Commit a82319fc9ed2f2dd44cceb6fe95a6a6185a704b2

Authored by 后端研发-苏泰源
2 parents 9e8470a4 c2f9aaf0

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

packageB/pages/zuhegou/index/index.js
@@ -1965,29 +1965,63 @@ Page({ @@ -1965,29 +1965,63 @@ Page({
1965 1965
1966 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 1966 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
1967 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) { 1967 if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
1968 - let zhqty_map=new map();  
1969 - //看一下是几倍  
1970 - var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); 1968 + var bz_num_ok=0; //超量倍增是否满足
  1969 + var zhqty_len=0; //几个超量倍增
  1970 + var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty); //看一下是几倍
1971 if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){ 1971 if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){
1972 - for(let i=0;i<zhqty_bz.length;i++){  
1973 - let vv=zhqty_bz[i];  
1974 - let num=0;  
1975 - let bz_num=be*vv.zhqty;  
1976 - for(let j=0;j<no_in_arr.length;j++){  
1977 - let ii=no_in_arr[j];  
1978 - if(vv.goods_id===ii.goods_id){  
1979 - num++;  
1980 - zhqty_map.set('num',num);  
1981 - zhqty_map.set('price',ii.price);  
1982 - }  
1983 - 1972 + if(zhqty_bz.length>1){
  1973 + zhqty_len=1;
  1974 + let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']}));
  1975 + let new_arr=zhqty_bz.filter(ii=>{
  1976 + return ii['num']==min_bz_num
  1977 + })
  1978 + // var vv=new_arr[0];
  1979 + var bz_num=be*new_arr[0].zhqty; //超量倍增
  1980 + var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量
  1981 + bz_num_ok=bz_num-num;
  1982 + if(bz_num_ok <= 0){
  1983 + //超量倍增满足,超量倍增就等于倍数
  1984 + bz_num_ok=bz_num;
  1985 + }else{
  1986 + //超量倍增不满足,倍数要减去多出得
  1987 + be=be-bz_num_ok;
  1988 + bz_num_ok=num;
1984 } 1989 }
1985 - } 1990 + for(let i=0;i<zhqty_bz.length;i++){
  1991 + var vv=zhqty_bz[i];
  1992 + for(let j=0;j<bz_num_ok;j++){
  1993 + let index= no_in_arr.findIndex(i=>{
  1994 + return vv.goods_id===i.goods_id
  1995 + })
  1996 + no_in_arr.splice(index,1)
  1997 + }
  1998 + }
  1999 + aprice += be * aprice;
  2000 + }else{
  2001 + var vv=zhqty_bz[0];
  2002 + var bz_num=be*vv.zhqty; //超量倍增
  2003 + var num=vv['num']-vv.zhqty; //购买数量减去超量
  2004 + bz_num_ok=bz_num-num;
  2005 + if(bz_num_ok <= 0){
  2006 + //超量倍增满足,超量倍增就等于倍数
  2007 + bz_num_ok=bz_num;
  2008 + }else{
  2009 + //超量倍增不满足,倍数要减去多出得
  2010 + be=be-bz_num_ok;
  2011 + bz_num_ok=num;
  2012 + }
  2013 + for(let j=0;j<bz_num_ok;j++){
  2014 + let index= no_in_arr.findIndex(i=>{
  2015 + return vv.goods_id===i.goods_id
  2016 + })
  2017 + no_in_arr.splice(index,1)
  2018 + }
  2019 + }
1986 } 2020 }
1987 - if(bz_num <= num){ 2021 + if(!zhqty_len){
  2022 + //多个超量就不用pop了
1988 aprice += be * aprice; 2023 aprice += be * aprice;
1989 - let pop_num=(be * this.data.act.zhbuyqty)-bz_num;  
1990 - console.log(pop_num); 2024 + let pop_num=be * this.data.act.zhbuyqty - bz_num_ok;
1991 for (var m = 0; m < pop_num; m++) { 2025 for (var m = 0; m < pop_num; m++) {
1992 no_in_arr.pop(); 2026 no_in_arr.pop();
1993 } 2027 }
pages/cart/cart/cart.js
@@ -2546,7 +2546,12 @@ Page({ @@ -2546,7 +2546,12 @@ Page({
2546 [rq_text]: list 2546 [rq_text]: list
2547 }); 2547 });
2548 } 2548 }
2549 - return false; 2549 +
  2550 + var rq_text2 = "requestData[" + cindex + "].make_up_arr";
  2551 + this.setData({
  2552 + [rq_text2]:null,
  2553 + })
  2554 +
2550 } 2555 }
2551 /*-- 2556 /*--
2552 var map2=new Map(); 2557 var map2=new Map();
@@ -2794,13 +2799,13 @@ Page({ @@ -2794,13 +2799,13 @@ Page({
2794 var item=res.data.data[0]; 2799 var item=res.data.data[0];
2795 switch (item.prom_type){ 2800 switch (item.prom_type){
2796 case 9: 2801 case 9:
2797 - good_url= '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.prom_id; 2802 + good_url= '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.act_id;
2798 break; 2803 break;
2799 case 8: 2804 case 8:
2800 - good_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.prom_id 2805 + good_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id
2801 break; 2806 break;
2802 default: 2807 default:
2803 - good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.prom_id+"&prom_type=1"; 2808 + good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id+"&prom_type=1";
2804 break 2809 break
2805 } 2810 }
2806 } 2811 }
pages/cart/cart/cart.wxml
@@ -39,11 +39,9 @@ @@ -39,11 +39,9 @@
39 <!-- 购物车商品框架 --> 39 <!-- 购物车商品框架 -->
40 <view class="login-in"> 40 <view class="login-in">
41 <!-- 编辑 --> 41 <!-- 编辑 -->
42 - <view class="padding flex-vertical-between fs30 Storenum store">  
43 - <view class="flex">  
44 - <view>总数量:</view>  
45 - <view class="goods_num">{{all_num}}</view>  
46 - <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="co-red weight_free">再买{{freight_free - total_fee}}元可享包邮({{weight_free}}kg内);</view> 42 + <view class="padding flex-vertical-between fs30 Storenum store" style="{{total_fee > 0 && freight_free - total_fee > 0 ? 'justify-content:space-between':'justify-content: flex-end;'}}">
  43 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  44 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
47 </view> 45 </view>
48 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view> 46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
49 <view wx:else bindtap="edit_cart" data-type="0">完成</view> 47 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
@@ -140,7 +138,8 @@ @@ -140,7 +138,8 @@
140 </view> 138 </view>
141 <!--- 去凑单 --> 139 <!--- 去凑单 -->
142 <view style="margin-top: 20rpx; padding: 0 30rpx"> 140 <view style="margin-top: 20rpx; padding: 0 30rpx">
143 - <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" > 141 + <block wx:if="{{item.make_up_arr}}">
  142 + <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
144 <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text> 143 <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text>
145 <text wx:if="{{item.diff_type==1}}">件</text> 144 <text wx:if="{{item.diff_type==1}}">件</text>
146 </text>, 145 </text>,
@@ -153,26 +152,36 @@ @@ -153,26 +152,36 @@
153 <text wx:if="{{item.content.is_libao==1}}">送礼包|</text> 152 <text wx:if="{{item.content.is_libao==1}}">送礼包|</text>
154 <text></text> 153 <text></text>
155 </view> 154 </view>
156 - <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view> 155 + <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
157 </view> 156 </view>
158 - </view>  
159 - 157 + </block>
  158 + </view>
160 <!-- 还差多少件立即享受组合购 --> 159 <!-- 还差多少件立即享受组合购 -->
161 <block wx:if="{{item.need_list && item.need_list.length>0 && !is_edit}}"> 160 <block wx:if="{{item.need_list && item.need_list.length>0 && !is_edit}}">
162 - <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.need_list}}"> 161 + <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.need_list}}">
163 <text>{{item.title}}</text> 162 <text>{{item.title}}</text>
164 - <text data-url="/packageB/pages/zuhegou/index/index?id={{item.id}}" bindtap="go_url">去凑单</text>  
165 - </view> 163 + <text data-url="/packageB/pages/zuhegou/index/index?id={{item.id}}" bindtap="go_url">去凑单></text>
  164 + </view>
166 </block> 165 </block>
167 166
168 <!-- 阶梯促销提示多少件的优惠 --> 167 <!-- 阶梯促销提示多少件的优惠 -->
169 <block wx:if="{{item.l_need_list && item.l_need_list.length>0 && !is_edit}}"> 168 <block wx:if="{{item.l_need_list && item.l_need_list.length>0 && !is_edit}}">
170 -  
171 <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.l_need_list}}"> 169 <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.l_need_list}}">
172 <text>{{item.title}}</text> 170 <text>{{item.title}}</text>
173 - <text data-url="/pages/goods/goodsList/goodsList?ladder_id={{item.id}}" bindtap="go_url">去凑单</text> 171 + <text data-url="/pages/goods/goodsList/goodsList?ladder_id={{item.id}}" bindtap="go_url">去凑单></text>
174 </view> 172 </view>
175 </block> 173 </block>
  174 +
  175 + <!-- <block wx:if="{{item.make_up_arr}}">
  176 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  177 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
  178 + </view>
  179 + </block>
  180 + <block wx:else="">
  181 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  182 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
  183 + </view>
  184 + </block> -->
176 185
177 186
178 <!-- 线下取价 --> 187 <!-- 线下取价 -->
pages/cart/cart/cart.wxss
@@ -224,6 +224,9 @@ radio { @@ -224,6 +224,9 @@ radio {
224 .store { 224 .store {
225 border-bottom: 7rpx solid rgb(245, 245, 245); 225 border-bottom: 7rpx solid rgb(245, 245, 245);
226 } 226 }
  227 +.login-in {
  228 + position: relative;
  229 +}
227 230
228 .login-in .Storenum { 231 .login-in .Storenum {
229 height: 80rpx; 232 height: 80rpx;
@@ -235,9 +238,11 @@ radio { @@ -235,9 +238,11 @@ radio {
235 } 238 }
236 239
237 .login-in .weight_free { 240 .login-in .weight_free {
  241 + /* position: absolute;
  242 + top: 20rpx; */
238 font-size: 26rpx; 243 font-size: 26rpx;
  244 + /* margin-left: 20rpx; */
239 line-height: 48rpx; 245 line-height: 48rpx;
240 - margin-left: 30rpx;  
241 } 246 }
242 247
243 .allradio { 248 .allradio {
pages/cart/cart/zh_calculate.js
@@ -232,25 +232,63 @@ module.exports = { @@ -232,25 +232,63 @@ module.exports = {
232 } 232 }
233 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 233 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
234 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 234 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
235 - //看一下是几倍  
236 - let num = 0;  
237 - let bz_num = 0;  
238 - var be = parseInt(no_in_arr.length / act.zhbuyqty); 235 + var bz_num_ok=0; //超量倍增是否满
  236 + var zhqty_len=0; //几个超量倍增
  237 + var be = parseInt(no_in_arr.length / act.zhbuyqty);//看一下是几倍
239 if (act.is_bzyh && zhqty_bz.length > 0) { 238 if (act.is_bzyh && zhqty_bz.length > 0) {
240 - for (let i = 0; i < zhqty_bz.length; i++) {  
241 - let item = zhqty_bz[i];  
242 - bz_num = be * item.zhqty;  
243 - for (let j = 0; j < no_in_arr.length; j++) {  
244 - let i = no_in_arr[j];  
245 - if (item.goods_id === i.goods_id) {  
246 - num++  
247 - } 239 + if(zhqty_bz.length>1){
  240 + zhqty_len=1;
  241 + let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']}));
  242 + let new_arr=zhqty_bz.filter(ii=>{
  243 + return ii['num']==min_bz_num
  244 + })
  245 + // var vv=new_arr[0];
  246 + var bz_num=be*new_arr[0].zhqty; //超量倍增
  247 + var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量
  248 + bz_num_ok=bz_num-num;
  249 + if(bz_num_ok <= 0){
  250 + //超量倍增满足,超量倍增就等于倍数
  251 + bz_num_ok=bz_num;
  252 + }else{
  253 + //超量倍增不满足,倍数要减去多出得
  254 + be=be-bz_num_ok;
  255 + bz_num_ok=num;
248 } 256 }
249 - } 257 + for(let i=0;i<zhqty_bz.length;i++){
  258 + var vv=zhqty_bz[i];
  259 + for(let j=0;j<bz_num_ok;j++){
  260 + let index= no_in_arr.findIndex(i=>{
  261 + return vv.goods_id===i.goods_id
  262 + })
  263 + no_in_arr.splice(index,1)
  264 + }
  265 + }
  266 + aprice += be * aprice;
  267 + }else{
  268 + var vv=zhqty_bz[0];
  269 + var bz_num=be*vv.zhqty; //超量倍增
  270 + var num=vv['num']-vv.zhqty; //购买数量减去超量
  271 + bz_num_ok=bz_num-num;
  272 + if(bz_num_ok <= 0){
  273 + //超量倍增满足,超量倍增就等于倍数
  274 + bz_num_ok=bz_num;
  275 + }else{
  276 + //超量倍增不满足,倍数要减去多出得
  277 + be=be-bz_num_ok;
  278 + bz_num_ok=num;
  279 + }
  280 + for(let j=0;j<bz_num_ok;j++){
  281 + let index= no_in_arr.findIndex(i=>{
  282 + return vv.goods_id===i.goods_id
  283 + })
  284 + no_in_arr.splice(index,1)
  285 + }
  286 + }
250 } 287 }
251 - if (bz_num <= num) { 288 + if (!zhqty_len) {
252 aprice += be * act.zhprice; 289 aprice += be * act.zhprice;
253 - for (var m = 0; m < be * act.zhbuyqty; m++) { 290 + let pop_num=be * act.zhbuyqty - bz_num_ok;
  291 + for (var m = 0; m < pop_num; m++) {
254 no_in_arr.pop(); 292 no_in_arr.pop();
255 } 293 }
256 } 294 }
pages/cart/cart2/cart2.js
@@ -24,7 +24,7 @@ Page({ @@ -24,7 +24,7 @@ Page({
24 firstEnter: !0, 24 firstEnter: !0,
25 //页面获取的参数 25 //页面获取的参数
26 param: null, 26 param: null,
27 - //提交订单的格式 27 + //提交订单的格式
28 formData: { 28 formData: {
29 order_amount: 0,//支付金额 29 order_amount: 0,//支付金额
30 total_amount: 0,//总价 30 total_amount: 0,//总价
@@ -87,7 +87,7 @@ Page({ @@ -87,7 +87,7 @@ Page({
87 is_express: 0, //选中物流的属性 87 is_express: 0, //选中物流的属性
88 expres_name: "", //点击选定 88 expres_name: "", //点击选定
89 isopen: 0, //券的说明 89 isopen: 0, //券的说明
90 - is_coupon: null, //选择券的控制属性 90 + is_coupon: 1, //选择券的控制属性
91 is_shipping_code: "",//插入用户默认地址 91 is_shipping_code: "",//插入用户默认地址
92 wu_arr_txt: "", //要更新的物流的字段 92 wu_arr_txt: "", //要更新的物流的字段
93 93
@@ -125,7 +125,7 @@ Page({ @@ -125,7 +125,7 @@ Page({
125 125
126 in_zhact_gdmap:{}, //不同门店参与同一活动的限购 126 in_zhact_gdmap:{}, //不同门店参与同一活动的限购
127 hid_inp:1, 127 hid_inp:1,
128 - user_note:{}, 128 + user_note:"",
129 zhhe_act_map:{}, //组合活动的map表 129 zhhe_act_map:{}, //组合活动的map表
130 zuhe_map_good:{}, //组合购的map表 130 zuhe_map_good:{}, //组合购的map表
131 ladder_map:{}, //阶梯促销的map表 131 ladder_map:{}, //阶梯促销的map表
@@ -175,10 +175,7 @@ Page({ @@ -175,10 +175,7 @@ Page({
175 //----------子页返回父页触发---------- 175 //----------子页返回父页触发----------
176 onShow: function () { 176 onShow: function () {
177 var th = this; 177 var th = this;
178 - th.setData({  
179 - show_submit: 0,  
180 -  
181 - }); //让提交先掩藏 178 + th.setData({show_submit: 0}); //让提交先掩藏
182 th.data.g_cart_q_time = null; 179 th.data.g_cart_q_time = null;
183 180
184 if (th.data.isclose == 0) { 181 if (th.data.isclose == 0) {
@@ -331,7 +328,6 @@ Page({ @@ -331,7 +328,6 @@ Page({
331 typeof func == "function" && func(); 328 typeof func == "function" && func();
332 }) 329 })
333 }, 330 },
334 -  
335 //------获取会员信息-----先获取用户信息,在进行下一步--- 331 //------获取会员信息-----先获取用户信息,在进行下一步---
336 get_info: function (func) { 332 get_info: function (func) {
337 var user_id = t.globalData.user_id; 333 var user_id = t.globalData.user_id;
@@ -529,7 +525,7 @@ Page({ @@ -529,7 +525,7 @@ Page({
529 } 525 }
530 else 526 else
531 { 527 {
532 - item1.act = th.data.zhhe_act_map[item1.prom_id]; 528 + item1.act = th.data.zhhe_act_map[item1.prom_id];
533 } 529 }
534 } 530 }
535 if(item1.prom_type==10){ 531 if(item1.prom_type==10){
@@ -565,7 +561,7 @@ Page({ @@ -565,7 +561,7 @@ Page({
565 } 561 }
566 }) 562 })
567 if (!isok){ 563 if (!isok){
568 - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id; 564 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
569 getApp().request.delete(url, {}); 565 getApp().request.delete(url, {});
570 th.data.ladder_map[item1.prom_id]=-1; 566 th.data.ladder_map[item1.prom_id]=-1;
571 continue; 567 continue;
@@ -629,9 +625,7 @@ Page({ @@ -629,9 +625,7 @@ Page({
629 if (arr.length > 0) { 625 if (arr.length > 0) {
630 for (var j = 0; j < arr.length; j++) { 626 for (var j = 0; j < arr.length; j++) {
631 if (arr[j].pickup_id == pcid) { 627 if (arr[j].pickup_id == pcid) {
632 -  
633 - //赠品的配送方式要和优惠的主商品一样  
634 - if(item.is_gift!=1){ 628 + //if(item.is_gift!=1){
635 //确定配送方式 629 //确定配送方式
636 if (arr[j].distr_t == 0) { 630 if (arr[j].distr_t == 0) {
637 arr[j].distr_t = car_item.distr_type; 631 arr[j].distr_t = car_item.distr_type;
@@ -652,8 +646,7 @@ Page({ @@ -652,8 +646,7 @@ Page({
652 arr[j].exp_type = e_t; 646 arr[j].exp_type = e_t;
653 if (e_t == 0) th.setData({is_all_zt: 0}); 647 if (e_t == 0) th.setData({is_all_zt: 0});
654 else if(e_t==1) th.setData({is_all_zt: 1}); 648 else if(e_t==1) th.setData({is_all_zt: 1});
655 - }  
656 - 649 + //}
657 650
658 //-- 把等级卡会优惠多少钱装进去 -- 651 //-- 把等级卡会优惠多少钱装进去 --
659 if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; 652 if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1;
@@ -696,7 +689,6 @@ Page({ @@ -696,7 +689,6 @@ Page({
696 } 689 }
697 //如果是物流的话,全部自提的控制要弄成0 690 //如果是物流的话,全部自提的控制要弄成0
698 if (e_t == 0) th.setData({is_all_zt: 0}); 691 if (e_t == 0) th.setData({is_all_zt: 0});
699 - else if (e_t == 1) th.setData({is_all_zt: 1});  
700 692
701 var narr = new Array(); 693 var narr = new Array();
702 narr.push(car_item); 694 narr.push(car_item);
@@ -835,8 +827,6 @@ Page({ @@ -835,8 +827,6 @@ Page({
835 get_buy_goods: function (e) { 827 get_buy_goods: function (e) {
836 var th = this; 828 var th = this;
837 var gg = to.get_b_now(); 829 var gg = to.get_b_now();
838 -  
839 -  
840 //--------如果goods_id一样,就是要立即购买----- 830 //--------如果goods_id一样,就是要立即购买-----
841 if (e == gg.goods_id) { 831 if (e == gg.goods_id) {
842 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { 832 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, {
@@ -984,11 +974,6 @@ Page({ @@ -984,11 +974,6 @@ Page({
984 } else { 974 } else {
985 //--看是不是搭配促销-- 975 //--看是不是搭配促销--
986 if (gg.prom_type == 5) { 976 if (gg.prom_type == 5) {
987 -  
988 - th.setData({  
989 - 'is_coupon': gg.is_coupon  
990 - });  
991 -  
992 t.data.data.prom_id = gg.prom_id; 977 t.data.data.prom_id = gg.prom_id;
993 t.data.data.prom_type = 5; 978 t.data.data.prom_type = 5;
994 if (gg.room_id) { 979 if (gg.room_id) {
@@ -1389,8 +1374,7 @@ Page({ @@ -1389,8 +1374,7 @@ Page({
1389 by_qc = res.data.data[0]; 1374 by_qc = res.data.data[0];
1390 } 1375 }
1391 }) 1376 })
1392 - }  
1393 - ; 1377 + };
1394 var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); 1378 var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist));
1395 1379
1396 if (th.data.cartlist && th.data.cartlist.length > 0) { 1380 if (th.data.cartlist && th.data.cartlist.length > 0) {
@@ -1478,7 +1462,7 @@ Page({ @@ -1478,7 +1462,7 @@ Page({
1478 { 1462 {
1479 is_no_zh=1; 1463 is_no_zh=1;
1480 } 1464 }
1481 - //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 1465 + //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1482 if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id] 1466 if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]
1483 && th.data.ladder_map[item[j].prom_id].is_useorderyh ) 1467 && th.data.ladder_map[item[j].prom_id].is_useorderyh )
1484 { 1468 {
@@ -1490,8 +1474,8 @@ Page({ @@ -1490,8 +1474,8 @@ Page({
1490 } 1474 }
1491 o_price += item[j].goods_price * item[j].goods_num; 1475 o_price += item[j].goods_price * item[j].goods_num;
1492 1476
1493 - //判断是否有设置限制重量包邮  
1494 - if(weight_free){ 1477 + //判断是否有设置限制重量包邮,先看商品有没有包邮
  1478 + if(item[j]['is_past']!==1 && weight_free){
1495 if( item[j]['exp_sum_type']==2 ){ 1479 if( item[j]['exp_sum_type']==2 ){
1496 if (goods_weight < 0) goods_weight = 0; 1480 if (goods_weight < 0) goods_weight = 0;
1497 //累积商品重量 每种商品的重量 * 数量 1481 //累积商品重量 每种商品的重量 * 数量
@@ -1740,19 +1724,16 @@ Page({ @@ -1740,19 +1724,16 @@ Page({
1740 }).then(res => { 1724 }).then(res => {
1741 if (res.data.code == 0) { 1725 if (res.data.code == 0) {
1742 var ord_prom = res.data.data; 1726 var ord_prom = res.data.data;
1743 - //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券  
1744 - if(!ord_prom.is_xz_yh || quan_price<=0) {  
1745 - order_prom_id = ord_prom['id'];  
1746 - switch (ord_prom['type']) {  
1747 - case 0:  
1748 - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折  
1749 - order_prom_amount = (o_condition - order_m).toFixed(2);  
1750 - break;  
1751 - case 1:  
1752 - //order_m = o_condition - ord_prom['expression'];//满额优惠金额  
1753 - order_prom_amount = ord_prom['expression'];  
1754 - break;  
1755 - } 1727 + order_prom_id = ord_prom['id'];
  1728 + switch (ord_prom['type']) {
  1729 + case 0:
  1730 + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  1731 + order_prom_amount = (o_condition - order_m).toFixed(2);
  1732 + break;
  1733 + case 1:
  1734 + //order_m = o_condition - ord_prom['expression'];//满额优惠金额
  1735 + order_prom_amount = ord_prom['expression'];
  1736 + break;
1756 } 1737 }
1757 } 1738 }
1758 }) 1739 })
@@ -2098,27 +2079,25 @@ Page({ @@ -2098,27 +2079,25 @@ Page({
2098 var order_prom_id = 0; 2079 var order_prom_id = 0;
2099 if (th.data.order_prom[th.data.bn_pick]) { 2080 if (th.data.order_prom[th.data.bn_pick]) {
2100 var ord_prom = th.data.order_prom[th.data.bn_pick]; 2081 var ord_prom = th.data.order_prom[th.data.bn_pick];
2101 - //如果订单没有勾选使用优惠券不参与此活动  
2102 - if(!ord_prom.is_xz_yh || quan_price<=0) {  
2103 -  
2104 - order_prom_id = ord_prom['id'];  
2105 - switch (ord_prom['type']) {  
2106 - case 0:  
2107 - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折  
2108 - order_prom_amount = (o_condition - order_m).toFixed(2);  
2109 - break;  
2110 - case 1:  
2111 - order_m = o_condition - ord_prom['expression'];//满额优惠金额  
2112 - order_prom_amount = ord_prom['expression'];  
2113 - break;  
2114 - } 2082 + order_prom_id = ord_prom['id'];
  2083 + switch (ord_prom['type']) {
  2084 + case 0:
  2085 + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  2086 + order_prom_amount = (o_condition - order_m).toFixed(2);
  2087 + break;
  2088 + case 1:
  2089 + order_m = o_condition - ord_prom['expression'];//满额优惠金额
  2090 + order_prom_amount = ord_prom['expression'];
  2091 + break;
2115 } 2092 }
2116 } 2093 }
2117 //--订单优惠的显示-- 2094 //--订单优惠的显示--
  2095 + var order_prom_txt1 = "formData.order_prom_id";
  2096 + var order_prom_txt2 = "formData.order_prom_amount";
2118 if (order_prom_id > 0) { 2097 if (order_prom_id > 0) {
2119 - var order_prom_txt1 = "formData.order_prom_id";  
2120 - var order_prom_txt2 = "formData.order_prom_amount";  
2121 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 2098 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
  2099 + }else{
  2100 + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})
2122 } 2101 }
2123 2102
2124 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 2103 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -2261,7 +2240,6 @@ Page({ @@ -2261,7 +2240,6 @@ Page({
2261 var ff = true; 2240 var ff = true;
2262 //------------立即购买------------- 2241 //------------立即购买-------------
2263 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { 2242 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
2264 -  
2265 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { 2243 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
2266 ff = false; 2244 ff = false;
2267 getApp().my_warnning("请选择收货地址", 0, th); 2245 getApp().my_warnning("请选择收货地址", 0, th);
@@ -2298,7 +2276,7 @@ Page({ @@ -2298,7 +2276,7 @@ Page({
2298 'user_money': th.data.formData.user_money, //使用余额 2276 'user_money': th.data.formData.user_money, //使用余额
2299 'total_amount': th.data.formData.total_amount, //订单总价 2277 'total_amount': th.data.formData.total_amount, //订单总价
2300 'order_amount': th.data.formData.order_amount, //应付 2278 'order_amount': th.data.formData.order_amount, //应付
2301 - 'user_note': th.data.user_note, //用户备注 2279 + 'user_note': th.data.user_note['0']?th.data.user_note['0']:0, //用户备注
2302 'store_id': oo.stoid, //商家 2280 'store_id': oo.stoid, //商家
2303 'pickup_id': th.data.bn_pick, //门店 2281 'pickup_id': th.data.bn_pick, //门店
2304 'exp_type': th.data.bn_exp_type, //配送方式 2282 'exp_type': th.data.bn_exp_type, //配送方式
@@ -2481,11 +2459,21 @@ Page({ @@ -2481,11 +2459,21 @@ Page({
2481 'gift_id': gift_gg.gift_id, 2459 'gift_id': gift_gg.gift_id,
2482 'prom_id': gift_gg.prom_id, 2460 'prom_id': gift_gg.prom_id,
2483 }; 2461 };
  2462 + //-- 把导购的信息填入--
  2463 + if (gg.guide_id) {
  2464 + g_goods.guide_id = gg.guide_id;
  2465 + g_goods.guide_type = gg.guide_type;
  2466 + //调用接口判断是不是会员
  2467 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  2468 + if (res.data.code == 0) {
  2469 + g_goods.guide_name = is_vip.salesman;
  2470 + g_goods.guide_sn = is_vip.salesman_no;
  2471 + }
  2472 + })
  2473 + }
2484 item.order_goods.push(g_goods); 2474 item.order_goods.push(g_goods);
2485 } 2475 }
2486 pdata.push(item); 2476 pdata.push(item);
2487 -  
2488 - console.log(pdata);  
2489 } else { 2477 } else {
2490 //---------购物车的结算--------- 2478 //---------购物车的结算---------
2491 if (th.data.is_all_zt == 0 && th.data.user_addr == null) { 2479 if (th.data.is_all_zt == 0 && th.data.user_addr == null) {
@@ -2547,7 +2535,6 @@ Page({ @@ -2547,7 +2535,6 @@ Page({
2547 if (t_item.coupon_price) { 2535 if (t_item.coupon_price) {
2548 item.coupon_price = t_item.coupon_price; 2536 item.coupon_price = t_item.coupon_price;
2549 item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; 2537 item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no;
2550 - t_item.quan_no=item.coupon_no;  
2551 } else if (t_item.quan_no) { 2538 } else if (t_item.quan_no) {
2552 item.coupon_no = t_item.quan_no; 2539 item.coupon_no = t_item.quan_no;
2553 item.coupon_price = 0; 2540 item.coupon_price = 0;
@@ -2616,16 +2603,15 @@ Page({ @@ -2616,16 +2603,15 @@ Page({
2616 2603
2617 //房间号的ids 2604 //房间号的ids
2618 var room_ids = ""; 2605 var room_ids = "";
2619 - //-- 把券的钱,写入从表 ---  
2620 - if (t_item.quan_youhui_list && t_item.coupon_price) {  
2621 2606
  2607 + //-- 把券的钱,写入从表 ---
  2608 + if (t_item.quan_youhui_list && t_item.coupon_price) {
2622 for (var kk in t_item.quan_youhui_list) { 2609 for (var kk in t_item.quan_youhui_list) {
2623 var you_item = t_item.quan_youhui_list[kk]; 2610 var you_item = t_item.quan_youhui_list[kk];
2624 //-- 对券的价格进行平摊 -- 2611 //-- 对券的价格进行平摊 --
2625 await th.split_set_goods_quanprice(you_item,t_item); 2612 await th.split_set_goods_quanprice(you_item,t_item);
2626 } 2613 }
2627 } 2614 }
2628 -  
2629 //-------------让商品添加到商品列表-------------------- 2615 //-------------让商品添加到商品列表--------------------
2630 for (var k = 0; k < t_item.goods.length; k++) { 2616 for (var k = 0; k < t_item.goods.length; k++) {
2631 var g_item = t_item.goods[k]; 2617 var g_item = t_item.goods[k];
@@ -2648,7 +2634,6 @@ Page({ @@ -2648,7 +2634,6 @@ Page({
2648 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); 2634 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
2649 goods.pricing_type = g_item.pricing_type; 2635 goods.pricing_type = g_item.pricing_type;
2650 } 2636 }
2651 -  
2652 if(g_item.quan_num){ 2637 if(g_item.quan_num){
2653 goods.quan_num=g_item.quan_num; 2638 goods.quan_num=g_item.quan_num;
2654 goods.quan_no=g_item.quan_no; 2639 goods.quan_no=g_item.quan_no;
@@ -2742,7 +2727,6 @@ Page({ @@ -2742,7 +2727,6 @@ Page({
2742 if (pdata.length == 0) return; 2727 if (pdata.length == 0) return;
2743 var str = JSON.stringify(pdata); 2728 var str = JSON.stringify(pdata);
2744 2729
2745 -  
2746 wx.showLoading({title: "加载中"}); 2730 wx.showLoading({title: "加载中"});
2747 wx.request({ 2731 wx.request({
2748 url: oo.url + '/api/weshop/order/createWxdOrder', 2732 url: oo.url + '/api/weshop/order/createWxdOrder',
@@ -2752,8 +2736,6 @@ Page({ @@ -2752,8 +2736,6 @@ Page({
2752 'content-type': 'application/json' 2736 'content-type': 'application/json'
2753 },// 设置请求的 header 2737 },// 设置请求的 header
2754 success: function (res) { 2738 success: function (res) {
2755 -  
2756 -  
2757 wx.hideLoading(); 2739 wx.hideLoading();
2758 if (res.statusCode == 200) { 2740 if (res.statusCode == 200) {
2759 var data = res.data; 2741 var data = res.data;
@@ -3602,7 +3584,6 @@ Page({ @@ -3602,7 +3584,6 @@ Page({
3602 if (th.data.is_b_now == 1) { 3584 if (th.data.is_b_now == 1) {
3603 th.setData({index: m_wind, is_express: m_wind}); 3585 th.setData({index: m_wind, is_express: m_wind});
3604 } else { 3586 } else {
3605 - clearInterval(ui);  
3606 var ui = setInterval(function () { 3587 var ui = setInterval(function () {
3607 if (th.data.cartlist) { 3588 if (th.data.cartlist) {
3608 var c_arr = th.data.cartlist; 3589 var c_arr = th.data.cartlist;
@@ -3639,7 +3620,9 @@ Page({ @@ -3639,7 +3620,9 @@ Page({
3639 //就要把相应的值,写入cartlist数组中-- 3620 //就要把相应的值,写入cartlist数组中--
3640 var ckeck_quan_price = 0, 3621 var ckeck_quan_price = 0,
3641 check_quan_price_list = '', 3622 check_quan_price_list = '',
3642 - check_quan_ware_list = ''; 3623 + check_quan_ware_list = '',
  3624 + check_quan_price_list_arr=[],
  3625 + check_quan_ware_list_arr=[];
3643 3626
3644 for (var i in goodlist) { 3627 for (var i in goodlist) {
3645 var gd = goodlist[i]; 3628 var gd = goodlist[i];
@@ -3678,47 +3661,75 @@ Page({ @@ -3678,47 +3661,75 @@ Page({
3678 th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele = 1; 3661 th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele = 1;
3679 } 3662 }
3680 is_xz_yh = 0; 3663 is_xz_yh = 0;
3681 - var item_price = gd.goods_price * gd.goods_num; 3664 +
  3665 + var item_price = gd.goods_price * gd.goods_num;
  3666 + var item_price2=item_price;
  3667 +
3682 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- 3668 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
3683 if (gd.account_fir != null && gd.account_fir != undefined) { 3669 if (gd.account_fir != null && gd.account_fir != undefined) {
3684 - //item_price = gd.account_fir * gd.goods_num; 3670 + item_price2 = gd.account_fir * gd.goods_num;
3685 } 3671 }
3686 - ckeck_quan_price += item_price;  
3687 3672
3688 - //--组装价格list--  
3689 - if (check_quan_price_list) {  
3690 - check_quan_price_list += "," + item_price;  
3691 - } else {  
3692 - check_quan_price_list = item_price; 3673 + if(gd.ld_account){
  3674 + item_price2 = gd.ld_account * gd.goods_num;
3693 } 3675 }
3694 - //--组装商品的线下erpwareid--  
3695 - if (check_quan_ware_list) {  
3696 - check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);  
3697 - } else {  
3698 - check_quan_ware_list = encodeURIComponent(gd['erpwareid']); 3676 +
  3677 + ckeck_quan_price += item_price;
  3678 + //如果商品有重复的过滤,一般是组合购和阶梯购的情况下
  3679 + var idx=check_quan_ware_list_arr.findIndex(function(ele){
  3680 + return ele== encodeURIComponent(gd['erpwareid']);
  3681 + })
  3682 +
  3683 + if(idx>-1){
  3684 + check_quan_price_list_arr[idx]+=item_price2;
  3685 + }else{
  3686 + check_quan_ware_list_arr.push(encodeURIComponent(gd['erpwareid']));
  3687 + check_quan_price_list_arr.push(item_price2);
3699 } 3688 }
  3689 + //--组装价格list--
  3690 + /*--
  3691 + if (check_quan_price_list) {
  3692 + check_quan_price_list += "," + item_price;
  3693 + } else {
  3694 + check_quan_price_list = item_price;
  3695 + }
  3696 + //--组装商品的线下erpwareid--
  3697 + if (check_quan_ware_list) {
  3698 + check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);
  3699 + } else {
  3700 + check_quan_ware_list = encodeURIComponent(gd['erpwareid']);
  3701 + }---*/
3700 } 3702 }
3701 -  
3702 //优惠券优惠的金额要控制到优惠券的选择条件 3703 //优惠券优惠的金额要控制到优惠券的选择条件
3703 var cut_price = 0; 3704 var cut_price = 0;
3704 for (var i in th.data.prom_goods_map[pickup_id]) { 3705 for (var i in th.data.prom_goods_map[pickup_id]) {
3705 var obj = th.data.prom_goods_map[pickup_id][i]; 3706 var obj = th.data.prom_goods_map[pickup_id][i];
3706 - if (obj.coupon_sele && obj.prom_price) { 3707 + if (obj.coupon_sele) {
3707 cut_price += obj.price - obj.prom_price; 3708 cut_price += obj.price - obj.prom_price;
3708 } 3709 }
3709 } 3710 }
3710 3711
3711 - //阶梯优惠使用券  
3712 var prom_pt_json= ep.prom_pt_json; 3712 var prom_pt_json= ep.prom_pt_json;
3713 if(prom_pt_json){ 3713 if(prom_pt_json){
3714 for(let oj in prom_pt_json){ 3714 for(let oj in prom_pt_json){
3715 let item_j=prom_pt_json[oj]; 3715 let item_j=prom_pt_json[oj];
  3716 +
  3717 + //要对一下阶梯优惠促销的功能
3716 if(item_j.ladder_prom_id){ 3718 if(item_j.ladder_prom_id){
  3719 +
  3720 + //看一下要不要限制使用优惠券
  3721 + if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon){
  3722 + continue;
  3723 + }
  3724 +
3717 cut_price += parseFloat(item_j.dis); 3725 cut_price += parseFloat(item_j.dis);
3718 } 3726 }
3719 } 3727 }
3720 } 3728 }
3721 3729
  3730 + if(check_quan_price_list_arr.length) check_quan_price_list=check_quan_price_list_arr.join(',');
  3731 + if(check_quan_ware_list_arr.length) check_quan_ware_list=check_quan_ware_list_arr.join(',')
  3732 +
3722 arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); 3733 arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0);
3723 arr[ind].check_quan_ware_list = check_quan_ware_list; 3734 arr[ind].check_quan_ware_list = check_quan_ware_list;
3724 arr[ind].check_quan_price_list = check_quan_price_list; 3735 arr[ind].check_quan_price_list = check_quan_price_list;
@@ -3732,7 +3743,7 @@ Page({ @@ -3732,7 +3743,7 @@ Page({
3732 data: { 3743 data: {
3733 storeId: oo.stoid, 3744 storeId: oo.stoid,
3734 userId: app.globalData.user_id, 3745 userId: app.globalData.user_id,
3735 - BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2), 3746 + BuySum: arr[ind].ckeck_quan_price,
3736 WareIds: check_quan_ware_list, 3747 WareIds: check_quan_ware_list,
3737 pageSize: 100 3748 pageSize: 100
3738 } 3749 }
@@ -3781,7 +3792,7 @@ Page({ @@ -3781,7 +3792,7 @@ Page({
3781 data: { 3792 data: {
3782 storeId: oo.stoid, 3793 storeId: oo.stoid,
3783 userId: app.globalData.user_id, 3794 userId: app.globalData.user_id,
3784 - BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2), 3795 + BuySum: th.data.ckeck_quan_price,
3785 WareIds: encodeURIComponent(th.data.check_quan_ware_list), 3796 WareIds: encodeURIComponent(th.data.check_quan_ware_list),
3786 pageSize: 100 3797 pageSize: 100
3787 }, 3798 },
@@ -3959,6 +3970,7 @@ Page({ @@ -3959,6 +3970,7 @@ Page({
3959 var goods_weight = -1, goods_piece = -1; 3970 var goods_weight = -1, goods_piece = -1;
3960 var gift_shipping_price = 0; 3971 var gift_shipping_price = 0;
3961 var th = this; 3972 var th = this;
  3973 + var out_of_weight=null;
3962 switch (good['exp_sum_type']) { 3974 switch (good['exp_sum_type']) {
3963 case 1: 3975 case 1:
3964 //统一运费 3976 //统一运费
@@ -3970,8 +3982,9 @@ Page({ @@ -3970,8 +3982,9 @@ Page({
3970 //累积商品重量 每种商品的重量 * 数量 3982 //累积商品重量 每种商品的重量 * 数量
3971 goods_weight += good['weight'] * good['buynum']; 3983 goods_weight += good['weight'] * good['buynum'];
3972 if (goods_weight1 > 0) { 3984 if (goods_weight1 > 0) {
  3985 + out_of_weight = gift_weight_free - goods_weight;
  3986 + //不能调换位置 下面goods_weight会变大
3973 goods_weight += goods_weight1; 3987 goods_weight += goods_weight1;
3974 - out_of_weight = (gift_weight_free*1000) - goods_weight;  
3975 } 3988 }
3976 break; 3989 break;
3977 case 3: 3990 case 3:
@@ -4139,9 +4152,8 @@ Page({ @@ -4139,9 +4152,8 @@ Page({
4139 getApp().goto(url); 4152 getApp().goto(url);
4140 }, 4153 },
4141 4154
4142 - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表  
4143 - split_set_goods_quanprice:async function (you_item,t_item) {  
4144 - 4155 + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
  4156 + split_set_goods_quanprice:async function (you_item,t_item) {
4145 var coupon_price=you_item.WareCashSum; 4157 var coupon_price=you_item.WareCashSum;
4146 var goods=t_item.goods; 4158 var goods=t_item.goods;
4147 var arr=[]; 4159 var arr=[];
pages/cart/cart2/cart2.wxml
@@ -375,13 +375,13 @@ @@ -375,13 +375,13 @@
375 </view> 375 </view>
376 </view> 376 </view>
377 <!-- 留言 --> 377 <!-- 留言 -->
378 -<!-- <view class="coupon-mes flex-vertical">-->  
379 -<!-- <view>留言</view>-->  
380 -<!-- <view class="leave-word">-->  
381 -<!-- <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}"-->  
382 -<!-- class="word-box" maxlength="100" name="user_note"></input>-->  
383 -<!-- </view>-->  
384 -<!-- </view>--> 378 + <view class="coupon-mes flex-vertical">
  379 + <view>留言</view>
  380 + <view class="leave-word">
  381 + <input placeholder-class="fs28" placeholder='给商家留言,最多100字' data-index="{{index}}" bindinput="keyUpChangeNum"
  382 + class="word-box" maxlength="100" name="user_note"></input>
  383 + </view>
  384 + </view>
385 385
386 <!-- 是否参与店铺优惠 --> 386 <!-- 是否参与店铺优惠 -->
387 <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}"> 387 <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}">
pages/cart/cart2/ladder_calculate.js
@@ -69,6 +69,7 @@ module.exports = { @@ -69,6 +69,7 @@ module.exports = {
69 new_g.goods_num = 1; 69 new_g.goods_num = 1;
70 //如果有平摊到单品的时候,account要显示 70 //如果有平摊到单品的时候,account要显示
71 if(!th.data.ispt_goods) new_g.account = account.toFixed(2); 71 if(!th.data.ispt_goods) new_g.account = account.toFixed(2);
  72 + new_g.ld_account = account.toFixed(2);
72 new_g.discount = item_j.discount; 73 new_g.discount = item_j.discount;
73 new_g.goods_price =new_price; 74 new_g.goods_price =new_price;
74 new_g.ladder_list_id =item_j.id; 75 new_g.ladder_list_id =item_j.id;
pages/cart/cart2/zh_calculate.js
@@ -144,25 +144,63 @@ module.exports = { @@ -144,25 +144,63 @@ module.exports = {
144 } 144 }
145 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 145 //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
146 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { 146 if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
147 - //看一下是几倍  
148 - let num = 0;  
149 - let bz_num = 0;  
150 - let be = parseInt(no_in_arr.length / act.zhbuyqty); 147 + var bz_num_ok=0; //超量倍增是否满足
  148 + var zhqty_len=0; //几个超量倍增
  149 + let be = parseInt(no_in_arr.length / act.zhbuyqty);//看一下是几倍
151 if (act.is_bzyh && zhqty_bz.length > 0) { 150 if (act.is_bzyh && zhqty_bz.length > 0) {
152 - for (let i = 0; i < zhqty_bz.length; i++) {  
153 - let item = zhqty_bz[i];  
154 - bz_num = be * item.zhqty;  
155 - for (let j = 0; j < no_in_arr.length; j++) {  
156 - let i = no_in_arr[j];  
157 - if (item.goods_id === i.goods_id) {  
158 - num++  
159 - }  
160 - }  
161 - } 151 + if(zhqty_bz.length>1){
  152 + zhqty_len=1;
  153 + let min_bz_num= Math.min.apply(Math, zhqty_bz.map(function(o) {return o['num']}));
  154 + let new_arr=zhqty_bz.filter(ii=>{
  155 + return ii['num']==min_bz_num
  156 + })
  157 + // var vv=new_arr[0];
  158 + var bz_num=be*new_arr[0].zhqty; //超量倍增
  159 + var num=min_bz_num-new_arr[0].zhqty; //购买数量减去超量
  160 + bz_num_ok=bz_num-num;
  161 + if(bz_num_ok <= 0){
  162 + //超量倍增满足,超量倍增就等于倍数
  163 + bz_num_ok=bz_num;
  164 + }else{
  165 + //超量倍增不满足,倍数要减去多出得
  166 + be=be-bz_num_ok;
  167 + bz_num_ok=num;
  168 + }
  169 + for(let i=0;i<zhqty_bz.length;i++){
  170 + var vv=zhqty_bz[i];
  171 + for(let j=0;j<bz_num_ok;j++){
  172 + let index= no_in_arr.findIndex(i=>{
  173 + return vv.goods_id===i.goods_id
  174 + })
  175 + no_in_arr.splice(index,1)
  176 + }
  177 + }
  178 + aprice += be * aprice;
  179 + }else{
  180 + var vv=zhqty_bz[0];
  181 + var bz_num=be*vv.zhqty; //超量倍增
  182 + var num=vv['num']-vv.zhqty; //购买数量减去超量
  183 + bz_num_ok=bz_num-num;
  184 + if(bz_num_ok <= 0){
  185 + //超量倍增满足,超量倍增就等于倍数
  186 + bz_num_ok=bz_num;
  187 + }else{
  188 + //超量倍增不满足,倍数要减去多出得
  189 + be=be-bz_num_ok;
  190 + bz_num_ok=num;
  191 + }
  192 + for(let j=0;j<bz_num_ok;j++){
  193 + let index= no_in_arr.findIndex(i=>{
  194 + return vv.goods_id===i.goods_id
  195 + })
  196 + no_in_arr.splice(index,1)
  197 + }
  198 + }
162 } 199 }
163 - if (bz_num <= num) {  
164 - aprice += be * act.zhprice;  
165 - for (var m = 0; m < be * act.zhbuyqty; m++) { 200 + if (!zhqty_len) {
  201 + aprice += be * act.zhprice;
  202 + let pop_num=be * act.zhbuyqty - bz_num_ok;
  203 + for (var m = 0; m < pop_num; m++) {
166 no_in_arr.pop(); 204 no_in_arr.pop();
167 } 205 }
168 } 206 }
pages/togoin/togoin.js
@@ -68,33 +68,12 @@ Page({ @@ -68,33 +68,12 @@ Page({
68 return app.my_warnning("登录需要授权手机号码!", 0, this); 68 return app.my_warnning("登录需要授权手机号码!", 0, this);
69 return false; 69 return false;
70 } 70 }
71 - var th=this;  
72 var sessionKey = getApp().globalData.sessionKey; 71 var sessionKey = getApp().globalData.sessionKey;
73 var openid = getApp().globalData.openid; 72 var openid = getApp().globalData.openid;
74 - var r=getApp().globalData.getu;  
75 -  
76 - if(e){  
77 - wx.showModal({  
78 - title: '授权通知',  
79 - content:'是否接受注册成功通知',  
80 - success(res){  
81 - if(res.confirm){  
82 - th.sendsm(function (){  
83 - th.save_the_data(r,e,sessionKey,openid)  
84 - })  
85 - }else if(res.cancel){  
86 - th.save_the_data(r,e,sessionKey,openid)  
87 - }  
88 - }  
89 -  
90 - })  
91 - }  
92 -  
93 - 73 + var r=getApp().globalData.getu;
  74 + this.save_the_data(r,e,sessionKey,openid)
94 }, 75 },
95 - requestSubscribe(){  
96 76
97 - },  
98 77
99 //-- 会员授权 -- 78 //-- 会员授权 --
100 bindGetUserInfo: function(ee) { 79 bindGetUserInfo: function(ee) {
@@ -186,6 +165,7 @@ Page({ @@ -186,6 +165,7 @@ Page({
186 }) 165 })
187 }, 166 },
188 167
  168 +
189 save_the_data: async function (r,e,sessionKey,openid) { 169 save_the_data: async function (r,e,sessionKey,openid) {
190 var app=getApp(),a=app,th=this; 170 var app=getApp(),a=app,th=this;
191 var dd = { 171 var dd = {
pages/user/order_detail/order_detail.js
@@ -1604,7 +1604,6 @@ Page({ @@ -1604,7 +1604,6 @@ Page({
1604 1604
1605 //跳转到商品 1605 //跳转到商品
1606 go_gd:function (e) { 1606 go_gd:function (e) {
1607 -  
1608 var user_id=getApp().globalData.user_id; 1607 var user_id=getApp().globalData.user_id;
1609 if(!user_id) user_id=0; 1608 if(!user_id) user_id=0;
1610 1609
@@ -1621,13 +1620,13 @@ Page({ @@ -1621,13 +1620,13 @@ Page({
1621 var item=res.data.data[0]; 1620 var item=res.data.data[0];
1622 switch (item.prom_type){ 1621 switch (item.prom_type){
1623 case 9: 1622 case 9:
1624 - good_url= '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.prom_id; 1623 + good_url= '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.act_id;
1625 break; 1624 break;
1626 case 8: 1625 case 8:
1627 - good_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.prom_id 1626 + good_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id
1628 break; 1627 break;
1629 default: 1628 default:
1630 - good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.prom_id+"&prom_type=1"; 1629 + good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id+"&prom_type=1";
1631 break 1630 break
1632 } 1631 }
1633 } 1632 }