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 { addToOreo } from '@/service/addToOreo';
|
||||||
import { pickTicket } from '@/service/pickTicket';
|
import { pickTicket } from '@/service/pickTicket';
|
||||||
import { retrieve } from '@/service/retrieve';
|
import { retrieve } from '@/service/retrieve';
|
||||||
|
import { changeStatus } from '@/service/changeStatus';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
||||||
|
|
@ -27,19 +28,21 @@ interface TicketDetailState {
|
||||||
id: number;
|
id: number;
|
||||||
isMember: boolean;
|
isMember: boolean;
|
||||||
showOreoModal: boolean;
|
showOreoModal: boolean;
|
||||||
showCommentModal: boolean;
|
showCommentLayout: boolean;
|
||||||
showRetrieveModal: boolean;
|
showRetrieveModal: boolean;
|
||||||
showStatusSheet: boolean;
|
showStatusSheet: boolean;
|
||||||
showPickModal: boolean;
|
showPickModal: boolean;
|
||||||
comment: string;
|
comment: string;
|
||||||
isLoading: boolean;
|
|
||||||
isDisable: boolean;
|
|
||||||
isOreoLoading: boolean;
|
isOreoLoading: boolean;
|
||||||
isOreoDisable: boolean;
|
isOreoDisable: boolean;
|
||||||
isPickLoading: boolean;
|
isPickLoading: boolean;
|
||||||
isPickDisable: boolean;
|
isPickDisable: boolean;
|
||||||
isRetrieveLoading: boolean;
|
isRetrieveLoading: boolean;
|
||||||
isRetrieveDisable: boolean;
|
isRetrieveDisable: boolean;
|
||||||
|
isStatusLoading: boolean;
|
||||||
|
isStatusDisable: boolean;
|
||||||
|
isCommentLoading: boolean;
|
||||||
|
isCommentDisable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
@ -47,19 +50,21 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
id: 0,
|
id: 0,
|
||||||
isMember: false,
|
isMember: false,
|
||||||
showOreoModal: false,
|
showOreoModal: false,
|
||||||
showCommentModal: false,
|
showCommentLayout: false,
|
||||||
showRetrieveModal: false,
|
showRetrieveModal: false,
|
||||||
showStatusSheet: false,
|
showStatusSheet: false,
|
||||||
showPickModal: false,
|
showPickModal: false,
|
||||||
comment: '',
|
comment: '',
|
||||||
isLoading: false,
|
|
||||||
isDisable: false,
|
|
||||||
isOreoLoading: false,
|
isOreoLoading: false,
|
||||||
isOreoDisable: false,
|
isOreoDisable: false,
|
||||||
isPickLoading: false,
|
isPickLoading: false,
|
||||||
isPickDisable: false,
|
isPickDisable: false,
|
||||||
isRetrieveLoading: false,
|
isRetrieveLoading: false,
|
||||||
isRetrieveDisable: false,
|
isRetrieveDisable: false,
|
||||||
|
isStatusLoading: false,
|
||||||
|
isStatusDisable: false,
|
||||||
|
isCommentLoading: false,
|
||||||
|
isCommentDisable: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
|
|
@ -79,7 +84,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
onAddComment(): void {
|
onAddComment(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showCommentModal: true,
|
showCommentLayout: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +114,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
handleCommentCancel(): void {
|
handleCommentCancel(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showCommentModal: false,
|
showCommentLayout: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,7 +181,15 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
handleStatusChange(status: number): void {
|
handleStatusChange(status: number): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
showStatusSheet: false,
|
showStatusSheet: false,
|
||||||
|
isStatusDisable: true,
|
||||||
});
|
});
|
||||||
|
changeStatus(this, status);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isStatusDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommentChange(comment: string) {
|
handleCommentChange(comment: string) {
|
||||||
|
|
@ -188,7 +201,8 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
|
|
||||||
onCommentSubmit() {
|
onCommentSubmit() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: true,
|
isCommentDisable: true,
|
||||||
|
showCommentLayout: false,
|
||||||
});
|
});
|
||||||
if (this.state.comment == '') {
|
if (this.state.comment == '') {
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
|
|
@ -197,7 +211,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isCommentDisable: false,
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
return;
|
return;
|
||||||
|
|
@ -205,7 +219,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
submitComment(this);
|
submitComment(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isCommentDisable: false,
|
||||||
});
|
});
|
||||||
}, submitInterval);
|
}, submitInterval);
|
||||||
}
|
}
|
||||||
|
|
@ -252,15 +266,25 @@ 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.onChangeStatus.bind(this)}>
|
<AtButton
|
||||||
{pt.get().ticketDetail.status.button}
|
loading={this.state.isStatusLoading}
|
||||||
|
disabled={this.state.isStatusDisable}
|
||||||
|
type='secondary'
|
||||||
|
onClick={this.onChangeStatus.bind(this)}
|
||||||
|
>
|
||||||
|
{pt.get().ticketDetail.addNote}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
className='at-col'
|
className='at-col'
|
||||||
style={{ marginLeft: 10, paddingRight: 5, width: '50%' }}
|
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}
|
{pt.get().ticketDetail.addNote}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -288,7 +312,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
className='at-col'
|
className='at-col'
|
||||||
style={{ marginRight: 10, paddingLeft: 5, width: '50%' }}
|
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}
|
{pt.get().ticketDetail.addNote}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
@ -336,12 +365,11 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
content={pt.get().modal.pick.content}
|
content={pt.get().modal.pick.content}
|
||||||
/>
|
/>
|
||||||
<AtFloatLayout
|
<AtFloatLayout
|
||||||
isOpened={this.state.showCommentModal}
|
isOpened={this.state.showCommentLayout}
|
||||||
title={pt.get().ticketDetail.comment.title}
|
title={pt.get().ticketDetail.comment.title}
|
||||||
onClose={this.handleCommentCancel.bind(this)}
|
onClose={this.handleCommentCancel.bind(this)}
|
||||||
>
|
>
|
||||||
<AtForm onSubmit={this.onCommentSubmit.bind(this)}>
|
<AtForm onSubmit={this.onCommentSubmit.bind(this)}>
|
||||||
<AtMessage />
|
|
||||||
<AtTextarea
|
<AtTextarea
|
||||||
value={this.state.comment}
|
value={this.state.comment}
|
||||||
onChange={this.handleCommentChange.bind(this)}
|
onChange={this.handleCommentChange.bind(this)}
|
||||||
|
|
@ -349,12 +377,7 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
height={200}
|
height={200}
|
||||||
placeholder={pt.get().ticketDetail.comment.placeholder}
|
placeholder={pt.get().ticketDetail.comment.placeholder}
|
||||||
/>
|
/>
|
||||||
<AtButton
|
<AtButton formType='submit' type='primary'>
|
||||||
loading={this.state.isLoading}
|
|
||||||
formType='submit'
|
|
||||||
type='primary'
|
|
||||||
disabled={this.state.isDisable}
|
|
||||||
>
|
|
||||||
{pt.get().button.buttonText.submit}
|
{pt.get().button.buttonText.submit}
|
||||||
</AtButton>
|
</AtButton>
|
||||||
</AtForm>
|
</AtForm>
|
||||||
|
|
@ -384,6 +407,12 @@ export default class TicketDetail extends Component<{}, TicketDetailState> {
|
||||||
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 5)}>
|
<AtActionSheetItem onClick={this.handleStatusChange.bind(this, 5)}>
|
||||||
{pt.get().ticketDetail.status.status5}
|
{pt.get().ticketDetail.status.status5}
|
||||||
</AtActionSheetItem>
|
</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>
|
</AtActionSheet>
|
||||||
<DetailFramework
|
<DetailFramework
|
||||||
middleButton={middleButton}
|
middleButton={middleButton}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ interface StepItem {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusStr = '1' | '2' | '3' | '4' | '5';
|
type StatusStr = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7';
|
||||||
|
|
||||||
export interface TicketDetailText {
|
export interface TicketDetailText {
|
||||||
stepItems: Array<StepItem>;
|
stepItems: Array<StepItem>;
|
||||||
|
|
@ -29,6 +29,8 @@ export interface TicketDetailText {
|
||||||
status3: string;
|
status3: string;
|
||||||
status4: string;
|
status4: string;
|
||||||
status5: string;
|
status5: string;
|
||||||
|
status6: string;
|
||||||
|
status7: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,11 +44,14 @@ export const ticketDetailZhCn: TicketDetailText = {
|
||||||
createTicketMessage: '创建了维修',
|
createTicketMessage: '创建了维修',
|
||||||
statusModifyPrefix: '将维修状态更改为:',
|
statusModifyPrefix: '将维修状态更改为:',
|
||||||
statusModifyMessage: new Map<StatusStr, string>([
|
statusModifyMessage: new Map<StatusStr, string>([
|
||||||
|
['0', '已创建/交接中'],
|
||||||
['1', '维修中'],
|
['1', '维修中'],
|
||||||
['2', '2(?)'],
|
['2', '劝退待取回'],
|
||||||
['3', '3(?)'],
|
['3', '劝退已取回'],
|
||||||
['4', '维修成功待取回'],
|
['4', '维修成功待取回'],
|
||||||
['5', '维修成功已取回'],
|
['5', '维修成功已取回'],
|
||||||
|
['6', '维修翻车待取回'],
|
||||||
|
['7', '维修翻车已取回'],
|
||||||
]),
|
]),
|
||||||
descTitle: '问题描述',
|
descTitle: '问题描述',
|
||||||
infoTitle: '机主信息',
|
infoTitle: '机主信息',
|
||||||
|
|
@ -62,12 +67,14 @@ export const ticketDetailZhCn: TicketDetailText = {
|
||||||
button: '改变工单状态',
|
button: '改变工单状态',
|
||||||
title: '请选择要改变成为的状态',
|
title: '请选择要改变成为的状态',
|
||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
status0: '',
|
status0: '已创建/交接中',
|
||||||
status1: '',
|
status1: '维修中',
|
||||||
status2: '',
|
status2: '劝退待取回',
|
||||||
status3: '',
|
status3: '劝退已取回',
|
||||||
status4: '',
|
status4: '维修成功待取回',
|
||||||
status5: '',
|
status5: '维修成功已取回',
|
||||||
|
status6: '维修翻车待取回',
|
||||||
|
status7: '维修翻车已取回',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -81,11 +88,14 @@ export const ticketDetailEnUs: TicketDetailText = {
|
||||||
createTicketMessage: 'Created ticket',
|
createTicketMessage: 'Created ticket',
|
||||||
statusModifyPrefix: 'Modified repair status to: ',
|
statusModifyPrefix: 'Modified repair status to: ',
|
||||||
statusModifyMessage: new Map<StatusStr, string>([
|
statusModifyMessage: new Map<StatusStr, string>([
|
||||||
|
['0', 'Created / Handovering'],
|
||||||
['1', 'Repairing'],
|
['1', 'Repairing'],
|
||||||
['2', '2(?)'],
|
['2', 'Pending Retrieval (Refused)'],
|
||||||
['3', '3(?)'],
|
['3', 'Retrieved (Refused)'],
|
||||||
['4', 'Device to be retrieved'],
|
['4', 'Pending Retrieval (Finished)'],
|
||||||
['5', 'Ticket finished'],
|
['5', 'Retrieved (Finished)'],
|
||||||
|
['6', 'Pending Retrieval (Failed)'],
|
||||||
|
['7', 'Retrieved (Failed)'],
|
||||||
]),
|
]),
|
||||||
descTitle: 'Description',
|
descTitle: 'Description',
|
||||||
infoTitle: 'Contact',
|
infoTitle: 'Contact',
|
||||||
|
|
@ -102,11 +112,13 @@ export const ticketDetailEnUs: TicketDetailText = {
|
||||||
button: 'Modify Status',
|
button: 'Modify Status',
|
||||||
title: 'Please select the status you want to modify to',
|
title: 'Please select the status you want to modify to',
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
status0: '',
|
status0: 'Created / Handovering',
|
||||||
status1: '',
|
status1: 'Repairing',
|
||||||
status2: '',
|
status2: 'Pending Retrieval (Refused)',
|
||||||
status3: '',
|
status3: 'Retrieved (Refused)',
|
||||||
status4: '',
|
status4: 'Pending Retrieval (Finished)',
|
||||||
status5: '',
|
status5: 'Retrieved (Finished)',
|
||||||
|
status6: 'Pending Retrieval (Failed)',
|
||||||
|
status7: 'Retrieved (Failed)',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export const ticketListEnUs: TicketListText = {
|
||||||
[3, 'Retrieved (Refused)'],
|
[3, 'Retrieved (Refused)'],
|
||||||
[4, 'Pending Retrieval (Finished)'],
|
[4, 'Pending Retrieval (Finished)'],
|
||||||
[5, 'Retrieved (Finished)'],
|
[5, 'Retrieved (Finished)'],
|
||||||
[4, 'Pending Retrieval (Failed)'],
|
[6, 'Pending Retrieval (Failed)'],
|
||||||
[5, 'Retrieved (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 pt from '@/plain-text';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function retrieve(that: TicketDetail) {
|
export function retrieve(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isRetrieveLoading: true,
|
isRetrieveLoading: true,
|
||||||
|
|
@ -24,6 +26,11 @@ export function retrieve(that: TicketDetail) {
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
|
||||||
|
});
|
||||||
|
}, reLaunchInterval);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,11 @@ import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
const reLaunchInterval = 1000;
|
||||||
|
|
||||||
export function submitComment(that: TicketDetail) {
|
export function submitComment(that: TicketDetail) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isLoading: true,
|
isCommentLoading: true,
|
||||||
});
|
});
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/report'),
|
url: getUrl('/report'),
|
||||||
|
|
@ -18,17 +20,22 @@ export function submitComment(that: TicketDetail) {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
that.setState({
|
that.setState({
|
||||||
isLoading: false,
|
isCommentLoading: false,
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.success,
|
message: pt.get().button.submitText.success,
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.reLaunch({
|
||||||
|
url: '/pages/TicketDetail/TicketDetail?id=' + that.state.id,
|
||||||
|
});
|
||||||
|
}, reLaunchInterval);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
that.setState({
|
that.setState({
|
||||||
isLoading: false,
|
isCommentLoading: false,
|
||||||
});
|
});
|
||||||
Taro.atMessage({
|
Taro.atMessage({
|
||||||
message: pt.get().button.submitText.error + err.toString(),
|
message: pt.get().button.submitText.error + err.toString(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue