diff --git a/packageA/pages/distribution/myteam/myteam.js b/packageA/pages/distribution/myteam/myteam.js index 39bc012..582a165 100644 --- a/packageA/pages/distribution/myteam/myteam.js +++ b/packageA/pages/distribution/myteam/myteam.js @@ -83,6 +83,7 @@ Page({ store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, level: 1, + isall: 1, }); }; @@ -149,6 +150,7 @@ Page({ store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, level: th.data.currentTabIndex + 1, + isall: 1 }); }, @@ -176,6 +178,7 @@ Page({ store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, level: currentIndex + 1, + isall: 1 }); }, diff --git a/packageA/pages/distribution/myteam/myteam.wxml b/packageA/pages/distribution/myteam/myteam.wxml index 1493a50..4674ed7 100644 --- a/packageA/pages/distribution/myteam/myteam.wxml +++ b/packageA/pages/distribution/myteam/myteam.wxml @@ -9,7 +9,11 @@ - {{item.nickname}} + + {{item.nickname}} + 分销会员 + 普通会员 + {{filter.format_time(item.reg_time)}} diff --git a/packageA/pages/jfbuy/jfbuy.wxml b/packageA/pages/jfbuy/jfbuy.wxml index e8182f9..3c10909 100644 --- a/packageA/pages/jfbuy/jfbuy.wxml +++ b/packageA/pages/jfbuy/jfbuy.wxml @@ -52,7 +52,7 @@ 零售价:¥{{item.market_price}} - 销量:{{item.buy_num}} + 销量:{{item.buy_num+item.virtual}} diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 546becc..0c8e2ef 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -40,7 +40,8 @@ Page({ g_buy_num: null, sele_collocation:null, - room_id:0, //房间号 + room_id:0, //房间号 + is_coupon: 1, //搭配促销禁用 }, //------初始化加载---------- @@ -164,163 +165,189 @@ Page({ var ee=this,th=ee,that=ee; var gid = this.data.gid,i = getApp().request; ee.data.g_buy_num = new Map(); - this.wait_for_store_config(); - setTimeout(function(){ - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { - failRollback: !0, - success: function(t) { - if (t.data.code == 0) { - if (t.data.data.is_on_sale != 1) { - wx.showModal({ - title: '商品已经下架', - showCancel: !1, - complete: function() { - wx.navigateBack(); - } - }); - } - - var timestamp = Date.parse(new Date()); - timestamp = timestamp / 1000; - if (t.data.data.on_time > timestamp) { - wx.showModal({ - title: '商品还未上架', - showCancel: !1, - complete: function() { - wx.navigateBack(); - } - }); - } - - if (t.data.data.down_time > 0) { - if (t.data.data.down_time < timestamp) { - wx.showModal({ - title: '商品已经到期下架', - showCancel: !1, - complete: function() { - wx.navigateBack(); - } - }); - } - } - - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); - var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); - t.data.data['disc'] = txt; - - if (t.data.data.original_img.indexOf(o.imghost) == -1) - t.data.data.original_img = o.imghost + t.data.data.original_img; - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; - - //计算商品的规格 - var gg = ""; - if(t.data.data.goods_spec=="null" || t.data.data.goods_spec==null) t.data.data.goods_spec=""; - if(t.data.data.goods_color=="null" || t.data.data.goods_color==null) t.data.data.goods_color=""; - - if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { - gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; - } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { - gg = t.data.data.goods_spec + t.data.data.goods_color; - } else { - gg = "规格1"; - } - t.data.data.gg = gg; - - - //--看一下有没有开启等级卡--- - if(ee.data.rank_switch){ - //---回调卡的列表--- - th.getPlusCardType(function(ob){ - var user = getApp().globalData.userInfo; - if(user){ - if(user.card_field && user['card_expiredate']){ - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - //--- 判断是等级会员,且在有效期范围内 --- - if(user.card_field && now5) card_name=card_name.substring(0,5); - th.setData({card_field:user.card_field,card_name:card_name}); - if(t.data.data[user.card_field]>0) t.data.data.shop_price=t.data.data[user.card_field]; - } - } - } - ee.setData({ data: t.data.data, }); - }) - }else{ - ee.setData({ data: t.data.data, }); - } - - if(!ee.data.collocationList){ - /*---获取活动的重表---*/ - //调用接口判断订单优惠, - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+ee.data.gid+"/2", {}).then(res => { - if(res.data.code==0){ - var r_data=res.data.data; - th.loop_promise(0,r_data.collocationList,function(){ - ee.setData({ - collocationGoods:r_data.collocationPromList, - collocationList:r_data.collocationList, - }) - }) - } - }) - } - - //获取统一条形码,普通商品和优惠促销的商品 - if ( t.data.data.prom_type == 5){ - //默认门店要拿下门店库存 - if(that.data.sales_rules==2 && that.data.is_newsales_rules){ - //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 - getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ - if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){ - var lock=0,plist=null; - //先读取门店的lock,采用链式写法,少用await - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000} - }).then(res=>{ - if(res.data.code==0 && res.data.data.total>0){ - for(var i in res.data.data.pageData) - lock+=res.data.data.pageData[i].outQty - } - //---通过接口获取门店的线下库存信息-- - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid,pageSize:2000} - }) - }).then(res=>{ - if(res.data.code==0 && res.data.data.total>0){ - plist=res.data.data.pageData[0]; - } - if(plist && plist.CanOutQty-lock>0){ - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; - }else{ - that.data.fir_def_store.CanOutQty=0; - } - //--给门店赋值线下库存-- - th.setData({def_pick_store:that.data.fir_def_store}); - //获取门店 - ee.get_sto(); - }) - }else{ - //--获取门店-- - ee.get_sto(); - } - }) - }else{ - //获取门店 - ee.get_sto(); - } - - } - else { - return getApp().my_warnning("商品没有搭配购的活动",0,th) - } - } - } - }); - },1000) + this.wait_for_store_config(); + clearTimeout(ot); + var ot = setTimeout(function () { + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { + failRollback: !0, + success: function (t) { + if (t.data.code == 0) { + if (t.data.data.is_on_sale != 1) { + wx.showModal({ + title: '商品已经下架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + + var timestamp = Date.parse(new Date()); + timestamp = timestamp / 1000; + if (t.data.data.on_time > timestamp) { + wx.showModal({ + title: '商品还未上架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + + if (t.data.data.down_time > 0) { + if (t.data.data.down_time < timestamp) { + wx.showModal({ + title: '商品已经到期下架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + } + + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); + var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2); + t.data.data['disc'] = txt; + + if (t.data.data.original_img.indexOf(o.imghost) == -1) + t.data.data.original_img = o.imghost + t.data.data.original_img; + if (t.data.data.goods_content == null) t.data.data.goods_content = ""; + + //计算商品的规格 + var gg = ""; + if (t.data.data.goods_spec == "null" || t.data.data.goods_spec == null) t.data.data.goods_spec = ""; + if (t.data.data.goods_color == "null" || t.data.data.goods_color == null) t.data.data.goods_color = ""; + + if (t.data.data.goods_spec != "" && t.data.data.goods_color != "") { + gg = t.data.data.goods_spec + "/" + t.data.data.goods_color; + } else if (t.data.data.goods_spec != "" || t.data.data.goods_color != "") { + gg = t.data.data.goods_spec + t.data.data.goods_color; + } else { + gg = "规格1"; + } + t.data.data.gg = gg; + + + //--看一下有没有开启等级卡--- + if (ee.data.rank_switch) { + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + var user = getApp().globalData.userInfo; + if (user) { + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + if (card_name && card_name.length > 5) card_name = card_name.substring(0, 5); + th.setData({ + card_field: user.card_field, + card_name: card_name + }); + if (t.data.data[user.card_field] > 0) t.data.data.shop_price = t.data.data[user.card_field]; + } + } + } + ee.setData({ + data: t.data.data, + }); + }) + } else { + ee.setData({ + data: t.data.data, + }); + } + + if (!ee.data.collocationList) { + /*---获取活动的重表---*/ + //调用接口判断订单优惠, + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + + th.data.is_coupon = r_data.collocationPromList.is_coupon; + + + th.loop_promise(0, r_data.collocationList, function () { + // 设置搭配购是否使用优惠卷 + ee.setData({ + collocationGoods: r_data.collocationPromList, + collocationList: r_data.collocationList, + }) + }) + } + }) + } + + //获取统一条形码,普通商品和优惠促销的商品 + if (t.data.data.prom_type == 5) { + //默认门店要拿下门店库存 + if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 + getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () { + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id) { + var lock = 0, + plist = null; + //先读取门店的lock,采用链式写法,少用await + getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { + data: { + store_id: os.stoid, + wareId: ee.data.data.goods_id, + storageId: that.data.fir_def_store.pickup_id, + pageSize: 1000 + } + }).then(res => { + if (res.data.code == 0 && res.data.data.total > 0) { + for (var i in res.data.data.pageData) + lock += res.data.data.pageData[i].outQty + } + //---通过接口获取门店的线下库存信息-- + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { + data: { + storageNos: that.data.fir_def_store.pickup_no, + wareIds: encodeURIComponent(th.data.data.erpwareid), + storeId: os.stoid, + pageSize: 2000 + } + }) + }).then(res => { + if (res.data.code == 0 && res.data.data.total > 0) { + plist = res.data.data.pageData[0]; + } + if (plist && plist.CanOutQty - lock > 0) { + that.data.fir_def_store.CanOutQty = plist.CanOutQty - lock; + } else { + that.data.fir_def_store.CanOutQty = 0; + } + //--给门店赋值线下库存-- + th.setData({ + def_pick_store: that.data.fir_def_store + }); + //获取门店 + ee.get_sto(); + }) + } else { + //--获取门店-- + ee.get_sto(); + } + }) + } else { + //获取门店 + ee.get_sto(); + } + + } else { + return getApp().my_warnning("商品没有搭配购的活动", 0, th) + } + } + } + }); + clearTimeout(ot); + }, 1000) }, onUnload: function() {}, @@ -507,6 +534,8 @@ Page({ newd['pick_dis'] = th.data.sto_sele_distr; newd["collocation_goods"]=th.data.sele_collocation; + newd["is_coupon"] = th.data.is_coupon; + th.buyNow(newd); }, diff --git a/packageB/pages/zuhegou/list/g_filter.wxs b/packageB/pages/zuhegou/list/g_filter.wxs index 9719e7d..0015aca 100644 --- a/packageB/pages/zuhegou/list/g_filter.wxs +++ b/packageB/pages/zuhegou/list/g_filter.wxs @@ -20,10 +20,19 @@ var g_filters = { var tnow=getDate(); if(t1>=tnow) return 1; return 0; - } + }, + goToUrl: function(type, id, name) { + if (type == 1) { + return "/packageB/pages/zuhegou/index/index?id="+id+"&title="+name + } else { + return "/packageB/pages/zuhegou/preIndex/index?id="+id+"&title="+name + } + }, + } module.exports = { has_char: g_filters.has_char, beg_time: g_filters.beg_time, end_time: g_filters.end_time, + goToUrl: g_filters.goToUrl, } \ No newline at end of file diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index ce87de3..3060968 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -90,16 +90,17 @@ Page({ //----倒计时函数----- countDown() { + if(!this.data.is_timer) return false; var th=this; // 获取当前时间,同时得到活动结束时间数组 - let newTime =ut.gettimestamp(); - var endTimeList = this.data.goodlist; - if(endTimeList==null) return null + let newTime = ut.gettimestamp(); + var endTimeList = th.data.goodlist; + if(endTimeList == null) return null; // 对结束时间进行处理渲染到页面 for (var i = 0; i < endTimeList.length;i++){ var o = endTimeList[i]; - var endTime = o.end_time; + var endTime = o.start_time; if(th.data.type==0) endTime = o.start_time; let obj = null; // 如果活动未结束,对时间进行处理 @@ -122,23 +123,36 @@ Page({ } }, + // 请求活动列表 async requestSalelist() { //--没有更多就不调用-- if(!this.data.ismore) return false; - - var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; + var e = this, + th = e, + i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=" + this.data.type + "&page=" + e.data.currentPage; // var plist=null,alllist=th.data.goodlist; // if(!alllist) alllist=[]; - let {goodlist}=this.data; + let {goodlist} = this.data; const {data:res}=await getApp().request.promiseGet(i,{ isShowLoading:1, - data:{store_id:os.stoid,user_id:getApp().globalData.user_id} + data:{ + store_id: os.stoid, + user_id: getApp().globalData.user_id + } }) if(res.code==0 && res.data.pageData.length>0){ if(res.data.page>1){ - goodlist=goodlist.concat(res.data.pageData) + th.data.goodlist = goodlist.concat(res.data.pageData) }else{ - goodlist=res.data.pageData; + th.data.goodlist = res.data.pageData; + } + + if (th.data.type == 0) { + clearInterval(ot); + var ot = setInterval(function () { + th.countDown(); + }, 1000); + } }else{ @@ -146,14 +160,21 @@ Page({ th.data.ismore=0; } e.data.currentPage++; - th.setData({goodlist,isshow:1}); + th.setData({ + goodlist: th.data.goodlist, + isshow: 1 + }); }, + onPullDownRefresh: function() { this.reloadGoodList(); }, + reloadGoodList: function() { - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); + this.data.goodlist = null; + this.data.currentPage = 1; + this.requestSalelist(); }, onReachBottom: function() { @@ -162,9 +183,16 @@ Page({ //点击tab事件 tip:function(e) { - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1; - this.setData({type:a,goodlist:null}); + var a = e.currentTarget.dataset.ty, + th = this; + th.data.type = a; + th.data.ismore = 1; + this.setData({ + type:a, + goodlist: null + }); this.reloadGoodList(); + }, diff --git a/packageB/pages/zuhegou/list/list.wxml b/packageB/pages/zuhegou/list/list.wxml index 2f54385..f58b305 100644 --- a/packageB/pages/zuhegou/list/list.wxml +++ b/packageB/pages/zuhegou/list/list.wxml @@ -31,18 +31,26 @@ - + + - + {{item.name}} 组合数量: {{item.zhbuyqty}} 活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}} + + 剩余: + {{item.djs.day}}天 + {{item.djs.hou}}时 + {{item.djs.min}}分 + {{item.djs.sec}}秒 + {{item.zhprice}} @@ -53,7 +61,24 @@ - 没有相关内容 + +没有相关内容 + + + + + + 火热进行中 + + + 即将开始 + + + + + diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js index 59e95d2..14e3197 100644 --- a/packageC/pages/group_list/group_list.js +++ b/packageC/pages/group_list/group_list.js @@ -9,7 +9,8 @@ Page({ * 页面的初始数据 */ data: { - // type:1, + url: a.imghost, + type:1, // goodlist: null, isLogin: false, @@ -51,13 +52,13 @@ Page({ isLogin: true, }); - + let typeVal = this.data.type; let url = '/api/weshop/goods/groupBuy/page'; let data = { store_id: app.globalData.setting.stoid, is_show: 1, is_end: 0, - timetype:1 + timetype: typeVal }; this.setData({ @@ -72,21 +73,48 @@ Page({ }); }); - this.data.is_timer=1; + this.data.is_timer = 1; }; - //设置全局定时器 + clearInterval(this.data.timer); this.data.timer = setInterval(function () { - self.countDown(); - },1000); - + self.countDown(); + }, 1000); }; }, + // 底部按钮切换 + tip: function(e) { + // 1进行中 0预热 + let typeValue = e.currentTarget.dataset.ty; + this.data.type = typeValue; + let url = '/api/weshop/goods/groupBuy/page'; + let data = { + store_id: app.globalData.setting.stoid, + is_show: 1, + is_end: 0, + timetype: typeValue + }; + + this.getData(true, url, data).then(function() { + self.setData({ + currentData: data, + }); + + }); + + + this.setData({ + list: null, + type: typeValue, + }); + + }, + /** * 生命周期函数--监听页面隐藏 */ @@ -210,7 +238,7 @@ Page({ // 对结束时间进行处理渲染到页面 for(var i = 0; i < endTimeList.length; i++) { var o = endTimeList[i]; - var endTime = o.end_time; + var endTime = this.data.type == 1?o.end_time:o.start_time; // if(th.data.type==0) endTime = o.start_time; let obj = null; // 如果活动未结束,对时间进行处理 diff --git a/packageC/pages/group_list/group_list.wxml b/packageC/pages/group_list/group_list.wxml index f64f2b4..55ab6c2 100644 --- a/packageC/pages/group_list/group_list.wxml +++ b/packageC/pages/group_list/group_list.wxml @@ -9,8 +9,13 @@ {{item.title}} - {{item.rebate}}折 - {{item.price}} + + {{item.rebate}}折 + {{item.rebate}}折 + + {{item.price}} + {{item.price}} + {{item.market_price}} @@ -19,15 +24,32 @@ 已售{{item.buy_num+item.virtual_num}}件 {{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒 - 去团购 + + + 去团购 + 即将开始 + + - - + + + + + + + + + 火热进行中 + + + 即将开始 + + \ No newline at end of file diff --git a/packageC/pages/group_list/group_list.wxss b/packageC/pages/group_list/group_list.wxss index 8c38c5c..6770daf 100644 --- a/packageC/pages/group_list/group_list.wxss +++ b/packageC/pages/group_list/group_list.wxss @@ -55,4 +55,83 @@ page { text-align: center; /* margin-top: 10rpx; */ color: #ccc; +} + +.xc-seckill-bottom{ + position: fixed; +bottom: 0rpx; +width: 100%; + +} + +.xc-bottom{ + width: 45rpx; + height: 45rpx; + margin-right: 13rpx; +} +.xc-border-right{ + border-right: 4rpx solid #eee; + +} + +.kill-time .theader .timeac { + font-size: 32rpx; height:100%; width: 50%; + color: #333; background-color: #fff; + +} + +.kill-time .theader{ + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + +} + +.kill-time { + text-align: center; + justify-content: space-around; + align-items: center; + height: 101rpx; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; + background-color: #f6f6f6; +} +.kill-time .theader{ + display: flex; margin: 0 auto; align-items: center; + height: 100rpx; + +} +.kill-time .theader .timeac { + font-size: 32rpx; height:100%; width: 50%; + color: #333; background-color: #fff; + +} +/* .kill-time .theader .timeac.left{border-top-left-radius: 86rpx; border-bottom-left-radius: 86rpx;} +.kill-time .theader .timeac.right{border-top-right-radius: 86rpx; border-bottom-right-radius: 86rpx;} */ +.kill-time .theader .timeac.active{color: #c4182e} + +.kill-item { + display: flex; + justify-content: space-between; + background-color: #fff; + padding: 20rpx; + margin-bottom: 20rpx; + border-radius: 10rpx; + /* height: 249rpx; */ + align-items: center; +} + +.kill-pic { + width: 215rpx; + height: 215rpx; +} + +.kill-cont { + width: 465rpx; + margin-left:20rpx; + margin-right: 5rpx; +} + +.blue_c { + color: #059de5; + } \ No newline at end of file diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 2b3e327..6ffa3a9 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -684,17 +684,19 @@ Page({ var o_condition1=0; if (th.data.order_prom[bn_pick]) { var ord_prom = th.data.order_prom[bn_pick]; - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - var all_1=o_condition; - o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (all_1 - o_condition1).toFixed(2); - break; - case 1: - o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; + if(!ord_prom.is_xz_yh || quan_price<=0) { + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + var all_1 = o_condition; + o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (all_1 - o_condition1).toFixed(2); + break; + case 1: + o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } } } //--订单优惠的显示-- @@ -2247,7 +2249,7 @@ Page({ await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ data:{store_id:os.stoid,goods_id:gg.goods_id} }).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.pageData){ + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ prom=res.data.data.pageData[0]; } }) @@ -2342,7 +2344,7 @@ Page({ await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ data:{store_id:os.stoid,goods_id:goodsinfo.goods_id} }).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.pageData){ + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ prom=res.data.data.pageData[0]; } }) diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 0572787..075c2c2 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -774,16 +774,18 @@ Page({ var order_prom_id = 0; if (th.data.order_prom[th.data.bn_pick]) { var ord_prom = th.data.order_prom[th.data.bn_pick]; - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (o_condition - order_m).toFixed(2); - break; - case 1: - order_m = o_condition - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; + if(!ord_prom.is_xz_yh || quan_price<=0) { + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - order_m).toFixed(2); + break; + case 1: + order_m = o_condition - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } } } //--订单优惠的显示-- diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js index 3125e78..0667eff 100644 --- a/packageC/pages/presell/list/list.js +++ b/packageC/pages/presell/list/list.js @@ -11,6 +11,7 @@ Page({ isshow: 0, ad_data: null, max_sw_height: 200, + type: 1, }, //------初始化加载---------- @@ -117,7 +118,7 @@ Page({ store_id: os.stoid, page: this.data.page, pageSize: 10, - timetype: 1, + timetype: self.data.type, isuse:1 } if(getApp().globalData.userInfo){ @@ -131,7 +132,6 @@ Page({ getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { data: req, success: function (res) { - console.log(res); self.data.loading = 0; if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { var list = self.data.goodlist ? self.data.goodlist : []; @@ -145,17 +145,92 @@ Page({ if (arr.length < 10) { self.setData({no_more: 1}) } + + // 预热活动设置倒计时 + if (self.data.type == 0) { + clearInterval(self.data.timer); + self.data.timer = setInterval(function () { + self.countDown(); + }, 1000); + + } } else { self.setData({no_more: 1}) } self.setData({is_get: 1}) - + } }) }, + + go_index:function () { getApp().goto("/pages/index/index/index"); - } + }, + + + tip: function(e){ + // 获取模板Data数据 1进行中 0预热中 + var typeValue = e.currentTarget.dataset.ty; + // 初始化数据 + this.data.type = typeValue; + this.data.loading = 0; + this.data.no_more = 0; + this.data.page = 1; + this.data.goodlist = []; + var goodslist = this.data.goodlist; + // 设置模板Data数据 + this.setData({ + type: typeValue, + goodlist: goodslist, + }); + // 请求接口数据 + this.get_list(); + }, + + //----倒计时函数----- + countDown() { + var th=this; + // 获取当前时间,同时得到活动结束时间数组 + let newTime = ut.gettimestamp(); + var endTimeList = this.data.goodlist; + if(endTimeList==null) return null + // 对结束时间进行处理渲染到页面 + for (var i = 0; i < endTimeList.length; i++){ + var o = endTimeList[i]; + var endTime = o.start_time; + let obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0){ + let time = (endTime - newTime); + // 获取天、时、分、秒 + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec), + hide: 1 + } + }else{ + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + var txt ="goodlist["+i+"].djs"; + th.setData({ [txt]: obj}); + } + }, + + + }); diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml index 7af0bb6..7cfe9ff 100644 --- a/packageC/pages/presell/list/list.wxml +++ b/packageC/pages/presell/list/list.wxml @@ -37,7 +37,7 @@ - + 已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}% @@ -45,32 +45,56 @@ 库存还剩{{item.presell_sumqty-item.buy_goodnum}}件 - - + - + + 剩余: + {{item.djs.day}}天 + {{item.djs.hou}}时 + {{item.djs.min}}分 + {{item.djs.sec}}秒 + + ¥{{item.presell_price}} {{item.price}} 零售价¥{{item.market_price}} - - 去抢购 + 去抢购 + 即将开始 + - - - 去首页逛逛 - - -- 没有更多 -- + + + + -- 没有更多 -- + + + + + + + 火热进行中 + + + + + 即将开始 + + + + + + diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index b963691..0b26dc8 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -175,7 +175,10 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; - th.setData({show_submit: 0}); //让提交先掩藏 + th.setData({ + show_submit: 0, + + }); //让提交先掩藏 th.data.g_cart_q_time = null; if (th.data.isclose == 0) { @@ -328,6 +331,7 @@ Page({ typeof func == "function" && func(); }) }, + //------获取会员信息-----先获取用户信息,在进行下一步--- get_info: function (func) { var user_id = t.globalData.user_id; @@ -525,7 +529,7 @@ Page({ } else { - item1.act = th.data.zhhe_act_map[item1.prom_id]; + item1.act = th.data.zhhe_act_map[item1.prom_id]; } } if(item1.prom_type==10){ @@ -561,7 +565,7 @@ Page({ } }) if (!isok){ - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id; getApp().request.delete(url, {}); th.data.ladder_map[item1.prom_id]=-1; continue; @@ -625,7 +629,9 @@ Page({ if (arr.length > 0) { for (var j = 0; j < arr.length; j++) { if (arr[j].pickup_id == pcid) { - //if(item.is_gift!=1){ + + //赠品的配送方式要和优惠的主商品一样 + if(item.is_gift!=1){ //确定配送方式 if (arr[j].distr_t == 0) { arr[j].distr_t = car_item.distr_type; @@ -646,7 +652,8 @@ Page({ arr[j].exp_type = e_t; if (e_t == 0) th.setData({is_all_zt: 0}); else if(e_t==1) th.setData({is_all_zt: 1}); - //} + } + //-- 把等级卡会优惠多少钱装进去 -- if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; @@ -689,6 +696,7 @@ Page({ } //如果是物流的话,全部自提的控制要弄成0 if (e_t == 0) th.setData({is_all_zt: 0}); + else if (e_t == 1) th.setData({is_all_zt: 1}); var narr = new Array(); narr.push(car_item); @@ -827,6 +835,8 @@ Page({ get_buy_goods: function (e) { var th = this; var gg = to.get_b_now(); + + //--------如果goods_id一样,就是要立即购买----- if (e == gg.goods_id) { a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { @@ -974,6 +984,11 @@ Page({ } else { //--看是不是搭配促销-- if (gg.prom_type == 5) { + + th.setData({ + 'is_coupon': gg.is_coupon + }); + t.data.data.prom_id = gg.prom_id; t.data.data.prom_type = 5; if (gg.room_id) { @@ -1725,16 +1740,19 @@ Page({ }).then(res => { if (res.data.code == 0) { var ord_prom = res.data.data; - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (o_condition - order_m).toFixed(2); - break; - case 1: - //order_m = o_condition - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; + //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券 + if(!ord_prom.is_xz_yh || quan_price<=0) { + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - order_m).toFixed(2); + break; + case 1: + //order_m = o_condition - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } } } }) @@ -2080,16 +2098,20 @@ Page({ var order_prom_id = 0; if (th.data.order_prom[th.data.bn_pick]) { var ord_prom = th.data.order_prom[th.data.bn_pick]; - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (o_condition - order_m).toFixed(2); - break; - case 1: - order_m = o_condition - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; + //如果订单没有勾选使用优惠券不参与此活动 + if(!ord_prom.is_xz_yh || quan_price<=0) { + + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - order_m).toFixed(2); + break; + case 1: + order_m = o_condition - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } } } //--订单优惠的显示-- @@ -2525,6 +2547,7 @@ Page({ if (t_item.coupon_price) { item.coupon_price = t_item.coupon_price; item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; + t_item.quan_no=item.coupon_no; } else if (t_item.quan_no) { item.coupon_no = t_item.quan_no; item.coupon_price = 0; @@ -2593,15 +2616,16 @@ Page({ //房间号的ids var room_ids = ""; + //-- 把券的钱,写入从表 --- + if (t_item.quan_youhui_list && t_item.coupon_price) { - //-- 把券的钱,写入从表 --- - if (t_item.quan_youhui_list && t_item.coupon_price) { for (var kk in t_item.quan_youhui_list) { var you_item = t_item.quan_youhui_list[kk]; //-- 对券的价格进行平摊 -- await th.split_set_goods_quanprice(you_item,t_item); } } + //-------------让商品添加到商品列表-------------------- for (var k = 0; k < t_item.goods.length; k++) { var g_item = t_item.goods[k]; @@ -2624,6 +2648,7 @@ Page({ goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); goods.pricing_type = g_item.pricing_type; } + if(g_item.quan_num){ goods.quan_num=g_item.quan_num; goods.quan_no=g_item.quan_no; @@ -2717,6 +2742,7 @@ Page({ if (pdata.length == 0) return; var str = JSON.stringify(pdata); + wx.showLoading({title: "加载中"}); wx.request({ url: oo.url + '/api/weshop/order/createWxdOrder', @@ -3576,6 +3602,7 @@ Page({ if (th.data.is_b_now == 1) { th.setData({index: m_wind, is_express: m_wind}); } else { + clearInterval(ui); var ui = setInterval(function () { if (th.data.cartlist) { var c_arr = th.data.cartlist; @@ -3654,7 +3681,7 @@ Page({ var item_price = gd.goods_price * gd.goods_num; //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- if (gd.account_fir != null && gd.account_fir != undefined) { - item_price = gd.account_fir * gd.goods_num; + //item_price = gd.account_fir * gd.goods_num; } ckeck_quan_price += item_price; @@ -3671,15 +3698,17 @@ Page({ check_quan_ware_list = encodeURIComponent(gd['erpwareid']); } } + //优惠券优惠的金额要控制到优惠券的选择条件 var cut_price = 0; for (var i in th.data.prom_goods_map[pickup_id]) { var obj = th.data.prom_goods_map[pickup_id][i]; - if (obj.coupon_sele) { + if (obj.coupon_sele && obj.prom_price) { cut_price += obj.price - obj.prom_price; } } + //阶梯优惠使用券 var prom_pt_json= ep.prom_pt_json; if(prom_pt_json){ for(let oj in prom_pt_json){ @@ -3689,8 +3718,8 @@ Page({ } } } - - arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; + + arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); arr[ind].check_quan_ware_list = check_quan_ware_list; arr[ind].check_quan_price_list = check_quan_price_list; arr[ind].is_xz_yh = is_xz_yh; @@ -3703,7 +3732,7 @@ Page({ data: { storeId: oo.stoid, userId: app.globalData.user_id, - BuySum: arr[ind].ckeck_quan_price, + BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2), WareIds: check_quan_ware_list, pageSize: 100 } @@ -3752,7 +3781,7 @@ Page({ data: { storeId: oo.stoid, userId: app.globalData.user_id, - BuySum: th.data.ckeck_quan_price, + BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2), WareIds: encodeURIComponent(th.data.check_quan_ware_list), pageSize: 100 }, @@ -4110,8 +4139,9 @@ Page({ getApp().goto(url); }, - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 - split_set_goods_quanprice:async function (you_item,t_item) { + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 + split_set_goods_quanprice:async function (you_item,t_item) { + var coupon_price=you_item.WareCashSum; var goods=t_item.goods; var arr=[]; diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml index e9bb202..b3e0d46 100644 --- a/pages/cart/cart2/cart2.wxml +++ b/pages/cart/cart2/cart2.wxml @@ -343,11 +343,12 @@ + {{order.store_prom}} - + 优惠券 {{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用 diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index d5c8dec..c6b12d9 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -3105,8 +3105,8 @@ Page({ //--------检查是否活动,活动是否开始,或者是否结束------- async check_prom(gid, prom_type, prom_id) { - console.log('check_prom'); - var ee = this,th = ee; + var ee = this, + th = ee; var user_id=getApp().globalData.user_id; if(!user_id) user_id=0; @@ -3118,6 +3118,7 @@ Page({ } if(prom_type==2){ + //-------判断团购活动是否抢光--------- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { 1: 1 @@ -3129,11 +3130,12 @@ Page({ }); //拿取价格并且判断时间-- getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { - success: function (t) { - if (t.data.code != 0) { - ee.get_normal(gid); - return false; - } + success: function (t) { + if (t.data.code != 0) { + ee.get_normal(gid); + return false; + } + //----已经结束----- if (t.data.data.is_end == 1) { ee.get_normal(gid); @@ -3141,17 +3143,18 @@ Page({ } //----已经过期----- var now = ut.gettimestamp(); - if (t.data.data.end_time < now || t.data.data.start_time>now) { + // if (t.data.data.end_time < now || t.data.data.start_time > now) { + if (t.data.data.end_time < now) { ee.get_normal(gid); return false; } - + /*-- 还没有开始预热的也不显示 --*/ if (t.data.data.show_time > now) { ee.get_normal(gid); return false; } - + var t_gd = ee.data.data; var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");