Commit 409528ecbfafcae4e212627071cba7db517db6bb

Authored by 后端研发-苏泰源
2 parents 52dd45bc 1a94a066

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

components/diy_pingd_buy/diy_pingd_buy.js
@@ -104,7 +104,11 @@ Component({ @@ -104,7 +104,11 @@ Component({
104 var url= "/api/weshop/teamlist/pageteam/2?page=1&pageSize=9"; 104 var url= "/api/weshop/teamlist/pageteam/2?page=1&pageSize=9";
105 getApp().request.promiseGet(url, { 105 getApp().request.promiseGet(url, {
106 data: { 106 data: {
107 - store_id: os.stoid,is_end: 0,is_show: 1, 107 + store_id:
  108 + os.stoid,
  109 + is_end: 0,
  110 + is_show: 1,
  111 + user_id: getApp().globalData.user_id,
108 } 112 }
109 }).then(res => { 113 }).then(res => {
110 if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ 114 if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){
@@ -139,7 +143,7 @@ Component({ @@ -139,7 +143,7 @@ Component({
139 //--三个三个一组--- 143 //--三个三个一组---
140 for(var i=0;i< all_array.length;i+=3){ 144 for(var i=0;i< all_array.length;i+=3){
141 arr.push(all_array.slice(i,i+3)); 145 arr.push(all_array.slice(i,i+3));
142 - } 146 + }
143 /*--熏染到前台--*/ 147 /*--熏染到前台--*/
144 th.setData({goods_array:arr}); 148 th.setData({goods_array:arr});
145 var newTime = ut.gettimestamp(); 149 var newTime = ut.gettimestamp();
packageA/pages/distribution/myteam/myteam.wxml
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <view> 12 <view>
13 {{item.nickname}} 13 {{item.nickname}}
14 <view style="color: #FF6768;display:block;font-size:26rpx" wx:if="{{item.is_distribut == 1}}">分销会员</view> 14 <view style="color: #FF6768;display:block;font-size:26rpx" wx:if="{{item.is_distribut == 1}}">分销会员</view>
15 - <view style="color: #FF6768;display:block;" wx:else>普通会员</view> 15 + <view style="color: #FF6768;display:block;font-size:26rpx" wx:else>普通会员</view>
16 </view> 16 </view>
17 <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> 17 <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view>
18 </view> 18 </view>
packageB/pages/zuhegou/index/index.js
@@ -1972,15 +1972,8 @@ Page({ @@ -1972,15 +1972,8 @@ Page({
1972 if (this.data.act.is_bzyh && zhqty_bz.length > 0) { 1972 if (this.data.act.is_bzyh && zhqty_bz.length > 0) {
1973 if (zhqty_bz.length > 1) { 1973 if (zhqty_bz.length > 1) {
1974 let zhqty_bz_arr = []; 1974 let zhqty_bz_arr = [];
1975 - let zhqty_bz_flag = zhqty_bz.every((item1, i) => {  
1976 - var bz_num = be * item1['zhqty']; //超量倍增  
1977 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量  
1978 - if (bz_num > num) {  
1979 - zhqty_bz_arr.push(item1);  
1980 - zhqty_bz.splice(i, 1)  
1981 - }  
1982 - return bz_num <= num;  
1983 - }) 1975 + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr);
  1976 +
1984 if (zhqty_bz_flag) { 1977 if (zhqty_bz_flag) {
1985 for (let i = 0; i < zhqty_bz.length; i++) { 1978 for (let i = 0; i < zhqty_bz.length; i++) {
1986 var vv = zhqty_bz[i]; 1979 var vv = zhqty_bz[i];
@@ -1995,11 +1988,12 @@ Page({ @@ -1995,11 +1988,12 @@ Page({
1995 } 1988 }
1996 } 1989 }
1997 } else { 1990 } else {
  1991 + zhqty_len=1;
1998 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { 1992 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) {
1999 - return o['num'] 1993 + return o['num'];
2000 })); 1994 }));
2001 let new_arr = zhqty_bz_arr.filter(ii => { 1995 let new_arr = zhqty_bz_arr.filter(ii => {
2002 - return ii['num'] == min_bz_num 1996 + return ii['num'] == min_bz_num;
2003 }) 1997 })
2004 var vv = new_arr[0]; 1998 var vv = new_arr[0];
2005 var bz_num = be * new_arr[0].zhqty; //超量倍增 1999 var bz_num = be * new_arr[0].zhqty; //超量倍增
@@ -2018,16 +2012,20 @@ Page({ @@ -2018,16 +2012,20 @@ Page({
2018 } 2012 }
2019 bz_num_ok = be * vv.zhqty; 2013 bz_num_ok = be * vv.zhqty;
2020 } 2014 }
2021 -  
2022 - for (let j = 0; j < bz_num_ok; j++) {  
2023 - let index = no_in_arr.findIndex(i => {  
2024 - return vv.goods_id === i.goods_id  
2025 - })  
2026 - if (index > -1) {  
2027 - delete_num++  
2028 - no_in_arr.splice(index, 1) 2015 +
  2016 + for(let i = 0; i < zhqty_bz.length; i++){
  2017 + let item1=zhqty_bz[i];
  2018 + for (let j = 0; j < be * item1['zhqty']; j++) {
  2019 + let index = no_in_arr.findIndex(i => {
  2020 + return item1.goods_id === i.goods_id
  2021 + })
  2022 + if (index > -1) {
  2023 + // delete_num++
  2024 + no_in_arr.splice(index, 1)
  2025 + }
2029 } 2026 }
2030 } 2027 }
  2028 + aprice += be * aprice;
2031 } 2029 }
2032 } else { 2030 } else {
2033 var vv = zhqty_bz[0]; 2031 var vv = zhqty_bz[0];
@@ -2258,6 +2256,20 @@ Page({ @@ -2258,6 +2256,20 @@ Page({
2258 } 2256 }
2259 if (func) func(list) 2257 if (func) func(list)
2260 2258
2261 - } 2259 + },
2262 2260
  2261 + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){
  2262 + let zhqty_bz_flag =true;
  2263 + for(let i=0;i<zhqty_bz.length;i++){
  2264 + let item=zhqty_bz[i];
  2265 + let bz_num = be * item['zhqty']; //超量倍增
  2266 + let num = item['num'] - item['zhqty']; //购买数量减去超量
  2267 + if (bz_num > num) {
  2268 + zhqty_bz_flag=false;
  2269 + zhqty_bz_arr.push(item);
  2270 + // zhqty_bz.splice(i,1)
  2271 + }
  2272 + }
  2273 + return zhqty_bz_flag;
  2274 + }
2263 }) 2275 })
2264 \ No newline at end of file 2276 \ No newline at end of file
packageB/pages/zuhegou/list/list.wxml
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </view> 63 </view>
64 64
65 <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view> 65 <view class="no-more" wx:if="{{goodlist.length==0}}">没有相关内容</view>
66 - 66 +<!--
67 <view class="kill-time xc-seckill-bottom"> 67 <view class="kill-time xc-seckill-bottom">
68 <view class="theader" > 68 <view class="theader" >
69 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> 69 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}">
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 即将开始</view> 76 即将开始</view>
77 </view> 77 </view>
78 </view> 78 </view>
79 - 79 +-->
80 80
81 81
82 </view> 82 </view>
packageC/pages/group_list/group_list.wxml
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> 44 <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata>
45 45
46 46
47 - 47 +<!--
48 <view class="kill-time xc-seckill-bottom"> 48 <view class="kill-time xc-seckill-bottom">
49 <view class="theader" > 49 <view class="theader" >
50 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> 50 <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}">
@@ -54,4 +54,5 @@ @@ -54,4 +54,5 @@
54 <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> 54 <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image>
55 即将开始</view> 55 即将开始</view>
56 </view> 56 </view>
57 -</view>  
58 \ No newline at end of file 57 \ No newline at end of file
  58 +</view>
  59 +-->
59 \ No newline at end of file 60 \ No newline at end of file
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1374,11 +1374,11 @@ Page({ @@ -1374,11 +1374,11 @@ Page({
1374 o_price += item[j].goods_price * item[j].goods_num; 1374 o_price += item[j].goods_price * item[j].goods_num;
1375 1375
1376 //判断是否有设置限制重量包邮 1376 //判断是否有设置限制重量包邮
1377 - if(weight_free){  
1378 - if( item[j]['exp_sum_type']==2 ){  
1379 - if (goods_weight < 0) goods_weight = 0;  
1380 - //累积商品重量 每种商品的重量 * 数量  
1381 - goods_weight += item[j]['weight'] * item[j]['goods_num']; 1377 + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2){
  1378 + if (goods_weight < 0) goods_weight = 0;
  1379 + //累积商品重量 每种商品的重量 * 数量
  1380 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1381 + if(weight_free > 0){
1382 out_of_weight = (weight_free*1000) - goods_weight; 1382 out_of_weight = (weight_free*1000) - goods_weight;
1383 } 1383 }
1384 } 1384 }
@@ -1560,9 +1560,11 @@ Page({ @@ -1560,9 +1560,11 @@ Page({
1560 } 1560 }
1561 1561
1562 }else{ 1562 }else{
1563 - if(goods_weight && out_of_weight !== 0){  
1564 - goods_weight=-1;  
1565 - out_of_weight=0; 1563 + if(item[j]['exp_sum_type']==2){
  1564 + if(out_of_weight !==0){
  1565 + goods_weight=-1;
  1566 + out_of_weight=0;
  1567 + }
1566 } 1568 }
1567 } 1569 }
1568 } 1570 }
@@ -1866,7 +1868,9 @@ Page({ @@ -1866,7 +1868,9 @@ Page({
1866 if (goods_weight < 0) goods_weight = 0; 1868 if (goods_weight < 0) goods_weight = 0;
1867 //累积商品重量 每种商品的重量 * 数量 1869 //累积商品重量 每种商品的重量 * 数量
1868 goods_weight += good['weight'] * good['buynum']; 1870 goods_weight += good['weight'] * good['buynum'];
1869 - out_of_weight = (weight_free * 1000 ) - goods_weight; 1871 + if(weight_free > 0){
  1872 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  1873 + }
1870 break; 1874 break;
1871 case 3: 1875 case 3:
1872 if (goods_piece < 0) goods_piece = 0; 1876 if (goods_piece < 0) goods_piece = 0;
@@ -1896,6 +1900,7 @@ Page({ @@ -1896,6 +1900,7 @@ Page({
1896 if (res.data.data[0].region_list) { 1900 if (res.data.data[0].region_list) {
1897 if (th.check_by_area(res.data.data[0].region_list)) { 1901 if (th.check_by_area(res.data.data[0].region_list)) {
1898 freight_free = 0; 1902 freight_free = 0;
  1903 + out_of_weight=0;
1899 th.data.is_no_by[th.data.bn_pick] = 1; 1904 th.data.is_no_by[th.data.bn_pick] = 1;
1900 } 1905 }
1901 } 1906 }
@@ -1903,6 +1908,7 @@ Page({ @@ -1903,6 +1908,7 @@ Page({
1903 if (res.data.data[0].goods_list && freight_free) { 1908 if (res.data.data[0].goods_list && freight_free) {
1904 if (th.check_by_goods(res.data.data[0].goods_list)) { 1909 if (th.check_by_goods(res.data.data[0].goods_list)) {
1905 freight_free = 0; 1910 freight_free = 0;
  1911 + out_of_weight=0;
1906 th.data.is_no_by[th.data.bn_pick] = 1; 1912 th.data.is_no_by[th.data.bn_pick] = 1;
1907 } 1913 }
1908 } 1914 }
@@ -2863,7 +2869,7 @@ Page({ @@ -2863,7 +2869,7 @@ Page({
2863 var price = 0, th = this; 2869 var price = 0, th = this;
2864 price += parseFloat(o_shipping_price); 2870 price += parseFloat(o_shipping_price);
2865 //如果是包邮 2871 //如果是包邮
2866 - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { 2872 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
2867 return 0; 2873 return 0;
2868 } 2874 }
2869 if (user_addr == null) { 2875 if (user_addr == null) {
@@ -2881,7 +2887,7 @@ Page({ @@ -2881,7 +2887,7 @@ Page({
2881 item = item.config; 2887 item = item.config;
2882 if (item == null) return o_shipping_price; 2888 if (item == null) return o_shipping_price;
2883 //------按重量---------- 2889 //------按重量----------
2884 - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { 2890 + if (goods_weight >= 0 && item['money']) {
2885 fw_price = parseFloat(item['money']); 2891 fw_price = parseFloat(item['money']);
2886 if (goods_weight > item['first_weight']) { 2892 if (goods_weight > item['first_weight']) {
2887 var fw = goods_weight - item['first_weight']; 2893 var fw = goods_weight - item['first_weight'];
@@ -2890,11 +2896,14 @@ Page({ @@ -2890,11 +2896,14 @@ Page({
2890 } 2896 }
2891 } 2897 }
2892 //------超出重量---------- 2898 //------超出重量----------
2893 - if(out_of_weight < 0){ 2899 + if(out_of_weight < 0 && o_price >= freight_free){
2894 fw_price = parseFloat(item['money']); 2900 fw_price = parseFloat(item['money']);
2895 var out_of_weight = Math.abs(out_of_weight); 2901 var out_of_weight = Math.abs(out_of_weight);
2896 - var n = Math.ceil(out_of_weight / item['second_weight'])  
2897 - fw_price = fw_price + n * parseFloat(item['add_money']); 2902 + if (out_of_weight > item['first_weight']) {
  2903 + var fw = out_of_weight - item['first_weight'];
  2904 + var n = Math.ceil(fw / item['second_weight'])
  2905 + fw_price = fw_price + n * parseFloat(item['add_money']);
  2906 + }
2898 } 2907 }
2899 //------按件数---------- 2908 //------按件数----------
2900 if (goods_piece > 0 && item['piecemoney']) { 2909 if (goods_piece > 0 && item['piecemoney']) {
@@ -3786,6 +3795,7 @@ Page({ @@ -3786,6 +3795,7 @@ Page({
3786 if (no_by_data && no_by_data.region_list) { 3795 if (no_by_data && no_by_data.region_list) {
3787 if (th.check_by_area(no_by_data.region_list)) { 3796 if (th.check_by_area(no_by_data.region_list)) {
3788 gift_freight_free = 0; 3797 gift_freight_free = 0;
  3798 + out_of_weight=0;
3789 th.data.is_no_by[th.data.bn_pick] = 1; 3799 th.data.is_no_by[th.data.bn_pick] = 1;
3790 } 3800 }
3791 } 3801 }
@@ -3793,12 +3803,13 @@ Page({ @@ -3793,12 +3803,13 @@ Page({
3793 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 3803 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
3794 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 3804 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
3795 gift_freight_free = 0; 3805 gift_freight_free = 0;
  3806 + out_of_weight=0;
3796 //th.data.is_no_by[th.data.bn_pick]=1; 3807 //th.data.is_no_by[th.data.bn_pick]=1;
3797 } 3808 }
3798 } 3809 }
3799 3810
3800 var t_shipping_price = 3811 var t_shipping_price =
3801 - this.calculatewuliu(code, gift_shipping_price, goods_weight, 3812 + this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,
3802 goods_piece, user_addr, gift_freight_free, allpice, rs); 3813 goods_piece, user_addr, gift_freight_free, allpice, rs);
3803 return t_shipping_price; 3814 return t_shipping_price;
3804 3815
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -513,6 +513,10 @@ Page({ @@ -513,6 +513,10 @@ Page({
513 var o_shipping_price = 0, 513 var o_shipping_price = 0,
514 goods_weight = -1, 514 goods_weight = -1,
515 goods_piece = -1; 515 goods_piece = -1;
  516 + var out_of_weight=null; //超出多少重量
  517 + var freight_free = ee.freight_free; //全场满多少包邮
  518 + var weight_free = ee.weight_free; //多少kg内包邮
  519 + var no_ex_id = ee.no_ex_id;
516 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- 520 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
517 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 521 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type !=
518 3 || th.data.bn_goods.is_normal == 1)) { 522 3 || th.data.bn_goods.is_normal == 1)) {
@@ -525,6 +529,9 @@ Page({ @@ -525,6 +529,9 @@ Page({
525 if (goods_weight < 0) goods_weight = 0; 529 if (goods_weight < 0) goods_weight = 0;
526 //累积商品重量 每种商品的重量 * 数量 530 //累积商品重量 每种商品的重量 * 数量
527 goods_weight += good['weight'] * good['buynum']; 531 goods_weight += good['weight'] * good['buynum'];
  532 + if(weight_free > 0){
  533 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  534 + }
528 break; 535 break;
529 case 3: 536 case 3:
530 if (goods_piece < 0) goods_piece = 0; 537 if (goods_piece < 0) goods_piece = 0;
@@ -1042,7 +1049,7 @@ Page({ @@ -1042,7 +1049,7 @@ Page({
1042 th = this; 1049 th = this;
1043 price += parseFloat(o_shipping_price); 1050 price += parseFloat(o_shipping_price);
1044 //如果是包邮 1051 //如果是包邮
1045 - if (freight_free > 0 && o_price >= freight_free) { 1052 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
1046 return 0; 1053 return 0;
1047 } 1054 }
1048 if (user_addr == null) { 1055 if (user_addr == null) {
@@ -1061,7 +1068,7 @@ Page({ @@ -1061,7 +1068,7 @@ Page({
1061 item = item.config; 1068 item = item.config;
1062 if (item == null) return o_shipping_price; 1069 if (item == null) return o_shipping_price;
1063 //------按重量---------- 1070 //------按重量----------
1064 - if (goods_weight > 0) { 1071 + if (goods_weight > 0 && item['money']) {
1065 fw_price = parseFloat(item['money']); 1072 fw_price = parseFloat(item['money']);
1066 if (goods_weight > item['first_weight']) { 1073 if (goods_weight > item['first_weight']) {
1067 var fw = goods_weight - item['first_weight']; 1074 var fw = goods_weight - item['first_weight'];
@@ -1069,6 +1076,16 @@ Page({ @@ -1069,6 +1076,16 @@ Page({
1069 fw_price = fw_price + n * parseFloat(item['add_money']); 1076 fw_price = fw_price + n * parseFloat(item['add_money']);
1070 } 1077 }
1071 } 1078 }
  1079 + //------超出重量----------
  1080 + if(out_of_weight < 0 && o_price >= freight_free){
  1081 + fw_price = parseFloat(item['money']);
  1082 + var out_of_weight = Math.abs(out_of_weight);
  1083 + if (out_of_weight > item['first_weight']) {
  1084 + var fw = out_of_weight - item['first_weight'];
  1085 + var n = Math.ceil(fw / item['second_weight'])
  1086 + fw_price = fw_price + n * parseFloat(item['add_money']);
  1087 + }
  1088 + }
1072 //------按件数---------- 1089 //------按件数----------
1073 if (goods_piece > 0) { 1090 if (goods_piece > 0) {
1074 fp_price = parseFloat(item['piecemoney']); 1091 fp_price = parseFloat(item['piecemoney']);
packageC/pages/presell/cart/cart.js
@@ -112,34 +112,34 @@ Page({ @@ -112,34 +112,34 @@ Page({
112 tabs: ['门店自提', '快递邮寄'], 112 tabs: ['门店自提', '快递邮寄'],
113 currentTabIndex: 1, 113 currentTabIndex: 1,
114 114
115 - order_sn:'',  
116 - order_id:'', 115 + order_sn: '',
  116 + order_id: '',
117 117
118 }, 118 },
119 onLoad: function (t) { 119 onLoad: function (t) {
120 -  
121 - if(t.order_id) this.data.order_id=t.order_id;  
122 - if(t.order_sn) this.data.order_sn=t.order_sn;  
123 120
124 - wx.setNavigationBarTitle({title: "订单详情",}) 121 + if (t.order_id) this.data.order_id = t.order_id;
  122 + if (t.order_sn) this.data.order_sn = t.order_sn;
  123 +
  124 + wx.setNavigationBarTitle({ title: "订单详情", })
125 var th = this; 125 var th = this;
126 - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); 126 + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
127 th.data.param = t; 127 th.data.param = t;
128 //清理一下,确保最新的系统配置 128 //清理一下,确保最新的系统配置
129 getApp().globalData.config2 = null; 129 getApp().globalData.config2 = null;
130 //清空is_pick_up 130 //清空is_pick_up
131 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 131 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
132 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 132 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
133 success: function (s) { 133 success: function (s) {
134 } 134 }
135 }); 135 });
136 - if(!getApp().globalData.userInfo){ 136 + if (!getApp().globalData.userInfo) {
137 getApp().goto("/pages/togoin/togoin"); 137 getApp().goto("/pages/togoin/togoin");
138 } 138 }
139 139
140 }, 140 },
141 onUnload: function () { 141 onUnload: function () {
142 - this.setData({isclose: 1}) 142 + this.setData({ isclose: 1 })
143 }, 143 },
144 onHide: function () { 144 onHide: function () {
145 this.setData({ 145 this.setData({
@@ -152,13 +152,13 @@ Page({ @@ -152,13 +152,13 @@ Page({
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 onShow: function () { 153 onShow: function () {
154 var th = this; 154 var th = this;
155 - th.setData({show_submit: 0}); //让提交先掩藏 155 + th.setData({ show_submit: 0 }); //让提交先掩藏
156 th.data.g_cart_q_time = null; 156 th.data.g_cart_q_time = null;
157 if (th.data.isclose == 0) { 157 if (th.data.isclose == 0) {
158 wx.navigateTo({ 158 wx.navigateTo({
159 - url:"/pages/index/index/index" 159 + url: "/pages/index/index/index"
160 }) 160 })
161 - }else{ 161 + } else {
162 this.getuser_addr(function (ie) { 162 this.getuser_addr(function (ie) {
163 //地址切换要把包邮券清空 163 //地址切换要把包邮券清空
164 if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) { 164 if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) {
@@ -178,16 +178,16 @@ Page({ @@ -178,16 +178,16 @@ Page({
178 th.data.prom_goods_map = {}; 178 th.data.prom_goods_map = {};
179 th.data.is_summit_ing = 0; 179 th.data.is_summit_ing = 0;
180 //更换地址回来要重新调用计算价钱的接口 180 //更换地址回来要重新调用计算价钱的接口
181 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id){  
182 - th.setData({user_addr: ie});  
183 - th.setData({add_back: 1});  
184 - th.calculatePrice2(); 181 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  182 + th.setData({ user_addr: ie });
  183 + th.setData({ add_back: 1 });
  184 + th.calculatePrice2();
185 } else { 185 } else {
186 - th.setData({user_addr: ie}); 186 + th.setData({ user_addr: ie });
187 } 187 }
188 var going = 0; 188 var going = 0;
189 }); 189 });
190 - 190 +
191 var is_card_back = getApp().globalData.is_card_back; 191 var is_card_back = getApp().globalData.is_card_back;
192 //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 192 //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司
193 if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) { 193 if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) {
@@ -210,7 +210,7 @@ Page({ @@ -210,7 +210,7 @@ Page({
210 sales_rules: ee.sales_rules, 210 sales_rules: ee.sales_rules,
211 rank_switch: json_d.rank_switch, 211 rank_switch: json_d.rank_switch,
212 is_default_logistics: is_default_logistics, 212 is_default_logistics: is_default_logistics,
213 - sys_switch:json_d, 213 + sys_switch: json_d,
214 }); 214 });
215 215
216 var rank_switch = json_d.rank_switch; 216 var rank_switch = json_d.rank_switch;
@@ -223,34 +223,34 @@ Page({ @@ -223,34 +223,34 @@ Page({
223 //-- 获取所有的等级卡, -- 223 //-- 获取所有的等级卡, --
224 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 224 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
225 {}).then(res => { 225 {}).then(res => {
226 - if (res.data.code == 0) {  
227 - var plusCard = res.data.data;  
228 - //-- 循环判断,拿到最贵的那张卡 --  
229 - for (var ih in plusCard) {  
230 - if (plusCard[ih].IsStopBuy == true) {  
231 - continue;  
232 - }  
233 - if (max_price < 0) {  
234 - max_price = plusCard[ih].CardFee;  
235 - name = 'card' + plusCard[ih]['CorrPrice'];  
236 - show_card = plusCard[ih];  
237 - } else {  
238 - if (max_price < plusCard[ih].CardFee) { 226 + if (res.data.code == 0) {
  227 + var plusCard = res.data.data;
  228 + //-- 循环判断,拿到最贵的那张卡 --
  229 + for (var ih in plusCard) {
  230 + if (plusCard[ih].IsStopBuy == true) {
  231 + continue;
  232 + }
  233 + if (max_price < 0) {
239 max_price = plusCard[ih].CardFee; 234 max_price = plusCard[ih].CardFee;
240 name = 'card' + plusCard[ih]['CorrPrice']; 235 name = 'card' + plusCard[ih]['CorrPrice'];
241 show_card = plusCard[ih]; 236 show_card = plusCard[ih];
  237 + } else {
  238 + if (max_price < plusCard[ih].CardFee) {
  239 + max_price = plusCard[ih].CardFee;
  240 + name = 'card' + plusCard[ih]['CorrPrice'];
  241 + show_card = plusCard[ih];
  242 + }
242 } 243 }
243 } 244 }
244 - }  
245 245
246 - if (show_card) {  
247 - name = name.toLowerCase();  
248 - th.setData({card_name: name, show_card: show_card}) 246 + if (show_card) {
  247 + name = name.toLowerCase();
  248 + th.setData({ card_name: name, show_card: show_card })
  249 + }
249 } 250 }
250 - }  
251 - //-----先获取物流,再获取用户信息,再展示页面-----  
252 - th.get_wuliu(th.get_info(th.show_page));  
253 - }) 251 + //-----先获取物流,再获取用户信息,再展示页面-----
  252 + th.get_wuliu(th.get_info(th.show_page));
  253 + })
254 } else { 254 } else {
255 //-----先获取物流,再获取用户信息,再展示页面----- 255 //-----先获取物流,再获取用户信息,再展示页面-----
256 th.get_wuliu(th.get_info(th.show_page)); 256 th.get_wuliu(th.get_info(th.show_page));
@@ -270,10 +270,10 @@ Page({ @@ -270,10 +270,10 @@ Page({
270 if (th.data.is_default_logistics) { 270 if (th.data.is_default_logistics) {
271 //如果第一个不是开启默认,说明要让用户自己选 271 //如果第一个不是开启默认,说明要让用户自己选
272 if (!e[0].is_default) { 272 if (!e[0].is_default) {
273 - th.setData({is_default_logistics: 0}); 273 + th.setData({ is_default_logistics: 0 });
274 } 274 }
275 } 275 }
276 - th.setData({wu_arr: e}) 276 + th.setData({ wu_arr: e })
277 typeof func == "function" && func(); 277 typeof func == "function" && func();
278 }) 278 })
279 }, 279 },
@@ -287,9 +287,9 @@ Page({ @@ -287,9 +287,9 @@ Page({
287 getuser_addr: function (func) { 287 getuser_addr: function (func) {
288 var th = this; 288 var th = this;
289 a.get("/api/weshop/useraddress/page", { 289 a.get("/api/weshop/useraddress/page", {
290 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 290 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
291 success: function (su) { 291 success: function (su) {
292 - 292 +
293 var item = null; 293 var item = null;
294 if (su.data.code == 0 && su.data.data && su.data.data.pageData) { 294 if (su.data.code == 0 && su.data.data && su.data.data.pageData) {
295 var user_addr = su.data.data.pageData; 295 var user_addr = su.data.data.pageData;
@@ -308,7 +308,7 @@ Page({ @@ -308,7 +308,7 @@ Page({
308 } 308 }
309 309
310 if (item == undefined) item = null; 310 if (item == undefined) item = null;
311 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 311 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
312 312
313 func(item); 313 func(item);
314 } 314 }
@@ -336,7 +336,7 @@ Page({ @@ -336,7 +336,7 @@ Page({
336 }); 336 });
337 } 337 }
338 //获取立即购买的商品信息 338 //获取立即购买的商品信息
339 - th.get_buy_goods(th.data.order_id,th.data.order_sn); 339 + th.get_buy_goods(th.data.order_id, th.data.order_sn);
340 }); 340 });
341 //获取提现金额 341 //获取提现金额
342 getApp().request.get("/api/weshop/withdrawals/summoney", { 342 getApp().request.get("/api/weshop/withdrawals/summoney", {
@@ -360,30 +360,30 @@ Page({ @@ -360,30 +360,30 @@ Page({
360 }, 360 },
361 361
362 //-----获取商品------ 362 //-----获取商品------
363 - async get_buy_goods(ord,o_sn) { 363 + async get_buy_goods(ord, o_sn) {
364 var order = null, 364 var order = null,
365 order_goods = null, 365 order_goods = null,
366 goods = null, 366 goods = null,
367 pickup = null, 367 pickup = null,
368 distr_type = 0, 368 distr_type = 0,
369 exp_type = 0, 369 exp_type = 0,
370 - presell=null, //订单从表  
371 - pre_arr=null, //订单内容  
372 - act=null, //订单内容 370 + presell = null, //订单从表
  371 + pre_arr = null, //订单内容
  372 + act = null, //订单内容
373 th = this; 373 th = this;
374 374
375 375
376 - if(o_sn){ 376 + if (o_sn) {
377 //获取order信息根据订单编号order_sn 377 //获取order信息根据订单编号order_sn
378 await getApp().request.promiseGet("/api/weshop/order/page", { 378 await getApp().request.promiseGet("/api/weshop/order/page", {
379 - data: { store_id: os.stoid, order_sn: o_sn,} 379 + data: { store_id: os.stoid, order_sn: o_sn, }
380 }).then(res => { 380 }).then(res => {
381 order = res.data.data.pageData[0]; 381 order = res.data.data.pageData[0];
382 }) 382 })
383 383
384 384
385 - ord=order.order_id;  
386 - }else{ 385 + ord = order.order_id;
  386 + } else {
387 //---获取订单--- 387 //---获取订单---
388 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => { 388 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => {
389 order = res.data.data; 389 order = res.data.data;
@@ -399,94 +399,94 @@ Page({ @@ -399,94 +399,94 @@ Page({
399 order_goods = res.data.data.pageData[0]; 399 order_goods = res.data.data.pageData[0];
400 }); 400 });
401 401
402 - await getApp().request.promiseGet("/api/weshop/order/orderPresell/get/"+oo.stoid+"/"+order.order_id, {}).then(res => { 402 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/get/" + oo.stoid + "/" + order.order_id, {}).then(res => {
403 presell = res.data.data; 403 presell = res.data.data;
404 }); 404 });
405 405
406 //等待定金 406 //等待定金
407 - if(order.order_status<2 && presell.deposit_pay_time<=0 ){  
408 - th.setData({wait_dj:1}) 407 + if (order.order_status < 2 && presell.deposit_pay_time <= 0) {
  408 + th.setData({ wait_dj: 1 })
409 } 409 }
410 //等待尾款 410 //等待尾款
411 - if(order.order_status<2 && presell.deposit_pay_time>0 && presell.tail_pay_state==0 && presell.presell_type!=1){  
412 - th.setData({wait_wk:1})  
413 - wx.setNavigationBarTitle({title: "支付尾款",}) 411 + if (order.order_status < 2 && presell.deposit_pay_time > 0 && presell.tail_pay_state == 0 && presell.presell_type != 1) {
  412 + th.setData({ wait_wk: 1 })
  413 + wx.setNavigationBarTitle({ title: "支付尾款", })
414 } 414 }
415 //等待发货 415 //等待发货
416 - if(order.pay_status==1 && order.shipping_status==0){  
417 - th.setData({wait_fh:1}) 416 + if (order.pay_status == 1 && order.shipping_status == 0) {
  417 + th.setData({ wait_fh: 1 })
418 } 418 }
419 419
420 - if(order.pay_status==1 && order.shipping_status==1 && order.order_status<2){  
421 - th.setData({wait_sh:1}) 420 + if (order.pay_status == 1 && order.shipping_status == 1 && order.order_status < 2) {
  421 + th.setData({ wait_sh: 1 })
422 } 422 }
423 //------获取预售主表---------- 423 //------获取预售主表----------
424 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+presell.prom_id, {}).then(res => { 424 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + presell.prom_id, {}).then(res => {
425 if (res.data.code == 0 && res.data.data) { 425 if (res.data.code == 0 && res.data.data) {
426 - act=res.data.data; 426 + act = res.data.data;
427 427
428 th.setData({ 428 th.setData({
429 - act: res.data.data, 429 + act: res.data.data,
430 }); 430 });
431 } 431 }
432 }) 432 })
433 433
434 //-- 判断一下会员的身份 -- 434 //-- 判断一下会员的身份 --
435 - if(order.pay_status==0){  
436 - var pre_data = { store_id: os.stoid, presell_id: presell.prom_id,timetype: 12, goods_id: order_goods.goods_id }; 435 + if (order.pay_status == 0) {
  436 + var pre_data = { store_id: os.stoid, presell_id: presell.prom_id, timetype: 12, goods_id: order_goods.goods_id };
437 pre_data.user_id = order.user_id; 437 pre_data.user_id = order.user_id;
438 - var isok=1; 438 + var isok = 1;
439 await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { 439 await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
440 data: pre_data, 440 data: pre_data,
441 }).then(e => { 441 }).then(e => {
442 if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { 442 if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
443 pre_arr = e.data.data.pageData[0]; 443 pre_arr = e.data.data.pageData[0];
444 - }else{  
445 - isok=0; 444 + } else {
  445 + isok = 0;
446 } 446 }
447 }) 447 })
448 448
449 - if(!isok){ 449 + if (!isok) {
450 getApp().confirmBox("会员身份不符合"); 450 getApp().confirmBox("会员身份不符合");
451 return false; 451 return false;
452 } 452 }
453 453
454 - if(th.data.wait_dj){  
455 - if(act.is_end) { 454 + if (th.data.wait_dj) {
  455 + if (act.is_end) {
456 getApp().confirmBox("活动已经结束"); 456 getApp().confirmBox("活动已经结束");
457 return false; 457 return false;
458 } 458 }
459 - if(!act.isuse) { 459 + if (!act.isuse) {
460 getApp().confirmBox("活动未启用"); 460 getApp().confirmBox("活动未启用");
461 return false; 461 return false;
462 } 462 }
463 - if(th.data.act.end_time<ut.gettimestamp()) {  
464 - getApp().confirmBox("活动的定金时间已经结束",function () { 463 + if (th.data.act.end_time < ut.gettimestamp()) {
  464 + getApp().confirmBox("活动的定金时间已经结束", function () {
465 ut.wx_back(); 465 ut.wx_back();
466 }); 466 });
467 return false; 467 return false;
468 } 468 }
469 469
470 } 470 }
471 - if(th.data.wait_wk){  
472 - if(th.data.act.pay_enddate<ut.gettimestamp()) {  
473 - getApp().confirmBox("活动的尾款时间已经结束",function () { 471 + if (th.data.wait_wk) {
  472 + if (th.data.act.pay_enddate < ut.gettimestamp()) {
  473 + getApp().confirmBox("活动的尾款时间已经结束", function () {
474 ut.wx_back(); 474 ut.wx_back();
475 }); 475 });
476 return false; 476 return false;
477 } 477 }
478 } 478 }
479 } 479 }
480 - else{  
481 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/list",{  
482 - data:{store_id:os.stoid,goods_id:order_goods.goods_id,presell_id:order_goods.prom_id}  
483 - }).then(re=>{ 480 + else {
  481 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/list", {
  482 + data: { store_id: os.stoid, goods_id: order_goods.goods_id, presell_id: order_goods.prom_id }
  483 + }).then(re => {
484 if (re.data.code == 0 && re.data.data && re.data.data.length > 0) { 484 if (re.data.code == 0 && re.data.data && re.data.data.length > 0) {
485 pre_arr = re.data.data[0]; 485 pre_arr = re.data.data[0];
486 } 486 }
487 }) 487 })
488 488
489 - if(!pre_arr){ 489 + if (!pre_arr) {
490 getApp().confirmBox("未找到商品"); 490 getApp().confirmBox("未找到商品");
491 return false; 491 return false;
492 } 492 }
@@ -498,28 +498,29 @@ Page({ @@ -498,28 +498,29 @@ Page({
498 order.market_price = goods.market_price; 498 order.market_price = goods.market_price;
499 order.show_img = oo.imghost + goods.original_img; 499 order.show_img = oo.imghost + goods.original_img;
500 }); 500 });
501 -  
502 -  
503 - var g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&pre_id="+pre_arr.id;  
504 - if(act.is_end || th.data.act.end_time<ut.gettimestamp()) {  
505 -  
506 - if(goods.prom_type==8 && goods.prom_id==act.id){  
507 - g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;  
508 - getApp().request.put("/api/weshop/goods/update",  
509 - { data:{goods_id:order_goods.goods_id,store_id:os.stoid,prom_id:0,prom_type:0},  
510 - success: function(e) {}  
511 - });  
512 - }else{  
513 - g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;  
514 - if(goods.prom_type==8){  
515 - g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&prom_id="+goods.prom_id;  
516 - }  
517 -  
518 - }  
519 -  
520 - }  
521 -  
522 - 501 +
  502 +
  503 + var g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&pre_id=" + pre_arr.id;
  504 + if (act.is_end || th.data.act.end_time < ut.gettimestamp()) {
  505 +
  506 + if (goods.prom_type == 8 && goods.prom_id == act.id) {
  507 + g_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id;
  508 + getApp().request.put("/api/weshop/goods/update",
  509 + {
  510 + data: { goods_id: order_goods.goods_id, store_id: os.stoid, prom_id: 0, prom_type: 0 },
  511 + success: function (e) { }
  512 + });
  513 + } else {
  514 + g_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id;
  515 + if (goods.prom_type == 8) {
  516 + g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&prom_id=" + goods.prom_id;
  517 + }
  518 +
  519 + }
  520 +
  521 + }
  522 +
  523 +
523 //判断使用优惠券的接口需要 524 //判断使用优惠券的接口需要
524 th.data.check_quan_ware_list = goods.erpwareid; 525 th.data.check_quan_ware_list = goods.erpwareid;
525 //---获取门店--- 526 //---获取门店---
@@ -529,30 +530,32 @@ Page({ @@ -529,30 +530,32 @@ Page({
529 530
530 order['is_all_return'] = 0; 531 order['is_all_return'] = 0;
531 //------------对比一下有没有退款记录------------ 532 //------------对比一下有没有退款记录------------
532 - await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{  
533 - data: { order_id: order.order_id, store_id: oo.stoid,  
534 - user_id:order.user_id, pageSize: 200 }  
535 - }).then(rss=>{  
536 - var ttd=rss; 533 + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", {
  534 + data: {
  535 + order_id: order.order_id, store_id: oo.stoid,
  536 + user_id: order.user_id, pageSize: 200
  537 + }
  538 + }).then(rss => {
  539 + var ttd = rss;
537 //----没有相关的退款记录---- 540 //----没有相关的退款记录----
538 - if (ttd.data.data.total==0){ 541 + if (ttd.data.data.total == 0) {
539 order['is_all_return'] = 0; 542 order['is_all_return'] = 0;
540 - }else{ 543 + } else {
541 var eea = ttd.data.data.pageData[0]; 544 var eea = ttd.data.data.pageData[0];
542 //1.退款正在进行中, 545 //1.退款正在进行中,
543 //2.退款被拒绝就要显示可以退款 546 //2.退款被拒绝就要显示可以退款
544 //3.退款已经完成 547 //3.退款已经完成
545 - order['is_all_return']=1; 548 + order['is_all_return'] = 1;
546 order['is_all_return_status'] = ttd.data.data.pageData[0].status; 549 order['is_all_return_status'] = ttd.data.data.pageData[0].status;
547 550
548 if (order['order_status'] == 1 && order['pay_status'] == 1) { 551 if (order['order_status'] == 1 && order['pay_status'] == 1) {
549 switch (eea.status) { 552 switch (eea.status) {
550 case 0: 553 case 0:
551 case 1: 554 case 1:
552 - order.order_status_detail="退款中"; 555 + order.order_status_detail = "退款中";
553 order['return_btn'] = 2; break; 556 order['return_btn'] = 2; break;
554 case 2: 557 case 2:
555 - order.order_status_detail="退款完成"; 558 + order.order_status_detail = "退款完成";
556 order['return_btn'] = 4; break; 559 order['return_btn'] = 4; break;
557 case 3: 560 case 3:
558 order['return_btn'] = 3; break; 561 order['return_btn'] = 3; break;
@@ -563,8 +566,8 @@ Page({ @@ -563,8 +566,8 @@ Page({
563 } 566 }
564 }) 567 })
565 568
566 - var price=presell.presell_price;  
567 - if(!goods) return false; 569 + var price = presell.presell_price;
  570 + if (!goods) return false;
568 //--判断物流-- 571 //--判断物流--
569 if (goods.distr_type) 572 if (goods.distr_type)
570 distr_type = goods.distr_type; 573 distr_type = goods.distr_type;
@@ -587,50 +590,50 @@ Page({ @@ -587,50 +590,50 @@ Page({
587 } 590 }
588 591
589 //等待发货的时候 592 //等待发货的时候
590 - if(th.data.wait_fh){  
591 - var send_time=th.data.act.delivery_date;  
592 - if(th.data.act.delivery_type==2){  
593 - send_time=ut.gettimestamp()+th.data.act.delivery_daynum*3600*24;  
594 - } 593 + if (th.data.wait_fh) {
  594 + var send_time = th.data.act.delivery_date;
  595 + if (th.data.act.delivery_type == 2) {
  596 + send_time = ut.gettimestamp() + th.data.act.delivery_daynum * 3600 * 24;
  597 + }
595 } 598 }
596 599
597 order.order_goods = order_goods; 600 order.order_goods = order_goods;
598 - var tail_pay=pre_arr.presell_price*order_goods.goods_num-presell.presell_deposit; 601 + var tail_pay = pre_arr.presell_price * order_goods.goods_num - presell.presell_deposit;
599 this.setData({ 602 this.setData({
600 order: order, 603 order: order,
601 distr_type: distr_type, 604 distr_type: distr_type,
602 pickup: pickup, 605 pickup: pickup,
603 exp_type: exp_type, 606 exp_type: exp_type,
604 goods: goods, 607 goods: goods,
605 - presell:presell,  
606 - pre_arr:pre_arr,  
607 - show_submit:1,  
608 - userInfo:getApp().globalData.userInfo,  
609 - tail_pay:tail_pay,  
610 - order_goods:order_goods,  
611 - all_price:pre_arr.presell_price*order_goods.goods_num,  
612 - pickup_id:pickup.pickup_id,  
613 - send_time:send_time,  
614 - g_url:g_url 608 + presell: presell,
  609 + pre_arr: pre_arr,
  610 + show_submit: 1,
  611 + userInfo: getApp().globalData.userInfo,
  612 + tail_pay: tail_pay,
  613 + order_goods: order_goods,
  614 + all_price: pre_arr.presell_price * order_goods.goods_num,
  615 + pickup_id: pickup.pickup_id,
  616 + send_time: send_time,
  617 + g_url: g_url
615 }); 618 });
616 th.get_diff(); 619 th.get_diff();
617 //统一进行计算金额 620 //统一进行计算金额
618 th.calculatePrice2(); 621 th.calculatePrice2();
619 //如果可以 622 //如果可以
620 - if(th.data.act.is_usecoupon){ 623 + if (th.data.act.is_usecoupon) {
621 th.get_buy_now_quan(); 624 th.get_buy_now_quan();
622 } 625 }
623 }, 626 },
624 627
625 628
626 - async calculatePrice2(){  
627 - var th=this;  
628 - if(!this.data.pre_arr) return false; 629 + async calculatePrice2() {
  630 + var th = this;
  631 + if (!this.data.pre_arr) return false;
629 //--计算物流-- 632 //--计算物流--
630 if (this.data.exp_type == 0) { 633 if (this.data.exp_type == 0) {
631 this.calculate_wuliu(); 634 this.calculate_wuliu();
632 } else { 635 } else {
633 - var allpice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; 636 + var allpice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
634 allpice = allpice.toFixed(2); 637 allpice = allpice.toFixed(2);
635 //--看一下有没有订单优惠-- 638 //--看一下有没有订单优惠--
636 var o_condition = parseFloat(allpice); 639 var o_condition = parseFloat(allpice);
@@ -654,37 +657,37 @@ Page({ @@ -654,37 +657,37 @@ Page({
654 quan_price = res.data.data[0].WareCashSum; 657 quan_price = res.data.data[0].WareCashSum;
655 } 658 }
656 }) 659 })
657 - }else{  
658 - th.setData({quan_price:0});  
659 - if(th.data.using_quan && th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby==1){  
660 - var txt="using_quan["+bn_pick+"]";  
661 - th.setData({[txt]:{}}); 660 + } else {
  661 + th.setData({ quan_price: 0 });
  662 + if (th.data.using_quan && th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) {
  663 + var txt = "using_quan[" + bn_pick + "]";
  664 + th.setData({ [txt]: {} });
662 } 665 }
663 666
664 } 667 }
665 668
666 - if(quan_price>0){  
667 - if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price})  
668 - else {  
669 - th.setData({quan_price: th.data.tail_pay})  
670 - }  
671 - o_condition=o_condition-quan_price; 669 + if (quan_price > 0) {
  670 + if (quan_price < th.data.tail_pay) th.setData({ quan_price: quan_price })
  671 + else {
  672 + th.setData({ quan_price: th.data.tail_pay })
  673 + }
  674 + o_condition = o_condition - quan_price;
672 675
673 - }else{  
674 - th.setData({quan_price: 0}) 676 + } else {
  677 + th.setData({ quan_price: 0 })
675 } 678 }
676 - if(o_condition<0) o_condition=0; 679 + if (o_condition < 0) o_condition = 0;
677 680
678 //如果同意参与订单优惠 681 //如果同意参与订单优惠
679 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 682 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
680 th.check_is_order_prom(o_condition, function (ord_price) { 683 th.check_is_order_prom(o_condition, function (ord_price) {
681 - var bn_pick=th.data.pickup.pickup_id 684 + var bn_pick = th.data.pickup.pickup_id
682 var order_prom_amount = 0; 685 var order_prom_amount = 0;
683 var order_prom_id = 0; 686 var order_prom_id = 0;
684 - var o_condition1=0; 687 + var o_condition1 = 0;
685 if (th.data.order_prom[bn_pick]) { 688 if (th.data.order_prom[bn_pick]) {
686 var ord_prom = th.data.order_prom[bn_pick]; 689 var ord_prom = th.data.order_prom[bn_pick];
687 - if(!ord_prom.is_xz_yh || quan_price<=0) { 690 + if (!ord_prom.is_xz_yh || quan_price <= 0) {
688 order_prom_id = ord_prom['id']; 691 order_prom_id = ord_prom['id'];
689 switch (ord_prom['type']) { 692 switch (ord_prom['type']) {
690 case 0: 693 case 0:
@@ -703,19 +706,19 @@ Page({ @@ -703,19 +706,19 @@ Page({
703 var order_prom_txt1 = "order_prom_id"; 706 var order_prom_txt1 = "order_prom_id";
704 var order_prom_txt2 = "order_prom_amount"; 707 var order_prom_txt2 = "order_prom_amount";
705 if (order_prom_id > 0) { 708 if (order_prom_id > 0) {
706 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
707 - }else{  
708 - o_condition1=ord_price;  
709 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 709 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  710 + } else {
  711 + o_condition1 = ord_price;
  712 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
710 } 713 }
711 -  
712 - o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit);  
713 - if(o_condition1<0) o_condition1=0;  
714 - th.setData({ exp_price: 0, order_m: o_condition1 }) 714 +
  715 + o_condition1 = parseFloat(o_condition1) - parseFloat(th.data.presell.presell_deposit);
  716 + if (o_condition1 < 0) o_condition1 = 0;
  717 + th.setData({ exp_price: 0, order_m: o_condition1 })
715 }) 718 })
716 - }else{  
717 - o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);  
718 - if(o_condition<0) o_condition=0; 719 + } else {
  720 + o_condition = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit);
  721 + if (o_condition < 0) o_condition = 0;
719 th.setData({ exp_price: 0, order_m: o_condition }) 722 th.setData({ exp_price: 0, order_m: o_condition })
720 } 723 }
721 } 724 }
@@ -725,14 +728,14 @@ Page({ @@ -725,14 +728,14 @@ Page({
725 checkAddressList: function () { 728 checkAddressList: function () {
726 var t = this; 729 var t = this;
727 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 730 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
728 - title: "请先填写或选择收货地址~",  
729 - success: function (a) {  
730 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
731 - },  
732 - fail: function () {  
733 - wx.navigateBack();  
734 - }  
735 - }), !1); 731 + title: "请先填写或选择收货地址~",
  732 + success: function (a) {
  733 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  734 + },
  735 + fail: function () {
  736 + wx.navigateBack();
  737 + }
  738 + }), !1);
736 }, 739 },
737 showInvoice: function () { 740 showInvoice: function () {
738 this.setData({ 741 this.setData({
@@ -752,7 +755,7 @@ Page({ @@ -752,7 +755,7 @@ Page({
752 keyUpChangeNum: function (t) { 755 keyUpChangeNum: function (t) {
753 this.setData({ 756 this.setData({
754 maxWord: t.detail.value.length, 757 maxWord: t.detail.value.length,
755 - user_note:t.detail.value 758 + user_note: t.detail.value
756 }); 759 });
757 }, 760 },
758 761
@@ -781,7 +784,7 @@ Page({ @@ -781,7 +784,7 @@ Page({
781 } 784 }
782 } 785 }
783 var set_txt = "cartlist[" + iter + "].can_num"; 786 var set_txt = "cartlist[" + iter + "].can_num";
784 - th.setData({[set_txt]: num}); 787 + th.setData({ [set_txt]: num });
785 } 788 }
786 }, 789 },
787 useCoupon: function () { 790 useCoupon: function () {
@@ -798,7 +801,7 @@ Page({ @@ -798,7 +801,7 @@ Page({
798 }); 801 });
799 }, 802 },
800 enterAddressPage: function () { 803 enterAddressPage: function () {
801 - if(!this.data.wait_wk) return false; 804 + if (!this.data.wait_wk) return false;
802 805
803 getApp().globalData.is_cart_old = 1; 806 getApp().globalData.is_cart_old = 1;
804 this.data.isget_by_quan = {}; 807 this.data.isget_by_quan = {};
@@ -811,9 +814,9 @@ Page({ @@ -811,9 +814,9 @@ Page({
811 setexptype: function (t) { 814 setexptype: function (t) {
812 var th = this; 815 var th = this;
813 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 816 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
814 - th.setData({bn_exp_type: ty}); 817 + th.setData({ bn_exp_type: ty });
815 if (ty == 0) { 818 if (ty == 0) {
816 - th.setData({is_all_zt: 0}); 819 + th.setData({ is_all_zt: 0 });
817 } 820 }
818 821
819 //当物流为空的时候。 822 //当物流为空的时候。
@@ -826,7 +829,7 @@ Page({ @@ -826,7 +829,7 @@ Page({
826 if (ty == 1) { 829 if (ty == 1) {
827 th.data.isget_by_quan = {}; 830 th.data.isget_by_quan = {};
828 if (th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) { 831 if (th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) {
829 - th.setData({using_quan: {}}); 832 + th.setData({ using_quan: {} });
830 } 833 }
831 } 834 }
832 835
@@ -836,7 +839,7 @@ Page({ @@ -836,7 +839,7 @@ Page({
836 if (wu_arr != null && wu_arr != "") { 839 if (wu_arr != null && wu_arr != "") {
837 for (var i = 0; i < wu_arr.length; i++) { 840 for (var i = 0; i < wu_arr.length; i++) {
838 if (wu_arr[i].shipping_code == def_exp_code) { 841 if (wu_arr[i].shipping_code == def_exp_code) {
839 - th.setData({index: i}); 842 + th.setData({ index: i });
840 } 843 }
841 } 844 }
842 } 845 }
@@ -848,16 +851,16 @@ Page({ @@ -848,16 +851,16 @@ Page({
848 //--------立即购买时,使用余额-------- 851 //--------立即购买时,使用余额--------
849 set_bn_useyuer: function () { 852 set_bn_useyuer: function () {
850 var th = this; 853 var th = this;
851 - th.setData({bn_use_money: !th.data.bn_use_money}); 854 + th.setData({ bn_use_money: !th.data.bn_use_money });
852 th.calculatePrice2(); 855 th.calculatePrice2();
853 }, 856 },
854 - //-------------------计算物流---------------  
855 - calculatewuliu: function (code, o_shipping_price, goods_weight,  
856 - goods_piece, user_addr, freight_free, o_price, rs) { 857 + //-----------------计算物流-------------
  858 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  859 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
857 var price = 0, th = this; 860 var price = 0, th = this;
858 price += parseFloat(o_shipping_price); 861 price += parseFloat(o_shipping_price);
859 //如果是包邮 862 //如果是包邮
860 - if (freight_free > 0 && o_price >= freight_free) { 863 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
861 return 0; 864 return 0;
862 } 865 }
863 if (user_addr == null) { 866 if (user_addr == null) {
@@ -883,6 +886,16 @@ Page({ @@ -883,6 +886,16 @@ Page({
883 fw_price = fw_price + n * parseFloat(item['add_money']); 886 fw_price = fw_price + n * parseFloat(item['add_money']);
884 } 887 }
885 } 888 }
  889 + //------超出重量----------
  890 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
  891 + fw_price = parseFloat(item['money']);
  892 + var out_of_weight = Math.abs(out_of_weight);
  893 + if (out_of_weight > item['first_weight']) {
  894 + var fw = out_of_weight - item['first_weight'];
  895 + var n = Math.ceil(fw / item['second_weight'])
  896 + fw_price = fw_price + n * parseFloat(item['add_money']);
  897 + }
  898 + }
886 //------按件数---------- 899 //------按件数----------
887 if (goods_piece > 0 && item['piecemoney']) { 900 if (goods_piece > 0 && item['piecemoney']) {
888 fp_price = parseFloat(item['piecemoney']); 901 fp_price = parseFloat(item['piecemoney']);
@@ -920,7 +933,7 @@ Page({ @@ -920,7 +933,7 @@ Page({
920 //----------立即购买,选择物流------------- 933 //----------立即购买,选择物流-------------
921 bindPickerChange: function (e) { 934 bindPickerChange: function (e) {
922 var ind = e.detail.value 935 var ind = e.detail.value
923 - this.setData({index: ind}); 936 + this.setData({ index: ind });
924 this.calculatePrice2(); 937 this.calculatePrice2();
925 }, 938 },
926 /*----券的所有操作----*/ 939 /*----券的所有操作----*/
@@ -933,7 +946,7 @@ Page({ @@ -933,7 +946,7 @@ Page({
933 946
934 947
935 if (bn == 1) { 948 if (bn == 1) {
936 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 949 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
937 } else { 950 } else {
938 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 951 //---多单打开券的时候,就要判断券在其他门店是否有使用---
939 var quanlist = th.data.cartlist[cindx].quan_list; 952 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -959,9 +972,9 @@ Page({ @@ -959,9 +972,9 @@ Page({
959 else 972 else
960 get_by_quan_list_cart[i].show_red = 0; 973 get_by_quan_list_cart[i].show_red = 0;
961 } 974 }
962 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 975 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
963 } else { 976 } else {
964 - th.setData({by_quan_list_cart: null}); 977 + th.setData({ by_quan_list_cart: null });
965 } 978 }
966 979
967 th.setData({ 980 th.setData({
@@ -976,7 +989,7 @@ Page({ @@ -976,7 +989,7 @@ Page({
976 }, 989 },
977 close_coupon: function (e) { 990 close_coupon: function (e) {
978 var th = this; 991 var th = this;
979 - th.setData({open_quan: 0, disabled: 0}); 992 + th.setData({ open_quan: 0, disabled: 0 });
980 }, 993 },
981 994
982 //---判断券时候在已经选择的列表中--- 995 //---判断券时候在已经选择的列表中---
@@ -1006,14 +1019,14 @@ Page({ @@ -1006,14 +1019,14 @@ Page({
1006 for (var i in quanlist) { 1019 for (var i in quanlist) {
1007 quanlist[i].show_red = 0; 1020 quanlist[i].show_red = 0;
1008 } 1021 }
1009 - this.setData({selected_quan_list: quanlist}); 1022 + this.setData({ selected_quan_list: quanlist });
1010 var by_quanlist = this.data.get_by_quan_list; 1023 var by_quanlist = this.data.get_by_quan_list;
1011 if (by_quanlist) { 1024 if (by_quanlist) {
1012 //---所有的券的显示红色选择都清理一遍--- 1025 //---所有的券的显示红色选择都清理一遍---
1013 for (var inb in by_quanlist) { 1026 for (var inb in by_quanlist) {
1014 by_quanlist[inb].show_red = 0; 1027 by_quanlist[inb].show_red = 0;
1015 } 1028 }
1016 - this.setData({get_by_quan_list: by_quanlist}); 1029 + this.setData({ get_by_quan_list: by_quanlist });
1017 } 1030 }
1018 1031
1019 var by_cart_list = this.data.by_quan_list_cart; 1032 var by_cart_list = this.data.by_quan_list_cart;
@@ -1022,7 +1035,7 @@ Page({ @@ -1022,7 +1035,7 @@ Page({
1022 for (var inc in by_cart_list) { 1035 for (var inc in by_cart_list) {
1023 by_cart_list[inc].show_red = 0; 1036 by_cart_list[inc].show_red = 0;
1024 } 1037 }
1025 - this.setData({by_quan_list_cart: by_cart_list}); 1038 + this.setData({ by_quan_list_cart: by_cart_list });
1026 } 1039 }
1027 1040
1028 var using_quan = this.data.using_quan; 1041 var using_quan = this.data.using_quan;
@@ -1033,9 +1046,9 @@ Page({ @@ -1033,9 +1046,9 @@ Page({
1033 using_quan[pickid].is_nouse_red = 1; 1046 using_quan[pickid].is_nouse_red = 1;
1034 } 1047 }
1035 else { 1048 else {
1036 - using_quan[pickid] = {is_nouse_red: 1}; 1049 + using_quan[pickid] = { is_nouse_red: 1 };
1037 } 1050 }
1038 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1051 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1039 return; 1052 return;
1040 } 1053 }
1041 1054
@@ -1052,9 +1065,9 @@ Page({ @@ -1052,9 +1065,9 @@ Page({
1052 using_quan[pickid].is_nouse_red = 0; 1065 using_quan[pickid].is_nouse_red = 0;
1053 } 1066 }
1054 else { 1067 else {
1055 - using_quan[pickid] = {is_nouse_red: 0}; 1068 + using_quan[pickid] = { is_nouse_red: 0 };
1056 } 1069 }
1057 - this.setData({using_quan: using_quan}); 1070 + this.setData({ using_quan: using_quan });
1058 1071
1059 }, 1072 },
1060 /*----- 点击选择包邮券 -----*/ 1073 /*----- 点击选择包邮券 -----*/
@@ -1067,7 +1080,7 @@ Page({ @@ -1067,7 +1080,7 @@ Page({
1067 for (var ind in by_quanlist) { 1080 for (var ind in by_quanlist) {
1068 by_quanlist[ind].show_red = 0; 1081 by_quanlist[ind].show_red = 0;
1069 } 1082 }
1070 - this.setData({get_by_quan_list: by_quanlist}); 1083 + this.setData({ get_by_quan_list: by_quanlist });
1071 } 1084 }
1072 1085
1073 //--购物车过来的包邮券-- 1086 //--购物车过来的包邮券--
@@ -1077,7 +1090,7 @@ Page({ @@ -1077,7 +1090,7 @@ Page({
1077 for (var ind in by_cart_list) { 1090 for (var ind in by_cart_list) {
1078 by_cart_list[ind].show_red = 0; 1091 by_cart_list[ind].show_red = 0;
1079 } 1092 }
1080 - this.setData({by_quan_list_cart: by_cart_list}); 1093 + this.setData({ by_quan_list_cart: by_cart_list });
1081 } 1094 }
1082 //普通券 1095 //普通券
1083 var quanlist = this.data.selected_quan_list; 1096 var quanlist = this.data.selected_quan_list;
@@ -1086,7 +1099,7 @@ Page({ @@ -1086,7 +1099,7 @@ Page({
1086 for (var ind in quanlist) { 1099 for (var ind in quanlist) {
1087 quanlist[ind].show_red = 0; 1100 quanlist[ind].show_red = 0;
1088 } 1101 }
1089 - this.setData({selected_quan_list: quanlist}); 1102 + this.setData({ selected_quan_list: quanlist });
1090 } 1103 }
1091 1104
1092 var th = this; 1105 var th = this;
@@ -1097,9 +1110,9 @@ Page({ @@ -1097,9 +1110,9 @@ Page({
1097 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1110 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1098 } 1111 }
1099 else { 1112 else {
1100 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1113 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1101 } 1114 }
1102 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1115 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1103 return; 1116 return;
1104 } 1117 }
1105 1118
@@ -1110,20 +1123,20 @@ Page({ @@ -1110,20 +1123,20 @@ Page({
1110 var txt1 = ""; 1123 var txt1 = "";
1111 var quan_item = null; 1124 var quan_item = null;
1112 1125
1113 - quan_item = this.data.get_by_quan_list[ind];  
1114 - txt = "get_by_quan_list[" + ind + "].show_red";  
1115 - var obj = {};  
1116 - obj[txt] = 1;  
1117 - this.setData(obj); 1126 + quan_item = this.data.get_by_quan_list[ind];
  1127 + txt = "get_by_quan_list[" + ind + "].show_red";
  1128 + var obj = {};
  1129 + obj[txt] = 1;
  1130 + this.setData(obj);
1118 1131
1119 1132
1120 if (using_quan[th.data.selected_quan_pick]) { 1133 if (using_quan[th.data.selected_quan_pick]) {
1121 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 1134 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
1122 } 1135 }
1123 else { 1136 else {
1124 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 1137 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
1125 } 1138 }
1126 - this.setData({using_quan: using_quan}); 1139 + this.setData({ using_quan: using_quan });
1127 }, 1140 },
1128 //--确认使用券--- 1141 //--确认使用券---
1129 confirm_quan: function () { 1142 confirm_quan: function () {
@@ -1180,10 +1193,10 @@ Page({ @@ -1180,10 +1193,10 @@ Page({
1180 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 1193 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
1181 if (using_quan[pickid]) { 1194 if (using_quan[pickid]) {
1182 if (using_quan[pickid].is_nouse_red == 1) { 1195 if (using_quan[pickid].is_nouse_red == 1) {
1183 - using_quan[pickid] = {is_nouse_red: 1}; 1196 + using_quan[pickid] = { is_nouse_red: 1 };
1184 th.calculatePrice2(); 1197 th.calculatePrice2();
1185 - th.setData({open_quan: 0});  
1186 - th.setData({using_quan: using_quan}); 1198 + th.setData({ open_quan: 0 });
  1199 + th.setData({ using_quan: using_quan });
1187 } 1200 }
1188 } 1201 }
1189 1202
@@ -1204,12 +1217,12 @@ Page({ @@ -1204,12 +1217,12 @@ Page({
1204 }; 1217 };
1205 using_quan[pickid].isby = 1; 1218 using_quan[pickid].isby = 1;
1206 } else { 1219 } else {
1207 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 1220 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
1208 using_quan[pickid].isby = 0; 1221 using_quan[pickid].isby = 0;
1209 } 1222 }
1210 - this.setData({using_quan: using_quan}); 1223 + this.setData({ using_quan: using_quan });
1211 th.calculatePrice2(); 1224 th.calculatePrice2();
1212 - th.setData({open_quan: 0}); 1225 + th.setData({ open_quan: 0 });
1213 }, 1226 },
1214 1227
1215 cart_set_err: function (e) { 1228 cart_set_err: function (e) {
@@ -1246,7 +1259,7 @@ Page({ @@ -1246,7 +1259,7 @@ Page({
1246 var wu_arr_txt = e.currentTarget.dataset.txt; 1259 var wu_arr_txt = e.currentTarget.dataset.txt;
1247 var w_sele_index = e.currentTarget.dataset.w_sele_index; 1260 var w_sele_index = e.currentTarget.dataset.w_sele_index;
1248 var is_express = null; 1261 var is_express = null;
1249 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 1262 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
1250 1263
1251 //--如果是多个门店的时候-- 1264 //--如果是多个门店的时候--
1252 if (w_sele_index != undefined) { 1265 if (w_sele_index != undefined) {
@@ -1257,21 +1270,21 @@ Page({ @@ -1257,21 +1270,21 @@ Page({
1257 }, 1270 },
1258 // 关闭物流的弹窗 1271 // 关闭物流的弹窗
1259 close_express: function () { 1272 close_express: function () {
1260 - this.setData({open_express: 0, disabled: 0}); 1273 + this.setData({ open_express: 0, disabled: 0 });
1261 }, 1274 },
1262 // 选择物流 1275 // 选择物流
1263 click_express_name: function (e) { 1276 click_express_name: function (e) {
1264 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 1277 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
1265 var index = e.currentTarget.dataset.idxe; 1278 var index = e.currentTarget.dataset.idxe;
1266 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 1279 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
1267 ob[this.data.wu_arr_txt] = index; 1280 ob[this.data.wu_arr_txt] = index;
1268 this.setData(ob); 1281 this.setData(ob);
1269 }, 1282 },
1270 1283
1271 //点击确定物流 1284 //点击确定物流
1272 determine_expres: function (e) { 1285 determine_expres: function (e) {
1273 - this.setData({open_express: 0});  
1274 - this.calculatePrice2(); 1286 + this.setData({ open_express: 0 });
  1287 + this.calculatePrice2();
1275 }, 1288 },
1276 1289
1277 //点击打开优惠券使用说明 1290 //点击打开优惠券使用说明
@@ -1287,7 +1300,7 @@ Page({ @@ -1287,7 +1300,7 @@ Page({
1287 obj[txt] = is_open; 1300 obj[txt] = is_open;
1288 1301
1289 this.setData(obj); 1302 this.setData(obj);
1290 - this.setData({disabled: 1}) 1303 + this.setData({ disabled: 1 })
1291 }, 1304 },
1292 1305
1293 clik_coupons2: function (e) { 1306 clik_coupons2: function (e) {
@@ -1302,7 +1315,7 @@ Page({ @@ -1302,7 +1315,7 @@ Page({
1302 obj[txt] = is_open; 1315 obj[txt] = is_open;
1303 1316
1304 this.setData(obj); 1317 this.setData(obj);
1305 - this.setData({disabled: 1}) 1318 + this.setData({ disabled: 1 })
1306 }, 1319 },
1307 1320
1308 1321
@@ -1311,11 +1324,11 @@ Page({ @@ -1311,11 +1324,11 @@ Page({
1311 var th = this; 1324 var th = this;
1312 var is_shipping_code = this.data.is_shipping_code 1325 var is_shipping_code = this.data.is_shipping_code
1313 getApp().request.put("/api/weshop/users/update", { 1326 getApp().request.put("/api/weshop/users/update", {
1314 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 1327 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
1315 success: function (rse) { 1328 success: function (rse) {
1316 if (rse.data.code == 0) { 1329 if (rse.data.code == 0) {
1317 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 1330 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
1318 - th.setData({open_express: 0}); 1331 + th.setData({ open_express: 0 });
1319 //----计算此时购物车的价格---- 1332 //----计算此时购物车的价格----
1320 th.calculatePrice2(); 1333 th.calculatePrice2();
1321 1334
@@ -1325,7 +1338,7 @@ Page({ @@ -1325,7 +1338,7 @@ Page({
1325 }, 1338 },
1326 1339
1327 //更新下默认,在onshow里面 1340 //更新下默认,在onshow里面
1328 - update_code(){ 1341 + update_code() {
1329 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 1342 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
1330 //--定时器,判断wu_arr不未空-- 1343 //--定时器,判断wu_arr不未空--
1331 var uii = setInterval(function () { 1344 var uii = setInterval(function () {
@@ -1339,7 +1352,7 @@ Page({ @@ -1339,7 +1352,7 @@ Page({
1339 } 1352 }
1340 //--如果是立即购买-- 1353 //--如果是立即购买--
1341 if (th.data.is_b_now == 1) { 1354 if (th.data.is_b_now == 1) {
1342 - th.setData({index: m_wind, is_express: m_wind}); 1355 + th.setData({ index: m_wind, is_express: m_wind });
1343 } else { 1356 } else {
1344 var ui = setInterval(function () { 1357 var ui = setInterval(function () {
1345 if (th.data.cartlist) { 1358 if (th.data.cartlist) {
@@ -1347,7 +1360,7 @@ Page({ @@ -1347,7 +1360,7 @@ Page({
1347 for (var i in c_arr) { 1360 for (var i in c_arr) {
1348 c_arr[i].wind = m_wind; 1361 c_arr[i].wind = m_wind;
1349 } 1362 }
1350 - th.setData({cartlist: c_arr, is_express: m_wind}) 1363 + th.setData({ cartlist: c_arr, is_express: m_wind })
1351 clearInterval(ui); 1364 clearInterval(ui);
1352 } 1365 }
1353 }, 500) 1366 }, 500)
@@ -1448,10 +1461,10 @@ Page({ @@ -1448,10 +1461,10 @@ Page({
1448 if (th.data.is_b_now) { 1461 if (th.data.is_b_now) {
1449 if (arr && arr.length > 0) { 1462 if (arr && arr.length > 0) {
1450 var quanlist = arr[0].quan_list; 1463 var quanlist = arr[0].quan_list;
1451 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 1464 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
1452 } 1465 }
1453 } else { 1466 } else {
1454 - th.setData({cartlist: arr}) 1467 + th.setData({ cartlist: arr })
1455 th.set_can_num(); 1468 th.set_can_num();
1456 } 1469 }
1457 }, 1470 },
@@ -1459,14 +1472,14 @@ Page({ @@ -1459,14 +1472,14 @@ Page({
1459 //------ 获取立即购买的购物车的劵 -------- 1472 //------ 获取立即购买的购物车的劵 --------
1460 get_buy_now_quan: function () { 1473 get_buy_now_quan: function () {
1461 var quanlist = null, th = this, frozenQuan = null; 1474 var quanlist = null, th = this, frozenQuan = null;
1462 - var allprice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; 1475 + var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
1463 th.data.ckeck_quan_price = allprice; 1476 th.data.ckeck_quan_price = allprice;
1464 1477
1465 //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- 1478 //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券--
1466 if (th.data.is_close_quan != 1) { 1479 if (th.data.is_close_quan != 1) {
1467 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 1480 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1468 var url = "/api/weshop/couponList/getUseCouponList"; 1481 var url = "/api/weshop/couponList/getUseCouponList";
1469 - app.request.promiseGet(url0, {1: 1}).then(res => { 1482 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
1470 if (res.data.code == 0) { 1483 if (res.data.code == 0) {
1471 frozenQuan = res.data.data; 1484 frozenQuan = res.data.data;
1472 th.data.frozenQuan = frozenQuan; 1485 th.data.frozenQuan = frozenQuan;
@@ -1484,7 +1497,7 @@ Page({ @@ -1484,7 +1497,7 @@ Page({
1484 quanlist = res.data.data.pageData; 1497 quanlist = res.data.data.pageData;
1485 if (quanlist) { 1498 if (quanlist) {
1486 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 1499 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
1487 - th.setData({selected_quan_list: quanlist}) 1500 + th.setData({ selected_quan_list: quanlist })
1488 } 1501 }
1489 } 1502 }
1490 } 1503 }
@@ -1512,7 +1525,7 @@ Page({ @@ -1512,7 +1525,7 @@ Page({
1512 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 1525 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
1513 for (var i in arr) { 1526 for (var i in arr) {
1514 var item = arr[i]; 1527 var item = arr[i];
1515 - if (goods_id == item) return 0; 1528 + if (goods_id == item) return 0;
1516 } 1529 }
1517 return 1; 1530 return 1;
1518 }, 1531 },
@@ -1534,14 +1547,14 @@ Page({ @@ -1534,14 +1547,14 @@ Page({
1534 pick = this.data.pickup.pickup_id; 1547 pick = this.data.pickup.pickup_id;
1535 //---获取订单优惠--- 1548 //---获取订单优惠---
1536 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 1549 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
1537 - data: {store_id: os.stoid, orderAmount: condition} 1550 + data: { store_id: os.stoid, orderAmount: condition }
1538 }).then(res => { 1551 }).then(res => {
1539 if (res.data.code == 0) { 1552 if (res.data.code == 0) {
1540 var data = res.data.data; 1553 var data = res.data.data;
1541 th.data.order_prom[pick] = data; 1554 th.data.order_prom[pick] = data;
1542 - }else{  
1543 - th.data.order_prom[pick] = null;  
1544 - } 1555 + } else {
  1556 + th.data.order_prom[pick] = null;
  1557 + }
1545 func(condition); 1558 func(condition);
1546 }) 1559 })
1547 }, 1560 },
@@ -1558,7 +1571,7 @@ Page({ @@ -1558,7 +1571,7 @@ Page({
1558 var ob = map[pickid][item.prom_id]; 1571 var ob = map[pickid][item.prom_id];
1559 ob.price += item.goods_price * item.goods_num; 1572 ob.price += item.goods_price * item.goods_num;
1560 ob.goods_num += item.goods_num; 1573 ob.goods_num += item.goods_num;
1561 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1574 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1562 1575
1563 } else { 1576 } else {
1564 var prom = null; 1577 var prom = null;
@@ -1574,7 +1587,7 @@ Page({ @@ -1574,7 +1587,7 @@ Page({
1574 ob.is_bz = prom.is_bz; 1587 ob.is_bz = prom.is_bz;
1575 ob.is_xz_yh = prom.is_xz_yh; 1588 ob.is_xz_yh = prom.is_xz_yh;
1576 ob.goods = new Array(); 1589 ob.goods = new Array();
1577 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1590 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1578 map[pickid][item.prom_id] = ob; 1591 map[pickid][item.prom_id] = ob;
1579 } 1592 }
1580 } else { 1593 } else {
@@ -1591,7 +1604,7 @@ Page({ @@ -1591,7 +1604,7 @@ Page({
1591 ob.is_bz = prom.is_bz; 1604 ob.is_bz = prom.is_bz;
1592 ob.is_xz_yh = prom.is_xz_yh; 1605 ob.is_xz_yh = prom.is_xz_yh;
1593 ob.goods = new Array(); 1606 ob.goods = new Array();
1594 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1607 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1595 1608
1596 var obj = {}; 1609 var obj = {};
1597 obj[item.prom_id] = ob; 1610 obj[item.prom_id] = ob;
@@ -1635,6 +1648,7 @@ Page({ @@ -1635,6 +1648,7 @@ Page({
1635 if (no_by_data && no_by_data.region_list) { 1648 if (no_by_data && no_by_data.region_list) {
1636 if (th.check_by_area(no_by_data.region_list)) { 1649 if (th.check_by_area(no_by_data.region_list)) {
1637 gift_freight_free = 0; 1650 gift_freight_free = 0;
  1651 + out_of_weight = 0;
1638 th.data.is_no_by[bn_pick] = 1; 1652 th.data.is_no_by[bn_pick] = 1;
1639 } 1653 }
1640 } 1654 }
@@ -1642,12 +1656,14 @@ Page({ @@ -1642,12 +1656,14 @@ Page({
1642 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 1656 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
1643 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 1657 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
1644 gift_freight_free = 0; 1658 gift_freight_free = 0;
  1659 + out_of_weight = 0;
  1660 + th.data.is_no_by[bn_pick] = 1;
1645 } 1661 }
1646 } 1662 }
1647 1663
1648 var t_shipping_price = 1664 var t_shipping_price =
1649 - this.calculatewuliu(code, gift_shipping_price, goods_weight,  
1650 - goods_piece, user_addr, gift_freight_free, allpice, rs); 1665 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  1666 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
1651 return t_shipping_price; 1667 return t_shipping_price;
1652 1668
1653 }, 1669 },
@@ -1707,12 +1723,15 @@ Page({ @@ -1707,12 +1723,15 @@ Page({
1707 goods_weight = -1, 1723 goods_weight = -1,
1708 goods_piece = -1, 1724 goods_piece = -1,
1709 good = th.data.goods, 1725 good = th.data.goods,
1710 - quan_price=0,  
1711 - exp_price=0; 1726 + quan_price = 0,
  1727 + exp_price = 0;
1712 1728
1713 var quan_no = null; 1729 var quan_no = null;
1714 - var bn_pick=th.data.pickup.pickup_id;  
1715 - var allpice =th.data.all_price; 1730 + var bn_pick = th.data.pickup.pickup_id;
  1731 + var allpice = th.data.all_price;
  1732 + var out_of_weight = null; //超出多少重量
  1733 + var freight_free = ee.freight_free; //全场满多少包邮
  1734 + var weight_free = ee.weight_free; //多少kg内包邮
1716 1735
1717 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) 1736 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
1718 quan_no = th.data.using_quan[bn_pick].coupon_no; 1737 quan_no = th.data.using_quan[bn_pick].coupon_no;
@@ -1734,19 +1753,19 @@ Page({ @@ -1734,19 +1753,19 @@ Page({
1734 }) 1753 })
1735 1754
1736 if (quan_price > 0) { 1755 if (quan_price > 0) {
1737 - if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price}) 1756 + if (quan_price < th.data.tail_pay) th.setData({ quan_price: quan_price })
1738 else { 1757 else {
1739 - th.setData({quan_price: th.data.tail_pay}) 1758 + th.setData({ quan_price: th.data.tail_pay })
1740 quan_price = th.data.tail_pay; 1759 quan_price = th.data.tail_pay;
1741 } 1760 }
1742 } else { 1761 } else {
1743 - th.setData({quan_price: 0}) 1762 + th.setData({ quan_price: 0 })
1744 } 1763 }
1745 - }else{  
1746 - th.setData({quan_price: 0}) 1764 + } else {
  1765 + th.setData({ quan_price: 0 })
1747 } 1766 }
1748 - }else{  
1749 - th.setData({quan_price: 0}) 1767 + } else {
  1768 + th.setData({ quan_price: 0 })
1750 } 1769 }
1751 1770
1752 //-----------当地址不为空,且是物流时,计算物流费用---------- 1771 //-----------当地址不为空,且是物流时,计算物流费用----------
@@ -1775,15 +1794,15 @@ Page({ @@ -1775,15 +1794,15 @@ Page({
1775 arr.push(item); 1794 arr.push(item);
1776 } 1795 }
1777 if (arr) { 1796 if (arr) {
1778 - th.setData({get_by_quan_list: arr}); 1797 + th.setData({ get_by_quan_list: arr });
1779 } 1798 }
1780 th.data.isget_by_quan[bn_pick] = 1; 1799 th.data.isget_by_quan[bn_pick] = 1;
1781 } 1800 }
1782 }) 1801 })
1783 } 1802 }
1784 if (quan_no && th.data.using_quan[bn_pick].isby == 1) { 1803 if (quan_no && th.data.using_quan[bn_pick].isby == 1) {
1785 - exp_price=0;  
1786 - }else{ 1804 + exp_price = 0;
  1805 + } else {
1787 switch (good['exp_sum_type']) { 1806 switch (good['exp_sum_type']) {
1788 case 1: 1807 case 1:
1789 //统一运费 1808 //统一运费
@@ -1793,6 +1812,9 @@ Page({ @@ -1793,6 +1812,9 @@ Page({
1793 if (goods_weight < 0) goods_weight = 0; 1812 if (goods_weight < 0) goods_weight = 0;
1794 //累积商品重量 每种商品的重量 * 数量 1813 //累积商品重量 每种商品的重量 * 数量
1795 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 1814 goods_weight += good['weight'] * th.data.order.order_goods['goods_num'];
  1815 + if (weight_free > 0) {
  1816 + out_of_weight = (weight_free * 1000) - goods_weight;
  1817 + }
1796 break; 1818 break;
1797 case 3: 1819 case 3:
1798 if (goods_piece < 0) goods_piece = 0; 1820 if (goods_piece < 0) goods_piece = 0;
@@ -1802,35 +1824,34 @@ Page({ @@ -1802,35 +1824,34 @@ Page({
1802 } 1824 }
1803 1825
1804 var code = th.data.wu_arr[th.data.index].code; 1826 var code = th.data.wu_arr[th.data.index].code;
1805 - var freight_free = ee.freight_free; //全场满多少包邮  
1806 var shipping_price = 1827 var shipping_price =
1807 - th.calculatewuliu(code, o_shipping_price, goods_weight, 1828 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
1808 goods_piece, th.data.user_addr, freight_free, allpice, rs); 1829 goods_piece, th.data.user_addr, freight_free, allpice, rs);
1809 exp_price = parseFloat(shipping_price).toFixed(2); 1830 exp_price = parseFloat(shipping_price).toFixed(2);
1810 } 1831 }
1811 - th.wuliu_next(allpice,quan_price,exp_price); 1832 + th.wuliu_next(allpice, quan_price, exp_price);
1812 } else { 1833 } else {
1813 - th.wuliu_next(allpice,quan_price,exp_price); 1834 + th.wuliu_next(allpice, quan_price, exp_price);
1814 } 1835 }
1815 }); 1836 });
1816 }); 1837 });
1817 }, 1838 },
1818 //相同的东西统一在一起 1839 //相同的东西统一在一起
1819 - wuliu_next( allpice,quan_price,exp_price){  
1820 - var th=this;  
1821 - var o_condition =parseFloat(allpice)-parseFloat(quan_price);  
1822 - if(o_condition<0) o_condition=0; 1840 + wuliu_next(allpice, quan_price, exp_price) {
  1841 + var th = this;
  1842 + var o_condition = parseFloat(allpice) - parseFloat(quan_price);
  1843 + if (o_condition < 0) o_condition = 0;
1823 //如果同意参与订单优惠 1844 //如果同意参与订单优惠
1824 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 1845 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
1825 th.check_is_order_prom(o_condition, function (ord_price) { 1846 th.check_is_order_prom(o_condition, function (ord_price) {
1826 - var bn_pick=th.data.pickup.pickup_id 1847 + var bn_pick = th.data.pickup.pickup_id
1827 var order_prom_amount = 0; 1848 var order_prom_amount = 0;
1828 var order_prom_id = 0; 1849 var order_prom_id = 0;
1829 - var order_m=0; 1850 + var order_m = 0;
1830 if (th.data.order_prom[bn_pick]) { 1851 if (th.data.order_prom[bn_pick]) {
1831 var ord_prom = th.data.order_prom[bn_pick]; 1852 var ord_prom = th.data.order_prom[bn_pick];
1832 //么有使用券,或者活动没有限制使用优惠券 1853 //么有使用券,或者活动没有限制使用优惠券
1833 - if(quan_price<=0 || !ord_prom.is_xz_yh) { 1854 + if (quan_price <= 0 || !ord_prom.is_xz_yh) {
1834 order_prom_id = ord_prom['id']; 1855 order_prom_id = ord_prom['id'];
1835 switch (ord_prom['type']) { 1856 switch (ord_prom['type']) {
1836 case 0: 1857 case 0:
@@ -1850,37 +1871,37 @@ Page({ @@ -1850,37 +1871,37 @@ Page({
1850 if (order_prom_id > 0) { 1871 if (order_prom_id > 0) {
1851 var order_prom_txt1 = "order_prom_id"; 1872 var order_prom_txt1 = "order_prom_id";
1852 var order_prom_txt2 = "order_prom_amount"; 1873 var order_prom_txt2 = "order_prom_amount";
1853 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
1854 - }else{  
1855 - var order_prom_txt1 = "order_prom_id";  
1856 - var order_prom_txt2 = "order_prom_amount";  
1857 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})  
1858 - }  
1859 -  
1860 -  
1861 - ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit);  
1862 - if(ord_price<0) ord_price=0;  
1863 - th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) 1874 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  1875 + } else {
  1876 + var order_prom_txt1 = "order_prom_id";
  1877 + var order_prom_txt2 = "order_prom_amount";
  1878 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
  1879 + }
  1880 +
  1881 +
  1882 + ord_price = parseFloat(ord_price) - parseFloat(th.data.presell.presell_deposit);
  1883 + if (ord_price < 0) ord_price = 0;
  1884 + th.setData({ exp_price: exp_price, order_m: ord_price + parseFloat(exp_price) })
1864 1885
1865 }) 1886 })
1866 - }else{  
1867 -  
1868 - var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);  
1869 - if(o_condition1<0) o_condition1=0;  
1870 - th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) 1887 + } else {
  1888 +
  1889 + var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit);
  1890 + if (o_condition1 < 0) o_condition1 = 0;
  1891 + th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1) + parseFloat(exp_price) })
1871 } 1892 }
1872 }, 1893 },
1873 1894
1874 //-- 获取时间差 -- 1895 //-- 获取时间差 --
1875 - get_diff(){ 1896 + get_diff() {
1876 1897
1877 switch (this.data.act.presell_type) { 1898 switch (this.data.act.presell_type) {
1878 //部分定金 1899 //部分定金
1879 case 0: 1900 case 0:
1880 if (this.data.act.pay_begindate > ut.gettimestamp()) { 1901 if (this.data.act.pay_begindate > ut.gettimestamp()) {
1881 - this.setData({no_start: 1}) 1902 + this.setData({ no_start: 1 })
1882 } else if (this.data.act.pay_enddate < ut.gettimestamp()) { 1903 } else if (this.data.act.pay_enddate < ut.gettimestamp()) {
1883 - this.setData({is_end: 1}) 1904 + this.setData({ is_end: 1 })
1884 } else { 1905 } else {
1885 var end_time = this.data.act.pay_enddate; 1906 var end_time = this.data.act.pay_enddate;
1886 var e_str = ut.formatTime(end_time); 1907 var e_str = ut.formatTime(end_time);
@@ -1891,15 +1912,15 @@ Page({ @@ -1891,15 +1912,15 @@ Page({
1891 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数 1912 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数
1892 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数 1913 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
1893 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数 1914 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数
1894 - this.setData({days: days, hours: hours, minutes: minutes, seconds: seconds}) 1915 + this.setData({ days: days, hours: hours, minutes: minutes, seconds: seconds })
1895 } 1916 }
1896 break; 1917 break;
1897 //全额付款 1918 //全额付款
1898 case 1: 1919 case 1:
1899 if (this.data.act.start_time > ut.gettimestamp()) { 1920 if (this.data.act.start_time > ut.gettimestamp()) {
1900 - this.setData({no_start: 1}) 1921 + this.setData({ no_start: 1 })
1901 } else if (this.data.act.end_time < ut.gettimestamp()) { 1922 } else if (this.data.act.end_time < ut.gettimestamp()) {
1902 - this.setData({is_end: 1}) 1923 + this.setData({ is_end: 1 })
1903 } else { 1924 } else {
1904 var end_time = this.data.act.end_time; 1925 var end_time = this.data.act.end_time;
1905 var e_str = ut.formatTime(end_time); 1926 var e_str = ut.formatTime(end_time);
@@ -1910,7 +1931,7 @@ Page({ @@ -1910,7 +1931,7 @@ Page({
1910 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数 1931 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数
1911 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数 1932 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
1912 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数 1933 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数
1913 - this.setData({days: days, hours: hours, minutes: minutes, seconds: seconds}) 1934 + this.setData({ days: days, hours: hours, minutes: minutes, seconds: seconds })
1914 } 1935 }
1915 break; 1936 break;
1916 1937
@@ -1921,16 +1942,16 @@ Page({ @@ -1921,16 +1942,16 @@ Page({
1921 //显示支付选择 1942 //显示支付选择
1922 show_pay: function () { 1943 show_pay: function () {
1923 //不用钱直接支付 1944 //不用钱直接支付
1924 - if(this.data.order_m<=0){ 1945 + if (this.data.order_m <= 0) {
1925 this.to_pay_type(1); 1946 this.to_pay_type(1);
1926 - }else{  
1927 - this.setData({show_pay_type: 1}); 1947 + } else {
  1948 + this.setData({ show_pay_type: 1 });
1928 } 1949 }
1929 1950
1930 }, 1951 },
1931 //关闭支付 1952 //关闭支付
1932 close_show_pay: function () { 1953 close_show_pay: function () {
1933 - this.setData({show_pay_type: 0}); 1954 + this.setData({ show_pay_type: 0 });
1934 }, 1955 },
1935 //--弹起支付框-- 1956 //--弹起支付框--
1936 to_pay() { 1957 to_pay() {
@@ -1939,7 +1960,7 @@ Page({ @@ -1939,7 +1960,7 @@ Page({
1939 return getApp().my_warnning("请选择收货地址", 0, this); 1960 return getApp().my_warnning("请选择收货地址", 0, this);
1940 } 1961 }
1941 1962
1942 - this.setData({show_pay_type: 1}); 1963 + this.setData({ show_pay_type: 1 });
1943 }, 1964 },
1944 1965
1945 //选择支付方式 1966 //选择支付方式
@@ -1975,26 +1996,26 @@ Page({ @@ -1975,26 +1996,26 @@ Page({
1975 dd.addressid = th.data.user_addr.address_id; 1996 dd.addressid = th.data.user_addr.address_id;
1976 } 1997 }
1977 1998
1978 - if(th.data.order_prom_amount>0){  
1979 - var e={  
1980 - order_prom_id:th.data.order_prom_id,  
1981 - order_prom_amount:th.data.order_prom_amount, 1999 + if (th.data.order_prom_amount > 0) {
  2000 + var e = {
  2001 + order_prom_id: th.data.order_prom_id,
  2002 + order_prom_amount: th.data.order_prom_amount,
1982 } 2003 }
1983 - dd.order_prom_list=e; 2004 + dd.order_prom_list = e;
1984 } 2005 }
1985 2006
1986 - var bn_pick=th.data.pickup_id;  
1987 - var quan_no=''; 2007 + var bn_pick = th.data.pickup_id;
  2008 + var quan_no = '';
1988 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) 2009 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
1989 quan_no = th.data.using_quan[bn_pick].coupon_no; 2010 quan_no = th.data.using_quan[bn_pick].coupon_no;
1990 - if(quan_no){  
1991 - dd.coupon_no=quan_no;  
1992 - if(th.data.quan_price) dd.coupon_price=th.data.quan_price; 2011 + if (quan_no) {
  2012 + dd.coupon_no = quan_no;
  2013 + if (th.data.quan_price) dd.coupon_price = th.data.quan_price;
1993 } 2014 }
1994 - if(th.data.user_note){  
1995 - dd.user_note=th.data.user_note; 2015 + if (th.data.user_note) {
  2016 + dd.user_note = th.data.user_note;
1996 } 2017 }
1997 - dd.order_amount= parseFloat(th.data.order_m).toFixed(2); 2018 + dd.order_amount = parseFloat(th.data.order_m).toFixed(2);
1998 2019
1999 console.log(JSON.stringify(dd)); 2020 console.log(JSON.stringify(dd));
2000 wx.request({ 2021 wx.request({
@@ -2014,25 +2035,25 @@ Page({ @@ -2014,25 +2035,25 @@ Page({
2014 function () { 2035 function () {
2015 //---用余额支付--- 2036 //---用余额支付---
2016 getApp().my_warnning("支付成功", 1, th); 2037 getApp().my_warnning("支付成功", 1, th);
2017 - var send_time=th.data.pre_arr.delivery_date;  
2018 - if(th.data.pre_arr.delivery_type==2){  
2019 - send_time=th.data.pre_arr.delivery_daynum*3600;  
2020 - }  
2021 - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});  
2022 - 2038 + var send_time = th.data.pre_arr.delivery_date;
  2039 + if (th.data.pre_arr.delivery_type == 2) {
  2040 + send_time = th.data.pre_arr.delivery_daynum * 3600;
  2041 + }
  2042 + th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time });
  2043 +
2023 }, function () { 2044 }, function () {
2024 getApp().my_warnning("支付失败", 0, th); 2045 getApp().my_warnning("支付失败", 0, th);
2025 }) 2046 })
2026 } else { 2047 } else {
2027 if (t.data.code == 0) { 2048 if (t.data.code == 0) {
2028 - var send_time=th.data.pre_arr.delivery_date;  
2029 - if(th.data.pre_arr.delivery_type==2){  
2030 - send_time=th.data.pre_arr.delivery_daynum*3600; 2049 + var send_time = th.data.pre_arr.delivery_date;
  2050 + if (th.data.pre_arr.delivery_type == 2) {
  2051 + send_time = th.data.pre_arr.delivery_daynum * 3600;
2031 } 2052 }
2032 //---用余额支付--- 2053 //---用余额支付---
2033 - getApp().my_warnning("支付成功", 1, th);  
2034 - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});  
2035 - 2054 + getApp().my_warnning("支付成功", 1, th);
  2055 + th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time });
  2056 +
2036 } else { 2057 } else {
2037 getApp().my_warnning(t.data.msg, 1, th); 2058 getApp().my_warnning(t.data.msg, 1, th);
2038 } 2059 }
@@ -2057,17 +2078,17 @@ Page({ @@ -2057,17 +2078,17 @@ Page({
2057 }, 2078 },
2058 fail: function (n) { 2079 fail: function (n) {
2059 console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败", 0, th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付", 0, th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length), 0, th), 2080 console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败", 0, th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付", 0, th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length), 0, th),
2060 - "function" == typeof fail && fail(); 2081 + "function" == typeof fail && fail();
2061 } 2082 }
2062 }); 2083 });
2063 }, 2084 },
2064 2085
2065 2086
2066 - show_liuyan:function () {  
2067 - this.setData({sh_liuyan:true}) 2087 + show_liuyan: function () {
  2088 + this.setData({ sh_liuyan: true })
2068 }, 2089 },
2069 - close_liuyan(){  
2070 - this.setData({sh_liuyan:false}) 2090 + close_liuyan() {
  2091 + this.setData({ sh_liuyan: false })
2071 }, 2092 },
2072 2093
2073 //--------点击选择---------- 2094 //--------点击选择----------
@@ -2081,83 +2102,83 @@ Page({ @@ -2081,83 +2102,83 @@ Page({
2081 2102
2082 //--------立即支付---------- 2103 //--------立即支付----------
2083 async jumpToCart4(e) { 2104 async jumpToCart4(e) {
2084 - var th=this;  
2085 - if(this.data.optionIsGoup) 2105 + var th = this;
  2106 + if (this.data.optionIsGoup)
2086 wx.navigateTo({ 2107 wx.navigateTo({
2087 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" 2108 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true"
2088 }) 2109 })
2089 - var order=this.data.order;  
2090 - var order_goods=this.data.order_goods;  
2091 - var user_id=getApp().globalData.userInfo.user_id;  
2092 -  
2093 - var wlist="";  
2094 -  
2095 - var good=order_goods;  
2096 - //线下取价功能已经关闭或者过期  
2097 - if(!th.data.is_open_offline && good.offline_cut>0){  
2098 - wx.showModal({  
2099 - title: '提示',  
2100 - content: '线下取价功能已经关闭或者过期!'  
2101 - });  
2102 - return false;  
2103 - }  
2104 - //如果不是小程序有的功能,直接提示要去3.0处理  
2105 - if(good.prom_type==2 ){  
2106 - wx.showModal({  
2107 - title: '提示',  
2108 - content: '小程序还未有该活动,请到3.0公众号支付'  
2109 - });  
2110 - return false;  
2111 - } 2110 + var order = this.data.order;
  2111 + var order_goods = this.data.order_goods;
  2112 + var user_id = getApp().globalData.userInfo.user_id;
  2113 +
  2114 + var wlist = "";
  2115 +
  2116 + var good = order_goods;
  2117 + //线下取价功能已经关闭或者过期
  2118 + if (!th.data.is_open_offline && good.offline_cut > 0) {
  2119 + wx.showModal({
  2120 + title: '提示',
  2121 + content: '线下取价功能已经关闭或者过期!'
  2122 + });
  2123 + return false;
  2124 + }
  2125 + //如果不是小程序有的功能,直接提示要去3.0处理
  2126 + if (good.prom_type == 2) {
  2127 + wx.showModal({
  2128 + title: '提示',
  2129 + content: '小程序还未有该活动,请到3.0公众号支付'
  2130 + });
  2131 + return false;
  2132 + }
2112 2133
2113 - //要每件每件的商品进行检查,看有么有超出库存,超出限购  
2114 - var goodsbuynum=0,promgoodsbuynum=0,gg=null;  
2115 - //获取单品的现在的活动状态  
2116 - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {  
2117 - }).then(res=>{  
2118 - gg=res.data.data;  
2119 - })  
2120 - var limit = gg.viplimited;  
2121 - var store_count = gg.store_count;  
2122 - good.erpwareid=gg.erpwareid; 2134 + //要每件每件的商品进行检查,看有么有超出库存,超出限购
  2135 + var goodsbuynum = 0, promgoodsbuynum = 0, gg = null;
  2136 + //获取单品的现在的活动状态
  2137 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {
  2138 + }).then(res => {
  2139 + gg = res.data.data;
  2140 + })
  2141 + var limit = gg.viplimited;
  2142 + var store_count = gg.store_count;
  2143 + good.erpwareid = gg.erpwareid;
2123 2144
2124 - //---要获得商品,该用户买了多少件,同步应用---  
2125 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
2126 - data: {  
2127 - store_id: os.stoid,  
2128 - user_id: getApp().globalData.user_id,  
2129 - goods_id: good.goods_id,  
2130 - prom_type: good.prom_type,  
2131 - prom_id: good.prom_id  
2132 - },  
2133 - }).then(res => {  
2134 - var buy_num_data = res.data.data;  
2135 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
2136 - goodsbuynum = buy_num_data.goodsbuynum;  
2137 - }) 2145 + //---要获得商品,该用户买了多少件,同步应用---
  2146 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  2147 + data: {
  2148 + store_id: os.stoid,
  2149 + user_id: getApp().globalData.user_id,
  2150 + goods_id: good.goods_id,
  2151 + prom_type: good.prom_type,
  2152 + prom_id: good.prom_id
  2153 + },
  2154 + }).then(res => {
  2155 + var buy_num_data = res.data.data;
  2156 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  2157 + goodsbuynum = buy_num_data.goodsbuynum;
  2158 + })
2138 2159
2139 - var buyed_mum2=goodsbuynum+good.goods_num;  
2140 - if (buyed_mum2 > limit && limit > 0) { 2160 + var buyed_mum2 = goodsbuynum + good.goods_num;
  2161 + if (buyed_mum2 > limit && limit > 0) {
2141 2162
2142 - var content=gg.goods_name+'购买数量超出商品限购,请取消订单';  
2143 - th.toast(content);  
2144 - return false;  
2145 - } 2163 + var content = gg.goods_name + '购买数量超出商品限购,请取消订单';
  2164 + th.toast(content);
  2165 + return false;
  2166 + }
2146 2167
2147 2168
2148 2169
2149 //如果是预售的时候, 2170 //如果是预售的时候,
2150 - if(good.prom_type==8){  
2151 - await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum",{  
2152 - data: {store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id},  
2153 - }).then(e=>{ 2171 + if (good.prom_type == 8) {
  2172 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum", {
  2173 + data: { store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id },
  2174 + }).then(e => {
2154 if (e.data.code == 0) { 2175 if (e.data.code == 0) {
2155 - promgoodsbuynum=e.data.data.sumgoodsnum; 2176 + promgoodsbuynum = e.data.data.sumgoodsnum;
2156 } 2177 }
2157 }) 2178 })
2158 2179
2159 - var presell_id =good.prom_id;  
2160 - var presellList=null; 2180 + var presell_id = good.prom_id;
  2181 + var presellList = null;
2161 var url = "/api/weshop/marketing/marketingPresellList/list" 2182 var url = "/api/weshop/marketing/marketingPresellList/list"
2162 var rd = { 2183 var rd = {
2163 store_id: os.stoid, 2184 store_id: os.stoid,
@@ -2170,13 +2191,13 @@ Page({ @@ -2170,13 +2191,13 @@ Page({
2170 }).then(res => { 2191 }).then(res => {
2171 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 2192 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
2172 var arr = res.data.data[0]; 2193 var arr = res.data.data[0];
2173 - presellList=arr 2194 + presellList = arr
2174 } 2195 }
2175 }) 2196 })
2176 2197
2177 - if(presellList){ 2198 + if (presellList) {
2178 2199
2179 - if(good.goods_num>presellList.presell_sumqty-presellList.buy_goodnum){ 2200 + if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
2180 var content = gg.goods_name + '购买数量超出商品库存,请取消订单'; 2201 var content = gg.goods_name + '购买数量超出商品库存,请取消订单';
2181 th.toast(content); 2202 th.toast(content);
2182 return false; 2203 return false;
@@ -2192,247 +2213,248 @@ Page({ @@ -2192,247 +2213,248 @@ Page({
2192 } 2213 }
2193 2214
2194 2215
2195 - //如果优惠促销和搭配购的时候  
2196 - if((good.prom_type==3 || good.prom_type==5) && good.is_collocation!=1 && good.is_gift!=1){  
2197 - var p_ok=1;  
2198 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {  
2199 - if(res.data.code==0){  
2200 - var r_data=res.data.data;  
2201 - if(!r_data.collocationPromList && good.prom_type==5){  
2202 -  
2203 - var content=good.goods_name+'未找到活动,请取消订单重新购买';  
2204 - th.toast(content);  
2205 - p_ok=0;  
2206 - }  
2207 - if(!r_data.promGoodsLists && good.prom_type==3){  
2208 -  
2209 - var content=good.goods_name+'未找到活动,请取消订单重新购买';  
2210 - th.toast(content);  
2211 - p_ok=0;  
2212 - }  
2213 - }else{ 2216 + //如果优惠促销和搭配购的时候
  2217 + if ((good.prom_type == 3 || good.prom_type == 5) && good.is_collocation != 1 && good.is_gift != 1) {
  2218 + var p_ok = 1;
  2219 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => {
  2220 + if (res.data.code == 0) {
  2221 + var r_data = res.data.data;
  2222 + if (!r_data.collocationPromList && good.prom_type == 5) {
2214 2223
2215 - var content=good.goods_name+'未找到活动,请取消订单重新购买'; 2224 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
2216 th.toast(content); 2225 th.toast(content);
2217 - p_ok=0; 2226 + p_ok = 0;
2218 } 2227 }
2219 - })  
2220 - if(!p_ok) return false;  
2221 - } 2228 + if (!r_data.promGoodsLists && good.prom_type == 3) {
2222 2229
2223 - //商品的普通购买 ,不要进行判断  
2224 - if((good.prom_type==1 || good.prom_type==6 || good.prom_type==4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){  
2225 - if(gg.prom_type!=good.prom_type) { 2230 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  2231 + th.toast(content);
  2232 + p_ok = 0;
  2233 + }
  2234 + } else {
2226 2235
2227 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; 2236 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
2228 th.toast(content); 2237 th.toast(content);
2229 - return false; 2238 + p_ok = 0;
2230 } 2239 }
2231 - }else{  
2232 - if((gg.prom_type==1 || gg.prom_type==3 || gg.prom_type==5 || gg.prom_type==6 || gg.prom_type==4)  
2233 - && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {  
2234 - var prom=null;  
2235 - //---如果是活动的时候---  
2236 - var prom=null,th=this;  
2237 - if(gg.prom_type==1){  
2238 - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+gg.prom_id,{  
2239 - }).then(res=>{  
2240 - if(res.data.code==0){  
2241 - prom=res.data.data;  
2242 - }  
2243 - })  
2244 - }  
2245 - if(gg.prom_type==6){  
2246 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+gg.prom_id,{  
2247 - }).then(res=>{  
2248 - if(res.data.code==0){  
2249 - prom=res.data.data;  
2250 - }  
2251 - })  
2252 - }  
2253 -  
2254 - if(gg.prom_type==4){  
2255 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
2256 - data:{store_id:os.stoid,goods_id:gg.goods_id}  
2257 - }).then(res=>{  
2258 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
2259 - prom=res.data.data.pageData[0];  
2260 - }  
2261 - })  
2262 - } 2240 + })
  2241 + if (!p_ok) return false;
  2242 + }
2263 2243
2264 - if(prom){  
2265 - var t_now=ut.gettimestamp();  
2266 - if(prom.is_end==0 && prom.start_time<t_now && prom.end_time>t_now){ 2244 + //商品的普通购买 ,不要进行判断
  2245 + if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) {
  2246 + if (gg.prom_type != good.prom_type) {
2267 2247
2268 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
2269 - th.toast(content);  
2270 - return false; 2248 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  2249 + th.toast(content);
  2250 + return false;
  2251 + }
  2252 + } else {
  2253 + if ((gg.prom_type == 1 || gg.prom_type == 3 || gg.prom_type == 5 || gg.prom_type == 6 || gg.prom_type == 4)
  2254 + && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
  2255 + var prom = null;
  2256 + //---如果是活动的时候---
  2257 + var prom = null, th = this;
  2258 + if (gg.prom_type == 1) {
  2259 + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + gg.prom_id, {
  2260 + }).then(res => {
  2261 + if (res.data.code == 0) {
  2262 + prom = res.data.data;
2271 } 2263 }
2272 - } 2264 + })
  2265 + }
  2266 + if (gg.prom_type == 6) {
  2267 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {
  2268 + }).then(res => {
  2269 + if (res.data.code == 0) {
  2270 + prom = res.data.data;
  2271 + }
  2272 + })
2273 } 2273 }
2274 - else{  
2275 - //不是赠品的时候  
2276 - if(!good.is_gift && good.prom_type!=3){  
2277 - var t_ok=1;  
2278 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {  
2279 - if(res.data.code==0){  
2280 - var r_data=res.data.data;  
2281 - //-- 参加了全局的优惠活动 --  
2282 - if(r_data.promGoodsLists){  
2283 -  
2284 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
2285 - th.toast(content);  
2286 - t_ok=0;  
2287 - }  
2288 - }  
2289 - })  
2290 - if(!t_ok) return false;  
2291 - }  
2292 2274
2293 - //-- 如果有参加线下取价 --  
2294 - if(good.offline_cut>0) wlist+=encodeURIComponent(gg.erpwareid)+","; 2275 + if (gg.prom_type == 4) {
  2276 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  2277 + data: { store_id: os.stoid, goods_id: gg.goods_id }
  2278 + }).then(res => {
  2279 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  2280 + prom = res.data.data.pageData[0];
  2281 + }
  2282 + })
2295 } 2283 }
2296 - //赠品和搭配购不判断商品金额  
2297 - var isok=1;  
2298 - var card_field=th.data.card_field;  
2299 - //如果会员是等级会员,商品有等级价,且不是活动商品  
2300 - if(!good.is_gift && !good.is_collocation && good.prom_type!=8) {  
2301 - if (card_field && gg[card_field] > 0) {  
2302 - if (good.goods_price != gg[card_field] && good.offline_cut<=0) isok = 0;  
2303 - if (good.goods_price >gg[card_field] && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
2304 2284
2305 - } else {  
2306 - if (good.goods_price != gg.shop_price && good.offline_cut<=0) isok = 0;  
2307 - if (good.goods_price> gg.shop_price && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
2308 - }  
2309 - var is_h=0;  
2310 - if (!isok) { 2285 + if (prom) {
  2286 + var t_now = ut.gettimestamp();
  2287 + if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) {
2311 2288
2312 - var content=gg.goods_name + '商品的价格发生了变化,请取消订单重新购买'; 2289 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
2313 th.toast(content); 2290 th.toast(content);
2314 return false; 2291 return false;
2315 } 2292 }
2316 } 2293 }
  2294 + }
  2295 + else {
  2296 + //不是赠品的时候
  2297 + if (!good.is_gift && good.prom_type != 3) {
  2298 + var t_ok = 1;
  2299 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => {
  2300 + if (res.data.code == 0) {
  2301 + var r_data = res.data.data;
  2302 + //-- 参加了全局的优惠活动 --
  2303 + if (r_data.promGoodsLists) {
2317 2304
  2305 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  2306 + th.toast(content);
  2307 + t_ok = 0;
  2308 + }
  2309 + }
  2310 + })
  2311 + if (!t_ok) return false;
  2312 + }
2318 2313
2319 - if(good.goods_num>store_count){  
2320 -  
2321 - var content=gg.goods_name+'商品的库存不足,请取消订单';  
2322 - th.toast(content);  
2323 - return false;  
2324 - } 2314 + //-- 如果有参加线下取价 --
  2315 + if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ",";
  2316 + }
  2317 + //赠品和搭配购不判断商品金额
  2318 + var isok = 1;
  2319 + var card_field = th.data.card_field;
  2320 + //如果会员是等级会员,商品有等级价,且不是活动商品
  2321 + if (!good.is_gift && !good.is_collocation && good.prom_type != 8) {
  2322 + if (card_field && gg[card_field] > 0) {
  2323 + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
  2324 + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
2325 2325
  2326 + } else {
  2327 + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
  2328 + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
  2329 + }
  2330 + var is_h = 0;
  2331 + if (!isok) {
2326 2332
  2333 + var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买';
  2334 + th.toast(content);
  2335 + return false;
  2336 + }
2327 } 2337 }
2328 2338
2329 - console.log("------------------------------------");  
2330 - //---如果是活动的时候---  
2331 - var prom=null,goodsinfo=good,th=this;  
2332 - if(goodsinfo.prom_type==1){  
2333 - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2334 - }).then(res=>{  
2335 - if(res.data.code==0){  
2336 - prom=res.data.data;  
2337 - }  
2338 - }) 2339 +
  2340 + if (good.goods_num > store_count) {
  2341 +
  2342 + var content = gg.goods_name + '商品的库存不足,请取消订单';
  2343 + th.toast(content);
  2344 + return false;
2339 } 2345 }
2340 - if(goodsinfo.prom_type==6 && !good.is_pd_normal){  
2341 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2342 - }).then(res=>{  
2343 - if(res.data.code==0){  
2344 - prom=res.data.data;  
2345 - }  
2346 - }) 2346 +
  2347 +
  2348 + }
  2349 +
  2350 + console.log("------------------------------------");
  2351 + //---如果是活动的时候---
  2352 + var prom = null, goodsinfo = good, th = this;
  2353 + if (goodsinfo.prom_type == 1) {
  2354 + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, {
  2355 + }).then(res => {
  2356 + if (res.data.code == 0) {
  2357 + prom = res.data.data;
  2358 + }
  2359 + })
  2360 + }
  2361 + if (goodsinfo.prom_type == 6 && !good.is_pd_normal) {
  2362 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {
  2363 + }).then(res => {
  2364 + if (res.data.code == 0) {
  2365 + prom = res.data.data;
  2366 + }
  2367 + })
  2368 + }
  2369 +
  2370 + if (goodsinfo.prom_type == 4 && !good.is_integral_normal) {
  2371 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  2372 + data: { store_id: os.stoid, goods_id: goodsinfo.goods_id }
  2373 + }).then(res => {
  2374 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  2375 + prom = res.data.data.pageData[0];
  2376 + }
  2377 + })
  2378 + }
  2379 +
  2380 + //----------如果有活动,并且在进行中,就不计算线下库存---------------
  2381 + if (prom) {
  2382 + var now = ut.gettimestamp();
  2383 + if (prom.is_end == 1 && prom.end_time < now) {
  2384 +
  2385 + var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单重新购买';
  2386 + th.toast(content);
  2387 + return false;
2347 } 2388 }
2348 2389
2349 - if(goodsinfo.prom_type==4 && !good.is_integral_normal){  
2350 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
2351 - data:{store_id:os.stoid,goods_id:goodsinfo.goods_id}  
2352 - }).then(res=>{  
2353 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
2354 - prom=res.data.data.pageData[0];  
2355 - }  
2356 - }) 2390 + buyed_mum2 = promgoodsbuynum + good.goods_num;
  2391 + if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) {
  2392 +
  2393 + var content = goodsinfo.goods_name + '购买数量超出商品活动限购,请取消订单重新购买';
  2394 + th.toast(content);
  2395 + return false;
2357 } 2396 }
2358 2397
2359 - //----------如果有活动,并且在进行中,就不计算线下库存---------------  
2360 - if(prom){  
2361 - var now=ut.gettimestamp();  
2362 - if(prom.is_end==1 && prom.end_time<now){ 2398 + if (goodsinfo.prom_type == 4) {
  2399 + if (good.goods_num > prom.limitqty - prom.buy_num) {
2363 2400
2364 - var content=goodsinfo.goods_name+'商品的活动已经结束,请取消订单重新购买'; 2401 + var content = goodsinfo.goods_name + '购买数量超出商品活动库存,请取消订单';
2365 th.toast(content); 2402 th.toast(content);
2366 return false; 2403 return false;
2367 } 2404 }
  2405 + } else {
  2406 + var redis_num = 0;
  2407 + //------判断活动是否抢光-----
  2408 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  2409 + os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, {
  2410 + }).then(res => {
  2411 + redis_num = res.data.data;
  2412 + });
2368 2413
2369 - buyed_mum2=promgoodsbuynum+good.goods_num;  
2370 - if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) { 2414 + if (good.goods_num > redis_num) {
2371 2415
2372 - var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单重新购买'; 2416 + var content = gg.goods_name + '超出商品活动库存,请取消订单';
2373 th.toast(content); 2417 th.toast(content);
2374 return false; 2418 return false;
2375 } 2419 }
2376 -  
2377 - if(goodsinfo.prom_type==4){  
2378 - if (good.goods_num > prom.limitqty-prom.buy_num) {  
2379 -  
2380 - var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单';  
2381 - th.toast(content);  
2382 - return false;  
2383 - }  
2384 - }else{  
2385 - var redis_num = 0;  
2386 - //------判断活动是否抢光-----  
2387 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +  
2388 - os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, {  
2389 - }).then(res => {  
2390 - redis_num = res.data.data;  
2391 - });  
2392 -  
2393 - if (good.goods_num > redis_num) {  
2394 -  
2395 - var content=gg.goods_name+'超出商品活动库存,请取消订单';  
2396 - th.toast(content);  
2397 - return false;  
2398 - }  
2399 - }  
2400 -  
2401 } 2420 }
2402 2421
  2422 + }
  2423 +
2403 2424
2404 2425
2405 //-- 要判断一下线下取价价格是不是发生改变 -- 2426 //-- 要判断一下线下取价价格是不是发生改变 --
2406 - if(wlist!="" && th.data.is_open_offline && th.data.is_open_offline>0){  
2407 - wlist=ut.sub_last(wlist);  
2408 - var keyid=order.pickup_id;  
2409 - var user_info=getApp().globalData.userInfo;  
2410 - if(!keyid) return false;  
2411 - var offarr=null; 2427 + if (wlist != "" && th.data.is_open_offline && th.data.is_open_offline > 0) {
  2428 + wlist = ut.sub_last(wlist);
  2429 + var keyid = order.pickup_id;
  2430 + var user_info = getApp().globalData.userInfo;
  2431 + if (!keyid) return false;
  2432 + var offarr = null;
2412 await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { 2433 await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
2413 - data:{  
2414 - VIPId:encodeURIComponent(user_info.erpvipid),  
2415 - store_id:os.stoid,  
2416 - PickupId:keyid,  
2417 - WareIds:wlist}, 2434 + data: {
  2435 + VIPId: encodeURIComponent(user_info.erpvipid),
  2436 + store_id: os.stoid,
  2437 + PickupId: keyid,
  2438 + WareIds: wlist
2418 }, 2439 },
2419 - ).then(res=>{  
2420 - if(res.data.code==0 && res.data.data && res.data.data.length>0){  
2421 - offarr=res.data.data; 2440 + },
  2441 + ).then(res => {
  2442 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  2443 + offarr = res.data.data;
2422 } 2444 }
2423 }) 2445 })
2424 - if(!offarr && offarr.length<=0 ){  
2425 - wx.showModal({ title: '获取线下取价失败',}); 2446 + if (!offarr && offarr.length <= 0) {
  2447 + wx.showModal({ title: '获取线下取价失败', });
2426 } 2448 }
2427 - var newarr=ut.convert_arr_key(offarr,'WareId'); 2449 + var newarr = ut.convert_arr_key(offarr, 'WareId');
2428 //-- 循环判断线下的价格 -- 2450 //-- 循环判断线下的价格 --
2429 - for(var k in order_goods){  
2430 - var good=order_goods[k]; 2451 + for (var k in order_goods) {
  2452 + var good = order_goods[k];
2431 //判断线下取价是不是一样 2453 //判断线下取价是不是一样
2432 - if(newarr[good.erpwareid] &&  
2433 - parseFloat(newarr[good.erpwareid].WarePrice)!=parseFloat(good.goods_price)){ 2454 + if (newarr[good.erpwareid] &&
  2455 + parseFloat(newarr[good.erpwareid].WarePrice) != parseFloat(good.goods_price)) {
2434 2456
2435 - var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; 2457 + var content = good.goods_name + '商品的价格发生了变化,请取消订单重新购买';
2436 th.toast(content); 2458 th.toast(content);
2437 return false; 2459 return false;
2438 } 2460 }
@@ -2447,30 +2469,30 @@ Page({ @@ -2447,30 +2469,30 @@ Page({
2447 type: 1 //正常单 2469 type: 1 //正常单
2448 }, 1);--*/ 2470 }, 1);--*/
2449 2471
2450 - util_pay.pay(this.data.order.order_sn, function() {  
2451 - wx.showToast({title: '支付成功'}) 2472 + util_pay.pay(this.data.order.order_sn, function () {
  2473 + wx.showToast({ title: '支付成功' })
2452 wx.navigateBack(); 2474 wx.navigateBack();
2453 - },null,os.stoid,1); 2475 + }, null, os.stoid, 1);
2454 2476
2455 2477
2456 }, 2478 },
2457 2479
2458 //--------取消订单--------- 2480 //--------取消订单---------
2459 - cancelOrder: function(e) {  
2460 - var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; 2481 + cancelOrder: function (e) {
  2482 + var t = this, th = t, ord_id = this.data.order.order_id, order = this.data.order;
2461 2483
2462 wx.showModal({ 2484 wx.showModal({
2463 title: "是否取消订单?", 2485 title: "是否取消订单?",
2464 - success: function(e) {  
2465 - if(!e.confirm) return false; 2486 + success: function (e) {
  2487 + if (!e.confirm) return false;
2466 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 2488 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
2467 //if(is_skill==1 || is_zsorder>=2){ 2489 //if(is_skill==1 || is_zsorder>=2){
2468 - getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+ord_id+"/"+getApp().globalData.user_id,{  
2469 - data:{},  
2470 - success: function(t) {  
2471 - if(t.data.code==0){  
2472 - th.setData({'order.order_status':3});  
2473 - wx.setStorageSync("order:order_list:update", !0); 2490 + getApp().request.post("/api/weshop/order/cancelOrder/" + os.stoid + "/" + ord_id + "/" + getApp().globalData.user_id, {
  2491 + data: {},
  2492 + success: function (t) {
  2493 + if (t.data.code == 0) {
  2494 + th.setData({ 'order.order_status': 3 });
  2495 + wx.setStorageSync("order:order_list:update", !0);
2474 } 2496 }
2475 2497
2476 }, 2498 },
@@ -2482,36 +2504,36 @@ Page({ @@ -2482,36 +2504,36 @@ Page({
2482 2504
2483 2505
2484 //-----删除订单----- 2506 //-----删除订单-----
2485 - deleteOrderData: function(t) {  
2486 - var th=this;  
2487 - var order_id=this.data.order.order_id;  
2488 - var up_data={  
2489 - order_id: order_id,isdel:1 2507 + deleteOrderData: function (t) {
  2508 + var th = this;
  2509 + var order_id = this.data.order.order_id;
  2510 + var up_data = {
  2511 + order_id: order_id, isdel: 1
2490 }; 2512 };
2491 - if(th.data.order.order_status!=6){  
2492 - up_data.order_status=5; 2513 + if (th.data.order.order_status != 6) {
  2514 + up_data.order_status = 5;
2493 } 2515 }
2494 wx.showModal({ 2516 wx.showModal({
2495 title: "是否删除订单?", 2517 title: "是否删除订单?",
2496 - success: function(tt) { 2518 + success: function (tt) {
2497 tt.confirm && getApp().request.put("/api/weshop/order/updatebyId", { 2519 tt.confirm && getApp().request.put("/api/weshop/order/updatebyId", {
2498 data: up_data, 2520 data: up_data,
2499 success: function (t) { 2521 success: function (t) {
2500 - getApp().my_warnning("删除成功",1,th); 2522 + getApp().my_warnning("删除成功", 1, th);
2501 setTimeout(function () { 2523 setTimeout(function () {
2502 getApp().goto("/pages/user/order_list/order_list"); 2524 getApp().goto("/pages/user/order_list/order_list");
2503 - },1000); 2525 + }, 1000);
2504 } 2526 }
2505 }) 2527 })
2506 } 2528 }
2507 }); 2529 });
2508 }, 2530 },
2509 2531
2510 - go_goods:function (e) {  
2511 - var url=e.currentTarget.dataset.url; 2532 + go_goods: function (e) {
  2533 + var url = e.currentTarget.dataset.url;
2512 getApp().goto(url); 2534 getApp().goto(url);
2513 }, 2535 },
2514 - toast(msg){ 2536 + toast(msg) {
2515 wx.showToast({ 2537 wx.showToast({
2516 title: msg, 2538 title: msg,
2517 icon: 'none', 2539 icon: 'none',
@@ -2519,15 +2541,15 @@ Page({ @@ -2519,15 +2541,15 @@ Page({
2519 }) 2541 })
2520 }, 2542 },
2521 //--------确认收货--------- 2543 //--------确认收货---------
2522 - confirmOrder: function(e) {  
2523 - var th=this;  
2524 - var o = this.data.order.order_id,order=this.data.order; 2544 + confirmOrder: function (e) {
  2545 + var th = this;
  2546 + var o = this.data.order.order_id, order = this.data.order;
2525 wx.showModal({ 2547 wx.showModal({
2526 title: "是否确认收货?", 2548 title: "是否确认收货?",
2527 - success: function(t) {  
2528 - t.confirm && getApp().request.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{  
2529 - success:function (e) {  
2530 - if(e.data.code==0){ 2549 + success: function (t) {
  2550 + t.confirm && getApp().request.post("/api/weshop/order/confirmOrder/" + os.stoid + "/" + o + "/" + getApp().globalData.user_id, {
  2551 + success: function (e) {
  2552 + if (e.data.code == 0) {
2531 th.setData({}) 2553 th.setData({})
2532 } 2554 }
2533 } 2555 }
@@ -2538,13 +2560,13 @@ Page({ @@ -2538,13 +2560,13 @@ Page({
2538 2560
2539 2561
2540 //---------联系客服------------ 2562 //---------联系客服------------
2541 - contactService: function() {  
2542 - getApp().getConfig(function(t) { 2563 + contactService: function () {
  2564 + getApp().getConfig(function (t) {
2543 if (t.store_tel == undefined) { 2565 if (t.store_tel == undefined) {
2544 getApp().request.get("/api/weshop/store/get/" + os.stoid, { 2566 getApp().request.get("/api/weshop/store/get/" + os.stoid, {
2545 isShowLoading: 1, 2567 isShowLoading: 1,
2546 data: {}, 2568 data: {},
2547 - success: function(rs) { 2569 + success: function (rs) {
2548 getApp().globalData.config = rs.data.data; 2570 getApp().globalData.config = rs.data.data;
2549 if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { 2571 if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
2550 getApp().my_warnning("商家未设置电话", 0, th); 2572 getApp().my_warnning("商家未设置电话", 0, th);
@@ -2560,13 +2582,13 @@ Page({ @@ -2560,13 +2582,13 @@ Page({
2560 }, 2582 },
2561 2583
2562 //---------联系微信客服------------ 2584 //---------联系微信客服------------
2563 - con_weixin:function () {  
2564 - var url=this.data.sys_switch.weapp_customertype_url;  
2565 - var id=this.data.sys_switch.weapp_customertype_appid; 2585 + con_weixin: function () {
  2586 + var url = this.data.sys_switch.weapp_customertype_url;
  2587 + var id = this.data.sys_switch.weapp_customertype_appid;
2566 wx.openCustomerServiceChat({ 2588 wx.openCustomerServiceChat({
2567 - extInfo: {url: url}, 2589 + extInfo: { url: url },
2568 corpId: id, 2590 corpId: id,
2569 - success(res) {} 2591 + success(res) { }
2570 }) 2592 })
2571 } 2593 }
2572 2594
packageC/pages/presell/cart/cart2.js
@@ -121,25 +121,25 @@ Page({ @@ -121,25 +121,25 @@ Page({
121 tabs: ['门店自提', '快递邮寄'], 121 tabs: ['门店自提', '快递邮寄'],
122 currentTabIndex: 1, 122 currentTabIndex: 1,
123 123
124 - in_zhact_gdmap:{}, //不同门店参与同一活动的限购  
125 - hid_inp:1,  
126 - user_note:{}, 124 + in_zhact_gdmap: {}, //不同门店参与同一活动的限购
  125 + hid_inp: 1,
  126 + user_note: {},
127 }, 127 },
128 onLoad: function (t) { 128 onLoad: function (t) {
129 - wx.setNavigationBarTitle({title: "填写订单",}) 129 + wx.setNavigationBarTitle({ title: "填写订单", })
130 var th = this; 130 var th = this;
131 //清理一下,确保最新的系统配置 131 //清理一下,确保最新的系统配置
132 getApp().globalData.config2 = null; 132 getApp().globalData.config2 = null;
133 //清空is_pick_up 133 //清空is_pick_up
134 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 134 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
135 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 135 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
136 success: function (s) { 136 success: function (s) {
137 } 137 }
138 }); 138 });
139 139
140 }, 140 },
141 onUnload: function () { 141 onUnload: function () {
142 - this.setData({isclose: 1}) 142 + this.setData({ isclose: 1 })
143 }, 143 },
144 onHide: function () { 144 onHide: function () {
145 this.setData({ 145 this.setData({
@@ -152,7 +152,7 @@ Page({ @@ -152,7 +152,7 @@ Page({
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 onShow: function () { 153 onShow: function () {
154 var th = this; 154 var th = this;
155 - th.setData({show_submit: 0}); //让提交先掩藏 155 + th.setData({ show_submit: 0 }); //让提交先掩藏
156 th.data.g_cart_q_time = null; 156 th.data.g_cart_q_time = null;
157 157
158 if (th.data.isclose == 0) { 158 if (th.data.isclose == 0) {
@@ -182,20 +182,20 @@ Page({ @@ -182,20 +182,20 @@ Page({
182 th.data.is_summit_ing = 0; 182 th.data.is_summit_ing = 0;
183 //更换地址回来要重新调用计算价钱的接口 183 //更换地址回来要重新调用计算价钱的接口
184 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { 184 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
185 - th.setData({user_addr: ie}); 185 + th.setData({ user_addr: ie });
186 if (th.data.is_b_now == 1) { 186 if (th.data.is_b_now == 1) {
187 if (th.data.bn_goods) { 187 if (th.data.bn_goods) {
188 - th.setData({add_back: 1}); 188 + th.setData({ add_back: 1 });
189 //th.calculatePrice2(); 189 //th.calculatePrice2();
190 } 190 }
191 } else { 191 } else {
192 if (th.data.cartlist) { 192 if (th.data.cartlist) {
193 - th.setData({add_back: 1}); 193 + th.setData({ add_back: 1 });
194 //th.calculatePrice(); 194 //th.calculatePrice();
195 } 195 }
196 } 196 }
197 } else { 197 } else {
198 - th.setData({user_addr: ie}); 198 + th.setData({ user_addr: ie });
199 } 199 }
200 var going = 0; 200 var going = 0;
201 201
@@ -234,34 +234,34 @@ Page({ @@ -234,34 +234,34 @@ Page({
234 //-- 获取所有的等级卡, -- 234 //-- 获取所有的等级卡, --
235 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 235 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
236 {}).then(res => { 236 {}).then(res => {
237 - if (res.data.code == 0) {  
238 - var plusCard = res.data.data;  
239 - //-- 循环判断,拿到最贵的那张卡 --  
240 - for (var ih in plusCard) {  
241 - if (plusCard[ih].IsStopBuy == true) {  
242 - continue;  
243 - }  
244 - if (max_price < 0) {  
245 - max_price = plusCard[ih].CardFee;  
246 - name = 'card' + plusCard[ih]['CorrPrice'];  
247 - show_card = plusCard[ih];  
248 - } else {  
249 - if (max_price < plusCard[ih].CardFee) { 237 + if (res.data.code == 0) {
  238 + var plusCard = res.data.data;
  239 + //-- 循环判断,拿到最贵的那张卡 --
  240 + for (var ih in plusCard) {
  241 + if (plusCard[ih].IsStopBuy == true) {
  242 + continue;
  243 + }
  244 + if (max_price < 0) {
250 max_price = plusCard[ih].CardFee; 245 max_price = plusCard[ih].CardFee;
251 name = 'card' + plusCard[ih]['CorrPrice']; 246 name = 'card' + plusCard[ih]['CorrPrice'];
252 show_card = plusCard[ih]; 247 show_card = plusCard[ih];
  248 + } else {
  249 + if (max_price < plusCard[ih].CardFee) {
  250 + max_price = plusCard[ih].CardFee;
  251 + name = 'card' + plusCard[ih]['CorrPrice'];
  252 + show_card = plusCard[ih];
  253 + }
253 } 254 }
254 } 255 }
255 - }  
256 256
257 - if (show_card) {  
258 - name = name.toLowerCase();  
259 - th.setData({card_name: name, show_card: show_card}) 257 + if (show_card) {
  258 + name = name.toLowerCase();
  259 + th.setData({ card_name: name, show_card: show_card })
  260 + }
260 } 261 }
261 - }  
262 - //-----先获取物流,再获取用户信息,再展示页面-----  
263 - th.get_wuliu(th.get_info(th.show_page));  
264 - }) 262 + //-----先获取物流,再获取用户信息,再展示页面-----
  263 + th.get_wuliu(th.get_info(th.show_page));
  264 + })
265 } else { 265 } else {
266 //-----先获取物流,再获取用户信息,再展示页面----- 266 //-----先获取物流,再获取用户信息,再展示页面-----
267 th.get_wuliu(th.get_info(th.show_page)); 267 th.get_wuliu(th.get_info(th.show_page));
@@ -281,10 +281,10 @@ Page({ @@ -281,10 +281,10 @@ Page({
281 if (th.data.is_default_logistics) { 281 if (th.data.is_default_logistics) {
282 //如果第一个不是开启默认,说明要让用户自己选 282 //如果第一个不是开启默认,说明要让用户自己选
283 if (!e[0].is_default) { 283 if (!e[0].is_default) {
284 - th.setData({is_default_logistics: 0}); 284 + th.setData({ is_default_logistics: 0 });
285 } 285 }
286 } 286 }
287 - th.setData({wu_arr: e}) 287 + th.setData({ wu_arr: e })
288 typeof func == "function" && func(); 288 typeof func == "function" && func();
289 }) 289 })
290 }, 290 },
@@ -298,7 +298,7 @@ Page({ @@ -298,7 +298,7 @@ Page({
298 getuser_addr: function (func) { 298 getuser_addr: function (func) {
299 var th = this; 299 var th = this;
300 a.get("/api/weshop/useraddress/page", { 300 a.get("/api/weshop/useraddress/page", {
301 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 301 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
302 success: function (su) { 302 success: function (su) {
303 /*--- 303 /*---
304 var user_addr=[ 304 var user_addr=[
@@ -323,7 +323,7 @@ Page({ @@ -323,7 +323,7 @@ Page({
323 } 323 }
324 324
325 if (item == undefined) item = null; 325 if (item == undefined) item = null;
326 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 326 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
327 327
328 func(item); 328 func(item);
329 } 329 }
@@ -338,32 +338,32 @@ Page({ @@ -338,32 +338,32 @@ Page({
338 //会员的信息,要获取最新 338 //会员的信息,要获取最新
339 var user = getApp().globalData.userInfo; 339 var user = getApp().globalData.userInfo;
340 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { 340 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
341 - data: {r: Math.random()}, 341 + data: { r: Math.random() },
342 success: function (e) { 342 success: function (e) {
343 getApp().globalData.userInfo = e.data.data; 343 getApp().globalData.userInfo = e.data.data;
344 - th.setData({userinfo: e.data.data}); 344 + th.setData({ userinfo: e.data.data });
345 345
346 //选获取地址 346 //选获取地址
347 th.getuser_addr(function (addr) { 347 th.getuser_addr(function (addr) {
348 - th.setData({user_addr: addr});  
349 - //--------------------------立即购买------------------  
350 - //读取门店  
351 - to.get_allsto(function (e) {  
352 - th.setData({allsto: e});  
353 - //获取立即购买的商品信息  
354 - th.get_buy_goods();  
355 - }); 348 + th.setData({ user_addr: addr });
  349 + //--------------------------立即购买------------------
  350 + //读取门店
  351 + to.get_allsto(function (e) {
  352 + th.setData({ allsto: e });
  353 + //获取立即购买的商品信息
  354 + th.get_buy_goods();
  355 + });
356 356
357 }); 357 });
358 358
359 //获取提现金额 359 //获取提现金额
360 getApp().request.get("/api/weshop/withdrawals/summoney", { 360 getApp().request.get("/api/weshop/withdrawals/summoney", {
361 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, 361 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
362 success: function (su) { 362 success: function (su) {
363 if (su.data.code == 0) { 363 if (su.data.code == 0) {
364 var yuer = parseFloat(th.data.userinfo.user_money - 364 var yuer = parseFloat(th.data.userinfo.user_money -
365 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); 365 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
366 - th.setData({txmon: su.data.data.summoney, yuer: yuer}); 366 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
367 } 367 }
368 } 368 }
369 }); 369 });
@@ -379,127 +379,127 @@ Page({ @@ -379,127 +379,127 @@ Page({
379 th.data.gg = to.get_b_now(); 379 th.data.gg = to.get_b_now();
380 //--------如果goods_id一样,就是要立即购买----- 380 //--------如果goods_id一样,就是要立即购买-----
381 getApp().request.get("/api/weshop/goods/get/" + oo.stoid + "/" + th.data.gg.goods_id, { 381 getApp().request.get("/api/weshop/goods/get/" + oo.stoid + "/" + th.data.gg.goods_id, {
382 - success: async function (t) {  
383 - var gd = t.data.data;  
384 - if (!gd) return false;  
385 -  
386 - t.data.data.original_img = oo.imghost + t.data.data.original_img;  
387 - t.data.data['buynum'] = th.data.gg.goods_num;  
388 - var distr_t = 0, et = 0  
389 - if (t.data.data.distr_type == 0) {  
390 - distr_t = th.data.gg.pick_dis;  
391 - } else {  
392 - distr_t = t.data.data.distr_type;  
393 - } 382 + success: async function (t) {
  383 + var gd = t.data.data;
  384 + if (!gd) return false;
  385 +
  386 + t.data.data.original_img = oo.imghost + t.data.data.original_img;
  387 + t.data.data['buynum'] = th.data.gg.goods_num;
  388 + var distr_t = 0, et = 0
  389 + if (t.data.data.distr_type == 0) {
  390 + distr_t = th.data.gg.pick_dis;
  391 + } else {
  392 + distr_t = t.data.data.distr_type;
  393 + }
394 394
395 - switch (distr_t) {  
396 - case 0:  
397 - et = 1;  
398 - //-- 系统后台有设置要默认的 --  
399 - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;  
400 - break;  
401 - case 1:  
402 - et = 1;  
403 - break;  
404 - case 2:  
405 - et = 0;  
406 - break;  
407 - } 395 + switch (distr_t) {
  396 + case 0:
  397 + et = 1;
  398 + //-- 系统后台有设置要默认的 --
  399 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  400 + break;
  401 + case 1:
  402 + et = 1;
  403 + break;
  404 + case 2:
  405 + et = 0;
  406 + break;
  407 + }
408 408
409 409
410 - var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;  
411 - if (et == 0 && def_exp_code) {  
412 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
413 - var item = th.data.wu_arr[k];  
414 - if (def_exp_code == item.code) {  
415 - m_wind = k;  
416 - } 410 + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  411 + if (et == 0 && def_exp_code) {
  412 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  413 + var item = th.data.wu_arr[k];
  414 + if (def_exp_code == item.code) {
  415 + m_wind = k;
417 } 416 }
418 } 417 }
  418 + }
419 419
420 - if (th.data.bn_goods) {  
421 - et = th.data.bn_exp_type;  
422 - m_wind = th.data.index;  
423 - } 420 + if (th.data.bn_goods) {
  421 + et = th.data.bn_exp_type;
  422 + m_wind = th.data.index;
  423 + }
424 424
425 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
426 - var is_card_back = getApp().globalData.is_card_back;  
427 - if (is_card_back) {  
428 - th.data.card_name = th.data.userinfo.card_field;  
429 - th.data.gg.goods_price = gd[th.data.card_name];  
430 - getApp().globalData.is_card_back = 0;  
431 - th.setData({card_cut_price: 0});  
432 - //如果是秒杀的返回  
433 - if (gd.prom_type == 1) gd.prom_type = 0;  
434 - } else {  
435 - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
436 - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --  
437 - if (!th.data.gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && th.data.gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {  
438 - var cut_p = (th.data.gg.goods_price - gd[th.data.card_name]) * th.data.gg.goods_num;  
439 - th.setData({card_cut_price: cut_p});  
440 - } 425 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  426 + var is_card_back = getApp().globalData.is_card_back;
  427 + if (is_card_back) {
  428 + th.data.card_name = th.data.userinfo.card_field;
  429 + th.data.gg.goods_price = gd[th.data.card_name];
  430 + getApp().globalData.is_card_back = 0;
  431 + th.setData({ card_cut_price: 0 });
  432 + //如果是秒杀的返回
  433 + if (gd.prom_type == 1) gd.prom_type = 0;
  434 + } else {
  435 + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  436 + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
  437 + if (!th.data.gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && th.data.gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  438 + var cut_p = (th.data.gg.goods_price - gd[th.data.card_name]) * th.data.gg.goods_num;
  439 + th.setData({ card_cut_price: cut_p });
441 } 440 }
  441 + }
442 442
443 - //定义变量  
444 - var gg = th.data.gg,act = null,prelist = null;  
445 - var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;  
446 - await getApp().request.promiseGet(url, {}).then(res => {  
447 - if (res.data.code == 0) {  
448 - act = res.data.data;  
449 - }  
450 - })  
451 - if (!act) {  
452 - wx.showToast({title: "未找到活动", icon: 'none', duration: 3000});  
453 - return false;  
454 - }  
455 - if (act.is_end==1 ) {  
456 - wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000});  
457 - return false;  
458 - }  
459 - if( ut.gettimestamp()>act.end_time){  
460 - wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000});  
461 - return false; 443 + //定义变量
  444 + var gg = th.data.gg, act = null, prelist = null;
  445 + var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
  446 + await getApp().request.promiseGet(url, {}).then(res => {
  447 + if (res.data.code == 0) {
  448 + act = res.data.data;
462 } 449 }
  450 + })
  451 + if (!act) {
  452 + wx.showToast({ title: "未找到活动", icon: 'none', duration: 3000 });
  453 + return false;
  454 + }
  455 + if (act.is_end == 1) {
  456 + wx.showToast({ title: '活动已经结束', icon: 'none', duration: 3000 });
  457 + return false;
  458 + }
  459 + if (ut.gettimestamp() > act.end_time) {
  460 + wx.showToast({ title: "活动定金支付时间已过期", icon: 'none', duration: 3000 });
  461 + return false;
  462 + }
463 463
464 - var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;  
465 - await getApp().request.promiseGet(url, {}).then(res => {  
466 - if (res.data.code == 0) {  
467 - prelist = res.data.data;  
468 - }  
469 - })  
470 - if (!prelist) {  
471 - wx.showToast({title: "未找到商品", icon: 'none', duration: 3000});  
472 - return false; 464 + var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;
  465 + await getApp().request.promiseGet(url, {}).then(res => {
  466 + if (res.data.code == 0) {
  467 + prelist = res.data.data;
473 } 468 }
  469 + })
  470 + if (!prelist) {
  471 + wx.showToast({ title: "未找到商品", icon: 'none', duration: 3000 });
  472 + return false;
  473 + }
474 474
475 - //这个位置要拿活动的预售价  
476 - t.data.data.shop_price = prelist.presell_money;  
477 - th.setData({  
478 - bn_goods: t.data.data,  
479 - bn_pickname: gg.pick_name,  
480 - bn_exp_type: et,  
481 - index: m_wind,  
482 - bn_pick: gg.pick_id,  
483 - bn_t_exp_t: distr_t,  
484 - bn_exp_type: et,  
485 - act:act  
486 - }); 475 + //这个位置要拿活动的预售价
  476 + t.data.data.shop_price = prelist.presell_money;
  477 + th.setData({
  478 + bn_goods: t.data.data,
  479 + bn_pickname: gg.pick_name,
  480 + bn_exp_type: et,
  481 + index: m_wind,
  482 + bn_pick: gg.pick_id,
  483 + bn_t_exp_t: distr_t,
  484 + bn_exp_type: et,
  485 + act: act
  486 + });
487 487
488 - if(act.is_usecoupon==1){  
489 - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;  
490 - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";  
491 - th.data.check_quan_ware_list = t.data.data.erpwareid + "";  
492 - } 488 + if (act.is_usecoupon == 1) {
  489 + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
  490 + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
  491 + th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  492 + }
493 493
494 494
495 - //计算价格  
496 - th.calculatePrice2();  
497 - //获取优惠券,如果有券的钱,就调用  
498 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 495 + //计算价格
  496 + th.calculatePrice2();
  497 + //获取优惠券,如果有券的钱,就调用
  498 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
499 499
500 500
501 - },  
502 - }); 501 + },
  502 + });
503 503
504 }, 504 },
505 505
@@ -507,14 +507,14 @@ Page({ @@ -507,14 +507,14 @@ Page({
507 checkAddressList: function () { 507 checkAddressList: function () {
508 var t = this; 508 var t = this;
509 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 509 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
510 - title: "请先填写或选择收货地址~",  
511 - success: function (a) {  
512 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
513 - },  
514 - fail: function () {  
515 - wx.navigateBack();  
516 - }  
517 - }), !1); 510 + title: "请先填写或选择收货地址~",
  511 + success: function (a) {
  512 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  513 + },
  514 + fail: function () {
  515 + wx.navigateBack();
  516 + }
  517 + }), !1);
518 }, 518 },
519 showInvoice: function () { 519 showInvoice: function () {
520 this.setData({ 520 this.setData({
@@ -533,7 +533,7 @@ Page({ @@ -533,7 +533,7 @@ Page({
533 }, 533 },
534 keyUpChangeNum: function (t) { 534 keyUpChangeNum: function (t) {
535 var index = t.currentTarget.dataset.index; 535 var index = t.currentTarget.dataset.index;
536 - var txt="user_note."+index; 536 + var txt = "user_note." + index;
537 this.setData({ 537 this.setData({
538 maxWord: t.detail.value.length, 538 maxWord: t.detail.value.length,
539 [txt]: t.detail.value 539 [txt]: t.detail.value
@@ -564,7 +564,7 @@ Page({ @@ -564,7 +564,7 @@ Page({
564 } 564 }
565 } 565 }
566 var set_txt = "cartlist[" + iter + "].can_num"; 566 var set_txt = "cartlist[" + iter + "].can_num";
567 - th.setData({[set_txt]: num}); 567 + th.setData({ [set_txt]: num });
568 } 568 }
569 }, 569 },
570 570
@@ -595,10 +595,10 @@ Page({ @@ -595,10 +595,10 @@ Page({
595 595
596 allpice = parseFloat(allpice).toFixed(2); 596 allpice = parseFloat(allpice).toFixed(2);
597 var txt = "formData.all_price"; 597 var txt = "formData.all_price";
598 - th.setData({[txt]: allpice,}); 598 + th.setData({ [txt]: allpice, });
599 if (cut_price) { 599 if (cut_price) {
600 var c_txt = "formData.cut_price"; 600 var c_txt = "formData.cut_price";
601 - th.setData({[c_txt]: cut_price,}); 601 + th.setData({ [c_txt]: cut_price, });
602 602
603 } 603 }
604 604
@@ -612,7 +612,7 @@ Page({ @@ -612,7 +612,7 @@ Page({
612 to.getwuliuprice(async function (rs) { 612 to.getwuliuprice(async function (rs) {
613 613
614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
615 - var out_of_weight=null; //超出多少重量 615 + var out_of_weight = null; //超出多少重量
616 var freight_free = ee.freight_free; //全场满多少包邮 616 var freight_free = ee.freight_free; //全场满多少包邮
617 var weight_free = ee.weight_free; //多少kg内包邮 617 var weight_free = ee.weight_free; //多少kg内包邮
618 var no_ex_id = ee.no_ex_id; 618 var no_ex_id = ee.no_ex_id;
@@ -666,7 +666,7 @@ Page({ @@ -666,7 +666,7 @@ Page({
666 arr.push(item); 666 arr.push(item);
667 } 667 }
668 if (arr) { 668 if (arr) {
669 - th.setData({get_by_quan_list: arr}); 669 + th.setData({ get_by_quan_list: arr });
670 } 670 }
671 th.data.isget_by_quan[th.data.bn_pick] = 1; 671 th.data.isget_by_quan[th.data.bn_pick] = 1;
672 } 672 }
@@ -682,7 +682,9 @@ Page({ @@ -682,7 +682,9 @@ Page({
682 if (goods_weight < 0) goods_weight = 0; 682 if (goods_weight < 0) goods_weight = 0;
683 //累积商品重量 每种商品的重量 * 数量 683 //累积商品重量 每种商品的重量 * 数量
684 goods_weight += good['weight'] * good['buynum']; 684 goods_weight += good['weight'] * good['buynum'];
685 - out_of_weight = (weight_free * 1000 ) - goods_weight; 685 + if (weight_free > 0) {
  686 + out_of_weight = (weight_free * 1000) - goods_weight;
  687 + }
686 break; 688 break;
687 case 3: 689 case 3:
688 if (goods_piece < 0) goods_piece = 0; 690 if (goods_piece < 0) goods_piece = 0;
@@ -693,18 +695,17 @@ Page({ @@ -693,18 +695,17 @@ Page({
693 695
694 var code = ""; 696 var code = "";
695 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 697 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
696 - 698 +
697 th.data.is_no_by[th.data.bn_pick] = 0; 699 th.data.is_no_by[th.data.bn_pick] = 0;
698 700
699 var no_by_data = null; 701 var no_by_data = null;
700 var gift_freight_free = freight_free; 702 var gift_freight_free = freight_free;
701 703
702 -  
703 //有不包邮区域,且不免运费 704 //有不包邮区域,且不免运费
704 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { 705 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) {
705 //-----------获取不包邮区域,不包邮商品------- 706 //-----------获取不包邮区域,不包邮商品-------
706 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 707 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
707 - data: {store_id: os.stoid, id: no_ex_id} 708 + data: { store_id: os.stoid, id: no_ex_id }
708 }).then(res => { 709 }).then(res => {
709 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 710 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
710 no_by_data = res.data.data[0]; 711 no_by_data = res.data.data[0];
@@ -712,6 +713,8 @@ Page({ @@ -712,6 +713,8 @@ Page({
712 if (res.data.data[0].region_list) { 713 if (res.data.data[0].region_list) {
713 if (th.check_by_area(res.data.data[0].region_list)) { 714 if (th.check_by_area(res.data.data[0].region_list)) {
714 freight_free = 0; 715 freight_free = 0;
  716 + out_of_weight = 0;
  717 + weight_free=-1;
715 th.data.is_no_by[th.data.bn_pick] = 1; 718 th.data.is_no_by[th.data.bn_pick] = 1;
716 } 719 }
717 } 720 }
@@ -719,6 +722,8 @@ Page({ @@ -719,6 +722,8 @@ Page({
719 if (res.data.data[0].goods_list && freight_free) { 722 if (res.data.data[0].goods_list && freight_free) {
720 if (th.check_by_goods(res.data.data[0].goods_list)) { 723 if (th.check_by_goods(res.data.data[0].goods_list)) {
721 freight_free = 0; 724 freight_free = 0;
  725 + out_of_weight = 0;
  726 + weight_free=-1;
722 th.data.is_no_by[th.data.bn_pick] = 1; 727 th.data.is_no_by[th.data.bn_pick] = 1;
723 } 728 }
724 } 729 }
@@ -729,13 +734,13 @@ Page({ @@ -729,13 +734,13 @@ Page({
729 th.data.is_by[th.data.bn_pick] = 0; 734 th.data.is_by[th.data.bn_pick] = 0;
730 //--------------开始计算物流------------------ 735 //--------------开始计算物流------------------
731 var shipping_price = 736 var shipping_price =
732 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
733 - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 737 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  738 + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs,th.data.bn_pick);
734 739
735 //如果有赠品的时候,也要计算赠品的物流费用 740 //如果有赠品的时候,也要计算赠品的物流费用
736 if (th.data.buy_now_gift_goods) { 741 if (th.data.buy_now_gift_goods) {
737 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free,  
738 - parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 742 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, gift_weight_free,
  743 + parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece,th.data.bn_pick);
739 } 744 }
740 745
741 if (shipping_price <= 0) { 746 if (shipping_price <= 0) {
@@ -744,18 +749,18 @@ Page({ @@ -744,18 +749,18 @@ Page({
744 749
745 shipping_price = parseFloat(shipping_price).toFixed(2); 750 shipping_price = parseFloat(shipping_price).toFixed(2);
746 var wl_txt = "formData.shipping_price"; 751 var wl_txt = "formData.shipping_price";
747 - th.setData({[wl_txt]: shipping_price,}) 752 + th.setData({ [wl_txt]: shipping_price, })
748 753
749 } else { 754 } else {
750 var wl_txt = "formData.shipping_price"; 755 var wl_txt = "formData.shipping_price";
751 - th.setData({[wl_txt]: 0,}) 756 + th.setData({ [wl_txt]: 0, })
752 } 757 }
753 758
754 if (quan_no) { 759 if (quan_no) {
755 if (th.data.using_quan[bn_pick].isby == 1) { 760 if (th.data.using_quan[bn_pick].isby == 1) {
756 shipping_price = 0; 761 shipping_price = 0;
757 var wl_txt = "formData.shipping_price"; 762 var wl_txt = "formData.shipping_price";
758 - th.setData({[wl_txt]: 0,}) 763 + th.setData({ [wl_txt]: 0, })
759 } 764 }
760 } 765 }
761 //-----------------支付价,优惠券不减物流----------------- 766 //-----------------支付价,优惠券不减物流-----------------
@@ -774,7 +779,7 @@ Page({ @@ -774,7 +779,7 @@ Page({
774 var order_prom_id = 0; 779 var order_prom_id = 0;
775 if (th.data.order_prom[th.data.bn_pick]) { 780 if (th.data.order_prom[th.data.bn_pick]) {
776 var ord_prom = th.data.order_prom[th.data.bn_pick]; 781 var ord_prom = th.data.order_prom[th.data.bn_pick];
777 - if(!ord_prom.is_xz_yh || quan_price<=0) { 782 + if (!ord_prom.is_xz_yh || quan_price <= 0) {
778 order_prom_id = ord_prom['id']; 783 order_prom_id = ord_prom['id'];
779 switch (ord_prom['type']) { 784 switch (ord_prom['type']) {
780 case 0: 785 case 0:
@@ -792,7 +797,7 @@ Page({ @@ -792,7 +797,7 @@ Page({
792 if (order_prom_id > 0) { 797 if (order_prom_id > 0) {
793 var order_prom_txt1 = "formData.order_prom_id"; 798 var order_prom_txt1 = "formData.order_prom_id";
794 var order_prom_txt2 = "formData.order_prom_amount"; 799 var order_prom_txt2 = "formData.order_prom_amount";
795 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 800 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
796 } 801 }
797 802
798 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 803 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -802,7 +807,7 @@ Page({ @@ -802,7 +807,7 @@ Page({
802 order_m = order_m.toFixed(2); 807 order_m = order_m.toFixed(2);
803 808
804 var atxt = "formData.total_amount"; 809 var atxt = "formData.total_amount";
805 - th.setData({[atxt]: total_m,}) 810 + th.setData({ [atxt]: total_m, })
806 811
807 var txt = "formData.user_money"; 812 var txt = "formData.user_money";
808 var txt2 = "formData.order_amount"; 813 var txt2 = "formData.order_amount";
@@ -812,43 +817,43 @@ Page({ @@ -812,43 +817,43 @@ Page({
812 if (th.data.bn_use_money == 1) { 817 if (th.data.bn_use_money == 1) {
813 if (amoney > order_m) { 818 if (amoney > order_m) {
814 order_m = parseFloat(order_m).toFixed(2); 819 order_m = parseFloat(order_m).toFixed(2);
815 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 820 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
816 } else { 821 } else {
817 order_m = parseFloat(order_m) - parseFloat(amoney); 822 order_m = parseFloat(order_m) - parseFloat(amoney);
818 order_m = order_m.toFixed(2); 823 order_m = order_m.toFixed(2);
819 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 824 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
820 } 825 }
821 } else { 826 } else {
822 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 827 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
823 } 828 }
824 //优惠活动送积分 829 //优惠活动送积分
825 if (good.s_intValue) { 830 if (good.s_intValue) {
826 txt = "formData.give_integral"; 831 txt = "formData.give_integral";
827 - th.setData({[txt]: good.s_intValue}); 832 + th.setData({ [txt]: good.s_intValue });
828 } 833 }
829 //优惠送券 834 //优惠送券
830 if (good.s_coupon_id) { 835 if (good.s_coupon_id) {
831 var i_txt = "formData.give_coupon_id"; 836 var i_txt = "formData.give_coupon_id";
832 //这个是json格式的 837 //这个是json格式的
833 var i_txt1 = "formData.g_coupon_num"; 838 var i_txt1 = "formData.g_coupon_num";
834 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 839 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
835 ob = JSON.stringify(ob); 840 ob = JSON.stringify(ob);
836 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 841 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
837 } 842 }
838 //优惠礼包 843 //优惠礼包
839 if (good.s_libao) { 844 if (good.s_libao) {
840 var l_txt = "formData.give_lb_id"; 845 var l_txt = "formData.give_lb_id";
841 //这个是json格式的 846 //这个是json格式的
842 var l_txt1 = "formData.g_lb_num"; 847 var l_txt1 = "formData.g_lb_num";
843 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 848 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
844 ob = JSON.stringify(ob); 849 ob = JSON.stringify(ob);
845 - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); 850 + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob });
846 } 851 }
847 }) 852 })
848 } else { 853 } else {
849 var order_prom_txt1 = "formData.order_prom_id"; 854 var order_prom_txt1 = "formData.order_prom_id";
850 var order_prom_txt2 = "formData.order_prom_amount"; 855 var order_prom_txt2 = "formData.order_prom_amount";
851 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 856 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
852 857
853 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 858 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
854 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); 859 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
@@ -857,7 +862,7 @@ Page({ @@ -857,7 +862,7 @@ Page({
857 total_m = total_m.toFixed(2); 862 total_m = total_m.toFixed(2);
858 order_m = order_m.toFixed(2); 863 order_m = order_m.toFixed(2);
859 864
860 - th.setData({[atxt]: total_m,}) 865 + th.setData({ [atxt]: total_m, })
861 866
862 var txt = "formData.user_money"; 867 var txt = "formData.user_money";
863 var txt2 = "formData.order_amount"; 868 var txt2 = "formData.order_amount";
@@ -867,37 +872,37 @@ Page({ @@ -867,37 +872,37 @@ Page({
867 if (th.data.bn_use_money == 1) { 872 if (th.data.bn_use_money == 1) {
868 if (amoney > order_m) { 873 if (amoney > order_m) {
869 order_m = parseFloat(order_m).toFixed(2); 874 order_m = parseFloat(order_m).toFixed(2);
870 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 875 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
871 } else { 876 } else {
872 order_m = parseFloat(order_m) - parseFloat(amoney); 877 order_m = parseFloat(order_m) - parseFloat(amoney);
873 order_m = order_m.toFixed(2); 878 order_m = order_m.toFixed(2);
874 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 879 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
875 } 880 }
876 } else { 881 } else {
877 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 882 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
878 } 883 }
879 //优惠活动送积分 884 //优惠活动送积分
880 if (good.s_intValue) { 885 if (good.s_intValue) {
881 txt = "formData.give_integral"; 886 txt = "formData.give_integral";
882 - th.setData({[txt]: good.s_intValue}); 887 + th.setData({ [txt]: good.s_intValue });
883 } 888 }
884 //优惠送券 889 //优惠送券
885 if (good.s_coupon_id) { 890 if (good.s_coupon_id) {
886 var i_txt = "formData.give_coupon_id"; 891 var i_txt = "formData.give_coupon_id";
887 //这个是json格式的 892 //这个是json格式的
888 var i_txt1 = "formData.g_coupon_num"; 893 var i_txt1 = "formData.g_coupon_num";
889 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 894 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
890 ob = JSON.stringify(ob); 895 ob = JSON.stringify(ob);
891 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 896 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
892 } 897 }
893 //优惠礼包 898 //优惠礼包
894 if (good.s_libao) { 899 if (good.s_libao) {
895 var l_txt = "formData.give_lb_id"; 900 var l_txt = "formData.give_lb_id";
896 //这个是json格式的 901 //这个是json格式的
897 var l_txt1 = "formData.g_lb_num"; 902 var l_txt1 = "formData.g_lb_num";
898 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 903 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
899 ob = JSON.stringify(ob); 904 ob = JSON.stringify(ob);
900 - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); 905 + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob });
901 } 906 }
902 } 907 }
903 908
@@ -908,7 +913,7 @@ Page({ @@ -908,7 +913,7 @@ Page({
908 }, 913 },
909 914
910 //--------------------提交订单----------------------- 915 //--------------------提交订单-----------------------
911 - async submitForm(t){ 916 + async submitForm(t) {
912 var sub_value = t; 917 var sub_value = t;
913 918
914 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 919 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
@@ -981,7 +986,7 @@ Page({ @@ -981,7 +986,7 @@ Page({
981 } 986 }
982 987
983 //--判断优惠活动的提交-- 988 //--判断优惠活动的提交--
984 - if (th.data.formData.cut_price > 0 ) { 989 + if (th.data.formData.cut_price > 0) {
985 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); 990 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2);
986 var ob = [{ 991 var ob = [{
987 "prom_id": th.data.bn_goods.prom_id, 992 "prom_id": th.data.bn_goods.prom_id,
@@ -1044,7 +1049,7 @@ Page({ @@ -1044,7 +1049,7 @@ Page({
1044 goods.guide_id = gg.guide_id; 1049 goods.guide_id = gg.guide_id;
1045 goods.guide_type = gg.guide_type; 1050 goods.guide_type = gg.guide_type;
1046 //调用接口判断是不是会员 1051 //调用接口判断是不是会员
1047 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 1052 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
1048 if (res.data.code == 0) { 1053 if (res.data.code == 0) {
1049 goods.guide_name = res.data.data.salesman; 1054 goods.guide_name = res.data.data.salesman;
1050 goods.guide_sn = res.data.data.salesman_no; 1055 goods.guide_sn = res.data.data.salesman_no;
@@ -1096,7 +1101,7 @@ Page({ @@ -1096,7 +1101,7 @@ Page({
1096 } 1101 }
1097 1102
1098 var pt_res = null; 1103 var pt_res = null;
1099 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 1104 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
1100 is_json: 1, 1105 is_json: 1,
1101 data: pt_data 1106 data: pt_data
1102 }).then(res => { 1107 }).then(res => {
@@ -1216,14 +1221,14 @@ Page({ @@ -1216,14 +1221,14 @@ Page({
1216 order_prom_list.order_prom_amount = t_item.order_prom_amount; 1221 order_prom_list.order_prom_amount = t_item.order_prom_amount;
1217 } 1222 }
1218 1223
1219 - order_prom_list.discount_amount =0; 1224 + order_prom_list.discount_amount = 0;
1220 //--判断优惠活动的提交-- 1225 //--判断优惠活动的提交--
1221 if (t_item.cut_price > 0) { 1226 if (t_item.cut_price > 0) {
1222 order_prom_list.discount_amount += t_item.cut_price; 1227 order_prom_list.discount_amount += t_item.cut_price;
1223 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); 1228 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json);
1224 } 1229 }
1225 //--判断组合优惠活动的提交-- 1230 //--判断组合优惠活动的提交--
1226 - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { 1231 + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) {
1227 order_prom_list.discount_amount += t_item.zh_cut_price; 1232 order_prom_list.discount_amount += t_item.zh_cut_price;
1228 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); 1233 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json);
1229 } 1234 }
@@ -1238,11 +1243,11 @@ Page({ @@ -1238,11 +1243,11 @@ Page({
1238 order_prom_list.give_lb_id = t_item.s_libao; 1243 order_prom_list.give_lb_id = t_item.s_libao;
1239 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); 1244 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num);
1240 } 1245 }
1241 - if (Object.keys(order_prom_list).length > 0){  
1242 - if(order_prom_list.discount_amount)  
1243 - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);  
1244 - if(order_prom_list.order_prom_amount)  
1245 - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); 1246 + if (Object.keys(order_prom_list).length > 0) {
  1247 + if (order_prom_list.discount_amount)
  1248 + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
  1249 + if (order_prom_list.order_prom_amount)
  1250 + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2);
1246 item.order_prom_list = order_prom_list; 1251 item.order_prom_list = order_prom_list;
1247 } 1252 }
1248 1253
@@ -1266,7 +1271,7 @@ Page({ @@ -1266,7 +1271,7 @@ Page({
1266 //-------------让商品添加到商品列表-------------------- 1271 //-------------让商品添加到商品列表--------------------
1267 for (var k = 0; k < t_item.goods.length; k++) { 1272 for (var k = 0; k < t_item.goods.length; k++) {
1268 var g_item = t_item.goods[k]; 1273 var g_item = t_item.goods[k];
1269 - if(g_item.goods_num<=0) continue; 1274 + if (g_item.goods_num <= 0) continue;
1270 var goods = { 1275 var goods = {
1271 'goods_id': g_item.goods_id, 1276 'goods_id': g_item.goods_id,
1272 'goods_name': g_item.goods_name, 1277 'goods_name': g_item.goods_name,
@@ -1279,7 +1284,7 @@ Page({ @@ -1279,7 +1284,7 @@ Page({
1279 }; 1284 };
1280 1285
1281 //-- 线下取价也要写入,组合购的商品不能去线下价格 -- 1286 //-- 线下取价也要写入,组合购的商品不能去线下价格 --
1282 - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { 1287 + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
1283 goods.goods_price = g_item.offline_price; 1288 goods.goods_price = g_item.offline_price;
1284 goods.member_goods_price = g_item.offline_price; 1289 goods.member_goods_price = g_item.offline_price;
1285 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); 1290 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
@@ -1290,7 +1295,7 @@ Page({ @@ -1290,7 +1295,7 @@ Page({
1290 if (t_item.quan_youhui_list && t_item.coupon_price) { 1295 if (t_item.quan_youhui_list && t_item.coupon_price) {
1291 for (var kk in t_item.quan_youhui_list) { 1296 for (var kk in t_item.quan_youhui_list) {
1292 var you_item = t_item.quan_youhui_list[kk]; 1297 var you_item = t_item.quan_youhui_list[kk];
1293 - if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { 1298 + if (g_item.prom_type != 7 && g_item.erpwareid == you_item.WareId) {
1294 goods.quan_num = you_item.WareCashSum; 1299 goods.quan_num = you_item.WareCashSum;
1295 goods.quan_no = you_item.CashRepNo; 1300 goods.quan_no = you_item.CashRepNo;
1296 } 1301 }
@@ -1341,7 +1346,7 @@ Page({ @@ -1341,7 +1346,7 @@ Page({
1341 } 1346 }
1342 1347
1343 //把优惠的平摊结果写进去 1348 //把优惠的平摊结果写进去
1344 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { 1349 + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
1345 if (g_item.account >= 0) goods.account = g_item.account; 1350 if (g_item.account >= 0) goods.account = g_item.account;
1346 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; 1351 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
1347 item.is_discount_amount = 1; 1352 item.is_discount_amount = 1;
@@ -1352,7 +1357,7 @@ Page({ @@ -1352,7 +1357,7 @@ Page({
1352 goods.guide_id = g_item.guide_id; 1357 goods.guide_id = g_item.guide_id;
1353 goods.guide_type = g_item.guide_type; 1358 goods.guide_type = g_item.guide_type;
1354 //调用接口判断是不是会员 1359 //调用接口判断是不是会员
1355 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { 1360 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
1356 if (res.data.code == 0) { 1361 if (res.data.code == 0) {
1357 goods.guide_name = res.data.data.salesman; 1362 goods.guide_name = res.data.data.salesman;
1358 goods.guide_sn = res.data.data.salesman_no; 1363 goods.guide_sn = res.data.data.salesman_no;
@@ -1378,7 +1383,7 @@ Page({ @@ -1378,7 +1383,7 @@ Page({
1378 if (pdata.length == 0) return; 1383 if (pdata.length == 0) return;
1379 var str = JSON.stringify(pdata); 1384 var str = JSON.stringify(pdata);
1380 1385
1381 - wx.showLoading({title: "加载中"}); 1386 + wx.showLoading({ title: "加载中" });
1382 wx.request({ 1387 wx.request({
1383 url: oo.url + '/api/weshop/order/createWxdOrder', 1388 url: oo.url + '/api/weshop/order/createWxdOrder',
1384 data: str, 1389 data: str,
@@ -1409,7 +1414,7 @@ Page({ @@ -1409,7 +1414,7 @@ Page({
1409 }) 1414 })
1410 //要进行判断,如果是用微信支付,就要跳转到支付界面 1415 //要进行判断,如果是用微信支付,就要跳转到支付界面
1411 if (order_amount > 0) { 1416 if (order_amount > 0) {
1412 - th.setData({isclose: 0}); 1417 + th.setData({ isclose: 0 });
1413 //void e.jumpToCart4({ 1418 //void e.jumpToCart4({
1414 // order_sn: data.data, 1419 // order_sn: data.data,
1415 //}, 1); 1420 //}, 1);
@@ -1424,12 +1429,12 @@ Page({ @@ -1424,12 +1429,12 @@ Page({
1424 }, function () { 1429 }, function () {
1425 //支付失败 1430 //支付失败
1426 setTimeout(function () { 1431 setTimeout(function () {
1427 - var cps=getCurrentPages();  
1428 - if(cps.length>1){  
1429 - wx.navigateBack({delta: 1})  
1430 - }else{  
1431 - getApp().goto("/pages/index/index/index");  
1432 - } 1432 + var cps = getCurrentPages();
  1433 + if (cps.length > 1) {
  1434 + wx.navigateBack({ delta: 1 })
  1435 + } else {
  1436 + getApp().goto("/pages/index/index/index");
  1437 + }
1433 1438
1434 }, 1000) 1439 }, 1000)
1435 }, oo.stoid); 1440 }, oo.stoid);
@@ -1447,7 +1452,7 @@ Page({ @@ -1447,7 +1452,7 @@ Page({
1447 if (t.data.code == 0) { 1452 if (t.data.code == 0) {
1448 //app.my_warnning("支付成功",1,th); 1453 //app.my_warnning("支付成功",1,th);
1449 //setTimeout(function () { 1454 //setTimeout(function () {
1450 - th.setData({isclose: 0}); 1455 + th.setData({ isclose: 0 });
1451 wx.redirectTo({ 1456 wx.redirectTo({
1452 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, 1457 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
1453 }) 1458 })
@@ -1472,7 +1477,7 @@ Page({ @@ -1472,7 +1477,7 @@ Page({
1472 cancelText: '取消', 1477 cancelText: '取消',
1473 confirmText: '确定', 1478 confirmText: '确定',
1474 showCancel: true, 1479 showCancel: true,
1475 - success(res){ 1480 + success(res) {
1476 if (res.cancel) { 1481 if (res.cancel) {
1477 return; 1482 return;
1478 } else if (res.confirm) { 1483 } else if (res.confirm) {
@@ -1506,11 +1511,11 @@ Page({ @@ -1506,11 +1511,11 @@ Page({
1506 1511
1507 }, 1512 },
1508 //---确认线下门店的数量足不足--- 1513 //---确认线下门店的数量足不足---
1509 - async check_store_num(goods_id, pick, goods_num, func){ 1514 + async check_store_num(goods_id, pick, goods_num, func) {
1510 var lock = 0, pick_no, plist, erpwareid; 1515 var lock = 0, pick_no, plist, erpwareid;
1511 //先读取门店的lock 1516 //先读取门店的lock
1512 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 1517 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
1513 - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} 1518 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
1514 }).then(res => { 1519 }).then(res => {
1515 if (res.data.code == 0 && res.data.data.total > 0) { 1520 if (res.data.code == 0 && res.data.data.total > 0) {
1516 for (var i in res.data.data.pageData) 1521 for (var i in res.data.data.pageData)
@@ -1519,7 +1524,7 @@ Page({ @@ -1519,7 +1524,7 @@ Page({
1519 }) 1524 })
1520 //先获取门店的编号 1525 //先获取门店的编号
1521 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { 1526 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
1522 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 1527 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
1523 }).then(res => { 1528 }).then(res => {
1524 if (res.data.code == 0) { 1529 if (res.data.code == 0) {
1525 pick_no = res.data.data.pickup_no; 1530 pick_no = res.data.data.pickup_no;
@@ -1527,7 +1532,7 @@ Page({ @@ -1527,7 +1532,7 @@ Page({
1527 }) 1532 })
1528 //先获取商品的线下库存 1533 //先获取商品的线下库存
1529 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { 1534 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
1530 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 1535 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
1531 }).then(res => { 1536 }).then(res => {
1532 if (res.data.code == 0) { 1537 if (res.data.code == 0) {
1533 erpwareid = res.data.data.erpwareid; 1538 erpwareid = res.data.data.erpwareid;
@@ -1535,7 +1540,7 @@ Page({ @@ -1535,7 +1540,7 @@ Page({
1535 }) 1540 })
1536 //读取线下的门店库存 1541 //读取线下的门店库存
1537 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 1542 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
1538 - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} 1543 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }
1539 }).then(res => { 1544 }).then(res => {
1540 if (res.data.code == 0) { 1545 if (res.data.code == 0) {
1541 plist = res.data.data.pageData[0]; 1546 plist = res.data.data.pageData[0];
@@ -1577,11 +1582,11 @@ Page({ @@ -1577,11 +1582,11 @@ Page({
1577 wl_txt = t.currentTarget.dataset.wl_txt, 1582 wl_txt = t.currentTarget.dataset.wl_txt,
1578 ont = t.currentTarget.dataset.ont; 1583 ont = t.currentTarget.dataset.ont;
1579 1584
1580 - th.setData({[txt]: ty}); 1585 + th.setData({ [txt]: ty });
1581 var iszt = 1; 1586 var iszt = 1;
1582 1587
1583 if (ty == 0) { 1588 if (ty == 0) {
1584 - th.setData({is_all_zt: 0}); 1589 + th.setData({ is_all_zt: 0 });
1585 } else { 1590 } else {
1586 for (var i = 0; i < th.data.cartlist.length; i++) { 1591 for (var i = 0; i < th.data.cartlist.length; i++) {
1587 var item = th.data.cartlist[i]; 1592 var item = th.data.cartlist[i];
@@ -1591,7 +1596,7 @@ Page({ @@ -1591,7 +1596,7 @@ Page({
1591 } 1596 }
1592 } 1597 }
1593 1598
1594 - th.setData({is_all_zt: iszt}); 1599 + th.setData({ is_all_zt: iszt });
1595 1600
1596 var ind = t.currentTarget.dataset.ind; 1601 var ind = t.currentTarget.dataset.ind;
1597 var c_item = th.data.cartlist[ind]; 1602 var c_item = th.data.cartlist[ind];
@@ -1599,7 +1604,7 @@ Page({ @@ -1599,7 +1604,7 @@ Page({
1599 1604
1600 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { 1605 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) {
1601 th.data.using_quan[pickid] = {}; 1606 th.data.using_quan[pickid] = {};
1602 - th.setData({using_quan: th.data.using_quan}); 1607 + th.setData({ using_quan: th.data.using_quan });
1603 } 1608 }
1604 1609
1605 1610
@@ -1611,7 +1616,7 @@ Page({ @@ -1611,7 +1616,7 @@ Page({
1611 for (var i = 0; i < wu_arr.length; i++) { 1616 for (var i = 0; i < wu_arr.length; i++) {
1612 if (wu_arr[i].shipping_code == def_exp_code) { 1617 if (wu_arr[i].shipping_code == def_exp_code) {
1613 var set_txt = "cartlist" 1618 var set_txt = "cartlist"
1614 - th.setData({wl_txt: i}); 1619 + th.setData({ wl_txt: i });
1615 } 1620 }
1616 } 1621 }
1617 } 1622 }
@@ -1624,9 +1629,9 @@ Page({ @@ -1624,9 +1629,9 @@ Page({
1624 setexptype: function (t) { 1629 setexptype: function (t) {
1625 var th = this; 1630 var th = this;
1626 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 1631 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
1627 - th.setData({bn_exp_type: ty}); 1632 + th.setData({ bn_exp_type: ty });
1628 if (ty == 0) { 1633 if (ty == 0) {
1629 - th.setData({is_all_zt: 0}); 1634 + th.setData({ is_all_zt: 0 });
1630 } 1635 }
1631 1636
1632 //当物流为空的时候。 1637 //当物流为空的时候。
@@ -1639,7 +1644,7 @@ Page({ @@ -1639,7 +1644,7 @@ Page({
1639 if (ty == 1) { 1644 if (ty == 1) {
1640 th.data.isget_by_quan = {}; 1645 th.data.isget_by_quan = {};
1641 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { 1646 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
1642 - th.setData({using_quan: {}}); 1647 + th.setData({ using_quan: {} });
1643 } 1648 }
1644 } 1649 }
1645 1650
@@ -1649,7 +1654,7 @@ Page({ @@ -1649,7 +1654,7 @@ Page({
1649 if (wu_arr != null && wu_arr != "") { 1654 if (wu_arr != null && wu_arr != "") {
1650 for (var i = 0; i < wu_arr.length; i++) { 1655 for (var i = 0; i < wu_arr.length; i++) {
1651 if (wu_arr[i].shipping_code == def_exp_code) { 1656 if (wu_arr[i].shipping_code == def_exp_code) {
1652 - th.setData({index: i}); 1657 + th.setData({ index: i });
1653 } 1658 }
1654 } 1659 }
1655 } 1660 }
@@ -1661,21 +1666,21 @@ Page({ @@ -1661,21 +1666,21 @@ Page({
1661 //--------立即购买时,使用余额-------- 1666 //--------立即购买时,使用余额--------
1662 set_bn_useyuer: function () { 1667 set_bn_useyuer: function () {
1663 var th = this; 1668 var th = this;
1664 - th.setData({bn_use_money: !th.data.bn_use_money}); 1669 + th.setData({ bn_use_money: !th.data.bn_use_money });
1665 th.calculatePrice2(); 1670 th.calculatePrice2();
1666 }, 1671 },
1667 set_js_useyuer: function () { 1672 set_js_useyuer: function () {
1668 var th = this; 1673 var th = this;
1669 - th.setData({js_use_money: !th.data.js_use_money}); 1674 + th.setData({ js_use_money: !th.data.js_use_money });
1670 th.calculatePrice(); 1675 th.calculatePrice();
1671 }, 1676 },
1672 //-------------------计算物流--------------- 1677 //-------------------计算物流---------------
1673 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,  
1674 - goods_piece, user_addr, freight_free, o_price, rs) { 1678 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  1679 + goods_piece, user_addr, freight_free, o_price, rs,pickid) {
1675 var price = 0, th = this; 1680 var price = 0, th = this;
1676 price += parseFloat(o_shipping_price); 1681 price += parseFloat(o_shipping_price);
1677 //如果是包邮 1682 //如果是包邮
1678 - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { 1683 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
1679 return 0; 1684 return 0;
1680 } 1685 }
1681 if (user_addr == null) { 1686 if (user_addr == null) {
@@ -1693,7 +1698,7 @@ Page({ @@ -1693,7 +1698,7 @@ Page({
1693 item = item.config; 1698 item = item.config;
1694 if (item == null) return o_shipping_price; 1699 if (item == null) return o_shipping_price;
1695 //------按重量---------- 1700 //------按重量----------
1696 - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { 1701 + if (goods_weight >= 0 && item['money']) {
1697 fw_price = parseFloat(item['money']); 1702 fw_price = parseFloat(item['money']);
1698 if (goods_weight > item['first_weight']) { 1703 if (goods_weight > item['first_weight']) {
1699 var fw = goods_weight - item['first_weight']; 1704 var fw = goods_weight - item['first_weight'];
@@ -1702,8 +1707,8 @@ Page({ @@ -1702,8 +1707,8 @@ Page({
1702 } 1707 }
1703 } 1708 }
1704 1709
1705 - //------超出重量----------  
1706 - if(out_of_weight < 0){ 1710 + //------超出重量----------
  1711 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
1707 fw_price = parseFloat(item['money']); 1712 fw_price = parseFloat(item['money']);
1708 var out_of_weight = Math.abs(out_of_weight); 1713 var out_of_weight = Math.abs(out_of_weight);
1709 var n = Math.ceil(out_of_weight / item['second_weight']) 1714 var n = Math.ceil(out_of_weight / item['second_weight'])
@@ -1746,13 +1751,13 @@ Page({ @@ -1746,13 +1751,13 @@ Page({
1746 //----------立即购买,选择物流------------- 1751 //----------立即购买,选择物流-------------
1747 bindPickerChange: function (e) { 1752 bindPickerChange: function (e) {
1748 var ind = e.detail.value 1753 var ind = e.detail.value
1749 - this.setData({index: ind}); 1754 + this.setData({ index: ind });
1750 this.calculatePrice2(); 1755 this.calculatePrice2();
1751 }, 1756 },
1752 //----------购物车结算,选择物流------------- 1757 //----------购物车结算,选择物流-------------
1753 bindPickerChange_w: function (e) { 1758 bindPickerChange_w: function (e) {
1754 var ind = e.detail.value, txt = e.currentTarget.dataset.txt; 1759 var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
1755 - this.setData({[txt]: ind}); 1760 + this.setData({ [txt]: ind });
1756 this.calculatePrice(); 1761 this.calculatePrice();
1757 }, 1762 },
1758 1763
@@ -1766,7 +1771,7 @@ Page({ @@ -1766,7 +1771,7 @@ Page({
1766 1771
1767 1772
1768 if (bn == 1) { 1773 if (bn == 1) {
1769 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 1774 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
1770 } else { 1775 } else {
1771 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 1776 //---多单打开券的时候,就要判断券在其他门店是否有使用---
1772 var quanlist = th.data.cartlist[cindx].quan_list; 1777 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -1792,9 +1797,9 @@ Page({ @@ -1792,9 +1797,9 @@ Page({
1792 else 1797 else
1793 get_by_quan_list_cart[i].show_red = 0; 1798 get_by_quan_list_cart[i].show_red = 0;
1794 } 1799 }
1795 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 1800 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
1796 } else { 1801 } else {
1797 - th.setData({by_quan_list_cart: null}); 1802 + th.setData({ by_quan_list_cart: null });
1798 } 1803 }
1799 1804
1800 console.log("2222222券的列表", quanlist); 1805 console.log("2222222券的列表", quanlist);
@@ -1810,7 +1815,7 @@ Page({ @@ -1810,7 +1815,7 @@ Page({
1810 }, 1815 },
1811 close_coupon: function (e) { 1816 close_coupon: function (e) {
1812 var th = this; 1817 var th = this;
1813 - th.setData({open_quan: 0, disabled: 0}); 1818 + th.setData({ open_quan: 0, disabled: 0 });
1814 }, 1819 },
1815 1820
1816 //---判断券时候在已经选择的列表中--- 1821 //---判断券时候在已经选择的列表中---
@@ -1881,14 +1886,14 @@ Page({ @@ -1881,14 +1886,14 @@ Page({
1881 for (var i in quanlist) { 1886 for (var i in quanlist) {
1882 quanlist[i].show_red = 0; 1887 quanlist[i].show_red = 0;
1883 } 1888 }
1884 - this.setData({selected_quan_list: quanlist}); 1889 + this.setData({ selected_quan_list: quanlist });
1885 var by_quanlist = this.data.get_by_quan_list; 1890 var by_quanlist = this.data.get_by_quan_list;
1886 if (by_quanlist) { 1891 if (by_quanlist) {
1887 //---所有的券的显示红色选择都清理一遍--- 1892 //---所有的券的显示红色选择都清理一遍---
1888 for (var inb in by_quanlist) { 1893 for (var inb in by_quanlist) {
1889 by_quanlist[inb].show_red = 0; 1894 by_quanlist[inb].show_red = 0;
1890 } 1895 }
1891 - this.setData({get_by_quan_list: by_quanlist}); 1896 + this.setData({ get_by_quan_list: by_quanlist });
1892 } 1897 }
1893 1898
1894 var by_cart_list = this.data.by_quan_list_cart; 1899 var by_cart_list = this.data.by_quan_list_cart;
@@ -1897,7 +1902,7 @@ Page({ @@ -1897,7 +1902,7 @@ Page({
1897 for (var inc in by_cart_list) { 1902 for (var inc in by_cart_list) {
1898 by_cart_list[inc].show_red = 0; 1903 by_cart_list[inc].show_red = 0;
1899 } 1904 }
1900 - this.setData({by_quan_list_cart: by_cart_list}); 1905 + this.setData({ by_quan_list_cart: by_cart_list });
1901 } 1906 }
1902 1907
1903 var using_quan = this.data.using_quan; 1908 var using_quan = this.data.using_quan;
@@ -1909,9 +1914,9 @@ Page({ @@ -1909,9 +1914,9 @@ Page({
1909 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1914 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1910 } 1915 }
1911 else { 1916 else {
1912 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1917 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1913 } 1918 }
1914 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1919 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1915 return; 1920 return;
1916 } 1921 }
1917 1922
@@ -1928,9 +1933,9 @@ Page({ @@ -1928,9 +1933,9 @@ Page({
1928 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 1933 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
1929 } 1934 }
1930 else { 1935 else {
1931 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 1936 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
1932 } 1937 }
1933 - this.setData({using_quan: using_quan}); 1938 + this.setData({ using_quan: using_quan });
1934 1939
1935 }, 1940 },
1936 1941
@@ -1945,7 +1950,7 @@ Page({ @@ -1945,7 +1950,7 @@ Page({
1945 for (var ind in by_quanlist) { 1950 for (var ind in by_quanlist) {
1946 by_quanlist[ind].show_red = 0; 1951 by_quanlist[ind].show_red = 0;
1947 } 1952 }
1948 - this.setData({get_by_quan_list: by_quanlist}); 1953 + this.setData({ get_by_quan_list: by_quanlist });
1949 } 1954 }
1950 1955
1951 //--购物车过来的包邮券-- 1956 //--购物车过来的包邮券--
@@ -1955,7 +1960,7 @@ Page({ @@ -1955,7 +1960,7 @@ Page({
1955 for (var ind in by_cart_list) { 1960 for (var ind in by_cart_list) {
1956 by_cart_list[ind].show_red = 0; 1961 by_cart_list[ind].show_red = 0;
1957 } 1962 }
1958 - this.setData({by_quan_list_cart: by_cart_list}); 1963 + this.setData({ by_quan_list_cart: by_cart_list });
1959 } 1964 }
1960 //普通券 1965 //普通券
1961 var quanlist = this.data.selected_quan_list; 1966 var quanlist = this.data.selected_quan_list;
@@ -1964,7 +1969,7 @@ Page({ @@ -1964,7 +1969,7 @@ Page({
1964 for (var ind in quanlist) { 1969 for (var ind in quanlist) {
1965 quanlist[ind].show_red = 0; 1970 quanlist[ind].show_red = 0;
1966 } 1971 }
1967 - this.setData({selected_quan_list: quanlist}); 1972 + this.setData({ selected_quan_list: quanlist });
1968 } 1973 }
1969 1974
1970 var th = this; 1975 var th = this;
@@ -1975,9 +1980,9 @@ Page({ @@ -1975,9 +1980,9 @@ Page({
1975 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1980 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1976 } 1981 }
1977 else { 1982 else {
1978 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1983 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1979 } 1984 }
1980 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1985 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1981 return; 1986 return;
1982 } 1987 }
1983 1988
@@ -1988,20 +1993,20 @@ Page({ @@ -1988,20 +1993,20 @@ Page({
1988 var txt1 = ""; 1993 var txt1 = "";
1989 var quan_item = null; 1994 var quan_item = null;
1990 1995
1991 - quan_item = this.data.get_by_quan_list[ind];  
1992 - txt = "get_by_quan_list[" + ind + "].show_red";  
1993 - var obj = {};  
1994 - obj[txt] = 1;  
1995 - this.setData(obj); 1996 + quan_item = this.data.get_by_quan_list[ind];
  1997 + txt = "get_by_quan_list[" + ind + "].show_red";
  1998 + var obj = {};
  1999 + obj[txt] = 1;
  2000 + this.setData(obj);
1996 2001
1997 2002
1998 if (using_quan[th.data.selected_quan_pick]) { 2003 if (using_quan[th.data.selected_quan_pick]) {
1999 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 2004 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
2000 } 2005 }
2001 else { 2006 else {
2002 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 2007 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
2003 } 2008 }
2004 - this.setData({using_quan: using_quan}); 2009 + this.setData({ using_quan: using_quan });
2005 }, 2010 },
2006 2011
2007 //--确认使用券--- 2012 //--确认使用券---
@@ -2061,14 +2066,14 @@ Page({ @@ -2061,14 +2066,14 @@ Page({
2061 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 2066 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
2062 if (using_quan[pickid]) { 2067 if (using_quan[pickid]) {
2063 if (using_quan[pickid].is_nouse_red == 1) { 2068 if (using_quan[pickid].is_nouse_red == 1) {
2064 - using_quan[pickid] = {is_nouse_red: 1};  
2065 - th.setData({using_quan: using_quan}); 2069 + using_quan[pickid] = { is_nouse_red: 1 };
  2070 + th.setData({ using_quan: using_quan });
2066 if (th.data.is_b_now == 1) { 2071 if (th.data.is_b_now == 1) {
2067 th.calculatePrice2(); 2072 th.calculatePrice2();
2068 } else { 2073 } else {
2069 th.calculatePrice(); 2074 th.calculatePrice();
2070 } 2075 }
2071 - th.setData({open_quan: 0}); 2076 + th.setData({ open_quan: 0 });
2072 return; 2077 return;
2073 } 2078 }
2074 } 2079 }
@@ -2087,13 +2092,13 @@ Page({ @@ -2087,13 +2092,13 @@ Page({
2087 }; 2092 };
2088 using_quan[pickid].isby = 1; 2093 using_quan[pickid].isby = 1;
2089 } else { 2094 } else {
2090 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 2095 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
2091 using_quan[pickid].isby = 0; 2096 using_quan[pickid].isby = 0;
2092 } 2097 }
2093 - this.setData({using_quan: using_quan}); 2098 + this.setData({ using_quan: using_quan });
2094 th.calculatePrice2(); 2099 th.calculatePrice2();
2095 2100
2096 - th.setData({open_quan: 0}); 2101 + th.setData({ open_quan: 0 });
2097 }, 2102 },
2098 2103
2099 cart_set_err: function (e) { 2104 cart_set_err: function (e) {
@@ -2130,7 +2135,7 @@ Page({ @@ -2130,7 +2135,7 @@ Page({
2130 var wu_arr_txt = e.currentTarget.dataset.txt; 2135 var wu_arr_txt = e.currentTarget.dataset.txt;
2131 var w_sele_index = e.currentTarget.dataset.w_sele_index; 2136 var w_sele_index = e.currentTarget.dataset.w_sele_index;
2132 var is_express = null; 2137 var is_express = null;
2133 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 2138 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
2134 2139
2135 //--如果是多个门店的时候-- 2140 //--如果是多个门店的时候--
2136 if (w_sele_index != undefined) { 2141 if (w_sele_index != undefined) {
@@ -2141,20 +2146,20 @@ Page({ @@ -2141,20 +2146,20 @@ Page({
2141 }, 2146 },
2142 // 关闭物流的弹窗 2147 // 关闭物流的弹窗
2143 close_express: function () { 2148 close_express: function () {
2144 - this.setData({open_express: 0, disabled: 0}); 2149 + this.setData({ open_express: 0, disabled: 0 });
2145 }, 2150 },
2146 // 选择物流 2151 // 选择物流
2147 click_express_name: function (e) { 2152 click_express_name: function (e) {
2148 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 2153 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
2149 var index = e.currentTarget.dataset.idxe; 2154 var index = e.currentTarget.dataset.idxe;
2150 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 2155 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
2151 ob[this.data.wu_arr_txt] = index; 2156 ob[this.data.wu_arr_txt] = index;
2152 this.setData(ob); 2157 this.setData(ob);
2153 }, 2158 },
2154 2159
2155 //点击确定物流 2160 //点击确定物流
2156 determine_expres: function (e) { 2161 determine_expres: function (e) {
2157 - this.setData({open_express: 0}); 2162 + this.setData({ open_express: 0 });
2158 if (this.data.is_b_now == 1) 2163 if (this.data.is_b_now == 1)
2159 this.calculatePrice2(); 2164 this.calculatePrice2();
2160 else 2165 else
@@ -2174,7 +2179,7 @@ Page({ @@ -2174,7 +2179,7 @@ Page({
2174 obj[txt] = is_open; 2179 obj[txt] = is_open;
2175 2180
2176 this.setData(obj); 2181 this.setData(obj);
2177 - this.setData({disabled: 1}) 2182 + this.setData({ disabled: 1 })
2178 }, 2183 },
2179 2184
2180 clik_coupons2: function (e) { 2185 clik_coupons2: function (e) {
@@ -2189,7 +2194,7 @@ Page({ @@ -2189,7 +2194,7 @@ Page({
2189 obj[txt] = is_open; 2194 obj[txt] = is_open;
2190 2195
2191 this.setData(obj); 2196 this.setData(obj);
2192 - this.setData({disabled: 1}) 2197 + this.setData({ disabled: 1 })
2193 }, 2198 },
2194 2199
2195 2200
@@ -2198,11 +2203,11 @@ Page({ @@ -2198,11 +2203,11 @@ Page({
2198 var th = this; 2203 var th = this;
2199 var is_shipping_code = this.data.is_shipping_code 2204 var is_shipping_code = this.data.is_shipping_code
2200 getApp().request.put("/api/weshop/users/update", { 2205 getApp().request.put("/api/weshop/users/update", {
2201 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 2206 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
2202 success: function (rse) { 2207 success: function (rse) {
2203 if (rse.data.code == 0) { 2208 if (rse.data.code == 0) {
2204 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 2209 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
2205 - th.setData({open_express: 0}); 2210 + th.setData({ open_express: 0 });
2206 //----计算此时购物车的价格---- 2211 //----计算此时购物车的价格----
2207 if (th.data.is_b_now == 1) th.calculatePrice2(); 2212 if (th.data.is_b_now == 1) th.calculatePrice2();
2208 else th.calculatePrice(); 2213 else th.calculatePrice();
@@ -2212,7 +2217,7 @@ Page({ @@ -2212,7 +2217,7 @@ Page({
2212 }, 2217 },
2213 2218
2214 //更新下默认,在onshow里面 2219 //更新下默认,在onshow里面
2215 - update_code(){ 2220 + update_code() {
2216 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 2221 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
2217 //--定时器,判断wu_arr不未空-- 2222 //--定时器,判断wu_arr不未空--
2218 var uii = setInterval(function () { 2223 var uii = setInterval(function () {
@@ -2226,7 +2231,7 @@ Page({ @@ -2226,7 +2231,7 @@ Page({
2226 } 2231 }
2227 //--如果是立即购买-- 2232 //--如果是立即购买--
2228 if (th.data.is_b_now == 1) { 2233 if (th.data.is_b_now == 1) {
2229 - th.setData({index: m_wind, is_express: m_wind}); 2234 + th.setData({ index: m_wind, is_express: m_wind });
2230 } else { 2235 } else {
2231 var ui = setInterval(function () { 2236 var ui = setInterval(function () {
2232 if (th.data.cartlist) { 2237 if (th.data.cartlist) {
@@ -2234,7 +2239,7 @@ Page({ @@ -2234,7 +2239,7 @@ Page({
2234 for (var i in c_arr) { 2239 for (var i in c_arr) {
2235 c_arr[i].wind = m_wind; 2240 c_arr[i].wind = m_wind;
2236 } 2241 }
2237 - th.setData({cartlist: c_arr, is_express: m_wind}) 2242 + th.setData({ cartlist: c_arr, is_express: m_wind })
2238 clearInterval(ui); 2243 clearInterval(ui);
2239 } 2244 }
2240 }, 500) 2245 }, 500)
@@ -2335,10 +2340,10 @@ Page({ @@ -2335,10 +2340,10 @@ Page({
2335 if (th.data.is_b_now) { 2340 if (th.data.is_b_now) {
2336 if (arr && arr.length > 0) { 2341 if (arr && arr.length > 0) {
2337 var quanlist = arr[0].quan_list; 2342 var quanlist = arr[0].quan_list;
2338 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 2343 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
2339 } 2344 }
2340 } else { 2345 } else {
2341 - th.setData({cartlist: arr}) 2346 + th.setData({ cartlist: arr })
2342 th.set_can_num(); 2347 th.set_can_num();
2343 } 2348 }
2344 2349
@@ -2358,7 +2363,7 @@ Page({ @@ -2358,7 +2363,7 @@ Page({
2358 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { 2363 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) {
2359 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 2364 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
2360 var url = "/api/weshop/couponList/getUseCouponList"; 2365 var url = "/api/weshop/couponList/getUseCouponList";
2361 - app.request.promiseGet(url0, {1: 1}).then(res => { 2366 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
2362 if (res.data.code == 0) { 2367 if (res.data.code == 0) {
2363 frozenQuan = res.data.data; 2368 frozenQuan = res.data.data;
2364 th.data.frozenQuan = frozenQuan; 2369 th.data.frozenQuan = frozenQuan;
@@ -2376,7 +2381,7 @@ Page({ @@ -2376,7 +2381,7 @@ Page({
2376 quanlist = res.data.data.pageData; 2381 quanlist = res.data.data.pageData;
2377 if (quanlist) { 2382 if (quanlist) {
2378 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 2383 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
2379 - th.setData({selected_quan_list: quanlist}) 2384 + th.setData({ selected_quan_list: quanlist })
2380 } 2385 }
2381 } 2386 }
2382 } 2387 }
@@ -2404,7 +2409,7 @@ Page({ @@ -2404,7 +2409,7 @@ Page({
2404 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 2409 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
2405 for (var i in arr) { 2410 for (var i in arr) {
2406 var item = arr[i]; 2411 var item = arr[i];
2407 - if (goods_id == item) return 0; 2412 + if (goods_id == item) return 0;
2408 } 2413 }
2409 return 1; 2414 return 1;
2410 }, 2415 },
@@ -2475,7 +2480,7 @@ Page({ @@ -2475,7 +2480,7 @@ Page({
2475 pick = this.data.bn_pick; 2480 pick = this.data.bn_pick;
2476 //---获取订单优惠--- 2481 //---获取订单优惠---
2477 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 2482 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
2478 - data: {store_id: os.stoid, orderAmount: condition} 2483 + data: { store_id: os.stoid, orderAmount: condition }
2479 }).then(res => { 2484 }).then(res => {
2480 if (res.data.code == 0) { 2485 if (res.data.code == 0) {
2481 var data = res.data.data; 2486 var data = res.data.data;
@@ -2497,7 +2502,7 @@ Page({ @@ -2497,7 +2502,7 @@ Page({
2497 var ob = map[pickid][item.prom_id]; 2502 var ob = map[pickid][item.prom_id];
2498 ob.price += item.goods_price * item.goods_num; 2503 ob.price += item.goods_price * item.goods_num;
2499 ob.goods_num += item.goods_num; 2504 ob.goods_num += item.goods_num;
2500 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2505 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2501 2506
2502 } else { 2507 } else {
2503 var prom = null; 2508 var prom = null;
@@ -2513,7 +2518,7 @@ Page({ @@ -2513,7 +2518,7 @@ Page({
2513 ob.is_bz = prom.is_bz; 2518 ob.is_bz = prom.is_bz;
2514 ob.is_xz_yh = prom.is_xz_yh; 2519 ob.is_xz_yh = prom.is_xz_yh;
2515 ob.goods = new Array(); 2520 ob.goods = new Array();
2516 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2521 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2517 map[pickid][item.prom_id] = ob; 2522 map[pickid][item.prom_id] = ob;
2518 } 2523 }
2519 } else { 2524 } else {
@@ -2530,7 +2535,7 @@ Page({ @@ -2530,7 +2535,7 @@ Page({
2530 ob.is_bz = prom.is_bz; 2535 ob.is_bz = prom.is_bz;
2531 ob.is_xz_yh = prom.is_xz_yh; 2536 ob.is_xz_yh = prom.is_xz_yh;
2532 ob.goods = new Array(); 2537 ob.goods = new Array();
2533 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2538 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2534 2539
2535 var obj = {}; 2540 var obj = {};
2536 obj[item.prom_id] = ob; 2541 obj[item.prom_id] = ob;
@@ -2540,7 +2545,7 @@ Page({ @@ -2540,7 +2545,7 @@ Page({
2540 }, 2545 },
2541 2546
2542 //计算立即购买赠品的物流费用 2547 //计算立即购买赠品的物流费用
2543 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 2548 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, gift_weight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1,pickid) {
2544 var good = this.data.buy_now_gift_goods; 2549 var good = this.data.buy_now_gift_goods;
2545 var goods_weight = -1, goods_piece = -1; 2550 var goods_weight = -1, goods_piece = -1;
2546 var gift_shipping_price = 0; 2551 var gift_shipping_price = 0;
@@ -2556,8 +2561,9 @@ Page({ @@ -2556,8 +2561,9 @@ Page({
2556 //累积商品重量 每种商品的重量 * 数量 2561 //累积商品重量 每种商品的重量 * 数量
2557 goods_weight += good['weight'] * good['buynum']; 2562 goods_weight += good['weight'] * good['buynum'];
2558 if (goods_weight1 > 0) { 2563 if (goods_weight1 > 0) {
  2564 + out_of_weight = gift_weight_free - goods_weight;
  2565 + //不能调换位置 下面goods_weight会变大
2559 goods_weight += goods_weight1; 2566 goods_weight += goods_weight1;
2560 - out_of_weight = (gift_weight_free*1000) - goods_weight;  
2561 } 2567 }
2562 break; 2568 break;
2563 case 3: 2569 case 3:
@@ -2575,6 +2581,7 @@ Page({ @@ -2575,6 +2581,7 @@ Page({
2575 if (no_by_data && no_by_data.region_list) { 2581 if (no_by_data && no_by_data.region_list) {
2576 if (th.check_by_area(no_by_data.region_list)) { 2582 if (th.check_by_area(no_by_data.region_list)) {
2577 gift_freight_free = 0; 2583 gift_freight_free = 0;
  2584 + out_of_weight = 0;
2578 th.data.is_no_by[th.data.bn_pick] = 1; 2585 th.data.is_no_by[th.data.bn_pick] = 1;
2579 } 2586 }
2580 } 2587 }
@@ -2582,13 +2589,14 @@ Page({ @@ -2582,13 +2589,14 @@ Page({
2582 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 2589 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
2583 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 2590 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
2584 gift_freight_free = 0; 2591 gift_freight_free = 0;
2585 - //th.data.is_no_by[th.data.bn_pick]=1; 2592 + out_of_weight = 0;
  2593 + th.data.is_no_by[th.data.bn_pick]=1;
2586 } 2594 }
2587 } 2595 }
2588 2596
2589 var t_shipping_price = 2597 var t_shipping_price =
2590 - this.calculatewuliu(code, gift_shipping_price, goods_weight,  
2591 - goods_piece, user_addr, gift_freight_free, allpice, rs); 2598 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  2599 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
2592 return t_shipping_price; 2600 return t_shipping_price;
2593 2601
2594 }, 2602 },
@@ -2645,7 +2653,7 @@ Page({ @@ -2645,7 +2653,7 @@ Page({
2645 2653
2646 //跳转关闭弹出框的显示 2654 //跳转关闭弹出框的显示
2647 close_offline: function () { 2655 close_offline: function () {
2648 - this.setData({is_offline_show: 0}); 2656 + this.setData({ is_offline_show: 0 });
2649 }, 2657 },
2650 2658
2651 //立即购买显示弹出框 2659 //立即购买显示弹出框
@@ -2653,7 +2661,7 @@ Page({ @@ -2653,7 +2661,7 @@ Page({
2653 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; 2661 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price;
2654 //是不是线下 2662 //是不是线下
2655 var is_get_offline = this.data.bn_goods.is_offline; 2663 var is_get_offline = this.data.bn_goods.is_offline;
2656 - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); 2664 + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline });
2657 }, 2665 },
2658 2666
2659 //确定使用线下取价 2667 //确定使用线下取价
@@ -2661,14 +2669,14 @@ Page({ @@ -2661,14 +2669,14 @@ Page({
2661 var bn_goods = this.data.bn_goods; 2669 var bn_goods = this.data.bn_goods;
2662 if (bn_goods && bn_goods.prom_type == 0) { 2670 if (bn_goods && bn_goods.prom_type == 0) {
2663 bn_goods.is_offline = 1; 2671 bn_goods.is_offline = 1;
2664 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 2672 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
2665 this.calculatePrice2(); 2673 this.calculatePrice2();
2666 } 2674 }
2667 //就是购物车结算时的 2675 //就是购物车结算时的
2668 else { 2676 else {
2669 var index = this.data.pop_offline_index; 2677 var index = this.data.pop_offline_index;
2670 var txt = "cartlist[" + index + "].is_offline"; 2678 var txt = "cartlist[" + index + "].is_offline";
2671 - this.setData({[txt]: 1, is_offline_show: 0,}); 2679 + this.setData({ [txt]: 1, is_offline_show: 0, });
2672 this.data.old_cartlist[index].is_offline = 1; 2680 this.data.old_cartlist[index].is_offline = 1;
2673 this.calculatePrice(); 2681 this.calculatePrice();
2674 } 2682 }
@@ -2681,14 +2689,14 @@ Page({ @@ -2681,14 +2689,14 @@ Page({
2681 var bn_goods = this.data.bn_goods; 2689 var bn_goods = this.data.bn_goods;
2682 if (bn_goods && bn_goods.prom_type == 0) { 2690 if (bn_goods && bn_goods.prom_type == 0) {
2683 bn_goods.is_offline = 0; 2691 bn_goods.is_offline = 0;
2684 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 2692 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
2685 this.calculatePrice2(); 2693 this.calculatePrice2();
2686 } 2694 }
2687 //就是购物车结算时的 2695 //就是购物车结算时的
2688 else { 2696 else {
2689 var index = this.data.pop_offline_index; 2697 var index = this.data.pop_offline_index;
2690 var txt = "cartlist[" + index + "].is_offline"; 2698 var txt = "cartlist[" + index + "].is_offline";
2691 - this.setData({[txt]: 0, is_offline_show: 0,}) 2699 + this.setData({ [txt]: 0, is_offline_show: 0, })
2692 this.data.old_cartlist[index].is_offline = 0; 2700 this.data.old_cartlist[index].is_offline = 0;
2693 this.calculatePrice(); 2701 this.calculatePrice();
2694 } 2702 }
@@ -2709,16 +2717,16 @@ Page({ @@ -2709,16 +2717,16 @@ Page({
2709 }); 2717 });
2710 }, 2718 },
2711 2719
2712 - set_hid_inp:function (e) { 2720 + set_hid_inp: function (e) {
2713 var index = e.currentTarget.dataset.index; 2721 var index = e.currentTarget.dataset.index;
2714 var txt = "cartlist[" + index + "].focus"; 2722 var txt = "cartlist[" + index + "].focus";
2715 - this.setData({[txt]:1}) 2723 + this.setData({ [txt]: 1 })
2716 }, 2724 },
2717 2725
2718 - clear_hid_inp:function (e) { 2726 + clear_hid_inp: function (e) {
2719 var index = e.currentTarget.dataset.index; 2727 var index = e.currentTarget.dataset.index;
2720 var txt = "cartlist[" + index + "].focus"; 2728 var txt = "cartlist[" + index + "].focus";
2721 - this.setData({[txt]:0}) 2729 + this.setData({ [txt]: 0 })
2722 }, 2730 },
2723 2731
2724 2732
packageC/pages/presell/cart/cart2_pre.js
1 -var t = getApp(),app=t, a = t.request, ut = require("../../../../utils/util.js");  
2 -var os=t.globalData.setting; 1 +var t = getApp(), app = t, a = t.request, ut = require("../../../../utils/util.js");
  2 +var os = t.globalData.setting;
3 var regeneratorRuntime = require('../../../../utils/runtime.js'); 3 var regeneratorRuntime = require('../../../../utils/runtime.js');
4 var util_pay = require("../../../../utils/pay.js"); 4 var util_pay = require("../../../../utils/pay.js");
5 5
@@ -20,132 +20,132 @@ Page({ @@ -20,132 +20,132 @@ Page({
20 enterAddressPage: !1, 20 enterAddressPage: !1,
21 firstEnter: !0, 21 firstEnter: !0,
22 //页面获取的参数 22 //页面获取的参数
23 - param:null,  
24 - postdata:null, 23 + param: null,
  24 + postdata: null,
25 //提交订单的格式 25 //提交订单的格式
26 formData: { 26 formData: {
27 - order_amount:0,//支付金额  
28 - total_amount:0,//总价  
29 - all_price:0,//商品卖的总价 27 + order_amount: 0,//支付金额
  28 + total_amount: 0,//总价
  29 + all_price: 0,//商品卖的总价
30 pay_points: 0,//使用积分 30 pay_points: 0,//使用积分
31 user_money: 0,//使用余额 31 user_money: 0,//使用余额
32 couponCode: "",//使用优惠券(多单就用逗号隔开) 32 couponCode: "",//使用优惠券(多单就用逗号隔开)
33 - shipping_price:0,//物流费用 33 + shipping_price: 0,//物流费用
34 }, 34 },
35 35
36 /*----------------立即购买---------------------*/ 36 /*----------------立即购买---------------------*/
37 - is_b_now:0, //0是购物车结算 1立即购买  
38 - bn_goods:null, //立即购买时候的调用商品  
39 - bn_use_money:0,//是否使用余额  
40 - bn_exp_type:1, //0是物流 1自提  
41 - bn_pick:0, //选择的门店 37 + is_b_now: 0, //0是购物车结算 1立即购买
  38 + bn_goods: null, //立即购买时候的调用商品
  39 + bn_use_money: 0,//是否使用余额
  40 + bn_exp_type: 1, //0是物流 1自提
  41 + bn_pick: 0, //选择的门店
42 bn_pickname: "", //选择的门店名称 42 bn_pickname: "", //选择的门店名称
43 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 43 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
44 /*------------------------*/ 44 /*------------------------*/
45 - user_addr:null,//物流  
46 - userinfo:null, //获取会员 45 + user_addr: null,//物流
  46 + userinfo: null, //获取会员
47 /*----------物流选择--------*/ 47 /*----------物流选择--------*/
48 - wu_arr:null,  
49 - index:0, 48 + wu_arr: null,
  49 + index: 0,
50 50
51 //判断页面是返回回来的还是 首次进入的 51 //判断页面是返回回来的还是 首次进入的
52 - isclose:1,  
53 - is_express:0,//选择物流的控制器  
54 - yuer:0,  
55 - agree_no_ref:0 52 + isclose: 1,
  53 + is_express: 0,//选择物流的控制器
  54 + yuer: 0,
  55 + agree_no_ref: 0
56 }, 56 },
57 - onLoad: function(t) { 57 + onLoad: function (t) {
58 wx.setNavigationBarTitle({ 58 wx.setNavigationBarTitle({
59 title: "填写订单", 59 title: "填写订单",
60 }); 60 });
61 - var th = this; this.setData({ is_b_now: 1});  
62 - th.data.postdata=getApp().get_b_now();  
63 - th.data.param=t;  
64 - 61 + var th = this; this.setData({ is_b_now: 1 });
  62 + th.data.postdata = getApp().get_b_now();
  63 + th.data.param = t;
  64 +
65 }, 65 },
66 - onUnload: function () { this.setData({ isclose: 1 })}, 66 + onUnload: function () { this.setData({ isclose: 1 }) },
67 67
68 //------获取会员信息-----先获取用户信息,在进行下一步--- 68 //------获取会员信息-----先获取用户信息,在进行下一步---
69 - get_info:function(func){  
70 - var user_id = t.globalData.user_id;  
71 - app.auth.get_u(func); 69 + get_info: function (func) {
  70 + var user_id = t.globalData.user_id;
  71 + app.auth.get_u(func);
72 }, 72 },
73 73
74 //-------------------获取物流--------------- 74 //-------------------获取物流---------------
75 get_wuliu(func) { 75 get_wuliu(func) {
76 - var th = this;  
77 - app.getwuliu(function (e) {  
78 - if (th.data.is_default_logistics) {  
79 - //如果第一个不是开启默认,说明要让用户自己选  
80 - if (!e[0].is_default) {  
81 - th.setData({ is_default_logistics: 0 });  
82 - }  
83 - }  
84 - th.setData({ wu_arr: e })  
85 - typeof func == "function" && func();  
86 - }) 76 + var th = this;
  77 + app.getwuliu(function (e) {
  78 + if (th.data.is_default_logistics) {
  79 + //如果第一个不是开启默认,说明要让用户自己选
  80 + if (!e[0].is_default) {
  81 + th.setData({ is_default_logistics: 0 });
  82 + }
  83 + }
  84 + th.setData({ wu_arr: e })
  85 + typeof func == "function" && func();
  86 + })
87 }, 87 },
88 88
89 //------获取会员收货地址----- 89 //------获取会员收货地址-----
90 - getuser_addr:function(func){  
91 - if (app.globalData.baddr!=null){  
92 - var user_addr =app.globalData.baddr;  
93 - app.globalData.baddr=null;  
94 - func(user_addr);  
95 - }else{  
96 - a.get("/api/weshop/useraddress/page", {  
97 - data: { user_id:app.globalData.user_id, store_id: os.stoid, pageSize: 600 },  
98 - success: function (su) {  
99 -  
100 - var user_addr = su.data.data.pageData;  
101 - var item = null;  
102 - var def_item=null;  
103 - for (var i = 0; i < user_addr.length; i++) {  
104 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
105 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
106 - }  
107 - if (item == null) item = def_item;  
108 - if (item == null) item = user_addr[0];  
109 - if (item == undefined) item = null;  
110 - func(item);  
111 - }  
112 - });  
113 - } 90 + getuser_addr: function (func) {
  91 + if (app.globalData.baddr != null) {
  92 + var user_addr = app.globalData.baddr;
  93 + app.globalData.baddr = null;
  94 + func(user_addr);
  95 + } else {
  96 + a.get("/api/weshop/useraddress/page", {
  97 + data: { user_id: app.globalData.user_id, store_id: os.stoid, pageSize: 600 },
  98 + success: function (su) {
  99 +
  100 + var user_addr = su.data.data.pageData;
  101 + var item = null;
  102 + var def_item = null;
  103 + for (var i = 0; i < user_addr.length; i++) {
  104 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  105 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  106 + }
  107 + if (item == null) item = def_item;
  108 + if (item == null) item = user_addr[0];
  109 + if (item == undefined) item = null;
  110 + func(item);
  111 + }
  112 + });
  113 + }
114 }, 114 },
115 //----------------展示页面,是再获取用户信息之后-------------- 115 //----------------展示页面,是再获取用户信息之后--------------
116 - show_page:function(){  
117 - var th=this;  
118 - var user=getApp().globalData.userInfo;  
119 - getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {  
120 - data:{r:Math.random()},  
121 - success: function (e) {  
122 -  
123 - getApp().globalData.userInfo = e.data.data;  
124 - th.setData({userinfo:e.data.data});  
125 - //获取立即购买的商品信息  
126 - th.get_buy_goods();  
127 -  
128 - //获取提现金额  
129 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
130 - data: { user_id:app.globalData.user_id, store_id: os.stoid, status: 0 },  
131 - success: function (su) {  
132 - if (su.data.code == 0) {  
133 - var yuer = parseFloat(th.data.userinfo.user_money -  
134 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
135 - if(yuer<0) yuer=0;  
136 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
137 - }  
138 - }  
139 - });  
140 - }  
141 - }); 116 + show_page: function () {
  117 + var th = this;
  118 + var user = getApp().globalData.userInfo;
  119 + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {
  120 + data: { r: Math.random() },
  121 + success: function (e) {
  122 +
  123 + getApp().globalData.userInfo = e.data.data;
  124 + th.setData({ userinfo: e.data.data });
  125 + //获取立即购买的商品信息
  126 + th.get_buy_goods();
  127 +
  128 + //获取提现金额
  129 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  130 + data: { user_id: app.globalData.user_id, store_id: os.stoid, status: 0 },
  131 + success: function (su) {
  132 + if (su.data.code == 0) {
  133 + var yuer = parseFloat(th.data.userinfo.user_money -
  134 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  135 + if (yuer < 0) yuer = 0;
  136 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  137 + }
  138 + }
  139 + });
  140 + }
  141 + });
142 }, 142 },
143 143
144 //-----获取立即购买的商品信息---- 144 //-----获取立即购买的商品信息----
145 get_buy_goods: async function () { 145 get_buy_goods: async function () {
146 var th = this, a = getApp().request; 146 var th = this, a = getApp().request;
147 //定义变量 147 //定义变量
148 - var gg = th.data.postdata,act = null,prelist = null; 148 + var gg = th.data.postdata, act = null, prelist = null;
149 var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id; 149 var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
150 await getApp().request.promiseGet(url, {}).then(res => { 150 await getApp().request.promiseGet(url, {}).then(res => {
151 if (res.data.code == 0) { 151 if (res.data.code == 0) {
@@ -153,15 +153,15 @@ Page({ @@ -153,15 +153,15 @@ Page({
153 } 153 }
154 }) 154 })
155 if (!act) { 155 if (!act) {
156 - wx.showToast({title: "未找到活动", icon: 'none', duration: 3000}); 156 + wx.showToast({ title: "未找到活动", icon: 'none', duration: 3000 });
157 return false; 157 return false;
158 } 158 }
159 - if (act.is_end==1 ) {  
160 - wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000}); 159 + if (act.is_end == 1) {
  160 + wx.showToast({ title: '活动已经结束', icon: 'none', duration: 3000 });
161 return false; 161 return false;
162 } 162 }
163 - if( ut.gettimestamp()>act.end_time){  
164 - wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000}); 163 + if (ut.gettimestamp() > act.end_time) {
  164 + wx.showToast({ title: "活动定金支付时间已过期", icon: 'none', duration: 3000 });
165 return false; 165 return false;
166 } 166 }
167 167
@@ -172,7 +172,7 @@ Page({ @@ -172,7 +172,7 @@ Page({
172 } 172 }
173 }) 173 })
174 if (!prelist) { 174 if (!prelist) {
175 - wx.showToast({title: "未找到商品", icon: 'none', duration: 3000}); 175 + wx.showToast({ title: "未找到商品", icon: 'none', duration: 3000 });
176 return false; 176 return false;
177 } 177 }
178 //-- 调用商品 -- 178 //-- 调用商品 --
@@ -191,7 +191,7 @@ Page({ @@ -191,7 +191,7 @@ Page({
191 distr_t = t.data.data.distr_type; 191 distr_t = t.data.data.distr_type;
192 } 192 }
193 193
194 - if(act.presell_type==1){ 194 + if (act.presell_type == 1) {
195 switch (distr_t) { 195 switch (distr_t) {
196 case 0: 196 case 0:
197 et = 1; 197 et = 1;
@@ -205,13 +205,13 @@ Page({ @@ -205,13 +205,13 @@ Page({
205 et = 0; 205 et = 0;
206 break; 206 break;
207 } 207 }
208 - }else{  
209 - et=1; //要付定金的时候 208 + } else {
  209 + et = 1; //要付定金的时候
210 } 210 }
211 211
212 t.data.data.shop_price = prelist.presell_money; 212 t.data.data.shop_price = prelist.presell_money;
213 th.setData({ 213 th.setData({
214 - bn_goods: t.data.data, bn_pickname: gg.pick_name,prelist:prelist,act:act, 214 + bn_goods: t.data.data, bn_pickname: gg.pick_name, prelist: prelist, act: act,
215 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et 215 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
216 }); 216 });
217 //计算价格 217 //计算价格
@@ -222,263 +222,269 @@ Page({ @@ -222,263 +222,269 @@ Page({
222 222
223 //----------子页返回父页触发---------- 223 //----------子页返回父页触发----------
224 onShow: function () { 224 onShow: function () {
225 - var th = this;  
226 - if (th.data.isclose == 0) {  
227 - wx.navigateTo({  
228 - url: "/pages/index/index/index"  
229 - })  
230 - } else {  
231 - this.getuser_addr(function (ie) {  
232 - //更换地址回来要重新调用计算价钱的接口  
233 - th.setData({ user_addr: ie });  
234 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {  
235 - th.setData({ add_back: 1 });  
236 - if (this.data.bn_goods) th.calculatePrice2();  
237 - }  
238 - })  
239 - //--更新默认地址--,看一下是不是跳到地址页面  
240 - if (!getApp().globalData.is_cart_old) {  
241 - this.update_code(); 225 + var th = this;
  226 + if (th.data.isclose == 0) {
  227 + wx.navigateTo({
  228 + url: "/pages/index/index/index"
  229 + })
242 } else { 230 } else {
243 - getApp().globalData.is_cart_old = 0;  
244 - }  
245 - }  
246 -  
247 - //先获取是否有关闭使用优惠券  
248 - getApp().getConfig2(function (ee) {  
249 - var json_d = JSON.parse(ee.switch_list);  
250 - th.data.json_d = json_d;  
251 - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
252 - var is_default_logistics = json_d.is_default_logistics;  
253 -  
254 - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });  
255 -  
256 - var rank_switch = json_d.rank_switch;  
257 - var max_price = -1;  
258 - var show_card = null;  
259 - var name = "";  
260 - //如果有开等级卡的时候,  
261 - //因为都是调接口,要返回在计算  
262 - if (rank_switch == 2) {  
263 - //-- 获取所有的等级卡, --  
264 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
265 - {}).then(res => {  
266 - if (res.data.code == 0) {  
267 - var plusCard = res.data.data;  
268 - //-- 循环判断,拿到最贵的那张卡 --  
269 - for (var ih in plusCard) {  
270 - if (plusCard[ih].IsStopBuy == true) { continue; }  
271 - if (max_price < 0) {  
272 - max_price = plusCard[ih].CardFee;  
273 - name = 'card' + plusCard[ih]['CorrPrice'];  
274 - show_card = plusCard[ih];  
275 - } else {  
276 - if (max_price < plusCard[ih].CardFee) {  
277 - max_price = plusCard[ih].CardFee;  
278 - name = 'card' + plusCard[ih]['CorrPrice'];  
279 - show_card = plusCard[ih];  
280 - }  
281 - }  
282 - }  
283 -  
284 - if (show_card) {  
285 - name = name.toLowerCase();  
286 - th.setData({ card_name: name, show_card: show_card }) 231 + this.getuser_addr(function (ie) {
  232 + //更换地址回来要重新调用计算价钱的接口
  233 + th.setData({ user_addr: ie });
  234 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  235 + th.setData({ add_back: 1 });
  236 + if (this.data.bn_goods) th.calculatePrice2();
287 } 237 }
288 - }  
289 - //-----先获取物流,再获取用户信息,再展示页面-----  
290 - th.get_wuliu(th.get_info(th.show_page));  
291 }) 238 })
292 - } else {  
293 - //-----先获取物流,再获取用户信息,再展示页面-----  
294 - th.get_wuliu(th.get_info(th.show_page)); 239 + //--更新默认地址--,看一下是不是跳到地址页面
  240 + if (!getApp().globalData.is_cart_old) {
  241 + this.update_code();
  242 + } else {
  243 + getApp().globalData.is_cart_old = 0;
  244 + }
295 } 245 }
296 - }, 1) 246 +
  247 + //先获取是否有关闭使用优惠券
  248 + getApp().getConfig2(function (ee) {
  249 + var json_d = JSON.parse(ee.switch_list);
  250 + th.data.json_d = json_d;
  251 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  252 + var is_default_logistics = json_d.is_default_logistics;
  253 +
  254 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  255 +
  256 + var rank_switch = json_d.rank_switch;
  257 + var max_price = -1;
  258 + var show_card = null;
  259 + var name = "";
  260 + //如果有开等级卡的时候,
  261 + //因为都是调接口,要返回在计算
  262 + if (rank_switch == 2) {
  263 + //-- 获取所有的等级卡, --
  264 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  265 + {}).then(res => {
  266 + if (res.data.code == 0) {
  267 + var plusCard = res.data.data;
  268 + //-- 循环判断,拿到最贵的那张卡 --
  269 + for (var ih in plusCard) {
  270 + if (plusCard[ih].IsStopBuy == true) { continue; }
  271 + if (max_price < 0) {
  272 + max_price = plusCard[ih].CardFee;
  273 + name = 'card' + plusCard[ih]['CorrPrice'];
  274 + show_card = plusCard[ih];
  275 + } else {
  276 + if (max_price < plusCard[ih].CardFee) {
  277 + max_price = plusCard[ih].CardFee;
  278 + name = 'card' + plusCard[ih]['CorrPrice'];
  279 + show_card = plusCard[ih];
  280 + }
  281 + }
  282 + }
  283 +
  284 + if (show_card) {
  285 + name = name.toLowerCase();
  286 + th.setData({ card_name: name, show_card: show_card })
  287 + }
  288 + }
  289 + //-----先获取物流,再获取用户信息,再展示页面-----
  290 + th.get_wuliu(th.get_info(th.show_page));
  291 + })
  292 + } else {
  293 + //-----先获取物流,再获取用户信息,再展示页面-----
  294 + th.get_wuliu(th.get_info(th.show_page));
  295 + }
  296 + }, 1)
297 297
298 }, 298 },
299 //---------------检查是否有收货地址------------------- 299 //---------------检查是否有收货地址-------------------
300 - checkAddressList: function() { 300 + checkAddressList: function () {
301 var t = this; 301 var t = this;
302 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 302 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
303 title: "请先填写或选择收货地址~", 303 title: "请先填写或选择收货地址~",
304 - success: function(a) { 304 + success: function (a) {
305 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 305 a.confirm ? t.enterAddressPage() : wx.navigateBack();
306 }, 306 },
307 - fail: function() { 307 + fail: function () {
308 wx.navigateBack(); 308 wx.navigateBack();
309 } 309 }
310 }), !1); 310 }), !1);
311 }, 311 },
312 - showInvoice: function() { 312 + showInvoice: function () {
313 this.setData({ 313 this.setData({
314 invoiceToggle: !this.data.invoiceToggle 314 invoiceToggle: !this.data.invoiceToggle
315 }); 315 });
316 }, 316 },
317 - keyUpChangePay1: function(t) { 317 + keyUpChangePay1: function (t) {
318 this.setData({ 318 this.setData({
319 payWithUserMoney: !(t.detail.value.length > 0) 319 payWithUserMoney: !(t.detail.value.length > 0)
320 }); 320 });
321 }, 321 },
322 - keyUpChangePay2: function(t) { 322 + keyUpChangePay2: function (t) {
323 this.setData({ 323 this.setData({
324 payWithPoints: !(t.detail.value.length > 0) 324 payWithPoints: !(t.detail.value.length > 0)
325 }); 325 });
326 }, 326 },
327 - keyUpChangeNum: function(t) { 327 + keyUpChangeNum: function (t) {
328 this.setData({ 328 this.setData({
329 maxWord: t.detail.value.length 329 maxWord: t.detail.value.length
330 }); 330 });
331 }, 331 },
332 //---------计算立即购买---------- 332 //---------计算立即购买----------
333 calculatePrice2: function () { 333 calculatePrice2: function () {
334 - console.log('calculatePrice2');  
335 - var th = this, good = this.data.bn_goods;  
336 - //-----------计算商品总价--------------  
337 - var allpice = good.shop_price * good.buynum;  
338 - allpice=parseFloat(allpice).toFixed(2);  
339 - var txt = "formData.all_price";  
340 - th.setData({ [txt]: allpice, });  
341 - console.log(th.data.formData);  
342 -  
343 - app.getConfig2(function (ee) {  
344 - app.getwuliuprice(function (rs) {  
345 - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;  
346 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
347 - if (th.data.user_addr != null && th.data.bn_exp_type == 0  
348 - && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
349 - switch (good['exp_sum_type']) {  
350 - case 1:  
351 - //统一运费  
352 - o_shipping_price += good['uniform_exp_sum']; break;  
353 - case 2:  
354 - if (goods_weight < 0) goods_weight = 0;  
355 - //累积商品重量 每种商品的重量 * 数量  
356 - goods_weight += good['weight'] * good['buynum'];break;  
357 - case 3:  
358 - if (goods_piece < 0) goods_piece = 0;  
359 - //累积商品数量  
360 - goods_piece += good['buynum']; break;  
361 - }  
362 -  
363 - var code = th.data.wu_arr[th.data.index].code;  
364 - var freight_free = ee.freight_free; //全场满多少包邮  
365 - var shipping_price=  
366 - th.calculatewuliu(code, o_shipping_price, goods_weight, 334 + console.log('calculatePrice2');
  335 + var th = this, good = this.data.bn_goods;
  336 + //-----------计算商品总价--------------
  337 + var allpice = good.shop_price * good.buynum;
  338 + allpice = parseFloat(allpice).toFixed(2);
  339 + var txt = "formData.all_price";
  340 + th.setData({ [txt]: allpice, });
  341 + console.log(th.data.formData);
  342 +
  343 + app.getConfig2(function (ee) {
  344 + app.getwuliuprice(function (rs) {
  345 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  346 + var out_of_weight = null; //超出多少重量
  347 + var freight_free = ee.freight_free; //全场满多少包邮
  348 + var weight_free = ee.weight_free; //多少kg内包邮
  349 + var no_ex_id = ee.no_ex_id;
  350 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  351 + if (th.data.user_addr != null && th.data.bn_exp_type == 0
  352 + && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  353 + switch (good['exp_sum_type']) {
  354 + case 1:
  355 + //统一运费
  356 + o_shipping_price += good['uniform_exp_sum']; break;
  357 + case 2:
  358 + if (goods_weight < 0) goods_weight = 0;
  359 + //累积商品重量 每种商品的重量 * 数量
  360 + goods_weight += good['weight'] * good['buynum'];
  361 + if (weight_free > 0) {
  362 + out_of_weight = (weight_free * 1000) - goods_weight;
  363 + }
  364 + break;
  365 + case 3:
  366 + if (goods_piece < 0) goods_piece = 0;
  367 + //累积商品数量
  368 + goods_piece += good['buynum']; break;
  369 + }
  370 +
  371 + var code = th.data.wu_arr[th.data.index].code;
  372 + var shipping_price =
  373 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
367 goods_piece, th.data.user_addr, freight_free, allpice, rs); 374 goods_piece, th.data.user_addr, freight_free, allpice, rs);
368 375
369 - shipping_price = parseFloat(shipping_price).toFixed(2);  
370 - var wl_txt = "formData.shipping_price";  
371 - th.setData({ [wl_txt]: shipping_price, })  
372 -  
373 - }else{  
374 - var wl_txt = "formData.shipping_price";  
375 - th.setData({ [wl_txt]: 0, })  
376 - }  
377 - //-----------------总价-----------------  
378 - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);  
379 - total_m = parseFloat(total_m).toFixed(2);  
380 -  
381 - var atxt= "formData.total_amount";  
382 - th.setData({ [atxt]: total_m, })  
383 - var order_m = total_m;  
384 -  
385 - var txt = "formData.user_money";  
386 - var txt2 = "formData.order_amount";  
387 - //--------------如果使用余额---------------------  
388 - if (th.data.bn_use_money == 1 && th.data.yuer>0) {  
389 - if ( parseFloat(th.data.yuer) > total_m) {  
390 - th.setData({ [txt]: total_m, [txt2]:0 })  
391 - }else{  
392 - order_m = parseFloat(order_m) - parseFloat(th.data.yuer);  
393 - order_m = order_m.toFixed(2);  
394 - th.setData({ [txt]: th.data.yuer, [txt2]: order_m })  
395 - }  
396 - }else{ 376 + shipping_price = parseFloat(shipping_price).toFixed(2);
  377 + var wl_txt = "formData.shipping_price";
  378 + th.setData({ [wl_txt]: shipping_price, })
  379 +
  380 + } else {
  381 + var wl_txt = "formData.shipping_price";
  382 + th.setData({ [wl_txt]: 0, })
  383 + }
  384 + //-----------------总价-----------------
  385 + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
  386 + total_m = parseFloat(total_m).toFixed(2);
  387 +
  388 + var atxt = "formData.total_amount";
  389 + th.setData({ [atxt]: total_m, })
  390 + var order_m = total_m;
  391 +
  392 + var txt = "formData.user_money";
  393 + var txt2 = "formData.order_amount";
  394 + //--------------如果使用余额---------------------
  395 + if (th.data.bn_use_money == 1 && th.data.yuer > 0) {
  396 + if (parseFloat(th.data.yuer) > total_m) {
  397 + th.setData({ [txt]: total_m, [txt2]: 0 })
  398 + } else {
  399 + order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
  400 + order_m = order_m.toFixed(2);
  401 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
  402 + }
  403 + } else {
397 th.setData({ [txt]: 0, [txt2]: order_m }) 404 th.setData({ [txt]: 0, [txt2]: order_m })
398 - } 405 + }
399 406
400 - });  
401 - }); 407 + });
  408 + });
402 }, 409 },
403 410
404 // -- 支付的下一步 -- 411 // -- 支付的下一步 --
405 - submitForm_next:async function(t){  
406 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
407 - this.data.is_summit_ing=1; 412 + submitForm_next: async function (t) {
  413 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  414 + this.data.is_summit_ing = 1;
408 415
409 - var th=this,pdata=new Array();  
410 - var ff=true; 416 + var th = this, pdata = new Array();
  417 + var ff = true;
411 //------------立即购买------------- 418 //------------立即购买-------------
412 419
413 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 420 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
414 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ 421 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
415 ff = false; 422 ff = false;
416 - getApp().my_warnning("请选择收货地址",0,this); 423 + getApp().my_warnning("请选择收货地址", 0, this);
417 this.data.is_summit_ing = 0; 424 this.data.is_summit_ing = 0;
418 } 425 }
419 if (!ff) return false; 426 if (!ff) return false;
420 var addr = th.data.user_addr; 427 var addr = th.data.user_addr;
421 - if (th.data.bn_exp_type == 1) addr=null; 428 + if (th.data.bn_exp_type == 1) addr = null;
422 429
423 - if(th.data.bn_exp_type==0 && (th.data.kt_type!=3)) { 430 + if (th.data.bn_exp_type == 0 && (th.data.kt_type != 3)) {
424 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { 431 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
425 - getApp().my_warnning("读取物流失败",0,this); 432 + getApp().my_warnning("读取物流失败", 0, this);
426 this.data.is_summit_ing = 0; 433 this.data.is_summit_ing = 0;
427 return false; 434 return false;
428 } 435 }
429 } 436 }
430 437
431 //阶梯团强制带1,自提~~~ 438 //阶梯团强制带1,自提~~~
432 - if(th.data.kt_type==3 ){  
433 - th.data.bn_exp_type=1; 439 + if (th.data.kt_type == 3) {
  440 + th.data.bn_exp_type = 1;
434 } 441 }
435 442
436 - var item={  
437 - 'user_id':app.globalData.user_id, 443 + var item = {
  444 + 'user_id': app.globalData.user_id,
438 'consignee': addr == null ? "" : addr.consignee, 445 'consignee': addr == null ? "" : addr.consignee,
439 'province': addr == null ? 0 : addr.province, 446 'province': addr == null ? 0 : addr.province,
440 'city': addr == null ? 0 : addr.city, 447 'city': addr == null ? 0 : addr.city,
441 'district': addr == null ? 0 : addr.district, 448 'district': addr == null ? 0 : addr.district,
442 'twon': addr == null ? 0 : addr.twon, 449 'twon': addr == null ? 0 : addr.twon,
443 - 'address': addr == null ? "": addr.address, 450 + 'address': addr == null ? "" : addr.address,
444 'more_address': addr == null ? "" : addr.more_address, 451 'more_address': addr == null ? "" : addr.more_address,
445 - 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,  
446 - 'email':'',  
447 - 'invoice_title':'', 452 + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
  453 + 'email': '',
  454 + 'invoice_title': '',
448 'goods_price': th.data.formData.all_price, //商品总价 455 'goods_price': th.data.formData.all_price, //商品总价
449 'shipping_price': th.data.formData.shipping_price, //物流金额 456 'shipping_price': th.data.formData.shipping_price, //物流金额
450 'user_money': th.data.formData.user_money, //使用余额 457 'user_money': th.data.formData.user_money, //使用余额
451 'total_amount': th.data.formData.total_amount, //订单总价 458 'total_amount': th.data.formData.total_amount, //订单总价
452 'order_amount': th.data.formData.order_amount, //应付 459 'order_amount': th.data.formData.order_amount, //应付
453 'user_note': t.detail.value.user_note, //用户备注 460 'user_note': t.detail.value.user_note, //用户备注
454 - 'store_id':os.stoid, //商家 461 + 'store_id': os.stoid, //商家
455 'pickup_id': th.data.bn_pick, //门店 462 'pickup_id': th.data.bn_pick, //门店
456 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 463 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
457 'prom_id': th.data.bn_goods.prom_id, //促销活动id 464 'prom_id': th.data.bn_goods.prom_id, //促销活动id
458 - 'order_goods':new Array(), 465 + 'order_goods': new Array(),
459 }; 466 };
460 467
461 //老会员成为分销下线需要的参数 468 //老会员成为分销下线需要的参数
462 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){ 469 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
463 //判断一下分享人是不是分享商 470 //判断一下分享人是不是分享商
464 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
465 - if(res.data.code==0){  
466 - var user= res.data.data;  
467 - if(user.is_distribut==1){  
468 - item.first_leader=parseInt(getApp().globalData.first_leader); 471 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  472 + if (res.data.code == 0) {
  473 + var user = res.data.data;
  474 + if (user.is_distribut == 1) {
  475 + item.first_leader = parseInt(getApp().globalData.first_leader);
469 } 476 }
470 } 477 }
471 }) 478 })
472 } 479 }
473 480
474 - if(th.data.qh!='')  
475 - {  
476 - item.team_qh=th.data.qh;  
477 - item.pt_listno=th.data.qh; 481 + if (th.data.qh != '') {
  482 + item.team_qh = th.data.qh;
  483 + item.pt_listno = th.data.qh;
478 } 484 }
479 485
480 - var gg =app.get_b_now();  
481 - var goods={ 486 + var gg = app.get_b_now();
  487 + var goods = {
482 'goods_id': gg.goods_id, 488 'goods_id': gg.goods_id,
483 'goods_name': gg.goods_name, 489 'goods_name': gg.goods_name,
484 'goods_sn': gg.goods_sn, 490 'goods_sn': gg.goods_sn,
@@ -487,37 +493,37 @@ Page({ @@ -487,37 +493,37 @@ Page({
487 'goods_price': th.data.bn_goods.shop_price, 493 'goods_price': th.data.bn_goods.shop_price,
488 'member_goods_price': th.data.bn_goods.shop_price, 494 'member_goods_price': th.data.bn_goods.shop_price,
489 'store_id': os.stoid, 495 'store_id': os.stoid,
490 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 496 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
491 'prom_id': th.data.bn_goods.prom_id, //促销活动id 497 'prom_id': th.data.bn_goods.prom_id, //促销活动id
492 }; 498 };
493 499
494 //--导购分享过来的id-- 500 //--导购分享过来的id--
495 - if(gg.guide_id){  
496 - goods.guide_id=gg.guide_id;  
497 - goods.guide_type=gg.guide_type; 501 + if (gg.guide_id) {
  502 + goods.guide_id = gg.guide_id;
  503 + goods.guide_type = gg.guide_type;
498 //调用接口判断是不是会员 504 //调用接口判断是不是会员
499 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+os.stoid+"/"+gg.guide_id,{}).then(res=>{  
500 - if(res.data.code==0){  
501 - goods.guide_name=res.data.data.salesman;  
502 - goods.guide_sn=res.data.data.salesman_no; 505 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + os.stoid + "/" + gg.guide_id, {}).then(res => {
  506 + if (res.data.code == 0) {
  507 + goods.guide_name = res.data.data.salesman;
  508 + goods.guide_sn = res.data.data.salesman_no;
503 } 509 }
504 }) 510 })
505 } 511 }
506 512
507 //--商品的房间号-- 513 //--商品的房间号--
508 - if(gg.room_id && gg.room_id>0){  
509 - item.room_ids=gg.room_id;  
510 - goods.room_id=gg.room_id; 514 + if (gg.room_id && gg.room_id > 0) {
  515 + item.room_ids = gg.room_id;
  516 + goods.room_id = gg.room_id;
511 } 517 }
512 518
513 - if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;} 519 + if (th.data.bn_goods.is_normal) { goods.is_pd_normal = 1; }
514 520
515 item.order_goods.push(goods); 521 item.order_goods.push(goods);
516 pdata.push(item); 522 pdata.push(item);
517 523
518 - if (pdata.length==0) return; 524 + if (pdata.length == 0) return;
519 var str = JSON.stringify(pdata); 525 var str = JSON.stringify(pdata);
520 - wx.showLoading({title: "加载中"}); 526 + wx.showLoading({ title: "加载中" });
521 wx.request({ 527 wx.request({
522 url: os.url + '/api/weshop/order/createWxdOrder', 528 url: os.url + '/api/weshop/order/createWxdOrder',
523 data: str, 529 data: str,
@@ -529,8 +535,8 @@ Page({ @@ -529,8 +535,8 @@ Page({
529 535
530 wx.hideLoading(); 536 wx.hideLoading();
531 if (res.statusCode == 200) { 537 if (res.statusCode == 200) {
532 - var data=res.data;  
533 - if(data.code==0){ 538 + var data = res.data;
  539 + if (data.code == 0) {
534 console.log(th.data.is_b_now); 540 console.log(th.data.is_b_now);
535 //如果是购物车结算,还要删除购物车 541 //如果是购物车结算,还要删除购物车
536 if (th.data.is_b_now == 0) { 542 if (th.data.is_b_now == 0) {
@@ -548,11 +554,11 @@ Page({ @@ -548,11 +554,11 @@ Page({
548 //要进行判断,如果是用微信支付,就要跳转到支付界面 554 //要进行判断,如果是用微信支付,就要跳转到支付界面
549 if (order_amount > 0) { 555 if (order_amount > 0) {
550 th.setData({ isclose: 0 }); 556 th.setData({ isclose: 0 });
551 - util_pay.pay(data.data, function() {  
552 - var url="/packageC/pages/presell/cart/cart?order_sn="+data.data; 557 + util_pay.pay(data.data, function () {
  558 + var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data;
553 setTimeout(function () { 559 setTimeout(function () {
554 - wx.reLaunch({ url: url,})  
555 - },1000) 560 + wx.reLaunch({ url: url, })
  561 + }, 1000)
556 }, function () { 562 }, function () {
557 //支付失败 563 //支付失败
558 setTimeout(function () { 564 setTimeout(function () {
@@ -560,9 +566,9 @@ Page({ @@ -560,9 +566,9 @@ Page({
560 wx.reLaunch({ 566 wx.reLaunch({
561 url: "/pages/user/order_list/order_list", 567 url: "/pages/user/order_list/order_list",
562 }) 568 })
563 - },1000) 569 + }, 1000)
564 570
565 - },os.stoid,1); 571 + }, os.stoid, 1);
566 572
567 } else { 573 } else {
568 var dd = { 574 var dd = {
@@ -575,15 +581,15 @@ Page({ @@ -575,15 +581,15 @@ Page({
575 data: dd, 581 data: dd,
576 success: function (t) { 582 success: function (t) {
577 console.log(t); 583 console.log(t);
578 - app.my_warnning("支付成功",1,th); 584 + app.my_warnning("支付成功", 1, th);
579 setTimeout(function () { 585 setTimeout(function () {
580 th.setData({ isclose: 0 }); 586 th.setData({ isclose: 0 });
581 587
582 588
583 - var url="/packageC/pages/presell/cart/cart?order_sn="+data.data;  
584 - wx.reLaunch({  
585 - url: url  
586 - }) 589 + var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data;
  590 + wx.reLaunch({
  591 + url: url
  592 + })
587 593
588 594
589 595
@@ -592,54 +598,54 @@ Page({ @@ -592,54 +598,54 @@ Page({
592 }); 598 });
593 } 599 }
594 } 600 }
595 - else{  
596 - th.data.is_summit_ing=0; //是否提交中 601 + else {
  602 + th.data.is_summit_ing = 0; //是否提交中
597 getApp().confirmBox(data.msg); 603 getApp().confirmBox(data.msg);
598 } 604 }
599 } else { 605 } else {
600 - th.data.is_summit_ing=0; //是否提交中 606 + th.data.is_summit_ing = 0; //是否提交中
601 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 607 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
602 } 608 }
603 }, 609 },
604 fail: function () { 610 fail: function () {
605 - th.data.is_summit_ing=0; //是否提交中 611 + th.data.is_summit_ing = 0; //是否提交中
606 wx.hideLoading(); 612 wx.hideLoading();
607 console.log("index.js wx.request CheckCallUser fail"); 613 console.log("index.js wx.request CheckCallUser fail");
608 }, 614 },
609 - complete: function () {} 615 + complete: function () { }
610 }) 616 })
611 }, 617 },
612 618
613 619
614 //--------------------提交订单----------------------- 620 //--------------------提交订单-----------------------
615 - submitForm: function(t){  
616 - var th=this; 621 + submitForm: function (t) {
  622 + var th = this;
617 //如果是部分定金,商家不同意退定金, 623 //如果是部分定金,商家不同意退定金,
618 - if(this.data.act.presell_type!=1 && !this.data.act.is_refundmoney && !th.agree_no_ref){ 624 + if (this.data.act.presell_type != 1 && !this.data.act.is_refundmoney && !th.agree_no_ref) {
619 wx.showModal({ 625 wx.showModal({
620 content: ' 预售商品不允许退定金!是否继续下单?', 626 content: ' 预售商品不允许退定金!是否继续下单?',
621 showCancel: true,//是否显示取消按钮 627 showCancel: true,//是否显示取消按钮
622 - cancelText:"我在想想",//默认是“取消”  
623 - confirmText:"继续下单",//默认是“确定” 628 + cancelText: "我在想想",//默认是“取消”
  629 + confirmText: "继续下单",//默认是“确定”
624 success: function (res) { 630 success: function (res) {
625 if (res.cancel) { 631 if (res.cancel) {
626 //点击取消,默认隐藏弹框 632 //点击取消,默认隐藏弹框
627 } else { 633 } else {
628 - th.setData({agree_no_ref:1})  
629 - th.submitForm_next(t) 634 + th.setData({ agree_no_ref: 1 })
  635 + th.submitForm_next(t)
630 } 636 }
631 }, 637 },
632 }) 638 })
633 639
634 - }else{  
635 - this.submitForm_next(t); 640 + } else {
  641 + this.submitForm_next(t);
636 } 642 }
637 }, 643 },
638 644
639 - useCoupon: function() { 645 + useCoupon: function () {
640 if (this.data.order.couponNum <= 0) { 646 if (this.data.order.couponNum <= 0) {
641 //return t.showWarning("无可用优惠券"); 647 //return t.showWarning("无可用优惠券");
642 - getApp().my_warnning("无可用优惠券",0,this); 648 + getApp().my_warnning("无可用优惠券", 0, this);
643 return; 649 return;
644 } 650 }
645 var a = { 651 var a = {
@@ -649,148 +655,158 @@ Page({ @@ -649,148 +655,158 @@ Page({
649 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) 655 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
650 }); 656 });
651 }, 657 },
652 - enterAddressPage: function() {  
653 - getApp().globalData.is_cart_old=1; 658 + enterAddressPage: function () {
  659 + getApp().globalData.is_cart_old = 1;
654 this.data.enterAddressPage = !0, wx.navigateTo({ 660 this.data.enterAddressPage = !0, wx.navigateTo({
655 url: "/pages/user/address_list/address_list" 661 url: "/pages/user/address_list/address_list"
656 }); 662 });
657 }, 663 },
658 664
659 - //--------立即购买时,选择自提和物流-----------  
660 - setexptype_w:function(t){  
661 - var th=this;  
662 - var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;  
663 - th.setData({ [txt]: ty });  
664 - var iszt=1;  
665 - if(ty==0){  
666 - th.setData({ is_all_zt: 0 });  
667 - }else{  
668 - for(var i=0;i<th.data.cartlist.length;i++){  
669 - var item = th.data.cartlist[i];  
670 - if (item.exp_type==0){ iszt=0;break;}  
671 - }  
672 - th.setData({ is_all_zt: iszt });  
673 - }  
674 - //----计算此时购物车的价格----  
675 - th.calculatePrice(); 665 + //--------立即购买时,选择自提和物流-----------
  666 + setexptype_w: function (t) {
  667 + var th = this;
  668 + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt;
  669 + th.setData({ [txt]: ty });
  670 + var iszt = 1;
  671 + if (ty == 0) {
  672 + th.setData({ is_all_zt: 0 });
  673 + } else {
  674 + for (var i = 0; i < th.data.cartlist.length; i++) {
  675 + var item = th.data.cartlist[i];
  676 + if (item.exp_type == 0) { iszt = 0; break; }
  677 + }
  678 + th.setData({ is_all_zt: iszt });
  679 + }
  680 + //----计算此时购物车的价格----
  681 + th.calculatePrice();
676 }, 682 },
677 683
678 //--------立即购买时,选择自提和物流---------- 684 //--------立即购买时,选择自提和物流----------
679 - setexptype:function(t){  
680 - var th=this;  
681 - var ty = t.currentTarget.dataset.t;  
682 - th.setData({ bn_exp_type:ty});  
683 - //当物流为空的时候。  
684 - if (ty == 0 && th.data.wu_arr==null){  
685 - return th.get_wuliu(th.calculatePrice2());  
686 - }  
687 - th.calculatePrice2()  
688 - console.log('setexptype');  
689 - },  
690 -  
691 - //--------立即购买时,使用余额--------  
692 - set_bn_useyuer:function(){  
693 - var th=this;  
694 - th.setData({ bn_use_money: !th.data.bn_use_money});  
695 - th.calculatePrice2();  
696 - },  
697 - set_js_useyuer:function(){  
698 - var th = this;  
699 - th.setData({ js_use_money: !th.data.js_use_money });  
700 - th.calculatePrice();  
701 - },  
702 -  
703 - //-------------------计算物流---------------  
704 - calculatewuliu:function(code, o_shipping_price, goods_weight,  
705 - goods_piece,user_addr, freight_free, o_price, rs){  
706 - var price =0,th=this;  
707 - price +=parseFloat(o_shipping_price);  
708 - //如果是包邮  
709 - if (freight_free > 0 && o_price >= freight_free){ return 0;}  
710 - if (user_addr==null) { return 0; }  
711 - //计算物流的config item;  
712 - var item=null;  
713 - //先根据 镇 县 区找计算的config  
714 - item = th.get_wuliu_config(user_addr.district,code,rs);  
715 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
716 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
717 - if (item == null) item = th.get_wuliu_default(code,rs);  
718 - if (item == null) return o_shipping_price;  
719 - var fw_price = 0, fp_price=0;  
720 - item=item.config;  
721 - if (item == null) return o_shipping_price;  
722 - //------按重量----------  
723 - if (goods_weight>0) {  
724 - fw_price =parseFloat(item['money']);  
725 - if (goods_weight > item['first_weight']){  
726 - var fw = goods_weight - item['first_weight'];  
727 - var n = Math.ceil(fw/item['second_weight'])  
728 - fw_price = fw_price + n * parseFloat(item['add_money']);  
729 - }  
730 - }  
731 - //------按件数----------  
732 - if (goods_piece > 0) {  
733 - fp_price = parseFloat(item['piecemoney']);  
734 - if (goods_piece > item['first_piece']) {  
735 - var fp = goods_piece - item['first_piece'];  
736 - var m = Math.ceil(fp / item['second_piece'])  
737 - fp_price = fp_price + m * parseFloat(item['add_piecemoney']);  
738 - }  
739 - }  
740 - var rspice =parseFloat(price + fw_price + fp_price);  
741 - return rspice;  
742 - },  
743 -  
744 - //------------循环获取config-----------  
745 - get_wuliu_config:function(region_id,code,rs){  
746 - var item=null,rslist = rs.pageData;  
747 - for (var i = 0; i < rslist.length;i++){  
748 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}  
749 - }  
750 - return item;  
751 - },  
752 - //-------循环获取config,code default-------  
753 - get_wuliu_default: function (code, rs) {  
754 - var item = null, rslist=rs.pageData;  
755 - for (var i = 0; i < rslist.length; i++) {  
756 - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }  
757 - }  
758 - return item;  
759 - },  
760 -  
761 - //----------立即购买,选择物流-------------  
762 - bindPickerChange:function(e){  
763 - var ind = e.detail.value  
764 - this.setData({ index: ind });  
765 - this.calculatePrice2();  
766 - },  
767 -  
768 - //----------购物车结算,选择物流-------------  
769 - bindPickerChange_w: function (e) {  
770 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt; 685 + setexptype: function (t) {
  686 + var th = this;
  687 + var ty = t.currentTarget.dataset.t;
  688 + th.setData({ bn_exp_type: ty });
  689 + //当物流为空的时候。
  690 + if (ty == 0 && th.data.wu_arr == null) {
  691 + return th.get_wuliu(th.calculatePrice2());
  692 + }
  693 + th.calculatePrice2()
  694 + console.log('setexptype');
  695 + },
  696 +
  697 + //--------立即购买时,使用余额--------
  698 + set_bn_useyuer: function () {
  699 + var th = this;
  700 + th.setData({ bn_use_money: !th.data.bn_use_money });
  701 + th.calculatePrice2();
  702 + },
  703 + set_js_useyuer: function () {
  704 + var th = this;
  705 + th.setData({ js_use_money: !th.data.js_use_money });
  706 + th.calculatePrice();
  707 + },
  708 +
  709 + //-------------------计算物流---------------
  710 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  711 + goods_piece, user_addr, freight_free, o_price, rs) {
  712 + var price = 0, th = this;
  713 + price += parseFloat(o_shipping_price);
  714 + //如果是包邮
  715 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  716 + if (user_addr == null) { return 0; }
  717 + //计算物流的config item;
  718 + var item = null;
  719 + //先根据 镇 县 区找计算的config
  720 + item = th.get_wuliu_config(user_addr.district, code, rs);
  721 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  722 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  723 + if (item == null) item = th.get_wuliu_default(code, rs);
  724 + if (item == null) return o_shipping_price;
  725 + var fw_price = 0, fp_price = 0;
  726 + item = item.config;
  727 + if (item == null) return o_shipping_price;
  728 + //------按重量----------
  729 + if (goods_weight >= 0 && item['money']) {
  730 + fw_price = parseFloat(item['money']);
  731 + if (goods_weight > item['first_weight']) {
  732 + var fw = goods_weight - item['first_weight'];
  733 + var n = Math.ceil(fw / item['second_weight'])
  734 + fw_price = fw_price + n * parseFloat(item['add_money']);
  735 + }
  736 + }
  737 + //------超出重量----------
  738 + if (out_of_weight < 0 && o_price >= freight_free) {
  739 + fw_price = parseFloat(item['money']);
  740 + var out_of_weight = Math.abs(out_of_weight);
  741 + if (out_of_weight > item['first_weight']) {
  742 + var fw = out_of_weight - item['first_weight'];
  743 + var n = Math.ceil(fw / item['second_weight'])
  744 + fw_price = fw_price + n * parseFloat(item['add_money']);
  745 + }
  746 + }
  747 + //------按件数----------
  748 + if (goods_piece > 0) {
  749 + fp_price = parseFloat(item['piecemoney']);
  750 + if (goods_piece > item['first_piece']) {
  751 + var fp = goods_piece - item['first_piece'];
  752 + var m = Math.ceil(fp / item['second_piece'])
  753 + fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
  754 + }
  755 + }
  756 + var rspice = parseFloat(price + fw_price + fp_price);
  757 + return rspice;
  758 + },
  759 +
  760 + //------------循环获取config-----------
  761 + get_wuliu_config: function (region_id, code, rs) {
  762 + var item = null, rslist = rs.pageData;
  763 + for (var i = 0; i < rslist.length; i++) {
  764 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
  765 + }
  766 + return item;
  767 + },
  768 + //-------循环获取config,code default-------
  769 + get_wuliu_default: function (code, rs) {
  770 + var item = null, rslist = rs.pageData;
  771 + for (var i = 0; i < rslist.length; i++) {
  772 + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
  773 + }
  774 + return item;
  775 + },
  776 +
  777 + //----------立即购买,选择物流-------------
  778 + bindPickerChange: function (e) {
  779 + var ind = e.detail.value
  780 + this.setData({ index: ind });
  781 + this.calculatePrice2();
  782 + },
  783 +
  784 + //----------购物车结算,选择物流-------------
  785 + bindPickerChange_w: function (e) {
  786 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
771 this.setData({ [txt]: ind }); 787 this.setData({ [txt]: ind });
772 this.calculatePrice(); 788 this.calculatePrice();
773 - },  
774 -  
775 - cart_set_err: function (e) {  
776 - var txt = e.currentTarget.dataset.err;  
777 - var ob = {};  
778 - ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";  
779 - this.setData(ob);  
780 - }, 789 + },
  790 +
  791 + cart_set_err: function (e) {
  792 + var txt = e.currentTarget.dataset.err;
  793 + var ob = {};
  794 + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
  795 + this.setData(ob);
  796 + },
781 797
782 //// 开启物流的弹窗 798 //// 开启物流的弹窗
783 - show_wu_arr:function(e){  
784 - this.setData({ open_express: 1}); 799 + show_wu_arr: function (e) {
  800 + this.setData({ open_express: 1 });
785 }, 801 },
786 802
787 //更新下默认,在onshow里面 803 //更新下默认,在onshow里面
788 - update_code(){  
789 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; 804 + update_code() {
  805 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
790 806
791 - var uii=setInterval(function () {  
792 - if(th.data.wu_arr){  
793 - clearInterval(uii); 807 + var uii = setInterval(function () {
  808 + if (th.data.wu_arr) {
  809 + clearInterval(uii);
794 for (var k = 0; k < th.data.wu_arr.length; k++) { 810 for (var k = 0; k < th.data.wu_arr.length; k++) {
795 var item = th.data.wu_arr[k]; 811 var item = th.data.wu_arr[k];
796 if (def_exp_code == item.code) { 812 if (def_exp_code == item.code) {
@@ -798,37 +814,37 @@ Page({ @@ -798,37 +814,37 @@ Page({
798 } 814 }
799 } 815 }
800 //--如果是立即购买-- 816 //--如果是立即购买--
801 - th.setData({ index: m_wind, is_express: m_wind}); 817 + th.setData({ index: m_wind, is_express: m_wind });
802 } 818 }
803 - },500) 819 + }, 500)
804 }, 820 },
805 821
806 // 关闭物流的弹窗 822 // 关闭物流的弹窗
807 - close_express:function(){  
808 - this.setData({ open_express:0 }); 823 + close_express: function () {
  824 + this.setData({ open_express: 0 });
809 }, 825 },
810 // 选择物流 826 // 选择物流
811 - click_express_name:function(e){ 827 + click_express_name: function (e) {
812 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 828 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
813 - var index=e.currentTarget.dataset.idxe;  
814 - var ob={ is_express: index, is_shipping_code: shippingcode,index:index}; 829 + var index = e.currentTarget.dataset.idxe;
  830 + var ob = { is_express: index, is_shipping_code: shippingcode, index: index };
815 this.setData(ob); 831 this.setData(ob);
816 }, 832 },
817 833
818 //点击确定物流 834 //点击确定物流
819 - determine_expres:function(e){  
820 - this.setData({ open_express: 0}); 835 + determine_expres: function (e) {
  836 + this.setData({ open_express: 0 });
821 this.calculatePrice2(); 837 this.calculatePrice2();
822 }, 838 },
823 //设置默认物流 839 //设置默认物流
824 select_default_logistics: function () { 840 select_default_logistics: function () {
825 - var th=this;  
826 - var is_shipping_code=this.data.is_shipping_code  
827 - getApp().request.put("/api/weshop/users/update",{  
828 - data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code},  
829 - success:function(rse){  
830 - if (rse.data.code==0){  
831 - getApp().globalData.userInfo.def_exp_code=is_shipping_code; 841 + var th = this;
  842 + var is_shipping_code = this.data.is_shipping_code
  843 + getApp().request.put("/api/weshop/users/update", {
  844 + data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code },
  845 + success: function (rse) {
  846 + if (rse.data.code == 0) {
  847 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
832 th.setData({ open_express: 0 }); 848 th.setData({ open_express: 0 });
833 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19---- 849 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
834 //if(th.data.is_b_now==1) th.calculatePrice2(); 850 //if(th.data.is_b_now==1) th.calculatePrice2();
@@ -841,14 +857,14 @@ Page({ @@ -841,14 +857,14 @@ Page({
841 857
842 858
843 //跳转到购买卡 859 //跳转到购买卡
844 - buycard:function(){  
845 - getApp().goto("/pages/user/plus/plus");  
846 - getApp().globalData.plus_buy_back=1;  
847 - },  
848 -  
849 - switchChange:function (e) {  
850 - console.log(e,111);  
851 - this.setData({agree_no_ref:e.detail.value}); 860 + buycard: function () {
  861 + getApp().goto("/pages/user/plus/plus");
  862 + getApp().globalData.plus_buy_back = 1;
  863 + },
  864 +
  865 + switchChange: function (e) {
  866 + console.log(e, 111);
  867 + this.setData({ agree_no_ref: e.detail.value });
852 } 868 }
853 - 869 +
854 }); 870 });
pages/cart/cart/cart.wxml
@@ -41,7 +41,8 @@ @@ -41,7 +41,8 @@
41 <!-- 编辑 --> 41 <!-- 编辑 -->
42 <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between"> 42 <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between">
43 <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free"> 43 <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
44 - <text>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text> 44 + <text wx:if="{{weight_free <=0}}">全场满{{freight_free}}元可享包邮</text>
  45 + <text wx:else>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text>
45 </view> 46 </view>
46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view> 47 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
47 <view wx:else bindtap="edit_cart" data-type="0">完成</view> 48 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
pages/cart/cart/zh_calculate.js
@@ -239,15 +239,8 @@ module.exports = { @@ -239,15 +239,8 @@ module.exports = {
239 if (act.is_bzyh && zhqty_bz.length > 0) { 239 if (act.is_bzyh && zhqty_bz.length > 0) {
240 if (zhqty_bz.length > 1) { 240 if (zhqty_bz.length > 1) {
241 let zhqty_bz_arr = []; 241 let zhqty_bz_arr = [];
242 - let zhqty_bz_flag = zhqty_bz.every((item1, i) => {  
243 - var bz_num = be * item1['zhqty']; //超量倍增  
244 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量  
245 - if (bz_num > num) {  
246 - zhqty_bz_arr.push(item1);  
247 - zhqty_bz.splice(i, 1)  
248 - }  
249 - return bz_num <= num;  
250 - }) 242 + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr);
  243 +
251 if (zhqty_bz_flag) { 244 if (zhqty_bz_flag) {
252 for (let i = 0; i < zhqty_bz.length; i++) { 245 for (let i = 0; i < zhqty_bz.length; i++) {
253 var vv = zhqty_bz[i]; 246 var vv = zhqty_bz[i];
@@ -262,11 +255,12 @@ module.exports = { @@ -262,11 +255,12 @@ module.exports = {
262 } 255 }
263 } 256 }
264 } else { 257 } else {
  258 + zhqty_len=1;
265 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { 259 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) {
266 - return o['num'] 260 + return o['num'];
267 })); 261 }));
268 let new_arr = zhqty_bz_arr.filter(ii => { 262 let new_arr = zhqty_bz_arr.filter(ii => {
269 - return ii['num'] == min_bz_num 263 + return ii['num'] == min_bz_num;
270 }) 264 })
271 var vv = new_arr[0]; 265 var vv = new_arr[0];
272 var bz_num = be * new_arr[0].zhqty; //超量倍增 266 var bz_num = be * new_arr[0].zhqty; //超量倍增
@@ -285,18 +279,22 @@ module.exports = { @@ -285,18 +279,22 @@ module.exports = {
285 } 279 }
286 bz_num_ok = be * vv.zhqty; 280 bz_num_ok = be * vv.zhqty;
287 } 281 }
288 -  
289 - for (let j = 0; j < bz_num_ok; j++) {  
290 - let index = no_in_arr.findIndex(i => {  
291 - return vv.goods_id === i.goods_id  
292 - })  
293 - if (index > -1) {  
294 - delete_num++  
295 - no_in_arr.splice(index, 1) 282 +
  283 + for(let i = 0; i < zhqty_bz.length; i++){
  284 + let item1=zhqty_bz[i];
  285 + for (let j = 0; j < be * item1['zhqty']; j++) {
  286 + let index = no_in_arr.findIndex(i => {
  287 + return item1.goods_id === i.goods_id
  288 + })
  289 + if (index > -1) {
  290 + // delete_num++
  291 + no_in_arr.splice(index, 1)
  292 + }
296 } 293 }
297 } 294 }
  295 + aprice += be * aprice;
298 } 296 }
299 - } else { 297 + } else {
300 var vv = zhqty_bz[0]; 298 var vv = zhqty_bz[0];
301 var bz_num = be * vv.zhqty; //超量倍增 299 var bz_num = be * vv.zhqty; //超量倍增
302 var num = vv['num'] - vv.zhqty; //购买数量减去超量 300 var num = vv['num'] - vv.zhqty; //购买数量减去超量
@@ -310,14 +308,11 @@ module.exports = { @@ -310,14 +308,11 @@ module.exports = {
310 // be=be-bz_num_ok; 308 // be=be-bz_num_ok;
311 if (num % vv.zhqty == 0) { 309 if (num % vv.zhqty == 0) {
312 be = num / vv.zhqty; 310 be = num / vv.zhqty;
313 - // bz_num_ok = num;  
314 } else { 311 } else {
315 be = Math.floor(num / vv.zhqty) 312 be = Math.floor(num / vv.zhqty)
316 - // bz_num_ok = num - (be * vv.zhqty);  
317 } 313 }
318 bz_num_ok = be * vv.zhqty; 314 bz_num_ok = be * vv.zhqty;
319 } 315 }
320 - // be=vv.num;  
321 for (let j = 0; j < bz_num_ok; j++) { 316 for (let j = 0; j < bz_num_ok; j++) {
322 let index = no_in_arr.findIndex(i => { 317 let index = no_in_arr.findIndex(i => {
323 return vv.goods_id === i.goods_id 318 return vv.goods_id === i.goods_id
@@ -496,7 +491,22 @@ module.exports = { @@ -496,7 +491,22 @@ module.exports = {
496 } 491 }
497 } 492 }
498 return dest; 493 return dest;
499 - } 494 + },
  495 +
  496 + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){
  497 + let zhqty_bz_flag =true;
  498 + for(let i=0;i<zhqty_bz.length;i++){
  499 + let item=zhqty_bz[i];
  500 + let bz_num = be * item['zhqty']; //超量倍增
  501 + let num = item['num'] - item['zhqty']; //购买数量减去超量
  502 + if (bz_num > num) {
  503 + zhqty_bz_flag=false;
  504 + zhqty_bz_arr.push(item);
  505 + // zhqty_bz.splice(i,1)
  506 + }
  507 + }
  508 + return zhqty_bz_flag;
  509 + }
500 510
501 511
502 } 512 }
503 \ No newline at end of file 513 \ No newline at end of file
pages/cart/cart2/cart2.js
@@ -123,46 +123,47 @@ Page({ @@ -123,46 +123,47 @@ Page({
123 tabs: ['门店自提', '快递邮寄'], 123 tabs: ['门店自提', '快递邮寄'],
124 currentTabIndex: 1, 124 currentTabIndex: 1,
125 125
126 - in_zhact_gdmap:{}, //不同门店参与同一活动的限购  
127 - hid_inp:1,  
128 - user_note:"",  
129 - zhhe_act_map:{}, //组合活动的map表  
130 - zuhe_map_good:{}, //组合购的map表  
131 - ladder_map:{}, //阶梯促销的map表  
132 -  
133 - state:0, //阶梯促销的的立即购买也走购物车流程state=1 126 + in_zhact_gdmap: {}, //不同门店参与同一活动的限购
  127 + hid_inp: 1,
  128 + user_note: "",
  129 + zhhe_act_map: {}, //组合活动的map表
  130 + zuhe_map_good: {}, //组合购的map表
  131 + ladder_map: {}, //阶梯促销的map表
  132 + is_no_past: 1,
  133 + state: 0, //阶梯促销的的立即购买也走购物车流程state=1
134 }, 134 },
135 onLoad: function (t) { 135 onLoad: function (t) {
136 - wx.setNavigationBarTitle({title: "填写订单",}) 136 + wx.setNavigationBarTitle({ title: "填写订单", })
137 var th = this; 137 var th = this;
138 - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); 138 + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
139 th.data.param = t; 139 th.data.param = t;
140 //清理一下,确保最新的系统配置 140 //清理一下,确保最新的系统配置
141 getApp().globalData.config2 = null; 141 getApp().globalData.config2 = null;
142 //清空is_pick_up 142 //清空is_pick_up
143 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 143 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
144 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 144 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
145 success: function (s) { 145 success: function (s) {
146 } 146 }
147 }); 147 });
148 148
149 //阶梯购 或者 组合购的立即购买 149 //阶梯购 或者 组合购的立即购买
150 - if(t.state){  
151 - th.data.state=1; 150 + if (t.state) {
  151 + th.data.state = 1;
152 } 152 }
153 getApp().promiseGet("/api/wx/weappSendlist/page", { 153 getApp().promiseGet("/api/wx/weappSendlist/page", {
154 data: { 154 data: {
155 store_id: os.stoid, 155 store_id: os.stoid,
156 typeid: "1001" 156 typeid: "1001"
157 - }}).then(res=>{ 157 + }
  158 + }).then(res => {
158 if (res.data.code == 0 && res.data.data.pageData.length > 0) { 159 if (res.data.code == 0 && res.data.data.pageData.length > 0) {
159 var template_id = res.data.data.pageData[0].template_id; 160 var template_id = res.data.data.pageData[0].template_id;
160 - th.setData({template_id:template_id}); 161 + th.setData({ template_id: template_id });
161 } 162 }
162 }) 163 })
163 }, 164 },
164 onUnload: function () { 165 onUnload: function () {
165 - this.setData({isclose: 1}) 166 + this.setData({ isclose: 1 })
166 }, 167 },
167 onHide: function () { 168 onHide: function () {
168 this.setData({ 169 this.setData({
@@ -175,7 +176,7 @@ Page({ @@ -175,7 +176,7 @@ Page({
175 //----------子页返回父页触发---------- 176 //----------子页返回父页触发----------
176 onShow: function () { 177 onShow: function () {
177 var th = this; 178 var th = this;
178 - th.setData({show_submit: 0}); //让提交先掩藏 179 + th.setData({ show_submit: 0 }); //让提交先掩藏
179 th.data.g_cart_q_time = null; 180 th.data.g_cart_q_time = null;
180 181
181 if (th.data.isclose == 0) { 182 if (th.data.isclose == 0) {
@@ -208,20 +209,20 @@ Page({ @@ -208,20 +209,20 @@ Page({
208 th.data.is_summit_ing = 0; 209 th.data.is_summit_ing = 0;
209 //更换地址回来要重新调用计算价钱的接口 210 //更换地址回来要重新调用计算价钱的接口
210 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { 211 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
211 - th.setData({user_addr: ie}); 212 + th.setData({ user_addr: ie });
212 if (th.data.is_b_now == 1) { 213 if (th.data.is_b_now == 1) {
213 if (th.data.bn_goods) { 214 if (th.data.bn_goods) {
214 - th.setData({add_back: 1}); 215 + th.setData({ add_back: 1 });
215 //th.calculatePrice2(); 216 //th.calculatePrice2();
216 } 217 }
217 } else { 218 } else {
218 if (th.data.cartlist) { 219 if (th.data.cartlist) {
219 - th.setData({add_back: 1}); 220 + th.setData({ add_back: 1 });
220 //th.calculatePrice(); 221 //th.calculatePrice();
221 } 222 }
222 } 223 }
223 } else { 224 } else {
224 - th.setData({user_addr: ie}); 225 + th.setData({ user_addr: ie });
225 } 226 }
226 var going = 0; 227 var going = 0;
227 228
@@ -275,34 +276,34 @@ Page({ @@ -275,34 +276,34 @@ Page({
275 //-- 获取所有的等级卡, -- 276 //-- 获取所有的等级卡, --
276 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 277 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
277 {}).then(res => { 278 {}).then(res => {
278 - if (res.data.code == 0) {  
279 - var plusCard = res.data.data;  
280 - //-- 循环判断,拿到最贵的那张卡 --  
281 - for (var ih in plusCard) {  
282 - if (plusCard[ih].IsStopBuy == true) {  
283 - continue;  
284 - }  
285 - if (max_price < 0) {  
286 - max_price = plusCard[ih].CardFee;  
287 - name = 'card' + plusCard[ih]['CorrPrice'];  
288 - show_card = plusCard[ih];  
289 - } else {  
290 - if (max_price < plusCard[ih].CardFee) { 279 + if (res.data.code == 0) {
  280 + var plusCard = res.data.data;
  281 + //-- 循环判断,拿到最贵的那张卡 --
  282 + for (var ih in plusCard) {
  283 + if (plusCard[ih].IsStopBuy == true) {
  284 + continue;
  285 + }
  286 + if (max_price < 0) {
291 max_price = plusCard[ih].CardFee; 287 max_price = plusCard[ih].CardFee;
292 name = 'card' + plusCard[ih]['CorrPrice']; 288 name = 'card' + plusCard[ih]['CorrPrice'];
293 show_card = plusCard[ih]; 289 show_card = plusCard[ih];
  290 + } else {
  291 + if (max_price < plusCard[ih].CardFee) {
  292 + max_price = plusCard[ih].CardFee;
  293 + name = 'card' + plusCard[ih]['CorrPrice'];
  294 + show_card = plusCard[ih];
  295 + }
294 } 296 }
295 } 297 }
296 - }  
297 298
298 - if (show_card) {  
299 - name = name.toLowerCase();  
300 - th.setData({card_name: name, show_card: show_card}) 299 + if (show_card) {
  300 + name = name.toLowerCase();
  301 + th.setData({ card_name: name, show_card: show_card })
  302 + }
301 } 303 }
302 - }  
303 - //-----先获取物流,再获取用户信息,再展示页面-----  
304 - th.get_wuliu(th.get_info(th.show_page));  
305 - }) 304 + //-----先获取物流,再获取用户信息,再展示页面-----
  305 + th.get_wuliu(th.get_info(th.show_page));
  306 + })
306 } else { 307 } else {
307 //-----先获取物流,再获取用户信息,再展示页面----- 308 //-----先获取物流,再获取用户信息,再展示页面-----
308 th.get_wuliu(th.get_info(th.show_page)); 309 th.get_wuliu(th.get_info(th.show_page));
@@ -321,10 +322,10 @@ Page({ @@ -321,10 +322,10 @@ Page({
321 if (th.data.is_default_logistics) { 322 if (th.data.is_default_logistics) {
322 //如果第一个不是开启默认,说明要让用户自己选 323 //如果第一个不是开启默认,说明要让用户自己选
323 if (!e[0].is_default) { 324 if (!e[0].is_default) {
324 - th.setData({is_default_logistics: 0}); 325 + th.setData({ is_default_logistics: 0 });
325 } 326 }
326 } 327 }
327 - th.setData({wu_arr: e}) 328 + th.setData({ wu_arr: e })
328 typeof func == "function" && func(); 329 typeof func == "function" && func();
329 }) 330 })
330 }, 331 },
@@ -338,7 +339,7 @@ Page({ @@ -338,7 +339,7 @@ Page({
338 getuser_addr: function (func) { 339 getuser_addr: function (func) {
339 var th = this; 340 var th = this;
340 a.get("/api/weshop/useraddress/page", { 341 a.get("/api/weshop/useraddress/page", {
341 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 342 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
342 success: function (su) { 343 success: function (su) {
343 /*--- 344 /*---
344 var user_addr=[ 345 var user_addr=[
@@ -363,7 +364,7 @@ Page({ @@ -363,7 +364,7 @@ Page({
363 } 364 }
364 365
365 if (item == undefined) item = null; 366 if (item == undefined) item = null;
366 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 367 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
367 368
368 func(item); 369 func(item);
369 } 370 }
@@ -378,19 +379,19 @@ Page({ @@ -378,19 +379,19 @@ Page({
378 //会员的信息,要获取最新 379 //会员的信息,要获取最新
379 var user = getApp().globalData.userInfo; 380 var user = getApp().globalData.userInfo;
380 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { 381 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
381 - data: {r: Math.random()}, 382 + data: { r: Math.random() },
382 success: function (e) { 383 success: function (e) {
383 getApp().globalData.userInfo = e.data.data; 384 getApp().globalData.userInfo = e.data.data;
384 - th.setData({userinfo: e.data.data}); 385 + th.setData({ userinfo: e.data.data });
385 386
386 //选获取地址 387 //选获取地址
387 th.getuser_addr(function (addr) { 388 th.getuser_addr(function (addr) {
388 - th.setData({user_addr: addr}); 389 + th.setData({ user_addr: addr });
389 //--------------------------立即购买------------------ 390 //--------------------------立即购买------------------
390 if (ta.is_bnow == 1) { 391 if (ta.is_bnow == 1) {
391 //读取门店 392 //读取门店
392 to.get_allsto(function (e) { 393 to.get_allsto(function (e) {
393 - th.setData({allsto: e}); 394 + th.setData({ allsto: e });
394 //获取立即购买的商品信息 395 //获取立即购买的商品信息
395 th.get_buy_goods(ta.goods_id); 396 th.get_buy_goods(ta.goods_id);
396 }); 397 });
@@ -398,7 +399,7 @@ Page({ @@ -398,7 +399,7 @@ Page({
398 //------------------------购物车结算---------------------- 399 //------------------------购物车结算----------------------
399 //读取门店 400 //读取门店
400 to.get_allsto(function (e) { 401 to.get_allsto(function (e) {
401 - th.setData({allsto: e}); 402 + th.setData({ allsto: e });
402 //-------获取购物车已经选择的商品-------- 403 //-------获取购物车已经选择的商品--------
403 th.get_cart(); 404 th.get_cart();
404 }) 405 })
@@ -407,12 +408,12 @@ Page({ @@ -407,12 +408,12 @@ Page({
407 408
408 //获取提现金额 409 //获取提现金额
409 getApp().request.get("/api/weshop/withdrawals/summoney", { 410 getApp().request.get("/api/weshop/withdrawals/summoney", {
410 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, 411 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
411 success: function (su) { 412 success: function (su) {
412 if (su.data.code == 0) { 413 if (su.data.code == 0) {
413 var yuer = parseFloat(th.data.userinfo.user_money - 414 var yuer = parseFloat(th.data.userinfo.user_money -
414 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); 415 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
415 - th.setData({txmon: su.data.data.summoney, yuer: yuer}); 416 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
416 } 417 }
417 } 418 }
418 }); 419 });
@@ -426,8 +427,8 @@ Page({ @@ -426,8 +427,8 @@ Page({
426 //-----真的获取购物车,入口-------- 427 //-----真的获取购物车,入口--------
427 get_cart: function () { 428 get_cart: function () {
428 var th = this, app = getApp(); 429 var th = this, app = getApp();
429 - var state=0;  
430 - if(th.data.state) state=1; 430 + var state = 0;
  431 + if (th.data.state) state = 1;
431 a.get("/api/weshop/cart/list", { 432 a.get("/api/weshop/cart/list", {
432 data: { 433 data: {
433 user_id: to.globalData.user_id, selected: 1, state: state, 434 user_id: to.globalData.user_id, selected: 1, state: state,
@@ -438,7 +439,7 @@ Page({ @@ -438,7 +439,7 @@ Page({
438 var arr = new Array(); 439 var arr = new Array();
439 var carr = su.data.data.pageData; 440 var carr = su.data.data.pageData;
440 th.data.cartlist_y = carr; //存储原始购物车列表 441 th.data.cartlist_y = carr; //存储原始购物车列表
441 - th.data.in_zhact_gdmap={}; 442 + th.data.in_zhact_gdmap = {};
442 443
443 //---是不是购买等级卡成功的返回---等级卡显示的判断--- 444 //---是不是购买等级卡成功的返回---等级卡显示的判断---
444 var is_card_back = getApp().globalData.is_card_back; 445 var is_card_back = getApp().globalData.is_card_back;
@@ -447,7 +448,7 @@ Page({ @@ -447,7 +448,7 @@ Page({
447 var item1 = carr[i]; 448 var item1 = carr[i];
448 //把已经购买了多少见的内容填入 449 //把已经购买了多少见的内容填入
449 450
450 - var goodsbuynum=0,promgoodsbuynum=0; 451 + var goodsbuynum = 0, promgoodsbuynum = 0;
451 //--要获得商品,该用户买了多少件,同步应用-- 452 //--要获得商品,该用户买了多少件,同步应用--
452 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 453 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
453 data: { 454 data: {
@@ -465,7 +466,7 @@ Page({ @@ -465,7 +466,7 @@ Page({
465 goodsbuynum = buy_num_data.goodsbuynum; 466 goodsbuynum = buy_num_data.goodsbuynum;
466 }) 467 })
467 //如果有购买活动 468 //如果有购买活动
468 - item1.promgoodsbuynum=promgoodsbuynum; 469 + item1.promgoodsbuynum = promgoodsbuynum;
469 470
470 //要把优惠活动加入,prom_goods_map中,赠品不要运算 471 //要把优惠活动加入,prom_goods_map中,赠品不要运算
471 if (item1.prom_type == 3 && item1.is_gift != 1) { 472 if (item1.prom_type == 3 && item1.is_gift != 1) {
@@ -473,8 +474,8 @@ Page({ @@ -473,8 +474,8 @@ Page({
473 } 474 }
474 475
475 //要把组合购的东西拿出来算一下 476 //要把组合购的东西拿出来算一下
476 - if(item1.prom_type == 7) {  
477 - if(!th.data.zuhe_map_good[item1.prom_id]) { 477 + if (item1.prom_type == 7) {
  478 + if (!th.data.zuhe_map_good[item1.prom_id]) {
478 var isok = 1; 479 var isok = 1;
479 var is_flag = 1; 480 var is_flag = 1;
480 //如果有组合购 481 //如果有组合购
@@ -523,50 +524,49 @@ Page({ @@ -523,50 +524,49 @@ Page({
523 } 524 }
524 }) 525 })
525 } 526 }
526 - else  
527 - {  
528 - item1.act = th.data.zhhe_act_map[item1.prom_id]; 527 + else {
  528 + item1.act = th.data.zhhe_act_map[item1.prom_id];
529 } 529 }
530 } 530 }
531 - if(item1.prom_type==10){  
532 - if(!th.data.ladder_map[item1.prom_id]){ 531 + if (item1.prom_type == 10) {
  532 + if (!th.data.ladder_map[item1.prom_id]) {
533 //如果有组合购 533 //如果有组合购
534 var isok = 1; 534 var isok = 1;
535 - var is_flag=1;  
536 - var act=null;  
537 - var url="/api/weshop/prom/ladderForm/get/"+os.stoid+"/"+item1.prom_id; 535 + var is_flag = 1;
  536 + var act = null;
  537 + var url = "/api/weshop/prom/ladderForm/get/" + os.stoid + "/" + item1.prom_id;
538 await getApp().request.promiseGet(url, {}).then(res => { 538 await getApp().request.promiseGet(url, {}).then(res => {
539 - console.log(res,1000);  
540 - if(res.data.code==0 && res.data.data){  
541 - if(res.data.data.isuse!=1){  
542 - isok=0; 539 + console.log(res, 1000);
  540 + if (res.data.code == 0 && res.data.data) {
  541 + if (res.data.data.isuse != 1) {
  542 + isok = 0;
543 } 543 }
544 //如果活动已经结束 544 //如果活动已经结束
545 - if(res.data.data.is_end==1){  
546 - isok=0; 545 + if (res.data.data.is_end == 1) {
  546 + isok = 0;
547 } 547 }
548 //已经结束 548 //已经结束
549 - if(ut.gettimestamp()>res.data.data.end_time){  
550 - isok=0; 549 + if (ut.gettimestamp() > res.data.data.end_time) {
  550 + isok = 0;
551 } 551 }
552 //还未开始 552 //还未开始
553 - if(ut.gettimestamp()<res.data.data.start_time){  
554 - isok=0; 553 + if (ut.gettimestamp() < res.data.data.start_time) {
  554 + isok = 0;
555 } 555 }
556 - act=res.data.data; 556 + act = res.data.data;
557 557
558 - }else{ 558 + } else {
559 //未找到商品的活动 559 //未找到商品的活动
560 is_flag = 0; 560 is_flag = 0;
561 } 561 }
562 }) 562 })
563 - if (!isok){ 563 + if (!isok) {
564 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 564 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
565 getApp().request.delete(url, {}); 565 getApp().request.delete(url, {});
566 - th.data.ladder_map[item1.prom_id]=-1; 566 + th.data.ladder_map[item1.prom_id] = -1;
567 continue; 567 continue;
568 } 568 }
569 - th.data.ladder_map[item1.prom_id]=act; 569 + th.data.ladder_map[item1.prom_id] = act;
570 570
571 //-- 获取阶梯规则 -- 571 //-- 获取阶梯规则 --
572 var url1 = "/api/weshop/prom/ladderList/list"; 572 var url1 = "/api/weshop/prom/ladderList/list";
@@ -577,9 +577,9 @@ Page({ @@ -577,9 +577,9 @@ Page({
577 await getApp().request.promiseGet(url1, { 577 await getApp().request.promiseGet(url1, {
578 data: req_data 578 data: req_data
579 }).then(rs1 => { 579 }).then(rs1 => {
580 - if (rs1.data.code==0 && rs1.data.data) { 580 + if (rs1.data.code == 0 && rs1.data.data) {
581 var gdlist = rs1.data.data; 581 var gdlist = rs1.data.data;
582 - th.data.ladder_map[item1.prom_id].ladder_list=gdlist; 582 + th.data.ladder_map[item1.prom_id].ladder_list = gdlist;
583 } 583 }
584 }) 584 })
585 } 585 }
@@ -616,7 +616,7 @@ Page({ @@ -616,7 +616,7 @@ Page({
616 616
617 item.original_img = oo.imghost + item.original_img; 617 item.original_img = oo.imghost + item.original_img;
618 618
619 - var car_item=item; 619 + var car_item = item;
620 /*----接口要弄出来的,先顶着-----*/ 620 /*----接口要弄出来的,先顶着-----*/
621 var pcid = car_item.pick_id; 621 var pcid = car_item.pick_id;
622 var find = 0; 622 var find = 0;
@@ -625,7 +625,7 @@ Page({ @@ -625,7 +625,7 @@ Page({
625 if (arr.length > 0) { 625 if (arr.length > 0) {
626 for (var j = 0; j < arr.length; j++) { 626 for (var j = 0; j < arr.length; j++) {
627 if (arr[j].pickup_id == pcid) { 627 if (arr[j].pickup_id == pcid) {
628 - if(item.is_gift!=1){ 628 + if (item.is_gift != 1) {
629 //确定配送方式 629 //确定配送方式
630 if (arr[j].distr_t == 0) { 630 if (arr[j].distr_t == 0) {
631 arr[j].distr_t = car_item.distr_type; 631 arr[j].distr_t = car_item.distr_type;
@@ -644,8 +644,8 @@ Page({ @@ -644,8 +644,8 @@ Page({
644 break; 644 break;
645 } 645 }
646 arr[j].exp_type = e_t; 646 arr[j].exp_type = e_t;
647 - if (e_t == 0) th.setData({is_all_zt: 0});  
648 - else if(e_t==1) th.setData({is_all_zt: 1}); 647 + if (e_t == 0) th.setData({ is_all_zt: 0 });
  648 + else if (e_t == 1) th.setData({ is_all_zt: 1 });
649 } 649 }
650 650
651 //-- 把等级卡会优惠多少钱装进去 -- 651 //-- 把等级卡会优惠多少钱装进去 --
@@ -688,8 +688,8 @@ Page({ @@ -688,8 +688,8 @@ Page({
688 break; 688 break;
689 } 689 }
690 //如果是物流的话,全部自提的控制要弄成0 690 //如果是物流的话,全部自提的控制要弄成0
691 - if (e_t == 0) th.setData({is_all_zt: 0});  
692 - else th.setData({is_all_zt: 1}); 691 + if (e_t == 0) th.setData({ is_all_zt: 0 });
  692 + else th.setData({ is_all_zt: 1 });
693 693
694 var narr = new Array(); 694 var narr = new Array();
695 narr.push(car_item); 695 narr.push(car_item);
@@ -748,11 +748,11 @@ Page({ @@ -748,11 +748,11 @@ Page({
748 var offline_price = 0; 748 var offline_price = 0;
749 var offline_num = 0; 749 var offline_num = 0;
750 for (var c = 0; c < item.length; c++) { 750 for (var c = 0; c < item.length; c++) {
751 - if(th.data.sales_rules!=2){  
752 - item[c].offline_price=0; 751 + if (th.data.sales_rules != 2) {
  752 + item[c].offline_price = 0;
753 } 753 }
754 //-- 如果这个商品是线下取价的时候 -- 754 //-- 如果这个商品是线下取价的时候 --
755 - if (item[c].offline_price > 0 && item[c].prom_type != 7 ) { 755 + if (item[c].offline_price > 0 && item[c].prom_type != 7) {
756 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; 756 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num;
757 offline_num += item[c].goods_num; 757 offline_num += item[c].goods_num;
758 } 758 }
@@ -778,7 +778,7 @@ Page({ @@ -778,7 +778,7 @@ Page({
778 var h_item = obj[var1]; 778 var h_item = obj[var1];
779 var gdlist = th.data.zuhe_map_good[h_item.prom_id]; 779 var gdlist = th.data.zuhe_map_good[h_item.prom_id];
780 //获取活动需要的商品列表 780 //获取活动需要的商品列表
781 - u_item.zh_prom_goods[h_item.prom_id] = {gdlist: gdlist, act: h_item.act}; 781 + u_item.zh_prom_goods[h_item.prom_id] = { gdlist: gdlist, act: h_item.act };
782 } 782 }
783 zh_calc.fir_set_arr(u_item, th); 783 zh_calc.fir_set_arr(u_item, th);
784 } 784 }
@@ -792,10 +792,10 @@ Page({ @@ -792,10 +792,10 @@ Page({
792 //存储不同阶梯促销活动的商品列表 792 //存储不同阶梯促销活动的商品列表
793 u_item.ladder_map = {}; 793 u_item.ladder_map = {};
794 for (let var1 in obj) { 794 for (let var1 in obj) {
795 - var h_item=obj[var1];  
796 - var act= th.data.ladder_map[h_item.prom_id]; 795 + var h_item = obj[var1];
  796 + var act = th.data.ladder_map[h_item.prom_id];
797 //获取活动需要的商品列表 797 //获取活动需要的商品列表
798 - u_item.ladder_map[h_item.prom_id] =act; 798 + u_item.ladder_map[h_item.prom_id] = act;
799 } 799 }
800 ladder_calc.fir_set_arr(u_item, th); 800 ladder_calc.fir_set_arr(u_item, th);
801 } 801 }
@@ -809,7 +809,7 @@ Page({ @@ -809,7 +809,7 @@ Page({
809 setTimeout(function () { 809 setTimeout(function () {
810 var frozenQuan = null; 810 var frozenQuan = null;
811 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 811 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
812 - app.request.promiseGet(url0, {1: 1}).then(res => { 812 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
813 if (res.data.code == 0) { 813 if (res.data.code == 0) {
814 frozenQuan = res.data.data; 814 frozenQuan = res.data.data;
815 th.data.frozenQuan = frozenQuan; 815 th.data.frozenQuan = frozenQuan;
@@ -880,7 +880,7 @@ Page({ @@ -880,7 +880,7 @@ Page({
880 th.data.card_name = th.data.userinfo.card_field; 880 th.data.card_name = th.data.userinfo.card_field;
881 gg.goods_price = gd[th.data.card_name]; 881 gg.goods_price = gd[th.data.card_name];
882 getApp().globalData.is_card_back = 0; 882 getApp().globalData.is_card_back = 0;
883 - th.setData({card_cut_price: 0}); 883 + th.setData({ card_cut_price: 0 });
884 //如果是秒杀的返回 884 //如果是秒杀的返回
885 if (gd.prom_type == 1) gd.prom_type = 0; 885 if (gd.prom_type == 1) gd.prom_type = 0;
886 } else { 886 } else {
@@ -888,12 +888,12 @@ Page({ @@ -888,12 +888,12 @@ Page({
888 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- 888 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
889 if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) { 889 if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
890 var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; 890 var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num;
891 - th.setData({card_cut_price: cut_p}); 891 + th.setData({ card_cut_price: cut_p });
892 } 892 }
893 } 893 }
894 894
895 - gd.prom_type=gg.prom_type?gg.prom_type:0;  
896 - gd.prom_id=gg.prom_id?gg.prom_id:0; 895 + gd.prom_type = gg.prom_type ? gg.prom_type : 0;
  896 + gd.prom_id = gg.prom_id ? gg.prom_id : 0;
897 897
898 switch (gd.prom_type) { 898 switch (gd.prom_type) {
899 case 0: 899 case 0:
@@ -956,7 +956,7 @@ Page({ @@ -956,7 +956,7 @@ Page({
956 ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 956 ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式
957 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 957 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额
958 958
959 - th.setData({buy_now_gift_goods: ob}); 959 + th.setData({ buy_now_gift_goods: ob });
960 } 960 }
961 } 961 }
962 962
@@ -990,7 +990,7 @@ Page({ @@ -990,7 +990,7 @@ Page({
990 t.data.data.guide_id = gg.guide_id; 990 t.data.data.guide_id = gg.guide_id;
991 t.data.data.guide_type = gg.guide_type; 991 t.data.data.guide_type = gg.guide_type;
992 } 992 }
993 - th.setData({collocation_goods: gg.collocation_goods}); 993 + th.setData({ collocation_goods: gg.collocation_goods });
994 994
995 var cart_arr = new Array(); 995 var cart_arr = new Array();
996 //var narr=gg.collocation_goods; 996 //var narr=gg.collocation_goods;
@@ -1001,21 +1001,20 @@ Page({ @@ -1001,21 +1001,20 @@ Page({
1001 1001
1002 //-- 搭配促销的门店配送方式的修复 -- 1002 //-- 搭配促销的门店配送方式的修复 --
1003 et = 1; 1003 et = 1;
1004 - distr_t = 0; 1004 + distr_t = 0; // 配送方式 0=用户自选 1=自提 2=物流
1005 for (var hi in narr) { 1005 for (var hi in narr) {
1006 var dis_t = narr[hi].distr_type; 1006 var dis_t = narr[hi].distr_type;
1007 if (dis_t == 2) { 1007 if (dis_t == 2) {
1008 - th.setData({is_all_zt: 0}); 1008 + th.setData({ is_all_zt: 0 });
1009 et = 0; 1009 et = 0;
1010 } 1010 }
1011 if (dis_t > 0) { 1011 if (dis_t > 0) {
1012 distr_t = dis_t; 1012 distr_t = dis_t;
1013 } 1013 }
1014 } 1014 }
1015 -  
1016 //自选的时候,系统配置了默认的配送方式是物流的时候 1015 //自选的时候,系统配置了默认的配送方式是物流的时候
1017 if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { 1016 if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) {
1018 - et = 0; 1017 + et = 2;
1019 } 1018 }
1020 1019
1021 1020
@@ -1047,7 +1046,7 @@ Page({ @@ -1047,7 +1046,7 @@ Page({
1047 if (gg.prom_type == 5) { 1046 if (gg.prom_type == 5) {
1048 var frozenQuan = null; 1047 var frozenQuan = null;
1049 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 1048 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1050 - app.request.promiseGet(url0, {1: 1}).then(res => { 1049 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
1051 if (res.data.code == 0) { 1050 if (res.data.code == 0) {
1052 frozenQuan = res.data.data; 1051 frozenQuan = res.data.data;
1053 th.data.frozenQuan = frozenQuan; 1052 th.data.frozenQuan = frozenQuan;
@@ -1057,7 +1056,7 @@ Page({ @@ -1057,7 +1056,7 @@ Page({
1057 th.get_cart_quan(); 1056 th.get_cart_quan();
1058 }); 1057 });
1059 1058
1060 - 1059 +
1061 1060
1062 } else { 1061 } else {
1063 //计算价格 1062 //计算价格
@@ -1071,13 +1070,13 @@ Page({ @@ -1071,13 +1070,13 @@ Page({
1071 case 1: //---秒杀----- 1070 case 1: //---秒杀-----
1072 var quanlist = null; 1071 var quanlist = null;
1073 getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id 1072 getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id
1074 - + "/" + gd.goods_id + "/1/" + gd.prom_id+"/"+app.globalData.user_id, { 1073 + + "/" + gd.goods_id + "/1/" + gd.prom_id + "/" + app.globalData.user_id, {
1075 success: async function (tt) { 1074 success: async function (tt) {
1076 if (tt.data.code == 0) { 1075 if (tt.data.code == 0) {
1077 //t.data.data.shop_price = tt.data.data.prom_price; 1076 //t.data.data.shop_price = tt.data.data.prom_price;
1078 t.data.data.shop_price = tt.data.data.prom_user_price; 1077 t.data.data.shop_price = tt.data.data.prom_user_price;
1079 - th.data.ckeck_quan_price=0;  
1080 - gd.is_xz_yh=1; 1078 + th.data.ckeck_quan_price = 0;
  1079 + gd.is_xz_yh = 1;
1081 } else { 1080 } else {
1082 t.data.data.prom_id = 0; 1081 t.data.data.prom_id = 0;
1083 t.data.data.prom_type = 0; 1082 t.data.data.prom_type = 0;
@@ -1099,7 +1098,7 @@ Page({ @@ -1099,7 +1098,7 @@ Page({
1099 //计算价格 1098 //计算价格
1100 th.calculatePrice2(); 1099 th.calculatePrice2();
1101 //获取优惠券,如果有券的钱,就调用 1100 //获取优惠券,如果有券的钱,就调用
1102 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 1101 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
1103 } 1102 }
1104 }); 1103 });
1105 1104
@@ -1107,7 +1106,7 @@ Page({ @@ -1107,7 +1106,7 @@ Page({
1107 1106
1108 case 2: //--- 团购 --- 1107 case 2: //--- 团购 ---
1109 var quanlist = null; 1108 var quanlist = null;
1110 - getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gd.goods_id+"/"+ gd.prom_id, { 1109 + getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
1111 success: async function (tt) { 1110 success: async function (tt) {
1112 if (tt.data.code == 0) { 1111 if (tt.data.code == 0) {
1113 //t.data.data.shop_price = tt.data.data.prom_price; 1112 //t.data.data.shop_price = tt.data.data.prom_price;
@@ -1117,12 +1116,12 @@ Page({ @@ -1117,12 +1116,12 @@ Page({
1117 t.data.data.prom_type = 0; 1116 t.data.data.prom_type = 0;
1118 } 1117 }
1119 1118
1120 - if(tt.data.data.isQuan){ 1119 + if (tt.data.data.isQuan) {
1121 th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; 1120 th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
1122 th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; 1121 th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
1123 th.data.check_quan_ware_list = t.data.data.erpwareid + ""; 1122 th.data.check_quan_ware_list = t.data.data.erpwareid + "";
1124 - }else{  
1125 - gd.is_xz_yh=1; 1123 + } else {
  1124 + gd.is_xz_yh = 1;
1126 } 1125 }
1127 1126
1128 th.setData({ 1127 th.setData({
@@ -1138,7 +1137,7 @@ Page({ @@ -1138,7 +1137,7 @@ Page({
1138 //-- 计算价格 -- 1137 //-- 计算价格 --
1139 th.calculatePrice2(); 1138 th.calculatePrice2();
1140 //获取优惠券,如果有券的钱,就调用 1139 //获取优惠券,如果有券的钱,就调用
1141 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 1140 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
1142 } 1141 }
1143 }); 1142 });
1144 1143
@@ -1153,14 +1152,14 @@ Page({ @@ -1153,14 +1152,14 @@ Page({
1153 checkAddressList: function () { 1152 checkAddressList: function () {
1154 var t = this; 1153 var t = this;
1155 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 1154 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
1156 - title: "请先填写或选择收货地址~",  
1157 - success: function (a) {  
1158 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
1159 - },  
1160 - fail: function () {  
1161 - wx.navigateBack();  
1162 - }  
1163 - }), !1); 1155 + title: "请先填写或选择收货地址~",
  1156 + success: function (a) {
  1157 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  1158 + },
  1159 + fail: function () {
  1160 + wx.navigateBack();
  1161 + }
  1162 + }), !1);
1164 }, 1163 },
1165 showInvoice: function () { 1164 showInvoice: function () {
1166 this.setData({ 1165 this.setData({
@@ -1179,7 +1178,7 @@ Page({ @@ -1179,7 +1178,7 @@ Page({
1179 }, 1178 },
1180 keyUpChangeNum: function (t) { 1179 keyUpChangeNum: function (t) {
1181 var index = t.currentTarget.dataset.index; 1180 var index = t.currentTarget.dataset.index;
1182 - var txt="user_note."+index; 1181 + var txt = "user_note." + index;
1183 this.setData({ 1182 this.setData({
1184 maxWord: t.detail.value.length, 1183 maxWord: t.detail.value.length,
1185 [txt]: t.detail.value 1184 [txt]: t.detail.value
@@ -1269,7 +1268,7 @@ Page({ @@ -1269,7 +1268,7 @@ Page({
1269 } 1268 }
1270 1269
1271 var pt_res = null; 1270 var pt_res = null;
1272 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 1271 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
1273 is_json: 1, 1272 is_json: 1,
1274 data: pt_data 1273 data: pt_data
1275 }).then(res => { 1274 }).then(res => {
@@ -1324,11 +1323,11 @@ Page({ @@ -1324,11 +1323,11 @@ Page({
1324 if (item_map.s_coupon_id) { 1323 if (item_map.s_coupon_id) {
1325 if (!cart_item.s_coupon_id) { 1324 if (!cart_item.s_coupon_id) {
1326 cart_item.s_coupon_id = item_map.s_coupon_id + ""; 1325 cart_item.s_coupon_id = item_map.s_coupon_id + "";
1327 - cart_item.g_coupon_num = [{'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}]; 1326 + cart_item.g_coupon_num = [{ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num }];
1328 } 1327 }
1329 else { 1328 else {
1330 cart_item.s_coupon_id += "," + item_map.s_coupon_id; 1329 cart_item.s_coupon_id += "," + item_map.s_coupon_id;
1331 - cart_item.g_coupon_num.push({'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}) 1330 + cart_item.g_coupon_num.push({ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num })
1332 } 1331 }
1333 } 1332 }
1334 1333
@@ -1336,11 +1335,11 @@ Page({ @@ -1336,11 +1335,11 @@ Page({
1336 if (item_map.s_libao) { 1335 if (item_map.s_libao) {
1337 if (!cart_item.s_libao) { 1336 if (!cart_item.s_libao) {
1338 cart_item.s_libao = item_map.s_libao + ""; 1337 cart_item.s_libao = item_map.s_libao + "";
1339 - cart_item.g_lb_num = [{'l_id': item_map.s_libao, "num": item_map.s_lb_num}]; 1338 + cart_item.g_lb_num = [{ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }];
1340 } 1339 }
1341 else { 1340 else {
1342 cart_item.s_libao += "," + item_map.s_libao; 1341 cart_item.s_libao += "," + item_map.s_libao;
1343 - cart_item.g_lb_num.push({'l_id': item_map.s_libao, "num": item_map.s_lb_num}) 1342 + cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num })
1344 } 1343 }
1345 } 1344 }
1346 } 1345 }
@@ -1349,7 +1348,7 @@ Page({ @@ -1349,7 +1348,7 @@ Page({
1349 }, 1348 },
1350 1349
1351 //-------------------计算订单价格------------------- 1350 //-------------------计算订单价格-------------------
1352 - calculatePrice : function (t, s) { 1351 + calculatePrice: function (t, s) {
1353 var th = this; 1352 var th = this;
1354 to.getConfig2(function (ee) { 1353 to.getConfig2(function (ee) {
1355 to.getwuliuprice(async function (rs) { 1354 to.getwuliuprice(async function (rs) {
@@ -1373,11 +1372,11 @@ Page({ @@ -1373,11 +1372,11 @@ Page({
1373 var no_ex_id = ee.no_ex_id; 1372 var no_ex_id = ee.no_ex_id;
1374 var no_ex_good = null; 1373 var no_ex_good = null;
1375 var by_qc = {}; 1374 var by_qc = {};
1376 - var out_of_weight=0; //超出多少重量 1375 + var out_of_weight = 0; //超出多少重量
1377 if (no_ex_id && freight_free > 0) { 1376 if (no_ex_id && freight_free > 0) {
1378 //-----------获取不包邮区域,不包邮商品------- 1377 //-----------获取不包邮区域,不包邮商品-------
1379 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 1378 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
1380 - data: {store_id: os.stoid, id: no_ex_id} 1379 + data: { store_id: os.stoid, id: no_ex_id }
1381 }).then(res => { 1380 }).then(res => {
1382 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 1381 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
1383 by_qc = res.data.data[0]; 1382 by_qc = res.data.data[0];
@@ -1396,9 +1395,9 @@ Page({ @@ -1396,9 +1395,9 @@ Page({
1396 //调用函数计算每件商品的单价 1395 //调用函数计算每件商品的单价
1397 await th.calc_per(c_arr); 1396 await th.calc_per(c_arr);
1398 //调用函数计算每件组合购商品的单价, 1397 //调用函数计算每件组合购商品的单价,
1399 - await zh_calc.calc_zh_split_price(c_arr,th); 1398 + await zh_calc.calc_zh_split_price(c_arr, th);
1400 //调用函数计算每件阶梯促销商品的单价, 1399 //调用函数计算每件阶梯促销商品的单价,
1401 - await ladder_calc.calc_split_price(c_arr,th); 1400 + await ladder_calc.calc_split_price(c_arr, th);
1402 //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 1401 //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品
1403 await th.get_cart_quan(c_arr); 1402 await th.get_cart_quan(c_arr);
1404 //---循环购物车--- 1403 //---循环购物车---
@@ -1421,7 +1420,7 @@ Page({ @@ -1421,7 +1420,7 @@ Page({
1421 var cart_item = c_arr[i]; //就是每一单的意思 1420 var cart_item = c_arr[i]; //就是每一单的意思
1422 var pickid = cart_item.pickup_id; 1421 var pickid = cart_item.pickup_id;
1423 var o_price = 0; 1422 var o_price = 0;
1424 - var o_price_no_zh=0; //参与订单优惠叠加--组合购的金额汇总 1423 + var o_price_no_zh = 0; //参与订单优惠叠加--组合购的金额汇总
1425 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 1424 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
1426 var item = c_arr[i].goods; //就是每一单的从表的意思 1425 var item = c_arr[i].goods; //就是每一单的从表的意思
1427 1426
@@ -1429,11 +1428,11 @@ Page({ @@ -1429,11 +1428,11 @@ Page({
1429 var quan_price = 0; 1428 var quan_price = 0;
1430 var coupon_price = 0; 1429 var coupon_price = 0;
1431 var quan_no = null; 1430 var quan_no = null;
1432 - var is_has_zh=c_arr[i].is_has_zh;  
1433 - var is_has_ladder=c_arr[i].is_has_ladder; 1431 + var is_has_zh = c_arr[i].is_has_zh;
  1432 + var is_has_ladder = c_arr[i].is_has_ladder;
1434 1433
1435 - var zh_prom_goods=c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间  
1436 - var ladder_prom_goods=c_arr[i].ladder_prom_goods; //组合购计算的原始数据存储空间 1434 + var zh_prom_goods = c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间
  1435 + var ladder_prom_goods = c_arr[i].ladder_prom_goods; //组合购计算的原始数据存储空间
1437 1436
1438 if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) 1437 if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined)
1439 quan_no = th.data.using_quan[pickid].coupon_no; 1438 quan_no = th.data.using_quan[pickid].coupon_no;
@@ -1462,66 +1461,65 @@ Page({ @@ -1462,66 +1461,65 @@ Page({
1462 //--------循环计算总价----------- 1461 //--------循环计算总价-----------
1463 for (var j = 0; j < item.length; j++) { 1462 for (var j = 0; j < item.length; j++) {
1464 1463
1465 - var is_no_zh=0;  
1466 - if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; 1464 + var is_no_zh = 0;
  1465 + if (item[j].prom_type != 7 && item[j].prom_type != 10) is_no_zh = 1;
1467 1466
1468 //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 1467 //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1469 - if(item[j].prom_type==7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[j].prom_id]  
1470 - && th.data.zhhe_act_map[item[j].prom_id].is_orderyh )  
1471 - {  
1472 - is_no_zh=1; 1468 + if (item[j].prom_type == 7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[j].prom_id]
  1469 + && th.data.zhhe_act_map[item[j].prom_id].is_orderyh) {
  1470 + is_no_zh = 1;
1473 } 1471 }
1474 //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 1472 //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1475 - if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]  
1476 - && th.data.ladder_map[item[j].prom_id].is_useorderyh )  
1477 - {  
1478 - is_no_zh=1; 1473 + if (item[j].prom_type == 10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]
  1474 + && th.data.ladder_map[item[j].prom_id].is_useorderyh) {
  1475 + is_no_zh = 1;
1479 } 1476 }
1480 1477
1481 - if(is_no_zh){ 1478 + if (is_no_zh) {
1482 o_price_no_zh += item[j].goods_price * item[j].goods_num; 1479 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1483 } 1480 }
1484 o_price += item[j].goods_price * item[j].goods_num; 1481 o_price += item[j].goods_price * item[j].goods_num;
1485 1482
1486 //判断是否有设置限制重量包邮,先看商品有没有包邮 1483 //判断是否有设置限制重量包邮,先看商品有没有包邮
1487 - if(item[j]['is_past']!==1 && weight_free){  
1488 - if( item[j]['exp_sum_type']==2 ){  
1489 - if (goods_weight < 0) goods_weight = 0;  
1490 - //累积商品重量 每种商品的重量 * 数量  
1491 - goods_weight += item[j]['weight'] * item[j]['goods_num'];  
1492 - out_of_weight = (weight_free*1000) - goods_weight; 1484 + if (item[j]['is_past'] !== 1 && item[j]['exp_sum_type'] == 2) {
  1485 + if (goods_weight < 0) goods_weight = 0;
  1486 + //累积商品重量 每种商品的重量 * 数量
  1487 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1488 + if (weight_free > 0) {
  1489 + out_of_weight = (weight_free * 1000) - goods_weight;
1493 } 1490 }
1494 } 1491 }
  1492 +
1495 } 1493 }
1496 //判断是不是有组合购的金额 1494 //判断是不是有组合购的金额
1497 var f_o_price = o_price; 1495 var f_o_price = o_price;
1498 //如果又优惠的钱,就要减价 1496 //如果又优惠的钱,就要减价
1499 - if (c_arr[i].cut_price > 0){ 1497 + if (c_arr[i].cut_price > 0) {
1500 o_price -= c_arr[i].cut_price; 1498 o_price -= c_arr[i].cut_price;
1501 - o_price_no_zh-=c_arr[i].cut_price; 1499 + o_price_no_zh -= c_arr[i].cut_price;
1502 } 1500 }
1503 //如果有组合购优惠的钱,就要减价 1501 //如果有组合购优惠的钱,就要减价
1504 - if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){ 1502 + if (c_arr[i].zh_cut_price > 0 || c_arr[i].zh_cut_price < 0) {
1505 o_price -= c_arr[i].zh_cut_price; 1503 o_price -= c_arr[i].zh_cut_price;
1506 - if(o_price_no_zh>0){ 1504 + if (o_price_no_zh > 0) {
1507 //找到那些可以订单优惠叠加的 1505 //找到那些可以订单优惠叠加的
1508 - for(let ij in zh_prom_goods){  
1509 - let kitem=zh_prom_goods[ij];  
1510 - if(kitem.act.is_orderyh)  
1511 - o_price_no_zh-=kitem.cut_price; 1506 + for (let ij in zh_prom_goods) {
  1507 + let kitem = zh_prom_goods[ij];
  1508 + if (kitem.act.is_orderyh)
  1509 + o_price_no_zh -= kitem.cut_price;
1512 } 1510 }
1513 } 1511 }
1514 } 1512 }
1515 1513
1516 //如果有组合购优惠的钱,就要减价 1514 //如果有组合购优惠的钱,就要减价
1517 - if (c_arr[i].ladder_cut_price>0 || c_arr[i].ladder_cut_price<0){ 1515 + if (c_arr[i].ladder_cut_price > 0 || c_arr[i].ladder_cut_price < 0) {
1518 o_price -= c_arr[i].ladder_cut_price; 1516 o_price -= c_arr[i].ladder_cut_price;
1519 - if(o_price_no_zh>0){ 1517 + if (o_price_no_zh > 0) {
1520 //找到那些可以订单优惠叠加的 1518 //找到那些可以订单优惠叠加的
1521 - for(let ij in ladder_prom_goods){  
1522 - let kitem=ladder_prom_goods[ij];  
1523 - if(th.data.ladder_map[ij].is_useorderyh )  
1524 - o_price_no_zh-=kitem.cut_price; 1519 + for (let ij in ladder_prom_goods) {
  1520 + let kitem = ladder_prom_goods[ij];
  1521 + if (th.data.ladder_map[ij].is_useorderyh)
  1522 + o_price_no_zh -= kitem.cut_price;
1525 } 1523 }
1526 } 1524 }
1527 } 1525 }
@@ -1529,30 +1527,37 @@ Page({ @@ -1529,30 +1527,37 @@ Page({
1529 //-- 计算线下取价的功能 -- 1527 //-- 计算线下取价的功能 --
1530 if (cart_item.is_offline == 1) { 1528 if (cart_item.is_offline == 1) {
1531 o_price = o_price - cart_item.offline_price; 1529 o_price = o_price - cart_item.offline_price;
1532 - o_price_no_zh-=c_arr[i].offline_price; 1530 + o_price_no_zh -= c_arr[i].offline_price;
1533 } 1531 }
1534 //判断包邮券的钱,组合购的商品不使用优惠券 1532 //判断包邮券的钱,组合购的商品不使用优惠券
1535 var q_conditin = 0; 1533 var q_conditin = 0;
1536 q_conditin = o_price - quan_price; 1534 q_conditin = o_price - quan_price;
1537 - if(is_has_zh){ 1535 + if (is_has_zh) {
1538 q_conditin = o_price_no_zh - quan_price; 1536 q_conditin = o_price_no_zh - quan_price;
1539 } 1537 }
1540 cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 1538 cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算
1541 //计算物流费用 1539 //计算物流费用
1542 cart_item.shipping_price = 0; 1540 cart_item.shipping_price = 0;
1543 1541
  1542 + th.data.is_no_past = 1; //不包邮标识符
  1543 +
1544 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- 1544 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
1545 - if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) && out_of_weight >= 0) { 1545 + if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) {
1546 //如果有设置不包邮区域的时候 1546 //如果有设置不包邮区域的时候
1547 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { 1547 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
1548 if (th.check_by_area(by_qc.region_list)) { 1548 if (th.check_by_area(by_qc.region_list)) {
1549 freight_free = 0; 1549 freight_free = 0;
  1550 + goods_weight = -1;
  1551 + out_of_weight = 0;
1550 th.data.is_no_by[pickid] = 1; 1552 th.data.is_no_by[pickid] = 1;
1551 } 1553 }
1552 } 1554 }
1553 //如果有设置不包邮区商品 1555 //如果有设置不包邮区商品
1554 if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { 1556 if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) {
1555 freight_free = 0; 1557 freight_free = 0;
  1558 + goods_weight = -1;
  1559 + out_of_weight = 0;
  1560 + th.data.is_no_by[pickid] = 1;
1556 no_ex_good = by_qc.goods_list; 1561 no_ex_good = by_qc.goods_list;
1557 } 1562 }
1558 } 1563 }
@@ -1567,7 +1572,7 @@ Page({ @@ -1567,7 +1572,7 @@ Page({
1567 store_id: os.stoid, 1572 store_id: os.stoid,
1568 isuse: 0, 1573 isuse: 0,
1569 //condition: q_conditin, 1574 //condition: q_conditin,
1570 - condition:cart_item.ckeck_quan_price, 1575 + condition: cart_item.ckeck_quan_price,
1571 user_id: getApp().globalData.user_id, 1576 user_id: getApp().globalData.user_id,
1572 pageSize: 2000 1577 pageSize: 2000
1573 } 1578 }
@@ -1592,7 +1597,7 @@ Page({ @@ -1592,7 +1597,7 @@ Page({
1592 } 1597 }
1593 if (arr) { 1598 if (arr) {
1594 th.data.get_by_quan_list_cart[pickid] = arr; 1599 th.data.get_by_quan_list_cart[pickid] = arr;
1595 - th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); 1600 + th.setData({ get_by_quan_list_cart: th.data.get_by_quan_list_cart });
1596 //if (th.data.is_b_now) { 1601 //if (th.data.is_b_now) {
1597 // th.setData({get_by_quan_list: arr}); 1602 // th.setData({get_by_quan_list: arr});
1598 //} 1603 //}
@@ -1617,7 +1622,7 @@ Page({ @@ -1617,7 +1622,7 @@ Page({
1617 if (ut.isContained(arr, arr2)) { 1622 if (ut.isContained(arr, arr2)) {
1618 getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); 1623 getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th);
1619 th.data.using_quan[pickid] = {}; 1624 th.data.using_quan[pickid] = {};
1620 - th.setData({using_quan: th.data.using_quan}) 1625 + th.setData({ using_quan: th.data.using_quan })
1621 return false; 1626 return false;
1622 } 1627 }
1623 var n_arr = ut.mergeArray(arr, arr2); 1628 var n_arr = ut.mergeArray(arr, arr2);
@@ -1656,7 +1661,7 @@ Page({ @@ -1656,7 +1661,7 @@ Page({
1656 if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); 1661 if (no_ex_good) no_ex_good_arr = no_ex_good.split(',');
1657 1662
1658 //----------------如果是选择了物流--------------------- 1663 //----------------如果是选择了物流---------------------
1659 - if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1 )) { 1664 + if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1)) {
1660 1665
1661 //如果地址不为空 1666 //如果地址不为空
1662 if (th.data.user_addr != null) { 1667 if (th.data.user_addr != null) {
@@ -1665,13 +1670,15 @@ Page({ @@ -1665,13 +1670,15 @@ Page({
1665 //统一运费 1670 //统一运费
1666 o_shipping_price += item[j]['uniform_exp_sum']; 1671 o_shipping_price += item[j]['uniform_exp_sum'];
1667 break; 1672 break;
1668 - // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮  
1669 - // +''  
1670 - // if (goods_weight < 0) goods_weight = 0;  
1671 - // //累积商品重量 每种商品的重量 * 数量  
1672 - // goods_weight += item[j]['weight'] * item[j]['goods_num'];  
1673 - // out_of_weight = (weight_free*1000) - goods_weight;  
1674 - // break; 1673 + case 2:
  1674 + +''
  1675 + if (goods_weight < 0) goods_weight = 0;
  1676 + //累积商品重量 每种商品的重量 * 数量
  1677 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1678 + if (weight_free > 0) {
  1679 + out_of_weight = (weight_free * 1000) - goods_weight;
  1680 + }
  1681 + break;
1675 case 3: 1682 case 3:
1676 if (goods_piece < 0) goods_piece = 0; 1683 if (goods_piece < 0) goods_piece = 0;
1677 //累积商品数量 1684 //累积商品数量
@@ -1679,12 +1686,6 @@ Page({ @@ -1679,12 +1686,6 @@ Page({
1679 break; 1686 break;
1680 } 1687 }
1681 } 1688 }
1682 -  
1683 - }else{  
1684 - if(goods_weight && out_of_weight !==0){  
1685 - goods_weight=-1;  
1686 - out_of_weight=0;  
1687 - }  
1688 } 1689 }
1689 } 1690 }
1690 1691
@@ -1695,8 +1696,8 @@ Page({ @@ -1695,8 +1696,8 @@ Page({
1695 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) 1696 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
1696 code = th.data.wu_arr[cart_item.wind].code; 1697 code = th.data.wu_arr[cart_item.wind].code;
1697 cart_item.shipping_price = 1698 cart_item.shipping_price =
1698 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
1699 - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); 1699 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  1700 + goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs, pickid);
1700 1701
1701 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1702 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
1702 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 1703 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了
@@ -1715,26 +1716,26 @@ Page({ @@ -1715,26 +1716,26 @@ Page({
1715 var order_prom_id = 0; 1716 var order_prom_id = 0;
1716 var o_condition = cart_item.order_amount; 1717 var o_condition = cart_item.order_amount;
1717 //看一下是不是不用组合购的订单优惠的叠加 1718 //看一下是不是不用组合购的订单优惠的叠加
1718 - if(is_has_zh){  
1719 - o_condition=o_price_no_zh-quan_price; 1719 + if (is_has_zh) {
  1720 + o_condition = o_price_no_zh - quan_price;
1720 } 1721 }
1721 1722
1722 //看一下是不是不用组合购的订单优惠的叠加 1723 //看一下是不是不用组合购的订单优惠的叠加
1723 - if(is_has_ladder){  
1724 - o_condition=o_price_no_zh-quan_price; 1724 + if (is_has_ladder) {
  1725 + o_condition = o_price_no_zh - quan_price;
1725 } 1726 }
1726 1727
1727 1728
1728 1729
1729 var order_m = 0; 1730 var order_m = 0;
1730 //---判断是不是有订单优惠--- 1731 //---判断是不是有订单优惠---
1731 - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {  
1732 - data: {store_id: os.stoid, orderAmount: o_condition} 1732 + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
  1733 + data: { store_id: os.stoid, orderAmount: o_condition }
1733 }).then(res => { 1734 }).then(res => {
1734 if (res.data.code == 0) { 1735 if (res.data.code == 0) {
1735 var ord_prom = res.data.data; 1736 var ord_prom = res.data.data;
1736 //么有使用券,或者活动没有限制使用优惠券 1737 //么有使用券,或者活动没有限制使用优惠券
1737 - if(quan_price<=0 || !ord_prom.is_xz_yh) { 1738 + if (quan_price <= 0 || !ord_prom.is_xz_yh) {
1738 order_prom_id = ord_prom['id']; 1739 order_prom_id = ord_prom['id'];
1739 switch (ord_prom['type']) { 1740 switch (ord_prom['type']) {
1740 case 0: 1741 case 0:
@@ -1878,13 +1879,13 @@ Page({ @@ -1878,13 +1879,13 @@ Page({
1878 } 1879 }
1879 } 1880 }
1880 var set_txt = "cartlist[" + iter + "].can_num"; 1881 var set_txt = "cartlist[" + iter + "].can_num";
1881 - th.setData({[set_txt]: num}); 1882 + th.setData({ [set_txt]: num });
1882 } 1883 }
1883 }, 1884 },
1884 1885
1885 1886
1886 //---------计算立即购买---------- 1887 //---------计算立即购买----------
1887 - calculatePrice2 : function () { 1888 + calculatePrice2: function () {
1888 var th = this, good = this.data.bn_goods; 1889 var th = this, good = this.data.bn_goods;
1889 1890
1890 if (!good) return false; 1891 if (!good) return false;
@@ -1910,10 +1911,10 @@ Page({ @@ -1910,10 +1911,10 @@ Page({
1910 1911
1911 allpice = parseFloat(allpice).toFixed(2); 1912 allpice = parseFloat(allpice).toFixed(2);
1912 var txt = "formData.all_price"; 1913 var txt = "formData.all_price";
1913 - th.setData({[txt]: allpice,}); 1914 + th.setData({ [txt]: allpice, });
1914 if (cut_price) { 1915 if (cut_price) {
1915 var c_txt = "formData.cut_price"; 1916 var c_txt = "formData.cut_price";
1916 - th.setData({[c_txt]: cut_price,}); 1917 + th.setData({ [c_txt]: cut_price, });
1917 1918
1918 } 1919 }
1919 1920
@@ -1926,8 +1927,8 @@ Page({ @@ -1926,8 +1927,8 @@ Page({
1926 to.getConfig2(function (ee) { 1927 to.getConfig2(function (ee) {
1927 to.getwuliuprice(async function (rs) { 1928 to.getwuliuprice(async function (rs) {
1928 1929
1929 - var o_shipping_price = 0,goods_weight = -1,goods_piece = -1;  
1930 - var out_of_weight=null; //超出多少重量 1930 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  1931 + var out_of_weight = null; //超出多少重量
1931 var freight_free = ee.freight_free; //全场满多少包邮 1932 var freight_free = ee.freight_free; //全场满多少包邮
1932 var weight_free = ee.weight_free; //多少kg内包邮 1933 var weight_free = ee.weight_free; //多少kg内包邮
1933 var no_ex_id = ee.no_ex_id; 1934 var no_ex_id = ee.no_ex_id;
@@ -1982,7 +1983,7 @@ Page({ @@ -1982,7 +1983,7 @@ Page({
1982 arr.push(item); 1983 arr.push(item);
1983 } 1984 }
1984 if (arr) { 1985 if (arr) {
1985 - th.setData({get_by_quan_list: arr}); 1986 + th.setData({ get_by_quan_list: arr });
1986 } 1987 }
1987 th.data.isget_by_quan[th.data.bn_pick] = 1; 1988 th.data.isget_by_quan[th.data.bn_pick] = 1;
1988 } 1989 }
@@ -1999,7 +2000,9 @@ Page({ @@ -1999,7 +2000,9 @@ Page({
1999 //dw 2000 //dw
2000 //累积商品重量 每种商品的重量 * 数量 2001 //累积商品重量 每种商品的重量 * 数量
2001 goods_weight += good['weight'] * good['buynum']; 2002 goods_weight += good['weight'] * good['buynum'];
2002 - out_of_weight = (weight_free * 1000 ) - goods_weight; 2003 + if (weight_free > 0) {
  2004 + out_of_weight = (weight_free * 1000) - goods_weight;
  2005 + }
2003 break; 2006 break;
2004 case 3: 2007 case 3:
2005 if (goods_piece < 0) goods_piece = 0; 2008 if (goods_piece < 0) goods_piece = 0;
@@ -2021,7 +2024,7 @@ Page({ @@ -2021,7 +2024,7 @@ Page({
2021 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { 2024 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) {
2022 //-----------获取不包邮区域,不包邮商品------- 2025 //-----------获取不包邮区域,不包邮商品-------
2023 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 2026 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
2024 - data: {store_id: os.stoid, id: no_ex_id} 2027 + data: { store_id: os.stoid, id: no_ex_id }
2025 }).then(res => { 2028 }).then(res => {
2026 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 2029 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
2027 no_by_data = res.data.data[0]; 2030 no_by_data = res.data.data[0];
@@ -2029,6 +2032,7 @@ Page({ @@ -2029,6 +2032,7 @@ Page({
2029 if (res.data.data[0].region_list) { 2032 if (res.data.data[0].region_list) {
2030 if (th.check_by_area(res.data.data[0].region_list)) { 2033 if (th.check_by_area(res.data.data[0].region_list)) {
2031 freight_free = 0; 2034 freight_free = 0;
  2035 + out_of_weight = 0;
2032 th.data.is_no_by[th.data.bn_pick] = 1; 2036 th.data.is_no_by[th.data.bn_pick] = 1;
2033 } 2037 }
2034 } 2038 }
@@ -2036,6 +2040,7 @@ Page({ @@ -2036,6 +2040,7 @@ Page({
2036 if (res.data.data[0].goods_list && freight_free) { 2040 if (res.data.data[0].goods_list && freight_free) {
2037 if (th.check_by_goods(res.data.data[0].goods_list)) { 2041 if (th.check_by_goods(res.data.data[0].goods_list)) {
2038 freight_free = 0; 2042 freight_free = 0;
  2043 + out_of_weight = 0;
2039 th.data.is_no_by[th.data.bn_pick] = 1; 2044 th.data.is_no_by[th.data.bn_pick] = 1;
2040 } 2045 }
2041 } 2046 }
@@ -2046,12 +2051,12 @@ Page({ @@ -2046,12 +2051,12 @@ Page({
2046 th.data.is_by[th.data.bn_pick] = 0; 2051 th.data.is_by[th.data.bn_pick] = 0;
2047 //--------------开始计算物流------------------ 2052 //--------------开始计算物流------------------
2048 var shipping_price = 2053 var shipping_price =
2049 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
2050 - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 2054 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  2055 + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs, th.data.bn_pick);
2051 2056
2052 //如果有赠品的时候,也要计算赠品的物流费用 2057 //如果有赠品的时候,也要计算赠品的物流费用
2053 if (th.data.buy_now_gift_goods) { 2058 if (th.data.buy_now_gift_goods) {
2054 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight, 2059 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight,
2055 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 2060 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
2056 } 2061 }
2057 2062
@@ -2061,18 +2066,18 @@ Page({ @@ -2061,18 +2066,18 @@ Page({
2061 2066
2062 shipping_price = parseFloat(shipping_price).toFixed(2); 2067 shipping_price = parseFloat(shipping_price).toFixed(2);
2063 var wl_txt = "formData.shipping_price"; 2068 var wl_txt = "formData.shipping_price";
2064 - th.setData({[wl_txt]: shipping_price,}) 2069 + th.setData({ [wl_txt]: shipping_price, })
2065 2070
2066 } else { 2071 } else {
2067 var wl_txt = "formData.shipping_price"; 2072 var wl_txt = "formData.shipping_price";
2068 - th.setData({[wl_txt]: 0,}) 2073 + th.setData({ [wl_txt]: 0, })
2069 } 2074 }
2070 2075
2071 if (quan_no) { 2076 if (quan_no) {
2072 if (th.data.using_quan[bn_pick].isby == 1) { 2077 if (th.data.using_quan[bn_pick].isby == 1) {
2073 shipping_price = 0; 2078 shipping_price = 0;
2074 var wl_txt = "formData.shipping_price"; 2079 var wl_txt = "formData.shipping_price";
2075 - th.setData({[wl_txt]: 0,}) 2080 + th.setData({ [wl_txt]: 0, })
2076 } 2081 }
2077 } 2082 }
2078 //-----------------支付价,优惠券不减物流----------------- 2083 //-----------------支付价,优惠券不减物流-----------------
@@ -2092,7 +2097,7 @@ Page({ @@ -2092,7 +2097,7 @@ Page({
2092 if (th.data.order_prom[th.data.bn_pick]) { 2097 if (th.data.order_prom[th.data.bn_pick]) {
2093 var ord_prom = th.data.order_prom[th.data.bn_pick]; 2098 var ord_prom = th.data.order_prom[th.data.bn_pick];
2094 //么有使用券,或者活动没有限制使用优惠券 2099 //么有使用券,或者活动没有限制使用优惠券
2095 - if(coupon_price<=0 || !ord_prom.is_xz_yh) { 2100 + if (coupon_price <= 0 || !ord_prom.is_xz_yh) {
2096 order_prom_id = ord_prom['id']; 2101 order_prom_id = ord_prom['id'];
2097 switch (ord_prom['type']) { 2102 switch (ord_prom['type']) {
2098 case 0: 2103 case 0:
@@ -2110,9 +2115,9 @@ Page({ @@ -2110,9 +2115,9 @@ Page({
2110 var order_prom_txt1 = "formData.order_prom_id"; 2115 var order_prom_txt1 = "formData.order_prom_id";
2111 var order_prom_txt2 = "formData.order_prom_amount"; 2116 var order_prom_txt2 = "formData.order_prom_amount";
2112 if (order_prom_id > 0) { 2117 if (order_prom_id > 0) {
2113 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
2114 - }else{  
2115 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 2118 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  2119 + } else {
  2120 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
2116 } 2121 }
2117 2122
2118 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 2123 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -2122,7 +2127,7 @@ Page({ @@ -2122,7 +2127,7 @@ Page({
2122 order_m = order_m.toFixed(2); 2127 order_m = order_m.toFixed(2);
2123 2128
2124 var atxt = "formData.total_amount"; 2129 var atxt = "formData.total_amount";
2125 - th.setData({[atxt]: total_m,}) 2130 + th.setData({ [atxt]: total_m, })
2126 2131
2127 var txt = "formData.user_money"; 2132 var txt = "formData.user_money";
2128 var txt2 = "formData.order_amount"; 2133 var txt2 = "formData.order_amount";
@@ -2132,44 +2137,44 @@ Page({ @@ -2132,44 +2137,44 @@ Page({
2132 if (th.data.bn_use_money == 1) { 2137 if (th.data.bn_use_money == 1) {
2133 if (amoney > order_m) { 2138 if (amoney > order_m) {
2134 order_m = parseFloat(order_m).toFixed(2); 2139 order_m = parseFloat(order_m).toFixed(2);
2135 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 2140 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
2136 } else { 2141 } else {
2137 order_m = parseFloat(order_m) - parseFloat(amoney); 2142 order_m = parseFloat(order_m) - parseFloat(amoney);
2138 order_m = order_m.toFixed(2); 2143 order_m = order_m.toFixed(2);
2139 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2144 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2140 } 2145 }
2141 } else { 2146 } else {
2142 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2147 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2143 } 2148 }
2144 //优惠活动送积分 2149 //优惠活动送积分
2145 if (good.s_intValue) { 2150 if (good.s_intValue) {
2146 txt = "formData.give_integral"; 2151 txt = "formData.give_integral";
2147 - th.setData({[txt]: good.s_intValue}); 2152 + th.setData({ [txt]: good.s_intValue });
2148 } 2153 }
2149 //优惠送券 2154 //优惠送券
2150 if (good.s_coupon_id) { 2155 if (good.s_coupon_id) {
2151 var i_txt = "formData.give_coupon_id"; 2156 var i_txt = "formData.give_coupon_id";
2152 //这个是json格式的 2157 //这个是json格式的
2153 var i_txt1 = "formData.g_coupon_num"; 2158 var i_txt1 = "formData.g_coupon_num";
2154 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 2159 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
2155 ob = JSON.stringify(ob); 2160 ob = JSON.stringify(ob);
2156 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 2161 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
2157 } 2162 }
2158 //优惠礼包 2163 //优惠礼包
2159 if (good.s_libao) { 2164 if (good.s_libao) {
2160 var l_txt = "formData.give_lb_id"; 2165 var l_txt = "formData.give_lb_id";
2161 //这个是json格式的 2166 //这个是json格式的
2162 var l_txt1 = "formData.g_lb_num"; 2167 var l_txt1 = "formData.g_lb_num";
2163 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 2168 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
2164 ob = JSON.stringify(ob); 2169 ob = JSON.stringify(ob);
2165 - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); 2170 + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob });
2166 } 2171 }
2167 }) 2172 })
2168 } else { 2173 } else {
2169 2174
2170 var order_prom_txt1 = "formData.order_prom_id"; 2175 var order_prom_txt1 = "formData.order_prom_id";
2171 var order_prom_txt2 = "formData.order_prom_amount"; 2176 var order_prom_txt2 = "formData.order_prom_amount";
2172 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 2177 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
2173 2178
2174 2179
2175 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 2180 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -2179,7 +2184,7 @@ Page({ @@ -2179,7 +2184,7 @@ Page({
2179 total_m = total_m.toFixed(2); 2184 total_m = total_m.toFixed(2);
2180 order_m = order_m.toFixed(2); 2185 order_m = order_m.toFixed(2);
2181 2186
2182 - th.setData({[atxt]: total_m,}) 2187 + th.setData({ [atxt]: total_m, })
2183 2188
2184 var txt = "formData.user_money"; 2189 var txt = "formData.user_money";
2185 var txt2 = "formData.order_amount"; 2190 var txt2 = "formData.order_amount";
@@ -2189,37 +2194,37 @@ Page({ @@ -2189,37 +2194,37 @@ Page({
2189 if (th.data.bn_use_money == 1) { 2194 if (th.data.bn_use_money == 1) {
2190 if (amoney > order_m) { 2195 if (amoney > order_m) {
2191 order_m = parseFloat(order_m).toFixed(2); 2196 order_m = parseFloat(order_m).toFixed(2);
2192 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 2197 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
2193 } else { 2198 } else {
2194 order_m = parseFloat(order_m) - parseFloat(amoney); 2199 order_m = parseFloat(order_m) - parseFloat(amoney);
2195 order_m = order_m.toFixed(2); 2200 order_m = order_m.toFixed(2);
2196 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2201 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2197 } 2202 }
2198 } else { 2203 } else {
2199 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2204 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2200 } 2205 }
2201 //优惠活动送积分 2206 //优惠活动送积分
2202 if (good.s_intValue) { 2207 if (good.s_intValue) {
2203 txt = "formData.give_integral"; 2208 txt = "formData.give_integral";
2204 - th.setData({[txt]: good.s_intValue}); 2209 + th.setData({ [txt]: good.s_intValue });
2205 } 2210 }
2206 //优惠送券 2211 //优惠送券
2207 if (good.s_coupon_id) { 2212 if (good.s_coupon_id) {
2208 var i_txt = "formData.give_coupon_id"; 2213 var i_txt = "formData.give_coupon_id";
2209 //这个是json格式的 2214 //这个是json格式的
2210 var i_txt1 = "formData.g_coupon_num"; 2215 var i_txt1 = "formData.g_coupon_num";
2211 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 2216 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
2212 ob = JSON.stringify(ob); 2217 ob = JSON.stringify(ob);
2213 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 2218 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
2214 } 2219 }
2215 //优惠礼包 2220 //优惠礼包
2216 if (good.s_libao) { 2221 if (good.s_libao) {
2217 var l_txt = "formData.give_lb_id"; 2222 var l_txt = "formData.give_lb_id";
2218 //这个是json格式的 2223 //这个是json格式的
2219 var l_txt1 = "formData.g_lb_num"; 2224 var l_txt1 = "formData.g_lb_num";
2220 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 2225 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
2221 ob = JSON.stringify(ob); 2226 ob = JSON.stringify(ob);
2222 - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); 2227 + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob });
2223 } 2228 }
2224 } 2229 }
2225 2230
@@ -2229,17 +2234,17 @@ Page({ @@ -2229,17 +2234,17 @@ Page({
2229 }); 2234 });
2230 }, 2235 },
2231 2236
2232 - requestSubscribe(){  
2233 - const th=this; 2237 + requestSubscribe() {
  2238 + const th = this;
2234 const template_id = this.data.template_id; 2239 const template_id = this.data.template_id;
2235 wx.getSetting({ 2240 wx.getSetting({
2236 - withSubscriptions:true,  
2237 - success(res){  
2238 - let itemSettings=res.subscriptionsSetting.itemSettings;  
2239 - if(itemSettings && itemSettings[template_id]=="accept"){ 2241 + withSubscriptions: true,
  2242 + success(res) {
  2243 + let itemSettings = res.subscriptionsSetting.itemSettings;
  2244 + if (itemSettings && itemSettings[template_id] == "accept") {
2240 th.submit_func(); 2245 th.submit_func();
2241 - }else{  
2242 - th.sendsm(function(){ 2246 + } else {
  2247 + th.sendsm(function () {
2243 th.submit_func(); 2248 th.submit_func();
2244 }) 2249 })
2245 } 2250 }
@@ -2248,11 +2253,12 @@ Page({ @@ -2248,11 +2253,12 @@ Page({
2248 }, 2253 },
2249 2254
2250 //--------------------提交订单----------------------- 2255 //--------------------提交订单-----------------------
2251 - async submit_func(){ 2256 + async submit_func() {
2252 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 2257 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
2253 this.data.is_summit_ing = 1; 2258 this.data.is_summit_ing = 1;
2254 var th = this, pdata = new Array(); 2259 var th = this, pdata = new Array();
2255 var ff = true; 2260 var ff = true;
  2261 +
2256 //------------立即购买------------- 2262 //------------立即购买-------------
2257 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { 2263 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
2258 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { 2264 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
@@ -2263,7 +2269,6 @@ Page({ @@ -2263,7 +2269,6 @@ Page({
2263 if (!ff) return false; 2269 if (!ff) return false;
2264 var addr = th.data.user_addr; 2270 var addr = th.data.user_addr;
2265 if (th.data.bn_exp_type == 1) addr = null; 2271 if (th.data.bn_exp_type == 1) addr = null;
2266 -  
2267 if (th.data.bn_exp_type == 0) 2272 if (th.data.bn_exp_type == 0)
2268 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { 2273 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
2269 getApp().my_warnning("读取物流失败", 0, th); 2274 getApp().my_warnning("读取物流失败", 0, th);
@@ -2291,7 +2296,7 @@ Page({ @@ -2291,7 +2296,7 @@ Page({
2291 'user_money': th.data.formData.user_money, //使用余额 2296 'user_money': th.data.formData.user_money, //使用余额
2292 'total_amount': th.data.formData.total_amount, //订单总价 2297 'total_amount': th.data.formData.total_amount, //订单总价
2293 'order_amount': th.data.formData.order_amount, //应付 2298 'order_amount': th.data.formData.order_amount, //应付
2294 - 'user_note': th.data.user_note['0']?th.data.user_note['0']:0, //用户备注 2299 + 'user_note': th.data.user_note['0'] ? th.data.user_note['0'] : 0, //用户备注
2295 'store_id': oo.stoid, //商家 2300 'store_id': oo.stoid, //商家
2296 'pickup_id': th.data.bn_pick, //门店 2301 'pickup_id': th.data.bn_pick, //门店
2297 'exp_type': th.data.bn_exp_type, //配送方式 2302 'exp_type': th.data.bn_exp_type, //配送方式
@@ -2317,7 +2322,7 @@ Page({ @@ -2317,7 +2322,7 @@ Page({
2317 } 2322 }
2318 2323
2319 //--判断优惠活动的提交-- 2324 //--判断优惠活动的提交--
2320 - if (th.data.formData.cut_price > 0 ) { 2325 + if (th.data.formData.cut_price > 0) {
2321 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); 2326 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2);
2322 var ob = [{ 2327 var ob = [{
2323 "prom_id": th.data.bn_goods.prom_id, 2328 "prom_id": th.data.bn_goods.prom_id,
@@ -2380,7 +2385,7 @@ Page({ @@ -2380,7 +2385,7 @@ Page({
2380 goods.guide_id = gg.guide_id; 2385 goods.guide_id = gg.guide_id;
2381 goods.guide_type = gg.guide_type; 2386 goods.guide_type = gg.guide_type;
2382 //调用接口判断是不是会员 2387 //调用接口判断是不是会员
2383 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 2388 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
2384 if (res.data.code == 0) { 2389 if (res.data.code == 0) {
2385 goods.guide_name = res.data.data.salesman; 2390 goods.guide_name = res.data.data.salesman;
2386 goods.guide_sn = res.data.data.salesman_no; 2391 goods.guide_sn = res.data.data.salesman_no;
@@ -2432,7 +2437,7 @@ Page({ @@ -2432,7 +2437,7 @@ Page({
2432 } 2437 }
2433 2438
2434 var pt_res = null; 2439 var pt_res = null;
2435 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 2440 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
2436 is_json: 1, 2441 is_json: 1,
2437 data: pt_data 2442 data: pt_data
2438 }).then(res => { 2443 }).then(res => {
@@ -2481,8 +2486,8 @@ Page({ @@ -2481,8 +2486,8 @@ Page({
2481 //调用接口判断是不是会员 2486 //调用接口判断是不是会员
2482 await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 2487 await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
2483 if (res.data.code == 0) { 2488 if (res.data.code == 0) {
2484 - g_goods.guide_name = res.data.salesman;  
2485 - g_goods.guide_sn = res.data.salesman_no; 2489 + g_goods.guide_name = res.data.data.salesman;
  2490 + g_goods.guide_sn = res.data.data.salesman_no;
2486 } 2491 }
2487 }) 2492 })
2488 } 2493 }
@@ -2490,6 +2495,7 @@ Page({ @@ -2490,6 +2495,7 @@ Page({
2490 } 2495 }
2491 pdata.push(item); 2496 pdata.push(item);
2492 } else { 2497 } else {
  2498 +
2493 //---------购物车的结算--------- 2499 //---------购物车的结算---------
2494 if (th.data.is_all_zt == 0 && th.data.user_addr == null) { 2500 if (th.data.is_all_zt == 0 && th.data.user_addr == null) {
2495 th.data.is_summit_ing = 0; 2501 th.data.is_summit_ing = 0;
@@ -2499,6 +2505,7 @@ Page({ @@ -2499,6 +2505,7 @@ Page({
2499 if (!ff) return false; 2505 if (!ff) return false;
2500 2506
2501 var addr = th.data.user_addr; 2507 var addr = th.data.user_addr;
  2508 + // 自提,地址数据清空 exp_type设置为1
2502 if (th.data.is_all_zt == 1) addr = null; 2509 if (th.data.is_all_zt == 1) addr = null;
2503 var val_arr = th.data.user_note; 2510 var val_arr = th.data.user_note;
2504 2511
@@ -2509,8 +2516,8 @@ Page({ @@ -2509,8 +2516,8 @@ Page({
2509 return false; 2516 return false;
2510 } 2517 }
2511 2518
2512 - var order_prom_list_cart = th.data.order_prom_list_cart;  
2513 - 2519 + var order_prom_list_cart = th.data.order_prom_list_cart;;
  2520 + console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart)
2514 //--组装推送数据-- 2521 //--组装推送数据--
2515 for (var i = 0; i < order_prom_list_cart.length; i++) { 2522 for (var i = 0; i < order_prom_list_cart.length; i++) {
2516 var t_item = order_prom_list_cart[i]; 2523 var t_item = order_prom_list_cart[i];
@@ -2562,23 +2569,23 @@ Page({ @@ -2562,23 +2569,23 @@ Page({
2562 order_prom_list.order_prom_amount = t_item.order_prom_amount; 2569 order_prom_list.order_prom_amount = t_item.order_prom_amount;
2563 } 2570 }
2564 2571
2565 - order_prom_list.discount_amount =0; 2572 + order_prom_list.discount_amount = 0;
2566 //--判断优惠活动的提交-- 2573 //--判断优惠活动的提交--
2567 if (t_item.cut_price > 0) { 2574 if (t_item.cut_price > 0) {
2568 order_prom_list.discount_amount += t_item.cut_price; 2575 order_prom_list.discount_amount += t_item.cut_price;
2569 } 2576 }
2570 //--判断组合优惠活动的提交-- 2577 //--判断组合优惠活动的提交--
2571 - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { 2578 + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) {
2572 order_prom_list.discount_amount += t_item.zh_cut_price; 2579 order_prom_list.discount_amount += t_item.zh_cut_price;
2573 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); 2580 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json);
2574 } 2581 }
2575 2582
2576 //--判断阶梯优惠活动的提交-- 2583 //--判断阶梯优惠活动的提交--
2577 - if (t_item.ladder_cut_price > 0 || t_item.ladder_cut_price<0) { 2584 + if (t_item.ladder_cut_price > 0 || t_item.ladder_cut_price < 0) {
2578 order_prom_list.discount_amount += t_item.ladder_cut_price; 2585 order_prom_list.discount_amount += t_item.ladder_cut_price;
2579 } 2586 }
2580 2587
2581 - if(t_item.prom_pt_json){ 2588 + if (t_item.prom_pt_json) {
2582 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); 2589 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json);
2583 } 2590 }
2584 2591
@@ -2593,11 +2600,11 @@ Page({ @@ -2593,11 +2600,11 @@ Page({
2593 order_prom_list.give_lb_id = t_item.s_libao; 2600 order_prom_list.give_lb_id = t_item.s_libao;
2594 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); 2601 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num);
2595 } 2602 }
2596 - if (Object.keys(order_prom_list).length > 0){  
2597 - if(order_prom_list.discount_amount)  
2598 - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);  
2599 - if(order_prom_list.order_prom_amount)  
2600 - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); 2603 + if (Object.keys(order_prom_list).length > 0) {
  2604 + if (order_prom_list.discount_amount)
  2605 + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
  2606 + if (order_prom_list.order_prom_amount)
  2607 + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2);
2601 item.order_prom_list = order_prom_list; 2608 item.order_prom_list = order_prom_list;
2602 } 2609 }
2603 2610
@@ -2619,18 +2626,18 @@ Page({ @@ -2619,18 +2626,18 @@ Page({
2619 //房间号的ids 2626 //房间号的ids
2620 var room_ids = ""; 2627 var room_ids = "";
2621 2628
2622 - //-- 把券的钱,写入从表 ---  
2623 - if (t_item.quan_youhui_list && t_item.coupon_price) { 2629 + //-- 把券的钱,写入从表 ---
  2630 + if (t_item.quan_youhui_list && t_item.coupon_price) {
2624 for (var kk in t_item.quan_youhui_list) { 2631 for (var kk in t_item.quan_youhui_list) {
2625 var you_item = t_item.quan_youhui_list[kk]; 2632 var you_item = t_item.quan_youhui_list[kk];
2626 //-- 对券的价格进行平摊 -- 2633 //-- 对券的价格进行平摊 --
2627 - await th.split_set_goods_quanprice(you_item,t_item); 2634 + await th.split_set_goods_quanprice(you_item, t_item);
2628 } 2635 }
2629 } 2636 }
2630 //-------------让商品添加到商品列表-------------------- 2637 //-------------让商品添加到商品列表--------------------
2631 for (var k = 0; k < t_item.goods.length; k++) { 2638 for (var k = 0; k < t_item.goods.length; k++) {
2632 var g_item = t_item.goods[k]; 2639 var g_item = t_item.goods[k];
2633 - if(g_item.goods_num<=0) continue; 2640 + if (g_item.goods_num <= 0) continue;
2634 var goods = { 2641 var goods = {
2635 'goods_id': g_item.goods_id, 2642 'goods_id': g_item.goods_id,
2636 'goods_name': g_item.goods_name, 2643 'goods_name': g_item.goods_name,
@@ -2643,20 +2650,20 @@ Page({ @@ -2643,20 +2650,20 @@ Page({
2643 }; 2650 };
2644 2651
2645 //-- 线下取价也要写入,组合购的商品不能去线下价格 -- 2652 //-- 线下取价也要写入,组合购的商品不能去线下价格 --
2646 - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { 2653 + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
2647 goods.goods_price = g_item.offline_price; 2654 goods.goods_price = g_item.offline_price;
2648 goods.member_goods_price = g_item.offline_price; 2655 goods.member_goods_price = g_item.offline_price;
2649 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); 2656 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
2650 goods.pricing_type = g_item.pricing_type; 2657 goods.pricing_type = g_item.pricing_type;
2651 } 2658 }
2652 - if(g_item.quan_num){  
2653 - goods.quan_num=g_item.quan_num;  
2654 - goods.quan_no=g_item.quan_no; 2659 + if (g_item.quan_num) {
  2660 + goods.quan_num = g_item.quan_num;
  2661 + goods.quan_no = g_item.quan_no;
2655 } 2662 }
2656 //--判断活动的类型-- 2663 //--判断活动的类型--
2657 switch (g_item.prom_type) { 2664 switch (g_item.prom_type) {
2658 case 1: 2665 case 1:
2659 - case 2: 2666 + case 2:
2660 case 10: 2667 case 10:
2661 goods.prom_type = g_item.prom_type; 2668 goods.prom_type = g_item.prom_type;
2662 goods.prom_id = g_item.prom_id; 2669 goods.prom_id = g_item.prom_id;
@@ -2699,7 +2706,7 @@ Page({ @@ -2699,7 +2706,7 @@ Page({
2699 } 2706 }
2700 2707
2701 //把优惠的平摊结果写进去 2708 //把优惠的平摊结果写进去
2702 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { 2709 + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
2703 if (g_item.account >= 0) goods.account = g_item.account; 2710 if (g_item.account >= 0) goods.account = g_item.account;
2704 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; 2711 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
2705 item.is_discount_amount = 1; 2712 item.is_discount_amount = 1;
@@ -2710,7 +2717,7 @@ Page({ @@ -2710,7 +2717,7 @@ Page({
2710 goods.guide_id = g_item.guide_id; 2717 goods.guide_id = g_item.guide_id;
2711 goods.guide_type = g_item.guide_type; 2718 goods.guide_type = g_item.guide_type;
2712 //调用接口判断是不是会员 2719 //调用接口判断是不是会员
2713 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { 2720 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
2714 if (res.data.code == 0) { 2721 if (res.data.code == 0) {
2715 goods.guide_name = res.data.data.salesman; 2722 goods.guide_name = res.data.data.salesman;
2716 goods.guide_sn = res.data.data.salesman_no; 2723 goods.guide_sn = res.data.data.salesman_no;
@@ -2724,8 +2731,8 @@ Page({ @@ -2724,8 +2731,8 @@ Page({
2724 } 2731 }
2725 2732
2726 //如果有阶梯促销 2733 //如果有阶梯促销
2727 - if(g_item.ladder_list_id){  
2728 - goods.ladder_list_id=g_item.ladder_list_id; 2734 + if (g_item.ladder_list_id) {
  2735 + goods.ladder_list_id = g_item.ladder_list_id;
2729 } 2736 }
2730 2737
2731 item.order_goods.push(goods); 2738 item.order_goods.push(goods);
@@ -2742,7 +2749,7 @@ Page({ @@ -2742,7 +2749,7 @@ Page({
2742 if (pdata.length == 0) return; 2749 if (pdata.length == 0) return;
2743 var str = JSON.stringify(pdata); 2750 var str = JSON.stringify(pdata);
2744 2751
2745 - wx.showLoading({title: "加载中"}); 2752 + wx.showLoading({ title: "加载中" });
2746 wx.request({ 2753 wx.request({
2747 url: oo.url + '/api/weshop/order/createWxdOrder', 2754 url: oo.url + '/api/weshop/order/createWxdOrder',
2748 data: str, 2755 data: str,
@@ -2771,7 +2778,7 @@ Page({ @@ -2771,7 +2778,7 @@ Page({
2771 }) 2778 })
2772 //要进行判断,如果是用微信支付,就要跳转到支付界面 2779 //要进行判断,如果是用微信支付,就要跳转到支付界面
2773 if (order_amount > 0) { 2780 if (order_amount > 0) {
2774 - th.setData({isclose: 0}); 2781 + th.setData({ isclose: 0 });
2775 //void e.jumpToCart4({ 2782 //void e.jumpToCart4({
2776 // order_sn: data.data, 2783 // order_sn: data.data,
2777 //}, 1); 2784 //}, 1);
@@ -2786,12 +2793,12 @@ Page({ @@ -2786,12 +2793,12 @@ Page({
2786 }, function () { 2793 }, function () {
2787 //支付失败 2794 //支付失败
2788 setTimeout(function () { 2795 setTimeout(function () {
2789 - var cps=getCurrentPages();  
2790 - if(cps.length>1){  
2791 - wx.navigateBack({delta: 1})  
2792 - }else{  
2793 - getApp().goto("/pages/index/index/index");  
2794 - } 2796 + var cps = getCurrentPages();
  2797 + if (cps.length > 1) {
  2798 + wx.navigateBack({ delta: 1 })
  2799 + } else {
  2800 + getApp().goto("/pages/index/index/index");
  2801 + }
2795 2802
2796 }, 1000) 2803 }, 1000)
2797 }, oo.stoid); 2804 }, oo.stoid);
@@ -2809,7 +2816,7 @@ Page({ @@ -2809,7 +2816,7 @@ Page({
2809 if (t.data.code == 0) { 2816 if (t.data.code == 0) {
2810 //app.my_warnning("支付成功",1,th); 2817 //app.my_warnning("支付成功",1,th);
2811 //setTimeout(function () { 2818 //setTimeout(function () {
2812 - th.setData({isclose: 0}); 2819 + th.setData({ isclose: 0 });
2813 wx.redirectTo({ 2820 wx.redirectTo({
2814 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, 2821 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
2815 }) 2822 })
@@ -2834,7 +2841,7 @@ Page({ @@ -2834,7 +2841,7 @@ Page({
2834 cancelText: '取消', 2841 cancelText: '取消',
2835 confirmText: '确定', 2842 confirmText: '确定',
2836 showCancel: true, 2843 showCancel: true,
2837 - success(res){ 2844 + success(res) {
2838 if (res.cancel) { 2845 if (res.cancel) {
2839 return; 2846 return;
2840 } else if (res.confirm) { 2847 } else if (res.confirm) {
@@ -2868,11 +2875,11 @@ Page({ @@ -2868,11 +2875,11 @@ Page({
2868 2875
2869 }, 2876 },
2870 //---确认线下门店的数量足不足--- 2877 //---确认线下门店的数量足不足---
2871 - async check_store_num(goods_id, pick, goods_num, func){ 2878 + async check_store_num(goods_id, pick, goods_num, func) {
2872 var lock = 0, pick_no, plist, erpwareid; 2879 var lock = 0, pick_no, plist, erpwareid;
2873 //先读取门店的lock 2880 //先读取门店的lock
2874 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2881 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
2875 - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} 2882 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
2876 }).then(res => { 2883 }).then(res => {
2877 if (res.data.code == 0 && res.data.data.total > 0) { 2884 if (res.data.code == 0 && res.data.data.total > 0) {
2878 for (var i in res.data.data.pageData) 2885 for (var i in res.data.data.pageData)
@@ -2881,7 +2888,7 @@ Page({ @@ -2881,7 +2888,7 @@ Page({
2881 }) 2888 })
2882 //先获取门店的编号 2889 //先获取门店的编号
2883 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { 2890 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
2884 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 2891 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
2885 }).then(res => { 2892 }).then(res => {
2886 if (res.data.code == 0) { 2893 if (res.data.code == 0) {
2887 pick_no = res.data.data.pickup_no; 2894 pick_no = res.data.data.pickup_no;
@@ -2889,7 +2896,7 @@ Page({ @@ -2889,7 +2896,7 @@ Page({
2889 }) 2896 })
2890 //先获取商品的线下库存 2897 //先获取商品的线下库存
2891 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { 2898 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
2892 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 2899 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
2893 }).then(res => { 2900 }).then(res => {
2894 if (res.data.code == 0) { 2901 if (res.data.code == 0) {
2895 erpwareid = res.data.data.erpwareid; 2902 erpwareid = res.data.data.erpwareid;
@@ -2897,7 +2904,7 @@ Page({ @@ -2897,7 +2904,7 @@ Page({
2897 }) 2904 })
2898 //读取线下的门店库存 2905 //读取线下的门店库存
2899 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 2906 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
2900 - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} 2907 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }
2901 }).then(res => { 2908 }).then(res => {
2902 if (res.data.code == 0) { 2909 if (res.data.code == 0) {
2903 plist = res.data.data.pageData[0]; 2910 plist = res.data.data.pageData[0];
@@ -2939,11 +2946,11 @@ Page({ @@ -2939,11 +2946,11 @@ Page({
2939 wl_txt = t.currentTarget.dataset.wl_txt, 2946 wl_txt = t.currentTarget.dataset.wl_txt,
2940 ont = t.currentTarget.dataset.ont; 2947 ont = t.currentTarget.dataset.ont;
2941 2948
2942 - th.setData({[txt]: ty}); 2949 + th.setData({ [txt]: ty });
2943 var iszt = 1; 2950 var iszt = 1;
2944 2951
2945 if (ty == 0) { 2952 if (ty == 0) {
2946 - th.setData({is_all_zt: 0}); 2953 + th.setData({ is_all_zt: 0 });
2947 } else { 2954 } else {
2948 for (var i = 0; i < th.data.cartlist.length; i++) { 2955 for (var i = 0; i < th.data.cartlist.length; i++) {
2949 var item = th.data.cartlist[i]; 2956 var item = th.data.cartlist[i];
@@ -2953,7 +2960,7 @@ Page({ @@ -2953,7 +2960,7 @@ Page({
2953 } 2960 }
2954 } 2961 }
2955 2962
2956 - th.setData({is_all_zt: iszt}); 2963 + th.setData({ is_all_zt: iszt });
2957 2964
2958 var ind = t.currentTarget.dataset.ind; 2965 var ind = t.currentTarget.dataset.ind;
2959 var c_item = th.data.cartlist[ind]; 2966 var c_item = th.data.cartlist[ind];
@@ -2961,7 +2968,7 @@ Page({ @@ -2961,7 +2968,7 @@ Page({
2961 2968
2962 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { 2969 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) {
2963 th.data.using_quan[pickid] = {}; 2970 th.data.using_quan[pickid] = {};
2964 - th.setData({using_quan: th.data.using_quan}); 2971 + th.setData({ using_quan: th.data.using_quan });
2965 } 2972 }
2966 2973
2967 2974
@@ -2973,7 +2980,7 @@ Page({ @@ -2973,7 +2980,7 @@ Page({
2973 for (var i = 0; i < wu_arr.length; i++) { 2980 for (var i = 0; i < wu_arr.length; i++) {
2974 if (wu_arr[i].shipping_code == def_exp_code) { 2981 if (wu_arr[i].shipping_code == def_exp_code) {
2975 var set_txt = "cartlist" 2982 var set_txt = "cartlist"
2976 - th.setData({wl_txt: i}); 2983 + th.setData({ wl_txt: i });
2977 } 2984 }
2978 } 2985 }
2979 } 2986 }
@@ -2986,9 +2993,9 @@ Page({ @@ -2986,9 +2993,9 @@ Page({
2986 setexptype: function (t) { 2993 setexptype: function (t) {
2987 var th = this; 2994 var th = this;
2988 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 2995 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
2989 - th.setData({bn_exp_type: ty}); 2996 + th.setData({ bn_exp_type: ty });
2990 if (ty == 0) { 2997 if (ty == 0) {
2991 - th.setData({is_all_zt: 0}); 2998 + th.setData({ is_all_zt: 0 });
2992 } 2999 }
2993 3000
2994 //当物流为空的时候。 3001 //当物流为空的时候。
@@ -3001,7 +3008,7 @@ Page({ @@ -3001,7 +3008,7 @@ Page({
3001 if (ty == 1) { 3008 if (ty == 1) {
3002 th.data.isget_by_quan = {}; 3009 th.data.isget_by_quan = {};
3003 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { 3010 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
3004 - th.setData({using_quan: {}}); 3011 + th.setData({ using_quan: {} });
3005 } 3012 }
3006 } 3013 }
3007 3014
@@ -3011,7 +3018,7 @@ Page({ @@ -3011,7 +3018,7 @@ Page({
3011 if (wu_arr != null && wu_arr != "") { 3018 if (wu_arr != null && wu_arr != "") {
3012 for (var i = 0; i < wu_arr.length; i++) { 3019 for (var i = 0; i < wu_arr.length; i++) {
3013 if (wu_arr[i].shipping_code == def_exp_code) { 3020 if (wu_arr[i].shipping_code == def_exp_code) {
3014 - th.setData({index: i}); 3021 + th.setData({ index: i });
3015 } 3022 }
3016 } 3023 }
3017 } 3024 }
@@ -3023,21 +3030,21 @@ Page({ @@ -3023,21 +3030,21 @@ Page({
3023 //--------立即购买时,使用余额-------- 3030 //--------立即购买时,使用余额--------
3024 set_bn_useyuer: function () { 3031 set_bn_useyuer: function () {
3025 var th = this; 3032 var th = this;
3026 - th.setData({bn_use_money: !th.data.bn_use_money}); 3033 + th.setData({ bn_use_money: !th.data.bn_use_money });
3027 th.calculatePrice2(); 3034 th.calculatePrice2();
3028 }, 3035 },
3029 set_js_useyuer: function () { 3036 set_js_useyuer: function () {
3030 var th = this; 3037 var th = this;
3031 - th.setData({js_use_money: !th.data.js_use_money}); 3038 + th.setData({ js_use_money: !th.data.js_use_money });
3032 th.calculatePrice(); 3039 th.calculatePrice();
3033 }, 3040 },
3034 //-------------------计算物流--------------- 3041 //-------------------计算物流---------------
3035 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,  
3036 - goods_piece, user_addr, freight_free, o_price, rs) { 3042 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  3043 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
3037 var price = 0, th = this; 3044 var price = 0, th = this;
3038 price += parseFloat(o_shipping_price); 3045 price += parseFloat(o_shipping_price);
3039 //如果是包邮 3046 //如果是包邮
3040 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { 3047 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
3041 return 0; 3048 return 0;
3042 } 3049 }
3043 if (user_addr == null) { 3050 if (user_addr == null) {
@@ -3055,7 +3062,7 @@ Page({ @@ -3055,7 +3062,7 @@ Page({
3055 item = item.config; 3062 item = item.config;
3056 if (item == null) return o_shipping_price; 3063 if (item == null) return o_shipping_price;
3057 //------按重量---------- 3064 //------按重量----------
3058 - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { 3065 + if (goods_weight >= 0 && item['money']) {
3059 fw_price = parseFloat(item['money']); 3066 fw_price = parseFloat(item['money']);
3060 if (goods_weight > item['first_weight']) { 3067 if (goods_weight > item['first_weight']) {
3061 var fw = goods_weight - item['first_weight']; 3068 var fw = goods_weight - item['first_weight'];
@@ -3064,11 +3071,9 @@ Page({ @@ -3064,11 +3071,9 @@ Page({
3064 } 3071 }
3065 } 3072 }
3066 //------超出重量---------- 3073 //------超出重量----------
3067 - if(out_of_weight < 0){ 3074 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
3068 fw_price = parseFloat(item['money']); 3075 fw_price = parseFloat(item['money']);
3069 var out_of_weight = Math.abs(out_of_weight); 3076 var out_of_weight = Math.abs(out_of_weight);
3070 - // var n = Math.ceil(out_of_weight / item['second_weight'])  
3071 - // fw_price = fw_price + n * parseFloat(item['add_money']);  
3072 if (out_of_weight > item['first_weight']) { 3077 if (out_of_weight > item['first_weight']) {
3073 var fw = out_of_weight - item['first_weight']; 3078 var fw = out_of_weight - item['first_weight'];
3074 var n = Math.ceil(fw / item['second_weight']) 3079 var n = Math.ceil(fw / item['second_weight'])
@@ -3112,13 +3117,13 @@ Page({ @@ -3112,13 +3117,13 @@ Page({
3112 //----------立即购买,选择物流------------- 3117 //----------立即购买,选择物流-------------
3113 bindPickerChange: function (e) { 3118 bindPickerChange: function (e) {
3114 var ind = e.detail.value 3119 var ind = e.detail.value
3115 - this.setData({index: ind}); 3120 + this.setData({ index: ind });
3116 this.calculatePrice2(); 3121 this.calculatePrice2();
3117 }, 3122 },
3118 //----------购物车结算,选择物流------------- 3123 //----------购物车结算,选择物流-------------
3119 bindPickerChange_w: function (e) { 3124 bindPickerChange_w: function (e) {
3120 var ind = e.detail.value, txt = e.currentTarget.dataset.txt; 3125 var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
3121 - this.setData({[txt]: ind}); 3126 + this.setData({ [txt]: ind });
3122 this.calculatePrice(); 3127 this.calculatePrice();
3123 }, 3128 },
3124 3129
@@ -3132,7 +3137,7 @@ Page({ @@ -3132,7 +3137,7 @@ Page({
3132 3137
3133 3138
3134 if (bn == 1) { 3139 if (bn == 1) {
3135 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 3140 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
3136 } else { 3141 } else {
3137 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 3142 //---多单打开券的时候,就要判断券在其他门店是否有使用---
3138 var quanlist = th.data.cartlist[cindx].quan_list; 3143 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -3158,9 +3163,9 @@ Page({ @@ -3158,9 +3163,9 @@ Page({
3158 else 3163 else
3159 get_by_quan_list_cart[i].show_red = 0; 3164 get_by_quan_list_cart[i].show_red = 0;
3160 } 3165 }
3161 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 3166 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
3162 } else { 3167 } else {
3163 - th.setData({by_quan_list_cart: null}); 3168 + th.setData({ by_quan_list_cart: null });
3164 } 3169 }
3165 3170
3166 console.log("2222222券的列表", quanlist); 3171 console.log("2222222券的列表", quanlist);
@@ -3176,7 +3181,7 @@ Page({ @@ -3176,7 +3181,7 @@ Page({
3176 }, 3181 },
3177 close_coupon: function (e) { 3182 close_coupon: function (e) {
3178 var th = this; 3183 var th = this;
3179 - th.setData({open_quan: 0, disabled: 0}); 3184 + th.setData({ open_quan: 0, disabled: 0 });
3180 }, 3185 },
3181 3186
3182 //---判断券时候在已经选择的列表中--- 3187 //---判断券时候在已经选择的列表中---
@@ -3247,14 +3252,14 @@ Page({ @@ -3247,14 +3252,14 @@ Page({
3247 for (var i in quanlist) { 3252 for (var i in quanlist) {
3248 quanlist[i].show_red = 0; 3253 quanlist[i].show_red = 0;
3249 } 3254 }
3250 - this.setData({selected_quan_list: quanlist}); 3255 + this.setData({ selected_quan_list: quanlist });
3251 var by_quanlist = this.data.get_by_quan_list; 3256 var by_quanlist = this.data.get_by_quan_list;
3252 if (by_quanlist) { 3257 if (by_quanlist) {
3253 //---所有的券的显示红色选择都清理一遍--- 3258 //---所有的券的显示红色选择都清理一遍---
3254 for (var inb in by_quanlist) { 3259 for (var inb in by_quanlist) {
3255 by_quanlist[inb].show_red = 0; 3260 by_quanlist[inb].show_red = 0;
3256 } 3261 }
3257 - this.setData({get_by_quan_list: by_quanlist}); 3262 + this.setData({ get_by_quan_list: by_quanlist });
3258 } 3263 }
3259 3264
3260 var by_cart_list = this.data.by_quan_list_cart; 3265 var by_cart_list = this.data.by_quan_list_cart;
@@ -3263,7 +3268,7 @@ Page({ @@ -3263,7 +3268,7 @@ Page({
3263 for (var inc in by_cart_list) { 3268 for (var inc in by_cart_list) {
3264 by_cart_list[inc].show_red = 0; 3269 by_cart_list[inc].show_red = 0;
3265 } 3270 }
3266 - this.setData({by_quan_list_cart: by_cart_list}); 3271 + this.setData({ by_quan_list_cart: by_cart_list });
3267 } 3272 }
3268 3273
3269 var using_quan = this.data.using_quan; 3274 var using_quan = this.data.using_quan;
@@ -3275,9 +3280,9 @@ Page({ @@ -3275,9 +3280,9 @@ Page({
3275 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 3280 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
3276 } 3281 }
3277 else { 3282 else {
3278 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 3283 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
3279 } 3284 }
3280 - this.setData({using_quan: using_quan, is_coupon: th.is_coupon}); 3285 + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon });
3281 return; 3286 return;
3282 } 3287 }
3283 3288
@@ -3294,9 +3299,9 @@ Page({ @@ -3294,9 +3299,9 @@ Page({
3294 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 3299 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
3295 } 3300 }
3296 else { 3301 else {
3297 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 3302 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
3298 } 3303 }
3299 - this.setData({using_quan: using_quan}); 3304 + this.setData({ using_quan: using_quan });
3300 3305
3301 }, 3306 },
3302 3307
@@ -3311,7 +3316,7 @@ Page({ @@ -3311,7 +3316,7 @@ Page({
3311 for (var ind in by_quanlist) { 3316 for (var ind in by_quanlist) {
3312 by_quanlist[ind].show_red = 0; 3317 by_quanlist[ind].show_red = 0;
3313 } 3318 }
3314 - this.setData({get_by_quan_list: by_quanlist}); 3319 + this.setData({ get_by_quan_list: by_quanlist });
3315 } 3320 }
3316 3321
3317 //--购物车过来的包邮券-- 3322 //--购物车过来的包邮券--
@@ -3321,7 +3326,7 @@ Page({ @@ -3321,7 +3326,7 @@ Page({
3321 for (var ind in by_cart_list) { 3326 for (var ind in by_cart_list) {
3322 by_cart_list[ind].show_red = 0; 3327 by_cart_list[ind].show_red = 0;
3323 } 3328 }
3324 - this.setData({by_quan_list_cart: by_cart_list}); 3329 + this.setData({ by_quan_list_cart: by_cart_list });
3325 } 3330 }
3326 //普通券 3331 //普通券
3327 var quanlist = this.data.selected_quan_list; 3332 var quanlist = this.data.selected_quan_list;
@@ -3330,7 +3335,7 @@ Page({ @@ -3330,7 +3335,7 @@ Page({
3330 for (var ind in quanlist) { 3335 for (var ind in quanlist) {
3331 quanlist[ind].show_red = 0; 3336 quanlist[ind].show_red = 0;
3332 } 3337 }
3333 - this.setData({selected_quan_list: quanlist}); 3338 + this.setData({ selected_quan_list: quanlist });
3334 } 3339 }
3335 3340
3336 var th = this; 3341 var th = this;
@@ -3341,9 +3346,9 @@ Page({ @@ -3341,9 +3346,9 @@ Page({
3341 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 3346 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
3342 } 3347 }
3343 else { 3348 else {
3344 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 3349 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
3345 } 3350 }
3346 - this.setData({using_quan: using_quan, is_coupon: th.is_coupon}); 3351 + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon });
3347 return; 3352 return;
3348 } 3353 }
3349 3354
@@ -3372,9 +3377,9 @@ Page({ @@ -3372,9 +3377,9 @@ Page({
3372 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 3377 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
3373 } 3378 }
3374 else { 3379 else {
3375 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 3380 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
3376 } 3381 }
3377 - this.setData({using_quan: using_quan}); 3382 + this.setData({ using_quan: using_quan });
3378 }, 3383 },
3379 3384
3380 //--确认使用券--- 3385 //--确认使用券---
@@ -3434,14 +3439,14 @@ Page({ @@ -3434,14 +3439,14 @@ Page({
3434 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 3439 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
3435 if (using_quan[pickid]) { 3440 if (using_quan[pickid]) {
3436 if (using_quan[pickid].is_nouse_red == 1) { 3441 if (using_quan[pickid].is_nouse_red == 1) {
3437 - using_quan[pickid] = {is_nouse_red: 1};  
3438 - th.setData({using_quan: using_quan}); 3442 + using_quan[pickid] = { is_nouse_red: 1 };
  3443 + th.setData({ using_quan: using_quan });
3439 if (th.data.is_b_now == 1) { 3444 if (th.data.is_b_now == 1) {
3440 th.calculatePrice2(); 3445 th.calculatePrice2();
3441 } else { 3446 } else {
3442 th.calculatePrice(); 3447 th.calculatePrice();
3443 } 3448 }
3444 - th.setData({open_quan: 0}); 3449 + th.setData({ open_quan: 0 });
3445 return; 3450 return;
3446 } 3451 }
3447 } 3452 }
@@ -3460,16 +3465,16 @@ Page({ @@ -3460,16 +3465,16 @@ Page({
3460 }; 3465 };
3461 using_quan[pickid].isby = 1; 3466 using_quan[pickid].isby = 1;
3462 } else { 3467 } else {
3463 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 3468 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
3464 using_quan[pickid].isby = 0; 3469 using_quan[pickid].isby = 0;
3465 } 3470 }
3466 - this.setData({using_quan: using_quan}); 3471 + this.setData({ using_quan: using_quan });
3467 if (th.data.is_b_now == 1) { 3472 if (th.data.is_b_now == 1) {
3468 th.calculatePrice2(); 3473 th.calculatePrice2();
3469 } else { 3474 } else {
3470 th.calculatePrice(); 3475 th.calculatePrice();
3471 } 3476 }
3472 - th.setData({open_quan: 0}); 3477 + th.setData({ open_quan: 0 });
3473 }, 3478 },
3474 3479
3475 cart_set_err: function (e) { 3480 cart_set_err: function (e) {
@@ -3506,7 +3511,7 @@ Page({ @@ -3506,7 +3511,7 @@ Page({
3506 var wu_arr_txt = e.currentTarget.dataset.txt; 3511 var wu_arr_txt = e.currentTarget.dataset.txt;
3507 var w_sele_index = e.currentTarget.dataset.w_sele_index; 3512 var w_sele_index = e.currentTarget.dataset.w_sele_index;
3508 var is_express = null; 3513 var is_express = null;
3509 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 3514 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
3510 3515
3511 //--如果是多个门店的时候-- 3516 //--如果是多个门店的时候--
3512 if (w_sele_index != undefined) { 3517 if (w_sele_index != undefined) {
@@ -3517,20 +3522,20 @@ Page({ @@ -3517,20 +3522,20 @@ Page({
3517 }, 3522 },
3518 // 关闭物流的弹窗 3523 // 关闭物流的弹窗
3519 close_express: function () { 3524 close_express: function () {
3520 - this.setData({open_express: 0, disabled: 0}); 3525 + this.setData({ open_express: 0, disabled: 0 });
3521 }, 3526 },
3522 // 选择物流 3527 // 选择物流
3523 click_express_name: function (e) { 3528 click_express_name: function (e) {
3524 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 3529 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
3525 var index = e.currentTarget.dataset.idxe; 3530 var index = e.currentTarget.dataset.idxe;
3526 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 3531 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
3527 ob[this.data.wu_arr_txt] = index; 3532 ob[this.data.wu_arr_txt] = index;
3528 this.setData(ob); 3533 this.setData(ob);
3529 }, 3534 },
3530 3535
3531 //点击确定物流 3536 //点击确定物流
3532 determine_expres: function (e) { 3537 determine_expres: function (e) {
3533 - this.setData({open_express: 0}); 3538 + this.setData({ open_express: 0 });
3534 if (this.data.is_b_now == 1) 3539 if (this.data.is_b_now == 1)
3535 this.calculatePrice2(); 3540 this.calculatePrice2();
3536 else 3541 else
@@ -3550,7 +3555,7 @@ Page({ @@ -3550,7 +3555,7 @@ Page({
3550 obj[txt] = is_open; 3555 obj[txt] = is_open;
3551 3556
3552 this.setData(obj); 3557 this.setData(obj);
3553 - this.setData({disabled: 1}) 3558 + this.setData({ disabled: 1 })
3554 }, 3559 },
3555 3560
3556 clik_coupons2: function (e) { 3561 clik_coupons2: function (e) {
@@ -3565,7 +3570,7 @@ Page({ @@ -3565,7 +3570,7 @@ Page({
3565 obj[txt] = is_open; 3570 obj[txt] = is_open;
3566 3571
3567 this.setData(obj); 3572 this.setData(obj);
3568 - this.setData({disabled: 1}) 3573 + this.setData({ disabled: 1 })
3569 }, 3574 },
3570 3575
3571 3576
@@ -3574,11 +3579,11 @@ Page({ @@ -3574,11 +3579,11 @@ Page({
3574 var th = this; 3579 var th = this;
3575 var is_shipping_code = this.data.is_shipping_code 3580 var is_shipping_code = this.data.is_shipping_code
3576 getApp().request.put("/api/weshop/users/update", { 3581 getApp().request.put("/api/weshop/users/update", {
3577 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 3582 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
3578 success: function (rse) { 3583 success: function (rse) {
3579 if (rse.data.code == 0) { 3584 if (rse.data.code == 0) {
3580 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 3585 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
3581 - th.setData({open_express: 0}); 3586 + th.setData({ open_express: 0 });
3582 //----计算此时购物车的价格---- 3587 //----计算此时购物车的价格----
3583 if (th.data.is_b_now == 1) th.calculatePrice2(); 3588 if (th.data.is_b_now == 1) th.calculatePrice2();
3584 else th.calculatePrice(); 3589 else th.calculatePrice();
@@ -3588,7 +3593,7 @@ Page({ @@ -3588,7 +3593,7 @@ Page({
3588 }, 3593 },
3589 3594
3590 //更新下默认,在onshow里面 3595 //更新下默认,在onshow里面
3591 - update_code(){ 3596 + update_code() {
3592 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 3597 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
3593 //--定时器,判断wu_arr不未空-- 3598 //--定时器,判断wu_arr不未空--
3594 var uii = setInterval(function () { 3599 var uii = setInterval(function () {
@@ -3602,7 +3607,7 @@ Page({ @@ -3602,7 +3607,7 @@ Page({
3602 } 3607 }
3603 //--如果是立即购买-- 3608 //--如果是立即购买--
3604 if (th.data.is_b_now == 1) { 3609 if (th.data.is_b_now == 1) {
3605 - th.setData({index: m_wind, is_express: m_wind}); 3610 + th.setData({ index: m_wind, is_express: m_wind });
3606 } else { 3611 } else {
3607 var ui = setInterval(function () { 3612 var ui = setInterval(function () {
3608 if (th.data.cartlist) { 3613 if (th.data.cartlist) {
@@ -3610,7 +3615,7 @@ Page({ @@ -3610,7 +3615,7 @@ Page({
3610 for (var i in c_arr) { 3615 for (var i in c_arr) {
3611 c_arr[i].wind = m_wind; 3616 c_arr[i].wind = m_wind;
3612 } 3617 }
3613 - th.setData({cartlist: c_arr, is_express: m_wind}) 3618 + th.setData({ cartlist: c_arr, is_express: m_wind })
3614 clearInterval(ui); 3619 clearInterval(ui);
3615 } 3620 }
3616 }, 500) 3621 }, 500)
@@ -3622,7 +3627,7 @@ Page({ @@ -3622,7 +3627,7 @@ Page({
3622 get_cart_quan: async function (order_prom_list_cart) { 3627 get_cart_quan: async function (order_prom_list_cart) {
3623 var th = this; 3628 var th = this;
3624 var is_xz_yh = 1; 3629 var is_xz_yh = 1;
3625 - var user_id=getApp().globalData.user_id; 3630 + var user_id = getApp().globalData.user_id;
3626 //等待值的出现 3631 //等待值的出现
3627 //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { 3632 //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
3628 //var arr=th.data.order_prom_list_cart; 3633 //var arr=th.data.order_prom_list_cart;
@@ -3641,8 +3646,8 @@ Page({ @@ -3641,8 +3646,8 @@ Page({
3641 var ckeck_quan_price = 0, 3646 var ckeck_quan_price = 0,
3642 check_quan_price_list = '', 3647 check_quan_price_list = '',
3643 check_quan_ware_list = '', 3648 check_quan_ware_list = '',
3644 - check_quan_price_list_arr=[],  
3645 - check_quan_ware_list_arr=[]; 3649 + check_quan_price_list_arr = [],
  3650 + check_quan_ware_list_arr = [];
3646 3651
3647 for (var i in goodlist) { 3652 for (var i in goodlist) {
3648 var gd = goodlist[i]; 3653 var gd = goodlist[i];
@@ -3652,25 +3657,25 @@ Page({ @@ -3652,25 +3657,25 @@ Page({
3652 } 3657 }
3653 3658
3654 //--如果是团购,要判断有没有限制使用优惠券 3659 //--如果是团购,要判断有没有限制使用优惠券
3655 - if(gd.prom_type == 2){  
3656 - var prom1=null; 3660 + if (gd.prom_type == 2) {
  3661 + var prom1 = null;
3657 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { 3662 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
3658 }).then(res => { 3663 }).then(res => {
3659 if (res.data.code == 0) prom1 = res.data.data; 3664 if (res.data.code == 0) prom1 = res.data.data;
3660 }) 3665 })
3661 - if(prom1 && !prom1.isQuan){ 3666 + if (prom1 && !prom1.isQuan) {
3662 continue; 3667 continue;
3663 } 3668 }
3664 } 3669 }
3665 3670
3666 //--如果是团购,要判断有没有限制使用优惠券 3671 //--如果是团购,要判断有没有限制使用优惠券
3667 - if(gd.prom_type == 10){  
3668 - var prom1=null;  
3669 - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+ os.stoid +"/"+user_id+"/"+ gd.prom_id, { 3672 + if (gd.prom_type == 10) {
  3673 + var prom1 = null;
  3674 + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + gd.prom_id, {
3670 }).then(res => { 3675 }).then(res => {
3671 if (res.data.code == 0) prom1 = res.data.data; 3676 if (res.data.code == 0) prom1 = res.data.data;
3672 }) 3677 })
3673 - if(prom1 && prom1.isuse && prom1. is_usecoupon){ 3678 + if (prom1 && prom1.isuse && prom1.is_usecoupon) {
3674 continue; 3679 continue;
3675 } 3680 }
3676 } 3681 }
@@ -3682,43 +3687,43 @@ Page({ @@ -3682,43 +3687,43 @@ Page({
3682 } 3687 }
3683 is_xz_yh = 0; 3688 is_xz_yh = 0;
3684 3689
3685 - var item_price = gd.goods_price * gd.goods_num;  
3686 - var item_price2=item_price; 3690 + var item_price = gd.goods_price * gd.goods_num;
  3691 + var item_price2 = item_price;
3687 3692
3688 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- 3693 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
3689 if (gd.account_fir != null && gd.account_fir != undefined) { 3694 if (gd.account_fir != null && gd.account_fir != undefined) {
3690 item_price2 = gd.account_fir * gd.goods_num; 3695 item_price2 = gd.account_fir * gd.goods_num;
3691 } 3696 }
3692 3697
3693 - if(gd.ld_account){ 3698 + if (gd.ld_account) {
3694 item_price2 = gd.ld_account * gd.goods_num; 3699 item_price2 = gd.ld_account * gd.goods_num;
3695 } 3700 }
3696 3701
3697 ckeck_quan_price += item_price; 3702 ckeck_quan_price += item_price;
3698 //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 3703 //如果商品有重复的过滤,一般是组合购和阶梯购的情况下
3699 - var idx=check_quan_ware_list_arr.findIndex(function(ele){  
3700 - return ele== encodeURIComponent(gd['erpwareid']); 3704 + var idx = check_quan_ware_list_arr.findIndex(function (ele) {
  3705 + return ele == encodeURIComponent(gd['erpwareid']);
3701 }) 3706 })
3702 3707
3703 - if(idx>-1){  
3704 - check_quan_price_list_arr[idx]+=item_price2;  
3705 - }else{ 3708 + if (idx > -1) {
  3709 + check_quan_price_list_arr[idx] += item_price2;
  3710 + } else {
3706 check_quan_ware_list_arr.push(encodeURIComponent(gd['erpwareid'])); 3711 check_quan_ware_list_arr.push(encodeURIComponent(gd['erpwareid']));
3707 check_quan_price_list_arr.push(item_price2); 3712 check_quan_price_list_arr.push(item_price2);
3708 } 3713 }
3709 - //--组装价格list--  
3710 - /*--  
3711 - if (check_quan_price_list) {  
3712 - check_quan_price_list += "," + item_price;  
3713 - } else {  
3714 - check_quan_price_list = item_price;  
3715 - }  
3716 - //--组装商品的线下erpwareid--  
3717 - if (check_quan_ware_list) {  
3718 - check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);  
3719 - } else {  
3720 - check_quan_ware_list = encodeURIComponent(gd['erpwareid']);  
3721 - }---*/ 3714 + //--组装价格list--
  3715 + /*--
  3716 + if (check_quan_price_list) {
  3717 + check_quan_price_list += "," + item_price;
  3718 + } else {
  3719 + check_quan_price_list = item_price;
  3720 + }
  3721 + //--组装商品的线下erpwareid--
  3722 + if (check_quan_ware_list) {
  3723 + check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);
  3724 + } else {
  3725 + check_quan_ware_list = encodeURIComponent(gd['erpwareid']);
  3726 + }---*/
3722 } 3727 }
3723 //优惠券优惠的金额要控制到优惠券的选择条件 3728 //优惠券优惠的金额要控制到优惠券的选择条件
3724 var cut_price = 0; 3729 var cut_price = 0;
@@ -3729,16 +3734,16 @@ Page({ @@ -3729,16 +3734,16 @@ Page({
3729 } 3734 }
3730 } 3735 }
3731 3736
3732 - var prom_pt_json= ep.prom_pt_json;  
3733 - if(prom_pt_json){  
3734 - for(let oj in prom_pt_json){  
3735 - let item_j=prom_pt_json[oj]; 3737 + var prom_pt_json = ep.prom_pt_json;
  3738 + if (prom_pt_json) {
  3739 + for (let oj in prom_pt_json) {
  3740 + let item_j = prom_pt_json[oj];
3736 3741
3737 //要对一下阶梯优惠促销的功能 3742 //要对一下阶梯优惠促销的功能
3738 - if(item_j.ladder_prom_id){ 3743 + if (item_j.ladder_prom_id) {
3739 3744
3740 //看一下要不要限制使用优惠券 3745 //看一下要不要限制使用优惠券
3741 - if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon){ 3746 + if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) {
3742 continue; 3747 continue;
3743 } 3748 }
3744 3749
@@ -3747,10 +3752,10 @@ Page({ @@ -3747,10 +3752,10 @@ Page({
3747 } 3752 }
3748 } 3753 }
3749 3754
3750 - if(check_quan_price_list_arr.length) check_quan_price_list=check_quan_price_list_arr.join(',');  
3751 - if(check_quan_ware_list_arr.length) check_quan_ware_list=check_quan_ware_list_arr.join(',') 3755 + if (check_quan_price_list_arr.length) check_quan_price_list = check_quan_price_list_arr.join(',');
  3756 + if (check_quan_ware_list_arr.length) check_quan_ware_list = check_quan_ware_list_arr.join(',')
3752 3757
3753 - arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); 3758 + arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price ? cut_price : 0);
3754 arr[ind].check_quan_ware_list = check_quan_ware_list; 3759 arr[ind].check_quan_ware_list = check_quan_ware_list;
3755 arr[ind].check_quan_price_list = check_quan_price_list; 3760 arr[ind].check_quan_price_list = check_quan_price_list;
3756 arr[ind].is_xz_yh = is_xz_yh; 3761 arr[ind].is_xz_yh = is_xz_yh;
@@ -3780,10 +3785,10 @@ Page({ @@ -3780,10 +3785,10 @@ Page({
3780 if (th.data.is_b_now) { 3785 if (th.data.is_b_now) {
3781 if (arr && arr.length > 0) { 3786 if (arr && arr.length > 0) {
3782 var quanlist = arr[0].quan_list; 3787 var quanlist = arr[0].quan_list;
3783 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 3788 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
3784 } 3789 }
3785 } else { 3790 } else {
3786 - th.setData({cartlist: arr}) 3791 + th.setData({ cartlist: arr })
3787 th.set_can_num(); 3792 th.set_can_num();
3788 } 3793 }
3789 3794
@@ -3803,7 +3808,7 @@ Page({ @@ -3803,7 +3808,7 @@ Page({
3803 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { 3808 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) {
3804 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 3809 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
3805 var url = "/api/weshop/couponList/getUseCouponList"; 3810 var url = "/api/weshop/couponList/getUseCouponList";
3806 - app.request.promiseGet(url0, {1: 1}).then(res => { 3811 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
3807 if (res.data.code == 0) { 3812 if (res.data.code == 0) {
3808 frozenQuan = res.data.data; 3813 frozenQuan = res.data.data;
3809 th.data.frozenQuan = frozenQuan; 3814 th.data.frozenQuan = frozenQuan;
@@ -3821,7 +3826,7 @@ Page({ @@ -3821,7 +3826,7 @@ Page({
3821 quanlist = res.data.data.pageData; 3826 quanlist = res.data.data.pageData;
3822 if (quanlist) { 3827 if (quanlist) {
3823 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 3828 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
3824 - th.setData({selected_quan_list: quanlist}) 3829 + th.setData({ selected_quan_list: quanlist })
3825 } 3830 }
3826 } 3831 }
3827 } 3832 }
@@ -3849,7 +3854,7 @@ Page({ @@ -3849,7 +3854,7 @@ Page({
3849 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 3854 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
3850 for (var i in arr) { 3855 for (var i in arr) {
3851 var item = arr[i]; 3856 var item = arr[i];
3852 - if (goods_id == item) return 0; 3857 + if (goods_id == item) return 0;
3853 } 3858 }
3854 return 1; 3859 return 1;
3855 }, 3860 },
@@ -3920,7 +3925,7 @@ Page({ @@ -3920,7 +3925,7 @@ Page({
3920 if (this.data.is_b_now == 1) pick = this.data.bn_pick; 3925 if (this.data.is_b_now == 1) pick = this.data.bn_pick;
3921 //---获取订单优惠--- 3926 //---获取订单优惠---
3922 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 3927 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
3923 - data: {store_id: os.stoid, orderAmount: condition} 3928 + data: { store_id: os.stoid, orderAmount: condition }
3924 }).then(res => { 3929 }).then(res => {
3925 if (res.data.code == 0) { 3930 if (res.data.code == 0) {
3926 var data = res.data.data; 3931 var data = res.data.data;
@@ -3942,7 +3947,7 @@ Page({ @@ -3942,7 +3947,7 @@ Page({
3942 var ob = map[pickid][item.prom_id]; 3947 var ob = map[pickid][item.prom_id];
3943 ob.price += item.goods_price * item.goods_num; 3948 ob.price += item.goods_price * item.goods_num;
3944 ob.goods_num += item.goods_num; 3949 ob.goods_num += item.goods_num;
3945 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3950 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3946 3951
3947 } else { 3952 } else {
3948 var prom = null; 3953 var prom = null;
@@ -3958,7 +3963,7 @@ Page({ @@ -3958,7 +3963,7 @@ Page({
3958 ob.is_bz = prom.is_bz; 3963 ob.is_bz = prom.is_bz;
3959 ob.is_xz_yh = prom.is_xz_yh; 3964 ob.is_xz_yh = prom.is_xz_yh;
3960 ob.goods = new Array(); 3965 ob.goods = new Array();
3961 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3966 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3962 map[pickid][item.prom_id] = ob; 3967 map[pickid][item.prom_id] = ob;
3963 } 3968 }
3964 } else { 3969 } else {
@@ -3975,7 +3980,7 @@ Page({ @@ -3975,7 +3980,7 @@ Page({
3975 ob.is_bz = prom.is_bz; 3980 ob.is_bz = prom.is_bz;
3976 ob.is_xz_yh = prom.is_xz_yh; 3981 ob.is_xz_yh = prom.is_xz_yh;
3977 ob.goods = new Array(); 3982 ob.goods = new Array();
3978 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3983 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3979 3984
3980 var obj = {}; 3985 var obj = {};
3981 obj[item.prom_id] = ob; 3986 obj[item.prom_id] = ob;
@@ -3985,12 +3990,12 @@ Page({ @@ -3985,12 +3990,12 @@ Page({
3985 }, 3990 },
3986 3991
3987 //计算立即购买赠品的物流费用 3992 //计算立即购买赠品的物流费用
3988 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 3993 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
3989 var good = this.data.buy_now_gift_goods; 3994 var good = this.data.buy_now_gift_goods;
3990 var goods_weight = -1, goods_piece = -1; 3995 var goods_weight = -1, goods_piece = -1;
3991 var gift_shipping_price = 0; 3996 var gift_shipping_price = 0;
3992 var th = this; 3997 var th = this;
3993 - var out_of_weight=null; 3998 + var out_of_weight = null;
3994 switch (good['exp_sum_type']) { 3999 switch (good['exp_sum_type']) {
3995 case 1: 4000 case 1:
3996 //统一运费 4001 //统一运费
@@ -4002,7 +4007,7 @@ Page({ @@ -4002,7 +4007,7 @@ Page({
4002 //累积商品重量 每种商品的重量 * 数量 4007 //累积商品重量 每种商品的重量 * 数量
4003 goods_weight += good['weight'] * good['buynum']; 4008 goods_weight += good['weight'] * good['buynum'];
4004 if (goods_weight1 > 0) { 4009 if (goods_weight1 > 0) {
4005 - out_of_weight = gift_weight_free - goods_weight; 4010 + out_of_weight = gift_weight_free - goods_weight;
4006 //不能调换位置 下面goods_weight会变大 4011 //不能调换位置 下面goods_weight会变大
4007 goods_weight += goods_weight1; 4012 goods_weight += goods_weight1;
4008 } 4013 }
@@ -4022,6 +4027,7 @@ Page({ @@ -4022,6 +4027,7 @@ Page({
4022 if (no_by_data && no_by_data.region_list) { 4027 if (no_by_data && no_by_data.region_list) {
4023 if (th.check_by_area(no_by_data.region_list)) { 4028 if (th.check_by_area(no_by_data.region_list)) {
4024 gift_freight_free = 0; 4029 gift_freight_free = 0;
  4030 + out_of_weight = 0
4025 th.data.is_no_by[th.data.bn_pick] = 1; 4031 th.data.is_no_by[th.data.bn_pick] = 1;
4026 } 4032 }
4027 } 4033 }
@@ -4029,13 +4035,14 @@ Page({ @@ -4029,13 +4035,14 @@ Page({
4029 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 4035 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
4030 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 4036 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
4031 gift_freight_free = 0; 4037 gift_freight_free = 0;
4032 - //th.data.is_no_by[th.data.bn_pick]=1; 4038 + out_of_weight = 0
  4039 + th.data.is_no_by[th.data.bn_pick]=1;
4033 } 4040 }
4034 } 4041 }
4035 4042
4036 var t_shipping_price = 4043 var t_shipping_price =
4037 - this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,  
4038 - goods_piece, user_addr, gift_freight_free, allpice, rs); 4044 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  4045 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
4039 return t_shipping_price; 4046 return t_shipping_price;
4040 4047
4041 }, 4048 },
@@ -4092,7 +4099,7 @@ Page({ @@ -4092,7 +4099,7 @@ Page({
4092 4099
4093 //跳转关闭弹出框的显示 4100 //跳转关闭弹出框的显示
4094 close_offline: function () { 4101 close_offline: function () {
4095 - this.setData({is_offline_show: 0}); 4102 + this.setData({ is_offline_show: 0 });
4096 }, 4103 },
4097 4104
4098 //立即购买显示弹出框 4105 //立即购买显示弹出框
@@ -4100,7 +4107,7 @@ Page({ @@ -4100,7 +4107,7 @@ Page({
4100 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; 4107 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price;
4101 //是不是线下 4108 //是不是线下
4102 var is_get_offline = this.data.bn_goods.is_offline; 4109 var is_get_offline = this.data.bn_goods.is_offline;
4103 - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); 4110 + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline });
4104 }, 4111 },
4105 4112
4106 //确定使用线下取价 4113 //确定使用线下取价
@@ -4108,14 +4115,14 @@ Page({ @@ -4108,14 +4115,14 @@ Page({
4108 var bn_goods = this.data.bn_goods; 4115 var bn_goods = this.data.bn_goods;
4109 if (bn_goods && bn_goods.prom_type == 0) { 4116 if (bn_goods && bn_goods.prom_type == 0) {
4110 bn_goods.is_offline = 1; 4117 bn_goods.is_offline = 1;
4111 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 4118 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
4112 this.calculatePrice2(); 4119 this.calculatePrice2();
4113 } 4120 }
4114 //就是购物车结算时的 4121 //就是购物车结算时的
4115 else { 4122 else {
4116 var index = this.data.pop_offline_index; 4123 var index = this.data.pop_offline_index;
4117 var txt = "cartlist[" + index + "].is_offline"; 4124 var txt = "cartlist[" + index + "].is_offline";
4118 - this.setData({[txt]: 1, is_offline_show: 0,}); 4125 + this.setData({ [txt]: 1, is_offline_show: 0, });
4119 this.data.old_cartlist[index].is_offline = 1; 4126 this.data.old_cartlist[index].is_offline = 1;
4120 this.calculatePrice(); 4127 this.calculatePrice();
4121 } 4128 }
@@ -4127,14 +4134,14 @@ Page({ @@ -4127,14 +4134,14 @@ Page({
4127 var bn_goods = this.data.bn_goods; 4134 var bn_goods = this.data.bn_goods;
4128 if (bn_goods && bn_goods.prom_type == 0) { 4135 if (bn_goods && bn_goods.prom_type == 0) {
4129 bn_goods.is_offline = 0; 4136 bn_goods.is_offline = 0;
4130 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 4137 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
4131 this.calculatePrice2(); 4138 this.calculatePrice2();
4132 } 4139 }
4133 //就是购物车结算时的 4140 //就是购物车结算时的
4134 else { 4141 else {
4135 var index = this.data.pop_offline_index; 4142 var index = this.data.pop_offline_index;
4136 var txt = "cartlist[" + index + "].is_offline"; 4143 var txt = "cartlist[" + index + "].is_offline";
4137 - this.setData({[txt]: 0, is_offline_show: 0,}) 4144 + this.setData({ [txt]: 0, is_offline_show: 0, })
4138 this.data.old_cartlist[index].is_offline = 0; 4145 this.data.old_cartlist[index].is_offline = 0;
4139 this.calculatePrice(); 4146 this.calculatePrice();
4140 } 4147 }
@@ -4167,34 +4174,34 @@ Page({ @@ -4167,34 +4174,34 @@ Page({
4167 // this.setData({[txt]:0}) 4174 // this.setData({[txt]:0})
4168 // }, 4175 // },
4169 4176
4170 - go_url:function (e) { 4177 + go_url: function (e) {
4171 var url = e.currentTarget.dataset.url; 4178 var url = e.currentTarget.dataset.url;
4172 getApp().goto(url); 4179 getApp().goto(url);
4173 }, 4180 },
4174 4181
4175 - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表  
4176 - split_set_goods_quanprice:async function (you_item,t_item) {  
4177 - var coupon_price=you_item.WareCashSum;  
4178 - var goods=t_item.goods;  
4179 - var arr=[]; 4182 + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
  4183 + split_set_goods_quanprice: async function (you_item, t_item) {
  4184 + var coupon_price = you_item.WareCashSum;
  4185 + var goods = t_item.goods;
  4186 + var arr = [];
4180 //判断是不是有goods_id重复 4187 //判断是不是有goods_id重复
4181 - for(var i=0;i<goods.length;i++){  
4182 - if(goods[i].prom_type!=7 && goods[i].erpwareid==you_item.WareId){  
4183 - var gg_ite={  
4184 - goods_id:goods[i].goods_id,  
4185 - goods_num:goods[i].goods_num,  
4186 - goods_price:goods[i].goods_price, 4188 + for (var i = 0; i < goods.length; i++) {
  4189 + if (goods[i].prom_type != 7 && goods[i].erpwareid == you_item.WareId) {
  4190 + var gg_ite = {
  4191 + goods_id: goods[i].goods_id,
  4192 + goods_num: goods[i].goods_num,
  4193 + goods_price: goods[i].goods_price,
4187 }; 4194 };
4188 - if(goods[i].account) gg_ite.goods_price=goods[i].account;  
4189 - gg_ite.idx=i;arr.push(gg_ite); 4195 + if (goods[i].account) gg_ite.goods_price = goods[i].account;
  4196 + gg_ite.idx = i; arr.push(gg_ite);
4190 } 4197 }
4191 } 4198 }
4192 4199
4193 - if(arr.length<=0) return false;  
4194 - if(arr.length==1){  
4195 - var idx=arr[0].idx;  
4196 - t_item.goods[idx].quan_num =Math.floor(coupon_price* 100) / 100;  
4197 - t_item.goods[idx].quan_no=t_item.quan_no; 4200 + if (arr.length <= 0) return false;
  4201 + if (arr.length == 1) {
  4202 + var idx = arr[0].idx;
  4203 + t_item.goods[idx].quan_num = Math.floor(coupon_price * 100) / 100;
  4204 + t_item.goods[idx].quan_no = t_item.quan_no;
4198 return false; 4205 return false;
4199 } 4206 }
4200 4207
@@ -4204,7 +4211,7 @@ Page({ @@ -4204,7 +4211,7 @@ Page({
4204 } 4211 }
4205 4212
4206 var pt_res = null; 4213 var pt_res = null;
4207 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 4214 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
4208 is_json: 1, 4215 is_json: 1,
4209 data: pt_data 4216 data: pt_data
4210 }).then(res => { 4217 }).then(res => {
@@ -4217,21 +4224,21 @@ Page({ @@ -4217,21 +4224,21 @@ Page({
4217 for (var i in pt_res) { 4224 for (var i in pt_res) {
4218 var idx = pt_res[i].idx; 4225 var idx = pt_res[i].idx;
4219 //有account的实收价,就要用account实收价 4226 //有account的实收价,就要用account实收价
4220 - var price=(t_item.goods[idx].account?t_item.goods[idx].account:t_item.goods[idx].goods_price);  
4221 - price=(price - pt_res[i].fisrt_account)* t_item.goods[idx].goods_num;  
4222 - t_item.goods[idx].quan_num =price; 4227 + var price = (t_item.goods[idx].account ? t_item.goods[idx].account : t_item.goods[idx].goods_price);
  4228 + price = (price - pt_res[i].fisrt_account) * t_item.goods[idx].goods_num;
  4229 + t_item.goods[idx].quan_num = price;
4223 4230
4224 - t_item.goods[idx].quan_num =Math.floor(t_item.goods[idx].quan_num * 100) / 100;  
4225 - t_item.goods[idx].quan_no=t_item.quan_no; 4231 + t_item.goods[idx].quan_num = Math.floor(t_item.goods[idx].quan_num * 100) / 100;
  4232 + t_item.goods[idx].quan_no = t_item.quan_no;
4226 q_s_num += t_item.goods[idx].quan_num; 4233 q_s_num += t_item.goods[idx].quan_num;
4227 } 4234 }
4228 4235
4229 - if (q_s_num > parseFloat(coupon_price) || q_s_num < parseFloat(coupon_price)){ 4236 + if (q_s_num > parseFloat(coupon_price) || q_s_num < parseFloat(coupon_price)) {
4230 for (var ik in arr) { 4237 for (var ik in arr) {
4231 if (arr[ik].goods_num == 1) { 4238 if (arr[ik].goods_num == 1) {
4232 var id = arr[ik].idx; 4239 var id = arr[ik].idx;
4233 - var pri=Math.floor(coupon_price*100)/100-Math.floor(q_s_num*100)/100  
4234 - t_item.goods[id].quan_num+=pri; 4240 + var pri = Math.floor(coupon_price * 100) / 100 - Math.floor(q_s_num * 100) / 100
  4241 + t_item.goods[id].quan_num += pri;
4235 break; 4242 break;
4236 } 4243 }
4237 } 4244 }
@@ -4239,8 +4246,7 @@ Page({ @@ -4239,8 +4246,7 @@ Page({
4239 } 4246 }
4240 }, 4247 },
4241 //订阅消息提醒 4248 //订阅消息提醒
4242 - sendsm:function(func)  
4243 - { 4249 + sendsm: function (func) {
4244 var template_id = this.data.template_id; 4250 var template_id = this.data.template_id;
4245 // //授权订阅 4251 // //授权订阅
4246 wx.requestSubscribeMessage({ 4252 wx.requestSubscribeMessage({
pages/cart/cart2/zh_calculate.js
@@ -152,15 +152,7 @@ module.exports = { @@ -152,15 +152,7 @@ module.exports = {
152 if (act.is_bzyh && zhqty_bz.length > 0) { 152 if (act.is_bzyh && zhqty_bz.length > 0) {
153 if (zhqty_bz.length > 1) { 153 if (zhqty_bz.length > 1) {
154 let zhqty_bz_arr = []; 154 let zhqty_bz_arr = [];
155 - let zhqty_bz_flag = zhqty_bz.every((item1, i) => {  
156 - var bz_num = be * item1['zhqty']; //超量倍增  
157 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量  
158 - if (bz_num > num) {  
159 - zhqty_bz_arr.push(item1);  
160 - zhqty_bz.splice(i, 1)  
161 - }  
162 - return bz_num <= num;  
163 - }) 155 + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr);
164 if (zhqty_bz_flag) { 156 if (zhqty_bz_flag) {
165 for (let i = 0; i < zhqty_bz.length; i++) { 157 for (let i = 0; i < zhqty_bz.length; i++) {
166 var vv = zhqty_bz[i]; 158 var vv = zhqty_bz[i];
@@ -175,11 +167,12 @@ module.exports = { @@ -175,11 +167,12 @@ module.exports = {
175 } 167 }
176 } 168 }
177 } else { 169 } else {
  170 + zhqty_len=1;
178 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { 171 let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) {
179 - return o['num'] 172 + return o['num'];
180 })); 173 }));
181 let new_arr = zhqty_bz_arr.filter(ii => { 174 let new_arr = zhqty_bz_arr.filter(ii => {
182 - return ii['num'] == min_bz_num 175 + return ii['num'] == min_bz_num;
183 }) 176 })
184 var vv = new_arr[0]; 177 var vv = new_arr[0];
185 var bz_num = be * new_arr[0].zhqty; //超量倍增 178 var bz_num = be * new_arr[0].zhqty; //超量倍增
@@ -198,18 +191,22 @@ module.exports = { @@ -198,18 +191,22 @@ module.exports = {
198 } 191 }
199 bz_num_ok = be * vv.zhqty; 192 bz_num_ok = be * vv.zhqty;
200 } 193 }
201 -  
202 - for (let j = 0; j < bz_num_ok; j++) {  
203 - let index = no_in_arr.findIndex(i => {  
204 - return vv.goods_id === i.goods_id  
205 - })  
206 - if (index > -1) {  
207 - delete_num++  
208 - no_in_arr.splice(index, 1) 194 +
  195 + for(let i = 0; i < zhqty_bz.length; i++){
  196 + let item1=zhqty_bz[i];
  197 + for (let j = 0; j < be * item1['zhqty']; j++) {
  198 + let index = no_in_arr.findIndex(i => {
  199 + return item1.goods_id === i.goods_id
  200 + })
  201 + if (index > -1) {
  202 + // delete_num++
  203 + no_in_arr.splice(index, 1)
  204 + }
209 } 205 }
210 } 206 }
  207 + aprice += be * aprice;
211 } 208 }
212 - } else { 209 + } else {
213 var vv = zhqty_bz[0]; 210 var vv = zhqty_bz[0];
214 var bz_num = be * vv.zhqty; //超量倍增 211 var bz_num = be * vv.zhqty; //超量倍增
215 var num = vv['num'] - vv.zhqty; //购买数量减去超量 212 var num = vv['num'] - vv.zhqty; //购买数量减去超量
@@ -223,19 +220,16 @@ module.exports = { @@ -223,19 +220,16 @@ module.exports = {
223 // be=be-bz_num_ok; 220 // be=be-bz_num_ok;
224 if (num % vv.zhqty == 0) { 221 if (num % vv.zhqty == 0) {
225 be = num / vv.zhqty; 222 be = num / vv.zhqty;
226 - // bz_num_ok = num;  
227 } else { 223 } else {
228 be = Math.floor(num / vv.zhqty) 224 be = Math.floor(num / vv.zhqty)
229 - // bz_num_ok = num - (be * vv.zhqty);  
230 } 225 }
231 bz_num_ok = be * vv.zhqty; 226 bz_num_ok = be * vv.zhqty;
232 } 227 }
233 - // be=vv.num;  
234 for (let j = 0; j < bz_num_ok; j++) { 228 for (let j = 0; j < bz_num_ok; j++) {
235 let index = no_in_arr.findIndex(i => { 229 let index = no_in_arr.findIndex(i => {
236 return vv.goods_id === i.goods_id 230 return vv.goods_id === i.goods_id
237 }) 231 })
238 - if(index > -1){ 232 + if (index > -1) {
239 delete_num++ 233 delete_num++
240 no_in_arr.splice(index, 1) 234 no_in_arr.splice(index, 1)
241 } 235 }
@@ -515,6 +509,20 @@ module.exports = { @@ -515,6 +509,20 @@ module.exports = {
515 } 509 }
516 510
517 511
  512 + },
  513 + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){
  514 + let zhqty_bz_flag =true;
  515 + for(let i=0;i<zhqty_bz.length;i++){
  516 + let item=zhqty_bz[i];
  517 + let bz_num = be * item['zhqty']; //超量倍增
  518 + let num = item['num'] - item['zhqty']; //购买数量减去超量
  519 + if (bz_num > num) {
  520 + zhqty_bz_flag=false;
  521 + zhqty_bz_arr.push(item);
  522 + // zhqty_bz.splice(i,1)
  523 + }
  524 + }
  525 + return zhqty_bz_flag;
518 } 526 }
519 527
520 528
pages/cart/cart2_inte/cart2_inte.js
1 -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"),  
2 - s = require("../../../utils/util.js"),ut=s, o = require("../../../utils/md5.js"), to = getApp();  
3 -var oo=t.globalData.setting,os=oo; 1 +var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
  2 + s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp();
  3 +var oo = t.globalData.setting, os = oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
6 6
7 -Page({ 7 +Page({
8 data: { 8 data: {
9 - url: t.globalData.setting.url, 9 + url: t.globalData.setting.url,
10 imgUrl: t.globalData.setting.imghost, 10 imgUrl: t.globalData.setting.imghost,
11 goods: null, 11 goods: null,
12 order: null, 12 order: null,
@@ -20,361 +20,361 @@ Page({ @@ -20,361 +20,361 @@ Page({
20 enterAddressPage: !1, 20 enterAddressPage: !1,
21 firstEnter: !0, 21 firstEnter: !0,
22 //页面获取的参数 22 //页面获取的参数
23 - param:null, 23 + param: null,
24 //提交订单的格式 24 //提交订单的格式
25 formData: { 25 formData: {
26 - order_amount:0,//支付金额  
27 - total_amount:0,//总价  
28 - all_price:0,//商品卖的总价 26 + order_amount: 0,//支付金额
  27 + total_amount: 0,//总价
  28 + all_price: 0,//商品卖的总价
29 pay_points: 0,//使用积分 29 pay_points: 0,//使用积分
30 user_money: 0,//使用余额 30 user_money: 0,//使用余额
31 couponCode: "",//使用优惠券(多单就用逗号隔开) 31 couponCode: "",//使用优惠券(多单就用逗号隔开)
32 - shipping_price:0,//物流费用 32 + shipping_price: 0,//物流费用
33 }, 33 },
34 34
35 35
36 /*----------------立即购买---------------------*/ 36 /*----------------立即购买---------------------*/
37 - is_b_now:1, //0是购物车结算 1立即购买  
38 - bn_goods:null, //立即购买时候的调用商品  
39 - bn_use_money:0,//是否使用余额  
40 - bn_exp_type:1, //0是物流 1自提  
41 - bn_pick:0, //选择的门店 37 + is_b_now: 1, //0是购物车结算 1立即购买
  38 + bn_goods: null, //立即购买时候的调用商品
  39 + bn_use_money: 0,//是否使用余额
  40 + bn_exp_type: 1, //0是物流 1自提
  41 + bn_pick: 0, //选择的门店
42 bn_pickname: "", //选择的门店名称 42 bn_pickname: "", //选择的门店名称
43 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流  
44 -  
45 - bn_plus_cut_price:0, //显示等级卡会优惠多少钱 43 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
  44 +
  45 + bn_plus_cut_price: 0, //显示等级卡会优惠多少钱
46 /*------------------------*/ 46 /*------------------------*/
47 - user_addr:null,//物流  
48 - userinfo:null, //获取会员 47 + user_addr: null,//物流
  48 + userinfo: null, //获取会员
49 /*----------物流选择--------*/ 49 /*----------物流选择--------*/
50 - wu_arr:null,  
51 - index:0,  
52 - w_sele_index:0, 50 + wu_arr: null,
  51 + index: 0,
  52 + w_sele_index: 0,
53 53
54 //判断页面是返回回来的还是 首次进入的 54 //判断页面是返回回来的还是 首次进入的
55 - isclose:1, 55 + isclose: 1,
56 //申请提现的金额 56 //申请提现的金额
57 - txmon:0,  
58 - yuer:0, 57 + txmon: 0,
  58 + yuer: 0,
59 //提交中,不重复提交 59 //提交中,不重复提交
60 - is_summit_ing:0,  
61 -  
62 - disabled:0,  
63 - open_express:0,//控制选择物流名列表 的属性  
64 -  
65 - is_express:0, //选中物流的属性  
66 - expres_name:"", //点击选定  
67 - is_shipping_code:"",//插入用户默认地址  
68 - wu_arr_txt:"", //要更新的物流的字段  
69 -  
70 - //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券  
71 - is_no_by:{},  
72 - is_by:{},  
73 - is_quan_by:{}, 60 + is_summit_ing: 0,
  61 +
  62 + disabled: 0,
  63 + open_express: 0,//控制选择物流名列表 的属性
  64 +
  65 + is_express: 0, //选中物流的属性
  66 + expres_name: "", //点击选定
  67 + is_shipping_code: "",//插入用户默认地址
  68 + wu_arr_txt: "", //要更新的物流的字段
  69 +
  70 + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券
  71 + is_no_by: {},
  72 + is_by: {},
  73 + is_quan_by: {},
74 //--购买赠送的商品-- 74 //--购买赠送的商品--
75 - buy_now_gift_goods:null, 75 + buy_now_gift_goods: null,
76 //--订单优惠-- 76 //--订单优惠--
77 - order_prom:{},  
78 - show_submit:0, //提交按钮变正常显示 77 + order_prom: {},
  78 + show_submit: 0, //提交按钮变正常显示
79 79
80 }, 80 },
81 - onLoad: function(t) {  
82 - wx.setNavigationBarTitle({ title: "填写订单",})  
83 - var th = this;  
84 - th.data.param=t; 81 + onLoad: function (t) {
  82 + wx.setNavigationBarTitle({ title: "填写订单", })
  83 + var th = this;
  84 + th.data.param = t;
85 //清空is_pick_up 85 //清空is_pick_up
86 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 86 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
87 - data: {user_id: getApp().globalData.user_id, is_pickup: 0},  
88 - success: function (s) {  
89 - } 87 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
  88 + success: function (s) {
  89 + }
90 }); 90 });
91 -  
92 - //先获取是否有关闭使用优惠券  
93 - getApp().getConfig2(function (ee) {  
94 - var json_d = JSON.parse(ee.switch_list);  
95 - th.data.json_d=json_d;  
96 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
97 - var is_default_logistics=json_d.is_default_logistics;  
98 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch,is_default_logistics:is_default_logistics});  
99 -  
100 - var rank_switch=json_d.rank_switch;  
101 - var max_price=-1;  
102 - var show_card=null;  
103 - var name="";  
104 - //如果有开等级卡的时候,  
105 - //因为都是调接口,要返回在计算  
106 - if(rank_switch==2){  
107 - //-- 获取所有的等级卡, --  
108 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
109 - {}).then(res => {  
110 - if(res.data.code==0){  
111 - var plusCard = res.data.data;  
112 - //-- 循环判断,拿到最贵的那张卡 --  
113 - for(var ih in plusCard){  
114 - if(plusCard[ih].IsStopBuy == true){ continue; }  
115 - if(max_price<0){  
116 - max_price=plusCard[ih].CardFee;  
117 - name='card'+plusCard[ih]['CorrPrice'];  
118 - show_card=plusCard[ih];  
119 - }else{  
120 - if(max_price<plusCard[ih].CardFee){  
121 - max_price=plusCard[ih].CardFee;  
122 - name='card'+plusCard[ih]['CorrPrice'];  
123 - show_card=plusCard[ih];  
124 - }  
125 - }  
126 - }  
127 -  
128 - if(show_card){  
129 - name=name.toLowerCase();  
130 - th.setData({card_name:name,show_card:show_card})  
131 - }  
132 - }  
133 - //-----先获取物流,再获取用户信息,再展示页面-----  
134 - th.get_wuliu(th.get_info(th.show_page));  
135 - })  
136 - }else{  
137 - //-----先获取物流,再获取用户信息,再展示页面-----  
138 - th.get_wuliu(th.get_info(th.show_page));  
139 - }  
140 - },1);  
141 -  
142 - 91 +
  92 + //先获取是否有关闭使用优惠券
  93 + getApp().getConfig2(function (ee) {
  94 + var json_d = JSON.parse(ee.switch_list);
  95 + th.data.json_d = json_d;
  96 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  97 + var is_default_logistics = json_d.is_default_logistics;
  98 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  99 +
  100 + var rank_switch = json_d.rank_switch;
  101 + var max_price = -1;
  102 + var show_card = null;
  103 + var name = "";
  104 + //如果有开等级卡的时候,
  105 + //因为都是调接口,要返回在计算
  106 + if (rank_switch == 2) {
  107 + //-- 获取所有的等级卡, --
  108 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  109 + {}).then(res => {
  110 + if (res.data.code == 0) {
  111 + var plusCard = res.data.data;
  112 + //-- 循环判断,拿到最贵的那张卡 --
  113 + for (var ih in plusCard) {
  114 + if (plusCard[ih].IsStopBuy == true) { continue; }
  115 + if (max_price < 0) {
  116 + max_price = plusCard[ih].CardFee;
  117 + name = 'card' + plusCard[ih]['CorrPrice'];
  118 + show_card = plusCard[ih];
  119 + } else {
  120 + if (max_price < plusCard[ih].CardFee) {
  121 + max_price = plusCard[ih].CardFee;
  122 + name = 'card' + plusCard[ih]['CorrPrice'];
  123 + show_card = plusCard[ih];
  124 + }
  125 + }
  126 + }
  127 +
  128 + if (show_card) {
  129 + name = name.toLowerCase();
  130 + th.setData({ card_name: name, show_card: show_card })
  131 + }
  132 + }
  133 + //-----先获取物流,再获取用户信息,再展示页面-----
  134 + th.get_wuliu(th.get_info(th.show_page));
  135 + })
  136 + } else {
  137 + //-----先获取物流,再获取用户信息,再展示页面-----
  138 + th.get_wuliu(th.get_info(th.show_page));
  139 + }
  140 + }, 1);
  141 +
  142 +
143 }, 143 },
144 - onUnload: function () { this.setData({ isclose: 1 })}, 144 + onUnload: function () { this.setData({ isclose: 1 }) },
145 onHide: function () { 145 onHide: function () {
146 - this.setData({  
147 - is_no_by:{},  
148 - is_by:{}  
149 - }) 146 + this.setData({
  147 + is_no_by: {},
  148 + is_by: {}
  149 + })
150 }, 150 },
151 151
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 - onShow: function() {  
154 - var th=this;  
155 - th.data.g_cart_q_time=null;  
156 -  
157 - if (th.data.isclose==0){ 153 + onShow: function () {
  154 + var th = this;
  155 + th.data.g_cart_q_time = null;
  156 +
  157 + if (th.data.isclose == 0) {
158 wx.navigateTo({ 158 wx.navigateTo({
159 url: "/pages/index/index/index" 159 url: "/pages/index/index/index"
160 }) 160 })
161 161
162 - }else{  
163 - this.getuser_addr(function(ie){  
164 - /*--  
165 - //地址切换要把包邮券清空  
166 - if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){  
167 - var using_quan=th.data.using_quan;  
168 - for(var i in using_quan){  
169 - var item=using_quan[i];  
170 - if(item.isby==1){  
171 - var ob={},txt="using_quan["+i+"]";ob[txt]={};  
172 - th.setData(ob);  
173 - } 162 + } else {
  163 + this.getuser_addr(function (ie) {
  164 + /*--
  165 + //地址切换要把包邮券清空
  166 + if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){
  167 + var using_quan=th.data.using_quan;
  168 + for(var i in using_quan){
  169 + var item=using_quan[i];
  170 + if(item.isby==1){
  171 + var ob={},txt="using_quan["+i+"]";ob[txt]={};
  172 + th.setData(ob);
  173 + }
  174 + }
  175 +
  176 + }--*/
  177 +
  178 + //th.data.prom_goods_map={};
  179 + //更换地址回来要重新调用计算价钱的接口
  180 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  181 + th.setData({ user_addr: ie, show_submit: 0 });
  182 + if (th.data.is_b_now == 1) {
  183 + if (th.data.bn_goods) {
  184 + th.setData({ add_back: 1 });
  185 + th.calculatePrice2();
174 } 186 }
175 -  
176 - }--*/  
177 -  
178 - //th.data.prom_goods_map={};  
179 - //更换地址回来要重新调用计算价钱的接口  
180 - if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){  
181 - th.setData({user_addr: ie,show_submit:0 });  
182 - if (th.data.is_b_now == 1) {  
183 - if(th.data.bn_goods) {  
184 - th.setData({add_back:1});  
185 - th.calculatePrice2();  
186 - }  
187 - }  
188 - }else{  
189 - th.setData({user_addr: ie });  
190 - }  
191 - var going=0;  
192 -  
193 - });  
194 - //--更新默认地址--,看一下是不是跳到地址页面  
195 - if(!getApp().globalData.is_cart_old){  
196 - this.update_code();  
197 - }else{  
198 - getApp().globalData.is_cart_old=0; 187 + }
  188 + } else {
  189 + th.setData({ user_addr: ie });
199 } 190 }
  191 + var going = 0;
  192 +
  193 + });
  194 + //--更新默认地址--,看一下是不是跳到地址页面
  195 + if (!getApp().globalData.is_cart_old) {
  196 + this.update_code();
  197 + } else {
  198 + getApp().globalData.is_cart_old = 0;
  199 + }
200 } 200 }
201 - 201 +
202 }, 202 },
203 203
204 //-------------------获取物流--------------- 204 //-------------------获取物流---------------
205 get_wuliu(func) { 205 get_wuliu(func) {
206 var th = this; 206 var th = this;
207 to.getwuliu(function (e) { 207 to.getwuliu(function (e) {
208 - if(th.data.is_default_logistics){  
209 - //如果第一个不是开启默认,说明要让用户自己选  
210 - if(!e[0].is_default){  
211 - th.setData({is_default_logistics:0});  
212 - }  
213 - }  
214 - th.setData({ wu_arr: e })  
215 - typeof func == "function" && func(); 208 + if (th.data.is_default_logistics) {
  209 + //如果第一个不是开启默认,说明要让用户自己选
  210 + if (!e[0].is_default) {
  211 + th.setData({ is_default_logistics: 0 });
  212 + }
  213 + }
  214 + th.setData({ wu_arr: e })
  215 + typeof func == "function" && func();
216 }) 216 })
217 }, 217 },
218 //------获取会员信息-----先获取用户信息,在进行下一步--- 218 //------获取会员信息-----先获取用户信息,在进行下一步---
219 - get_info:function(func){ 219 + get_info: function (func) {
220 var user_id = t.globalData.user_id; 220 var user_id = t.globalData.user_id;
221 to.auth.get_u(func); 221 to.auth.get_u(func);
222 }, 222 },
223 223
224 //------获取会员收货地址----- 224 //------获取会员收货地址-----
225 - getuser_addr:function(func){  
226 - var th=this;  
227 - a.get("/api/weshop/useraddress/page", {  
228 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600,t:Math.random()},  
229 - success: function (su) {  
230 -  
231 - var item = null;  
232 - if(su.data.code==0 && su.data.data && su.data.data.pageData){  
233 - var user_addr = su.data.data.pageData;  
234 - var def_item=null;  
235 - for (var i = 0; i < user_addr.length; i++) {  
236 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];}  
237 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
238 - }  
239 -  
240 - if (item == null) item = def_item;  
241 - if (item == null) item = user_addr[0];  
242 - }  
243 -  
244 - if(item==undefined) item=null;  
245 - if(!item) th.setData({user_addr:null}); //地址为空的时候,要清空,因为返回的时候,有缓存  
246 - func(item); 225 + getuser_addr: function (func) {
  226 + var th = this;
  227 + a.get("/api/weshop/useraddress/page", {
  228 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
  229 + success: function (su) {
  230 +
  231 + var item = null;
  232 + if (su.data.code == 0 && su.data.data && su.data.data.pageData) {
  233 + var user_addr = su.data.data.pageData;
  234 + var def_item = null;
  235 + for (var i = 0; i < user_addr.length; i++) {
  236 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  237 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  238 + }
  239 +
  240 + if (item == null) item = def_item;
  241 + if (item == null) item = user_addr[0];
247 } 242 }
248 - }); 243 +
  244 + if (item == undefined) item = null;
  245 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
  246 + func(item);
  247 + }
  248 + });
249 }, 249 },
250 - 250 +
251 //----------------展示页面,是再获取用户信息之后-------------- 251 //----------------展示页面,是再获取用户信息之后--------------
252 - show_page:function(){  
253 - var th=this,ta = this.data.param; 252 + show_page: function () {
  253 + var th = this, ta = this.data.param;
254 //th.setData({ userinfo: getApp().globalData.userInfo,}); 254 //th.setData({ userinfo: getApp().globalData.userInfo,});
255 -  
256 - var user=getApp().globalData.userInfo;  
257 - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {  
258 - data:{r:Math.random()},  
259 - success: function (e) {  
260 -  
261 - getApp().globalData.userInfo = e.data.data;  
262 - th.setData({userinfo:e.data.data});  
263 -  
264 - //选获取地址  
265 - th.getuser_addr(function(addr){  
266 - th.setData({user_addr: addr});  
267 - //--------------------------立即购买------------------  
268 - if(ta.is_bnow== 1){  
269 - //读取门店  
270 - to.get_allsto(function (e) {  
271 - th.setData({ allsto: e });  
272 - //获取立即购买的商品信息  
273 - th.get_buy_goods(ta.goods_id);  
274 - });  
275 - }  
276 - });  
277 - //获取提现金额  
278 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
279 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
280 - success: function (su) {  
281 - if (su.data.code == 0) {  
282 - var yuer = parseFloat(th.data.userinfo.user_money -  
283 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
284 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
285 - }  
286 - }  
287 - });  
288 -  
289 - },  
290 - })  
291 -  
292 - 255 +
  256 + var user = getApp().globalData.userInfo;
  257 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  258 + data: { r: Math.random() },
  259 + success: function (e) {
  260 +
  261 + getApp().globalData.userInfo = e.data.data;
  262 + th.setData({ userinfo: e.data.data });
  263 +
  264 + //选获取地址
  265 + th.getuser_addr(function (addr) {
  266 + th.setData({ user_addr: addr });
  267 + //--------------------------立即购买------------------
  268 + if (ta.is_bnow == 1) {
  269 + //读取门店
  270 + to.get_allsto(function (e) {
  271 + th.setData({ allsto: e });
  272 + //获取立即购买的商品信息
  273 + th.get_buy_goods(ta.goods_id);
  274 + });
  275 + }
  276 + });
  277 + //获取提现金额
  278 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  279 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  280 + success: function (su) {
  281 + if (su.data.code == 0) {
  282 + var yuer = parseFloat(th.data.userinfo.user_money -
  283 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  284 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  285 + }
  286 + }
  287 + });
  288 +
  289 + },
  290 + })
  291 +
  292 +
293 }, 293 },
294 - 294 +
295 //-----获取立即购买的商品信息,入口---- 295 //-----获取立即购买的商品信息,入口----
296 - get_buy_goods: function (e){  
297 - var th=this; 296 + get_buy_goods: function (e) {
  297 + var th = this;
298 var gg = to.get_b_now(); 298 var gg = to.get_b_now();
299 //--------如果goods_id一样,就是要立即购买----- 299 //--------如果goods_id一样,就是要立即购买-----
300 - if(e==gg.goods_id){  
301 - a.get("/api/weshop/goods/get/" + oo.stoid+"/"+e, {  
302 - success:async function (t) { 300 + if (e == gg.goods_id) {
  301 + a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, {
  302 + success: async function (t) {
303 var gd = t.data.data; 303 var gd = t.data.data;
304 - if(!gd) return false; 304 + if (!gd) return false;
305 305
306 t.data.data.original_img = oo.imghost + t.data.data.original_img; 306 t.data.data.original_img = oo.imghost + t.data.data.original_img;
307 t.data.data['buynum'] = gg.goods_num; 307 t.data.data['buynum'] = gg.goods_num;
308 - var distr_t=0,et=0  
309 - if (t.data.data.distr_type==0){ 308 + var distr_t = 0, et = 0
  309 + if (t.data.data.distr_type == 0) {
310 distr_t = gg.pick_dis; 310 distr_t = gg.pick_dis;
311 - }else{ 311 + } else {
312 distr_t = t.data.data.distr_type; 312 distr_t = t.data.data.distr_type;
313 } 313 }
314 - switch (distr_t){ 314 + switch (distr_t) {
315 case 0: 315 case 0:
316 - et=1;  
317 - //-- 系统后台有设置要默认的 --  
318 - if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) et=0;  
319 - break; 316 + et = 1;
  317 + //-- 系统后台有设置要默认的 --
  318 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  319 + break;
320 case 1: et = 1; break; 320 case 1: et = 1; break;
321 case 2: et = 0; break; 321 case 2: et = 0; break;
322 } 322 }
323 -  
324 - if(th.data.bn_goods) et=th.data.bn_exp_type  
325 -  
326 - var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
327 - if(et==0 && def_exp_code){  
328 - for(var k=0;k<th.data.wu_arr.length;k++){  
329 - var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; }  
330 - } 323 +
  324 + if (th.data.bn_goods) et = th.data.bn_exp_type
  325 +
  326 + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  327 + if (et == 0 && def_exp_code) {
  328 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  329 + var item = th.data.wu_arr[k]; if (def_exp_code == item.code) { m_wind = k; }
  330 + }
331 } 331 }
332 -  
333 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
334 - var is_card_back=getApp().globalData.is_card_back;  
335 - if(is_card_back){  
336 - th.data.card_name=th.data.userinfo.card_field;  
337 - gg.goods_price=gd[th.data.card_name];  
338 - getApp().globalData.is_card_back=0;  
339 - th.setData({card_cut_price:0});  
340 - //如果是秒杀的返回  
341 - if(gd.prom_type==4) gd.prom_type=0;  
342 - }else{  
343 - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
344 - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --  
345 - if(!gg.collocation_goods && gd['prom_type']!=6 && th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){  
346 - var cut_p= (gg.goods_price-gd[th.data.card_name])*gg.goods_num;  
347 - th.setData({card_cut_price:cut_p});  
348 - }  
349 - }  
350 -  
351 - switch (gd.prom_type){ 332 +
  333 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  334 + var is_card_back = getApp().globalData.is_card_back;
  335 + if (is_card_back) {
  336 + th.data.card_name = th.data.userinfo.card_field;
  337 + gg.goods_price = gd[th.data.card_name];
  338 + getApp().globalData.is_card_back = 0;
  339 + th.setData({ card_cut_price: 0 });
  340 + //如果是秒杀的返回
  341 + if (gd.prom_type == 4) gd.prom_type = 0;
  342 + } else {
  343 + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  344 + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
  345 + if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  346 + var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num;
  347 + th.setData({ card_cut_price: cut_p });
  348 + }
  349 + }
  350 +
  351 + switch (gd.prom_type) {
352 case 0: 352 case 0:
353 case 2: 353 case 2:
354 case 3: 354 case 3:
355 case 5: 355 case 5:
356 case 6: 356 case 6:
357 - getApp().my_warnning("商品不是积分活动",0,th);  
358 - wx.navigateBack();  
359 - break; 357 + getApp().my_warnning("商品不是积分活动", 0, th);
  358 + wx.navigateBack();
  359 + break;
360 case 4: //-- 积分购 -- 360 case 4: //-- 积分购 --
361 - getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
362 - data:{store_id:os.stoid,goods_id:gg.goods_id}, 361 + getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  362 + data: { store_id: os.stoid, goods_id: gg.goods_id },
363 success: async function (tt) { 363 success: async function (tt) {
364 - if(tt.data.code==0 && tt.data.data && tt.data.data.pageData){  
365 - var inte_data=tt.data.data.pageData[0];  
366 - t.data.data.shop_price=inte_data.addmoney;  
367 - t.data.data.integral=inte_data.integral;  
368 - th.setData({  
369 - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,  
370 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type: et  
371 - });  
372 - //计算价格  
373 - th.calculatePrice2();  
374 - }else{  
375 - getApp().my_warnning("商品不是积分活动",0,th);  
376 - wx.navigateBack();  
377 - } 364 + if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) {
  365 + var inte_data = tt.data.data.pageData[0];
  366 + t.data.data.shop_price = inte_data.addmoney;
  367 + t.data.data.integral = inte_data.integral;
  368 + th.setData({
  369 + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind,
  370 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
  371 + });
  372 + //计算价格
  373 + th.calculatePrice2();
  374 + } else {
  375 + getApp().my_warnning("商品不是积分活动", 0, th);
  376 + wx.navigateBack();
  377 + }
378 } 378 }
379 }); 379 });
380 break; 380 break;
@@ -385,34 +385,34 @@ Page({ @@ -385,34 +385,34 @@ Page({
385 }, 385 },
386 386
387 //---------------检查是否有收货地址------------------- 387 //---------------检查是否有收货地址-------------------
388 - checkAddressList: function() { 388 + checkAddressList: function () {
389 var t = this; 389 var t = this;
390 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 390 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
391 title: "请先填写或选择收货地址~", 391 title: "请先填写或选择收货地址~",
392 - success: function(a) { 392 + success: function (a) {
393 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 393 a.confirm ? t.enterAddressPage() : wx.navigateBack();
394 }, 394 },
395 - fail: function() { 395 + fail: function () {
396 wx.navigateBack(); 396 wx.navigateBack();
397 } 397 }
398 }), !1); 398 }), !1);
399 }, 399 },
400 - showInvoice: function() { 400 + showInvoice: function () {
401 this.setData({ 401 this.setData({
402 invoiceToggle: !this.data.invoiceToggle 402 invoiceToggle: !this.data.invoiceToggle
403 }); 403 });
404 }, 404 },
405 - keyUpChangePay1: function(t) { 405 + keyUpChangePay1: function (t) {
406 this.setData({ 406 this.setData({
407 payWithUserMoney: !(t.detail.value.length > 0) 407 payWithUserMoney: !(t.detail.value.length > 0)
408 }); 408 });
409 }, 409 },
410 - keyUpChangePay2: function(t) { 410 + keyUpChangePay2: function (t) {
411 this.setData({ 411 this.setData({
412 payWithPoints: !(t.detail.value.length > 0) 412 payWithPoints: !(t.detail.value.length > 0)
413 }); 413 });
414 }, 414 },
415 - keyUpChangeNum: function(t) { 415 + keyUpChangeNum: function (t) {
416 this.setData({ 416 this.setData({
417 maxWord: t.detail.value.length 417 maxWord: t.detail.value.length
418 }); 418 });
@@ -421,30 +421,33 @@ Page({ @@ -421,30 +421,33 @@ Page({
421 421
422 //---------计算立即购买---------- 422 //---------计算立即购买----------
423 calculatePrice2: function () { 423 calculatePrice2: function () {
424 - var th = this, good = this.data.bn_goods;  
425 - wx.showLoading({ title:"处理中.",}) 424 + var th = this, good = this.data.bn_goods;
  425 + wx.showLoading({ title: "处理中.", })
426 //-----------计算商品总价-------------- 426 //-----------计算商品总价--------------
427 var allpice = good.shop_price * good.buynum; 427 var allpice = good.shop_price * good.buynum;
428 - var all_integral=good.integral * good.buynum;  
429 -  
430 - var cut_price=0;  
431 - if(good.prom_type==3 && good.prom_price!==null){  
432 - cut_price=allpice-good.prom_price; 428 + var all_integral = good.integral * good.buynum;
  429 +
  430 + var cut_price = 0;
  431 + if (good.prom_type == 3 && good.prom_price !== null) {
  432 + cut_price = allpice - good.prom_price;
433 } 433 }
434 - allpice=parseFloat(allpice).toFixed(2); 434 + allpice = parseFloat(allpice).toFixed(2);
435 var txt = "formData.all_price"; 435 var txt = "formData.all_price";
436 th.setData({ [txt]: allpice, }); 436 th.setData({ [txt]: allpice, });
437 - if(cut_price){  
438 - var c_txt="formData.cut_price"; 437 + if (cut_price) {
  438 + var c_txt = "formData.cut_price";
439 th.setData({ [c_txt]: cut_price, }); 439 th.setData({ [c_txt]: cut_price, });
440 } 440 }
441 to.getConfig2(function (ee) { 441 to.getConfig2(function (ee) {
442 to.getwuliuprice(async function (rs) { 442 to.getwuliuprice(async function (rs) {
443 443
444 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 444 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  445 + var out_of_weight = null; //超出多少重量
  446 + var freight_free = ee.freight_free; //全场满多少包邮
  447 + var weight_free = ee.weight_free; //多少kg内包邮
445 //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- 448 //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮----------
446 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){  
447 - 449 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) {
  450 +
448 switch (good['exp_sum_type']) { 451 switch (good['exp_sum_type']) {
449 case 1: 452 case 1:
450 //统一运费 453 //统一运费
@@ -452,100 +455,105 @@ Page({ @@ -452,100 +455,105 @@ Page({
452 case 2: 455 case 2:
453 if (goods_weight < 0) goods_weight = 0; 456 if (goods_weight < 0) goods_weight = 0;
454 //累积商品重量 每种商品的重量 * 数量 457 //累积商品重量 每种商品的重量 * 数量
455 - goods_weight += good['weight'] * good['buynum'];break; 458 + goods_weight += good['weight'] * good['buynum'];
  459 + if (weight_free > 0) {
  460 + out_of_weight = (weight_free * 1000) - goods_weight;
  461 + }
  462 + break;
456 case 3: 463 case 3:
457 if (goods_piece < 0) goods_piece = 0; 464 if (goods_piece < 0) goods_piece = 0;
458 //累积商品数量 465 //累积商品数量
459 goods_piece += good['buynum']; break; 466 goods_piece += good['buynum']; break;
460 } 467 }
461 468
462 - var code ="";  
463 - if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code;  
464 - var freight_free = ee.freight_free; //全场满多少包邮  
465 - var no_ex_id=ee.no_ex_id;  
466 - th.data.is_no_by[th.data.bn_pick]=0;  
467 -  
468 - var no_by_data=null;  
469 - var gift_freight_free=freight_free;  
470 - //有不包邮区域,且不免运费  
471 - if(no_ex_id && freight_free>0 && freight_free<=allpice-cut_price){  
472 - //-----------获取不包邮区域,不包邮商品-------  
473 - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{  
474 - data:{store_id:os.stoid,id:no_ex_id}  
475 - }).then(res=>{  
476 - if(res.data.code==0){  
477 - no_by_data=res.data.data[0];  
478 - //如果有设置不包邮区域的时候  
479 - if(res.data.data[0].region_list){  
480 - if(th.check_by_area(res.data.data[0].region_list)){  
481 - freight_free=0;  
482 - th.data.is_no_by[th.data.bn_pick]=1;  
483 - }  
484 - }  
485 - //如果有设置不包邮商品  
486 - if(res.data.data[0].goods_list && freight_free){  
487 - if(th.check_by_goods(res.data.data[0].goods_list)){  
488 - freight_free=0;  
489 - th.data.is_no_by[th.data.bn_pick]=1;  
490 - }  
491 - }  
492 - }  
493 - })  
494 - }  
495 -  
496 - th.data.is_by[th.data.bn_pick]=0;  
497 - //--------------开始计算物流------------------  
498 - var shipping_price=  
499 - th.calculatewuliu(code, o_shipping_price, goods_weight,  
500 - goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs);  
501 - if(shipping_price<=0){  
502 - th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 469 + var code = "";
  470 + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
  471 + var no_ex_id = ee.no_ex_id;
  472 + th.data.is_no_by[th.data.bn_pick] = 0;
  473 + var no_by_data = null;
  474 + var gift_freight_free = freight_free;
  475 + //有不包邮区域,且不免运费
  476 + if (no_ex_id && freight_free > 0 && freight_free <= allpice - cut_price) {
  477 + //-----------获取不包邮区域,不包邮商品-------
  478 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
  479 + data: { store_id: os.stoid, id: no_ex_id }
  480 + }).then(res => {
  481 + if (res.data.code == 0) {
  482 + no_by_data = res.data.data[0];
  483 + //如果有设置不包邮区域的时候
  484 + if (res.data.data[0].region_list) {
  485 + if (th.check_by_area(res.data.data[0].region_list)) {
  486 + freight_free = 0;
  487 + out_of_weight = 0;
  488 + weight_free = -1;
  489 + th.data.is_no_by[th.data.bn_pick] = 1;
  490 + }
  491 + }
  492 + //如果有设置不包邮商品
  493 + if (res.data.data[0].goods_list && freight_free) {
  494 + if (th.check_by_goods(res.data.data[0].goods_list)) {
  495 + freight_free = 0;
  496 + out_of_weight = 0;
  497 + weight_free = -1;
  498 + th.data.is_no_by[th.data.bn_pick] = 1;
  499 + }
  500 + }
  501 + }
  502 + })
  503 + }
  504 +
  505 + //--------------开始计算物流------------------
  506 + var shipping_price =
  507 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  508 + goods_piece, th.data.user_addr, freight_free, allpice - cut_price, rs, th.data.bn_pick);
  509 + if (shipping_price <= 0) {
  510 + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
503 } 511 }
504 512
505 shipping_price = parseFloat(shipping_price).toFixed(2); 513 shipping_price = parseFloat(shipping_price).toFixed(2);
506 var wl_txt = "formData.shipping_price"; 514 var wl_txt = "formData.shipping_price";
507 th.setData({ [wl_txt]: shipping_price, }) 515 th.setData({ [wl_txt]: shipping_price, })
508 -  
509 - }else{ 516 +
  517 + } else {
510 var wl_txt = "formData.shipping_price"; 518 var wl_txt = "formData.shipping_price";
511 th.setData({ [wl_txt]: 0, }) 519 th.setData({ [wl_txt]: 0, })
512 } 520 }
513 //---如果有选择优惠券的情况下--- 521 //---如果有选择优惠券的情况下---
514 - var quan_price=0,bn_pick=th.data.bn_pick;  
515 -  
516 - //-----------------支付价,优惠券不减物流----------------- 522 + var quan_price = 0, bn_pick = th.data.bn_pick;
  523 +
  524 + //-----------------支付价,优惠券不减物流-----------------
517 var total_m = (parseFloat(allpice)).toFixed(2); 525 var total_m = (parseFloat(allpice)).toFixed(2);
518 - var order_m = (parseFloat(allpice-cut_price)-quan_price).toFixed(2);  
519 - var coupon_price=quan_price; //优惠券优惠了多少钱  
520 - if(order_m<0) {  
521 - order_m=0;coupon_price=parseFloat(order_m).toFixed(2); 526 + var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2);
  527 + var coupon_price = quan_price; //优惠券优惠了多少钱
  528 + if (order_m < 0) {
  529 + order_m = 0; coupon_price = parseFloat(order_m).toFixed(2);
522 } 530 }
523 -  
524 - //--看一下有没有订单优惠--  
525 - total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);  
526 - order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);  
527 - var atxt= "formData.total_amount";  
528 - th.setData({ [atxt]: total_m, })  
529 -  
530 - var txt = "formData.user_money";  
531 - var txt2 = "formData.order_amount";  
532 - var txt4="formData.integral";  
533 -  
534 - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);  
535 - //--------------如果使用余额---------------------  
536 - if (th.data.bn_use_money == 1) {  
537 - if (amoney> order_m) {  
538 - order_m = order_m.toFixed(2);  
539 - th.setData({ [txt]: order_m, [txt2]:0,[txt4]:all_integral,show_submit:1 })  
540 - }else{  
541 - order_m =parseFloat(order_m - amoney);  
542 - order_m = order_m.toFixed(2);  
543 - th.setData({ [txt]: amoney, [txt2]: order_m,[txt4]:all_integral,show_submit:1 })  
544 - }  
545 - }else{  
546 - th.setData({ [txt]: 0, [txt2]: order_m,[txt4]:all_integral, show_submit:1 })  
547 - }  
548 - 531 +
  532 + //--看一下有没有订单优惠--0
  533 + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
  534 + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
  535 + var atxt = "formData.total_amount";
  536 + th.setData({ [atxt]: total_m, })
  537 +
  538 + var txt = "formData.user_money";
  539 + var txt2 = "formData.order_amount";
  540 + var txt4 = "formData.integral";
  541 +
  542 + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
  543 + //--------------如果使用余额---------------------
  544 + if (th.data.bn_use_money == 1) {
  545 + if (amoney > order_m) {
  546 + order_m = order_m.toFixed(2);
  547 + th.setData({ [txt]: order_m, [txt2]: 0, [txt4]: all_integral, show_submit: 1 })
  548 + } else {
  549 + order_m = parseFloat(order_m - amoney);
  550 + order_m = order_m.toFixed(2);
  551 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt4]: all_integral, show_submit: 1 })
  552 + }
  553 + } else {
  554 + th.setData({ [txt]: 0, [txt2]: order_m, [txt4]: all_integral, show_submit: 1 })
  555 + }
  556 +
549 wx.hideLoading(); 557 wx.hideLoading();
550 558
551 }); 559 });
@@ -553,104 +561,104 @@ Page({ @@ -553,104 +561,104 @@ Page({
553 }, 561 },
554 562
555 //--------------------提交订单----------------------- 563 //--------------------提交订单-----------------------
556 - async submitForm(t){  
557 - var sub_value=t; 564 + async submitForm(t) {
  565 + var sub_value = t;
558 566
559 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
560 - this.data.is_summit_ing=1;  
561 - var th=this,pdata=new Array();  
562 - var ff=true; 567 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  568 + this.data.is_summit_ing = 1;
  569 + var th = this, pdata = new Array();
  570 + var ff = true;
563 //------------立即购买------------- 571 //------------立即购买-------------
564 - if (th.data.is_b_now==1 && th.data.bn_goods.prom_type!=5){ 572 + if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
565 573
566 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){  
567 - ff = false; getApp().my_warnning("请选择收货地址",0,th);  
568 - th.data.is_summit_ing = 0; 574 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
  575 + ff = false; getApp().my_warnning("请选择收货地址", 0, th);
  576 + th.data.is_summit_ing = 0;
569 } 577 }
570 if (!ff) return false; 578 if (!ff) return false;
571 var addr = th.data.user_addr; 579 var addr = th.data.user_addr;
572 - if (th.data.bn_exp_type == 1) addr=null; 580 + if (th.data.bn_exp_type == 1) addr = null;
573 581
574 - if(th.data.bn_exp_type==0)  
575 - if(th.data.wu_arr==null || th.data.wu_arr.length<=0){  
576 - getApp().my_warnning("读取物流失败",0,th);  
577 - th.data.is_summit_ing = 0; 582 + if (th.data.bn_exp_type == 0)
  583 + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
  584 + getApp().my_warnning("读取物流失败", 0, th);
  585 + th.data.is_summit_ing = 0;
578 return false; 586 return false;
579 } 587 }
580 -  
581 -  
582 - var integrals=0;  
583 - var get_datas= {  
584 - user_id:getApp().globalData.user_id, store_id:o.stoid,  
585 - };  
586 - await getApp().request.promiseGet("/api/weshop/users/getAllPoints", {  
587 - data: get_datas  
588 - }).then(res => {  
589 - if(res.data.code==0){  
590 - integrals=res.data.data.Integral;  
591 - }  
592 - })  
593 -  
594 - //判断积分的情况  
595 - if(th.data.formData.integral && parseFloat(th.data.formData.integral)< parseFloat(integrals) ){  
596 - getApp().my_warnning("积分不足",0,th);  
597 - th.data.is_summit_ing = 0;  
598 - return false;  
599 - }  
600 -  
601 -  
602 - var item={ 588 +
  589 +
  590 + var integrals = 0;
  591 + var get_datas = {
  592 + user_id: getApp().globalData.user_id, store_id: o.stoid,
  593 + };
  594 + await getApp().request.promiseGet("/api/weshop/users/getAllPoints", {
  595 + data: get_datas
  596 + }).then(res => {
  597 + if (res.data.code == 0) {
  598 + integrals = res.data.data.Integral;
  599 + }
  600 + })
  601 +
  602 + //判断积分的情况
  603 + if (th.data.formData.integral && parseFloat(th.data.formData.integral) < parseFloat(integrals)) {
  604 + getApp().my_warnning("积分不足", 0, th);
  605 + th.data.is_summit_ing = 0;
  606 + return false;
  607 + }
  608 +
  609 +
  610 + var item = {
603 'user_id': to.globalData.user_id, 611 'user_id': to.globalData.user_id,
604 'consignee': addr == null ? "" : addr.consignee, 612 'consignee': addr == null ? "" : addr.consignee,
605 'province': addr == null ? 0 : addr.province, 613 'province': addr == null ? 0 : addr.province,
606 'city': addr == null ? 0 : addr.city, 614 'city': addr == null ? 0 : addr.city,
607 'district': addr == null ? 0 : addr.district, 615 'district': addr == null ? 0 : addr.district,
608 'twon': addr == null ? 0 : addr.twon, 616 'twon': addr == null ? 0 : addr.twon,
609 - 'address': addr == null ? "": addr.address, 617 + 'address': addr == null ? "" : addr.address,
610 'more_address': addr == null ? "" : addr.more_address, 618 'more_address': addr == null ? "" : addr.more_address,
611 //'mobile': th.data.userinfo.mobile, 619 //'mobile': th.data.userinfo.mobile,
612 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, 620 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
613 - 'email':'', 621 + 'email': '',
614 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, 622 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code,
615 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, 623 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name,
616 - 'invoice_title':'', 624 + 'invoice_title': '',
617 'goods_price': th.data.formData.all_price, //商品总价 625 'goods_price': th.data.formData.all_price, //商品总价
618 'shipping_price': th.data.formData.shipping_price, //物流金额 626 'shipping_price': th.data.formData.shipping_price, //物流金额
619 'user_money': th.data.formData.user_money, //使用余额 627 'user_money': th.data.formData.user_money, //使用余额
620 'total_amount': th.data.formData.total_amount, //订单总价 628 'total_amount': th.data.formData.total_amount, //订单总价
621 'order_amount': th.data.formData.order_amount, //应付 629 'order_amount': th.data.formData.order_amount, //应付
622 'user_note': t.detail.value.user_note, //用户备注 630 'user_note': t.detail.value.user_note, //用户备注
623 - 'store_id':oo.stoid, //商家 631 + 'store_id': oo.stoid, //商家
624 'pickup_id': th.data.bn_pick, //门店 632 'pickup_id': th.data.bn_pick, //门店
625 'exp_type': th.data.bn_exp_type, //配送方式 633 'exp_type': th.data.bn_exp_type, //配送方式
626 - 'order_goods':new Array(),  
627 - 'integral': th.data.formData.integral, 634 + 'order_goods': new Array(),
  635 + 'integral': th.data.formData.integral,
628 }; 636 };
629 //是不是重新提交 637 //是不是重新提交
630 - if(th.data.is_continue==1) item.is_continue=1; 638 + if (th.data.is_continue == 1) item.is_continue = 1;
631 639
632 //获取立即购买的商品的信息 640 //获取立即购买的商品的信息
633 var gg = to.get_b_now(); 641 var gg = to.get_b_now();
634 //--商品的房间号-- 642 //--商品的房间号--
635 - if(gg.room_id && gg.room_id>0){  
636 - item.room_ids=gg.room_id; 643 + if (gg.room_id && gg.room_id > 0) {
  644 + item.room_ids = gg.room_id;
  645 + }
  646 +
  647 + //老会员成为分销下线需要的参数
  648 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
  649 + //判断一下分享人是不是分享商
  650 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  651 + if (res.data.code == 0) {
  652 + var user = res.data.data;
  653 + if (user.is_distribut == 1) {
  654 + item.first_leader = parseInt(getApp().globalData.first_leader);
  655 + }
  656 + }
  657 + })
637 } 658 }
638 -  
639 - //老会员成为分销下线需要的参数  
640 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){  
641 - //判断一下分享人是不是分享商  
642 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
643 - if(res.data.code==0){  
644 - var user= res.data.data;  
645 - if(user.is_distribut==1){  
646 - item.first_leader=parseInt(getApp().globalData.first_leader);  
647 - }  
648 - }  
649 - })  
650 - }  
651 -  
652 -  
653 - var goods={ 659 +
  660 +
  661 + var goods = {
654 'goods_id': gg.goods_id, 662 'goods_id': gg.goods_id,
655 'goods_name': gg.goods_name, 663 'goods_name': gg.goods_name,
656 'goods_sn': gg.goods_sn, 664 'goods_sn': gg.goods_sn,
@@ -659,37 +667,37 @@ Page({ @@ -659,37 +667,37 @@ Page({
659 'goods_price': th.data.bn_goods.shop_price, 667 'goods_price': th.data.bn_goods.shop_price,
660 'member_goods_price': th.data.bn_goods.shop_price, 668 'member_goods_price': th.data.bn_goods.shop_price,
661 'store_id': oo.stoid, 669 'store_id': oo.stoid,
662 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 670 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
663 'prom_id': th.data.bn_goods.prom_id, //促销活动id 671 'prom_id': th.data.bn_goods.prom_id, //促销活动id
664 }; 672 };
665 673
666 //-- 把导购的信息填入-- 674 //-- 把导购的信息填入--
667 - if(gg.guide_id){  
668 - goods.guide_id=gg.guide_id;  
669 - goods.guide_type=gg.guide_type;  
670 - //调用接口判断是不是会员  
671 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{  
672 - if(res.data.code==0){  
673 - goods.guide_name=res.data.data.salesman;  
674 - goods.guide_sn=res.data.data.salesman_no;  
675 - }  
676 - }) 675 + if (gg.guide_id) {
  676 + goods.guide_id = gg.guide_id;
  677 + goods.guide_type = gg.guide_type;
  678 + //调用接口判断是不是会员
  679 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  680 + if (res.data.code == 0) {
  681 + goods.guide_name = res.data.data.salesman;
  682 + goods.guide_sn = res.data.data.salesman_no;
  683 + }
  684 + })
677 } 685 }
678 686
679 //--商品的房间号-- 687 //--商品的房间号--
680 - if(gg.room_id && gg.room_id>0){  
681 - goods.room_id=gg.room_id; 688 + if (gg.room_id && gg.room_id > 0) {
  689 + goods.room_id = gg.room_id;
682 } 690 }
683 - 691 +
684 item.order_goods.push(goods); 692 item.order_goods.push(goods);
685 - pdata.push(item); 693 + pdata.push(item);
686 } 694 }
687 -  
688 695
689 - if (pdata.length==0) return; 696 +
  697 + if (pdata.length == 0) return;
690 var str = JSON.stringify(pdata); 698 var str = JSON.stringify(pdata);
691 -  
692 - wx.showLoading({title: "加载中"}); 699 +
  700 + wx.showLoading({ title: "加载中" });
693 wx.request({ 701 wx.request({
694 url: oo.url + '/api/weshop/order/createWxdOrder', 702 url: oo.url + '/api/weshop/order/createWxdOrder',
695 data: str, 703 data: str,
@@ -699,11 +707,11 @@ Page({ @@ -699,11 +707,11 @@ Page({
699 },// 设置请求的 header 707 },// 设置请求的 header
700 success: function (res) { 708 success: function (res) {
701 709
702 - th.data.is_summit_ing=0; //是否提交中 710 + th.data.is_summit_ing = 0; //是否提交中
703 wx.hideLoading(); 711 wx.hideLoading();
704 if (res.statusCode == 200) { 712 if (res.statusCode == 200) {
705 - var data=res.data;  
706 - if(data.code==0){ 713 + var data = res.data;
  714 + if (data.code == 0) {
707 console.log(th.data.is_b_now); 715 console.log(th.data.is_b_now);
708 //如果是购物车结算,还要删除购物车 716 //如果是购物车结算,还要删除购物车
709 if (th.data.is_b_now == 0) { 717 if (th.data.is_b_now == 0) {
@@ -724,20 +732,20 @@ Page({ @@ -724,20 +732,20 @@ Page({
724 //void e.jumpToCart4({ 732 //void e.jumpToCart4({
725 // order_sn: data.data, 733 // order_sn: data.data,
726 //}, 1); 734 //}, 1);
727 - util_pay.pay(data.data, function() {  
728 - //app.my_warnning("支付成功",1,th);  
729 - //setTimeout(function () {  
730 - wx.redirectTo({  
731 - url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data  
732 - })  
733 - //},1000)  
734 -  
735 - }, function () {  
736 - //支付失败  
737 - setTimeout(function () {  
738 - wx.navigateBack({ delta: 1 })  
739 - },1000)  
740 - },oo.stoid); 735 + util_pay.pay(data.data, function () {
  736 + //app.my_warnning("支付成功",1,th);
  737 + //setTimeout(function () {
  738 + wx.redirectTo({
  739 + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data
  740 + })
  741 + //},1000)
  742 +
  743 + }, function () {
  744 + //支付失败
  745 + setTimeout(function () {
  746 + wx.navigateBack({ delta: 1 })
  747 + }, 1000)
  748 + }, oo.stoid);
741 749
742 } else { 750 } else {
743 var dd = { 751 var dd = {
@@ -749,110 +757,110 @@ Page({ @@ -749,110 +757,110 @@ Page({
749 data: dd, 757 data: dd,
750 success: function (t) { 758 success: function (t) {
751 //console.log(t); 759 //console.log(t);
752 - if(t.data.code==0){  
753 - //app.my_warnning("支付成功",1,th);  
754 - //setTimeout(function () {  
755 - th.setData({ isclose: 0 });  
756 - wx.redirectTo({  
757 - url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data,  
758 - })  
759 - //}, 1000) 760 + if (t.data.code == 0) {
  761 + //app.my_warnning("支付成功",1,th);
  762 + //setTimeout(function () {
  763 + th.setData({ isclose: 0 });
  764 + wx.redirectTo({
  765 + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
  766 + })
  767 + //}, 1000)
760 } 768 }
761 }, 769 },
762 - fail:function () { 770 + fail: function () {
763 771
764 } 772 }
765 }); 773 });
766 } 774 }
767 775
768 } 776 }
769 - else{  
770 - //--内容换行--  
771 - var msg=data.msg;  
772 - //赠品活动已经取消,无法赠送,是否继续买单?  
773 - if(msg.indexOf("是否继续买单")>0){  
774 - wx.showModal({  
775 - title:"提示",  
776 - content: data.msg,  
777 - cancelText:'取消',  
778 - confirmText:'确定',  
779 - showCancel: true,  
780 - success(res){  
781 - if(res.cancel){  
782 - return;  
783 - }else if(res.confirm){  
784 - th.data.is_continue=1;  
785 - th.submitForm(sub_value);  
786 - }  
787 - }  
788 - })  
789 - return;  
790 - }  
791 - if(msg.length>13){  
792 - msg=msg.slice(0, 13) + "\r\n"+ msg.slice(13);  
793 - }  
794 - getApp().confirmBox(msg);  
795 - }  
796 - }else{  
797 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 777 + else {
  778 + //--内容换行--
  779 + var msg = data.msg;
  780 + //赠品活动已经取消,无法赠送,是否继续买单?
  781 + if (msg.indexOf("是否继续买单") > 0) {
  782 + wx.showModal({
  783 + title: "提示",
  784 + content: data.msg,
  785 + cancelText: '取消',
  786 + confirmText: '确定',
  787 + showCancel: true,
  788 + success(res) {
  789 + if (res.cancel) {
  790 + return;
  791 + } else if (res.confirm) {
  792 + th.data.is_continue = 1;
  793 + th.submitForm(sub_value);
  794 + }
  795 + }
  796 + })
  797 + return;
  798 + }
  799 + if (msg.length > 13) {
  800 + msg = msg.slice(0, 13) + "\r\n" + msg.slice(13);
  801 + }
  802 + getApp().confirmBox(msg);
  803 + }
  804 + } else {
  805 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
798 } 806 }
799 }, 807 },
800 fail: function () { 808 fail: function () {
801 - th.data.is_summit_ing=0; 809 + th.data.is_summit_ing = 0;
802 wx.hideLoading(); 810 wx.hideLoading();
803 console.log("index.js wx.request CheckCallUser fail"); 811 console.log("index.js wx.request CheckCallUser fail");
804 }, 812 },
805 - complete: function () {} 813 + complete: function () { }
806 }) 814 })
807 815
808 }, 816 },
809 - 817 +
810 //---确认线下门店的数量足不足--- 818 //---确认线下门店的数量足不足---
811 - async check_store_num(goods_id,pick,goods_num,func){  
812 - var lock=0,pick_no,plist,erpwareid;  
813 - //先读取门店的lock  
814 - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{  
815 - data:{store_id:os.stoid,wareId:goods_id,storageId:pick,pageSize:1000}  
816 - }).then(res=>{  
817 - if(res.data.code==0 && res.data.data.total>0){  
818 - for(var i in res.data.data.pageData)  
819 - lock+=res.data.data.pageData[i].outQty;  
820 - }  
821 - })  
822 - //先获取门店的编号  
823 - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+pick,{  
824 - data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:pick}  
825 - }).then(res=>{  
826 - if(res.data.code==0){  
827 - pick_no=res.data.data.pickup_no;  
828 - }  
829 - })  
830 - //先获取商品的线下库存  
831 - await getApp().request.promiseGet("/api/weshop/goods/get/"+os.stoid+"/"+goods_id,{  
832 - data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:pick}  
833 - }).then(res=>{  
834 - if(res.data.code==0){  
835 - erpwareid=res.data.data.erpwareid;  
836 - }  
837 - })  
838 - //读取线下的门店库存  
839 - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{  
840 - data:{storageNos:pick_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid}  
841 - }).then(res=>{  
842 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
843 - plist=res.data.data.pageData[0];  
844 - }  
845 - })  
846 - var isok=1;  
847 - if(goods_num>plist.CanOutQty-lock){  
848 - isok=0;  
849 - }  
850 - func(isok); 819 + async check_store_num(goods_id, pick, goods_num, func) {
  820 + var lock = 0, pick_no, plist, erpwareid;
  821 + //先读取门店的lock
  822 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
  823 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
  824 + }).then(res => {
  825 + if (res.data.code == 0 && res.data.data.total > 0) {
  826 + for (var i in res.data.data.pageData)
  827 + lock += res.data.data.pageData[i].outQty;
  828 + }
  829 + })
  830 + //先获取门店的编号
  831 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
  832 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
  833 + }).then(res => {
  834 + if (res.data.code == 0) {
  835 + pick_no = res.data.data.pickup_no;
  836 + }
  837 + })
  838 + //先获取商品的线下库存
  839 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
  840 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
  841 + }).then(res => {
  842 + if (res.data.code == 0) {
  843 + erpwareid = res.data.data.erpwareid;
  844 + }
  845 + })
  846 + //读取线下的门店库存
  847 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
  848 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid }
  849 + }).then(res => {
  850 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  851 + plist = res.data.data.pageData[0];
  852 + }
  853 + })
  854 + var isok = 1;
  855 + if (goods_num > plist.CanOutQty - lock) {
  856 + isok = 0;
  857 + }
  858 + func(isok);
851 }, 859 },
852 860
853 - useCoupon: function() { 861 + useCoupon: function () {
854 if (this.data.order.couponNum <= 0) { 862 if (this.data.order.couponNum <= 0) {
855 - getApp().my_warnning("无可用优惠券",0,this); 863 + getApp().my_warnning("无可用优惠券", 0, this);
856 return; 864 return;
857 } 865 }
858 866
@@ -863,86 +871,96 @@ Page({ @@ -863,86 +871,96 @@ Page({
863 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) 871 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
864 }); 872 });
865 }, 873 },
866 - enterAddressPage: function() {  
867 - getApp().globalData.is_cart_old=1;  
868 - this.data.isget_by_quan={}; 874 + enterAddressPage: function () {
  875 + getApp().globalData.is_cart_old = 1;
  876 + this.data.isget_by_quan = {};
869 this.data.enterAddressPage = !0, wx.navigateTo({ 877 this.data.enterAddressPage = !0, wx.navigateTo({
870 url: "/pages/user/address_list/address_list" 878 url: "/pages/user/address_list/address_list"
871 }); 879 });
872 }, 880 },
873 881
874 - 882 +
875 883
876 //--------立即购买时,选择自提和物流---------- 884 //--------立即购买时,选择自提和物流----------
877 - setexptype:function(t){  
878 - var th=this;  
879 - var ty = t.currentTarget.dataset.t,def_exp_code= getApp().globalData.userInfo.def_exp_code;  
880 - th.setData({ bn_exp_type:ty}); 885 + setexptype: function (t) {
  886 + var th = this;
  887 + var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  888 + th.setData({ bn_exp_type: ty });
881 //当物流为空的时候。 889 //当物流为空的时候。
882 - if (ty == 0 && th.data.wu_arr==null){  
883 - th.data.isget_by_quan={}; 890 + if (ty == 0 && th.data.wu_arr == null) {
  891 + th.data.isget_by_quan = {};
884 return th.get_wuliu(th.calculatePrice2()); 892 return th.get_wuliu(th.calculatePrice2());
885 } 893 }
886 894
887 //--自提就要把包邮券清理掉-- 895 //--自提就要把包邮券清理掉--
888 - if(ty==1){  
889 - th.data.isget_by_quan={};  
890 - if(th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){  
891 - th.setData({using_quan:{}}); 896 + if (ty == 1) {
  897 + th.data.isget_by_quan = {};
  898 + if (th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
  899 + th.setData({ using_quan: {} });
892 } 900 }
893 } 901 }
894 902
895 - //判断有没有默认的物流地址值  
896 - if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {  
897 - var wu_arr=this.data.wu_arr;  
898 - if (wu_arr!= null && wu_arr!=""){  
899 - for(var i=0;i<wu_arr.length;i++){  
900 - if (wu_arr[i].shipping_code == def_exp_code){  
901 - th.setData({index:i});  
902 - }  
903 - } 903 + //判断有没有默认的物流地址值
  904 + if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined) {
  905 + var wu_arr = this.data.wu_arr;
  906 + if (wu_arr != null && wu_arr != "") {
  907 + for (var i = 0; i < wu_arr.length; i++) {
  908 + if (wu_arr[i].shipping_code == def_exp_code) {
  909 + th.setData({ index: i });
904 } 910 }
  911 + }
905 } 912 }
906 - th.calculatePrice2() 913 + }
  914 + th.calculatePrice2()
907 915
908 }, 916 },
909 917
910 //--------立即购买时,使用余额-------- 918 //--------立即购买时,使用余额--------
911 - set_bn_useyuer:function(){  
912 - var th=this;  
913 - th.setData({ bn_use_money: !th.data.bn_use_money}); 919 + set_bn_useyuer: function () {
  920 + var th = this;
  921 + th.setData({ bn_use_money: !th.data.bn_use_money });
914 th.calculatePrice2(); 922 th.calculatePrice2();
915 }, 923 },
916 - set_js_useyuer:function(){ 924 + set_js_useyuer: function () {
917 var th = this; 925 var th = this;
918 th.setData({ js_use_money: !th.data.js_use_money }); 926 th.setData({ js_use_money: !th.data.js_use_money });
919 th.calculatePrice(); 927 th.calculatePrice();
920 }, 928 },
921 //-------------------计算物流--------------- 929 //-------------------计算物流---------------
922 - calculatewuliu:function(code, o_shipping_price, goods_weight,  
923 - goods_piece,user_addr, freight_free, o_price, rs){  
924 - var price =0,th=this;  
925 - price +=parseFloat(o_shipping_price); 930 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  931 + goods_piece, user_addr, freight_free, o_price, rs, pickid = null) {
  932 + var price = 0, th = this;
  933 + price += parseFloat(o_shipping_price);
926 //如果是包邮 934 //如果是包邮
927 - if (freight_free > 0 && o_price >= freight_free){ return 0;}  
928 - if (user_addr==null) { return 0; } 935 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  936 + if (user_addr == null) { return 0; }
929 //计算物流的config item; 937 //计算物流的config item;
930 - var item=null; 938 + var item = null;
931 //先根据 镇 县 区找计算的config 939 //先根据 镇 县 区找计算的config
932 - item = th.get_wuliu_config(user_addr.district,code,rs);  
933 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
934 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
935 - if (item == null) item = th.get_wuliu_default(code,rs); 940 + item = th.get_wuliu_config(user_addr.district, code, rs);
  941 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  942 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  943 + if (item == null) item = th.get_wuliu_default(code, rs);
  944 + if (item == null) return o_shipping_price;
  945 + var fw_price = 0, fp_price = 0;
  946 + item = item.config;
936 if (item == null) return o_shipping_price; 947 if (item == null) return o_shipping_price;
937 - var fw_price = 0, fp_price=0;  
938 - item=item.config;  
939 - if (item == null) return o_shipping_price;  
940 //------按重量---------- 948 //------按重量----------
941 - if (goods_weight>=0 && item['money']) {  
942 - fw_price =parseFloat(item['money']);  
943 - if (goods_weight > item['first_weight']){ 949 + if (goods_weight >= 0 && item['money']) {
  950 + fw_price = parseFloat(item['money']);
  951 + if (goods_weight > item['first_weight']) {
944 var fw = goods_weight - item['first_weight']; 952 var fw = goods_weight - item['first_weight'];
945 - var n = Math.ceil(fw/item['second_weight']) 953 + var n = Math.ceil(fw / item['second_weight'])
  954 + fw_price = fw_price + n * parseFloat(item['add_money']);
  955 + }
  956 + }
  957 + //------超出重量----------
  958 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
  959 + fw_price = parseFloat(item['money']);
  960 + var out_of_weight = Math.abs(out_of_weight);
  961 + if (out_of_weight > item['first_weight']) {
  962 + var fw = out_of_weight - item['first_weight'];
  963 + var n = Math.ceil(fw / item['second_weight'])
946 fw_price = fw_price + n * parseFloat(item['add_money']); 964 fw_price = fw_price + n * parseFloat(item['add_money']);
947 } 965 }
948 } 966 }
@@ -955,21 +973,21 @@ Page({ @@ -955,21 +973,21 @@ Page({
955 fp_price = fp_price + m * parseFloat(item['add_piecemoney']); 973 fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
956 } 974 }
957 } 975 }
958 - var rspice =parseFloat(price + fw_price + fp_price); 976 + var rspice = parseFloat(price + fw_price + fp_price);
959 return rspice; 977 return rspice;
960 }, 978 },
961 979
962 //------------循环获取config----------- 980 //------------循环获取config-----------
963 - get_wuliu_config:function(region_id,code,rs){  
964 - var item=null,rslist = rs.pageData;  
965 - for (var i = 0; i < rslist.length;i++){  
966 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];} 981 + get_wuliu_config: function (region_id, code, rs) {
  982 + var item = null, rslist = rs.pageData;
  983 + for (var i = 0; i < rslist.length; i++) {
  984 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
967 } 985 }
968 return item; 986 return item;
969 }, 987 },
970 //-------循环获取config,code default------- 988 //-------循环获取config,code default-------
971 get_wuliu_default: function (code, rs) { 989 get_wuliu_default: function (code, rs) {
972 - var item = null, rslist=rs.pageData; 990 + var item = null, rslist = rs.pageData;
973 for (var i = 0; i < rslist.length; i++) { 991 for (var i = 0; i < rslist.length; i++) {
974 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } 992 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
975 } 993 }
@@ -977,141 +995,140 @@ Page({ @@ -977,141 +995,140 @@ Page({
977 }, 995 },
978 996
979 //----------立即购买,选择物流------------- 997 //----------立即购买,选择物流-------------
980 - bindPickerChange:function(e){ 998 + bindPickerChange: function (e) {
981 var ind = e.detail.value 999 var ind = e.detail.value
982 this.setData({ index: ind }); 1000 this.setData({ index: ind });
983 this.calculatePrice2(); 1001 this.calculatePrice2();
984 }, 1002 },
985 //----------购物车结算,选择物流------------- 1003 //----------购物车结算,选择物流-------------
986 bindPickerChange_w: function (e) { 1004 bindPickerChange_w: function (e) {
987 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt; 1005 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
988 this.setData({ [txt]: ind }); 1006 this.setData({ [txt]: ind });
989 this.calculatePrice(); 1007 this.calculatePrice();
990 }, 1008 },
991 1009
992 - cart_set_err:function(e){  
993 - var txt = e.currentTarget.dataset.err;  
994 - var ob={};  
995 - ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";  
996 - this.setData(ob); 1010 + cart_set_err: function (e) {
  1011 + var txt = e.currentTarget.dataset.err;
  1012 + var ob = {};
  1013 + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
  1014 + this.setData(ob);
997 }, 1015 },
998 - 1016 +
999 //// 开启物流的弹窗 1017 //// 开启物流的弹窗
1000 - show_wu_arr:function(e){  
1001 - var wu_arr_txt=e.currentTarget.dataset.txt;  
1002 - var w_sele_index=e.currentTarget.dataset.w_sele_index;  
1003 - var is_express=null;  
1004 - var ob={open_express: 1,wu_arr_txt:wu_arr_txt,disabled:1}; 1018 + show_wu_arr: function (e) {
  1019 + var wu_arr_txt = e.currentTarget.dataset.txt;
  1020 + var w_sele_index = e.currentTarget.dataset.w_sele_index;
  1021 + var is_express = null;
  1022 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
1005 1023
1006 //--如果是多个门店的时候-- 1024 //--如果是多个门店的时候--
1007 - if(w_sele_index!=undefined){  
1008 - is_express=this.data.cartlist[w_sele_index].wind;  
1009 - ob['is_express']=is_express; 1025 + if (w_sele_index != undefined) {
  1026 + is_express = this.data.cartlist[w_sele_index].wind;
  1027 + ob['is_express'] = is_express;
1010 } 1028 }
1011 this.setData(ob); 1029 this.setData(ob);
1012 }, 1030 },
1013 - // 关闭物流的弹窗  
1014 - close_express:function(){  
1015 - this.setData({ open_express:0,disabled:0 }); 1031 + // 关闭物流的弹窗
  1032 + close_express: function () {
  1033 + this.setData({ open_express: 0, disabled: 0 });
  1034 + },
  1035 + // 选择物流
  1036 + click_express_name: function (e) {
  1037 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  1038 + var index = e.currentTarget.dataset.idxe;
  1039 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
  1040 + ob[this.data.wu_arr_txt] = index;
  1041 + this.setData(ob);
1016 }, 1042 },
1017 - // 选择物流  
1018 - click_express_name:function(e){  
1019 - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;  
1020 - var index=e.currentTarget.dataset.idxe;  
1021 - var ob={ is_express: index, is_shipping_code: shippingcode,disabled:0};  
1022 - ob[this.data.wu_arr_txt]=index;  
1023 - this.setData(ob);  
1024 - },  
1025 1043
1026 - //点击确定物流  
1027 - determine_expres:function(e){  
1028 - this.setData({ open_express: 0});  
1029 - this.calculatePrice2(); 1044 + //点击确定物流
  1045 + determine_expres: function (e) {
  1046 + this.setData({ open_express: 0 });
  1047 + this.calculatePrice2();
1030 }, 1048 },
1031 - 1049 +
1032 //设置默认物流 1050 //设置默认物流
1033 select_default_logistics: function () { 1051 select_default_logistics: function () {
1034 - var th=this;  
1035 - var is_shipping_code=this.data.is_shipping_code  
1036 - getApp().request.put("/api/weshop/users/update",{  
1037 - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code},  
1038 - success:function(rse){  
1039 - if (rse.data.code==0){  
1040 - getApp().globalData.userInfo.def_exp_code=is_shipping_code; 1052 + var th = this;
  1053 + var is_shipping_code = this.data.is_shipping_code
  1054 + getApp().request.put("/api/weshop/users/update", {
  1055 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
  1056 + success: function (rse) {
  1057 + if (rse.data.code == 0) {
  1058 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
1041 th.setData({ open_express: 0 }); 1059 th.setData({ open_express: 0 });
1042 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19-------- 1060 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19--------
1043 //if(th.data.is_b_now==1) th.calculatePrice2(); 1061 //if(th.data.is_b_now==1) th.calculatePrice2();
1044 //else th.calculatePrice(); 1062 //else th.calculatePrice();
1045 th.calculatePrice2(); 1063 th.calculatePrice2();
1046 - } 1064 + }
1047 } 1065 }
1048 }) 1066 })
1049 }, 1067 },
1050 1068
1051 //更新下默认,在onshow里面 1069 //更新下默认,在onshow里面
1052 - update_code(){  
1053 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
1054 - //--定时器,判断wu_arr不未空--  
1055 - var uii=setInterval(function () {  
1056 - if(th.data.wu_arr)  
1057 - {  
1058 - clearInterval(uii);  
1059 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
1060 - var item = th.data.wu_arr[k];  
1061 - if (def_exp_code == item.code) { m_wind = k; }  
1062 - }  
1063 - //--如果是立即购买--  
1064 - th.setData({index: m_wind,is_express:m_wind});  
1065 -  
1066 - }  
1067 - },500); 1070 + update_code() {
  1071 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  1072 + //--定时器,判断wu_arr不未空--
  1073 + var uii = setInterval(function () {
  1074 + if (th.data.wu_arr) {
  1075 + clearInterval(uii);
  1076 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  1077 + var item = th.data.wu_arr[k];
  1078 + if (def_exp_code == item.code) { m_wind = k; }
  1079 + }
  1080 + //--如果是立即购买--
  1081 + th.setData({ index: m_wind, is_express: m_wind });
  1082 +
  1083 + }
  1084 + }, 500);
1068 }, 1085 },
1069 - 1086 +
1070 //检查区域是不是包邮 1087 //检查区域是不是包邮
1071 - check_area:function(arr){  
1072 - var user_addr=this.data.user_addr;  
1073 - for(var i in arr){  
1074 - var item=arr[i];  
1075 - if(user_addr.twon==item || user_addr.district==item  
1076 - || user_addr.city==item|| user_addr.province==item ){  
1077 - return 0;  
1078 - }  
1079 - }  
1080 - return 1; 1088 + check_area: function (arr) {
  1089 + var user_addr = this.data.user_addr;
  1090 + for (var i in arr) {
  1091 + var item = arr[i];
  1092 + if (user_addr.twon == item || user_addr.district == item
  1093 + || user_addr.city == item || user_addr.province == item) {
  1094 + return 0;
  1095 + }
  1096 + }
  1097 + return 1;
1081 }, 1098 },
1082 - 1099 +
1083 //检查立即购买的商品是不是不包邮 1100 //检查立即购买的商品是不是不包邮
1084 - check_good:function(arr,goods_id){  
1085 - if(!goods_id) goods_id=this.data.bn_goods.goods_id;  
1086 - for(var i in arr){  
1087 - var item=arr[i];  
1088 - if(goods_id==item) return 0;  
1089 - }  
1090 - return 1; 1101 + check_good: function (arr, goods_id) {
  1102 + if (!goods_id) goods_id = this.data.bn_goods.goods_id;
  1103 + for (var i in arr) {
  1104 + var item = arr[i];
  1105 + if (goods_id == item) return 0;
  1106 + }
  1107 + return 1;
1091 }, 1108 },
1092 - check_by_area:function(region_list){  
1093 - var arr=region_list.split(",");  
1094 - var check=this.check_area(arr);  
1095 - return !check; 1109 + check_by_area: function (region_list) {
  1110 + var arr = region_list.split(",");
  1111 + var check = this.check_area(arr);
  1112 + return !check;
1096 }, 1113 },
1097 - check_by_goods:function(goods_list,goods_id){  
1098 - var arr=goods_list.split(",");  
1099 - var check=this.check_good(arr,goods_id);  
1100 - return !check; 1114 + check_by_goods: function (goods_list, goods_id) {
  1115 + var arr = goods_list.split(",");
  1116 + var check = this.check_good(arr, goods_id);
  1117 + return !check;
1101 }, 1118 },
1102 -  
1103 1119
1104 - //从优惠的映射中拿出商品从表的item  
1105 - arr_get_goods:function(goods_id,arr){  
1106 - for(var i in arr){  
1107 - if(arr[i].goods_id==goods_id) return arr[i];  
1108 - }  
1109 - },  
1110 -  
1111 - //跳转到购买卡  
1112 - buycard:function(){  
1113 - getApp().goto("/pages/user/plus/plus");  
1114 - getApp().globalData.plus_buy_back=1;  
1115 - } 1120 +
  1121 + //从优惠的映射中拿出商品从表的item
  1122 + arr_get_goods: function (goods_id, arr) {
  1123 + for (var i in arr) {
  1124 + if (arr[i].goods_id == goods_id) return arr[i];
  1125 + }
  1126 + },
  1127 +
  1128 + //跳转到购买卡
  1129 + buycard: function () {
  1130 + getApp().goto("/pages/user/plus/plus");
  1131 + getApp().globalData.plus_buy_back = 1;
  1132 + }
1116 1133
1117 }); 1134 });
pages/cart/cart2_pt/cart2_pt.js
1 -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), 1 +var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
2 s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); 2 s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp();
3 -var oo=t.globalData.setting,os=oo; 3 +var oo = t.globalData.setting, os = oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
6 6
7 Page({ 7 Page({
8 - data: {  
9 - url: t.globalData.setting.url,  
10 - resourceUrl: t.globalData.setting.resourceUrl,  
11 - imgUrl: t.globalData.setting.imghost,  
12 - goods: null,  
13 - order: null,  
14 - orderPrices: null,  
15 - coupons: null,  
16 - coupon: null,  
17 - invoiceToggle: !0,  
18 - payWithUserMoney: !0,  
19 - payWithPoints: !0,  
20 - maxWord: 0,  
21 - enterAddressPage: !1,  
22 - firstEnter: !0,  
23 - //页面获取的参数  
24 - param:null,  
25 - postdata:null,  
26 - //提交订单的格式  
27 - formData: {  
28 - order_amount:0,//支付金额  
29 - total_amount:0,//总价  
30 - all_price:0,//商品卖的总价  
31 - pay_points: 0,//使用积分  
32 - user_money: 0,//使用余额  
33 - couponCode: "",//使用优惠券(多单就用逗号隔开)  
34 - shipping_price:0,//物流费用  
35 - },  
36 -  
37 - /*----------------立即购买---------------------*/  
38 - is_b_now:0, //0是购物车结算 1立即购买  
39 - bn_goods:null, //立即购买时候的调用商品  
40 - bn_use_money:0,//是否使用余额  
41 - bn_exp_type:1, //0是物流 1自提  
42 - bn_pick:0, //选择的门店  
43 - bn_pickname: "", //选择的门店名称  
44 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流  
45 - /*------------------------*/  
46 - user_addr:null,//物流  
47 - userinfo:null, //获取会员  
48 - /*----------物流选择--------*/  
49 - wu_arr:null,  
50 - index:0,  
51 -  
52 - //判断页面是返回回来的还是 首次进入的  
53 - isclose:1,  
54 - kt_type:0, //开团类型  
55 - is_pt_tz:0,//是否开团团长  
56 - qh:'', //期号  
57 - pt_listno:'',//期号  
58 - is_normal:0,  
59 - is_express:0,//选择物流的控制器  
60 - yuer:0,  
61 -  
62 - rank_switch:0, //是不是开同等级卡  
63 - show_card:null, //显示的等级卡  
64 - card_name:'', //显示的卡的名称  
65 - card_cut_price:null,//减价多少钱 8 + data: {
  9 + url: t.globalData.setting.url,
  10 + resourceUrl: t.globalData.setting.resourceUrl,
  11 + imgUrl: t.globalData.setting.imghost,
  12 + goods: null,
  13 + order: null,
  14 + orderPrices: null,
  15 + coupons: null,
  16 + coupon: null,
  17 + invoiceToggle: !0,
  18 + payWithUserMoney: !0,
  19 + payWithPoints: !0,
  20 + maxWord: 0,
  21 + enterAddressPage: !1,
  22 + firstEnter: !0,
  23 + //页面获取的参数
  24 + param: null,
  25 + postdata: null,
  26 + //提交订单的格式
  27 + formData: {
  28 + order_amount: 0,//支付金额
  29 + total_amount: 0,//总价
  30 + all_price: 0,//商品卖的总价
  31 + pay_points: 0,//使用积分
  32 + user_money: 0,//使用余额
  33 + couponCode: "",//使用优惠券(多单就用逗号隔开)
  34 + shipping_price: 0,//物流费用
66 }, 35 },
67 - onLoad: function(t) {  
68 - console.log("onLoad_pt_cart");  
69 - var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,});  
70 - var appD=getApp().get_b_now();  
71 -  
72 - th.data.postdata=appD;  
73 - //如果期号有值  
74 - if(appD.qh){  
75 - th.data.qh=appD.qh;  
76 - th.data.pt_listno=appD.qh;  
77 - }  
78 - //th.data.kt_type=appD.kt_type;  
79 - th.setData({kt_type:appD.kt_type});  
80 - if(appD.is_pt_tz) th.data.is_pt_tz=appD.is_pt_tz;  
81 - th.data.param=t;  
82 - //先获取物流,再获取用户信息,再展示页面  
83 - //th.get_wuliu(th.get_info(th.show_page));  
84 - },  
85 - onUnload: function () { this.setData({ isclose: 1 })},  
86 36
87 - //------获取会员信息-----先获取用户信息,在进行下一步---  
88 - get_info:function(func){  
89 - var user_id = t.globalData.user_id;  
90 - to.auth.get_u(func);  
91 - }, 37 + /*----------------立即购买---------------------*/
  38 + is_b_now: 0, //0是购物车结算 1立即购买
  39 + bn_goods: null, //立即购买时候的调用商品
  40 + bn_use_money: 0,//是否使用余额
  41 + bn_exp_type: 1, //0是物流 1自提
  42 + bn_pick: 0, //选择的门店
  43 + bn_pickname: "", //选择的门店名称
  44 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
  45 + /*------------------------*/
  46 + user_addr: null,//物流
  47 + userinfo: null, //获取会员
  48 + /*----------物流选择--------*/
  49 + wu_arr: null,
  50 + index: 0,
  51 +
  52 + //判断页面是返回回来的还是 首次进入的
  53 + isclose: 1,
  54 + kt_type: 0, //开团类型
  55 + is_pt_tz: 0,//是否开团团长
  56 + qh: '', //期号
  57 + pt_listno: '',//期号
  58 + is_normal: 0,
  59 + is_express: 0,//选择物流的控制器
  60 + yuer: 0,
  61 +
  62 + rank_switch: 0, //是不是开同等级卡
  63 + show_card: null, //显示的等级卡
  64 + card_name: '', //显示的卡的名称
  65 + card_cut_price: null,//减价多少钱
  66 + },
  67 + onLoad: function (t) {
  68 + console.log("onLoad_pt_cart");
  69 + var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
  70 + var appD = getApp().get_b_now();
  71 +
  72 + th.data.postdata = appD;
  73 + //如果期号有值
  74 + if (appD.qh) {
  75 + th.data.qh = appD.qh;
  76 + th.data.pt_listno = appD.qh;
  77 + }
  78 + //th.data.kt_type=appD.kt_type;
  79 + th.setData({ kt_type: appD.kt_type });
  80 + if (appD.is_pt_tz) th.data.is_pt_tz = appD.is_pt_tz;
  81 + th.data.param = t;
  82 + //先获取物流,再获取用户信息,再展示页面
  83 + //th.get_wuliu(th.get_info(th.show_page));
  84 + },
  85 + onUnload: function () { this.setData({ isclose: 1 }) },
92 86
93 - //-------------------获取物流---------------  
94 - get_wuliu(func) {  
95 - var th = this;  
96 - console.log("getwuliu4545");  
97 - to.getwuliu(function (e) {  
98 - if (th.data.is_default_logistics) {  
99 - //如果第一个不是开启默认,说明要让用户自己选  
100 - if (!e[0].is_default) {  
101 - th.setData({ is_default_logistics: 0 });  
102 - } 87 + //------获取会员信息-----先获取用户信息,在进行下一步---
  88 + get_info: function (func) {
  89 + var user_id = t.globalData.user_id;
  90 + to.auth.get_u(func);
  91 + },
  92 +
  93 + //-------------------获取物流---------------
  94 + get_wuliu(func) {
  95 + var th = this;
  96 + console.log("getwuliu4545");
  97 + to.getwuliu(function (e) {
  98 + if (th.data.is_default_logistics) {
  99 + //如果第一个不是开启默认,说明要让用户自己选
  100 + if (!e[0].is_default) {
  101 + th.setData({ is_default_logistics: 0 });
103 } 102 }
104 - th.setData({ wu_arr: e })  
105 - typeof func == "function" && func();  
106 - })  
107 - }, 103 + }
  104 + th.setData({ wu_arr: e })
  105 + typeof func == "function" && func();
  106 + })
  107 + },
108 108
109 - //------获取会员收货地址-----  
110 - getuser_addr:function(func){  
111 - if (to.globalData.baddr!=null){  
112 - var user_addr = to.globalData.baddr;  
113 - to.globalData.baddr=null;  
114 - func(user_addr);  
115 - }else{  
116 - a.get("/api/weshop/useraddress/page", {  
117 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 }, 109 + //------获取会员收货地址-----
  110 + getuser_addr: function (func) {
  111 + if (to.globalData.baddr != null) {
  112 + var user_addr = to.globalData.baddr;
  113 + to.globalData.baddr = null;
  114 + func(user_addr);
  115 + } else {
  116 + a.get("/api/weshop/useraddress/page", {
  117 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 },
  118 + success: function (su) {
  119 +
  120 + var user_addr = su.data.data.pageData;
  121 + var item = null;
  122 + var def_item = null;
  123 + for (var i = 0; i < user_addr.length; i++) {
  124 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  125 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  126 + }
  127 + if (item == null) item = def_item;
  128 + if (item == null) item = user_addr[0];
  129 + if (item == undefined) item = null;
  130 + func(item);
  131 + }
  132 + });
  133 + }
  134 + },
  135 + //----------------展示页面,是再获取用户信息之后--------------
  136 + show_page: function () {
  137 + var th = this;
  138 + //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取
  139 + var user = getApp().globalData.userInfo;
  140 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  141 + data: { r: Math.random() },
  142 + success: function (e) {
  143 +
  144 + getApp().globalData.userInfo = e.data.data;
  145 + th.setData({ userinfo: e.data.data });
  146 + //获取立即购买的商品信息
  147 + th.get_buy_goods();
  148 +
  149 + //获取提现金额
  150 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  151 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
118 success: function (su) { 152 success: function (su) {
119 -  
120 - var user_addr = su.data.data.pageData;  
121 - var item = null;  
122 - var def_item=null;  
123 - for (var i = 0; i < user_addr.length; i++) {  
124 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
125 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } 153 + if (su.data.code == 0) {
  154 + var yuer = parseFloat(th.data.userinfo.user_money -
  155 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  156 + if (yuer < 0) yuer = 0;
  157 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
126 } 158 }
127 - if (item == null) item = def_item;  
128 - if (item == null) item = user_addr[0];  
129 - if (item == undefined) item = null;  
130 - func(item);  
131 } 159 }
132 }); 160 });
133 } 161 }
134 - },  
135 - //----------------展示页面,是再获取用户信息之后--------------  
136 - show_page:function(){  
137 - var th=this;  
138 - //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取  
139 - var user=getApp().globalData.userInfo;  
140 - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {  
141 - data:{r:Math.random()},  
142 - success: function (e) {  
143 -  
144 - getApp().globalData.userInfo = e.data.data;  
145 - th.setData({userinfo:e.data.data});  
146 - //获取立即购买的商品信息  
147 - th.get_buy_goods();  
148 -  
149 - //获取提现金额  
150 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
151 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
152 - success: function (su) {  
153 - if (su.data.code == 0) {  
154 - var yuer = parseFloat(th.data.userinfo.user_money -  
155 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
156 - if(yuer<0) yuer=0;  
157 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
158 - }  
159 - }  
160 - });  
161 - }  
162 - });  
163 - }, 162 + });
  163 + },
164 164
165 - //-----获取立即购买的商品信息----  
166 - get_buy_goods: function (){  
167 - var th=this,a=getApp().request;  
168 - var gg = th.data.postdata;  
169 - //调用商品  
170 - a.get("/api/weshop/goods/get/" + oo.stoid+"/"+gg.goods_id, {  
171 - success: function (t) {  
172 - var gd = t.data.data;  
173 - if(!gd) return false;  
174 -  
175 - t.data.data.original_img = oo.imghost + t.data.data.original_img;  
176 - t.data.data['buynum'] = gg.goods_num;  
177 - console.log(t.data.data);  
178 - var distr_t = 0, et = 0  
179 - if (t.data.data.distr_type == 0) {  
180 - distr_t = gg.pick_dis;  
181 - } else {  
182 - distr_t = t.data.data.distr_type;  
183 - }  
184 - switch (distr_t) {  
185 - case 0:  
186 - et = 1;  
187 - //-- 系统后台有设置要默认的 --  
188 - if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) et=0;  
189 - break;  
190 - case 1:  
191 - et = 1;  
192 - break;  
193 - case 2:  
194 - et = 0;  
195 - break;  
196 - }  
197 -  
198 - t.data.data.shop_price=gg.goods_price;  
199 - //--如果是普通购买的时候--  
200 - if(gg.is_normal==1){  
201 - t.data.data.prom_id = 0;  
202 - t.data.data.prom_type = 0;  
203 - t.data.data.is_normal=1;  
204 -  
205 - var gd=t.data.data;  
206 - //-- 用商品的手店价来显示 --  
207 - gg.goods_price=gd.shop_price;  
208 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
209 - var is_card_back=getApp().globalData.is_card_back;  
210 - if(is_card_back){  
211 - gg.goods_price=gd[th.data.card_name];  
212 - t.data.data.shop_price=gg.goods_price;  
213 - getApp().globalData.is_card_back=0;  
214 - th.setData({card_cut_price:0});  
215 - }else{  
216 - //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
217 - if(th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){  
218 - var cut_p= gg.goods_price-gd[th.data.card_name];  
219 - th.setData({card_cut_price:cut_p});  
220 - }  
221 - }  
222 -  
223 - if(th.data.bn_goods){  
224 - et=th.data.bn_exp_type;  
225 - }  
226 -  
227 -  
228 - th.setData({  
229 - bn_goods: t.data.data, bn_pickname: gg.pick_name,  
230 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal:1,bn_exp_type:et  
231 - });  
232 -  
233 -  
234 -  
235 - th.calculatePrice2();  
236 - }else{  
237 -  
238 - //--阶梯团很特殊,不能用总表来拿价格--  
239 - getApp().request.get("/api/weshop/teamlist/get/"+oo.stoid+"/"+gd.prom_id, {  
240 - success: function (tt) {  
241 -  
242 - if (tt.data.code == 0) {  
243 - var pt_data=tt.data.data;  
244 - var now=s.gettimestamp();  
245 -  
246 - if(pt_data.is_end==1){  
247 - t.data.data.prom_id = 0;  
248 - t.data.data.prom_type = 0;  
249 - t.data.data.is_normal=1;  
250 - }else if(now>pt_data.end_time){  
251 - t.data.data.prom_id = 0;  
252 - t.data.data.prom_type = 0;  
253 - t.data.data.is_normal=1;  
254 - }else{  
255 - t.data.data.shop_price = tt.data.data.price; //活动价格  
256 - t.data.data.is_normal=0;  
257 - if(pt_data.kttype==3){  
258 - t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买  
259 - }  
260 - }  
261 - } else {  
262 - t.data.data.prom_id = 0;  
263 - t.data.data.prom_type = 0;  
264 - t.data.data.is_normal=1;  
265 - }  
266 -  
267 - if(th.data.bn_goods){  
268 - et=th.data.bn_exp_type;  
269 - }  
270 -  
271 - th.setData({  
272 - bn_goods: t.data.data, bn_pickname: gg.pick_name,  
273 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type:et  
274 - });  
275 -  
276 -  
277 - //计算价格  
278 - th.calculatePrice2();  
279 - }  
280 - });  
281 - }  
282 - }  
283 - });  
284 - }, 165 + //-----获取立即购买的商品信息----
  166 + get_buy_goods: function () {
  167 + var th = this, a = getApp().request;
  168 + var gg = th.data.postdata;
  169 + //调用商品
  170 + a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, {
  171 + success: function (t) {
  172 + var gd = t.data.data;
  173 + if (!gd) return false;
  174 +
  175 + t.data.data.original_img = oo.imghost + t.data.data.original_img;
  176 + t.data.data['buynum'] = gg.goods_num;
  177 + console.log(t.data.data);
  178 + var distr_t = 0, et = 0
  179 + if (t.data.data.distr_type == 0) {
  180 + distr_t = gg.pick_dis;
  181 + } else {
  182 + distr_t = t.data.data.distr_type;
  183 + }
  184 + switch (distr_t) {
  185 + case 0:
  186 + et = 1;
  187 + //-- 系统后台有设置要默认的 --
  188 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  189 + break;
  190 + case 1:
  191 + et = 1;
  192 + break;
  193 + case 2:
  194 + et = 0;
  195 + break;
  196 + }
285 197
286 - //----------子页返回父页触发----------  
287 - onShow: function () {  
288 - var th = this;  
289 - if (th.data.isclose == 0) {  
290 - wx.navigateTo({  
291 - url: "/pages/index/index/index"  
292 - })  
293 - } else {  
294 - this.getuser_addr(function (ie) {  
295 - //更换地址回来要重新调用计算价钱的接口  
296 - th.setData({ user_addr: ie });  
297 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {  
298 - th.setData({ add_back: 1 });  
299 - if (th.data.bn_goods) th.calculatePrice2(); 198 + t.data.data.shop_price = gg.goods_price;
  199 + //--如果是普通购买的时候--
  200 + if (gg.is_normal == 1) {
  201 + t.data.data.prom_id = 0;
  202 + t.data.data.prom_type = 0;
  203 + t.data.data.is_normal = 1;
  204 +
  205 + var gd = t.data.data;
  206 + //-- 用商品的手店价来显示 --
  207 + gg.goods_price = gd.shop_price;
  208 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  209 + var is_card_back = getApp().globalData.is_card_back;
  210 + if (is_card_back) {
  211 + gg.goods_price = gd[th.data.card_name];
  212 + t.data.data.shop_price = gg.goods_price;
  213 + getApp().globalData.is_card_back = 0;
  214 + th.setData({ card_cut_price: 0 });
  215 + } else {
  216 + //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  217 + if (th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  218 + var cut_p = gg.goods_price - gd[th.data.card_name];
  219 + th.setData({ card_cut_price: cut_p });
  220 + }
  221 + }
  222 +
  223 + if (th.data.bn_goods) {
  224 + et = th.data.bn_exp_type;
300 } 225 }
301 - })  
302 - //--更新默认地址--,看一下是不是跳到地址页面  
303 - if (!getApp().globalData.is_cart_old) {  
304 - this.update_code(); 226 +
  227 +
  228 + th.setData({
  229 + bn_goods: t.data.data, bn_pickname: gg.pick_name,
  230 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal: 1, bn_exp_type: et
  231 + });
  232 +
  233 +
  234 +
  235 + th.calculatePrice2();
305 } else { 236 } else {
306 - getApp().globalData.is_cart_old = 0; 237 +
  238 + //--阶梯团很特殊,不能用总表来拿价格--
  239 + getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, {
  240 + success: function (tt) {
  241 +
  242 + if (tt.data.code == 0) {
  243 + var pt_data = tt.data.data;
  244 + var now = s.gettimestamp();
  245 +
  246 + if (pt_data.is_end == 1) {
  247 + t.data.data.prom_id = 0;
  248 + t.data.data.prom_type = 0;
  249 + t.data.data.is_normal = 1;
  250 + } else if (now > pt_data.end_time) {
  251 + t.data.data.prom_id = 0;
  252 + t.data.data.prom_type = 0;
  253 + t.data.data.is_normal = 1;
  254 + } else {
  255 + t.data.data.shop_price = tt.data.data.price; //活动价格
  256 + t.data.data.is_normal = 0;
  257 + if (pt_data.kttype == 3) {
  258 + t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买
  259 + }
  260 + }
  261 + } else {
  262 + t.data.data.prom_id = 0;
  263 + t.data.data.prom_type = 0;
  264 + t.data.data.is_normal = 1;
  265 + }
  266 +
  267 + if (th.data.bn_goods) {
  268 + et = th.data.bn_exp_type;
  269 + }
  270 +
  271 + th.setData({
  272 + bn_goods: t.data.data, bn_pickname: gg.pick_name,
  273 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
  274 + });
  275 +
  276 +
  277 + //计算价格
  278 + th.calculatePrice2();
  279 + }
  280 + });
307 } 281 }
308 } 282 }
  283 + });
  284 + },
  285 +
  286 + //----------子页返回父页触发----------
  287 + onShow: function () {
  288 + var th = this;
  289 + if (th.data.isclose == 0) {
  290 + wx.navigateTo({
  291 + url: "/pages/index/index/index"
  292 + })
  293 + } else {
  294 + this.getuser_addr(function (ie) {
  295 + //更换地址回来要重新调用计算价钱的接口
  296 + th.setData({ user_addr: ie });
  297 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  298 + th.setData({ add_back: 1 });
  299 + if (th.data.bn_goods) th.calculatePrice2();
  300 + }
  301 + })
  302 + //--更新默认地址--,看一下是不是跳到地址页面
  303 + if (!getApp().globalData.is_cart_old) {
  304 + this.update_code();
  305 + } else {
  306 + getApp().globalData.is_cart_old = 0;
  307 + }
  308 + }
309 309
310 310
311 - //先获取是否有关闭使用优惠券  
312 - getApp().getConfig2(function (ee) {  
313 - var json_d = JSON.parse(ee.switch_list);  
314 - th.data.json_d = json_d;  
315 - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
316 - var is_default_logistics = json_d.is_default_logistics;  
317 -  
318 - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });  
319 -  
320 - var rank_switch = json_d.rank_switch;  
321 - var max_price = -1;  
322 - var show_card = null;  
323 - var name = "";  
324 - //如果有开等级卡的时候,  
325 - //因为都是调接口,要返回在计算  
326 - if (rank_switch == 2) {  
327 - //-- 获取所有的等级卡, --  
328 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
329 - {}).then(res => {  
330 - if (res.data.code == 0) {  
331 - var plusCard = res.data.data;  
332 - //-- 循环判断,拿到最贵的那张卡 --  
333 - for (var ih in plusCard) {  
334 - if (plusCard[ih].IsStopBuy == true) { continue; }  
335 - if (max_price < 0) { 311 + //先获取是否有关闭使用优惠券
  312 + getApp().getConfig2(function (ee) {
  313 + var json_d = JSON.parse(ee.switch_list);
  314 + th.data.json_d = json_d;
  315 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  316 + var is_default_logistics = json_d.is_default_logistics;
  317 +
  318 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  319 +
  320 + var rank_switch = json_d.rank_switch;
  321 + var max_price = -1;
  322 + var show_card = null;
  323 + var name = "";
  324 + //如果有开等级卡的时候,
  325 + //因为都是调接口,要返回在计算
  326 + if (rank_switch == 2) {
  327 + //-- 获取所有的等级卡, --
  328 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  329 + {}).then(res => {
  330 + if (res.data.code == 0) {
  331 + var plusCard = res.data.data;
  332 + //-- 循环判断,拿到最贵的那张卡 --
  333 + for (var ih in plusCard) {
  334 + if (plusCard[ih].IsStopBuy == true) { continue; }
  335 + if (max_price < 0) {
  336 + max_price = plusCard[ih].CardFee;
  337 + name = 'card' + plusCard[ih]['CorrPrice'];
  338 + show_card = plusCard[ih];
  339 + } else {
  340 + if (max_price < plusCard[ih].CardFee) {
336 max_price = plusCard[ih].CardFee; 341 max_price = plusCard[ih].CardFee;
337 name = 'card' + plusCard[ih]['CorrPrice']; 342 name = 'card' + plusCard[ih]['CorrPrice'];
338 show_card = plusCard[ih]; 343 show_card = plusCard[ih];
339 - } else {  
340 - if (max_price < plusCard[ih].CardFee) {  
341 - max_price = plusCard[ih].CardFee;  
342 - name = 'card' + plusCard[ih]['CorrPrice'];  
343 - show_card = plusCard[ih];  
344 - }  
345 } 344 }
346 } 345 }
  346 + }
347 347
348 - if (show_card) {  
349 - name = name.toLowerCase();  
350 - th.setData({ card_name: name, show_card: show_card })  
351 - } 348 + if (show_card) {
  349 + name = name.toLowerCase();
  350 + th.setData({ card_name: name, show_card: show_card })
352 } 351 }
353 - //-----先获取物流,再获取用户信息,再展示页面-----  
354 - th.get_wuliu(th.get_info(th.show_page));  
355 - }) 352 + }
  353 + //-----先获取物流,再获取用户信息,再展示页面-----
  354 + th.get_wuliu(th.get_info(th.show_page));
  355 + })
  356 + } else {
  357 + //-----先获取物流,再获取用户信息,再展示页面-----
  358 + th.get_wuliu(th.get_info(th.show_page));
  359 + }
  360 + }, 1)
  361 +
  362 + },
  363 + //---------------检查是否有收货地址-------------------
  364 + checkAddressList: function () {
  365 + var t = this;
  366 + return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
  367 + title: "请先填写或选择收货地址~",
  368 + success: function (a) {
  369 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  370 + },
  371 + fail: function () {
  372 + wx.navigateBack();
  373 + }
  374 + }), !1);
  375 + },
  376 + showInvoice: function () {
  377 + this.setData({
  378 + invoiceToggle: !this.data.invoiceToggle
  379 + });
  380 + },
  381 + keyUpChangePay1: function (t) {
  382 + this.setData({
  383 + payWithUserMoney: !(t.detail.value.length > 0)
  384 + });
  385 + },
  386 + keyUpChangePay2: function (t) {
  387 + this.setData({
  388 + payWithPoints: !(t.detail.value.length > 0)
  389 + });
  390 + },
  391 + keyUpChangeNum: function (t) {
  392 + this.setData({
  393 + maxWord: t.detail.value.length
  394 + });
  395 + },
  396 + //---------计算立即购买----------
  397 + calculatePrice2: function () {
  398 + var th = this, good = this.data.bn_goods;
  399 + //-----------计算商品总价--------------
  400 + var allpice = good.shop_price * good.buynum;
  401 + allpice = parseFloat(allpice).toFixed(2);
  402 + var txt = "formData.all_price";
  403 + th.setData({ [txt]: allpice, });
  404 + console.log(th.data.formData);
  405 +
  406 + to.getConfig2(function (ee) {
  407 + to.getwuliuprice(function (rs) {
  408 + console.log('calculatePrice2222');
  409 + console.log(rs);
  410 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  411 + var out_of_weight = null; //超出多少重量
  412 + var freight_free = ee.freight_free; //全场满多少包邮
  413 + var weight_free = ee.weight_free; //多少kg内包邮
  414 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  415 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  416 + switch (good['exp_sum_type']) {
  417 + case 1:
  418 + //统一运费
  419 + o_shipping_price += good['uniform_exp_sum']; break;
  420 + case 2:
  421 + if (goods_weight < 0) goods_weight = 0;
  422 + //累积商品重量 每种商品的重量 * 数量
  423 + goods_weight += good['weight'] * good['buynum'];
  424 + if (weight_free > 0) {
  425 + out_of_weight = (weight_free * 1000) - goods_weight;
  426 + }
  427 + break;
  428 + case 3:
  429 + if (goods_piece < 0) goods_piece = 0;
  430 + //累积商品数量
  431 + goods_piece += good['buynum']; break;
  432 + }
  433 +
  434 + console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece);
  435 + console.log(th.data.wu_arr);
  436 + var code = th.data.wu_arr[th.data.index].code;
  437 + var freight_free = ee.freight_free; //全场满多少包邮
  438 + var shipping_price =
  439 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  440 + goods_piece, th.data.user_addr, freight_free, allpice, rs);
  441 +
  442 + shipping_price = parseFloat(shipping_price).toFixed(2);
  443 + var wl_txt = "formData.shipping_price";
  444 + th.setData({ [wl_txt]: shipping_price, })
  445 +
356 } else { 446 } else {
357 - //-----先获取物流,再获取用户信息,再展示页面-----  
358 - th.get_wuliu(th.get_info(th.show_page)); 447 + var wl_txt = "formData.shipping_price";
  448 + th.setData({ [wl_txt]: 0, })
  449 + }
  450 + //-----------------总价-----------------
  451 + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
  452 + total_m = parseFloat(total_m).toFixed(2);
  453 +
  454 + var atxt = "formData.total_amount";
  455 + th.setData({ [atxt]: total_m, })
  456 + var order_m = total_m;
  457 +
  458 + var txt = "formData.user_money";
  459 + var txt2 = "formData.order_amount";
  460 + //--------------如果使用余额---------------------
  461 + if (th.data.bn_use_money == 1 && th.data.yuer > 0) {
  462 + if (parseFloat(th.data.yuer) > total_m) {
  463 + th.setData({ [txt]: total_m, [txt2]: 0 })
  464 + } else {
  465 + order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
  466 + order_m = order_m.toFixed(2);
  467 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
  468 + }
  469 + } else {
  470 + th.setData({ [txt]: 0, [txt2]: order_m })
359 } 471 }
360 - }, 1)  
361 -  
362 - },  
363 - //---------------检查是否有收货地址-------------------  
364 - checkAddressList: function() {  
365 - var t = this;  
366 - return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({  
367 - title: "请先填写或选择收货地址~",  
368 - success: function(a) {  
369 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
370 - },  
371 - fail: function() {  
372 - wx.navigateBack();  
373 - }  
374 - }), !1);  
375 - },  
376 - showInvoice: function() {  
377 - this.setData({  
378 - invoiceToggle: !this.data.invoiceToggle  
379 - });  
380 - },  
381 - keyUpChangePay1: function(t) {  
382 - this.setData({  
383 - payWithUserMoney: !(t.detail.value.length > 0)  
384 - });  
385 - },  
386 - keyUpChangePay2: function(t) {  
387 - this.setData({  
388 - payWithPoints: !(t.detail.value.length > 0)  
389 - });  
390 - },  
391 - keyUpChangeNum: function(t) {  
392 - this.setData({  
393 - maxWord: t.detail.value.length  
394 - });  
395 - },  
396 - //---------计算立即购买----------  
397 - calculatePrice2: function () {  
398 - console.log('calculatePrice2');  
399 - var th = this, good = this.data.bn_goods;  
400 - //-----------计算商品总价--------------  
401 - var allpice = good.shop_price * good.buynum;  
402 - allpice=parseFloat(allpice).toFixed(2);  
403 - var txt = "formData.all_price";  
404 - th.setData({ [txt]: allpice, });  
405 - console.log(th.data.formData);  
406 -  
407 - to.getConfig2(function (ee) {  
408 - to.getwuliuprice(function (rs) {  
409 - console.log('calculatePrice2222');  
410 - console.log(rs);  
411 - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;  
412 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
413 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
414 - switch (good['exp_sum_type']) {  
415 - case 1:  
416 - //统一运费  
417 - o_shipping_price += good['uniform_exp_sum']; break;  
418 - case 2:  
419 - if (goods_weight < 0) goods_weight = 0;  
420 - //累积商品重量 每种商品的重量 * 数量  
421 - goods_weight += good['weight'] * good['buynum'];break;  
422 - case 3:  
423 - if (goods_piece < 0) goods_piece = 0;  
424 - //累积商品数量  
425 - goods_piece += good['buynum']; break;  
426 - }  
427 -  
428 - console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece);  
429 - console.log(th.data.wu_arr);  
430 - var code = th.data.wu_arr[th.data.index].code;  
431 - var freight_free = ee.freight_free; //全场满多少包邮  
432 - var shipping_price=  
433 - th.calculatewuliu(code, o_shipping_price, goods_weight,  
434 - goods_piece, th.data.user_addr, freight_free, allpice, rs);  
435 -  
436 - shipping_price = parseFloat(shipping_price).toFixed(2);  
437 - var wl_txt = "formData.shipping_price";  
438 - th.setData({ [wl_txt]: shipping_price, })  
439 -  
440 - }else{  
441 - var wl_txt = "formData.shipping_price";  
442 - th.setData({ [wl_txt]: 0, })  
443 - }  
444 - //-----------------总价-----------------  
445 - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);  
446 - total_m = parseFloat(total_m).toFixed(2);  
447 -  
448 - var atxt= "formData.total_amount";  
449 - th.setData({ [atxt]: total_m, })  
450 - var order_m = total_m;  
451 -  
452 - var txt = "formData.user_money";  
453 - var txt2 = "formData.order_amount";  
454 - //--------------如果使用余额---------------------  
455 - if (th.data.bn_use_money == 1 && th.data.yuer>0) {  
456 - if ( parseFloat(th.data.yuer) > total_m) {  
457 - th.setData({ [txt]: total_m, [txt2]:0 })  
458 - }else{  
459 - order_m = parseFloat(order_m) - parseFloat(th.data.yuer);  
460 - order_m = order_m.toFixed(2);  
461 - th.setData({ [txt]: th.data.yuer, [txt2]: order_m })  
462 - }  
463 - }else{  
464 - th.setData({ [txt]: 0, [txt2]: order_m })  
465 - }  
466 472
467 - });  
468 }); 473 });
469 - },  
470 - //--------------------提交订单-----------------------  
471 - submitForm: async function(t){  
472 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
473 - this.data.is_summit_ing=1;  
474 -  
475 - var th=this,pdata=new Array();  
476 - var ff=true;  
477 - //------------立即购买-------------  
478 - console.log("buy_new");  
479 -  
480 - //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候  
481 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
482 - ff = false;  
483 - getApp().my_warnning("请选择收货地址",0,this);  
484 - this.data.is_summit_ing = 0;  
485 - }  
486 - if (!ff) return false;  
487 - var addr = th.data.user_addr;  
488 - if (th.data.bn_exp_type == 1) addr=null;  
489 -  
490 - console.log(th.data.formData);  
491 - console.log(th.data.wu_arr);  
492 - console.log(th.data.bn_exp_type);  
493 -  
494 - if(th.data.bn_exp_type==0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)) {  
495 - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {  
496 - getApp().my_warnning("读取物流失败",0,this);  
497 - this.data.is_summit_ing = 0;  
498 - return false; 474 + });
  475 + },
  476 + //--------------------提交订单-----------------------
  477 + submitForm: async function (t) {
  478 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  479 + this.data.is_summit_ing = 1;
  480 +
  481 + var th = this, pdata = new Array();
  482 + var ff = true;
  483 + //------------立即购买-------------
  484 + console.log("buy_new");
  485 +
  486 + //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
  487 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  488 + ff = false;
  489 + getApp().my_warnning("请选择收货地址", 0, this);
  490 + this.data.is_summit_ing = 0;
  491 + }
  492 + if (!ff) return false;
  493 + var addr = th.data.user_addr;
  494 + if (th.data.bn_exp_type == 1) addr = null;
  495 +
  496 + console.log(th.data.formData);
  497 + console.log(th.data.wu_arr);
  498 + console.log(th.data.bn_exp_type);
  499 +
  500 + if (th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  501 + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
  502 + getApp().my_warnning("读取物流失败", 0, this);
  503 + this.data.is_summit_ing = 0;
  504 + return false;
  505 + }
  506 + }
  507 +
  508 + //阶梯团强制带1,自提~~~
  509 + if (th.data.kt_type == 3) {
  510 + th.data.bn_exp_type = 1;
  511 + }
  512 +
  513 + var item = {
  514 + 'user_id': to.globalData.user_id,
  515 + 'consignee': addr == null ? "" : addr.consignee,
  516 + 'province': addr == null ? 0 : addr.province,
  517 + 'city': addr == null ? 0 : addr.city,
  518 + 'district': addr == null ? 0 : addr.district,
  519 + 'twon': addr == null ? 0 : addr.twon,
  520 + 'address': addr == null ? "" : addr.address,
  521 + 'more_address': addr == null ? "" : addr.more_address,
  522 + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
  523 + 'email': '',
  524 + 'invoice_title': '',
  525 + 'goods_price': th.data.formData.all_price, //商品总价
  526 + 'shipping_price': th.data.formData.shipping_price, //物流金额
  527 + 'user_money': th.data.formData.user_money, //使用余额
  528 + 'total_amount': th.data.formData.total_amount, //订单总价
  529 + 'order_amount': th.data.formData.order_amount, //应付
  530 + 'user_note': t.detail.value.user_note, //用户备注
  531 + 'store_id': oo.stoid, //商家
  532 + 'pickup_id': th.data.bn_pick, //门店
  533 + 'exp_type': th.data.bn_exp_type, //配送方式
  534 + 'is_normal': th.data.bn_goods.is_normal, //是否是普通购买
  535 + 'pt_prom_id': th.data.bn_goods.prom_id, //拼单ID
  536 + 'is_pt_tz': th.data.is_pt_tz, //开团类型
  537 + 'order_goods': new Array(),
  538 + };
  539 +
  540 + //如果不是阶梯团,或者是普通购买,
  541 + if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  542 + item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
  543 + item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
  544 + }
  545 +
  546 + if (!th.data.bn_goods.is_normal) {
  547 + item.is_zsorder = th.data.kt_type + 1; //开团类型
  548 + }
  549 + //老会员成为分销下线需要的参数
  550 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
  551 + //判断一下分享人是不是分享商
  552 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  553 + if (res.data.code == 0) {
  554 + var user = res.data.data;
  555 + if (user.is_distribut == 1) {
  556 + item.first_leader = parseInt(getApp().globalData.first_leader);
499 } 557 }
500 } 558 }
501 -  
502 - //阶梯团强制带1,自提~~~  
503 - if(th.data.kt_type==3 ){  
504 - th.data.bn_exp_type=1;  
505 - }  
506 -  
507 - var item={  
508 - 'user_id': to.globalData.user_id,  
509 - 'consignee': addr == null ? "" : addr.consignee,  
510 - 'province': addr == null ? 0 : addr.province,  
511 - 'city': addr == null ? 0 : addr.city,  
512 - 'district': addr == null ? 0 : addr.district,  
513 - 'twon': addr == null ? 0 : addr.twon,  
514 - 'address': addr == null ? "": addr.address,  
515 - 'more_address': addr == null ? "" : addr.more_address,  
516 - 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,  
517 - 'email':'',  
518 - 'invoice_title':'',  
519 - 'goods_price': th.data.formData.all_price, //商品总价  
520 - 'shipping_price': th.data.formData.shipping_price, //物流金额  
521 - 'user_money': th.data.formData.user_money, //使用余额  
522 - 'total_amount': th.data.formData.total_amount, //订单总价  
523 - 'order_amount': th.data.formData.order_amount, //应付  
524 - 'user_note': t.detail.value.user_note, //用户备注  
525 - 'store_id':oo.stoid, //商家  
526 - 'pickup_id': th.data.bn_pick, //门店  
527 - 'exp_type': th.data.bn_exp_type, //配送方式  
528 - 'is_normal':th.data.bn_goods.is_normal, //是否是普通购买  
529 - 'pt_prom_id':th.data.bn_goods.prom_id, //拼单ID  
530 - 'is_pt_tz':th.data.is_pt_tz, //开团类型  
531 - 'order_goods':new Array(),  
532 - };  
533 -  
534 - //如果不是阶梯团,或者是普通购买,  
535 - if((th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)){  
536 - item['shipping_code']= th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;  
537 - item['shipping_name']= th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;  
538 - }  
539 -  
540 - if(!th.data.bn_goods.is_normal){  
541 - item.is_zsorder=th.data.kt_type+1; //开团类型  
542 - }  
543 - //老会员成为分销下线需要的参数  
544 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){  
545 - //判断一下分享人是不是分享商  
546 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
547 - if(res.data.code==0){  
548 - var user= res.data.data;  
549 - if(user.is_distribut==1){  
550 - item.first_leader=parseInt(getApp().globalData.first_leader);  
551 - }  
552 - }  
553 - })  
554 - }  
555 -  
556 - if(th.data.qh!='')  
557 - {  
558 - item.team_qh=th.data.qh;  
559 - item.pt_listno=th.data.qh;  
560 - }  
561 -  
562 - var gg = to.get_b_now();  
563 - var goods={  
564 - 'goods_id': gg.goods_id,  
565 - 'goods_name': gg.goods_name,  
566 - 'goods_sn': gg.goods_sn,  
567 - 'goods_num': gg.goods_num,  
568 - 'market_price': th.data.bn_goods.market_price,  
569 - 'goods_price': th.data.bn_goods.shop_price,  
570 - 'member_goods_price': th.data.bn_goods.shop_price,  
571 - 'store_id': oo.stoid,  
572 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型  
573 - 'prom_id': th.data.bn_goods.prom_id, //促销活动id  
574 - };  
575 -  
576 - //--导购分享过来的id--  
577 - if(gg.guide_id){  
578 - goods.guide_id=gg.guide_id;  
579 - goods.guide_type=gg.guide_type;  
580 - //调用接口判断是不是会员  
581 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{  
582 - if(res.data.code==0){  
583 - goods.guide_name=res.data.data.salesman;  
584 - goods.guide_sn=res.data.data.salesman_no;  
585 - }  
586 - })  
587 - }  
588 -  
589 - //--商品的房间号--  
590 - if(gg.room_id && gg.room_id>0){  
591 - item.room_ids=gg.room_id;  
592 - goods.room_id=gg.room_id; 559 + })
  560 + }
  561 +
  562 + if (th.data.qh != '') {
  563 + item.team_qh = th.data.qh;
  564 + item.pt_listno = th.data.qh;
  565 + }
  566 +
  567 + var gg = to.get_b_now();
  568 + var goods = {
  569 + 'goods_id': gg.goods_id,
  570 + 'goods_name': gg.goods_name,
  571 + 'goods_sn': gg.goods_sn,
  572 + 'goods_num': gg.goods_num,
  573 + 'market_price': th.data.bn_goods.market_price,
  574 + 'goods_price': th.data.bn_goods.shop_price,
  575 + 'member_goods_price': th.data.bn_goods.shop_price,
  576 + 'store_id': oo.stoid,
  577 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
  578 + 'prom_id': th.data.bn_goods.prom_id, //促销活动id
  579 + };
  580 +
  581 + //--导购分享过来的id--
  582 + if (gg.guide_id) {
  583 + goods.guide_id = gg.guide_id;
  584 + goods.guide_type = gg.guide_type;
  585 + //调用接口判断是不是会员
  586 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  587 + if (res.data.code == 0) {
  588 + goods.guide_name = res.data.data.salesman;
  589 + goods.guide_sn = res.data.data.salesman_no;
593 } 590 }
594 -  
595 - if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;}  
596 -  
597 - item.order_goods.push(goods);  
598 - pdata.push(item);  
599 -  
600 - if (pdata.length==0) return;  
601 - var str = JSON.stringify(pdata);  
602 - console.log("支付数据");  
603 - console.log(str);  
604 - //return false;  
605 - wx.showLoading({title: "加载中"});  
606 - wx.request({  
607 - url: oo.url + '/api/weshop/order/createWxdOrder',  
608 - data: str,  
609 - method: 'POST',  
610 - header: {  
611 - 'content-type': 'application/json'  
612 - },// 设置请求的 header  
613 - success: function (res) {  
614 -  
615 - wx.hideLoading();  
616 - if (res.statusCode == 200) {  
617 - var data=res.data;  
618 - if(data.code==0){  
619 - console.log(th.data.is_b_now);  
620 - //如果是购物车结算,还要删除购物车  
621 - if (th.data.is_b_now == 0) {  
622 - console.log(th.data.cartlist_y);  
623 - var list = th.data.cartlist_y;  
624 - for (var i = 0; i < list.length; i++) {  
625 - //删除购物车  
626 - getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});  
627 - }  
628 - }  
629 - var order_amount = 0;  
630 - pdata.forEach(function (em, ind) {  
631 - order_amount += em.order_amount;  
632 - })  
633 - //要进行判断,如果是用微信支付,就要跳转到支付界面  
634 - if (order_amount > 0) { 591 + })
  592 + }
  593 +
  594 +
  595 + //--商品的房间号--
  596 + if (gg.room_id && gg.room_id > 0) {
  597 + item.room_ids = gg.room_id;
  598 + goods.room_id = gg.room_id;
  599 + }
  600 +
  601 + if (th.data.bn_goods.is_normal) { goods.is_pd_normal = 1; }
  602 +
  603 + item.order_goods.push(goods);
  604 + pdata.push(item);
  605 +
  606 + if (pdata.length == 0) return;
  607 + var str = JSON.stringify(pdata);
  608 + console.log("支付数据");
  609 + console.log(str);
  610 + //return false;
  611 + wx.showLoading({ title: "加载中" });
  612 + wx.request({
  613 + url: oo.url + '/api/weshop/order/createWxdOrder',
  614 + data: str,
  615 + method: 'POST',
  616 + header: {
  617 + 'content-type': 'application/json'
  618 + },// 设置请求的 header
  619 + success: function (res) {
  620 +
  621 + wx.hideLoading();
  622 + if (res.statusCode == 200) {
  623 + var data = res.data;
  624 + if (data.code == 0) {
  625 + console.log(th.data.is_b_now);
  626 + //如果是购物车结算,还要删除购物车
  627 + if (th.data.is_b_now == 0) {
  628 + console.log(th.data.cartlist_y);
  629 + var list = th.data.cartlist_y;
  630 + for (var i = 0; i < list.length; i++) {
  631 + //删除购物车
  632 + getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});
  633 + }
  634 + }
  635 + var order_amount = 0;
  636 + pdata.forEach(function (em, ind) {
  637 + order_amount += em.order_amount;
  638 + })
  639 + //要进行判断,如果是用微信支付,就要跳转到支付界面
  640 + if (order_amount > 0) {
  641 + th.setData({ isclose: 0 });
  642 + //void e.jumpToCart4({
  643 + // order_sn: data.data,
  644 + // type:1,
  645 + // }, 1);
  646 + util_pay.pay(data.data, function () {
  647 + setTimeout(function () {
  648 + wx.reLaunch({
  649 + //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
  650 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  651 + })
  652 + }, 1000)
  653 + }, function () {
  654 + //支付失败
  655 + setTimeout(function () {
  656 + //wx.navigateBack({ delta: 1 })
  657 + wx.reLaunch({
  658 + url: "/pages/user/order_list/order_list",
  659 + })
  660 + }, 1000)
  661 +
  662 + }, oo.stoid, 1);
  663 +
  664 + } else {
  665 + var dd = {
  666 + parent_sn: data.data,
  667 + store_id: oo.stoid,
  668 + type: 1,
  669 + };
  670 + //return false;
  671 + getApp().request.post("/api/weshop/order/pay/createOrder", {
  672 + data: dd,
  673 + success: function (t) {
  674 + console.log(t);
  675 + app.my_warnning("支付成功", 1, th);
  676 + setTimeout(function () {
635 th.setData({ isclose: 0 }); 677 th.setData({ isclose: 0 });
636 - //void e.jumpToCart4({  
637 - // order_sn: data.data,  
638 - // type:1,  
639 - // }, 1);  
640 - util_pay.pay(data.data, function() {  
641 - setTimeout(function () {  
642 - wx.reLaunch({  
643 - //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,  
644 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
645 - })  
646 - },1000)  
647 - }, function () {  
648 - //支付失败  
649 - setTimeout(function () {  
650 - //wx.navigateBack({ delta: 1 })  
651 - wx.reLaunch({  
652 - url: "/pages/user/order_list/order_list",  
653 - })  
654 - },1000)  
655 -  
656 - },oo.stoid,1);  
657 678
658 - } else {  
659 - var dd = {  
660 - parent_sn: data.data,  
661 - store_id: oo.stoid,  
662 - type: 1,  
663 - };  
664 - //return false;  
665 - getApp().request.post("/api/weshop/order/pay/createOrder", {  
666 - data: dd,  
667 - success: function (t) {  
668 - console.log(t);  
669 - app.my_warnning("支付成功",1,th);  
670 - setTimeout(function () {  
671 - th.setData({ isclose: 0 });  
672 -  
673 - if(th.data.is_normal==1){  
674 - /*--  
675 - wx.navigateTo({  
676 - url: "/pages/user/order_list/order_list",  
677 - })--*/  
678 - var url="/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data;  
679 - wx.reLaunch({  
680 - url: url  
681 - })  
682 -  
683 - }else{  
684 - wx.reLaunch({  
685 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
686 - })  
687 - }  
688 -  
689 -  
690 - }, 1000) 679 + if (th.data.is_normal == 1) {
  680 + /*--
  681 + wx.navigateTo({
  682 + url: "/pages/user/order_list/order_list",
  683 + })--*/
  684 + var url = "/pages/payment/pay_success/pay_success?type=1&order_sn=" + data.data;
  685 + wx.reLaunch({
  686 + url: url
  687 + })
  688 +
  689 + } else {
  690 + wx.reLaunch({
  691 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  692 + })
691 } 693 }
692 - }); 694 +
  695 +
  696 + }, 1000)
693 } 697 }
694 - }  
695 - else{  
696 - th.data.is_summit_ing=0; //是否提交中  
697 - getApp().confirmBox(data.msg);  
698 - }  
699 - } else {  
700 - th.data.is_summit_ing=0; //是否提交中  
701 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 698 + });
  699 + }
702 } 700 }
703 - },  
704 - fail: function () {  
705 - th.data.is_summit_ing=0; //是否提交中  
706 - wx.hideLoading();  
707 - console.log("index.js wx.request CheckCallUser fail");  
708 - },  
709 - complete: function () {}  
710 - })  
711 - },  
712 - useCoupon: function() {  
713 - if (this.data.order.couponNum <= 0) {  
714 - //return t.showWarning("无可用优惠券");  
715 - getApp().my_warnning("无可用优惠券",0,this);  
716 - return; 701 + else {
  702 + th.data.is_summit_ing = 0; //是否提交中
  703 + getApp().confirmBox(data.msg);
  704 + }
  705 + } else {
  706 + th.data.is_summit_ing = 0; //是否提交中
  707 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
717 } 708 }
718 - var a = {  
719 - lid: this.data.coupon ? this.data.coupon.id : "0"  
720 - };  
721 - wx.navigateTo({  
722 - url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)  
723 - });  
724 - },  
725 - enterAddressPage: function() {  
726 - getApp().globalData.is_cart_old=1;  
727 - this.data.enterAddressPage = !0, wx.navigateTo({  
728 - url: "/pages/user/address_list/address_list"  
729 - });  
730 - }, 709 + },
  710 + fail: function () {
  711 + th.data.is_summit_ing = 0; //是否提交中
  712 + wx.hideLoading();
  713 + console.log("index.js wx.request CheckCallUser fail");
  714 + },
  715 + complete: function () { }
  716 + })
  717 + },
  718 + useCoupon: function () {
  719 + if (this.data.order.couponNum <= 0) {
  720 + //return t.showWarning("无可用优惠券");
  721 + getApp().my_warnning("无可用优惠券", 0, this);
  722 + return;
  723 + }
  724 + var a = {
  725 + lid: this.data.coupon ? this.data.coupon.id : "0"
  726 + };
  727 + wx.navigateTo({
  728 + url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
  729 + });
  730 + },
  731 + enterAddressPage: function () {
  732 + getApp().globalData.is_cart_old = 1;
  733 + this.data.enterAddressPage = !0, wx.navigateTo({
  734 + url: "/pages/user/address_list/address_list"
  735 + });
  736 + },
731 737
732 - //--------立即购买时,选择自提和物流-----------  
733 - setexptype_w:function(t){  
734 - var th=this;  
735 - var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;  
736 - th.setData({ [txt]: ty });  
737 - var iszt=1;  
738 - if(ty==0){  
739 - th.setData({ is_all_zt: 0 });  
740 - }else{  
741 - for(var i=0;i<th.data.cartlist.length;i++){  
742 - var item = th.data.cartlist[i];  
743 - if (item.exp_type==0){ iszt=0;break;}  
744 - }  
745 - th.setData({ is_all_zt: iszt }); 738 + //--------立即购买时,选择自提和物流-----------
  739 + setexptype_w: function (t) {
  740 + var th = this;
  741 + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt;
  742 + th.setData({ [txt]: ty });
  743 + var iszt = 1;
  744 + if (ty == 0) {
  745 + th.setData({ is_all_zt: 0 });
  746 + } else {
  747 + for (var i = 0; i < th.data.cartlist.length; i++) {
  748 + var item = th.data.cartlist[i];
  749 + if (item.exp_type == 0) { iszt = 0; break; }
746 } 750 }
747 - //----计算此时购物车的价格----  
748 - th.calculatePrice();  
749 - }, 751 + th.setData({ is_all_zt: iszt });
  752 + }
  753 + //----计算此时购物车的价格----
  754 + th.calculatePrice();
  755 + },
750 756
751 - //--------立即购买时,选择自提和物流----------  
752 - setexptype:function(t){  
753 - var th=this;  
754 - var ty = t.currentTarget.dataset.t;  
755 - th.setData({ bn_exp_type:ty});  
756 - //当物流为空的时候。  
757 - if (ty == 0 && th.data.wu_arr==null){  
758 - return th.get_wuliu(th.calculatePrice2());  
759 - }  
760 - th.calculatePrice2()  
761 - console.log('setexptype');  
762 - }, 757 + //--------立即购买时,选择自提和物流----------
  758 + setexptype: function (t) {
  759 + var th = this;
  760 + var ty = t.currentTarget.dataset.t;
  761 + th.setData({ bn_exp_type: ty });
  762 + //当物流为空的时候。
  763 + if (ty == 0 && th.data.wu_arr == null) {
  764 + return th.get_wuliu(th.calculatePrice2());
  765 + }
  766 + th.calculatePrice2()
  767 + console.log('setexptype');
  768 + },
763 769
764 - //--------立即购买时,使用余额--------  
765 - set_bn_useyuer:function(){  
766 - var th=this;  
767 - th.setData({ bn_use_money: !th.data.bn_use_money});  
768 - th.calculatePrice2();  
769 - },  
770 - set_js_useyuer:function(){  
771 - var th = this;  
772 - th.setData({ js_use_money: !th.data.js_use_money });  
773 - th.calculatePrice();  
774 - }, 770 + //--------立即购买时,使用余额--------
  771 + set_bn_useyuer: function () {
  772 + var th = this;
  773 + th.setData({ bn_use_money: !th.data.bn_use_money });
  774 + th.calculatePrice2();
  775 + },
  776 + set_js_useyuer: function () {
  777 + var th = this;
  778 + th.setData({ js_use_money: !th.data.js_use_money });
  779 + th.calculatePrice();
  780 + },
775 781
776 //-------------------计算物流--------------- 782 //-------------------计算物流---------------
777 - calculatewuliu:function(code, o_shipping_price, goods_weight,  
778 - goods_piece,user_addr, freight_free, o_price, rs){  
779 - var price =0,th=this;  
780 - price +=parseFloat(o_shipping_price);  
781 - //如果是包邮  
782 - if (freight_free > 0 && o_price >= freight_free){ return 0;}  
783 - if (user_addr==null) { return 0; }  
784 - //计算物流的config item;  
785 - var item=null;  
786 - //先根据 镇 县 区找计算的config  
787 - item = th.get_wuliu_config(user_addr.district,code,rs);  
788 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
789 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
790 - if (item == null) item = th.get_wuliu_default(code,rs); 783 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  784 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
  785 + var price = 0, th = this;
  786 + price += parseFloat(o_shipping_price);
  787 + //如果是包邮
  788 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  789 + if (user_addr == null) { return 0; }
  790 + //计算物流的config item;
  791 + var item = null;
  792 + //先根据 镇 县 区找计算的config
  793 + item = th.get_wuliu_config(user_addr.district, code, rs);
  794 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  795 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  796 + if (item == null) item = th.get_wuliu_default(code, rs);
  797 + if (item == null) return o_shipping_price;
  798 + var fw_price = 0, fp_price = 0;
  799 + item = item.config;
791 if (item == null) return o_shipping_price; 800 if (item == null) return o_shipping_price;
792 - var fw_price = 0, fp_price=0;  
793 - item=item.config;  
794 - if (item == null) return o_shipping_price;  
795 //------按重量---------- 801 //------按重量----------
796 - if (goods_weight>=0) {  
797 - fw_price =parseFloat(item['money']);  
798 - if (goods_weight > item['first_weight']){  
799 - var fw = goods_weight - item['first_weight'];  
800 - var n = Math.ceil(fw/item['second_weight'])  
801 - fw_price = fw_price + n * parseFloat(item['add_money']);  
802 - } 802 + if (goods_weight >= 0 && item['money']) {
  803 + fw_price = parseFloat(item['money']);
  804 + if (goods_weight > item['first_weight']) {
  805 + var fw = goods_weight - item['first_weight'];
  806 + var n = Math.ceil(fw / item['second_weight'])
  807 + fw_price = fw_price + n * parseFloat(item['add_money']);
  808 + }
  809 + }
  810 + //------超出重量----------
  811 + if (out_of_weight < 0 && o_price >= freight_free) {
  812 + fw_price = parseFloat(item['money']);
  813 + var out_of_weight = Math.abs(out_of_weight);
  814 + if (out_of_weight > item['first_weight']) {
  815 + var fw = out_of_weight - item['first_weight'];
  816 + var n = Math.ceil(fw / item['second_weight'])
  817 + fw_price = fw_price + n * parseFloat(item['add_money']);
  818 + }
803 } 819 }
804 //------按件数---------- 820 //------按件数----------
805 if (goods_piece > 0) { 821 if (goods_piece > 0) {
806 fp_price = parseFloat(item['piecemoney']); 822 fp_price = parseFloat(item['piecemoney']);
807 if (goods_piece > item['first_piece']) { 823 if (goods_piece > item['first_piece']) {
808 - var fp = goods_piece - item['first_piece'];  
809 - var m = Math.ceil(fp / item['second_piece']) 824 + var fp = goods_piece - item['first_piece'];
  825 + var m = Math.ceil(fp / item['second_piece'])
810 fp_price = fp_price + m * parseFloat(item['add_piecemoney']); 826 fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
811 } 827 }
812 } 828 }
813 - var rspice =parseFloat(price + fw_price + fp_price); 829 + var rspice = parseFloat(price + fw_price + fp_price);
814 return rspice; 830 return rspice;
815 }, 831 },
816 832
817 //------------循环获取config----------- 833 //------------循环获取config-----------
818 - get_wuliu_config:function(region_id,code,rs){  
819 - var item=null,rslist = rs.pageData;  
820 - for (var i = 0; i < rslist.length;i++){  
821 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}  
822 - }  
823 - return item; 834 + get_wuliu_config: function (region_id, code, rs) {
  835 + var item = null, rslist = rs.pageData;
  836 + for (var i = 0; i < rslist.length; i++) {
  837 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
  838 + }
  839 + return item;
824 }, 840 },
825 //-------循环获取config,code default------- 841 //-------循环获取config,code default-------
826 get_wuliu_default: function (code, rs) { 842 get_wuliu_default: function (code, rs) {
827 - var item = null, rslist=rs.pageData; 843 + var item = null, rslist = rs.pageData;
828 for (var i = 0; i < rslist.length; i++) { 844 for (var i = 0; i < rslist.length; i++) {
829 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } 845 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
830 } 846 }
831 return item; 847 return item;
832 }, 848 },
833 849
834 - //----------立即购买,选择物流-------------  
835 - bindPickerChange:function(e){  
836 - var ind = e.detail.value  
837 - this.setData({ index: ind });  
838 - this.calculatePrice2();  
839 - },  
840 -  
841 - //----------购物车结算,选择物流-------------  
842 - bindPickerChange_w: function (e) {  
843 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt;  
844 - this.setData({ [txt]: ind });  
845 - this.calculatePrice();  
846 - },  
847 - 850 + //----------立即购买,选择物流-------------
  851 + bindPickerChange: function (e) {
  852 + var ind = e.detail.value
  853 + this.setData({ index: ind });
  854 + this.calculatePrice2();
  855 + },
  856 +
  857 + //----------购物车结算,选择物流-------------
  858 + bindPickerChange_w: function (e) {
  859 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
  860 + this.setData({ [txt]: ind });
  861 + this.calculatePrice();
  862 + },
  863 +
848 cart_set_err: function (e) { 864 cart_set_err: function (e) {
849 var txt = e.currentTarget.dataset.err; 865 var txt = e.currentTarget.dataset.err;
850 var ob = {}; 866 var ob = {};
@@ -852,70 +868,70 @@ Page({ @@ -852,70 +868,70 @@ Page({
852 this.setData(ob); 868 this.setData(ob);
853 }, 869 },
854 870
855 - //// 开启物流的弹窗  
856 - show_wu_arr:function(e){  
857 - this.setData({ open_express: 1});  
858 - }, 871 + //// 开启物流的弹窗
  872 + show_wu_arr: function (e) {
  873 + this.setData({ open_express: 1 });
  874 + },
859 875
860 - //更新下默认,在onshow里面  
861 - update_code(){  
862 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
863 -  
864 - var uii=setInterval(function () {  
865 - if(th.data.wu_arr){  
866 - clearInterval(uii);  
867 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
868 - var item = th.data.wu_arr[k];  
869 - if (def_exp_code == item.code) {  
870 - m_wind = k;  
871 - }  
872 - }  
873 - //--如果是立即购买--  
874 - th.setData({ index: m_wind, is_express: m_wind});  
875 - }  
876 - },500)  
877 - }, 876 + //更新下默认,在onshow里面
  877 + update_code() {
  878 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  879 +
  880 + var uii = setInterval(function () {
  881 + if (th.data.wu_arr) {
  882 + clearInterval(uii);
  883 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  884 + var item = th.data.wu_arr[k];
  885 + if (def_exp_code == item.code) {
  886 + m_wind = k;
  887 + }
  888 + }
  889 + //--如果是立即购买--
  890 + th.setData({ index: m_wind, is_express: m_wind });
  891 + }
  892 + }, 500)
  893 + },
878 894
879 - // 关闭物流的弹窗  
880 - close_express:function(){  
881 - this.setData({ open_express:0 });  
882 - },  
883 - // 选择物流  
884 - click_express_name:function(e){  
885 - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;  
886 - var index=e.currentTarget.dataset.idxe;  
887 - var ob={ is_express: index, is_shipping_code: shippingcode,index:index};  
888 - this.setData(ob);  
889 - }, 895 + // 关闭物流的弹窗
  896 + close_express: function () {
  897 + this.setData({ open_express: 0 });
  898 + },
  899 + // 选择物流
  900 + click_express_name: function (e) {
  901 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  902 + var index = e.currentTarget.dataset.idxe;
  903 + var ob = { is_express: index, is_shipping_code: shippingcode, index: index };
  904 + this.setData(ob);
  905 + },
890 906
891 - //点击确定物流  
892 - determine_expres:function(e){  
893 - this.setData({ open_express: 0});  
894 - this.calculatePrice2();  
895 - },  
896 - //设置默认物流  
897 - select_default_logistics: function () {  
898 - var th=this;  
899 - var is_shipping_code=this.data.is_shipping_code  
900 - getApp().request.put("/api/weshop/users/update",{  
901 - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code},  
902 - success:function(rse){  
903 - if (rse.data.code==0){  
904 - getApp().globalData.userInfo.def_exp_code=is_shipping_code;  
905 - th.setData({ open_express: 0 });  
906 - //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----  
907 - //if(th.data.is_b_now==1) th.calculatePrice2();  
908 - //else th.calculatePrice();  
909 - th.calculatePrice2();  
910 - }  
911 - }  
912 - })  
913 - }, 907 + //点击确定物流
  908 + determine_expres: function (e) {
  909 + this.setData({ open_express: 0 });
  910 + this.calculatePrice2();
  911 + },
  912 + //设置默认物流
  913 + select_default_logistics: function () {
  914 + var th = this;
  915 + var is_shipping_code = this.data.is_shipping_code
  916 + getApp().request.put("/api/weshop/users/update", {
  917 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
  918 + success: function (rse) {
  919 + if (rse.data.code == 0) {
  920 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
  921 + th.setData({ open_express: 0 });
  922 + //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
  923 + //if(th.data.is_b_now==1) th.calculatePrice2();
  924 + //else th.calculatePrice();
  925 + th.calculatePrice2();
  926 + }
  927 + }
  928 + })
  929 + },
914 930
915 931
916 - //跳转到购买卡  
917 - buycard:function(){  
918 - getApp().goto("/pages/user/plus/plus");  
919 - getApp().globalData.plus_buy_back=1;  
920 - } 932 + //跳转到购买卡
  933 + buycard: function () {
  934 + getApp().goto("/pages/user/plus/plus");
  935 + getApp().globalData.plus_buy_back = 1;
  936 + }
921 }); 937 });
pages/cart/cart_wk/cart_wk.js
@@ -420,10 +420,10 @@ Page({ @@ -420,10 +420,10 @@ Page({
420 var to = getApp(), th = this; 420 var to = getApp(), th = this;
421 to.getConfig2(function (ee) { 421 to.getConfig2(function (ee) {
422 to.getwuliuprice(function (rs) { 422 to.getwuliuprice(function (rs) {
423 - var o_shipping_price = 0,  
424 - goods_weight = -1,  
425 - goods_piece = -1,  
426 - good = th.data.goods; 423 + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods;
  424 + var out_of_weight=null; //超出多少重量
  425 + var freight_free = ee.freight_free; //全场满多少包邮
  426 + var weight_free = ee.weight_free; //多少kg内包邮
427 //-----------当地址不为空,且是物流时,计算物流费用---------- 427 //-----------当地址不为空,且是物流时,计算物流费用----------
428 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 428 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
429 switch (good['exp_sum_type']) { 429 switch (good['exp_sum_type']) {
@@ -435,6 +435,9 @@ Page({ @@ -435,6 +435,9 @@ Page({
435 if (goods_weight < 0) goods_weight = 0; 435 if (goods_weight < 0) goods_weight = 0;
436 //累积商品重量 每种商品的重量 * 数量 436 //累积商品重量 每种商品的重量 * 数量
437 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 437 goods_weight += good['weight'] * th.data.order.order_goods['goods_num'];
  438 + if(weight_free > 0){
  439 + out_of_weight = (weight_free * 1000 ) - goods_weight;
  440 + }
438 break; 441 break;
439 case 3: 442 case 3:
440 if (goods_piece < 0) goods_piece = 0; 443 if (goods_piece < 0) goods_piece = 0;
@@ -443,11 +446,10 @@ Page({ @@ -443,11 +446,10 @@ Page({
443 break; 446 break;
444 } 447 }
445 var code = th.data.wu_arr[th.data.index].code; 448 var code = th.data.wu_arr[th.data.index].code;
446 - var freight_free = ee.freight_free; //全场满多少包邮  
447 //--全部金额-- 449 //--全部金额--
448 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; 450 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
449 var shipping_price = 451 var shipping_price =
450 - th.calculatewuliu(code, o_shipping_price, goods_weight, 452 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
451 goods_piece, th.data.user_addr, freight_free, allpice, rs); 453 goods_piece, th.data.user_addr, freight_free, allpice, rs);
452 var exp_price = parseFloat(shipping_price).toFixed(2); 454 var exp_price = parseFloat(shipping_price).toFixed(2);
453 allpice = parseFloat(exp_price) + parseFloat(allpice); 455 allpice = parseFloat(exp_price) + parseFloat(allpice);
@@ -465,12 +467,12 @@ Page({ @@ -465,12 +467,12 @@ Page({
465 }, 467 },
466 468
467 //----------------计算物流--------------- 469 //----------------计算物流---------------
468 - calculatewuliu: function (code, o_shipping_price, goods_weight, 470 + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
469 goods_piece, user_addr, freight_free, o_price, rs) { 471 goods_piece, user_addr, freight_free, o_price, rs) {
470 var price = 0, th = this; 472 var price = 0, th = this;
471 price += parseFloat(o_shipping_price); 473 price += parseFloat(o_shipping_price);
472 //如果是包邮 474 //如果是包邮
473 - if (freight_free > 0 && o_price >= freight_free) { return 0; } 475 + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; }
474 if (user_addr == null) { return 0; } 476 if (user_addr == null) { return 0; }
475 //计算物流的config item; 477 //计算物流的config item;
476 var item = null; 478 var item = null;
@@ -484,7 +486,7 @@ Page({ @@ -484,7 +486,7 @@ Page({
484 item = item.config; 486 item = item.config;
485 if (item == null) return o_shipping_price; 487 if (item == null) return o_shipping_price;
486 //------按重量---------- 488 //------按重量----------
487 - if (goods_weight > 0) { 489 + if (goods_weight >= 0 && item['money']) {
488 fw_price = parseFloat(item['money']); 490 fw_price = parseFloat(item['money']);
489 if (goods_weight > item['first_weight']) { 491 if (goods_weight > item['first_weight']) {
490 var fw = goods_weight - item['first_weight']; 492 var fw = goods_weight - item['first_weight'];
@@ -492,6 +494,16 @@ Page({ @@ -492,6 +494,16 @@ Page({
492 fw_price = fw_price + n * parseFloat(item['add_money']); 494 fw_price = fw_price + n * parseFloat(item['add_money']);
493 } 495 }
494 } 496 }
  497 + //------超出重量----------
  498 + if(out_of_weight < 0 && o_price >= freight_free){
  499 + fw_price = parseFloat(item['money']);
  500 + var out_of_weight = Math.abs(out_of_weight);
  501 + if (out_of_weight > item['first_weight']) {
  502 + var fw = out_of_weight - item['first_weight'];
  503 + var n = Math.ceil(fw / item['second_weight'])
  504 + fw_price = fw_price + n * parseFloat(item['add_money']);
  505 + }
  506 + }
495 //------按件数---------- 507 //------按件数----------
496 if (goods_piece > 0) { 508 if (goods_piece > 0) {
497 fp_price = parseFloat(item['piecemoney']); 509 fp_price = parseFloat(item['piecemoney']);
pages/goods/goodsInfo/goodsInfo.js
@@ -33,6 +33,8 @@ Page({ @@ -33,6 +33,8 @@ Page({
33 iurl: o.imghost, 33 iurl: o.imghost,
34 defaultAvatar: o.resourceUrl + "/static/images/user68.jpg", 34 defaultAvatar: o.resourceUrl + "/static/images/user68.jpg",
35 35
  36 + viplimited_timetype: 0,
  37 +
36 data: null, 38 data: null,
37 content: "", //商品详情 39 content: "", //商品详情
38 comments: null, //商品评论 40 comments: null, //商品评论
@@ -740,7 +742,8 @@ Page({ @@ -740,7 +742,8 @@ Page({
740 i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { 742 i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
741 failRollback: !0, 743 failRollback: !0,
742 success: function (t) { 744 success: function (t) {
743 - console.log(t); 745 +
  746 + ee.data.viplimited_timetype = t.data.data.viplimited_timetype;
744 if (t.data.code == 0) { 747 if (t.data.code == 0) {
745 if (t.data.data.is_on_sale != 1) { 748 if (t.data.data.is_on_sale != 1) {
746 wx.showModal({ 749 wx.showModal({
@@ -2243,7 +2246,7 @@ Page({ @@ -2243,7 +2246,7 @@ Page({
2243 ) { 2246 ) {
2244 url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; 2247 url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1";
2245 } 2248 }
2246 - 2249 + console.log(url,500);
2247 var ob = { 2250 var ob = {
2248 title: price + "元 " + title, 2251 title: price + "元 " + title,
2249 path: url, 2252 path: url,
@@ -2268,7 +2271,6 @@ Page({ @@ -2268,7 +2271,6 @@ Page({
2268 2271
2269 ob.title = text + " " + name; 2272 ob.title = text + " " + name;
2270 } 2273 }
2271 -  
2272 //-- 页面不能刷新 -- 2274 //-- 页面不能刷新 --
2273 this.data.show_prew_img=1; 2275 this.data.show_prew_img=1;
2274 return ob; 2276 return ob;
@@ -3720,7 +3722,8 @@ Page({ @@ -3720,7 +3722,8 @@ Page({
3720 data: { 3722 data: {
3721 store_id: os.stoid, 3723 store_id: os.stoid,
3722 user_id: user_id, 3724 user_id: user_id,
3723 - goods_id: gd.goods_id 3725 + goods_id: gd.goods_id,
  3726 + timetype: th.data.viplimited_timetype
3724 }, 3727 },
3725 success: function (t) { 3728 success: function (t) {
3726 if (t.data.code == 0) { 3729 if (t.data.code == 0) {
@@ -4164,7 +4167,7 @@ Page({ @@ -4164,7 +4167,7 @@ Page({
4164 var item = this.data.teamgroup[ind]; 4167 var item = this.data.teamgroup[ind];
4165 var id = item.id; 4168 var id = item.id;
4166 var th = this; 4169 var th = this;
4167 - 4170 + var goods_id=this.data.data.goods_id;
4168 getApp().request.get("/api/weshop/order/page", { 4171 getApp().request.get("/api/weshop/order/page", {
4169 data: { 4172 data: {
4170 pt_prom_id: item.team_id, 4173 pt_prom_id: item.team_id,
@@ -4207,14 +4210,14 @@ Page({ @@ -4207,14 +4210,14 @@ Page({
4207 4210
4208 } else { 4211 } else {
4209 wx.navigateTo({ 4212 wx.navigateTo({
4210 - url: "/pages/team/team_show/team_show?tg_id=" + id, 4213 + url: `/pages/team/team_show/team_show?tg_id=${id}&goods_id=${goods_id}`,
4211 }); 4214 });
4212 } 4215 }
4213 } 4216 }
4214 //--跳转到参团-- 4217 //--跳转到参团--
4215 else { 4218 else {
4216 wx.navigateTo({ 4219 wx.navigateTo({
4217 - url: "/pages/team/team_show/team_show?tg_id=" + id, 4220 + url: `/pages/team/team_show/team_show?tg_id=${id}&goods_id=${goods_id}`,
4218 }); 4221 });
4219 } 4222 }
4220 } 4223 }
pages/team/team_show/team_show.js
@@ -94,18 +94,29 @@ Page({ @@ -94,18 +94,29 @@ Page({
94 94
95 }, 95 },
96 onLoad: function(options) { 96 onLoad: function(options) {
97 -  
98 wx.setNavigationBarTitle({ title: "拼团订单",}) 97 wx.setNavigationBarTitle({ title: "拼团订单",})
99 //var postdata=getApp().globalData.to_group; 98 //var postdata=getApp().globalData.to_group;
100 var postdata=options; 99 var postdata=options;
101 - var tg_id = postdata.tg_id, first_leader=options.first_leader; 100 + var tg_id = postdata.tg_id, first_leader=options.first_leader,goods_id=options.goods_id;
102 //如果tg_id是空的话 101 //如果tg_id是空的话
103 - if(tg_id==undefined || tg_id==null || tg_id==""){ 102 + if(tg_id==null ||goods_id==null){
104 var tg_id_str=decodeURIComponent(postdata.scene); 103 var tg_id_str=decodeURIComponent(postdata.scene);
105 tg_id_str=tg_id_str.split("_"); 104 tg_id_str=tg_id_str.split("_");
106 - tg_id=tg_id_str[0];  
107 - if(tg_id_str.length>1){  
108 - first_leader=tg_id_str[1]; 105 + console.log(tg_id_str.length);
  106 + //tg_id_str[0] teamgroup.id tg_id_str[1] user_id tg_id_str[2] goods_id
  107 + switch(tg_id_str.length){
  108 + case 1:
  109 + tg_id=tg_id_str[0];
  110 + break;
  111 + case 2:
  112 + tg_id=tg_id_str[0];
  113 + first_leader=tg_id_str[1];
  114 + break;
  115 + case 3:
  116 + tg_id=tg_id_str[0];
  117 + first_leader=tg_id_str[1];
  118 + goods_id=tg_id_str[2];
  119 + break;
109 } 120 }
110 } 121 }
111 //--判断一下是不是导购-- 122 //--判断一下是不是导购--
@@ -118,14 +129,13 @@ Page({ @@ -118,14 +129,13 @@ Page({
118 } 129 }
119 }) 130 })
120 } 131 }
121 -  
122 - this.setData({tg_id: tg_id }); 132 + this.setData({tg_id: tg_id,goods_id});
123 getApp().globalData.to_group=null; 133 getApp().globalData.to_group=null;
124 134
125 - var th=this;  
126 - getApp().getConfig2(function(e) {  
127 - th.setData({ bconfig: e,});  
128 - th.wait_for_store_config(); //获取默认的门店 135 + var th=this;
  136 + getApp().getConfig2(function(e) {
  137 + th.setData({ bconfig: e,});
  138 + th.wait_for_store_config(); //获取默认的门店
129 }) 139 })
130 140
131 }, 141 },
@@ -358,17 +368,47 @@ Page({ @@ -358,17 +368,47 @@ Page({
358 max_num = 0, 368 max_num = 0,
359 min_price = 0, 369 min_price = 0,
360 th=this, 370 th=this,
361 - that=th; 371 + that=th,
  372 + flag=null;
  373 + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2",{
  374 + data:{
  375 + store_id: os.stoid,
  376 + is_end: 0,
  377 + is_show: 1,
  378 + user_id: getApp().globalData.user_id,
  379 + pageSize:1000
  380 + }
  381 + }).then(res=>{
  382 + let pd_list=res.data.data.pageData;
  383 + if(res.data.code==0 && pd_list.length>0){
  384 + flag =pd_list.some(pd=>{
  385 + // if(th.data.goods_id){
  386 + return pd.goods_id==th.data.goods_id;
  387 + // }
  388 + })
  389 + }
  390 + })
  391 + if(!flag){
  392 + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000});
  393 + setTimeout(function () {
  394 + ut.wx_back();
  395 + }, 1000)
  396 + return false;
  397 + }
362 398
363 //获取活动从表信息team_id,listno团编号(券号) 399 //获取活动从表信息team_id,listno团编号(券号)
364 await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, { 400 await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, {
365 }).then(res => { 401 }).then(res => {
  402 +
  403 + if(res.data.code !=0 ){
  404 + getApp().showWarning(res.data.msg);
  405 + th.go_back();
  406 + return false;
  407 + }
366 408
367 -  
368 - if(res.data.code==0 && res.data && res.data.data ) { 409 + if(res.data && res.data.data ) {
369 410
370 teamgroup = res.data.data; 411 teamgroup = res.data.data;
371 -  
372 //获取当前时间,并且判断剩余时间 412 //获取当前时间,并且判断剩余时间
373 var nt = ut.gettimestamp(); 413 var nt = ut.gettimestamp();
374 var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); 414 var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss");
@@ -388,7 +428,6 @@ Page({ @@ -388,7 +428,6 @@ Page({
388 } 428 }
389 429
390 } 430 }
391 -  
392 }) 431 })
393 432
394 //判断是不是要继续的开关 433 //判断是不是要继续的开关
@@ -433,36 +472,10 @@ Page({ @@ -433,36 +472,10 @@ Page({
433 //获取活动表的信息根据活动team_id 472 //获取活动表的信息根据活动team_id
434 await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + teamgroup.team_id, { 473 await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + teamgroup.team_id, {
435 data: {} 474 data: {}
436 - }).then(async res => {  
437 - var flag=null; 475 + }).then(res => {
438 if (res.data.code == 0) { 476 if (res.data.code == 0) {
439 teamlist = res.data.data; 477 teamlist = res.data.data;
440 goods_id = res.data.data.goods_id; 478 goods_id = res.data.data.goods_id;
441 -  
442 - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{  
443 - data:{  
444 - store_id: os.stoid,  
445 - is_end: 0,  
446 - is_show: 1,  
447 - user_id: getApp().globalData.user_id,  
448 - pageSize:1000  
449 - }  
450 - }).then(res=>{  
451 - let pd_list=res.data.data.pageData;  
452 - if(res.data.code==0 && pd_list.length>0){  
453 - flag =pd_list.some(pd=>{  
454 - return pd.goods_id==teamlist['goods_id']  
455 - })  
456 - }  
457 - })  
458 - if(!flag){  
459 - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000});  
460 - // setTimeout(function () {  
461 - ut.wx_back();  
462 - // }, 2000)  
463 - return false;  
464 - }  
465 -  
466 //----------查看阶梯团------------ 479 //----------查看阶梯团------------
467 if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined) { 480 if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined) {
468 var ct_rylist = JSON.parse(teamlist.ct_rylist); 481 var ct_rylist = JSON.parse(teamlist.ct_rylist);
pages/team/team_success/team_success.js
@@ -398,19 +398,26 @@ Page({ @@ -398,19 +398,26 @@ Page({
398 var app = getApp(); 398 var app = getApp();
399 var unit = that.data.screenWidth / 750 * 1.35; 399 var unit = that.data.screenWidth / 750 * 1.35;
400 var scene=th.data.teamgroup.id; 400 var scene=th.data.teamgroup.id;
  401 + var goods_id=th.data.teamlist.goods_id;
401 var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; 402 var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;
402 if(user_id>0){ 403 if(user_id>0){
403 scene+="_"+user_id; 404 scene+="_"+user_id;
404 } 405 }
  406 + if(goods_id !==""){
  407 + scene+="_"+goods_id;
  408 + }
405 409
406 //二微码 410 //二微码
407 var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ 411 var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+
408 os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; 412 os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show";
409 413
  414 + console.log(path3,6000);
  415 +
410 //读取文件成功则OK-- 416 //读取文件成功则OK--
411 wx.getImageInfo({ 417 wx.getImageInfo({
412 src: path3, 418 src: path3,
413 success:function (res) { 419 success:function (res) {
  420 + console.log(res,5000);
414 //回调写法 421 //回调写法
415 th.get_head_temp(th.get_goods_temp,function () { 422 th.get_head_temp(th.get_goods_temp,function () {
416 var vpath = res.path; 423 var vpath = res.path;
@@ -812,7 +819,8 @@ Page({ @@ -812,7 +819,8 @@ Page({
812 onShareAppMessage: function (e) { 819 onShareAppMessage: function (e) {
813 var th=this; 820 var th=this;
814 var scene=this.data.teamgroup.id; 821 var scene=this.data.teamgroup.id;
815 - var url="/pages/team/team_show/team_show?tg_id="+scene; 822 + var goods_id=this.data.teamlist.goods_id;
  823 + var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id="+goods_id;
816 //--分享图片-- 824 //--分享图片--
817 var img=th.data.iurl+th.data.teamlist.share_imgurl; 825 var img=th.data.iurl+th.data.teamlist.share_imgurl;
818 //--把会员分享出去-- 826 //--把会员分享出去--
@@ -828,7 +836,6 @@ Page({ @@ -828,7 +836,6 @@ Page({
828 if(th.data.teamlist.share_title){ 836 if(th.data.teamlist.share_title){
829 share_title=th.data.teamlist.share_title; 837 share_title=th.data.teamlist.share_title;
830 } 838 }
831 - console.log(url,3000);  
832 return { 839 return {
833 path:url, 840 path:url,
834 title: share_title, 841 title: share_title,