Commit 08d3358a0a0f5fb51d8fb709580c45dd071c64e5
1 parent
19842764
商品详情页、服务卡项详情页、个人中心联系客服修改
Showing
10 changed files
with
957 additions
and
230 deletions
app.wxss
@@ -743,9 +743,17 @@ background: #ffe3e2; | @@ -743,9 +743,17 @@ background: #ffe3e2; | ||
743 | /* 图标字体(ty) */ | 743 | /* 图标字体(ty) */ |
744 | @font-face { | 744 | @font-face { |
745 | font-family: 'iconfont'; /* Project id 2054717 */ | 745 | font-family: 'iconfont'; /* Project id 2054717 */ |
746 | - src: url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff2?t=1645781927179') format('woff2'), | ||
747 | - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.woff?t=1645781927179') format('woff'), | ||
748 | - url('//at.alicdn.com/t/font_2054717_o34jrbrtxpk.ttf?t=1645781927179') format('truetype'); | 746 | + src: url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.woff2?t=1646731629521') format('woff2'), |
747 | + url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.woff?t=1646731629521') format('woff'), | ||
748 | + url('//at.alicdn.com/t/font_2054717_qbvqi1zioy.ttf?t=1646731629521') format('truetype'); | ||
749 | +} | ||
750 | + | ||
751 | +.icon-kefu1:before { | ||
752 | + content: "\e666"; | ||
753 | +} | ||
754 | + | ||
755 | +.icon-dianhua:before { | ||
756 | + content: "\e623"; | ||
749 | } | 757 | } |
750 | 758 | ||
751 | .icon-infofill:before { | 759 | .icon-infofill:before { |
packageA/pages/goodsInfo/goodsInfo.js
@@ -8,6 +8,7 @@ var t = require("../../../utils/util.js"), | @@ -8,6 +8,7 @@ var t = require("../../../utils/util.js"), | ||
8 | oo = s.globalData, | 8 | oo = s.globalData, |
9 | o = s.globalData.setting, | 9 | o = s.globalData.setting, |
10 | os = o; | 10 | os = o; |
11 | + | ||
11 | let self = null; | 12 | let self = null; |
12 | 13 | ||
13 | //评价加载更多 | 14 | //评价加载更多 |
@@ -50,7 +51,7 @@ Page({ | @@ -50,7 +51,7 @@ Page({ | ||
50 | supportPageScroll: !1, | 51 | supportPageScroll: !1, |
51 | address: { | 52 | address: { |
52 | address: "", | 53 | address: "", |
53 | - district: 0 | 54 | + district: 0, |
54 | }, | 55 | }, |
55 | shipping: "", | 56 | shipping: "", |
56 | shippingCost: 0, | 57 | shippingCost: 0, |
@@ -199,15 +200,17 @@ Page({ | @@ -199,15 +200,17 @@ Page({ | ||
199 | sales_rules:1, //默认是线上销售 | 200 | sales_rules:1, //默认是线上销售 |
200 | 201 | ||
201 | wait_for_user_store:null, | 202 | wait_for_user_store:null, |
202 | - poster:null, //自定义海报 | ||
203 | - share_b_img:'', //自定义分享的背景 | ||
204 | - showPoster: false, | ||
205 | - hui_condition:null, | ||
206 | - sto_sele_name_1:'',//分享的门店名称 | 203 | + poster:null, //自定义海报 |
204 | + share_b_img:'', //自定义分享的背景 | ||
205 | + showPoster: false, | ||
206 | + hui_condition:null, | ||
207 | + sto_sele_name_1:'',//分享的门店名称 | ||
207 | 208 | ||
208 | // 秒杀 | 209 | // 秒杀 |
209 | prom_st: 1, | 210 | prom_st: 1, |
210 | prom_r_null: 0, | 211 | prom_r_null: 0, |
212 | + | ||
213 | + hiddenCS: true, //控制客服操作菜单显示和控制 | ||
211 | }, | 214 | }, |
212 | 215 | ||
213 | //------初始化加载---------- | 216 | //------初始化加载---------- |
@@ -261,10 +264,10 @@ Page({ | @@ -261,10 +264,10 @@ Page({ | ||
261 | first_leader=gid_str[1]; | 264 | first_leader=gid_str[1]; |
262 | } | 265 | } |
263 | //-- 如果有room_id的获取 -- | 266 | //-- 如果有room_id的获取 -- |
264 | - if(gid_str.length>2 && gid_str[2]){ | 267 | + if(gid_str.length>2 && gid_str[2]) { |
265 | room_id=gid_str[2]; | 268 | room_id=gid_str[2]; |
266 | room_user_share=1; | 269 | room_user_share=1; |
267 | - } | 270 | + }; |
268 | }; | 271 | }; |
269 | 272 | ||
270 | ee.setData({ gid: gid}); | 273 | ee.setData({ gid: gid}); |
@@ -309,7 +312,7 @@ Page({ | @@ -309,7 +312,7 @@ Page({ | ||
309 | is_show_gb: 1 | 312 | is_show_gb: 1 |
310 | }); | 313 | }); |
311 | } | 314 | } |
312 | - console.log(e); | 315 | + // console.log(e); |
313 | var json_d = JSON.parse(e.switch_list); | 316 | var json_d = JSON.parse(e.switch_list); |
314 | ee.setData({ | 317 | ee.setData({ |
315 | store_config: e, | 318 | store_config: e, |
@@ -318,6 +321,7 @@ Page({ | @@ -318,6 +321,7 @@ Page({ | ||
318 | is_newsales_rules: json_d.is_newsales_rules | 321 | is_newsales_rules: json_d.is_newsales_rules |
319 | }); | 322 | }); |
320 | ee.init(gid); | 323 | ee.init(gid); |
324 | + | ||
321 | //------几人评价------- | 325 | //------几人评价------- |
322 | //n.init(th, "", "comments"); | 326 | //n.init(th, "", "comments"); |
323 | 327 | ||
@@ -370,7 +374,7 @@ Page({ | @@ -370,7 +374,7 @@ Page({ | ||
370 | 374 | ||
371 | //获取用户的默认门店 | 375 | //获取用户的默认门店 |
372 | getApp().get_user_store(function(e) { | 376 | getApp().get_user_store(function(e) { |
373 | - if(!e) { | 377 | + if(!e) { |
374 | th.data.fir_def_store={}; //赋值空对象 | 378 | th.data.fir_def_store={}; //赋值空对象 |
375 | return false; | 379 | return false; |
376 | } | 380 | } |
@@ -431,7 +435,7 @@ Page({ | @@ -431,7 +435,7 @@ Page({ | ||
431 | appd.lat=that.data.lat; | 435 | appd.lat=that.data.lat; |
432 | appd.lon=that.data.lon; | 436 | appd.lon=that.data.lon; |
433 | 437 | ||
434 | - }else{ | 438 | + } else { |
435 | if (e) { | 439 | if (e) { |
436 | e.distance = null; | 440 | e.distance = null; |
437 | that.data.fir_def_store=e; | 441 | that.data.fir_def_store=e; |
@@ -456,7 +460,7 @@ Page({ | @@ -456,7 +460,7 @@ Page({ | ||
456 | 460 | ||
457 | setTimeout(()=>{ | 461 | setTimeout(()=>{ |
458 | wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { | 462 | wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { |
459 | - // console.log('node@@@@@@@', res); | 463 | + |
460 | if(res.length != 0) { | 464 | if(res.length != 0) { |
461 | this.setData({ | 465 | this.setData({ |
462 | showFold: res[0].height < res[1].height, | 466 | showFold: res[0].height < res[1].height, |
@@ -517,7 +521,9 @@ Page({ | @@ -517,7 +521,9 @@ Page({ | ||
517 | 521 | ||
518 | if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 | 522 | if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 |
519 | let prom_id = this.data.options.prom_id; | 523 | let prom_id = this.data.options.prom_id; |
524 | + // 检查活动是否开始 | ||
520 | this.check_prom(goods_id, prom_type, prom_id); | 525 | this.check_prom(goods_id, prom_type, prom_id); |
526 | + | ||
521 | } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 | 527 | } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 |
522 | getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', { | 528 | getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', { |
523 | data: { | 529 | data: { |
@@ -537,20 +543,16 @@ Page({ | @@ -537,20 +543,16 @@ Page({ | ||
537 | let prom_id = result[0].act_id; | 543 | let prom_id = result[0].act_id; |
538 | this.setData({ | 544 | this.setData({ |
539 | 'options.prom_type': prom_type, | 545 | 'options.prom_type': prom_type, |
546 | + 'options.prom_id': prom_id, | ||
540 | }); | 547 | }); |
548 | + // 检查活动是否开始 | ||
541 | this.check_prom(goods_id, prom_type, prom_id); | 549 | this.check_prom(goods_id, prom_type, prom_id); |
542 | } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 | 550 | } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 |
543 | this.setData({ | 551 | this.setData({ |
544 | actList: res.data.data, | 552 | actList: res.data.data, |
545 | }); | 553 | }); |
546 | }; | 554 | }; |
547 | - | ||
548 | - // console.log('!!!!!!~~~~~~~~~prom~~~~~~~~~~!!!!!!'); | ||
549 | - | ||
550 | - // this.setData({ | ||
551 | - // prom, | ||
552 | - // }); | ||
553 | - | 555 | + |
554 | }; | 556 | }; |
555 | }); | 557 | }); |
556 | }; | 558 | }; |
@@ -669,8 +671,6 @@ Page({ | @@ -669,8 +671,6 @@ Page({ | ||
669 | 671 | ||
670 | 672 | ||
671 | 673 | ||
672 | - | ||
673 | - | ||
674 | 674 | ||
675 | i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { | 675 | i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { |
676 | failRollback: !0, | 676 | failRollback: !0, |
@@ -744,6 +744,9 @@ Page({ | @@ -744,6 +744,9 @@ Page({ | ||
744 | }; | 744 | }; |
745 | } | 745 | } |
746 | }); | 746 | }); |
747 | + | ||
748 | + | ||
749 | + | ||
747 | this.data.enterAddressPage && (this.data.enterAddressPage = !1); | 750 | this.data.enterAddressPage && (this.data.enterAddressPage = !1); |
748 | this.get_sto(); | 751 | this.get_sto(); |
749 | 752 | ||
@@ -815,8 +818,23 @@ Page({ | @@ -815,8 +818,23 @@ Page({ | ||
815 | activeCategoryId: 1 | 818 | activeCategoryId: 1 |
816 | }); | 819 | }); |
817 | }, | 820 | }, |
818 | - | ||
819 | - | 821 | + |
822 | + //获取redis中的数量 | ||
823 | + async getactLen(func) { | ||
824 | + var r_num = 0, | ||
825 | + prom_type = this.data.prom_type, | ||
826 | + prom_id = this.data.prom_id; | ||
827 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { | ||
828 | + 1: 1 | ||
829 | + }).then(res => { | ||
830 | + var em = res; | ||
831 | + if (em.data.code == 0) { | ||
832 | + r_num = em.data.data; | ||
833 | + } | ||
834 | + }) | ||
835 | + func(r_num); | ||
836 | + }, | ||
837 | + | ||
820 | //------------加入购物车-------------- | 838 | //------------加入购物车-------------- |
821 | addCart: function(t) { | 839 | addCart: function(t) { |
822 | var th = this; | 840 | var th = this; |
@@ -828,10 +846,61 @@ Page({ | @@ -828,10 +846,61 @@ Page({ | ||
828 | open_ind_store: ind | 846 | open_ind_store: ind |
829 | }); | 847 | }); |
830 | 848 | ||
831 | - if(!th.data.sto_sele_name){ | 849 | + if(!th.data.sto_sele_name) { |
832 | getApp().my_warnning('请选择门店', 1, th, 450); | 850 | getApp().my_warnning('请选择门店', 1, th, 450); |
833 | return false; | 851 | return false; |
834 | } | 852 | } |
853 | + | ||
854 | + | ||
855 | + | ||
856 | + //000000 | ||
857 | + //如果是秒杀的话,要看redis够不够 | ||
858 | + // if (this.data.prom_type == 1) { | ||
859 | + | ||
860 | + // if (this.data.openSpecModal_flash_normal) { | ||
861 | + // this.data.is_normal=1; //是普通购买 | ||
862 | + // return false; | ||
863 | + // } | ||
864 | + | ||
865 | + | ||
866 | + // this.getactLen(function (num) { | ||
867 | + // if (num < th.data.goodsInputNum) { | ||
868 | + // getApp().my_warnning("活动库存不足!", 0, th); | ||
869 | + // return false; | ||
870 | + // } else { | ||
871 | + // // th.add_cart_func(t); | ||
872 | + // } | ||
873 | + // }); | ||
874 | + // } else { | ||
875 | + // // th.add_cart_func(t); | ||
876 | + // } | ||
877 | + //000000 | ||
878 | + | ||
879 | + | ||
880 | + if(this.data.options.prom_type == 1) { | ||
881 | + var t = th.data.goodsInputNum; | ||
882 | + th.data.sele_g.viplimited = th.data.sele_g.buy_limit; | ||
883 | + if (th.data.sele_g.viplimited > 0) { | ||
884 | + var gd_buy_num = th.data.sele_g.buy_num; | ||
885 | + | ||
886 | + if (t + gd_buy_num >= th.data.sele_g.viplimited) { | ||
887 | + wx.showModal({ | ||
888 | + title: '超出商品限购', | ||
889 | + }); | ||
890 | + | ||
891 | + // var num = th.data.sele_g.viplimited - gd_buy_num; | ||
892 | + // if (num < 0) num = th.data.sele_g.viplimited; | ||
893 | + th.setData({goodsInputNum: 0}); | ||
894 | + return false; | ||
895 | + } | ||
896 | + }; | ||
897 | + }; | ||
898 | + | ||
899 | + | ||
900 | + | ||
901 | + | ||
902 | + | ||
903 | + | ||
835 | 904 | ||
836 | 905 | ||
837 | if(action=="buy"){ | 906 | if(action=="buy"){ |
@@ -855,7 +924,10 @@ Page({ | @@ -855,7 +924,10 @@ Page({ | ||
855 | // console.log('newd++++++++', newd); | 924 | // console.log('newd++++++++', newd); |
856 | th.buyNow(newd); | 925 | th.buyNow(newd); |
857 | } else { | 926 | } else { |
858 | - | 927 | + |
928 | + | ||
929 | + | ||
930 | + | ||
859 | var newd = { | 931 | var newd = { |
860 | service_id: th.data.data.id, | 932 | service_id: th.data.data.id, |
861 | service_sn:th.data.data.service_sn, | 933 | service_sn:th.data.data.service_sn, |
@@ -866,7 +938,7 @@ Page({ | @@ -866,7 +938,7 @@ Page({ | ||
866 | store_id:os.stoid, | 938 | store_id:os.stoid, |
867 | money:th.data.data.shop_price | 939 | money:th.data.data.shop_price |
868 | }; | 940 | }; |
869 | - if(getApp().globalData.guide_id){ | 941 | + if(getApp().globalData.guide_id) { |
870 | newd['guide_id'] = getApp().globalData.guide_id; | 942 | newd['guide_id'] = getApp().globalData.guide_id; |
871 | newd['guide_type']=0; | 943 | newd['guide_type']=0; |
872 | } | 944 | } |
@@ -926,14 +998,16 @@ Page({ | @@ -926,14 +998,16 @@ Page({ | ||
926 | } | 998 | } |
927 | 999 | ||
928 | 1000 | ||
1001 | + | ||
1002 | + | ||
929 | }, | 1003 | }, |
930 | 1004 | ||
931 | //----------立即购买----------- | 1005 | //----------立即购买----------- |
932 | buyNow: function(e) { | 1006 | buyNow: function(e) { |
933 | - getApp().globalData.service_now=e; | ||
934 | - wx.redirectTo({ | ||
935 | - url: "/packageA/pages/cart2_ser/cart2_ser", | ||
936 | - }); | 1007 | + getApp().globalData.service_now=e; |
1008 | + wx.redirectTo({ | ||
1009 | + url: "/packageA/pages/cart2_ser/cart2_ser", | ||
1010 | + }); | ||
937 | }, | 1011 | }, |
938 | //----------增加购买数量----------- | 1012 | //----------增加购买数量----------- |
939 | addCartNum: function(t) { | 1013 | addCartNum: function(t) { |
@@ -950,9 +1024,91 @@ Page({ | @@ -950,9 +1024,91 @@ Page({ | ||
950 | 1024 | ||
951 | //------检查数量是不是超出限购------ | 1025 | //------检查数量是不是超出限购------ |
952 | checkCartNum: function(t) { | 1026 | checkCartNum: function(t) { |
1027 | + | ||
953 | if(t<=0) return false; | 1028 | if(t<=0) return false; |
954 | - var th = this; | ||
955 | - th.setData({goodsInputNum:t}) | 1029 | + var th = this; |
1030 | + th.setData({goodsInputNum:t}); | ||
1031 | + | ||
1032 | + | ||
1033 | + var th = this; | ||
1034 | + this.get_buy_num(this.data.sele_g, async function () { | ||
1035 | + th.data.sele_g.viplimited = th.data.sele_g.buy_limit; | ||
1036 | + | ||
1037 | + //--判断商品是否超出限购-- | ||
1038 | + // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | ||
1039 | + if (th.data.sele_g.viplimited > 0) { | ||
1040 | + var gd_buy_num = th.data.sele_g.buy_num; | ||
1041 | + | ||
1042 | + if (t + gd_buy_num > th.data.sele_g.viplimited) { | ||
1043 | + wx.showModal({ | ||
1044 | + title: '超出商品限购', | ||
1045 | + }); | ||
1046 | + | ||
1047 | + var num = th.data.sele_g.viplimited - gd_buy_num; | ||
1048 | + if (num < 0) num = 0; | ||
1049 | + th.setData({goodsInputNum: num}) | ||
1050 | + return false; | ||
1051 | + } | ||
1052 | + } | ||
1053 | + | ||
1054 | + //如果是普通购买的情况下 | ||
1055 | + if(th.data.openSpecModal_flash_normal) th.data.is_normal=1; | ||
1056 | + | ||
1057 | + //--判断商品是否超出活动限购-- | ||
1058 | + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { | ||
1059 | + if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { | ||
1060 | + wx.showModal({ | ||
1061 | + title: '超出商品活动限购', | ||
1062 | + }); | ||
1063 | + | ||
1064 | + var num = th.data.prom_buy_limit - th.data.prom_buy_num; | ||
1065 | + if (num < 0) num = 0; | ||
1066 | + th.setData({goodsInputNum: num}) | ||
1067 | + return false; | ||
1068 | + } | ||
1069 | + } | ||
1070 | + | ||
1071 | + if ((th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) && !th.data.is_normal) { | ||
1072 | + var redis_num = 0; | ||
1073 | + //------判断活动是否抢光----- | ||
1074 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
1075 | + os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { | ||
1076 | + 1: 1 | ||
1077 | + }).then(res => { | ||
1078 | + redis_num = res.data.data; | ||
1079 | + }); | ||
1080 | + | ||
1081 | + if (t > redis_num) { | ||
1082 | + wx.showModal({ | ||
1083 | + title: '超出商品活动库存', | ||
1084 | + }); | ||
1085 | + th.setData({goodsInputNum: redis_num}) | ||
1086 | + return false; | ||
1087 | + } | ||
1088 | + } | ||
1089 | + var e = th.data.sele_g.store_count; | ||
1090 | + var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | ||
1091 | + 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)) { | ||
1092 | + if (!th.data.def_pick_store) { | ||
1093 | + wx.showModal({title: '请选择门店',}); | ||
1094 | + return false; | ||
1095 | + } else { | ||
1096 | + e = th.data.def_pick_store.CanOutQty; | ||
1097 | + } | ||
1098 | + } | ||
1099 | + if (!e) e = 0; | ||
1100 | + //库存不足,不增加 | ||
1101 | + if (e < t) { | ||
1102 | + wx.showModal({title: '库存不足',}); | ||
1103 | + if (e < 0) e = 0; | ||
1104 | + th.setData({goodsInputNum: e}); | ||
1105 | + return false; | ||
1106 | + } | ||
1107 | + t > e || 0 == e ? t = e : t < 1 && (t = 1); | ||
1108 | + th.setData({goodsInputNum: t}); | ||
1109 | + // th.is_show_more_buy(); | ||
1110 | + | ||
1111 | + }) | ||
956 | }, | 1112 | }, |
957 | 1113 | ||
958 | 1114 | ||
@@ -964,7 +1120,6 @@ Page({ | @@ -964,7 +1120,6 @@ Page({ | ||
964 | }, | 1120 | }, |
965 | 1121 | ||
966 | openSpecModel: function(t) { | 1122 | openSpecModel: function(t) { |
967 | - // console.log('****ttttttt***', t); | ||
968 | var th=this; | 1123 | var th=this; |
969 | var open_store = t.currentTarget.dataset.ind; | 1124 | var open_store = t.currentTarget.dataset.ind; |
970 | this.setData({ | 1125 | this.setData({ |
@@ -1045,29 +1200,57 @@ Page({ | @@ -1045,29 +1200,57 @@ Page({ | ||
1045 | }); | 1200 | }); |
1046 | } | 1201 | } |
1047 | } | 1202 | } |
1048 | - }, | ||
1049 | - | ||
1050 | - //---------联系客服------------ | ||
1051 | - contactService: function() { | ||
1052 | - s.getConfig(function(t) { | ||
1053 | - if (t.store_tel == undefined) { | ||
1054 | - getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
1055 | - isShowLoading: 1, | ||
1056 | - data: {}, | ||
1057 | - success: function(rs) { | ||
1058 | - getApp().globalData.config = rs.data.data; | ||
1059 | - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
1060 | - getApp().my_warnning("商家未设置电话", 0, th); | ||
1061 | - return false; | ||
1062 | - } | ||
1063 | - s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
1064 | - } | ||
1065 | - }) | ||
1066 | - } else { | ||
1067 | - s.confirmBox("请联系客服:" + t.store_tel); | ||
1068 | - } | ||
1069 | - }); | ||
1070 | - }, | 1203 | + }, |
1204 | + //---------联系客服------------ | ||
1205 | + contactService: function () { | ||
1206 | + this.getTel() | ||
1207 | + .then(() => { | ||
1208 | + if(self.data.store_tel) { | ||
1209 | + wx.showModal({ | ||
1210 | + title: '联系客服', | ||
1211 | + content: '客服热线:' + self.data.store_tel, | ||
1212 | + confirmText: '拨打', | ||
1213 | + success(res) { | ||
1214 | + if(res.confirm) { | ||
1215 | + wx.makePhoneCall({ | ||
1216 | + phoneNumber: self.data.store_tel, | ||
1217 | + }) | ||
1218 | + }; | ||
1219 | + }, | ||
1220 | + }); | ||
1221 | + }; | ||
1222 | + }); | ||
1223 | + }, | ||
1224 | + // 获取客服电话 | ||
1225 | + getTel() { | ||
1226 | + return new Promise((resolve, reject) => { | ||
1227 | + s.getConfig(function (t) { | ||
1228 | + if (t.store_tel == undefined) { | ||
1229 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
1230 | + isShowLoading: 1, | ||
1231 | + data: {}, | ||
1232 | + success: function (rs) { | ||
1233 | + getApp().globalData.config = rs.data.data; | ||
1234 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
1235 | + getApp().my_warnning("商家未设置电话", 0, th); | ||
1236 | + return false; | ||
1237 | + } | ||
1238 | + self.setData({ | ||
1239 | + store_tel: rs.data.data.store_tel, | ||
1240 | + }); | ||
1241 | + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
1242 | + } | ||
1243 | + }) | ||
1244 | + } else { | ||
1245 | + self.setData({ | ||
1246 | + store_tel: t.store_tel, | ||
1247 | + }); | ||
1248 | + // s.confirmBox("请联系客服:" + t.store_tel); | ||
1249 | + }; | ||
1250 | + resolve(); | ||
1251 | + }); | ||
1252 | + }); | ||
1253 | + }, | ||
1071 | //-------获取购物车数量---------- | 1254 | //-------获取购物车数量---------- |
1072 | requestCardNum: function() { | 1255 | requestCardNum: function() { |
1073 | var t = this; | 1256 | var t = this; |
@@ -2919,37 +3102,44 @@ Page({ | @@ -2919,37 +3102,44 @@ Page({ | ||
2919 | }, | 3102 | }, |
2920 | 3103 | ||
2921 | 3104 | ||
3105 | + //获取redis中的数量 | ||
3106 | + async getactLen(func) { | ||
3107 | + var r_num = 0, | ||
3108 | + prom_type = this.data.prom_type, | ||
3109 | + prom_id = this.data.prom_id; | ||
3110 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { | ||
3111 | + 1: 1 | ||
3112 | + }).then(res => { | ||
3113 | + var em = res; | ||
3114 | + if (em.data.code == 0) { | ||
3115 | + r_num = em.data.data; | ||
3116 | + } | ||
3117 | + }) | ||
3118 | + func(r_num); | ||
3119 | + }, | ||
3120 | + | ||
3121 | + | ||
2922 | 3122 | ||
2923 | 3123 | ||
2924 | //--------检查是否活动,活动是否开始,或者是否结束------- | 3124 | //--------检查是否活动,活动是否开始,或者是否结束------- |
2925 | async check_prom(gid, prom_type, prom_id) { | 3125 | async check_prom(gid, prom_type, prom_id) { |
2926 | - console.log('check_prom'); | ||
2927 | var ee = this, th = ee; | 3126 | var ee = this, th = ee; |
2928 | var user_id = getApp().globalData.user_id; | 3127 | var user_id = getApp().globalData.user_id; |
2929 | if (!user_id) user_id = 0; | 3128 | if (!user_id) user_id = 0; |
2930 | - | ||
2931 | - // if (prom_type == 3 || prom_type == 0 || prom_type == 5 || prom_type == 7 || prom_type == 9 || prom_type == 10) { | ||
2932 | - // this.setData({ | ||
2933 | - // prom_type: 0, isshow: 1, | ||
2934 | - // }); | ||
2935 | - // return false; | ||
2936 | - // } | ||
2937 | - | ||
2938 | - | ||
2939 | - | ||
2940 | - // if (prom_type == 1 && prom_id == 0) { | ||
2941 | - // this.setData({ | ||
2942 | - // prom_type: 0, isshow: 1, | ||
2943 | - // }); | ||
2944 | - | ||
2945 | - // //获取门店 | ||
2946 | - // this.get_sto(); | ||
2947 | - // this.get_sku(o.stoid, this.data.data, gid); | ||
2948 | - // this.check_has_flash(); | ||
2949 | - // this.data.is_normal = 1; | ||
2950 | - // this.check_is_youhui(gid, 1); | ||
2951 | - // return false; | ||
2952 | - // } | 3129 | + |
3130 | + if (prom_type == 1 && prom_id == 0) { | ||
3131 | + // this.setData({ | ||
3132 | + // prom_type: 0, isshow: 1, | ||
3133 | + // }); | ||
3134 | + | ||
3135 | + // //获取门店 | ||
3136 | + // this.get_sto(); | ||
3137 | + // this.get_sku(o.stoid, this.data.data, gid); | ||
3138 | + // this.check_has_flash(); | ||
3139 | + // this.data.is_normal = 1; | ||
3140 | + // this.check_is_youhui(gid, 1); | ||
3141 | + // return false; | ||
3142 | + } | ||
2953 | 3143 | ||
2954 | //if (prom_type != 3 && prom_type!=0){ | 3144 | //if (prom_type != 3 && prom_type!=0){ |
2955 | //---判断秒杀---- | 3145 | //---判断秒杀---- |
@@ -2959,15 +3149,27 @@ Page({ | @@ -2959,15 +3149,27 @@ Page({ | ||
2959 | 1: 1 | 3149 | 1: 1 |
2960 | }).then(res => { | 3150 | }).then(res => { |
2961 | var em = res; | 3151 | var em = res; |
2962 | - if (res.data.code == 0) { | ||
2963 | - // console.log('!!!!!!res!!!!', res); | ||
2964 | - if (res.data.data <= 0) ee.setData({ | ||
2965 | - prom_r_null: 1 | ||
2966 | - }); | 3152 | + if (em.data.code == 0) { |
3153 | + | ||
3154 | + if (em.data.data <= 0) { | ||
3155 | + wx.showModal({ | ||
3156 | + title: '来晚了,已被抢光!', | ||
3157 | + }); | ||
3158 | + | ||
3159 | + ee.setData({ | ||
3160 | + prom_r_null: 1, | ||
3161 | + goodsInputNum: 0 | ||
3162 | + }); | ||
3163 | + | ||
3164 | + // th.setData({goodsInputNum: redis_num}) | ||
3165 | + }; | ||
2967 | //拿取价格并且判断时间-- | 3166 | //拿取价格并且判断时间-- |
2968 | getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { | 3167 | getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { |
2969 | success: function (t) { | 3168 | success: function (t) { |
2970 | - // console.log('!!!!!!t!!!!', t); | 3169 | + th.setData({ |
3170 | + sele_g: t.data.data, | ||
3171 | + }); | ||
3172 | + | ||
2971 | if (t.data.code != 0) { | 3173 | if (t.data.code != 0) { |
2972 | ee.get_normal(gid); | 3174 | ee.get_normal(gid); |
2973 | return false; | 3175 | return false; |
@@ -2994,7 +3196,6 @@ Page({ | @@ -2994,7 +3196,6 @@ Page({ | ||
2994 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); | 3196 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); |
2995 | 3197 | ||
2996 | ee.setData({ | 3198 | ee.setData({ |
2997 | - 'data.shop_price': t.data.data.user_price, | ||
2998 | prom_price: t.data.data.user_price, | 3199 | prom_price: t.data.data.user_price, |
2999 | prom_type: 1, | 3200 | prom_type: 1, |
3000 | prom_id: prom_id, | 3201 | prom_id: prom_id, |
@@ -3011,8 +3212,7 @@ Page({ | @@ -3011,8 +3212,7 @@ Page({ | ||
3011 | var endTime1 = t.data.data.start_time; | 3212 | var endTime1 = t.data.data.start_time; |
3012 | if (endTime1 > newTime) { | 3213 | if (endTime1 > newTime) { |
3013 | ee.setData({ | 3214 | ee.setData({ |
3014 | - prom_time_text: '距秒杀开始还有', | ||
3015 | - prom_st: 0, | 3215 | + prom_time_text: '距秒杀开始还有' |
3016 | }) | 3216 | }) |
3017 | ee.countDown(endTime1, 0); | 3217 | ee.countDown(endTime1, 0); |
3018 | } else { | 3218 | } else { |
@@ -3026,60 +3226,60 @@ Page({ | @@ -3026,60 +3226,60 @@ Page({ | ||
3026 | } | 3226 | } |
3027 | 3227 | ||
3028 | //如果是进行中的话 | 3228 | //如果是进行中的话 |
3029 | - // if (endTime1 < newTime) { | ||
3030 | - // //-- 获取秒杀活动的多少规格 -- | ||
3031 | - // ee.get_more_flahs(function (list) { | ||
3032 | - // if (list && list.length > 1) { | ||
3033 | - | ||
3034 | - // var n_item = list[0]; | ||
3035 | - // var ind = list.findIndex(function (ele) { | ||
3036 | - // return ele.goods_id == ee.data.data.goods_id; | ||
3037 | - // }) | ||
3038 | - // if (ind < 0) return false; | ||
3039 | - // if (ind > 0) { | ||
3040 | - // n_item = JSON.parse(JSON.stringify(list[ind])); | ||
3041 | - // list.splice(ind, 1); | ||
3042 | - // list.unshift(n_item); | ||
3043 | - // } | ||
3044 | - | ||
3045 | - // ee.data.sele_g.viplimited = n_item.viplimited; | ||
3046 | - // ee.data.data.viplimited = n_item.viplimited; | ||
3047 | - | ||
3048 | - // var gb = 1; | ||
3049 | - // //-- 显示多规格 -- | ||
3050 | - // for (let i in list) { | ||
3051 | - // let item = list[i]; | ||
3052 | - // var gg = ""; | ||
3053 | - // if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
3054 | - // if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | ||
3055 | - | ||
3056 | - // if (item.goods_spec != "" && item.goods_color != "") { | ||
3057 | - // gg = item.goods_spec + "/" + item.goods_color; | ||
3058 | - // } else if (item.goods_spec != "" || item.goods_color != "") { | ||
3059 | - // gg = item.goods_spec + item.goods_color; | ||
3060 | - // } else { | ||
3061 | - // gg = "规格" + gb; | ||
3062 | - // gb++; | ||
3063 | - // } | ||
3064 | - // item.gg = gg; | ||
3065 | - // item.prom_id = item.prom_id; | ||
3066 | - // item.prom_type = 1; | ||
3067 | - // } | ||
3068 | - | ||
3069 | - // ee.setData({ | ||
3070 | - // sku_g: list, | ||
3071 | - // }); | ||
3072 | - | ||
3073 | - // } | ||
3074 | - // }) | ||
3075 | - // } | 3229 | + if (endTime1 < newTime) { |
3230 | + //-- 获取秒杀活动的多少规格 -- | ||
3231 | + ee.get_more_flahs(function (list) { | ||
3232 | + if (list && list.length > 1) { | ||
3233 | + | ||
3234 | + var n_item = list[0]; | ||
3235 | + var ind = list.findIndex(function (ele) { | ||
3236 | + return ele.goods_id == ee.data.data.goods_id; | ||
3237 | + }) | ||
3238 | + if (ind < 0) return false; | ||
3239 | + if (ind > 0) { | ||
3240 | + n_item = JSON.parse(JSON.stringify(list[ind])); | ||
3241 | + list.splice(ind, 1); | ||
3242 | + list.unshift(n_item); | ||
3243 | + } | ||
3244 | + | ||
3245 | + ee.data.sele_g.viplimited = n_item.viplimited; | ||
3246 | + ee.data.data.viplimited = n_item.viplimited; | ||
3247 | + | ||
3248 | + var gb = 1; | ||
3249 | + //-- 显示多规格 -- | ||
3250 | + for (let i in list) { | ||
3251 | + let item = list[i]; | ||
3252 | + var gg = ""; | ||
3253 | + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
3254 | + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | ||
3255 | + | ||
3256 | + if (item.goods_spec != "" && item.goods_color != "") { | ||
3257 | + gg = item.goods_spec + "/" + item.goods_color; | ||
3258 | + } else if (item.goods_spec != "" || item.goods_color != "") { | ||
3259 | + gg = item.goods_spec + item.goods_color; | ||
3260 | + } else { | ||
3261 | + gg = "规格" + gb; | ||
3262 | + gb++; | ||
3263 | + } | ||
3264 | + item.gg = gg; | ||
3265 | + item.prom_id = item.prom_id; | ||
3266 | + item.prom_type = 1; | ||
3267 | + } | ||
3268 | + | ||
3269 | + ee.setData({ | ||
3270 | + sku_g: list, | ||
3271 | + }); | ||
3272 | + | ||
3273 | + } | ||
3274 | + }) | ||
3275 | + } | ||
3076 | 3276 | ||
3077 | } | 3277 | } |
3078 | }); | 3278 | }); |
3079 | } | 3279 | } |
3080 | }) | 3280 | }) |
3081 | } | 3281 | } |
3082 | - | 3282 | + |
3083 | }, | 3283 | }, |
3084 | 3284 | ||
3085 | 3285 | ||
@@ -3088,51 +3288,194 @@ Page({ | @@ -3088,51 +3288,194 @@ Page({ | ||
3088 | let prom_type = e.currentTarget.dataset.promtype; | 3288 | let prom_type = e.currentTarget.dataset.promtype; |
3089 | let prom_id = e.currentTarget.dataset.promid; | 3289 | let prom_id = e.currentTarget.dataset.promid; |
3090 | let goods_id = this.data.data.goods_id; | 3290 | let goods_id = this.data.data.goods_id; |
3091 | - let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`; | ||
3092 | - // console.log('url~~~~', url); | 3291 | + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;s |
3093 | getApp().goto(url); | 3292 | getApp().goto(url); |
3094 | }, | 3293 | }, |
3095 | 3294 | ||
3096 | 3295 | ||
3097 | 3296 | ||
3098 | - | ||
3099 | - //-- 检验商品的活动情况 -- | ||
3100 | - check_gd_prom_new: function (func) { | ||
3101 | - var th = this; | 3297 | + //获取更多秒杀 |
3298 | + get_more_flahs: async function (func) { | ||
3299 | + var f_more = false; | ||
3102 | var user_id = getApp().globalData.user_id; | 3300 | var user_id = getApp().globalData.user_id; |
3103 | if (!user_id) user_id = 0; | 3301 | if (!user_id) user_id = 0; |
3104 | 3302 | ||
3105 | - var url = '/api/weshop/activitylist/listGoodActInfo2'; | ||
3106 | - var req_d = { | ||
3107 | - "store_id": os.stoid, | ||
3108 | - "goods_id": this.data.gid, | ||
3109 | - "user_id": user_id, | 3303 | + var url = "/api/weshop/goods/listSkuFlash?store_id=" + os.stoid + "&goods_id=" + this.data.data.goods_id + "&user_id=" + user_id; |
3304 | + //获取秒杀的多规格 | ||
3305 | + await getApp().request.promiseGet(url, {}).then(res => { | ||
3306 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
3307 | + f_more = res.data.data; | ||
3308 | + } | ||
3309 | + }) | ||
3310 | + if (!f_more) { | ||
3311 | + func(false); | ||
3312 | + return false; | ||
3110 | } | 3313 | } |
3111 | - getApp().request.get(url, { | ||
3112 | - data: req_d, | ||
3113 | - success: function (e) { | ||
3114 | - if (e.data.code == 0 && e.data.data && e.data.data.length > 0) { | ||
3115 | - var arr = e.data.data; | ||
3116 | - var arr2 = arr.filter(function (e) { | ||
3117 | - return e.s_time < ut.gettimestamp(); | ||
3118 | - }) | ||
3119 | - //-- 如果只有一个活动的话 -- | ||
3120 | - if (arr.length == 1) { | ||
3121 | - th.data.prom_type = arr[0].prom_type; | ||
3122 | - th.data.prom_id = arr[0].act_id; | ||
3123 | - } | ||
3124 | - //-- 如果只有一个进行中的活动的话 -- | ||
3125 | - else if (arr2.length == 1) { | ||
3126 | - th.data.prom_type = arr2[0].prom_type; | ||
3127 | - th.data.prom_id = arr2[0].act_id; | 3314 | + //-- 秒杀的价格要更新 -- |
3315 | + for (let i in f_more) { | ||
3316 | + | ||
3317 | + let item = f_more[i]; | ||
3318 | + f_more[i].prom_id = item.act_id; | ||
3319 | + f_more[i].prom_type = 1; | ||
3320 | + if (item.goods_id == this.data.data.goods_id) { | ||
3321 | + continue; | ||
3322 | + } | ||
3323 | + var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id; | ||
3324 | + await getApp().request.promiseGet(url, {}).then(rs => { | ||
3325 | + if (rs.data.code == 0) { | ||
3326 | + f_more[i].price = rs.data.data.user_price; | ||
3327 | + | ||
3328 | + } | ||
3329 | + }) | ||
3330 | + } | ||
3331 | + func(f_more); | ||
3332 | + | ||
3333 | + }, | ||
3334 | + | ||
3335 | + | ||
3336 | + | ||
3337 | + | ||
3338 | + | ||
3339 | + | ||
3340 | + //-------------获取购买数量的总函数---------------- | ||
3341 | + get_buy_num: function (gd, func) { | ||
3342 | + | ||
3343 | + var th = this, | ||
3344 | + user_id = getApp().globalData.user_id; | ||
3345 | + | ||
3346 | + | ||
3347 | + //----获取商品购买数---- | ||
3348 | + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
3349 | + data: { | ||
3350 | + store_id: os.stoid, | ||
3351 | + user_id: user_id, | ||
3352 | + goods_id: this.data.gid, | ||
3353 | + }, | ||
3354 | + success: function (t) { | ||
3355 | + if (t.data.code == 0) { | ||
3356 | + var g_buy_num = t.data.data.goodsbuynum; | ||
3357 | + | ||
3358 | + // 如果是秒杀的时候 | ||
3359 | + // if (th.data.prom_type == 0 && gd.prom_type == 1) { | ||
3360 | + // gd.prom_type = 0; | ||
3361 | + // } | ||
3362 | + | ||
3363 | + //----获取活动购买数---- | ||
3364 | + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
3365 | + data: { | ||
3366 | + store_id: os.stoid, | ||
3367 | + user_id: user_id, | ||
3368 | + goods_id: th.data.gid, | ||
3369 | + prom_type: th.data.prom_type, | ||
3370 | + prom_id: th.data.prom_id | ||
3371 | + }, | ||
3372 | + //-----获取----- | ||
3373 | + success: function (tt) { | ||
3374 | + if (tt.data.code == 0) { | ||
3375 | + th.setData({ | ||
3376 | + prom_buy_num: tt.data.data.goodsbuynum, | ||
3377 | + }); | ||
3378 | + "function" == typeof func && func(); | ||
3379 | + } | ||
3380 | + } | ||
3381 | + }); | ||
3382 | + | ||
3383 | + | ||
3128 | } | 3384 | } |
3385 | + }, | ||
3386 | + }); | ||
3387 | + }, | ||
3388 | + | ||
3389 | + | ||
3390 | + | ||
3391 | + | ||
3392 | + | ||
3393 | + // 促销 -> 送礼包 -> 查看详情 | ||
3394 | + viewLbDetails(e) { | ||
3395 | + let id = e.currentTarget.dataset.id; // 获取礼包id | ||
3396 | + let url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 | ||
3397 | + // console.log('myurl', url); | ||
3398 | + getApp().goto(url); | ||
3399 | + }, | ||
3400 | + | ||
3401 | + go_more_ladder: function (e) { | ||
3402 | + var prom_id = e.currentTarget.dataset.id; | ||
3403 | + getApp().goto("/pages/goods/goodsList/goodsList?ladder_id=" + prom_id); | ||
3404 | + }, | ||
3405 | + | ||
3406 | + getHistoryBuy() { | ||
3407 | + let _this = this; | ||
3408 | + let req_data = { | ||
3409 | + store_id: os.stoid, | ||
3410 | + goods_id: this.data.gid, | ||
3411 | + pay_status: 1, | ||
3412 | + rndid: 1 | ||
3413 | + }; | ||
3414 | + getApp().request.promiseGet('/api/weshop/ordergoods/list', { | ||
3415 | + data: req_data, | ||
3416 | + }) | ||
3417 | + .then(res => { | ||
3418 | + if (t.ajax_ok(res)) { | ||
3419 | + _this.setData({ | ||
3420 | + historyBuyInfo: res.data.data.pageData, | ||
3421 | + }) | ||
3129 | } | 3422 | } |
3130 | - //-- 调用回调 -- | ||
3131 | - func(); | ||
3132 | - } | ||
3133 | - }); | 3423 | + }) |
3134 | }, | 3424 | }, |
3135 | 3425 | ||
3426 | + | ||
3427 | + | ||
3428 | + //-- 秒杀的普通购买 -- | ||
3429 | + openSpecModel_Nor: function () { | ||
3430 | + this.data.g_buy_num = new Map(); | ||
3431 | + var th = this; | ||
3432 | + this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 | ||
3433 | + if (th.data.sku_g_pt) { | ||
3434 | + this.get_sto(1) | ||
3435 | + this.setData({openSpecModal_flash_normal: 1}); | ||
3436 | + } else { | ||
3437 | + th.get_sto(1); | ||
3438 | + th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { | ||
3439 | + th.setData({ | ||
3440 | + openSpecModal_flash_normal: 1 | ||
3441 | + }); | ||
3442 | + }); | ||
3443 | + } | ||
3444 | + this.check_is_youhui(th.data.gid, 1); | ||
3445 | + }, | ||
3446 | + | ||
3447 | + closeSpecModal_flash_normal: function () { | ||
3448 | + this.setData({openSpecModal_flash_normal: 0}); | ||
3449 | + }, | ||
3450 | + | ||
3451 | + | ||
3452 | + //打开客服操作菜单 | ||
3453 | + openCS() { | ||
3454 | + // csType/在线客服设置: | ||
3455 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | ||
3456 | + // 1小程序客服、 | ||
3457 | + // 2企业微信客服 | ||
3458 | + let csType = this.data.sys_switch.weapp_customertype; | ||
3459 | + if(csType == 0) { | ||
3460 | + // 获取电话号码 | ||
3461 | + this.contactService(); | ||
3462 | + } else { | ||
3463 | + this.getTel() | ||
3464 | + .then(() => { | ||
3465 | + self.setData({ | ||
3466 | + hiddenCS: false, | ||
3467 | + }); | ||
3468 | + }); | ||
3469 | + | ||
3470 | + }; | ||
3471 | + }, | ||
3472 | + | ||
3473 | + //关闭客服操作菜单 | ||
3474 | + closeCS() { | ||
3475 | + this.setData({ | ||
3476 | + hiddenCS: true, | ||
3477 | + }); | ||
3478 | + } | ||
3136 | 3479 | ||
3137 | 3480 | ||
3138 | 3481 | ||
@@ -3140,9 +3483,11 @@ Page({ | @@ -3140,9 +3483,11 @@ Page({ | ||
3140 | 3483 | ||
3141 | 3484 | ||
3142 | 3485 | ||
3486 | + | ||
3143 | 3487 | ||
3144 | 3488 | ||
3145 | 3489 | ||
3490 | + | ||
3146 | 3491 | ||
3147 | 3492 | ||
3148 | 3493 |
packageA/pages/goodsInfo/goodsInfo.wxml
@@ -101,7 +101,8 @@ | @@ -101,7 +101,8 @@ | ||
101 | <!-- 秒杀价 --> | 101 | <!-- 秒杀价 --> |
102 | <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> --> | 102 | <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> --> |
103 | <!-- 手店价 --> | 103 | <!-- 手店价 --> |
104 | - <view class="co-red"><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> | 104 | + <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> |
105 | + <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> | ||
105 | <view class="goods-title"> | 106 | <view class="goods-title"> |
106 | <view class="goods-name elli">{{data.goods_name}}</view> | 107 | <view class="goods-name elli">{{data.goods_name}}</view> |
107 | </view> | 108 | </view> |
@@ -506,7 +507,7 @@ | @@ -506,7 +507,7 @@ | ||
506 | <view class="join-cart jc_sb ai_c"> | 507 | <view class="join-cart jc_sb ai_c"> |
507 | 508 | ||
508 | <view class="flex"> | 509 | <view class="flex"> |
509 | - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact" | 510 | + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact" |
510 | session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | 511 | session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> |
511 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | 512 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
512 | <view>客服</view> | 513 | <view>客服</view> |
@@ -521,6 +522,11 @@ | @@ -521,6 +522,11 @@ | ||
521 | <view wx:else class="custom-service cart-ico new_split pdh20" bindtap="contactService" style="text-align: center"> | 522 | <view wx:else class="custom-service cart-ico new_split pdh20" bindtap="contactService" style="text-align: center"> |
522 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | 523 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
523 | <view>客服</view> | 524 | <view>客服</view> |
525 | + </view> --> | ||
526 | + | ||
527 | + <view class="custom-service cart-ico new_split pdh20" bindtap="openCS"> | ||
528 | + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | ||
529 | + <view>客服</view> | ||
524 | </view> | 530 | </view> |
525 | 531 | ||
526 | <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20"> | 532 | <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20"> |
@@ -542,8 +548,8 @@ | @@ -542,8 +548,8 @@ | ||
542 | <view class="flex f1 btn-group"> | 548 | <view class="flex f1 btn-group"> |
543 | 549 | ||
544 | <!-- 从“秒杀”入口进入购买商品 --> | 550 | <!-- 从“秒杀”入口进入购买商品 --> |
545 | - <!-- <block wx:if="{{options.prom_type == 1}}"> --> | ||
546 | <block wx:if="{{options.prom_type == 1}}"> | 551 | <block wx:if="{{options.prom_type == 1}}"> |
552 | + | ||
547 | <block wx:if="{{prom_st==1 && !prom_r_null}}"> | 553 | <block wx:if="{{prom_st==1 && !prom_r_null}}"> |
548 | <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view> | 554 | <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view> |
549 | <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view> | 555 | <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view> |
@@ -560,9 +566,7 @@ | @@ -560,9 +566,7 @@ | ||
560 | </block> | 566 | </block> |
561 | </block> | 567 | </block> |
562 | 568 | ||
563 | - | ||
564 | - <block wx:if="{{prom_r_null}}"> | ||
565 | - | 569 | + <block wx:if="{{prom_r_null}}"> |
566 | <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}"> | 570 | <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}"> |
567 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> | 571 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> |
568 | <view class="buy-btn cart-btn huise f1">已抢光</view> | 572 | <view class="buy-btn cart-btn huise f1">已抢光</view> |
@@ -575,11 +579,10 @@ | @@ -575,11 +579,10 @@ | ||
575 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> | 579 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> |
576 | <view class="buy-btn cart-btn huise f1">活动已经结束</view> | 580 | <view class="buy-btn cart-btn huise f1">活动已经结束</view> |
577 | </block> | 581 | </block> |
578 | - | ||
579 | <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view> | 582 | <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view> |
580 | </block> | 583 | </block> |
584 | + | ||
581 | </block> | 585 | </block> |
582 | - <!-- </block> --> | ||
583 | 586 | ||
584 | 587 | ||
585 | <!-- 从“我的服务”入口进入购买商品 --> | 588 | <!-- 从“我的服务”入口进入购买商品 --> |
@@ -615,7 +618,8 @@ | @@ -615,7 +618,8 @@ | ||
615 | <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view> | 618 | <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view> |
616 | <view class="flex ai_end xc-val-money"> | 619 | <view class="flex ai_end xc-val-money"> |
617 | <view class="spec-goods-price"><text class="fs20">¥</text> | 620 | <view class="spec-goods-price"><text class="fs20">¥</text> |
618 | - <block wx>{{data.shop_price}}</block> | 621 | + <block wx:if="{{options.prom_type == 1}}">{{prom_price}}</block> |
622 | + <block wx:else>{{data.shop_price}}</block> | ||
619 | </view> | 623 | </view> |
620 | </view> | 624 | </view> |
621 | </view> | 625 | </view> |
@@ -902,3 +906,31 @@ | @@ -902,3 +906,31 @@ | ||
902 | </view> | 906 | </view> |
903 | </view> | 907 | </view> |
904 | </view> | 908 | </view> |
909 | + | ||
910 | + | ||
911 | +<!-- 联系客服操作菜单 --> | ||
912 | +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}"> | ||
913 | + <view class="pd20 t-c pr"> | ||
914 | + <text class="bold">联系客服</text> | ||
915 | + <text class="iconfont icon-guan" bindtap="closeCS"></text> | ||
916 | + </view> | ||
917 | + <!-- 客服热线 --> | ||
918 | + <view class="pd20 bdt fs30 btn2" bindtap="contactService"> | ||
919 | + <text class="iconfont icon-dianhua"></text>客服热线: | ||
920 | + <text class="c-red">{{store_tel}}</text> | ||
921 | + </view> | ||
922 | + <!-- 小程序客服 --> | ||
923 | + <block wx:if="{{sys_switch.weapp_customertype == 1}}"> | ||
924 | + <button class="pd20 bdt fs30 btn2" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | ||
925 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
926 | + </button> | ||
927 | + </block> | ||
928 | + <!-- 微信客服 --> | ||
929 | + <block wx:elif="{{sys_switch.weapp_customertype == 2}}"> | ||
930 | + <view class="pd20 bdt fs30 btn2" bindtap="con_weixin"> | ||
931 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
932 | + </view> | ||
933 | + </block> | ||
934 | +</view> | ||
935 | + | ||
936 | +<view class="mask2" bindtap="closeCS"></view> |
packageA/pages/goodsInfo/goodsInfo.wxss
@@ -2968,3 +2968,56 @@ button.custom-service::after{ | @@ -2968,3 +2968,56 @@ button.custom-service::after{ | ||
2968 | left: -1000px; | 2968 | left: -1000px; |
2969 | top: -1000px; | 2969 | top: -1000px; |
2970 | } | 2970 | } |
2971 | + | ||
2972 | + | ||
2973 | + | ||
2974 | +/* 联系客服操作菜单 */ | ||
2975 | +.action { | ||
2976 | + position: fixed; | ||
2977 | + bottom: 100rpx; | ||
2978 | + z-index: 1; | ||
2979 | + width: 100%; | ||
2980 | + background-color: white; | ||
2981 | + border-radius: 20rpx 20rpx 0 0; | ||
2982 | +} | ||
2983 | + | ||
2984 | +.action .icon-guan { | ||
2985 | + position: absolute; | ||
2986 | + left: 20rpx !important; | ||
2987 | + right: auto !important; | ||
2988 | +} | ||
2989 | + | ||
2990 | +.action .iconfont { | ||
2991 | + color: #ff7295; | ||
2992 | + margin-right: 10rpx; | ||
2993 | +} | ||
2994 | + | ||
2995 | +.action button { | ||
2996 | + text-align: left; | ||
2997 | + line-height: normal; | ||
2998 | +} | ||
2999 | + | ||
3000 | +.action button::after { | ||
3001 | + border-width: 0; | ||
3002 | +} | ||
3003 | + | ||
3004 | +.action .btn2 { | ||
3005 | + box-sizing: border-box; | ||
3006 | + height: 100rpx; | ||
3007 | + display: flex; | ||
3008 | + align-items: center; | ||
3009 | +} | ||
3010 | + | ||
3011 | +.mask2 { | ||
3012 | + display: none; | ||
3013 | + position: fixed; | ||
3014 | + left: 0; | ||
3015 | + right: 0; | ||
3016 | + top: 0; | ||
3017 | + bottom: 0; | ||
3018 | + background-color: rgba(0,0,0,.5); | ||
3019 | +} | ||
3020 | + | ||
3021 | +.action.active ~ .mask2 { | ||
3022 | + display: block; | ||
3023 | +} |
pages/goods/goodsInfo/goodsInfo.js
@@ -255,6 +255,8 @@ Page({ | @@ -255,6 +255,8 @@ Page({ | ||
255 | share_hidden: false, | 255 | share_hidden: false, |
256 | all_activity_list: null, //所有活动的列表 | 256 | all_activity_list: null, //所有活动的列表 |
257 | 257 | ||
258 | + hiddenCS: true, //控制客服操作菜单 | ||
259 | + | ||
258 | }, | 260 | }, |
259 | 261 | ||
260 | //------初始化加载---------- | 262 | //------初始化加载---------- |
@@ -2280,25 +2282,55 @@ Page({ | @@ -2280,25 +2282,55 @@ Page({ | ||
2280 | 2282 | ||
2281 | //---------联系客服------------ | 2283 | //---------联系客服------------ |
2282 | contactService: function () { | 2284 | contactService: function () { |
2283 | - s.getConfig(function (t) { | ||
2284 | - if (t.store_tel == undefined) { | ||
2285 | - getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
2286 | - isShowLoading: 1, | ||
2287 | - data: {}, | ||
2288 | - success: function (rs) { | ||
2289 | - getApp().globalData.config = rs.data.data; | ||
2290 | - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
2291 | - getApp().my_warnning("商家未设置电话", 0, th); | ||
2292 | - return false; | ||
2293 | - } | ||
2294 | - s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
2295 | - } | ||
2296 | - }) | ||
2297 | - } else { | ||
2298 | - s.confirmBox("请联系客服:" + t.store_tel); | ||
2299 | - } | ||
2300 | - }); | 2285 | + this.getTel() |
2286 | + .then(() => { | ||
2287 | + if(self.data.store_tel) { | ||
2288 | + wx.showModal({ | ||
2289 | + title: '联系客服', | ||
2290 | + content: '客服热线:' + self.data.store_tel, | ||
2291 | + confirmText: '拨打', | ||
2292 | + success(res) { | ||
2293 | + if(res.confirm) { | ||
2294 | + wx.makePhoneCall({ | ||
2295 | + phoneNumber: self.data.store_tel, | ||
2296 | + }) | ||
2297 | + }; | ||
2298 | + }, | ||
2299 | + }); | ||
2300 | + }; | ||
2301 | + }); | ||
2301 | }, | 2302 | }, |
2303 | + // 获取客服电话 | ||
2304 | + getTel() { | ||
2305 | + return new Promise((resolve, reject) => { | ||
2306 | + s.getConfig(function (t) { | ||
2307 | + if (t.store_tel == undefined) { | ||
2308 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
2309 | + isShowLoading: 1, | ||
2310 | + data: {}, | ||
2311 | + success: function (rs) { | ||
2312 | + getApp().globalData.config = rs.data.data; | ||
2313 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
2314 | + getApp().my_warnning("商家未设置电话", 0, th); | ||
2315 | + return false; | ||
2316 | + } | ||
2317 | + self.setData({ | ||
2318 | + store_tel: rs.data.data.store_tel, | ||
2319 | + }); | ||
2320 | + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
2321 | + } | ||
2322 | + }) | ||
2323 | + } else { | ||
2324 | + self.setData({ | ||
2325 | + store_tel: t.store_tel, | ||
2326 | + }); | ||
2327 | + // s.confirmBox("请联系客服:" + t.store_tel); | ||
2328 | + }; | ||
2329 | + resolve(); | ||
2330 | + }); | ||
2331 | + }); | ||
2332 | + }, | ||
2333 | + | ||
2302 | //-------获取购物车数量---------- | 2334 | //-------获取购物车数量---------- |
2303 | requestCardNum: function () { | 2335 | requestCardNum: function () { |
2304 | var t = this; | 2336 | var t = this; |
@@ -6621,6 +6653,35 @@ Page({ | @@ -6621,6 +6653,35 @@ Page({ | ||
6621 | }, | 6653 | }, |
6622 | 6654 | ||
6623 | 6655 | ||
6656 | + //打开客服操作菜单 | ||
6657 | + openCS() { | ||
6658 | + // csType/在线客服设置: | ||
6659 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | ||
6660 | + // 1小程序客服、 | ||
6661 | + // 2企业微信客服 | ||
6662 | + let csType = this.data.sys_switch.weapp_customertype; | ||
6663 | + if(csType == 0) { | ||
6664 | + // 获取电话号码 | ||
6665 | + this.contactService(); | ||
6666 | + } else { | ||
6667 | + this.getTel() | ||
6668 | + .then(() => { | ||
6669 | + self.setData({ | ||
6670 | + hiddenCS: false, | ||
6671 | + }); | ||
6672 | + }); | ||
6673 | + | ||
6674 | + }; | ||
6675 | + }, | ||
6676 | + | ||
6677 | + //关闭客服操作菜单 | ||
6678 | + closeCS() { | ||
6679 | + this.setData({ | ||
6680 | + hiddenCS: true, | ||
6681 | + }); | ||
6682 | + } | ||
6683 | + | ||
6684 | + | ||
6624 | 6685 | ||
6625 | 6686 | ||
6626 | 6687 |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -1011,17 +1011,17 @@ | @@ -1011,17 +1011,17 @@ | ||
1011 | <!-- -----------------底部按钮------------------ --> | 1011 | <!-- -----------------底部按钮------------------ --> |
1012 | <view class="join-cart"> | 1012 | <view class="join-cart"> |
1013 | <!-- bindtap="contactService" --> | 1013 | <!-- bindtap="contactService" --> |
1014 | - <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | 1014 | + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> |
1015 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | 1015 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
1016 | <view>客服</view> | 1016 | <view>客服</view> |
1017 | - </button> | 1017 | + </button> --> |
1018 | 1018 | ||
1019 | - <view wx:elif="{{sys_switch.weapp_customertype==2}}" class="custom-service cart-ico new_split" bindtap="con_weixin"> | 1019 | + <!-- <view wx:elif="{{sys_switch.weapp_customertype==2}}" class="custom-service cart-ico new_split" bindtap="con_weixin"> |
1020 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | 1020 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
1021 | <view>客服</view> | 1021 | <view>客服</view> |
1022 | - </view> | 1022 | + </view> --> |
1023 | 1023 | ||
1024 | - <view wx:else class="custom-service cart-ico new_split" bindtap="contactService"> | 1024 | + <view class="custom-service cart-ico new_split" bindtap="openCS"> |
1025 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | 1025 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
1026 | <view>客服</view> | 1026 | <view>客服</view> |
1027 | </view> | 1027 | </view> |
@@ -1718,3 +1718,32 @@ | @@ -1718,3 +1718,32 @@ | ||
1718 | <view hidden="{{!openSpecModal_flash_normal}}"> | 1718 | <view hidden="{{!openSpecModal_flash_normal}}"> |
1719 | <include src="buy_flash_normal.wxml" /> | 1719 | <include src="buy_flash_normal.wxml" /> |
1720 | </view> | 1720 | </view> |
1721 | + | ||
1722 | + | ||
1723 | + | ||
1724 | +<!-- 联系客服操作菜单 --> | ||
1725 | +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}"> | ||
1726 | + <view class="pd20 t-c pr"> | ||
1727 | + <text class="bold">联系客服</text> | ||
1728 | + <text class="iconfont icon-guan" bindtap="closeCS"></text> | ||
1729 | + </view> | ||
1730 | + <!-- 客服热线 --> | ||
1731 | + <view class="pd20 bdt fs30 btn2" bindtap="contactService"> | ||
1732 | + <text class="iconfont icon-dianhua"></text>客服热线: | ||
1733 | + <text class="c-red">{{store_tel}}</text> | ||
1734 | + </view> | ||
1735 | + <!-- 小程序客服 --> | ||
1736 | + <block wx:if="{{sys_switch.weapp_customertype == 1}}"> | ||
1737 | + <button class="pd20 bdt fs30 btn2" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | ||
1738 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
1739 | + </button> | ||
1740 | + </block> | ||
1741 | + <!-- 微信客服 --> | ||
1742 | + <block wx:elif="{{sys_switch.weapp_customertype == 2}}"> | ||
1743 | + <view class="pd20 bdt fs30 btn2" bindtap="con_weixin"> | ||
1744 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
1745 | + </view> | ||
1746 | + </block> | ||
1747 | +</view> | ||
1748 | + | ||
1749 | +<view class="mask2" bindtap="closeCS"></view> |
pages/goods/goodsInfo/goodsInfo.wxss
@@ -4001,3 +4001,54 @@ button.custom-service::after { | @@ -4001,3 +4001,54 @@ button.custom-service::after { | ||
4001 | left: -1000px; | 4001 | left: -1000px; |
4002 | top: -1000px; | 4002 | top: -1000px; |
4003 | } | 4003 | } |
4004 | + | ||
4005 | + | ||
4006 | + | ||
4007 | + | ||
4008 | +/* 联系客服操作菜单 */ | ||
4009 | +.action { | ||
4010 | + position: fixed; | ||
4011 | + bottom: 100rpx; | ||
4012 | + z-index: 1; | ||
4013 | + width: 100%; | ||
4014 | + background-color: white; | ||
4015 | + border-radius: 20rpx 20rpx 0 0; | ||
4016 | +} | ||
4017 | + | ||
4018 | +.action .icon-guan { | ||
4019 | + position: absolute; | ||
4020 | + left: 20rpx !important; | ||
4021 | + right: auto !important; | ||
4022 | +} | ||
4023 | + | ||
4024 | +.action .iconfont { | ||
4025 | + color: #ff7295; | ||
4026 | + margin-right: 10rpx; | ||
4027 | +} | ||
4028 | + | ||
4029 | +.action button { | ||
4030 | + text-align: left; | ||
4031 | + line-height: normal; | ||
4032 | +} | ||
4033 | + | ||
4034 | +.action .btn2 { | ||
4035 | + box-sizing: border-box; | ||
4036 | + height: 100rpx; | ||
4037 | + display: flex; | ||
4038 | + align-items: center; | ||
4039 | +} | ||
4040 | + | ||
4041 | +.mask2 { | ||
4042 | + display: none; | ||
4043 | + position: fixed; | ||
4044 | + left: 0; | ||
4045 | + right: 0; | ||
4046 | + top: 0; | ||
4047 | + bottom: 0; | ||
4048 | + background-color: rgba(0,0,0,.5); | ||
4049 | +} | ||
4050 | + | ||
4051 | +.action.active ~ .mask2 { | ||
4052 | + display: block; | ||
4053 | +} | ||
4054 | + |
pages/user/index/index.js
@@ -11,6 +11,7 @@ const { | @@ -11,6 +11,7 @@ const { | ||
11 | qrcode | 11 | qrcode |
12 | } = require('../../../utils/index.js'); | 12 | } = require('../../../utils/index.js'); |
13 | var ut = require("../../../utils/util.js"); | 13 | var ut = require("../../../utils/util.js"); |
14 | +let self = null; | ||
14 | 15 | ||
15 | Page({ | 16 | Page({ |
16 | /** | 17 | /** |
@@ -44,7 +45,7 @@ Page({ | @@ -44,7 +45,7 @@ Page({ | ||
44 | ad_img:"", | 45 | ad_img:"", |
45 | add_card_data:'', //等级卡的内容 | 46 | add_card_data:'', //等级卡的内容 |
46 | 47 | ||
47 | - | 48 | + hiddenCS: true, |
48 | }, | 49 | }, |
49 | goto_nav: function(e) { | 50 | goto_nav: function(e) { |
50 | var th = this; | 51 | var th = this; |
@@ -62,6 +63,7 @@ Page({ | @@ -62,6 +63,7 @@ Page({ | ||
62 | */ | 63 | */ |
63 | onLoad: function(options) { | 64 | onLoad: function(options) { |
64 | var th=this; | 65 | var th=this; |
66 | + self = this; | ||
65 | getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { | 67 | getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { |
66 | data: { | 68 | data: { |
67 | enabled: 1 | 69 | enabled: 1 |
@@ -703,26 +705,60 @@ Page({ | @@ -703,26 +705,60 @@ Page({ | ||
703 | 705 | ||
704 | //---------联系客服------------ | 706 | //---------联系客服------------ |
705 | contactService: function() { | 707 | contactService: function() { |
706 | - var s = getApp(); | ||
707 | - s.getConfig(function(t) { | ||
708 | - if (t.store_tel == undefined) { | ||
709 | - getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
710 | - isShowLoading: 1, | ||
711 | - data: {}, | ||
712 | - success: function(rs) { | ||
713 | - getApp().globalData.config = rs.data.data; | ||
714 | - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
715 | - getApp().showWarning("商家未设置电话"); | ||
716 | - return false; | ||
717 | - } | ||
718 | - s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
719 | - } | ||
720 | - }) | ||
721 | - } else { | ||
722 | - s.confirmBox("请联系客服:" + t.store_tel); | ||
723 | - } | ||
724 | - }); | ||
725 | - }, | 708 | + this.getTel() |
709 | + .then(() => { | ||
710 | + if(self.data.store_tel) { | ||
711 | + wx.showModal({ | ||
712 | + title: '联系客服', | ||
713 | + content: '客服热线:' + self.data.store_tel, | ||
714 | + confirmText: '拨打', | ||
715 | + success(res) { | ||
716 | + if(res.confirm) { | ||
717 | + wx.makePhoneCall({ | ||
718 | + phoneNumber: self.data.store_tel, | ||
719 | + }) | ||
720 | + }; | ||
721 | + }, | ||
722 | + }); | ||
723 | + }; | ||
724 | + }); | ||
725 | + }, | ||
726 | + | ||
727 | + // 获取客服热线 | ||
728 | + getTel() { | ||
729 | + return new Promise((resolve, reject) => { | ||
730 | + var self = this; | ||
731 | + var s = getApp(); | ||
732 | + s.getConfig(function(t) { | ||
733 | + if (t.store_tel == undefined) { | ||
734 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
735 | + isShowLoading: 1, | ||
736 | + data: {}, | ||
737 | + success: function(rs) { | ||
738 | + getApp().globalData.config = rs.data.data; | ||
739 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
740 | + getApp().showWarning("商家未设置电话"); | ||
741 | + return false; | ||
742 | + } else { | ||
743 | + self.setData({ | ||
744 | + store_tel: rs.data.data.store_tel, | ||
745 | + }); | ||
746 | + // s.confirmBox("客服热线:" + rs.data.data.store_tel); | ||
747 | + }; | ||
748 | + | ||
749 | + } | ||
750 | + }) | ||
751 | + } else { | ||
752 | + self.setData({ | ||
753 | + store_tel: t.store_tel, | ||
754 | + }); | ||
755 | + // s.confirmBox("客服热线:" + t.store_tel); | ||
756 | + } | ||
757 | + resolve(); | ||
758 | + }); | ||
759 | + }); | ||
760 | + }, | ||
761 | + | ||
726 | 762 | ||
727 | go_info: function() { | 763 | go_info: function() { |
728 | getApp().goto("/pages/user/userinfo/userinfo"); | 764 | getApp().goto("/pages/user/userinfo/userinfo"); |
@@ -902,7 +938,38 @@ Page({ | @@ -902,7 +938,38 @@ Page({ | ||
902 | } | 938 | } |
903 | }) | 939 | }) |
904 | this.setData({user_tool:d_list}); | 940 | this.setData({user_tool:d_list}); |
905 | - } | 941 | + }, |
942 | + | ||
943 | + | ||
944 | + //打开客服操作菜单 | ||
945 | + openCS() { | ||
946 | + // csType/在线客服设置: | ||
947 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | ||
948 | + // 1小程序客服、 | ||
949 | + // 2企业微信客服 | ||
950 | + let csType = this.data.sys_switch.weapp_customertype; | ||
951 | + if(csType == 0) { | ||
952 | + // 获取电话号码 | ||
953 | + this.contactService(); | ||
954 | + } else { | ||
955 | + this.getTel() | ||
956 | + .then(() => { | ||
957 | + self.setData({ | ||
958 | + hiddenCS: false, | ||
959 | + }); | ||
960 | + }); | ||
961 | + | ||
962 | + }; | ||
963 | + }, | ||
964 | + | ||
965 | + //关闭客服操作菜单 | ||
966 | + closeCS() { | ||
967 | + this.setData({ | ||
968 | + hiddenCS: true, | ||
969 | + }); | ||
970 | + } | ||
971 | + | ||
972 | + | ||
906 | 973 | ||
907 | 974 | ||
908 | 975 |
pages/user/index/index.wxml
@@ -261,7 +261,7 @@ | @@ -261,7 +261,7 @@ | ||
261 | <!-- 没有链接地址的时候 --> | 261 | <!-- 没有链接地址的时候 --> |
262 | <block wx:else> | 262 | <block wx:else> |
263 | <block wx:if="{{item.name=='联系客服'}}"> | 263 | <block wx:if="{{item.name=='联系客服'}}"> |
264 | - <button class="item t-c" wx:if="{{sys_switch.weapp_customertype==1}}" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | 264 | + <!-- <button class="item t-c" wx:if="{{sys_switch.weapp_customertype==1}}" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> |
265 | <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | 265 | <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image> |
266 | <view class="fs26">联系客服</view> | 266 | <view class="fs26">联系客服</view> |
267 | </button> | 267 | </button> |
@@ -274,7 +274,12 @@ | @@ -274,7 +274,12 @@ | ||
274 | <view class="item t-c" bindtap="contactService" wx:else> | 274 | <view class="item t-c" bindtap="contactService" wx:else> |
275 | <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | 275 | <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image> |
276 | <view class="fs26">联系客服</view> | 276 | <view class="fs26">联系客服</view> |
277 | - </view> | 277 | + </view> --> |
278 | + | ||
279 | + <view class="item t-c" bindtap="openCS"> | ||
280 | + <image class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | ||
281 | + <view class="fs26">联系客服</view> | ||
282 | + </view> | ||
278 | 283 | ||
279 | </block> | 284 | </block> |
280 | <block wx:elif="{{item.name=='收入卡包'}}"> | 285 | <block wx:elif="{{item.name=='收入卡包'}}"> |
@@ -346,4 +351,34 @@ | @@ -346,4 +351,34 @@ | ||
346 | </view> | 351 | </view> |
347 | </view> | 352 | </view> |
348 | 353 | ||
349 | -<pop_txt id="pop_txt"></pop_txt> | ||
350 | \ No newline at end of file | 354 | \ No newline at end of file |
355 | +<pop_txt id="pop_txt"></pop_txt> | ||
356 | + | ||
357 | + | ||
358 | +<!-- 联系客服操作菜单 --> | ||
359 | +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}"> | ||
360 | + <view class="pd20 t-c pr"> | ||
361 | + <text class="bold">联系客服</text> | ||
362 | + <text class="iconfont icon-guan" bindtap="closeCS"></text> | ||
363 | + </view> | ||
364 | + <!-- 客服热线 --> | ||
365 | + <view class="pd20 bdt fs30 btn" bindtap="contactService"> | ||
366 | + <text class="iconfont icon-dianhua"></text>客服热线: | ||
367 | + <text class="c-red">{{store_tel}}</text> | ||
368 | + </view> | ||
369 | + <!-- 小程序客服 --> | ||
370 | + <block wx:if="{{sys_switch.weapp_customertype == 1}}"> | ||
371 | + <button class="pd20 bdt fs30 btn" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | ||
372 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
373 | + </button> | ||
374 | + </block> | ||
375 | + <!-- 微信客服 --> | ||
376 | + <block wx:elif="{{sys_switch.weapp_customertype == 2}}"> | ||
377 | + <view class="pd20 bdt fs30 btn" bindtap="con_weixin"> | ||
378 | + <text class="iconfont icon-kefu1"></text>在线客服 | ||
379 | + </view> | ||
380 | + </block> | ||
381 | +</view> | ||
382 | + | ||
383 | +<view class="mask" bindtap="closeCS"></view> | ||
384 | + | ||
385 | + |
pages/user/index/index.wxss
@@ -739,4 +739,50 @@ button::after{ border: 0} | @@ -739,4 +739,50 @@ button::after{ border: 0} | ||
739 | 739 | ||
740 | .c-5 { | 740 | .c-5 { |
741 | color: #555; | 741 | color: #555; |
742 | -} | ||
743 | \ No newline at end of file | 742 | \ No newline at end of file |
743 | +} | ||
744 | + | ||
745 | +.action { | ||
746 | + position: fixed; | ||
747 | + bottom: 100rpx; | ||
748 | + z-index: 1; | ||
749 | + width: 100%; | ||
750 | + background-color: white; | ||
751 | + border-radius: 20rpx 20rpx 0 0; | ||
752 | +} | ||
753 | + | ||
754 | +.action .icon-guan { | ||
755 | + position: absolute; | ||
756 | + right: 20rpx; | ||
757 | +} | ||
758 | + | ||
759 | +.action .iconfont { | ||
760 | + color: #ff7295; | ||
761 | + margin-right: 10rpx; | ||
762 | +} | ||
763 | + | ||
764 | +.action button { | ||
765 | + text-align: left; | ||
766 | + line-height: normal; | ||
767 | +} | ||
768 | + | ||
769 | +.action .btn { | ||
770 | + box-sizing: border-box; | ||
771 | + height: 100rpx; | ||
772 | + display: flex; | ||
773 | + align-items: center; | ||
774 | +} | ||
775 | + | ||
776 | +.mask { | ||
777 | + display: none; | ||
778 | + position: fixed; | ||
779 | + left: 0; | ||
780 | + right: 0; | ||
781 | + top: 0; | ||
782 | + bottom: 0; | ||
783 | + background-color: rgba(0,0,0,.5); | ||
784 | +} | ||
785 | + | ||
786 | +.action.active ~ .mask { | ||
787 | + display: block; | ||
788 | +} | ||
789 | + |