diff --git a/packageD/pages/user/coupons/coupons.js b/packageD/pages/user/coupons/coupons.js index 92104c9..377ce3a 100644 --- a/packageD/pages/user/coupons/coupons.js +++ b/packageD/pages/user/coupons/coupons.js @@ -11,10 +11,10 @@ const { qrcode } = require('../../../../utils/index.js'); let _this = null; - + Page({ data: { - + iurl: getApp().globalData.setting.imghost, val:false, datet: "", dates: "", @@ -96,9 +96,45 @@ Page({ }, - + //跳转商品 + nvShop(){ + let url= '/pages/goods/goodsList/goodsList' + getApp().goto(url) + }, + //跳转商品详情 + nvShopInfo(e){ + let useobjectid = e.currentTarget.dataset.useobjectid; + //------------------------------------------------ + getApp().request.get('/api/weshop/goods/list', { + data: { + store_id: os.stoid, + erpwareid: useobjectid, + }, + success(res) { + if (ut.ajax_ok2(res)) { + let good = res.data.data; + if (good.length>0) { + let item = good[0] + let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` + getApp().goto(url) + } + } + } + }) - + + + // wx.reLaunch({ + // url: '/pages/goods/goodsInfo/goodsInfo', + // }) + + + + + + + //------------------------------------------------ + }, // 点击选中二维码 click: function (e) { diff --git a/packageD/pages/user/coupons/coupons.wxml b/packageD/pages/user/coupons/coupons.wxml index dae9b75..ce8691e 100644 --- a/packageD/pages/user/coupons/coupons.wxml +++ b/packageD/pages/user/coupons/coupons.wxml @@ -20,11 +20,15 @@ 包邮券 微券来源: 微信商城 - {{filter.showBtnText(currentIndex)}} + {{filter.showBtnText(currentIndex)}} - + 有效期:{{detail.use_start_time==null?" " : time.format_time(detail.use_start_time)}} 至 {{time.format_time(detail.use_end_time)}} 有效期:不限 + + + + @@ -46,15 +50,17 @@ 微券来源: {{detail.SendMan==null?'线下发放':detail.SendMan==''?"线下发放":detail.SendMan}} - {{filter.showBtnText(currentIndex)}} + {{filter.showBtnText(currentIndex)}} - + 有效期:{{detail.BeginDate==null ? " " : time.replace_time2(detail.BeginDate)}} 至 {{time.replace_time2(detail.ValidDate)}} 有效期:不限 + + - + 使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}} diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 6fcc4ab..fbd7473 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -28,6 +28,7 @@ Page({ up_dating: 0, //更新中 isreduce: 0, //商品数量是否可减 isadd: 0, //是否可以加商品数量 + invalidList:[], //失效商品列表 card_field:"", bconf:null, @@ -65,7 +66,9 @@ Page({ onShow: function () { //每次显示都清空 this.data.in_zhact_gdmap = {}; - + this.setData({ + invalidList:[] + }); if (typeof this.getTabBar === 'function' && this.getTabBar()) { var index = getApp().getPageIndex(this); @@ -164,9 +167,39 @@ Page({ onUnLoad() { getApp().globalData.cart_zh_act = null; }, + + //失效商品处理 + // invType 表示失效的原因,classType 表示类别 0 表示商品,1表示服务 + disInvalid(item,invType=0,classType=0){ + let invalidList = this.data.invalidList; + let off = true; + console.log('失效商品-----1') + console.log(item) + console.log('失效商品-----2') + invalidList.map(ite=>{ + if(classType ==0 && ite.goods_id == item.goods_id){ //判断该商品是否存在于失效列表中 + off = false; + } + if(classType ==1 && ite.service_id == item.service_id){ //判断该商品是否存在于失效列表中 + off = false; + } + }); + if(off){ + if(invType==0){ + item.invalid = '商品活动变动'; + }else if(invType ==1){ + item.invalid = '商品已下架'; + }else{ + item.invalid ="商品超出限购" + } + item.classType = classType + invalidList.push(item); + this.setData({invalidList}); + } + }, //-------------获取购物车列表,要安装门店进行分类订单----------- getCardList: function () { - + this.setData({invalidList:[]}); //重置失效商品 var th = this; //要获取会员是不是等级会员 @@ -218,6 +251,156 @@ Page({ }, 800) } }, + //失效单选 + inCheck_th_item: async function(e){ + console.log('失效单选'); + console.log(e); + let i = e.currentTarget.dataset.item; + let invalidList = this.data.invalidList; + console.log(i) + console.log(invalidList[i]) + invalidList[i].selected = invalidList[i].selected == 1 ? 0 : 1; + console.log(invalidList); + this.setData({invalidList}); + console.log(this.data.invalidList); + // this.doCheckAll(); + + }, + //清空失效宝贝 + delInva(obj=null){ + let ainvalid=''; + let binvalid=''; + var user_id = getApp().globalData.user_id; + var th = this; + let ab = 0; //选中 + let abc = 0; // + let arr = obj.id ? [obj] : this.data.invalidList + console.log('失效-----') + console.log(arr); + arr.map(item=>{ + if (item.classType ==0 ) { + ainvalid+=item.id + ','; + ab = 1; + } + if (item.classType ==1 ) { + binvalid+=item.id + ','; + abc = 1; + } + }); + + + if (ab == 0 && abc == 0 ) { + t.my_warnning('没有需要清空的失效宝贝', 0, th); + return false; + } + if (ab) { + ainvalid = ainvalid.substring(0, ainvalid.length - 1); + //要删除购物车中的商品 + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; + getApp().request.delete(url, { + success: function (t) { + th.getCardList(); + getApp().requestCardNum(th); + } + }); + } + if (abc) { + binvalid = binvalid.substring(0, binvalid.length - 1); + //要删除购物车中的商品 + var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; + getApp().request.delete(url, { + success: function (t) { + th.getCardList(); + getApp().requestCardNum(th); + } + }); + } + }, + + //---------点击收藏------------ + collectGoods: async function () { + + let t = this + let timestamp = Date.parse(new Date()); + timestamp = timestamp / 1000; + let d = { + // goods_id: t.data.data.goods_id, + user_id: app.globalData.user_id, + store_id: oo.stoid, + add_time: timestamp, + }; + //加入收藏夹就是导购的ID + if (getApp().globalData.guide_id) { + d.guide_id = getApp().globalData.guide_id; + d.guide_type = 2; + } + let off = false + let errOff = false + var invalidList= [...this.data.invalidList] + var arr=[] + invalidList.map(async (item,index)=>{ + if (item.selected) { + off = true + if(item.classType ==1 ){ + d.goods_id = item.service_id + d.type = 1 + }else{ + d.goods_id = item.goods_id + d.type =0 + } + let is_collect = 0 + //------是否收藏---------- + await getApp().request.promiseGet("/api/weshop/goodscollect/page", { + data: { + store_id: oo.stoid, + goods_id: d.goods_id, + user_id: app.globalData.user_id, + } + }).then(res => { + let t = res; + let data = t.data.data.pageData; + if (data && data.length > 0) { + is_collect =1 + } + }) + if (is_collect) { + t.delInva(item) + return + } + await getApp().request.post("/api/weshop/goodscollect/save", { //添加收藏 + data: d, + success: function (e) { + t.data.is_collect_load = 0; + if (e.data.code == 0) { + t.delInva(item) + }else{ + errOff = true + arr.push(item) + } + } + }); + }else{ + arr.push(item) + } + }); + if (off) { + t.setData({ + invalidList:arr + }) + if (errOff) { + getApp().my_warnning('移到收藏夹错误', 0, t); + }else{ + wx.showToast({ + title: "收藏成功", + icon: 'none', + duration: 2000 + }) + } + console.log('移动成功') + }else{ + getApp().my_warnning('请先选择失效宝贝', 0, t); + } + }, //-----真的获取购物车-------- get_cart: function () { @@ -287,10 +470,11 @@ Page({ var tt = ut.gettimestamp(); //如果商品下架了,或者商品是赠品,一开始都要清除 if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, { - success: function (t) {} - }); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, { + // success: function (t) {} + // }); + th.disInvalid(item,1); //商品已经下架 continue; } @@ -307,8 +491,9 @@ Page({ if (item.goods_num + goodsbuynum > limit && limit > 0) { var cbuy = limit - goodsbuynum; if (cbuy <= 0) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - a.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // a.delete(url, {}); + th.disInvalid(item,2); continue; } //-- 购物车更新 -- @@ -323,23 +508,72 @@ Page({ }) item.goods_num = cbuy; } - + //判断如果是普通商品,后面参加活动了,变成失效商品 + if (item.prom_type == 0) { + var prom = null; + var now = ut.gettimestamp(); + await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, { + data:{ + "store_id": oo.stoid, + "goods_id": item.goods_id, + "user_id": user_id, + } + }).then(res => { + if (res.data.code == 0) { + prom = res.data.data + } + }) + let prom_true = 0 + let prom_id=0 + if (prom) { + prom.map(item=>{ + if (item.prom_type==3 || item.prom_type==7) { + prom_true = item.prom_type + prom_id = item.act_id + } + }) + } + if (prom_true) { + //-- 购物车更新 -- + var updata1 = { + id: item.id, + prom_type: prom_true, + prom_id, + store_id: os.stoid, + user_id: getApp().globalData.userInfo.user_id + }; + item.prom_id = prom_id + item.prom_type = prom_true + getApp().request.put("/api/weshop/cart/update", { + data: updata1, + }) + + }else{ + if(prom && !item.is_integral_normal && !item.is_pd_normal){ + th.disInvalid(item); + continue; + } + } + } //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 if (item.prom_type == 1) { var prom = null; var now = ut.gettimestamp(); await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => { - if (res.data.code == 0) { + console.log('活动情况----------------') + console.log(res) + if (res.data.code == 0) { prom = res.data.data; prom.price = prom.user_price; } }) //---如果互动都已经过期,或者还未开始,或者无活动 if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - a.delete(url, { - success: function (t) {} - }); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // a.delete(url, { + // success: function (t) {} + // }); + th.disInvalid(item); //商品已经下架 continue; } @@ -348,8 +582,9 @@ Page({ if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { var cbuy = prom.buy_limit - promgoodsbuynum; if (cbuy <= 0) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - a.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // a.delete(url, {}); + th.disInvalid(item,2); continue; } //-- 购物车更新 -- @@ -380,6 +615,30 @@ Page({ }) } } + // 判断团购活动都去掉了,或者结束了,那么这个商品也没有必要留着 + else if(item.prom_type ==2){ + var prom = null; + var now = ut.gettimestamp(); + await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/' + item.goods_id + '/' + user_id + '/' + item.prom_id, {}).then(res => { + if (res.data.code == 0) { + prom = res.data.data; + prom.price = prom.user_price; + } + }); + //---如果互动都已经过期,或者还未开始,或者无活动 + if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // a.delete(url, { + // success: function (t) {} + // }); + console.log('团购活动-----'); + th.disInvalid(item); + //商品已经下架 + continue; + } + + + } //--判断优惠活动有没有过期,-- else if (item.prom_type == 3) { var isok = 1,is_g_prom=0; @@ -405,23 +664,26 @@ Page({ if (res.data.code == 0) { var r_data = res.data.data; if (!r_data.promGoodsLists) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); //商品已经无活动 isok = 0; } else { //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 if (item.prom_id != r_data.promGoodsLists[0].prom_id) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); //商品已经下架 isok = 0; } } } else { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); //商品已经下架 isok = 0; } @@ -432,23 +694,26 @@ Page({ if (res.data.code == 0) { var r_data = res.data.data; if (!r_data.promGoodsLists) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); //商品已经无活动 isok = 0; } else { //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 if (item.prom_id != r_data.promGoodsLists[0].prom_id) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); //商品已经下架 isok = 0; } } } else { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item,1); //商品已经下架 isok = 0; } @@ -492,8 +757,9 @@ Page({ } }) if (!isok) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); th.data.zuhe_map[item.prom_id] = -1; continue; } @@ -530,8 +796,9 @@ Page({ return ele.goods_id == item.goods_id }) if (!t_item) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item,1); th.data.zuhe_map[item.prom_id] = -1; continue; } @@ -578,8 +845,9 @@ Page({ } }) if (!isok){ - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item,1); th.data.ladder_map[item.prom_id]=-1; continue; } @@ -818,6 +1086,7 @@ Page({ //-----真的获取购物车-------- get_ser_cart: function () { var th = this; + var user_id = getApp().globalData.user_id; var rd = Math.random().toString(36).substr(2, 15); getApp().request.get("/api/weshop/cartService/page", { data: { @@ -841,23 +1110,101 @@ Page({ good = res.data.data; }) if (!good) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, { - success: function (t) {} - }); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, { + // success: function (t) {} + // }); + th.disInvalid({ + ...item, + original_img: good.imgUrl + },1,1); continue; } - + //如果商品下架了,或者商品是赠品,一开始都要清除 if (good.is_show == 0) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, { - success: function (t) {} - }); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, { + // success: function (t) {} + // }); + th.disInvalid({ + ...item, + original_img: good.imgUrl + },1,1); //商品已经下架 continue; } + if(item.prom_type ==0){ + var prom = null; + var now = ut.gettimestamp(); + await getApp().request.promiseGet(`/api/weshop/activitylist/listGoodActInfo2`, { + data:{ + store_id: oo.stoid, + goods_id: item.service_id, + user_id: user_id, + goods_type: 1, + } + }).then(res => { + console.log('服务卡活动信息') + console.log(res) + console.log('服务卡活动信息-------------') + if (res.data.code == 0) { + prom = res.data.data + } + }) + if(prom){ + th.disInvalid({ + ...item, + original_img: good.imgUrl + },2,1) + continue; + } + } + + if (item.prom_type == 1) { + var prom = null; + var now = ut.gettimestamp(); + await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + os.stoid + '/' + user_id + '/' + item.prom_id, {}).then(res => { + if (res.data.code == 0) { + prom = res.data.data; + prom.price = prom.user_price; + } + }); + console.log('服务的秒杀信息') + console.log(prom) + //---如果互动都已经过期,或者还未开始,或者无活动 + if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { + th.disInvalid({ + ...item, + original_img: good.imgUrl + },0,1); + continue; + } + //判断秒杀的限购 + var msNum=0 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + card_id: prom.goods_id, + } + }).then(res=>{ + if (res.data.code==0) { + msNum = res.data.data.cardbuynum + console.log('秒杀限购:'+msNum) + } + }) + } + if (msNum && (msNum >= prom.buy_limit) ) { + console.log('秒杀限购') + th.disInvalid({ + ...item, + original_img: good.imgUrl + },2,1) + continue; + } + all_num += item.goods_num; item.img_url = oo.imghost + good.imgUrl; item.selected = 0; @@ -912,6 +1259,7 @@ Page({ }, + //设置莫个门店的所有线下价格 async set_offline(list) { var th = this; @@ -1625,6 +1973,11 @@ Page({ } else { if(item[c].prom_type==7){ //先把商品放入组合计算的专用的区域 + console.log('是组合商品---') + console.log(car); + console.log(a) + console.log(obj) + console.log('......................') zh_calc.add_zhprom(car,a,obj); }else if(item[c].prom_type==10){ ladder_calc.add_ladder_prom(car,a,obj); @@ -1644,6 +1997,8 @@ Page({ //总的价格,把组合商品的价格拿出来 var zh_calc_res=zh_calc.calculate_zh(car,a,th); + console.log('.组合价-----------') + console.log(zh_calc_res) //总的价格,把阶梯促销商品的价格拿出来 var ladder_calc_res=ladder_calc.calculate_ladder(car,a,th); @@ -2536,6 +2891,23 @@ Page({ } } } + + //排除失效商品结算 + this.data.invalidList.map(item=>{ + if(item.selected && item.classType==0){ + rq.put('/api/weshop/cart/update', { + data: { + id: item.id, + selected: 0, + store_id: oo.stoid + }, + success: function (ee) { + console.log(ee); + } + }); + } + }) + if (ab == 0) { t.my_warnning("未选择商品", 0, th); wx.hideLoading(); @@ -2715,6 +3087,18 @@ Page({ }); } } + //排除失效服务结算 + this.data.invalidList.map(item=>{ + if(item.selected && item.classType==1){ + rq.promisePut('/api/weshop/cartService/update', { + data: { + id: item.id, + selected: 0, + store_id: oo.stoid + } + }); + } + }) wx.hideLoading(); getApp().goto("/packageA/pages/cart2_ser/cart2_ser?is_cart=1"); } @@ -2923,8 +3307,9 @@ Page({ var item = list.goods[ii]; list.goods.splice(ii, 1); if (item.prom_id == p_item[0] && item.prom_type == 3) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); } } continue; @@ -3227,8 +3612,9 @@ Page({ var item = list.goods[ii]; list.goods.splice(ii, 1); if (item.prom_id == p_item[0] && item.prom_type == 3) { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // getApp().request.delete(url, {}); + th.disInvalid(item); } } continue; diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 60d4283..b9dadfd 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -238,8 +238,42 @@ - - + + + + + + 失效宝贝{{invalidList.length}}件 + + 移到收藏夹 + 清空失效宝贝 + + + + + + + + + + + + + + + {{items.goods_name || items.service_name}} + + + + + {{items.invalid}} + + + + + + + diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss index 0858710..7a4bfb3 100644 --- a/pages/cart/cart/cart.wxss +++ b/pages/cart/cart/cart.wxss @@ -222,7 +222,7 @@ radio { } .store { - border-bottom: 7rpx solid rgb(245, 245, 245); + /* border-bottom: 7rpx solid rgb(245, 245, 245); */ } .login-in { position: relative; diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 34ea947..1de29b5 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -286,13 +286,16 @@ Page({ if (json_str) { var json_data = JSON.parse(json_str); + console.log('自定义海报参数-------'); + console.log(json_data); if (json_data.bg_img) { - + //-- 把图片那到本地 -- wx.getImageInfo({ src: json_data.bg_img, success: function (res) { var path = res.path; + th.setData({share_b_img: path}) }, fail: function (res) { @@ -5044,7 +5047,8 @@ Page({ if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; - + console.log('商品类型。。。。。'); + console.log(type); wx.showLoading({title: '生成中...',}) var that = this, th = that; //设置画板显示,才能开始绘图 @@ -5094,17 +5098,21 @@ Page({ // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - if (type == 0 || type == 1 || type == 2 || type == 3) { // 如果是普通商品,绘制新海报 + if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3)){ // 如果是普通商品,绘制新海报 th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); } else { context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); }; - + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); //-- 是自定义海报的情况下 -- - if (type != 0 && type != 1 && type != 2 && type != 3) { + if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { if (th.data.poster && parseInt(th.data.poster.style) == 2) { //在线上分享人的情况下 @@ -5158,7 +5166,7 @@ Page({ //---产品名称--- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 - if (type != 4 && type != 0 && type != 1 && type != 2 && type != 3) { + if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { context.setFillStyle("black"); context.setFontSize(21.3 * unit) getApp().draw_Text(context, share_title, @@ -5195,7 +5203,7 @@ Page({ context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); context.stroke();--*/ - } else if (type == 4 && type != 0 && type != 1 && type != 2 && type != 3) { + } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) { context.setFillStyle("black"); context.setFontSize(21.3 * unit) getApp().draw_Text(context, share_title, @@ -5223,18 +5231,56 @@ Page({ } //---中间大图--- - if (type != 0 && type != 1 && type != 2 && type != 3) { + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); } ; + + //---自定义海报 产品质量保证 + if(th.data.share_b_img && th.data.poster.show_quality==1 && type==0){ + var g_path = "../../../images/share/s_gou.png"; + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("正品保证", 84 * unit, 690 * unit); + + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("纯实体店", 246 * unit, 690 * unit); + + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("官方验证", 420 * unit, 690 * unit); - - //-------大图后面就不一样了----------- + } + //-------大图后面就不一样了----------- switch (type) { case 0: + if(!th.data.share_b_img){ + break + } + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 710 * unit) + context.lineTo(520 * unit, 710 * unit) + context.stroke(); + //---文字--- + context.setFillStyle("black") + context.setFontSize(22 * unit) + // 原来start ---> + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); + // <--- 原来end + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); + // context.setFontSize(18 * unit) + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); + //---二维吗图--- + context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); break;//普通商品的展示 case 4: - //中间的几个字 + // 中间的几个字 if (th.data.poster && parseInt(th.data.poster.style) == 2) { if (parseInt(th.data.poster.show_quality)) { var g_path = "../../../images/share/s_gou.png"; @@ -5303,7 +5349,7 @@ Page({ //---二维吗图--- //-- 自定义海报 -- - if (th.data.poster) { + if (th.data.share_b_img || th.data.poster) { var erm_x = parseFloat(th.data.poster.ewm_x) * 2; var erm_y = parseFloat(th.data.poster.ewm_y) * 2; context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); @@ -5314,7 +5360,10 @@ Page({ ; break; - case -12: //秒杀商品的展示 + case 1: //秒杀商品的展示 + if(!th.data.share_b_img){ + break + } //---画线--- context.setLineWidth(1 * unit) context.moveTo(32 * unit, 670 * unit) @@ -5337,7 +5386,7 @@ Page({ //---二维吗图--- //-- 自定义海报 -- - if (th.data.poster) { + if (th.data.share_b_img || th.data.poster) { var erm_x = parseFloat(th.data.poster.ewm_x) * 2; var erm_y = parseFloat(th.data.poster.ewm_y) * 2; context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); @@ -5347,7 +5396,10 @@ Page({ } break; - case -2: //会员团和商家团的展示 + case 2: //会员团和商家团的展示 + if(!th.data.share_b_img){ + break + } //---画线--- context.setLineWidth(1 * unit) context.moveTo(32 * unit, 670 * unit) @@ -5383,7 +5435,7 @@ Page({ //---二维吗图--- //-- 自定义海报 -- - if (th.data.poster) { + if (th.data.share_b_img || th.data.poster) { var erm_x = parseFloat(th.data.poster.ewm_x) * 2; var erm_y = parseFloat(th.data.poster.ewm_y) * 2; context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); @@ -5392,7 +5444,10 @@ Page({ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); } break - case -3: //阶梯团的展示 + case 3: //阶梯团的展示 + if(!th.data.share_b_img){ + break + } //---画线--- context.setLineWidth(1 * unit) context.moveTo(32 * unit, 670 * unit) @@ -5428,7 +5483,7 @@ Page({ //-- 自定义海报 -- - if (th.data.poster) { + if (th.data.share_b_img || th.data.poster) { var erm_x = parseFloat(th.data.poster.ewm_x) * 2; var erm_y = parseFloat(th.data.poster.ewm_y) * 2; context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); @@ -5459,7 +5514,7 @@ Page({ //---二维吗图--- //-- 自定义海报 -- - if (th.data.poster) { + if (th.data.share_b_img || th.data.poster) { var erm_x = parseFloat(th.data.poster.ewm_x) * 2; var erm_y = parseFloat(th.data.poster.ewm_y) * 2; context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); @@ -5474,7 +5529,7 @@ Page({ //--- 如果是自定义海报的时候 --- - if (type != 0 && type != 1 && type != 2 && type != 3) { + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { if (th.data.poster && parseInt(th.data.poster.style) == 2) { diff --git a/pages/index/index/index.js b/pages/index/index/index.js index e076bd2..12e8ac3 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -14,7 +14,7 @@ var e = function (e) { var regeneratorRuntime = require('../../../utils/runtime.js'); var api = require('../../../api/api.js'); var d = getApp().globalData; - + var full_screen = require('full_screen.js'); @@ -78,7 +78,7 @@ Page({ showHongbao: false, showHongbaoSmall: false, - + goodsGroupArr:[], //商品模块列表 is_full_screen_show: 0, //全屏显示 sec_show: 3, //倒计时的秒数 full_ad: null, //全屏广告 @@ -297,8 +297,34 @@ Page({ }); } }) - }, - + }, + onReady(){ + console.log('渲染完成----') + console.log(this.data.template_arr); + console.log('....................'); + }, + + //获取商品模块实例 + newGoodsGroup(){ + let arr=[] + if (this.data.template_arr.length == 0) { + return + } + this.data.template_arr.map((item,index)=>{ + if (item.ename == 'goodsGroup') { + arr.push(`goodsGroup${index}`) + } + }) + if (arr.length > 0) { + this.setData({ + goodsGroupArr : arr + }) + arr.map(item=>{ + let a = '.'+item + this[item] = this.selectComponent(a); + }) + } + }, //关闭新用户领取广告 close_disgraceful: function () { @@ -523,13 +549,17 @@ Page({ if (data && data.length > 0) { var temp_data = data[0]; var t_arr = JSON.parse(temp_data.json_str); - + console.log('商品列表------------1') + console.log(t_arr) + console.log('商品列表------------2') th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor - }); - + }); + setTimeout(()=>{ + th.newGoodsGroup() + },1000) //---如果有设定顶部的颜色的时候-- if (temp_data.top_color && temp_data.top_color != 'null') { @@ -723,6 +753,8 @@ Page({ }, //---加载更多是靠这个函数---- onReachBottom: function () { + console.log('下拉加载2'); + var goods_list = this.selectComponent("#goods_list"); //组件的id if (goods_list) goods_list.get_list(); @@ -731,7 +763,17 @@ Page({ let item = getApp().globalData.func_list[i]; item.re_show(); } - } + } + + + //自定义时商品自动加载更多 + let goodsGroupArr = this.data.goodsGroupArr + if (this.data.isTemplate && goodsGroupArr.length >0) { + goodsGroupArr.map(item=>{ + this[item].automore() + }) + } + }, onPullDownRefresh: function (e) { @@ -1226,8 +1268,26 @@ Page({ getApp().goto(url); }, - - + //视频号跳转 + nv_void(){ + // getApp().openChannelsActivity() + wx.getChannelsLiveInfo({ + finderUserName:'sphYA5FuPCZxHaw', + success:(res)=>{ + console.log(res) + }, + fail:(error)=>{ + console.log(error) + } + }) + }, + getchir(){ + const child = this.selectComponent('.goodsg'); + console.log('子组件--------111111------') + console.log(child) + console.log('子组件----------2222----') + + }, }); diff --git a/pages/index/index/index.json b/pages/index/index/index.json index e3ab55c..5cc0ca5 100644 --- a/pages/index/index/index.json +++ b/pages/index/index/index.json @@ -26,5 +26,6 @@ "mp-dialog": "weui-miniprogram/dialog/dialog", "mp-sticky": "/components/mp-sticky/mp-sticky" }, - "enablePullDownRefresh": false + "enablePullDownRefresh": false, + "onReachBottomDistance":300 } \ No newline at end of file diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 0594e04..182b918 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -417,7 +417,7 @@ - + diff --git a/pages/template/index.js b/pages/template/index.js index 2c7e9c2..f8b6b28 100644 --- a/pages/template/index.js +++ b/pages/template/index.js @@ -11,7 +11,8 @@ var t = getApp(), Page({ data: { url: os.imghost, - temp_id:0, + temp_id:0, + goodsGroupArr:[] }, onLoad: function(e) { @@ -46,7 +47,27 @@ Page({ } }, - + //获取商品模块实例 + newGoodsGroup(){ + let arr=[] + if (this.data.template_arr.length == 0) { + return + } + this.data.template_arr.map((item,index)=>{ + if (item.ename == 'goodsGroup') { + arr.push(`goodsGroup${index}`) + } + }) + if (arr.length > 0) { + this.setData({ + goodsGroupArr : arr + }) + arr.map(item=>{ + let a = '.'+item + this[item] = this.selectComponent(a); + }) + } + }, //当隐藏的时候就关闭计时器 onHide: function() { @@ -70,6 +91,9 @@ Page({ isTemplate: 1, bgcolor_t: temp_data.bkcolor }); + setTimeout(()=>{ + th.newGoodsGroup() + },1000) //---如果有设定顶部的颜色的时候-- if(temp_data.top_color && temp_data.top_color!='null' ){ @@ -156,6 +180,14 @@ Page({ item.re_show(); } } + + //自定义时商品自动加载更多 + let goodsGroupArr = this.data.goodsGroupArr + if (this.data.isTemplate && goodsGroupArr.length >0) { + goodsGroupArr.map(item=>{ + this[item].automore() + }) + } }, diff --git a/pages/template/index.json b/pages/template/index.json index c8f5ff7..dca47df 100644 --- a/pages/template/index.json +++ b/pages/template/index.json @@ -22,5 +22,6 @@ "scan": "/components/diy_scan/diy_scan", "presell": "/components/diy_pregoods/diy_pregoods" }, - "enablePullDownRefresh": false + "enablePullDownRefresh": false, + "onReachBottomDistance":300 } \ No newline at end of file diff --git a/pages/template/index.wxml b/pages/template/index.wxml index 405353f..0c62bce 100644 --- a/pages/template/index.wxml +++ b/pages/template/index.wxml @@ -15,7 +15,7 @@ - + diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 1174760..95de390 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -10,7 +10,7 @@ var t = function(t) { oo = e.globalData, r = e.request, rq = r, - a = require("../../../utils/common.js"), + a = require("../../../utils/common.js"), s = new t.default(); var regeneratorRuntime = require('../../../utils/runtime.js'); var ut= require('../../../utils/util.js'); @@ -481,6 +481,45 @@ Page({ } }); }, + //-----删除订单----- + deleteSerOrderData: function(t) { + var th = this; + var order_id = t.currentTarget.dataset.orderid; + let order_sn = t.currentTarget.dataset.ordersn; + var index = t.currentTarget.dataset.index; + // var up_data={order_id: order_id,isdel:1}; + // var order=th.data.orderList[index]; + // if(order.order_status!=6){ + // up_data.order_status=5; + // } + wx.showModal({ + title: "是否删除订单?", + success: function(tt) { + tt.confirm && rq.put("/api/weshop/recharge/update", { + data: { + store_id: os.stoid, + order_id: order_id, + order_sn: order_sn, + order_status: 5, + }, + success: function(t) { + let cardList = th.data.cardList + cardList.splice(index,1) + th.setData({ + cardList + }) + // for (var e = 0; e < th.data.orderList.length; e++) + // if (th.data.orderList[e].order_id == order_id) { + // th.data.orderList.splice(e, 1), th.setData({ + // orderList: th.data.orderList + // }); + // break; + // } + } + }) + } + }); + }, deleteOrderData2: function(order_id) { var th = this; diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index d1c347d..dd0a79d 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -73,8 +73,12 @@ 待发货 待收货 - 待评价 - 已评价 + 待评价 + + + 已评价 + + 已取消 @@ -90,8 +94,12 @@ 未支付 待发货 待收货 - 待评价 - 已评价 + 待评价 + + + 已评价 + + 已取消 @@ -103,8 +111,12 @@ 待发货 待收货 - 待评价 - 已评价 + 待评价 + + + 已评价 + + 已取消 @@ -294,9 +306,15 @@ 待支付 - 待评价 - 已评价 - 已取消 + 待评价 + + + 已评价 + + + 已取消 + + 已作废 @@ -367,7 +385,7 @@ 取消订单 - + 订单详情 diff --git a/utils/wxParse/wxParse.wxss b/utils/wxParse/wxParse.wxss index 11f43ac..8a56072 100644 --- a/utils/wxParse/wxParse.wxss +++ b/utils/wxParse/wxParse.wxss @@ -178,6 +178,7 @@ view.wxParse view{ .wxParse-li-text { align-items: center; line-height: 20px; + position: relative; } .wxParse-li-circle {