Commit 0af1cd6fde778b0e9fc0fb2091af9d13fb691dea

Authored by yvan.ni
1 parent f9e0e278

组合购优化

@@ -51,7 +51,7 @@ App({ @@ -51,7 +51,7 @@ App({
51 config2: null, //门店配置 51 config2: null, //门店配置
52 code: null, 52 code: null,
53 heigth:0, 53 heigth:0,
54 - user_id:null,// 3674923,// 4379287,// null,// 5682068, 54 + user_id:null,//13324010,//4755274,
55 buy_now:null, 55 buy_now:null,
56 picklist:null, //门店列表 56 picklist:null, //门店列表
57 wuliuprice: null, //物流价格表 57 wuliuprice: null, //物流价格表
@@ -618,6 +618,7 @@ App({ @@ -618,6 +618,7 @@ App({
618 this.globalData.config2=null; //清除config2的缓存 618 this.globalData.config2=null; //清除config2的缓存
619 this.globalData.config=null; //清除config的缓存 619 this.globalData.config=null; //清除config的缓存
620 this.globalData.gr_index=0; //商品分组的序列 620 this.globalData.gr_index=0; //商品分组的序列
  621 + this.globalData.pk_store=null;
621 622
622 }, 623 },
623 624
@@ -726,7 +727,9 @@ App({ @@ -726,7 +727,9 @@ App({
726 727
727 }, 728 },
728 729
729 - 730 +
  731 +
  732 +
730 733
731 734
732 }); 735 });
packageB/pages/zuhegou/index/index.js
@@ -2,6 +2,7 @@ const app = getApp(); @@ -2,6 +2,7 @@ const app = getApp();
2 let self = null; 2 let self = null;
3 var os = app.globalData.setting; 3 var os = app.globalData.setting;
4 var ut = require("../../../../utils/util.js"); 4 var ut = require("../../../../utils/util.js");
  5 +var regeneratorRuntime = require('../../../../utils/runtime.js');
5 var oo = app.globalData; 6 var oo = app.globalData;
6 7
7 8
@@ -105,7 +106,7 @@ Page({ @@ -105,7 +106,7 @@ Page({
105 page: 1, //第一页 106 page: 1, //第一页
106 no_more: 0, //没有更多 107 no_more: 0, //没有更多
107 loading: 0, //加载中 108 loading: 0, //加载中
108 - list: [], //商品列表的显示 109 + list:null, //商品列表的显示
109 act: null, //组合活动 110 act: null, //组合活动
110 all_price: 0, //合计价格 111 all_price: 0, //合计价格
111 all_num: 0, //全部数量 112 all_num: 0, //全部数量
@@ -179,8 +180,8 @@ Page({ @@ -179,8 +180,8 @@ Page({
179 } 180 }
180 181
181 //等待活动值 182 //等待活动值
182 - this.waitfor2(10, 'act', function () {  
183 - if(!th.data.act) return false; 183 + this.waitfor2(10, 'list', function () {
  184 + if(!th.data.list) return false;
184 if(ut.gettimestamp()<th.data.act.start_time){ 185 if(ut.gettimestamp()<th.data.act.start_time){
185 return false; 186 return false;
186 } 187 }
@@ -221,6 +222,10 @@ Page({ @@ -221,6 +222,10 @@ Page({
221 th.data.fir_def_store = {}; //赋值空对象 222 th.data.fir_def_store = {}; //赋值空对象
222 return false; 223 return false;
223 } 224 }
  225 +
  226 + //获取购物车的内容
  227 + th.get_cart_val(e);
  228 +
224 var ee = JSON.parse(JSON.stringify(e)); 229 var ee = JSON.parse(JSON.stringify(e));
225 var appd = getApp().globalData; 230 var appd = getApp().globalData;
226 //-- 等待定位系统的开启 -- 231 //-- 等待定位系统的开启 --
@@ -350,6 +355,7 @@ Page({ @@ -350,6 +355,7 @@ Page({
350 if (ut.ajax_ok(res)) { 355 if (ut.ajax_ok(res)) {
351 th.data.page++; 356 th.data.page++;
352 var list = th.data.list; 357 var list = th.data.list;
  358 + if(!list) list=[];
353 for (var i in res.data.data.pageData) { 359 for (var i in res.data.data.pageData) {
354 list.push(res.data.data.pageData[i]); 360 list.push(res.data.data.pageData[i]);
355 } 361 }
@@ -577,8 +583,9 @@ Page({ @@ -577,8 +583,9 @@ Page({
577 var th = this; 583 var th = this;
578 var index = e.currentTarget.dataset.index; 584 var index = e.currentTarget.dataset.index;
579 var item = this.data.list[index]; 585 var item = this.data.list[index];
  586 + this.data.sele_g=item;
580 let num = item.num; 587 let num = item.num;
581 - th.data.s_cart_num = this.data.sele_g.cart_num - 1; 588 + th.data.s_cart_num = item.cart_num - 1;
582 589
583 if (num >= 2) { 590 if (num >= 2) {
584 var check_num = num - 1; 591 var check_num = num - 1;
@@ -615,7 +622,7 @@ Page({ @@ -615,7 +622,7 @@ Page({
615 if(th.data.s_cart_num){ 622 if(th.data.s_cart_num){
616 var updata = { 623 var updata = {
617 id: th.data.sele_g.cart_id, 624 id: th.data.sele_g.cart_id,
618 - goods_num:h.data.s_cart_num , 625 + goods_num:th.data.s_cart_num ,
619 store_id: os.stoid 626 store_id: os.stoid
620 } 627 }
621 getApp().request.put("/api/weshop/cart/update", { 628 getApp().request.put("/api/weshop/cart/update", {
@@ -643,7 +650,7 @@ Page({ @@ -643,7 +650,7 @@ Page({
643 if (res.data.code == 0) { 650 if (res.data.code == 0) {
644 var title = '移除购物车成功'; 651 var title = '移除购物车成功';
645 th.setData({ 652 th.setData({
646 - [txt1]: 1, 653 + [txt1]: 0,
647 [txt2]: false, 654 [txt2]: false,
648 [txt]: false, 655 [txt]: false,
649 }); 656 });
@@ -1599,7 +1606,7 @@ Page({ @@ -1599,7 +1606,7 @@ Page({
1599 data: updata, 1606 data: updata,
1600 success: function (t) { 1607 success: function (t) {
1601 th.setData({ 1608 th.setData({
1602 - [txt1]: updata.goods_num, 1609 + [txt1]: th.data.goodsInputNum,
1603 [txt2]: true, 1610 [txt2]: true,
1604 [txt]: true, 1611 [txt]: true,
1605 }); 1612 });
@@ -1784,7 +1791,7 @@ Page({ @@ -1784,7 +1791,7 @@ Page({
1784 } 1791 }
1785 1792
1786 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 1793 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
1787 - if (this.data.act.is_bz && no_in_arr.length > this.data.act.zhbuyqty) { 1794 + if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
1788 //看一下是几倍 1795 //看一下是几倍
1789 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); 1796 var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
1790 aprice += be * aprice; 1797 aprice += be * aprice;
@@ -1810,13 +1817,100 @@ Page({ @@ -1810,13 +1817,100 @@ Page({
1810 }) 1817 })
1811 1818
1812 if(all_num<=0){ 1819 if(all_num<=0){
1813 - th.data.sele_store = 0; //什么都没有选,就没有选择了门店 1820 + this.data.sele_store = 0; //什么都没有选,就没有选择了门店
1814 } 1821 }
1815 1822
1816 }, 1823 },
1817 1824
1818 go_cart:function () { 1825 go_cart:function () {
1819 getApp().goto("/pages/cart/cart/cart"); 1826 getApp().goto("/pages/cart/cart/cart");
  1827 + },
  1828 +
  1829 + //获取购物车中,相应的门店已购买的商品
  1830 + get_cart_val:function (e) {
  1831 + var th=this;
  1832 + var user_id=getApp().globalData.user_id;
  1833 + var req={
  1834 + user_id: user_id,
  1835 + store_id: os.stoid,
  1836 + pageSize: 600,
  1837 + state:0,
  1838 + prom_type:7,
  1839 + prom_id:this.data.act.id
  1840 + };
  1841 + //获取购物车列表
  1842 + getApp().request.get("/api/weshop/cart/list",{
  1843 + data:req,
  1844 + success: async function(e) {
  1845 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) {
  1846 + var map={};
  1847 + var mlist=e.data.data.pageData;
  1848 + for(let i in mlist){
  1849 + let item=mlist[i];
  1850 + if(item.prom_type!=7) continue;
  1851 + if(item.prom_id!=th.data.act.id) continue;
  1852 + map[item.goods_id]=item;
  1853 + }
  1854 + for(let j in th.data.list){
  1855 + let item_j=th.data.list[j];
  1856 + item_j.current_price=item_j.shop_price;
  1857 +
  1858 + var card_price=0;
  1859 + //如果会员有等级价
  1860 + if (th.data.card_field) {
  1861 + card_price = item_j[th.data.card_field];
  1862 + if (card_price > 0) {
  1863 + item_j.current_price=card_price;
  1864 + }
  1865 + }
  1866 +
  1867 +
  1868 + if(map[item_j.goods_id]){
  1869 + var cart_num=map[item_j.goods_id].goods_num;
  1870 + item_j.num=cart_num;
  1871 + item_j.cart_num=cart_num;
  1872 + item_j.cart_id=map[item_j.goods_id].id;
  1873 + if(item_j.buyqty>0){
  1874 + var g_buy_num=0;
  1875 + var promgoodsbuynum=0;
  1876 + //----获取商品购买数----
  1877 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1878 + data: {
  1879 + store_id: os.stoid,
  1880 + user_id: user_id,
  1881 + goods_id: item_j.goods_id,
  1882 + prom_type: 7,
  1883 + prom_id: th.data.act.id
  1884 + },
  1885 + }).then(res2=>{
  1886 + if (res2.data.code == 0) {
  1887 + var buy_num_data = res2.data.data;
  1888 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  1889 + g_buy_num = buy_num_data.goodsbuynum;
  1890 + }
  1891 + })
  1892 +
  1893 + if(item_j.viplimited>0){
  1894 + var cby=item_j.viplimited-g_buy_num;
  1895 + if(cby<=0) continue;//不能买就continue下一个
  1896 + item_j.num=cby>item_j.num?item_j.num:cby;
  1897 + }
  1898 + if(item_j.buyqty>0){
  1899 + var cby=item_j.buyqty-promgoodsbuynum;
  1900 + if(cby<=0) continue;//不能买就continue下一个
  1901 + item_j.num=cby>item_j.num?item_j.num:cby;
  1902 + }
  1903 + }
  1904 +
  1905 + item_j.haveAdded=1;
  1906 + item_j.showNum=true;
  1907 + }
  1908 + }
  1909 + th.setData({list:th.data.list});
  1910 + th.re_sum_price();
  1911 + }
  1912 + }
  1913 + });
1820 } 1914 }
1821 1915
1822 }) 1916 })
1823 \ No newline at end of file 1917 \ No newline at end of file
pages/cart/cart/cart.js
@@ -468,7 +468,16 @@ Page({ @@ -468,7 +468,16 @@ Page({
468 var list=arr[i]; 468 var list=arr[i];
469 await th.set_offline(list); 469 await th.set_offline(list);
470 } 470 }
471 - } 471 + }else{
  472 + //-- 此时要实时更新线下取价价格 --
  473 + for(var i=0;i<arr.length;i++){
  474 + //每个门店都去看下线下取价
  475 + var list=arr[i];
  476 + for(var i in list.goods){
  477 + list.goods[i].offline_price=0
  478 + }
  479 + }
  480 + }
472 481
473 for (let u1 in arr) { 482 for (let u1 in arr) {
474 var u_item=arr[u1]; 483 var u_item=arr[u1];
@@ -1885,7 +1894,7 @@ Page({ @@ -1885,7 +1894,7 @@ Page({
1885 throw "商品价格已经变化"; 1894 throw "商品价格已经变化";
1886 } 1895 }
1887 } else { 1896 } else {
1888 - if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price) { 1897 + if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price>0) {
1889 isok = 0; 1898 isok = 0;
1890 gname = val.goods_name; 1899 gname = val.goods_name;
1891 throw "商品价格已经变化"; 1900 throw "商品价格已经变化";
pages/cart/cart/zh_calculate.js
@@ -119,11 +119,11 @@ module.exports = { @@ -119,11 +119,11 @@ module.exports = {
119 item.offline_price=get_num(item).offline_price; 119 item.offline_price=get_num(item).offline_price;
120 var cart_num=get_num(item).goods_num; 120 var cart_num=get_num(item).goods_num;
121 var zh_b_num=get_num2(item).zh_b_num; 121 var zh_b_num=get_num2(item).zh_b_num;
  122 + if(!cart_num) continue;
122 123
123 item.cart_num =cart_num; 124 item.cart_num =cart_num;
124 //-- 当商品有购买的时候,以及有限购的时候 -- 125 //-- 当商品有购买的时候,以及有限购的时候 --
125 - if(zh_b_num>0 && item.buyqty>0){  
126 - 126 + if(item.buyqty>0){
127 var cbuy=item.buyqty-zh_b_num; 127 var cbuy=item.buyqty-zh_b_num;
128 //当可买的数量为0 128 //当可买的数量为0
129 if(cbuy<=0){ 129 if(cbuy<=0){
pages/cart/cart2/cart2.js
@@ -419,6 +419,28 @@ Page({ @@ -419,6 +419,28 @@ Page({
419 419
420 for (var i = 0; i < carr.length; i++) { 420 for (var i = 0; i < carr.length; i++) {
421 var item1 = carr[i]; 421 var item1 = carr[i];
  422 + //把已经购买了多少见的内容填入
  423 +
  424 + var goodsbuynum=0,promgoodsbuynum=0;
  425 + //--要获得商品,该用户买了多少件,同步应用--
  426 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  427 + data: {
  428 + store_id: os.stoid,
  429 + user_id: getApp().globalData.user_id,
  430 + goods_id: item1.goods_id,
  431 + prom_type: item1.prom_type,
  432 + prom_id: item1.prom_id
  433 + },
  434 + }).then(res => {
  435 + var buy_num_data = res.data.data;
  436 + if (buy_num_data.promgoodsbuynum) {
  437 + promgoodsbuynum = buy_num_data.promgoodsbuynum;
  438 + }
  439 + goodsbuynum = buy_num_data.goodsbuynum;
  440 + })
  441 + //如果有购买活动
  442 + item1.promgoodsbuynum=promgoodsbuynum;
  443 +
422 //要把优惠活动加入,prom_goods_map中,赠品不要运算 444 //要把优惠活动加入,prom_goods_map中,赠品不要运算
423 if (item1.prom_type == 3 && item1.is_gift != 1) { 445 if (item1.prom_type == 3 && item1.is_gift != 1) {
424 await th.add_prom_goods_map(item1); 446 await th.add_prom_goods_map(item1);
@@ -482,19 +504,20 @@ Page({ @@ -482,19 +504,20 @@ Page({
482 } 504 }
483 505
484 item.original_img = oo.imghost + item.original_img; 506 item.original_img = oo.imghost + item.original_img;
  507 +
  508 + var car_item=item;
485 /*----接口要弄出来的,先顶着-----*/ 509 /*----接口要弄出来的,先顶着-----*/
486 - var pcid = item.pick_id; 510 + var pcid = car_item.pick_id;
487 var find = 0; 511 var find = 0;
488 //----如果有就加进去,没有就新增一个---- 512 //----如果有就加进去,没有就新增一个----
489 //-----------循环查找门店------------- 513 //-----------循环查找门店-------------
490 if (arr.length > 0) { 514 if (arr.length > 0) {
491 for (var j = 0; j < arr.length; j++) { 515 for (var j = 0; j < arr.length; j++) {
492 if (arr[j].pickup_id == pcid) { 516 if (arr[j].pickup_id == pcid) {
493 - arr[j].goods.push(item);  
494 //if(item.is_gift!=1){ 517 //if(item.is_gift!=1){
495 //确定配送方式 518 //确定配送方式
496 if (arr[j].distr_t == 0) { 519 if (arr[j].distr_t == 0) {
497 - arr[j].distr_t = item.distr_type; 520 + arr[j].distr_t = car_item.distr_type;
498 } 521 }
499 var e_t = 0 522 var e_t = 0
500 switch (arr[j].distr_t) { 523 switch (arr[j].distr_t) {
@@ -514,7 +537,9 @@ Page({ @@ -514,7 +537,9 @@ Page({
514 //} 537 //}
515 538
516 //-- 把等级卡会优惠多少钱装进去 -- 539 //-- 把等级卡会优惠多少钱装进去 --
517 - if (item.cut_price) arr[j].card_cut_price += item.cut_price; 540 + if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1;
  541 +
  542 + arr[j].goods.push(car_item);
518 find = 1; 543 find = 1;
519 break; 544 break;
520 } 545 }
@@ -554,7 +579,7 @@ Page({ @@ -554,7 +579,7 @@ Page({
554 if (e_t == 0) th.setData({is_all_zt: 0}); 579 if (e_t == 0) th.setData({is_all_zt: 0});
555 580
556 var narr = new Array(); 581 var narr = new Array();
557 - narr.push(item); 582 + narr.push(car_item);
558 583
559 //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号,计算默认的物流,不管是不是自提都算一下----------------- 584 //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号,计算默认的物流,不管是不是自提都算一下-----------------
560 var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 585 var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
@@ -584,7 +609,7 @@ Page({ @@ -584,7 +609,7 @@ Page({
584 }; 609 };
585 610
586 //-- 把等级卡会优惠多少钱装进去 -- 611 //-- 把等级卡会优惠多少钱装进去 --
587 - if (item.cut_price1) ie.card_cut_price += item.cut_price1; 612 + if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1;
588 arr.push(ie); 613 arr.push(ie);
589 614
590 } 615 }
@@ -610,8 +635,11 @@ Page({ @@ -610,8 +635,11 @@ Page({
610 var offline_price = 0; 635 var offline_price = 0;
611 var offline_num = 0; 636 var offline_num = 0;
612 for (var c = 0; c < item.length; c++) { 637 for (var c = 0; c < item.length; c++) {
  638 + if(th.data.sales_rules!=2){
  639 + item[c].offline_price=0;
  640 + }
613 //-- 如果这个商品是线下取价的时候 -- 641 //-- 如果这个商品是线下取价的时候 --
614 - if (item[c].offline_price > 0 && item[c].prom_type != 7) { 642 + if (item[c].offline_price > 0 && item[c].prom_type != 7 ) {
615 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; 643 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num;
616 offline_num += item[c].goods_num; 644 offline_num += item[c].goods_num;
617 } 645 }
@@ -2470,7 +2498,13 @@ Page({ @@ -2470,7 +2498,13 @@ Page({
2470 }, function () { 2498 }, function () {
2471 //支付失败 2499 //支付失败
2472 setTimeout(function () { 2500 setTimeout(function () {
2473 - wx.navigateBack({delta: 1}) 2501 + var cps=getCurrentPages();
  2502 + if(cps.length>1){
  2503 + wx.navigateBack({delta: 1})
  2504 + }else{
  2505 + getApp().goto("/pages/index/index/index");
  2506 + }
  2507 +
2474 }, 1000) 2508 }, 1000)
2475 }, oo.stoid); 2509 }, oo.stoid);
2476 2510
pages/cart/cart2/cart2.wxml
@@ -105,8 +105,7 @@ @@ -105,8 +105,7 @@
105 </view> 105 </view>
106 </navigator> 106 </navigator>
107 </view> 107 </view>
108 -  
109 - 108 +
110 <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> 109 <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 -->
111 <view class="plus_buy fs28" wx:if="{{item.card_cut_price>0}}"> 110 <view class="plus_buy fs28" wx:if="{{item.card_cut_price>0}}">
112 <view class="flex"> 111 <view class="flex">
pages/cart/cart2/zh_calculate.js
@@ -22,6 +22,18 @@ module.exports = { @@ -22,6 +22,18 @@ module.exports = {
22 let need_to_buy = 0; 22 let need_to_buy = 0;
23 let all_zhqty = 0; //所有商品要求起购数之和 23 let all_zhqty = 0; //所有商品要求起购数之和
24 let no_in_arr = []; //剩余的未加入组合购 24 let no_in_arr = []; //剩余的未加入组合购
  25 + let out_arr=[]; //超出活动限购的商品放入
  26 +
  27 + //-- 寻找一下 --
  28 + function get_num2(ite) {
  29 + for (let v2 in goods) {
  30 + var vh = goods[v2];
  31 + if (vh.goods_id == ite.goods_id) {
  32 + return vh;
  33 + }
  34 + }
  35 + return 0;
  36 + }
25 37
26 for (let j in act_goos) { 38 for (let j in act_goos) {
27 let item = act_goos[j]; 39 let item = act_goos[j];
@@ -32,6 +44,27 @@ module.exports = { @@ -32,6 +44,27 @@ module.exports = {
32 if (item_j) { 44 if (item_j) {
33 act_goos[j].num = item_j.goods_num; 45 act_goos[j].num = item_j.goods_num;
34 act_goos[j].goods_price = item_j.goods_price; 46 act_goos[j].goods_price = item_j.goods_price;
  47 + var cart_num=item.cart_num =item_j.goods_num;
  48 + var zh_b_num=item_j.promgoodsbuynum;
  49 + if(item.buyqty>0){
  50 + var cbuy=item.buyqty-zh_b_num;
  51 + //当可买的数量为0
  52 + if(cbuy<=0){
  53 + item.num=0;
  54 + out_arr.push({
  55 + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num
  56 + })
  57 + }else{
  58 + if(cbuy>=cart_num) item.num =cart_num;
  59 + else{
  60 + item.num =cbuy;
  61 + out_arr.push({
  62 + price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy
  63 + })
  64 + }
  65 + }
  66 + }
  67 +
35 all_num += item.num; 68 all_num += item.num;
36 //当有起购数的控制的时候 69 //当有起购数的控制的时候
37 if (item.zhqty) { 70 if (item.zhqty) {
@@ -86,9 +119,10 @@ module.exports = { @@ -86,9 +119,10 @@ module.exports = {
86 } 119 }
87 } 120 }
88 121
  122 +
  123 + let goods_map = {};
89 //算一下剩余的商品 124 //算一下剩余的商品
90 - if (no_in_arr.length) {  
91 - let goods_map = {}; 125 + if(no_in_arr.length) {
92 for (let ii in no_in_arr) { 126 for (let ii in no_in_arr) {
93 let item = no_in_arr[ii]; 127 let item = no_in_arr[ii];
94 if (item.offline_price) { 128 if (item.offline_price) {
@@ -102,6 +136,27 @@ module.exports = { @@ -102,6 +136,27 @@ module.exports = {
102 goods_map[item.goods_id] = 1; 136 goods_map[item.goods_id] = 1;
103 } 137 }
104 } 138 }
  139 + }
  140 +
  141 + //超量的部分也要计算一下
  142 + if(out_arr.length){
  143 + for (var m in out_arr) {
  144 + var item = out_arr[m];
  145 + if (item.offline_price) {
  146 + offline_price += (item.price - item.offline_price)*item.num;
  147 + offline_num += item.num;
  148 + }
  149 + if (goods_map[item.goods_id]) {
  150 + var num = goods_map[item.goods_id];
  151 + num+=item.num
  152 + goods_map[item.goods_id] =num;
  153 + } else {
  154 + goods_map[item.goods_id] = item.num;
  155 + }
  156 + }
  157 + }
  158 +
  159 + if(Object.keys(goods_map).length) {
105 //这里就开始拆分提交订单时的列表 160 //这里就开始拆分提交订单时的列表
106 for (let j in goods_map) { 161 for (let j in goods_map) {
107 //map中存的就是商品的数量 162 //map中存的就是商品的数量
@@ -118,6 +173,8 @@ module.exports = { @@ -118,6 +173,8 @@ module.exports = {
118 goods.push(new_g); 173 goods.push(new_g);
119 } 174 }
120 } 175 }
  176 +
  177 +
121 //-- 只统计是参与活动的商品 -- 178 //-- 只统计是参与活动的商品 --
122 for(var ij in goods){ 179 for(var ij in goods){
123 var iter=goods[ij]; 180 var iter=goods[ij];
pages/goods/goodsInfo/goodsInfo.js
@@ -1588,6 +1588,12 @@ Page({ @@ -1588,6 +1588,12 @@ Page({
1588 // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { 1588 // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {
1589 // action: "buy_now" 1589 // action: "buy_now"
1590 // }), 1590 // }),
  1591 + this.setData({
  1592 + openSpecModal:0,
  1593 + openSpecModal_inte:0,
  1594 + openSpecModal_inte_normal:0,
  1595 + openSpecModal_pt:0,
  1596 + })
1591 1597
1592 if(e.prom_type==4){ 1598 if(e.prom_type==4){
1593 s.set_b_now(e); 1599 s.set_b_now(e);
@@ -1602,16 +1608,20 @@ Page({ @@ -1602,16 +1608,20 @@ Page({
1602 e.prom_id=res.cat_id 1608 e.prom_id=res.cat_id
1603 } 1609 }
1604 s.set_b_now(e); 1610 s.set_b_now(e);
  1611 + /*--
1605 wx.redirectTo({ 1612 wx.redirectTo({
1606 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, 1613 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
1607 - }); 1614 + });--*/
  1615 + getApp().goto("/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
1608 1616
1609 }) 1617 })
1610 }else{ 1618 }else{
1611 s.set_b_now(e); 1619 s.set_b_now(e);
  1620 + /*--
1612 wx.redirectTo({ 1621 wx.redirectTo({
1613 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, 1622 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
1614 - }); 1623 + });--*/
  1624 + getApp().goto("/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
1615 } 1625 }
1616 1626
1617 } 1627 }
@@ -3192,7 +3202,7 @@ Page({ @@ -3192,7 +3202,7 @@ Page({
3192 }); 3202 });
3193 3203
3194 //----------查看阶梯团------------ 3204 //----------查看阶梯团------------
3195 - if (t.data.data.ct_rylist != "" && t.data.data.ct_rylist != null && t.data.data.ct_rylist != undefined) { 3205 + if (t.data.data.ct_rylist != "null" && t.data.data.ct_rylist != "" && t.data.data.ct_rylist != null && t.data.data.ct_rylist != undefined) {
3196 t.data.data.ct_rylist = JSON.parse(t.data.data.ct_rylist); 3206 t.data.data.ct_rylist = JSON.parse(t.data.data.ct_rylist);
3197 var max_num = 0; 3207 var max_num = 0;
3198 t.data.data.ct_rylist.forEach(function(val, ind) { 3208 t.data.data.ct_rylist.forEach(function(val, ind) {
@@ -3521,10 +3531,13 @@ Page({ @@ -3521,10 +3531,13 @@ Page({
3521 if(this.data.is_go_to_team_show) return false; 3531 if(this.data.is_go_to_team_show) return false;
3522 this.data.is_go_to_team_show=1; 3532 this.data.is_go_to_team_show=1;
3523 wx.showLoading(); 3533 wx.showLoading();
3524 - 3534 +
  3535 + /*---
3525 wx.redirectTo({ 3536 wx.redirectTo({
3526 url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, 3537 url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,
3527 - }); 3538 + });--*/
  3539 + getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
  3540 +
3528 } else { 3541 } else {
3529 th.setData({ 3542 th.setData({
3530 is_normal: ind, 3543 is_normal: ind,
@@ -3753,9 +3766,11 @@ Page({ @@ -3753,9 +3766,11 @@ Page({
3753 3766
3754 var th = this; 3767 var th = this;
3755 var url="/pages/team/team_success/team_success?ordersn=" + th.data.buy_order.order_sn; 3768 var url="/pages/team/team_success/team_success?ordersn=" + th.data.buy_order.order_sn;
  3769 + /*--
3756 wx.redirectTo({ 3770 wx.redirectTo({
3757 url:url, 3771 url:url,
3758 - }) 3772 + })--*/
  3773 + getApp().goto(url);
3759 3774
3760 }, 3775 },
3761 3776
@@ -3840,10 +3855,13 @@ Page({ @@ -3840,10 +3855,13 @@ Page({
3840 if(this.data.is_go_to_team_show) return false; 3855 if(this.data.is_go_to_team_show) return false;
3841 this.data.is_go_to_team_show=1; 3856 this.data.is_go_to_team_show=1;
3842 wx.showLoading(); 3857 wx.showLoading();
3843 - 3858 + /*--
3844 wx.redirectTo({ 3859 wx.redirectTo({
3845 url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, 3860 url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,
3846 - }); 3861 + });--*/
  3862 +
  3863 + getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
  3864 +
3847 } else { 3865 } else {
3848 wx.navigateTo({ 3866 wx.navigateTo({
3849 url: "/pages/team/team_show/team_show?tg_id=" + id, 3867 url: "/pages/team/team_show/team_show?tg_id=" + id,