From b13734503b078e5c5aa50a6c7410375191048328 Mon Sep 17 00:00:00 2001 From: From-wh Date: Mon, 10 Apr 2023 18:41:08 +0800 Subject: [PATCH] =?UTF-8?q?improve;=20=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/uni-app/api/public.js | 10 ++ .../uni-app/pages/annex/vip_paid/index.vue | 9 +- .../uni-app/pages/annex/web_view/index.vue | 1 + .../uni-app/pages/goods/cashier/index.vue | 48 ++++--- .../pages/goods/order_confirm/index.vue | 2 - .../pages/goods/order_details/index.vue | 122 +----------------- .../uni-app/pages/goods/order_list/index.vue | 93 ------------- .../pages/users/user_invoice_order/index.vue | 77 ----------- .../pages/users/user_payment/index.vue | 24 ++++ 9 files changed, 70 insertions(+), 316 deletions(-) diff --git a/template/uni-app/api/public.js b/template/uni-app/api/public.js index a405aa252..c39ba1923 100644 --- a/template/uni-app/api/public.js +++ b/template/uni-app/api/public.js @@ -221,3 +221,13 @@ export function getCategoryVersion(name) { noAuth: true }); } + +/** + * 配置信息 + * + */ +export function basicConfig(name) { + return request.get(`basic_config`, {}, { + noAuth: true + }); +} diff --git a/template/uni-app/pages/annex/vip_paid/index.vue b/template/uni-app/pages/annex/vip_paid/index.vue index 5cab6e21a..e0a053cc9 100644 --- a/template/uni-app/pages/annex/vip_paid/index.vue +++ b/template/uni-app/pages/annex/vip_paid/index.vue @@ -135,9 +135,6 @@ groomList, memberOverdueTime } from '@/api/user.js'; - import { - orderOfflinePayType - } from '@/api/order.js'; import { toLogin } from '@/libs/login.js'; @@ -145,7 +142,9 @@ openPaySubscribe } from '@/utils/SubscribeMessage.js'; import dayjs from '@/plugin/dayjs/dayjs.min.js'; - + import { + basicConfig + } from '@/api/public.js' export default { components: { home, @@ -358,7 +357,7 @@ }); }, getOrderPayType() { - orderOfflinePayType().then(res => { + basicConfig().then(res => { const { ali_pay_status, pay_weixin_open diff --git a/template/uni-app/pages/annex/web_view/index.vue b/template/uni-app/pages/annex/web_view/index.vue index cb1bb5823..28d13b799 100644 --- a/template/uni-app/pages/annex/web_view/index.vue +++ b/template/uni-app/pages/annex/web_view/index.vue @@ -17,6 +17,7 @@ } }, onLoad(option) { + console.log(option) this.url = option.url; try { const res = uni.getSystemInfoSync(); diff --git a/template/uni-app/pages/goods/cashier/index.vue b/template/uni-app/pages/goods/cashier/index.vue index 19adb7e82..3c2dfc22f 100644 --- a/template/uni-app/pages/goods/cashier/index.vue +++ b/template/uni-app/pages/goods/cashier/index.vue @@ -46,6 +46,9 @@ getCashierOrder, orderPay } from '@/api/order.js'; + import { + basicConfig + } from '@/api/public.js' export default { components: { countDown, @@ -128,7 +131,7 @@ onLoad(options) { if (options.order_id) this.orderId = options.order_id if (options.from_type) this.fromType = options.from_type - this.getCashierOrder() + this.getBasicConfig() }, onShow() { let options = wx.getEnterOptionsSync(); @@ -172,6 +175,32 @@ } }, methods: { + getBasicConfig() { + basicConfig().then(res => { + //微信支付是否开启 + this.cartArr[0].payStatus = res.data.wechat_pay_status || 0 + //支付宝是否开启 + this.cartArr[1].payStatus = res.data.ali_pay_status || 0; + //#ifdef MP + this.cartArr[1].payStatus = 0; + //#endif + //余额支付是否开启 + this.cartArr[2].payStatus = res.data.yue_pay_status + if (res.data.offline_pay_status) { + this.cartArr[3].payStatus = 1 + } else { + this.cartArr[3].payStatus = 0 + } + //好友代付是否开启 + this.cartArr[4].payStatus = res.data.friend_pay_status || 0; + this.getCashierOrder() + }).catch(err => { + uni.hideLoading(); + return this.$util.Tips({ + title: err + }) + }) + }, getCashierOrder() { uni.showLoading({ title: this.$t(`创建订单中`) @@ -182,24 +211,7 @@ this.payPostage = res.data.pay_postage this.offlinePostage = res.data.offline_postage this.invalidTime = res.data.invalid_time - //微信支付是否开启 - this.cartArr[0].payStatus = res.data.wechat_pay_status || 0 - //支付宝是否开启 - this.cartArr[1].payStatus = res.data.ali_pay_status || 0; - //#ifdef MP - this.cartArr[1].payStatus = false; - //#endif - //余额支付是否开启 - // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money; this.cartArr[2].number = res.data.now_money; - this.cartArr[2].payStatus = res.data.yue_pay_status - if (res.data.offline_pay_status) { - this.cartArr[3].payStatus = 1 - } else { - this.cartArr[3].payStatus = 0 - } - //好友代付是否开启 - this.cartArr[4].payStatus = res.data.friend_pay_status || 0; uni.hideLoading(); }).catch(err => { uni.hideLoading(); diff --git a/template/uni-app/pages/goods/order_confirm/index.vue b/template/uni-app/pages/goods/order_confirm/index.vue index 4d062ae63..ac832ab71 100644 --- a/template/uni-app/pages/goods/order_confirm/index.vue +++ b/template/uni-app/pages/goods/order_confirm/index.vue @@ -228,8 +228,6 @@ - diff --git a/template/uni-app/pages/goods/order_details/index.vue b/template/uni-app/pages/goods/order_details/index.vue index 3ccf60af5..7a770cd53 100644 --- a/template/uni-app/pages/goods/order_details/index.vue +++ b/template/uni-app/pages/goods/order_details/index.vue @@ -406,10 +406,6 @@ - - - @@ -448,7 +444,6 @@ makeUpinvoice } from '@/api/user.js'; import home from '@/components/home'; - import payment from '@/components/payment'; import orderGoods from "@/components/orderGoods"; import ClipboardJS from "@/plugin/clipboard/clipboard.js"; import { @@ -466,7 +461,6 @@ import zbCode from '@/components/zb-code/zb-code.vue' export default { components: { - payment, home, invoicePicker, invoiceModal, @@ -587,7 +581,6 @@ } }, onShow() { - this.payClose() if (this.isLogin) { this.getOrderInfo(); this.getUserInfo(); @@ -675,29 +668,6 @@ url: `/pages/goods/order_refund_goods/index?orderId=` + this.order_id }) }, - // refundSubmit() { - // if (!this.express_num.trim()) { - // return this.$util.Tips({ - // title: '请输入物流单号' - // }) - // } - // refundExpress({ - // express_id: this.express_num, - // id: this.orderInfo.id - // }).then(res => { - // this.$util.Tips({ - // title: '操作成功', - // icon: 'success' - // }, () => { - // this.refund_close = false - // this.getOrderInfo(); - // }); - // }).catch(err => { - // this.$util.Tips({ - // title: err, - // }) - // }) - // }, getCustomerType() { getCustomerType().then(res => { this.customerInfo = res.data; @@ -732,76 +702,7 @@ }); // #endif }, - // openSubcribe(e, type) { - // let page = e; - // // #ifdef MP - // uni.showLoading({ - // title: '正在加载', - // }) - // openOrderRefundSubscribe().then(res => { - // uni.hideLoading(); - // uni.navigateTo({ - // url: page, - // success: (res) => { - // if (!type) { - // let cartList = []; - // this.cartInfo.forEach((item) => { - // let i = { - // cart_info: item, - // cart_id: item.id, - // cart_num: item.cart_num, - // surplus_num: item.cart_num - item.refund_num - // } - // cartList.push(i) - // }) - // res.eventChannel.emit('goodsData', { - // cartList: cartList, - // count: 1, - // }) - // } - // } - // }); - // }).catch(() => { - // uni.hideLoading(); - // }); - // // #endif - // // #ifndef MP - // uni.navigateTo({ - // url: page, - // success: (res) => { - // if (!type) { - // let cartList = []; - // this.cartInfo.forEach((item) => { - // let i = { - // cart_info: item, - // cart_id: item.id, - // cart_num: item.cart_num, - // surplus_num: item.cart_num - item.refund_num - // } - // cartList.push(i) - // }) - // res.eventChannel.emit('goodsData', { - // cartList: cartList, - // count: 1, - // }) - // } - // } - // }); - // // #endif - // }, - goReturnGoods() { - - }, - /** - * 事件回调 - * - */ - onChangeFun: function(e) { - let opt = e; - let action = opt.action || null; - let value = opt.value != undefined ? opt.value : null; - (action && this[action]) && this[action](value); - }, + goReturnGoods() {}, /** * 拨打电话 */ @@ -829,13 +730,6 @@ }, }); }, - /** - * 关闭支付组件 - * - */ - payClose: function() { - this.pay_close = false; - }, /** * 打开支付组件 * @@ -848,20 +742,6 @@ // this.pay_order_id = this.orderInfo.order_id; // this.totalPrice = this.orderInfo.pay_price; }, - /** - * 支付成功回调 - * - */ - pay_complete: function() { - this.pay_close = false; - this.pay_order_id = ''; - uni.navigateTo({ - url: '/pages/goods/order_pay_status/index?order_id=' + this.orderInfo.order_id + '&msg=' + - this.$t(`支付成功`) + - '&type=3' + '&totalPrice=' + this.totalPrice - }) - this.getOrderInfo(); - }, /** * 支付失败回调 * diff --git a/template/uni-app/pages/goods/order_list/index.vue b/template/uni-app/pages/goods/order_list/index.vue index 7ce298216..8bc05835d 100644 --- a/template/uni-app/pages/goods/order_list/index.vue +++ b/template/uni-app/pages/goods/order_list/index.vue @@ -136,8 +136,6 @@ - @@ -149,14 +147,10 @@ orderDel, orderPay } from '@/api/order.js'; - import { - getUserInfo - } from '@/api/user.js'; import { openOrderSubscribe } from '@/utils/SubscribeMessage.js'; import home from '@/components/home'; - import payment from '@/components/payment'; import { toLogin } from '@/libs/login.js'; @@ -170,7 +164,6 @@ import colors from '@/mixins/color.js'; export default { components: { - payment, home, emptyPage, // #ifdef MP @@ -188,35 +181,6 @@ orderStatus: 9, //订单状态 page: 1, limit: 20, - payMode: [{ - name: this.$t(`微信支付`), - icon: 'icon-weixinzhifu', - value: 'weixin', - title: this.$t(`使用微信快捷支付`), - payStatus: true - }, - { - name: this.$t(`支付宝支付`), - icon: 'icon-zhifubao', - value: 'alipay', - title: this.$t(`使用支付宝支付`), - payStatus: true - }, - { - name: this.$t(`余额支付`), - icon: 'icon-yuezhifu', - value: 'yue', - title: this.$t(`可用余额`), - number: 0, - payStatus: true - }, { - "name": this.$t(`好友代付`), - "icon": "icon-haoyoudaizhifu", - value: 'friend', - title: this.$t(`找微信好友支付`), - payStatus: 1, - } - ], pay_close: false, pay_order_id: '', totalPrice: '0', @@ -262,7 +226,6 @@ methods: { onLoadFun() { this.getOrderData(); - this.getUserInfo(); }, // 授权关闭 authColse: function(e) { @@ -278,17 +241,6 @@ let value = opt.value != undefined ? opt.value : null; action && this[action] && this[action](value); }, - /** - * 获取用户信息 - * - */ - getUserInfo: function() { - let that = this; - getUserInfo().then(res => { - that.payMode[2].number = res.data.now_money; - that.$set(that, 'payMode', that.payMode); - }); - }, /** * 关闭支付组件 * @@ -305,23 +257,6 @@ let that = this; orderData().then(res => { that.$set(that, 'orderData', res.data); - that.payMode.map(item => { - if (item.value == 'weixin') { - item.payStatus = res.data.pay_weixin_open ? true : false; - } - if (item.value == 'alipay') { - item.payStatus = res.data.ali_pay_status ? true : false; - } - if (item.value == 'yue') { - item.payStatus = res.data.yue_pay_status == 1 ? true : false; - } - if (item.value == 'friend') { - item.payStatus = res.data.friend_pay_status == 1 ? true : false; - } - }); - //#ifdef MP - this.payMode[1].payStatus = false; - //#endif }); }, /** @@ -362,34 +297,6 @@ uni.navigateTo({ url: `/pages/goods/cashier/index?order_id=${order_id}&from_type=order` }) - // this.$set(this, 'pay_close', true); - // this.$set(this, 'pay_order_id', order_id); - // this.$set(this, 'totalPrice', pay_price); - }, - /** - * 支付成功回调 - * - */ - pay_complete: function() { - this.loadend = false; - this.page = 1; - this.$set(this, 'orderList', []); - this.pay_close = false; - uni.navigateTo({ - url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id + - '&msg=' + this.$t(`支付成功`) + '&type=3&totalPrice=' + this.totalPrice - }) - this.pay_order_id = ''; - this.getOrderData(); - this.getOrderList(); - }, - /** - * 支付失败回调 - * - */ - pay_fail: function() { - this.pay_close = false; - this.pay_order_id = ''; }, /** * 去订单详情 diff --git a/template/uni-app/pages/users/user_invoice_order/index.vue b/template/uni-app/pages/users/user_invoice_order/index.vue index dab177304..ab4a199ac 100644 --- a/template/uni-app/pages/users/user_invoice_order/index.vue +++ b/template/uni-app/pages/users/user_invoice_order/index.vue @@ -164,9 +164,6 @@ - - -