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..fc97a375 100644 --- a/api/promotion/coupon.js +++ b/api/promotion/coupon.js @@ -1,5 +1,6 @@ import request from "@/utils/request.js"; +// 领取优惠券 export function takeCoupon(templateId) { return request.post("app-api/promotion/coupon/take", { templateId @@ -11,23 +12,21 @@ export function getMatchCouponList(data) { return request.get("app-api/promotion/coupon/match-list", data); } +// 获得用户优惠劵列表 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); } +// 获得优惠劵模板列表 +export function getCouponTemplateList(data) { + return request.get("app-api/promotion/coupon-template/list", data); +} + // 获得未使用的优惠劵数量 export function getUnusedCouponCount() { return request.get("app-api/promotion/coupon/get-unused-count"); diff --git a/components/couponListWindow/index.vue b/components/couponListWindow/index.vue index bdf5d4c8..0f53d2be 100644 --- a/components/couponListWindow/index.vue +++ b/components/couponListWindow/index.vue @@ -11,7 +11,7 @@ - + {{ fen2yuan(item.discountPrice) }} {{ (item.discountPercent / 10.0).toFixed(1) }} 折 @@ -33,8 +33,8 @@ {{ formatDate(item.validStartTime) + " - " + formatDate(item.validEndTime) }} - {{item.use_title || '已领取'}} - {{coupon.statusTile || '立即领取'}} + {{coupon.statusTile || '立即领取'}} + {{item.use_title || '已领取'}} @@ -80,7 +80,7 @@ methods: { close: function() { this.type = 1 - this.$emit('ChangCouponsClone'); + this.$emit('ChangCouponsClose'); }, /** * 选择优惠劵 @@ -88,11 +88,11 @@ getCouponUser: function(index, id) { // 领取优惠劵时,如果已经领取,则直接跳过 let list = this.coupon.list; - if (list[index].takeStatus && this.openType === 0) { - return; - } switch (this.openType) { case 0: // 领取优惠券 + if (!list[index].canTake) { + return; + } CouponApi.takeCoupon(id).then(res => { this.$util.Tips({ title: "领取成功" diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index 313268ff..1463c620 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -226,7 +226,7 @@ @@ -819,7 +819,7 @@ * 获取优惠券 */ getCouponList(useType) { - CouponApi.getCouponTemplateList(this.id, useType).then(res => { + CouponApi.getCouponTemplateList({spuId: this.id, productScope: useType, count: 10}).then(res => { this.$set(this.coupon, 'list', res.data); }) }, @@ -837,7 +837,7 @@ /** * 关闭优惠劵弹窗 */ - ChangCouponsClone: function() { + ChangCouponsClose: function() { this.$set(this.coupon, 'coupon', false) }, /** diff --git a/pages/index/index.vue b/pages/index/index.vue index 0ecc7ffa..36ad0e41 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -97,16 +97,16 @@ - - {{ item.name }} - + + {{ item.name }} + {{ fen2yuan(item.discountPrice) }} 元 {{ (item.discountPercent / 10.0).toFixed(1) }} 折 - 领取 - 已领取 + 已领取 满{{ fen2yuan(item.usePrice) }}元可用 @@ -184,6 +184,7 @@ import * as DecorateApi from '@/api/promotion/decorate.js'; import * as ProductUtil from '@/utils/product.js'; import * as Util from '@/utils/util.js'; + export default { computed: mapGetters(['isLogin', 'uid']), components: { @@ -381,7 +382,7 @@ * 获得优惠劵列表 */ getcouponList() { - CouponApi.getCouponTemplateList().then(res => { + CouponApi.getCouponTemplateList({ count: 2 }).then(res => { this.$set(this, 'couponList', res.data); }).catch(err => { return this.$util.Tips({ @@ -394,7 +395,8 @@ */ getCoupon: function(id, index) { CouponApi.takeCoupon(id).then(res => { - this.$set(this.couponList[index], 'takeStatus', true); + // 设置已领取,即不能再领取 + this.$set(this.couponList[index], 'canTake', res.data !== true); this.$util.Tips({ title: '领取成功' }); diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue index 542e23bd..f8a49665 100644 --- a/pages/users/order_confirm/index.vue +++ b/pages/users/order_confirm/index.vue @@ -50,14 +50,14 @@ + v-if="orderInfoVo.type === 0 && productType==='normal'"> 优惠券 {{couponTitle}} - + 积分抵扣 {{pointStatus ? "剩余积分":"当前积分"}} @@ -139,7 +139,7 @@ item.spuId), + skuIds: this.orderInfoVo.items.map(item => item.skuId), + categoryIds: this.orderInfoVo.items.map(item => item.categoryId) }).then(res => { this.$set(this.coupon, 'list', res.data); // 设置指定优惠劵已选择;用于 couponId 有参数时,默认选中一下 @@ -440,7 +443,7 @@ /** * 关闭 coupon 优惠劵的选择弹窗 */ - ChangCouponsClone: function() { + ChangCouponsClose: function() { this.$set(this.coupon, 'coupon', false); }, diff --git a/pages/users/user_get_coupon/index.vue b/pages/users/user_get_coupon/index.vue index d1cc3c25..af918259 100644 --- a/pages/users/user_get_coupon/index.vue +++ b/pages/users/user_get_coupon/index.vue @@ -9,7 +9,7 @@ - + {{ fen2yuan(item.discountPrice) }} {{ (item.discountPercent / 10.0).toFixed(1) }} 折 @@ -18,11 +18,11 @@ - 通用 - 品类 - 商品 + 商品 {{item.name}} @@ -30,8 +30,8 @@ {{ formatDate(item.validStartTime) + " - " + formatDate(item.validEndTime) }} - 已领取 - 立即领取 + 立即领取 + 已领取 @@ -111,7 +111,8 @@ getCoupon: function(id, index) { // 领取优惠券 CouponApi.takeCoupon(id).then(res => { - this.couponsList[index].takeStatus = true; + // 设置已领取,即不能再领取 + this.couponsList[index].canTake = res.data; this.$set(this, 'couponsList', this.couponsList); this.$util.Tips({ title: '领取成功' @@ -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; diff --git a/pages/users/user_sgin/index.vue b/pages/users/user_sgin/index.vue index 71071156..144ba0b7 100644 --- a/pages/users/user_sgin/index.vue +++ b/pages/users/user_sgin/index.vue @@ -60,7 +60,14 @@ 第 {{item.day}} 天签到积分奖励 {{ formatDate(item.createTime) }} - +{{ item.point }} + + + 积分 +{{ item.point }} + + + 经验 +{{ item.experience }} + + 点击加载更多 @@ -73,7 +80,8 @@ 签到成功 - 获得{{ point }}积分 + 获得{{ signResult.point }}积分 + 获得{{ signResult.experience }}经验 好的 @@ -98,7 +106,7 @@ signRecordList: [], // 签到记录 active: false, // 签到提示 - point: 0, // 刚签到获得的奖励 + signResult: 0, // 签到的结果 }; }, computed: mapGetters(['isLogin', 'userInfo']), @@ -176,7 +184,7 @@ } SignInApi.createSignInRecord().then(res => { this.active = true; - this.point = res.data.point; + this.signResult = res.data; // 重新获得签到信息 this.getSignInfo(); this.getSignList(); @@ -420,6 +428,11 @@ margin-top: 9rpx; } + .sign .list3 .item .num-title { + font-size: 10rpx; + margin-right: 8rpx; + } + .sign .list3 .item .num { font-size: 36rpx; font-family: 'Guildford Pro'; diff --git a/pages/users/user_sgin_list/index.vue b/pages/users/user_sgin_list/index.vue index 6acb95e6..0a45edab 100644 --- a/pages/users/user_sgin_list/index.vue +++ b/pages/users/user_sgin_list/index.vue @@ -9,7 +9,14 @@ 第 {{item.day}} 天签到积分奖励 {{ formatDate(item.createTime) }} - +{{ item.point }} + + + 积分 +{{ item.point }} + + + 经验 +{{ item.experience }} + + @@ -92,4 +99,9 @@