my-card.js
1.72 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
import {
getBindtapData
} from '../../utils/util';
import {
productMap
} from '../../const/custom-data';
let app = getApp();
Page({
data: {
prizeInfo: []
},
onShareAppMessage() {},
onLoad(options) {
this.initData();
},
initData() {
app.post({
url: app.api.fishPrize,
data: {}
}).then((result) => {
let prizeInfo = result;
prizeInfo.forEach(element => {
element.endDateStr = new Date(element.endDate).toString("yy-MM-dd");
});
this.setData({
prizeInfo: prizeInfo
})
console.log("prizeInfo:", this.data.prizeInfo);
})
},
/**
* 显示券的详情
*/
onShowDetailHandler(evt) {
let curData = getBindtapData(evt);
if (curData.instanceCode) {
// 查看奖品
app.post({
url: app.api.wishbillGiftQuery,
data: {
instanceCode: curData.instanceCode
}
}).then((result) => {
// 合并奖品详情数据
curData = Object.assign(curData, result);
// 合并自定义数据
let product = productMap[curData.prizeDefineCode + ""];
curData = Object.assign(curData, product);
app.globalData.giftData = curData;
// console.log("app.globalData.giftData 333:", app.globalData.giftData);
// console.log(JSON.stringify(app.globalData.giftData));
app.router.push({
path: "prizeDetail"
})
})
} else {
app.globalData.curCoupon = curData;
app.router.push({
path: "couponDetail"
})
}
},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})