Commit ce4d08307bfe33b1ea409e7cc9f983c2a9633a3d

Authored by WXD-SEASON\season
2 parents bbc86ce8 4416f19c

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

packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -495,7 +495,7 @@ Page({ @@ -495,7 +495,7 @@ Page({
495 }); 495 });
496 }, 496 },
497 //---------计算立即购买---------- 497 //---------计算立即购买----------
498 - calculatePrice2: function () { 498 + calculatePrice2: async function () {
499 console.log('calculatePrice2'); 499 console.log('calculatePrice2');
500 var th = this, 500 var th = this,
501 good = this.data.bn_goods; 501 good = this.data.bn_goods;
@@ -506,12 +506,14 @@ Page({ @@ -506,12 +506,14 @@ Page({
506 th.setData({ 506 th.setData({
507 [txt]: allpice, 507 [txt]: allpice,
508 }); 508 });
509 - console.log(th.data.formData);  
510 -  
511 509
512 - to.getwuliuprice(async function (rs) { 510 + wx.showLoading({
  511 + title: "处理中.",
  512 + mask:true
  513 + })
  514 + //to.getwuliuprice(async function (rs) {
513 515
514 - var o_shipping_price = 0, 516 + var o_shipping_price = 0,
515 goods_weight = -1, 517 goods_weight = -1,
516 goods_piece = -1; 518 goods_piece = -1;
517 var out_of_weight = null; //超出多少重量 519 var out_of_weight = null; //超出多少重量
@@ -539,8 +541,7 @@ Page({ @@ -539,8 +541,7 @@ Page({
539 let item = gd_arr_list[i]; 541 let item = gd_arr_list[i];
540 542
541 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 543 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
542 -  
543 - 544 + if (goods_weight < 0) goods_weight = 0;
544 if (item['exp_sum_type'] == 2) { 545 if (item['exp_sum_type'] == 2) {
545 goods_weight += item['weight'] * item['buynum']; 546 goods_weight += item['weight'] * item['buynum'];
546 cut_good_weight += item['weight'] * item['buynum']; 547 cut_good_weight += item['weight'] * item['buynum'];
@@ -581,9 +582,36 @@ Page({ @@ -581,9 +582,36 @@ Page({
581 else out_of_weight = -back_data.weight_free * 1000; 582 else out_of_weight = -back_data.weight_free * 1000;
582 583
583 var code = th.data.wu_arr[th.data.index].code; 584 var code = th.data.wu_arr[th.data.index].code;
584 - var shipping_price =  
585 - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
586 - goods_piece, th.data.user_addr, back_data,rs); 585 + var shipping_price =0;
  586 + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  587 + // goods_piece, th.data.user_addr, back_data,rs);
  588 +
  589 + var w_data={
  590 + store_id:os.stoid, code:code,
  591 + o_shipping_price:o_shipping_price,
  592 + goods_weight:goods_weight,
  593 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  594 + user_addr_province:th.data.user_addr.province,
  595 + user_addr_city:th.data.user_addr.city,
  596 + user_addr_district:th.data.user_addr.district,
  597 + is_by_all:back_data && back_data.is_by_all?1:0,
  598 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  599 + }
  600 +
  601 + var is_ok=0;
  602 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  603 + if(res.data.code==0){
  604 + shipping_price=res.data.data; is_ok=1;
  605 + }
  606 + })
  607 + if(!is_ok){
  608 + wx.showToast({
  609 + title: "计算物流错误", icon: 'none',duration: 2000
  610 + })
  611 + th.setData({ show_submit:0 });
  612 + wx.hideLoading();
  613 + }
  614 +
587 615
588 shipping_price = parseFloat(shipping_price).toFixed(2); 616 shipping_price = parseFloat(shipping_price).toFixed(2);
589 var wl_txt = "formData.shipping_price"; 617 var wl_txt = "formData.shipping_price";
@@ -616,24 +644,27 @@ Page({ @@ -616,24 +644,27 @@ Page({
616 if (parseFloat(th.data.yuer) > total_m) { 644 if (parseFloat(th.data.yuer) > total_m) {
617 th.setData({ 645 th.setData({
618 [txt]: total_m, 646 [txt]: total_m,
619 - [txt2]: 0 647 + [txt2]: 0,
  648 + is_show_sub:1
620 }) 649 })
621 } else { 650 } else {
622 order_m = parseFloat(order_m) - parseFloat(th.data.yuer); 651 order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
623 order_m = order_m.toFixed(2); 652 order_m = order_m.toFixed(2);
624 th.setData({ 653 th.setData({
625 [txt]: th.data.yuer, 654 [txt]: th.data.yuer,
626 - [txt2]: order_m 655 + [txt2]: order_m,
  656 + is_show_sub:1
627 }) 657 })
628 } 658 }
629 } else { 659 } else {
630 th.setData({ 660 th.setData({
631 [txt]: 0, 661 [txt]: 0,
632 - [txt2]: order_m 662 + [txt2]: order_m,
  663 + is_show_sub:1
633 }) 664 })
634 } 665 }
635 -  
636 - }); 666 + wx.hideLoading();
  667 + //});
637 668
638 }, 669 },
639 670
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
@@ -154,7 +154,7 @@ @@ -154,7 +154,7 @@
154 </view> 154 </view>
155 </view> 155 </view>
156 156
157 - <view class="btn-wrap"> 157 + <view class="btn-wrap" wx:if="{{is_show_sub}}">
158 <view class="pay-amount"> 158 <view class="pay-amount">
159 <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> 159 <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view>
160 <!-- <view class="co-red big"></view> --> 160 <!-- <view class="co-red big"></view> -->
packageC/pages/presell/cart/cart.js
@@ -1716,9 +1716,9 @@ Page({ @@ -1716,9 +1716,9 @@ Page({
1716 1716
1717 1717
1718 //----计算物流的钱---- 1718 //----计算物流的钱----
1719 - calculate_wuliu() { 1719 + async calculate_wuliu() {
1720 var to = getApp(), th = this; 1720 var to = getApp(), th = this;
1721 - to.getwuliuprice(async function (rs) { 1721 + //to.getwuliuprice(async function (rs) {
1722 var o_shipping_price = 0, 1722 var o_shipping_price = 0,
1723 goods_weight = -1, 1723 goods_weight = -1,
1724 goods_piece = -1, 1724 goods_piece = -1,
@@ -1823,6 +1823,7 @@ Page({ @@ -1823,6 +1823,7 @@ Page({
1823 let item = gd_arr_list[i]; 1823 let item = gd_arr_list[i];
1824 1824
1825 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 1825 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
  1826 + if (goods_weight < 0) goods_weight = 0;
1826 if (item['exp_sum_type'] == 2) { 1827 if (item['exp_sum_type'] == 2) {
1827 goods_weight += item['weight'] * item['buynum']; 1828 goods_weight += item['weight'] * item['buynum'];
1828 cut_good_weight += item['weight'] * item['buynum']; 1829 cut_good_weight += item['weight'] * item['buynum'];
@@ -1867,8 +1868,36 @@ Page({ @@ -1867,8 +1868,36 @@ Page({
1867 th.data.is_no_by[th.data.bn_pick] = 0; 1868 th.data.is_no_by[th.data.bn_pick] = 0;
1868 1869
1869 //--------------开始计算物流------------------ 1870 //--------------开始计算物流------------------
1870 - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
1871 - goods_piece, th.data.user_addr, back_data, rs); 1871 + var shipping_price =0;
  1872 +
  1873 + //ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  1874 + //goods_piece, th.data.user_addr, back_data, rs);
  1875 + var w_data={
  1876 + store_id:os.stoid, code:code,
  1877 + o_shipping_price:o_shipping_price,
  1878 + goods_weight:goods_weight,
  1879 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  1880 + user_addr_province:th.data.user_addr.province,
  1881 + user_addr_city:th.data.user_addr.city,
  1882 + user_addr_district:th.data.user_addr.district,
  1883 + is_by_all:back_data && back_data.is_by_all?1:0,
  1884 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  1885 + }
  1886 +
  1887 + var is_ok=0;
  1888 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  1889 + if(res.data.code==0){
  1890 + shipping_price=res.data.data; is_ok=1;
  1891 + }
  1892 + })
  1893 + if(!is_ok){
  1894 + wx.showToast({
  1895 + title: "计算物流错误", icon: 'none',duration: 2000
  1896 + })
  1897 + th.setData({ show_submit:0 });
  1898 + wx.hideLoading();
  1899 + return false;
  1900 + }
1872 1901
1873 exp_price = parseFloat(shipping_price).toFixed(2); 1902 exp_price = parseFloat(shipping_price).toFixed(2);
1874 } 1903 }
@@ -1876,7 +1905,7 @@ Page({ @@ -1876,7 +1905,7 @@ Page({
1876 } else { 1905 } else {
1877 th.wuliu_next(allpice, quan_price, exp_price); 1906 th.wuliu_next(allpice, quan_price, exp_price);
1878 } 1907 }
1879 - }); 1908 + //});
1880 }, 1909 },
1881 //相同的东西统一在一起 1910 //相同的东西统一在一起
1882 wuliu_next(allpice, quan_price, exp_price) { 1911 wuliu_next(allpice, quan_price, exp_price) {
packageC/pages/presell/cart/cart.wxml
@@ -346,6 +346,9 @@ @@ -346,6 +346,9 @@
346 </view> 346 </view>
347 </view> 347 </view>
348 348
  349 +
  350 +
  351 +
349 <!-- 要支付尾款的时候 --> 352 <!-- 要支付尾款的时候 -->
350 <view class="fixedToBottom shadow-1" wx:if="{{wait_wk}}"> 353 <view class="fixedToBottom shadow-1" wx:if="{{wait_wk}}">
351 <view wx:if="{{no_start}}" class="date-container">尾款时间{{filters.format_time(act.pay_begindate,1)}} - 354 <view wx:if="{{no_start}}" class="date-container">尾款时间{{filters.format_time(act.pay_begindate,1)}} -
@@ -363,7 +366,7 @@ @@ -363,7 +366,7 @@
363 </view> 366 </view>
364 </view> 367 </view>
365 <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button> 368 <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button>
366 - <button wx:else class="tips-btn" bindtap="show_pay">支付尾款</button> 369 + <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit}}">支付尾款</button>
367 <!-- 预售 --> 370 <!-- 预售 -->
368 <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> 371 <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> -->
369 </view> 372 </view>
@@ -371,14 +374,13 @@ @@ -371,14 +374,13 @@
371 <!-- 当订单不是支付尾款的时候 --> 374 <!-- 当订单不是支付尾款的时候 -->
372 <view class="fixedToBottom shadow-1" wx:else style="background-color: #fff;display: flex; justify-content: flex-end; padding: 10rpx 0"> 375 <view class="fixedToBottom shadow-1" wx:else style="background-color: #fff;display: flex; justify-content: flex-end; padding: 10rpx 0">
373 <view bindtap="cancelOrder" data-id="{{order.order_id}}" class="tips-btn2" wx:if="{{wait_dj}}">取消订单</view> 376 <view bindtap="cancelOrder" data-id="{{order.order_id}}" class="tips-btn2" wx:if="{{wait_dj}}">取消订单</view>
374 - <view bindtap="jumpToCart4" class="tips-btn2" wx:if="{{wait_dj}}">立即付款</view> 377 +
  378 + <view hidden="{{!show_submit}}" bindtap="jumpToCart4" class="tips-btn2" wx:if="{{wait_dj}}">立即付款</view>
375 <block wx:if="{{!(order.has_rt || order.return_btn==2 || order.return_btn==4) && wait_sh && !wait_fh }}"> 379 <block wx:if="{{!(order.has_rt || order.return_btn==2 || order.return_btn==4) && wait_sh && !wait_fh }}">
376 <navigator bindtap="confirmOrder" class="tips-btn2" hidden="{{!wait_sh}}">收货确认</navigator> 380 <navigator bindtap="confirmOrder" class="tips-btn2" hidden="{{!wait_sh}}">收货确认</navigator>
377 </block> 381 </block>
378 382
379 <view class="tips-btn2" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> 383 <view class="tips-btn2" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view>
380 -  
381 -  
382 <navigator class="tips-btn2" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> 384 <navigator class="tips-btn2" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator>
383 385
384 386
@@ -401,6 +403,8 @@ @@ -401,6 +403,8 @@
401 </view> 403 </view>
402 404
403 405
  406 +
  407 +
404 </form> 408 </form>
405 409
406 <!-- 使用券列表的弹窗 --> 410 <!-- 使用券列表的弹窗 -->
packageC/pages/presell/cart/cart2.js
@@ -571,7 +571,7 @@ Page({ @@ -571,7 +571,7 @@ Page({
571 571
572 572
573 //---------计算立即购买---------- 573 //---------计算立即购买----------
574 - calculatePrice2: function () { 574 + calculatePrice2: async function () {
575 var th = this, good = this.data.bn_goods; 575 var th = this, good = this.data.bn_goods;
576 if (!good) return false; 576 if (!good) return false;
577 577
@@ -582,7 +582,7 @@ Page({ @@ -582,7 +582,7 @@ Page({
582 } 582 }
583 583
584 wx.showLoading({ 584 wx.showLoading({
585 - title: "处理中." 585 + title: "处理中.",mask:true
586 }) 586 })
587 //-----------计算商品总价-------------- 587 //-----------计算商品总价--------------
588 var allpice = good.shop_price * good.buynum; 588 var allpice = good.shop_price * good.buynum;
@@ -609,8 +609,8 @@ Page({ @@ -609,8 +609,8 @@ Page({
609 } 609 }
610 610
611 611
612 - to.getConfig2(function (ee) {  
613 - to.getwuliuprice(async function (rs) { 612 + // to.getConfig2(function (ee) {
  613 + // to.getwuliuprice(async function (rs) {
614 614
615 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 615 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
616 var out_of_weight = null; //超出多少重量 616 var out_of_weight = null; //超出多少重量
@@ -699,6 +699,7 @@ Page({ @@ -699,6 +699,7 @@ Page({
699 let item = gd_arr_list[i]; 699 let item = gd_arr_list[i];
700 700
701 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 701 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
  702 + if (goods_weight < 0) goods_weight = 0;
702 if (item['exp_sum_type'] == 2) { 703 if (item['exp_sum_type'] == 2) {
703 cut_good_weight += item['weight'] * item['buynum']; 704 cut_good_weight += item['weight'] * item['buynum'];
704 goods_weight += item['weight'] * item['buynum']; 705 goods_weight += item['weight'] * item['buynum'];
@@ -744,9 +745,35 @@ Page({ @@ -744,9 +745,35 @@ Page({
744 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 745 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
745 746
746 //--------------开始计算物流------------------ 747 //--------------开始计算物流------------------
747 - var shipping_price =  
748 - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
749 - goods_piece, th.data.user_addr, back_data, rs); 748 + var shipping_price =0;
  749 + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  750 + // goods_piece, th.data.user_addr, back_data, rs);
  751 + var w_data={
  752 + store_id:os.stoid, code:code,
  753 + o_shipping_price:o_shipping_price,
  754 + goods_weight:goods_weight,
  755 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  756 + user_addr_province:th.data.user_addr.province,
  757 + user_addr_city:th.data.user_addr.city,
  758 + user_addr_district:th.data.user_addr.district,
  759 + is_by_all:back_data && back_data.is_by_all?1:0,
  760 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  761 + }
  762 +
  763 + var is_ok=0;
  764 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  765 + if(res.data.code==0){
  766 + shipping_price=res.data.data; is_ok=1;
  767 + }
  768 + })
  769 + if(!is_ok){
  770 + wx.showToast({
  771 + title: "计算物流错误", icon: 'none',duration: 2000
  772 + })
  773 + th.setData({ show_submit:0 });
  774 + wx.hideLoading();
  775 + return false;
  776 + }
750 777
751 778
752 if (shipping_price <= 0) { 779 if (shipping_price <= 0) {
@@ -915,8 +942,8 @@ Page({ @@ -915,8 +942,8 @@ Page({
915 942
916 wx.hideLoading(); 943 wx.hideLoading();
917 944
918 - });  
919 - }); 945 + // });
  946 + // });
920 }, 947 },
921 948
922 //--------------------提交订单----------------------- 949 //--------------------提交订单-----------------------
pages/cart/cart/cart.js
@@ -1731,7 +1731,7 @@ Page({ @@ -1731,7 +1731,7 @@ Page({
1731 1731
1732 function normal_check(store_count, goodsinfo, wareIds) { 1732 function normal_check(store_count, goodsinfo, wareIds) {
1733 //--- 看一下是不是线下库存 --- 1733 //--- 看一下是不是线下库存 ---
1734 - if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7) { 1734 + if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7 && !goodsinfo.whsle_id) {
1735 th.check_down_line(t, pitem, item, wareIds); 1735 th.check_down_line(t, pitem, item, wareIds);
1736 } else { 1736 } else {
1737 if (t.goods_num > store_count) { 1737 if (t.goods_num > store_count) {
@@ -2491,7 +2491,7 @@ Page({ @@ -2491,7 +2491,7 @@ Page({
2491 ab = 1; 2491 ab = 1;
2492 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- 2492 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
2493 if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || 2493 if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 ||
2494 - i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) { 2494 + i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) {
2495 //--获取商品的线下商品ID-- 2495 //--获取商品的线下商品ID--
2496 var gd = null; 2496 var gd = null;
2497 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { 2497 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => {
pages/cart/cart2/cart2.js
@@ -882,6 +882,11 @@ Page({ @@ -882,6 +882,11 @@ Page({
882 gd.prom_type = gg.prom_type ? gg.prom_type : 0; 882 gd.prom_type = gg.prom_type ? gg.prom_type : 0;
883 gd.prom_id = gg.prom_id ? gg.prom_id : 0; 883 gd.prom_id = gg.prom_id ? gg.prom_id : 0;
884 884
  885 + if(gd.whsle_id>0){
  886 + gd.prom_type =gg.prom_type=0;
  887 + gd.prom_id =gg.prom_id=0;
  888 + }
  889 +
885 switch (gd.prom_type) { 890 switch (gd.prom_type) {
886 case 0: 891 case 0:
887 case 3: 892 case 3:
@@ -1458,15 +1463,14 @@ Page({ @@ -1458,15 +1463,14 @@ Page({
1458 }, 1463 },
1459 1464
1460 //-------------------计算订单价格------------------- 1465 //-------------------计算订单价格-------------------
1461 - calculatePrice: function (t, s) { 1466 + calculatePrice:async function (t, s) {
1462 var th = this; 1467 var th = this;
1463 1468
1464 wx.showLoading({ 1469 wx.showLoading({
1465 title: "处理中.", 1470 title: "处理中.",
1466 mask:true 1471 mask:true
1467 }) 1472 })
1468 -  
1469 - to.getwuliuprice(async function (rs) { 1473 + //-- to.getwuliuprice(async function (rs) { --
1470 1474
1471 //是不是区域包邮 1475 //是不是区域包邮
1472 th.data.is_area_by = 0; 1476 th.data.is_area_by = 0;
@@ -1759,8 +1763,8 @@ Page({ @@ -1759,8 +1763,8 @@ Page({
1759 continue; 1763 continue;
1760 } 1764 }
1761 1765
1762 - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {  
1763 - 1766 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {
  1767 + if (goods_weight < 0) goods_weight = 0;
1764 if (item[j]['exp_sum_type'] == 2) { 1768 if (item[j]['exp_sum_type'] == 2) {
1765 cut_good_weight += item[j]['weight'] * item[j]['goods_num']; 1769 cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
1766 goods_weight += item[j]['weight'] * item[j]['goods_num']; 1770 goods_weight += item[j]['weight'] * item[j]['goods_num'];
@@ -1805,8 +1809,38 @@ Page({ @@ -1805,8 +1809,38 @@ Page({
1805 var code = ""; 1809 var code = "";
1806 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) 1810 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
1807 code = th.data.wu_arr[cart_item.wind].code; 1811 code = th.data.wu_arr[cart_item.wind].code;
1808 - cart_item.shipping_price =  
1809 - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs); 1812 +
  1813 + // cart_item.shipping_price =
  1814 + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs);
  1815 +
  1816 + var w_data={
  1817 + store_id:os.stoid, code:code,
  1818 + o_shipping_price:o_shipping_price,
  1819 + goods_weight:goods_weight,
  1820 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  1821 + user_addr_province:th.data.user_addr.province,
  1822 + user_addr_city:th.data.user_addr.city,
  1823 + user_addr_district:th.data.user_addr.district,
  1824 + is_by_all:back_data && back_data.is_by_all?1:0,
  1825 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  1826 + }
  1827 +
  1828 + var is_ok=1;
  1829 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  1830 + if(res.data.code==0){
  1831 + cart_item.shipping_price=res.data.data;
  1832 + }else{
  1833 + is_ok=0;
  1834 + }
  1835 + })
  1836 +
  1837 + if(!is_ok){
  1838 + wx.showToast({
  1839 + title: "计算物流错误", icon: 'none',duration: 2000
  1840 + })
  1841 + th.setData({ show_submit:0 });
  1842 + wx.hideLoading();
  1843 + }
1810 1844
1811 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1845 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
1812 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 1846 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了
@@ -1960,7 +1994,7 @@ Page({ @@ -1960,7 +1994,7 @@ Page({
1960 th.set_can_num(); 1994 th.set_can_num();
1961 wx.hideLoading(); 1995 wx.hideLoading();
1962 1996
1963 - }); 1997 + //});
1964 }, 1998 },
1965 1999
1966 set_can_num: function () { 2000 set_can_num: function () {
@@ -1994,7 +2028,7 @@ Page({ @@ -1994,7 +2028,7 @@ Page({
1994 2028
1995 2029
1996 //---------计算立即购买---------- 2030 //---------计算立即购买----------
1997 - calculatePrice2: function () { 2031 + calculatePrice2: async function () {
1998 var th = this, good = this.data.bn_goods; 2032 var th = this, good = this.data.bn_goods;
1999 2033
2000 if (!good) return false; 2034 if (!good) return false;
@@ -2033,7 +2067,7 @@ Page({ @@ -2033,7 +2067,7 @@ Page({
2033 allpice = good.offline_price * good.buynum; 2067 allpice = good.offline_price * good.buynum;
2034 } 2068 }
2035 2069
2036 - to.getwuliuprice(async function (rs) { 2070 + //to.getwuliuprice(async function (rs) {
2037 2071
2038 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 2072 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
2039 var out_of_weight = null; //超出多少重量 2073 var out_of_weight = null; //超出多少重量
@@ -2163,6 +2197,7 @@ Page({ @@ -2163,6 +2197,7 @@ Page({
2163 2197
2164 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 2198 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
2165 2199
  2200 + if (goods_weight < 0) goods_weight = 0;
2166 if (item['exp_sum_type'] == 2) { 2201 if (item['exp_sum_type'] == 2) {
2167 goods_weight += item['weight'] * item['buynum']; 2202 goods_weight += item['weight'] * item['buynum'];
2168 cut_good_weight += item['weight'] * item['buynum']; 2203 cut_good_weight += item['weight'] * item['buynum'];
@@ -2209,8 +2244,37 @@ Page({ @@ -2209,8 +2244,37 @@ Page({
2209 th.data.is_by[th.data.bn_pick] = 0; 2244 th.data.is_by[th.data.bn_pick] = 0;
2210 2245
2211 //--------------开始计算物流------------------ 2246 //--------------开始计算物流------------------
2212 - shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
2213 - goods_piece, th.data.user_addr, back_data, rs); 2247 + // shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  2248 + // goods_piece, th.data.user_addr, back_data, rs);
  2249 +
  2250 + var w_data={
  2251 + store_id:os.stoid, code:code,
  2252 + o_shipping_price:o_shipping_price,
  2253 + goods_weight:goods_weight,
  2254 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  2255 + user_addr_province:th.data.user_addr.province,
  2256 + user_addr_city:th.data.user_addr.city,
  2257 + user_addr_district:th.data.user_addr.district,
  2258 + is_by_all:back_data && back_data.is_by_all?1:0,
  2259 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  2260 + }
  2261 +
  2262 + var is_ok=1;
  2263 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  2264 + if(res.data.code==0){
  2265 + shipping_price=res.data.data;
  2266 + }else{
  2267 + is_ok=0;
  2268 + }
  2269 + })
  2270 +
  2271 + if(!is_ok){
  2272 + wx.showToast({
  2273 + title: "计算物流错误", icon: 'none',duration: 2000
  2274 + })
  2275 + th.setData({ show_submit:0 });
  2276 + wx.hideLoading();
  2277 + }
2214 2278
2215 if (shipping_price <= 0) { 2279 if (shipping_price <= 0) {
2216 th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 2280 th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
@@ -2408,7 +2472,7 @@ Page({ @@ -2408,7 +2472,7 @@ Page({
2408 2472
2409 wx.hideLoading(); 2473 wx.hideLoading();
2410 2474
2411 - }); 2475 + //});
2412 2476
2413 }, 2477 },
2414 2478
@@ -2606,7 +2670,7 @@ Page({ @@ -2606,7 +2670,7 @@ Page({
2606 if (gg.is_pd_normal) goods.is_pd_normal = 1; 2670 if (gg.is_pd_normal) goods.is_pd_normal = 1;
2607 2671
2608 //如果不立即购买或者秒杀,如果是线下库存购买的时候 2672 //如果不立即购买或者秒杀,如果是线下库存购买的时候
2609 - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules == 2) { 2673 + if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules == 2 && !th.data.bn_goods.whsle_id) {
2610 var isok = 1; 2674 var isok = 1;
2611 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { 2675 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) {
2612 isok = res; 2676 isok = res;
@@ -2850,121 +2914,125 @@ Page({ @@ -2850,121 +2914,125 @@ Page({
2850 } 2914 }
2851 2915
2852 //代发商品的集合 2916 //代发商品的集合
2853 - var df_goods=[];  
2854 - var df_price=0;  
2855 - var df_room_ids="";  
2856 - //-------------让商品添加到商品列表--------------------  
2857 - for (var k = 0; k < t_item.goods.length; k++) {  
2858 - var g_item = t_item.goods[k];  
2859 - if (g_item.goods_num <= 0) continue;  
2860 - var goods = {  
2861 - 'goods_id': g_item.goods_id,  
2862 - 'goods_name': g_item.goods_name,  
2863 - 'goods_sn': g_item.goods_sn,  
2864 - 'goods_num': g_item.goods_num,  
2865 - 'market_price': g_item.market_price,  
2866 - 'goods_price': g_item.goods_price,  
2867 - 'member_goods_price': g_item.goods_price,  
2868 - 'store_id': oo.stoid,  
2869 - }; 2917 + var df_goods = [];
  2918 + var df_price = 0;
  2919 + var df_room_ids = "";
  2920 +
  2921 + //多个商品才运算
  2922 + if( t_item.goods.length>1) {
  2923 + //-------------让商品添加到商品列表--------------------
  2924 + for (var k = 0; k < t_item.goods.length; k++) {
  2925 + var g_item = t_item.goods[k];
  2926 + if (g_item.goods_num <= 0) continue;
  2927 + var goods = {
  2928 + 'goods_id': g_item.goods_id,
  2929 + 'goods_name': g_item.goods_name,
  2930 + 'goods_sn': g_item.goods_sn,
  2931 + 'goods_num': g_item.goods_num,
  2932 + 'market_price': g_item.market_price,
  2933 + 'goods_price': g_item.goods_price,
  2934 + 'member_goods_price': g_item.goods_price,
  2935 + 'store_id': oo.stoid,
  2936 + };
2870 2937
2871 - if (getApp().globalData.skinface_id) {  
2872 - goods.skinface_id = getApp().globalData.skinface_id;  
2873 - } 2938 + if (getApp().globalData.skinface_id) {
  2939 + goods.skinface_id = getApp().globalData.skinface_id;
  2940 + }
2874 2941
2875 - //-- 线下取价也要写入,组合购的商品不能去线下价格 --  
2876 - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {  
2877 - goods.goods_price = g_item.offline_price;  
2878 - goods.member_goods_price = g_item.offline_price;  
2879 - goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);  
2880 - goods.pricing_type = g_item.pricing_type;  
2881 - }  
2882 - if (g_item.quan_num) {  
2883 - goods.quan_num = g_item.quan_num;  
2884 - goods.quan_no = g_item.quan_no;  
2885 - }  
2886 - //--判断活动的类型--  
2887 - switch (g_item.prom_type) {  
2888 - case 1:  
2889 - case 2:  
2890 - case 10:  
2891 - goods.prom_type = g_item.prom_type;  
2892 - goods.prom_id = g_item.prom_id;  
2893 - break;  
2894 - case 3:  
2895 - goods.prom_type = 3;  
2896 - goods.prom_id = g_item.prom_id;  
2897 - if (g_item.is_gift) {  
2898 - goods.is_gift = g_item.is_gift;  
2899 - goods.gift_id = g_item.gift_id;  
2900 - }  
2901 - break;  
2902 - case 5:  
2903 - goods.prom_type = 5;  
2904 - goods.prom_id = g_item.prom_id;  
2905 - if (g_item.is_collocation) {  
2906 - goods.is_collocation = g_item.is_collocation;  
2907 - }  
2908 - break  
2909 - case 7:  
2910 - goods.prom_type = 7;  
2911 - goods.prom_id = g_item.prom_id;  
2912 - break  
2913 - default:  
2914 - goods.prom_type = 0;  
2915 - goods.prom_id = 0;  
2916 - } 2942 + //-- 线下取价也要写入,组合购的商品不能去线下价格 --
  2943 + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
  2944 + goods.goods_price = g_item.offline_price;
  2945 + goods.member_goods_price = g_item.offline_price;
  2946 + goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
  2947 + goods.pricing_type = g_item.pricing_type;
  2948 + }
  2949 + if (g_item.quan_num) {
  2950 + goods.quan_num = g_item.quan_num;
  2951 + goods.quan_no = g_item.quan_no;
  2952 + }
  2953 + //--判断活动的类型--
  2954 + switch (g_item.prom_type) {
  2955 + case 1:
  2956 + case 2:
  2957 + case 10:
  2958 + goods.prom_type = g_item.prom_type;
  2959 + goods.prom_id = g_item.prom_id;
  2960 + break;
  2961 + case 3:
  2962 + goods.prom_type = 3;
  2963 + goods.prom_id = g_item.prom_id;
  2964 + if (g_item.is_gift) {
  2965 + goods.is_gift = g_item.is_gift;
  2966 + goods.gift_id = g_item.gift_id;
  2967 + }
  2968 + break;
  2969 + case 5:
  2970 + goods.prom_type = 5;
  2971 + goods.prom_id = g_item.prom_id;
  2972 + if (g_item.is_collocation) {
  2973 + goods.is_collocation = g_item.is_collocation;
  2974 + }
  2975 + break
  2976 + case 7:
  2977 + goods.prom_type = 7;
  2978 + goods.prom_id = g_item.prom_id;
  2979 + break
  2980 + default:
  2981 + goods.prom_type = 0;
  2982 + goods.prom_id = 0;
  2983 + }
2917 2984
2918 - //如果不立即购买或者秒杀,如果是线下库存购买的时候  
2919 - if (goods.prom_type == 0 && th.data.sales_rules == 2) {  
2920 - var isok = 1;  
2921 - await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {  
2922 - isok = res;  
2923 - });  
2924 - if (!isok) {  
2925 - getApp().confirmBox(goods.goods_name + "的门店库存不足");  
2926 - th.data.is_summit_ing = 0;  
2927 - return false; 2985 + //如果不立即购买或者秒杀,如果是线下库存购买的时候
  2986 + if (goods.prom_type == 0 && th.data.sales_rules == 2) {
  2987 + var isok = 1;
  2988 + await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {
  2989 + isok = res;
  2990 + });
  2991 + if (!isok) {
  2992 + getApp().confirmBox(goods.goods_name + "的门店库存不足");
  2993 + th.data.is_summit_ing = 0;
  2994 + return false;
  2995 + }
2928 } 2996 }
2929 - }  
2930 2997
2931 - //把优惠的平摊结果写进去  
2932 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {  
2933 - if (g_item.account >= 0) goods.account = g_item.account;  
2934 - if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;  
2935 - item.is_discount_amount = 1;  
2936 - } 2998 + //把优惠的平摊结果写进去
  2999 + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
  3000 + if (g_item.account >= 0) goods.account = g_item.account;
  3001 + if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
  3002 + item.is_discount_amount = 1;
  3003 + }
2937 3004
2938 - //导购ID  
2939 - if (g_item.guide_id) {  
2940 - goods.guide_id = g_item.guide_id;  
2941 - goods.guide_type = g_item.guide_type;  
2942 - //调用接口判断是不是会员  
2943 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {  
2944 - if (res.data.code == 0) {  
2945 - goods.guide_name = res.data.data.salesman;  
2946 - goods.guide_sn = res.data.data.salesman_no;  
2947 - }  
2948 - })  
2949 - } 3005 + //导购ID
  3006 + if (g_item.guide_id) {
  3007 + goods.guide_id = g_item.guide_id;
  3008 + goods.guide_type = g_item.guide_type;
  3009 + //调用接口判断是不是会员
  3010 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
  3011 + if (res.data.code == 0) {
  3012 + goods.guide_name = res.data.data.salesman;
  3013 + goods.guide_sn = res.data.data.salesman_no;
  3014 + }
  3015 + })
  3016 + }
2950 3017
2951 - //如果有阶梯促销  
2952 - if (g_item.ladder_list_id) {  
2953 - goods.ladder_list_id = g_item.ladder_list_id;  
2954 - } 3018 + //如果有阶梯促销
  3019 + if (g_item.ladder_list_id) {
  3020 + goods.ladder_list_id = g_item.ladder_list_id;
  3021 + }
2955 3022
2956 - //-- 如果有代发商品,就要开始拆单 --  
2957 - if(g_item.whsle_id){  
2958 - df_price+= parseFloat(g_item.goods_num*g_item.goods_price);  
2959 - goods.is_whsle_goods=1;  
2960 - df_goods.push(goods);  
2961 - df_room_ids+= g_item.room_id + ",";  
2962 - }else{  
2963 - item.order_goods.push(goods);  
2964 - //如果房间号不为空的时候  
2965 - if (g_item.room_id) {  
2966 - goods.room_id = g_item.room_id;  
2967 - room_ids += g_item.room_id + ","; 3023 + //-- 如果有代发商品,就要开始拆单 --
  3024 + if (g_item.whsle_id) {
  3025 + df_price += parseFloat(g_item.goods_num * g_item.goods_price);
  3026 + goods.is_whsle_goods = 1;
  3027 + df_goods.push(goods);
  3028 + df_room_ids += g_item.room_id + ",";
  3029 + } else {
  3030 + item.order_goods.push(goods);
  3031 + //如果房间号不为空的时候
  3032 + if (g_item.room_id) {
  3033 + goods.room_id = g_item.room_id;
  3034 + room_ids += g_item.room_id + ",";
  3035 + }
2968 } 3036 }
2969 } 3037 }
2970 } 3038 }
pages/cart/cart2_inte/cart2_inte.js
@@ -407,9 +407,9 @@ Page({ @@ -407,9 +407,9 @@ Page({
407 407
408 408
409 //---------计算立即购买---------- 409 //---------计算立即购买----------
410 - calculatePrice2: function () { 410 + calculatePrice2:async function () {
411 var th = this, good = this.data.bn_goods; 411 var th = this, good = this.data.bn_goods;
412 - wx.showLoading({ title: "处理中.", }) 412 + wx.showLoading({ title: "处理中.", mask:true })
413 //-----------计算商品总价-------------- 413 //-----------计算商品总价--------------
414 var allpice = good.shop_price * good.buynum; 414 var allpice = good.shop_price * good.buynum;
415 var all_integral = good.integral * good.buynum; 415 var all_integral = good.integral * good.buynum;
@@ -426,7 +426,7 @@ Page({ @@ -426,7 +426,7 @@ Page({
426 th.setData({ [c_txt]: cut_price, }); 426 th.setData({ [c_txt]: cut_price, });
427 } 427 }
428 428
429 - to.getwuliuprice(async function (rs) { 429 + //to.getwuliuprice(async function (rs) {
430 430
431 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 431 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
432 var out_of_weight = null; //超出多少重量 432 var out_of_weight = null; //超出多少重量
@@ -453,6 +453,7 @@ Page({ @@ -453,6 +453,7 @@ Page({
453 let item = gd_arr_list[i]; 453 let item = gd_arr_list[i];
454 454
455 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { 455 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) {
  456 + if (goods_weight < 0) goods_weight = 0;
456 if (item['exp_sum_type'] == 2) { 457 if (item['exp_sum_type'] == 2) {
457 goods_weight += item['weight'] * item['buynum']; 458 goods_weight += item['weight'] * item['buynum'];
458 cut_good_weight += item['weight'] * item['buynum']; 459 cut_good_weight += item['weight'] * item['buynum'];
@@ -495,8 +496,38 @@ Page({ @@ -495,8 +496,38 @@ Page({
495 var code = ""; 496 var code = "";
496 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 497 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
497 //--------------开始计算物流------------------ 498 //--------------开始计算物流------------------
498 - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
499 - goods_piece, th.data.user_addr, back_data, rs); 499 + var shipping_price=0;
  500 + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  501 + // goods_piece, th.data.user_addr, back_data, rs);
  502 +
  503 + var w_data={
  504 + store_id:os.stoid, code:code,
  505 + o_shipping_price:o_shipping_price,
  506 + goods_weight:goods_weight,
  507 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  508 + user_addr_province:th.data.user_addr.province,
  509 + user_addr_city:th.data.user_addr.city,
  510 + user_addr_district:th.data.user_addr.district,
  511 + is_by_all:back_data && back_data.is_by_all?1:0,
  512 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  513 + }
  514 +
  515 + var is_ok=0;
  516 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  517 + if(res.data.code==0){
  518 + shipping_price=res.data.data; is_ok=1;
  519 + }
  520 + })
  521 + if(!is_ok){
  522 + wx.showToast({
  523 + title: "计算物流错误", icon: 'none',duration: 2000
  524 + })
  525 + th.setData({ show_submit:0 });
  526 + wx.hideLoading();
  527 + return false;
  528 + }
  529 +
  530 +
500 if (shipping_price <= 0) { 531 if (shipping_price <= 0) {
501 th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 532 th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
502 } 533 }
@@ -547,7 +578,7 @@ Page({ @@ -547,7 +578,7 @@ Page({
547 578
548 wx.hideLoading(); 579 wx.hideLoading();
549 580
550 - }); 581 + //});
551 582
552 }, 583 },
553 584
pages/cart/cart2_pt/cart2_pt.js
@@ -394,7 +394,7 @@ Page({ @@ -394,7 +394,7 @@ Page({
394 }); 394 });
395 }, 395 },
396 //---------计算立即购买---------- 396 //---------计算立即购买----------
397 - calculatePrice2: function () { 397 + calculatePrice2:async function () {
398 398
399 wx.showLoading({ 399 wx.showLoading({
400 title: "处理中.", 400 title: "处理中.",
@@ -408,9 +408,10 @@ Page({ @@ -408,9 +408,10 @@ Page({
408 var txt = "formData.all_price"; 408 var txt = "formData.all_price";
409 th.setData({ [txt]: allpice, }); 409 th.setData({ [txt]: allpice, });
410 410
411 - to.getwuliuprice(async function (rs) { 411 + //to.getwuliuprice(async function (rs) {
412 console.log('calculatePrice2222'); 412 console.log('calculatePrice2222');
413 - console.log(rs); 413 + //console.log(rs);
  414 +
414 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 415 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
415 var out_of_weight = null; //超出多少重量 416 var out_of_weight = null; //超出多少重量
416 417
@@ -436,7 +437,8 @@ Page({ @@ -436,7 +437,8 @@ Page({
436 let item = gd_arr_list[i]; 437 let item = gd_arr_list[i];
437 438
438 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 439 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
439 - if (item['exp_sum_type'] == 2) { 440 + if (goods_weight < 0) goods_weight = 0;
  441 + if (item['exp_sum_type'] == 2) {
440 cut_good_weight += item['weight'] * item['buynum']; 442 cut_good_weight += item['weight'] * item['buynum'];
441 goods_weight += item['weight'] * item['buynum']; 443 goods_weight += item['weight'] * item['buynum'];
442 } 444 }
@@ -479,8 +481,36 @@ Page({ @@ -479,8 +481,36 @@ Page({
479 var code = th.data.wu_arr[th.data.index].code; 481 var code = th.data.wu_arr[th.data.index].code;
480 482
481 //--------------开始计算物流------------------ 483 //--------------开始计算物流------------------
482 - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
483 - goods_piece, th.data.user_addr, back_data, rs); 484 + var shipping_price=0;
  485 + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  486 + // goods_piece, th.data.user_addr, back_data, rs);
  487 +
  488 + var w_data={
  489 + store_id:os.stoid, code:code,
  490 + o_shipping_price:o_shipping_price,
  491 + goods_weight:goods_weight,
  492 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  493 + user_addr_province:th.data.user_addr.province,
  494 + user_addr_city:th.data.user_addr.city,
  495 + user_addr_district:th.data.user_addr.district,
  496 + is_by_all:back_data && back_data.is_by_all?1:0,
  497 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  498 + }
  499 +
  500 + var is_ok=0;
  501 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  502 + if(res.data.code==0){
  503 + shipping_price=res.data.data; is_ok=1;
  504 + }
  505 + })
  506 + if(!is_ok){
  507 + wx.showToast({
  508 + title: "计算物流错误", icon: 'none',duration: 2000
  509 + })
  510 + th.setData({ show_submit:0 });
  511 + wx.hideLoading();
  512 + return false;
  513 + }
484 514
485 shipping_price = parseFloat(shipping_price).toFixed(2); 515 shipping_price = parseFloat(shipping_price).toFixed(2);
486 var wl_txt = "formData.shipping_price"; 516 var wl_txt = "formData.shipping_price";
@@ -515,7 +545,7 @@ Page({ @@ -515,7 +545,7 @@ Page({
515 545
516 wx.hideLoading(); 546 wx.hideLoading();
517 547
518 - }); 548 + //});
519 549
520 }, 550 },
521 //--------------------提交订单----------------------- 551 //--------------------提交订单-----------------------
pages/cart/cart_wk/cart_wk.js
@@ -473,9 +473,9 @@ Page({ @@ -473,9 +473,9 @@ Page({
473 }, 473 },
474 474
475 //----计算物流的钱---- 475 //----计算物流的钱----
476 - calculate_wuliu() { 476 + async calculate_wuliu() {
477 var to = getApp(), th = this; 477 var to = getApp(), th = this;
478 - to.getwuliuprice(async function (rs) { 478 + //to.getwuliuprice(async function (rs) {
479 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; 479 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods;
480 var out_of_weight = null; //超出多少重量 480 var out_of_weight = null; //超出多少重量
481 481
@@ -505,7 +505,8 @@ Page({ @@ -505,7 +505,8 @@ Page({
505 let item = gd_arr_list[i]; 505 let item = gd_arr_list[i];
506 506
507 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 507 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
508 - if (item['exp_sum_type'] == 2) { 508 + if (goods_weight < 0) goods_weight = 0;
  509 + if (item['exp_sum_type'] == 2) {
509 goods_weight += item['weight'] * item['buynum']; 510 goods_weight += item['weight'] * item['buynum'];
510 cut_good_weight += item['weight'] * item['buynum']; 511 cut_good_weight += item['weight'] * item['buynum'];
511 } 512 }
@@ -547,8 +548,36 @@ Page({ @@ -547,8 +548,36 @@ Page({
547 var code = th.data.wu_arr[th.data.index].code; 548 var code = th.data.wu_arr[th.data.index].code;
548 549
549 //--------------开始计算物流------------------ 550 //--------------开始计算物流------------------
550 - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
551 - goods_piece, th.data.user_addr, back_data, rs); 551 + var shipping_price =0;
  552 + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  553 + // goods_piece, th.data.user_addr, back_data, rs);
  554 +
  555 + var w_data={
  556 + store_id:os.stoid, code:code,
  557 + o_shipping_price:o_shipping_price,
  558 + goods_weight:goods_weight,
  559 + out_of_weight:out_of_weight,goods_piece:goods_piece,
  560 + user_addr_province:th.data.user_addr.province,
  561 + user_addr_city:th.data.user_addr.city,
  562 + user_addr_district:th.data.user_addr.district,
  563 + is_by_all:back_data && back_data.is_by_all?1:0,
  564 + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
  565 + }
  566 +
  567 + var is_ok=0;
  568 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
  569 + if(res.data.code==0){
  570 + shipping_price=res.data.data; is_ok=1;
  571 + }
  572 + })
  573 + if(!is_ok){
  574 + wx.showToast({
  575 + title: "计算物流错误", icon: 'none',duration: 2000
  576 + })
  577 + th.setData({ show_submit:0 });
  578 + wx.hideLoading();
  579 + return false;
  580 + }
552 581
553 var exp_price = parseFloat(shipping_price).toFixed(2); 582 var exp_price = parseFloat(shipping_price).toFixed(2);
554 allpice = parseFloat(exp_price) + parseFloat(allpice); 583 allpice = parseFloat(exp_price) + parseFloat(allpice);
@@ -561,7 +590,7 @@ Page({ @@ -561,7 +590,7 @@ Page({
561 allpice = allpice.toFixed(2); 590 allpice = allpice.toFixed(2);
562 th.setData({ exp_price: 0, allpice: allpice }) 591 th.setData({ exp_price: 0, allpice: allpice })
563 } 592 }
564 - }); 593 + //});
565 594
566 }, 595 },
567 596
pages/goods/goodsInfo/goodsInfo.js
@@ -561,7 +561,7 @@ Page({ @@ -561,7 +561,7 @@ Page({
561 var that = this, th = this; 561 var that = this, th = this;
562 getApp().getConfig2(function (e) { 562 getApp().getConfig2(function (e) {
563 var sales_rules = e.sales_rules; 563 var sales_rules = e.sales_rules;
564 - if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 ) { 564 + if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 && !th.data.sele_g.whsle_id ) {
565 getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { 565 getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
566 var lock = 0, plist = null; 566 var lock = 0, plist = null;
567 var gd = that.data.fir_goods; 567 var gd = that.data.fir_goods;
@@ -1676,7 +1676,7 @@ Page({ @@ -1676,7 +1676,7 @@ Page({
1676 } 1676 }
1677 1677
1678 //---如果是线下门店销售的时候--- 1678 //---如果是线下门店销售的时候---
1679 - if (th.data.sales_rules == 2) { 1679 + if (th.data.sales_rules == 2 && !th.data.sele_g.whsle_id ) {
1680 var pick = th.get_pick_from_list(th.data.sto_sele_id) 1680 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1681 //---通过接口获取门店的线下库存信息-- 1681 //---通过接口获取门店的线下库存信息--
1682 getApp().request.get("/api/weshop/goods/getWareStorages", { 1682 getApp().request.get("/api/weshop/goods/getWareStorages", {
@@ -2348,7 +2348,7 @@ Page({ @@ -2348,7 +2348,7 @@ Page({
2348 check_is_prom_goods: function (callback) { 2348 check_is_prom_goods: function (callback) {
2349 var th = this; 2349 var th = this;
2350 var usr = getApp().globalData.userInfo; 2350 var usr = getApp().globalData.userInfo;
2351 - if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3) { 2351 + if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) {
2352 callback(); 2352 callback();
2353 } else { 2353 } else {
2354 //-- 判断有没有优惠活动 -- 2354 //-- 判断有没有优惠活动 --
@@ -2862,7 +2862,7 @@ Page({ @@ -2862,7 +2862,7 @@ Page({
2862 if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal); 2862 if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal);
2863 2863
2864 //默认门店要拿下门店库存 2864 //默认门店要拿下门店库存
2865 - if (that.data.sales_rules == 2 && that.data.def_pick_store) { 2865 + if (that.data.sales_rules == 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id ) {
2866 var lock = 0, plist = null; 2866 var lock = 0, plist = null;
2867 //先读取门店的lock,采用链式写法,少用await 2867 //先读取门店的lock,采用链式写法,少用await
2868 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2868 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
@@ -3089,7 +3089,7 @@ Page({ @@ -3089,7 +3089,7 @@ Page({
3089 th.setData({all_pick_list: e.data.data.pageData}); 3089 th.setData({all_pick_list: e.data.data.pageData});
3090 3090
3091 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- 3091 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购--
3092 - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { 3092 + if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) {
3093 setTimeout(function () { 3093 setTimeout(function () {
3094 th.deal_pickup_dline(e); 3094 th.deal_pickup_dline(e);
3095 }, 800) 3095 }, 800)
@@ -5993,7 +5993,7 @@ Page({ @@ -5993,7 +5993,7 @@ Page({
5993 var lock = 0; 5993 var lock = 0;
5994 5994
5995 //---如果是活动的时候,同时不是普通购买--- 5995 //---如果是活动的时候,同时不是普通购买---
5996 - if ((th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) { 5996 + if (th.data.sele_g.whsle_id || (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) {
5997 func(); 5997 func();
5998 return false; 5998 return false;
5999 } 5999 }
pages/goods/goodsInfo/goodsInfo.wxml
@@ -649,7 +649,7 @@ @@ -649,7 +649,7 @@
649 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> 649 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
650 (配送不匹配) 650 (配送不匹配)
651 </view> 651 </view>
652 - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 652 + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}">
653 (库存不足) 653 (库存不足)
654 </view> 654 </view>
655 </block> 655 </block>
@@ -1254,7 +1254,7 @@ @@ -1254,7 +1254,7 @@
1254 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 1254 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
1255 <block wx:else> 1255 <block wx:else>
1256 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 1256 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
1257 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 1257 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 &&!sele_g.whsle_id}}">
1258 (库存不足) 1258 (库存不足)
1259 </view> 1259 </view>
1260 </block> 1260 </block>
@@ -1326,7 +1326,7 @@ @@ -1326,7 +1326,7 @@
1326 </block> 1326 </block>
1327 <block wx:else> 1327 <block wx:else>
1328 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> 1328 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
1329 - <block wx:if="{{sales_rules==2 && prom_type==0}}"> 1329 + <block wx:if="{{sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}">
1330 <block wx:if="{{!def_pick_store.CanOutQty}}"> 1330 <block wx:if="{{!def_pick_store.CanOutQty}}">
1331 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> 1331 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
1332 库存不足 1332 库存不足
pages/user/order_detail/order_detail.js
@@ -629,7 +629,7 @@ Page({ @@ -629,7 +629,7 @@ Page({
629 } 629 }
630 630
631 //--如果是线下库存的时候-- 631 //--如果是线下库存的时候--
632 - if(th.data.conf.sales_rules==2){ 632 + if(th.data.conf.sales_rules==2 && !gg.whsle_id){
633 var ob={}; 633 var ob={};
634 await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){ 634 await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){
635 ob=obj; 635 ob=obj;
@@ -1239,7 +1239,7 @@ Page({ @@ -1239,7 +1239,7 @@ Page({
1239 1239
1240 1240
1241 //判断是不是线下库存的购买, 是不是秒杀活动 1241 //判断是不是线下库存的购买, 是不是秒杀活动
1242 - if(th.data.sales_rules==2 && !prom){ 1242 + if(th.data.sales_rules==2 && !prom && !good.whsle_id){
1243 1243
1244 //-- 看一下购物车上有多少商品 -- 1244 //-- 看一下购物车上有多少商品 --
1245 var cart_num=0; 1245 var cart_num=0;
pages/user/order_list/order_list.js
@@ -881,7 +881,7 @@ Page({ @@ -881,7 +881,7 @@ Page({
881 } 881 }
882 882
883 //--如果是线下库存的时候-- 883 //--如果是线下库存的时候--
884 - if (th.data.conf.sales_rules == 2) { 884 + if (th.data.conf.sales_rules == 2 && !gg.whsle_id) {
885 var ob = {}; 885 var ob = {};
886 await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { 886 await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) {
887 ob = obj; 887 ob = obj;
@@ -1482,7 +1482,7 @@ Page({ @@ -1482,7 +1482,7 @@ Page({
1482 1482
1483 1483
1484 //判断是不是线下库存的购买, 是不是秒杀活动 1484 //判断是不是线下库存的购买, 是不是秒杀活动
1485 - if(th.data.sales_rules==2 && !prom){ 1485 + if(th.data.sales_rules==2 && !prom && !good.whsle_id){
1486 1486
1487 //-- 看一下购物车上有多少商品 -- 1487 //-- 看一下购物车上有多少商品 --
1488 var cart_num=0; 1488 var cart_num=0;