pointOrderDetailLogic.js
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {observable} from 'mobx'
import {_pointOrderDetail,_sign} from "../integralMall/utils/AppService";
import { xnToast } from '../../utils/utils';
export default class pointOrderDetailLogic{
id=""
@observable
phone=""
@observable
name=""
@observable
address=""
@observable
items=[]
@observable
orderNum=""
@observable
status=""
rowVersion=""
@observable
loading=true
@observable
isVirtual=false
async get(){
try{
const data=await _pointOrderDetail({
id:this.id
})
const {errors, firstErrorMessage,orderShipping,orderLogisticsList,order} = data
if (errors.length > 0) {
xnToast(firstErrorMessage)
} else {
const {cityName,districtName,provinceName,address,contactName,contactPhone}=orderShipping
this.name=contactName
this.phone=contactPhone
this.address=provinceName+cityName+districtName+address
const {orderLineList,number,status,rowVersion}=order
this.items.replace(orderLineList)
this.orderNum=number
this.status=status
this.rowVersion=rowVersion
this.isVirtual=order.orderLineList[0].isVirtual
}
}catch(e){
}
this.loading=false
}
async sign(){
try{
const data=await _sign({
id:this.id,
type:"MEMBER",
rowVersion:this.rowVersion
})
const {errors, firstErrorMessage,} = data
if (errors.length > 0) {
xnToast(firstErrorMessage)
return false
} else {
return true
}
}catch(e){
console.log(e)
}
}
}