Commit a68c9a69666244f32286dcc362e5c432246216b1
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
9 changed files
with
195 additions
and
215 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -1020,35 +1020,55 @@ Page({ | @@ -1020,35 +1020,55 @@ Page({ | ||
1020 | success: function (t) { | 1020 | success: function (t) { |
1021 | console.log(t); | 1021 | console.log(t); |
1022 | if (t.data.code == 0) { | 1022 | if (t.data.code == 0) { |
1023 | + | ||
1024 | + var p_fail=0; | ||
1025 | + | ||
1023 | if (t.data.data.is_on_sale != 1) { | 1026 | if (t.data.data.is_on_sale != 1) { |
1027 | + p_fail=1; | ||
1024 | wx.showModal({ | 1028 | wx.showModal({ |
1025 | title: '商品已经下架', | 1029 | title: '商品已经下架', |
1026 | showCancel: !1, | 1030 | showCancel: !1, |
1027 | complete: function () { | 1031 | complete: function () { |
1028 | - wx.navigateBack(); | 1032 | + let pages = getCurrentPages(); |
1033 | + if (pages[pages.length - 2]) { | ||
1034 | + wx.navigateBack(); | ||
1035 | + } else { | ||
1036 | + getApp().goto('/pages/index/index/index') | ||
1037 | + } | ||
1029 | } | 1038 | } |
1030 | }); | 1039 | }); |
1040 | + | ||
1031 | } | 1041 | } |
1032 | 1042 | ||
1033 | var timestamp = Date.parse(new Date()); | 1043 | var timestamp = Date.parse(new Date()); |
1034 | timestamp = timestamp / 1000; | 1044 | timestamp = timestamp / 1000; |
1035 | - if (t.data.data.on_time > timestamp) { | 1045 | + if (t.data.data.on_time > timestamp && !p_fail) { |
1036 | wx.showModal({ | 1046 | wx.showModal({ |
1037 | title: '商品还未上架', | 1047 | title: '商品还未上架', |
1038 | showCancel: !1, | 1048 | showCancel: !1, |
1039 | complete: function () { | 1049 | complete: function () { |
1040 | - wx.navigateBack(); | 1050 | + let pages = getCurrentPages(); |
1051 | + if (pages[pages.length - 2]) { | ||
1052 | + wx.navigateBack(); | ||
1053 | + } else { | ||
1054 | + getApp().goto('/pages/index/index/index') | ||
1055 | + } | ||
1041 | } | 1056 | } |
1042 | }); | 1057 | }); |
1043 | } | 1058 | } |
1044 | 1059 | ||
1045 | - if (t.data.data.down_time > 0) { | 1060 | + if (t.data.data.down_time > 0 && !p_fail) { |
1046 | if (t.data.data.down_time < timestamp) { | 1061 | if (t.data.data.down_time < timestamp) { |
1047 | wx.showModal({ | 1062 | wx.showModal({ |
1048 | title: '商品已经到期下架', | 1063 | title: '商品已经到期下架', |
1049 | showCancel: !1, | 1064 | showCancel: !1, |
1050 | complete: function () { | 1065 | complete: function () { |
1051 | - wx.navigateBack(); | 1066 | + let pages = getCurrentPages(); |
1067 | + if (pages[pages.length - 2]) { | ||
1068 | + wx.navigateBack(); | ||
1069 | + } else { | ||
1070 | + getApp().goto('/pages/index/index/index') | ||
1071 | + } | ||
1052 | } | 1072 | } |
1053 | }); | 1073 | }); |
1054 | } | 1074 | } |
@@ -1979,193 +1999,41 @@ Page({ | @@ -1979,193 +1999,41 @@ Page({ | ||
1979 | openSpecModal_pt: 0, | 1999 | openSpecModal_pt: 0, |
1980 | }) | 2000 | }) |
1981 | 2001 | ||
1982 | - // if (e.prom_type == 9) { | ||
1983 | - // s.set_b_now(e); | ||
1984 | - // // var url = ''; | ||
1985 | - // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; | ||
1986 | - // getApp().goto(url); | ||
1987 | - // } else | ||
1988 | - | ||
1989 | - // if(e.prom_type == 9){ | ||
1990 | - if (true) { | ||
1991 | - //要判断积分购的普通购买有没有参加优惠活动 | ||
1992 | - if (e.is_normal == 1) { | ||
1993 | - this.check_nor_promgood(e.goods_id, function (res) { | ||
1994 | - if (res && res.act_id) { | ||
1995 | - e.prom_type = res.prom_type; | ||
1996 | - e.prom_id = res.act_id; | ||
1997 | - } else { | ||
1998 | - e.prom_type = 0; | ||
1999 | - // e.prom_id = 0; | ||
2000 | - } | ||
2001 | - | ||
2002 | - //-- 这一步主要是要让立即购买 走 购物车的逻辑 参与活动,如果有zh_act就强制组合购购买,要计算一下组合购的总数量 -- | ||
2003 | - if(th.data.zh_act && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num<th.data.zh_act.zh_num ) | ||
2004 | - && th.data.zh_act.zhbuyqty <= th.data.goodsInputNum){ | ||
2005 | - wx.hideLoading(); | ||
2006 | - | ||
2007 | - if((th.data.zh_act.buy_limit !=0 && th.data.zh_act.buy_limit <= th.data.userbuynum)){ | ||
2008 | - wx.showModal({ | ||
2009 | - title: '提示', | ||
2010 | - // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`, | ||
2011 | - content: `${th.data.data.goods_name}超出组合购限购次数,将以普通商品购买`, | ||
2012 | - success:res=>{ | ||
2013 | - if (res.confirm) { | ||
2014 | - console.log('用户点击确定') | ||
2015 | - //----先看会员在购物车中是否加入了该商品,立即购买的----- | ||
2016 | - getApp().request.get("/api/weshop/cart/page", { | ||
2017 | - data: { | ||
2018 | - store_id: os.stoid, | ||
2019 | - user_id: oo.user_id, | ||
2020 | - state: 1 | ||
2021 | - }, | ||
2022 | - success: function (res) { | ||
2023 | - //-------如果购物车中有相关的数据--------- | ||
2024 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2025 | - for (let j in res.data.data.pageData) { | ||
2026 | - let item_j = res.data.data.pageData[j]; | ||
2027 | - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id; | ||
2028 | - getApp().request.delete(url, {}); | ||
2029 | - } | ||
2030 | - } | ||
2031 | - e.state = 1; | ||
2032 | - e.prom_type=0; | ||
2033 | - e.prom_id=0 | ||
2034 | - getApp().request.post("/api/weshop/cart/save", { | ||
2035 | - data: e, | ||
2036 | - success: function (t) { | ||
2037 | - th.closeSpecModal(); | ||
2038 | - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); | ||
2039 | - } | ||
2040 | - }); | ||
2041 | - } | ||
2042 | - }) | ||
2043 | - } else if (res.cancel) { | ||
2044 | - | ||
2045 | - console.log('用户点击取消') | ||
2046 | - } | ||
2047 | - } | ||
2048 | - }) | ||
2049 | - }else{ | ||
2050 | - | ||
2051 | - | ||
2052 | - //----先看会员在购物车中是否加入了该商品,立即购买的----- | ||
2053 | - getApp().request.get("/api/weshop/cart/page", { | ||
2054 | - data: { | ||
2055 | - store_id: os.stoid, | ||
2056 | - user_id: oo.user_id, | ||
2057 | - state: 1 | ||
2058 | - }, | ||
2059 | - success: function (res) { | ||
2060 | - //-------如果购物车中有相关的数据,先清理掉--------- | ||
2061 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2062 | - for (let j in res.data.data.pageData) { | ||
2063 | - let item_j = res.data.data.pageData[j]; | ||
2064 | - var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id; | ||
2065 | - getApp().request.delete(url, {}); | ||
2066 | - } | ||
2067 | - } | ||
2068 | - | ||
2069 | - e.state = 1; | ||
2070 | - e.prom_type=7; | ||
2071 | - e.prom_id=th.data.zh_act.id; | ||
2072 | - getApp().request.post("/api/weshop/cart/save", { | ||
2073 | - data: e, | ||
2074 | - success: function (t) { | ||
2075 | - th.closeSpecModal(); | ||
2076 | - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); | ||
2077 | - } | ||
2078 | - }); | 2002 | + e.prom_type = 0; |
2003 | + e.prom_id = 0; | ||
2004 | + e.is_pd_normal= 1; | ||
2005 | + e.state = 1; | ||
2079 | 2006 | ||
2080 | - } | ||
2081 | - }) | ||
2082 | - } | ||
2083 | - | ||
2084 | - | ||
2085 | - return false | ||
2086 | - }else{ | ||
2087 | - //----先看会员在购物车中是否加入了该商品,立即购买的----- | ||
2088 | - getApp().request.get("/api/weshop/cart/page", { | ||
2089 | - data: { | ||
2090 | - store_id: os.stoid, | ||
2091 | - user_id: oo.user_id, | ||
2092 | - state: 1 | ||
2093 | - }, | ||
2094 | - success: function (res) { | ||
2095 | - //-------如果购物车中有相关的数据--------- | ||
2096 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2097 | - for (let j in res.data.data.pageData) { | ||
2098 | - let item_j = res.data.data.pageData[j]; | ||
2099 | - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id; | ||
2100 | - getApp().request.delete(url, {}); | ||
2101 | - } | ||
2102 | - } | 2007 | + //----先看会员在购物车中是否加入了该商品,立即购买的----- |
2008 | + getApp().request.get("/api/weshop/cart/page", { | ||
2103 | 2009 | ||
2104 | - } | ||
2105 | - }) | 2010 | + data: { |
2011 | + store_id: os.stoid, | ||
2012 | + user_id: oo.user_id, | ||
2013 | + state: 1 | ||
2014 | + }, | ||
2106 | 2015 | ||
2016 | + success: function (res) { | ||
2017 | + //-------如果购物车中有相关的数据,先清理掉--------- | ||
2018 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
2019 | + for (let j in res.data.data.pageData) { | ||
2020 | + let item_j = res.data.data.pageData[j]; | ||
2021 | + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id; | ||
2022 | + getApp().request.delete(url, {}); | ||
2107 | } | 2023 | } |
2024 | + } | ||
2108 | 2025 | ||
2109 | - | ||
2110 | - if(e.prom_type==10){ | ||
2111 | - //----先看会员在购物车中是否加入了该商品,立即购买的----- | ||
2112 | - getApp().request.get("/api/weshop/cart/page", { | ||
2113 | - data: { | ||
2114 | - store_id: e.store_id, | ||
2115 | - user_id: oo.user_id, | ||
2116 | - state: 1 | ||
2117 | - }, | ||
2118 | - success: function (res) { | ||
2119 | - //-------如果购物车中有相关的数据,先清理掉--------- | ||
2120 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2121 | - for (let j in res.data.data.pageData) { | ||
2122 | - let item_j = res.data.data.pageData[j]; | ||
2123 | - var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id; | ||
2124 | - getApp().request.delete(url, {}); | ||
2125 | - } | ||
2126 | - } | ||
2127 | - | ||
2128 | - e.state = 1; | ||
2129 | - getApp().request.post("/api/weshop/cart/save", { | ||
2130 | - data: e, | ||
2131 | - success: function (t) { | ||
2132 | - th.closeSpecModal(); | ||
2133 | - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); | ||
2134 | - } | ||
2135 | - }); | ||
2136 | - | ||
2137 | - } | ||
2138 | - }) | ||
2139 | - return false; | 2026 | + getApp().request.post("/api/weshop/cart/save", { |
2027 | + data: e, | ||
2028 | + success: function (t) { | ||
2029 | + th.closeSpecModal(); | ||
2030 | + getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); | ||
2140 | } | 2031 | } |
2032 | + }); | ||
2141 | 2033 | ||
2142 | - | ||
2143 | - | ||
2144 | - s.set_b_now(e); | ||
2145 | - /*-- | ||
2146 | - wx.redirectTo({ | ||
2147 | - url: "?is_bnow=1&goods_id=" + e.goods_id, | ||
2148 | - });--*/ | ||
2149 | - | ||
2150 | - // console.log('11111111111111111111111111======》'); | ||
2151 | - // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); | ||
2152 | - //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | ||
2153 | - | ||
2154 | - getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) | ||
2155 | - | ||
2156 | - }) | ||
2157 | - } else { | ||
2158 | - //console.log('222222222222222222222222222222======》'); | ||
2159 | - //s.set_b_now(e); | ||
2160 | - /*-- | ||
2161 | - wx.redirectTo({ | ||
2162 | - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | ||
2163 | - });--*/ | ||
2164 | - //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) | ||
2165 | - // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); | ||
2166 | } | 2034 | } |
2035 | + }) | ||
2167 | 2036 | ||
2168 | - } | ||
2169 | }, | 2037 | }, |
2170 | 2038 | ||
2171 | //----------增加购买数量----------- | 2039 | //----------增加购买数量----------- |
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -761,34 +761,54 @@ Page({ | @@ -761,34 +761,54 @@ Page({ | ||
761 | success: function (t) { | 761 | success: function (t) { |
762 | console.log(t); | 762 | console.log(t); |
763 | if (t.data.code == 0) { | 763 | if (t.data.code == 0) { |
764 | + | ||
765 | + var p_fail=0; | ||
766 | + | ||
764 | if (t.data.data.is_on_sale != 1) { | 767 | if (t.data.data.is_on_sale != 1) { |
768 | + | ||
769 | + p_fail=1; | ||
765 | wx.showModal({ | 770 | wx.showModal({ |
766 | title: '商品已经下架', | 771 | title: '商品已经下架', |
767 | showCancel: !1, | 772 | showCancel: !1, |
768 | complete: function () { | 773 | complete: function () { |
769 | - wx.navigateBack(); | 774 | + let pages = getCurrentPages(); |
775 | + if (pages[pages.length - 2]) { | ||
776 | + wx.navigateBack(); | ||
777 | + } else { | ||
778 | + getApp().goto('/pages/index/index/index') | ||
779 | + } | ||
770 | } | 780 | } |
771 | }); | 781 | }); |
772 | } | 782 | } |
773 | var timestamp = Date.parse(new Date()); | 783 | var timestamp = Date.parse(new Date()); |
774 | timestamp = timestamp / 1000; | 784 | timestamp = timestamp / 1000; |
775 | - if (t.data.data.on_time > timestamp) { | 785 | + if (t.data.data.on_time > timestamp && !p_fail) { |
776 | wx.showModal({ | 786 | wx.showModal({ |
777 | title: '商品还未上架', | 787 | title: '商品还未上架', |
778 | showCancel: !1, | 788 | showCancel: !1, |
779 | complete: function () { | 789 | complete: function () { |
780 | - wx.navigateBack(); | 790 | + let pages = getCurrentPages(); |
791 | + if (pages[pages.length - 2]) { | ||
792 | + wx.navigateBack(); | ||
793 | + } else { | ||
794 | + getApp().goto('/pages/index/index/index') | ||
795 | + } | ||
781 | } | 796 | } |
782 | }); | 797 | }); |
783 | } | 798 | } |
784 | 799 | ||
785 | - if (t.data.data.down_time > 0) { | 800 | + if (t.data.data.down_time > 0 && !p_fail) { |
786 | if (t.data.data.down_time < timestamp) { | 801 | if (t.data.data.down_time < timestamp) { |
787 | wx.showModal({ | 802 | wx.showModal({ |
788 | title: '商品已经到期下架', | 803 | title: '商品已经到期下架', |
789 | showCancel: !1, | 804 | showCancel: !1, |
790 | complete: function () { | 805 | complete: function () { |
791 | - wx.navigateBack(); | 806 | + let pages = getCurrentPages(); |
807 | + if (pages[pages.length - 2]) { | ||
808 | + wx.navigateBack(); | ||
809 | + } else { | ||
810 | + getApp().goto('/pages/index/index/index') | ||
811 | + } | ||
792 | } | 812 | } |
793 | }); | 813 | }); |
794 | } | 814 | } |
packageE/pages/cart/cart2/cart2.js
@@ -877,6 +877,17 @@ Page({ | @@ -877,6 +877,17 @@ Page({ | ||
877 | }, | 877 | }, |
878 | 878 | ||
879 | 879 | ||
880 | + is_last(gid,goods,map){ | ||
881 | + let last_id=0; | ||
882 | + for (let i = 0; i <goods.length ; i++) { | ||
883 | + if(map.indexOf(goods[i].goods_id)>-1){ | ||
884 | + last_id=goods[i].goods_id; | ||
885 | + } | ||
886 | + } | ||
887 | + if(gid==last_id) return true; | ||
888 | + return false; | ||
889 | + }, | ||
890 | + | ||
880 | //-- is_change是有没有切换活动的意思 -- | 891 | //-- is_change是有没有切换活动的意思 -- |
881 | async get_cart_next(carr,is_change,old_prom){ | 892 | async get_cart_next(carr,is_change,old_prom){ |
882 | 893 | ||
@@ -1222,7 +1233,28 @@ Page({ | @@ -1222,7 +1233,28 @@ Page({ | ||
1222 | 1233 | ||
1223 | //要在多活动确定之后,在来计算 | 1234 | //要在多活动确定之后,在来计算 |
1224 | for (var jh = 0; jh < arr[k].goods.length; jh++) { | 1235 | for (var jh = 0; jh < arr[k].goods.length; jh++) { |
1225 | - var item1 = arr[k].goods[jh] | 1236 | + |
1237 | + var item1 = arr[k].goods[jh]; | ||
1238 | + if(arr[k].show_can_cx){ | ||
1239 | + for (let key_o in arr[k].show_can_cx) { | ||
1240 | + let k_arr=key_o.split(','); | ||
1241 | + if(k_arr.indexOf(item1.goods_id+'')>-1 ){ | ||
1242 | + //-- 如果初始活动在计算的时候,是不满足的时候,就要把活动清理掉 -- | ||
1243 | + var is_no_ok=arr[k].show_can_cx[key_o].cur_act.is_no_ok; | ||
1244 | + if(is_no_ok==1){ | ||
1245 | + item1.prom_id = 0; | ||
1246 | + item1.prom_type = 0; | ||
1247 | + | ||
1248 | + //这里要判断一下活动的最后一个商品,is_act_last | ||
1249 | + if(th.is_last(item1.goods_id,arr[k].goods,arr[k].show_can_cx[key_o].ch_map)){ | ||
1250 | + item1.is_act_last=1; //这个是要在前端显示按钮切换的 | ||
1251 | + } | ||
1252 | + | ||
1253 | + } | ||
1254 | + } | ||
1255 | + } | ||
1256 | + } | ||
1257 | + | ||
1226 | //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠 | 1258 | //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠 |
1227 | if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) { | 1259 | if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) { |
1228 | // th.check_is_youhui(item1.goods_id, item1.pick_id); | 1260 | // th.check_is_youhui(item1.goods_id, item1.pick_id); |
@@ -1254,6 +1286,7 @@ Page({ | @@ -1254,6 +1286,7 @@ Page({ | ||
1254 | 1286 | ||
1255 | //要把组合购的东西拿出来算一下,同时组合购的总数量要有存在 | 1287 | //要把组合购的东西拿出来算一下,同时组合购的总数量要有存在 |
1256 | if (item1.prom_type == 7) { | 1288 | if (item1.prom_type == 7) { |
1289 | + | ||
1257 | if (!th.data.zuhe_map_good[item1.prom_id]) { | 1290 | if (!th.data.zuhe_map_good[item1.prom_id]) { |
1258 | var isok = 1; | 1291 | var isok = 1; |
1259 | var is_flag = 1; | 1292 | var is_flag = 1; |
@@ -1325,6 +1358,8 @@ Page({ | @@ -1325,6 +1358,8 @@ Page({ | ||
1325 | 1358 | ||
1326 | 1359 | ||
1327 | } else { | 1360 | } else { |
1361 | + | ||
1362 | + | ||
1328 | item1.act = th.data.zhhe_act_map[item1.prom_id]; | 1363 | item1.act = th.data.zhhe_act_map[item1.prom_id]; |
1329 | } | 1364 | } |
1330 | } | 1365 | } |
@@ -1402,19 +1437,23 @@ Page({ | @@ -1402,19 +1437,23 @@ Page({ | ||
1402 | item1.is_order_yh=1; | 1437 | item1.is_order_yh=1; |
1403 | item1.is_post_temp=1; | 1438 | item1.is_post_temp=1; |
1404 | //如果是秒杀,团购的时候,优惠促销和搭配购的时候 | 1439 | //如果是秒杀,团购的时候,优惠促销和搭配购的时候 |
1405 | - if([1,2,3,5,6].indexOf(item1.prom_type)>-1){ | 1440 | + if([1,2,3,5,6,7].indexOf(item1.prom_type)>-1){ |
1406 | var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid | 1441 | var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid |
1407 | + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id; | 1442 | + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id; |
1408 | await app.request.promiseGet(url,{}).then(res=>{ | 1443 | await app.request.promiseGet(url,{}).then(res=>{ |
1409 | if(res.data.code==0){ | 1444 | if(res.data.code==0){ |
1410 | console.log(res.data.data,"111"); | 1445 | console.log(res.data.data,"111"); |
1411 | - item1.is_order_yh=res.data.data.is_order_yh; | 1446 | + //组合促销有另外一个字段名is_orderyh,在控制订单促销的叠加 |
1447 | + if(item1.prom_type!=7){ | ||
1448 | + item1.is_order_yh=res.data.data.is_order_yh; | ||
1449 | + } | ||
1450 | + else item1.is_order_yh=0; | ||
1451 | + | ||
1412 | item1.is_post_temp=res.data.data.is_post_temp; | 1452 | item1.is_post_temp=res.data.data.is_post_temp; |
1413 | } | 1453 | } |
1414 | }) | 1454 | }) |
1415 | } | 1455 | } |
1416 | 1456 | ||
1417 | - | ||
1418 | } | 1457 | } |
1419 | 1458 | ||
1420 | 1459 | ||
@@ -1495,7 +1534,9 @@ Page({ | @@ -1495,7 +1534,9 @@ Page({ | ||
1495 | var u_item = arr[var1]; | 1534 | var u_item = arr[var1]; |
1496 | //把组合购进行分组 | 1535 | //把组合购进行分组 |
1497 | var obj = zh_calc.find_split(u_item); | 1536 | var obj = zh_calc.find_split(u_item); |
1498 | - if (!obj) continue; | 1537 | + if (!obj){ |
1538 | + continue; | ||
1539 | + } | ||
1499 | //存储不同活动的商品列表 | 1540 | //存储不同活动的商品列表 |
1500 | u_item.zh_prom_goods = {}; | 1541 | u_item.zh_prom_goods = {}; |
1501 | for (let var1 in obj) { | 1542 | for (let var1 in obj) { |
@@ -2915,12 +2956,12 @@ Page({ | @@ -2915,12 +2956,12 @@ Page({ | ||
2915 | o_price += item[jc].goods_price * item[jc].goods_num; | 2956 | o_price += item[jc].goods_price * item[jc].goods_num; |
2916 | 2957 | ||
2917 | //--- 秒杀, 团购的时候,判断有没有订单优惠和包邮模板的叠加 --- | 2958 | //--- 秒杀, 团购的时候,判断有没有订单优惠和包邮模板的叠加 --- |
2918 | - if( [1,2,3,5,6].indexOf(item[jc].prom_type)>-1){ | 2959 | + if( [1,2,3,5,6,7].indexOf(item[jc].prom_type)>-1){ |
2919 | 2960 | ||
2920 | var gd_price=item[jc].goods_price; | 2961 | var gd_price=item[jc].goods_price; |
2921 | if(item[jc].account_fir) gd_price=item[jc].account_fir; | 2962 | if(item[jc].account_fir) gd_price=item[jc].account_fir; |
2922 | 2963 | ||
2923 | - if(!item[jc].is_order_yh && !item[jc].whsle_id){ | 2964 | + if(!item[jc].is_order_yh && !item[jc].whsle_id && item[jc].prom_type!=7){ |
2924 | no_order_yh+=gd_price * item[jc].goods_num; | 2965 | no_order_yh+=gd_price * item[jc].goods_num; |
2925 | if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去 | 2966 | if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去 |
2926 | 2967 |
packageE/pages/cart/cart2/cart2.wxml
@@ -120,8 +120,10 @@ | @@ -120,8 +120,10 @@ | ||
120 | <!-- 新增促销多活动的排版,单商品的时候 --> | 120 | <!-- 新增促销多活动的排版,单商品的时候 --> |
121 | <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id] && item.show_can_cx[items.goods_id].act_arr.length>1)}}"> | 121 | <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id] && item.show_can_cx[items.goods_id].act_arr.length>1)}}"> |
122 | 122 | ||
123 | + | ||
123 | <!-- 组合购和阶梯促销要特殊出来 --> | 124 | <!-- 组合购和阶梯促销要特殊出来 --> |
124 | <block wx:if="{{item.show_can_cx[items.goods_id].sele_prom_type==7 || item.show_can_cx[items.goods_id].sele_prom_type==10 }}"> | 125 | <block wx:if="{{item.show_can_cx[items.goods_id].sele_prom_type==7 || item.show_can_cx[items.goods_id].sele_prom_type==10 }}"> |
126 | + | ||
125 | <!-- 是不是活动的最后一个商品 --> | 127 | <!-- 是不是活动的最后一个商品 --> |
126 | <view class="bdb16" wx:if="{{items.is_act_last}}" > | 128 | <view class="bdb16" wx:if="{{items.is_act_last}}" > |
127 | <view bindtap="switch_cx_group" | 129 | <view bindtap="switch_cx_group" |
packageE/pages/cart/cart2/zh_calculate.js
@@ -158,7 +158,7 @@ module.exports = { | @@ -158,7 +158,7 @@ module.exports = { | ||
158 | let be = parseInt(no_in_arr.length / act.zhbuyqty); | 158 | let be = parseInt(no_in_arr.length / act.zhbuyqty); |
159 | //如果有总数控制的时候,看还能买几组 | 159 | //如果有总数控制的时候,看还能买几组 |
160 | if(act.zh_num){ | 160 | if(act.zh_num){ |
161 | - var be1= parseInt((act.zh_num-act.zh_buy_num)/ act.zhbuyqty)-1; | 161 | + var be1= parseInt(act.zh_num-act.zh_buy_num)-1; |
162 | if(be1<be) be=be1; | 162 | if(be1<be) be=be1; |
163 | } | 163 | } |
164 | 164 |
pages/cart/cart/cart.js
@@ -3474,8 +3474,12 @@ Page({ | @@ -3474,8 +3474,12 @@ Page({ | ||
3474 | } | 3474 | } |
3475 | } | 3475 | } |
3476 | 3476 | ||
3477 | - if (i_arr[j].prom_type == 7 && (!this.data.requestData[i].need_list || (this.data.requestData[i].need_list && this.data.requestData[i].need_list.length == 0)) && i_arr[j].act && i_arr[j].act.buy_limit != 0) { | ||
3478 | - let userbuynum = await this.getUserBuyPromNum(i_arr[j].goods_prom_id); | 3477 | + |
3478 | + | ||
3479 | + | ||
3480 | + | ||
3481 | + if (i_arr[j].prom_type == 7 && i_arr[j].act && (i_arr[j].act.buy_limit>0 || i_arr[j].act.zh_num>0) ) { | ||
3482 | + let userbuynum = await this.getUserBuyPromNum(i_arr[j].prom_id); | ||
3479 | 3483 | ||
3480 | if(!zh_buyed_m[i_arr[j].prom_id]) zh_buyed_m[i_arr[j].prom_id]=userbuynum; | 3484 | if(!zh_buyed_m[i_arr[j].prom_id]) zh_buyed_m[i_arr[j].prom_id]=userbuynum; |
3481 | if(i_arr[j].act.buy_limit>0){ | 3485 | if(i_arr[j].act.buy_limit>0){ |
@@ -3483,7 +3487,11 @@ Page({ | @@ -3483,7 +3487,11 @@ Page({ | ||
3483 | } | 3487 | } |
3484 | 3488 | ||
3485 | console.log('活动次数:' + userbuynum); | 3489 | console.log('活动次数:' + userbuynum); |
3486 | - if (userbuynum >= i_arr[j].act.buy_limit && i_arr[j].act.buy_limit>0) { | 3490 | + |
3491 | + if(userbuynum >= i_arr[j].act.zh_num && i_arr[j].act.zh_num>0){ | ||
3492 | + i_arr[j].out_all_num=1; | ||
3493 | + checkArr7.push(i_arr[j]) | ||
3494 | + }else if (userbuynum >= i_arr[j].act.buy_limit && i_arr[j].act.buy_limit>0) { | ||
3487 | // i_arr[j].act.buy_userbuynum=true | 3495 | // i_arr[j].act.buy_userbuynum=true |
3488 | checkArr7.push(i_arr[j]) | 3496 | checkArr7.push(i_arr[j]) |
3489 | }else{ | 3497 | }else{ |
@@ -3742,16 +3750,33 @@ Page({ | @@ -3742,16 +3750,33 @@ Page({ | ||
3742 | 3750 | ||
3743 | 3751 | ||
3744 | if (checkArr7.length > 0) { | 3752 | if (checkArr7.length > 0) { |
3745 | - let checkStr = [] | 3753 | + |
3754 | + let checkStr = []; | ||
3755 | + let checkStr2 = []; | ||
3756 | + | ||
3746 | checkArr7.map(item => { | 3757 | checkArr7.map(item => { |
3747 | - checkStr.push(item.goods_name) | 3758 | + if(item.out_all_num){ |
3759 | + checkStr2.push(item.goods_name); | ||
3760 | + }else{ | ||
3761 | + checkStr.push(item.goods_name) | ||
3762 | + } | ||
3748 | }) | 3763 | }) |
3749 | - let str = checkStr.join() | 3764 | + |
3765 | + var msg_str=''; | ||
3766 | + if(checkStr.length){ | ||
3767 | + let str = checkStr.join(); | ||
3768 | + msg_str=`${str}超出组合购限购次数,将以普通商品购买`; | ||
3769 | + } | ||
3770 | + if(checkStr2.length){ | ||
3771 | + if(msg_str) msg_str+=","; | ||
3772 | + msg_str+=checkStr2.join()+"超出组合购总数,将以普通商品购买"; | ||
3773 | + } | ||
3774 | + | ||
3750 | wx.hideLoading() | 3775 | wx.hideLoading() |
3751 | wx.showModal({ | 3776 | wx.showModal({ |
3752 | title: '提示', | 3777 | title: '提示', |
3753 | // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`, | 3778 | // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`, |
3754 | - content: `${str}超出组合购限购次数,将以普通商品购买`, | 3779 | + content: msg_str, |
3755 | success: res => { | 3780 | success: res => { |
3756 | wx.showLoading(); | 3781 | wx.showLoading(); |
3757 | if (res.confirm) { | 3782 | if (res.confirm) { |
pages/cart/cart/cart.wxss
@@ -434,7 +434,7 @@ page { | @@ -434,7 +434,7 @@ page { | ||
434 | background-color: #d60021; | 434 | background-color: #d60021; |
435 | /* margin:0 auto; */ | 435 | /* margin:0 auto; */ |
436 | color: #fff; | 436 | color: #fff; |
437 | - padding: 6rpx 20rpx; | 437 | + padding: 6rpx 12rpx; |
438 | } | 438 | } |
439 | 439 | ||
440 | .xc-coupon-fram .xc-coupon.gray{ | 440 | .xc-coupon-fram .xc-coupon.gray{ |
pages/cart/cart/zh_calculate.js
@@ -242,7 +242,7 @@ module.exports = { | @@ -242,7 +242,7 @@ module.exports = { | ||
242 | 242 | ||
243 | //如果有总数控制的时候,看还能买几组 | 243 | //如果有总数控制的时候,看还能买几组 |
244 | if(act.zh_num){ | 244 | if(act.zh_num){ |
245 | - var be1= parseInt((act.zh_num-act.zh_buy_num)/ act.zhbuyqty)-1; | 245 | + var be1= parseInt(act.zh_num-act.zh_buy_num)-1; |
246 | if(be1<be) be=be1; | 246 | if(be1<be) be=be1; |
247 | } | 247 | } |
248 | 248 |
pages/goods/goodsInfo/goodsInfo.js
@@ -1020,32 +1020,47 @@ Page({ | @@ -1020,32 +1020,47 @@ Page({ | ||
1020 | t.data.data.prom_type = 0 | 1020 | t.data.data.prom_type = 0 |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | - if (t.data.data.is_on_sale != 1) { | 1023 | + |
1024 | + var p_fail=0; | ||
1025 | + | ||
1026 | + if (t.data.data.is_on_sale != 1 ) { | ||
1027 | + p_fail=1; | ||
1024 | wx.showModal({ | 1028 | wx.showModal({ |
1025 | title: '商品已经下架', | 1029 | title: '商品已经下架', |
1026 | showCancel: !1, | 1030 | showCancel: !1, |
1027 | complete: function () { | 1031 | complete: function () { |
1028 | - wx.navigateBack(); | 1032 | + let pages = getCurrentPages(); |
1033 | + if (pages[pages.length - 2]) { | ||
1034 | + wx.navigateBack(); | ||
1035 | + } else { | ||
1036 | + getApp().goto('/pages/index/index/index') | ||
1037 | + } | ||
1029 | } | 1038 | } |
1030 | }); | 1039 | }); |
1040 | + | ||
1031 | } | 1041 | } |
1032 | 1042 | ||
1033 | ee.init(gid); | 1043 | ee.init(gid); |
1034 | 1044 | ||
1035 | var timestamp = Date.parse(new Date()); | 1045 | var timestamp = Date.parse(new Date()); |
1036 | timestamp = timestamp / 1000; | 1046 | timestamp = timestamp / 1000; |
1037 | - if (t.data.data.on_time > timestamp) { | 1047 | + if (t.data.data.on_time > timestamp && !p_fail) { |
1038 | wx.showModal({ | 1048 | wx.showModal({ |
1039 | title: '商品还未上架', | 1049 | title: '商品还未上架', |
1040 | showCancel: !1, | 1050 | showCancel: !1, |
1041 | complete: function () { | 1051 | complete: function () { |
1042 | - wx.navigateBack(); | 1052 | + let pages = getCurrentPages(); |
1053 | + if (pages[pages.length - 2]) { | ||
1054 | + wx.navigateBack(); | ||
1055 | + } else { | ||
1056 | + getApp().goto('/pages/index/index/index') | ||
1057 | + } | ||
1043 | } | 1058 | } |
1044 | }); | 1059 | }); |
1045 | } | 1060 | } |
1046 | 1061 | ||
1047 | - if (t.data.data.down_time > 0) { | ||
1048 | - if (t.data.data.down_time < timestamp) { | 1062 | + if (t.data.data.down_time > 0 && !p_fail) { |
1063 | + if (t.data.data.down_time < timestamp ) { | ||
1049 | wx.showModal({ | 1064 | wx.showModal({ |
1050 | title: '商品已经到期下架', | 1065 | title: '商品已经到期下架', |
1051 | showCancel: !1, | 1066 | showCancel: !1, |
@@ -3482,7 +3497,7 @@ Page({ | @@ -3482,7 +3497,7 @@ Page({ | ||
3482 | if (!user_id) user_id = 0; | 3497 | if (!user_id) user_id = 0; |
3483 | if (goodsinfo.prom_type == 1) { | 3498 | if (goodsinfo.prom_type == 1) { |
3484 | await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + goodsinfo.prom_id, {}).then(res => { | 3499 | await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + goodsinfo.prom_id, {}).then(res => { |
3485 | - if (res.data.code == 0) { | 3500 | + if (res.data.code == 0 && res.data.data) { |
3486 | prom = res.data.data; | 3501 | prom = res.data.data; |
3487 | prom.price = prom.user_price; | 3502 | prom.price = prom.user_price; |
3488 | this.setData({ | 3503 | this.setData({ |
@@ -3927,7 +3942,10 @@ Page({ | @@ -3927,7 +3942,10 @@ Page({ | ||
3927 | //------------处理门店--------------- | 3942 | //------------处理门店--------------- |
3928 | deal_pickup(e) { | 3943 | deal_pickup(e) { |
3929 | var th = this; | 3944 | var th = this; |
3930 | - if (!th.data.sele_g) return false | 3945 | + if (!th.data.sele_g){ |
3946 | + wx.hideLoading(); | ||
3947 | + return false | ||
3948 | + } | ||
3931 | 3949 | ||
3932 | var g_distr_type = th.data.sele_g.distr_type; | 3950 | var g_distr_type = th.data.sele_g.distr_type; |
3933 | wx.hideLoading(); | 3951 | wx.hideLoading(); |
@@ -4127,7 +4145,10 @@ Page({ | @@ -4127,7 +4145,10 @@ Page({ | ||
4127 | deal_pickup_dline(e) { | 4145 | deal_pickup_dline(e) { |
4128 | var pkno = [], | 4146 | var pkno = [], |
4129 | th = this; | 4147 | th = this; |
4130 | - if (!th.data.sele_g) return false; | 4148 | + if (!th.data.sele_g){ |
4149 | + wx.hideLoading(); | ||
4150 | + return false; | ||
4151 | + } | ||
4131 | 4152 | ||
4132 | if (this.data.def_pick_store) { | 4153 | if (this.data.def_pick_store) { |
4133 | pkno.push(this.data.def_pick_store.pickup_no); | 4154 | pkno.push(this.data.def_pick_store.pickup_no); |
@@ -4601,7 +4622,7 @@ Page({ | @@ -4601,7 +4622,7 @@ Page({ | ||
4601 | //拿取价格并且判断时间-- | 4622 | //拿取价格并且判断时间-- |
4602 | getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { | 4623 | getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { |
4603 | success: function (t) { | 4624 | success: function (t) { |
4604 | - if (t.data.code != 0) { | 4625 | + if (t.data.code != 0 || !t.data.data) { |
4605 | ee.get_normal(gid); | 4626 | ee.get_normal(gid); |
4606 | return false; | 4627 | return false; |
4607 | } | 4628 | } |
@@ -8120,6 +8141,9 @@ Page({ | @@ -8120,6 +8141,9 @@ Page({ | ||
8120 | if (this.check_prom_custom(1) !== 3) { | 8141 | if (this.check_prom_custom(1) !== 3) { |
8121 | return false; | 8142 | return false; |
8122 | } | 8143 | } |
8144 | + | ||
8145 | + if(!this.data.sele_g) return false; | ||
8146 | + | ||
8123 | var per_price = this.data.sele_g.shop_price | 8147 | var per_price = this.data.sele_g.shop_price |
8124 | if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { | 8148 | if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { |
8125 | per_price = this.data.sele_g[this.data.card_field]; | 8149 | per_price = this.data.sele_g[this.data.card_field]; |