diff --git a/pages.json b/pages.json index 9dfbe01..c6f81dc 100644 --- a/pages.json +++ b/pages.json @@ -539,6 +539,12 @@ "navigationBarTitleText": "商品兑换" } }, + { + "path": "online_payment/exchange/vegetable", + "style": { + "navigationBarTitleText": "商品兑换" + } + }, { "path": "online_payment/exchange/record", "style": { diff --git a/pages/admin/business/index.vue b/pages/admin/business/index.vue index 2cf5921..f13f21f 100644 --- a/pages/admin/business/index.vue +++ b/pages/admin/business/index.vue @@ -34,177 +34,223 @@ import emptyPage from '@/components/emptyPage.vue' import shopList from '@/components/shopList'; import {promoteQrCodes,onlinePaymentQrCodes} from "@/api/service"; +import { getSiteQrCode } from '@/api/exchange.js'; - export default { - name: 'business', - components: { - shopList, - emptyPage - }, - data() { - return { - is_sys: '', - downStatus: false, - service: null, - storeList: {}, - // 二维码 - qrCode: '', - } - }, - computed: { - list(){ - if(!this.service) return []; - const merId = this.service.mer_id; - const list = []; - if(this.service.status){ - list.push({ - type: 'customer', - title: '客服记录', - url: '/pages/chat/customer_list/index?type=1&mer_id=' + merId, - icon: 'iconfont icon-kefujilu' - }); - } - if(this.service.is_verify){ - list.push({ - title: '订单核销', - url: '/pages/admin/order_cancellation/index?mer_id=' + merId, - icon: 'iconfont icon-dingdanhexiao' - }); - } - if(this.service.customer){ - list.push({ - title: '订单管理', - url: '/pages/admin/order/index?mer_id=' + merId, - icon: 'iconfont icon-dingdanguanli' - }); - } - if(this.service.is_goods){ - list.push({ - title: '商品管理', - url: '/pages/product/list/index?mer_id=' + merId, - icon: 'iconfont icon-shangjiaguanli' - }); - } - if(this.service.is_user){ - list.push({ - title: '用户管理', - url: '/pages/admin/custom/index?mer_id=' + merId, - icon: 'iconfont icon-kehu-xuanzhong' - }); - } - if(this.service.staff_manage){ - list.push({ - title: '员工管理', - url: '/pages/admin/business/staff?mer_id=' + merId, - icon: 'iconfont icon-kehu-xuanzhong' - }); - } - if(this.service.qr_code_show){ - list.push({ - type: 'qr_code', - title: '推广二维码', - url: '', - icon: 'iconfont icon-erweima1' - }); - } +export default { + name: 'business', + components: { + shopList, + emptyPage + }, + data() { + return { + is_sys: '', + downStatus: false, + service: null, + storeList: {}, + // 二维码 + qrCode: '', + } + }, + computed: { + list(){ + if(!this.service) return []; + const merId = this.service.mer_id; + const list = []; + if(this.service.status){ list.push({ - type: 'online_payment_qr_code', - title: '买单二维码', + type: 'customer', + title: '客服记录', + url: '/pages/chat/customer_list/index?type=1&mer_id=' + merId, + icon: 'iconfont icon-kefujilu' + }); + } + if(this.service.is_verify){ + list.push({ + title: '订单核销', + url: '/pages/admin/order_cancellation/index?mer_id=' + merId, + icon: 'iconfont icon-dingdanhexiao' + }); + } + if(this.service.customer){ + list.push({ + title: '订单管理', + url: '/pages/admin/order/index?mer_id=' + merId, + icon: 'iconfont icon-dingdanguanli' + }); + } + if(this.service.is_goods){ + list.push({ + title: '商品管理', + url: '/pages/product/list/index?mer_id=' + merId, + icon: 'iconfont icon-shangjiaguanli' + }); + } + if(this.service.is_user){ + list.push({ + title: '用户管理', + url: '/pages/admin/custom/index?mer_id=' + merId, + icon: 'iconfont icon-kehu-xuanzhong' + }); + } + if(this.service.staff_manage){ + list.push({ + title: '员工管理', + url: '/pages/admin/business/staff?mer_id=' + merId, + icon: 'iconfont icon-kehu-xuanzhong' + }); + } + if(this.service.qr_code_show){ + list.push({ + type: 'qr_code', + title: '推广码', url: '', icon: 'iconfont icon-erweima1' }); + } + list.push({ + type: 'online_payment_qr_code', + title: '买单码', + url: '', + icon: 'iconfont icon-erweima1' + }); + list.push({ + type: 'exchange_qr_code', + title: '商品兑换码', + url: '', + icon: 'iconfont icon-erweima1' + }); - return list; - } - }, - onLoad: function(options) { - this.is_sys = options.is_sys; - this.getStoreList({is_sys:this.is_sys}); - uni.setNavigationBarTitle({ - title: this.is_sys ? '平台管理' : '商家管理' - }) - }, - methods: { - getStoreList: function(data) { - this.$nextTick(() => { - this.$refs.shopList.getStoreList(data) - }); - }, - changeTips(data) { - if(Object.values(this.storeList).length > 1){ - this.downStatus = !this.downStatus; - this.$refs.shopList.isShowStore(); - } - }, - changeClose() { - this.downStatus = false; - }, - goNext(item){ - 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){ - return this.$util.Tips({ - title: '客服已离线,请开启客服状态!' - }); - } - else{ - uni.navigateTo({ - url: item.url, - }); - } - }, - getService: function(data) { - this.storeList = this.$refs.shopList.storeList || {}; + return list; + } + }, + onLoad: function(options) { + this.is_sys = options.is_sys; + this.getStoreList({is_sys:this.is_sys}); + uni.setNavigationBarTitle({ + title: this.is_sys ? '平台管理' : '商家管理' + }) + }, + methods: { + getStoreList: function(data) { + this.$nextTick(() => { + this.$refs.shopList.getStoreList(data) + }); + }, + changeTips(data) { + if(Object.values(this.storeList).length > 1){ + this.downStatus = !this.downStatus; + this.$refs.shopList.isShowStore(); + } + }, + changeClose() { + this.downStatus = false; + }, + goNext(item){ + if(item.type == 'online_payment_qr_code'){ + this.createOnlinePaymentQrCode(); + } + else if(item.type == 'exchange_qr_code'){ + this.createExchangeQrCode(); + } + else if(item.type == 'qr_code' && this.service.qr_code_show == 1){ + this.createQrCode(); + } + else if(item.type == 'customer' && this.service.status == 0){ + return this.$util.Tips({ + title: '客服已离线,请开启客服状态!' + }); + } + else{ + uni.navigateTo({ + url: item.url, + }); + } + }, + getService: function(data) { + this.storeList = this.$refs.shopList.storeList || {}; - this.service = data; - if(data && data.merchant){ - uni.setNavigationBarTitle({ - title: data.merchant.mer_name - }) - }else{ - uni.setNavigationBarTitle({ - title: (!data.mer_id) ? '平台管理' : '商家管理' - }) - } - }, - // 二维码 - 生成推广二维码 - createQrCode(){ - let _this = this; - promoteQrCodes({ 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 - }); + this.service = data; + if(data && data.merchant){ + uni.setNavigationBarTitle({ + title: data.merchant.mer_name + }) + }else{ + uni.setNavigationBarTitle({ + title: (!data.mer_id) ? '平台管理' : '商家管理' + }) + } + }, + // 二维码 - 生成推广二维码 + createQrCode(){ + let _this = this; + promoteQrCodes({ 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 }); - }, - // 二维码 - 生成买单二维码 - 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 - }); + }); + }, + // 二维码 - 生成买单二维码 + 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(); - }, - } - } + }); + }, + // 二维码 - 生成商品兑换码 + createExchangeQrCode(){ + let _this = this; + // 点击按钮触发弹框输入框的显示 + uni.showModal({ + title: '兑换商品金额', // 弹框标题 + content: '', + editable: true,//是否显示输入框 + placeholderText: '请输入用户兑换商品的总金额',//输入框提示内容 + showCancel: true, // 是否显示取消按钮 + cancelText: '取消', // 取消按钮文字 + confirmText: '确定', // 确认按钮文字 + success: (res) => { + if (res.confirm && Number(res.content) > 0) { + let inputValue = Number(res.content); + let params = { + mer_id: this.service.mer_id, + total_money: inputValue, + quota_type: 2, + }; + getSiteQrCode(params).then(res => { + if (res.status == 200) { + _this.qrCode = res.data.qr_code || '' + _this.$refs.qrCodePopup.open('center'); + } + }).catch(err => { + this.$util.Tips({ + title: err + }); + }); + } else if (res.cancel) { + console.log('用户点击了取消'); + } + } + }) + }, + // 推广二维码 - 关闭二维码 + closeQrCode(){ + this.$refs.qrCodePopup.close(); + }, + } +}