diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 7757199..06ea8fd 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -19,6 +19,7 @@ var more = function (e) { var utils = require('../../../../utils/util.js'); var regeneratorRuntime = require('../../../../utils/runtime.js'); const { app } = require("../../../../utils/common.js"); +let self = null; Page({ data: { @@ -281,11 +282,14 @@ Page({ surplus: 0, canBuy: false, btnHidden: false, + + hiddenCS: true, //控制客服操作菜单显示和控制 }, //------初始化加载---------- onLoad: function (t) { - + self = this; + // console.log('onload'); if (t && t.group_id) { this.data.group_id = t.group_id; @@ -2248,24 +2252,53 @@ Page({ //---------联系客服------------ contactService: function () { - s.getConfig(function (t) { - if (t.store_tel == undefined) { - getApp().request.get("/api/weshop/store/get/" + os.stoid, { - isShowLoading: 1, - data: {}, - success: function (rs) { - getApp().globalData.config = rs.data.data; - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { - getApp().my_warnning("商家未设置电话", 0, th); - return false; - } - s.confirmBox("请联系客服:" + rs.data.data.store_tel); - } - }) - } else { - s.confirmBox("请联系客服:" + t.store_tel); - } - }); + this.getTel() + .then(() => { + if(self.data.store_tel) { + wx.showModal({ + title: '联系客服', + content: '客服热线:' + self.data.store_tel, + confirmText: '拨打', + success(res) { + if(res.confirm) { + wx.makePhoneCall({ + phoneNumber: self.data.store_tel, + }) + }; + }, + }); + }; + }); + }, + // 获取客服电话 + getTel() { + return new Promise((resolve, reject) => { + s.getConfig(function (t) { + if (t.store_tel == undefined) { + getApp().request.get("/api/weshop/store/get/" + os.stoid, { + isShowLoading: 1, + data: {}, + success: function (rs) { + getApp().globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + getApp().my_warnning("商家未设置电话", 0, th); + return false; + } + self.setData({ + store_tel: rs.data.data.store_tel, + }); + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); + } + }) + } else { + self.setData({ + store_tel: t.store_tel, + }); + // s.confirmBox("请联系客服:" + t.store_tel); + }; + resolve(); + }); + }); }, //-------获取购物车数量---------- requestCardNum: function () { @@ -2306,11 +2339,7 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t); }, previewCommentImgs_w: function (t) { @@ -2320,21 +2349,16 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t); }, previewGoodsCommentImgs: function (t) { var e = this, a = this.data.data.comment[t.currentTarget.dataset.cidx].img; + getApp().globalData.no_clear=1; a = a.map(function (t) { return e.data.url + t; - }), wx.previewImage({ - current: a[t.currentTarget.dataset.id], - urls: a - }); + }), getApp().pre_img2(a,t); this.data.show_prew_img = 1; }, closePromModal: function () { @@ -2349,7 +2373,7 @@ Page({ }, //--点击分享事件--- - onShareAppMessage: function (t) { + onShareAppMessage: function (t) { getApp().globalData.no_clear=1; // var th = this; // var price = th.data.sele_g.shop_price; @@ -6095,11 +6119,8 @@ Page({ }, previewImage() { - this.data.show_prew_img = 1; - wx.previewImage({ - //将图片预览出来 - urls: [this.data.sele_g.original_img] - }); + this.data.show_prew_img = 1; + getApp().pre_img(this.data.sele_g.original_img); }, is_show_more_buy: function () { @@ -6327,13 +6348,7 @@ Page({ }, con_weixin: function () { - var url = this.data.sys_switch.weapp_customertype_url; - var id = this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: { url: url }, - corpId: id, - success(res) { } - }) + getApp().con_wx(this); }, @@ -6486,6 +6501,7 @@ Page({ // 预览海报 previewPoster() { + getApp().globalData.no_clear=1; wx.previewImage({ current: this.data.shareImgPath, // 当前显示图片的http链接 urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 @@ -6493,4 +6509,38 @@ Page({ }, + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + + //打开客服操作菜单 + openCS() { + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + let csType = this.data.sys_switch.weapp_customertype; + if(csType == 0) { + // 获取电话号码 + this.contactService(); + } else { + this.getTel() + .then(() => { + self.setData({ + hiddenCS: false, + }); + }); + + }; + }, + + //关闭客服操作菜单 + closeCS() { + this.setData({ + hiddenCS: true, + }); + }, + + }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 88e5a26..a2f8850 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -871,7 +871,7 @@ - + + + + + 在线客服 + + + + + diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index 979fad7..173547f 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -3115,4 +3115,56 @@ button.custom-service::after{ .popup-content { max-height: 600rpx; overflow-y: auto; + } + + + /* 联系客服操作菜单 */ + .action { + position: fixed; + bottom: 100rpx; + z-index: 1; + width: 100%; + background-color: white; + border-radius: 20rpx 20rpx 0 0; + } + + .action .icon-guan { + position: absolute; + left: 20rpx !important; + right: auto !important; + } + + .action .iconfont { + color: #ff7295; + margin-right: 10rpx; + } + + .action button { + text-align: left; + line-height: normal; + } + + .action button::after { + border-width: 0; + } + + .action .btn2 { + box-sizing: border-box; + height: 100rpx; + display: flex; + align-items: center; + } + + .mask2 { + display: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0,0,0,.5); + } + + .action.active ~ .mask2 { + display: block; } \ No newline at end of file diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 7a49267..e260687 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -16,6 +16,7 @@ var more = function (e) { n = new more.default(); var utils = require('../../../../utils/util.js'); var regeneratorRuntime = require('../../../../utils/runtime.js'); +let self = null; Page({ data: { @@ -248,10 +249,13 @@ Page({ share_hidden: false, pre_arr: null, + + hiddenCS: true, }, //------初始化加载---------- onLoad: function (t) { + self = this; var ee = this, that = ee, th = ee, pre_id = t.pre_id, gid = t.goods_id, @@ -1430,25 +1434,55 @@ Page({ //---------联系客服------------ contactService: function () { - s.getConfig(function (t) { - if (t.store_tel == undefined) { - getApp().request.get("/api/weshop/store/get/" + os.stoid, { - isShowLoading: 1, - data: {}, - success: function (rs) { - getApp().globalData.config = rs.data.data; - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { - getApp().my_warnning("商家未设置电话", 0, th); - return false; - } - s.confirmBox("请联系客服:" + rs.data.data.store_tel); - } - }) - } else { - s.confirmBox("请联系客服:" + t.store_tel); - } - }); + this.getTel() + .then(() => { + if(self.data.store_tel) { + wx.showModal({ + title: '联系客服', + content: '客服热线:' + self.data.store_tel, + confirmText: '拨打', + success(res) { + if(res.confirm) { + wx.makePhoneCall({ + phoneNumber: self.data.store_tel, + }) + }; + }, + }); + }; + }); + }, + // 获取客服电话 + getTel() { + return new Promise((resolve, reject) => { + s.getConfig(function (t) { + if (t.store_tel == undefined) { + getApp().request.get("/api/weshop/store/get/" + os.stoid, { + isShowLoading: 1, + data: {}, + success: function (rs) { + getApp().globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + getApp().my_warnning("商家未设置电话", 0, th); + return false; + } + self.setData({ + store_tel: rs.data.data.store_tel, + }); + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); + } + }) + } else { + self.setData({ + store_tel: t.store_tel, + }); + // s.confirmBox("请联系客服:" + t.store_tel); + }; + resolve(); + }); + }); }, + //-------获取购物车数量---------- requestCardNum: function () { var t = this; @@ -1488,11 +1522,8 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; + getApp().pre_img2(b,t) - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); }, previewCommentImgs_w: function (t) { @@ -1502,21 +1533,16 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t) }, previewGoodsCommentImgs: function (t) { var e = this, a = this.data.data.comment[t.currentTarget.dataset.cidx].img; + getApp().globalData.no_clear=1; a = a.map(function (t) { return e.data.url + t; - }), wx.previewImage({ - current: a[t.currentTarget.dataset.id], - urls: a - }); + }), getApp().pre_img2(a,t); this.data.show_prew_img = 1; }, closePromModal: function () { @@ -1531,7 +1557,7 @@ Page({ }, //--点击分享事件--- - onShareAppMessage: function (t) { + onShareAppMessage: function (t) { getApp().globalData.no_clear=1; var th = this; var price = th.data.pre_arr.presell_price; @@ -3813,10 +3839,7 @@ Page({ previewImage() { this.data.show_prew_img = 1; - wx.previewImage({ - //将图片预览出来 - urls: [this.data.shareImgPath] - }); + getApp().pre_img(this.data.shareImgPath); }, @@ -4012,21 +4035,50 @@ Page({ }, con_weixin:function () { - var url=this.data.sys_switch.weapp_customertype_url; - var id=this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) {} - }) + getApp().con_wx(this); }, // 预览海报 previewPoster() { + getApp().globalData.no_clear=1; wx.previewImage({ current: this.data.shareImgPath, // 当前显示图片的http链接 urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 }); }, + + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + + //打开客服操作菜单 + openCS() { + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + let csType = this.data.sys_switch.weapp_customertype; + if(csType == 0) { + // 获取电话号码 + this.contactService(); + } else { + this.getTel() + .then(() => { + self.setData({ + hiddenCS: false, + }); + }); + + }; + }, + + //关闭客服操作菜单 + closeCS() { + this.setData({ + hiddenCS: true, + }); + }, + }); diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index 73a884f..dbeb456 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -495,7 +495,7 @@ - + + + + + 在线客服 + + + + + + diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxss b/packageC/pages/presell/goodsInfo/goodsInfo.wxss index bff91ce..46b4008 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxss +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxss @@ -1614,6 +1614,7 @@ left:31rpx;} .icon-share { font-size: 46rpx; color: #d60021; + line-height: 1; } .xc-share-frame{ /* width: 129rpx; @@ -2832,7 +2833,7 @@ button.custom-service::after{ } .icon-close { - font-size: 48rpx; + font-size: 42rpx; } .quan_price{ background-color: #ff4700; color: #fff; padding: 10rpx 25rpx; margin-left: 10rpx; border-radius: 30rpx; @@ -2915,3 +2916,56 @@ button.custom-service::after{ margin-right: 10rpx; } + + +/* 联系客服操作菜单 */ +.action { + position: fixed; + bottom: 100rpx; + z-index: 1; + width: 100%; + background-color: white; + border-radius: 20rpx 20rpx 0 0; +} + +.action .icon-guan { + position: absolute; + left: 20rpx !important; + right: auto !important; +} + +.action .iconfont { + color: #ff7295; + margin-right: 10rpx; +} + +.action button { + text-align: left; + line-height: normal; +} + +.action button::after { + border-width: 0; +} + +.action .btn2 { + box-sizing: border-box; + height: 100rpx; + display: flex; + align-items: center; +} + +.mask2 { + display: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0,0,0,.5); +} + +.action.active ~ .mask2 { + display: block; +} +