From 290481e15771d6362ac1de4c8a6b4a7aae3f9484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Tue, 29 Apr 2025 10:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=98=E6=83=A0=E5=8A=B5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 4 +- pages/diy/components/diy/coupon.vue | 19 +++++---- pages/plugins/coupon/detail/detail.vue | 30 +++++++------- pages/plugins/coupon/index/index.vue | 14 +++---- pages/plugins/coupon/shop/shop.vue | 54 +++++++++++++------------- 5 files changed, 63 insertions(+), 58 deletions(-) diff --git a/App.vue b/App.vue index e4649d3b..5337dffd 100644 --- a/App.vue +++ b/App.vue @@ -7,10 +7,10 @@ data: { // 基础配置 // 数据接口请求地址 - request_url:'http://shopxo.com/', + request_url:'https://d1.shopxo.vip/', // 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/) - static_url:'http://shopxo.com/', + static_url:'https://d1.shopxo.vip/', // 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立) system_type: 'default', diff --git a/pages/diy/components/diy/coupon.vue b/pages/diy/components/diy/coupon.vue index be67aaec..8179b705 100644 --- a/pages/diy/components/diy/coupon.vue +++ b/pages/diy/components/diy/coupon.vue @@ -316,7 +316,7 @@ var user = app.globalData.get_user_info(this, 'coupon_receive_event'); if (user != false) { var temp_list = this.data_list; - if (temp_list[coupon_index]['is_operable'] != 0) { + if (temp_list[coupon_index]['status_type'] == 0) { uni.showLoading({ title: this.$t('common.processing_in_text'), }); @@ -331,12 +331,17 @@ }, // 全部领取 receive_all_event() { - const filter_data_list = this.data_list.map((item) => { - if (item.is_operable != 0 && item.status_type == 0) { - return item.id; - } - }); - this.coupon_api(filter_data_list.join(',')); + // 判断是否可领取的数量 + const temp_list = this.data_list.filter(item => item.status_type == 0); + // 可以领取的数量大于0的时候调接口 + if (temp_list.length > 0) { + const filter_data_list = this.data_list.map((item) => { + if (item.status_type == 0) { + return item.id; + } + }); + this.coupon_api(filter_data_list.join(',')); + } }, // 优惠劵领取事件 coupon_api(val, index) { diff --git a/pages/plugins/coupon/detail/detail.vue b/pages/plugins/coupon/detail/detail.vue index 5fb0a082..2dd6b073 100644 --- a/pages/plugins/coupon/detail/detail.vue +++ b/pages/plugins/coupon/detail/detail.vue @@ -15,11 +15,11 @@ - - - - - + + + + + @@ -43,8 +43,8 @@ theme_view: app.globalData.get_theme_value_view(), data_bottom_line_status: false, data_list_loding_status: 1, - data_list_loding_msg: '', - bottom_fixed_style: '', + data_list_loding_msg: '', + bottom_fixed_style: '', params: {}, data: null, data_base: null, @@ -63,12 +63,12 @@ }, onLoad(params) { - // 调用公共事件方法 - app.globalData.page_event_onload_handle(params); - - // 设置参数 - this.setData({ - params: app.globalData.launch_params_handle(params), + // 调用公共事件方法 + app.globalData.page_event_onload_handle(params); + + // 设置参数 + this.setData({ + params: app.globalData.launch_params_handle(params), }); }, @@ -113,7 +113,7 @@ share_info: { title: this.data.name, desc: this.data.desc, - path: '/pages/plugins/coupon/detail/detail', + path: '/pages/plugins/coupon/detail/detail', query: 'id='+this.data.id }, }); @@ -162,7 +162,7 @@ var user = app.globalData.get_user_info(this, 'coupon_receive_event'); if (user != false) { var data = this.data; - if (data['is_operable'] != 0) { + if (data['status_type'] == 0) { uni.showLoading({ title: this.$t('common.processing_in_text'), }); diff --git a/pages/plugins/coupon/index/index.vue b/pages/plugins/coupon/index/index.vue index b9ee202b..39ecf5a7 100644 --- a/pages/plugins/coupon/index/index.vue +++ b/pages/plugins/coupon/index/index.vue @@ -22,11 +22,11 @@ - - - - - + + + + + @@ -54,7 +54,7 @@ coupon_static_url: coupon_static_url + 'app/', data_bottom_line_status: false, data_list_loding_status: 1, - data_list_loding_msg: '', + data_list_loding_msg: '', bottom_fixed_style: '', data_list: [], data_base: null, @@ -181,7 +181,7 @@ var user = app.globalData.get_user_info(this, 'coupon_receive_event'); if (user != false) { var temp_list = this.data_list; - if (temp_list[index]['is_operable'] != 0) { + if (temp_list[index]['status_type'] == 0) { uni.showLoading({ title: this.$t('common.processing_in_text'), }); diff --git a/pages/plugins/coupon/shop/shop.vue b/pages/plugins/coupon/shop/shop.vue index 590fcb55..f9fb1010 100644 --- a/pages/plugins/coupon/shop/shop.vue +++ b/pages/plugins/coupon/shop/shop.vue @@ -180,35 +180,35 @@ var user = app.globalData.get_user_info(this, 'coupon_receive_event'); if (user != false) { var temp_list = this.data_list; - if (temp_list[index]['is_operable'] != 0) { + 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); - } - } - }, - fail: () => { - uni.hideLoading(); - app.globalData.showToast(this.$t('common.internet_error_tips')); - }, + }); + 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); + } + } + }, + fail: () => { + uni.hideLoading(); + app.globalData.showToast(this.$t('common.internet_error_tips')); + }, }); } }