tips-prize-comp.js
2.28 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
let app = getApp();
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
innerText: {
type: String,
value: 'default value',
},
wishInfo: {
type: Object,
value: {},
},
// 1正常(有库存) 2无库存
status: {
type: Number,
status: 2
}
},
data: {
// 这里是一些组件内部数据
someData: {}
},
methods: {
// 这里是一个自定义方法
customMethod() {
this.triggerEvent('evtcomp', {
name: "_evt_custom"
})
},
// 隐藏蒙层
hideMask() {
this.triggerEvent('evtcomp', {
name: "_evt_hide_mask"
});
},
/**
* 提交礼品领取方式
*/
queryWishbillAcceptTypeSubmit(acceptType) {
return new Promise((resolve, reject) => {
let wishInfo = this.properties.wishInfo;
app.post({
url: app.api.wishbillAcceptTypeSubmit,
data: {
instanceCode: wishInfo.instanceCode,
acceptType: acceptType
}
}).then((result) => {
// 再查看奖品
app.post({
url: app.api.wishbillGiftQuery,
data: {
instanceCode: wishInfo.instanceCode
}
}).then((result) => {
let curData = app.globalData.giftData
curData = Object.assign(curData, result);
// modify 2019-09-20
// curData.order.coupon = JSON.parse(JSON.stringify(curData.order));
app.globalData.giftData = curData;
console.log("app.globalData.giftData 333:", app.globalData.giftData);
console.log(JSON.stringify(app.globalData.giftData));
resolve(result)
})
})
});
},
// 自提
toSelfLiftHandler() {
this.queryWishbillAcceptTypeSubmit(2).then((result) => {
let wishInfo = this.properties.wishInfo;
this.hideMask();
app.router.push({
path: "prizeDetail",
})
})
},
// 邮寄
toUserTableHandler() {
this.queryWishbillAcceptTypeSubmit(1).then((result) => {
let wishInfo = this.properties.wishInfo;
this.hideMask();
app.router.push({
path: "userTable",
})
})
},
}
})