add changeStatus service
parent
3d5cd6c8da
commit
4640f89ea8
|
|
@ -20,6 +20,7 @@ import wechatUser from '@/wechat';
|
|||
import { addToOreo } from '@/service/addToOreo';
|
||||
import { pickTicket } from '@/service/pickTicket';
|
||||
import { retrieve } from '@/service/retrieve';
|
||||
import { changeStatus } from '@/service/changeStatus';
|
||||
|
||||
const submitInterval = 5000;
|
||||
|
||||
|
|
@ -40,6 +41,8 @@ interface TicketDetailState {
|
|||
isPickDisable: boolean;
|
||||
isRetrieveLoading: boolean;
|
||||
isRetrieveDisable: boolean;
|
||||
isStatusLoading: boolean;
|
||||
isStatusDisable: boolean;
|
||||
}
|
||||
|
||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||
|
|
@ -60,6 +63,8 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
isPickDisable: false,
|
||||
isRetrieveLoading: false,
|
||||
isRetrieveDisable: false,
|
||||
isStatusLoading: false,
|
||||
isStatusDisable: false,
|
||||
};
|
||||
|
||||
componentDidMount(): void {
|
||||
|
|
@ -176,7 +181,15 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
handleStatusChange(status: number): void {
|
||||
this.setState({
|
||||
showStatusSheet: false,
|
||||
isStatusDisable: true,
|
||||
});
|
||||
changeStatus(this, status);
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
isStatusDisable: false,
|
||||
});
|
||||
}, submitInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
handleCommentChange(comment: string) {
|
||||
|
|
@ -252,8 +265,13 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
className='at-col'
|
||||
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
||||
>
|
||||
<AtButton type='primary' onClick={this.onChangeStatus.bind(this)}>
|
||||
{pt.get().ticketDetail.status.button}
|
||||
<AtButton
|
||||
loading={this.state.isStatusLoading}
|
||||
disabled={this.state.isStatusDisable}
|
||||
type='secondary'
|
||||
onClick={this.onChangeStatus.bind(this)}
|
||||
>
|
||||
{pt.get().ticketDetail.addNote}
|
||||
</AtButton>
|
||||
</View>
|
||||
<View
|
||||
|
|
@ -288,7 +306,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
className='at-col'
|
||||
style={{ marginRight: 10, paddingLeft: 5, width: '50%' }}
|
||||
>
|
||||
<AtButton type='secondary' onClick={this.onChangeStatus.bind(this)}>
|
||||
<AtButton type='secondary' onClick={this.onAddComment.bind(this)}>
|
||||
{pt.get().ticketDetail.addNote}
|
||||
</AtButton>
|
||||
</View>
|
||||
|
|
@ -384,6 +402,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 5)}>
|
||||
{pt.get().ticketDetail.status.status5}
|
||||
</AtActionSheetItem>
|
||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 6)}>
|
||||
{pt.get().ticketDetail.status.status6}
|
||||
</AtActionSheetItem>
|
||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 7)}>
|
||||
{pt.get().ticketDetail.status.status7}
|
||||
</AtActionSheetItem>
|
||||
</AtActionSheet>
|
||||
<DetailFramework
|
||||
middleButton={middleButton}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ interface StepItem {
|
|||
title: string;
|
||||
}
|
||||
|
||||
type StatusStr = '1' | '2' | '3' | '4' | '5';
|
||||
type StatusStr = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7';
|
||||
|
||||
export interface TicketDetailText {
|
||||
stepItems: Array<StepItem>;
|
||||
|
|
@ -29,6 +29,8 @@ export interface TicketDetailText {
|
|||
status3: string;
|
||||
status4: string;
|
||||
status5: string;
|
||||
status6: string;
|
||||
status7: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -42,11 +44,14 @@ export const ticketDetailZhCn: TicketDetailText = {
|
|||
createTicketMessage: '创建了维修',
|
||||
statusModifyPrefix: '将维修状态更改为:',
|
||||
statusModifyMessage: new Map<StatusStr, string>([
|
||||
['0', '已创建/交接中'],
|
||||
['1', '维修中'],
|
||||
['2', '2(?)'],
|
||||
['3', '3(?)'],
|
||||
['2', '劝退待取回'],
|
||||
['3', '劝退已取回'],
|
||||
['4', '维修成功待取回'],
|
||||
['5', '维修成功已取回'],
|
||||
['6', '维修翻车待取回'],
|
||||
['7', '维修翻车已取回'],
|
||||
]),
|
||||
descTitle: '问题描述',
|
||||
infoTitle: '机主信息',
|
||||
|
|
@ -62,12 +67,14 @@ export const ticketDetailZhCn: TicketDetailText = {
|
|||
button: '改变工单状态',
|
||||
title: '请选择要改变成为的状态',
|
||||
cancel: '取消',
|
||||
status0: '',
|
||||
status1: '',
|
||||
status2: '',
|
||||
status3: '',
|
||||
status4: '',
|
||||
status5: '',
|
||||
status0: '已创建/交接中',
|
||||
status1: '维修中',
|
||||
status2: '劝退待取回',
|
||||
status3: '劝退已取回',
|
||||
status4: '维修成功待取回',
|
||||
status5: '维修成功已取回',
|
||||
status6: '维修翻车待取回',
|
||||
status7: '维修翻车已取回',
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -81,11 +88,14 @@ export const ticketDetailEnUs: TicketDetailText = {
|
|||
createTicketMessage: 'Created ticket',
|
||||
statusModifyPrefix: 'Modified repair status to: ',
|
||||
statusModifyMessage: new Map<StatusStr, string>([
|
||||
['0', 'Created / Handovering'],
|
||||
['1', 'Repairing'],
|
||||
['2', '2(?)'],
|
||||
['3', '3(?)'],
|
||||
['4', 'Device to be retrieved'],
|
||||
['5', 'Ticket finished'],
|
||||
['2', 'Pending Retrieval (Refused)'],
|
||||
['3', 'Retrieved (Refused)'],
|
||||
['4', 'Pending Retrieval (Finished)'],
|
||||
['5', 'Retrieved (Finished)'],
|
||||
['6', 'Pending Retrieval (Failed)'],
|
||||
['7', 'Retrieved (Failed)'],
|
||||
]),
|
||||
descTitle: 'Description',
|
||||
infoTitle: 'Contact',
|
||||
|
|
@ -102,11 +112,13 @@ export const ticketDetailEnUs: TicketDetailText = {
|
|||
button: 'Modify Status',
|
||||
title: 'Please select the status you want to modify to',
|
||||
cancel: 'Cancel',
|
||||
status0: '',
|
||||
status1: '',
|
||||
status2: '',
|
||||
status3: '',
|
||||
status4: '',
|
||||
status5: '',
|
||||
status0: 'Created / Handovering',
|
||||
status1: 'Repairing',
|
||||
status2: 'Pending Retrieval (Refused)',
|
||||
status3: 'Retrieved (Refused)',
|
||||
status4: 'Pending Retrieval (Finished)',
|
||||
status5: 'Retrieved (Finished)',
|
||||
status6: 'Pending Retrieval (Failed)',
|
||||
status7: 'Retrieved (Failed)',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export const ticketListEnUs: TicketListText = {
|
|||
[3, 'Retrieved (Refused)'],
|
||||
[4, 'Pending Retrieval (Finished)'],
|
||||
[5, 'Retrieved (Finished)'],
|
||||
[4, 'Pending Retrieval (Failed)'],
|
||||
[5, 'Retrieved (Failed)'],
|
||||
[6, 'Pending Retrieval (Failed)'],
|
||||
[7, 'Retrieved (Failed)'],
|
||||
]),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
export function changeStatus(that: TicketDetail, status: number) {
|
||||
that.setState({
|
||||
isStatusLoading: true,
|
||||
});
|
||||
Taro.request({
|
||||
url: getUrl('/tickets/update'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
token: 'token_test',
|
||||
id: that.state.id,
|
||||
status: status,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
that.setState({
|
||||
isStatusLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.success,
|
||||
type: 'success',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
that.setState({
|
||||
isStatusLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue