From 08d3358a0a0f5fb51d8fb709580c45dd071c64e5 Mon Sep 17 00:00:00 2001 From: taiwan Date: Wed, 9 Mar 2022 11:30:01 +0800 Subject: [PATCH] 商品详情页、服务卡项详情页、个人中心联系客服修改 --- app.wxss | 14 +++++++++++--- packageA/pages/goodsInfo/goodsInfo.js | 683 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------- packageA/pages/goodsInfo/goodsInfo.wxml | 50 +++++++++++++++++++++++++++++++++++++++++--------- packageA/pages/goodsInfo/goodsInfo.wxss | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/goods/goodsInfo/goodsInfo.js | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ pages/goods/goodsInfo/goodsInfo.wxml | 39 ++++++++++++++++++++++++++++++++++----- pages/goods/goodsInfo/goodsInfo.wxss | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ pages/user/index/index.js | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- pages/user/index/index.wxml | 41 ++++++++++++++++++++++++++++++++++++++--- pages/user/index/index.wxss | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 10 files changed, 957 insertions(+), 230 deletions(-) diff --git a/app.wxss b/app.wxss index aa2467b..779f442 100644 --- a/app.wxss +++ b/app.wxss @@ -743,9 +743,17 @@ background: #ffe3e2; /* 图标字体(ty) */ @font-face { font-family: 'iconfont'; /* Project id 2054717 */ - src: url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff2?t=1645781927179') format('woff2'), - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff?t=1645781927179') format('woff'), - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.ttf?t=1645781927179') format('truetype'); + src: url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.woff2?t=1646731629521') format('woff2'), + url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.woff?t=1646731629521') format('woff'), + url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.ttf?t=1646731629521') format('truetype'); +} + +.icon-kefu1:before { + content: "\e666"; +} + +.icon-dianhua:before { + content: "\e623"; } .icon-infofill:before { diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 34fb2fe..1473296 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -8,6 +8,7 @@ var t = require("../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; + let self = null; //评价加载更多 @@ -50,7 +51,7 @@ Page({ supportPageScroll: !1, address: { address: "", - district: 0 + district: 0, }, shipping: "", shippingCost: 0, @@ -199,15 +200,17 @@ Page({ sales_rules:1, //默认是线上销售 wait_for_user_store:null, - poster:null, //自定义海报 - share_b_img:'', //自定义分享的背景 - showPoster: false, - hui_condition:null, - sto_sele_name_1:'',//分享的门店名称 + poster:null, //自定义海报 + share_b_img:'', //自定义分享的背景 + showPoster: false, + hui_condition:null, + sto_sele_name_1:'',//分享的门店名称 // 秒杀 prom_st: 1, prom_r_null: 0, + + hiddenCS: true, //控制客服操作菜单显示和控制 }, //------初始化加载---------- @@ -261,10 +264,10 @@ Page({ first_leader=gid_str[1]; } //-- 如果有room_id的获取 -- - if(gid_str.length>2 && gid_str[2]){ + if(gid_str.length>2 && gid_str[2]) { room_id=gid_str[2]; room_user_share=1; - } + }; }; ee.setData({ gid: gid}); @@ -309,7 +312,7 @@ Page({ is_show_gb: 1 }); } - console.log(e); + // console.log(e); var json_d = JSON.parse(e.switch_list); ee.setData({ store_config: e, @@ -318,6 +321,7 @@ Page({ is_newsales_rules: json_d.is_newsales_rules }); ee.init(gid); + //------几人评价------- //n.init(th, "", "comments"); @@ -370,7 +374,7 @@ Page({ //获取用户的默认门店 getApp().get_user_store(function(e) { - if(!e) { + if(!e) { th.data.fir_def_store={}; //赋值空对象 return false; } @@ -431,7 +435,7 @@ Page({ appd.lat=that.data.lat; appd.lon=that.data.lon; - }else{ + } else { if (e) { e.distance = null; that.data.fir_def_store=e; @@ -456,7 +460,7 @@ Page({ setTimeout(()=>{ wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { - // console.log('node@@@@@@@', res); + if(res.length != 0) { this.setData({ showFold: res[0].height < res[1].height, @@ -517,7 +521,9 @@ Page({ if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 let prom_id = this.data.options.prom_id; + // 检查活动是否开始 this.check_prom(goods_id, prom_type, prom_id); + } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', { data: { @@ -537,20 +543,16 @@ Page({ let prom_id = result[0].act_id; this.setData({ 'options.prom_type': prom_type, + 'options.prom_id': prom_id, }); + // 检查活动是否开始 this.check_prom(goods_id, prom_type, prom_id); } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 this.setData({ actList: res.data.data, }); }; - - // console.log('!!!!!!~~~~~~~~~prom~~~~~~~~~~!!!!!!'); - - // this.setData({ - // prom, - // }); - + }; }); }; @@ -669,8 +671,6 @@ Page({ - - i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { failRollback: !0, @@ -744,6 +744,9 @@ Page({ }; } }); + + + this.data.enterAddressPage && (this.data.enterAddressPage = !1); this.get_sto(); @@ -815,8 +818,23 @@ Page({ activeCategoryId: 1 }); }, - - + + //获取redis中的数量 + async getactLen(func) { + var r_num = 0, + prom_type = this.data.prom_type, + prom_id = this.data.prom_id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { + 1: 1 + }).then(res => { + var em = res; + if (em.data.code == 0) { + r_num = em.data.data; + } + }) + func(r_num); + }, + //------------加入购物车-------------- addCart: function(t) { var th = this; @@ -828,10 +846,61 @@ Page({ open_ind_store: ind }); - if(!th.data.sto_sele_name){ + if(!th.data.sto_sele_name) { getApp().my_warnning('请选择门店', 1, th, 450); return false; } + + + + //000000 + //如果是秒杀的话,要看redis够不够 + // if (this.data.prom_type == 1) { + + // if (this.data.openSpecModal_flash_normal) { + // this.data.is_normal=1; //是普通购买 + // return false; + // } + + + // this.getactLen(function (num) { + // if (num < th.data.goodsInputNum) { + // getApp().my_warnning("活动库存不足!", 0, th); + // return false; + // } else { + // // th.add_cart_func(t); + // } + // }); + // } else { + // // th.add_cart_func(t); + // } + //000000 + + + if(this.data.options.prom_type == 1) { + var t = th.data.goodsInputNum; + th.data.sele_g.viplimited = th.data.sele_g.buy_limit; + if (th.data.sele_g.viplimited > 0) { + var gd_buy_num = th.data.sele_g.buy_num; + + if (t + gd_buy_num >= th.data.sele_g.viplimited) { + wx.showModal({ + title: '超出商品限购', + }); + + // var num = th.data.sele_g.viplimited - gd_buy_num; + // if (num < 0) num = th.data.sele_g.viplimited; + th.setData({goodsInputNum: 0}); + return false; + } + }; + }; + + + + + + if(action=="buy"){ @@ -855,7 +924,10 @@ Page({ // console.log('newd++++++++', newd); th.buyNow(newd); } else { - + + + + var newd = { service_id: th.data.data.id, service_sn:th.data.data.service_sn, @@ -866,7 +938,7 @@ Page({ store_id:os.stoid, money:th.data.data.shop_price }; - if(getApp().globalData.guide_id){ + if(getApp().globalData.guide_id) { newd['guide_id'] = getApp().globalData.guide_id; newd['guide_type']=0; } @@ -926,14 +998,16 @@ Page({ } + + }, //----------立即购买----------- buyNow: function(e) { - getApp().globalData.service_now=e; - wx.redirectTo({ - url: "/packageA/pages/cart2_ser/cart2_ser", - }); + getApp().globalData.service_now=e; + wx.redirectTo({ + url: "/packageA/pages/cart2_ser/cart2_ser", + }); }, //----------增加购买数量----------- addCartNum: function(t) { @@ -950,9 +1024,91 @@ Page({ //------检查数量是不是超出限购------ checkCartNum: function(t) { + if(t<=0) return false; - var th = this; - th.setData({goodsInputNum:t}) + var th = this; + th.setData({goodsInputNum:t}); + + + var th = this; + this.get_buy_num(this.data.sele_g, async function () { + th.data.sele_g.viplimited = th.data.sele_g.buy_limit; + + //--判断商品是否超出限购-- + // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { + if (th.data.sele_g.viplimited > 0) { + var gd_buy_num = th.data.sele_g.buy_num; + + if (t + gd_buy_num > th.data.sele_g.viplimited) { + wx.showModal({ + title: '超出商品限购', + }); + + var num = th.data.sele_g.viplimited - gd_buy_num; + if (num < 0) num = 0; + th.setData({goodsInputNum: num}) + return false; + } + } + + //如果是普通购买的情况下 + if(th.data.openSpecModal_flash_normal) th.data.is_normal=1; + + //--判断商品是否超出活动限购-- + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { + if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { + wx.showModal({ + title: '超出商品活动限购', + }); + + var num = th.data.prom_buy_limit - th.data.prom_buy_num; + if (num < 0) num = 0; + th.setData({goodsInputNum: num}) + return false; + } + } + + if ((th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) && !th.data.is_normal) { + var redis_num = 0; + //------判断活动是否抢光----- + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { + 1: 1 + }).then(res => { + redis_num = res.data.data; + }); + + if (t > redis_num) { + wx.showModal({ + title: '超出商品活动库存', + }); + th.setData({goodsInputNum: redis_num}) + return false; + } + } + var e = th.data.sele_g.store_count; + var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 + if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { + if (!th.data.def_pick_store) { + wx.showModal({title: '请选择门店',}); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } + } + if (!e) e = 0; + //库存不足,不增加 + if (e < t) { + wx.showModal({title: '库存不足',}); + if (e < 0) e = 0; + th.setData({goodsInputNum: e}); + return false; + } + t > e || 0 == e ? t = e : t < 1 && (t = 1); + th.setData({goodsInputNum: t}); + // th.is_show_more_buy(); + + }) }, @@ -964,7 +1120,6 @@ Page({ }, openSpecModel: function(t) { - // console.log('****ttttttt***', t); var th=this; var open_store = t.currentTarget.dataset.ind; this.setData({ @@ -1045,29 +1200,57 @@ 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); - } - }); - }, + }, + //---------联系客服------------ + contactService: function () { + 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; @@ -2919,37 +3102,44 @@ Page({ }, + //获取redis中的数量 + async getactLen(func) { + var r_num = 0, + prom_type = this.data.prom_type, + prom_id = this.data.prom_id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { + 1: 1 + }).then(res => { + var em = res; + if (em.data.code == 0) { + r_num = em.data.data; + } + }) + func(r_num); + }, + + //--------检查是否活动,活动是否开始,或者是否结束------- async check_prom(gid, prom_type, prom_id) { - console.log('check_prom'); var ee = this, th = ee; var user_id = getApp().globalData.user_id; if (!user_id) user_id = 0; - - // if (prom_type == 3 || prom_type == 0 || prom_type == 5 || prom_type == 7 || prom_type == 9 || prom_type == 10) { - // this.setData({ - // prom_type: 0, isshow: 1, - // }); - // return false; - // } - - - - // if (prom_type == 1 && prom_id == 0) { - // this.setData({ - // prom_type: 0, isshow: 1, - // }); - - // //获取门店 - // this.get_sto(); - // this.get_sku(o.stoid, this.data.data, gid); - // this.check_has_flash(); - // this.data.is_normal = 1; - // this.check_is_youhui(gid, 1); - // return false; - // } + + if (prom_type == 1 && prom_id == 0) { + // this.setData({ + // prom_type: 0, isshow: 1, + // }); + + // //获取门店 + // this.get_sto(); + // this.get_sku(o.stoid, this.data.data, gid); + // this.check_has_flash(); + // this.data.is_normal = 1; + // this.check_is_youhui(gid, 1); + // return false; + } //if (prom_type != 3 && prom_type!=0){ //---判断秒杀---- @@ -2959,15 +3149,27 @@ Page({ 1: 1 }).then(res => { var em = res; - if (res.data.code == 0) { - // console.log('!!!!!!res!!!!', res); - if (res.data.data <= 0) ee.setData({ - prom_r_null: 1 - }); + if (em.data.code == 0) { + + if (em.data.data <= 0) { + wx.showModal({ + title: '来晚了,已被抢光!', + }); + + ee.setData({ + prom_r_null: 1, + goodsInputNum: 0 + }); + + // th.setData({goodsInputNum: redis_num}) + }; //拿取价格并且判断时间-- getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { success: function (t) { - // console.log('!!!!!!t!!!!', t); + th.setData({ + sele_g: t.data.data, + }); + if (t.data.code != 0) { ee.get_normal(gid); return false; @@ -2994,7 +3196,6 @@ Page({ var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); ee.setData({ - 'data.shop_price': t.data.data.user_price, prom_price: t.data.data.user_price, prom_type: 1, prom_id: prom_id, @@ -3011,8 +3212,7 @@ Page({ var endTime1 = t.data.data.start_time; if (endTime1 > newTime) { ee.setData({ - prom_time_text: '距秒杀开始还有', - prom_st: 0, + prom_time_text: '距秒杀开始还有' }) ee.countDown(endTime1, 0); } else { @@ -3026,60 +3226,60 @@ Page({ } //如果是进行中的话 - // if (endTime1 < newTime) { - // //-- 获取秒杀活动的多少规格 -- - // ee.get_more_flahs(function (list) { - // if (list && list.length > 1) { - - // var n_item = list[0]; - // var ind = list.findIndex(function (ele) { - // return ele.goods_id == ee.data.data.goods_id; - // }) - // if (ind < 0) return false; - // if (ind > 0) { - // n_item = JSON.parse(JSON.stringify(list[ind])); - // list.splice(ind, 1); - // list.unshift(n_item); - // } - - // ee.data.sele_g.viplimited = n_item.viplimited; - // ee.data.data.viplimited = n_item.viplimited; - - // var gb = 1; - // //-- 显示多规格 -- - // for (let i in list) { - // let item = list[i]; - // var gg = ""; - // if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; - // if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; - - // if (item.goods_spec != "" && item.goods_color != "") { - // gg = item.goods_spec + "/" + item.goods_color; - // } else if (item.goods_spec != "" || item.goods_color != "") { - // gg = item.goods_spec + item.goods_color; - // } else { - // gg = "规格" + gb; - // gb++; - // } - // item.gg = gg; - // item.prom_id = item.prom_id; - // item.prom_type = 1; - // } - - // ee.setData({ - // sku_g: list, - // }); - - // } - // }) - // } + if (endTime1 < newTime) { + //-- 获取秒杀活动的多少规格 -- + ee.get_more_flahs(function (list) { + if (list && list.length > 1) { + + var n_item = list[0]; + var ind = list.findIndex(function (ele) { + return ele.goods_id == ee.data.data.goods_id; + }) + if (ind < 0) return false; + if (ind > 0) { + n_item = JSON.parse(JSON.stringify(list[ind])); + list.splice(ind, 1); + list.unshift(n_item); + } + + ee.data.sele_g.viplimited = n_item.viplimited; + ee.data.data.viplimited = n_item.viplimited; + + var gb = 1; + //-- 显示多规格 -- + for (let i in list) { + let item = list[i]; + var gg = ""; + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; + + if (item.goods_spec != "" && item.goods_color != "") { + gg = item.goods_spec + "/" + item.goods_color; + } else if (item.goods_spec != "" || item.goods_color != "") { + gg = item.goods_spec + item.goods_color; + } else { + gg = "规格" + gb; + gb++; + } + item.gg = gg; + item.prom_id = item.prom_id; + item.prom_type = 1; + } + + ee.setData({ + sku_g: list, + }); + + } + }) + } } }); } }) } - + }, @@ -3088,51 +3288,194 @@ Page({ let prom_type = e.currentTarget.dataset.promtype; let prom_id = e.currentTarget.dataset.promid; let goods_id = this.data.data.goods_id; - let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`; - // console.log('url~~~~', url); + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;s getApp().goto(url); }, - - //-- 检验商品的活动情况 -- - check_gd_prom_new: function (func) { - var th = this; + //获取更多秒杀 + get_more_flahs: async function (func) { + var f_more = false; var user_id = getApp().globalData.user_id; if (!user_id) user_id = 0; - var url = '/api/weshop/activitylist/listGoodActInfo2'; - var req_d = { - "store_id": os.stoid, - "goods_id": this.data.gid, - "user_id": user_id, + var url = "/api/weshop/goods/listSkuFlash?store_id=" + os.stoid + "&goods_id=" + this.data.data.goods_id + "&user_id=" + user_id; + //获取秒杀的多规格 + await getApp().request.promiseGet(url, {}).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { + f_more = res.data.data; + } + }) + if (!f_more) { + func(false); + return false; } - getApp().request.get(url, { - data: req_d, - success: function (e) { - if (e.data.code == 0 && e.data.data && e.data.data.length > 0) { - var arr = e.data.data; - var arr2 = arr.filter(function (e) { - return e.s_time < ut.gettimestamp(); - }) - //-- 如果只有一个活动的话 -- - if (arr.length == 1) { - th.data.prom_type = arr[0].prom_type; - th.data.prom_id = arr[0].act_id; - } - //-- 如果只有一个进行中的活动的话 -- - else if (arr2.length == 1) { - th.data.prom_type = arr2[0].prom_type; - th.data.prom_id = arr2[0].act_id; + //-- 秒杀的价格要更新 -- + for (let i in f_more) { + + let item = f_more[i]; + f_more[i].prom_id = item.act_id; + f_more[i].prom_type = 1; + if (item.goods_id == this.data.data.goods_id) { + continue; + } + var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id; + await getApp().request.promiseGet(url, {}).then(rs => { + if (rs.data.code == 0) { + f_more[i].price = rs.data.data.user_price; + + } + }) + } + func(f_more); + + }, + + + + + + + //-------------获取购买数量的总函数---------------- + get_buy_num: function (gd, func) { + + var th = this, + user_id = getApp().globalData.user_id; + + + //----获取商品购买数---- + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + goods_id: this.data.gid, + }, + success: function (t) { + if (t.data.code == 0) { + var g_buy_num = t.data.data.goodsbuynum; + + // 如果是秒杀的时候 + // if (th.data.prom_type == 0 && gd.prom_type == 1) { + // gd.prom_type = 0; + // } + + //----获取活动购买数---- + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + goods_id: th.data.gid, + prom_type: th.data.prom_type, + prom_id: th.data.prom_id + }, + //-----获取----- + success: function (tt) { + if (tt.data.code == 0) { + th.setData({ + prom_buy_num: tt.data.data.goodsbuynum, + }); + "function" == typeof func && func(); + } + } + }); + + } + }, + }); + }, + + + + + + // 促销 -> 送礼包 -> 查看详情 + viewLbDetails(e) { + let id = e.currentTarget.dataset.id; // 获取礼包id + let url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 + // console.log('myurl', url); + getApp().goto(url); + }, + + go_more_ladder: function (e) { + var prom_id = e.currentTarget.dataset.id; + getApp().goto("/pages/goods/goodsList/goodsList?ladder_id=" + prom_id); + }, + + getHistoryBuy() { + let _this = this; + let req_data = { + store_id: os.stoid, + goods_id: this.data.gid, + pay_status: 1, + rndid: 1 + }; + getApp().request.promiseGet('/api/weshop/ordergoods/list', { + data: req_data, + }) + .then(res => { + if (t.ajax_ok(res)) { + _this.setData({ + historyBuyInfo: res.data.data.pageData, + }) } - //-- 调用回调 -- - func(); - } - }); + }) }, + + + //-- 秒杀的普通购买 -- + openSpecModel_Nor: function () { + this.data.g_buy_num = new Map(); + var th = this; + this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 + if (th.data.sku_g_pt) { + this.get_sto(1) + this.setData({openSpecModal_flash_normal: 1}); + } else { + th.get_sto(1); + th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { + th.setData({ + openSpecModal_flash_normal: 1 + }); + }); + } + this.check_is_youhui(th.data.gid, 1); + }, + + closeSpecModal_flash_normal: function () { + this.setData({openSpecModal_flash_normal: 0}); + }, + + + //打开客服操作菜单 + 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, + }); + } @@ -3140,9 +3483,11 @@ Page({ + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 1212320..5af7826 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -101,7 +101,8 @@ - {{filters.toFix(data.shop_price,2)}} + {{filters.toFix(prom_price,2)}} + {{filters.toFix(data.shop_price,2)}} {{data.goods_name}} @@ -506,7 +507,7 @@ - + + + + + 在线客服 + + + + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss index 49b3695..4800210 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/goodsInfo/goodsInfo.wxss @@ -2968,3 +2968,56 @@ button.custom-service::after{ left: -1000px; top: -1000px; } + + + +/* 联系客服操作菜单 */ +.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; +} diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 146b870..d39466d 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -255,6 +255,8 @@ Page({ share_hidden: false, all_activity_list: null, //所有活动的列表 + hiddenCS: true, //控制客服操作菜单 + }, //------初始化加载---------- @@ -2280,25 +2282,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; @@ -6621,6 +6653,35 @@ Page({ }, + //打开客服操作菜单 + 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/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 5fcc7ad..95d0be6 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -1011,17 +1011,17 @@ - + + + + + 在线客服 + + + + + diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index 6b05758..bbfc3d7 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -4001,3 +4001,54 @@ button.custom-service::after { left: -1000px; top: -1000px; } + + + + +/* 联系客服操作菜单 */ +.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 .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; +} + diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 2fa7e06..f3af9f4 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -11,6 +11,7 @@ const { qrcode } = require('../../../utils/index.js'); var ut = require("../../../utils/util.js"); +let self = null; Page({ /** @@ -44,7 +45,7 @@ Page({ ad_img:"", add_card_data:'', //等级卡的内容 - + hiddenCS: true, }, goto_nav: function(e) { var th = this; @@ -62,6 +63,7 @@ Page({ */ onLoad: function(options) { var th=this; + self = this; getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { data: { enabled: 1 @@ -703,26 +705,60 @@ Page({ //---------联系客服------------ contactService: function() { - var s = getApp(); - 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().showWarning("商家未设置电话"); - 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) => { + var self = this; + var s = getApp(); + 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().showWarning("商家未设置电话"); + return false; + } else { + 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(); + }); + }); + }, + go_info: function() { getApp().goto("/pages/user/userinfo/userinfo"); @@ -902,7 +938,38 @@ Page({ } }) this.setData({user_tool:d_list}); - } + }, + + + //打开客服操作菜单 + 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/pages/user/index/index.wxml b/pages/user/index/index.wxml index 09ce4f3..269b4c5 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -261,7 +261,7 @@ - + + + + + 在线客服 + + + + + + + diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss index 5d208f0..0575e7d 100644 --- a/pages/user/index/index.wxss +++ b/pages/user/index/index.wxss @@ -739,4 +739,50 @@ button::after{ border: 0} .c-5 { color: #555; -} \ No newline at end of file +} + +.action { + position: fixed; + bottom: 100rpx; + z-index: 1; + width: 100%; + background-color: white; + border-radius: 20rpx 20rpx 0 0; +} + +.action .icon-guan { + position: absolute; + right: 20rpx; +} + +.action .iconfont { + color: #ff7295; + margin-right: 10rpx; +} + +.action button { + text-align: left; + line-height: normal; +} + +.action .btn { + box-sizing: border-box; + height: 100rpx; + display: flex; + align-items: center; +} + +.mask { + display: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0,0,0,.5); +} + +.action.active ~ .mask { + display: block; +} + -- libgit2 0.21.4