diff --git a/api/api.js b/api/api.js index d1fdc19a..a19a7e15 100644 --- a/api/api.js +++ b/api/api.js @@ -32,7 +32,7 @@ export function setFormId(formId) { } /** - * 领取优惠卷 + * 领取优惠券 * @param int couponId * */ diff --git a/api/order.js b/api/order.js index 4efb6c71..ec543162 100644 --- a/api/order.js +++ b/api/order.js @@ -178,7 +178,7 @@ export function orderConfirm(cartId, isNew, addAgain,secKill,combination,bargain } /** - * 获取当前金额能使用的优惠卷 + * 获取当前金额能使用的优惠券 * @param string price * */ diff --git a/api/promotion/coupon.js b/api/promotion/coupon.js index efc0bd59..bee13ad6 100644 --- a/api/promotion/coupon.js +++ b/api/promotion/coupon.js @@ -15,15 +15,6 @@ export function getCouponPage(data) { return request.get("app-api/promotion/coupon/page", data); } -export function getCouponTemplateList(spuId, useType) { - return request.get("app-api/promotion/coupon-template/list", { - spuId, - useType - }, { - noAuth: true // TODO 芋艿:后续要做调整 - }); -} - export function getCouponTemplatePage(data) { return request.get("app-api/promotion/coupon-template/page", data); } diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index 313268ff..72bb29cb 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -819,8 +819,8 @@ * 获取优惠券 */ getCouponList(useType) { - CouponApi.getCouponTemplateList(this.id, useType).then(res => { - this.$set(this.coupon, 'list', res.data); + CouponApi.getCouponTemplatePage({spuId: this.id, productScope: useType}).then(res => { + this.$set(this.coupon, 'list', res.data.list); }) }, /** diff --git a/pages/index/index.vue b/pages/index/index.vue index 0ecc7ffa..36433900 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -98,7 +98,7 @@ + v-for="(item, index) in couponList" :key="index"> {{ item.name }} {{ fen2yuan(item.discountPrice) }} 元 @@ -381,8 +381,8 @@ * 获得优惠劵列表 */ getcouponList() { - CouponApi.getCouponTemplateList().then(res => { - this.$set(this, 'couponList', res.data); + CouponApi.getCouponTemplatePage({pageSize: 2}).then(res => { + this.$set(this, 'couponList', res.data.list); }).catch(err => { return this.$util.Tips({ title: err diff --git a/pages/users/user_get_coupon/index.vue b/pages/users/user_get_coupon/index.vue index d1cc3c25..fbaed861 100644 --- a/pages/users/user_get_coupon/index.vue +++ b/pages/users/user_get_coupon/index.vue @@ -111,6 +111,7 @@ getCoupon: function(id, index) { // 领取优惠券 CouponApi.takeCoupon(id).then(res => { + // todo 会导致take_limit_count失效 this.couponsList[index].takeStatus = true; this.$set(this, 'couponsList', this.couponsList); this.$util.Tips({ @@ -133,7 +134,7 @@ CouponApi.getCouponTemplatePage({ pageNo: this.page, pageSize: this.limit, - useType: this.type + productScope: this.type }).then(res => { const list = res.data.list; const loadend = list.length < this.limit;