Commit 3b47f90994f1b08356061ecffc6548bd066cc522

Authored by F5VT98DI7XY4X12\Administrator
1 parent 68b01da9

收货地址,在选择的时候选中。 订单列表取消订单,使用优惠券的时候,要考虑冻结的优惠券, 支付尾款的接口修正

pages/cart/cart2/cart2.js
... ... @@ -77,9 +77,18 @@ Page({
77 77  
78 78 },
79 79 onLoad: function(t) {
  80 +
80 81 wx.setNavigationBarTitle({ title: "填写订单",})
81 82 var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,});
82 83 th.data.param=t;
  84 +
  85 + //清空is_pick_up
  86 + getApp().request.put("/api/weshop/useraddress/updatePickUp", {
  87 + data: {user_id: getApp().globalData.user_id, is_pickup: 0},
  88 + success: function (s) {
  89 + }
  90 + });
  91 +
83 92 //先获取是否有关闭使用优惠券
84 93 getApp().getConfig2(function (ee) {
85 94 var json_d = JSON.parse(ee.switch_list);
... ... @@ -322,6 +331,19 @@ Page({
322 331 if(res.data.code==0)
323 332 arr[ind].quan_list=res.data.data.pageData;
324 333 })
  334 +
  335 + var frozenQuan=null;
  336 + var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
  337 + await app.request.promiseGet(url0,{1:1}).then(res=>{
  338 + if(res.data.code==0){
  339 + frozenQuan=res.data.data;
  340 + }
  341 + })
  342 +
  343 + if(frozenQuan){
  344 + arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan);
  345 + }
  346 +
325 347 }
326 348 }
327 349  
... ... @@ -380,6 +402,18 @@ Page({
380 402 })
381 403 }
382 404  
  405 + var frozenQuan=null;
  406 + var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
  407 + await app.request.promiseGet(url0,{1:1}).then(res=>{
  408 + if(res.data.code==0){
  409 + frozenQuan=res.data.data;
  410 + }
  411 + })
  412 +
  413 + if(frozenQuan){
  414 + quanlist=th.check_is_frozenQuan(quanlist,frozenQuan);
  415 + }
  416 +
383 417 t.data.data.prom_id = 0;
384 418 t.data.data.prom_type = 0;
385 419  
... ... @@ -409,11 +443,23 @@ Page({
409 443  
410 444 var url="/api/weshop/couponList/getUseCouponList";
411 445 await app.request.promiseGet(url,{
412   - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100}
  446 + data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100}
413 447 }).then(res=>{
414   - if(res.data.code==0)
415   - quanlist=res.data.data.pageData;
416   - })
  448 + if(res.data.code==0)
  449 + quanlist=res.data.data.pageData;
  450 + })
  451 +
  452 + var frozenQuan=null;
  453 + var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id;
  454 + await app.request.promiseGet(url0,{1:1}).then(res=>{
  455 + if(res.data.code==0){
  456 + frozenQuan=res.data.data;
  457 + }
  458 + })
  459 +
  460 + if(frozenQuan){
  461 + quanlist=th.check_is_frozenQuan(quanlist,frozenQuan);
  462 + }
417 463 }
418 464 }
419 465 th.setData({
... ... @@ -756,7 +802,8 @@ Page({
756 802 'twon': addr == null ? 0 : addr.twon,
757 803 'address': addr == null ? "": addr.address,
758 804 'more_address': addr == null ? "" : addr.more_address,
759   - 'mobile': th.data.userinfo.mobile,
  805 + //'mobile': th.data.userinfo.mobile,
  806 + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
760 807 'email':'',
761 808 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code,
762 809 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name,
... ... @@ -1118,10 +1165,6 @@ Page({
1118 1165 var bn=e.currentTarget.dataset.bn;
1119 1166 var cindx=e.currentTarget.dataset.cind;
1120 1167  
1121   - console.log("open_coupon_list--quan");
1122   - console.log("门店:"+pickid);
1123   - console.log(bn);
1124   -
1125 1168  
1126 1169 if(bn==1){
1127 1170 th.setData({open_quan:1,selected_quan_pick:pickid, disabled:1});
... ... @@ -1251,6 +1294,26 @@ Page({
1251 1294 var ob={};
1252 1295 ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
1253 1296 this.setData(ob);
  1297 + },
  1298 +
  1299 + //--验证是否已经冻结--
  1300 + check_is_frozenQuan:function(quanlist,frozenQuan){
  1301 + var arr=[];
  1302 + for(var i=0;i<quanlist.length;i++){
  1303 + var item=quanlist[i];
  1304 + var is_find=0;
  1305 + var Q_no=quanlist[i].CashRepNo;
  1306 + for(var j=0;j<frozenQuan.length;j++){
  1307 + var q_no=frozenQuan[j].cashRepNo;
  1308 + if(Q_no==q_no){
  1309 + is_find=1; break;
  1310 + }
  1311 + }
  1312 + if(!is_find) arr.push(item);
  1313 +
  1314 + }
  1315 + return arr;
1254 1316 }
1255 1317  
  1318 +
1256 1319 });
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -43,6 +43,14 @@ Page({
43 43 * 生命周期函数--监听页面加载
44 44 */
45 45 onLoad: function(options) {
  46 +
  47 + //清空is_pick_up
  48 + getApp().request.put("/api/weshop/useraddress/updatePickUp", {
  49 + data: {user_id: getApp().globalData.user_id, is_pickup: 0},
  50 + success: function (s) {
  51 + }
  52 + });
  53 +
46 54 var th = this;
47 55 this.data.order_id = options.order_id;
48 56 //--初始化--
... ... @@ -256,7 +264,7 @@ Page({
256 264 if(exp_type==0){
257 265 th.calculate_wuliu();
258 266 }else{
259   - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
  267 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
260 268 allpice = allpice.toFixed(2);
261 269 th.setData({ exp_price: 0, allpice: allpice })
262 270 }
... ... @@ -370,7 +378,7 @@ Page({
370 378 var n=t.data.data;
371 379 th.weixinPay(n,
372 380 function () {
373   - var allmoney=th.data.order.user_money+th.data.order.order_amount+th.data.order.pt_tail_money;
  381 + var allmoney=th.data.allpice;
374 382 th.jumpPaymentPage(th.data.order.order_sn,allmoney);
375 383 },function () {
376 384 getApp().my_warnning("支付失败",0,th);
... ... @@ -503,7 +511,7 @@ Page({
503 511 //--进入收货地址的编辑页面--
504 512 enterAddressPage: function() {
505 513 this.data.enterAddressPage =1, wx.navigateTo({
506   - url: "/pages/user/address_list/address_list?operate=select"
  514 + url: "/pages/user/address_list/address_list?is_back=1"
507 515 });
508 516 },
509 517  
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -821,7 +821,7 @@
821 821 </block>
822 822 <block wx:else>
823 823 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
824   - <view class="spec-goods-stock">可售:{{sele_g.store_count-sele_g.sales_sum}}</view>
  824 + <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view>
825 825 <view class="spec-goods-stock">已选:{{sku_g_pt[0].gg}}</view>
826 826 </block>
827 827 </view>
... ...
pages/team/team_ping/team_ping.wxml
... ... @@ -64,7 +64,7 @@
64 64 <view class='foot-left'>
65 65 共{{item.order_goods[0].goods_num}}件,
66 66 <block wx:if="{{item.is_zsorder==4}}">
67   - <block wx:if="{{item.pt_status==4 || item.pt_status==5}}">
  67 + <block wx:if="{{item.pt_status==3 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}">
68 68 金额:<text class="xc-wc">¥</text>
69 69 <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount+item.pt_tail_money,2)}}</view>
70 70 </block>
... ...
pages/team/team_ping/team_ping.wxss
... ... @@ -374,5 +374,5 @@ margin-left:5rpx;
374 374 color: #e4374d;
375 375 font-weight: normal;
376 376 margin-top:-40rpx;
377   - margin-left:98rpx
  377 + margin-left:78rpx
378 378 }
379 379 \ No newline at end of file
... ...
pages/user/add_address/add_address.js
... ... @@ -13,6 +13,7 @@ Page({
13 13 address: null,
14 14 isnew:0,
15 15 is_op_co:false,//switch开关
  16 + disabled:0
16 17 },
17 18 onLoad: function(s) {
18 19 var a = this,th=a;
... ... @@ -26,6 +27,7 @@ Page({
26 27 th.initRegions();
27 28 })
28 29 },
  30 +
29 31 onReachBottom: function () {
30 32 if (this.data.total <= 6) return;
31 33 if (this.data.ismore) return;
... ... @@ -58,6 +60,7 @@ Page({
58 60 console.log("initRegions");
59 61 console.log(t);
60 62 Object.assign(e.data.address, t), e.setData({
  63 + "disabled": 0,
61 64 "address.province_name": e.data.address.province_name,
62 65 "address.city_name": e.data.address.city_name,
63 66 "address.district_name": e.data.address.district_name,
... ...
pages/user/add_address/add_address.wxml
... ... @@ -22,7 +22,8 @@
22 22 </view>
23 23 <view class="detailed">
24 24 <view class="detailed_item-name">详细地址</view>
25   - <textarea class="detailed_item-input" name="address" value="{{address.address}}" placeholder="街道 楼牌号等" placeholder-style="color: rgb(199, 199, 199)"></textarea>
  25 + <textarea wx:if="{{!disabled}}" class="detailed_item-input" name="address" disabled="{{disabled}}" data-dis="{{disabled}}"
  26 + value="{{address.address}}" placeholder="街道 楼牌号等" placeholder-style="color: rgb(199, 199, 199)"></textarea>
26 27 </view>
27 28 <view class="item item_default">
28 29 <view class="item-name">设为默认地址</view>
... ... @@ -35,6 +36,6 @@
35 36 </view>
36 37 </form>
37 38 </view>
38   -<template is="regions" data="{{regions:regions}}"></template>
39 39  
  40 +<template is="regions" data="{{regions:regions}}"></template>
40 41 <warn id="warn"></warn>
... ...
pages/user/address_list/address_list.js
1 1 var e = getApp(), t = require("../../../utils/request.js"), os = e.globalData.setting, oo = e.globalData, t = e.request;
2 2  
3   -
4 3 Page({
5 4 data: {
6 5 url: e.globalData.setting.url,
... ... @@ -16,6 +15,14 @@ Page({
16 15 is_address_read:0
17 16 },
18 17 onLoad: function (e) {
  18 +
  19 + //清空is_pick_up
  20 + getApp().request.put("/api/weshop/useraddress/updatePickUp", {
  21 + data: {user_id: getApp().globalData.user_id, is_pickup: 0},
  22 + success: function (s) {
  23 + }
  24 + });
  25 +
19 26 this.data.operate = e.operate;
20 27 var is_back=e.is_back;
21 28 if (is_back) this.setData({ is_back: is_back})
... ... @@ -27,7 +34,6 @@ Page({
27 34 console.log(this.data.addresses)
28 35 },
29 36  
30   -
31 37 onReachBottom: function () {
32 38 if (this.data.total <= 6) return;
33 39 if (this.data.ismore) return;
... ... @@ -76,10 +82,12 @@ Page({
76 82 };
77 83 wx.setStorageSync("goodsInfo:goodsInfo:address", t);
78 84 }---*/
  85 +
79 86 oo.baddr = e.currentTarget.dataset.item;
80 87 wx.navigateBack();
81 88 }
82 89 },
  90 +
83 91 getAddressData: function (e) {
84 92 var t = this.data.addresses;
85 93 for (var s in t) if (t[s].address_id == e) break;
... ... @@ -93,47 +101,41 @@ Page({
93 101 },
94 102 //判断是否选择
95 103 add_is_pickup:function(e){
96   - var th = this;
97   - var index = e.currentTarget.dataset.icon;
98   - var a = this.data.addresses[index];
99   -
100   - if(a.is_pickup==1) {
101   - if(th.data.is_back){
102   - wx.navigateBack({});
103   - }
104   - return false;
105   - }
  104 +
  105 + if(this.data.is_back==0) return false;
  106 +
  107 + var th = this;
  108 + var index = e.currentTarget.dataset.ind;
  109 + var a = this.data.addresses[index];
106 110  
107 111 if (th.data.isloading) return;
108 112 th.data.isloading=1;
109 113  
110   -
111   -
112   -
113 114 t.put("/api/weshop/useraddress/updatePickUp", {
114 115 data: { user_id: oo.user_id, is_pickup: 0 },
115 116 isShowLoading:0,
116 117 success: function (s) {
117   - var add_arr = th.data.addresses;
118   - for (var i in add_arr){
119   - add_arr[i].is_pickup=0;
120   - }
121   - th.setData({addresses:add_arr});
  118 + // var add_arr = th.data.addresses;
  119 + // for (var i in add_arr){
  120 + // add_arr[i].is_pickup=0;
  121 + // }
  122 + // th.setData({addresses:add_arr});
  123 +
122 124 a.is_pickup = 1;
123 125 t.put("/api/weshop/useraddress/updateById", {
124 126 data: a,
125 127 isShowLoading: 0,
126 128 success: function (s) {
127   - var obj={};
128   - var txt = "addresses[" + index +"].is_pickup";
129   - obj[txt]=1;
130   - th.setData(obj);
  129 + // var obj={};
  130 + // var txt = "addresses[" + index +"].is_pickup";
  131 + // obj[txt]=1;
  132 + // th.setData(obj);
  133 +
131 134 th.data.isloading=0
132 135 if (th.data.is_back) {
133 136 wx.navigateBack({});
134 137 }
135   -
136   -
  138 +
137 139 },fail: function (t) {
138 140 th.data.isloading = 0;
139 141 }
... ...
pages/user/address_list/address_list.wxml
... ... @@ -16,9 +16,10 @@
16 16 <view class="create-btn">+新建地址</view>
17 17 </navigator>
18 18 </view> -->
  19 +
19 20 <!-- 无收货地址提醒页面 -->
20 21 <view class="topbcolor"></view>
21   -<view class="nothing" wx:if="{{is_address_read==0?false:true && addresses.length<0}}">
  22 +<view class="nothing" wx:if="{{is_address_read && addresses.length<=0}}">
22 23 <view class="image flex-level">
23 24 <image src="../../../images/nothingaddress.png"></image>
24 25 </view>
... ... @@ -37,16 +38,16 @@
37 38 <!-- 所有的收货地址框架 -->
38 39 <view class="address-box">
39 40  
40   - <!-- 单个收货地址框架 -->
  41 + <!-- 单个收货地址框架 -->
41 42 <view class="address-user" wx:for="{{addresses}}" wx:key="{{index}}">
42   - <!-- 选择icon -->
  43 + <!-- 选择icon
43 44 <view class="icon">
44 45 <icon type="success" color="red" size="33rpx" wx:if="{{item.is_pickup==1}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon>
45 46 <icon class="no_xuanze" color="white" wx:if="{{item.is_pickup==0}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon>
46   - </view>
  47 + </view>-->
47 48  
48 49 <!-- 收货地址全部信息 -->
49   - <view class="address">
  50 + <view class="address" bindtap="add_is_pickup" data-ind="{{index}}" >
50 51 <!-- 个人直接信息 -->
51 52 <view class="user">
52 53 <!-- 名字 -->
... ...
pages/user/order_detail/order_detail.js
... ... @@ -112,14 +112,17 @@ Page({
112 112 success: function(e) {
113 113 if(!e.confirm) return false;
114 114 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
115   - if(is_skill==1 || is_zsorder>=2){
116   - getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+o,{
117   - data:{},
118   - success: function(t) {
119   - if(t.data.code==0)
120   - th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
121   - },
122   - })
  115 + //if(is_skill==1 || is_zsorder>=2){
  116 +
  117 + getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+o,{
  118 + data:{},
  119 + success: function(t) {
  120 + if(t.data.code==0)
  121 + th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
  122 + },
  123 + })
  124 +
  125 + /*----
123 126 }else{
124 127 getApp().request.put("/api/weshop/order/updatebyId", {
125 128 data: {order_id: o, order_status: 3},
... ... @@ -127,7 +130,7 @@ Page({
127 130 th.requestOrderDetail(o), wx.setStorageSync("order:order_list:update", !0);
128 131 }
129 132 });
130   - }
  133 + }--*/
131 134 }
132 135 });
133 136 },
... ...
pages/user/order_list/order_list.js
... ... @@ -194,7 +194,7 @@ Page({
194 194 success: function(t) {
195 195 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
196 196 if(t.confirm){
197   - if(is_skill==1 || is_zsorder>=2){
  197 + //if(is_skill==1 || is_zsorder>=2){
198 198 getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+a,{
199 199 data:{},
200 200 success: function(t) {
... ... @@ -208,18 +208,7 @@ Page({
208 208 getApp().confirmBox(e.data.msg);
209 209 }
210 210 },
211   - })
212   - }else{
213   - rq.put("/api/weshop/order/updatebyId", {
214   - data: {
215   - order_id: a, order_status: 3
216   - },
217   - success: function (t) {
218   - 0 == e.data.activeCategoryId ?
219   - (e.resetData(), e.requestOrderList(e.data.activeCategoryId)) : e.deleteOrderData(a);
220   - }
221   - });
222   - }
  211 + })
223 212 }
224 213 }
225 214 });
... ... @@ -289,7 +278,32 @@ Page({
289 278  
290 279 /*----------跳转支付-----------*/
291 280 jumpToCart4: function(t) {
  281 + var o_index=t.currentTarget.dataset.idx;
292 282 var e = this.data.orderList[t.currentTarget.dataset.idx];
  283 + var th=this;
  284 +
  285 + console.log("jumpToCart4");
  286 + console.log(e);
  287 +
  288 + if(e.order_amount==0){
  289 + var dd = {
  290 + parent_sn: e.order_sn,
  291 + store_id: e.store_id,
  292 + type: 1,
  293 + };
  294 + getApp().request.post("/api/weshop/order/pay/createOrder", {
  295 + data: dd,
  296 + success: function (t) {
  297 + if(t.data.code==0){
  298 + th.onload();
  299 + }else{
  300 + getApp().confirmBox(t.data.msg+"请您取消该订单");
  301 + }
  302 + }
  303 + })
  304 + return false;
  305 + }
  306 +
293 307 a.jumpToCart4({
294 308 order_sn: e.order_sn,
295 309 order_amount: e.order_amount,
... ...
utils/regions/Regions.js
... ... @@ -38,6 +38,9 @@ var s = function() {
38 38 return s(a, [ {
39 39 key: "openRegionsModal",
40 40 value: function(t) {
  41 + this.page.setData({
  42 + disabled:1
  43 + });
41 44 var s = this, a = t.currentTarget.dataset.id, i = t.currentTarget.dataset.name;
42 45 isNaN(parseInt(a)) || !parseInt(a) ? (a = 0, this.currentArea = 0) : (0 == this.currentArea ? (this.address.province_name = i,
43 46 this.address.province = a, this.address.city_name = "", this.address.city = 0, this.address.district_name = "",
... ... @@ -55,13 +58,14 @@ var s = function() {
55 58 t.data.data.pageData && t.data.data.pageData.length > 0 ? s.page.setData(e({}, s.dataName, {
56 59 regions: t.data.data.pageData,
57 60 showRegionsModal: !0
58   - })) : s.endCall(a, i);
  61 + })) : s.endCall(a, i);
59 62 }
60 63 }) : this.endCall(a, i);
61 64 }
62 65 }, {
63 66 key: "closeRegionsModal",
64 67 value: function() {
  68 + this.page.setData({disabled:0});
65 69 this.page.setData(e({}, this.dataName, {
66 70 showCategoryModal: !1
67 71 }));
... ...