diff --git a/api/merchant.js b/api/merchant.js index ad23c41..07e7ee3 100644 --- a/api/merchant.js +++ b/api/merchant.js @@ -4,6 +4,10 @@ import request from "@/utils/request.js"; export function promoteQrCodes(data) { return request.get('merchant/promote_qr_code',data); } +// 商户中心 - 买单二维码 +export function onlinePaymentQrCodes(data) { + return request.get('merchant/online_payment_qr_code',data); +} @@ -16,4 +20,3 @@ export function promoteQrCodes(data) { - diff --git a/pages/admin/business/index.vue b/pages/admin/business/index.vue index 19434a1..69e022f 100644 --- a/pages/admin/business/index.vue +++ b/pages/admin/business/index.vue @@ -34,6 +34,7 @@ import emptyPage from '@/components/emptyPage.vue' import shopList from '@/components/shopList'; import {promoteQrCodes} from "@/api/merchant"; +import {onlinePaymentQrCodes} from "../../../api/merchant"; export default { name: 'business', @@ -107,6 +108,12 @@ import {promoteQrCodes} from "@/api/merchant"; icon: 'iconfont icon-erweima1' }); } + list.push({ + type: 'online_payment_qr_code', + title: '买单二维码', + url: '', + icon: 'iconfont icon-erweima1' + }); return list; } @@ -134,7 +141,10 @@ import {promoteQrCodes} from "@/api/merchant"; this.downStatus = false; }, goNext(item){ - if(item.type == 'qr_code' && this.service.qr_code_show == 1){ + if(item.type == 'online_payment_qr_code'){ + this.createOnlinePaymentQrCode(); + } + else if(item.type == 'qr_code' && this.service.qr_code_show == 1){ this.createQrCode(); } else if(item.type == 'customer' && this.service.status == 0){ @@ -162,7 +172,7 @@ import {promoteQrCodes} from "@/api/merchant"; }) } }, - // 推广二维码 - 生成二维码 + // 二维码 - 生成推广二维码 createQrCode(){ let _this = this; promoteQrCodes({ mer_id: _this.service.mer_id }).then(res => { @@ -176,6 +186,20 @@ import {promoteQrCodes} from "@/api/merchant"; }); }); }, + // 二维码 - 生成买单二维码 + createOnlinePaymentQrCode(){ + let _this = this; + onlinePaymentQrCodes({ mer_id: _this.service.mer_id }).then(res => { + if (res.status == 200) { + _this.qrCode = res.data.qr_code || ''; + _this.$refs.qrCodePopup.open('center'); + } + }).catch(err => { + this.$util.Tips({ + title: err + }); + }); + }, // 推广二维码 - 关闭二维码 closeQrCode(){ this.$refs.qrCodePopup.close(); diff --git a/pages/users/online_payment/payment/index.vue b/pages/users/online_payment/payment/index.vue index a8fa246..c756bb6 100644 --- a/pages/users/online_payment/payment/index.vue +++ b/pages/users/online_payment/payment/index.vue @@ -7,7 +7,7 @@ {{ mer_info.mer_name || '请选择门店' }} - 切换 + 切换 消费记录 @@ -108,6 +108,7 @@ export default { mer_info:{}, mer_list: {}, mer_search: { + mer_id: 0, search_text: '', }, // 买单相关 @@ -118,6 +119,7 @@ export default { return_url: 'http://' + window.location.host + '/pages/users/order_list/index', // #endif }, + default_mer_id: 0, //支付方式 pay_list: [ { @@ -162,6 +164,14 @@ export default { ...mapGetters(['isLogin', 'userInfo', 'viewColor']) }, onLoad(options) { + // 二维码参数接收 + if(options.scene){ + // console.log("接收参数 - 未转义",options.scene) + var scene = this.$util.getUrlParams(decodeURIComponent(options.scene)); + // console.log("接收参数 - 转义后",scene) + this.default_mer_id = scene.mer_id || 0; + this.mer_search.mer_id = scene.mer_id || 0; + } // 判断:是否登录 if (!this.isLogin) { // 未登录 授权登录 @@ -213,6 +223,10 @@ export default { searchMer(this.mer_search) .then(res => { _this.mer_list = res.data || {}; + // 判断:是否存在默认商户 存在则使用默认商户,且不可变更 + if(Number(_this.default_mer_id) > 0 && Object.values(_this.mer_list).length === 1){ + this.selectedMer(_this.mer_list[0]); + } }) .catch(err => { this.$util.Tips({