From 1f7824b0d7732b83ab23699344975df29ae4e95c Mon Sep 17 00:00:00 2001 From: owen Date: Tue, 26 Sep 2023 20:44:17 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E5=96=84APP=E4=BC=98=E6=83=A0=E5=88=B8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api.js | 2 +- api/order.js | 2 +- api/promotion/coupon.js | 9 --------- pages/goods_details/index.vue | 4 ++-- pages/index/index.vue | 6 +++--- pages/users/user_get_coupon/index.vue | 3 ++- 6 files changed, 9 insertions(+), 17 deletions(-) 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; From 810f311a1314a102ed7cbf5aeed8f5212221e0f1 Mon Sep 17 00:00:00 2001 From: owen Date: Tue, 26 Sep 2023 22:46:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BC=98=E6=83=A0=E5=88=B8=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users/order_confirm/index.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue index b1a77e6f..da92dbe0 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 ? "剩余积分":"当前积分"}} @@ -387,7 +387,10 @@ */ getCouponList: function() { CouponApi.getMatchCouponList({ - // TODO 芋艿:这里应该补充下参数 + price: this.orderInfoVo.price.payPrice, + spuIds: this.orderInfoVo.items.map(item => 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 有参数时,默认选中一下 From 78da791d4c590dde3a6a8f5c4814047294c8ea83 Mon Sep 17 00:00:00 2001 From: owen Date: Tue, 26 Sep 2023 23:20:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BC=98=E6=83=A0=E5=88=B8=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/couponListWindow/index.vue | 2 +- pages/goods_details/index.vue | 4 ++-- pages/index/index.vue | 3 ++- pages/users/order_confirm/index.vue | 4 ++-- pages/users/user_get_coupon/index.vue | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/components/couponListWindow/index.vue b/components/couponListWindow/index.vue index bdf5d4c8..272de737 100644 --- a/components/couponListWindow/index.vue +++ b/components/couponListWindow/index.vue @@ -80,7 +80,7 @@ methods: { close: function() { this.type = 1 - this.$emit('ChangCouponsClone'); + this.$emit('ChangCouponsClose'); }, /** * 选择优惠劵 diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index 72bb29cb..f507036d 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -226,7 +226,7 @@ @@ -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 36433900..e658c242 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -394,7 +394,8 @@ */ getCoupon: function(id, index) { CouponApi.takeCoupon(id).then(res => { - this.$set(this.couponList[index], 'takeStatus', true); + // 设置已领取,即不能再领取 + this.$set(this.couponList[index], 'takeStatus', res.data !== true); this.$util.Tips({ title: '领取成功' }); diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue index da92dbe0..9a7f2f6f 100644 --- a/pages/users/order_confirm/index.vue +++ b/pages/users/order_confirm/index.vue @@ -139,7 +139,7 @@ { - // todo 会导致take_limit_count失效 - this.couponsList[index].takeStatus = true; + // 设置已领取,即不能再领取 + this.couponsList[index].takeStatus = res.data !== true; this.$set(this, 'couponsList', this.couponsList); this.$util.Tips({ title: '领取成功' From 1ff0b665b65b5cdf13f7c10c608b078cb47db4b3 Mon Sep 17 00:00:00 2001 From: owen Date: Sat, 30 Sep 2023 22:05:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=9A?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=98=AF=E5=90=A6=E9=A2=86=E5=8F=96=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/promotion/coupon.js | 8 ++++++++ components/couponListWindow/index.vue | 12 ++++++------ pages/goods_details/index.vue | 4 ++-- pages/index/index.vue | 17 +++++++++-------- pages/users/user_get_coupon/index.vue | 14 +++++++------- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/api/promotion/coupon.js b/api/promotion/coupon.js index bee13ad6..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,14 +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 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 272de737..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 || '已领取'}} @@ -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 f507036d..1463c620 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -819,8 +819,8 @@ * 获取优惠券 */ getCouponList(useType) { - CouponApi.getCouponTemplatePage({spuId: this.id, productScope: useType}).then(res => { - this.$set(this.coupon, 'list', res.data.list); + CouponApi.getCouponTemplateList({spuId: this.id, productScope: useType, count: 10}).then(res => { + this.$set(this.coupon, 'list', res.data); }) }, /** diff --git a/pages/index/index.vue b/pages/index/index.vue index e658c242..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,8 +382,8 @@ * 获得优惠劵列表 */ getcouponList() { - CouponApi.getCouponTemplatePage({pageSize: 2}).then(res => { - this.$set(this, 'couponList', res.data.list); + CouponApi.getCouponTemplateList({ count: 2 }).then(res => { + this.$set(this, 'couponList', res.data); }).catch(err => { return this.$util.Tips({ title: err @@ -395,7 +396,7 @@ getCoupon: function(id, index) { CouponApi.takeCoupon(id).then(res => { // 设置已领取,即不能再领取 - this.$set(this.couponList[index], 'takeStatus', res.data !== true); + this.$set(this.couponList[index], 'canTake', res.data !== true); this.$util.Tips({ title: '领取成功' }); diff --git a/pages/users/user_get_coupon/index.vue b/pages/users/user_get_coupon/index.vue index d29ed35a..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) }} - 已领取 - 立即领取 + 立即领取 + 已领取 @@ -112,7 +112,7 @@ // 领取优惠券 CouponApi.takeCoupon(id).then(res => { // 设置已领取,即不能再领取 - this.couponsList[index].takeStatus = res.data !== true; + this.couponsList[index].canTake = res.data; this.$set(this, 'couponsList', this.couponsList); this.$util.Tips({ title: '领取成功' From 1256956825d18b75619bf64f6469810e1251f960 Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 1 Oct 2023 09:53:53 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=AD=BE=E5=88=B0=EF=BC=9A=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E5=90=8E=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E3=80=81=E7=BB=8F=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/users/user_sgin/index.vue | 21 +++++++++++++++++---- pages/users/user_sgin_list/index.vue | 14 +++++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) 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 @@