From 4964ad26c60acd58253ca43537a3cf8ea1db5751 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Wed, 14 May 2025 22:42:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 1 - pages.json | 4 +- pages/goods-detail/goods-detail.vue | 124 ++++++++++-------- .../components/coupon-card/coupon-card.vue | 16 ++- pages/plugins/coupon/detail/detail.vue | 94 +++++++------ pages/plugins/coupon/index/index.vue | 94 +++++++------ pages/plugins/coupon/shop/shop.vue | 92 +++++++------ .../goods-compare/goods-compare.vue | 10 +- 8 files changed, 221 insertions(+), 214 deletions(-) diff --git a/App.vue b/App.vue index 84beff36..8f5e9cda 100644 --- a/App.vue +++ b/App.vue @@ -769,7 +769,6 @@ } } } else { - uni.hideLoading(); self.showToast(res.data.msg); } }, diff --git a/pages.json b/pages.json index c8510eed..b02b38a9 100644 --- a/pages.json +++ b/pages.json @@ -117,20 +117,20 @@ "enablePullDownRefresh": true, "navigationBarTitleText": "", "usingComponents": { + "component-goods-comments": "/pages/goods-detail/components/goods-comments/goods-comments", "component-binding-detail-list": "/pages/plugins/binding/components/binding-detail-list/binding-detail-list", "component-realstore-list": "/pages/plugins/realstore/components/realstore-list/realstore-list", "component-shop-list": "/pages/plugins/shop/components/shop-list/shop-list", "component-ask-comments-goods": "/pages/plugins/ask/components/ask-comments-goods/ask-comments-goods", - "component-goods-comments": "/pages/goods-detail/components/goods-comments/goods-comments", "component-coupon-card": "/pages/plugins/coupon/components/coupon-card/coupon-card", "component-goods-compare": "/pages/plugins/goodscompare/components/goods-compare/goods-compare" }, "componentPlaceholder": { + "component-goods-comments": "view", "component-binding-detail-list": "view", "component-realstore-list": "view", "component-shop-list": "view", "component-ask-comments-goods": "view", - "component-goods-comments": "view", "component-coupon-card": "view", "component-goods-compare": "view" } diff --git a/pages/goods-detail/goods-detail.vue b/pages/goods-detail/goods-detail.vue index d4c35fc8..a7e81b5f 100644 --- a/pages/goods-detail/goods-detail.vue +++ b/pages/goods-detail/goods-detail.vue @@ -222,7 +222,7 @@ {{ item.desc || item.name }} - {{ item.status_operable_name }} + {{ item.status_operable_name }} @@ -529,7 +529,7 @@ - + @@ -618,7 +618,9 @@ - + + + @@ -641,12 +643,12 @@ import componentBindingDetailList from '@/pages/plugins/binding/components/binding-detail-list/binding-detail-list'; import componentSharePopup from '@/components/share-popup/share-popup'; import componentGoodsComments from '@/pages/goods-detail/components/goods-comments/goods-comments'; - import componentAskCommentsGoods from '@/pages/plugins/ask/components/ask-comments-goods/ask-comments-goods'; - import componentCouponCard from '@/pages/plugins/coupon/components/coupon-card/coupon-card'; + import componentCategorylimitWarmTips from '@/pages/goods-detail/components/categorylimit-warm-tips/categorylimit-warm-tips'; import componentRealstoreCart from '@/components/realstore-cart/realstore-cart'; import componentGoodsList from '@/components/goods-list/goods-list'; import componentWholesaleRules from '@/components/wholesale-rules/wholesale-rules'; - import componentCategorylimitWarmTips from '@/pages/goods-detail/components/categorylimit-warm-tips/categorylimit-warm-tips'; + import componentAskCommentsGoods from '@/pages/plugins/ask/components/ask-comments-goods/ask-comments-goods'; + import componentCouponCard from '@/pages/plugins/coupon/components/coupon-card/coupon-card'; import componentGoodsCompare from '@/pages/plugins/goodscompare/components/goods-compare/goods-compare'; var common_static_url = app.globalData.get_static_url('common'); @@ -747,8 +749,6 @@ plugins_seckill_is_valid: false, // 优惠劵插件 plugins_coupon_data: null, - temp_coupon_receive_index: null, - temp_coupon_receive_value: null, popup_coupon_status: false, // 购买记录插件 plugins_salerecords_data: null, @@ -789,9 +789,9 @@ componentGoodsBatchBuy, componentPopup, componentBadge, + componentTrnNav, componentCountdown, componentNoData, - componentTrnNav, componentBottomLine, componentOnlineService, componentRealstoreList, @@ -799,12 +799,12 @@ componentBindingDetailList, componentSharePopup, componentGoodsComments, - componentAskCommentsGoods, - componentCouponCard, + componentCategorylimitWarmTips, componentRealstoreCart, componentGoodsList, componentWholesaleRules, - componentCategorylimitWarmTips, + componentAskCommentsGoods, + componentCouponCard, componentGoodsCompare }, @@ -1350,55 +1350,69 @@ }); }, - // 优惠劵领取事件 - coupon_receive_event(index, value) { - // 参数处理 - if ((index || null) == null && (value || null) == null) { - var index = this.temp_coupon_receive_index; - var value = this.temp_coupon_receive_value; - } else { - this.setData({ - temp_coupon_receive_index: index, - temp_coupon_receive_value: value, - }); + // 优惠券组件领取事件 + coupon_receive_back_event() { + if (!app.globalData.is_single_page_check()) { + return false; } - // 登录校验 - var user = app.globalData.get_user_info(this, 'coupon_receive_event'); + let user = app.globalData.get_user_info(this, 'coupon_receive_back_event'); if (user != false) { - var temp_list = this.plugins_coupon_data.data; - uni.showLoading({ - title: this.$t('common.processing_in_text'), - }); - uni.request({ - url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), - method: 'POST', - data: { - coupon_id: value, - }, - dataType: 'json', - success: (res) => { - uni.hideLoading(); - if (res.data.code == 0) { - app.globalData.showToast(res.data.msg, 'success'); - temp_list[index] = res.data.data.coupon; - this.setData({ - 'plugins_coupon_data.data': temp_list, - }); - } else { - if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) { - app.globalData.showToast(res.data.msg); - } - } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast(this.$t('common.internet_error_tips')); - }, - }); + let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null; + if(res != null) { + this.coupon_receive_handle(res); + } } }, + // 优惠劵领取事件 + coupon_receive_event(e) { + if (!app.globalData.is_single_page_check()) { + return false; + } + // 登录校验 + let user = app.globalData.get_user_info(this, 'coupon_receive_event', e); + if (user != false) { + this.coupon_receive_handle(e.currentTarget.dataset); + } + }, + + // 优惠券领取处理 + coupon_receive_handle(params) { + let index = params.index; + let value = params.value; + let temp_list = this.plugins_coupon_data.data; + uni.showLoading({ + title: this.$t('common.processing_in_text'), + }); + uni.request({ + url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), + method: 'POST', + data: { + coupon_id: value, + }, + dataType: 'json', + success: (res) => { + uni.hideLoading(); + if (res.data.code == 0) { + app.globalData.showToast(res.data.msg, 'success'); + temp_list[index] = res.data.data.coupon; + this.setData({ + 'plugins_coupon_data.data': temp_list, + }); + } else { + if (app.globalData.is_login_check(res.data, this, 'coupon_receive_handle', params)) { + app.globalData.showToast(res.data.msg); + } + } + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast(this.$t('common.internet_error_tips')); + }, + }); + }, + // 购买记录提示处理 plugins_salerecords_tips_handle() { // 销毁之前的任务 diff --git a/pages/plugins/coupon/components/coupon-card/coupon-card.vue b/pages/plugins/coupon/components/coupon-card/coupon-card.vue index 3f869190..b47283d2 100644 --- a/pages/plugins/coupon/components/coupon-card/coupon-card.vue +++ b/pages/plugins/coupon/components/coupon-card/coupon-card.vue @@ -27,7 +27,7 @@ - {{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }} + {{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }} {{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }} {{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }} @@ -41,7 +41,7 @@ - {{$t('coupon-card.coupon-card.j318xx')}} + {{$t('coupon-card.coupon-card.j318xx')}} @@ -136,13 +136,19 @@ // 符号 currency_symbol: app.globalData.currency_symbol(), // 首页地址 - home_page_url: tabbar_pages[0], + home_page_url: tabbar_pages[0], + // 缓存key + cache_key: 'cache_plugins_coupon_receive_key', }; }, methods: { // 领取 - receive(e) { - this.$emit('call-back', this.propIndex, this.propData.id); + receive_event(e) { + uni.setStorageSync(this.cache_key, { + index: this.propIndex, + value: this.propData.id + }); + this.$emit('call-back'); }, // url事件 diff --git a/pages/plugins/coupon/detail/detail.vue b/pages/plugins/coupon/detail/detail.vue index 2dd6b073..ff0de4dd 100644 --- a/pages/plugins/coupon/detail/detail.vue +++ b/pages/plugins/coupon/detail/detail.vue @@ -5,7 +5,7 @@ - + @@ -144,55 +144,51 @@ }); }, // 优惠劵领取事件 - coupon_receive_event(index, value) { - if (!app.globalData.is_single_page_check()) { - return false; - } - // 参数处理 - if ((index || null) == null && (value || null) == null) { - var index = this.temp_coupon_receive_index; - var value = this.temp_coupon_receive_value; - } else { - this.setData({ - temp_coupon_receive_index: index, - temp_coupon_receive_value: value, - }); - } - // 登录校验 - var user = app.globalData.get_user_info(this, 'coupon_receive_event'); - if (user != false) { - var data = this.data; - if (data['status_type'] == 0) { - uni.showLoading({ - title: this.$t('common.processing_in_text'), - }); - uni.request({ - url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), - method: 'POST', - data: { - coupon_id: value, - }, - dataType: 'json', - success: (res) => { - uni.hideLoading(); - if (res.data.code == 0) { - app.globalData.showToast(res.data.msg, 'success'); - data = res.data.data.coupon; - this.setData({ - data_list: data, - }); - } else { - if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) { - app.globalData.showToast(res.data.msg); + coupon_receive_back_event() { + if (!app.globalData.is_single_page_check()) { + return false; + } + // 缓存 + let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null; + if(res != null) { + // 登录校验 + let user = app.globalData.get_user_info(this, 'coupon_receive_back_event'); + if (user != false) { + let index = res.index; + let value = res.value; + let data = this.data; + if (data['status_type'] == 0) { + uni.showLoading({ + title: this.$t('common.processing_in_text'), + }); + uni.request({ + url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), + method: 'POST', + data: { + coupon_id: value, + }, + dataType: 'json', + success: (res) => { + uni.hideLoading(); + if (res.data.code == 0) { + app.globalData.showToast(res.data.msg, 'success'); + data = res.data.data.coupon; + this.setData({ + data_list: data, + }); + } else { + if (app.globalData.is_login_check(res.data, this, 'coupon_receive_back_event')) { + app.globalData.showToast(res.data.msg); + } } - } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast(this.$t('common.internet_error_tips')); - }, - }); - } + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast(this.$t('common.internet_error_tips')); + }, + }); + } + } } }, diff --git a/pages/plugins/coupon/index/index.vue b/pages/plugins/coupon/index/index.vue index 39ecf5a7..746387ca 100644 --- a/pages/plugins/coupon/index/index.vue +++ b/pages/plugins/coupon/index/index.vue @@ -11,7 +11,7 @@ - + @@ -163,55 +163,51 @@ }); }, // 优惠劵领取事件 - coupon_receive_event(index, value) { - if (!app.globalData.is_single_page_check()) { - return false; - } - // 参数处理 - if ((index || null) == null && (value || null) == null) { - var index = this.temp_coupon_receive_index; - var value = this.temp_coupon_receive_value; - } else { - this.setData({ - temp_coupon_receive_index: index, - temp_coupon_receive_value: value, - }); - } - // 登录校验 - var user = app.globalData.get_user_info(this, 'coupon_receive_event'); - if (user != false) { - var temp_list = this.data_list; - if (temp_list[index]['status_type'] == 0) { - uni.showLoading({ - title: this.$t('common.processing_in_text'), - }); - uni.request({ - url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), - method: 'POST', - data: { - coupon_id: value, - }, - dataType: 'json', - success: (res) => { - uni.hideLoading(); - if (res.data.code == 0) { - app.globalData.showToast(res.data.msg, 'success'); - temp_list[index] = res.data.data.coupon; - this.setData({ - data_list: temp_list, - }); - } else { - if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) { - app.globalData.showToast(res.data.msg); + coupon_receive_back_event() { + if (!app.globalData.is_single_page_check()) { + return false; + } + // 缓存 + let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null; + if(res != null) { + // 登录校验 + let user = app.globalData.get_user_info(this, 'coupon_receive_back_event'); + if (user != false) { + let index = res.index; + let value = res.value; + let temp_list = this.data_list; + if (temp_list[index]['status_type'] == 0) { + uni.showLoading({ + title: this.$t('common.processing_in_text'), + }); + uni.request({ + url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), + method: 'POST', + data: { + coupon_id: value, + }, + dataType: 'json', + success: (res) => { + uni.hideLoading(); + if (res.data.code == 0) { + app.globalData.showToast(res.data.msg, 'success'); + temp_list[index] = res.data.data.coupon; + this.setData({ + data_list: temp_list, + }); + } else { + if (app.globalData.is_login_check(res.data, this, 'coupon_receive_back_event')) { + app.globalData.showToast(res.data.msg); + } } - } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast(this.$t('common.internet_error_tips')); - }, - }); - } + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast(this.$t('common.internet_error_tips')); + }, + }); + } + } } }, diff --git a/pages/plugins/coupon/shop/shop.vue b/pages/plugins/coupon/shop/shop.vue index f9fb1010..caec3645 100644 --- a/pages/plugins/coupon/shop/shop.vue +++ b/pages/plugins/coupon/shop/shop.vue @@ -5,7 +5,7 @@ - + @@ -162,54 +162,50 @@ }, // 优惠劵领取事件 - coupon_receive_event(index, value) { - if (!app.globalData.is_single_page_check()) { - return false; - } - // 参数处理 - if ((index || null) == null && (value || null) == null) { - var index = this.temp_coupon_receive_index; - var value = this.temp_coupon_receive_value; - } else { - this.setData({ - temp_coupon_receive_index: index, - temp_coupon_receive_value: value, - }); - } - // 登录校验 - var user = app.globalData.get_user_info(this, 'coupon_receive_event'); - if (user != false) { - var temp_list = this.data_list; - if (temp_list[index]['status_type'] == 0) { - uni.showLoading({ - title: this.$t('common.processing_in_text'), - }); - uni.request({ - url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), - method: 'POST', - data: { - coupon_id: value, - }, - dataType: 'json', - success: (res) => { - uni.hideLoading(); - if (res.data.code == 0) { - app.globalData.showToast(res.data.msg, 'success'); - temp_list[index] = res.data.data.coupon; - this.setData({ - data_list: temp_list, - }); - } else { - if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) { - app.globalData.showToast(res.data.msg); + coupon_receive_back_event() { + if (!app.globalData.is_single_page_check()) { + return false; + } + // 缓存 + let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null; + if(res != null) { + // 登录校验 + let user = app.globalData.get_user_info(this, 'coupon_receive_back_event'); + if (user != false) { + let index = res.index; + let value = res.value; + let temp_list = this.data_list; + if (temp_list[index]['status_type'] == 0) { + uni.showLoading({ + title: this.$t('common.processing_in_text'), + }); + uni.request({ + url: app.globalData.get_request_url('receive', 'coupon', 'coupon'), + method: 'POST', + data: { + coupon_id: value, + }, + dataType: 'json', + success: (res) => { + uni.hideLoading(); + if (res.data.code == 0) { + app.globalData.showToast(res.data.msg, 'success'); + temp_list[index] = res.data.data.coupon; + this.setData({ + data_list: temp_list, + }); + } else { + if (app.globalData.is_login_check(res.data, this, 'coupon_receive_back_event')) { + app.globalData.showToast(res.data.msg); + } } - } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast(this.$t('common.internet_error_tips')); - }, - }); + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast(this.$t('common.internet_error_tips')); + }, + }); + } } } }, diff --git a/pages/plugins/goodscompare/components/goods-compare/goods-compare.vue b/pages/plugins/goodscompare/components/goods-compare/goods-compare.vue index 1f4ffe5d..56dac793 100644 --- a/pages/plugins/goodscompare/components/goods-compare/goods-compare.vue +++ b/pages/plugins/goodscompare/components/goods-compare/goods-compare.vue @@ -58,25 +58,25 @@ popup_status: false, data_list: [], goods: null, - config: null, + config: null }; }, components: { componentPopup, - componentNoData, + componentNoData }, // 属性 props: { propGoods: { type: [Array,Object,String], - default: '', + default: '' }, }, // 页面被展示 created: function () { this.init_config(); this.setData({ - goods: this.propGoods, + goods: this.propGoods }); }, // 属性值改变监听 @@ -84,7 +84,7 @@ // 是否灰度 propGoods(value, old_value) { this.setData({ - goods: value, + goods: value }); }, },