From 98fa810e9b8346b55ed3ee267036bd55ebf349c2 Mon Sep 17 00:00:00 2001 From: fanfan Date: Mon, 12 Aug 2024 21:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/detail.vue | 67 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 61d4278..d4c1e4d 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -262,14 +262,25 @@ 客服 + - - + + + + + + 客服 + - - 客服 + + + + + + 客服 + + - @@ -484,6 +495,8 @@ import * as address from '@/api/address.js' import * as CartApi from '@/api/cart' import store from '@/store' + import SettingKeyEnum from '@/common/enum/setting/Key' + import SettingModel from '@/common/model/Setting' export default { components: { SkuPopup, @@ -555,6 +568,8 @@ district: '玄武区' }, seckillCountTime: 0, + // 系统设置 + setting: {}, } }, computed: { @@ -587,6 +602,7 @@ this.getGoodsStockInfor() this.getCartTotal() this.getProvinceAll() + this.getSetting() uni.$on("onenPrice", function(selectShop) { that.openPirce(); that.isTodo = false; @@ -620,6 +636,47 @@ } }, methods: { + // 获取商城设置 + getSetting() { + const app = this + return new Promise((resolve, reject) => { + SettingModel.data() + .then(setting => { + app.setting = setting + resolve(setting) + }) + .catch(reject) + }) + }, + // 在线客服 + handleContact() { + // 商城客服设置 + const setting = this.setting[SettingKeyEnum.CUSTOMER.value] + // 企业微信客服 + if (setting.provider == 'wxqykf') { + + if (!setting.config.wxqykf.url || !setting.config.wxqykf.corpId) { + this.$toast('客服链接和企业ID不能为空') + return + } + // #ifdef H5 + window.open(setting.config.wxqykf.url) + // #endif + // #ifdef MP-WEIXIN + console.log(setting.config.wxqykf.url,setting.config.wxqykf.corpId) + wx.openCustomerServiceChat({ + extInfo: { + url: setting.config.wxqykf.url + }, + corpId: setting.config.wxqykf.corpId, + success(res) {}, + fail(res){ + console.log(res,'企业微信') + } + }) + // #endif + } + }, onLook(isLink, url) { if (isLink) { uni.navigateTo({