diff --git a/app.js b/app.js index 3ba33ea..ee1bf0a 100644 --- a/app.js +++ b/app.js @@ -50,7 +50,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id:null,// 6519870,//5682094, + user_id:null,//1564704,// 10153869,// 6453964,//5682094, buy_now:null, picklist:null, //门店列表 wuliuprice: null, //物流价格表 @@ -78,6 +78,10 @@ App({ onLaunch: function() { wx.hideTabBar(); this.initExt(); + + //检查更新 + this.checkUpdateVersion(); + var t = this.globalData.setting; //console.log(t) t.resourceUrl = t.url + "/template/mobile/rainbow"; @@ -665,6 +669,7 @@ App({ this.globalData.dis_buy_obj=null; //等级卡的购买记录 this.globalData.storeFooter=null; //底部的导航 this.globalData.full_screen=null; //全屏 + }, clear_word:function (word) { @@ -767,6 +772,42 @@ App({ }, + checkUpdateVersion() { + //判断微信版本是否 兼容小程序更新机制API的使用 + if (wx.canIUse('getUpdateManager')) { + //创建 UpdateManager 实例 + const updateManager = wx.getUpdateManager(); + console.log('是否进入模拟更新'); + //检测版本更新 + updateManager.onCheckForUpdate(function(res) { + console.log('是否获取版本'); + // 请求完新版本信息的回调 + if (res.hasUpdate) { + //监听小程序有版本更新事件 + updateManager.onUpdateReady(function() { + + //TODO 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 ( 此处进行了自动更新操作) + updateManager.applyUpdate(); + }) + updateManager.onUpdateFailed(function() { + // 新版本下载失败 + wx.showModal({ + title: '已经有新版本喽~', + content: '请您删除当前小程序,到微信 “发现-小程序” 页,重新搜索打开哦~', + }) + }) + } + }) + } else { + //TODO 此时微信版本太低(一般而言版本都是支持的) + wx.showModal({ + title: '溫馨提示', + content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' + }) + } + }, + + diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxss b/components/diy_goodsGroup/diy_goodsGroup.wxss index c6e228f..6d8dd5a 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxss +++ b/components/diy_goodsGroup/diy_goodsGroup.wxss @@ -816,7 +816,7 @@ swiper { background-color: rgba(0, 0, 0, 0.5); } -.t_red{ color:red;} +.t_red{ color:red !important;} .sp .sp_top .s_img image.zs_t3_3l{ width: 56rpx; diff --git a/packageA/pages/checkin/checkin.wxml b/packageA/pages/checkin/checkin.wxml index ac082ff..82cc42f 100644 --- a/packageA/pages/checkin/checkin.wxml +++ b/packageA/pages/checkin/checkin.wxml @@ -91,41 +91,40 @@ - - - - - - - - - - - + + + + + + + + - - - - - + + + + + + + + + + - - + + + + 小积分大作为 + 积分抵用现金,积少成多 + + + 去购物 Go! + + + - - - - - + diff --git a/packageA/pages/distribution/myteam/myteam.wxml b/packageA/pages/distribution/myteam/myteam.wxml index 4674ed7..445c02c 100644 --- a/packageA/pages/distribution/myteam/myteam.wxml +++ b/packageA/pages/distribution/myteam/myteam.wxml @@ -11,8 +11,8 @@ {{item.nickname}} - 分销会员 - 普通会员 + 分销会员 + 普通会员 {{filter.format_time(item.reg_time)}} diff --git a/packageA/pages/quan_pro/quan_pro.wxml b/packageA/pages/quan_pro/quan_pro.wxml index 0789a3e..0c6bfa6 100644 --- a/packageA/pages/quan_pro/quan_pro.wxml +++ b/packageA/pages/quan_pro/quan_pro.wxml @@ -16,9 +16,9 @@ - + 全场通用 - 仅限{{q_data.useobjectname}}使用 + 仅限{{q_data.useobjectname}}使用 @@ -26,7 +26,9 @@ 满{{filters.toFix(q_data.condition,2)}}可用 - {{q_data.coupon_remark}} + + {{q_data.coupon_remark}} + diff --git a/packageA/pages/quan_pro/quan_pro.wxss b/packageA/pages/quan_pro/quan_pro.wxss index 440eb21..fcd20cb 100644 --- a/packageA/pages/quan_pro/quan_pro.wxss +++ b/packageA/pages/quan_pro/quan_pro.wxss @@ -10,7 +10,7 @@ page{background-color: #f8f8f8;} .q_content{ position: absolute;top: 0; left: 0; width: calc(100% - 40rpx); height: 450rpx;padding: 0 20rpx; } .upper{ height:330rpx;} .lower{ height: 120rpx; line-height: 170rpx;color:#7a668f} -.quan_box {display: flex;flex-direction: column;justify-content: flex-start; box-sizing: border-box;} +.quan_box {display: flex;flex-direction: column; box-sizing: border-box;} .upper .left{ margin-left:30rpx; margin-top: 30rpx } .t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx} @@ -27,3 +27,5 @@ page{background-color: #f8f8f8;} } .btn.gray{background-color: #dcdcdc; color: #adb3be;} +.coupon_remark{padding: 30rpx 0 10rpx 0; box-sizing: border-box; overflow: hidden;} + diff --git a/packageB/pages/evaluate/evaluate.js b/packageB/pages/evaluate/evaluate.js index 5cb90b6..c04f7a1 100644 --- a/packageB/pages/evaluate/evaluate.js +++ b/packageB/pages/evaluate/evaluate.js @@ -140,6 +140,7 @@ Page({ getApp().request.promiseGet(url, { data: { number: th.data.number, + fromtype:th.data.ftype, storeId: a.stoid } }).then(res => { @@ -239,7 +240,7 @@ Page({ if(options.fromtype){ this.setData({ftype:parseInt(options.fromtype)}) ; - if(options.fromtype==4) th.judge_act(); + if(options.fromtype==4 || options.fromtype==1 ) th.judge_act(); } //th.query_bea(); @@ -288,7 +289,7 @@ Page({ var ty=this.data.ftype?this.data.ftype:2; wx.redirectTo({ - url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number + url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number+"&isdg=1" }); }, @@ -305,7 +306,8 @@ Page({ orderNumber: th.data.number, orderType: ty, storeId: a.stoid, - userId: d.user_id + userId: d.user_id, + isdg:1//是否是导购评价 } }).then(res => { if (res.data.code == 0) { @@ -329,7 +331,8 @@ Page({ var th=this; var chekc_data={}; chekc_data['storeId'] = a.stoid; - chekc_data['number'] =this.data.number; + chekc_data['number'] =this.data.number; + chekc_data['fromtype'] =this.data.ftype; getApp().request.get("/api/weshop/evaluation/evaluate/check",{ data:chekc_data, success:function(res){ diff --git a/packageB/pages/evaluate/evaluate.wxml b/packageB/pages/evaluate/evaluate.wxml index e2db52d..8cc0d3d 100644 --- a/packageB/pages/evaluate/evaluate.wxml +++ b/packageB/pages/evaluate/evaluate.wxml @@ -102,7 +102,9 @@ 查看已评价的订单 - + + 点击领取礼品 + @@ -117,12 +119,13 @@ 领券 + + + - - 点击领取礼品 - + diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index e6c47c3..af5ec6c 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -1017,12 +1017,12 @@ Page({ 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; + 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; + newd['guide_type'] = 1; } } @@ -1914,7 +1914,7 @@ Page({ var need_to_buy = 0; var data = this.data.list; var all_zhqty = 0; //所有商品要求起购数之后 - var zhqty_bz=[]; //超量 + var zhqty_bz = []; //超量 var no_in_arr = []; for (var i in data) { var item = data[i]; @@ -1965,72 +1965,111 @@ Page({ //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { - var bz_num_ok=0; //超量倍增是否满足 - var zhqty_len=0; //几个超量倍增 + var bz_num_ok = 0; //超量倍增是否满足 + var delete_num = 0; + var zhqty_len = 0; //几个超量倍增 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); //看一下是几倍 - if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){ - if(zhqty_bz.length>1){ - zhqty_len=1; - let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']})); - let new_arr=zhqty_bz.filter(ii=>{ - return ii['num']==min_bz_num + if (this.data.act.is_bzyh && zhqty_bz.length > 0) { + if (zhqty_bz.length > 1) { + let zhqty_bz_arr = []; + let zhqty_bz_flag = zhqty_bz.every((item1, i) => { + var bz_num = be * item1['zhqty']; //超量倍增 + var num = item1['num'] - item1['zhqty']; //购买数量减去超量 + if (bz_num > num) { + zhqty_bz_arr.push(item1); + zhqty_bz.splice(i, 1) + } + return bz_num <= num; }) - // var vv=new_arr[0]; - var bz_num=be*new_arr[0].zhqty; //超量倍增 - var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量 - bz_num_ok=bz_num-num; - if(bz_num_ok <= 0){ - //超量倍增满足,超量倍增就等于倍数 - bz_num_ok=bz_num; - }else{ - //超量倍增不满足,倍数要减去多出得 - be=be-bz_num_ok; - bz_num_ok=num; - } - for(let i=0;i{ - return vv.goods_id===i.goods_id - }) - no_in_arr.splice(index,1) - } + if (zhqty_bz_flag) { + for (let i = 0; i < zhqty_bz.length; i++) { + var vv = zhqty_bz[i]; + for (let j = 0; j < be * vv['zhqty']; j++) { + let index = no_in_arr.findIndex(i => { + return vv.goods_id === i.goods_id + }) + if (index > -1) { + delete_num++ + no_in_arr.splice(index, 1) + } + } + } + } else { + let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { + return o['num'] + })); + let new_arr = zhqty_bz_arr.filter(ii => { + return ii['num'] == min_bz_num + }) + var vv = new_arr[0]; + var bz_num = be * new_arr[0].zhqty; //超量倍增 + var num = min_bz_num - new_arr[0].zhqty; //购买数量减去超量 + bz_num_ok = bz_num - num; + if (bz_num_ok <= 0) { + //超量倍增满足,超量倍增就等于倍数 + bz_num_ok = bz_num; + } else { + //超量倍增不满足,倍数要减去多出得 + // be=be-bz_num_ok; + if (num % vv.zhqty == 0) { + be = num / vv.zhqty; + } else { + be = Math.floor(num / vv.zhqty) + } + bz_num_ok = be * vv.zhqty; + } + + for (let j = 0; j < bz_num_ok; j++) { + let index = no_in_arr.findIndex(i => { + return vv.goods_id === i.goods_id + }) + if (index > -1) { + delete_num++ + no_in_arr.splice(index, 1) + } + } } - aprice += be * aprice; - }else{ - var vv=zhqty_bz[0]; - var bz_num=be*vv.zhqty; //超量倍增 - var num=vv['num']-vv.zhqty; //购买数量减去超量 - bz_num_ok=bz_num-num; - if(bz_num_ok <= 0){ + } else { + var vv = zhqty_bz[0]; + var bz_num = be * vv.zhqty; //超量倍增 + var num = vv['num'] - vv.zhqty; //购买数量减去超量 + if (num > 0) { + bz_num_ok = bz_num - num; + if (bz_num_ok <= 0) { //超量倍增满足,超量倍增就等于倍数 - bz_num_ok=bz_num; - }else{ + bz_num_ok = bz_num; + } else { //超量倍增不满足,倍数要减去多出得 - be=be-bz_num_ok; - bz_num_ok=num; + // be=be-bz_num_ok; + if (num % vv.zhqty == 0) { + be = num / vv.zhqty; + } else { + be = Math.floor(num / vv.zhqty) + } + bz_num_ok = be * vv.zhqty; } - for(let j=0;j{ - return vv.goods_id===i.goods_id - }) - no_in_arr.splice(index,1) - } - } + for (let j = 0; j < bz_num_ok; j++) { + let index = no_in_arr.findIndex(i => { + return vv.goods_id === i.goods_id + }) + if (index > -1) { + delete_num++ + no_in_arr.splice(index, 1) + } + } + } else { + zhqty_len = 1; + } + } } - if(!zhqty_len){ + if (!zhqty_len) { //多个超量就不用pop了 aprice += be * aprice; - let pop_num=be * this.data.act.zhbuyqty - bz_num_ok; + let pop_num = be * this.data.act.zhbuyqty - delete_num; for (var m = 0; m < pop_num; m++) { no_in_arr.pop(); } } - // var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); - // aprice += be * aprice; - // for (var m = 0; m < be * this.data.act.zhbuyqty; m++) { - // no_in_arr.pop(); - // } } //算一下剩余的钱 diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index 662d908..a9a7bd2 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -137,7 +137,7 @@ Page({ isShowLoading:1, data:{ store_id: os.stoid, - user_id: getApp().globalData.user_id + user_id: getApp().globalData.user_id, } }) if(res.code==0 && res.data.pageData.length>0){ diff --git a/packageC/pages/group_list/group_list.wxml b/packageC/pages/group_list/group_list.wxml index 55ab6c2..7d63580 100644 --- a/packageC/pages/group_list/group_list.wxml +++ b/packageC/pages/group_list/group_list.wxml @@ -21,7 +21,9 @@ - 已售{{item.buy_num+item.virtual_num}}件 + + 已售{{item.buy_num+item.virtual_num}}0 + {{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒 diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 2085de5..c73bc54 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -286,7 +286,7 @@ Page({ //------初始化加载---------- onLoad: function (t) { - + // console.log('onload'); if(t && t.group_id) { this.data.group_id = t.group_id; }; @@ -317,6 +317,7 @@ Page({ //---获取手机地址坐标-- //--如果tg_id是空的话,分享回来-- + // console.log('扫描海报gid'); if (gid == undefined || gid == null || gid == "") { var gid_str = decodeURIComponent(t.scene); gid_str = gid_str.split("_"); @@ -326,6 +327,11 @@ Page({ gid=fir_arr[0]; prom_type=fir_arr[1]; prom_id=fir_arr[2]; + // this.setData({ + // prom_type: prom_type, + // prom_id: prom_id, + // group_id: fir_arr[2], + // }); this.data.prom_type=prom_type; this.data.prom_id=prom_id; this.data.group_id = fir_arr[2]; @@ -745,7 +751,7 @@ Page({ //---展示--- onShow: async function () { - + // console.log('onshow'); var goods_list = null, th = this, that = this; var show_prew_img = this.data.show_prew_img if (show_prew_img) { @@ -763,8 +769,9 @@ Page({ id: this.data.group_id, } }).then(res => { + // console.log() + // console.log('判断活动是否暂停=======》', res.data.data); if (res.data.code == 0) { - // console.log('成团信息=======》', res.data.data); if(res.data.data.pageData && res.data.data.pageData.length == 0) { let obj = { day: '00', @@ -797,6 +804,7 @@ Page({ }); + // 活动暂停显示空白 if (this.data.isTimeUp) { wx.showModal({ diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml index fa63ea4..3deb8f2 100644 --- a/packageC/pages/presell/list/list.wxml +++ b/packageC/pages/presell/list/list.wxml @@ -27,7 +27,7 @@ - + @@ -38,12 +38,12 @@ - - 已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}% + + 已预售0% - 库存还剩{{item.presell_sumqty-item.buy_goodnum}}件 + 库存还剩{{item.presell_sumqty+item.virtual_qty}}件 diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml index e449925..3bb3c54 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxml @@ -134,13 +134,13 @@ 总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件 限购:{{presellList.vip_butyqty}}件 限购:不限 - 已购:{{presellList.buy_goodnum+presellList.virtual_qty}}件 + 已购:0件 总数量:{{presellList.presell_sumqty}}件 限购:{{presellList.vip_butyqty}}件 限购:不限 - 已购:{{presellList.buy_goodnum}}件 + 已购:0件 diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 0eaca33..e6c1775 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -27,9 +27,6 @@ Page({ }) var first_leader = t.first_leader; var th = this; - - console.log("------------"); - console.log(first_leader); getApp().getConfig(); if (first_leader) { @@ -64,23 +61,28 @@ Page({ }); } }) - + // var user_id=getApp().globalData.user_id; + // if(!user_id) user_id=0; + // this.setData({ + // user_id, + // }) + this.requestSalelist(); }, onShow: function (t) { - this.data.is_timer = 1; this.data.currentPage = 1; this.data.ismore = 1; var th = this; - var userInfo = wx.getStorageSync('userinfo'); - console.log(userInfo,30000); - if (userInfo && th.data.goodlist.length==0) { - //调用列表 - this.requestSalelist(userInfo.user_id); - } else { - getApp().goto("/pages/togoin/togoin"); - } + // var userInfo = wx.getStorageSync('userinfo'); + // if (userInfo) { + // //调用列表 + // this.requestSalelist(userInfo.user_id); + // } else { + // getApp().goto("/pages/togoin/togoin"); + // } + + //设置全局定时器 th.data.timer = setInterval(function () { th.countDown(); @@ -134,12 +136,12 @@ Page({ }, //读取数据 - async requestSalelist(user_id) { + async requestSalelist() { if (!this.data.ismore) return false; var e = this, th = e, i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage; - var plist = null, + var plist = [], alllist = th.data.goodlist; if (!alllist) alllist = []; await getApp().request.promiseGet(i, { @@ -148,7 +150,7 @@ Page({ store_id: os.stoid, is_end: 0, is_show: 1, - user_id, + user_id:getApp().globalData.user_id, } }).then(res => { plist = res.data.data.pageData; @@ -183,7 +185,7 @@ Page({ this.reloadGoodList(); }, reloadGoodList: function () { - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); + this.data.goodlist = [], this.data.currentPage = 1, this.requestSalelist(); }, onReachBottom: function () { this.requestSalelist(); diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index d8c38c0..93b06b0 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -1,254 +1,297 @@ -var e = getApp(), i = e.request, a = e.globalData.setting,os=a,ut = require("../../../utils/util.js"); +var e = getApp(), + i = e.request, + a = e.globalData.setting, + os = a, + ut = require("../../../utils/util.js"); var regeneratorRuntime = require('../../../utils/runtime.js'); Page({ - data: { - url: a.imghost, - killtime: null, - currentPage: 1, - goodlist: null, - type:1, - timer:null, - ismore:1, //是否可以加载更多 - isshow:0, - ad_data:null, - max_sw_height:200, - }, - - //------初始化加载---------- - onLoad: function(t) { - wx.setNavigationBarTitle({ title: "商品秒杀",}) - var first_leader = t.first_leader; - var type=t.type; - if(type!=undefined){ - this.setData({type:type}); - } + data: { + url: a.imghost, + killtime: null, + currentPage: 1, + goodlist: null, + type: 1, + timer: null, + ismore: 1, //是否可以加载更多 + isshow: 0, + ad_data: null, + max_sw_height: 200, + }, + + //------初始化加载---------- + onLoad: function (t) { + wx.setNavigationBarTitle({ + title: "商品秒杀", + }) + var first_leader = t.first_leader; + var type = t.type; + if (type != undefined) { + this.setData({ + type: type + }); + } - var th=this; + var th = this; + console.log("------------"); + console.log(first_leader); + getApp().getConfig(); - console.log("------------"); - console.log(first_leader); - getApp().getConfig(); + if (first_leader) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } - if (first_leader) { - getApp().globalData.first_leader = first_leader; - //调用接口判断是不是会员 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { - if (res.data.code == 0) { - getApp().globalData.guide_id = res.data.data.id; - } - }) + getApp().request.promiseGet("/api/weshop/ad/page?pid=701&store_id=" + os.stoid, { + data: { + enabled: 1 + } + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { + var a = res.data.data.pageData; + var narr = []; + for (var i in a) { + var tt = { + 'ad_code': os.imghost + a[i].ad_code, + 'media_link': '', + 'ad_weapplink': a[i].ad_weapplink + }; + narr.push(tt); } - - getApp().request.promiseGet("/api/weshop/ad/page?pid=701&store_id=" + os.stoid, { - data: { - enabled: 1 - } - }).then(res => { - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ - var a = res.data.data.pageData; - var narr=[]; - for(var i in a){ - var tt = { - 'ad_code': os.imghost + a[i].ad_code, - 'media_link': '', - 'ad_weapplink':a[i].ad_weapplink - }; - narr.push(tt); - } - th.setData({ad_data:narr}); - } - }) - - }, - - - onShow: function(t) { - this.data.ismore=1; - this.data.is_timer=1; - this.data.currentPage=1; - var th=this;th.setData({goodlist:null,}) - this.requestSalelist(); - //设置全局定时器 - th.data.timer=setInterval(function () { - th.countDown(); - },1000); - }, - onHide:function(){ - //--清理定时器-- - clearInterval(this.data.timer); - this.setData({isshow:0}); - }, - //---小于10的格式化函数---- - timeFormat(param) { - return param < 10 ? '0' + param : param; - }, + th.setData({ + ad_data: narr + }); + } + }) + this.requestSalelist(); + }, + + + onShow: function (t) { + this.data.is_timer = 1; + this.data.currentPage = 1; + var th = this; + //设置全局定时器 + th.data.timer = setInterval(function () { + th.countDown(); + }, 1000); + }, + onHide: function () { + //--清理定时器-- + clearInterval(this.data.timer); + this.setData({ + isshow: 0 + }); + }, + //---小于10的格式化函数---- + timeFormat(param) { + return param < 10 ? '0' + param : param; + }, //----倒计时函数----- - countDown() { - if(!this.data.is_timer) return false; - var th=this; + countDown() { + if (!this.data.is_timer) return false; + var th = this; // 获取当前时间,同时得到活动结束时间数组 - let newTime =ut.gettimestamp(); + let newTime = ut.gettimestamp(); var endTimeList = this.data.goodlist; - if(endTimeList==null) return null + if (endTimeList == null) return null // 对结束时间进行处理渲染到页面 - for (var i = 0; i < endTimeList.length;i++){ - var o = endTimeList[i]; - var endTime = o.end_time; - if(th.data.type==0) 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}); + for (var i = 0; i < endTimeList.length; i++) { + var o = endTimeList[i]; + var endTime = o.end_time; + if (th.data.type == 0) 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 } - }, - - async requestSalelist() { - //--没有更多就不调用-- - if(!this.data.ismore) return false; - var e = this,th=e, i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage; - var plist=null,alllist=th.data.goodlist; - if(!alllist) alllist=[]; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=user_id; - var req={store_id:os.stoid,timetype:th.data.type,is_end:0,is_show:1,user_id:user_id}; - - await getApp().request.promiseGet(i, - {isShowLoading:1,data:req} - ).then(res=>{ - if(ut.ajax_ok(res)) plist=res.data.data.pageData; + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + var txt = "goodlist[" + i + "].djs"; + th.setData({ + [txt]: obj + }); + } + }, - }); + async requestSalelist() { + //--没有更多就不调用-- + if (!this.data.ismore) return false; + var e = this, + th = e, + i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage; + var plist = [], + alllist = th.data.goodlist; + if (!alllist) alllist = []; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = user_id; + var req = { + store_id: os.stoid, + timetype: th.data.type, + is_end: 0, + is_show: 1, + user_id: user_id + }; - if(plist.length<=0){ - - getApp().showWarning("没有更多数据"); - th.data.ismore=0; - if(e.data.currentPage==1 && this.data.type==1){ - setTimeout(function () { - th.data.ismore=1; - th.setData({type:0}); - th.requestSalelist(); - },1000); - } - return false; - } + await getApp().request.promiseGet(i, { + isShowLoading: 1, + data: req + }).then(res => { + if (ut.ajax_ok(res)) plist = res.data.data.pageData; - //--循环读取接口--- - for(var i=0;i{ - if(res.data.code==0){ - plist[i].status=1; - if(res.data.data<=0) plist[i].status=3; - } - }) - alllist.push(plist[i]); - } - e.data.currentPage++; - console.log("秒杀商品列表", alllist); - th.setData({goodlist:alllist,isshow:1}); - - }, - onPullDownRefresh: function() { - this.reloadGoodList(); - }, - reloadGoodList: function() { - this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist(); - }, - - onReachBottom: function() { - this.requestSalelist(); - }, - - //点击tab事件 - tip:function(e){ - var a=e.currentTarget.dataset.ty,th=this;th.data.ismore=1; - this.setData({type:a,goodlist:null}); - this.reloadGoodList(); - }, - - - //---------分享配置-------- - onShareAppMessage: function (e) { - var curPage=this; - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - if(getApp().globalData.user_id){ + }); - if(pagePath.indexOf("?")>0){ - pagePath+="&first_leader="+getApp().globalData.user_id; - }else{ - pagePath+="?first_leader="+getApp().globalData.user_id; - } - } + if (!plist || plist.length <= 0) { - console.log("11"+pagePath); - return { - title: "限时秒杀", - path:pagePath, + getApp().showWarning("没有更多数据"); + th.data.ismore = 0; + if (e.data.currentPage == 1 && this.data.type == 1) { + setTimeout(function () { + th.data.ismore = 1; + th.setData({ + type: 0 + }); + th.requestSalelist(); + }, 1000); + } + return false; + } + + //--循环读取接口--- + for (var i = 0; i < plist.length; i++) { + + if (plist[i].user_price) plist[i].price = plist[i].user_price; + var prom_id = plist[i].id; + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + prom_id, {} + ).then(res => { + if (res.data.code == 0) { + plist[i].status = 1; + if (res.data.data <= 0) plist[i].status = 3; } - }, - - //图片失败,默认图片 - bind_bnerr2: function (e) { - var _errImg = e.target.dataset.errorimg; - var val = e.target.dataset.val; - if(val!=undefined && val!=null && val!='null' ){ - var _errObj = {}; - _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - } - }, - - onShareTimeline() { - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; - if(!store_name) - store_name=getApp().globalData.setting.appName; - return { - title: '秒杀活动-' + store_name, - } - }, - - imageLoad:function(e){ - var imgwidth = e.detail.width; - var imgheight = e.detail.height; - //宽高比 - var ratio = imgwidth / imgheight; - //计算的高度值 - var viewHeight = 750 / ratio; - var hei=this.data.max_sw_height; - - if (hei< viewHeight) { - this.setData({ max_sw_height: viewHeight }); - } - }, - go_url(e){ - let url=e.currentTarget.dataset.url; - if(url){ - getApp().goto(url); + }) + alllist.push(plist[i]); + } + e.data.currentPage++; + console.log("秒杀商品列表", alllist); + th.setData({ + goodlist: alllist, + isshow: 1 + }); + + + + }, + onPullDownRefresh: function () { + this.reloadGoodList(); + }, + reloadGoodList: function () { + this.data.goodlist = [], this.data.currentPage = 1, this.requestSalelist(); + }, + + onReachBottom: function () { + this.requestSalelist(); + }, + + //点击tab事件 + tip: function (e) { + var a = e.currentTarget.dataset.ty, + th = this; + th.data.ismore = 1; + this.setData({ + type: a, + goodlist: null + }); + this.reloadGoodList(); + }, + + + //---------分享配置-------- + onShareAppMessage: function (e) { + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + if (getApp().globalData.user_id) { + + if (pagePath.indexOf("?") > 0) { + pagePath += "&first_leader=" + getApp().globalData.user_id; + } else { + pagePath += "?first_leader=" + getApp().globalData.user_id; } - }, + } + + console.log("11" + pagePath); + return { + title: "限时秒杀", + path: pagePath, + } + }, + + //图片失败,默认图片 + bind_bnerr2: function (e) { + var _errImg = e.target.dataset.errorimg; + var val = e.target.dataset.val; + if (val != undefined && val != null && val != 'null') { + var _errObj = {}; + _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + } + }, + + onShareTimeline() { + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; + if (!store_name) + store_name = getApp().globalData.setting.appName; + return { + title: '秒杀活动-' + store_name, + } + }, + + imageLoad: function (e) { + var imgwidth = e.detail.width; + var imgheight = e.detail.height; + //宽高比 + var ratio = imgwidth / imgheight; + //计算的高度值 + var viewHeight = 750 / ratio; + var hei = this.data.max_sw_height; -}); + if (hei < viewHeight) { + this.setData({ + max_sw_height: viewHeight + }); + } + }, + go_url(e) { + let url = e.currentTarget.dataset.url; + if (url) { + getApp().goto(url); + } + }, +}); \ No newline at end of file diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 6d2dda8..ab2e874 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -39,9 +39,9 @@