diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index d69e5c1..72eeefe 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -1,7 +1,7 @@ var ut = require("../../../../utils/util.js"), e = require("../../../../utils/common.js"), a = require("../../../../utils/wxParse/wxParse.js"), - s = getApp(),app=s, + s = getApp(), app = s, i = s.request, rq = i, oo = s.globalData, @@ -247,14 +247,14 @@ Page({ fir_goods: null, share_hidden: false, - pre_arr:null, + pre_arr: null, }, //------初始化加载---------- onLoad: function (t) { - var ee = this, that = ee, th = ee, - pre_id=t.pre_id, - gid=t.goods_id, + var ee = this, that = ee, th = ee, + pre_id = t.pre_id, + gid = t.goods_id, first_leader = t.first_leader, room_id = t.room_id, room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id @@ -305,8 +305,8 @@ Page({ } } - this.data.gid=gid; - this.data.pre_id=pre_id; + this.data.gid = gid; + this.data.pre_id = pre_id; if (first_leader) { console.log("log---".first_leader); @@ -425,17 +425,17 @@ Page({ }, - //--- 设置一下默认库存的数量 ---- - set_def_storage(ee) { - var that = this, th = this; - that.data.fir_def_store = ee; - that.setData({ - def_pick_store: ee, - sto_sele_name: ee.pickup_name, - sto_sele_id: ee.pickup_id, - sto_sele_distr: ee.distr_type - }) - }, + //--- 设置一下默认库存的数量 ---- + set_def_storage(ee) { + var that = this, th = this; + that.data.fir_def_store = ee; + that.setData({ + def_pick_store: ee, + sto_sele_name: ee.pickup_name, + sto_sele_id: ee.pickup_id, + sto_sele_distr: ee.distr_type + }) + }, //------------程序初始化入口------------- @@ -590,7 +590,7 @@ Page({ //-- 如果是预览图片,页面不重新更新 -- var show_prew_img = this.data.show_prew_img if (show_prew_img) { - this.data.show_prew_img = 0; return false; + this.data.show_prew_img = 0; return false; } //优惠券要实时更新 @@ -611,202 +611,202 @@ Page({ }, 300) this.data.is_timer = 1; - var ee = this,gid = this.data.gid,i = getApp().request; + var ee = this, gid = this.data.gid, i = getApp().request; this.wait_for_store_config(); this.get_pre_prom(function () { - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { - failRollback: !0, - success: function (t) { - console.log(t); - if (t.data.code == 0) { - if (t.data.data.is_on_sale != 1) { - wx.showModal({ - title: '商品已经下架', - showCancel: !1, - complete: function () { - wx.navigateBack(); - } - }); - } - var timestamp = Date.parse(new Date()); - timestamp = timestamp / 1000; - if (t.data.data.on_time > timestamp) { - wx.showModal({ - title: '商品还未上架', - showCancel: !1, - complete: function () { - wx.navigateBack(); - } - }); - } + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { + failRollback: !0, + success: function (t) { + console.log(t); + if (t.data.code == 0) { + if (t.data.data.is_on_sale != 1) { + wx.showModal({ + title: '商品已经下架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + var timestamp = Date.parse(new Date()); + timestamp = timestamp / 1000; + if (t.data.data.on_time > timestamp) { + wx.showModal({ + title: '商品还未上架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } - if (t.data.data.down_time > 0) { - if (t.data.data.down_time < timestamp) { - wx.showModal({ - title: '商品已经到期下架', - showCancel: !1, - complete: function () { - wx.navigateBack(); - } - }); - } - } - //动态获取商品名称 - wx.setNavigationBarTitle({ - title: t.data.data.goods_name, - }); + if (t.data.data.down_time > 0) { + if (t.data.data.down_time < timestamp) { + wx.showModal({ + title: '商品已经到期下架', + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + } + //动态获取商品名称 + wx.setNavigationBarTitle({ + title: t.data.data.goods_name, + }); - //-- 把商品的赋值 -- - ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); + //-- 把商品的赋值 -- + ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); - //获取用户的默认门店 - getApp().get_user_store(function (e) { - if (!e) { - th.data.fir_def_store = {}; //赋值空对象 - return false; - } - var ee = JSON.parse(JSON.stringify(e)); + //获取用户的默认门店 + getApp().get_user_store(function (e) { + if (!e) { + th.data.fir_def_store = {}; //赋值空对象 + return false; + } + var ee = JSON.parse(JSON.stringify(e)); + + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { + ee.is_no_dis = 1; + } + + var appd = getApp().globalData; + var w_time = setInterval(function () { + if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); + var e = JSON.parse(JSON.stringify(ee)); - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { - ee.is_no_dis = 1; + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { + that.set_def_storage(e); + + } 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 + }, + }).then(res => { + if (res.data.code == 0) { + e = res.data.data.pageData[0]; + if (e) { + e.is_no_dis = ee.is_no_dis; + appd.pk_store = e; + that.set_def_storage(e); } - var appd = getApp().globalData; - var w_time = setInterval(function () { - if (that.data.is_get_local_ok == 0) return false; - clearInterval(w_time); - var e = JSON.parse(JSON.stringify(ee)); - - //如果有开启近距离的话,同时距离优不一样了 - if (that.data.lat != null) { - //如果经纬度有变化的话 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { - that.set_def_storage(e); - - } 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 - }, - }).then(res => { - if (res.data.code == 0) { - e = res.data.data.pageData[0]; - if (e) { - e.is_no_dis = ee.is_no_dis; - appd.pk_store = e; - that.set_def_storage(e); - } - - } - }) - } - appd.lat = that.data.lat; - appd.lon = that.data.lon; - - } else { - if (e) { - e.distance = null; - - that.set_def_storage(e); - } - } - }, 500) - }); + } + }) + } + appd.lat = that.data.lat; + appd.lon = that.data.lon; + } else { + if (e) { + e.distance = null; + that.set_def_storage(e); + } + } + }, 500) + }); - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); - var cur_price = t.data.data.shop_price; - if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { - var cfile = getApp().globalData.userInfo.card_field; - if (t.data.data[cfile]) { - cur_price = t.data.data[cfile]; - } - } - var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString(); - txt = parseFloat(txt); - t.data.data['disc'] = txt; - if (t.data.data.original_img.indexOf(o.imghost) == -1) - t.data.data.original_img = o.imghost + t.data.data.original_img; + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; + var cur_price = t.data.data.shop_price; + if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { + var cfile = getApp().globalData.userInfo.card_field; + if (t.data.data[cfile]) { + cur_price = t.data.data[cfile]; + } + } + var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString(); + txt = parseFloat(txt); - //-----商品详情--- - if (!t.data.data.goods_content) t.data.data.goods_content = " "; - a.wxParse("content", "html", t.data.data.goods_content, ee, 6); - e.wxParseAddFullImageUrl(ee, "content"); + t.data.data['disc'] = txt; + if (t.data.data.original_img.indexOf(o.imghost) == -1) + t.data.data.original_img = o.imghost + t.data.data.original_img; - ee.setData({ - data: t.data.data, - sele_g: t.data.data, - userInfo: getApp().globalData.userInfo - }); + if (t.data.data.goods_content == null) t.data.data.goods_content = ""; - //获取门店 - ee.get_sto(); - ee.get_sku(o.stoid, t.data.data, gid); - - - ee.data.g_buy_num = new Map(); - - if (ee.data.cat_name == '') { - //过去国别,分类,品牌的名称 - i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, { - success: function (t) { - var dd = t.data.data; - if (t.data.code == 0) { - th.setData({ - cat_name: dd.name - }); - } - } - }); - //过去国别,分类,品牌的名称 - i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, { - success: function (t) { - var dd = t.data.data; - if (t.data.code == 0) { - th.setData({ - brand_name: dd.name - }); - } - } - }); - //过去国别,分类,品牌的名称 - i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, { - success: function (t) { - var dd = t.data.data; - if (t.data.code == 0) { - th.setData({ - nation_name: dd.name - }); - } - } - }); - } + //-----商品详情--- + if (!t.data.data.goods_content) t.data.data.goods_content = " "; + a.wxParse("content", "html", t.data.data.goods_content, ee, 6); + e.wxParseAddFullImageUrl(ee, "content"); + ee.setData({ + data: t.data.data, + sele_g: t.data.data, + userInfo: getApp().globalData.userInfo + }); + + //获取门店 + ee.get_sto(); + ee.get_sku(o.stoid, t.data.data, gid); + + + ee.data.g_buy_num = new Map(); + + if (ee.data.cat_name == '') { + //过去国别,分类,品牌的名称 + i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, { + success: function (t) { + var dd = t.data.data; + if (t.data.code == 0) { + th.setData({ + cat_name: dd.name + }); + } } - else { - wx.showModal({ - title: t.data.msg, - showCancel: !1, - complete: function () { - wx.navigateBack(); - } + }); + //过去国别,分类,品牌的名称 + i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, { + success: function (t) { + var dd = t.data.data; + if (t.data.code == 0) { + th.setData({ + brand_name: dd.name }); + } } + }); + //过去国别,分类,品牌的名称 + i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, { + success: function (t) { + var dd = t.data.data; + if (t.data.code == 0) { + th.setData({ + nation_name: dd.name + }); + } + } + }); } - }); - ee.data.enterAddressPage && (this.data.enterAddressPage = !1); + + } + else { + wx.showModal({ + title: t.data.msg, + showCancel: !1, + complete: function () { + wx.navigateBack(); + } + }); + } + } + }); + ee.data.enterAddressPage && (this.data.enterAddressPage = !1); }) @@ -931,12 +931,12 @@ Page({ var th = this; var ind = t.currentTarget.dataset.openSpecModal_ind; if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind; - th.setData({ - open_ind_store: ind + th.setData({ + open_ind_store: ind }); - + th.add_cart_func(t); - + }, @@ -951,7 +951,7 @@ Page({ return s.my_warnning("还未登录!", 0, this); } - var e = this,th = e, o = this.data.sele_g,a = o.goods_id; + var e = this, th = e, o = this.data.sele_g, a = o.goods_id; //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, function (ee) { //---判断商品是否超出限购--- @@ -994,7 +994,7 @@ Page({ goods_name: o.goods_name, goods_sn: o.goods_sn, sku: o.sku, - presell_list_id:th.data.presellList.id, + presell_list_id: th.data.presellList.id, }; //---是不是从收藏夹出来的--- @@ -1031,16 +1031,16 @@ Page({ newd.pricing_type = o.pricing_type; } - newd.goods_price = th.data.prom_price; - newd.member_goods_price = th.data.prom_price, + newd.goods_price = th.data.prom_price; + newd.member_goods_price = th.data.prom_price, newd.prom_type = 8; - newd.prom_id = o.prom_id; + newd.prom_id = o.prom_id; + + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 - }) }, @@ -1128,7 +1128,7 @@ Page({ } }) - }else { + } else { newd['pick_name'] = th.data.sto_sele_name; newd['pick_dis'] = th.data.sto_sele_distr; th.buyNow(newd); @@ -1137,18 +1137,18 @@ Page({ //----------立即购买----------- buyNow: function (e) { - + this.setData({ openSpecModal: 0, openSpecModal_inte: 0, openSpecModal_inte_normal: 0, openSpecModal_pt: 0, }) - - app.set_b_now(e); + + app.set_b_now(e); getApp().goto("/packageC/pages/presell/cart/cart2_pre"); - - + + }, //----------增加购买数量----------- @@ -1722,8 +1722,8 @@ Page({ is_on_sale: 1, pageSize: 500, orderField: 'sort', - prom_id:tt.data.presellForm.id, - prom_type:8, + prom_id: tt.data.presellForm.id, + prom_type: 8, } }).then(res => { var e = res; @@ -1910,7 +1910,7 @@ Page({ //---------拿出门店分类和门店------------ get_sto(e) { - var th = this,is_normal = e; + var th = this, is_normal = e; if (e == 1) { th.setData({ is_normal: 1 }) @@ -2854,10 +2854,7 @@ Page({ }; //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 - var type = this.data.prom_type; - if (type == 6) type = 2; - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; - + var type = 8; wx.showLoading({ title: '生成中...', }) @@ -2949,12 +2946,8 @@ Page({ context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); } - 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; - if (th.data.prom_type == 4) share_title = th.data.prom_act.name; - } + var share_title = th.data.presellForm.share_title; + share_title ? share_title : th.data.data.goods_name; //---产品名称--- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 @@ -2962,34 +2955,34 @@ Page({ context.setFillStyle("black"); context.setFontSize(21.3 * unit) th.draw_Text(context, share_title, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); + 80 * unit, 200 * unit, 200 * unit, 279 * unit, unit); //------产品的价格------- - context.setFontSize(23 * unit) + context.setFontSize(22 * unit) context.setFillStyle("red") - var pri0 = th.data.data.shop_price; - if (th.data.prom_act) - pri0 = th.data.prom_act.price; + var pri0 = th.data.presellList.presell_money; + // 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.setFontSize(22 * unit) context.fillText(pri0, wd1, 185 * unit); //---市场价划掉--- - context.setFillStyle("gray") + context.setFillStyle("red") context.setFontSize(22 * unit) 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); + context.fillText('定金', 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(); + // 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 { context.setFillStyle("black"); @@ -3009,227 +3002,82 @@ Page({ context.fillText(text, 38 * unit, 235 * unit); } - + console.log(th.data.share_goods_img); + let share_goods_img=th.data.presellForm.share_img; + share_goods_img?share_goods_img:th.data.data.share_goods_img; //---中间大图--- context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); - //-------大图后面就不一样了----------- - switch (type) { - case 0: //普通商品的展示 - case 4: - //中间的几个字 - if (th.data.poster && parseInt(th.data.poster.style) == 2) { - if (parseInt(th.data.poster.show_quality)) { - var g_path = "../../../../images/share/s_gou.png"; - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("正品保证", 84 * unit, 690 * unit); - - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("纯实体店", 246 * unit, 690 * unit); - - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("官方验证", 420 * unit, 690 * unit); - } - - } else { - var g_path = "../../../../images/share/s_gou.png"; - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("正品保证", 84 * unit, 690 * unit); - - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("纯实体店", 246 * unit, 690 * unit); - - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); - context.setFillStyle("red") - context.setFontSize(18 * unit) - context.fillText("官方验证", 420 * unit, 690 * unit); - } - - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 710 * unit) - context.lineTo(520 * unit, 710 * unit) - context.stroke(); - - //---文字--- - context.setFillStyle("black") - context.setFontSize(22 * unit) - - if (type == 0) { - // 原来start ---> - context.setFontSize(24 * unit) - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); - - context.setFontSize(22 * unit) - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); - - } else { - context.setFontSize(24 * unit) - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); - context.setFontSize(22 * unit) - context.fillText("长按识别二维码", 40 * unit, 806 * unit); - context.fillText("立即开始兑换", 40 * unit, 846 * 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; - case 1: //秒杀商品的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - - //画秒杀的图片 - var miaos_path = '../../../../images/share/miao_share.png'; - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); - - context.setFillStyle("black") - context.setFontSize(24 * unit) - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * 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, 135 * unit, 135 * unit); - } else { - //---二维吗图--- - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); - } - break; - - case 2: //会员团和商家团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - //---文字--- - - context.setFillStyle("black") - context.setFontSize(24 * unit) - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * 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.prom_act.ct_num; - context.setFontSize(14 * unit) - context.font = 'normal'; + //预售 + /* 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"; + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * 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.prom_act.buy_num + "份", 166 * unit, 763 * unit); + context.setFontSize(18 * unit) + context.fillText("正品保证", 84 * unit, 690 * unit); - context.setFillStyle("gray") - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); - context.setFillStyle("black") - context.font = 'normal bold 18px sans-serif'; - context.setFontSize(21.3 * unit) - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * 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 - case 3: //阶梯团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - //---文字--- + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("纯实体店", 246 * unit, 690 * unit); - context.setFillStyle("black") - context.setFontSize(24 * unit) - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); - - //---绘制中间阶梯的价格--- - var list = th.data.prom_act.ct_rylist; - for (var i = 0; i < list.length; i++) { - var item = list[i]; - var wi = i * 90 * unit; - context.font = 'normal'; - context.setFontSize(16 * unit) - context.setFillStyle("red") - context.fillText("¥", 40 * unit + wi, 756 * unit); - context.setFontSize(22 * unit) - var pri = parseFloat(item.price).toFixed(2); - context.fillText(pri, 56 * unit + wi, 756 * unit); - context.setFillStyle("gray") - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); - } - //----------------下面部分---------------- - // context.setFillStyle("gray") - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); - // context.setFillStyle("black") - // context.font = 'normal bold 18px sans-serif'; - // context.setFontSize(22 * unit) - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); - //context.setFillStyle("gray") - context.setFillStyle("black") - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); - //context.font = 'normal bold 18px sans-serif'; - context.setFontSize(21 * unit) - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * 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 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("官方验证", 420 * unit, 690 * unit); + } + } else { + var g_path = "../../../../images/share/s_gou.png"; + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("正品保证", 84 * unit, 690 * unit); + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("纯实体店", 246 * unit, 690 * unit); + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("官方验证", 420 * unit, 690 * unit); + } */ + + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 665 * unit) + context.lineTo(520 * unit, 665 * unit) + context.stroke(); + + //---文字--- + context.setFillStyle("black") + // context.setFontSize(22 * unit) + context.setFontSize(24 * unit) + context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); + context.setFillStyle("red") + context.setFontSize(20 * unit) + var presell_price = `预售价:${th.data.presellList.presell_price}` + context.fillText(presell_price, 40 * unit, 801 * unit); + context.setFillStyle("black") + context.setFontSize(22 * unit) + context.fillText("特惠好物,限时预售", 40 * unit, 836 * unit); + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * 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, 756 * unit, 130 * unit, 116 * unit); } + //--- 如果是自定义海报的时候 --- if (th.data.poster && parseInt(th.data.poster.style) == 2) { @@ -3437,9 +3285,12 @@ Page({ return false; } - var img_url = ee.data.data.original_img; - if ((this.data.prom_type == 1 || this.data.prom_type == 6) && this.data.prom_act.share_imgurl) { - img_url = this.data.iurl + this.data.prom_act.share_imgurl; + // var img_url = ee.data.data.original_img; + var img_url = ee.data.presellForm.share_img; + img_url?img_url:ee.data.data.original_img; + + if (img_url) { + img_url = this.data.iurl + img_url; } //获取商品是分享图信息 @@ -4181,100 +4032,100 @@ Page({ }, addCart_inte: function (t) { - this.add_cart_func_inte(t); + this.add_cart_func_inte(t); }, - onShareTimeline() { - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; - if (!store_name) - store_name = getApp().globalData.setting.appName; - return { - title: this.data.data.goods_name + '-' + store_name, - imageUrl: this.data.gallery[0].image_url, - } - }, - - clickCollapse() { - this.setData({flag: !this.data.flag,}) - }, + onShareTimeline() { + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; + if (!store_name) + store_name = getApp().globalData.setting.appName; + return { + title: this.data.data.goods_name + '-' + store_name, + imageUrl: this.data.gallery[0].image_url, + } + }, - clickShare() { - this.setData({share_hidden: true,}); - }, + clickCollapse() { + this.setData({ flag: !this.data.flag, }) + }, - send() { - this.setData({share_hidden: false,}); - }, + clickShare() { + this.setData({ share_hidden: true, }); + }, - cancel() { - this.setData({ - share_hidden: false, - }); - }, + send() { + this.setData({ share_hidden: false, }); + }, - //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 - check_nor_promgood(goods_id, back) { - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { - success: function (res) { - if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) { - var obj = { - act_id: res.data.data.promGoodsLists[0].prom_id, - } - back(obj); - } else { - back(0) - } - } - }) - }, + cancel() { + this.setData({ + share_hidden: false, + }); + }, - async get_pre_prom(func){ - var th = this; - var presell_id = null; - var pre_arr = null; - //------获取预售从表---------- - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { - if (res.data.code == 0 && res.data.data) { - var arr = res.data.data; - presell_id = arr.presell_id; - th.setData({ - presellList: arr, - }) - } - }) - if (!presell_id) { - wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000}) - return false; - } - //------获取预售主表---------- - await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { - if (res.data.code == 0 && res.data.data) { - th.setData({ - presellForm: res.data.data, - }); - th.countDown(res.data.data.end_time) - } - }) - var userInfo = getApp().globalData.userInfo; - var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid}; - if (userInfo) { - pre_data.user_id = userInfo.user_id; + //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 + check_nor_promgood(goods_id, back) { + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { + success: function (res) { + if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) { + var obj = { + act_id: res.data.data.promGoodsLists[0].prom_id, + } + back(obj); + } else { + back(0) } - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { - data: pre_data, - }).then(e => { - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { - pre_arr = e.data.data.pageData[0]; - th.setData({pre_arr: pre_arr}) - } + } + }) + }, + + async get_pre_prom(func) { + var th = this; + var presell_id = null; + var pre_arr = null; + //------获取预售从表---------- + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { + if (res.data.code == 0 && res.data.data) { + var arr = res.data.data; + presell_id = arr.presell_id; + th.setData({ + presellList: arr, }) - if (!pre_arr) { - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}) - } - if (func) { - func(); - } + } + }) + if (!presell_id) { + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 }) + return false; + } + //------获取预售主表---------- + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { + if (res.data.code == 0 && res.data.data) { + th.setData({ + presellForm: res.data.data, + }); + th.countDown(res.data.data.end_time) + } + }) + var userInfo = getApp().globalData.userInfo; + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid }; + if (userInfo) { + pre_data.user_id = userInfo.user_id; + } + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { + data: pre_data, + }).then(e => { + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { + pre_arr = e.data.data.pageData[0]; + th.setData({ pre_arr: pre_arr }) + } + }) + if (!pre_arr) { + wx.showToast({ title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000 }) + } + if (func) { + func(); } + } });