diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index ac15a10..ebfd0dd 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -504,7 +504,7 @@ Component({ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { var arr = res.data.data[0]; item.prom_price = arr.luck_goods_price; - item.sales_sum=arr.buy_goodnum + item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); } }) break; @@ -517,9 +517,12 @@ Component({ var prom =null; if(res && res.data) prom=res.data.data; if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time { - // console.log('获取广告', res); if(res.data.code == 0) { self.setData({ adList: res.data.data.pageData, }); }; - }); // 获取列表 @@ -72,8 +54,6 @@ Page({ }; - - }; }, diff --git a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.wxml b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.wxml index 693287a..bf4862b 100644 --- a/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.wxml +++ b/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.wxml @@ -11,11 +11,11 @@ - - + - + + {{item.title}} @@ -26,8 +26,7 @@ - 去参团 - + 去参团 diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js index 50a27e4..1ee2e18 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js @@ -46,10 +46,15 @@ Page({ showRules: false, + isSuccess: false, + showPoster: false, }, onLoad: function (t) { - // wx.setNavigationBarTitle({ title: "拼团订单",}) - // console.log('options========>', t); + if(t.team_id != null && t.team_id !=undefined) { + this.setData({ + team_id: t.team_id, + }); + }; this.setData({ param: t, }); @@ -93,8 +98,22 @@ Page({ }) }, + onShow: function() { + this.get_team_info(); + }, + + + + + onUnload: function () { + // 开团成功后,清除storage里的team_id + if(this.data.luckyGoInfo.num && this.data.luckyGoInfo.num == 0) { + wx.removeStorageSync('team_id'); + }; + }, + //关闭展开列表 - click:function(e){ + click: function(e) { this.setData({ hiddenName: !this.data.hiddenName, zk: !this.data.zk, @@ -102,7 +121,7 @@ Page({ }, //打开收起拼团列表 - czk:function(e){ + czk: function(e) { this.setData({ zk:!this.data.zk, hiddenName: !this.data.hiddenName, @@ -110,28 +129,28 @@ Page({ }, //打开蒙板提示 - cmeng:function(e){ + cmeng: function(e) { this.setData({ meng:!this.data.meng, }) }, //关闭蒙板提示 - cmc:function(e){ + cmc: function(e) { this.setData({ meng: !this.data.meng, }) }, //打开二维码提示 - cerweima:function(e){ + cerweima: function(e) { this.setData({ meng: !this.data.meng, erweima: !this.data.erweima, }) }, - cerc:function(e){ + cerc: function(e) { this.setData({ erweima: !this.data.erweima, meng: !this.data.meng, @@ -164,116 +183,81 @@ Page({ // data: {orderSn:order_sn,storeId:os.stoid } // }) - // 幸运购成团信息 - await getApp().request.promiseGet("/api/weshop/prom/luckyActivity/page", { - data: { - store_id: o.stoid, - is_end: 0, - timetype: 1, - id: this.data.param.group_id, - } - }).then(res => { - var luckyGoInfo = res.data.data.pageData[0]; - console.log('成团信息====>', luckyGoInfo); - th.setData({ - luckyGoInfo, - }); - //参团成功后,保存team_id - wx.setStorage({ - key: 'team_id', - data: luckyGoInfo.team_id, - }) - //如果team_id为0, 表示当前已开启新的一期,文字提示应改为’参团成功,本期幸运购已开团,中奖结果可点击下方查看参团列表‘ - //如果team_id为0,取出之前保存的team_id替换掉,请求上一期已成团的幸运购活动 - }) - // 幸运购成团成员 - await getApp().request.promiseGet("/api/weshop/prom/luckyOrder/page", { - data: { - store_id: o.stoid, - team_id: this.data.luckyGoInfo.team_id, - } - }).then(res => { - console.log('成团成员====>', res.data.data.pageData); - th.setData({ - luckyGoMembers: res.data.data.pageData, - }); - }) - //获取order信息根据订单编号order_sn - await getApp().request.promiseGet("/api/weshop/order/page", { - data: { store_id: o.stoid, order_sn: order_sn,} - }).then(res => { - console.log('获取order信息====>', order); - order = res.data.data.pageData[0]; - pt_prom_id = order.pt_prom_id; - pt_listno = order.pt_listno; - }) - - if (this.data.payf || order.pt_status == 3) p_status = 3; //失败 - if (order.pt_status == 2 || order.pt_status == 4 || order.pt_status == 5) - p_status = 2; //成功 - if (order.pt_status < 2 && !this.data.payf) - p_status = 1; //正在进行 - if ( order.pt_status == 6) p_status = 4; //支付尾款失败 - - //多少人参团头像 - // await getApp().request.promiseGet("/api/weshop/order/pagePtList", { - // data: { store_id: o.stoid, pt_listno: pt_listno, } - // }).then(res => { - // ordertx = res.data.data.pageData; - // }) - - - var min_price=0; - //获取活动表的信息根据活动pt_prom_id - await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + pt_prom_id, { - data: { } - }).then(res => { - if (res.data.code==0){ - teamlist = res.data.data; - this.setData({teamlist: teamlist}); - //获取当前时间,并且判断剩余时间 - var nt = ut.gettimestamp(); - teamlist.status = 0; - if (nt >= teamlist.start_time) teamlist.status = 1; - - goods_id = res.data.data.goods_id; - id = res.data.data.id; - share_img = ee.data.imageurl + res.data.data.share_imgurl; - - //----------查看阶梯团------------ - if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){ - var ct_rylist = JSON.parse(teamlist.ct_rylist); - var max=0; var pri=0; - ct_rylist.forEach(function (val,ind) { - if(val.rynum>max){ - max=val.rynum; - pri = val.price; - } - }) - max_num=max; - min_price=pri; + // await getApp().request.promiseGet("/api/weshop/order/page", { + // data: { store_id: o.stoid, order_sn: order_sn,} + // }).then(res => { + // console.log('获取order信息====>', order); + // order = res.data.data.pageData[0]; + // pt_prom_id = order.pt_prom_id; + // pt_listno = order.pt_listno; + // }) + + // if (this.data.payf || order.pt_status == 3) p_status = 3; //失败 + // if (order.pt_status == 2 || order.pt_status == 4 || order.pt_status == 5) + // p_status = 2; //成功 + // if (order.pt_status < 2 && !this.data.payf) + // p_status = 1; //正在进行 + // if ( order.pt_status == 6) p_status = 4; //支付尾款失败 + + // //多少人参团头像 + // // await getApp().request.promiseGet("/api/weshop/order/pagePtList", { + // // data: { store_id: o.stoid, pt_listno: pt_listno, } + // // }).then(res => { + // // ordertx = res.data.data.pageData; + // // }) + + + // var min_price=0; + // //获取活动表的信息根据活动pt_prom_id + // await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + pt_prom_id, { + // data: { } + // }).then(res => { + // if (res.data.code==0){ + // teamlist = res.data.data; + // this.setData({teamlist: teamlist}); + // //获取当前时间,并且判断剩余时间 + // var nt = ut.gettimestamp(); + // teamlist.status = 0; + // if (nt >= teamlist.start_time) teamlist.status = 1; + + // goods_id = res.data.data.goods_id; + // id = res.data.data.id; + // share_img = ee.data.imageurl + res.data.data.share_imgurl; + + // //----------查看阶梯团------------ + // if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){ + // var ct_rylist = JSON.parse(teamlist.ct_rylist); + // var max=0; var pri=0; + // ct_rylist.forEach(function (val,ind) { + // if(val.rynum>max){ + // max=val.rynum; + // pri = val.price; + // } + // }) + // max_num=max; + // min_price=pri; - } + // } - //获取商品信息 - getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { - }).then(res => { - //商品地址 - original_img = ee.data.imageurl+ res.data.data.original_img, - goods = res.data.data + // //获取商品信息 + // getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { + // }).then(res => { + // //商品地址 + // original_img = ee.data.imageurl+ res.data.data.original_img, + // goods = res.data.data - ee.setData({goods: goods,image: original_img,}) + // ee.setData({goods: goods,image: original_img,}) - }) + // }) - } - }) + // } + // }) //只装5个 @@ -299,28 +283,28 @@ Page({ //获取活动从表信息team_id:305暂时 - await getApp().request.promiseGet("/api/weshop/teamgroup/page" , { - data: { store_id: os.stoid, listno: pt_listno, team_id: pt_prom_id } - }).then(res => { - teamgroup = res.data.data.pageData[0]; - if (teamgroup){ - var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); - teamgroup.buy_start_date=buy_start_date; - } - }) + // await getApp().request.promiseGet("/api/weshop/teamgroup/page" , { + // data: { store_id: os.stoid, listno: pt_listno, team_id: pt_prom_id } + // }).then(res => { + // teamgroup = res.data.data.pageData[0]; + // if (teamgroup){ + // var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); + // teamgroup.buy_start_date=buy_start_date; + // } + // }) - var ct_price = 0, - num_0 = ordertx.length; - if (teamlist.kttype == 3){ - var js_data = JSON.parse(teamlist.ct_rylist); - js_data.forEach(function (val,ind) { - if (num_0<=val.rynum && ct_price==0){ - ct_price=val.price; - } - }) - if(ct_price==0) ct_price=min_price; - } + // var ct_price = 0, + // num_0 = ordertx.length; + // if (teamlist.kttype == 3){ + // var js_data = JSON.parse(teamlist.ct_rylist); + // js_data.forEach(function (val,ind) { + // if (num_0<=val.rynum && ct_price==0){ + // ct_price=val.price; + // } + // }) + // if(ct_price==0) ct_price=min_price; + // } //获取大家都在团信息 getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , { @@ -334,416 +318,520 @@ Page({ }) //--当是成团的时候的操作-- - if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ - //设置值 - - ee.setData({ - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price, - order: order, share_img: share_img,max_num:max_num, - pindGoods: teamlist,is_show:1, zk:false, - hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr}); - - //--是否支付了尾款-- - if(order.pt_status==4 || order.pt_status==5){ - ee.setData({is_pay_wk:1}); - } - }else{ - console.log("239什么鬼", teamlist); - //设置值 - ee.setData({ - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, - order: order, p_status: p_status, min_price:min_price, - share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1, - ct_price: ct_price, p_status: p_status,sf_arr:sf_arr}); - } + // if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ + // //设置值 + + // ee.setData({ + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price, + // order: order, share_img: share_img,max_num:max_num, + // pindGoods: teamlist,is_show:1, zk:false, + // hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr}); + + // //--是否支付了尾款-- + // if(order.pt_status==4 || order.pt_status==5){ + // ee.setData({is_pay_wk:1}); + // } + // }else{ + // console.log("239什么鬼", teamlist); + // //设置值 + // ee.setData({ + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, + // order: order, p_status: p_status, min_price:min_price, + // share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1, + // ct_price: ct_price, p_status: p_status,sf_arr:sf_arr}); + // } wx.hideLoading(); wx.setNavigationBarTitle({ title: "拼团详情", - }) + }); - ee.countDown2(); + // ee.countDown2(); //获取分享图片的本地地址 - var path2 = os.imghost + teamlist.share_imgurl; - wx.getImageInfo({ - src: path2, - success: function (res) { - //res.path是网络图片的本地地址 - ee.data.share_img_localpath = res.path; - }, - fail: function (res) { - //失败回调 - } - }); + // var path2 = os.imghost + th.data.luckyGoInfo.original_img; + // wx.getImageInfo({ + // src: path2, + // success: function (res) { + // //res.path是网络图片的本地地址 + // ee.data.share_img_localpath = res.path; + // }, + // fail: function (res) { + // //失败回调 + // } + // }); }, //---小于10的格式化函数---- - timeFormat(param) { - return param < 10 ? '0' + param : param; - }, - countDown2() { - var th = this; - // 获取当前时间,同时得到活动结束时间数组 - var newTime = ut.gettimestamp(); - var o = this.data.teamgroup; - if(!o) return false; + // timeFormat(param) { + // return param < 10 ? '0' + param : param; + // }, + // countDown2() { + // var th = this; + // // 获取当前时间,同时得到活动结束时间数组 + // var newTime = ut.gettimestamp(); + // var o = this.data.teamgroup; + // if(!o) return false; - var endTime = o.kt_end_time; - if (o.status == 0) endTime = o.start_time; + // var endTime = o.kt_end_time; + // if (o.status == 0) endTime = o.start_time; - //看一下,是否要支付尾款 - if(o.team_type==3 && th.data.order.pt_status==2){ - endTime = o.wk_end_time; - } + // //看一下,是否要支付尾款 + // if(o.team_type==3 && th.data.order.pt_status==2){ + // endTime = o.wk_end_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) + // 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) + // } + // } else { + // //活动已结束,全部设置为'00' + // obj = { + // day: '00', + // hou: '00', + // min: '00', + // sec: '00' + // } + // } + // var txt = "pindGoods.djs"; + // th.setData({ + // obj: obj + // }); + // setTimeout(th.countDown2, 1000); + // }, + + + + //--定义的保存图片方法,分享团--- + saveImageToPhotosAlbum: function () { + var that = this, th = that; + var app = getApp(); + + // 关闭底部分享弹窗 + this.setData({ + share_hidden: false, + }); + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + //getApp().my_warnning("请先登录",0,this); + // wx.navigateTo({ url: '/pages/togoin/togoin', }) + // return false; + } + + // if (this.data.share_hidden) { + // this.setData({ share_hidden: false,}); + // }; + + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 + var type = 9; + // if (type == 6) type = 2; + // if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; + + wx.showLoading({title: '生成海报中'}); + + //设置画板显示,才能开始绘图 + // that.setData({ + // canvasHidden: true + // }) + + + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, + // var path2 = th.data.iurl + th.data.luckyGoInfo.original_img; + var scene = th.data.param.goods_id + ''; + scene+="."+9+"."+th.data.luckyGoInfo.id; + + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; + if (user_id > 0) { + scene += "_" + user_id; + }; + //-- 如果不是会员分享过来的要分享给别人 -- + if(getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { + //固定房间是第3个字符 + if (!user_id) scene += "_0"; + scene += "_" + getApp().globalData.room_id; + }; + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; + + + // 读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function (res) { + // 回调写法 + th.get_head_temp(th.get_goods_temp, function () { + var vpath = res.path; + var context = wx.createCanvasContext('share'); + // 先画背景 + var pg_path = "../../../../images/share/share_bg.png"; + + // context.fillStyle="#FFFFFF"; + // context.fillRect(0,0,554 * unit, 899 * unit); + + // if(type == 0) { + // this.drawPoster(context); + // return false; + // }; + + + //-- 如果有自定义海报的时候,判断背景的图片 -- + // if (th.data.share_b_img) { + // pg_path = th.data.share_b_img; + // } + + // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + + + // if(type == 0) { + // // 如果是普通商品,绘制新海报 + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); + // } else { + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + // }; + + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); + + + //-- 是自定义海报的情况下 -- + if(type != 0) { + + + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { + //在线上分享人的情况下 + // if (parseInt(th.data.poster.show_headpic)) { + // //获取坐标 + // var x = parseFloat(th.data.poster.head_x) * 2; + // var y = parseFloat(th.data.poster.head_y) * 2; + // var x1 = (x + 90) * unit; + // var y1 = (y + 50) * unit; + // //--昵称--- + // context.setFontSize(24 * unit) + // context.setFillStyle("black") + // context.fillText(app.globalData.userInfo.nickname, x1, y1); + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + // //强烈推荐 改许程 + // var tj_path = "../../../../images/share/q_tj.png"; + // context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); + // context.setFontSize(16 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFillStyle("white"); + // context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); + + // //context.setFillStyle("black") + // //context.setFontSize(24 * unit) + // //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); + // } + } else { + //--昵称--- + context.setFontSize(24 * unit); + context.setFillStyle("black"); + context.fillText(getApp().globalData.userInfo.nickname, 152 * unit, 60 * unit); + var width = 24 * getApp().globalData.userInfo.nickname.length * unit + 2 * unit; + //强烈推荐 改许程 + // var tj_path = "../../../../images/share/q_tj.png"; + // let txt_gn = th.data.luckGoInfo.group_num + '人团'; + // let width_gn = ut.measureText(txt_gn, 15); + // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); + // context.setFontSize(16 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFillStyle("white"); + // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); + // 发出幸运购活动邀请 + context.setFillStyle("#7f7f7f") + context.setFontSize(21.3 * unit) + context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); + + } + + }; + + + // var share_title = th.data.data.goods_name; + var share_title = th.data.param.goods_name; + // if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { + // share_title = th.data.prom_act.share_title; + // if (!share_title) share_title = th.data.prom_act.title; + // if (th.data.prom_type == 4) share_title = th.data.prom_act.name; + // } + + //---产品名称--- + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 + if (type != 4 && type != 0) { + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + th.draw_Text(context, share_title, + 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit); + + //------产品的价格------- + context.setFontSize(23 * unit); + context.setFillStyle("red"); + + + // var pri0 = th.data.data.shop_price; + var pri0 = th.data.luckyGoInfo.group_price/100; + if (th.data.prom_act) pri0 = th.data.prom_act.price; + pri0 = parseFloat(pri0).toFixed(2); + var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; + context.fillText("¥", wd1 - 15, 185 * unit); + context.setFontSize(31 * unit); + context.fillText(pri0, wd1, 185 * unit); + + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFontSize(18 * unit); + context.setFillStyle("white"); + context.fillText('参团价', 330 * unit, 179 * unit); + + //---市场价划掉--- + context.setFillStyle("gray"); + context.setFontSize(22 * unit); + pri0 = "零售价:¥" + th.data.luckyGoInfo.market_price.toFixed(2); + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; + context.fillText(pri0, wd2, 213 * unit); + + context.setStrokeStyle('gray'); + context.setLineWidth(1 * unit); + context.moveTo(wd2 - 5, 206 * unit); + context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); + context.stroke(); + + } else if(type == 4 && type != 0) { + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + th.draw_Text(context, share_title, + 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); + //------ 产品的价格 ----- + var pri0 = th.data.prom_act.addmoney; + var integral = th.data.prom_act.integral; + var text = ""; + if (integral) { text = integral + "积分"; } + if (pri0 && integral) { text += "+"; } + if (pri0) { text += "¥" + pri0; } + + if (!pri0 && !integral) { text = "0积分"; } + context.setFillStyle("red"); + context.fillText(text, 38 * unit, 235 * unit); + } - } else { - //活动已结束,全部设置为'00' - obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' + + //---中间大图--- + // if(type != 0) { + // ee.data.share_img_localpath + context.drawImage(that.data.share_img_localpath, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // wx.getImageInfo({ + // src: th.data.iurl + th.data.luckyGoInfo.original_img, + // ssuccess: function (res) { + // //res.path是网络图片的本地地址 + // console.log('res.path', res.path); + // context.drawImage(res.path, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // // ee.data.share_img_localpath = res.path; + // // tt(); + // }, + // fail: function (res) { + // // context.drawImage('../../../../images/share/default_g_img.gif', 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // // ee.data.share_img_localpath= "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 + // // tt(); + // } + // }); + // context.drawImage(th.data.luckyGoInfo.original_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // }; + + + + //-------大图后面就不一样了----------- + switch (type) { + case 9: + + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 680 * unit) + context.lineTo(520 * unit, 680 * unit) + context.stroke(); + + //---文字--- + context.setFillStyle("black") + context.setFontSize(24 * unit) + // context.font = 'normal bold 18px'; + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + //还差N人,即可成团 + let group_num = th.data.luckyGoInfo.group_num; + let num_joined = th.data.luckyGoInfo.num; + let delta1 = group_num - num_joined; + let width_delta1 = ut.measureText(delta1, 15); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta1, 160 * unit, 772 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); + + // N人得商品,N人全额退款 + let group_win = th.data.luckyGoInfo.group_win; + let delta2 = group_num - group_win; + let width_delta2 = ut.measureText(delta2, 16); + let width_groupNum = ut.measureText(group_num, 15); + let width_groupWin = ut.measureText(group_win, 15); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(group_win, 40 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta2, 160 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); + + // 并得帮团惊喜礼品 + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("并得帮团", 40 * unit, 840 * unit); + context.setFillStyle("#FF6768") + context.setFontSize(21.3 * unit) + context.fillText("惊喜礼品", 130 * unit, 840 * unit); + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("!", 220 * unit, 840 * unit); + + + //---二维吗图--- + //-- 自定义海报 -- + if (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); + } else { + //---二维吗图--- + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + } + + break; + + } - } - var txt = "pindGoods.djs"; - th.setData({ - obj: obj - }); - setTimeout(th.countDown2, 1000); - }, - - //--定义的保存图片方法,分享团--- - saveImageToPhotosAlbum: function () { - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 - var type=1; - if(this.data.teamlist.kttype==3) type=2; - - wx.showLoading({ title: '生成中...', }) - var that = this, th = that; - //设置画板显示,才能开始绘图 - that.setData({ - canvasHidden: true, - }) + + + //--- 如果是自定义海报的时候 --- + if(type != 0) { + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { + + //如果显示会员信息的话 + if (parseInt(th.data.poster.show_headpic)) { + //获取坐标 + var x = parseFloat(th.data.poster.head_x) * 2; + var y = parseFloat(th.data.poster.head_y) * 2; + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = x * unit; + var h_y = y * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } + + } else { + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = 60 * unit; + var h_y = 24 * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } + + }; + + + + //把画板内容绘制成图片,并回调 画板图片路径 + context.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1217, + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, + canvasId: 'share', + success: function (res) { + console.log('生成成功'); + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true + }) + + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + - if(this.data.share_hidden) { - this.setData({ - share_hidden: false, + that.setData({ + showPoster: true, + }); + wx.hideLoading(); + }, + fail: function() { + console.log('生成失败'); + }, + }) + }, 500) + }); - }; - - var app = getApp(); - var unit = that.data.screenWidth / 750 * 1.35; - var scene=th.data.teamgroup.id; - var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; - if(user_id>0){ - scene+="_"+user_id; - } - - //二微码 - var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ - os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; - - //读取文件成功则OK-- - wx.getImageInfo({ - src: path3, - success:function (res) { - //回调写法 - th.get_head_temp(th.get_goods_temp,function () { - var vpath = res.path; - var context = wx.createCanvasContext('share'); - - - //先画背景 - var pg_path = "../../../../images/share/share_bg.png"; - //-- 如果有自定义海报的时候,判断背景的图片 -- - if(th.data.share_b_img){ - pg_path=th.data.share_b_img; - } - - var share_title=th.data.teamlist.share_title; - if(!share_title) - share_title=th.data.teamlist.title; - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - - //-- 是自定义海报的情况下 -- - if(th.data.poster && parseInt(th.data.poster.style)==2){ - //在线上分享人的情况下 - if(parseInt(th.data.poster.show_headpic)){ - //获取坐标 - var x=parseFloat(th.data.poster.head_x)*2; - var y=parseFloat(th.data.poster.head_y)*2; - var x1=(x+90) *unit; - var y1=(y+50) *unit; - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, x1, y1); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; - //强烈推荐 改许程 - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); - context.setFontSize(16 * unit) - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white") - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); - } - - }else{ - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; - //强烈推荐 - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); - context.setFontSize(18 * unit) - context.setFillStyle("white") - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); - } - - - //---产品名称--- - context.setFontSize(21.3 * unit); - context.setFillStyle("black"); - - - - - th.draw_Text(context,share_title, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); - //------产品的价格------- - context.setFontSize(24 * unit) - context.setFillStyle("red") - - var pri0 = th.data.teamlist.price; - pri0=parseFloat(pri0).toFixed(2); - var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25; - context.fillText("¥", wd1-15, 180 * unit); - context.setFontSize(31 * unit) - context.fillText(pri0, wd1, 180 * unit); - - //---市场价划掉--- - context.setFillStyle("gray") - context.setFontSize(22 * unit) - pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2); - var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25; - context.fillText(pri0, wd2, 210 * unit); - - context.setStrokeStyle('gray') - context.setLineWidth(1 * unit) - context.moveTo(wd2-5, 204 * unit) - context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit) - context.stroke(); - console.log(th.data.share_img_localpath); - - - //---中间大图--- - context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit); - - var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length; - var wz= ""; - if(g_ct>0) wz="还差"+g_ct+"人成团,"; - else{ - g_ct= th.data.max_num -th.data.ordertx.length; - if(g_ct>0){ - wz="还差"+g_ct+"人享最低优惠,"; - }else{ - wz="已享受最优惠,"; - } - } - - //-------大图后面就不一样了----------- - switch (type) { - case 1://会员团和商家团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - - //绘制成团图片 - var ct_img ="../../../../images/share/ct_num.png"; - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); - var ct_num = th.data.teamlist.ct_num; - context.setFontSize(14 * unit) - - context.setFillStyle("red") - if(ct_num<10){ - context.fillText(ct_num+"人拼团", 92 * unit, 760 * unit); - }else{ - context.fillText(ct_num+"人拼团", 86 * unit, 760 * unit); - } - context.setFontSize(22 * unit) - context.fillText("已拼"+th.data.teamlist.buy_num+"份", 166 * unit, 763 * unit); - context.setFillStyle("gray") - context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 826 * unit); - context.setFillStyle("black") - - context.setFontSize(22 * unit) - context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); - //---二维吗图--- - //-- 自定义海报 -- - if(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, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); - } - break - case 2://阶梯团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - //---绘制中间阶梯的价格--- - var list= JSON.parse(th.data.teamlist.ct_rylist); - for(var i=0; i { + var luckyGoInfo = res.data.data.pageData[0]; + var team_id = luckyGoInfo.team_id; + + th.setData({ + luckyGoInfo, + team_id, + }); + + //参团成功后,检查team_id + //如果team_id为0, 表示当前已开启新的一期,文字提示应改为’参团成功,本期幸运购已开团,中奖结果可点击下方查看参团列表‘ + //如果team_id为0,取出之前保存的team_id替换掉,请求上一期已成团的幸运购活动 + if(team_id != 0) { + wx.setStorage({ + key: 'team_id', + data: team_id, + }); + } else { + let team_id = wx.getStorageSync('team_id'); + th.setData({ + team_id: team_id, + isSuccess: true, + }); + }; + + }); + + // 幸运购成团成员 + await getApp().request.promiseGet("/api/weshop/prom/luckyOrder/page", { + data: { + store_id: o.stoid, + team_id: this.data.team_id, + } + }).then(res => { + th.setData({ + luckyGoMembers: res.data.data.pageData, + }); + }); + + }, diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml index e0525f8..2155d60 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml @@ -66,7 +66,13 @@ - 参团成功,还差{{filters.show_default(luckyGoInfo.group_num, '0')- filters.show_default(luckyGoInfo.num, '0')}}人即可成团,请留意成员开奖通知! + + 参团成功,还差{{filters.show_default(luckyGoInfo.group_num, '0') - filters.show_default(luckyGoInfo.num, '0')}}人即可成团,请留意成员开奖通知! + 参团成功,本期幸运购已开团! + + + 组团中,还差{{filters.show_default(luckyGoInfo.group_num, '0') - filters.show_default(luckyGoInfo.num, '0')}}人即可成团! + 未团中可获得帮团奖励 - - - - + + + + + + + + + + + + + - - - - - - - - @@ -202,9 +207,9 @@ - {{filters.format_time(item.create_time, 1)}} + {{filters.format_time(item.add_time, 1)}} 待成团 - 未团中 + 未团中 已团中 @@ -240,15 +245,14 @@ - - + - + - + + @@ -324,13 +329,15 @@ - - + + + + + + + + - - - - diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxss b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxss index 20ddf4c..0d64a21 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxss +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxss @@ -1023,7 +1023,7 @@ height:40rpx; font-size: 26rpx; position: absolute; color: white; - background-color: rgba(255,103,103,.7); + background-color: #FE6867; right: 0; top: 0; z-index: 1; @@ -1083,4 +1083,10 @@ height:40rpx; .popup-content { max-height: 600rpx; overflow-y: auto; +} + +.mycanvas { + position: absolute; + top: -9999px; + left: -9999px; } \ No newline at end of file diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index 62168aa..80bc77c 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -18,7 +18,7 @@ ¥ {{sele_g.shop_price}} - ¥ {{prom_price}} + ¥ {{prom_price || filters.div100(luckGoInfo.group_price)}} @@ -31,13 +31,13 @@ 可售:{{sele_g.store_count}} - + @@ -102,14 +102,23 @@ + + - - 立即购买 + 立即购买 @@ -203,7 +212,7 @@ 配送不匹配 - 确定 + 确定 diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index e2b4af6..c8b4439 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -139,7 +139,7 @@ Page({ brand_name: '', nation_name: '', - //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单 + //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单 9幸运购 prom_type: 9, prom_time_text: "", prom_price: null, @@ -296,10 +296,14 @@ Page({ prom_id = t.group_id; //活动ID if(prom_type) { - this.data.prom_type = prom_type; - this.data.prom_id = prom_id; + // this.data.prom_type = prom_type; + // this.data.prom_id = prom_id; + this.setData({ + prom_type, + prom_id, + }); } - + console.log('type********>>',this.data.prom_type); //-- 自定义海报 -- // getApp().request.promiseGet("/api/weshop/goods/poster/page", { // data: { store_id: os.stoid, type: 1, is_use: 1 } @@ -435,34 +439,34 @@ Page({ var swithc_list = e.switch_list; var sw_arr = JSON.parse(swithc_list); //---如果后台又开等级卡的开关--- - // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - // th.setData({ rank_switch: true }); - // //---回调卡的列表--- - // th.getPlusCardType(function (ob) { - // th.setData({ card_list: ob.card_list }); - // var ti = setInterval(function () { - // var user = getApp().globalData.userInfo; - // if (!user) return false; - // clearInterval(ti); - - // 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.length>6) card_name=card_name.substring(0,6); - - // var is_near_date = 0; - // if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 - // th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); - // } - // } - // }, 500) - // }) - // } + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ rank_switch: true }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ card_list: ob.card_list }); + var ti = setInterval(function () { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); + + 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.length>6) card_name=card_name.substring(0,6); + + var is_near_date = 0; + if (end - now < 60 * 60 * 30 * 24) is_near_date = 1; //如果小于30天 + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list, is_near_date: is_near_date }); + } + } + }, 500) + }) + } }, 1); @@ -877,6 +881,7 @@ Page({ e.wxParseAddFullImageUrl(ee, "content"); if(ee.data.prom_type){ + //999 t.data.data.prom_type=ee.data.prom_type; t.data.data.prom_id=ee.data.prom_id; } @@ -891,17 +896,17 @@ Page({ //获取统一条形码,普通商品和优惠促销的商品 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7) { //默认门店要拿下门店库存 - if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { - //获取门店 - ee.get_sto(); + // if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { + // //获取门店 + // ee.get_sto(1); - } else { - //获取门店 - ee.get_sto(); - } + // } else { + // //获取门店 + // ee.get_sto(); + // } - ee.get_sku(o.stoid, t.data.data, gid); - ee.check_has_flash(); + // ee.get_sku(o.stoid, t.data.data, gid); + // ee.check_has_flash(); } else { @@ -1018,7 +1023,7 @@ Page({ } }).then(res => { if (res.data.code == 0) { - console.log('成团信息=======》', res.data.data); + // console.log('成团信息=======》', res.data.data); th.setData({ luckGoInfo: res.data.data.pageData[0], team_id: res.data.data.pageData[0].team_id, @@ -1039,7 +1044,7 @@ Page({ } }).then(res => { if (res.data.code == 0) { - console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); + // console.log(th.data.team_id,'参团成员===============》', res.data.data.pageData); th.setData({ luckGoMembers: res.data.data.pageData, }); @@ -1057,19 +1062,22 @@ Page({ }, + // 暂时无用 + // enterAddress: function () { + // this.data.enterAddressPage = !0, wx.navigateTo({ + // url: "/pages/user/address_list/address_list?operate=selectAddress" + // }); + // }, - enterAddress: function () { - this.data.enterAddressPage = !0, wx.navigateTo({ - url: "/pages/user/address_list/address_list?operate=selectAddress" - }); - }, + // 页面卸载 onUnload: function () { for (var i = 1; i < 100; i++) { clearInterval(i); } }, + // 页面隐藏 onHide: function () { this.data.is_timer = 0; for (var i = 1; i < 100; i++) { @@ -1077,7 +1085,7 @@ Page({ } }, - //----------三个选项按钮----------- + // 点击顶部选项卡 tabClick: function (t) { var e = t.currentTarget.id; this.setData({ @@ -1092,6 +1100,8 @@ Page({ // }); // }, + + // 点击评价选项卡下的各评价按钮 tabClick3: function (t) { var e = this; if (t.currentTarget.id != this.data.activeCategoryId3) { @@ -1104,6 +1114,7 @@ Page({ } }, + // 滚动到顶部 doScrollTop: function () { wx.pageScrollTo({ scrollTop: 0 @@ -1116,7 +1127,8 @@ Page({ }), this.data.comments || this.requestComments_new(); }, - //商品详情的时候调用 + + //商品详情里表格信息:类别、品牌、国别 tabGoodsContent: function () { var th = this, i = getApp().request; @@ -1702,9 +1714,9 @@ Page({ openSpecModal_pt: 0, }) - if (e.prom_type == 4) { + if (e.prom_type == 9) { s.set_b_now(e); - var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id; + var url = "/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id; getApp().goto(url); } else { //要判断积分购的普通购买有没有参加优惠活动 @@ -1954,6 +1966,8 @@ Page({ }) return false; } + + if(th.data.more_flash && open_store==1){ th.setData({is_pop_more:1}); @@ -3729,22 +3743,20 @@ Page({ //--点击弹起拼单-- openSpecModel_pt: function (e) { - - this.setData({ open_ind_store: 4, goodsInputNum: 1 });//拼团直接给4 - + this.setData({ open_ind_store: 9, goodsInputNum: 1 }); //--先判断会员状态-- var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { wx.navigateTo({ url: '/pages/togoin/togoin', }) return false; - } + }; var th = this; - var ind = parseInt(e.currentTarget.dataset.it); - //如果是拼单活动的普通购买 + var ind = parseInt(e.currentTarget.dataset.ind); + //ind == 1是普通购买 if (ind == 1) { //如果拼单的sku data是空的,就要先获取一下 if (th.data.sku_g_pt) { @@ -3761,62 +3773,73 @@ Page({ openSpecModal_pt: 1 }); }); - } + + th.setData({ + is_normal: ind, + openSpecModal_pt: 1 + }); + }; th.check_is_youhui(th.data.gid, 1); } else { - //拼单商品从这里进,先判断有没有买过商品, - getApp().request.get("/api/weshop/order/page", { - data: { - pt_prom_id: th.data.prom_act.id, - user_id: oo.user_id, - store_id: os.stoid, - pageSize: 1, - page: 1 - }, - success: function (e) { - //--跳转到已经购买的情况-- - if (e.data.data.pageData.length > 0) { - var odr = e.data.data.pageData[0]; - //还未支付 - if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { - wx.showModal({ - title: "您已经购买了该商品待支付中", - success: function (a) { - if (a.confirm) { - wx.navigateTo({ - url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, - }); - } - } - }); - } else if (odr.pt_status == 1 && odr.order_status == 1) { - - if (this.data.is_go_to_team_show) return false; - this.data.is_go_to_team_show = 1; - wx.showLoading(); - - /*--- - wx.redirectTo({ - url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, - });--*/ - getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); - - } else { - th.setData({ - is_normal: ind, - openSpecModal_pt: 1 - }); - } + // //拼单商品从这里进,先判断有没有买过商品, + // getApp().request.get("/api/weshop/order/page", { + // data: { + // // pt_prom_id: th.data.prom_act.id, + // user_id: oo.user_id, + // store_id: os.stoid, + // pageSize: 1, + // page: 1 + // }, + // success: function (e) { + // //--跳转到已经购买的情况-- + // if (e.data.data.pageData.length > 0) { + // var odr = e.data.data.pageData[0]; + // //还未支付 + // if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { + // wx.showModal({ + // title: "您已经购买了该商品待支付中", + // success: function (a) { + // if (a.confirm) { + // wx.navigateTo({ + // url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, + // }); + // } + // } + // }); + // } else if (odr.pt_status == 1 && odr.order_status == 1) { + + // if (this.data.is_go_to_team_show) return false; + // this.data.is_go_to_team_show = 1; + // wx.showLoading(); + + // /*--- + // wx.redirectTo({ + // url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, + // });--*/ + // getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); + + // } else { + // th.setData({ + // is_normal: ind, + // openSpecModal_pt: 1 + // }); + // } - } else { - th.setData({ - is_normal: ind, - openSpecModal_pt: 1 - }); - } - } - }); + // } else { + // th.setData({ + // is_normal: ind, + // openSpecModal_pt: 1 + // }); + // } + // } + // }); + th.get_sto(1); + th.setData({ + is_normal: 0, + openSpecModal_pt: 1 + }); + } }, @@ -4010,7 +4033,7 @@ Page({ buyNow_pt: function (e) { s.set_b_now(e); wx.navigateTo({ - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id, + url: "/packageC/pages/luckyGo_cart/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id, }); }, @@ -4437,8 +4460,9 @@ Page({ this.setData({ share_hidden: false,}); }; - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 - var type = this.data.prom_type; + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 + var type = 9; + console.log('type',type); if (type == 6) type = 2; if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; @@ -4481,7 +4505,7 @@ Page({ var vpath = res.path; var context = wx.createCanvasContext('share'); // 先画背景 - var pg_path = "../../../images/share/share_bg.png"; + var pg_path = "../../../../images/share/share_bg.png"; // context.fillStyle="#FFFFFF"; // context.fillRect(0,0,554 * unit, 899 * unit); @@ -4511,6 +4535,8 @@ Page({ //-- 是自定义海报的情况下 -- if(type != 0) { + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { //在线上分享人的情况下 if (parseInt(th.data.poster.show_headpic)) { @@ -4525,7 +4551,7 @@ Page({ context.fillText(app.globalData.userInfo.nickname, x1, y1); var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; //强烈推荐 改许程 - var tj_path = "../../../images/share/q_tj.png"; + var tj_path = "../../../../images/share/q_tj.png"; context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); context.setFontSize(16 * unit); context.setLineJoin('round'); //交点设置成圆角 @@ -4540,22 +4566,29 @@ Page({ //--昵称--- context.setFontSize(24 * unit); context.setFillStyle("black"); - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; //强烈推荐 改许程 - var tj_path = "../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); - context.setFontSize(16 * unit); - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white"); - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); + // var tj_path = "../../../../images/share/q_tj.png"; + // let txt_gn = th.data.luckGoInfo.group_num + '人团'; + // let width_gn = ut.measureText(txt_gn, 15); + // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); + // context.setFontSize(16 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFillStyle("white"); + // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); + // 发出幸运购活动邀请 + context.setFillStyle("#7f7f7f") + context.setFontSize(21.3 * unit) + context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); + } }; - var share_title = th.data.data.goods_name; + var share_title = th.data.data.goods_name; if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { share_title = th.data.prom_act.share_title; if (!share_title) share_title = th.data.prom_act.title; @@ -4568,7 +4601,7 @@ Page({ context.setFillStyle("black"); context.setFontSize(21.3 * unit) th.draw_Text(context, share_title, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); + 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit); //------产品的价格------- context.setFontSize(23 * unit) @@ -4583,11 +4616,18 @@ Page({ context.fillText("¥", wd1 - 15, 185 * unit); context.setFontSize(31 * unit) context.fillText(pri0, wd1, 185 * unit); + + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFontSize(18 * unit); + context.setFillStyle("white"); + context.fillText('参团价', 330 * unit, 179 * unit); //---市场价划掉--- context.setFillStyle("gray") context.setFontSize(22 * unit) - pri0 = "¥" + th.data.data.market_price.toFixed(2); + pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; context.fillText(pri0, wd2, 213 * unit); @@ -4630,7 +4670,7 @@ Page({ //中间的几个字 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"; + 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) @@ -4648,7 +4688,7 @@ Page({ } } else { - var g_path = "../../../images/share/s_gou.png"; + 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) @@ -4714,7 +4754,7 @@ Page({ context.stroke(); //画秒杀的图片 - var miaos_path = '../../../images/share/miao_share.png'; + var miaos_path = '../../../../images/share/miao_share.png'; context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); context.setFillStyle("black") @@ -4751,7 +4791,7 @@ Page({ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); //绘制成团图片 - var ct_img = "../../../images/share/ct_num.png"; + var ct_img = "../../../../images/share/ct_num.png"; context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); var ct_num = th.data.prom_act.ct_num; context.setFontSize(14 * unit) @@ -4834,7 +4874,81 @@ Page({ //---二维吗图--- context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); } - break + break; + + + case 9: + + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 680 * unit) + context.lineTo(520 * unit, 680 * unit) + context.stroke(); + + //---文字--- + context.setFillStyle("black") + context.setFontSize(24 * unit) + context.font = 'normal bold 18px'; + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + //还差N人,即可成团 + let group_num = th.data.luckGoInfo.group_num; + let num_joined = th.data.luckGoInfo.num; + let delta1 = group_num - num_joined; + let width_delta1 = ut.measureText(delta1, 15); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta1, 160 * unit, 772 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); + + // N人得商品,N人全额退款 + let group_win = th.data.luckGoInfo.group_win; + let delta2 = group_num - group_win; + let width_delta2 = ut.measureText(delta2, 16); + let width_groupNum = ut.measureText(group_num, 15); + let width_groupWin = ut.measureText(group_win, 15); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(group_win, 40 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta2, 160 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); + + // 并得帮团惊喜礼品 + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("并得帮团", 40 * unit, 840 * unit); + context.setFillStyle("#FF6768") + context.setFontSize(21.3 * unit) + context.fillText("惊喜礼品", 130 * unit, 840 * unit); + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("!", 220 * unit, 840 * unit); + + + //---二维吗图--- + //-- 自定义海报 -- + if (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); + } else { + //---二维吗图--- + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + } + + break; } @@ -6068,9 +6182,9 @@ Page({ // 查看奖励 showReward: function() { - this.setData({ - showReward: true, - }); + + this.getPrizes(this.data.luckGoInfo.type); + }, // 关闭奖励 @@ -6080,5 +6194,108 @@ Page({ }); }, + + // 获取优惠券奖励和服务项目奖励 + getPrizes: function(type) { + // let currentItem = this.data.list.pageData[currentItemIndex]; + // let type = type; + let self = this; + let app = getApp(); + // 分割type字符串 + let typeArr = this.splitStringToArr(type); + let prizesArr = []; + let promiseArr = []; + typeArr.forEach(function(item) { + + let obj = {}; + obj.type = item; + + let promise = new Promise((resolve, reject) => { + switch(item) { + case 1: { //积分 + obj.name = '积分'; + obj.num = 'point'; + prizesArr.push(obj); + resolve(); + break; + }; + case 2: { //成长值 + obj.name = '成长值'; + obj.num = 'grow'; + prizesArr.push(obj); + resolve(); + break; + }; + case 3: { //优惠券 + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { + data: { + store_id: os.stoid, + aid: self.data.luckGoInfo.id, + } + }).then(res => { + if(res.data.code == 0) { + obj.couponList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 4: { //服务项目 + app.request.promiseGet('/api/weshop/prom/luckyService/page', { + data: { + store_id: os.stoid, + aid: self.data.luckGoInfo.id, + } + }).then(res => { + if(res.data.code == 0) { + obj.serviceList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 5: { //预存金额 + obj.name = 'prestore_name'; + obj.num = 'prestore_money'; + prizesArr.push(obj); + resolve(); + break; + }; + }; + }); + + promiseArr.push(promise); + + + Promise.all(promiseArr).then(()=> { + self.setData({ + prizesArr, + showReward: true, + }); + }); + + + + }); + + + + }, + + // 将type字符串分割成数组 + splitStringToArr: function(typeStr) { + var index; + var newTypeArr = []; + var typeStrArr = typeStr.split(','); + typeStrArr.forEach(function(item) { + index = parseInt(item); + newTypeArr.push(index); + }); + // console.log('newTypeArr', newTypeArr); + return newTypeArr; + }, + }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index efa55e2..acd66d0 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -883,13 +883,14 @@ - + {{filters.toFix(data.market_price,2)}} 单独购买 - 立即参团2 + + 立即参团 + + + + + + 优惠券-{{i.name}} + 数量:{{i.num}} + + + + + + + + + 服务项目-{{i.name}} + 数量:{{i.num}} + + + + + + + + + {{luckGoInfo[item.name]}} + 金额:{{filters.div100(luckGoInfo[item.num])}} + + + + + + + + + + + + {{item.name}} + 数量:{{luckGoInfo[item.num]}} + + + + + diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index d9c9dcb..5670482 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -1130,8 +1130,8 @@ left:31rpx;} } /* 评价的用户边框 */ .middle-user-frame{ - height: 65rpx; - overflow: hidden; + /* height: 65rpx; + overflow: hidden; */ } .middle-user{ height: 25; @@ -3094,12 +3094,13 @@ button.custom-service::after{ .popup-list-item { display: flex; + align-items: center; padding: 20rpx; } .popup-list-item .img-container { - width: 140rpx; - height: 140rpx; + width: 120rpx; + height: 100rpx; } .popup-title { diff --git a/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.js b/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.js index 9b2bc5f..2726629 100644 --- a/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.js +++ b/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.js @@ -1,40 +1,8 @@ -var t = require("../../../../utils/util.js"), - ut = t, - e = require("../../../../utils/common.js"), - a = require("../../../../utils/wxParse/wxParse.js"), - s = getApp(), - i = s.request, - rq = i, - oo = s.globalData, - o = s.globalData.setting, - os = o; -var regeneratorRuntime = require('../../../../utils/runtime.js'); -var e = getApp(),oo = e.globalData.setting; - - const app = getApp(); let self = null; Page({ data: { - wu:false, - imageurl: os.imghost,//有礼派图片地址, - iurl: os.imghost,//有礼派图片地址, - pt_state:0, - order : null,//订单数据 - currentTab: 0, - current:0, - ordertx:[],//头像 - baseUrl: "/api/weshop/order/page?1=1", - resourceUrl: e.globalData.setting.resourceUrl, - currentPage: 1, - requestData: null, - original_img:null, - timer:null, - - - - tabArr: ['全部','参团中','已团中','未团中'], currentTabIndex: 0, @@ -44,6 +12,24 @@ Page({ noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 showReward: false, + prizesArr: [], + + typeArr: [{ + key: 'point', + name: '积分', + },{ + key: 'grow', + name: '成长值', + },{ + key: 'point', + name: '优惠券', + },{ + key: 'prestore_name', + name: '项目服务', + },{ + key: 'prestore_money', + name: '预存金额', + }], }, onLoad: function () { @@ -64,7 +50,6 @@ Page({ isLogin: true, }); - let data = { store_id: app.globalData.setting.stoid, user_id: this.data.userInfo.user_id, @@ -128,11 +113,11 @@ Page({ break; }; case 2: { - currentData.team_status = 1; + currentData.team_status = 2; break; }; case 3: { - currentData.team_status = 2; + currentData.team_status = 1; break; }; }; @@ -219,10 +204,12 @@ Page({ }, //查看奖励 - showReward: function() { + showReward: function(e) { this.setData({ - showReward: true, + currentItemIndex: e.target.dataset.index, + currentItemAid: e.target.dataset.aid, }); + this.getPrizes(this.data.currentItemIndex); }, //关闭奖励 @@ -233,208 +220,100 @@ Page({ }, + // 获取优惠券奖励和服务项目奖励 + getPrizes: function(currentItemIndex) { + let currentItem = this.data.list.pageData[currentItemIndex]; + let type = currentItem.type; + + // 分割type字符串 + let typeArr = this.splitStringToArr(type); + let prizesArr = []; + let promiseArr = []; + typeArr.forEach(function(item) { + + let obj = {}; + obj.type = item; + + let promise = new Promise((resolve, reject) => { + switch(item) { + case 1: { //积分 + obj.name = '积分'; + obj.num = 'point'; + prizesArr.push(obj); + resolve(); + break; + }; + case 2: { //成长值 + obj.name = '成长值'; + obj.num = 'grow'; + prizesArr.push(obj); + resolve(); + break; + }; + case 3: { //优惠券 + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', { + data: { + store_id: os.stoid, + aid: self.data.currentItemAid, + } + }).then(res => { + if(res.data.code == 0) { + obj.couponList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 4: { //服务项目 + app.request.promiseGet('/api/weshop/prom/luckyService/page', { + data: { + store_id: os.stoid, + aid: self.data.currentItemAid, + } + }).then(res => { + if(res.data.code == 0) { + obj.serviceList = res.data.data.pageData; + prizesArr.push(obj); + resolve(); + }; + }); + break; + }; + case 5: { //预存金额 + obj.name = 'prestore_name'; + obj.num = 'prestore_money'; + prizesArr.push(obj); + resolve(); + break; + }; + }; + }); + + promiseArr.push(promise); + + + Promise.all(promiseArr).then(()=> { + self.setData({ + prizesArr, + showReward: true, + }); + }); + + }); + }, + // 将type字符串分割成数组 + splitStringToArr: function(typeStr) { + var index; + var newTypeArr = []; + var typeStrArr = typeStr.split(','); + typeStrArr.forEach(function(item) { + index = parseInt(item); + newTypeArr.push(index); + }); + return newTypeArr; + }, - - - - - - - - - - - - - - /** - * 点击tab切换 - */ - // swichNav: function (e) { - // this.data.requestData=[]; - // this.data.currentPage=1; - // var that = this; - - // if (that.data.order == null){ - // that.setData({ - // wu:true - // }) - // } - - // if (this.data.currentTab === e.target.dataset.current) { - // return false; - // } else { - // that.setData({ - // currentTab: e.target.dataset.current, - // }) - // that.init(e.target.dataset.current); - // } - // }, - - // async init(current) { - // var where="1=1"; - // var user_id = getApp().globalData.user_id; - // switch (current){ - // case "1": - // where+="&pt_status=1"; - // break; - // case "2": - // where += "&pt_ok=1"; - // break; - // case "3": - // where += "&pt_status=3"; - // break; - // } - - // var goods_id = 0,//商品ID, - // original_img = [],//商品图片 - // ee = this, - // ordertx=[],//头像 - // order = null,//订单数据 - // goods = null,//商品数据 - // users = null,//会员数据 - // order_goods=null;//订单商品表 - - // //获取订单表的信息根据活动user_id,pt_prom_id>0 AND pay_time>0 - // /*--- - // await getApp().request.promiseGet("/api/weshop/order/page?"+where, { - // data: { is_pt:1,store_id: os.stoid, user_id: user_id, pageSize: 6, page: this.data.currentPage,} - // }).then(res => { - // order = res.data.data.pageData; - // this.data.currentPage++; - // })--*/ - - // await getApp().request.promiseGet("/api/weshop/order/pageTuan?"+where, { - // data: { is_pt:1,store_id: os.stoid, user_id: user_id, pageSize: 6, page: this.data.currentPage,} - // }).then(res => { - // order = res.data.data.pageData; - // this.data.currentPage++; - // }) - - - // wx.showLoading({ title: "加载中"}); - // for (i = 0; i < order.length; i++) { - // //获取订单从表信息 - // await getApp().request.promiseGet("/api/weshop/ordergoods/pageGoods", { - // data: { store_id: os.stoid, order_id: order[i].order_id } - // }).then(res => { - // order_goods = res.data.data.pageData; - // order[i].order_goods = order_goods; - // order[i].gimage = ee.data.imageurl + order_goods[0].original_img; - // }) - - - // //获取订单表信息根据上面查询的订单号order[i].pt_listno - // await getApp().request.promiseGet("/api/weshop/order/pagePtList", { - // data: { store_id: os.stoid, pt_listno: order[i].pt_listno,pageSize:60,page:1} - // }).then(res => { - // //console.log("ordertx"); - // ordertx = res.data.data.pageData; - // //console.log(ordertx); - // order[i].tx=ordertx; - // }) - - - - // if (order[i].is_zsorder== 4) { - // var num = 0; - // var jt_data = JSON.parse(order[i].ct_rylist); - // for (var m in jt_data) { - // if (jt_data[m].rynum > num) num = jt_data[m].rynum; - // } - // order[i].max_ct_num = num; - // } - - // var sf_num = order[i].ct_num; - // if (order[i].ct_num>=3){ sf_num=3;} - // sf_num=sf_num-ordertx.length; - // if(sf_num>0) { - // var arr = []; - // for(var j=0;j --> 参团中,还差{{filters.difference(item.num, item.group_num)}} - 已团中,{{item.shipping_status == 0 ? '待发货':'已发货'}} - 未团中,已退款 + 已团中,{{item.shipping_status == 0 ? '待发货':'已发货'}} + 未团中,已退款 @@ -24,16 +24,15 @@ {{filters.price(item.group_price)}} 零售价{{item.market_price}} - 未团中可获得帮团奖励 + 未团中可获得帮团奖励 共1件,实付金额:{{item.user_money}} 查看订单 - 邀请好友 - - 查看奖励 + 邀请好友 + 查看奖励 @@ -41,8 +40,6 @@ - - @@ -50,18 +47,58 @@ - - - - {{typeArr[item-1].name}} - 数量:{{luckGoInfo[typeArr[item-1]['key']]}} - - - + + + + + + + 优惠券-{{i.name}} + 数量:{{i.num}} + + + + + + + + + 服务项目-{{i.name}} + 数量:{{i.num}} + + + + + + + + + {{list.pageData[currentItemIndex][item.name]}} + 金额:{{filters.div100(list.pageData[currentItemIndex][item.num])}} + + + + + + + + + + + + {{item.name}} + 数量:{{list.pageData[currentItemIndex][item.num]}} + + + + + + + diff --git a/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxss b/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxss index 2290a94..2f13299 100644 --- a/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxss +++ b/packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxss @@ -127,16 +127,20 @@ page { color: #AF481D; } - +.popup-list { + max-height: 700rpx; + overflow-y: auto; +} .popup-list-item { display: flex; + align-items: center; padding: 20rpx; } .popup-list-item .img-container { - width: 140rpx; - height: 140rpx; + width: 120rpx; + height: 100rpx; } .popup-title { diff --git a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml index f459997..24652f6 100644 --- a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml +++ b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml @@ -19,8 +19,8 @@ 门店:{{order.pickname}} 参团中 - 已团中 | {{order.shipping_status == 0 ? '待发货':'已发货'}} - 未团中 | 已退款 + 已团中 | {{order.shipping_status == 0 ? '待发货':'已发货'}} + 未团中 | 已退款 @@ -152,16 +152,17 @@ - + 退款信息 退款金额 - ¥0.01 + ¥{{filters.toFix(order.user_money+order.pt_tail_money,2)}} + ¥{{filters.toFix(order.user_money,2)}} 退款时间 - 2021-10-11 18:00:00 + {{filters.format_time(order.is_back_time, 1)}} 退款方式 diff --git a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxss b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxss index e5209ed..8a0d6fc 100644 --- a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxss +++ b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxss @@ -37,7 +37,7 @@ padding-right: 40rpx; padding-left: 40rpx; */ background-color: #fff; - color: #f23030; + color: #FF6768; justify-content: space-between; display: flex; } diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 5d65ea5..c8695bf 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -356,32 +356,79 @@ Page({ //--判断优惠活动有没有过期-- else if (item.prom_type == 3) { - var isok = 1; - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { - if (res.data.code == 0) { - var r_data = res.data.data; - if (!r_data.promGoodsLists) { + var isok = 1,is_g_prom=0; + //因为有全场优惠活动,商品参加的活动还未开始 + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:os.stoid,goodsidlist:item.goods_id,is_detail:1,user_id:user_id + }; + await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { + if(res.data.code==0 && res.data.data && res.data.data.length){ + for(let i in res.data.data){ + let item=res.data.data[i]; + if(item.prom_type==3) { + is_g_prom=1; break; + } + } + } + }) + + if(is_g_prom){ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { + 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, {}); + //商品已经无活动 + 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, {}); + //商品已经下架 + isok = 0; + } + } + + } else { var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; getApp().request.delete(url, {}); - //商品已经无活动 + //商品已经下架 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, {}); - //商品已经下架 - isok = 0; - } - } - - } else { - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - getApp().request.delete(url, {}); - //商品已经下架 - isok = 0; - } - }) + } + }) + + }else{ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + item.goods_id, {}).then(res => { + 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, {}); + //商品已经无活动 + 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, {}); + //商品已经下架 + isok = 0; + } + } + + } else { + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + getApp().request.delete(url, {}); + //商品已经下架 + isok = 0; + } + }) + + } + if (!isok) continue; } else if (item.prom_type == 7) { @@ -1423,9 +1470,28 @@ Page({ //----------------------更新购物数量,加减,调用接口--------------------- postCardList: function(t, item, pitem) { + var e = this,th=e,user_id = getApp().globalData.user_id; + function normal_check(store_count,goodsinfo,wareIds) { + //--- 看一下是不是线下库存 --- + if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){ + th.check_down_line(t, pitem, item,wareIds); + }else{ + if (t.goods_num > store_count) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: store_count + }); + e.doCheckAll(); + t.goods_num=store_count; + } + e.update_cart(t, pitem, item); + } + } - var e = this,th=e; - var user_id = getApp().globalData.user_id; // console.log('update'); // console.log('9995959595959',t); rq.get("/api/weshop/goods/get/" + oo.stoid + "/" + t.goods_id, { @@ -1456,12 +1522,8 @@ Page({ th.setData({[txt]:promgoodsbuynum}); } goodsbuynum = buy_num_data.goodsbuynum; - - - // console.log('goodsbuynum===========', goodsbuynum); - }) - + }) var buyed_mum2 = t.goods_num + goodsbuynum; if (buyed_mum2 > limit && limit > 0) { @@ -1482,129 +1544,174 @@ Page({ } - if (goodsinfo.prom_type == 1) { - //读取秒杀 - rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { - isShowLoading: 0, - success: function(res_d) { - - if(res_d.data.code==0 && res_d.data.data){ - if (t.goods_num > store_count) { - wx.showModal({ - title: '提示', - content: '购买数量超出商品库存' - }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - - t.goods_num=store_count; - e.update_cart(t, pitem, item); + switch (goodsinfo.prom_type){ + case 1: + //读取秒杀 + rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { + isShowLoading: 0, + success: function(res_d) { + if(res_d.data.code==0 && res_d.data.data){ + if (t.goods_num > store_count) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: store_count + }); + e.doCheckAll(); - return false; - } + t.goods_num=store_count; + e.update_cart(t, pitem, item); - var false_data = res_d.data.data; - //--判断库存-- - if (t.goods_num > false_data.goods_num - false_data.buy_num) { - wx.showModal({ - title: '提示', - content: '购买数量超出活动库存' - }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.goods_num - false_data.buy_num - }); - e.doCheckAll(); - - t.goods_num=false_data.goods_num - false_data.buy_num; - e.update_cart(t, pitem, item); + return false; + } - return false; - } + var false_data = res_d.data.data; + //--判断库存-- + if (t.goods_num > false_data.goods_num - false_data.buy_num) { + wx.showModal({ + title: '提示', + content: '购买数量超出活动库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: false_data.goods_num - false_data.buy_num + }); + e.doCheckAll(); - //--判断redis数量是否已经超出-- - if (t.goods_num > false_data.redisnum) { - wx.showModal({ - title: '提示', - content: '购买数量超出商品库存' - }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.redisnum - }); - e.doCheckAll(); - - t.goods_num=false_data.redisnum; - e.update_cart(t, pitem, item); + t.goods_num=false_data.goods_num - false_data.buy_num; + e.update_cart(t, pitem, item); + return false; + } - return false; - } + //--判断redis数量是否已经超出-- + if (t.goods_num > false_data.redisnum) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: false_data.redisnum + }); + e.doCheckAll(); - //--活动的限购是不是要判断-- - if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) { - wx.showModal({ - title: '提示', - content: '购买数量超出秒杀限购' - }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.false_data.buy_limit - }); - e.doCheckAll(); - - t.goods_num=false_data.false_data.buy_limit; - e.update_cart(t, pitem, item); - return false; - } - e.update_cart(t, pitem, item); + t.goods_num=false_data.redisnum; + e.update_cart(t, pitem, item); + return false; + } - }else{ - //--- 看一下是不是线下库存 --- - if(th.data.sales_rules==2){ - th.check_down_line(t, pitem, item,wareIds); - }else{ - if (t.goods_num > store_count) { + //--活动的限购是不是要判断-- + if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) { wx.showModal({ title: '提示', - content: '购买数量超出商品库存' + content: '购买数量超出秒杀限购' }); var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; e.setData({ - [txt]: store_count + [txt]: false_data.buy_limit }); e.doCheckAll(); + t.goods_num=(false_data.buy_limit-promgoodsbuynum)?false_data.buy_limit-promgoodsbuynum:0; + e.update_cart(t, pitem, item); return false; } e.update_cart(t, pitem, item); + + }else{ + normal_check(store_count,goodsinfo,wareIds); } } + }) + break; + case 2: + getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, { + }).then(res => { + if(res.data.code==0 && res.data.data){ + if (t.goods_num > store_count) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: store_count + }); + e.doCheckAll(); + + t.goods_num=store_count; + e.update_cart(t, pitem, item); + + return false; + } + + var gr_data = res.data.data; + //--判断库存-- + if (t.goods_num > gr_data.goods_num - gr_data.buy_num) { + wx.showModal({ + title: '提示', + content: '购买数量超出活动库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: gr_data.goods_num - gr_data.buy_num + }); + e.doCheckAll(); + + t.goods_num=gr_data.goods_num - gr_data.buy_num; + e.update_cart(t, pitem, item); + + return false; + } + + //--判断redis数量是否已经超出-- + if (t.goods_num > gr_data.redisnum) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: gr_data.redisnum + }); + e.doCheckAll(); + + t.goods_num=gr_data.redisnum; + e.update_cart(t, pitem, item); + return false; + } + + //--活动的限购是不是要判断-- + if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) { + wx.showModal({ + title: '提示', + content: '购买数量超出团购限购' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: gr_data.buy_limit + }); + e.doCheckAll(); + + t.goods_num=(gr_data.buy_limit-promgoodsbuynum)?gr_data.buy_limit-promgoodsbuynum:0; + e.update_cart(t, pitem, item); + return false; + } + e.update_cart(t, pitem, item); + + }else{ + normal_check(store_count,goodsinfo,wareIds); + } + }) - } - }) - } else { - //--- 看一下是不是线下库存 --- - if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){ - th.check_down_line(t, pitem, item,wareIds); - }else{ - if (t.goods_num > store_count) { - wx.showModal({ - title: '提示', - content: '购买数量超出商品库存' - }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - t.goods_num=store_count; - } - e.update_cart(t, pitem, item); - } - } + break; + default: + normal_check(store_count,goodsinfo,wareIds); + break + } } }); }, @@ -1733,8 +1840,6 @@ Page({ }, - - //-------下拉刷新--------- onPullDownRefresh: function(t) { this.getCardList(); @@ -1749,7 +1854,6 @@ Page({ title:"计算中" }) } - var garr=this.data.requestData; var check_is_goods_selected=0; if(garr) { @@ -1779,9 +1883,10 @@ Page({ for (var j = 0; j < i_arr.length; j++) { if (i_arr[j].selected && i_arr[j].is_gift != 1) { - if (i_arr[j].is_pd_normal) { + if (i_arr[j].is_pd_normal || i_arr[j].prom_type==0 || i_arr[j].prom_type==3) { normal_arr[i_arr[j].goods_id] = 1; } + //map 的key是不会重复,会覆盖,, var ie = { goods_id: i_arr[j].goods_id, @@ -1886,6 +1991,7 @@ Page({ var promgoodsbuynum = 0; var goodsbuynum = 0; + //--要获得商品,该用户买了多少件,同步应用-- await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { @@ -1935,7 +2041,6 @@ Page({ return false; } } - if (num > val.redisnum && val.redisnum && !normal_arr[val.goods_id]) { isok = 0; gname = val.goods_name; diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 7d7e1ae..7e52d05 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -983,6 +983,7 @@ Page({ //t.data.data.shop_price = tt.data.data.prom_price; t.data.data.shop_price = tt.data.data.prom_user_price; th.data.ckeck_quan_price=0; + gd.is_xz_yh=1; } else { t.data.data.prom_id = 0; t.data.data.prom_type = 0; @@ -1022,9 +1023,13 @@ Page({ t.data.data.prom_type = 0; } - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; - th.data.check_quan_ware_list = t.data.data.erpwareid + ""; + if(tt.data.data.isQuan){ + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; + th.data.check_quan_ware_list = t.data.data.erpwareid + ""; + }else{ + gd.is_xz_yh=1; + } th.setData({ bn_goods: gd, @@ -1420,7 +1425,7 @@ Page({ } //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- - if (cart_item.exp_type == 0 && th.data.user_addr != null) { + if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) { //看是不是有调用过包邮券 if (!th.data.isget_by_quan[pickid]) { //--判断要不要显示包邮券,调用接口,因为有for循环--- @@ -1428,7 +1433,8 @@ Page({ data: { store_id: os.stoid, isuse: 0, - condition: q_conditin, + //condition: q_conditin, + condition:cart_item.ckeck_quan_price, user_id: getApp().globalData.user_id, pageSize: 2000 } @@ -1453,10 +1459,10 @@ Page({ } if (arr) { th.data.get_by_quan_list_cart[pickid] = arr; - //th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); - if (th.data.is_b_now) { - th.setData({get_by_quan_list: arr}); - } + th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); + //if (th.data.is_b_now) { + // th.setData({get_by_quan_list: arr}); + //} } th.data.isget_by_quan[pickid] = 1; } @@ -3428,6 +3434,19 @@ Page({ if (gd.prom_type == 1 || gd.is_gift || gd.prom_type == 7) { continue; } + + //--如果是团购,要判断有没有限制使用优惠券 + if(gd.prom_type == 2){ + var prom1=null; + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { + }).then(res => { + if (res.data.code == 0) prom1 = res.data.data; + }) + if(!prom1.isQuan){ + continue; + } + } + //如果有限制使用优惠券,就要返回 if (gd.prom_type == 3) { if (th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue; @@ -3466,6 +3485,7 @@ Page({ arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; 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; //是否关闭使用优惠券 if (th.data.is_close_quan != 1 && !is_xz_yh) { @@ -3475,7 +3495,7 @@ Page({ data: { storeId: oo.stoid, userId: app.globalData.user_id, - BuySum: ckeck_quan_price, + BuySum: arr[ind].ckeck_quan_price, WareIds: check_quan_ware_list, pageSize: 100 } diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 0d83ba4..2e90b3a 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -296,5 +296,31 @@ Page({ var th = this; var url = e.currentTarget.dataset.url; getApp().goto(url); - } + }, + + onShareAppMessage: function (e) { + var curPage=this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + return { + title: "专享礼包", + path:pagePath, + } + }, + + onShareTimeline() { + var curPage=this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + return { + title: '专享礼包', + imageUrl: this.data.ad_data.ad_code, + path: pagePath, + } + }, + }) \ No newline at end of file diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index febc280..99b8d55 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -469,7 +469,7 @@ Page({ } else { //要用接口是获取距离,js的计算不准 getApp().request.promiseGet("/api/weshop/pickup/list", { - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon }, + data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon,isstop:0,is_pos:1 }, }).then(res => { if (res.data.code == 0) { e = res.data.data.pageData[0]; @@ -798,9 +798,14 @@ Page({ }); } - //-- 把商品的赋值 -- + //-- 把商品的赋值,同时给活动赋值 -- ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); - if(ee.data.prom_type!=1 && ee.data.prom_type!=4 && ee.data.prom_type!=6 && ee.data.prom_type!=2) + if(t.data.data.prom_type && t.data.data.prom_id){ + ee.data.prom_type=t.data.data.prom_type; + ee.data.prom_id=t.data.data.prom_id; + } + + if(ee.data.prom_type!=1 && ee.data.prom_type!=4 && ee.data.prom_type!=6 && ee.data.prom_type!=2) ee.check_is_youhui(ee.data.gid); t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); @@ -2252,16 +2257,10 @@ Page({ if (res.data.code == 0) prom = res.data.data; }) break - case 8: continue; - - case 8: - continue; - } - } //---如果有活动,不算在一起--- if (prom) { @@ -2498,12 +2497,14 @@ Page({ store_id: o.stoid, distr_type: g_distr_type, isstop: 0, + is_pos:1, pageSize: 2000 } } else { dd = { store_id: o.stoid, isstop: 0, + is_pos:1, pageSize: 2000 } } @@ -3023,44 +3024,24 @@ Page({ getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gid+"/"+ prom_id, { success: function (t) { if (t.data.code != 0) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } //----已经结束----- if (t.data.data.is_end == 1) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } //----已经过期----- var now = ut.gettimestamp(); if (t.data.data.end_time < now || t.data.data.start_time>now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } /*-- 还没有开始预热的也不显示 --*/ if (t.data.data.show_time > now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } @@ -3135,43 +3116,23 @@ Page({ getApp().request.get("/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id, { success: function (t) { if (t.data.code != 0) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } //----已经结束----- if (t.data.data.is_end == 1) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } //----已经过期----- var now = ut.gettimestamp(); if (t.data.data.end_time < now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } /*-- 还没有开始预热的也不显示 --*/ if (t.data.data.show_time > now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } @@ -3304,9 +3265,7 @@ Page({ ee.get_sto(); } else { - ee.setData({ prom_type: 0, isshow: 1, }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); + ee.get_normal(gid); return false; } }) @@ -3331,44 +3290,25 @@ Page({ success: function (t) { console.log(t,3124); if (t.data.code != 0) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); - return false; + ee.get_normal(gid); + return false; } //----已经结束----- if (t.data.data.is_end == 1) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - return false; + ee.get_normal(gid); + return false; } //----已经过期----- var now = ut.gettimestamp(); if (t.data.data.end_time < now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); - return false; + ee.get_normal(gid); + return false; } /*-- 还没有开始预热的也不显示 --*/ if (t.data.data.show_time > now) { - ee.setData({ - prom_type: 0, - isshow: 1, - }); - ee.get_sku(os.stoid, ee.data.data, gid); - ee.get_sto(); - return false; + ee.get_normal(gid); + return false; } /*-- 判断拼单是否启用 --*/ @@ -6055,9 +5995,21 @@ Page({ corpId: id, success(res) {} }) + }, + + get_normal(gid){ + this.setData({ + prom_type: 0, + isshow: 1, + }); + this.get_sku(os.stoid, this.data.data, gid); + this.get_sto(); + this.check_is_youhui(gid,1); + this.data.is_normal=1; } + }); diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js index bbc3986..e08bef1 100644 --- a/pages/goods/goodsList/goodsList.js +++ b/pages/goods/goodsList/goodsList.js @@ -42,7 +42,9 @@ Page({ } var th=this; - a.init(this, "", "requestData"); + + //a.init(this, "", "requestData"); + var url = this.data.baseUrl; this.data.is_new=t.is_new; this.data.is_hot=t.is_hot; @@ -171,10 +173,12 @@ Page({ } this.resetData(), this.requestGoodsList(url); }, - requestGoodsList: function(t) { - var e = this; + requestGoodsList:function(t) { + if(this.data.loading) return false; + this.data.loading=1; + var e = this,th=e; this.data.requestUrl = t; - + //不是商品分组的,不是默认排序的 if(t.indexOf("group_id")==-1 || e.data.tabname!="sort" ){ t += "&orderField=" + e.data.tabname; @@ -182,14 +186,94 @@ Page({ } t +="&page=" + e.data.currentPage; - a.request(t, - function(t) { - e.setData({is_go:1}); - e.data.currentPage++, null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)), - wx.stopPullDownRefresh(); - }, - null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid} - ); + getApp().request.promiseGet(t, {data:{is_mainshow: 1, isonsale: 1, store_id: oo.stoid}}).then(async res=>{ + th.data.loading=0; + e.setData({is_go:1}); + if(ut.ajax_ok(res)){ + e.data.currentPage++; + if(!e.data.requestData) e.data.requestData=[]; + for(let i in res.data.data.pageData){ + let item=res.data.data.pageData[i]; + item.original_img = th.data.url + item.original_img; + + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:oo.stoid,goodsidlist:item.goods_id,is_detail:1 + }; + //获取商品的实际活动 + await getApp().request.promiseGet(url, {data:req_data}).then(res=>{ + if(res.data.code==0 && res.data.data && res.data.data.length==1){ + item.prom_type=res.data.data[0].prom_type; + item.prom_id=res.data.data[0].act_id; + } + }) + + var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 + var prom_id=item.prom_id; + var now=ut.gettimestamp(); + var url = ""; + switch (prom_type){ + case 1: + var user_id=getApp().globalData.user_id; + if(!user_id) user_id=0; + url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id; + break; + case 2: + url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id + break; + case 4: + url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id; + break; + case 6: + url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; + break; + case 8: + var presell_id = prom_id; + var url1 = "/api/weshop/marketing/marketingPresellList/list"; + var rd= { + store_id: oo.stoid, + presell_id: presell_id, + goods_id: val.goods_id + } + //------获取预售从表---------- + await getApp().request.promiseGet(url1, { + data: rd + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { + var arr = res.data.data[0]; + item.prom_price = arr.luck_goods_price; + item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); + } + }) + break; + default: + break + } + if(url!=null && url!=''){ + await getApp().request.promiseGet(url, {}).then(res => { + var prom =null; + if(res && res.data) prom=res.data.data; + if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time {{item.goods_name}} - + diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index ed397a4..00d5f6f 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -31,7 +31,6 @@ Page({ onLoad: function(t) { this.data.rq_data=t; - //接受有没有导购的参数 var first_leader=t.first_leader; if(first_leader){ @@ -95,7 +94,7 @@ Page({ }) - e.init(this, "", "requestData"); + //e.init(this, "", "requestData"); var url = this.data.baseUrl; //扫一扫过来,显示搜索的内容 @@ -112,9 +111,8 @@ Page({ if (url != this.data.baseUrl) return this.requestSearch(url); this.openSearchModal(); - - // 获取历史搜索记录 - this.getHistorySearch(); + // 获取历史搜索记录 + this.getHistorySearch(); }, changeTab: function(t) { var ord = t.currentTarget.dataset.href; @@ -134,24 +132,100 @@ Page({ //-----------真的调用地址进行搜索------------ requestSearch: function(t) { - var a = this; - + if(this.data.loading) return false; + this.data.loading=1; + var e = this,th=e; if(getApp().globalData.userInfo){ t += "&user_id=" + getApp().globalData.userInfo.user_id; } + this.data.requestUrl = t; + getApp().request.promiseGet(t, {data:{is_mainshow: 1, isonsale: 1, store_id: oo.stoid,orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage}}).then(async res=>{ + th.data.loading=0; + if(ut.ajax_ok(res)){ + if(!e.data.requestData) e.data.requestData=[]; + for(let i in res.data.data.pageData){ + let item=res.data.data.pageData[i]; + item.original_img = th.data.url + item.original_img; + + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:oo.stoid,goodsidlist:item.goods_id,is_detail:1 + }; + //获取商品的实际活动 + await getApp().request.promiseGet(url, {data:req_data}).then(res=>{ + if(res.data.code==0 && res.data.data && res.data.data.length==1){ + item.prom_type=res.data.data[0].prom_type; + item.prom_id=res.data.data[0].act_id; + } + }) + + var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 + var prom_id=item.prom_id; + var now=ut.gettimestamp(); + var url = ""; + switch (prom_type){ + case 1: + var user_id=getApp().globalData.user_id; + if(!user_id) user_id=0; + url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id; + break; + case 2: + url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id + break; + case 4: + url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id; + break; + case 6: + url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; + break; + case 8: + var presell_id = prom_id; + var url1 = "/api/weshop/marketing/marketingPresellList/list"; + var rd= { + store_id: oo.stoid, + presell_id: presell_id, + goods_id: val.goods_id + } + //------获取预售从表---------- + await getApp().request.promiseGet(url1, { + data: rd + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { + var arr = res.data.data[0]; + item.prom_price = arr.luck_goods_price; + item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); + } + }) + break; + default: + break + } + if(url!=null && url!=''){ + await getApp().request.promiseGet(url, {}).then(res => { + var prom =null; + if(res && res.data) prom=res.data.data; + if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time {{item.goods_name}} - + {{item.prom_integral}}积分 diff --git a/pages/index/index/index.js b/pages/index/index/index.js index c2508e4..6111093 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -17,6 +17,7 @@ var d = getApp().globalData; var full_screen = require('full_screen.js'); + Page({ data: { url: o.imghost, @@ -86,8 +87,6 @@ Page({ }, onLoad: async function (tt) { - console.log("进入首页-------------"); - console.log(tt); var th = this; var first_leader = tt.first_leader; if (!first_leader && tt.scene) { @@ -139,8 +138,8 @@ Page({ var pages = getCurrentPages(); //获取加载的页面 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 - console.log("当前路由"); - console.log(currentPage.route); + // console.log("当前路由"); + // console.log(currentPage.route); th.setappdata(ob); @@ -173,7 +172,6 @@ Page({ getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { data: {} }).then(function (data) { - // console.log('909090909090----->', data.data.code); let code = data.data.code; if (code == 0) { @@ -230,6 +228,7 @@ Page({ if (new_nav == "") { th.is_new(); } + // sty setTimeout(function () { if (getApp().globalData.user_id) getApp().requestCardNum(th); }, 500) @@ -392,6 +391,7 @@ Page({ active: index //数字是当前页面在tabbar的索引 }) + //sty getApp().requestCardNum(this); } @@ -421,6 +421,22 @@ Page({ getApp().globalData.isLoad_ad = 1; } }, 1500) + + + // 获取幸运购活动列表 + getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { + data: { + store_id: getApp().globalData.setting.stoid, + is_end: 0, + timetype: 1, + } + }).then(res => { + if(res.data.code == 0) { + th.setData({ + luckGo_list: res.data.data.pageData.slice(0,3), + }); + } + }); @@ -601,6 +617,14 @@ Page({ }); } }) + + + + + + + + //---调用信息--- // this.requestRecommend(); this.setData({ @@ -615,6 +639,7 @@ Page({ th.is_new(); } + // sty setTimeout(function () { if (getApp().globalData.user_id) getApp().requestCardNum(th); }, 500) @@ -1140,6 +1165,8 @@ Page({ } var url=e.currentTarget.dataset.url; getApp().goto(url); - } + }, + + }); \ No newline at end of file diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index e19dbb0..46111fc 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -229,43 +229,46 @@ - - - - - - 幸运购 - - - 查看全部 - + + + + + + + 幸运购 + + + 查看全部 + + - - - - - - - - - 我是商品 - - - 189.00 - 零售价:155 - - - - 去参团 + + + + + + + + {{item.title}} + + + {{filter.price(item.group_price)}} + 零售价:{{item.market_price}} + + + + 去参团 + + + - + *{{item.group_num}}人成团,{{item.group_win}}人得商品,{{item.group_num - item.group_win}}人全额退款并得惊喜礼品 - *5人成团,5人得商品,5人全额退款并得惊喜礼品 - diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index fb89c60..78f38b3 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -1151,7 +1151,7 @@ page { } .luck .name::before { - content: '5人团'; + content: attr(data-content); background-color: #FF6768; color: white; font-size: 26rpx; diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index 48df9f5..aae5de6 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -370,7 +370,6 @@ Page({ th.toast(content); return false; } - //当是组合优惠的时候 if(good.prom_type==7){ //如果有组合购 @@ -439,30 +438,72 @@ Page({ //如果优惠促销和搭配购的时候 if((good.prom_type==3 || good.prom_type==5) && good.is_collocation!=1 && good.is_gift!=1){ - var p_ok=1; - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => { - if(res.data.code==0){ - var r_data=res.data.data; - if(!r_data.collocationPromList && good.prom_type==5){ - - var content=good.goods_name+'未找到活动,请取消订单重新购买'; - th.toast(content); - p_ok=0; - } - if(!r_data.promGoodsLists && good.prom_type==3){ - - var content=good.goods_name+'未找到活动,请取消订单重新购买'; - th.toast(content); - p_ok=0; - } - }else{ - - var content=good.goods_name+'未找到活动,请取消订单重新购买'; - th.toast(content); - p_ok=0; - } - }) - if(!p_ok) return false; + var p_ok = 1,is_g_prom=0; + //因为有全场优惠活动,商品参加的活动还未开始 + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:os.stoid,goodsidlist:good.goods_id,is_detail:1,user_id:user_id + }; + await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { + if(res.data.code==0 && res.data.data && res.data.data.length){ + for(let i in res.data.data){ + let item=res.data.data[i]; + if(item.prom_type==3) { + is_g_prom=1; break; + } + } + } + }) + if(is_g_prom){ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (!r_data.collocationPromList && good.prom_type == 5) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content) + p_ok = 0; + } + if (!r_data.promGoodsLists && good.prom_type == 3) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content); + p_ok = 0; + } + } else { + + var content = good.goods_name + '未找到活动,请取消订单重新购买' + th.toast(content); + p_ok = 0; + } + }) + }else{ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (!r_data.collocationPromList && good.prom_type == 5) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content) + + p_ok = 0; + } + if (!r_data.promGoodsLists && good.prom_type == 3) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content); + p_ok = 0; + } + } else { + + var content = good.goods_name + '未找到活动,请取消订单重新购买' + th.toast(content); + p_ok = 0; + } + }) + + } + if (!p_ok) return false; } //商品的普通购买 ,不要进行判断 @@ -1074,15 +1115,43 @@ Page({ //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 if(g_item.prom_type==3 || good.prom_type==3){ - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { - if (res.data.code == 0) { - var r_data = res.data.data; - if (r_data.promGoodsLists) { - b_item.prom_type=3; - b_item.prom_id=r_data.promGoodsLists[0].prom_id; - } - } - }) + var is_g_prom=0; + //因为有全场优惠活动,商品参加的活动还未开始 + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:os.stoid,goodsidlist:good.goods_id,is_detail:1,user_id:user_id + }; + await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { + if(res.data.code==0 && res.data.data && res.data.data.length){ + for(let i in res.data.data){ + let item=res.data.data[i]; + if(item.prom_type==3) { + is_g_prom=1; break; + } + } + } + }) + if(is_g_prom) { + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (r_data.promGoodsLists) { + b_item.prom_type = 3; + b_item.prom_id = r_data.promGoodsLists[0].prom_id; + } + } + }) + }else{ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (r_data.promGoodsLists) { + b_item.prom_type = 3; + b_item.prom_id = r_data.promGoodsLists[0].prom_id; + } + } + }) + } } diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index b095238..8e3c85d 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -620,34 +620,73 @@ Page({ } } - - //如果优惠促销和搭配购的时候 if ((good.prom_type == 3 || good.prom_type == 5) && good.is_gift != 1 && good.is_collocation != 1) { - var p_ok = 1; - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { - if (res.data.code == 0) { - var r_data = res.data.data; - if (!r_data.collocationPromList && good.prom_type == 5) { + var p_ok = 1,is_g_prom=0; + //因为有全场优惠活动,商品参加的活动还未开始 + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:os.stoid,goodsidlist:good.goods_id,is_detail:1,user_id:user_id + }; + await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { + if(res.data.code==0 && res.data.data && res.data.data.length){ + for(let i in res.data.data){ + let item=res.data.data[i]; + if(item.prom_type==3) { + is_g_prom=1; break; + } + } + } + }) + if(is_g_prom){ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (!r_data.collocationPromList && good.prom_type == 5) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content) + p_ok = 0; + } + if (!r_data.promGoodsLists && good.prom_type == 3) { - var content = good.goods_name + '未找到活动,请取消订单重新购买'; - th.toast(content) + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content); + p_ok = 0; + } + } else { + var content = good.goods_name + '未找到活动,请取消订单重新购买' + th.toast(content); p_ok = 0; } - if (!r_data.promGoodsLists && good.prom_type == 3) { + }) + }else{ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (!r_data.collocationPromList && good.prom_type == 5) { + + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content) + + p_ok = 0; + } + if (!r_data.promGoodsLists && good.prom_type == 3) { - var content = good.goods_name + '未找到活动,请取消订单重新购买'; + var content = good.goods_name + '未找到活动,请取消订单重新购买'; + th.toast(content); + p_ok = 0; + } + } else { + + var content = good.goods_name + '未找到活动,请取消订单重新购买' th.toast(content); p_ok = 0; } - } else { + }) - var content = good.goods_name + '未找到活动,请取消订单重新购买' - th.toast(content); - p_ok = 0; - } - }) + } if (!p_ok) return false; } @@ -1244,15 +1283,44 @@ Page({ //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 if(g_item.prom_type==3 || good.prom_type==3){ - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { - if (res.data.code == 0) { - var r_data = res.data.data; - if (r_data.promGoodsLists) { - b_item.prom_type=3; - b_item.prom_id=r_data.promGoodsLists[0].prom_id; + var is_g_prom=0; + //因为有全场优惠活动,商品参加的活动还未开始 + var url="/api/weshop/activitylist/getGoodActInfo"; + var req_data={ + store_id:os.stoid,goodsidlist:good.goods_id,is_detail:1,user_id:user_id + }; + await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { + if(res.data.code==0 && res.data.data && res.data.data.length){ + for(let i in res.data.data){ + let item=res.data.data[i]; + if(item.prom_type==3) { + is_g_prom=1; break; + } + } } + }) + if(is_g_prom) { + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (r_data.promGoodsLists) { + b_item.prom_type = 3; + b_item.prom_id = r_data.promGoodsLists[0].prom_id; + } + } + }) + }else{ + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (r_data.promGoodsLists) { + b_item.prom_type = 3; + b_item.prom_id = r_data.promGoodsLists[0].prom_id; + } + } + }) } - }) + }