From 9638e5da9f1cdae122012a95d8ea6471664edeec Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Tue, 29 Jul 2025 20:56:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E7=BD=91=E7=BB=9C=E9=AA=8C=E8=AF=81=E4=BB=85=E5=AF=B9?= =?UTF-8?q?app=E6=9C=89=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/payment/payment.vue | 88 ++++++++++--- components/realstore-cart/realstore-cart.vue | 2 +- locale/en.json | 6 +- locale/zh.json | 6 +- pages.json | 38 +++--- pages/cashier/cashier.css | 24 ++++ .../allocation => }/cashier/cashier.vue | 119 +++++++++++++----- pages/goods-category/goods-category.vue | 2 + pages/index/index.vue | 2 + pages/plugins/allocation/cashier/cashier.css | 6 - .../order-detail/order-detail.css | 23 ---- .../order-detail/order-detail.vue | 18 --- pages/plugins/realstore/detail/detail.vue | 2 + pages/plugins/realstore/index/index.vue | 2 + pages/plugins/shop/detail/detail.vue | 6 +- pages/plugins/shop/index/index.vue | 6 +- .../weixinliveplayer/detail/detail.vue | 5 +- 17 files changed, 233 insertions(+), 122 deletions(-) create mode 100644 pages/cashier/cashier.css rename pages/{plugins/allocation => }/cashier/cashier.vue (56%) delete mode 100644 pages/plugins/allocation/cashier/cashier.css diff --git a/components/payment/payment.vue b/components/payment/payment.vue index 66594e49..6acb5dd1 100644 --- a/components/payment/payment.vue +++ b/components/payment/payment.vue @@ -7,8 +7,10 @@ {{$t('payment.payment.973g2e')}} - {{ popup_view_pay_data.name }} - + {{ popup_view_pay_data.name }} + + + {{ popup_view_pay_data.msg }} @@ -101,7 +103,9 @@ // 支付返回数据 pay_response_data: {}, // 支付确认弹窗 - payment_confirm_modal_status: false, + payment_confirm_modal_status: false, + // 微信app + weixinapp: null, }; }, props: { @@ -234,7 +238,26 @@ this.setData({ payment_list: this.propPaymentList, payment_id: Number(this.propPaymentId) == 0 ? this.propDefaultPaymentId : Number(this.propPaymentId), - }); + }); + + // #ifdef APP + // 是否存在微信app + var self = this; + plus.share.getServices(res => { + let weixinapp = null; + for(let i in res) { + if(res[i].id == 'weixin') { + weixinapp = res[i]; + break; + } + } + if(weixinapp) { + self.setData({ + weixinapp: weixinapp + }); + } + }); + // #endif }, methods: { // 支付弹窗关闭 @@ -460,7 +483,8 @@ // APP支付 app_pay_handle(self, data, order_id) { var arr = { - Alipay: 'alipay', + Alipay: 'alipay', + AlipayCert: 'alipay', Weixin: 'wxpay', PayPal: 'paypal' } @@ -493,7 +517,27 @@ } } }); - } else { + } else { + // 是否打开微信app + var status = true; + if(data.data.substr(0, 12) == 'weixinapp://') { + if(this.weixinapp == null) { + app.globalData.showToast(this.$t('detail.detail.86g7e1')); + return false; + } + var weixin_original_id = app.globalData.get_config('config.common_app_mini_weixin_share_original_id', null); + if(weixin_original_id == null) { + app.globalData.showToast(this.$t('detail.detail.567uyh')); + return false; + } + this.weixinapp.launchMiniProgram({ + id: weixin_original_id, + type: 0, + path: data.data.substr(12) + }); + status = false; + } + // 先清除定时任务 if(self.open_pay_url_timer != null) { clearTimeout(self.open_pay_url_timer); @@ -507,15 +551,17 @@ self.setData({ open_pay_url_status: true }); - // 打开url - plus.runtime.openURL(data.data, function(error) { - uni.hideLoading(); - // 打开url失败、并进入提示失败环节 - self.setData({ - open_pay_url_status: false - }); - self.order_item_pay_fail_handle(data, order_id, error.message+'('+error.code+')'); - }); + // 打开url + if(status) { + plus.runtime.openURL(data.data, function(error) { + uni.hideLoading(); + // 打开url失败、并进入提示失败环节 + self.setData({ + open_pay_url_status: false + }); + self.order_item_pay_fail_handle(data, order_id, error.message+'('+error.code+')'); + }); + } // 定时3秒后提示用户确认支付状态 self.open_pay_url_timer = setTimeout(function() { if(self.open_pay_url_status) { @@ -633,15 +679,17 @@ self.order_item_pay_success_handle(data, order_id); }, fail: (res) => { - let error = res.memo || res.errMsg || null; - if(error != null) { + let msg = res.memo || res.errMsg || null; + if(msg != null) { let code = res.resultCode || res.errCode || res.errNo || null; if(code != null) { - error += '('+code+')'; + msg += '('+code+')'; + } + if(msg.indexOf('cancel') != -1) { + msg = null; } - console.log(error); } - self.order_item_pay_fail_handle(data, order_id, self.$t('paytips.paytips.6y488i')); + self.order_item_pay_fail_handle(data, order_id, msg || self.$t('paytips.paytips.6y488i')); }, }); } diff --git a/components/realstore-cart/realstore-cart.vue b/components/realstore-cart/realstore-cart.vue index 0e8177cb..beea2b19 100644 --- a/components/realstore-cart/realstore-cart.vue +++ b/components/realstore-cart/realstore-cart.vue @@ -406,7 +406,7 @@ if(limit_type.length > 0) { var type_data = this.buy_use_type_data(); if(limit_type.indexOf(type_data.data_index) != -1 || limit_type.indexOf(type_data.data_index.toString()) != -1) { - return temp['name'] + this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price; + return this.$t('realstore-cart.realstore-cart.miv944')+ this.propCurrencySymbol + starting_price; } } else { return this.$t('realstore-cart.realstore-cart.miv944') + this.propCurrencySymbol + starting_price; diff --git a/locale/en.json b/locale/en.json index 6ad764d6..fa7d2012 100644 --- a/locale/en.json +++ b/locale/en.json @@ -89,7 +89,10 @@ "not_supported_scan_tips": "H5 webpage does not support scanning codes", "copy_link": "Copy link", "multilingual": "multilingual", - "ver_update_tips": "Your WeChat version is too low, please update to the latest version!" + "ver_update_tips": "Your WeChat version is too low, please update to the latest version!", + "click_pay_text" : "Click to initiate payment", + "again_pay_text" : "Restart payment", + "back_app_text" : "Return to APP" }, "client": { "weixin": "WeChat", @@ -750,6 +753,7 @@ "y2639j": "Start time", "fa8h7j": "poster", "eg25j9": "Enter live", + "567uyh": "WeChat original ID is not configured in the background", "86g7e1": "No WeChat app installed", "9d3o6w": "Please open it in the WeChat mini program", "6xvl35": "Generating", diff --git a/locale/zh.json b/locale/zh.json index db195f77..d6a80aee 100644 --- a/locale/zh.json +++ b/locale/zh.json @@ -89,7 +89,10 @@ "not_supported_scan_tips": "H5网页不支持扫码", "copy_link": "复制链接", "multilingual": "多语言", - "ver_update_tips": "你的微信版本过低,请更新至最新版本!" + "ver_update_tips": "你的微信版本过低,请更新至最新版本!", + "click_pay_text" : "点击发起支付", + "again_pay_text" : "重新发起支付", + "back_app_text" : "返回APP" }, "client": { "weixin": "微信", @@ -740,6 +743,7 @@ "y2639j": "开播时间", "fa8h7j": "海报", "eg25j9": "进入直播", + "567uyh": "后台没有配置微信原始id", "86g7e1": "未安装微信APP", "9d3o6w": "请在微信小程序中打开", "6xvl35": "生成中...", diff --git a/pages.json b/pages.json index a39a5b71..ea86ee94 100644 --- a/pages.json +++ b/pages.json @@ -475,6 +475,25 @@ } ] }, + { + "root": "pages/cashier", + "pages": [ + { + "path": "cashier", + "style": { + // #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || APP + "navigationStyle": "custom", + // #endif + // #ifdef MP-ALIPAY + "transparentTitle": "auto", + "titlePenetrate": "YES", + // #endif + "enablePullDownRefresh": false, + "navigationBarTitleText": "" + } + } + ] + }, { "root": "pages/paytips", "pages": [ @@ -1832,25 +1851,6 @@ } ] }, - { - "root": "pages/plugins/allocation", - "pages": [ - { - "path": "cashier/cashier", - "style": { - // #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || APP - "navigationStyle": "custom", - // #endif - // #ifdef MP-ALIPAY - "transparentTitle": "auto", - "titlePenetrate": "YES", - // #endif - "enablePullDownRefresh": false, - "navigationBarTitleText": "" - } - } - ] - }, { "root": "pages/plugins/hospital", "pages": [ diff --git a/pages/cashier/cashier.css b/pages/cashier/cashier.css new file mode 100644 index 00000000..8085578b --- /dev/null +++ b/pages/cashier/cashier.css @@ -0,0 +1,24 @@ +.page { + height: 100vh; +} +.page > .content { + padding-top: 30%; +} +/** + * 支付确认弹窗 + */ +.payment-confirm-modal { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: rgba(0, 0, 0, 0.6); + z-index: 100; + width: 100%; + height: 100%; +} +.payment-confirm-modal .content { + margin-top: 60%; + z-index: 101; +} \ No newline at end of file diff --git a/pages/plugins/allocation/cashier/cashier.vue b/pages/cashier/cashier.vue similarity index 56% rename from pages/plugins/allocation/cashier/cashier.vue rename to pages/cashier/cashier.vue index 9581b9c3..1e009fe4 100644 --- a/pages/plugins/allocation/cashier/cashier.vue +++ b/pages/cashier/cashier.vue @@ -11,16 +11,26 @@ {{pay_msg}} - + - - + + + + + + + + + {{$t('common.payment_in_text')}} + + + @@ -47,6 +57,10 @@ data: {}, pay_status: 0, pay_msg: '', + payment_confirm_modal_status: false, + is_first: 1, + pay_btn_text: this.$t('common.again_pay_text'), + pay_back_app_text: this.$t('common.back_app_text') }; }, @@ -98,7 +112,7 @@ success: (res) => { if (res.code) { uni.request({ - url: app.globalData.get_request_url("paydata", "cashier", "allocation"), + url: app.globalData.get_request_url("paydata", "cashier", self.params.plugins || ''), method: 'POST', data: {...self.params, ...{authcode: res.code}}, dataType: 'json', @@ -115,6 +129,7 @@ this.pay_handle(); } else { this.setData({ + is_first: 0, data_list_loding_status: 0, data_list_loding_msg: res.data.msg, }); @@ -123,6 +138,7 @@ fail: () => { uni.stopPullDownRefresh(); this.setData({ + is_first: 0, data_list_loding_status: 0, data_list_loding_msg: self.$t('common.internet_error_tips'), }); @@ -133,6 +149,7 @@ fail: (e) => { uni.stopPullDownRefresh(); this.setData({ + is_first: 0, data_list_loding_status: 0, data_list_loding_msg: self.$t('login.login.3nmrg2'), }); @@ -141,37 +158,83 @@ }, // 支付处理 - pay_handle(e) { - if(this.pay_status != 1) - { + pay_handle() { + if(this.pay_status != 1) { + var self = this; + var data = self.data.pay_data; + // 是否打开另一个小程序 + if (typeof data != 'string' && (data.appid || null) != null && (data.path || null) != null && (data.order_no || null) != null) { + uni.navigateToMiniProgram({ + appId: data.appid, + path: data.path, + extraData: data.extra_data || {}, + success(res) { + // 提示弹窗 + self.setData({ + is_first: 0, + payment_confirm_modal_status: true, + }); + }, + fail(res) { + self.setData({ + is_first: 0, + pay_status: 2, + pay_msg: self.is_first == 1 ? '' : self.$t('paytips.paytips.6y488i'), + pay_btn_text: self.is_first == 1 ? self.$t('common.click_pay_text') : self.$t('common.again_pay_text'), + }); + } + }); + } else { + self.setData({ + is_first: 0, + pay_status: 0, + pay_msg: self.$t('common.payment_in_text'), + }); + uni.requestPayment({ + timeStamp: data.timeStamp, + nonceStr: data.nonceStr, + package: data.package, + signType: data.signType, + paySign: data.paySign, + success: (res) => { + self.setData({ + pay_status: 1, + pay_msg: self.$t('paytips.paytips.679rxu'), + }); + }, + fail: (res) => { + self.setData({ + pay_status: 2, + pay_msg: self.$t('paytips.paytips.6y488i'), + }); + }, + }); + } + } + }, + + // 支付确认弹窗事件 + payment_confirm_event(e) { + // 关闭弹窗清除定时任务 + this.setData({ + payment_confirm_modal_status: false, + }); + // 回调处理 + if(parseInt(e.currentTarget.dataset.type || 0) == 1) { this.setData({ - pay_status: 0, - pay_msg: this.$t('common.payment_in_text'), + pay_status: 1, + pay_msg: this.$t('paytips.paytips.679rxu'), }); - uni.requestPayment({ - timeStamp: this.data.pay_data.timeStamp, - nonceStr: this.data.pay_data.nonceStr, - package: this.data.pay_data.package, - signType: this.data.pay_data.signType, - paySign: this.data.pay_data.paySign, - success: (res) => { - this.setData({ - pay_status: 1, - pay_msg: this.$t('paytips.paytips.679rxu'), - }); - }, - fail: (res) => { - this.setData({ - pay_status: 2, - pay_msg: this.$t('paytips.paytips.6y488i'), - }); - }, + } else { + this.setData({ + pay_status: 2, + pay_msg: this.$t('paytips.paytips.6y488i'), }); } } } }; - \ No newline at end of file diff --git a/pages/goods-category/goods-category.vue b/pages/goods-category/goods-category.vue index bb8ce723..c210fb9c 100644 --- a/pages/goods-category/goods-category.vue +++ b/pages/goods-category/goods-category.vue @@ -565,11 +565,13 @@ // 获取数据 init(params = {}) { + // #ifdef APP // 网络检查 if ((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'init', params); return false; } + // #endif // 请求数据 if (this.is_first == 1) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 1c07ee22..626aa437 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -501,11 +501,13 @@ params['is_cache'] = 0; } + // #ifdef APP // 网络检查 if ((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'init', params); return false; } + // #endif // 没有缓存数据则开启加载层 if (upd_data == null) { diff --git a/pages/plugins/allocation/cashier/cashier.css b/pages/plugins/allocation/cashier/cashier.css deleted file mode 100644 index 72469d86..00000000 --- a/pages/plugins/allocation/cashier/cashier.css +++ /dev/null @@ -1,6 +0,0 @@ -.page { - height: 100vh; -} -.page > .content { - padding-top: 20%; -} \ No newline at end of file diff --git a/pages/plugins/distribution/order-detail/order-detail.css b/pages/plugins/distribution/order-detail/order-detail.css index 5233e973..d1ffe075 100644 --- a/pages/plugins/distribution/order-detail/order-detail.css +++ b/pages/plugins/distribution/order-detail/order-detail.css @@ -19,27 +19,4 @@ .goods-image { width: 160rpx; height: 160rpx; -} - -/* -* 地址信息 -*/ -.address-base, -.address-detail { - padding: 10rpx 0; -} -.address-detail .icon { - width: 30rpx; - height: 35rpx !important; -} -.address-detail .text { - width: calc(100% - 40rpx); -} -.address-detail .text { - line-height: 36rpx; -} -.address-alias, -.address-map-submit { - padding: 0 15rpx; - line-height: 40rpx; } \ No newline at end of file diff --git a/pages/plugins/distribution/order-detail/order-detail.vue b/pages/plugins/distribution/order-detail/order-detail.vue index 709a6356..78aefc66 100644 --- a/pages/plugins/distribution/order-detail/order-detail.vue +++ b/pages/plugins/distribution/order-detail/order-detail.vue @@ -2,24 +2,6 @@ - - - - {{ detail.address_data.alias }} - {{ detail.address_data.name }} - {{ detail.address_data.tel }} - - - - - {{ detail.address_data.province_name }}{{ detail.address_data.city_name }}{{ detail.address_data.county_name }}{{ detail.address_data.address }} - - - - - {{$t('order-detail.order-detail.9er1pc')}} diff --git a/pages/plugins/realstore/detail/detail.vue b/pages/plugins/realstore/detail/detail.vue index 0171df6e..cc50c466 100644 --- a/pages/plugins/realstore/detail/detail.vue +++ b/pages/plugins/realstore/detail/detail.vue @@ -511,11 +511,13 @@ // 获取数据-初始化 get_detail_init(params = {}) { + // #ifdef APP // 网络检查 if((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'get_detail_init'); return false; } + // #endif // 请求数据 uni.request({ diff --git a/pages/plugins/realstore/index/index.vue b/pages/plugins/realstore/index/index.vue index e7c92bde..93b843e6 100644 --- a/pages/plugins/realstore/index/index.vue +++ b/pages/plugins/realstore/index/index.vue @@ -237,11 +237,13 @@ methods: { // 初始化 get_data(params = {}) { + // #ifdef APP // 网络检查 if((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'get_data', params); return false; } + // #endif // 请求数据 var lng = 0; diff --git a/pages/plugins/shop/detail/detail.vue b/pages/plugins/shop/detail/detail.vue index f71eb113..22f3a8e8 100644 --- a/pages/plugins/shop/detail/detail.vue +++ b/pages/plugins/shop/detail/detail.vue @@ -160,12 +160,14 @@ }, // 获取数据 - get_data(params = {}) { + get_data(params = {}) { + // #ifdef APP // 网络检查 if((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'get_data', params); return false; - } + } + // #endif // 请求数据 uni.request({ diff --git a/pages/plugins/shop/index/index.vue b/pages/plugins/shop/index/index.vue index fed6dd37..686f4b12 100644 --- a/pages/plugins/shop/index/index.vue +++ b/pages/plugins/shop/index/index.vue @@ -125,12 +125,14 @@ methods: { // 初始化 - get_data(params = {}) { + get_data(params = {}) { + // #ifdef APP // 网络检查 if((params || null) == null || (params.loading || 0) == 0) { app.globalData.network_type_handle(this, 'get_data', params); return false; - } + } + // #endif // 请求数据 uni.request({ diff --git a/pages/plugins/weixinliveplayer/detail/detail.vue b/pages/plugins/weixinliveplayer/detail/detail.vue index 6f039e0b..fc2a8266 100644 --- a/pages/plugins/weixinliveplayer/detail/detail.vue +++ b/pages/plugins/weixinliveplayer/detail/detail.vue @@ -209,7 +209,8 @@ let sweixin = null; for(let i in res) { if(res[i].id == 'weixin') { - sweixin = res[i]; + sweixin = res[i]; + break; } } //唤醒微信小程序 @@ -223,6 +224,8 @@ app.globalData.showToast(this.$t('detail.detail.86g7e1')); } }); + } else { + app.globalData.showToast(this.$t('detail.detail.567uyh')); } return false; // #endif