Compare commits
2 Commits
3d5cd6c8da
...
cd3064c90f
| Author | SHA1 | Date |
|---|---|---|
|
|
cd3064c90f | |
|
|
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;
|
||||
|
||||
|
|
@ -27,19 +28,21 @@ interface TicketDetailState {
|
|||
id: number;
|
||||
isMember: boolean;
|
||||
showOreoModal: boolean;
|
||||
showCommentModal: boolean;
|
||||
showCommentLayout: boolean;
|
||||
showRetrieveModal: boolean;
|
||||
showStatusSheet: boolean;
|
||||
showPickModal: boolean;
|
||||
comment: string;
|
||||
isLoading: boolean;
|
||||
isDisable: boolean;
|
||||
isOreoLoading: boolean;
|
||||
isOreoDisable: boolean;
|
||||
isPickLoading: boolean;
|
||||
isPickDisable: boolean;
|
||||
isRetrieveLoading: boolean;
|
||||
isRetrieveDisable: boolean;
|
||||
isStatusLoading: boolean;
|
||||
isStatusDisable: boolean;
|
||||
isCommentLoading: boolean;
|
||||
isCommentDisable: boolean;
|
||||
}
|
||||
|
||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||
|
|
@ -47,19 +50,21 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
id: 0,
|
||||
isMember: false,
|
||||
showOreoModal: false,
|
||||
showCommentModal: false,
|
||||
showCommentLayout: false,
|
||||
showRetrieveModal: false,
|
||||
showStatusSheet: false,
|
||||
showPickModal: false,
|
||||
comment: '',
|
||||
isLoading: false,
|
||||
isDisable: false,
|
||||
isOreoLoading: false,
|
||||
isOreoDisable: false,
|
||||
isPickLoading: false,
|
||||
isPickDisable: false,
|
||||
isRetrieveLoading: false,
|
||||
isRetrieveDisable: false,
|
||||
isStatusLoading: false,
|
||||
isStatusDisable: false,
|
||||
isCommentLoading: false,
|
||||
isCommentDisable: false,
|
||||
};
|
||||
|
||||
componentDidMount(): void {
|
||||
|
|
@ -79,7 +84,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
|
||||
onAddComment(): void {
|
||||
this.setState({
|
||||
showCommentModal: true,
|
||||
showCommentLayout: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +114,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
|
||||
handleCommentCancel(): void {
|
||||
this.setState({
|
||||
showCommentModal: false,
|
||||
showCommentLayout: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
@ -188,7 +201,8 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
|
||||
onCommentSubmit() {
|
||||
this.setState({
|
||||
isDisable: true,
|
||||
isCommentDisable: true,
|
||||
showCommentLayout: false,
|
||||
});
|
||||
if (this.state.comment == '') {
|
||||
Taro.atMessage({
|
||||
|
|
@ -197,7 +211,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
});
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
isDisable: false,
|
||||
isCommentDisable: false,
|
||||
});
|
||||
}, submitInterval);
|
||||
return;
|
||||
|
|
@ -205,7 +219,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
submitComment(this);
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
isDisable: false,
|
||||
isCommentDisable: false,
|
||||
});
|
||||
}, submitInterval);
|
||||
}
|
||||
|
|
@ -252,15 +266,25 @@ 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
|
||||
className='at-col'
|
||||
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
||||
>
|
||||
<AtButton type='secondary' onClick={this.onAddComment.bind(this)}>
|
||||
<AtButton
|
||||
disabled={this.state.isCommentDisable}
|
||||
loading={this.state.isCommentLoading}
|
||||
type='secondary'
|
||||
onClick={this.onAddComment.bind(this)}
|
||||
>
|
||||
{pt.get().ticketDetail.addNote}
|
||||
</AtButton>
|
||||
</View>
|
||||
|
|
@ -288,7 +312,12 @@ 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
|
||||
disabled={this.state.isCommentDisable}
|
||||
loading={this.state.isCommentLoading}
|
||||
type='secondary'
|
||||
onClick={this.onAddComment.bind(this)}
|
||||
>
|
||||
{pt.get().ticketDetail.addNote}
|
||||
</AtButton>
|
||||
</View>
|
||||
|
|
@ -336,12 +365,11 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
content={pt.get().modal.pick.content}
|
||||
/>
|
||||
<AtFloatLayout
|
||||
isOpened={this.state.showCommentModal}
|
||||
isOpened={this.state.showCommentLayout}
|
||||
title={pt.get().ticketDetail.comment.title}
|
||||
onClose={this.handleCommentCancel.bind(this)}
|
||||
>
|
||||
<AtForm onSubmit={this.onCommentSubmit.bind(this)}>
|
||||
<AtMessage />
|
||||
<AtTextarea
|
||||
value={this.state.comment}
|
||||
onChange={this.handleCommentChange.bind(this)}
|
||||
|
|
@ -349,12 +377,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
|||
height={200}
|
||||
placeholder={pt.get().ticketDetail.comment.placeholder}
|
||||
/>
|
||||
<AtButton
|
||||
loading={this.state.isLoading}
|
||||
formType='submit'
|
||||
type='primary'
|
||||
disabled={this.state.isDisable}
|
||||
>
|
||||
<AtButton formType='submit' type='primary'>
|
||||
{pt.get().button.buttonText.submit}
|
||||
</AtButton>
|
||||
</AtForm>
|
||||
|
|
@ -384,6 +407,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,46 @@
|
|||
import TicketDetail from '@/pages/TicketDetail/TicketDetail';
|
||||
import Taro from '@tarojs/taro';
|
||||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
||||
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',
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
|
||||
});
|
||||
}, reLaunchInterval);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
that.setState({
|
||||
isStatusLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ import Taro from '@tarojs/taro';
|
|||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
||||
export function retrieve(that: TicketDetail) {
|
||||
that.setState({
|
||||
isRetrieveLoading: true,
|
||||
|
|
@ -24,6 +26,11 @@ export function retrieve(that: TicketDetail) {
|
|||
message: pt.get().button.submitText.success,
|
||||
type: 'success',
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
|
||||
});
|
||||
}, reLaunchInterval);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ import Taro from '@tarojs/taro';
|
|||
import pt from '@/plain-text';
|
||||
import { getUrl } from '.';
|
||||
|
||||
const reLaunchInterval = 1000;
|
||||
|
||||
export function submitComment(that: TicketDetail) {
|
||||
that.setState({
|
||||
isLoading: true,
|
||||
isCommentLoading: true,
|
||||
});
|
||||
Taro.request({
|
||||
url: getUrl('/report'),
|
||||
|
|
@ -18,17 +20,22 @@ export function submitComment(that: TicketDetail) {
|
|||
.then((res) => {
|
||||
console.log(res.data);
|
||||
that.setState({
|
||||
isLoading: false,
|
||||
isCommentLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.success,
|
||||
type: 'success',
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
|
||||
});
|
||||
}, reLaunchInterval);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
that.setState({
|
||||
isLoading: false,
|
||||
isCommentLoading: false,
|
||||
});
|
||||
Taro.atMessage({
|
||||
message: pt.get().button.submitText.error + err.toString(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue