Commit adc68ddae9d7d41e63a42ad301ea834baed3d165
1 parent
fabd3b79
商品分类,商品结算
Showing
4 changed files
with
68 additions
and
28 deletions
pages/cart/cart2/cart2.js
@@ -82,6 +82,7 @@ Page({ | @@ -82,6 +82,7 @@ Page({ | ||
82 | expres_name:"",//点击选定 | 82 | expres_name:"",//点击选定 |
83 | isopen:0,//券的说明 | 83 | isopen:0,//券的说明 |
84 | is_coupon:0,//选择券的控制属性 | 84 | is_coupon:0,//选择券的控制属性 |
85 | + is_shipping_code:"",//插入用户默认地址 | ||
85 | }, | 86 | }, |
86 | onLoad: function(t) { | 87 | onLoad: function(t) { |
87 | 88 | ||
@@ -153,7 +154,7 @@ Page({ | @@ -153,7 +154,7 @@ Page({ | ||
153 | var th = this; | 154 | var th = this; |
154 | to.getwuliu(function (e) { | 155 | to.getwuliu(function (e) { |
155 | console.log("ws"); | 156 | console.log("ws"); |
156 | - console.log(e); | 157 | + console.log("物流的数据77777777777777",e); |
157 | th.setData({ wu_arr: e }) | 158 | th.setData({ wu_arr: e }) |
158 | typeof func == "function" && func(); | 159 | typeof func == "function" && func(); |
159 | }) | 160 | }) |
@@ -349,6 +350,7 @@ Page({ | @@ -349,6 +350,7 @@ Page({ | ||
349 | }) | 350 | }) |
350 | 351 | ||
351 | if(frozenQuan){ | 352 | if(frozenQuan){ |
353 | + console.log("券列表111111111111111111",arr[ind].quan_list); | ||
352 | arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan); | 354 | arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan); |
353 | } | 355 | } |
354 | 356 | ||
@@ -407,6 +409,7 @@ Page({ | @@ -407,6 +409,7 @@ Page({ | ||
407 | }).then(res=>{ | 409 | }).then(res=>{ |
408 | if(res.data.code==0) | 410 | if(res.data.code==0) |
409 | quanlist=res.data.data.pageData; | 411 | quanlist=res.data.data.pageData; |
412 | + console.log("22222222222222222222券的列表", quanlist); | ||
410 | 413 | ||
411 | }) | 414 | }) |
412 | } | 415 | } |
@@ -425,7 +428,7 @@ Page({ | @@ -425,7 +428,7 @@ Page({ | ||
425 | 428 | ||
426 | t.data.data.prom_id = 0; | 429 | t.data.data.prom_id = 0; |
427 | t.data.data.prom_type = 0; | 430 | t.data.data.prom_type = 0; |
428 | - console.log("44444444444444券的列表", quanlist); | 431 | + |
429 | th.setData({ | 432 | th.setData({ |
430 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, | 433 | bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, |
431 | bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist | 434 | bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist |
@@ -456,6 +459,7 @@ Page({ | @@ -456,6 +459,7 @@ Page({ | ||
456 | }).then(res=>{ | 459 | }).then(res=>{ |
457 | if(res.data.code==0) | 460 | if(res.data.code==0) |
458 | quanlist=res.data.data.pageData; | 461 | quanlist=res.data.data.pageData; |
462 | + console.log("券接口的列表333333333333333",quanlist); | ||
459 | }) | 463 | }) |
460 | 464 | ||
461 | var frozenQuan=null; | 465 | var frozenQuan=null; |
@@ -1079,6 +1083,10 @@ Page({ | @@ -1079,6 +1083,10 @@ Page({ | ||
1079 | 1083 | ||
1080 | //--------立即购买时,选择自提和物流----------- | 1084 | //--------立即购买时,选择自提和物流----------- |
1081 | setexptype_w:function(t){ | 1085 | setexptype_w:function(t){ |
1086 | + | ||
1087 | + var uerinfo= getApp().globalData.userInfo.def_exp_code; | ||
1088 | + | ||
1089 | + console.log(getApp().globalData.userInfo, "获取默认的物流地址", uerinfo ); | ||
1082 | var th=this; | 1090 | var th=this; |
1083 | 1091 | ||
1084 | var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, ont = t.currentTarget.dataset.ont; | 1092 | var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, ont = t.currentTarget.dataset.ont; |
@@ -1096,10 +1104,24 @@ Page({ | @@ -1096,10 +1104,24 @@ Page({ | ||
1096 | 1104 | ||
1097 | th.setData({ is_all_zt: iszt }); | 1105 | th.setData({ is_all_zt: iszt }); |
1098 | } | 1106 | } |
1107 | + //判断有没有默认的物流地址值 | ||
1108 | + if (uerinfo != "" && uerinfo != null && uerinfo !=undefined) { | ||
1109 | + var wu_arr=this.data.wu_arr; | ||
1110 | + if (wu_arr!= null && wu_arr!=""){ | ||
1111 | + for(var i=0;i<wu_arr.length;i++){ | ||
1112 | + if (wu_arr[i].shipping_code == uerinfo){ | ||
1113 | + console.log(wu_arr[i],"人生啊,路漫漫,",wu_arr,"判断传出去的下标",i); | ||
1114 | + th.setData({index:i}); | ||
1115 | + } | ||
1116 | + } | ||
1117 | + } | ||
1118 | + | ||
1119 | + }else{ | ||
1099 | //判断是不是快递 | 1120 | //判断是不是快递 |
1100 | if (ont == 66) { | 1121 | if (ont == 66) { |
1101 | this.express_name(); | 1122 | this.express_name(); |
1102 | } | 1123 | } |
1124 | + } | ||
1103 | //----计算此时购物车的价格---- | 1125 | //----计算此时购物车的价格---- |
1104 | th.calculatePrice(); | 1126 | th.calculatePrice(); |
1105 | }, | 1127 | }, |
@@ -1241,19 +1263,15 @@ Page({ | @@ -1241,19 +1263,15 @@ Page({ | ||
1241 | 1263 | ||
1242 | /*--点击选择券--*/ | 1264 | /*--点击选择券--*/ |
1243 | sele_quan_item:function(e) { | 1265 | sele_quan_item:function(e) { |
1244 | - var no_use=e.currentTarget.dataset.no, quanlist=this.data.selected_quan_list; | ||
1245 | - | 1266 | + var no_use=e.currentTarget.dataset.no, quanlist=this.data.selected_quan_list; |
1246 | //---所有的券的显示红色选择都清理一遍--- | 1267 | //---所有的券的显示红色选择都清理一遍--- |
1247 | for(var ind in quanlist){ | 1268 | for(var ind in quanlist){ |
1248 | quanlist[ind].show_red=0; | 1269 | quanlist[ind].show_red=0; |
1249 | } | 1270 | } |
1250 | - | ||
1251 | this.setData({selected_quan_list:quanlist}); | 1271 | this.setData({selected_quan_list:quanlist}); |
1252 | var using_quan=this.data.using_quan; | 1272 | var using_quan=this.data.using_quan; |
1253 | var th=this; | 1273 | var th=this; |
1254 | - | ||
1255 | //---如果是不使用优惠券--- | 1274 | //---如果是不使用优惠券--- |
1256 | - | ||
1257 | if(no_use==1){ | 1275 | if(no_use==1){ |
1258 | console.log("有进来吗券", no_use); | 1276 | console.log("有进来吗券", no_use); |
1259 | if(using_quan[th.data.selected_quan_pick]){ | 1277 | if(using_quan[th.data.selected_quan_pick]){ |
@@ -1267,15 +1285,17 @@ Page({ | @@ -1267,15 +1285,17 @@ Page({ | ||
1267 | } | 1285 | } |
1268 | 1286 | ||
1269 | var ind = e.currentTarget.dataset.ind; | 1287 | var ind = e.currentTarget.dataset.ind; |
1288 | + | ||
1270 | var quan_item = this.data.selected_quan_list[ind]; | 1289 | var quan_item = this.data.selected_quan_list[ind]; |
1271 | var txt = "selected_quan_list[" + ind + "].show_red"; | 1290 | var txt = "selected_quan_list[" + ind + "].show_red"; |
1291 | + | ||
1272 | var obj = {}; | 1292 | var obj = {}; |
1273 | obj[txt] = 1; | 1293 | obj[txt] = 1; |
1274 | if (quan_item.show_red) { | 1294 | if (quan_item.show_red) { |
1275 | obj[txt] = 0; | 1295 | obj[txt] = 0; |
1276 | } | 1296 | } |
1277 | this.setData(obj); | 1297 | this.setData(obj); |
1278 | - | 1298 | + console.log(this.data.selected_quan_list, "选中的券的下标", quan_item, "数据都在这里", txt); |
1279 | if(using_quan[th.data.selected_quan_pick]){ | 1299 | if(using_quan[th.data.selected_quan_pick]){ |
1280 | using_quan[th.data.selected_quan_pick].is_nouse_red=0; | 1300 | using_quan[th.data.selected_quan_pick].is_nouse_red=0; |
1281 | } | 1301 | } |
@@ -1288,14 +1308,18 @@ Page({ | @@ -1288,14 +1308,18 @@ Page({ | ||
1288 | 1308 | ||
1289 | //--确认使用券--- | 1309 | //--确认使用券--- |
1290 | confirm_quan:function () { | 1310 | confirm_quan:function () { |
1291 | - console.log(1111); | 1311 | + |
1292 | var using_quan=this.data.using_quan,pickid=this.data.selected_quan_pick; | 1312 | var using_quan=this.data.using_quan,pickid=this.data.selected_quan_pick; |
1293 | var th=this,selected_quan_list=this.data.selected_quan_list; | 1313 | var th=this,selected_quan_list=this.data.selected_quan_list; |
1294 | //选择了的券 | 1314 | //选择了的券 |
1295 | var sele_quan=null; | 1315 | var sele_quan=null; |
1316 | + console.log(selected_quan_list, "确认使用券"); | ||
1296 | for(var i in selected_quan_list){ | 1317 | for(var i in selected_quan_list){ |
1318 | + | ||
1297 | var item=selected_quan_list[i]; | 1319 | var item=selected_quan_list[i]; |
1320 | + console.log(item, "确认使用券",item.show_red); | ||
1298 | if(item.show_red) { | 1321 | if(item.show_red) { |
1322 | + console.log(item.show_red, "确定的券7"); | ||
1299 | th.insert_into_using_quan(item,using_quan,pickid); | 1323 | th.insert_into_using_quan(item,using_quan,pickid); |
1300 | return; | 1324 | return; |
1301 | } | 1325 | } |
@@ -1341,6 +1365,7 @@ Page({ | @@ -1341,6 +1365,7 @@ Page({ | ||
1341 | 1365 | ||
1342 | //--验证是否已经冻结-- | 1366 | //--验证是否已经冻结-- |
1343 | check_is_frozenQuan:function(quanlist,frozenQuan){ | 1367 | check_is_frozenQuan:function(quanlist,frozenQuan){ |
1368 | + console.log("券列表",quanlist); | ||
1344 | var arr=[]; | 1369 | var arr=[]; |
1345 | for(var i=0;i<quanlist.length;i++){ | 1370 | for(var i=0;i<quanlist.length;i++){ |
1346 | var item=quanlist[i]; | 1371 | var item=quanlist[i]; |
@@ -1368,21 +1393,17 @@ Page({ | @@ -1368,21 +1393,17 @@ Page({ | ||
1368 | }, | 1393 | }, |
1369 | // 选择物流 | 1394 | // 选择物流 |
1370 | click_express_name:function(e){ | 1395 | click_express_name:function(e){ |
1371 | - var express_name=e.currentTarget.dataset.name; | 1396 | + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; |
1397 | + console.log("判断是不是11111111111111111111111111111", shippingcode); | ||
1372 | var index=e.currentTarget.dataset.idxe; | 1398 | var index=e.currentTarget.dataset.idxe; |
1373 | - this.setData({ is_express: index, index: index}); | 1399 | + this.setData({ is_express: index, index: index, is_shipping_code: shippingcode}); |
1374 | }, | 1400 | }, |
1375 | //点击确定物流 | 1401 | //点击确定物流 |
1376 | determine_expres:function(e){ | 1402 | determine_expres:function(e){ |
1377 | - | ||
1378 | - var name=this.data.expres_name | ||
1379 | this.setData({ open_express: 0}); | 1403 | this.setData({ open_express: 0}); |
1380 | this.calculatePrice(); | 1404 | this.calculatePrice(); |
1381 | }, | 1405 | }, |
1382 | - //设置默认物流 | ||
1383 | - set_default:function(){ | ||
1384 | - | ||
1385 | - }, | 1406 | + |
1386 | //点击打开优惠券使用说明 | 1407 | //点击打开优惠券使用说明 |
1387 | clik_coupons:function(e){ | 1408 | clik_coupons:function(e){ |
1388 | 1409 | ||
@@ -1401,6 +1422,22 @@ Page({ | @@ -1401,6 +1422,22 @@ Page({ | ||
1401 | var ind = e.currentTarget.dataset.ind; | 1422 | var ind = e.currentTarget.dataset.ind; |
1402 | console.log("下标", ind); | 1423 | console.log("下标", ind); |
1403 | this.setData({ is_coupon: ind}); | 1424 | this.setData({ is_coupon: ind}); |
1404 | - | ||
1405 | - } | 1425 | + }, |
1426 | + | ||
1427 | + //设置默认物流 | ||
1428 | + select_default_logistics: function () { | ||
1429 | + var th=this; | ||
1430 | + var is_shipping_code=this.data.is_shipping_code | ||
1431 | + getApp().request.put("/api/weshop/users/update",{ | ||
1432 | + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, | ||
1433 | + success:function(rse){ | ||
1434 | + if (rse.data.code==0){ | ||
1435 | + th.setData({ open_express: 0 }); | ||
1436 | + //----计算此时购物车的价格---- | ||
1437 | + th.calculatePrice(); | ||
1438 | + } | ||
1439 | + } | ||
1440 | + }) | ||
1441 | + | ||
1442 | + }, | ||
1406 | }); | 1443 | }); |
pages/cart/cart2/cart2.wxml
@@ -202,19 +202,21 @@ | @@ -202,19 +202,21 @@ | ||
202 | 202 | ||
203 | <view class="use-item flex-space-between"> | 203 | <view class="use-item flex-space-between"> |
204 | <view class="flex"> | 204 | <view class="flex"> |
205 | - <view bindtap='setexptype' data-t='1' style="display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}};"> | 205 | + <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;'}};"> |
206 | <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon> | 206 | <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon> |
207 | <view class="yu_er">自提</view> | 207 | <view class="yu_er">自提</view> |
208 | </view> | 208 | </view> |
209 | - <view bindtap='setexptype' data-t='0' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}};"> | 209 | + <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;'}};"> |
210 | <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon> | 210 | <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon> |
211 | <view class="yu_er">物流</view> | 211 | <view class="yu_er">物流</view> |
212 | </view> | 212 | </view> |
213 | </view> | 213 | </view> |
214 | + <block wx:if="{{item.exp_type==0}}"> | ||
214 | <view class="flex-vertical"> | 215 | <view class="flex-vertical"> |
215 | <view class="logistics-name">{{wu_arr[index].name}}</view> | 216 | <view class="logistics-name">{{wu_arr[index].name}}</view> |
216 | <view class="xc-right"></view> | 217 | <view class="xc-right"></view> |
217 | </view> | 218 | </view> |
219 | + </block> | ||
218 | </view> | 220 | </view> |
219 | 221 | ||
220 | <!-- <view class="use-item" hidden='{{bn_exp_type==1}}'> | 222 | <!-- <view class="use-item" hidden='{{bn_exp_type==1}}'> |
@@ -331,7 +333,7 @@ | @@ -331,7 +333,7 @@ | ||
331 | <view class="xc-frame flex-level"> | 333 | <view class="xc-frame flex-level"> |
332 | <view class="list-frame"> | 334 | <view class="list-frame"> |
333 | 335 | ||
334 | - <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" data-ind="{{index}}" wx:for-item="item"wx:for-index="index"> | 336 | + <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{index}}" wx:for-item="item"wx:for-index="index"> |
335 | <view class="xc-coupon-frame flex-center" bindtap="sele_coupon" data-ind="{{index}}"> | 337 | <view class="xc-coupon-frame flex-center" bindtap="sele_coupon" data-ind="{{index}}"> |
336 | <view class="coupon-frame flex rel"> | 338 | <view class="coupon-frame flex rel"> |
337 | <!-- 锯齿 --> | 339 | <!-- 锯齿 --> |
@@ -463,7 +465,7 @@ | @@ -463,7 +465,7 @@ | ||
463 | </view> | 465 | </view> |
464 | <view class="express_list"> | 466 | <view class="express_list"> |
465 | <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx"> | 467 | <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx"> |
466 | - <view class="express_list_frame" bindtap="click_express_name" data-name="{{express_list.name}}" data-idxe="{{idx}}"> | 468 | + <view class="express_list_frame" bindtap="click_express_name" data-shippingcode="{{express_list.shipping_code}}" data-name="{{express_list.name}}" data-idxe="{{idx}}"> |
467 | <block wx:if="{{is_express==idx}}"> | 469 | <block wx:if="{{is_express==idx}}"> |
468 | <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view> | 470 | <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view> |
469 | </block> | 471 | </block> |
@@ -479,8 +481,8 @@ | @@ -479,8 +481,8 @@ | ||
479 | <view class="xc-determine flex-center" bindtap="determine_expres"> | 481 | <view class="xc-determine flex-center" bindtap="determine_expres"> |
480 | <view class="flex-vertical t-c">确定</view> | 482 | <view class="flex-vertical t-c">确定</view> |
481 | </view> | 483 | </view> |
482 | - <view class="xc-confirms flex-center" bindtap="set_default"> | ||
483 | - <view class="flex-vertical t-c">设为默认</view> | 484 | + <view class="xc-confirms flex-center" bindtap="select_default_logistics"> |
485 | + <view class="flex-vertical t-c">设为默认</view> | ||
484 | </view> | 486 | </view> |
485 | </view> | 487 | </view> |
486 | 488 |
pages/goods/categoryList/categoryList.js
@@ -36,7 +36,8 @@ Page({ | @@ -36,7 +36,8 @@ Page({ | ||
36 | brand_list:null,//品牌列表 | 36 | brand_list:null,//品牌列表 |
37 | 37 | ||
38 | one_level_classify:[],// 新的版本左边的边分类1级 | 38 | one_level_classify:[],// 新的版本左边的边分类1级 |
39 | - is_level_three:0//判断有没有3级 | 39 | + is_level_three:0,//判断有没有3级 |
40 | + cat_id:0, | ||
40 | }, | 41 | }, |
41 | onLoad: function(tt) { | 42 | onLoad: function(tt) { |
42 | const res = wx.getSystemInfoSync(), | 43 | const res = wx.getSystemInfoSync(), |
@@ -461,7 +462,7 @@ Page({ | @@ -461,7 +462,7 @@ Page({ | ||
461 | } | 462 | } |
462 | } | 463 | } |
463 | 464 | ||
464 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name }); | 465 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid}); |
465 | 466 | ||
466 | }, | 467 | }, |
467 | // 图片失败 | 468 | // 图片失败 |
pages/goods/categoryList/categoryList.wxml
@@ -207,7 +207,7 @@ | @@ -207,7 +207,7 @@ | ||
207 | <!-- 只是2级的 --> | 207 | <!-- 只是2级的 --> |
208 | <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> | 208 | <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> |
209 | <view> | 209 | <view> |
210 | -<view class="classify_name fs32 flex-space-between"data-pid="0"data-cid="{{goods.items.id}}" bindtap='select_more'> | 210 | +<view class="classify_name fs32 flex-space-between"data-pid="0"data-cid="{{cat_id}}" bindtap='select_more'> |
211 | <view>{{classify_name}}</view> | 211 | <view>{{classify_name}}</view> |
212 | <view class="flex select_more" > | 212 | <view class="flex select_more" > |
213 | <view class="red-co fs32" >选择更多</view> | 213 | <view class="red-co fs32" >选择更多</view> |