Commit 9f5f1ae255dd34057a2b0d1a5e89764a10b60f47

Authored by antploy
1 parent 8f243d11

预售海报

packageC/pages/presell/goodsInfo/goodsInfo.js
1 var ut = require("../../../../utils/util.js"), 1 var ut = require("../../../../utils/util.js"),
2 e = require("../../../../utils/common.js"), 2 e = require("../../../../utils/common.js"),
3 a = require("../../../../utils/wxParse/wxParse.js"), 3 a = require("../../../../utils/wxParse/wxParse.js"),
4 - s = getApp(),app=s, 4 + s = getApp(), app = s,
5 i = s.request, 5 i = s.request,
6 rq = i, 6 rq = i,
7 oo = s.globalData, 7 oo = s.globalData,
@@ -247,14 +247,14 @@ Page({ @@ -247,14 +247,14 @@ Page({
247 fir_goods: null, 247 fir_goods: null,
248 248
249 share_hidden: false, 249 share_hidden: false,
250 - pre_arr:null, 250 + pre_arr: null,
251 }, 251 },
252 252
253 //------初始化加载---------- 253 //------初始化加载----------
254 onLoad: function (t) { 254 onLoad: function (t) {
255 - var ee = this, that = ee, th = ee,  
256 - pre_id=t.pre_id,  
257 - gid=t.goods_id, 255 + var ee = this, that = ee, th = ee,
  256 + pre_id = t.pre_id,
  257 + gid = t.goods_id,
258 first_leader = t.first_leader, 258 first_leader = t.first_leader,
259 room_id = t.room_id, 259 room_id = t.room_id,
260 room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id 260 room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -305,8 +305,8 @@ Page({ @@ -305,8 +305,8 @@ Page({
305 } 305 }
306 } 306 }
307 307
308 - this.data.gid=gid;  
309 - this.data.pre_id=pre_id; 308 + this.data.gid = gid;
  309 + this.data.pre_id = pre_id;
310 310
311 if (first_leader) { 311 if (first_leader) {
312 console.log("log---".first_leader); 312 console.log("log---".first_leader);
@@ -425,17 +425,17 @@ Page({ @@ -425,17 +425,17 @@ Page({
425 }, 425 },
426 426
427 427
428 - //--- 设置一下默认库存的数量 ----  
429 - set_def_storage(ee) {  
430 - var that = this, th = this;  
431 - that.data.fir_def_store = ee;  
432 - that.setData({  
433 - def_pick_store: ee,  
434 - sto_sele_name: ee.pickup_name,  
435 - sto_sele_id: ee.pickup_id,  
436 - sto_sele_distr: ee.distr_type  
437 - })  
438 - }, 428 + //--- 设置一下默认库存的数量 ----
  429 + set_def_storage(ee) {
  430 + var that = this, th = this;
  431 + that.data.fir_def_store = ee;
  432 + that.setData({
  433 + def_pick_store: ee,
  434 + sto_sele_name: ee.pickup_name,
  435 + sto_sele_id: ee.pickup_id,
  436 + sto_sele_distr: ee.distr_type
  437 + })
  438 + },
439 439
440 440
441 //------------程序初始化入口------------- 441 //------------程序初始化入口-------------
@@ -590,7 +590,7 @@ Page({ @@ -590,7 +590,7 @@ Page({
590 //-- 如果是预览图片,页面不重新更新 -- 590 //-- 如果是预览图片,页面不重新更新 --
591 var show_prew_img = this.data.show_prew_img 591 var show_prew_img = this.data.show_prew_img
592 if (show_prew_img) { 592 if (show_prew_img) {
593 - this.data.show_prew_img = 0; return false; 593 + this.data.show_prew_img = 0; return false;
594 } 594 }
595 595
596 //优惠券要实时更新 596 //优惠券要实时更新
@@ -611,202 +611,202 @@ Page({ @@ -611,202 +611,202 @@ Page({
611 }, 300) 611 }, 300)
612 612
613 this.data.is_timer = 1; 613 this.data.is_timer = 1;
614 - var ee = this,gid = this.data.gid,i = getApp().request; 614 + var ee = this, gid = this.data.gid, i = getApp().request;
615 615
616 this.wait_for_store_config(); 616 this.wait_for_store_config();
617 this.get_pre_prom(function () { 617 this.get_pre_prom(function () {
618 - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {  
619 - failRollback: !0,  
620 - success: function (t) {  
621 - console.log(t);  
622 - if (t.data.code == 0) {  
623 - if (t.data.data.is_on_sale != 1) {  
624 - wx.showModal({  
625 - title: '商品已经下架',  
626 - showCancel: !1,  
627 - complete: function () {  
628 - wx.navigateBack();  
629 - }  
630 - });  
631 - }  
632 - var timestamp = Date.parse(new Date());  
633 - timestamp = timestamp / 1000;  
634 - if (t.data.data.on_time > timestamp) {  
635 - wx.showModal({  
636 - title: '商品还未上架',  
637 - showCancel: !1,  
638 - complete: function () {  
639 - wx.navigateBack();  
640 - }  
641 - });  
642 - } 618 + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
  619 + failRollback: !0,
  620 + success: function (t) {
  621 + console.log(t);
  622 + if (t.data.code == 0) {
  623 + if (t.data.data.is_on_sale != 1) {
  624 + wx.showModal({
  625 + title: '商品已经下架',
  626 + showCancel: !1,
  627 + complete: function () {
  628 + wx.navigateBack();
  629 + }
  630 + });
  631 + }
  632 + var timestamp = Date.parse(new Date());
  633 + timestamp = timestamp / 1000;
  634 + if (t.data.data.on_time > timestamp) {
  635 + wx.showModal({
  636 + title: '商品还未上架',
  637 + showCancel: !1,
  638 + complete: function () {
  639 + wx.navigateBack();
  640 + }
  641 + });
  642 + }
643 643
644 - if (t.data.data.down_time > 0) {  
645 - if (t.data.data.down_time < timestamp) {  
646 - wx.showModal({  
647 - title: '商品已经到期下架',  
648 - showCancel: !1,  
649 - complete: function () {  
650 - wx.navigateBack();  
651 - }  
652 - });  
653 - }  
654 - }  
655 - //动态获取商品名称  
656 - wx.setNavigationBarTitle({  
657 - title: t.data.data.goods_name,  
658 - }); 644 + if (t.data.data.down_time > 0) {
  645 + if (t.data.data.down_time < timestamp) {
  646 + wx.showModal({
  647 + title: '商品已经到期下架',
  648 + showCancel: !1,
  649 + complete: function () {
  650 + wx.navigateBack();
  651 + }
  652 + });
  653 + }
  654 + }
  655 + //动态获取商品名称
  656 + wx.setNavigationBarTitle({
  657 + title: t.data.data.goods_name,
  658 + });
659 659
660 - //-- 把商品的赋值 --  
661 - ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); 660 + //-- 把商品的赋值 --
  661 + ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
662 662
663 - //获取用户的默认门店  
664 - getApp().get_user_store(function (e) {  
665 - if (!e) {  
666 - th.data.fir_def_store = {}; //赋值空对象  
667 - return false;  
668 - }  
669 - var ee = JSON.parse(JSON.stringify(e)); 663 + //获取用户的默认门店
  664 + getApp().get_user_store(function (e) {
  665 + if (!e) {
  666 + th.data.fir_def_store = {}; //赋值空对象
  667 + return false;
  668 + }
  669 + var ee = JSON.parse(JSON.stringify(e));
  670 +
  671 + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
  672 + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
  673 + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
  674 + ee.is_no_dis = 1;
  675 + }
  676 +
  677 + var appd = getApp().globalData;
  678 + var w_time = setInterval(function () {
  679 + if (that.data.is_get_local_ok == 0) return false;
  680 + clearInterval(w_time);
  681 + var e = JSON.parse(JSON.stringify(ee));
670 682
671 - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;  
672 - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--  
673 - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {  
674 - ee.is_no_dis = 1; 683 + //如果有开启近距离的话,同时距离优不一样了
  684 + if (that.data.lat != null) {
  685 + //如果经纬度有变化的话
  686 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  687 + that.set_def_storage(e);
  688 +
  689 + } else {
  690 + //要用接口是获取距离,js的计算不准
  691 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  692 + data: {
  693 + store_id: os.stoid,
  694 + pickup_id: e.pickup_id,
  695 + lat: th.data.lat,
  696 + lon: th.data.lon
  697 + },
  698 + }).then(res => {
  699 + if (res.data.code == 0) {
  700 + e = res.data.data.pageData[0];
  701 + if (e) {
  702 + e.is_no_dis = ee.is_no_dis;
  703 + appd.pk_store = e;
  704 + that.set_def_storage(e);
675 } 705 }
676 706
677 - var appd = getApp().globalData;  
678 - var w_time = setInterval(function () {  
679 - if (that.data.is_get_local_ok == 0) return false;  
680 - clearInterval(w_time);  
681 - var e = JSON.parse(JSON.stringify(ee));  
682 -  
683 - //如果有开启近距离的话,同时距离优不一样了  
684 - if (that.data.lat != null) {  
685 - //如果经纬度有变化的话  
686 - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {  
687 - that.set_def_storage(e);  
688 -  
689 - } else {  
690 - //要用接口是获取距离,js的计算不准  
691 - getApp().request.promiseGet("/api/weshop/pickup/list", {  
692 - data: {  
693 - store_id: os.stoid,  
694 - pickup_id: e.pickup_id,  
695 - lat: th.data.lat,  
696 - lon: th.data.lon  
697 - },  
698 - }).then(res => {  
699 - if (res.data.code == 0) {  
700 - e = res.data.data.pageData[0];  
701 - if (e) {  
702 - e.is_no_dis = ee.is_no_dis;  
703 - appd.pk_store = e;  
704 - that.set_def_storage(e);  
705 - }  
706 -  
707 - }  
708 - })  
709 - }  
710 - appd.lat = that.data.lat;  
711 - appd.lon = that.data.lon;  
712 -  
713 - } else {  
714 - if (e) {  
715 - e.distance = null;  
716 -  
717 - that.set_def_storage(e);  
718 - }  
719 - }  
720 - }, 500)  
721 - }); 707 + }
  708 + })
  709 + }
  710 + appd.lat = that.data.lat;
  711 + appd.lon = that.data.lon;
722 712
  713 + } else {
  714 + if (e) {
  715 + e.distance = null;
723 716
  717 + that.set_def_storage(e);
  718 + }
  719 + }
  720 + }, 500)
  721 + });
724 722
725 - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');  
726 723
727 - var cur_price = t.data.data.shop_price;  
728 - if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {  
729 - var cfile = getApp().globalData.userInfo.card_field;  
730 - if (t.data.data[cfile]) {  
731 - cur_price = t.data.data[cfile];  
732 - }  
733 - }  
734 - var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();  
735 - txt = parseFloat(txt);  
736 724
737 - t.data.data['disc'] = txt;  
738 - if (t.data.data.original_img.indexOf(o.imghost) == -1)  
739 - t.data.data.original_img = o.imghost + t.data.data.original_img; 725 + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
740 726
741 - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; 727 + var cur_price = t.data.data.shop_price;
  728 + if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
  729 + var cfile = getApp().globalData.userInfo.card_field;
  730 + if (t.data.data[cfile]) {
  731 + cur_price = t.data.data[cfile];
  732 + }
  733 + }
  734 + var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
  735 + txt = parseFloat(txt);
742 736
743 - //-----商品详情---  
744 - if (!t.data.data.goods_content) t.data.data.goods_content = " ";  
745 - a.wxParse("content", "html", t.data.data.goods_content, ee, 6);  
746 - e.wxParseAddFullImageUrl(ee, "content"); 737 + t.data.data['disc'] = txt;
  738 + if (t.data.data.original_img.indexOf(o.imghost) == -1)
  739 + t.data.data.original_img = o.imghost + t.data.data.original_img;
747 740
748 - ee.setData({  
749 - data: t.data.data,  
750 - sele_g: t.data.data,  
751 - userInfo: getApp().globalData.userInfo  
752 - }); 741 + if (t.data.data.goods_content == null) t.data.data.goods_content = "";
753 742
754 - //获取门店  
755 - ee.get_sto();  
756 - ee.get_sku(o.stoid, t.data.data, gid);  
757 -  
758 -  
759 - ee.data.g_buy_num = new Map();  
760 -  
761 - if (ee.data.cat_name == '') {  
762 - //过去国别,分类,品牌的名称  
763 - i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {  
764 - success: function (t) {  
765 - var dd = t.data.data;  
766 - if (t.data.code == 0) {  
767 - th.setData({  
768 - cat_name: dd.name  
769 - });  
770 - }  
771 - }  
772 - });  
773 - //过去国别,分类,品牌的名称  
774 - i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {  
775 - success: function (t) {  
776 - var dd = t.data.data;  
777 - if (t.data.code == 0) {  
778 - th.setData({  
779 - brand_name: dd.name  
780 - });  
781 - }  
782 - }  
783 - });  
784 - //过去国别,分类,品牌的名称  
785 - i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {  
786 - success: function (t) {  
787 - var dd = t.data.data;  
788 - if (t.data.code == 0) {  
789 - th.setData({  
790 - nation_name: dd.name  
791 - });  
792 - }  
793 - }  
794 - });  
795 - } 743 + //-----商品详情---
  744 + if (!t.data.data.goods_content) t.data.data.goods_content = " ";
  745 + a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
  746 + e.wxParseAddFullImageUrl(ee, "content");
796 747
  748 + ee.setData({
  749 + data: t.data.data,
  750 + sele_g: t.data.data,
  751 + userInfo: getApp().globalData.userInfo
  752 + });
  753 +
  754 + //获取门店
  755 + ee.get_sto();
  756 + ee.get_sku(o.stoid, t.data.data, gid);
  757 +
  758 +
  759 + ee.data.g_buy_num = new Map();
  760 +
  761 + if (ee.data.cat_name == '') {
  762 + //过去国别,分类,品牌的名称
  763 + i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
  764 + success: function (t) {
  765 + var dd = t.data.data;
  766 + if (t.data.code == 0) {
  767 + th.setData({
  768 + cat_name: dd.name
  769 + });
  770 + }
797 } 771 }
798 - else {  
799 - wx.showModal({  
800 - title: t.data.msg,  
801 - showCancel: !1,  
802 - complete: function () {  
803 - wx.navigateBack();  
804 - } 772 + });
  773 + //过去国别,分类,品牌的名称
  774 + i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
  775 + success: function (t) {
  776 + var dd = t.data.data;
  777 + if (t.data.code == 0) {
  778 + th.setData({
  779 + brand_name: dd.name
805 }); 780 });
  781 + }
806 } 782 }
  783 + });
  784 + //过去国别,分类,品牌的名称
  785 + i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
  786 + success: function (t) {
  787 + var dd = t.data.data;
  788 + if (t.data.code == 0) {
  789 + th.setData({
  790 + nation_name: dd.name
  791 + });
  792 + }
  793 + }
  794 + });
807 } 795 }
808 - });  
809 - ee.data.enterAddressPage && (this.data.enterAddressPage = !1); 796 +
  797 + }
  798 + else {
  799 + wx.showModal({
  800 + title: t.data.msg,
  801 + showCancel: !1,
  802 + complete: function () {
  803 + wx.navigateBack();
  804 + }
  805 + });
  806 + }
  807 + }
  808 + });
  809 + ee.data.enterAddressPage && (this.data.enterAddressPage = !1);
810 }) 810 })
811 811
812 812
@@ -931,12 +931,12 @@ Page({ @@ -931,12 +931,12 @@ Page({
931 var th = this; 931 var th = this;
932 var ind = t.currentTarget.dataset.openSpecModal_ind; 932 var ind = t.currentTarget.dataset.openSpecModal_ind;
933 if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind; 933 if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
934 - th.setData({  
935 - open_ind_store: ind 934 + th.setData({
  935 + open_ind_store: ind
936 }); 936 });
937 - 937 +
938 th.add_cart_func(t); 938 th.add_cart_func(t);
939 - 939 +
940 }, 940 },
941 941
942 942
@@ -951,7 +951,7 @@ Page({ @@ -951,7 +951,7 @@ Page({
951 return s.my_warnning("还未登录!", 0, this); 951 return s.my_warnning("还未登录!", 0, this);
952 } 952 }
953 953
954 - var e = this,th = e, o = this.data.sele_g,a = o.goods_id; 954 + var e = this, th = e, o = this.data.sele_g, a = o.goods_id;
955 //----------添加到购物车时,要判断限购数量,-------- 955 //----------添加到购物车时,要判断限购数量,--------
956 e.get_buy_num(o, function (ee) { 956 e.get_buy_num(o, function (ee) {
957 //---判断商品是否超出限购--- 957 //---判断商品是否超出限购---
@@ -994,7 +994,7 @@ Page({ @@ -994,7 +994,7 @@ Page({
994 goods_name: o.goods_name, 994 goods_name: o.goods_name,
995 goods_sn: o.goods_sn, 995 goods_sn: o.goods_sn,
996 sku: o.sku, 996 sku: o.sku,
997 - presell_list_id:th.data.presellList.id, 997 + presell_list_id: th.data.presellList.id,
998 }; 998 };
999 999
1000 //---是不是从收藏夹出来的--- 1000 //---是不是从收藏夹出来的---
@@ -1031,16 +1031,16 @@ Page({ @@ -1031,16 +1031,16 @@ Page({
1031 newd.pricing_type = o.pricing_type; 1031 newd.pricing_type = o.pricing_type;
1032 } 1032 }
1033 1033
1034 - newd.goods_price = th.data.prom_price;  
1035 - newd.member_goods_price = th.data.prom_price, 1034 + newd.goods_price = th.data.prom_price;
  1035 + newd.member_goods_price = th.data.prom_price,
1036 newd.prom_type = 8; 1036 newd.prom_type = 8;
1037 - newd.prom_id = o.prom_id; 1037 + newd.prom_id = o.prom_id;
  1038 +
  1039 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  1040 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  1041 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
1038 1042
1039 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
1040 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
1041 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1042 1043
1043 -  
1044 }) 1044 })
1045 }, 1045 },
1046 1046
@@ -1128,7 +1128,7 @@ Page({ @@ -1128,7 +1128,7 @@ Page({
1128 } 1128 }
1129 }) 1129 })
1130 1130
1131 - }else { 1131 + } else {
1132 newd['pick_name'] = th.data.sto_sele_name; 1132 newd['pick_name'] = th.data.sto_sele_name;
1133 newd['pick_dis'] = th.data.sto_sele_distr; 1133 newd['pick_dis'] = th.data.sto_sele_distr;
1134 th.buyNow(newd); 1134 th.buyNow(newd);
@@ -1137,18 +1137,18 @@ Page({ @@ -1137,18 +1137,18 @@ Page({
1137 1137
1138 //----------立即购买----------- 1138 //----------立即购买-----------
1139 buyNow: function (e) { 1139 buyNow: function (e) {
1140 - 1140 +
1141 this.setData({ 1141 this.setData({
1142 openSpecModal: 0, 1142 openSpecModal: 0,
1143 openSpecModal_inte: 0, 1143 openSpecModal_inte: 0,
1144 openSpecModal_inte_normal: 0, 1144 openSpecModal_inte_normal: 0,
1145 openSpecModal_pt: 0, 1145 openSpecModal_pt: 0,
1146 }) 1146 })
1147 -  
1148 - app.set_b_now(e); 1147 +
  1148 + app.set_b_now(e);
1149 getApp().goto("/packageC/pages/presell/cart/cart2_pre"); 1149 getApp().goto("/packageC/pages/presell/cart/cart2_pre");
1150 -  
1151 - 1150 +
  1151 +
1152 }, 1152 },
1153 1153
1154 //----------增加购买数量----------- 1154 //----------增加购买数量-----------
@@ -1722,8 +1722,8 @@ Page({ @@ -1722,8 +1722,8 @@ Page({
1722 is_on_sale: 1, 1722 is_on_sale: 1,
1723 pageSize: 500, 1723 pageSize: 500,
1724 orderField: 'sort', 1724 orderField: 'sort',
1725 - prom_id:tt.data.presellForm.id,  
1726 - prom_type:8, 1725 + prom_id: tt.data.presellForm.id,
  1726 + prom_type: 8,
1727 } 1727 }
1728 }).then(res => { 1728 }).then(res => {
1729 var e = res; 1729 var e = res;
@@ -1910,7 +1910,7 @@ Page({ @@ -1910,7 +1910,7 @@ Page({
1910 1910
1911 //---------拿出门店分类和门店------------ 1911 //---------拿出门店分类和门店------------
1912 get_sto(e) { 1912 get_sto(e) {
1913 - var th = this,is_normal = e; 1913 + var th = this, is_normal = e;
1914 1914
1915 if (e == 1) { 1915 if (e == 1) {
1916 th.setData({ is_normal: 1 }) 1916 th.setData({ is_normal: 1 })
@@ -2854,10 +2854,7 @@ Page({ @@ -2854,10 +2854,7 @@ Page({
2854 }; 2854 };
2855 2855
2856 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 2856 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
2857 - var type = this.data.prom_type;  
2858 - if (type == 6) type = 2;  
2859 - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;  
2860 - 2857 + var type = 8;
2861 wx.showLoading({ 2858 wx.showLoading({
2862 title: '生成中...', 2859 title: '生成中...',
2863 }) 2860 })
@@ -2949,12 +2946,8 @@ Page({ @@ -2949,12 +2946,8 @@ Page({
2949 context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); 2946 context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
2950 } 2947 }
2951 2948
2952 - var share_title = th.data.data.goods_name;  
2953 - if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) {  
2954 - share_title = th.data.prom_act.share_title;  
2955 - if (!share_title) share_title = th.data.prom_act.title;  
2956 - if (th.data.prom_type == 4) share_title = th.data.prom_act.name;  
2957 - } 2949 + var share_title = th.data.presellForm.share_title;
  2950 + share_title ? share_title : th.data.data.goods_name;
2958 2951
2959 //---产品名称--- 2952 //---产品名称---
2960 //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 2953 //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
@@ -2962,34 +2955,34 @@ Page({ @@ -2962,34 +2955,34 @@ Page({
2962 context.setFillStyle("black"); 2955 context.setFillStyle("black");
2963 context.setFontSize(21.3 * unit) 2956 context.setFontSize(21.3 * unit)
2964 th.draw_Text(context, share_title, 2957 th.draw_Text(context, share_title,
2965 - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); 2958 + 80 * unit, 200 * unit, 200 * unit, 279 * unit, unit);
2966 2959
2967 //------产品的价格------- 2960 //------产品的价格-------
2968 - context.setFontSize(23 * unit) 2961 + context.setFontSize(22 * unit)
2969 context.setFillStyle("red") 2962 context.setFillStyle("red")
2970 2963
2971 2964
2972 - var pri0 = th.data.data.shop_price;  
2973 - if (th.data.prom_act)  
2974 - pri0 = th.data.prom_act.price; 2965 + var pri0 = th.data.presellList.presell_money;
  2966 + // if (th.data.prom_act)
  2967 + // pri0 = th.data.prom_act.price;
2975 pri0 = parseFloat(pri0).toFixed(2); 2968 pri0 = parseFloat(pri0).toFixed(2);
2976 var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; 2969 var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
2977 context.fillText("¥", wd1 - 15, 185 * unit); 2970 context.fillText("¥", wd1 - 15, 185 * unit);
2978 - context.setFontSize(31 * unit) 2971 + context.setFontSize(22 * unit)
2979 context.fillText(pri0, wd1, 185 * unit); 2972 context.fillText(pri0, wd1, 185 * unit);
2980 2973
2981 //---市场价划掉--- 2974 //---市场价划掉---
2982 - context.setFillStyle("gray") 2975 + context.setFillStyle("red")
2983 context.setFontSize(22 * unit) 2976 context.setFontSize(22 * unit)
2984 pri0 = "¥" + th.data.data.market_price.toFixed(2); 2977 pri0 = "¥" + th.data.data.market_price.toFixed(2);
2985 var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; 2978 var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
2986 - context.fillText(pri0, wd2, 213 * unit); 2979 + context.fillText('定金', wd2, 213 * unit);
2987 2980
2988 - context.setStrokeStyle('gray');  
2989 - context.setLineWidth(1 * unit);  
2990 - context.moveTo(wd2 - 5, 206 * unit);  
2991 - context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);  
2992 - context.stroke(); 2981 + // context.setStrokeStyle('gray');
  2982 + // context.setLineWidth(1 * unit);
  2983 + // context.moveTo(wd2 - 5, 206 * unit);
  2984 + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
  2985 + // context.stroke();
2993 2986
2994 } else { 2987 } else {
2995 context.setFillStyle("black"); 2988 context.setFillStyle("black");
@@ -3009,227 +3002,82 @@ Page({ @@ -3009,227 +3002,82 @@ Page({
3009 context.fillText(text, 38 * unit, 235 * unit); 3002 context.fillText(text, 38 * unit, 235 * unit);
3010 3003
3011 } 3004 }
3012 - 3005 + console.log(th.data.share_goods_img);
  3006 + let share_goods_img=th.data.presellForm.share_img;
  3007 + share_goods_img?share_goods_img:th.data.data.share_goods_img;
3013 //---中间大图--- 3008 //---中间大图---
3014 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); 3009 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
3015 - //-------大图后面就不一样了-----------  
3016 - switch (type) {  
3017 - case 0: //普通商品的展示  
3018 - case 4:  
3019 - //中间的几个字  
3020 - if (th.data.poster && parseInt(th.data.poster.style) == 2) {  
3021 - if (parseInt(th.data.poster.show_quality)) {  
3022 - var g_path = "../../../../images/share/s_gou.png";  
3023 - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);  
3024 - context.setFillStyle("red")  
3025 - context.setFontSize(18 * unit)  
3026 - context.fillText("正品保证", 84 * unit, 690 * unit);  
3027 -  
3028 - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);  
3029 - context.setFillStyle("red")  
3030 - context.setFontSize(18 * unit)  
3031 - context.fillText("纯实体店", 246 * unit, 690 * unit);  
3032 -  
3033 - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);  
3034 - context.setFillStyle("red")  
3035 - context.setFontSize(18 * unit)  
3036 - context.fillText("官方验证", 420 * unit, 690 * unit);  
3037 - }  
3038 -  
3039 - } else {  
3040 - var g_path = "../../../../images/share/s_gou.png";  
3041 - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);  
3042 - context.setFillStyle("red")  
3043 - context.setFontSize(18 * unit)  
3044 - context.fillText("正品保证", 84 * unit, 690 * unit);  
3045 -  
3046 - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);  
3047 - context.setFillStyle("red")  
3048 - context.setFontSize(18 * unit)  
3049 - context.fillText("纯实体店", 246 * unit, 690 * unit);  
3050 -  
3051 - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);  
3052 - context.setFillStyle("red")  
3053 - context.setFontSize(18 * unit)  
3054 - context.fillText("官方验证", 420 * unit, 690 * unit);  
3055 - }  
3056 -  
3057 3010
3058 - //---画线---  
3059 - context.setLineWidth(1 * unit)  
3060 - context.moveTo(32 * unit, 710 * unit)  
3061 - context.lineTo(520 * unit, 710 * unit)  
3062 - context.stroke();  
3063 -  
3064 - //---文字---  
3065 - context.setFillStyle("black")  
3066 - context.setFontSize(22 * unit)  
3067 -  
3068 - if (type == 0) {  
3069 - // 原来start --->  
3070 - context.setFontSize(24 * unit)  
3071 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);  
3072 -  
3073 - context.setFontSize(22 * unit)  
3074 - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);  
3075 - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);  
3076 -  
3077 - } else {  
3078 - context.setFontSize(24 * unit)  
3079 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);  
3080 - context.setFontSize(22 * unit)  
3081 - context.fillText("长按识别二维码", 40 * unit, 806 * unit);  
3082 - context.fillText("立即开始兑换", 40 * unit, 846 * unit);  
3083 - }  
3084 -  
3085 - //---二维吗图---  
3086 - //-- 自定义海报 --  
3087 - if (th.data.poster) {  
3088 - var erm_x = parseFloat(th.data.poster.ewm_x) * 2;  
3089 - var erm_y = parseFloat(th.data.poster.ewm_y) * 2;  
3090 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);  
3091 - } else {  
3092 - //---二维吗图---  
3093 - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);  
3094 - }  
3095 -  
3096 - break;  
3097 - case 1: //秒杀商品的展示  
3098 - //---画线---  
3099 - context.setLineWidth(1 * unit)  
3100 - context.moveTo(32 * unit, 670 * unit)  
3101 - context.lineTo(520 * unit, 670 * unit)  
3102 - context.stroke();  
3103 -  
3104 - //画秒杀的图片  
3105 - var miaos_path = '../../../../images/share/miao_share.png';  
3106 - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);  
3107 -  
3108 - context.setFillStyle("black")  
3109 - context.setFontSize(24 * unit)  
3110 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);  
3111 - //---文字---  
3112 - context.setFontSize(22 * unit)  
3113 - context.setFillStyle("black")  
3114 - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);  
3115 - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);  
3116 -  
3117 -  
3118 - //---二维吗图---  
3119 - //-- 自定义海报 --  
3120 - if (th.data.poster) {  
3121 - var erm_x = parseFloat(th.data.poster.ewm_x) * 2;  
3122 - var erm_y = parseFloat(th.data.poster.ewm_y) * 2;  
3123 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);  
3124 - } else {  
3125 - //---二维吗图---  
3126 - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);  
3127 - }  
3128 - break;  
3129 -  
3130 - case 2: //会员团和商家团的展示  
3131 - //---画线---  
3132 - context.setLineWidth(1 * unit)  
3133 - context.moveTo(32 * unit, 670 * unit)  
3134 - context.lineTo(520 * unit, 670 * unit)  
3135 - context.stroke();  
3136 - //---文字---  
3137 -  
3138 - context.setFillStyle("black")  
3139 - context.setFontSize(24 * unit)  
3140 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);  
3141 -  
3142 - //绘制成团图片  
3143 - var ct_img = "../../../../images/share/ct_num.png";  
3144 - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);  
3145 - var ct_num = th.data.prom_act.ct_num;  
3146 - context.setFontSize(14 * unit)  
3147 - context.font = 'normal'; 3011 + //预售
  3012 + /* if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  3013 + if (parseInt(th.data.poster.show_quality)) {
  3014 + var g_path = "../../../../images/share/s_gou.png";
  3015 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
3148 context.setFillStyle("red") 3016 context.setFillStyle("red")
3149 - if (ct_num < 10) {  
3150 - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);  
3151 - } else {  
3152 - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);  
3153 - }  
3154 - context.setFontSize(22 * unit)  
3155 - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); 3017 + context.setFontSize(18 * unit)
  3018 + context.fillText("正品保证", 84 * unit, 690 * unit);
3156 3019
3157 - context.setFillStyle("gray")  
3158 - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);  
3159 - context.setFillStyle("black")  
3160 - context.font = 'normal bold 18px sans-serif';  
3161 - context.setFontSize(21.3 * unit)  
3162 - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);  
3163 -  
3164 -  
3165 - //---二维吗图---  
3166 - //-- 自定义海报 --  
3167 - if (th.data.poster) {  
3168 - var erm_x = parseFloat(th.data.poster.ewm_x) * 2;  
3169 - var erm_y = parseFloat(th.data.poster.ewm_y) * 2;  
3170 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);  
3171 - } else {  
3172 - //---二维吗图---  
3173 - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);  
3174 - }  
3175 - break  
3176 - case 3: //阶梯团的展示  
3177 - //---画线---  
3178 - context.setLineWidth(1 * unit)  
3179 - context.moveTo(32 * unit, 670 * unit)  
3180 - context.lineTo(520 * unit, 670 * unit)  
3181 - context.stroke();  
3182 - //---文字--- 3020 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  3021 + context.setFillStyle("red")
  3022 + context.setFontSize(18 * unit)
  3023 + context.fillText("纯实体店", 246 * unit, 690 * unit);
3183 3024
3184 - context.setFillStyle("black")  
3185 - context.setFontSize(24 * unit)  
3186 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);  
3187 -  
3188 - //---绘制中间阶梯的价格---  
3189 - var list = th.data.prom_act.ct_rylist;  
3190 - for (var i = 0; i < list.length; i++) {  
3191 - var item = list[i];  
3192 - var wi = i * 90 * unit;  
3193 - context.font = 'normal';  
3194 - context.setFontSize(16 * unit)  
3195 - context.setFillStyle("red")  
3196 - context.fillText("¥", 40 * unit + wi, 756 * unit);  
3197 - context.setFontSize(22 * unit)  
3198 - var pri = parseFloat(item.price).toFixed(2);  
3199 - context.fillText(pri, 56 * unit + wi, 756 * unit);  
3200 - context.setFillStyle("gray")  
3201 - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);  
3202 - }  
3203 - //----------------下面部分----------------  
3204 - // context.setFillStyle("gray")  
3205 - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);  
3206 - // context.setFillStyle("black")  
3207 - // context.font = 'normal bold 18px sans-serif';  
3208 - // context.setFontSize(22 * unit)  
3209 - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);  
3210 - //context.setFillStyle("gray")  
3211 - context.setFillStyle("black")  
3212 - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);  
3213 - //context.font = 'normal bold 18px sans-serif';  
3214 - context.setFontSize(21 * unit)  
3215 - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);  
3216 -  
3217 -  
3218 - //-- 自定义海报 --  
3219 - if (th.data.poster) {  
3220 - var erm_x = parseFloat(th.data.poster.ewm_x) * 2;  
3221 - var erm_y = parseFloat(th.data.poster.ewm_y) * 2;  
3222 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);  
3223 - } else {  
3224 - //---二维吗图---  
3225 - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);  
3226 - }  
3227 - break 3025 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  3026 + context.setFillStyle("red")
  3027 + context.setFontSize(18 * unit)
  3028 + context.fillText("官方验证", 420 * unit, 690 * unit);
  3029 + }
  3030 + } else {
  3031 + var g_path = "../../../../images/share/s_gou.png";
  3032 + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  3033 + context.setFillStyle("red")
  3034 + context.setFontSize(18 * unit)
  3035 + context.fillText("正品保证", 84 * unit, 690 * unit);
3228 3036
  3037 + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  3038 + context.setFillStyle("red")
  3039 + context.setFontSize(18 * unit)
  3040 + context.fillText("纯实体店", 246 * unit, 690 * unit);
3229 3041
  3042 + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  3043 + context.setFillStyle("red")
  3044 + context.setFontSize(18 * unit)
  3045 + context.fillText("官方验证", 420 * unit, 690 * unit);
  3046 + } */
  3047 +
  3048 + //---画线---
  3049 + context.setLineWidth(1 * unit)
  3050 + context.moveTo(32 * unit, 665 * unit)
  3051 + context.lineTo(520 * unit, 665 * unit)
  3052 + context.stroke();
  3053 +
  3054 + //---文字---
  3055 + context.setFillStyle("black")
  3056 + // context.setFontSize(22 * unit)
  3057 + context.setFontSize(24 * unit)
  3058 + context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
  3059 + context.setFillStyle("red")
  3060 + context.setFontSize(20 * unit)
  3061 + var presell_price = `预售价:${th.data.presellList.presell_price}`
  3062 + context.fillText(presell_price, 40 * unit, 801 * unit);
  3063 + context.setFillStyle("black")
  3064 + context.setFontSize(22 * unit)
  3065 + context.fillText("特惠好物,限时预售", 40 * unit, 836 * unit);
  3066 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
  3067 +
  3068 + //---二维吗图---
  3069 + //-- 自定义海报 --
  3070 + if (th.data.poster) {
  3071 + var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  3072 + var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  3073 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  3074 + } else {
  3075 + //---二维吗图---
  3076 + context.drawImage(vpath, 390 * unit, 756 * unit, 130 * unit, 116 * unit);
3230 } 3077 }
3231 3078
3232 3079
  3080 +
3233 //--- 如果是自定义海报的时候 --- 3081 //--- 如果是自定义海报的时候 ---
3234 if (th.data.poster && parseInt(th.data.poster.style) == 2) { 3082 if (th.data.poster && parseInt(th.data.poster.style) == 2) {
3235 3083
@@ -3437,9 +3285,12 @@ Page({ @@ -3437,9 +3285,12 @@ Page({
3437 return false; 3285 return false;
3438 } 3286 }
3439 3287
3440 - var img_url = ee.data.data.original_img;  
3441 - if ((this.data.prom_type == 1 || this.data.prom_type == 6) && this.data.prom_act.share_imgurl) {  
3442 - img_url = this.data.iurl + this.data.prom_act.share_imgurl; 3288 + // var img_url = ee.data.data.original_img;
  3289 + var img_url = ee.data.presellForm.share_img;
  3290 + img_url?img_url:ee.data.data.original_img;
  3291 +
  3292 + if (img_url) {
  3293 + img_url = this.data.iurl + img_url;
3443 } 3294 }
3444 3295
3445 //获取商品是分享图信息 3296 //获取商品是分享图信息
@@ -4181,100 +4032,100 @@ Page({ @@ -4181,100 +4032,100 @@ Page({
4181 }, 4032 },
4182 4033
4183 addCart_inte: function (t) { 4034 addCart_inte: function (t) {
4184 - this.add_cart_func_inte(t); 4035 + this.add_cart_func_inte(t);
4185 }, 4036 },
4186 4037
4187 4038
4188 - onShareTimeline() {  
4189 - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';  
4190 - if (!store_name)  
4191 - store_name = getApp().globalData.setting.appName;  
4192 - return {  
4193 - title: this.data.data.goods_name + '-' + store_name,  
4194 - imageUrl: this.data.gallery[0].image_url,  
4195 - }  
4196 - },  
4197 -  
4198 - clickCollapse() {  
4199 - this.setData({flag: !this.data.flag,})  
4200 - }, 4039 + onShareTimeline() {
  4040 + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
  4041 + if (!store_name)
  4042 + store_name = getApp().globalData.setting.appName;
  4043 + return {
  4044 + title: this.data.data.goods_name + '-' + store_name,
  4045 + imageUrl: this.data.gallery[0].image_url,
  4046 + }
  4047 + },
4201 4048
4202 - clickShare() {  
4203 - this.setData({share_hidden: true,});  
4204 - }, 4049 + clickCollapse() {
  4050 + this.setData({ flag: !this.data.flag, })
  4051 + },
4205 4052
4206 - send() {  
4207 - this.setData({share_hidden: false,});  
4208 - }, 4053 + clickShare() {
  4054 + this.setData({ share_hidden: true, });
  4055 + },
4209 4056
4210 - cancel() {  
4211 - this.setData({  
4212 - share_hidden: false,  
4213 - });  
4214 - }, 4057 + send() {
  4058 + this.setData({ share_hidden: false, });
  4059 + },
4215 4060
4216 - //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动  
4217 - check_nor_promgood(goods_id, back) {  
4218 - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {  
4219 - success: function (res) {  
4220 - if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {  
4221 - var obj = {  
4222 - act_id: res.data.data.promGoodsLists[0].prom_id,  
4223 - }  
4224 - back(obj);  
4225 - } else {  
4226 - back(0)  
4227 - }  
4228 - }  
4229 - })  
4230 - }, 4061 + cancel() {
  4062 + this.setData({
  4063 + share_hidden: false,
  4064 + });
  4065 + },
4231 4066
4232 - async get_pre_prom(func){  
4233 - var th = this;  
4234 - var presell_id = null;  
4235 - var pre_arr = null;  
4236 - //------获取预售从表----------  
4237 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {  
4238 - if (res.data.code == 0 && res.data.data) {  
4239 - var arr = res.data.data;  
4240 - presell_id = arr.presell_id;  
4241 - th.setData({  
4242 - presellList: arr,  
4243 - })  
4244 - }  
4245 - })  
4246 - if (!presell_id) {  
4247 - wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000})  
4248 - return false;  
4249 - }  
4250 - //------获取预售主表----------  
4251 - await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {  
4252 - if (res.data.code == 0 && res.data.data) {  
4253 - th.setData({  
4254 - presellForm: res.data.data,  
4255 - });  
4256 - th.countDown(res.data.data.end_time)  
4257 - }  
4258 - })  
4259 - var userInfo = getApp().globalData.userInfo;  
4260 - var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid};  
4261 - if (userInfo) {  
4262 - pre_data.user_id = userInfo.user_id; 4067 + //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
  4068 + check_nor_promgood(goods_id, back) {
  4069 + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
  4070 + success: function (res) {
  4071 + if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
  4072 + var obj = {
  4073 + act_id: res.data.data.promGoodsLists[0].prom_id,
  4074 + }
  4075 + back(obj);
  4076 + } else {
  4077 + back(0)
4263 } 4078 }
4264 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {  
4265 - data: pre_data,  
4266 - }).then(e => {  
4267 - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {  
4268 - pre_arr = e.data.data.pageData[0];  
4269 - th.setData({pre_arr: pre_arr})  
4270 - } 4079 + }
  4080 + })
  4081 + },
  4082 +
  4083 + async get_pre_prom(func) {
  4084 + var th = this;
  4085 + var presell_id = null;
  4086 + var pre_arr = null;
  4087 + //------获取预售从表----------
  4088 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
  4089 + if (res.data.code == 0 && res.data.data) {
  4090 + var arr = res.data.data;
  4091 + presell_id = arr.presell_id;
  4092 + th.setData({
  4093 + presellList: arr,
4271 }) 4094 })
4272 - if (!pre_arr) {  
4273 - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000})  
4274 - }  
4275 - if (func) {  
4276 - func();  
4277 - } 4095 + }
  4096 + })
  4097 + if (!presell_id) {
  4098 + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 })
  4099 + return false;
  4100 + }
  4101 + //------获取预售主表----------
  4102 + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
  4103 + if (res.data.code == 0 && res.data.data) {
  4104 + th.setData({
  4105 + presellForm: res.data.data,
  4106 + });
  4107 + th.countDown(res.data.data.end_time)
  4108 + }
  4109 + })
  4110 + var userInfo = getApp().globalData.userInfo;
  4111 + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid };
  4112 + if (userInfo) {
  4113 + pre_data.user_id = userInfo.user_id;
  4114 + }
  4115 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
  4116 + data: pre_data,
  4117 + }).then(e => {
  4118 + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
  4119 + pre_arr = e.data.data.pageData[0];
  4120 + th.setData({ pre_arr: pre_arr })
  4121 + }
  4122 + })
  4123 + if (!pre_arr) {
  4124 + wx.showToast({ title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000 })
  4125 + }
  4126 + if (func) {
  4127 + func();
4278 } 4128 }
  4129 + }
4279 4130
4280 }); 4131 });