Showing
1 changed file
with
11 additions
and
6 deletions
@@ -361,6 +361,9 @@ deliveryWay = { | @@ -361,6 +361,9 @@ deliveryWay = { | ||
361 | // 更新订单配送方式数据 | 361 | // 更新订单配送方式数据 |
362 | that.updateOrder({way: id}); | 362 | that.updateOrder({way: id}); |
363 | 363 | ||
364 | + // 更新优惠券列表 | ||
365 | + coupon.getList(); | ||
366 | + | ||
364 | // 重新计算订单价格 | 367 | // 重新计算订单价格 |
365 | compute(0); | 368 | compute(0); |
366 | }); | 369 | }); |
@@ -503,6 +506,7 @@ coupon = { | @@ -503,6 +506,7 @@ coupon = { | ||
503 | var code; | 506 | var code; |
504 | 507 | ||
505 | if (!this.$el.length) { | 508 | if (!this.$el.length) { |
509 | + this.unsupport = true; | ||
506 | return; | 510 | return; |
507 | } | 511 | } |
508 | 512 | ||
@@ -522,17 +526,16 @@ coupon = { | @@ -522,17 +526,16 @@ coupon = { | ||
522 | this.eventBind(); | 526 | this.eventBind(); |
523 | }, | 527 | }, |
524 | getList: function(code) { | 528 | getList: function(code) { |
525 | - var that = this, | ||
526 | - hasCode; | 529 | + var that = this; |
527 | 530 | ||
528 | - if (!order.deliveryWay) { | 531 | + if (!this.unsupport && !order.deliveryWay) { |
529 | return; | 532 | return; |
530 | } | 533 | } |
531 | 534 | ||
532 | if (typeof code !== 'string') { | 535 | if (typeof code !== 'string') { |
533 | code = order.couponCode || ''; | 536 | code = order.couponCode || ''; |
534 | } else { | 537 | } else { |
535 | - hasCode = true; | 538 | + this.userChoosed = true; |
536 | } | 539 | } |
537 | 540 | ||
538 | $.ajax({ | 541 | $.ajax({ |
@@ -574,10 +577,12 @@ coupon = { | @@ -574,10 +577,12 @@ coupon = { | ||
574 | // 更新使用数量 | 577 | // 更新使用数量 |
575 | usedNum = that.$couponWrap.find('.coupon-item.active').length; | 578 | usedNum = that.$couponWrap.find('.coupon-item.active').length; |
576 | 579 | ||
577 | - if (hasCode) { | 580 | + if (that.userChoosed) { |
578 | usedText = usedNum ? `已选${usedNum}张` : usedText; | 581 | usedText = usedNum ? `已选${usedNum}张` : usedText; |
579 | order.couponCode = data.usedCouponCode; | 582 | order.couponCode = data.usedCouponCode; |
580 | - compute(0); // 重新计算价格 | 583 | + |
584 | + // 重新计算价格 | ||
585 | + compute(0); | ||
581 | } else { | 586 | } else { |
582 | usedText += usedNum ? ` 已推荐${usedNum}张` : ''; | 587 | usedText += usedNum ? ` 已推荐${usedNum}张` : ''; |
583 | } | 588 | } |
-
Please register or login to post a comment