add retrieve in service
parent
7ced70ab21
commit
3d5cd6c8da
11
doc/api.md
11
doc/api.md
|
|
@ -215,6 +215,17 @@ Request
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 确认已取回 `POST /tickets/retrieve`
|
||||||
|
|
||||||
|
Request
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"token": "token_test",
|
||||||
|
"id": "id",
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 获取七天内未完成工单 `POST /tickets/uncompleted`
|
### 获取七天内未完成工单 `POST /tickets/uncompleted`
|
||||||
|
|
||||||
Request
|
Request
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@ export default {
|
||||||
'POST /tickets/update': {
|
'POST /tickets/update': {
|
||||||
data: {},
|
data: {},
|
||||||
},
|
},
|
||||||
|
'POST /tickets/retrieve': {
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
'POST /member/login': {
|
'POST /member/login': {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export class TicketListItem {
|
||||||
[2, clock],
|
[2, clock],
|
||||||
[3, finished],
|
[3, finished],
|
||||||
[4, clock],
|
[4, clock],
|
||||||
[5, finished],
|
[5, tick],
|
||||||
[6, clock],
|
[6, clock],
|
||||||
[7, fail],
|
[7, fail],
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import Taro from '@tarojs/taro';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import { addToOreo } from '@/service/addToOreo';
|
import { addToOreo } from '@/service/addToOreo';
|
||||||
import { pickTicket } from '@/service/pickTicket';
|
import { pickTicket } from '@/service/pickTicket';
|
||||||
|
import { retrieve } from '@/service/retrieve';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
||||||
|
|
@ -37,6 +38,8 @@ interface TicketDetailState {
|
||||||
isOreoDisable: boolean;
|
isOreoDisable: boolean;
|
||||||
isPickLoading: boolean;
|
isPickLoading: boolean;
|
||||||
isPickDisable: boolean;
|
isPickDisable: boolean;
|
||||||
|
isRetrieveLoading: boolean;
|
||||||
|
isRetrieveDisable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
@ -55,6 +58,8 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
isOreoDisable: false,
|
isOreoDisable: false,
|
||||||
isPickLoading: false,
|
isPickLoading: false,
|
||||||
isPickDisable: false,
|
isPickDisable: false,
|
||||||
|
isRetrieveLoading: false,
|
||||||
|
isRetrieveDisable: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
|
|
@ -140,11 +145,17 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommentConfirm(): void {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleRetrieveConfirm(): void {
|
handleRetrieveConfirm(): void {
|
||||||
|
this.setState({
|
||||||
|
isRetrieveDisable: true,
|
||||||
|
showRetrieveModal: false,
|
||||||
|
});
|
||||||
|
retrieve(this);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isRetrieveDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +275,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
className='at-col'
|
className='at-col'
|
||||||
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
||||||
>
|
>
|
||||||
<AtButton type='primary' onClick={this.onRetrieved.bind(this)}>
|
<AtButton
|
||||||
|
loading={this.state.isRetrieveLoading}
|
||||||
|
disabled={this.state.isRetrieveDisable}
|
||||||
|
type='primary'
|
||||||
|
onClick={this.onRetrieved.bind(this)}
|
||||||
|
>
|
||||||
{pt.get().ticketDetail.tookAway}
|
{pt.get().ticketDetail.tookAway}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import pt from '@/plain-text';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function retrieve(that: TicketDetail) {
|
||||||
|
that.setState({
|
||||||
|
isRetrieveLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/tickets/retrieve'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
id: that.state.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isRetrieveLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
that.setState({
|
||||||
|
isRetrieveLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.error + err.toString(),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue