diff --git a/app.js b/app.js index 27c6255..8cb325d 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id: null,//1564704,// 10153869,// 6453964,//5682094,6520044,6520119 qa 4687 6519901 + user_id: null,//5682094,6520044,6520119 qa 4687 6519901 buy_now: null, picklist: null, //门店列表 wuliuprice: null, //物流价格表 @@ -205,6 +205,7 @@ App({ this.getConfig(); }, + //---初始化第三方---- initExt: function () { var tt = t; @@ -671,20 +672,29 @@ App({ //清空登录时候缓存的值 onHide: function () { - this.globalData.is_test = 0; - this.globalData.guide_id = null; //导购清空 - this.globalData.first_leader = null; //分享的会员清空 - this.globalData.wuliu = null; //关闭要把物流清空 - this.globalData.room_id = null; //关闭要把房间号关闭 - this.globalData.room_goods_id = null; //关闭要把物流清空 - this.globalData.config2 = null; //清除config2的缓存 - this.globalData.config = null; //清除config的缓存 - this.globalData.gr_index = 0; //商品分组的序列 - this.globalData.pk_store = null; - this.globalData.wxapp_buy_obj = null; - this.globalData.dis_buy_obj = null; //等级卡的购买记录 - this.globalData.storeFooter = null; //底部的导航 - this.globalData.full_screen = null; //全屏 + var th=this; + setTimeout(function () { + console.log("app onhide"); + console.log(th.globalData.no_clear); + if(!th.globalData.no_clear) { + th.globalData.is_test = 0; + th.globalData.guide_id = null; //导购清空 + th.globalData.first_leader = null; //分享的会员清空 + th.globalData.wuliu = null; //关闭要把物流清空 + th.globalData.room_id = null; //关闭要把房间号关闭 + th.globalData.room_goods_id = null; //关闭要把物流清空 + th.globalData.config2 = null; //清除config2的缓存 + th.globalData.config = null; //清除config的缓存 + th.globalData.gr_index = 0; //商品分组的序列 + th.globalData.pk_store = null; + th.globalData.wxapp_buy_obj = null; + th.globalData.dis_buy_obj = null; //等级卡的购买记录 + th.globalData.storeFooter = null; //底部的导航 + th.globalData.full_screen = null; //全屏 + }else{ + th.globalData.no_clear=0; + } + },600) }, @@ -825,9 +835,92 @@ App({ } }, + //重复函数,统一调用, + pre_img(path){ + this.globalData.no_clear=1; + wx.previewImage({ + //将图片预览出来 + urls: [path] + }); + }, + //b是数组,t是wxml元素返回的 + pre_img2(b,t){ + this.globalData.no_clear=1; + wx.previewImage({ + current: b[t.currentTarget.dataset.id], + urls: b + }); + }, + con_wx(th){ + var url=th.data.sys_switch.weapp_customertype_url; + var id=th.data.sys_switch.weapp_customertype_appid; + this.globalData.no_clear=1; + wx.openCustomerServiceChat({ + extInfo: {url: url}, + corpId: id, + success(res) {} + }) + }, - + con_Service(){ + var th=this; + var oss= this.globalData.setting; + this.getConfig(function(t) { + if (t.store_tel == undefined) { + th.request.get("/api/weshop/store/get/" + oss.stoid, { + isShowLoading: 1, + data: {}, + success: function(rs) { + th.globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + wx.showToast({ + title: "商家未设置电话", + icon: 'none', + duration: 3000 + }) + return false; + } + th.globalData.no_clear=1; + wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) + } + }) + } else { + th.globalData.no_clear=1; + wx.makePhoneCall({ phoneNumber: t.store_tel, }) + } + }); + }, + + com_call(self) { + self.getTel() + .then(() => { + if(self.data.store_tel) { + wx.showModal({ + title: '联系客服', + content: '客服热线:' + self.data.store_tel, + confirmText: '拨打', + success(res) { + if(res.confirm) { + getApp().globalData.no_clear = 1; + wx.makePhoneCall({ + phoneNumber: self.data.store_tel, + }) + }; + }, + }); + }; + }); + }, + + //检验能不能分享 + check_can_share(){ + if(!this.globalData.user_id) wx.hideShareMenu(); + else wx.showShareMenu(); + } + + + }); diff --git a/app.wxss b/app.wxss index aa2467b..a02ca49 100644 --- a/app.wxss +++ b/app.wxss @@ -1,5 +1,6 @@ @import './utils/weapp-icon.wxss'; @import "./utils/wxParse/wxParse.wxss"; +@import './components/com_servicer/com_servicer.wxss'; .pdt4 { padding-top: 4rpx; @@ -743,11 +744,20 @@ 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_aefpqs97v86.woff2?t=1647056245887') format('woff2'), + url('//at.alicdn.com/t/font_2054717_aefpqs97v86.woff?t=1647056245887') format('woff'), + url('//at.alicdn.com/t/font_2054717_aefpqs97v86.ttf?t=1647056245887') format('truetype'); } +.icon-kefu1:before { + content: "\e651"; +} + +.icon-dianhua:before { + content: "\e64b"; +} + + .icon-infofill:before { content: "\e6e6"; } diff --git a/components/com_servicer/com_servicer.wxml b/components/com_servicer/com_servicer.wxml new file mode 100644 index 0000000..81c8f82 --- /dev/null +++ b/components/com_servicer/com_servicer.wxml @@ -0,0 +1,26 @@ + + + + \ No newline at end of file diff --git a/components/com_servicer/com_servicer.wxss b/components/com_servicer/com_servicer.wxss new file mode 100644 index 0000000..4f60bc7 --- /dev/null +++ b/components/com_servicer/com_servicer.wxss @@ -0,0 +1,51 @@ +/* 联系客服操作菜单 */ + .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; + padding: 10rpx 20rpx 10rpx 10rpx; + } + + .action .iconfont { + color: #ff7295; + margin-right: 10rpx; + } + + .action button { + text-align: left; + line-height: normal; + } + + .action button::after { + border-width: 0; + } + + .action .btn2 { + box-sizing: border-box; + height: 100rpx; + display: flex; + align-items: center; + } + + .mask2 { + display: none; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0,0,0,.5); + } + + .action.active ~ .mask2 { + display: block; + } \ No newline at end of file diff --git a/components/diy_scan/diy_scan.js b/components/diy_scan/diy_scan.js index 8abf39e..5072315 100644 --- a/components/diy_scan/diy_scan.js +++ b/components/diy_scan/diy_scan.js @@ -26,6 +26,7 @@ Component({ //-- 扫描成功之后 -- getScancode:function(){ var _this = this; + getApp().globalData.no_clear=1; //-- 允许从相机和相册扫码 -- wx.scanCode({ success: (res) => { diff --git a/components/diy_seckill/diy_seckill.js b/components/diy_seckill/diy_seckill.js index fdd208d..512c645 100644 --- a/components/diy_seckill/diy_seckill.js +++ b/components/diy_seckill/diy_seckill.js @@ -78,23 +78,26 @@ Component({ // 这里是一个自定义方法 customMethod: function () { }, init: function (g_id) { - var th = this, app = getApp(), goodsidlist = ""; + var th = this, app = getApp(), goodsidlist = "", idlist = ""; if (g_id.data_type == 2) { if (g_id.data && g_id.data.length > 0) { //--先把商品ID串起来-- g_id.data.forEach(function (val, ind) { var item = {}; goodsidlist += val.goodsid + ","; + idlist += val.flashid + ","; }) goodsidlist = ut.sub_last(goodsidlist); + idlist = ut.sub_last(idlist); var user_id=getApp().globalData.user_id; if(!user_id){ user_id=0;} //--调用接口,读取秒杀-- - app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id=" - + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1", {}).then(res => { - console.log(res); + // var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1"; + var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&idlist=" + idlist + "&user_id="+user_id+"&type=1"; + app.request.promiseGet(gUrl, {}).then(res => { + //如果秒杀的数组为空的时候 var goodslist = res.data.data; //就算是添加的活动已经过期,就要用最新的进行中活动 @@ -153,16 +156,51 @@ Component({ for(let i in all_array){ let item=all_array[i]; if(item.user_price) item.price=item.user_price; + if(item.start_time > newTime) { + item.status = 0; + } else if(item.end_time > newTime) { + item.status = 1; + }; + } + + + var promisies = []; + for (const key in all_array) { + if (Object.hasOwnProperty.call(all_array, key)) { + const val = all_array[key]; + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + val.id, + {} + ).then(res => { + if (res.data.code == 0) { + if (res.data.data <= 0) all_array[key].status = 2; + }; + }); + } + } - var arr = new Array(); - //--三个三个一组--- - for (var i = 0; i < all_array.length; i += 3) { - arr.push(all_array.slice(i, i + 3)); - } - /*--熏染到前台--*/ - th.setData({ goods_array: arr }); + Promise.all(promisies).then(() => { + + // 判断活动是否结束 + for(let i in all_array){ + let item=all_array[i]; + if(newTime > item.end_time) { + all_array[i].status = 3; + }; + + } + + var arr = new Array(); + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 3) { + arr.push(all_array.slice(i, i + 3)); + } + /*--熏染到前台--*/ + th.setData({ goods_array: arr }); + }); + th.data.timer = setInterval(function () { th.countDown2(th); diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index 3b000d9..0a14ad8 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -16,17 +16,17 @@ - + - + 即将开始 - + + + + + + 火热进行 + + + + + 已抢光 + + + + 活动已结束 + + @@ -81,7 +98,7 @@ - + @@ -101,25 +118,25 @@ ¥{{aitem.price}} ¥{{aitem.market_price}} - + 正在预热 - + 已结束 - + 我要抢 - + 已抢光 diff --git a/components/diy_service/diy_service.js b/components/diy_service/diy_service.js index adc1c34..7d42364 100644 --- a/components/diy_service/diy_service.js +++ b/components/diy_service/diy_service.js @@ -38,35 +38,16 @@ Component({ //---------联系客服------------ contactService: function() { - getApp().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; - } - wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) - } - }) - } else { - wx.makePhoneCall({ phoneNumber: t.store_tel, }) - } - }); - }, + getApp().con_Service(); + }, //---------联系微信客服------------ con_weixin:function () { - var url=this.data.sys_switch.weapp_customertype_url; - var id=this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) {} - }) + getApp().con_wx(this); + }, + + click_contact:function () { + getApp().globalData.no_clear=1; } } }) diff --git a/components/diy_service/diy_service.wxml b/components/diy_service/diy_service.wxml index b35487c..ee3983f 100644 --- a/components/diy_service/diy_service.wxml +++ b/components/diy_service/diy_service.wxml @@ -8,7 +8,7 @@ - 联系客服 联系客服 diff --git a/packageA/pages/distribution/card/card.js b/packageA/pages/distribution/card/card.js index b78cbd1..b27ae9f 100644 --- a/packageA/pages/distribution/card/card.js +++ b/packageA/pages/distribution/card/card.js @@ -38,6 +38,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -92,7 +93,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/commision/commision.js b/packageA/pages/distribution/commision/commision.js index 210ee15..277dc75 100644 --- a/packageA/pages/distribution/commision/commision.js +++ b/packageA/pages/distribution/commision/commision.js @@ -74,6 +74,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { @@ -149,7 +150,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/goods/goods.js b/packageA/pages/distribution/goods/goods.js index f6d3451..fd6620f 100644 --- a/packageA/pages/distribution/goods/goods.js +++ b/packageA/pages/distribution/goods/goods.js @@ -97,6 +97,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + + getApp().check_can_share(); let url = '/api/weshop/goods/page'; let currentQuery = this.data.currentQuery; if(app.globalData.userInfo) { @@ -264,7 +266,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/myteam/myteam.js b/packageA/pages/distribution/myteam/myteam.js index 582a165..a5a5ddf 100644 --- a/packageA/pages/distribution/myteam/myteam.js +++ b/packageA/pages/distribution/myteam/myteam.js @@ -69,6 +69,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -157,7 +158,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/order/order.js b/packageA/pages/distribution/order/order.js index 45b8fd4..e990e6d 100644 --- a/packageA/pages/distribution/order/order.js +++ b/packageA/pages/distribution/order/order.js @@ -78,6 +78,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -141,7 +142,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/rank/rank.js b/packageA/pages/distribution/rank/rank.js index dd29d33..c066dc0 100644 --- a/packageA/pages/distribution/rank/rank.js +++ b/packageA/pages/distribution/rank/rank.js @@ -67,6 +67,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -151,7 +152,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/rookie/rookie.js b/packageA/pages/distribution/rookie/rookie.js index b7defcc..f528918 100644 --- a/packageA/pages/distribution/rookie/rookie.js +++ b/packageA/pages/distribution/rookie/rookie.js @@ -58,6 +58,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo instanceof Object) { this.setData({ userInfo: app.globalData.userInfo, @@ -112,7 +113,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index 20860ff..d9f78d6 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -95,6 +95,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); + //自己登录的 if (app.globalData.userInfo && !this.data.first_leader) { if (!this.data.isLogin) { @@ -316,7 +318,7 @@ Page({ * 用户点击右上角分享 *--点击分享事件--分享我的小店 *--*/ - onShareAppMessage: function (t) { + onShareAppMessage: function (t) { getApp().globalData.no_clear=1; var th = this; var title = "我的小店"; diff --git a/packageA/pages/goodsInfo/buy_flash_normal.wxml b/packageA/pages/goodsInfo/buy_flash_normal.wxml new file mode 100644 index 0000000..f7ec6ee --- /dev/null +++ b/packageA/pages/goodsInfo/buy_flash_normal.wxml @@ -0,0 +1,143 @@ + + + + + + + + {{data.goods_name}} + + + {{data.shop_price}} + + + + + + + + + + + + + + + + {{def_pick_store.pickup_name}} + + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} + + + + + + + + 选择门店 + + + 更多门店 + + (库存不足) + + (库存不足) + + (配送不匹配) + (库存不足) + + + 地址:{{def_pick_store.fulladdress}} + + + + + + + 购买数量 + + - + + + + + + + + + + + 再买{{hui_condition.need}} + ,免{{hui_condition.money}}元 + ,打{{hui_condition.sale}}折 + ,包邮 + ,送{{hui_condition.intValue}}积分 + ,送优惠券 + ,送赠品 + ,送礼包 + ,送专享礼包 + + + + + + + + + 配送不匹配 + + + + + 库存不足 + + + + + + 库存不足 + + + + 库存不足 + + + + 请先选择门店 + + + + 库存不足 + + + + 加入购物车 + 立即购买 + + + + + + + + + + + + + \ No newline at end of file diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 34fb2fe..6eaec01 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,19 @@ 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_st: null, prom_r_null: 0, + + hiddenCS: true, //控制客服操作菜单显示和控制 + + openSpecModal_flash_normal: 0, }, //------初始化加载---------- @@ -261,10 +266,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}); @@ -278,14 +283,15 @@ Page({ } }) } + var c_guide_id=t.c_guide_id; if(c_guide_id){ th.data.c_guide_id=c_guide_id; } - getApp().getConfig(function(e) { - ee.setData({sto_sele_name_1:e.store_name}) - }) + getApp().getConfig(function(e) { + ee.setData({sto_sele_name_1:e.store_name}) + }) //----获取系统参数----- getApp().getConfig2(function (e) { @@ -309,7 +315,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 +324,7 @@ Page({ is_newsales_rules: json_d.is_newsales_rules }); ee.init(gid); + //------几人评价------- //n.init(th, "", "comments"); @@ -370,7 +377,7 @@ Page({ //获取用户的默认门店 getApp().get_user_store(function(e) { - if(!e) { + if(!e) { th.data.fir_def_store={}; //赋值空对象 return false; } @@ -431,7 +438,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; @@ -449,14 +456,15 @@ Page({ }); - }, + + }, onReady() { - - setTimeout(()=>{ + // 用于控制保障服务折叠图标的显示 + 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,13 +525,14 @@ 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', { + getApp().request.promiseGet('/api/weshop/activitylist/listGoodActInfo2', { data: { store_id: os.stoid, - goodsidlist: goods_id, - is_detail: 1, + goods_id: goods_id, goods_type: 1, user_id: oo.user_id, } @@ -537,20 +546,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, - // }); - + }; }); }; @@ -662,6 +667,9 @@ Page({ //---展示--- // gid 在onload阶段已经保存在this.data中 onShow: function() { + + getApp().check_can_share(); + var that=this; var ee = this,gid = this.data.gid, i = getApp().request; this.data.is_timer = 1; @@ -669,8 +677,6 @@ Page({ - - i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { failRollback: !0, @@ -700,6 +706,7 @@ Page({ that.setData({ 'data.goods_name': t.data.data.serviceName, 'data.shop_price': t.data.data.money, + 'data.show_price': t.data.data.show_price, 'data.validDays': t.data.data.validDays, 'data.serviceContent': t.data.data.serviceContent, 'data.image_url': t.data.data.imgUrl, @@ -744,6 +751,9 @@ Page({ }; } }); + + + this.data.enterAddressPage && (this.data.enterAddressPage = !1); this.get_sto(); @@ -815,26 +825,185 @@ 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) { + addCart: async function(t) { var th = this; var ind = t.currentTarget.dataset.openSpecModal_ind; var action= t.currentTarget.dataset.action; if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; - + // 活动ID + var prom_id = th.data.prom_id; th.setData({ open_ind_store: ind }); - if(!th.data.sto_sele_name){ + if(!th.data.sto_sele_name) { getApp().my_warnning('请选择门店', 1, th, 450); return false; - } + }; + + + if(this.data.prom_type == 1) { + + this.data.sele_g.viplimited = this.data.sele_g.buy_limit; + + // 每人限购数 + th.data.sele_g.viplimited = th.data.sele_g.buy_limit; + + //----获取用户活动购买数---- + // 已经付款的单数 + var gd_buy_num = 0; + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+os.stoid+"&user_id="+getApp().globalData.user_id+"&card_id="+th.data.options.goods_id+"&prom_type="+th.data.options.prom_type+"&prom_id="+th.data.options.prom_id, { + }).then(res => { + gd_buy_num = !res.data.data.promcardbuynum ? 0 : res.data.data.promcardbuynum; + }); + + + // 检查redis库存量 + var redisNum = 0; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + redisNum = !res.data.data ? 0 : res.data.data; + }; + }); + + // 获取购物车同款数量 判断是否超库存 + var cartGoodsNum = 0; + await getApp().request.promiseGet("/api/weshop/cartService/page?store_id="+os.stoid+"&user_id="+oo.user_id+"&service_id="+th.data.data.id+"&pick_id="+th.data.sto_sele_id, + { }).then(res => { + if (res.data.data.pageData.length > 0) { + const tmpObj = res.data.data.pageData[0]; + cartGoodsNum = !tmpObj.goods_num ? 0 : tmpObj.goods_num; + } + + }); + + + + // 有库存的情况下,走秒杀活动流程 否则 走正常购买流程 + // 没有库存,已抢光的情况下,走正常购买流程 + if(redisNum > 0 && !this.data.is_normal) { + // 输入的数量 + var t = th.data.goodsInputNum; + + if (t > redisNum) { + wx.showToast({ + title: '超出活动库存' + redisNum, + icon: 'none' + }); + + // 开启限购 + if (th.data.sele_g.viplimited > 0) { + + let num = th.data.sele_g.viplimited - gd_buy_num; + if (action !="buy") { + // 购物车 + if (num > redisNum) { + th.setData({goodsInputNum: redisNum}); + } else { + th.setData({goodsInputNum: num}); + } + } else { + // 立即购买 + if (num > redisNum) { + th.setData({goodsInputNum: redisNum}); + } else { + th.setData({goodsInputNum: num}); + } + } + + + } else { + th.setData({goodsInputNum: redisNum}); + } + + return false; + } + + + + // 跳过<立即购买> 购物车 + if (action !="buy") { + + // 输入的数量 + 购物车同款商品的数量 + var maxNum = parseInt(t) + parseInt(cartGoodsNum); + // 是否开启个人限购 + if (th.data.sele_g.viplimited > 0) { + if (maxNum + gd_buy_num > th.data.sele_g.buy_limit) { + wx.showToast({ + title: '超出活动限购数量', + icon: 'none' + }); + + // 可购买数量 + let num = th.data.sele_g.viplimited - gd_buy_num - cartGoodsNum; + th.setData({goodsInputNum: num < 0 ? 0 : num}); + return false; + } + + } + + if (maxNum > redisNum) { + wx.showToast({ + title: '超出活动库存', + icon: 'none' + }); + // 可购买数量 + let num = redisNum - cartGoodsNum; + th.setData({goodsInputNum: num}); + return false; + } + + } else { + // 以下为立即购买 + // 是否开启个人限购 + if (th.data.sele_g.viplimited > 0) { + + if (t + gd_buy_num > th.data.sele_g.viplimited) { + wx.showToast({ + title: '超出活动限购数量', + icon: 'none' + }); + + let num = th.data.sele_g.viplimited - gd_buy_num; + if (num > redisNum) { + th.setData({goodsInputNum: redisNum}); + } else { + th.setData({goodsInputNum: num}); + } + return false; + } + + + }; + + } + + }; + }; + + + - if(action=="buy"){ + if(action=="buy"){ // 立即购买 //--------------此时操作的数据------------ var newd = { id: th.data.data.id, @@ -850,12 +1019,30 @@ Page({ newd['prom_type'] = this.data.prom_type; newd['prom_id'] = this.data.prom_id; newd['prom_price'] = this.data.prom_price; - } + }; + + if(this.data.prom_type == 1 && this.data.openSpecModal_flash_normal) { + newd['prom_type'] = 0; + newd['prom_price'] = this.data.data.shop_price; + }; + + // 判断是否为0库存的情况 + var tmpRedisNum = 0; + // 检查redis库存量 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + tmpRedisNum = res.data.data; + }; + }); + if(this.data.prom_type == 1 && tmpRedisNum == 0) { + newd['prom_type'] = 0; + newd['prom_price'] = this.data.data.shop_price; + }; // console.log('newd++++++++', newd); th.buyNow(newd); - } else { - + } else { // 购物车 + var newd = { service_id: th.data.data.id, service_sn:th.data.data.service_sn, @@ -864,12 +1051,36 @@ Page({ pick_id: th.data.sto_sele_id, user_id:oo.user_id, store_id:os.stoid, - money:th.data.data.shop_price + 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; - } + }; + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 + if(th.data.options.prom_type == 1) { + newd['prom_type'] = th.data.options.prom_type; + newd['prom_id'] = th.data.options.prom_id; + if(th.data.openSpecModal_flash_normal) { + newd['money'] = th.data.data.shop_price; + newd['is_pd_normal'] = 1; + } else { + newd['money'] = th.data.prom_price; + }; + }; + + // 判断是否为0库存的情况 + var tmpRedisNum = 0; + // 检查redis库存量 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + tmpRedisNum = res.data.data; + }; + }); + if(th.data.options.prom_type == 1 && tmpRedisNum == 0) { + newd['prom_type'] = 0; + newd['money'] = th.data.data.shop_price; + }; //----先看会员在购物车中是否加入了该商品----- getApp().request.get("/api/weshop/cartService/page", { @@ -890,6 +1101,18 @@ Page({ money: th.data.data.shop_price, store_id: os.stoid, }; + + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 + if(th.data.options.prom_type == 1) { + // updata['prom_type'] = th.data.options.prom_type; + // updata['prom_id'] = th.data.options.prom_id; + if(th.data.openSpecModal_flash_normal) { + updata['money'] = th.data.data.shop_price; + updata['is_pd_normal'] = 1; + } else { + updata['money'] = th.data.prom_price; + }; + }; if (getApp().globalData.guide_id) { updata['guide_id'] = getApp().globalData.guide_id; @@ -923,17 +1146,22 @@ 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,21 +1178,155 @@ Page({ //------检查数量是不是超出限购------ checkCartNum: function(t) { - if(t<=0) return false; - var th = this; - th.setData({goodsInputNum:t}) + + if(this.data.prom_type != 1) { + this.setData({goodsInputNum: t}); + return false; + }; + + var th = this; + + // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) { + + if(t == 0) return false; + // th.setData({goodsInputNum:t}); + + // if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { + + 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.prom_act.is_shop_buy) { + + // 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 = 1; + // th.setData({goodsInputNum: num}) + // return false; + // } + // }; + + + // 单独购买 + if(th.data.openSpecModal_flash_normal) th.data.is_normal = 1; + + // 秒杀:判断活动是否抢光 + if (th.data.sele_g.prom_type == 1 && !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.showToast({ + // title: '超出商品活动库存', + title: '超出活动库存', + icon: 'none', + }); + th.setData({goodsInputNum: redis_num}) + return false; + } + }; + + //--秒杀:判断商品是否超出活动限购-- + if (th.data.sele_g.viplimited > 0 && !th.data.is_normal && th.data.prom_type == 1) { + var gd_buy_num = th.data.promcardbuynum; + + // 如果限购数量>活动库存数量,增加数量时会先超过库存数量,此时应该提示“超出活动库存”; + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” + if(th.data.sele_g.viplimited > th.data.sele_g.goods_num) { + + // 计算还可以购买的数量:库存量 - 已购数 + var num = th.data.sele_g.goods_num - gd_buy_num; + if(num < 0) num = 0; + if(t > num) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + + th.setData({goodsInputNum: num}) + return false; + + }; + + } else { + if ((t + gd_buy_num> th.data.sele_g.viplimited) && (t<=th.data.sele_g.goods_num)) { + wx.showToast({ + title: '超出活动限购数量', + icon: 'none', + }); + + var num = th.data.sele_g.viplimited - gd_buy_num; + if (num <= 0) num = 1; + th.setData({goodsInputNum: num}) + return false; + }; + }; + + + + }; + + //--秒杀:判断商品是否超出活动限购-- + // 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; + // }; + // }; + + + + + + // var e = th.data.sele_g.goods_num; + 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; + } + } + + th.setData({goodsInputNum: t}); + + }); + + }, closeSpecModal: function() { this.setData({ openSpecModal: !1, - openSpecModal_pt: !1 + openSpecModal_pt: !1, + openSpecModal_flash_normal: !1, }); }, openSpecModel: function(t) { - // console.log('****ttttttt***', t); var th=this; var open_store = t.currentTarget.dataset.ind; this.setData({ @@ -982,10 +1344,12 @@ Page({ return false; } - var ind = t.currentTarget.dataset.ind; + var ind = t.currentTarget.dataset.ind; + this.setData({ openSpecModal: !0, - openSpecModal_ind: ind, + openSpecModal_ind: ind, + goodsInputNum: 1, }); }, @@ -1045,29 +1409,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; @@ -1122,10 +1514,12 @@ Page({ title=th.data.prom_act.share_title; img=th.data.iurl+th.data.prom_act.share_imgurl; } + + var url="/packageA/pages/goodsInfo/goodsInfo?goods_id=" + th.data.gid; - if(getApp().globalData.user_id){ + if(getApp().globalData.user_id) { url+="&first_leader="+getApp().globalData.user_id; } @@ -1137,30 +1531,24 @@ Page({ url+="&room_id="+getApp().globalData.room_id+"&room_user_share=1"; } + var ob={ title: price + "元 " +title, path:url, imageUrl: img, - }; - // if(th.data.prom_type==6){ - // title+='\n'+th.data.prom_act.share_remark; - // ob.title=title; - // ob.desc=th.data.prom_act.share_remark; - // } - - //如果是积分购的时候 - // if(th.data.prom_type==4){ - // var name = th.data.prom_act.name; - // //-- 积分购的 -- - // var pri0 = th.data.prom_act.addmoney; - // var integral=th.data.prom_act.integral; - // var text=""; - // if(integral){text=integral+"积分"; } - // if(pri0 && integral){ text+="+";} - // if(pri0){ text+="¥"+pri0;} + }; - // ob.title= text+" "+name; - // } + // 如果服务卡参加秒杀活动,且后台设置了分享标题和分享图片 + if(th.data.prom_type == 1) { + if(th.data.sele_g && th.data.sele_g.share_title) { + title = th.data.sele_g.share_title; + ob.title = title; + }; + if(th.data.sele_g && th.data.sele_g.share_imgurl) { + img = th.data.iurl + th.data.sele_g.share_imgurl; + ob.imageUrl = img; + }; + }; return ob; @@ -2562,13 +2950,11 @@ Page({ }, previewImage() { - wx.previewImage({ - //将图片预览出来 - urls: [this.data.shareImgPath] - }); + getApp().pre_img(this.data.shareImgPath); }, onShareTimeline() { + getApp().globalData.no_clear=1 var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; if(!store_name) store_name=getApp().globalData.setting.appName; @@ -2913,45 +3299,51 @@ Page({ isshow: 1, }); // this.get_sku(os.stoid, this.data.data, gid); - // this.get_sto(); + this.get_sto(); // this.check_is_youhui(gid, 1); this.data.is_normal = 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); + }, + + //--------检查是否活动,活动是否开始,或者是否结束------- 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 == 1 && prom_id == 0) { + this.setData({ + prom_type: 0, isshow: 1, + }); - // 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; - // } + //获取门店 + 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){ //---判断秒杀---- if (prom_type == 1 && prom_id > 0) { //-------判断活动是否抢光--------- @@ -2959,15 +3351,23 @@ 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) { + th.setData({ + prom_r_null: 1, + goodsInputNum: res.data.data, + }); + + // 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 +3394,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, @@ -3026,60 +3425,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_flash(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,61 +3487,744 @@ 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_flash: 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.options.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; + } + //-- 秒杀的价格要更新 -- + 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 map = this.data.g_buy_num, + var th = this, + user_id = getApp().globalData.user_id; + if (user_id == null) { + // map.set(gd.goods_id, 0); + th.setData({ + // g_buy_num: map, + prom_buy_num: 0, + }); + "function" == typeof func && func(); + 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 (map.has(gd.goods_id)) { + // "function" == typeof func && func(); + // } else { + //----获取商品购买数---- + if (th.data.prom_type == 1) { + //----获取活动购买数---- + getApp().request.get("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + card_id: th.data.options.goods_id, + prom_type: th.data.options.prom_type, + prom_id: th.data.options.prom_id + }, + //-----获取----- + success: function (tt) { + if (tt.data.code == 0) { + // map.set(gd.goods_id, g_buy_num); + th.setData({ + // g_buy_num: map, + promcardbuynum: tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, + }); + "function" == typeof func && func(); + } + } + }); + } else { + "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, + }) + } + }) + }, + + + + //-- 秒杀的普通购买 -- + openSpecModel_Nor: function () { + this.data.g_buy_num = new Map(); + var th = this; + this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 + + this.setData({openSpecModal_flash_normal: 1}); + + + // 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() { + // 判断会员状态 + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + if(this.data.sys_switch) { + 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, + }); + }, + + + + + + + + //-- 加入购物的函数 -- + add_cart_func: function (t) { + var i = getApp().request; + if (oo.user_id == null) { + return s.my_warnning("还未登录!", 0, this); + } + + if (!getApp().globalData.userInfo) { + return s.my_warnning("还未登录!", 0, this); + } + + var e = this, + th = e, + a = 0, + o = this.data.sele_g; + a = o.goods_id; + + //----------添加到购物车时,要判断限购数量,-------- + e.get_buy_num(o, function (ee) { + //---判断商品是否超出限购--- + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + wx.showModal({ + title: '提示', + content: '超出活动限购数量' + }); + return false; + } + } + //---判断商品是否超出活动限购--- + if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { + if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { + wx.showModal({ + title: '提示', + content: '超出活动限购数量' + }); + return false; + } + } + + if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) + this.setData({ + sto_sele_name: "" + }); + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + + //--------------此时操作的数据------------ + var newd = { + goods_id: o.goods_id, + goods_num: th.data.goodsInputNum, + pick_id: th.data.sto_sele_id, + user_id: oo.user_id, + store_id: th.data.stoid, + goods_price: o.shop_price, + member_goods_price: o.shop_price, + goods_name: o.goods_name, + goods_sn: o.goods_sn, + sku: o.sku, + prom_id: th.data.sele_g.prom_id, + prom_type: th.data.sele_g.prom_type, + }; + + //---是不是从收藏夹出来的--- + if (th.data.c_guide_id) { + newd['guide_id'] = th.data.c_guide_id; + newd['guide_type'] = 2; + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3; + } else { + if (getApp().globalData.guide_id) { + newd['guide_id'] = getApp().globalData.guide_id; + newd['guide_type'] = 0; + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1; + } + } + + //让商品带上房间号 + //让商品带上房间号 + if (th.data.sys_switch.is_skuroom_id == 1) { + if (th.data.data.goods_id == getApp().globalData.room_goods_id) { + newd.room_id = getApp().globalData.room_id; + } + } else { + if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id; + } + + //如果是积分够,is_integral_normal就要有积分购普通购买字段 + if (o.prom_type == 4) { + newd.is_integral_normal = 1; + } + + //如果有线下取价 + if (o.offline_price) { + newd.offline_price = o.offline_price; + newd.pricing_type = o.pricing_type; + } + + //-----如果是秒杀,团购,积分购,拼团----- + if (th.data.prom_type == 1 || th.data.prom_type == 2) { + + if (th.data.openSpecModal_flash_normal) { + + newd.prom_type = 0; + newd.prom_id = 0; + + //---如果是线下门店销售的时候--- + if (th.data.sales_rules == 2) { + var pick = th.get_pick_from_list(th.data.sto_sele_id) + //---通过接口获取门店的线下库存信息-- + getApp().request.get("/api/weshop/goods/getWareStorages", { + data: { + storageNos: pick.pickup_no, + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), + storeId: os.stoid + }, + success: function (res) { + if (res.data.code == 0) { + if (res.data.data.pageData.length > 0) { + var CanOutQty = res.data.data.pageData[0].CanOutQty; + if (CanOutQty < e.data.goodsInputNum) { + return s.my_warnning("库存不足!", 0, th); + } + //在调一次接口,读取商品的预出库的数量,lock + getApp().request.get("/api/weshop/order/ware/lock/page", { + data: { + store_id: os.stoid, + wareId: th.data.sele_g.goods_id, + storageId: pick.pickup_id, + pageSize: 1000 + }, + success: function (res_data) { + if (res_data.data.code == 0 && res_data.data.data.total > 0) { + + var lock = 0; + for (var i in res_data.data.data.pageData) { + lock += res_data.data.data.pageData[i].outQty; + } + + if (CanOutQty <= lock) { + return s.my_warnning("库存不足!", 0, th); + } + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); + } else { + th.add_cart_next(e, t, a, o, newd, CanOutQty); + } + } + }) + } else { + return s.my_warnning("库存不足!", 0, th); + } + + } + } + }) + } else { + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 + } + + return false; + } + + + newd.goods_price = th.data.prom_price; + newd.member_goods_price = th.data.prom_price, + newd.prom_type = th.data.prom_type; + newd.prom_id = th.data.prom_id; + + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 + + } else if (o.prom_type == 7) { + + //判断进行中的活动,是不是要判断线下库存 + th.check_zh_acting(function (ee) { + newd.prom_id = 0; + newd.prom_type = 0; + if (ee && th.data.sele_g.act) { + newd.prom_id = th.data.sele_g.act.id; + newd.prom_type = 7; + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 + return false; + } else { + //---如果是线下门店销售的时候--- + if (th.data.sales_rules == 2) { + var pick = th.get_pick_from_list(th.data.sto_sele_id) + //---通过接口获取门店的线下库存信息-- + getApp().request.get("/api/weshop/goods/getWareStorages", { + data: { + storageNos: pick.pickup_no, + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), + storeId: os.stoid + }, + success: function (res) { + if (res.data.code == 0) { + if (res.data.data.pageData.length > 0) { + var CanOutQty = res.data.data.pageData[0].CanOutQty; + if (CanOutQty < e.data.goodsInputNum) { + return s.my_warnning("库存不足!", 0, th); + } + //在调一次接口,读取商品的预出库的数量,lock + getApp().request.get("/api/weshop/order/ware/lock/page", { + data: { + store_id: os.stoid, + wareId: th.data.sele_g.goods_id, + storageId: pick.pickup_id, + pageSize: 1000 + }, + success: function (res_data) { + if (res_data.data.code == 0 && res_data.data.data.total > 0) { + + var lock = 0; + for (var i in res_data.data.data.pageData) { + lock += res_data.data.data.pageData[i].outQty; + } + + if (CanOutQty <= lock) { + return s.my_warnning("库存不足!", 0, th); + } + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); + } else { + th.add_cart_next(e, t, a, o, newd, CanOutQty); + } + } + }) + } else { + return s.my_warnning("库存不足!", 0, th); + } + + } + } + }) + } else { + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 + } + } + }) + + } + else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) { + newd.prom_type = 0; + newd.prom_id = 0; + + if (th.data.prom_type == 10) { + newd.prom_type = th.data.prom_type; + newd.prom_id = th.data.prom_id; + } + + //---如果是线下门店销售的时候--- + if (th.data.sales_rules == 2) { + var pick = th.get_pick_from_list(th.data.sto_sele_id) + //---通过接口获取门店的线下库存信息-- + getApp().request.get("/api/weshop/goods/getWareStorages", { + data: { + storageNos: pick.pickup_no, + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), + storeId: os.stoid + }, + success: function (res) { + if (res.data.code == 0) { + if (res.data.data.pageData.length > 0) { + var CanOutQty = res.data.data.pageData[0].CanOutQty; + if (CanOutQty < e.data.goodsInputNum) { + return s.my_warnning("库存不足!", 0, th); + } + //在调一次接口,读取商品的预出库的数量,lock + getApp().request.get("/api/weshop/order/ware/lock/page", { + data: { + store_id: os.stoid, + wareId: th.data.sele_g.goods_id, + storageId: pick.pickup_id, + pageSize: 1000 + }, + success: function (res_data) { + if (res_data.data.code == 0 && res_data.data.data.total > 0) { + + var lock = 0; + for (var i in res_data.data.data.pageData) { + lock += res_data.data.data.pageData[i].outQty; + } + + if (CanOutQty <= lock) { + return s.my_warnning("库存不足!", 0, th); + } + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); + } else { + th.add_cart_next(e, t, a, o, newd, CanOutQty); + } + } + }) + } else { + return s.my_warnning("库存不足!", 0, th); + } + + } + } }) - //-- 如果只有一个活动的话 -- - if (arr.length == 1) { - th.data.prom_type = arr[0].prom_type; - th.data.prom_id = arr[0].act_id; + } else { + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 + } + } + }) + }, + + //---加入购物车的最后一步--- + add_cart_next(e, t, a, o, newd, CanOutQty) { + var th = this, i = getApp().request; + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ + if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) { + var conf = th.data.bconfig; + if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { + var s_list = JSON.parse(conf.switch_list); + var now = ut.gettimestamp(); + + + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + + //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下-- + if (parseInt(s_list.rank_switch) == 2 && end > now) { + var card_price = o[getApp().globalData.userInfo['card_field']]; + //如果会员有等级价 + if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null + && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { + newd.goods_price = card_price; + newd.member_goods_price = card_price; } - //-- 如果只有一个进行中的活动的话 -- - else if (arr2.length == 1) { - th.data.prom_type = arr2[0].prom_type; - th.data.prom_id = arr2[0].act_id; + } + } + } + + //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); + if ("add" == t.currentTarget.dataset.action) { + + if (th.data.prom_goods) { + newd.prom_type = 3; + newd.prom_id = th.data.prom_goods[0].prom_id; + } + + //----先看会员在购物车中是否加入了该商品----- + i.get("/api/weshop/cart/page", { + data: { + store_id: e.data.stoid, + user_id: oo.user_id, + goods_id: a, + pick_id: e.data.sto_sele_id, + state: 0 + }, + success: function (re) { + + //-------如果购物车中有相关的数据--------- + if (re.data.data.total > 0) { + + var item = re.data.data.pageData[0]; + + //判断数量,要看下购物车中有没有该商品 + if (CanOutQty) { + if (item.goods_num + th.data.goodsInputNum > CanOutQty) { + return s.my_warnning("库存不足!", 0, th); + } + } else { + if (item.goods_num + th.data.goodsInputNum > o.store_count) { + return s.my_warnning("库存不足!", 0, th); + } + } + + var updata = { + id: item.id, + goods_num: e.data.goodsInputNum + item.goods_num, + goods_price: newd.goods_price, + member_goods_price: newd.goods_price, + store_id: th.data.stoid, + }; + + //---是不是从收藏夹出来的--- + if (th.data.c_guide_id) { + updata['guide_id'] = th.data.c_guide_id; + updata['guide_type'] = 3; //加入购物车之后就变成了3 + } else { + if (getApp().globalData.guide_id) { + updata['guide_id'] = getApp().globalData.guide_id; + updata['guide_type'] = 0; + } + } + + i.put("/api/weshop/cart/update", { + data: updata, + success: function (t) { + getApp().my_warnning('加入购物车成功', 1, th, 450); + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + th.closeSpecModal(); + } + }); + } else { + + + i.post("/api/weshop/cart/save", { + data: newd, + success: function (t) { + getApp().my_warnning('加入购物车成功', 1, th, 450); + var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + th.closeSpecModal(); + } + }); } } - //-- 调用回调 -- - func(); + }); + + } + else { + + //这一步主要是要让立即购买 走 购物车的逻辑 参与活动 + if (newd.prom_type == 10 || newd.prom_type == 7) { + //----先看会员在购物车中是否加入了该商品,立即购买的----- + getApp().request.get("/api/weshop/cart/page", { + data: { + store_id: e.data.stoid, + user_id: oo.user_id, + state: 1 + }, + success: function (res) { + //-------如果购物车中有相关的数据--------- + if (res.data.code == 0 && res.data.data.total > 0) { + for (let j in res.data.data.pageData) { + let item_j = res.data.data.pageData[j]; + var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id; + getApp().request.delete(url, {}); + } + } + newd.state = 1; + getApp().request.post("/api/weshop/cart/save", { + data: newd, + success: function (t) { + th.closeSpecModal(); + getApp().goto("/pages/cart/cart2/cart2?state=1"); + } + }); + }, + }) + return false; } - }); + + if (th.data.prom_goods) { + var prom_d = th.data.prom_goods; + for (var i in prom_d) { + //判断活动有俩种条件,0元 1件 + var condition_t = prom_d[i].prom_type; + switch (condition_t) { + case 0: //按钱 + if (newd.goods_price >= condition_t) { + newd.prom_type = 3; + newd.prom_id = prom_d[i].prom_id; + } + break + case 1://按购买数量 + if (newd.goods_num >= condition_t) { + newd.prom_type = 3; + newd.prom_id = prom_d[i].prom_id; + } + break; + } + } + + } + + newd['pick_name'] = th.data.sto_sele_name; + newd['pick_dis'] = th.data.sto_sele_distr; + th.buyNow(newd); + } + }, + + + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + //打开客服操作菜单 + openCS() { + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + let csType = this.data.sys_switch.weapp_customertype; + if(csType == 0) { + // 获取电话号码 + this.contactService(); + } else { + this.getTel() + .then(() => { + self.setData({ + hiddenCS: false, + }); + }); + + }; }, + //关闭客服操作菜单 + closeCS() { + this.setData({ + hiddenCS: true, + }); + }, - + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 1212320..4806282 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -16,6 +16,7 @@ - - + + + {{current}}/{{gallery.length}} @@ -48,17 +50,18 @@ + - + - - + @@ -71,15 +74,13 @@ - + 距活动开始还有 - 距活动结束还有 - - - {{djs.day}} - - + 距活动结束还有 + + {{djs.day}} + {{djs.hou}} {{djs.min}} @@ -90,8 +91,7 @@ - - + @@ -99,21 +99,51 @@ - + {{filters.toFix(prom_price,2)}} - {{filters.toFix(data.shop_price,2)}} + {{filters.toFix(data.shop_price,2)}} + {{data.goods_name}} - + + + + + 总数量:{{prom_act.goods_num+prom_act.virtual}}件 + + 限购:{{prom_act.buy_limit}}件 + 限购:不限 + 已售:{{prom_act.buy_num+prom_act.virtual}}件 + + + + + + + + + + 销量:{{data.sales_sum}} 有效天数:{{data.validDays?data.validDays:'不限'}} - + @@ -186,6 +216,8 @@ + + @@ -506,7 +538,7 @@ - + + + + + 在线客服 + + + + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss index 49b3695..d6ac50e 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/goodsInfo/goodsInfo.wxss @@ -562,7 +562,7 @@ view.cart-btn-lg { .spec-model { position: fixed; bottom: 0; - z-index: 20; + z-index: 19; background: white; width: 100%; /* padding: 0 30rpx; */ @@ -2968,3 +2968,5 @@ button.custom-service::after{ left: -1000px; top: -1000px; } + + diff --git a/packageA/pages/goods_share/goods_share.js b/packageA/pages/goods_share/goods_share.js index 6129fd8..5e7f82b 100644 --- a/packageA/pages/goods_share/goods_share.js +++ b/packageA/pages/goods_share/goods_share.js @@ -123,9 +123,9 @@ Page({ /*** 生命周期函数--监听页面显示***/ onShow: function () { + getApp().check_can_share(); var th=this; - - + if(app.globalData.userInfo) { this.setData({ //用来判断是否是分销商,是分销商才显示分成佣金 @@ -177,7 +177,8 @@ Page({ /**e * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { + getApp().globalData.no_clear=1; var th = this; var item=this.data.share_good; var price = item.shop_price; @@ -732,10 +733,7 @@ Page({ }) return false; } - wx.previewImage({ - //将图片预览出来 - urls: [that.data.shareImgPath] - }); + getApp().pre_img(that.data.shareImgPath); wx.hideLoading(); } }) diff --git a/packageA/pages/hongBao/hongBao.js b/packageA/pages/hongBao/hongBao.js index 32bd064..4d41682 100644 --- a/packageA/pages/hongBao/hongBao.js +++ b/packageA/pages/hongBao/hongBao.js @@ -76,10 +76,9 @@ Page({ */ onShow: function () { console.log('onshow'); + getApp().check_can_share(); - - - + }, /** @@ -113,7 +112,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/hongBaoDetails/hongBaoDetails.js b/packageA/pages/hongBaoDetails/hongBaoDetails.js index 87de214..49c8b06 100644 --- a/packageA/pages/hongBaoDetails/hongBaoDetails.js +++ b/packageA/pages/hongBaoDetails/hongBaoDetails.js @@ -64,7 +64,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -98,7 +98,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/jfbuy/jfbuy.js b/packageA/pages/jfbuy/jfbuy.js index 1e5edd9..52ce5b1 100644 --- a/packageA/pages/jfbuy/jfbuy.js +++ b/packageA/pages/jfbuy/jfbuy.js @@ -169,7 +169,7 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function () {}, + onShow: function () { getApp().check_can_share(); }, /** * 生命周期函数--监听页面隐藏 */ @@ -187,8 +187,8 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { - + onShareAppMessage: function () { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:''; var pagePath = this.route; //当前页面url @@ -270,6 +270,7 @@ Page({ onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:''; var pagePath = this.route; //当前页面url diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index b9ced4c..0530f00 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -208,9 +208,10 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + self=this; getApp().is_Single_page(this,function(){ app.isLogin().then(function(data) {//进入页面前已经授权登录成功 - this.setData({ + self.setData({ userInfo: data, }); }); @@ -229,6 +230,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -247,6 +250,9 @@ Page({ self.setData({ living: self.data.list, }); + + + console.log(self.data.living); //直播中列表请求完后,请求即将开始列表 self.getData(true, '/api/weshop/wx/livelist/page', { @@ -348,7 +354,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; if (res.from === 'button') { // 来自页面内转发按钮 // console.log(res.target) @@ -360,6 +366,7 @@ Page({ }, onShareTimeline: function (res) { + getApp().globalData.no_clear=1; if (res.from === 'button') { // 来自页面内转发按钮 // console.log(res.target) diff --git a/packageA/pages/liveStream/liveStream.wxml b/packageA/pages/liveStream/liveStream.wxml index 6397223..e762f12 100644 --- a/packageA/pages/liveStream/liveStream.wxml +++ b/packageA/pages/liveStream/liveStream.wxml @@ -29,7 +29,7 @@ 直播中 - + diff --git a/packageA/pages/liveStreamDetails/liveStreamDetails.js b/packageA/pages/liveStreamDetails/liveStreamDetails.js index 371509b..472479d 100644 --- a/packageA/pages/liveStreamDetails/liveStreamDetails.js +++ b/packageA/pages/liveStreamDetails/liveStreamDetails.js @@ -53,6 +53,11 @@ Page({ // 分享操作表 clickShare: function () { + + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } this.setData({ showActionSheet: !this.data.showActionSheet }) @@ -570,7 +575,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -605,6 +610,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un * 用户点击右上角分享 */ onShareAppMessage: function (res) { + getApp().globalData.clear=1; this.setData({ showActionSheet: 'false' }) @@ -625,6 +631,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un }, onShareTimeline: function (res) { + getApp().globalData.no_clear=1; if (res.from === 'button') { // 来自页面内转发按钮 console.log(res.target) diff --git a/packageA/pages/live_share/live_share.js b/packageA/pages/live_share/live_share.js index 8e15cf0..34f8619 100644 --- a/packageA/pages/live_share/live_share.js +++ b/packageA/pages/live_share/live_share.js @@ -44,7 +44,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -71,7 +71,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; var th=this; var id=th.data.hui_active.id; var url='/packageA/pages/liveStreamDetails/liveStreamDetails?id=' + id + '&live=ing'; diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index 3ff812b..ab53025 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -67,6 +67,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -147,7 +149,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js index d432b6b..07fdcff 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.js +++ b/packageA/pages/myGiftDetails/myGiftDetails.js @@ -57,6 +57,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -192,7 +193,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/my_service/beauty_deta.js b/packageA/pages/my_service/beauty_deta.js index 671dc78..c89bb33 100644 --- a/packageA/pages/my_service/beauty_deta.js +++ b/packageA/pages/my_service/beauty_deta.js @@ -394,6 +394,7 @@ Page({ previewImage: function(e) { var th = this; var current = e.currentTarget.dataset.src; + getApp().globalData.no_clear=1; wx.previewImage({ current: current, // 当前显示图片的http链接 urls: [th.data.head_img] // 需要预览的图片http链接列表 diff --git a/packageA/pages/my_service2/beauty_deta.js b/packageA/pages/my_service2/beauty_deta.js index 671dc78..c89bb33 100644 --- a/packageA/pages/my_service2/beauty_deta.js +++ b/packageA/pages/my_service2/beauty_deta.js @@ -394,6 +394,7 @@ Page({ previewImage: function(e) { var th = this; var current = e.currentTarget.dataset.src; + getApp().globalData.no_clear=1; wx.previewImage({ current: current, // 当前显示图片的http链接 urls: [th.data.head_img] // 需要预览的图片http链接列表 diff --git a/packageA/pages/parseHtml/parseHtml.js b/packageA/pages/parseHtml/parseHtml.js index 325373f..dea4a8b 100644 --- a/packageA/pages/parseHtml/parseHtml.js +++ b/packageA/pages/parseHtml/parseHtml.js @@ -286,7 +286,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -320,7 +320,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js index 3878500..37147cf 100644 --- a/packageA/pages/profile/profile.js +++ b/packageA/pages/profile/profile.js @@ -688,6 +688,9 @@ Page({ }, onShow: function() { + + getApp().check_can_share(); + var e = this; if (this.data.is_zy) return false; this.wait_for_store_config(); @@ -875,6 +878,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { + getApp().globalData.no_clear=1 return o.share; }, diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 45d30d6..ab3cc72 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -162,6 +162,9 @@ Page({ //---展示--- onShow: function() { + + getApp().check_can_share(); + var ee=this,th=ee,that=ee; var gid = this.data.gid,i = getApp().request; ee.data.g_buy_num = new Map(); @@ -711,6 +714,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { + getApp().globalData.no_clear=1 var curPage=this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { diff --git a/packageA/pages/quan/quan.js b/packageA/pages/quan/quan.js index 8e36521..0855002 100644 --- a/packageA/pages/quan/quan.js +++ b/packageA/pages/quan/quan.js @@ -48,7 +48,7 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function () { }, + onShow: function () { getApp().check_can_share(); }, /** * 生命周期函数--监听页面隐藏 @@ -73,7 +73,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; var th=this; var id=th.data.hui_active.id; var url="/packageA/pages/quan_pro/quan_pro?id="+id; diff --git a/packageA/pages/service_share/service_share.js b/packageA/pages/service_share/service_share.js index 9466ff2..feb9371 100644 --- a/packageA/pages/service_share/service_share.js +++ b/packageA/pages/service_share/service_share.js @@ -97,6 +97,8 @@ Page({ /*** 生命周期函数--监听页面显示***/ onShow: function () { + getApp().check_can_share(); + var th=this; getApp().getConfig2(function(rs){ //计算等级价相关 @@ -141,7 +143,7 @@ Page({ /**e * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; var th = this; var item=this.data.share_good; var price = item.money; @@ -709,10 +711,7 @@ Page({ }) return false; } - wx.previewImage({ - //将图片预览出来 - urls: [that.data.shareImgPath] - }); + getApp().pre_img(that.data.shareImgPath); wx.hideLoading(); } }) diff --git a/packageA/pages/text/text.js b/packageA/pages/text/text.js deleted file mode 100644 index 079769c..0000000 --- a/packageA/pages/text/text.js +++ /dev/null @@ -1,66 +0,0 @@ -// packageA//pages/text/text.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } -}) \ No newline at end of file diff --git a/packageA/pages/text/text.json b/packageA/pages/text/text.json deleted file mode 100644 index 8835af0..0000000 --- a/packageA/pages/text/text.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/packageA/pages/text/text.wxml b/packageA/pages/text/text.wxml deleted file mode 100644 index 5d51b9c..0000000 --- a/packageA/pages/text/text.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -packageA//pages/text/text.wxml diff --git a/packageA/pages/text/text.wxss b/packageA/pages/text/text.wxss deleted file mode 100644 index 1fd4d8f..0000000 --- a/packageA/pages/text/text.wxss +++ /dev/null @@ -1 +0,0 @@ -/* packageA//pages/text/text.wxss */ \ No newline at end of file diff --git a/packageA/pages/user/my_service2/appment_main.js b/packageA/pages/user/my_service2/appment_main.js index 0f3039e..35961aa 100644 --- a/packageA/pages/user/my_service2/appment_main.js +++ b/packageA/pages/user/my_service2/appment_main.js @@ -26,7 +26,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -60,7 +60,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 } }) \ No newline at end of file diff --git a/packageB/pages/boxes-details/boxes-details.js b/packageB/pages/boxes-details/boxes-details.js index f3365f7..4895c96 100644 --- a/packageB/pages/boxes-details/boxes-details.js +++ b/packageB/pages/boxes-details/boxes-details.js @@ -51,6 +51,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + getApp().check_can_share(); + // console.log('show~~~'); if (app.globalData.userInfo) { if (!this.data.isLogin) { @@ -124,7 +126,7 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function() { - + getApp().globalData.no_clear=1 }, diff --git a/packageB/pages/boxes-list/boxes-list.js b/packageB/pages/boxes-list/boxes-list.js index e00f266..5025bf8 100644 --- a/packageB/pages/boxes-list/boxes-list.js +++ b/packageB/pages/boxes-list/boxes-list.js @@ -9,7 +9,9 @@ Page({ currentTabIndex: 0, isLogin: false, - list: null, + list: { + pageData: [], + }, isLoading: false, // 检测是否已经发送请求,防止重复发送请求 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 @@ -103,6 +105,14 @@ Page({ }, clickTab(e) { + // 判断会员状态 + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; this.debounce(this.handleTab.bind(this, e), 200)(); }, diff --git a/packageB/pages/luckactivity/index/index.js b/packageB/pages/luckactivity/index/index.js index 21676ac..fa3fe5b 100644 --- a/packageB/pages/luckactivity/index/index.js +++ b/packageB/pages/luckactivity/index/index.js @@ -69,6 +69,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); + if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -166,7 +168,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageB/pages/user/Change_phone/Change_phone.js b/packageB/pages/user/Change_phone/Change_phone.js index 303f7d0..f0d7873 100644 --- a/packageB/pages/user/Change_phone/Change_phone.js +++ b/packageB/pages/user/Change_phone/Change_phone.js @@ -211,7 +211,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - + getApp().check_can_share(); }, /** @@ -246,6 +246,6 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function() { - + getApp().globalData.no_clear=1 } }) diff --git a/packageB/pages/user/add_comment/add_comment.js b/packageB/pages/user/add_comment/add_comment.js index 3c50fb6..a1c3590 100644 --- a/packageB/pages/user/add_comment/add_comment.js +++ b/packageB/pages/user/add_comment/add_comment.js @@ -220,6 +220,7 @@ Page({ var imgs = this.data.imgs; + getApp().globalData.no_clear=1; wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 @@ -259,6 +260,7 @@ Page({ var index = e.currentTarget.dataset.index; //所有图片 var imgs = this.data.imgs; + getApp().globalData.no_clear=1; wx.previewImage({ //当前显示图片 current: imgs[index], diff --git a/packageB/pages/user/binding_info/binding_info.js b/packageB/pages/user/binding_info/binding_info.js index a9d1ed5..13d389a 100644 --- a/packageB/pages/user/binding_info/binding_info.js +++ b/packageB/pages/user/binding_info/binding_info.js @@ -26,7 +26,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, /** @@ -60,7 +60,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 } }) \ No newline at end of file diff --git a/packageB/pages/user/buyDetails/buyDetails.js b/packageB/pages/user/buyDetails/buyDetails.js index 78ec393..eb8a24a 100644 --- a/packageB/pages/user/buyDetails/buyDetails.js +++ b/packageB/pages/user/buyDetails/buyDetails.js @@ -40,6 +40,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -106,7 +107,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageB/pages/user/choice_guide/choice_guide.js b/packageB/pages/user/choice_guide/choice_guide.js index bb6b4d3..23ce6eb 100644 --- a/packageB/pages/user/choice_guide/choice_guide.js +++ b/packageB/pages/user/choice_guide/choice_guide.js @@ -19,6 +19,7 @@ Page({ onLoad: function(t) {}, onShow: function() { + getApp().check_can_share(); this.data.ismore=0;this.data.isload=0; this.setData({list:null}); this.get_list(); @@ -26,6 +27,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { + getApp().globalData.no_clear=1 return o.share; }, get_list: function() { diff --git a/packageB/pages/user/comment/comment.js b/packageB/pages/user/comment/comment.js index a7438ba..b7ffaf5 100644 --- a/packageB/pages/user/comment/comment.js +++ b/packageB/pages/user/comment/comment.js @@ -161,6 +161,7 @@ Page({ } else { image = imgArr[index].weapp_img[sindex]; } + getApp().globalData.no_clear=1; wx.previewImage({ current: image, //当前图片地址 diff --git a/packageB/pages/user/view_comment/view_comment.js b/packageB/pages/user/view_comment/view_comment.js index f826ea7..3c2ed6e 100644 --- a/packageB/pages/user/view_comment/view_comment.js +++ b/packageB/pages/user/view_comment/view_comment.js @@ -112,6 +112,7 @@ Page({ var iurl = th.data.iurl; if (image != "") { image = imgArr[0].weapp_img[index]; + getApp().globalData.no_clear=1; wx.previewImage({ current: image, //当前图片地址 @@ -119,6 +120,7 @@ Page({ }) } else { image = imgArr[0].img[index]; + getApp().globalData.no_clear=1; wx.previewImage({ current: iurl + image, //当前图片地址 diff --git a/packageB/pages/video/index.js b/packageB/pages/video/index.js index 82614ac..762d968 100644 --- a/packageB/pages/video/index.js +++ b/packageB/pages/video/index.js @@ -7,6 +7,7 @@ Page({ }, bindButtonTap: function() { var that = this + getApp().globalData.no_clear=1; wx.chooseVideo({ sourceType: ['album', 'camera'], maxDuration: 60, @@ -25,6 +26,8 @@ Page({ }) }, onShow:function(){ + getApp().check_can_share(); + var goods_list = this.selectComponent("#goods_list"); //组件的id goods_list.init(); setTimeout(function() { @@ -34,6 +37,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 return { title: "直播视频回放", } diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index 44dbb66..734ed71 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -160,6 +160,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); + getApp().is_Single_page(this, function () { var th = this, that = this, @@ -446,7 +448,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; var title = this.data.act.name; var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; if (getApp().globalData.user_id) { @@ -465,6 +467,7 @@ Page({ * 用户分享朋友圈 */ onShareTimeline() { + getApp().globalData.no_clear=1; var title = this.data.act.name; var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; if (getApp().globalData.user_id) { diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index a9a7bd2..494267c 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -65,7 +65,10 @@ Page({ }, - onShow: function(t) { + onShow: function(t) { + + getApp().check_can_share(); + this.data.ismore=1; this.data.is_timer=1; this.data.currentPage=1; @@ -198,6 +201,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var curPage=this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { diff --git a/packageB/pages/zuhegou/preindex/index.js b/packageB/pages/zuhegou/preindex/index.js index ee9aacc..faf319d 100644 --- a/packageB/pages/zuhegou/preindex/index.js +++ b/packageB/pages/zuhegou/preindex/index.js @@ -159,6 +159,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); + getApp().is_Single_page(this, function () { var th = this, that = this, @@ -447,7 +449,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1; var title = this.data.act.name; var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; if (getApp().globalData.user_id) { @@ -466,6 +468,7 @@ Page({ * 用户分享朋友圈 */ onShareTimeline() { + getApp().globalData.no_clear=1; var title = this.data.act.name; var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; if (getApp().globalData.user_id) { diff --git a/packageC/pages/goods/distributionCategoryList/index.js b/packageC/pages/goods/distributionCategoryList/index.js index 29661be..bce472c 100644 --- a/packageC/pages/goods/distributionCategoryList/index.js +++ b/packageC/pages/goods/distributionCategoryList/index.js @@ -231,6 +231,8 @@ Page({ }) }, onShow: function () { + + getApp().check_can_share(); if (t.globalData.userInfo) { let currentData = { store_id: t.globalData.setting.stoid, @@ -404,6 +406,7 @@ Page({ }, //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var url = "pages/goods/categoryList/categoryList"; var userInfo = getApp().globalData.userInfo; @@ -639,9 +642,9 @@ Page({ //扫一扫 getScancode: function () { // 允许从相机和相册扫码 + getApp().globalData.no_clear=1; wx.scanCode({ success: (res) => { - console.log(res); var key_word = res.result; wx.navigateBack({ delta: 1 diff --git a/packageC/pages/goods/goodsList/goodsList.js b/packageC/pages/goods/goodsList/goodsList.js index 9b2df74..76b6de1 100644 --- a/packageC/pages/goods/goodsList/goodsList.js +++ b/packageC/pages/goods/goodsList/goodsList.js @@ -119,6 +119,11 @@ Page({ } }); }, + + onShow:function () { + getApp().check_can_share(); + }, + //设置优惠券的 set_prom_list: async function (arr) { var th = this; @@ -240,6 +245,7 @@ Page({ }, //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { @@ -312,4 +318,6 @@ Page({ }, + + }); \ No newline at end of file diff --git a/packageC/pages/goods/search/search.js b/packageC/pages/goods/search/search.js index f94fc8b..f843a16 100644 --- a/packageC/pages/goods/search/search.js +++ b/packageC/pages/goods/search/search.js @@ -31,6 +31,10 @@ Page({ is_his: 0, }, + onShow:function () { + getApp().check_can_share(); + }, + onLoad: function (t) { this.data.rq_data = t; @@ -235,6 +239,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js index 14e3197..2a4cffc 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -44,6 +44,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -147,7 +148,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js index 0c49d3f..9940f77 100644 --- a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js +++ b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.js @@ -35,6 +35,7 @@ Page({ }, onShow: function() { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -191,6 +192,7 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var pagePath = this.route; //当前页面url if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js index 2db8aab..5b2ac21 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js @@ -106,6 +106,7 @@ Page({ }, onShow: function() { + getApp().check_can_share(); this.get_team_info(); }, @@ -972,6 +973,7 @@ Page({ //------ 分享配置 -------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1 var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.param.goods_id}&prom_type=9&group_id=${this.data.param.group_id}`; //当前页面url // console.log('pagePath=====xxxxxx>', pagePath); var imgPath = this.data.iurl + this.data.luckyGoInfo.original_img; @@ -1008,6 +1010,10 @@ Page({ // }, clickShare() { + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } this.setData({ share_hidden: true, }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 7757199..b39f883 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -8,6 +8,7 @@ var t = require("../../../../utils/util.js"), oo = s.globalData, o = s.globalData.setting, os = o; +let self = null; //评价加载更多 var more = function (e) { @@ -281,11 +282,13 @@ Page({ surplus: 0, canBuy: false, btnHidden: false, + + hiddenCS: true, }, //------初始化加载---------- onLoad: function (t) { - + self = this; // console.log('onload'); if (t && t.group_id) { this.data.group_id = t.group_id; @@ -753,6 +756,8 @@ Page({ //---展示--- onShow: async function () { + + getApp().check_can_share(); // console.log('onshow'); var goods_list = null, th = this, that = this; var show_prew_img = this.data.show_prew_img @@ -2248,24 +2253,37 @@ 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); - } - }); + getApp().com_call(this); + }, + // 获取客服电话 + getTel() { + return new Promise((resolve, reject) => { + s.getConfig(function (t) { + if (t.store_tel == undefined) { + getApp().request.get("/api/weshop/store/get/" + os.stoid, { + isShowLoading: 1, + data: {}, + success: function (rs) { + getApp().globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + getApp().my_warnning("商家未设置电话", 0, th); + return false; + } + self.setData({ + store_tel: rs.data.data.store_tel, + }); + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); + } + }) + } else { + self.setData({ + store_tel: t.store_tel, + }); + // s.confirmBox("请联系客服:" + t.store_tel); + }; + resolve(); + }); + }); }, //-------获取购物车数量---------- requestCardNum: function () { @@ -2306,11 +2324,7 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t); }, previewCommentImgs_w: function (t) { @@ -2320,21 +2334,16 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t); }, previewGoodsCommentImgs: function (t) { var e = this, a = this.data.data.comment[t.currentTarget.dataset.cidx].img; + getApp().globalData.no_clear=1; a = a.map(function (t) { return e.data.url + t; - }), wx.previewImage({ - current: a[t.currentTarget.dataset.id], - urls: a - }); + }), getApp().pre_img2(a,t); this.data.show_prew_img = 1; }, closePromModal: function () { @@ -2349,7 +2358,7 @@ Page({ }, //--点击分享事件--- - onShareAppMessage: function (t) { + onShareAppMessage: function (t) { getApp().globalData.no_clear=1; // var th = this; // var price = th.data.sele_g.shop_price; @@ -6095,11 +6104,8 @@ Page({ }, previewImage() { - this.data.show_prew_img = 1; - wx.previewImage({ - //将图片预览出来 - urls: [this.data.sele_g.original_img] - }); + this.data.show_prew_img = 1; + getApp().pre_img(this.data.sele_g.original_img); }, is_show_more_buy: function () { @@ -6175,6 +6181,7 @@ Page({ }, onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) store_name = getApp().globalData.setting.appName; @@ -6192,6 +6199,10 @@ Page({ }, clickShare() { + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } this.setData({ share_hidden: true, }); @@ -6327,13 +6338,7 @@ Page({ }, con_weixin: function () { - var url = this.data.sys_switch.weapp_customertype_url; - var id = this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: { url: url }, - corpId: id, - success(res) { } - }) + getApp().con_wx(this); }, @@ -6486,6 +6491,7 @@ Page({ // 预览海报 previewPoster() { + getApp().globalData.no_clear=1; wx.previewImage({ current: this.data.shareImgPath, // 当前显示图片的http链接 urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 @@ -6493,4 +6499,47 @@ Page({ }, + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + //打开客服操作菜单 + openCS() { + // 判断会员状态 + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + if(this.data.sys_switch) { + let csType = this.data.sys_switch.weapp_customertype; + if(csType == 0) { + // 拨打电话号码 + this.contactService(); + } else { + this.getTel() + .then(() => { + self.setData({ + hiddenCS: false, + }); + }); + }; + }; + + }, + + //关闭客服操作菜单 + closeCS() { + this.setData({ + hiddenCS: true, + }); + }, + + }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 88e5a26..c34f037 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -871,7 +871,7 @@ - + 联系客服 联系客服 diff --git a/packageC/pages/luckyGo/luckyGo_winners/luckyGo_winners.js b/packageC/pages/luckyGo/luckyGo_winners/luckyGo_winners.js index e3c1c24..17ecef7 100644 --- a/packageC/pages/luckyGo/luckyGo_winners/luckyGo_winners.js +++ b/packageC/pages/luckyGo/luckyGo_winners/luckyGo_winners.js @@ -38,6 +38,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { this.setData({ @@ -114,7 +115,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 9fdfdd2..64106b5 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -2601,35 +2601,12 @@ Page({ //---------联系客服------------ contactService: function () { - getApp().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; - } - wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) - } - }) - } else { - wx.makePhoneCall({ phoneNumber: t.store_tel, }) - } - }); + getApp().con_Service(); }, //---------联系微信客服------------ con_weixin: function () { - var url = this.data.sys_switch.weapp_customertype_url; - var id = this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: { url: url }, - corpId: id, - success(res) { } - }) + getApp().con_wx(this); } diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 7a49267..ca13be2 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -17,6 +17,8 @@ var more = function (e) { var utils = require('../../../../utils/util.js'); var regeneratorRuntime = require('../../../../utils/runtime.js'); +let self = null; + Page({ data: { start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始) @@ -248,10 +250,13 @@ Page({ share_hidden: false, pre_arr: null, + + hiddenCS: true, }, //------初始化加载---------- onLoad: function (t) { + self = this; var ee = this, that = ee, th = ee, pre_id = t.pre_id, gid = t.goods_id, @@ -588,6 +593,7 @@ Page({ //---展示--- onShow: function () { + getApp().check_can_share(); var goods_list = null, th = this, that = this; //-- 如果是预览图片,页面不重新更新 -- @@ -1430,25 +1436,40 @@ 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); - } - }); + getApp().com_call(this); }, + + // 获取客服电话 + getTel() { + return new Promise((resolve, reject) => { + s.getConfig(function (t) { + if (t.store_tel == undefined) { + getApp().request.get("/api/weshop/store/get/" + os.stoid, { + isShowLoading: 1, + data: {}, + success: function (rs) { + getApp().globalData.config = rs.data.data; + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { + getApp().my_warnning("商家未设置电话", 0, th); + return false; + } + self.setData({ + store_tel: rs.data.data.store_tel, + }); + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); + } + }) + } else { + self.setData({ + store_tel: t.store_tel, + }); + // s.confirmBox("请联系客服:" + t.store_tel); + }; + resolve(); + }); + }); + }, + //-------获取购物车数量---------- requestCardNum: function () { var t = this; @@ -1488,11 +1509,8 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; + getApp().pre_img2(b,t) - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); }, previewCommentImgs_w: function (t) { @@ -1502,21 +1520,16 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t) }, previewGoodsCommentImgs: function (t) { var e = this, a = this.data.data.comment[t.currentTarget.dataset.cidx].img; + getApp().globalData.no_clear=1; a = a.map(function (t) { return e.data.url + t; - }), wx.previewImage({ - current: a[t.currentTarget.dataset.id], - urls: a - }); + }), getApp().pre_img2(a,t); this.data.show_prew_img = 1; }, closePromModal: function () { @@ -1531,7 +1544,7 @@ Page({ }, //--点击分享事件--- - onShareAppMessage: function (t) { + onShareAppMessage: function (t) { getApp().globalData.no_clear=1; var th = this; var price = th.data.pre_arr.presell_price; @@ -3813,14 +3826,12 @@ Page({ previewImage() { this.data.show_prew_img = 1; - wx.previewImage({ - //将图片预览出来 - urls: [this.data.shareImgPath] - }); + getApp().pre_img(this.data.shareImgPath); }, onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) store_name = getApp().globalData.setting.appName; @@ -3835,6 +3846,10 @@ Page({ }, clickShare() { + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } this.setData({ share_hidden: true, }); }, @@ -4012,21 +4027,59 @@ Page({ }, con_weixin:function () { - var url=this.data.sys_switch.weapp_customertype_url; - var id=this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) {} - }) + getApp().con_wx(this); }, // 预览海报 previewPoster() { + getApp().globalData.no_clear=1; wx.previewImage({ current: this.data.shareImgPath, // 当前显示图片的http链接 urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 }); }, + + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + //打开客服操作菜单 + openCS() { + // 判断会员状态 + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + if(this.data.sys_switch) { + let csType = this.data.sys_switch.weapp_customertype; + if(csType == 0) { + // 拨打电话号码 + this.contactService(); + } else { + this.getTel() + .then(() => { + self.setData({ + hiddenCS: false, + }); + }); + }; + }; + + }, + + //关闭客服操作菜单 + closeCS() { + this.setData({ + hiddenCS: true, + }); + }, + }); diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index 73a884f..e8ffc06 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -495,7 +495,7 @@ - diff --git a/packageD/pages/AI-test-skin/history_record/history_record.js b/packageD/pages/AI-test-skin/history_record/history_record.js index 598d574..640e4cb 100644 --- a/packageD/pages/AI-test-skin/history_record/history_record.js +++ b/packageD/pages/AI-test-skin/history_record/history_record.js @@ -304,7 +304,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + getApp().check_can_share(); }, go_result(e) { let id = e.currentTarget.dataset.id; @@ -344,7 +344,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 } }) \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/index/aiskin.js b/packageD/pages/AI-test-skin/index/aiskin.js index 1b36232..72fb316 100644 --- a/packageD/pages/AI-test-skin/index/aiskin.js +++ b/packageD/pages/AI-test-skin/index/aiskin.js @@ -43,6 +43,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); this.getHistoryData(); }, @@ -101,7 +102,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/packageD/pages/AI-test-skin/select_photo/select_photo.js b/packageD/pages/AI-test-skin/select_photo/select_photo.js index bc32fd8..995d321 100644 --- a/packageD/pages/AI-test-skin/select_photo/select_photo.js +++ b/packageD/pages/AI-test-skin/select_photo/select_photo.js @@ -52,6 +52,7 @@ Page({ //-- 重新从相册中选择图片 -- show_pai_pop: function () { var th = this; + getApp().globalData.no_clear=1; //选择和拍照一张图片 wx.chooseImage({ count: 1, @@ -70,6 +71,7 @@ Page({ //选择图片 takePhoto() { var that = this; + getApp().globalData.no_clear=1; wx.chooseImage({ count: 1, sizeType: ['compressed'], diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js index 6004d73..c9e03d2 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js @@ -36,6 +36,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); let th = this; setTimeout(() => { th.setData({ @@ -68,13 +69,14 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, //从相册中选择图片 show_pai_pop: function () { let th = this; + getApp().globalData.no_clear=1; //选择和拍照一张图片 wx.chooseImage({ count: 1, @@ -98,7 +100,8 @@ Page({ //选择图片 takePhoto() { var that = this; - + getApp().globalData.no_clear=1; + that.setData({selecting:1}); wx.chooseImage({ count: 1, sizeType: ['compressed'], @@ -118,6 +121,7 @@ Page({ }, fail(err) { + that.setData({selecting:0}) console.log(err); } }) @@ -143,6 +147,7 @@ Page({ var that = this; //size小于100kb 时 直接转码识别 if (size < 1024) { + that.setData({selecting:0}) getApp().globalData.skin_img_info = { path:img, size, @@ -153,12 +158,15 @@ Page({ return; } + wx.showLoading({ + title:'处理中', + mask: true + }); //先获取图片 然后根据长宽 缩小 之后获取图片 wx.getImageInfo({ src: img, success(res) { - console.log(res.width) - console.log(res.height) + var ratio = size / 1024; size1 = size1 / ratio; var canvasWidth = res.width //图片原始长宽 @@ -183,7 +191,7 @@ Page({ destHeight: canvasHeight, fileType: 'jpg', success: function (res) { - console.log(res.tempFilePath)//最终图片路径 + wx.hideLoading(); that.setData({ canvasImgUrl: res.tempFilePath }); @@ -195,9 +203,8 @@ Page({ app.goto(url); }, fail: function (res) { - console.log("缩放图片失败"); - console.log(res.errMsg) wx.hideLoading(); + that.setData({selecting:0}) wx.showToast({ title: '识别图片失败', image: '../../utils/img/wrong.png', @@ -211,9 +218,8 @@ Page({ }, 1000)) //留一定的时间绘制canvas 否则会报错fail canvas is empty }, fail: function (res) { - console.log("获取图片失败"); - console.log(res.errMsg) wx.hideLoading(); + that.setData({selecting:0}) wx.showToast({ title: '识别图片失败', image: '../../utils/img/wrong.png', diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml index bf3b8e6..c0f41f1 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxml @@ -55,7 +55,7 @@ - 准备闭眼拍摄 + 准备闭眼拍摄 如无闭眼,将导致图片分析失败 diff --git a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss index 3b40331..a1ab4ed 100644 --- a/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss +++ b/packageD/pages/AI-test-skin/shoot_notice/shoot_notice.wxss @@ -103,6 +103,7 @@ page { text-align: center; border-radius: 50rpx; color: #fff; + display: block; } .btn_fixed { diff --git a/packageD/pages/AI-test-skin/success_result/goods.wxml b/packageD/pages/AI-test-skin/success_result/goods.wxml index 0de5dee..2f76e90 100644 --- a/packageD/pages/AI-test-skin/success_result/goods.wxml +++ b/packageD/pages/AI-test-skin/success_result/goods.wxml @@ -9,9 +9,9 @@ - {{item.prom_integral}}积分 - + ¥{{item.shop_price}} + + + @@ -36,4 +36,5 @@ + {{item.prom_integral}}积分 \ No newline at end of file diff --git a/packageD/pages/AI-test-skin/success_result/success_result.js b/packageD/pages/AI-test-skin/success_result/success_result.js index e606b81..07effe0 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.js +++ b/packageD/pages/AI-test-skin/success_result/success_result.js @@ -83,7 +83,29 @@ Page({ this.init(); //var face_result=getApp().globalData.face_result; //var face_data=face_result.face_list[0]; - this.data.id = options.id; + var id=options.id; + var first_leader = options.first_leader; + + if (id == undefined || id == null || id == "") { + var gid_str = decodeURIComponent(options.scene); + gid_str = gid_str.split("_"); + id=gid_str[0]; + if (gid_str.length > 1) { + first_leader = gid_str[1]; + } + } + + this.data.id=id; + if (first_leader) { + console.log("log---".first_leader); + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + setting.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } //用异步的获取比较准一点 wx.getSystemInfo({ @@ -280,6 +302,7 @@ Page({ //-- 获取一下分享要用的图片 -- th.set_share_img(); acne.get_goods(th, setting.stoid); + // let { heightRecord, tab } = th.data; // tab.forEach(item => { // console.log(2); @@ -457,7 +480,9 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function () { }, + onShow: function () { + getApp().check_can_share(); + }, clickTab(e) { let { index, tab_id } = e.currentTarget.dataset; @@ -590,7 +615,15 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function () { + getApp().globalData.no_clear=1; + var url="packageD/pages/AI-test-skin/success_result/success_result?id="+this.data.id+"&first_leader="+getApp().globalData.user_id; + var ob = { + title: "测肤报告", + path: url, + }; + + return ob; }, //商品页面跳转 @@ -748,8 +781,8 @@ Page({ } ///二微码 var path3 = setting.url + "/api/wx/open/app/user/getWeAppEwm/" + - setting.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; - + setting.stoid + "?sceneValue=" + scene + "&pageValue=packageD/pages/AI-test-skin/success_result/success_result"; + // 读取文件成功则OK-- wx.getImageInfo({ src: path3, @@ -763,21 +796,21 @@ Page({ context.fillStyle = '#ebf6f8'; // 灰色实心矩形 // 1. 语法: x坐标, y坐标, 宽度, 高度 - context.fillRect(0, 0, 750 * rpx, 1338 * rpx); + context.fillRect(0, 0, 750 * rpx, 1320 * rpx); context.setFontSize(20 * rpx) context.setFillStyle("#00d8e9") - context.fillText("官方检测认证", 28 * b * rpx, 80 * b * rpx); + context.fillText("官方检测认证", 32 * b * rpx, 80 * b * rpx); //两个底部颜色 context.fillStyle = '#a7ecf5'; - context.fillRect(28 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx); - context.fillRect(28 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx); + context.fillRect(32 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx); + context.fillRect(32 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx); context.setFontSize(42 * b * rpx) context.setFillStyle("#070609") - context.fillText("我的肌底强韧", 30 * b * rpx, 140 * b * rpx); - context.fillText("肌肤鲜活润泽", 30 * b * rpx, 196 * b * rpx); + context.fillText("我的肌底强韧", 32 * b * rpx, 140 * b * rpx); + context.fillText("肌肤鲜活润泽", 32 * b * rpx, 196 * b * rpx); //先画一个圆形 th.circle(context, 110 * b * rpx, 280 * b * rpx, 140 * b * rpx, "#e7f3f8"); @@ -786,35 +819,35 @@ Page({ context.drawImage(th.data.share_head, 132 * b * rpx, 310 * b * rpx, 230 * b * rpx, 230 * b * rpx); //左右俩个框并填充文字 - th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); - th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); - context.setFontSize(20 * b * rpx) + th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 120 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); + th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 120 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); + context.setFontSize(18 * b * rpx) context.setFillStyle("black") - context.fillText("黑眼圈 重度", 50 * b * rpx, 368 * b * rpx); - context.fillText("毛孔 " + th.data.pore_num, 336 * b * rpx, 368 * b * rpx); + context.fillText("黑眼圈 重度", 50 * b * rpx, 363 * b * rpx); + context.fillText("毛孔 " + th.data.pore_num, 340 * b * rpx, 363 * b * rpx); //左右俩个框并填充文字 - th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); - th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); + th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); context.setFillStyle("black") - context.fillText("黑头 " + th.data.blackhead_num, 52 * b * rpx, 440 * b * rpx); - context.fillText("色斑 " + th.data.speckle_num, 354 * b * rpx, 440 * b * rpx); + context.fillText("黑头 " + th.data.blackhead_num, 60 * b * rpx, 434 * b * rpx); + context.fillText("色斑 " + th.data.speckle_num, 362 * b * rpx, 434 * b * rpx); //左右俩个框并填充文字 - th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); - th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); + th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); + th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 34 * b * rpx, 17 * b * rpx, context); context.setFillStyle("black") - context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 510 * b * rpx); - context.fillText("痤疮 " + th.data.acne_num, 344 * b * rpx, 510 * b * rpx); + context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 506 * b * rpx); + context.fillText("痤疮 " + th.data.acne_num, 350 * b * rpx, 506 * b * rpx); //底部的绘制 th.darwRoundRect(38 * b * rpx, 650 * b * rpx, 430 * b * rpx, 160 * b * rpx, 10 * b * rpx, context); //绘制二维码 context.drawImage(vpath, 60 * b * rpx, 672 * b * rpx, 120 * b * rpx, 120 * b * rpx); context.setFillStyle("black") - context.setFontSize(32 * b * rpx) + context.setFontSize(27 * b * rpx) context.fillText("美肤管家AI测肤", 200 * b * rpx, 726 * b * rpx); - context.setFontSize(22 * b * rpx) + context.setFontSize(19 * b * rpx) context.fillText("科学了解皮肤的真实状态", 200 * b * rpx, 766 * b * rpx); //把画板内容绘制成图片,并回调 画板图片路径 @@ -824,7 +857,7 @@ Page({ x: 0, y: 0, width: 750, - height: 1338, + height: 1320, destWidth: 1.4 * 750 * 750 / th.data.screenWidth, destHeight: 1.4 * 750 * 750 / th.data.screenWidth, canvasId: 'share', diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxml b/packageD/pages/AI-test-skin/success_result/success_result.wxml index a0ab3df..354463c 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxml +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxml @@ -378,12 +378,12 @@ - + @@ -412,7 +412,7 @@ - + diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxss b/packageD/pages/AI-test-skin/success_result/success_result.wxss index 24be046..ab8f06b 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxss +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxss @@ -384,13 +384,15 @@ page { font-size: 28rpx; } -.analyse_classify_foot .product_item { - display: flex; +.analyse_classify_foot .product_item:nth-child(1) { margin-right: 30rpx; +} +.analyse_classify_foot .product_item{ + display: flex; flex-direction: column; border-radius: 30rpx; width: 40%; - padding: 5%; + padding: 5% ; background-color: #fff; } @@ -592,8 +594,7 @@ page { .xc-coupon-frame { width: 100%; max-height: 560rpx; - overflow: auto; - + /* overflow: auto; */ } .xc-coupon-frame .rel:not(:first-child) { @@ -727,7 +728,7 @@ page { z-index: 999999; top: 50%; left: 50%; - width: 70%; + width: 75%; transform: translate(-50%, -50%); } @@ -742,10 +743,10 @@ page { .sh_close { position: absolute; - right: 20rpx; - top: 20rpx; - width: 70rpx; - height: 70rpx; + right: 34rpx; + top: 36rpx; + width: 65rpx; + height: 65rpx; display: flex; justify-content: center; align-items: center; diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 05e480a..b434b0b 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -65,6 +65,7 @@ Page({ }, onShow: function (t) { + getApp().check_can_share(); this.data.is_timer = 1; this.data.currentPage = 1; this.data.ismore = 1; @@ -195,6 +196,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { @@ -248,6 +250,7 @@ Page({ }, onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) store_name = getApp().globalData.setting.appName; diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index 0c27e38..918d2e3 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -73,6 +73,7 @@ Page({ onShow: function (t) { + getApp().check_can_share(); this.data.is_timer = 1; this.data.currentPage = 1; var th = this; @@ -233,6 +234,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { @@ -266,6 +268,7 @@ Page({ }, onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) store_name = getApp().globalData.setting.appName; diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index b79d639..bc32976 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -69,6 +69,7 @@ Page({ //每次显示都清空 this.data.in_zhact_gdmap = {}; + if (typeof this.getTabBar === 'function' && this.getTabBar()) { var index = getApp().getPageIndex(this); this.getTabBar().setData({ @@ -1080,8 +1081,20 @@ Page({ goods_num: a, goods_id: e.goods_id, id: e.id, - store_id: oo.stoid + store_id: oo.stoid, }; + if(e.prom_type) { + s.prom_type = e.prom_type; + }; + if(e.prom_id) { + s.prom_id = e.prom_id; + }; + if(e.is_pd_normal) { + s.is_pd_normal = e.is_pd_normal; + }; + if(e.service_id) { + s.card_id = e.service_id; + }; th.postCardList_ser(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); } }, @@ -1089,7 +1102,7 @@ Page({ addNum_ser: function (t) { if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; - this.data.up_dating = 1; + // this.data.up_dating = 1; var a = t.currentTarget.dataset.item; var b = t.currentTarget.dataset.pitems; @@ -1098,18 +1111,31 @@ Page({ var e = { goods_num: a.goods_num + 1, id: a.id, - goods_id: a.goods_id, - store_id: oo.stoid + goods_id: a.service_id, + store_id: oo.stoid, }; + if(a.prom_type) { + e.prom_type = a.prom_type; + }; + if(a.prom_id) { + e.prom_id = a.prom_id; + }; + if(a.is_pd_normal) { + e.is_pd_normal = a.is_pd_normal; + }; + if(a.service_id) { + e.card_id = a.service_id; + }; this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); }, //-------------减数量--------------------- subNum_ser: function (t) { + if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; - this.data.up_dating = 1; - + // this.data.up_dating = 1; + var a = t.currentTarget.dataset.item; var b = t.currentTarget.dataset.pitems; a = this.data.service_data[b].goods[a]; @@ -1297,8 +1323,9 @@ Page({ for (var j = 0; j < item.length; j++) { var txt = "service_data[" + i + "].goods[" + j + "].selected" e.setData({ - [txt]: !e.data.checkAllToggle, + [txt]: !e.data.checkAllToggle ? 1 : 0, }) + if (!e.data.checkAllToggle) { tfeel += item[j].goods_num * item[j].money; t_num += item[j].goods_num; @@ -1509,7 +1536,8 @@ Page({ var e = this, item = t.currentTarget.dataset.item, pitems = t.currentTarget.dataset.pitems; - a = this.data.service_data[pitems].goods[item]; + a = this.data.service_data[pitems].goods[item]; // 选中的商品 + var isok = 1, fir = 0; var iarr = e.data.service_data[pitems].goods; @@ -1541,6 +1569,7 @@ Page({ e.setData({ [txt]: Number(!a.selected), }); + this.doCheckAll(); }, @@ -1987,17 +2016,204 @@ Page({ }, //----------------------更新购物数量,加减,调用接口--------------------- - postCardList_ser: function (t, item, pitem) { + postCardList_ser: async function (t, item, pitem) { var e = this, th = e; var user_id = getApp().globalData.user_id; var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ [txt]: t.goods_num }); - e.doCheckAll(); - e.update_cart_ser(t, pitem, item); + + + if(t.prom_type == 1) { + var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; + var redis_num = 0; + + //------判断活动是否抢光----- + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + t.store_id + "/" + t.prom_type + "/" + t.prom_id, { + 1: 1 + }).then(res => { + redis_num = res.data.data; + }); + + // 检测库存 + if(redis_num == 0) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + th.setData({[txt]: redis_num}); + await e.doCheckAll(); + return false; + }; + + var buylimit = 0 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { + + }).then(res => { + if(res.data.code == 0) { + + th.data.sele_g = res.data.data; + th.data.sele_g.viplimited = res.data.data.buy_limit; + buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit; + }; + }); + + //----获取用户活动购买数---- + var gd_buy_num = 0; + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.card_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { + }).then(tt => { + if (tt.data.code == 0) { + gd_buy_num = !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum; + th.setData({ + promcardbuynum: !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, + }); + }; + }); + + + if(t.goods_num > redis_num) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + // 开启限购 + if (buylimit > 0) { + let num = buylimit - gd_buy_num; + if (num > redis_num) { + th.setData({[txt]: redis_num}); + } else { + th.setData({[txt]: num}); + } + } else { + th.setData({[txt]: redis_num}); + } + + await e.doCheckAll(); + return false; + }; + + + //--秒杀:判断商品是否超出活动限购-- + if (buylimit > 0) { + + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” + if(t.goods_num + gd_buy_num > buylimit) { + // 计算还可以购买的数量:库存量 - 已购数 + wx.showToast({ + title: '超出活动限购', + icon: 'none', + }); + let num = buylimit - gd_buy_num; + if (num <= 0) num = 1; + th.setData({[txt]: num}); + await e.doCheckAll(); + return false; + }; + + } + + + } + await e.doCheckAll(); + await e.update_cart_ser(t, pitem, item); + + }, + + + // 检查购物车数量 + async checkCartNum(t, item, pitem) { + var th = this; + if(t.is_pd_normal) return false; + if (t.prom_type == 1) { + var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; + var redis_num = 0; + + //------判断活动是否抢光----- + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + t.store_id + "/" + t.prom_type + "/" + t.prom_id, { + 1: 1 + }).then(res => { + redis_num = res.data.data; + }); + + // 检测库存 + if(redis_num == 0) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + th.setData({[txt]: redis_num}); + return false; + }; + + if(t.goods_num > redis_num) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + th.setData({[txt]: redis_num}); + return false; + }; + + // 个人限购 + //----获取用户活动购买数---- + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { + }).then(tt => { + if (tt.data.code == 0) { + th.setData({ + promcardbuynum: tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, + }); + }; + }); + + + + var buylimit = 0 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { + + }).then(res => { + if(res.data.code == 0) { + + th.data.sele_g = res.data.data; + th.data.sele_g.viplimited = res.data.data.buy_limit; + buylimit = res.data.data.buy_limit; + }; + }); + + + //--秒杀:判断商品是否超出活动限购-- + if (buylimit > 0) { + + var gd_buy_num = th.data.promcardbuynum; + + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” + if(t.goods_num + gd_buy_num > buylimit) { + // 计算还可以购买的数量:库存量 - 已购数 + wx.showToast({ + title: '超出活动限购', + icon: 'none', + }); + th.setData({[txt]: buylimit}); + + }; + + } + + + th.doCheckAll(); + th.update_cart_ser(t, pitem, item); + + + + }; + }, @@ -2117,6 +2333,8 @@ Page({ //--更新购物车--- update_cart_ser: function (t, pitem, item) { var e = this; + + console.log('t===>', t); getApp().request.put("/api/weshop/cartService/update", { data: t, success: async function (ee) { @@ -2417,19 +2635,20 @@ Page({ } }); } else { + //-- 开始服务卡的购物车购买 -- for (var i = 0; i < this.data.service_data.length; i++) { var i_arr = this.data.service_data[i].goods; + console.log(i_arr) + for (var j = 0; j < i_arr.length; j++) { - if (i_arr[j].selected) { - await rq.promisePut("/api/weshop/cartService/update", { - data: { - id: i_arr[j].id, - selected: 1, - store_id: oo.stoid - } - }); - } + await rq.promisePut("/api/weshop/cartService/update", { + data: { + id: i_arr[j].id, + selected: i_arr[j].selected, + store_id: oo.stoid + } + }); } } wx.hideLoading(); @@ -2876,6 +3095,14 @@ Page({ getApp().goto(good_url); } }) - } + }, + + + + + + + + }); \ No newline at end of file diff --git a/pages/cart/cart2/c_filter.wxs b/pages/cart/cart2/c_filter.wxs index 01114fe..630d400 100644 --- a/pages/cart/cart2/c_filter.wxs +++ b/pages/cart/cart2/c_filter.wxs @@ -45,7 +45,7 @@ var filters = { if (ind == 2) return "指定品类"; if (ind == 11) return "指定用途"; if (ind == 12) return "指定分类1"; - if (ind == 13) return "全场通用"; + if (ind == 13) return "自定义"; if (ind == 20) return "指定单品"; return ""; }, diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index fcf119b..ac11b9e 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -5,10 +5,8 @@ var regeneratorRuntime = require('../../../utils/runtime.js'); var util_pay = require("../../../utils/pay.js"); var zh_calc = require("zh_calculate.js"); var ladder_calc = require("ladder_calculate.js"); - // 防抖函数用定时器 let timer; - Page({ data: { url: t.globalData.setting.url, @@ -93,13 +91,11 @@ Page({ is_coupon: 1, //选择券的控制属性 is_shipping_code: "",//插入用户默认地址 wu_arr_txt: "", //要更新的物流的字段 - sales_rules: 1, //默认是显示线上库存 isget_by_quan: {}, //是否调用了接口获取包邮券 get_by_quan_list: null, //立即购买的 get_by_quan_list_cart: {}, //购物车的 by_quan_list_cart: null, //点击选择的包邮列表 - //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券 is_no_by: {}, is_by: {}, @@ -2347,15 +2343,15 @@ Page({ } } }) + this.setData({ + submit:1, + }) }, //--------------------提交订单----------------------- async submit_func() { - if (this.data.is_summit_ing == 1) return false; //--提交中退出-- - this.data.is_summit_ing = 1; var th = this, pdata = new Array(); var ff = true; - //------------立即购买------------- if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { @@ -2981,6 +2977,9 @@ Page({ console.log("index.js wx.request CheckCallUser fail"); }, complete: function () { + th.setData({ + submit:0, + }) } }) @@ -4370,15 +4369,22 @@ Page({ }, //订阅消息提醒 sendsm: function (func) { + let th =this; var template_id = this.data.template_id; // //授权订阅 wx.requestSubscribeMessage({ tmplIds: [template_id], success(res) { func(); + th.setData({ + submit:0, + }) }, fail(res) { func(); + th.setData({ + submit:0, + }) } }) diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml index 0fdda33..a6a3aee 100644 --- a/pages/cart/cart2/cart2.wxml +++ b/pages/cart/cart2/cart2.wxml @@ -455,7 +455,7 @@ 应付金额:{{formData.order_amount}} - + diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 3ac786a..652dae1 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -70,6 +70,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + getApp().check_can_share(); var th = this; if (th.data.isclose == 0) { wx.navigateTo({ @@ -94,7 +95,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { }, + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, //---------------获取物流--------------- get_wuliu(func) { var th = this, diff --git a/pages/distribution/distribution.js b/pages/distribution/distribution.js index 5dd2c3c..a5da9c2 100644 --- a/pages/distribution/distribution.js +++ b/pages/distribution/distribution.js @@ -57,7 +57,8 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function () { + onShow: function () { + getApp().check_can_share(); if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ active: 2 @@ -233,7 +234,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index dccbaa0..54eeb67 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -79,6 +79,7 @@ Page({ this.getList(); }, onShow: function () { + getApp().check_can_share(); //--先判断会员状态-- getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 7e8a399..548ea43 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -73,6 +73,7 @@ Page({ }, onShow: function () { + getApp().check_can_share(); getApp().is_Single_page(this,function () { //--先判断会员状态-- var user_info = getApp().globalData.userInfo; diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 8e0d3d7..dfee9d8 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -78,6 +78,7 @@ Page({ this.getList(); }, onShow: function () { + getApp().check_can_share(); //--先判断会员状态-- getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; @@ -163,6 +164,7 @@ Page({ //--- 分享设置 -- onShareAppMessage: function (e) { + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { @@ -176,6 +178,7 @@ Page({ }, onShareTimeline() { + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 03a553e..71daaa0 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -185,6 +185,7 @@ Page({ }); }, onShow:function(){ + getApp().check_can_share(); if (typeof this.getTabBar === 'function' && this.getTabBar()) { var index=getApp().getPageIndex(this); @@ -627,7 +628,7 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { - + getApp().globalData.no_clear=1; var url="pages/goods/categoryList/categoryList"; var userInfo=getApp().globalData.userInfo; //是分销商才带 @@ -799,6 +800,7 @@ Page({ //扫一扫 getScancode:function(){ var _this = this; + getApp().globalData.no_clear=1; // 允许从相机和相册扫码 wx.scanCode({ success: (res) => { @@ -1058,6 +1060,7 @@ Page({ }, onShareTimeline(){ + getApp().globalData.no_clear=1; var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; if(!store_name) store_name=getApp().globalData.setting.appName; diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 4e83a6f..00e38c7 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -255,6 +255,7 @@ Page({ share_hidden: false, all_activity_list: null, //所有活动的列表 + hiddenCS: true, }, //------初始化加载---------- @@ -270,7 +271,11 @@ Page({ prom_id = t.prom_id; //活动ID self = this; - + + + console.log("gd onload"); + console.log(t); + //-- 自定义海报 -- getApp().request.promiseGet("/api/weshop/goods/poster/page", { data: {store_id: os.stoid, type: 1, is_use: 1} @@ -334,8 +339,13 @@ Page({ this.data.prom_id = prom_id; } ee.setData({gid: gid}); - if (first_leader) { - console.log("log---".first_leader); + + console.log("gd onload--2"); + console.log(first_leader); + + if(first_leader) { + console.log("gd onload--3"); + console.log("log---"+first_leader); getApp().globalData.first_leader = first_leader; //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { @@ -752,6 +762,9 @@ Page({ //---展示--- onShow: function () { + + getApp().check_can_share(); + var goods_list = null, th = this, that = this; var show_prew_img = this.data.show_prew_img if (show_prew_img) { @@ -759,6 +772,11 @@ Page({ return false; } + if(this.data.show_video) { + this.data.show_video=0; + return false; + } + //优惠券要实时更新 getApp().getConfig2(function (e) { var json_d = JSON.parse(e.switch_list); @@ -2280,25 +2298,40 @@ 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); - } - }); + getApp().com_call(this); }, + + // 获取客服电话 + 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; @@ -2338,11 +2371,7 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t) }, previewCommentImgs_w: function (t) { @@ -2352,10 +2381,7 @@ Page({ b[i] = this.data.iurl + e[i]; } this.data.show_prew_img = 1; - wx.previewImage({ - current: b[t.currentTarget.dataset.id], - urls: b - }); + getApp().pre_img2(b,t) }, previewGoodsCommentImgs: function (t) { @@ -2363,10 +2389,7 @@ Page({ a = this.data.data.comment[t.currentTarget.dataset.cidx].img; a = a.map(function (t) { return e.data.url + t; - }), wx.previewImage({ - current: a[t.currentTarget.dataset.id], - urls: a - }); + }), getApp().pre_img2(a,t); this.data.show_prew_img = 1; }, closePromModal: function () { @@ -2382,6 +2405,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function (t) { + getApp().globalData.no_clear=1; var th = this; var price = th.data.sele_g.shop_price; @@ -2440,6 +2464,9 @@ Page({ } //-- 页面不能刷新 -- this.data.show_prew_img=1; + + console.log("share.."); + console.log(ob); return ob; }, @@ -3951,7 +3978,7 @@ Page({ map.set(gd.goods_id, g_buy_num); th.setData({ g_buy_num: map, - prom_buy_num: tt.data.data.goodsbuynum, + prom_buy_num: tt.data.data.promgoodsbuynum, }); "function" == typeof func && func(); } @@ -5911,6 +5938,12 @@ Page({ wait_for_store_config: function () { var th = this; + //----获取系统参数----- + getApp().getConfig2(function (e) { + th.setData({ + bconfig: e, + }); + }) var t_time = setInterval(function () { if (th.data.bconfig == null) false; var e = th.data.bconfig; @@ -6246,10 +6279,7 @@ Page({ previewImage(e) { this.data.show_prew_img = 1; - wx.previewImage({ - //将图片预览出来 - urls: [this.data.sele_g.original_img] - }); + getApp().pre_img(this.data.sele_g.original_img); }, is_show_more_buy: function () { @@ -6329,6 +6359,7 @@ Page({ }, onShareTimeline() { + getApp().globalData.no_clear=1; var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; if (!store_name) store_name = getApp().globalData.setting.appName; @@ -6346,6 +6377,10 @@ Page({ }, clickShare() { + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } this.setData({ share_hidden: true, }); @@ -6499,15 +6534,9 @@ Page({ }, con_weixin: function () { - var url = this.data.sys_switch.weapp_customertype_url; - var id = this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) { - } - }) + getApp().con_wx(this); }, + get_normal(gid){ this.setData({ prom_type: 0, @@ -6616,11 +6645,62 @@ Page({ // 预览海报 previewPoster() { + getApp().globalData.no_clear=1; wx.previewImage({ current: this.data.shareImgPath, // 当前显示图片的http链接 urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 }); }, + + screenChange:function (e) { + let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏 + if (fullScreen ){ //退出全屏 + getApp().globalData.no_clear=1; + this.data.show_video=1; + } + }, + + click_contact:function () { + getApp().globalData.no_clear=1; + }, + + //打开客服操作菜单 + openCS() { + // 判断会员状态 + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + }; + // csType/在线客服设置: + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 + // 1小程序客服、 + // 2企业微信客服 + if(this.data.sys_switch) { + 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 fa37630..a5695bc 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -42,7 +42,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -274,6 +274,7 @@ + {{data.goods_name}} @@ -388,9 +389,11 @@ + + {{data.goods_name}} @@ -1011,7 +1014,7 @@ - + 联系客服 联系客服 @@ -77,7 +77,10 @@ 配送方式 - {{(order.shipping_name!=''&& order.shipping_name!=null) ?order.shipping_name:'自提'}} + + -- + + {{(order.shipping_name!=''&& order.shipping_name!=null) ?order.shipping_name:'自提'}} 买家留言 diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 2c6924a..8878190 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -2258,7 +2258,7 @@ Page({ //------调起支付框-------- weixinPay: function(n, success, fail) { if (!n) return false; - let order_id = item.order_id; + // let order_id = item.order_id; wx.requestPayment({ timeStamp: String(n.timeStamp), nonceStr: n.nonceStr, diff --git a/pages/user/plus/plus.wxml b/pages/user/plus/plus.wxml index b434572..afaf81c 100644 --- a/pages/user/plus/plus.wxml +++ b/pages/user/plus/plus.wxml @@ -23,7 +23,7 @@ {{item.CardName}} 开通会员卡仅{{item.CardFee}}元 - 立即购买 + 立即购买 diff --git a/pages/user/return_goods_info/return_goods_info.js b/pages/user/return_goods_info/return_goods_info.js index 63e4103..4480a49 100644 --- a/pages/user/return_goods_info/return_goods_info.js +++ b/pages/user/return_goods_info/return_goods_info.js @@ -158,6 +158,7 @@ Page({ }, previewImgs: function(e) { var t = this, r = this.data.return_goods.imgs; + getApp().globalData.no_clear=1; r = r.map(function(e) { return t.data.url + e; }), wx.previewImage({ diff --git a/pages/user/user_spsy/user_spsy.js b/pages/user/user_spsy/user_spsy.js index 5ee5215..ca2c563 100644 --- a/pages/user/user_spsy/user_spsy.js +++ b/pages/user/user_spsy/user_spsy.js @@ -41,8 +41,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - - + getApp().check_can_share(); }, async getQrCode(FormId,GradeId) { const res = await getApp().request.promiseGet("/api/weshop/users/grade/wares/code/get", { @@ -116,7 +115,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index e2736ee..e2030cf 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -740,6 +740,7 @@ Page({ }, onShow: function() { + getApp().check_can_share(); var e = this; if (this.data.is_zy) return false; this.wait_for_store_config(); @@ -834,6 +835,7 @@ Page({ changeAvatar: function() { return false; var r = this; + getApp().globalData.no_clear=1; wx.chooseImage({ count: 1, sizeType: ["compressed", "original"], @@ -996,6 +998,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { + getApp().globalData.no_clear=1; return o.share; }, diff --git a/pages/user/userqy/userqy.js b/pages/user/userqy/userqy.js index 574c301..58789d0 100644 --- a/pages/user/userqy/userqy.js +++ b/pages/user/userqy/userqy.js @@ -53,6 +53,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: async function () { + getApp().check_can_share(); wx.showLoading(); var cz_val=0,backClass=null,qy_list=null,gradeId=null,gradeEndDate=null,need_money=0,g_qy_list=null,GradeName='',cur_g_num=0; var gl_data=getApp().globalData; @@ -158,7 +159,7 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, //--新品使用-- diff --git a/pages/user/userqy/userqy.wxml b/pages/user/userqy/userqy.wxml index 9c8cfd6..2de3fee 100644 --- a/pages/user/userqy/userqy.wxml +++ b/pages/user/userqy/userqy.wxml @@ -29,10 +29,10 @@ - {{item.GradeName}} + {{item.GradeName}} - + [{{item.GradeName}}]365天累计成长值≥{{backClass[index+1].BuyGradeSum }}可升级[{{ backClass[index+1].GradeName}}] @@ -40,21 +40,21 @@ [{{item.GradeName}}]365天累计成长值≥{{item.BuyGradeSum }}可保级 - 会员将在{{filter.replace_time2(gradeEndDate)}}到期,365天累计成长值≥{{need_money}}可升级[{{ backClass[index+1].GradeName}}][{{item.GradeName}}]365天累计成长值≥{{item.BuyGradeSum}}可保级 + 会员将在{{filter.replace_time2(gradeEndDate)}}到期,365天累计成长值≥{{need_money}}可升级[{{ backClass[index+1].GradeName}}][{{item.GradeName}}]365天累计成长值≥{{item.BuyGradeSum}}可保级 - + [{{item.GradeName}}]365天累计成长值≥{{backClass[index+1].BuyGradeSum }}可升级[{{ backClass[index+1].GradeName}}] - + 加入会员尽享优惠 - + 距离{{item.GradeName}}还需{{ filter.pInt(item.BuyGradeSum-cz_val)}}成长值 - + 您当前是此会员 diff --git a/utils/selectFiles.js b/utils/selectFiles.js index 09371c9..e868c8a 100644 --- a/utils/selectFiles.js +++ b/utils/selectFiles.js @@ -1,5 +1,6 @@ module.exports = { selectPhotos: function(e, s, o) { + getApp().globalData.no_clear=1; if (void 0 === e[s]) { var c = 5 - e.length; c > 0 && wx.chooseImage({ diff --git a/utils/wxParse/html2json.js b/utils/wxParse/html2json.js index 671e6a2..93ba194 100644 --- a/utils/wxParse/html2json.js +++ b/utils/wxParse/html2json.js @@ -54,6 +54,8 @@ module.exports = { e; }, {})), "img" === s.tag) { s.imgIndex = i.images.length; + if(!s.attr) return false; + if(!s.attr.src) return false; var d = s.attr.src; "" == d[0] && d.splice(0, 1), d = l.urlToHttpUrl(d, n), s.attr.src = d, s.from = a, i.images.push(s), i.imageUrls.push(d); diff --git a/utils/wxParse/wxParse.js b/utils/wxParse/wxParse.js index 8f650c9..c7e1d04 100644 --- a/utils/wxParse/wxParse.js +++ b/utils/wxParse/wxParse.js @@ -16,6 +16,7 @@ function t(e, t, a) { function a(e) { var t = this, a = e.target.dataset.src, i = e.target.dataset.from; t.data.show_prew_img=1; + getApp().globalData.no_clear=1; void 0 !== i && i.length > 0 && wx.previewImage({ current: a, urls: t.data[i].imageUrls,