Commit d29e7e00d1690dc77bbef7d722e185ae3a9cb634

Authored by F5VT98DI7XY4X12\Administrator
1 parent 7d6ab3d6

购物车的选择收货地址, 收货地址, 尾款选择物流,收货地址选择优惠券

images/dpr.png 0 → 100644

21.7 KB

images/nothingaddress.png 0 → 100644

17.8 KB

pages/cart/cart2/cart2.js
... ... @@ -73,6 +73,7 @@ Page({
73 73 //选择的券的门店
74 74 selected_quan_pick:null,
75 75 is_close_quan:0,
  76 + disabled:0,
76 77  
77 78 },
78 79 onLoad: function(t) {
... ... @@ -990,7 +991,7 @@ Page({
990 991 },
991 992 enterAddressPage: function() {
992 993 this.data.enterAddressPage = !0, wx.navigateTo({
993   - url: "/pages/user/address_list/address_list?operate=select"
  994 + url: "/pages/user/address_list/address_list?is_back=1"
994 995 });
995 996 },
996 997  
... ... @@ -1119,7 +1120,7 @@ Page({
1119 1120  
1120 1121  
1121 1122 if(bn==1){
1122   - th.setData({open_quan:1,selected_quan_pick:pickid});
  1123 + th.setData({open_quan:1,selected_quan_pick:pickid, disabled:1});
1123 1124 }else{
1124 1125 //---多单打开券的时候,就要判断券在其他门店是否有使用---
1125 1126 var quanlist=th.data.cartlist[cindx].quan_list;
... ... @@ -1128,12 +1129,12 @@ Page({
1128 1129 var is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid);
1129 1130 if(is_using) quanlist[i].is_using=1;
1130 1131 }
1131   - th.setData({open_quan:1,selected_quan_pick:pickid,selected_quan_list:quanlist});
  1132 + th.setData({open_quan:1,selected_quan_pick:pickid,selected_quan_list:quanlist,disabled:1});
1132 1133 }
1133 1134 },
1134 1135 close_coupon:function (e) {
1135 1136 var th=this;
1136   - th.setData({open_quan:0});
  1137 + th.setData({open_quan:0,disabled:0});
1137 1138 },
1138 1139  
1139 1140 //---判断券时候在已经选择的列表中---
... ...
pages/cart/cart2/cart2.wxml
... ... @@ -89,7 +89,7 @@
89 89 <view class="coupon-mes">
90 90 <view>用户备注(50字)</view>
91 91 <view class="leave-word">
92   - <textarea bindinput="keyUpChangeNum" class="word-box" maxlength="50" name="user_note_{{item.pickup_id}}"></textarea>
  92 + <textarea bindinput="keyUpChangeNum" disabled="{{disabled}}" class="word-box" maxlength="50" name="user_note_{{item.pickup_id}}"></textarea>
93 93 <view class="max-word">{{maxWord}}/50</view>
94 94 </view>
95 95 </view>
... ... @@ -183,19 +183,9 @@
183 183 </view>
184 184 </view>
185 185 <view class="coupon-mes">
186   - <!-- <view bindtap="useCoupon" class="coupon-title">
187   - <view class="classname">
188   - <view class="">优惠券</view>
189   - <view class="coupon-num">{{order.couponNum}}张可用</view>
190   - </view>
191   - <view class="set-btn">
192   - <view>{{coupon?coupon.coupon.name:'未使用'}}</view>
193   - <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/icon-arrowdown.png"></image>
194   - </view>
195   - </view> -->
196 186 <view>用户备注(50字)</view>
197 187 <view class="leave-word">
198   - <textarea bindinput="keyUpChangeNum" class="word-box" maxlength="50" name="user_note"></textarea>
  188 + <textarea bindinput="keyUpChangeNum" disabled="{{disabled}}" class="word-box" maxlength="50" name="user_note"></textarea>
199 189 <view class="max-word">{{maxWord}}/50</view>
200 190 </view>
201 191 </view>
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -287,6 +287,9 @@ Page({
287 287 this.setData({
288 288 exp_type: type
289 289 });
  290 +
  291 +
  292 +
290 293 //--计算物流的值--
291 294 if (type == 0) {
292 295 th.calculate_wuliu();
... ... @@ -405,7 +408,7 @@ Page({
405 408 case 2:
406 409 if (goods_weight < 0) goods_weight = 0;
407 410 //累积商品重量 每种商品的重量 * 数量
408   - goods_weight += good['weight'] * good['buynum'];
  411 + goods_weight += good['weight'] * th.data.order.order_goods['goods_num'];
409 412 break;
410 413 case 3:
411 414 if (goods_piece < 0) goods_piece = 0;
... ...
pages/user/add_address/add_address.js
... ... @@ -12,6 +12,7 @@ Page({
12 12 iurl: a.imghost,
13 13 address: null,
14 14 isnew:0,
  15 + is_op_co:false,//switch开关
15 16 },
16 17 onLoad: function(s) {
17 18 var a = this,th=a;
... ... @@ -25,6 +26,31 @@ Page({
25 26 th.initRegions();
26 27 })
27 28 },
  29 + onReachBottom: function () {
  30 + if (this.data.total <= 6) return;
  31 + if (this.data.ismore) return;
  32 + this.requestAddressList();
  33 + },
  34 +
  35 + requestAddressList: function () {
  36 + var e = this;
  37 + t.get(e.data.url + "/api/weshop/useraddress/page", {
  38 + data: { store_id: os.stoid, user_id: oo.user_id, page: e.data.curpage, pageSize: 6 },
  39 + success: function (t) {
  40 + e.data.curpage++;
  41 + var arr1 = e.data.addresses;
  42 + var arr2 = t.data.data.pageData;
  43 + var arr3 = [...arr1, ...arr2];
  44 +
  45 + var ismore = 0;
  46 + if (arr3.length == t.data.data.total) ismore = 1
  47 +
  48 + e.setData({
  49 + addresses: arr3, total: t.data.data.total, ismore: ismore
  50 + }), wx.stopPullDownRefresh();
  51 + }
  52 + });
  53 + },
28 54 initRegions: function() {
29 55 var e = this;
30 56 new s.default(this, "regions", {
... ... @@ -44,92 +70,101 @@ Page({
44 70 }
45 71 });
46 72 },
  73 + //-----------添加或者编辑-----------
  74 + submitAddress: function (s) {
  75 + var a = this.data.address, b = a, th = this;
  76 + Object.assign(a, s.detail.value), a.is_default = Number(a.is_default);
  77 + a.store_id = os.stoid;
47 78  
48   - //-----------添加或者编辑-----------
49   - submitAddress: function(s) {
50   - var a= this.data.address, b=a,th=this;
51   - Object.assign(a, s.detail.value), a.is_default = Number(a.is_default);
52   - a.store_id = os.stoid;
53   -
54   - var ob = ut.check_mobile(a.mobile);
55   - if(ob.code!=1){
56   - return getApp().my_warnning(ob.title,0,th);
57   - }
58   -
59   - if (a.more_address == null || a.more_address == undefined || a.more_address=="" ){
60   - getApp().my_warnning("请选择地区",0,th);
61   - return false;
62   - }
63   -
64   -
65   - //判断是不是空对象
66   - //--------如果是修改地址----------
67   - if (!th.data.isnew){
68   - if (a.is_default==1){
69   - t.put("/api/weshop/useraddress/update", {
70   - data: { user_id: oo.user_id, is_default:0},
71   - success: function (s) {
72   - t.put("/api/weshop/useraddress/updateById", {
73   - data: a,
74   - success: function (s) {
75   - e.showSuccess(s.data.msg, function () {
76   - wx.navigateBack();
77   - });
78   - }
79   - });
80   - }
81   - });
82   -
83   - }else{
84   - t.put("/api/weshop/useraddress/updateById", {
85   - data: a,
86   - success: function (s) {
87   - e.showSuccess(s.data.msg, function () {
88   - wx.navigateBack();
89   - });
90   - }
  79 + //判断用户名是否为空
  80 + var cs = th.check(a.consignee);
  81 + if (cs != 1) {
  82 + return getApp().my_warnning("收货姓名不能为空", 0, th);
  83 + }
  84 +
  85 + var ob = ut.check_mobile(a.mobile);
  86 + if (ob.code != 1) {
  87 + return getApp().my_warnning(ob.title, 0, th);
  88 + }
  89 +
  90 + if (a.more_address == null || a.more_address == undefined || a.more_address == "") {
  91 + getApp().my_warnning("请选择地区", 0, th);
  92 + return false;
  93 + }
  94 + //判断地址是否为空
  95 + var add = th.check(a.address);
  96 + if (add != 1) {
  97 + return getApp().my_warnning("详细地址不能为空", 0, th);
  98 + }
  99 +
  100 + //判断是不是空对象
  101 + //--------如果是修改地址----------
  102 + if (!th.data.isnew) {
  103 + if (a.is_default == 1) {
  104 + t.put("/api/weshop/useraddress/update", {
  105 + data: { user_id: oo.user_id, is_default: 0 },
  106 + success: function (s) {
  107 + t.put("/api/weshop/useraddress/updateById", {
  108 + data: a,
  109 + success: function (s) {
  110 + e.showSuccess(s.data.msg, function () {
  111 + wx.navigateBack();
91 112 });
92   - }
93   -
94   - }else{
95   - a['user_id'] = oo.user_id;
96   - a['store_id'] = os.stoid;
97   -
98   -
99   - if (a.is_default == 1) {
100   - t.put("/api/weshop/useraddress/update", {
101   - data: { user_id: oo.user_id, is_default: 0 },
102   - success: function (s) {
103   -
104   - //-----新增地址-------
105   - t.post("/api/weshop/useraddress/save", {
106   - data: a,
107   - success: function (s) {
108   - e.showSuccess(s.data.msg, function () {
109   - wx.navigateBack();
110   - });
111   - }
112   - });
113   -
114   - }
115   - })
116   - }else{
117   -
118   - //-----新增地址-------
119   - t.post("/api/weshop/useraddress/save", {
120   - data: a,
121   - success: function (s) {
122   - e.showSuccess(s.data.msg, function () {
123   - wx.navigateBack();
124   - });
125   - }
126   - });
127   - }
128   -
129   -
130   -
131   - }
132   - },
  113 + }
  114 + });
  115 + }
  116 + });
  117 +
  118 + } else {
  119 + t.put("/api/weshop/useraddress/updateById", {
  120 + data: a,
  121 + success: function (s) {
  122 + e.showSuccess(s.data.msg, function () {
  123 + wx.navigateBack();
  124 + });
  125 + }
  126 + });
  127 + }
  128 +
  129 + } else {
  130 + a['user_id'] = oo.user_id;
  131 + a['store_id'] = os.stoid;
  132 +
  133 +
  134 + if (a.is_default == 1) {
  135 + t.put("/api/weshop/useraddress/update", {
  136 + data: { user_id: oo.user_id, is_default: 0 },
  137 + success: function (s) {
  138 +
  139 + //-----新增地址-------
  140 + t.post("/api/weshop/useraddress/save", {
  141 + data: a,
  142 + success: function (s) {
  143 + e.showSuccess(s.data.msg, function () {
  144 + wx.navigateBack();
  145 + });
  146 + }
  147 + });
  148 +
  149 + }
  150 + })
  151 + } else {
  152 +
  153 + //-----新增地址-------
  154 + t.post("/api/weshop/useraddress/save", {
  155 + data: a,
  156 + success: function (s) {
  157 + e.showSuccess(s.data.msg, function () {
  158 + wx.navigateBack();
  159 + });
  160 + }
  161 + });
  162 + }
  163 +
  164 +
  165 +
  166 + }
  167 + },
133 168  
134 169 //---------删除收货地址------------
135 170 deleteAddress: function() {
... ... @@ -146,5 +181,20 @@ Page({
146 181 });
147 182 }
148 183 });
149   - }
  184 + },
  185 + //是否是默认地址
  186 + bind_is_op_co:function(e){
  187 + var i = e.detail;
  188 + this.setData({
  189 + is_op_co:i
  190 + })
  191 + console.log(i)
  192 + },
  193 + check:function(as){
  194 + var code = 1;
  195 + if(as===''){
  196 + code = -1;
  197 + }
  198 + return code;
  199 +}
150 200 });
151 201 \ No newline at end of file
... ...
pages/user/add_address/add_address.wxml
1 1 <import src="../../../utils/regions/regions.wxml"></import>
  2 +
  3 +
2 4 <view class="container">
  5 +<view class="topbcolor"></view>
3 6 <form bindsubmit="submitAddress">
  7 +
4 8 <view class="item">
5   - <view class="item-name">收货人:</view>
6   - <input class="item-input" name="consignee" value="{{address.consignee}}"></input>
  9 + <view class="item-name">收货人</view>
  10 + <input class="item-input" name="consignee" value="{{address.consignee}}" placeholder="请填写收货人姓名" placeholder-style="color: rgb(199, 199, 199)"></input>
7 11 </view>
8 12 <view class="item">
9   - <view class="item-name">手机号码:</view>
10   - <input type="number" class="item-input" name="mobile" value="{{address.mobile}}"></input>
  13 + <view class="item-name">手机号码</view>
  14 + <input type="number" class="item-input" name="mobile" value="{{address.mobile}}" placeholder="请填写收货人手机号" placeholder-style="color: rgb(199, 199, 199)"></input>
11 15 </view>
12 16 <view bindtap="openRegionsModal" class="item" data-id="0">
13   - <view class="item-name">所在地区:</view>
14   - <view class="item-input">{{address.more_address}}</view>
  17 + <view class="item-name">所在地区</view>
  18 + <view class="item-input{{address.more_address==null?'address':''}}">{{address.more_address==null?'省市区县,乡镇等':address.more_address}}</view>
15 19 <view class="item-img">
16 20 <image class="arrow" src="{{iurl}}/miniapp/images/icon-arrowdown.png"></image>
17 21 </view>
  22 + </view>
  23 + <view class="detailed">
  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>
18 26 </view>
19   - <view class="item">
20   - <view class="item-name">详细地址:</view>
21   - <input class="item-input" name="address" value="{{address.address}}"></input>
22   - </view>
23   - <view class="item">
  27 + <view class="item item_default">
24 28 <view class="item-name">设为默认地址</view>
25   - <switch checked="{{address.is_default==1?true:false}}" class="item-switch" color="#e30000" name="is_default" type="switch"></switch>
  29 + <switch checked="{{address.is_default==1?true:false}}" class="item-switch"
  30 + color="{{address.is_default==1?'rgb(239,22,51)':is_op_co==false?'white':'rgb(239,22,51)'}}" name="is_default" type="switch" bindchange="bind_is_op_co"/>
26 31 </view>
27 32 <view class="address-btns">
28   - <button bindtap="deleteAddress" class="delete-btn">删除地址</button>
  33 + <button bindtap="deleteAddress" wx:if="{{address.mobile!=null}}" class="delete-btn">删除地址</button>
29 34 <button class="submit-btn" formType="submit">提交地址</button>
30 35 </view>
31 36 </form>
... ...
pages/user/add_address/add_address.wxss
1 1 page {
2   - background: white;
  2 + background: rgb(255, 255, 255);
  3 +}
  4 +
  5 +.topbcolor {
  6 + width: 100%;
  7 + height: 7rpx;
  8 + background-color: rgb(245, 245, 245);
3 9 }
4 10  
5 11 .item {
6   - float: left;
7   - padding: 0 30rpx;
8   - width: 100%;
9   - box-sizing: border-box;
10   - font-size: 30rpx;
11   - border-bottom: 1rpx #f5f5f5 solid;
12   - line-height: 100rpx;
13   - height: 100rpx;
14   - position: relative;
  12 + display: flex;
  13 + align-items: center;
  14 + padding: 0 31rpx;
  15 + width: 100%;
  16 + box-sizing: border-box;
  17 + border-bottom: 1rpx #f5f5f5 solid;
  18 + height: 98rpx;
  19 + position: relative;
  20 + font-size: 26rpx;
  21 + padding-top: 16rpx;
15 22 }
16 23  
17 24 .item-name {
18   - float: left;
  25 + display: flex;
  26 + align-items: center;
  27 + height: 100%;
  28 + width: 104rpx;
  29 +}
  30 +
  31 +.item-img {
  32 + height: 100%;
  33 + align-items: center;
  34 +}
  35 +
  36 +.item_default {
  37 + display: flex;
  38 + justify-content: space-between;
  39 +}
  40 +
  41 +.item_default .item-name {
  42 + width: 200rpx;
19 43 }
20 44  
21 45 .item-input {
22   - float: left;
23   - height: 100rpx;
24   - width: 450rpx;
25   - margin-left: 20rpx;
26   - word-break: keep-all;
27   - white-space: nowrap;
28   - overflow: hidden;
29   - text-overflow: ellipsis;
  46 + display: flex;
  47 + height: 100%;
  48 + margin-left: 40rpx;
  49 + /* word-break: keep-all;
  50 + white-space: nowrap;
  51 + overflow: hidden; */
  52 + text-overflow: ellipsis;
  53 + color: rgb(0, 0, 0);
  54 + align-items: center;
  55 + width: 74%;
  56 +}
  57 +
  58 +.item-inputaddress {
  59 + color: rgb(199, 199, 199);
  60 + margin-left: 40rpx;
  61 +}
  62 +
  63 +.detailed {
  64 + height: 193rpx;
  65 + padding-bottom: 95rpx;
  66 + display: flex;
  67 + padding: 0 31rpx;
  68 + padding-top: 41rpx;
  69 + font-size: 26rpx;
  70 + border-bottom: 1rpx #f5f5f5 solid;
  71 +}
  72 +
  73 +.detailed .detailed_item-name {
  74 + width: 137rpx;
  75 +}
  76 +
  77 +.detailed_item-input {
  78 + margin-left: 40rpx;
  79 + height: auto;
  80 + width: 100%;
  81 + min-height: 40rpx;
  82 + padding-bottom: 28rpx;
30 83 }
31 84  
32 85 .item-switch {
33   - float: right;
  86 + zoom: 0.7;
  87 +}
  88 +
  89 +.item-switch::before {
  90 + width: 80rpx !important;
  91 + height: 35rpx !important;
  92 + zoom: 1;
34 93 }
35 94  
36 95 .arrow {
37   - position: absolute;
38   - right: 30rpx;
39   - width: 32rpx;
40   - height: 32rpx;
41   - padding-top: 30rpx;
  96 + position: absolute;
  97 + right: 26rpx;
  98 + width: 26rpx;
  99 + height: 26rpx;
  100 + padding-top: 28rpx;
42 101 }
43 102  
44 103 .address-btns {
45   - position: absolute;
46   - bottom: 80rpx;
47   - float: left;
48   - width: 100%;
49   - padding: 10rpx 0;
  104 + position: absolute;
  105 + display: flex;
  106 + justify-content: center;
  107 + align-items: center;
  108 + bottom: 80rpx;
  109 + width: 100%;
50 110 }
51 111  
52 112 .delete-btn {
53   - float: left;
54   - width: 40%;
55   - margin: 0 10% 0 5%;
56   - border-radius: 10rpx;
57   - color: #999;
58   - border: 1px solid #f2f2f2;
  113 + display: flex;
  114 + justify-content: center;
  115 + align-items: center;
  116 + width: 285rpx;
  117 + height: 60rpx;
  118 + border-radius: 40rpx;
  119 + font-size: 27rpx;
  120 + color: rgb(0, 0, 0);
  121 + border: 1rpx solid rgb(210, 210, 210);
59 122 }
60 123  
61 124 .submit-btn {
62   - float: left;
63   - width: 40%;
64   - background-color: #e30000;
65   - color: white;
66   - border-radius: 10rpx;
  125 + display: flex;
  126 + justify-content: center;
  127 + align-items: center;
  128 + width: 285rpx;
  129 + height: 59rpx;
  130 + background-color: #e30000;
  131 + font-size: 27rpx;
  132 + color: rgb(255, 255, 255);
  133 + border-radius: 40rpx;
67 134 }
68   -
69   -@import "../../../utils/regions/regions.wxss";
70 135 \ No newline at end of file
  136 +@import "../../../utils/regions/regions.wxss";
... ...
pages/user/address_list/address_list.js
1   -var e = getApp(), t = require("../../../utils/request.js"),os=e.globalData.setting,oo=e.globalData;
  1 +var e = getApp(), t = require("../../../utils/request.js"), os = e.globalData.setting, oo = e.globalData, t = e.request;
2 2  
3 3  
4 4 Page({
5   - data: {
6   - url: e.globalData.setting.url,
7   - resourceUrl: e.globalData.setting.resourceUrl,
8   - iurl: e.globalData.setting.imghost,
9   - addresses: [],
10   - operate: null,
11   - curpage:1,
12   - total:0,
13   - ismore:0,
14   -
15   - },
16   - onLoad: function(e) {
17   - this.data.operate = e.operate;
18   - },
19   - onShow: function() {
20   - this.data.curpage=1;
21   - this.data.addresses=[];
22   - this.requestAddressList();
23   - },
24   -
  5 + data: {
  6 + url: e.globalData.setting.url,
  7 + resourceUrl: e.globalData.setting.resourceUrl,
  8 + iurl: e.globalData.setting.imghost,
  9 + addresses: [],
  10 + operate: null,
  11 + curpage: 1,
  12 + total: 0,
  13 + ismore: 0,
  14 + is_back:0, //有没有跳转
  15 + isloading:0,
  16 + is_address_read:0
  17 + },
  18 + onLoad: function (e) {
  19 + this.data.operate = e.operate;
  20 + var is_back=e.is_back;
  21 + if (is_back) this.setData({ is_back: is_back})
  22 + },
  23 + onShow: function () {
  24 + this.data.curpage = 1;
  25 + this.data.addresses = [];
  26 + this.requestAddressList();
  27 + console.log(this.data.addresses)
  28 + },
  29 +
25 30  
26 31 onReachBottom: function () {
27   - if(this.data.total<=6) return;
28   - if(this.data.ismore) return;
29   - this.requestAddressList();
  32 + if (this.data.total <= 6) return;
  33 + if (this.data.ismore) return;
  34 + this.requestAddressList();
30 35 },
31 36  
32   - requestAddressList: function() {
33   - var tt= Math.random() * 100
34   - var e = this;
35   - t.get(e.data.url + "/api/weshop/useraddress/page", {
36   - data: { store_id: os.stoid, user_id: oo.user_id, page: e.data.curpage,pageSize:6,t:tt},
37   - success: function(t) {
38   - e.data.curpage++;
39   - var arr1 = e.data.addresses;
40   - var arr2 = t.data.data.pageData;
41   - var arr3 = [...arr1, ...arr2];
  37 + requestAddressList: function () {
  38 + var tt = Math.random() * 100
  39 + var e = this;
  40 + t.get(e.data.url + "/api/weshop/useraddress/page", {
  41 + data: { store_id: os.stoid, user_id: oo.user_id, page: e.data.curpage, pageSize: 6, t: tt },
  42 + success: function (t) {
  43 + e.data.curpage++;
  44 + var arr1 = e.data.addresses;
  45 + var arr2 = t.data.data.pageData;
  46 + var arr3 = [...arr1, ...arr2];
42 47  
43   - var ismore=0;
44   - if (arr3.length == t.data.data.total) ismore=1
  48 + var ismore = 0;
  49 + if (arr3.length == t.data.data.total) ismore = 1
45 50  
46   - e.setData({
47   - addresses: arr3, total: t.data.data.total, ismore: ismore
48   - }), wx.stopPullDownRefresh();
49   - }
50   - });
51   - },
  51 + e.setData({
  52 + addresses: arr3, total: t.data.data.total, ismore: ismore,
  53 + is_address_read:1
  54 + }), wx.stopPullDownRefresh();
  55 + }
  56 + });
  57 + },
52 58  
53   - /*----------编辑地址----------*/
54   - editAddress: function(e) {
55   - var t = this.getAddressData(e.currentTarget.dataset.id), s = "";
56   - for (var a in t) s += (0 != s.length ? "&" : "?") + a + "=" + t[a];
57   - s && wx.navigateTo({
58   - url: "/pages/user/add_address/add_address" + s
59   - });
60   - },
  59 + /*----------编辑地址----------*/
  60 + editAddress: function (e) {
  61 + var t = this.getAddressData(e.currentTarget.dataset.id), s = "";
  62 + for (var a in t) s += (0 != s.length ? "&" : "?") + a + "=" + t[a];
  63 + s && wx.navigateTo({
  64 + url: "/pages/user/add_address/add_address" + s
  65 + });
  66 + },
61 67  
62   - /*-----选择地址返回确认------*/
63   - selectAddress: function(e) {
64   - if (null != this.data.operate) {
65   - /*----
66   - if ("select" == this.data.operate) wx.setStorageSync("cart:cart2:address_id", e.currentTarget.dataset.item.address_id); else if ("teamSelect" == this.data.operate) wx.setStorageSync("team:confirm:address_id", e.currentTarget.dataset.item.address_id); else if ("selectAddress" == this.data.operate) {
67   - var t = {
68   - address: e.currentTarget.dataset.item.province_name + e.currentTarget.dataset.item.city_name + e.currentTarget.dataset.item.district_name,
69   - district: e.currentTarget.dataset.item.district
70   - };
71   - wx.setStorageSync("goodsInfo:goodsInfo:address", t);
72   - }---*/
73   - oo.baddr = e.currentTarget.dataset.item;
74   - wx.navigateBack();
75   - }
76   - },
77   - getAddressData: function(e) {
78   - var t = this.data.addresses;
79   - for (var s in t) if (t[s].address_id == e) break;
80   - return s ? t[s] : {};
81   - },
  68 + /*-----选择地址返回确认------*/
  69 + selectAddress: function (e) {
  70 + if (null != this.data.operate) {
  71 + /*----
  72 + if ("select" == this.data.operate) wx.setStorageSync("cart:cart2:address_id", e.currentTarget.dataset.item.address_id); else if ("teamSelect" == this.data.operate) wx.setStorageSync("team:confirm:address_id", e.currentTarget.dataset.item.address_id); else if ("selectAddress" == this.data.operate) {
  73 + var t = {
  74 + address: e.currentTarget.dataset.item.province_name + e.currentTarget.dataset.item.city_name + e.currentTarget.dataset.item.district_name,
  75 + district: e.currentTarget.dataset.item.district
  76 + };
  77 + wx.setStorageSync("goodsInfo:goodsInfo:address", t);
  78 + }---*/
  79 + oo.baddr = e.currentTarget.dataset.item;
  80 + wx.navigateBack();
  81 + }
  82 + },
  83 + getAddressData: function (e) {
  84 + var t = this.data.addresses;
  85 + for (var s in t) if (t[s].address_id == e) break;
  86 + return s ? t[s] : {};
  87 + },
82 88  
83   - go_url:function(e){
84   - var url=e.currentTarget.dataset.url;
85   - getApp().goto(url);
  89 + go_url: function (e) {
  90 + var url = e.currentTarget.dataset.url;
  91 + getApp().goto(url);
  92 +
  93 + },
  94 + //判断是否选择
  95 + 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;
86 105 }
87 106  
  107 + if (th.data.isloading) return;
  108 + th.data.isloading=1;
88 109  
  110 +
  111 +
  112 +
  113 + t.put("/api/weshop/useraddress/updatePickUp", {
  114 + data: { user_id: oo.user_id, is_pickup: 0 },
  115 + isShowLoading:0,
  116 + 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});
  122 + a.is_pickup = 1;
  123 + t.put("/api/weshop/useraddress/updateById", {
  124 + data: a,
  125 + isShowLoading: 0,
  126 + success: function (s) {
  127 + var obj={};
  128 + var txt = "addresses[" + index +"].is_pickup";
  129 + obj[txt]=1;
  130 + th.setData(obj);
  131 + th.data.isloading=0
  132 + if (th.data.is_back) {
  133 + wx.navigateBack({});
  134 + }
  135 +
  136 +
  137 + },fail: function (t) {
  138 + th.data.isloading = 0;
  139 + }
  140 + });
  141 + },
  142 + fail: function (t) {
  143 + th.data.isloading = 0;
  144 + }
  145 + });
  146 +
  147 +
  148 +
  149 + }
89 150 });
90 151 \ No newline at end of file
... ...
pages/user/address_list/address_list.wxml
1   -<view class="container">
  1 +<!-- <view class="container">
2 2 <view class="address-box" wx:for="{{addresses}}" wx:key="{{index}}">
3 3 <view class="address-user">
4 4 <view class="user-name">{{item.consignee}}</view>
... ... @@ -12,7 +12,68 @@
12 12 <image src="{{iurl}}/miniapp/images/address_edit.png"></image>
13 13 </view>
14 14 </view>
15   - <view bindtap="go_url" class="address-create" data-url="/pages/user/add_address/add_address">
  15 + <navigator class="address-create" url="/pages/user/add_address/add_address">
16 16 <view class="create-btn">+新建地址</view>
17   - </view>
  17 + </navigator>
  18 +</view> -->
  19 +<!-- 无收货地址提醒页面 -->
  20 +<view class="topbcolor"></view>
  21 +<view class="nothing" wx:if="{{is_address_read==0?false:true && addresses.length<0}}">
  22 + <view class="image flex-level">
  23 + <image src="../../../images/nothingaddress.png"></image>
  24 + </view>
  25 +
  26 + <view class="nothingaddress flex-level">
  27 + <view>暂无收货地址</view>
  28 + </view>
  29 +
  30 + <view class="address flex-level">
  31 + <navigator bindtap="go_url" data-url="/pages/user/add_address/add_address">添加收货地址</navigator>
  32 + </view>
18 33 </view>
  34 +
  35 +<!-- 收货地址页面集合框架 -->
  36 +<view class="container" wx:if="{{addresses.length>0}}">
  37 + <!-- 所有的收货地址框架 -->
  38 + <view class="address-box">
  39 +
  40 + <!-- 单个收货地址框架 -->
  41 + <view class="address-user" wx:for="{{addresses}}" wx:key="{{index}}">
  42 + <!-- 选择icon -->
  43 + <view class="icon">
  44 + <icon type="success" color="red" size="33rpx" wx:if="{{item.is_pickup==1}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon>
  45 + <icon class="no_xuanze" color="white" wx:if="{{item.is_pickup==0}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon>
  46 + </view>
  47 +
  48 + <!-- 收货地址全部信息 -->
  49 + <view class="address">
  50 + <!-- 个人直接信息 -->
  51 + <view class="user">
  52 + <!-- 名字 -->
  53 + <view class="userName">{{item.consignee}}</view>
  54 + <!-- 电话 -->
  55 + <view class="userPhone">{{item.mobile}}</view>
  56 + <view class="default" wx:if="{{item.is_default}}">默认地址</view>
  57 + </view>
  58 +
  59 + <!-- 收货地址 -->
  60 + <view class="ShippingAddress ellipsis-2 ">{{item.more_address}} {{item.address}}</view>
  61 + </view>
  62 +
  63 + <!-- 编辑地址图片 -->
  64 + <view class="edit" bindtap="editAddress" data-id="{{item.address_id}}">
  65 + <image src="../../../images/dpr.png"></image>
  66 + </view>
  67 + </view>
  68 +
  69 + </view>
  70 +
  71 + <!-- 新建收货地址 -->
  72 + <view class="new">
  73 + <navigator bindtap="go_url" data-url="/pages/user/add_address/add_address">
  74 + <view class="add">+</view>
  75 + <view class="addAddress">新建收货地址</view>
  76 + </navigator>
  77 + </view>
  78 +
  79 +</view>
19 80 \ No newline at end of file
... ...
pages/user/address_list/address_list.wxss
1   -page {
  1 +/* 没有收货地址时的样式 */
  2 +
  3 +.nothing {
  4 + width: 100%;
  5 + font-size: 31rpx;
  6 +}
  7 +
  8 +.nothing image {
  9 + width: 299rpx;
  10 + height: 283rpx;
  11 + margin-top: 161rpx;
  12 +}
  13 +
  14 +.nothing .nothingaddress {
  15 + color: rgb(251, 65, 66);
  16 + margin-top: 35rpx;
  17 +}
  18 +
  19 +.nothing .address {
  20 + margin-top: 61rpx;
  21 +}
  22 +
  23 +.nothing .address navigator {
  24 + color: rgb(255, 255, 255);
  25 + background-color: rgb(251, 65, 66);
  26 + width: 256rpx;
  27 + height: 55rpx;
  28 + border-radius: 30rpx;
  29 + display: flex;
  30 + align-items: center;
  31 + justify-content: center;
  32 +}
  33 +
  34 +/* page {
2 35 margin-bottom: 200rpx;
3 36 }
4 37  
... ... @@ -15,7 +48,7 @@ page {
15 48 width: 150rpx;
16 49 }
17 50  
18   -.user-name {
  51 +.N-name {
19 52 font-size: 30rpx;
20 53 padding-bottom: 20rpx;
21 54 word-break: keep-all;
... ... @@ -62,20 +95,14 @@ page {
62 95 }
63 96  
64 97 .address-create {
65   - background-color: #fff;
66   - width: 100%;
  98 + width: 50%;
67 99 text-align: center;
68 100 position: fixed;
69   - bottom: 0rpx;
70   - height: 200rpx;
71   - border-top:1rpx solid #eee
72   -
  101 + bottom: 80rpx;
  102 + left: 25%;
73 103 }
74 104  
75 105 .create-btn {
76   - width: 50%;
77   - margin: 0 auto;
78   - margin-top: 60rpx;
79 106 font-size: 28rpx;
80 107 color: white;
81 108 background-color: #f23030;
... ... @@ -83,4 +110,131 @@ page {
83 110 text-align: center;
84 111 line-height: 80rpx;
85 112 display: block;
86   -}
87 113 \ No newline at end of file
  114 +} */
  115 +
  116 +page {
  117 + margin-bottom: 200rpx;
  118 +}
  119 +
  120 +.topbcolor {
  121 + width: 100%;
  122 + height: 7rpx;
  123 + background-color: rgb(245, 245, 245);
  124 +}
  125 +
  126 +.container {
  127 + margin-top: 7rpx;
  128 +}
  129 +
  130 +.container .address-box {
  131 + width: 100%;
  132 +}
  133 +
  134 +.container .address-box .address-user {
  135 + display: flex;
  136 + justify-content: center;
  137 + width: 100%;
  138 + border-bottom: 2rpx solid rgb(245, 245, 245);
  139 + height: 180rpx;
  140 + align-items: center;
  141 +}
  142 +
  143 +.container .address-box .address-user .icon {
  144 + padding-right: 20rpx;
  145 + display: flex;
  146 + align-items: center;
  147 + height: 100%;
  148 +}
  149 +
  150 +.container .address-box .address-user .no_xuanze {
  151 + width: 31rpx;
  152 + height: 31rpx;
  153 + border-radius: 50%;
  154 + border: 1rpx solid;
  155 +}
  156 +
  157 +.container .address-box .address-user .address {
  158 + width: 530rpx;
  159 +}
  160 +
  161 +.container .address-box .address-user .address .user {
  162 + display: flex;
  163 + align-items: center;
  164 + width: 500rpx;
  165 + font-weight: bold;
  166 + font-size: 31rpx;
  167 + color: rgb(40, 36, 33);
  168 +}
  169 +
  170 +.container .address-box .address-user .address .user .userName {
  171 + overflow: hidden;
  172 + text-overflow: ellipsis;
  173 + display: -webkit-box;
  174 + -webkit-box-orient: vertical;
  175 + -webkit-line-clamp: 1;
  176 + max-width: 149rpx;
  177 +}
  178 +
  179 +.container .address-box .address-user .address .user .userPhone {
  180 + margin-left: 41rpx;
  181 +}
  182 +
  183 +.container .address-box .address-user .address .user .default {
  184 + display: flex;
  185 + width: 105rpx;
  186 + height: 31rpx;
  187 + background-color: rgb(239, 22, 51);
  188 + justify-content: center;
  189 + font-size: 20rpx;
  190 + color: rgb(255, 255, 253);
  191 + border-radius: 8rpx;
  192 + margin-left: 21rpx;
  193 + line-height: 31rpx;
  194 +}
  195 +
  196 +.container .address-box .address-user .address .ShippingAddress {
  197 + font-size: 24rpx;
  198 + color: rgb(41, 38, 33);
  199 + height: 66rpx;
  200 +}
  201 +
  202 +.container .address-box .address-user .edit {
  203 + display: flex;
  204 + justify-content: center;
  205 + margin-left: 60rpx;
  206 + height: 100%;
  207 + align-items: center;
  208 +}
  209 +
  210 +.container .address-box .address-user .edit image {
  211 + width: 41rpx;
  212 + height: 38rpx;
  213 + align-items: center;
  214 +}
  215 +
  216 +.container .new {
  217 + width: 100%;
  218 + display: flex;
  219 + justify-content: center;
  220 + position: fixed;
  221 + bottom: 0rpx;
  222 + height: 204rpx;
  223 + align-items: center;
  224 + background-color: rgb(255, 255, 255);
  225 +}
  226 +
  227 +.container .new .add {
  228 + margin-right: 10rpx;
  229 +}
  230 +
  231 +.container navigator {
  232 + display: flex;
  233 + width: 430rpx;
  234 + height: 62rpx;
  235 + background-color: rgb(239, 22, 51);
  236 + border-radius: 40rpx;
  237 + justify-content: center;
  238 + align-items: center;
  239 + color: rgb(255, 255, 255);
  240 + font-size: 27rpx;
  241 +}
... ...