applyActivity.js
2.83 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import activityApi from "~/api/activityApi/index"
import {
reportData
} from '~/api/api.js'
Page({
data: {
list: [
{
name: '新车洽谈场景',
tip: '1.0 新车权益销售',
},
{
name: '新车交付场景',
tip: '1.1 新车精品升级',
},
{
name: '0-12个月',
tip: '1.2 新车线上转化',
},
{
name: '12个月以上',
tip: '1.3 存量用户众筹',
},
],
currentIndex: 0,
product: [
{
id: 1,
name: '360全景导航',
isSelect: false
},
{
id: 2,
name: '360全景导航',
isSelect: false
},
{
id: 3,
name: '360全景导航',
isSelect: false
},
{
id: 4,
name: '360全景导航',
isSelect: false
},
{
id: 5,
name: '360全景导航',
isSelect: false
}
]
},
select(e) {
const { index } = e.currentTarget.dataset
this.setData({
currentIndex: index
})
},
selectProduct(e) {
const { item, index } = e.currentTarget.dataset
let name = `product[${index}].isSelect`
this.setData({
[name]: !item.isSelect
})
},
// 申请开通
applyOpened() {
// 获取已选的产品code
let { product, currentIndex } = this.data
let arr = []
product.forEach(val => {
if (val.isSelect) arr.push(val.id)
})
console.log(reportData)
const {
USERINFO
} = this.getCommonData()
reportData({
openId: USERINFO.weChatOpenId || '',
unionId: USERINFO.uuid || '',
nickName: USERINFO.weChatNickName || '',
avatar: USERINFO.weChatAvatarUrl || '',
phone: USERINFO.weChatPhone || '',
shopId: USERINFO.merchantId || '',
shopName: USERINFO.merchantName || '',
shareOpenId: USERINFO.weChatOpenId || '',
}, 2).then(res => {
console.log(res)
})
if (!arr.length) return wx.showToast({
title: '请选择产品/活动',
icon: "none"
})
activityApi.applyActivity({
serviceMerchantId: 1,
merchantId: 2,
sceneCode: currentIndex,
productCodes: arr
}).then(res => {
if (res.code == 200) {
const {
USERINFO
} = this.getCommonData()
reportData({
openId: USERINFO.weChatOpenId || '',
unionId: USERINFO.uuid || '',
nickName: USERINFO.weChatNickName || '',
avatar: USERINFO.weChatAvatarUrl || '',
phone: USERINFO.weChatPhone || '',
merchantId: USERINFO.merchantId || ''
}).then(res => {
console.log(res)
})
wx.$router.go('packageActivity.applySuccess')
}
})
},
getCommonData() {
const USERINFO = wx.$storage.get('userInfo')
return {
USERINFO
}
}
})