Commit c7930fd48783c9b397571d6fdfd69d21d42def3a
1 parent
b7df6b4b
1. 活动的分享优化 商品的分享优化
2. 购物车的功能优化
Showing
4 changed files
with
121 additions
and
69 deletions
packageA/pages/activity_share/activity_share.js
| @@ -161,7 +161,10 @@ Page({ | @@ -161,7 +161,10 @@ Page({ | ||
| 161 | //---秒杀,拼团,促销--- | 161 | //---秒杀,拼团,促销--- |
| 162 | var item=this.data.share_good; | 162 | var item=this.data.share_good; |
| 163 | if(item){ | 163 | if(item){ |
| 164 | - var price = item.shop_price; | 164 | + var price = item.price; |
| 165 | + if(!price) price=item.shop_price; | ||
| 166 | + | ||
| 167 | + | ||
| 165 | var title= item.goods_name; | 168 | var title= item.goods_name; |
| 166 | var img=this.data.url+item.original_img; | 169 | var img=this.data.url+item.original_img; |
| 167 | var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; | 170 | var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; |
packageA/pages/goods_share/goods_share.wxml
| @@ -10,8 +10,21 @@ | @@ -10,8 +10,21 @@ | ||
| 10 | <!-- 标题 --> | 10 | <!-- 标题 --> |
| 11 | <view class="title"> | 11 | <view class="title"> |
| 12 | <view class="title-item" bindtap="sale_sort">销量</view> | 12 | <view class="title-item" bindtap="sale_sort">销量</view> |
| 13 | - <view class="title-item" bindtap="sort1">价格<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view> | ||
| 14 | - <view class="title-item" bindtap="sort2">佣金<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view> | 13 | + |
| 14 | + <block wx:if="{{orderField=='shop_price'}}"> | ||
| 15 | + <view class="title-item" bindtap="sort1">价格<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view> | ||
| 16 | + </block> | ||
| 17 | + <block wx:else> | ||
| 18 | + <view class="title-item" bindtap="sort1">价格<text class="iconfont icon-shang"></text></view> | ||
| 19 | + </block> | ||
| 20 | + | ||
| 21 | + <block wx:if="{{orderField=='commission'}}"> | ||
| 22 | + <view class="title-item" bindtap="sort2">佣金<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view> | ||
| 23 | + </block> | ||
| 24 | + <block wx:else> | ||
| 25 | + <view class="title-item" bindtap="sort2">佣金<text class="iconfont icon-xia"></text></view> | ||
| 26 | + </block> | ||
| 27 | + | ||
| 15 | <view class="title-item" bindtap='new_sort'>最新</view> | 28 | <view class="title-item" bindtap='new_sort'>最新</view> |
| 16 | </view> | 29 | </view> |
| 17 | <!-- 列表项 --> | 30 | <!-- 列表项 --> |
pages/cart/cart2/cart2.js
| @@ -112,6 +112,8 @@ Page({ | @@ -112,6 +112,8 @@ Page({ | ||
| 112 | show_card:null, //显示的等级卡 | 112 | show_card:null, //显示的等级卡 |
| 113 | card_name:'', //显示的卡的名称 | 113 | card_name:'', //显示的卡的名称 |
| 114 | card_cut_price:null,//减价多少钱 | 114 | card_cut_price:null,//减价多少钱 |
| 115 | + | ||
| 116 | + show_submit:0, //提交按钮变正常显示 | ||
| 115 | 117 | ||
| 116 | }, | 118 | }, |
| 117 | onLoad: function(t) { | 119 | onLoad: function(t) { |
| @@ -140,8 +142,9 @@ Page({ | @@ -140,8 +142,9 @@ Page({ | ||
| 140 | //----------子页返回父页触发---------- | 142 | //----------子页返回父页触发---------- |
| 141 | onShow: function() { | 143 | onShow: function() { |
| 142 | var th=this; | 144 | var th=this; |
| 145 | + th.setData({show_submit:0}); | ||
| 146 | + | ||
| 143 | if (th.data.isclose==0){ | 147 | if (th.data.isclose==0){ |
| 144 | - | ||
| 145 | wx.navigateTo({ | 148 | wx.navigateTo({ |
| 146 | url: "/pages/index/index/index" | 149 | url: "/pages/index/index/index" |
| 147 | }) | 150 | }) |
| @@ -153,7 +156,7 @@ Page({ | @@ -153,7 +156,7 @@ Page({ | ||
| 153 | console.log(ie) | 156 | console.log(ie) |
| 154 | 157 | ||
| 155 | //地址切换要把包邮券清空 | 158 | //地址切换要把包邮券清空 |
| 156 | - if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ | 159 | + if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){ |
| 157 | var using_quan=th.data.using_quan; | 160 | var using_quan=th.data.using_quan; |
| 158 | for(var i in using_quan){ | 161 | for(var i in using_quan){ |
| 159 | var item=using_quan[i]; | 162 | var item=using_quan[i]; |
| @@ -164,19 +167,22 @@ Page({ | @@ -164,19 +167,22 @@ Page({ | ||
| 164 | } | 167 | } |
| 165 | th.data.isget_by_quan={}; | 168 | th.data.isget_by_quan={}; |
| 166 | } | 169 | } |
| 167 | - | 170 | + |
| 171 | + | ||
| 172 | + th.data.prom_goods_map={}; | ||
| 173 | + th.data.is_summit_ing=0; | ||
| 168 | //更换地址回来要重新调用计算价钱的接口 | 174 | //更换地址回来要重新调用计算价钱的接口 |
| 169 | if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ | 175 | if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ |
| 170 | th.setData({user_addr: ie }); | 176 | th.setData({user_addr: ie }); |
| 171 | if (th.data.is_b_now == 1) { | 177 | if (th.data.is_b_now == 1) { |
| 172 | if(th.data.bn_goods) { | 178 | if(th.data.bn_goods) { |
| 173 | th.setData({add_back:1}); | 179 | th.setData({add_back:1}); |
| 174 | - th.calculatePrice2(); | 180 | + //th.calculatePrice2(); |
| 175 | } | 181 | } |
| 176 | }else{ | 182 | }else{ |
| 177 | if (th.data.cartlist){ | 183 | if (th.data.cartlist){ |
| 178 | th.setData({add_back:1}); | 184 | th.setData({add_back:1}); |
| 179 | - th.calculatePrice(); | 185 | + //th.calculatePrice(); |
| 180 | } | 186 | } |
| 181 | } | 187 | } |
| 182 | }else{ | 188 | }else{ |
| @@ -277,26 +283,31 @@ Page({ | @@ -277,26 +283,31 @@ Page({ | ||
| 277 | 283 | ||
| 278 | //------获取会员收货地址----- | 284 | //------获取会员收货地址----- |
| 279 | getuser_addr:function(func){ | 285 | getuser_addr:function(func){ |
| 286 | + var th=this; | ||
| 280 | a.get("/api/weshop/useraddress/page", { | 287 | a.get("/api/weshop/useraddress/page", { |
| 281 | - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 }, | 288 | + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600,t:Math.random()}, |
| 282 | success: function (su) { | 289 | success: function (su) { |
| 283 | /*--- | 290 | /*--- |
| 284 | var user_addr=[ | 291 | var user_addr=[ |
| 285 | { 'address_id': 882, 'user_id': 2661, 'consignee': '测试测试测', 'province': 3102, 'city': 3431, 'district': 3466, | 292 | { 'address_id': 882, 'user_id': 2661, 'consignee': '测试测试测', 'province': 3102, 'city': 3431, 'district': 3466, |
| 286 | 'address': 'ed', 'more_address': '山西-长治市-襄垣县-虎(音si)亭镇', 'mobile': 13012345678,'is_default':1}, | 293 | 'address': 'ed', 'more_address': '山西-长治市-襄垣县-虎(音si)亭镇', 'mobile': 13012345678,'is_default':1}, |
| 287 | - ];---*/ | ||
| 288 | - var user_addr = su.data.data.pageData; | ||
| 289 | - var item = null; | ||
| 290 | - var def_item=null; | ||
| 291 | - for (var i = 0; i < user_addr.length; i++) { | ||
| 292 | - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];} | ||
| 293 | - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - if (item == null) item = def_item; | ||
| 297 | - if (item == null) item = user_addr[0]; | 294 | + ];---*/ |
| 295 | + var item = null; | ||
| 296 | + if(su.data.code==0 && su.data.data && su.data.data.pageData){ | ||
| 297 | + var user_addr = su.data.data.pageData; | ||
| 298 | + var def_item=null; | ||
| 299 | + for (var i = 0; i < user_addr.length; i++) { | ||
| 300 | + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];} | ||
| 301 | + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + if (item == null) item = def_item; | ||
| 305 | + if (item == null) item = user_addr[0]; | ||
| 306 | + } | ||
| 298 | 307 | ||
| 299 | if(item==undefined) item=null; | 308 | if(item==undefined) item=null; |
| 309 | + if(!item) th.setData({user_addr:null}); //地址为空的时候,要清空,因为返回的时候,有缓存 | ||
| 310 | + | ||
| 300 | func(item); | 311 | func(item); |
| 301 | } | 312 | } |
| 302 | }); | 313 | }); |
| @@ -341,7 +352,8 @@ Page({ | @@ -341,7 +352,8 @@ Page({ | ||
| 341 | } | 352 | } |
| 342 | }); | 353 | }); |
| 343 | }, | 354 | }, |
| 344 | - | 355 | + |
| 356 | + | ||
| 345 | //-----真的获取购物车,入口-------- | 357 | //-----真的获取购物车,入口-------- |
| 346 | get_cart: function () { | 358 | get_cart: function () { |
| 347 | var th = this,app=getApp(); | 359 | var th = this,app=getApp(); |
| @@ -360,11 +372,7 @@ Page({ | @@ -360,11 +372,7 @@ Page({ | ||
| 360 | 372 | ||
| 361 | for (var i = 0; i < carr.length; i++) { | 373 | for (var i = 0; i < carr.length; i++) { |
| 362 | var item = carr[i]; | 374 | var item = carr[i]; |
| 363 | - //要把优惠活动加入,prom_goods_map中,赠品不要运算 | ||
| 364 | - if(item.prom_type==3 && item.is_gift!=1){ | ||
| 365 | - await th.add_prom_goods_map(item); | ||
| 366 | - } | ||
| 367 | - | 375 | + |
| 368 | //-- 如果是等级会员注册返回 -- | 376 | //-- 如果是等级会员注册返回 -- |
| 369 | if(is_card_back){ | 377 | if(is_card_back){ |
| 370 | th.data.card_name=th.data.userinfo.card_field; | 378 | th.data.card_name=th.data.userinfo.card_field; |
| @@ -383,12 +391,17 @@ Page({ | @@ -383,12 +391,17 @@ Page({ | ||
| 383 | // 拼团,搭配购不计算,赠品也不计算,同时会员还未购买等级会员 | 391 | // 拼团,搭配购不计算,赠品也不计算,同时会员还未购买等级会员 |
| 384 | if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field | 392 | if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field |
| 385 | && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ | 393 | && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ |
| 386 | - item.cut_price= item.goods_price-item[th.data.card_name]; | ||
| 387 | - carr[i].cut_price=(item.goods_price-item[th.data.card_name])*item.goods_num; | 394 | + item.cut_price1= item.goods_price-item[th.data.card_name]; |
| 395 | + carr[i].cut_price1=(item.goods_price-item[th.data.card_name])*item.goods_num; | ||
| 388 | } | 396 | } |
| 389 | 397 | ||
| 390 | } | 398 | } |
| 391 | 399 | ||
| 400 | + //要把优惠活动加入,prom_goods_map中,赠品不要运算 | ||
| 401 | + if(item.prom_type==3 && item.is_gift!=1){ | ||
| 402 | + await th.add_prom_goods_map(item); | ||
| 403 | + } | ||
| 404 | + | ||
| 392 | 405 | ||
| 393 | item.original_img = oo.imghost + item.original_img; | 406 | item.original_img = oo.imghost + item.original_img; |
| 394 | /*----接口要弄出来的,先顶着-----*/ | 407 | /*----接口要弄出来的,先顶着-----*/ |
| @@ -399,7 +412,22 @@ Page({ | @@ -399,7 +412,22 @@ Page({ | ||
| 399 | if (arr.length > 0) { | 412 | if (arr.length > 0) { |
| 400 | for (var j = 0; j < arr.length; j++) { | 413 | for (var j = 0; j < arr.length; j++) { |
| 401 | if (arr[j].pickup_id == pcid) { | 414 | if (arr[j].pickup_id == pcid) { |
| 402 | - arr[j].goods.push(item); | 415 | + arr[j].goods.push(item); |
| 416 | + if(item.is_gift!=1){ | ||
| 417 | + //确定配送方式 | ||
| 418 | + if(arr[j].distr_t==0){ | ||
| 419 | + arr[j].distr_t=item.distr_type; | ||
| 420 | + } | ||
| 421 | + var e_t=0 | ||
| 422 | + switch (arr[j].distr_t) { | ||
| 423 | + case 0: e_t = 1; break; | ||
| 424 | + case 1: e_t = 1; break; | ||
| 425 | + case 2: e_t = 0; break; | ||
| 426 | + } | ||
| 427 | + arr[j].exp_type=e_t; | ||
| 428 | + if (e_t == 0) th.setData({ is_all_zt:0}); | ||
| 429 | + } | ||
| 430 | + | ||
| 403 | //-- 把等级卡会优惠多少钱装进去 -- | 431 | //-- 把等级卡会优惠多少钱装进去 -- |
| 404 | if(item.cut_price) arr[j].card_cut_price+=item.cut_price; | 432 | if(item.cut_price) arr[j].card_cut_price+=item.cut_price; |
| 405 | find = 1;break; | 433 | find = 1;break; |
| @@ -426,7 +454,6 @@ Page({ | @@ -426,7 +454,6 @@ Page({ | ||
| 426 | case 1: e_t = 1; break; | 454 | case 1: e_t = 1; break; |
| 427 | case 2: e_t = 0; break; | 455 | case 2: e_t = 0; break; |
| 428 | } | 456 | } |
| 429 | - | ||
| 430 | //如果是物流的话,全部自提的控制要弄成0 | 457 | //如果是物流的话,全部自提的控制要弄成0 |
| 431 | if (e_t == 0) th.setData({ is_all_zt:0}); | 458 | if (e_t == 0) th.setData({ is_all_zt:0}); |
| 432 | 459 | ||
| @@ -441,14 +468,21 @@ Page({ | @@ -441,14 +468,21 @@ Page({ | ||
| 441 | } | 468 | } |
| 442 | 469 | ||
| 443 | var ie = { | 470 | var ie = { |
| 444 | - pickup_id: pcid, pname: pikname, goods: narr, wind: m_wind, distr_t: dis_t,card_cut_price:0, | 471 | + pickup_id: pcid, pname: pikname, goods: narr, wind: m_wind, distr_t: dis_t,card_cut_price:0,exp_type:e_t, |
| 445 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; | 472 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; |
| 446 | - | ||
| 447 | - if(!th.data.add_back){ | ||
| 448 | - ie.exp_type= e_t | ||
| 449 | - } | 473 | + |
| 474 | + //-- 如果是回退回来的情况 -- | ||
| 475 | + if(th.data.cartlist && th.data.cartlist.length>0) { | ||
| 476 | + for(var kj in th.data.cartlist){ | ||
| 477 | + if(ie.pickup_id==th.data.cartlist[kj].pickup_id){ | ||
| 478 | + ie.exp_type=th.data.cartlist[kj].exp_type; | ||
| 479 | + break; | ||
| 480 | + } | ||
| 481 | + } | ||
| 482 | + } | ||
| 483 | + | ||
| 450 | //-- 把等级卡会优惠多少钱装进去 -- | 484 | //-- 把等级卡会优惠多少钱装进去 -- |
| 451 | - if(item.cut_price) ie.card_cut_price+=item.cut_price; | 485 | + if(item.cut_price1) ie.card_cut_price+=item.cut_price1; |
| 452 | arr.push(ie); | 486 | arr.push(ie); |
| 453 | 487 | ||
| 454 | } | 488 | } |
| @@ -496,7 +530,9 @@ Page({ | @@ -496,7 +530,9 @@ Page({ | ||
| 496 | case 1: et = 1; break; | 530 | case 1: et = 1; break; |
| 497 | case 2: et = 0; break; | 531 | case 2: et = 0; break; |
| 498 | } | 532 | } |
| 499 | - | 533 | + |
| 534 | + if(th.data.bn_goods) et=th.data.bn_exp_type | ||
| 535 | + | ||
| 500 | var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; | 536 | var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; |
| 501 | if(et==0 && def_exp_code){ | 537 | if(et==0 && def_exp_code){ |
| 502 | for(var k=0;k<th.data.wu_arr.length;k++){ | 538 | for(var k=0;k<th.data.wu_arr.length;k++){ |
| @@ -579,12 +615,9 @@ Page({ | @@ -579,12 +615,9 @@ Page({ | ||
| 579 | 615 | ||
| 580 | th.setData({ | 616 | th.setData({ |
| 581 | bn_goods: data, bn_pickname: gg.pick_name,index:m_wind, | 617 | bn_goods: data, bn_pickname: gg.pick_name,index:m_wind, |
| 582 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t | 618 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type: et |
| 583 | }); | 619 | }); |
| 584 | - | ||
| 585 | - if(!th.data.add_back){ | ||
| 586 | - th.setData({ bn_exp_type: et }) | ||
| 587 | - } | 620 | + |
| 588 | //计算价格 | 621 | //计算价格 |
| 589 | th.calculatePrice2(); | 622 | th.calculatePrice2(); |
| 590 | //获取优惠券 | 623 | //获取优惠券 |
| @@ -615,13 +648,10 @@ Page({ | @@ -615,13 +648,10 @@ Page({ | ||
| 615 | } | 648 | } |
| 616 | th.setData({ | 649 | th.setData({ |
| 617 | bn_goods: t.data.data, bn_pickname: gg.pick_name,index:m_wind, | 650 | bn_goods: t.data.data, bn_pickname: gg.pick_name,index:m_wind, |
| 618 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t | 651 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type: et |
| 619 | }); | 652 | }); |
| 620 | 653 | ||
| 621 | - if(!th.data.add_back){ | ||
| 622 | - th.setData({ bn_exp_type: et }) | ||
| 623 | - } | ||
| 624 | - | 654 | + |
| 625 | //--搭配促销也是按照购物车的方式来计算优惠券-- | 655 | //--搭配促销也是按照购物车的方式来计算优惠券-- |
| 626 | if(gg.prom_type==5){ | 656 | if(gg.prom_type==5){ |
| 627 | var frozenQuan=null; | 657 | var frozenQuan=null; |
| @@ -658,13 +688,9 @@ Page({ | @@ -658,13 +688,9 @@ Page({ | ||
| 658 | 688 | ||
| 659 | th.setData({ | 689 | th.setData({ |
| 660 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, | 690 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, |
| 661 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t | 691 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type: et |
| 662 | }); | 692 | }); |
| 663 | - | ||
| 664 | - if(!th.data.add_back){ | ||
| 665 | - th.setData({ bn_exp_type: et }) | ||
| 666 | - } | ||
| 667 | - | 693 | + |
| 668 | //计算价格 | 694 | //计算价格 |
| 669 | th.calculatePrice2(); | 695 | th.calculatePrice2(); |
| 670 | //获取优惠券 | 696 | //获取优惠券 |
| @@ -822,7 +848,8 @@ Page({ | @@ -822,7 +848,8 @@ Page({ | ||
| 822 | 848 | ||
| 823 | //有活动,且优惠活动并没有限制使用优惠券,且有减价 | 849 | //有活动,且优惠活动并没有限制使用优惠券,且有减价 |
| 824 | //--看有没有减价-- | 850 | //--看有没有减价-- |
| 825 | - if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ | 851 | + //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ |
| 852 | + if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ | ||
| 826 | if(cart_item.prom_pt_json){ | 853 | if(cart_item.prom_pt_json){ |
| 827 | cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) | 854 | cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) |
| 828 | }else{ | 855 | }else{ |
| @@ -892,6 +919,7 @@ Page({ | @@ -892,6 +919,7 @@ Page({ | ||
| 892 | cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}) | 919 | cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}) |
| 893 | } | 920 | } |
| 894 | } | 921 | } |
| 922 | + | ||
| 895 | //-- 如果有送优包邮券的情况 -- | 923 | //-- 如果有送优包邮券的情况 -- |
| 896 | if(item_map.s_libao){ | 924 | if(item_map.s_libao){ |
| 897 | if(!cart_item.s_libao) { | 925 | if(!cart_item.s_libao) { |
| @@ -1004,15 +1032,18 @@ Page({ | @@ -1004,15 +1032,18 @@ Page({ | ||
| 1004 | if(no_ex_good){ | 1032 | if(no_ex_good){ |
| 1005 | is_good_no_by=th.check_by_goods(no_ex_good,item[j].goods_id); | 1033 | is_good_no_by=th.check_by_goods(no_ex_good,item[j].goods_id); |
| 1006 | } | 1034 | } |
| 1035 | + | ||
| 1007 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 | 1036 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 |
| 1008 | if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ | 1037 | if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ |
| 1009 | continue; | 1038 | continue; |
| 1010 | } | 1039 | } |
| 1040 | + | ||
| 1011 | //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- | 1041 | //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- |
| 1012 | if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){ | 1042 | if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){ |
| 1013 | continue; | 1043 | continue; |
| 1014 | } | 1044 | } |
| 1015 | 1045 | ||
| 1046 | + | ||
| 1016 | //----------------如果是选择了物流--------------------- | 1047 | //----------------如果是选择了物流--------------------- |
| 1017 | if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){ | 1048 | if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){ |
| 1018 | //如果地址不为空 | 1049 | //如果地址不为空 |
| @@ -1197,7 +1228,7 @@ Page({ | @@ -1197,7 +1228,7 @@ Page({ | ||
| 1197 | th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, | 1228 | th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, |
| 1198 | [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, | 1229 | [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, |
| 1199 | [atxt5]: all_coupon_price_m,[atxt6]: all_cutprice, | 1230 | [atxt5]: all_coupon_price_m,[atxt6]: all_cutprice, |
| 1200 | - [atxt7]: all_order_prom, | 1231 | + [atxt7]: all_order_prom, show_submit:1 |
| 1201 | }) | 1232 | }) |
| 1202 | th.data.order_prom_list_cart=c_arr; | 1233 | th.data.order_prom_list_cart=c_arr; |
| 1203 | th.set_can_num(); | 1234 | th.set_can_num(); |
| @@ -1247,7 +1278,7 @@ Page({ | @@ -1247,7 +1278,7 @@ Page({ | ||
| 1247 | //-----------计算商品总价-------------- | 1278 | //-----------计算商品总价-------------- |
| 1248 | var allpice = good.shop_price * good.buynum; | 1279 | var allpice = good.shop_price * good.buynum; |
| 1249 | var cut_price=0; | 1280 | var cut_price=0; |
| 1250 | - if(good.prom_type==3 && good.prom_price){ | 1281 | + if(good.prom_type==3 && good.prom_price!==null){ |
| 1251 | cut_price=allpice-good.prom_price; | 1282 | cut_price=allpice-good.prom_price; |
| 1252 | } | 1283 | } |
| 1253 | allpice=parseFloat(allpice).toFixed(2); | 1284 | allpice=parseFloat(allpice).toFixed(2); |
| @@ -1429,14 +1460,14 @@ Page({ | @@ -1429,14 +1460,14 @@ Page({ | ||
| 1429 | if (th.data.bn_use_money == 1) { | 1460 | if (th.data.bn_use_money == 1) { |
| 1430 | if (amoney> order_m) { | 1461 | if (amoney> order_m) { |
| 1431 | order_m = order_m.toFixed(2); | 1462 | order_m = order_m.toFixed(2); |
| 1432 | - th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price }) | 1463 | + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price,show_submit:1 }) |
| 1433 | }else{ | 1464 | }else{ |
| 1434 | order_m =parseFloat(order_m - amoney); | 1465 | order_m =parseFloat(order_m - amoney); |
| 1435 | order_m = order_m.toFixed(2); | 1466 | order_m = order_m.toFixed(2); |
| 1436 | - th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price }) | 1467 | + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price,show_submit:1 }) |
| 1437 | } | 1468 | } |
| 1438 | }else{ | 1469 | }else{ |
| 1439 | - th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price }) | 1470 | + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price,show_submit:1}) |
| 1440 | } | 1471 | } |
| 1441 | //优惠活动送积分 | 1472 | //优惠活动送积分 |
| 1442 | if(good.s_intValue){ | 1473 | if(good.s_intValue){ |
| @@ -1476,14 +1507,14 @@ Page({ | @@ -1476,14 +1507,14 @@ Page({ | ||
| 1476 | if (th.data.bn_use_money == 1) { | 1507 | if (th.data.bn_use_money == 1) { |
| 1477 | if (amoney> order_m) { | 1508 | if (amoney> order_m) { |
| 1478 | order_m = order_m.toFixed(2); | 1509 | order_m = order_m.toFixed(2); |
| 1479 | - th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price }) | 1510 | + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price,show_submit:1 }) |
| 1480 | }else{ | 1511 | }else{ |
| 1481 | order_m =parseFloat(order_m - amoney); | 1512 | order_m =parseFloat(order_m - amoney); |
| 1482 | order_m = order_m.toFixed(2); | 1513 | order_m = order_m.toFixed(2); |
| 1483 | - th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price }) | 1514 | + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price,show_submit:1 }) |
| 1484 | } | 1515 | } |
| 1485 | }else{ | 1516 | }else{ |
| 1486 | - th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price }) | 1517 | + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price, show_submit:1 }) |
| 1487 | } | 1518 | } |
| 1488 | //优惠活动送积分 | 1519 | //优惠活动送积分 |
| 1489 | if(good.s_intValue){ | 1520 | if(good.s_intValue){ |
| @@ -1527,7 +1558,7 @@ Page({ | @@ -1527,7 +1558,7 @@ Page({ | ||
| 1527 | 1558 | ||
| 1528 | if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){ | 1559 | if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){ |
| 1529 | ff = false; getApp().my_warnning("请选择收货地址",0,th); | 1560 | ff = false; getApp().my_warnning("请选择收货地址",0,th); |
| 1530 | - this.data.is_summit_ing = 0; | 1561 | + th.data.is_summit_ing = 0; |
| 1531 | } | 1562 | } |
| 1532 | if (!ff) return false; | 1563 | if (!ff) return false; |
| 1533 | var addr = th.data.user_addr; | 1564 | var addr = th.data.user_addr; |
| @@ -1536,6 +1567,7 @@ Page({ | @@ -1536,6 +1567,7 @@ Page({ | ||
| 1536 | if(th.data.bn_exp_type==0) | 1567 | if(th.data.bn_exp_type==0) |
| 1537 | if(th.data.wu_arr==null || th.data.wu_arr.length<=0){ | 1568 | if(th.data.wu_arr==null || th.data.wu_arr.length<=0){ |
| 1538 | getApp().my_warnning("读取物流失败",0,th); | 1569 | getApp().my_warnning("读取物流失败",0,th); |
| 1570 | + th.data.is_summit_ing = 0; | ||
| 1539 | return false; | 1571 | return false; |
| 1540 | } | 1572 | } |
| 1541 | 1573 | ||
| @@ -1716,7 +1748,9 @@ Page({ | @@ -1716,7 +1748,9 @@ Page({ | ||
| 1716 | console.log(pdata); | 1748 | console.log(pdata); |
| 1717 | }else{ | 1749 | }else{ |
| 1718 | //---------购物车的结算--------- | 1750 | //---------购物车的结算--------- |
| 1719 | - if (th.data.is_all_zt == 0 && th.data.user_addr == null) { ff = false; getApp().confirmBox("请新建收货地址");} | 1751 | + if (th.data.is_all_zt == 0 && th.data.user_addr == null) { |
| 1752 | + th.data.is_summit_ing = 0; | ||
| 1753 | + ff = false; getApp().confirmBox("请新建收货地址");} | ||
| 1720 | if (!ff) return false; | 1754 | if (!ff) return false; |
| 1721 | 1755 | ||
| 1722 | var addr = th.data.user_addr; | 1756 | var addr = th.data.user_addr; |
| @@ -1726,6 +1760,7 @@ Page({ | @@ -1726,6 +1760,7 @@ Page({ | ||
| 1726 | 1760 | ||
| 1727 | if(th.data.is_all_zt !=1) | 1761 | if(th.data.is_all_zt !=1) |
| 1728 | if(th.data.wu_arr==null || th.data.wu_arr.length<=0 ){ | 1762 | if(th.data.wu_arr==null || th.data.wu_arr.length<=0 ){ |
| 1763 | + th.data.is_summit_ing = 0; | ||
| 1729 | getApp().confirmBox("读取物流失败"); | 1764 | getApp().confirmBox("读取物流失败"); |
| 1730 | return false; | 1765 | return false; |
| 1731 | } | 1766 | } |
| @@ -1939,7 +1974,7 @@ Page({ | @@ -1939,7 +1974,7 @@ Page({ | ||
| 1939 | util_pay.pay(data.data, function() { | 1974 | util_pay.pay(data.data, function() { |
| 1940 | //app.my_warnning("支付成功",1,th); | 1975 | //app.my_warnning("支付成功",1,th); |
| 1941 | //setTimeout(function () { | 1976 | //setTimeout(function () { |
| 1942 | - wx.navigateTo({ | 1977 | + wx.redirectTo({ |
| 1943 | url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data | 1978 | url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data |
| 1944 | }) | 1979 | }) |
| 1945 | //},1000) | 1980 | //},1000) |
| @@ -1965,7 +2000,7 @@ Page({ | @@ -1965,7 +2000,7 @@ Page({ | ||
| 1965 | //app.my_warnning("支付成功",1,th); | 2000 | //app.my_warnning("支付成功",1,th); |
| 1966 | //setTimeout(function () { | 2001 | //setTimeout(function () { |
| 1967 | th.setData({ isclose: 0 }); | 2002 | th.setData({ isclose: 0 }); |
| 1968 | - wx.navigateTo({ | 2003 | + wx.redirectTo({ |
| 1969 | url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data, | 2004 | url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data, |
| 1970 | }) | 2005 | }) |
| 1971 | //}, 1000) | 2006 | //}, 1000) |
| @@ -2084,6 +2119,7 @@ Page({ | @@ -2084,6 +2119,7 @@ Page({ | ||
| 2084 | 2119 | ||
| 2085 | //--------购物车购买时,选择自提和物流----------- | 2120 | //--------购物车购买时,选择自提和物流----------- |
| 2086 | setexptype_w:function(t){ | 2121 | setexptype_w:function(t){ |
| 2122 | + | ||
| 2087 | var def_exp_code= getApp().globalData.userInfo.def_exp_code,th=this; | 2123 | var def_exp_code= getApp().globalData.userInfo.def_exp_code,th=this; |
| 2088 | var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, | 2124 | var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, |
| 2089 | wl_txt = t.currentTarget.dataset.wl_txt, | 2125 | wl_txt = t.currentTarget.dataset.wl_txt, |
pages/cart/cart2/cart2.wxml
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | 4 | ||
| 5 | <form bindsubmit="submitForm"> | 5 | <form bindsubmit="submitForm"> |
| 6 | <view class="container"> | 6 | <view class="container"> |
| 7 | - <!--要进行判断地址是否显示----> | 7 | + <!--要进行判断地址是否显示----> |
| 8 | <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> | 8 | <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> |
| 9 | <!---默认地址显示------> | 9 | <!---默认地址显示------> |
| 10 | <block wx:if="{{user_addr!=null}}"> | 10 | <block wx:if="{{user_addr!=null}}"> |
| @@ -371,12 +371,12 @@ | @@ -371,12 +371,12 @@ | ||
| 371 | </view> | 371 | </view> |
| 372 | </view> | 372 | </view> |
| 373 | 373 | ||
| 374 | - <view class="btn-wrap shadow-1"> | 374 | + <view class="btn-wrap shadow-1" wx:if="{{show_submit}}"> |
| 375 | <view class="pay-amount"> | 375 | <view class="pay-amount"> |
| 376 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | 376 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
| 377 | <!-- <view class="co-red big"></view> --> | 377 | <!-- <view class="co-red big"></view> --> |
| 378 | </view> | 378 | </view> |
| 379 | - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | 379 | + <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> |
| 380 | </view> | 380 | </view> |
| 381 | </form> | 381 | </form> |
| 382 | 382 |