diff --git a/components/payment/index.vue b/components/payment/index.vue index ff1e796..7dd92d9 100644 --- a/components/payment/index.vue +++ b/components/payment/index.vue @@ -4,8 +4,7 @@ 选择付款方式 - + @@ -69,7 +68,7 @@ }; }, mounted:function(){ - + }, methods: { close: function() { @@ -101,7 +100,7 @@ }else if(paytype == 'alipay'){ // #ifndef MP type = 'alipay'; - // #endif + // #endif // #ifdef MP type = 'alipayQr'; // #endif @@ -115,7 +114,7 @@ uni.showLoading({ title: '支付中' }); - let orderApi = that.order_type === 1 ? presellOrderPay : that.order_type === 2 ? integralOrderPay : orderPay + let orderApi = that.order_type === 1 ? presellOrderPay : that.order_type === 2 ? integralOrderPay : orderPay orderApi(that.order_id, { type: type, // #ifdef H5 @@ -127,7 +126,7 @@ jsConfig = res.data.result.config, callback_key = res.data.result.pay_key, goPages = that.returnUrl ? that.returnUrl : '/pages/users/order_list/index'; - switch (status) { + switch (status) { case 'ORDER_EXIST': case 'EXTEND_ORDER': case 'PAY_ERROR': @@ -138,13 +137,13 @@ }); return that.$util.Tips({ title: res.message - }); + }); break; case 'success': uni.hideLoading(); this.$emit('onChangeFun', { action: 'payClose' - }); + }); return that.$util.Tips({ title: '支付成功', icon: 'success' @@ -158,19 +157,19 @@ uni.hideLoading(); this.$emit('onChangeFun', { action: 'payClose' - }); + }); uni.navigateTo({ url: '/pages/order_pay_back/index?keyCode='+callback_key+'&url='+jsConfig, - }) - return - break; + }) + return + break; // #ifndef MP case "wechat": case "weixin": case "weixinApp": jsConfig.timeStamp = jsConfig.timestamp; // #ifndef APP-PLUS - that.$wechat.pay(jsConfig).then(res => { + that.$wechat.pay(jsConfig).then(res => { console.log('测试支付数据无效的success:'+res.data) this.$emit('onChangeFun', { action: 'payClose' @@ -179,7 +178,7 @@ return that.$util.Tips({ title: '支付成功', icon: 'success' - }, { + }, { tab: 5, url: goPages + 'status=1' }); @@ -193,12 +192,12 @@ }else{ return that.$util.Tips({ title: '取消支付' - }, { + }, { tab: 5, url: goPages + '?status=0' }); } - } + } }) // #endif // #ifdef APP-PLUS @@ -218,7 +217,7 @@ return that.$util.Tips({ title: '支付成功', icon: 'success' - }, { + }, { tab: 5, url: goPages + 'status=1' }); @@ -231,7 +230,7 @@ }else{ return that.$util.Tips({ title: '取消支付' - }, { + }, { tab: 5, url: goPages + '?status=0' }); @@ -265,15 +264,15 @@ return that.$util.Tips({ title: '支付成功', icon: 'success' - }, { + }, { tab: 5, url: goPages + '?status=1' }); - + return that.$util.Tips({ title: '支付成功', icon: 'success' - }, { + }, { tab: 5, url: goPages + '?status=1' }); @@ -288,7 +287,7 @@ }); }, complete: function(e) { - uni.hideLoading(); + uni.hideLoading(); //关闭当前页面跳转至订单状态 if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({ title: '取消支付' @@ -321,8 +320,8 @@ location.href = locations; }, 100); break; - // #endif - + // #endif + // #ifdef APP-PLUS case 'alipayApp': uni.requestPayment({ @@ -335,11 +334,11 @@ return that.$util.Tips({ title: '支付成功', icon: 'success' - }, { + }, { tab: 5, url: goPages + 'status=1' }); - + }, fail: (e) => { return that.$util.Tips({ diff --git a/config/app.js b/config/app.js index 6a45260..e76d97b 100644 --- a/config/app.js +++ b/config/app.js @@ -6,13 +6,13 @@ let VUE_APP_WS_URL = `ws://${location.hostname}?type=user` let openPlantGrass = '-openPlantGrass-' // 网络接口修改此字符 小程序域名要求https -// let httpApi = 'https://bt.test.cdlfjy.com/' // 开发 -let httpApi = 'https://mp.scwmbh.cn/' // 生产 +let httpApi = 'https://bt.test.cdlfjy.com/' // 开发 +// let httpApi = 'https://mp.scwmbh.cn/' // 生产 // 聊天接口修改此字符 小程序聊天要求wss 例如: -// let wsApi = 'wss://bt.test.cdlfjy.com' -let wsApi = 'wss://mp.scwmbh.cn' +let wsApi = 'wss://bt.test.cdlfjy.com' +// let wsApi = 'wss://mp.scwmbh.cn' module.exports = { diff --git a/pages/agent/invite/index.vue b/pages/agent/invite/index.vue index deae6fd..034c8b3 100644 --- a/pages/agent/invite/index.vue +++ b/pages/agent/invite/index.vue @@ -183,6 +183,7 @@ export default { mer_images: {}, }, // 地区选择器 + area_value:[], area_status: false, address: '', // 商户相关 @@ -267,7 +268,8 @@ export default { this.isShowAuth = true }else{ // 已登录 获取信息 - this.init(); + if(Number(this.apply_info_id) > 0) this.getApplyInfo(); + else this.init(); } }, methods: { @@ -284,7 +286,6 @@ export default { }, // 授权成功 初始化 init () { - if(Number(this.apply_info_id) > 0) this.getApplyInfo(); this.getInviteAgentInfo() this.generatePageTitle(); this.getConfig(); @@ -395,8 +396,17 @@ export default { }, // 商户相关 - 获取分类列表 getMerClass() { + let _this = this; merClassifly().then(res => { - this.mer_cate_list = res.data + _this.mer_cate_list = res.data + if(Number(_this.apply_info_id) > 0){ + Object.values(res.data).forEach(function(item, index) { + if (item.merchant_category_id == _this.apply_info.mer_class_id) { + _this.mer_cate_index = index; + _this.mer_class_name = item.category_name + } + }); + } }).catch(res => { this.$util.Tips({ title: res @@ -405,8 +415,17 @@ export default { }, // 商户相关 - 获取类型列表 getMerType() { + let _this = this; getStoreTypeApi().then(res => { - this.mer_type_list = res.data + _this.mer_type_list = res.data + if(Number(_this.apply_info_id) > 0){ + Object.values(res.data).forEach(function(item, index) { + if (item.mer_type_id == _this.apply_info.mer_type_id) { + _this.mer_type_index = index; + _this.mer_type_name = item.type_name + } + }); + } }).catch(res => { this.$util.Tips({ title: res @@ -470,15 +489,13 @@ export default { // 提交申请 submitAgentApplyInfo(applyInfo).then(res => { if (res.status == 200) { - if(Number(_this.pay_money) > 0){ + if(Number(_this.pay_money) > 0 && Number(_this.apply_info_id) <= 0){ let status = res.data.status, orderId = res.data.result.order_id, callback_key = res.data.result.pay_key, jsConfig = res.data.result.config; // let goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message; let goPages = '/pages/agent/invite/record'; - - switch (status) { case 'ORDER_EXIST': case 'EXTEND_ORDER': @@ -606,7 +623,8 @@ export default { title: '取消支付' }, { tab: 5, - url: pages + '&status=0' + // url: pages + '&status=0' + url: pages }); }, }) @@ -679,14 +697,15 @@ export default { title: '取消支付' }, { tab: 5, - url: pages + '&status=0' + // url: pages + '&status=0' + url: pages }); } }else{ _this.$util.Tips({ title: '操作成功!', },{ - tab: 5, + tab: 4, url: '/pages/agent/invite/record' }); } @@ -713,8 +732,9 @@ export default { let data = res.data || {}; _this.apply_info = data || {}; _this.agent_type = data.agent_type; - _this.agent_id = data.pid - _this.getInviteAgentInfo() + _this.agent_id = data.pid; + _this.areaChange({}); + _this.init(); } }).catch(err => { this.$util.Tips({title: err}); diff --git a/pages/agent/invite/record.vue b/pages/agent/invite/record.vue index 4beb8d3..1842a6b 100644 --- a/pages/agent/invite/record.vue +++ b/pages/agent/invite/record.vue @@ -3,25 +3,41 @@ - - {{item.contact_name}}({{agentType(item.agent_type)}}) - + {{item.contact_name}}({{agentType(item.agent_type)}}) 提交时间:{{item.create_time}} 原因:{{item.reason}} - - - - - {{statusText(item.status)}} - - 修改 + + + {{statusText(item)}} + + 去支付 + + + + + + + {{statusText(item)}} + + 修改 + + + + + @@ -32,11 +48,17 @@ import {mapGetters} from "vuex"; import emptyPage from '@/components/emptyPage.vue'; import {agentApplyRecord} from "@/api/agent"; import authorize from '@/components/Authorize'; +import payment from '@/components/payment'; +import {getUserInfo} from "@/api/user"; export default { components: { authorize, - emptyPage + emptyPage, + payment + }, + computed: { + ...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor']) }, data() { return { @@ -45,11 +67,36 @@ export default { // 登录相关 isAuto: false, //没有授权的不会自动授权 isShowAuth: false,//是否隐藏授权 + // 支付相关 + pay_list: [ + { + name: "微信支付", + icon: "icon-weixinzhifu", + value: 'wechat', + title: '微信快捷支付', + payStatus: 1 + }, + { + name: "支付宝支付", + icon: "icon-zhifubao", + value: 'alipay', + title: '支付宝支付', + payStatus: this.$store.getters.globalData.alipay_open + }, + { + name: "余额支付", + icon: "icon-yuezhifu", + value: 'balance', + title: '可用余额:', + number: 0, + payStatus: this.$store.getters.globalData.yue_pay_status + } + ], + pay_close: false, + pay_order_id: '', + totalPrice: 0, } }, - computed: { - ...mapGetters(['isLogin', 'userInfo', 'viewColor']) - }, onLoad() { let _this = this; // 判断:是否登录 @@ -81,6 +128,9 @@ export default { // 授权成功 初始化 init () { this.getRecordList(); + getUserInfo().then(res => { + this.pay_list[2].number = res.data.now_money; + }); }, // 记录 getRecordList() { @@ -99,13 +149,18 @@ export default { }); }, //状态判断 - statusText(number) { - let statusData = { - 0: "审核中", - 1: "已通过", - 2: "已驳回" - }; - return statusData[number] + statusText(item) { + let orderStatus = item.orderInfo ? item.orderInfo.status : 0; + if(Number(orderStatus) != 3 && item.orderInfo){ + return '待支付:' + '¥' + item.orderInfo.pay_price; + }else{ + let statusData = { + 0: "审核中", + 1: "已通过", + 2: "已驳回" + }; + return statusData[Number(item.status)] + } }, //状态判断 agentType(number) { @@ -127,6 +182,26 @@ export default { url: `/pages/agent/invite/index?apply_id=${item.id}` }) }, + // 支付 - 发起支付 + goPay(orderInfo) { + this.$set(this, 'pay_close', true); + this.order_id = orderInfo.group_order_id; + this.pay_order_id = orderInfo.group_order_id.toString() + this.$set(this, 'totalPrice', orderInfo.pay_price); + }, + // 支付 - 事件回调 + onChangeFun(e) { + let opt = e; + let action = opt.action || null; + let value = opt.value != undefined ? opt.value : null; + (action && this[action]) && this[action](value); + }, + // 支付 - 关闭弹框 + payClose: function() { + this.pay_close = false; + }, + + } } diff --git a/pages/users/order_list/index.vue b/pages/users/order_list/index.vue index 2f51d39..a429cb5 100644 --- a/pages/users/order_list/index.vue +++ b/pages/users/order_list/index.vue @@ -117,7 +117,7 @@ x{{goods.product_num}} - + @@ -711,7 +711,7 @@ // 关闭发票弹窗 changeInvoiceClose: function(data) { if(data)this.getInvoiceData(data); - this.$set(this.invoice, 'invoice', false); + this.$set(this.invoice, 'invoice', false); }, // 开票回调 getInvoiceData(data) { @@ -1022,7 +1022,7 @@ } } } - + .search { height: 70rpx; padding: 0 30rpx; @@ -1031,7 +1031,7 @@ background-color: #FFFFFF; font-size: 26rpx; color: #999999; - + .iconfont { margin-right: 10rpx; font-size: 23rpx;