正在显示
5 个修改的文件
包含
279 行增加
和
118 行删除
@@ -772,7 +772,13 @@ | @@ -772,7 +772,13 @@ | ||
772 | line-height: 88rpx; | 772 | line-height: 88rpx; |
773 | border-radius: 10rpx; | 773 | border-radius: 10rpx; |
774 | } | 774 | } |
775 | - | 775 | +.behuiyuanbtn{ |
776 | + width:486rpx; | ||
777 | +} | ||
778 | +.surezhifu{ | ||
779 | + color:#C29445; | ||
780 | + font-size: 32rpx; | ||
781 | +} | ||
776 | /* 优惠券使用规则 */ | 782 | /* 优惠券使用规则 */ |
777 | .couponrule { | 783 | .couponrule { |
778 | width: 540rpx; | 784 | width: 540rpx; |
@@ -165,11 +165,11 @@ | @@ -165,11 +165,11 @@ | ||
165 | data3: [], //积分商品 | 165 | data3: [], //积分商品 |
166 | selall: false, | 166 | selall: false, |
167 | total: 0, | 167 | total: 0, |
168 | - arr:[], | ||
169 | - data:[], | ||
170 | - seldelall:false, | ||
171 | - cartid:[], | ||
172 | - editsel:true | 168 | + arr: [], |
169 | + data: [], | ||
170 | + seldelall: false, | ||
171 | + cartid: [], | ||
172 | + editsel: true | ||
173 | } | 173 | } |
174 | }, | 174 | }, |
175 | onLoad() { | 175 | onLoad() { |
@@ -178,32 +178,41 @@ | @@ -178,32 +178,41 @@ | ||
178 | console.log(uni.getStorageSync("token")) | 178 | console.log(uni.getStorageSync("token")) |
179 | }, | 179 | }, |
180 | methods: { | 180 | methods: { |
181 | - editcart(){ | ||
182 | - this.editsel=!this.editsel; | ||
183 | - | 181 | + editcart() { |
182 | + this.editsel = !this.editsel; | ||
183 | + this.cartid = []; | ||
184 | + this.arr = [], | ||
185 | + this.data = [], | ||
186 | + this.seldelall = false; | ||
187 | + this.selall = false; | ||
188 | + this.getcartlist() | ||
184 | }, | 189 | }, |
185 | 190 | ||
186 | // 删除商品 | 191 | // 删除商品 |
187 | - selshan(){ | ||
188 | - let that=this; | ||
189 | - this.seldelall=!this.seldelall; | ||
190 | - if(this.seldelall==true){ | 192 | + selshan() { |
193 | + let that = this; | ||
194 | + let newcartid = []; | ||
195 | + this.seldelall = !this.seldelall; | ||
196 | + if (this.seldelall == true) { | ||
191 | this.data3.forEach(function(value, index, array) { | 197 | this.data3.forEach(function(value, index, array) { |
192 | value.sel = true; | 198 | value.sel = true; |
193 | that.$forceUpdate() | 199 | that.$forceUpdate() |
194 | - newcartid.push(value.id) | 200 | + newcartid.push(value.id); |
201 | + that.cartid = newcartid | ||
195 | 202 | ||
196 | }) | 203 | }) |
197 | - this.data2.forEach(function(value, index, array){ | 204 | + this.data2.forEach(function(value, index, array) { |
198 | value.sel = true; | 205 | value.sel = true; |
199 | that.$forceUpdate() | 206 | that.$forceUpdate() |
200 | - newcartid.push(value.id) | 207 | + newcartid.push(value.id); |
208 | + that.cartid = newcartid | ||
201 | 209 | ||
202 | }) | 210 | }) |
203 | - this.data1[0].list.forEach(function(value, index, array){ | 211 | + this.data1[0].list.forEach(function(value, index, array) { |
204 | value.sel = true; | 212 | value.sel = true; |
205 | that.$forceUpdate() | 213 | that.$forceUpdate() |
206 | - newcartid.push(value.id) | 214 | + newcartid.push(value.id); |
215 | + that.cartid = newcartid | ||
207 | 216 | ||
208 | }) | 217 | }) |
209 | 218 | ||
@@ -211,38 +220,71 @@ | @@ -211,38 +220,71 @@ | ||
211 | this.data3.forEach(function(value, index, array) { | 220 | this.data3.forEach(function(value, index, array) { |
212 | value.sel = false; | 221 | value.sel = false; |
213 | }) | 222 | }) |
214 | - this.data2.forEach(function(value, index, array){ | ||
215 | - value.sel =false | 223 | + this.data2.forEach(function(value, index, array) { |
224 | + value.sel = false | ||
216 | }) | 225 | }) |
217 | - this.data1[0].list.forEach(function(value, index, array){ | ||
218 | - value.sel =false | 226 | + this.data1[0].list.forEach(function(value, index, array) { |
227 | + value.sel = false | ||
219 | }) | 228 | }) |
220 | 229 | ||
221 | - newcartid=[]; | 230 | + newcartid = []; |
222 | } | 231 | } |
223 | - that.cartid=newcartid; | 232 | + that.cartid = newcartid; |
224 | console.log(that.cartid) | 233 | console.log(that.cartid) |
225 | }, | 234 | }, |
226 | 235 | ||
227 | - delgood(){ | 236 | + delgood() { |
228 | let that = this; | 237 | let that = this; |
229 | console.log(that.cartid) | 238 | console.log(that.cartid) |
230 | uni.showModal({ | 239 | uni.showModal({ |
231 | title: '提示', | 240 | title: '提示', |
232 | content: '是否删除该商品', | 241 | content: '是否删除该商品', |
233 | - success: function (res) { | 242 | + success: function(res) { |
234 | if (res.confirm) { | 243 | if (res.confirm) { |
235 | 244 | ||
236 | var url = 'car/batch_delete'; | 245 | var url = 'car/batch_delete'; |
237 | var params = { | 246 | var params = { |
238 | - car_ids:that.cartid.join(",") | 247 | + car_ids: that.cartid.join(",") |
239 | } | 248 | } |
240 | console.log(params) | 249 | console.log(params) |
241 | app.post(url, params).then((res) => { | 250 | app.post(url, params).then((res) => { |
242 | console.log(res); | 251 | console.log(res); |
243 | uni.showToast({ | 252 | uni.showToast({ |
244 | - title:'删除成功', | ||
245 | - icon:"none" | 253 | + title: '删除成功', |
254 | + icon: "none" | ||
255 | + }) | ||
256 | + | ||
257 | + that.getcartlist() | ||
258 | + | ||
259 | + }).catch((err) => { | ||
260 | + console.log(err) | ||
261 | + }) | ||
262 | + } else if (res.cancel) { | ||
263 | + console.log('用户点击取消'); | ||
264 | + } | ||
265 | + } | ||
266 | + }); | ||
267 | + | ||
268 | + }, | ||
269 | + delgood() { | ||
270 | + let that = this; | ||
271 | + console.log(that.cartid) | ||
272 | + uni.showModal({ | ||
273 | + title: '提示', | ||
274 | + content: '是否删除该商品', | ||
275 | + success: function(res) { | ||
276 | + if (res.confirm) { | ||
277 | + | ||
278 | + var url = 'car/batch_delete'; | ||
279 | + var params = { | ||
280 | + car_ids: that.cartid.join(",") | ||
281 | + } | ||
282 | + console.log(params) | ||
283 | + app.post(url, params).then((res) => { | ||
284 | + console.log(res); | ||
285 | + uni.showToast({ | ||
286 | + title: '删除成功', | ||
287 | + icon: "none" | ||
246 | }) | 288 | }) |
247 | 289 | ||
248 | that.getcartlist() | 290 | that.getcartlist() |
@@ -274,35 +316,48 @@ | @@ -274,35 +316,48 @@ | ||
274 | getcartlist() { | 316 | getcartlist() { |
275 | let that = this; | 317 | let that = this; |
276 | var url = 'car/get_all'; | 318 | var url = 'car/get_all'; |
277 | - var params = { | ||
278 | - } | 319 | + var params = {} |
279 | console.log(params) | 320 | console.log(params) |
280 | app.post(url, params).then((res) => { | 321 | app.post(url, params).then((res) => { |
281 | console.log(res); | 322 | console.log(res); |
282 | that.data1 = res.data.data.data3; | 323 | that.data1 = res.data.data.data3; |
283 | that.data2 = res.data.data.data1; | 324 | that.data2 = res.data.data.data1; |
284 | that.data3 = res.data.data.data2; | 325 | that.data3 = res.data.data.data2; |
326 | + let newlenarr = [] | ||
285 | // 店铺商品 | 327 | // 店铺商品 |
286 | - that.data1[0].list.forEach(function(value,index,array){ | 328 | + if (that.data1.length != 0) { |
329 | + that.data1[0].list.forEach(function(value, index, array) { | ||
287 | value.sel = false; | 330 | value.sel = false; |
331 | + newlenarr.push(value) | ||
288 | }) | 332 | }) |
289 | - that.data1=that.data1; | 333 | + that.data1 = that.data1; |
334 | + } | ||
335 | + | ||
336 | + | ||
290 | // 面坊商品 | 337 | // 面坊商品 |
338 | + if (that.data2.length != 0) { | ||
291 | that.data2.forEach(function(value, index, array) { | 339 | that.data2.forEach(function(value, index, array) { |
292 | value.sel = false; | 340 | value.sel = false; |
341 | + newlenarr.push(value) | ||
293 | }) | 342 | }) |
294 | that.data2 = that.data2; | 343 | that.data2 = that.data2; |
344 | + } | ||
345 | + | ||
295 | console.log('738932893', that.data2) | 346 | console.log('738932893', that.data2) |
296 | // 积分商品 | 347 | // 积分商品 |
348 | + if (that.data3.length != 0) { | ||
297 | that.data3.forEach(function(value, index, array) { | 349 | that.data3.forEach(function(value, index, array) { |
298 | - value.sel = false | 350 | + value.sel = false; |
351 | + newlenarr.push(value) | ||
299 | }) | 352 | }) |
300 | that.data3 = that.data3; | 353 | that.data3 = that.data3; |
354 | + } | ||
355 | + this.lenarr = newlenarr | ||
356 | + | ||
301 | }).catch((err) => { | 357 | }).catch((err) => { |
302 | console.log(err) | 358 | console.log(err) |
303 | }) | 359 | }) |
304 | }, | 360 | }, |
305 | - | ||
306 | //选择购物车 | 361 | //选择购物车 |
307 | selectcart(item, index) { | 362 | selectcart(item, index) { |
308 | console.log(item, index) | 363 | console.log(item, index) |
@@ -326,7 +381,11 @@ | @@ -326,7 +381,11 @@ | ||
326 | obj.spec_sku_id=item.spec_sku_id; | 381 | obj.spec_sku_id=item.spec_sku_id; |
327 | obj.number=item.number; | 382 | obj.number=item.number; |
328 | console.log('34898348',obj); | 383 | console.log('34898348',obj); |
329 | - that.data.push(obj) | 384 | + that.data.push(obj); |
385 | + if(that.cartid.length==that.lenarr.length){ | ||
386 | + that.selall=true; | ||
387 | + that.seldelall=true | ||
388 | + } | ||
330 | } else { | 389 | } else { |
331 | that.arr.splice(0,1) | 390 | that.arr.splice(0,1) |
332 | that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number; | 391 | that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number; |
@@ -343,6 +402,8 @@ | @@ -343,6 +402,8 @@ | ||
343 | newcartid.splice(index,1) | 402 | newcartid.splice(index,1) |
344 | } | 403 | } |
345 | }) | 404 | }) |
405 | + that.selall=false; | ||
406 | + that.seldelall=false | ||
346 | } | 407 | } |
347 | that.data=that.data; | 408 | that.data=that.data; |
348 | 409 | ||
@@ -359,12 +420,17 @@ | @@ -359,12 +420,17 @@ | ||
359 | if (value.sel == true) { | 420 | if (value.sel == true) { |
360 | that.arr.push(1); | 421 | that.arr.push(1); |
361 | newcartid.push(value.id); | 422 | newcartid.push(value.id); |
423 | + that.cartid=newcartid | ||
362 | that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; | 424 | that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; |
363 | obj.type=item.type; | 425 | obj.type=item.type; |
364 | obj.goods_id=item.goods_id; | 426 | obj.goods_id=item.goods_id; |
365 | obj.spec_sku_id=item.spec_sku_id; | 427 | obj.spec_sku_id=item.spec_sku_id; |
366 | obj.number=item.number; | 428 | obj.number=item.number; |
367 | - that.data.push(obj) | 429 | + that.data.push(obj); |
430 | + if(that.cartid.length==that.lenarr.length){ | ||
431 | + that.selall=true; | ||
432 | + that.seldelall=true | ||
433 | + } | ||
368 | 434 | ||
369 | } else { | 435 | } else { |
370 | that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number; | 436 | that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number; |
@@ -379,6 +445,8 @@ | @@ -379,6 +445,8 @@ | ||
379 | newcartid.splice(index,1) | 445 | newcartid.splice(index,1) |
380 | } | 446 | } |
381 | }) | 447 | }) |
448 | + that.selall=false; | ||
449 | + that.seldelall=false | ||
382 | } | 450 | } |
383 | } | 451 | } |
384 | }) | 452 | }) |
@@ -393,19 +461,23 @@ | @@ -393,19 +461,23 @@ | ||
393 | console.log('383483',value.id) | 461 | console.log('383483',value.id) |
394 | 462 | ||
395 | value.sel = !value.sel; | 463 | value.sel = !value.sel; |
396 | - | ||
397 | that.$forceUpdate() | 464 | that.$forceUpdate() |
398 | console.log(value.sel) | 465 | console.log(value.sel) |
399 | if (value.sel == true) { | 466 | if (value.sel == true) { |
400 | console.log(value.sel) | 467 | console.log(value.sel) |
401 | that.arr.push(1); | 468 | that.arr.push(1); |
402 | newcartid.push(item.id); | 469 | newcartid.push(item.id); |
470 | + that.cartid=newcartid; | ||
403 | that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number; | 471 | that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number; |
404 | obj.type=item.type; | 472 | obj.type=item.type; |
405 | obj.goods_id=item.goods_id; | 473 | obj.goods_id=item.goods_id; |
406 | obj.spec_sku_id=item.spec_sku_id; | 474 | obj.spec_sku_id=item.spec_sku_id; |
407 | obj.number=item.number; | 475 | obj.number=item.number; |
408 | - that.data.push(obj) | 476 | + that.data.push(obj); |
477 | + if(that.cartid.length==that.lenarr.length){ | ||
478 | + that.selall=true; | ||
479 | + that.seldelall=true | ||
480 | + } | ||
409 | 481 | ||
410 | } else { | 482 | } else { |
411 | that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number; | 483 | that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number; |
@@ -420,42 +492,50 @@ | @@ -420,42 +492,50 @@ | ||
420 | newcartid.splice(index,1) | 492 | newcartid.splice(index,1) |
421 | } | 493 | } |
422 | }) | 494 | }) |
495 | + that.selall=false; | ||
496 | + that.seldelall=false | ||
497 | + | ||
423 | } | 498 | } |
424 | } | 499 | } |
425 | }) | 500 | }) |
426 | that.data1 = that.data1; | 501 | that.data1 = that.data1; |
427 | that.data=that.data; | 502 | that.data=that.data; |
428 | that.cartid=newcartid; | 503 | that.cartid=newcartid; |
504 | + if(that.cartid.length==that.lenarr.length){ | ||
505 | + that.selall=true; | ||
506 | + that.seldelall=true | ||
507 | + } | ||
429 | console.log(that.data); | 508 | console.log(that.data); |
430 | console.log(that.cartid) | 509 | console.log(that.cartid) |
431 | } | 510 | } |
432 | 511 | ||
433 | }, | 512 | }, |
513 | + | ||
434 | // 选择全部购物车 | 514 | // 选择全部购物车 |
435 | selectall() { | 515 | selectall() { |
436 | - let that=this; | 516 | + let that = this; |
437 | this.selall = !this.selall; | 517 | this.selall = !this.selall; |
438 | - let newarr=[]; | ||
439 | - let newtotal=0; | ||
440 | - let newcartid=[] | 518 | + let newarr = []; |
519 | + let newtotal = 0; | ||
520 | + let newcartid = [] | ||
441 | if (this.selall == true) { | 521 | if (this.selall == true) { |
442 | this.data3.forEach(function(value, index, array) { | 522 | this.data3.forEach(function(value, index, array) { |
443 | value.sel = true; | 523 | value.sel = true; |
444 | newarr.push(1); | 524 | newarr.push(1); |
445 | - newtotal=newtotal+value.score_goods.price * 100 / 100 * value.number; | 525 | + newtotal = newtotal + value.score_goods.price * 100 / 100 * value.number; |
446 | newcartid.push(value.id) | 526 | newcartid.push(value.id) |
447 | // this.total = this.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number | 527 | // this.total = this.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number |
448 | }) | 528 | }) |
449 | - this.data2.forEach(function(value, index, array){ | 529 | + this.data2.forEach(function(value, index, array) { |
450 | value.sel = true; | 530 | value.sel = true; |
451 | - newtotal=newtotal+value.flour_goods.price * 100 / 100 * value.number; | 531 | + newtotal = newtotal + value.flour_goods.price * 100 / 100 * value.number; |
452 | newcartid.push(value.id) | 532 | newcartid.push(value.id) |
453 | // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; | 533 | // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; |
454 | newarr.push(1) | 534 | newarr.push(1) |
455 | }) | 535 | }) |
456 | - this.data1[0].list.forEach(function(value, index, array){ | 536 | + this.data1[0].list.forEach(function(value, index, array) { |
457 | value.sel = true; | 537 | value.sel = true; |
458 | - newtotal=newtotal+value.store_goods.price * 100 / 100 * value.number; | 538 | + newtotal = newtotal + value.store_goods.price * 100 / 100 * value.number; |
459 | newcartid.push(value.id) | 539 | newcartid.push(value.id) |
460 | // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; | 540 | // this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number; |
461 | newarr.push(1) | 541 | newarr.push(1) |
@@ -465,20 +545,20 @@ | @@ -465,20 +545,20 @@ | ||
465 | this.data3.forEach(function(value, index, array) { | 545 | this.data3.forEach(function(value, index, array) { |
466 | value.sel = false; | 546 | value.sel = false; |
467 | }) | 547 | }) |
468 | - this.data2.forEach(function(value, index, array){ | ||
469 | - value.sel =false | 548 | + this.data2.forEach(function(value, index, array) { |
549 | + value.sel = false | ||
470 | }) | 550 | }) |
471 | - this.data1[0].list.forEach(function(value, index, array){ | ||
472 | - value.sel =false | 551 | + this.data1[0].list.forEach(function(value, index, array) { |
552 | + value.sel = false | ||
473 | }) | 553 | }) |
474 | - newarr=[]; | ||
475 | - newtotal=0; | ||
476 | - newcartid=[]; | 554 | + newarr = []; |
555 | + newtotal = 0; | ||
556 | + newcartid = []; | ||
477 | } | 557 | } |
478 | this.data3 = this.data3; | 558 | this.data3 = this.data3; |
479 | - this.total=newtotal; | ||
480 | - this.arr=newarr; | ||
481 | - this.cartid=newcartid; | 559 | + this.total = newtotal; |
560 | + this.arr = newarr; | ||
561 | + this.cartid = newcartid; | ||
482 | 562 | ||
483 | }, | 563 | }, |
484 | //购物车增加 | 564 | //购物车增加 |
@@ -507,9 +587,9 @@ | @@ -507,9 +587,9 @@ | ||
507 | }) | 587 | }) |
508 | that.data2 = that.data2; | 588 | that.data2 = that.data2; |
509 | 589 | ||
510 | - }else if(item.type==3){ | 590 | + } else if (item.type == 3) { |
511 | that.data1[0].list.forEach(function(value, index, array) { | 591 | that.data1[0].list.forEach(function(value, index, array) { |
512 | - console.log('3787478',value) | 592 | + console.log('3787478', value) |
513 | if (value.id == item.id) { | 593 | if (value.id == item.id) { |
514 | console.log(value.id); | 594 | console.log(value.id); |
515 | console.log(item.id) | 595 | console.log(item.id) |
@@ -572,7 +652,7 @@ | @@ -572,7 +652,7 @@ | ||
572 | if (item.sel == true) { | 652 | if (item.sel == true) { |
573 | that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * 1; | 653 | that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * 1; |
574 | } | 654 | } |
575 | - }else{ | 655 | + } else { |
576 | uni.showToast({ | 656 | uni.showToast({ |
577 | title: '不能再减少了~', | 657 | title: '不能再减少了~', |
578 | icon: 'none' | 658 | icon: 'none' |
@@ -581,7 +661,7 @@ | @@ -581,7 +661,7 @@ | ||
581 | } | 661 | } |
582 | }) | 662 | }) |
583 | that.data2 = that.data2; | 663 | that.data2 = that.data2; |
584 | - }else if(item.type==3){ | 664 | + } else if (item.type == 3) { |
585 | that.data1[0].list.forEach(function(value, index, array) { | 665 | that.data1[0].list.forEach(function(value, index, array) { |
586 | if (value.id == item.id) { | 666 | if (value.id == item.id) { |
587 | if (value.number > 1) { | 667 | if (value.number > 1) { |
@@ -590,7 +670,7 @@ | @@ -590,7 +670,7 @@ | ||
590 | if (item.sel == true) { | 670 | if (item.sel == true) { |
591 | that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * 1; | 671 | that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * 1; |
592 | } | 672 | } |
593 | - }else{ | 673 | + } else { |
594 | uni.showToast({ | 674 | uni.showToast({ |
595 | title: '不能再减少了~', | 675 | title: '不能再减少了~', |
596 | icon: 'none' | 676 | icon: 'none' |
@@ -618,29 +698,31 @@ | @@ -618,29 +698,31 @@ | ||
618 | }) | 698 | }) |
619 | }, | 699 | }, |
620 | // 去结算 | 700 | // 去结算 |
621 | - jiesuan(){ | 701 | + jiesuan() { |
622 | let that = this; | 702 | let that = this; |
623 | - if(that.data.length==0){ | 703 | + if (that.data.length == 0) { |
624 | uni.showToast({ | 704 | uni.showToast({ |
625 | - title:'请选择商品', | ||
626 | - icon:'none' | 705 | + title: '请选择商品', |
706 | + icon: 'none' | ||
627 | }) | 707 | }) |
628 | return false | 708 | return false |
629 | } | 709 | } |
710 | + uni.setStorageSync("addressitem",""); | ||
711 | + uni.setStorageSync("couponitem","") | ||
630 | var url = 'order/confirm_order'; | 712 | var url = 'order/confirm_order'; |
631 | - console.log('获取的参数',that.data) | 713 | + console.log('获取的参数', that.data) |
632 | var params = { | 714 | var params = { |
633 | data: JSON.stringify(that.data), | 715 | data: JSON.stringify(that.data), |
634 | 716 | ||
635 | } | 717 | } |
636 | console.log(params) | 718 | console.log(params) |
637 | - app.post(url, params,"post").then((res) => { | 719 | + app.post(url, params, "post").then((res) => { |
638 | console.log(res); | 720 | console.log(res); |
639 | console.log(res.data.data); | 721 | console.log(res.data.data); |
640 | - let seldata=JSON.stringify(that.data) | ||
641 | - uni.setStorageSync("goodinfo",res.data.data); | 722 | + let seldata = JSON.stringify(that.data) |
723 | + uni.setStorageSync("goodinfo", res.data.data); | ||
642 | uni.navigateTo({ | 724 | uni.navigateTo({ |
643 | - url:'/pages/nearshop/sureorder?seldata='+seldata | 725 | + url: '/pages/nearshop/sureorder?seldata=' + seldata |
644 | }) | 726 | }) |
645 | 727 | ||
646 | }).catch((err) => { | 728 | }).catch((err) => { |
@@ -660,25 +742,28 @@ | @@ -660,25 +742,28 @@ | ||
660 | page { | 742 | page { |
661 | background: #F8F6F9; | 743 | background: #F8F6F9; |
662 | } | 744 | } |
663 | - .editcart{ | ||
664 | - color:#3D454C; | 745 | + |
746 | + .editcart { | ||
747 | + color: #3D454C; | ||
665 | font-size: 28rpx; | 748 | font-size: 28rpx; |
666 | - width:750rpx; | 749 | + width: 750rpx; |
667 | background: #fff; | 750 | background: #fff; |
668 | text-align: right; | 751 | text-align: right; |
669 | padding: 0 32rpx; | 752 | padding: 0 32rpx; |
670 | box-sizing: border-box; | 753 | box-sizing: border-box; |
671 | } | 754 | } |
672 | - .quanname{ | ||
673 | - color:#3D454C; | 755 | + |
756 | + .quanname { | ||
757 | + color: #3D454C; | ||
674 | font-size: 28rpx; | 758 | font-size: 28rpx; |
675 | } | 759 | } |
676 | - .delgoodname{ | ||
677 | - width:280rpx; | ||
678 | - height:88rpx; | ||
679 | - background:rgba(194,148,69,1); | ||
680 | - border-radius:16rpx; | ||
681 | - color:#fff; | 760 | + |
761 | + .delgoodname { | ||
762 | + width: 280rpx; | ||
763 | + height: 88rpx; | ||
764 | + background: rgba(194, 148, 69, 1); | ||
765 | + border-radius: 16rpx; | ||
766 | + color: #fff; | ||
682 | font-size: 28rpx; | 767 | font-size: 28rpx; |
683 | text-align: center; | 768 | text-align: center; |
684 | line-height: 88rpx; | 769 | line-height: 88rpx; |
@@ -687,10 +772,12 @@ | @@ -687,10 +772,12 @@ | ||
687 | .cartlist { | 772 | .cartlist { |
688 | /* padding-bottom: 120rpx; */ | 773 | /* padding-bottom: 120rpx; */ |
689 | } | 774 | } |
690 | - .spec{ | ||
691 | - color:#3D454C; | 775 | + |
776 | + .spec { | ||
777 | + color: #3D454C; | ||
692 | font-size: 28rpx; | 778 | font-size: 28rpx; |
693 | } | 779 | } |
780 | + | ||
694 | .cartselimg { | 781 | .cartselimg { |
695 | width: 30rpx; | 782 | width: 30rpx; |
696 | height: 30rpx; | 783 | height: 30rpx; |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | </view> | 20 | </view> |
21 | <view class="sureshop sureshopk"> | 21 | <view class="sureshop sureshopk"> |
22 | <!-- 店铺商品 --> | 22 | <!-- 店铺商品 --> |
23 | - <view class="bigbox" v-if="goodinfo.data3[0].goods!=undefined"> | 23 | + <view class="bigbox" v-if="goodinfo.data3.length!=0"> |
24 | <view class="sureorderbox flexone"> | 24 | <view class="sureorderbox flexone"> |
25 | <view class="sureimg"> | 25 | <view class="sureimg"> |
26 | <image src="../../static/nearshop.png" mode=""></image> | 26 | <image src="../../static/nearshop.png" mode=""></image> |
@@ -252,66 +252,75 @@ | @@ -252,66 +252,75 @@ | ||
252 | </view> | 252 | </view> |
253 | </view> | 253 | </view> |
254 | 254 | ||
255 | - <view class="huiyuanbot boxsizing"> | ||
256 | - <view class="behuiyuanbtn">确认支付</view> | 255 | + <view class="huiyuanbot boxsizing flextwo"> |
256 | + <view class="surezhifu">总计:{{goodinfo.total}}</view> | ||
257 | + <view class="behuiyuanbtn behuiyuanbtnk" @click="surepay">确认支付</view> | ||
257 | </view> | 258 | </view> |
258 | 259 | ||
259 | <!-- 购买弹层 --> | 260 | <!-- 购买弹层 --> |
260 | <view class="register" @click="hidebuy" v-if="buyshow"> | 261 | <view class="register" @click="hidebuy" v-if="buyshow"> |
261 | <view class="buywrap boxsizing"> | 262 | <view class="buywrap boxsizing"> |
262 | <view class="buyname">订单总额</view> | 263 | <view class="buyname">订单总额</view> |
263 | - <view class="buymoney">3600</view> | 264 | + <view class="buymoney">{{goodinfo.total}}</view> |
264 | <view class='buybox'> | 265 | <view class='buybox'> |
265 | - <view class="buyitem boxsizing flextwo"> | 266 | + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="1"> |
266 | <view class="buyitemleft flexone"> | 267 | <view class="buyitemleft flexone"> |
267 | - <view class="buyleftimg"> | ||
268 | - <image src="../../static/zhifubao.png" mode=""></image> | 268 | + <view class="buyleftimg" > |
269 | + | ||
270 | + <image src="../../static/weixin.png" mode=""></image> | ||
269 | </view> | 271 | </view> |
270 | - <view class="buyitemname">支付宝</view> | 272 | + <view class="buyitemname">微信支付</view> |
271 | </view> | 273 | </view> |
272 | - <view class="selimg"> | ||
273 | - <image src="../../static/selactive.png" mode=""></image> | 274 | + <view class="selimg" > |
275 | + <image src="../../static/selactive.png" mode="" v-if="pay_type==1"></image> | ||
276 | + <image src="../../static/active.png" mode="" v-else></image> | ||
274 | </view> | 277 | </view> |
275 | </view> | 278 | </view> |
276 | <view class="buyitem boxsizing flextwo"> | 279 | <view class="buyitem boxsizing flextwo"> |
277 | <view class="buyitemleft flexone"> | 280 | <view class="buyitemleft flexone"> |
278 | <view class="buyleftimg"> | 281 | <view class="buyleftimg"> |
279 | - <image src="../../static/weixin.png" mode=""></image> | 282 | + |
283 | + <image src="../../static/zhifubao.png" mode=""></image> | ||
280 | </view> | 284 | </view> |
281 | - <view class="buyitemname">微信支付</view> | 285 | + <view class="buyitemname">支付宝</view> |
282 | </view> | 286 | </view> |
283 | - <view class="selimg"> | ||
284 | - <image src="../../static/selactive.png" mode=""></image> | 287 | + <view class="selimg" @click.stop="paytype" :data-id="2"> |
288 | + <image src="../../static/selactive.png" mode="" v-if="pay_type==2"></image> | ||
289 | + <image src="../../static/active.png" mode="" v-else></image> | ||
285 | </view> | 290 | </view> |
286 | </view> | 291 | </view> |
287 | - <view class="buyitem boxsizing flextwo"> | 292 | + |
293 | + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="3"> | ||
288 | <view class="buyitemleft flexone"> | 294 | <view class="buyitemleft flexone"> |
289 | - <view class="buyleftimg"> | ||
290 | - <image src="../../static/yue.png" mode=""></image> | 295 | + <view class="buyleftimg" > |
296 | + <image src="../../static/yue.png" mode="" ></image> | ||
291 | </view> | 297 | </view> |
292 | <view class="buyitemname">余额支付</view> | 298 | <view class="buyitemname">余额支付</view> |
293 | </view> | 299 | </view> |
294 | - <view class="selimg"> | ||
295 | - <image src="../../static/selactive.png" mode=""></image> | 300 | + <view class="selimg" > |
301 | + <image src="../../static/selactive.png" mode="" v-if="pay_type==3"></image> | ||
302 | + <image src="../../static/active.png" mode="" v-else></image> | ||
296 | </view> | 303 | </view> |
297 | </view> | 304 | </view> |
298 | - <view class="buyitem boxsizing flextwo"> | 305 | + <view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="4"> |
299 | <view class="buyitemleft flexone"> | 306 | <view class="buyitemleft flexone"> |
300 | <view class="buyleftimg"> | 307 | <view class="buyleftimg"> |
301 | - <image src="../../static/baitiao.png" mode=""></image> | ||
302 | - </view> | ||
303 | - <view class="buyitemname">白条支付</view> | 308 | + |
309 | + <image src="../../static/baitiao.png" mode="" ></image> | ||
304 | </view> | 310 | </view> |
305 | - <view class="selimg"> | ||
306 | - <image src="../../static/selactive.png" mode=""></image> | 311 | + <view class="buyitemname">赊吧支付</view> |
307 | </view> | 312 | </view> |
313 | + <view class="selimg" > | ||
314 | + <image src="../../static/selactive.png" mode="" v-if="pay_type==4"></image> | ||
315 | + <image src="../../static/active.png" mode="" v-else></image> | ||
308 | </view> | 316 | </view> |
309 | </view> | 317 | </view> |
310 | - <view class="flextwo"> | ||
311 | - <view class="totalmoney">{{goodinfo.total}}</view> | ||
312 | - <view class="buybtn btnk">确认支付(¥2560.00)</view> | ||
313 | </view> | 318 | </view> |
314 | 319 | ||
320 | + | ||
321 | + <view class="buybtn btnk" @click="paynow">确认支付(¥{{goodinfo.total}})</view> | ||
322 | + | ||
323 | + | ||
315 | </view> | 324 | </view> |
316 | </view> | 325 | </view> |
317 | <!-- 优惠券使用规则 --> | 326 | <!-- 优惠券使用规则 --> |
@@ -381,6 +390,8 @@ | @@ -381,6 +390,8 @@ | ||
381 | name:'上门自提' | 390 | name:'上门自提' |
382 | }], | 391 | }], |
383 | goodpeiname:'请选择配送方式', | 392 | goodpeiname:'请选择配送方式', |
393 | + pay_type:-1, | ||
394 | + user_ticket_id:'' | ||
384 | 395 | ||
385 | 396 | ||
386 | 397 | ||
@@ -398,6 +409,11 @@ | @@ -398,6 +409,11 @@ | ||
398 | }, | 409 | }, |
399 | 410 | ||
400 | methods: { | 411 | methods: { |
412 | + | ||
413 | + // 选择支付方式 | ||
414 | + paytype(e){ | ||
415 | + this.pay_type=e.currentTarget.dataset.id | ||
416 | + }, | ||
401 | // 面访商品配送方式 | 417 | // 面访商品配送方式 |
402 | bindmianChange(e){ | 418 | bindmianChange(e){ |
403 | this.mianpeiname=this.servicearr[e.target.value].name; | 419 | this.mianpeiname=this.servicearr[e.target.value].name; |
@@ -430,17 +446,21 @@ | @@ -430,17 +446,21 @@ | ||
430 | }, | 446 | }, |
431 | 447 | ||
432 | // 面坊商品备注 | 448 | // 面坊商品备注 |
433 | - entermianfangrmark(){ | ||
434 | - this.remark1=e.detail.value | 449 | + entermianfangrmark(e){ |
450 | + console.log(e) | ||
451 | + this.remark1=e.detail.value; | ||
452 | + console.log(this.remark1) | ||
435 | }, | 453 | }, |
436 | // 店铺商品备注 | 454 | // 店铺商品备注 |
437 | entershopmessage(e){ | 455 | entershopmessage(e){ |
456 | + | ||
438 | this.seldata.forEach(function(value,index,array){ | 457 | this.seldata.forEach(function(value,index,array){ |
439 | if(value.type==3){ | 458 | if(value.type==3){ |
440 | value.remark=e.detail.value | 459 | value.remark=e.detail.value |
441 | } | 460 | } |
442 | }) | 461 | }) |
443 | this.seldata=this.this.seldata; | 462 | this.seldata=this.this.seldata; |
463 | + console.log(this.seldata) | ||
444 | }, | 464 | }, |
445 | // 积分商品备注 | 465 | // 积分商品备注 |
446 | enterjifenremark(){ | 466 | enterjifenremark(){ |
@@ -487,17 +507,63 @@ | @@ -487,17 +507,63 @@ | ||
487 | console.log(err) | 507 | console.log(err) |
488 | 508 | ||
489 | }) | 509 | }) |
510 | + }, | ||
511 | + //确认支付 | ||
512 | + surepay(){ | ||
513 | + this.buyshow=true | ||
514 | + }, | ||
515 | + hidebuy(){ | ||
516 | + this.buyshow=false | ||
517 | + }, | ||
518 | + // 确认支付 | ||
519 | + paynow(){ | ||
520 | + let that = this; | ||
521 | + // if(that.data.length==0){ | ||
522 | + // uni.showToast({ | ||
523 | + // title:'请选择商品', | ||
524 | + // icon:'none' | ||
525 | + // }) | ||
526 | + // return false | ||
527 | + // } | ||
528 | + var url = 'order/create_order'; | ||
529 | + var params = { | ||
530 | + data: JSON.stringify(that.seldata), | ||
531 | + user_ticket_id:that.user_ticket_id, | ||
532 | + postage_type1:that.postage_type1, | ||
533 | + postage_type2:that.postage_type2, | ||
534 | + score:that.jifen, | ||
535 | + remark1:that.remark1, | ||
536 | + remark2:that.remark2, | ||
537 | + pay_type:that.pay_type | ||
538 | + | ||
539 | + } | ||
540 | + console.log(that.seldata) | ||
541 | + console.log(params) | ||
542 | + app.post(url, params,"post").then((res) => { | ||
543 | + console.log(res); | ||
544 | + uni.navigateTo({ | ||
545 | + url:'/pages/nearshop/sureorder' | ||
546 | + }) | ||
547 | + | ||
548 | + }).catch((err) => { | ||
549 | + console.log(err) | ||
550 | + | ||
551 | + }) | ||
490 | } | 552 | } |
491 | 553 | ||
492 | 554 | ||
493 | }, | 555 | }, |
494 | onShow() { | 556 | onShow() { |
557 | + console.log(uni.getStorageSync("addressitem")) | ||
495 | if(uni.getStorageSync("addressitem")!=''){ | 558 | if(uni.getStorageSync("addressitem")!=''){ |
496 | this.addressitem = uni.getStorageSync("addressitem"); | 559 | this.addressitem = uni.getStorageSync("addressitem"); |
497 | } | 560 | } |
498 | - if(uni.getStorageSync("addressitem")!=''){ | 561 | + if(uni.getStorageSync("couponitem")!=''){ |
499 | let couponitem = uni.getStorageSync("couponitem"); | 562 | let couponitem = uni.getStorageSync("couponitem"); |
500 | - this.couponname=couponitem.name | 563 | + console.log(couponitem) |
564 | + this.couponname=couponitem.name; | ||
565 | + console.log(this.couponname) | ||
566 | + this.user_ticket_id=couponitem.id | ||
501 | } | 567 | } |
502 | 568 | ||
503 | console.log(this.addressitem) | 569 | console.log(this.addressitem) |
@@ -519,6 +585,8 @@ | @@ -519,6 +585,8 @@ | ||
519 | } | 585 | } |
520 | .btnk{ | 586 | .btnk{ |
521 | width:200prx; | 587 | width:200prx; |
522 | - | 588 | + } |
589 | + .buywrap{ | ||
590 | + z-index:999 | ||
523 | } | 591 | } |
524 | </style> | 592 | </style> |
此 diff 太大无法显示。
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论