Commit 6b130349d994c1960857f30de1fce1ca42e1cde3

Authored by yvan.ni
1 parent a607b625

确认购买页面

pages/cart/cart2/cart2.js
@@ -97,19 +97,21 @@ Page({ @@ -97,19 +97,21 @@ Page({
97 } 97 }
98 }); 98 });
99 99
100 - //先获取是否有关闭使用优惠券  
101 - getApp().getConfig2(function (ee) {  
102 - var json_d = JSON.parse(ee.switch_list);  
103 - th.setData({ is_close_quan: json_d.is_close_quan });  
104 - //-----先获取物流,再获取用户信息,再展示页面-----  
105 - th.get_wuliu(th.get_info(th.show_page));  
106 - }) 100 +
107 }, 101 },
108 onUnload: function () { this.setData({ isclose: 1 })}, 102 onUnload: function () { this.setData({ isclose: 1 })},
109 103
110 //----------子页返回父页触发---------- 104 //----------子页返回父页触发----------
111 onShow: function() { 105 onShow: function() {
112 - console.log('onshow'); 106 +
  107 + //先获取是否有关闭使用优惠券
  108 + getApp().getConfig2(function (ee) {
  109 + var json_d = JSON.parse(ee.switch_list);
  110 + th.setData({ is_close_quan: json_d.is_close_quan });
  111 + //-----先获取物流,再获取用户信息,再展示页面-----
  112 + th.get_wuliu(th.get_info(th.show_page));
  113 + })
  114 +
113 var th=this; 115 var th=this;
114 console.log(th.data.isclose); 116 console.log(th.data.isclose);
115 if (th.data.isclose==0){ 117 if (th.data.isclose==0){
@@ -230,7 +232,7 @@ Page({ @@ -230,7 +232,7 @@ Page({
230 }); 232 });
231 }, 233 },
232 234
233 - //-----真的获取购物车-------- 235 + //-----真的获取购物车,入口--------
234 get_cart: function () { 236 get_cart: function () {
235 var th = this,app=getApp(); 237 var th = this,app=getApp();
236 a.get("/api/weshop/cart/list", { 238 a.get("/api/weshop/cart/list", {
@@ -289,7 +291,7 @@ Page({ @@ -289,7 +291,7 @@ Page({
289 var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; 291 var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;
290 if(e_t==0 && def_exp_code){ 292 if(e_t==0 && def_exp_code){
291 for(var k=0;k<th.data.wu_arr.length;k++){ 293 for(var k=0;k<th.data.wu_arr.length;k++){
292 - var itme=th.data.wu_arr[k]; if(def_exp_code=item.code){ m_wind=k; } 294 + var item=th.data.wu_arr[k]; if(def_exp_code=item.code){ m_wind=k; }
293 } 295 }
294 } 296 }
295 297
@@ -356,7 +358,6 @@ Page({ @@ -356,7 +358,6 @@ Page({
356 }) 358 })
357 359
358 if(frozenQuan){ 360 if(frozenQuan){
359 - console.log("券列表111111111111111111",arr[ind].quan_list);  
360 arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan); 361 arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan);
361 } 362 }
362 363
@@ -372,7 +373,7 @@ Page({ @@ -372,7 +373,7 @@ Page({
372 }); 373 });
373 }, 374 },
374 375
375 - //-----获取立即购买的商品信息---- 376 + //-----获取立即购买的商品信息,入口----
376 get_buy_goods: function (e){ 377 get_buy_goods: function (e){
377 var th=this; 378 var th=this;
378 var gg = to.get_b_now(); 379 var gg = to.get_b_now();
@@ -396,6 +397,14 @@ Page({ @@ -396,6 +397,14 @@ Page({
396 case 2: et = 0; break; 397 case 2: et = 0; break;
397 } 398 }
398 399
  400 + var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;
  401 + if(et==0 && def_exp_code){
  402 + for(var k=0;k<th.data.wu_arr.length;k++){
  403 + var item=th.data.wu_arr[k]; if(def_exp_code=item.code){ m_wind=k; }
  404 + }
  405 + }
  406 +
  407 +
399 switch (gd.prom_type){ 408 switch (gd.prom_type){
400 case 0: 409 case 0:
401 case 6: 410 case 6:
@@ -415,7 +424,7 @@ Page({ @@ -415,7 +424,7 @@ Page({
415 }).then(res=>{ 424 }).then(res=>{
416 if(res.data.code==0) 425 if(res.data.code==0)
417 quanlist=res.data.data.pageData; 426 quanlist=res.data.data.pageData;
418 - console.log("22222222222222222222券的列表", quanlist); 427 +
419 428
420 }) 429 })
421 } 430 }
@@ -436,7 +445,7 @@ Page({ @@ -436,7 +445,7 @@ Page({
436 t.data.data.prom_type = 0; 445 t.data.data.prom_type = 0;
437 446
438 th.setData({ 447 th.setData({
439 - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, 448 + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,
440 bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist 449 bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist
441 }); 450 });
442 //计算价格 451 //计算价格
@@ -465,7 +474,6 @@ Page({ @@ -465,7 +474,6 @@ Page({
465 }).then(res=>{ 474 }).then(res=>{
466 if(res.data.code==0) 475 if(res.data.code==0)
467 quanlist=res.data.data.pageData; 476 quanlist=res.data.data.pageData;
468 - console.log("券接口的列表333333333333333",quanlist);  
469 }) 477 })
470 478
471 var frozenQuan=null; 479 var frozenQuan=null;
@@ -481,9 +489,9 @@ Page({ @@ -481,9 +489,9 @@ Page({
481 } 489 }
482 } 490 }
483 } 491 }
484 - console.log("3333333333券的列表", quanlist); 492 +
485 th.setData({ 493 th.setData({
486 - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, 494 + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,
487 bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist 495 bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist
488 }); 496 });
489 //计算价格 497 //计算价格
@@ -1087,15 +1095,14 @@ Page({ @@ -1087,15 +1095,14 @@ Page({
1087 }); 1095 });
1088 }, 1096 },
1089 1097
1090 - //--------立即购买时,选择自提和物流----------- 1098 + //--------购物车购买时,选择自提和物流-----------
1091 setexptype_w:function(t){ 1099 setexptype_w:function(t){
1092 1100
1093 - var uerinfo= getApp().globalData.userInfo.def_exp_code;  
1094 -  
1095 - console.log(getApp().globalData.userInfo, "获取默认的物流地址", uerinfo );  
1096 - var th=this;  
1097 -  
1098 - var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, ont = t.currentTarget.dataset.ont; 1101 + var def_exp_code= getApp().globalData.userInfo.def_exp_code,th=this;
  1102 + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt,
  1103 + wl_txt = t.currentTarget.dataset.wl_txt,
  1104 + ont = t.currentTarget.dataset.ont;
  1105 +
1099 th.setData({ [txt]: ty }); 1106 th.setData({ [txt]: ty });
1100 var iszt=1; 1107 var iszt=1;
1101 1108
@@ -1111,37 +1118,51 @@ Page({ @@ -1111,37 +1118,51 @@ Page({
1111 th.setData({ is_all_zt: iszt }); 1118 th.setData({ is_all_zt: iszt });
1112 } 1119 }
1113 //判断有没有默认的物流地址值 1120 //判断有没有默认的物流地址值
1114 - if (uerinfo != "" && uerinfo != null && uerinfo !=undefined) { 1121 + if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {
1115 var wu_arr=this.data.wu_arr; 1122 var wu_arr=this.data.wu_arr;
1116 if (wu_arr!= null && wu_arr!=""){ 1123 if (wu_arr!= null && wu_arr!=""){
1117 for(var i=0;i<wu_arr.length;i++){ 1124 for(var i=0;i<wu_arr.length;i++){
1118 - if (wu_arr[i].shipping_code == uerinfo){  
1119 - console.log(wu_arr[i],"人生啊,路漫漫,",wu_arr,"判断传出去的下标",i);  
1120 - th.setData({index:i});  
1121 - } 1125 + if (wu_arr[i].shipping_code == def_exp_code){
  1126 + var set_txt="cartlist"
  1127 + th.setData({wl_txt:i});
  1128 + }
1122 } 1129 }
1123 } 1130 }
1124 -  
1125 }else{ 1131 }else{
1126 - //判断是不是快递  
1127 - if (ont == 66) {  
1128 - this.express_name();  
1129 - } 1132 + //判断是不是快递
  1133 + if (ont == 66) {
  1134 + this.express_name();
  1135 + }
1130 } 1136 }
1131 //----计算此时购物车的价格---- 1137 //----计算此时购物车的价格----
1132 th.calculatePrice(); 1138 th.calculatePrice();
1133 }, 1139 },
  1140 +
1134 //--------立即购买时,选择自提和物流---------- 1141 //--------立即购买时,选择自提和物流----------
1135 setexptype:function(t){ 1142 setexptype:function(t){
1136 var th=this; 1143 var th=this;
1137 - var ty = t.currentTarget.dataset.t; 1144 + var ty = t.currentTarget.dataset.t,def_exp_code= getApp().globalData.userInfo.def_exp_code;
1138 th.setData({ bn_exp_type:ty}); 1145 th.setData({ bn_exp_type:ty});
1139 //当物流为空的时候。 1146 //当物流为空的时候。
1140 if (ty == 0 && th.data.wu_arr==null){ 1147 if (ty == 0 && th.data.wu_arr==null){
1141 return th.get_wuliu(th.calculatePrice2()); 1148 return th.get_wuliu(th.calculatePrice2());
1142 } 1149 }
1143 - th.calculatePrice2()  
1144 - console.log('setexptype'); 1150 +
  1151 + //判断有没有默认的物流地址值
  1152 + if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {
  1153 + var wu_arr=this.data.wu_arr;
  1154 + if (wu_arr!= null && wu_arr!=""){
  1155 + for(var i=0;i<wu_arr.length;i++){
  1156 + if (wu_arr[i].shipping_code == def_exp_code){
  1157 + th.setData({index:i});
  1158 + }
  1159 + }
  1160 + }
  1161 + }
  1162 +
  1163 +
  1164 + th.calculatePrice2()
  1165 + console.log('setexptype');
1145 }, 1166 },
1146 1167
1147 //--------立即购买时,使用余额-------- 1168 //--------立即购买时,使用余额--------
pages/cart/cart2/cart2.wxml
@@ -111,12 +111,15 @@ @@ -111,12 +111,15 @@
111 <view class="circle xc-hookts on"></view> 111 <view class="circle xc-hookts on"></view>
112 </block> 112 </block>
113 113
114 - <view bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">快递邮寄</view> 114 + <view bindtap='setexptype_w' data-t='0'
  115 + data-txt='cartlist[{{pidx}}].exp_type'
  116 + data-wl_txt='cartlist[{{pidx}}].wind'
  117 + class="yu_er">快递邮寄</view>
115 </view> 118 </view>
116 </view> 119 </view>
117 <block wx:if="{{item.exp_type==0}}"> 120 <block wx:if="{{item.exp_type==0}}">
118 <view class="flex-vertical"> 121 <view class="flex-vertical">
119 - <view >{{wu_arr[index].name}}</view> 122 + <view >{{wu_arr[item.wind].name}}</view>
120 <view class="xc-right"></view> 123 <view class="xc-right"></view>
121 </view> 124 </view>
122 </block> 125 </block>
@@ -169,9 +172,7 @@ @@ -169,9 +172,7 @@
169 <view class="flex-vertical fs28 xc-ash">商品属性: <view class="goods-color"> 172 <view class="flex-vertical fs28 xc-ash">商品属性: <view class="goods-color">
170 <text wx:if="{{bn_goods.goods_spec!=''}}"> {{bn_goods.goods_spec}}/</text>{{bn_goods.goods_color}}</view></view> 173 <text wx:if="{{bn_goods.goods_spec!=''}}"> {{bn_goods.goods_spec}}/</text>{{bn_goods.goods_color}}</view></view>
171 174
172 -  
173 - <!-----商品名称规格------>  
174 - 175 + <!-----商品名称规格------>
175 <view class="order-num flex-space-between"> 176 <view class="order-num flex-space-between">
176 <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view> 177 <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view>
177 <view class="goods-num">x{{bn_goods.buynum}}</view> 178 <view class="goods-num">x{{bn_goods.buynum}}</view>
@@ -199,11 +200,11 @@ @@ -199,11 +200,11 @@
199 200
200 <view class="use-item flex-space-between"> 201 <view class="use-item flex-space-between">
201 <view class="flex"> 202 <view class="flex">
202 - <view bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}};"> 203 + <view bindtap='setexptype' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}};">
203 <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon> 204 <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon>
204 <view class="yu_er">自提</view> 205 <view class="yu_er">自提</view>
205 </view> 206 </view>
206 - <view bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}};"> 207 + <view bindtap='setexptype' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}};">
207 <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon> 208 <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon>
208 <view class="yu_er">物流</view> 209 <view class="yu_er">物流</view>
209 </view> 210 </view>
@@ -216,28 +217,6 @@ @@ -216,28 +217,6 @@
216 </block> 217 </block>
217 </view> 218 </view>
218 219
219 - <!-- <view class="use-item" hidden='{{bn_exp_type==1}}'>  
220 - <view>使用物流:</view>  
221 - <view >{{wu_arr[index].name}}</view> -->  
222 - <!-- <picker bindchange="bindPickerChange" value="{{index}}" range="{{wu_arr}}" range-key="name">  
223 -  
224 - </picker> -->  
225 - <!-- </view> -->  
226 -  
227 - <!-- <view class="use-item">  
228 - <view>使用积分 : </view>  
229 - <input bindblur="keyUpChangePay2" maxlength="20" name="pay_points" placeholder="可用积分为:{{order.userInfo.pay_points}}" type="number"></input>  
230 - <button class="use-btn" formType="submit">使用</button>  
231 - </view>  
232 - <view class="use-item">  
233 - <view>使用券码 : </view>  
234 - <input name="couponCode" placeholder="请输入优惠券券码" type="text"></input>  
235 - <button class="use-btn" formType="submit">使用</button>  
236 - </view>  
237 - <view class="use-item" style="display:{{payWithUserMoney&&payWithPoints?'none':'flex'}}">  
238 - <view>支付密码 : </view>  
239 - <input password maxlength="20" name="paypwd" placeholder="请输入密码" type="text"></input>  
240 - </view> -->  
241 </view> 220 </view>
242 221
243 <!-----使用余额------> 222 <!-----使用余额------>
@@ -245,7 +224,6 @@ @@ -245,7 +224,6 @@
245 <view class="use-item" bindtap='set_bn_useyuer'> 224 <view class="use-item" bindtap='set_bn_useyuer'>
246 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> 225 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
247 <view class="yu_er">使用余额 :¥{{yuer}} </view> 226 <view class="yu_er">使用余额 :¥{{yuer}} </view>
248 - <!-- <input bindblur="keyUpChangePay1" maxlength="20" name="user_money" placeholder="可用余额:{{order.userInfo.user_money}}" type="digit"></input> <button class="use-btn" formType="submit">使用</button>-->  
249 </view> 227 </view>
250 </view> 228 </view>
251 <view class="coupon-mes flex-vertical"> 229 <view class="coupon-mes flex-vertical">
@@ -381,8 +359,7 @@ @@ -381,8 +359,7 @@
381 <view class="flex top-frame"> 359 <view class="flex top-frame">
382 360
383 <view class="frame"> 361 <view class="frame">
384 - <!-- <view class="flex"> -->  
385 - 362 + <!-- <view class="flex"> -->
386 <view class="coupon-wode ib flex ellipsis-2 "> 363 <view class="coupon-wode ib flex ellipsis-2 ">
387 <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}} 364 <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}
388 </text> 365 </text>
@@ -401,7 +378,7 @@ @@ -401,7 +378,7 @@
401 </view> --> 378 </view> -->
402 379
403 <block wx:if="{{is_coupon==index}}"> 380 <block wx:if="{{is_coupon==index}}">
404 - <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> 381 + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view>
405 </block> 382 </block>
406 <block wx:else> 383 <block wx:else>
407 <view class="circle xc-hooks on"></view> 384 <view class="circle xc-hooks on"></view>
pages/goods/goodsList/goodsList.js
@@ -26,14 +26,14 @@ Page({ @@ -26,14 +26,14 @@ Page({
26 this.data.is_new=t.is_new; 26 this.data.is_new=t.is_new;
27 this.data.is_hot=t.is_hot; 27 this.data.is_hot=t.is_hot;
28 28
29 - if (0 != t.cat_id && t.cat_id != undefined) {  
30 - url += "&cat_id=" + t.cat_id;  
31 - if (t.parent_id == undefined && t.parent_id == null){  
32 - url += "&parent_id=0";  
33 - }else{  
34 - url += "&parent_id="+t.parent_id;  
35 - }  
36 - } 29 + if (0 != t.cat_id && t.cat_id != undefined) {
  30 + url += "&cat_id=" + t.cat_id;
  31 + if (t.pid == undefined || t.pid == null){
  32 + url += "&parent_id=0";
  33 + }else{
  34 + url += "&parent_id="+t.pid;
  35 + }
  36 + }
37 37
38 if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } 38 if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
39 if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } 39 if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }