|
@@ -8,12 +8,6 @@
|
8
|
8
|
<a class="iconfont iconguanbi Close" @click="DeleteItem(index)"></a>
|
9
|
9
|
<div class="flex-h">
|
10
|
10
|
<span class="flex-item">{{ReturnType(item)}}<em>{{item.Count}}</em>注<em>{{item.Count * 2}}</em>元</span>
|
11
|
|
- <span>
|
12
|
|
- <a class="iconfont iconjianhao" @click="MultipleLess(item)"></a>
|
13
|
|
- <input type="number" v-model="item.Multiple" disabled="disabled">
|
14
|
|
- <span>倍</span>
|
15
|
|
- <a class="iconfont iconjiahao" @click="MultipleMore(item)"></a>
|
16
|
|
- </span>
|
17
|
11
|
</div>
|
18
|
12
|
<ul>
|
19
|
13
|
<li v-for="(subItem, subIndex) in item.SortArr" :key="subIndex" :class="{'active': !subItem.IsFirst}">
|
|
@@ -27,10 +21,21 @@
|
27
|
21
|
</ul>
|
28
|
22
|
|
29
|
23
|
<div class="OtherTab">
|
30
|
|
- <div class="flex-h">
|
31
|
|
- <span class="flex-item">是否追期?</span>
|
32
|
|
- <span>追号喜中二等奖</span>
|
33
|
|
- <van-switch v-model="IsAdd" active-color="#07c160" inactive-color="#ccc" size="0.13rem" @change="SwitchChange" />
|
|
24
|
+ <div>
|
|
25
|
+ <div class="flex-h">
|
|
26
|
+ <span class="flex-item">加倍</span>
|
|
27
|
+ <span>
|
|
28
|
+ <a class="iconfont iconjianhao" @click="Multiple = Multiple > 1 ? Multiple - 1 : 1"></a>
|
|
29
|
+ <input type="number" disabled="disabled" v-model="Multiple">
|
|
30
|
+ <span>倍</span>
|
|
31
|
+ <a class="iconfont iconjiahao" @click="Multiple += 1"></a>
|
|
32
|
+ </span>
|
|
33
|
+ </div>
|
|
34
|
+ <div class="flex-h">
|
|
35
|
+ <span class="flex-item">是否追期?</span>
|
|
36
|
+ <span>追号喜中二等奖</span>
|
|
37
|
+ <van-switch v-model="IsAdd" active-color="#07c160" inactive-color="#ccc" size="0.13rem" @change="SwitchChange" />
|
|
38
|
+ </div>
|
34
|
39
|
</div>
|
35
|
40
|
</div>
|
36
|
41
|
|
|
@@ -38,56 +43,65 @@
|
38
|
43
|
</div>
|
39
|
44
|
<div class="Bottom">
|
40
|
45
|
<div class="Store">
|
41
|
|
- <a @click="ShowStore = true">店铺:请选择</a>
|
|
46
|
+ <a @click="ShowStore = true">店铺:{{CurrentStoreName || '请选择'}}</a>
|
42
|
47
|
</div>
|
43
|
48
|
<div class="Count">
|
44
|
49
|
<span><em>{{TotalCount}}</em>注</span>
|
45
|
50
|
<span>金额:<em>{{TotalPrize}}</em>元</span>
|
46
|
51
|
</div>
|
47
|
|
- <a>立即购买</a>
|
|
52
|
+ <a @click="ToPostBetting" :class="{'active': CurrentStoreId !== null && ShuangSeQiuCart.length}">立即购买</a>
|
48
|
53
|
</div>
|
|
54
|
+
|
49
|
55
|
<div class="Layer" v-if="ShowStore">
|
50
|
56
|
<div class="centerLabel">
|
51
|
|
- <span>推荐店铺:</span>
|
52
|
|
- <ul>
|
53
|
|
- <li v-for="(item, index) in 3" :key="index" class="flex-h">
|
|
57
|
+ <span v-if="RecommendStoreList.length">推荐店铺:</span>
|
|
58
|
+ <ul v-if="RecommendStoreList.length">
|
|
59
|
+ <li v-for="(item, index) in RecommendStoreList" :key="index" v-if="item.status - 0 === 1" class="flex-h" @click="SelectStore(item)">
|
54
|
60
|
<div class="flex-item">
|
55
|
61
|
<div>
|
56
|
|
- <span>彩票供销社{{index + 1}}</span>
|
|
62
|
+ <span>{{item.name}}</span>
|
57
|
63
|
</div>
|
58
|
64
|
</div>
|
59
|
|
- <i class="iconfont iconweigouxuan"></i>
|
|
65
|
+ <i class="iconfont iconweigouxuan" v-if="item.shopId !== CurrentStoreId"></i>
|
|
66
|
+ <i class="iconfont iconyigouxuan active" v-else></i>
|
60
|
67
|
</li>
|
61
|
68
|
</ul>
|
62
|
69
|
<span>选择附近店铺:</span>
|
63
|
70
|
<ul class="ScrollList">
|
64
|
|
- <li v-for="(item, index) in 20" :key="index" class="flex-h">
|
|
71
|
+ <li v-for="(item, index) in StoreList" :key="index" v-if="item.status - 0 === 1" class="flex-h" @click="SelectStore(item)">
|
65
|
72
|
<div class="flex-item">
|
66
|
73
|
<div>
|
67
|
|
- <span>彩票供销社{{index + 1}}</span>
|
|
74
|
+ <span>{{item.name}}</span>
|
68
|
75
|
</div>
|
69
|
76
|
</div>
|
70
|
|
- <span>200m</span>
|
71
|
|
- <i class="iconfont iconweigouxuan"></i>
|
|
77
|
+ <!-- <span>200m</span> -->
|
|
78
|
+ <i class="iconfont iconweigouxuan" v-if="item.shopId !== CurrentStoreId"></i>
|
|
79
|
+ <i class="iconfont iconyigouxuan active" v-else></i>
|
72
|
80
|
</li>
|
73
|
81
|
</ul>
|
74
|
82
|
<div class="Bottom flex-h">
|
75
|
|
- <a class="flex-item" @click="ShowStore = false">取消</a>
|
76
|
|
- <a class="flex-item active">确定</a>
|
|
83
|
+ <a class="flex-item" @click="CurrentStoreId = null; CurrentStoreName = null; ShowStore = false">取消</a>
|
|
84
|
+ <a class="flex-item active" @click="ShowStore = false">确定</a>
|
77
|
85
|
</div>
|
78
|
86
|
</div>
|
79
|
87
|
</div>
|
|
88
|
+
|
80
|
89
|
</div>
|
81
|
90
|
</template>
|
82
|
91
|
|
83
|
92
|
<script>
|
84
|
93
|
import { Switch } from 'vant'
|
85
|
94
|
import { mapMutations, createNamespacedHelpers } from 'vuex'
|
86
|
|
-const { mapState: mapUserState, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
|
|
95
|
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
|
87
|
96
|
export default {
|
88
|
97
|
name: '',
|
89
|
98
|
data () {
|
90
|
99
|
return {
|
|
100
|
+ CurrentStoreName: null, // 当前选择店铺名称
|
|
101
|
+ CurrentStoreId: null, // 当前选择店铺id
|
|
102
|
+ RecommendStoreList: [], // 推荐店铺列表
|
|
103
|
+ StoreList: [], // 店铺列表
|
|
104
|
+ Multiple: 1, // 倍数
|
91
|
105
|
ShowStore: false, // 是否显示店铺选择弹窗
|
92
|
106
|
TotalCount: 0, // 总注数
|
93
|
107
|
TotalPrize: 0, // 总金额
|
|
@@ -112,6 +126,15 @@ export default {
|
112
|
126
|
])
|
113
|
127
|
this.PageList = [...this.ShuangSeQiuCart]
|
114
|
128
|
this.CheckOrderCount() // 计算订单倍数、金额
|
|
129
|
+ this.GetStoreList({
|
|
130
|
+ queryData: {
|
|
131
|
+ location: '114.16936109999999,22.3193039',
|
|
132
|
+ lotteryId: 'double-color'
|
|
133
|
+ }
|
|
134
|
+ }).then((res) => {
|
|
135
|
+ this.StoreList = res.data.data.nearest || []
|
|
136
|
+ this.RecommendStoreList = res.data.data.recommend || []
|
|
137
|
+ })
|
115
|
138
|
},
|
116
|
139
|
mounted () {
|
117
|
140
|
this.$nextTick(() => {
|
|
@@ -124,6 +147,66 @@ export default {
|
124
|
147
|
...mapUserMutations([
|
125
|
148
|
'DeleteShuangSeQiuCart'
|
126
|
149
|
]),
|
|
150
|
+ ...mapUserActions([
|
|
151
|
+ 'PostBetting',
|
|
152
|
+ 'GetStoreList'
|
|
153
|
+ ]),
|
|
154
|
+ ToPostBetting () { // 去下注
|
|
155
|
+ if (this.DataLock || !this.ShuangSeQiuCart.length || this.CurrentStoreId === null) return
|
|
156
|
+ this.DataLock = true
|
|
157
|
+ let ListData = []
|
|
158
|
+ this.ShuangSeQiuCart.map((item) => {
|
|
159
|
+ item.FirstRes.Dan.sort((a, b) => { return a - b })
|
|
160
|
+ item.FirstRes.Tuo.sort((a, b) => { return a - b })
|
|
161
|
+ item.LastRes.Dan.sort((a, b) => { return a - b })
|
|
162
|
+ item.LastRes.Tuo.sort((a, b) => { return a - b })
|
|
163
|
+ ListData.push({
|
|
164
|
+ amount: item.Count, // 购买注数
|
|
165
|
+ charges: item.Count * 2 * 100, // 价格
|
|
166
|
+ firstDan: item.FirstRes.Dan.join(','), // 前区胆号, 逗号连接
|
|
167
|
+ firstNums: item.FirstRes.Tuo.join(','), // 前区其余数字, 逗号连接
|
|
168
|
+ isDan: !!item.FirstRes.Dan.length, // 是否胆拖
|
|
169
|
+ isMulti: item.Count > 1, // 是否复式
|
|
170
|
+ secondDan: item.LastRes.Dan.join(','), // 后区胆号, 逗号连接
|
|
171
|
+ secondNums: item.LastRes.Tuo.join(',') // 后区其余数字, 逗号连接
|
|
172
|
+ })
|
|
173
|
+ })
|
|
174
|
+ let Data = {
|
|
175
|
+ itemList: [...ListData], // 这个是详细购买方案的列表
|
|
176
|
+ lotteryId: 'double-color', // 彩种ID
|
|
177
|
+ notesNum: this.TotalCount, // 总注数
|
|
178
|
+ shopId: this.CurrentStoreId, // 店铺ID
|
|
179
|
+ times: this.Multiple, // 倍数
|
|
180
|
+ totalPrice: this.TotalPrize * this.Multiple * 100 // 总金额
|
|
181
|
+ }
|
|
182
|
+ this.PostBetting({
|
|
183
|
+ urlData: { id: 'double-color' },
|
|
184
|
+ data: { ...Data }
|
|
185
|
+ }).then((res) => {
|
|
186
|
+ this.Dialog.alert({
|
|
187
|
+ message: '投注成功!'
|
|
188
|
+ })
|
|
189
|
+ this.EmptyShuangSeQiuCart()
|
|
190
|
+ this.PageList = []
|
|
191
|
+ this.TotalCount = 0
|
|
192
|
+ this.TotalPrize = 0
|
|
193
|
+ this.Multiple = 1
|
|
194
|
+ this.DataLock = false
|
|
195
|
+ }).catch((res) => {
|
|
196
|
+ this.Dialog.alert({
|
|
197
|
+ title: '错误',
|
|
198
|
+ message: res.data.message
|
|
199
|
+ })
|
|
200
|
+ this.DataLock = false
|
|
201
|
+ })
|
|
202
|
+ },
|
|
203
|
+ SelectStore (item) { // 选择店铺
|
|
204
|
+ if (this.DataLock) return
|
|
205
|
+ this.DataLock = true
|
|
206
|
+ this.CurrentStoreName = item.shopId === this.CurrentStoreId ? null : item.name
|
|
207
|
+ this.CurrentStoreId = item.shopId === this.CurrentStoreId ? null : item.shopId
|
|
208
|
+ this.DataLock = false
|
|
209
|
+ },
|
127
|
210
|
SwitchChange () { // 追加状态改变
|
128
|
211
|
this.CheckOrderCount()
|
129
|
212
|
},
|
|
@@ -160,10 +243,9 @@ export default {
|
160
|
243
|
CheckOrderCount () { // 计算订单倍数、金额
|
161
|
244
|
let Count = 0 // 注数
|
162
|
245
|
let Money = 0 // 金额
|
163
|
|
- let ItemPrize = this.IsAdd ? 3 : 2
|
164
|
246
|
this.PageList.map((item) => {
|
165
|
247
|
Count += item.Count
|
166
|
|
- Money += item.Count * item.Multiple * ItemPrize
|
|
248
|
+ Money += item.Count * item.Multiple * 2
|
167
|
249
|
})
|
168
|
250
|
this.TotalCount = Count
|
169
|
251
|
this.TotalPrize = Money
|