Commit a335d73c3cda7cf631323fda7fbf69b389cb9d7a
1 parent
76196ce9
移动个人中心地址移动到F包
Showing
11 changed files
with
921 additions
and
6 deletions
app.json
| ... | ... | @@ -14,8 +14,7 @@ |
| 14 | 14 | "pages/user/order_detail/order_detail", |
| 15 | 15 | "pages/user/userinfo/userinfo", |
| 16 | 16 | "pages/user/coupon/coupon", |
| 17 | - "pages/user/checkcoupon/checkcoupon", | |
| 18 | - "pages/user/add_address/add_address", | |
| 17 | + "pages/user/checkcoupon/checkcoupon", | |
| 19 | 18 | "pages/user/express/express", |
| 20 | 19 | "pages/activity/seckill_list/seckill_list", |
| 21 | 20 | "pages/activity/pind_list/pind_list", |
| ... | ... | @@ -232,7 +231,8 @@ |
| 232 | 231 | "pages/user/return_goods_info/return_goods_info", |
| 233 | 232 | "pages/user/return_goods_list/return_goods_list", |
| 234 | 233 | "pages/user/return_goods/return_goods", |
| 235 | - "pages/user/address_list/address_list" | |
| 234 | + "pages/user/address_list/address_list", | |
| 235 | + "pages/user/add_address/add_address" | |
| 236 | 236 | ] |
| 237 | 237 | |
| 238 | 238 | } | ... | ... |
packageF/pages/user/add_address/add_address.js
0 → 100644
| 1 | +var s = function(s) { | |
| 2 | + return s && s.__esModule ? s : { | |
| 3 | + default: s | |
| 4 | + }; | |
| 5 | +}(require("../../../../utils/regions/Regions.js")), e = getApp(), a = e.globalData.setting,os=a,t = e.request; | |
| 6 | +var ut = require("../../../../utils/util.js"), oo = e.globalData; | |
| 7 | + | |
| 8 | +Page({ | |
| 9 | + data: { | |
| 10 | + url: a.url, | |
| 11 | + resourceUrl: a.resourceUrl, | |
| 12 | + iurl: a.imghost, | |
| 13 | + address: null, | |
| 14 | + isnew:0, | |
| 15 | + is_op_co:false,//switch开关 | |
| 16 | + disabled:0 | |
| 17 | + }, | |
| 18 | + onLoad: function(s) { | |
| 19 | + var a = this,th=a; | |
| 20 | + var is_e = ut.isEmptyObject(s); | |
| 21 | + this.setData({ | |
| 22 | + address: s, isnew:is_e, | |
| 23 | + }), e.getUserInfo(function(s) { | |
| 24 | + a.setData({ | |
| 25 | + user: s | |
| 26 | + }); | |
| 27 | + th.initRegions(); | |
| 28 | + }) | |
| 29 | + }, | |
| 30 | + | |
| 31 | + onReachBottom: function () { | |
| 32 | + if (this.data.total <= 6) return; | |
| 33 | + if (this.data.ismore) return; | |
| 34 | + this.requestAddressList(); | |
| 35 | + }, | |
| 36 | + | |
| 37 | + requestAddressList: function () { | |
| 38 | + var e = this; | |
| 39 | + t.get(e.data.url + "/api/weshop/useraddress/page", { | |
| 40 | + data: { store_id: os.stoid, user_id: oo.user_id, page: e.data.curpage, pageSize: 20 }, | |
| 41 | + success: function (t) { | |
| 42 | + e.data.curpage++; | |
| 43 | + var arr1 = e.data.addresses; | |
| 44 | + var arr2 = t.data.data.pageData; | |
| 45 | + var arr3 = [...arr1, ...arr2]; | |
| 46 | + | |
| 47 | + var ismore = 0; | |
| 48 | + if (arr3.length == t.data.data.total) ismore = 1 | |
| 49 | + | |
| 50 | + e.setData({ | |
| 51 | + addresses: arr3, total: t.data.data.total, ismore: ismore | |
| 52 | + }), wx.stopPullDownRefresh(); | |
| 53 | + } | |
| 54 | + }); | |
| 55 | + }, | |
| 56 | + initRegions: function() { | |
| 57 | + var e = this; | |
| 58 | + new s.default(this, "regions", { | |
| 59 | + endAreaLevelCall: function(s, a, t) { | |
| 60 | + console.log("initRegions"); | |
| 61 | + console.log(t); | |
| 62 | + Object.assign(e.data.address, t), e.setData({ | |
| 63 | + "disabled": 0, | |
| 64 | + "address.province_name": e.data.address.province_name, | |
| 65 | + "address.city_name": e.data.address.city_name, | |
| 66 | + "address.district_name": e.data.address.district_name, | |
| 67 | + "address.twon_name": e.data.address.twon_name, | |
| 68 | + "address.more_address": | |
| 69 | + e.data.address.province_name + "-" + e.data.address.city_name + "-" + e.data.address.district_name | |
| 70 | + +"-"+e.data.address.twon_name, | |
| 71 | + }); | |
| 72 | + console.log(e.data.address); | |
| 73 | + } | |
| 74 | + }); | |
| 75 | + }, | |
| 76 | + //-----------添加或者编辑----------- | |
| 77 | + submitAddress: function (s) { | |
| 78 | + var a = this.data.address, b = a, th = this; | |
| 79 | + Object.assign(a, s.detail.value), a.is_default = Number(a.is_default); | |
| 80 | + a.store_id = os.stoid; | |
| 81 | + | |
| 82 | + //判断用户名是否为空 | |
| 83 | + var cs = th.check(a.consignee); | |
| 84 | + if (cs != 1) { | |
| 85 | + return getApp().my_warnning("收货姓名不能为空", 0, th); | |
| 86 | + } | |
| 87 | + | |
| 88 | + var ob = ut.check_mobile(a.mobile); | |
| 89 | + if (ob.code != 1) { | |
| 90 | + return getApp().my_warnning(ob.title, 0, th); | |
| 91 | + } | |
| 92 | + | |
| 93 | + if (a.more_address == null || a.more_address == undefined || a.more_address == "") { | |
| 94 | + getApp().my_warnning("请选择地区", 0, th); | |
| 95 | + return false; | |
| 96 | + } | |
| 97 | + //判断地址是否为空 | |
| 98 | + var add = th.check(a.address); | |
| 99 | + if (add != 1) { | |
| 100 | + return getApp().my_warnning("详细地址不能为空", 0, th); | |
| 101 | + } | |
| 102 | + | |
| 103 | + //判断是不是空对象 | |
| 104 | + //--------如果是修改地址---------- | |
| 105 | + if (!th.data.isnew) { | |
| 106 | + if (a.is_default == 1) { | |
| 107 | + t.put("/api/weshop/useraddress/update", { | |
| 108 | + data: { user_id: oo.user_id, is_default: 0 }, | |
| 109 | + success: function (s) { | |
| 110 | + t.put("/api/weshop/useraddress/updateById", { | |
| 111 | + data: a, | |
| 112 | + success: function (s) { | |
| 113 | + e.showSuccess(s.data.msg, function () { | |
| 114 | + wx.navigateBack(); | |
| 115 | + }); | |
| 116 | + } | |
| 117 | + }); | |
| 118 | + } | |
| 119 | + }); | |
| 120 | + | |
| 121 | + } else { | |
| 122 | + t.put("/api/weshop/useraddress/updateById", { | |
| 123 | + data: a, | |
| 124 | + success: function (s) { | |
| 125 | + e.showSuccess(s.data.msg, function () { | |
| 126 | + wx.navigateBack(); | |
| 127 | + }); | |
| 128 | + } | |
| 129 | + }); | |
| 130 | + } | |
| 131 | + | |
| 132 | + } else { | |
| 133 | + a['user_id'] = oo.user_id; | |
| 134 | + a['store_id'] = os.stoid; | |
| 135 | + | |
| 136 | + | |
| 137 | + if (a.is_default == 1) { | |
| 138 | + t.put("/api/weshop/useraddress/update", { | |
| 139 | + data: { user_id: oo.user_id, is_default: 0 }, | |
| 140 | + success: function (s) { | |
| 141 | + | |
| 142 | + //-----新增地址------- | |
| 143 | + t.post("/api/weshop/useraddress/save", { | |
| 144 | + data: a, | |
| 145 | + success: function (s) { | |
| 146 | + e.showSuccess(s.data.msg, function () { | |
| 147 | + wx.navigateBack(); | |
| 148 | + }); | |
| 149 | + } | |
| 150 | + }); | |
| 151 | + | |
| 152 | + } | |
| 153 | + }) | |
| 154 | + } else { | |
| 155 | + | |
| 156 | + //-----新增地址------- | |
| 157 | + t.post("/api/weshop/useraddress/save", { | |
| 158 | + data: a, | |
| 159 | + success: function (s) { | |
| 160 | + e.showSuccess(s.data.msg, function () { | |
| 161 | + wx.navigateBack(); | |
| 162 | + }); | |
| 163 | + } | |
| 164 | + }); | |
| 165 | + } | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + } | |
| 170 | + }, | |
| 171 | + | |
| 172 | + //---------删除收货地址------------ | |
| 173 | + deleteAddress: function() { | |
| 174 | + var s = this.data.address.address_id; | |
| 175 | + s && wx.showModal({ | |
| 176 | + title: "确定删除?", | |
| 177 | + success: function(a) { | |
| 178 | + a.confirm && t.delete("/api/weshop/useraddress/del/" + oo.user_id+"/"+s, { | |
| 179 | + success: function(s) { | |
| 180 | + e.showSuccess("删除成功", function() { | |
| 181 | + wx.navigateBack(); | |
| 182 | + }, 500); | |
| 183 | + } | |
| 184 | + }); | |
| 185 | + } | |
| 186 | + }); | |
| 187 | + }, | |
| 188 | + //是否是默认地址 | |
| 189 | + bind_is_op_co:function(e){ | |
| 190 | + var i = e.detail; | |
| 191 | + this.setData({ | |
| 192 | + is_op_co:i | |
| 193 | + }) | |
| 194 | + console.log(i) | |
| 195 | + }, | |
| 196 | + check:function(as){ | |
| 197 | + var code = 1; | |
| 198 | + if(as===''){ | |
| 199 | + code = -1; | |
| 200 | + } | |
| 201 | + return code; | |
| 202 | +} | |
| 203 | +}); | |
| 0 | 204 | \ No newline at end of file | ... | ... |
packageF/pages/user/add_address/add_address.json
0 → 100644
packageF/pages/user/add_address/add_address.wxml
0 → 100644
| 1 | +<import src="../../../utils/regions/regions.wxml"></import> | |
| 2 | + | |
| 3 | + | |
| 4 | +<view class="container"> | |
| 5 | +<view class="topbcolor"></view> | |
| 6 | + <form bindsubmit="submitAddress"> | |
| 7 | + | |
| 8 | + <view class="item"> | |
| 9 | + <view class="item-name">收货人</view> | |
| 10 | + <input maxlength="10" class="item-input" name="consignee" value="{{address.consignee}}" placeholder="请填写收货人姓名" placeholder-style="color: rgb(199, 199, 199)"></input> | |
| 11 | + </view> | |
| 12 | + <view class="item"> | |
| 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> | |
| 15 | + </view> | |
| 16 | + <view bindtap="openRegionsModal" class="item" data-id="0"> | |
| 17 | + <view class="item-name">所在地区</view> | |
| 18 | + <view class="item-input{{address.more_address==null?'address':''}}">{{address.more_address==null?'省市区县,乡镇等':address.more_address}}</view> | |
| 19 | + <view class="item-img"> | |
| 20 | + <image class="arrow" src="{{iurl}}/miniapp/images/icon-arrowdown.png"></image> | |
| 21 | + </view> | |
| 22 | + </view> | |
| 23 | + <view class="detailed"> | |
| 24 | + <view class="detailed_item-name">详细地址</view> | |
| 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> | |
| 27 | + </view> | |
| 28 | + <view class="item item_default"> | |
| 29 | + <view class="item-name">设为默认地址</view> | |
| 30 | + <switch checked="{{address.is_default==1?true:false}}" class="item-switch" | |
| 31 | + 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"/> | |
| 32 | + </view> | |
| 33 | + <view class="address-btns"> | |
| 34 | + <button bindtap="deleteAddress" wx:if="{{address.mobile!=null}}" class="delete-btn">删除地址</button> | |
| 35 | + <button class="submit-btn" formType="submit">提交地址</button> | |
| 36 | + </view> | |
| 37 | + </form> | |
| 38 | +</view> | |
| 39 | + | |
| 40 | +<template is="regions" data="{{regions:regions}}"></template> | |
| 41 | +<warn id="warn"></warn> | ... | ... |
packageF/pages/user/add_address/add_address.wxss
0 → 100644
| 1 | +page { | |
| 2 | + background: rgb(255, 255, 255); | |
| 3 | +} | |
| 4 | + | |
| 5 | +.topbcolor { | |
| 6 | + width: 100%; | |
| 7 | + height: 7rpx; | |
| 8 | + background-color: rgb(245, 245, 245); | |
| 9 | +} | |
| 10 | + | |
| 11 | +.item { | |
| 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; | |
| 22 | +} | |
| 23 | + | |
| 24 | +.item-name { | |
| 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; | |
| 43 | +} | |
| 44 | + | |
| 45 | +.item-input { | |
| 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; | |
| 83 | +} | |
| 84 | + | |
| 85 | +.item-switch { | |
| 86 | + zoom: 0.7; | |
| 87 | +} | |
| 88 | + | |
| 89 | +.item-switch::before { | |
| 90 | + width: 80rpx !important; | |
| 91 | + height: 35rpx !important; | |
| 92 | + zoom: 1; | |
| 93 | +} | |
| 94 | + | |
| 95 | +.arrow { | |
| 96 | + position: absolute; | |
| 97 | + right: 26rpx; | |
| 98 | + width: 26rpx; | |
| 99 | + height: 26rpx; | |
| 100 | + padding-top: 28rpx; | |
| 101 | +} | |
| 102 | + | |
| 103 | +.address-btns { | |
| 104 | + position: absolute; | |
| 105 | + display: flex; | |
| 106 | + justify-content: center; | |
| 107 | + align-items: center; | |
| 108 | + bottom: 80rpx; | |
| 109 | + width: 100%; | |
| 110 | +} | |
| 111 | + | |
| 112 | +.delete-btn { | |
| 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); | |
| 122 | +} | |
| 123 | + | |
| 124 | +.submit-btn { | |
| 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; | |
| 134 | +} | |
| 135 | +@import "../../../../utils/regions/regions.wxss"; | ... | ... |
packageF/pages/user/address_list/address_list.js
0 → 100644
| 1 | +var e = getApp(), t = require("../../../../utils/request.js"), os = e.globalData.setting, oo = e.globalData, t = e.request; | |
| 2 | + | |
| 3 | +Page({ | |
| 4 | + data: { | |
| 5 | + url: e.globalData.setting.url, | |
| 6 | + resourceUrl: e.globalData.setting.resourceUrl, | |
| 7 | + iurl: e.globalData.setting.imghost, | |
| 8 | + addresses: [], | |
| 9 | + operate: null, | |
| 10 | + curpage: 1, | |
| 11 | + total: 0, | |
| 12 | + ismore: 0, | |
| 13 | + is_back:0, //有没有跳转 | |
| 14 | + isloading:0, | |
| 15 | + is_address_read:0 | |
| 16 | + }, | |
| 17 | + onLoad: function (e) { | |
| 18 | + var pages = getCurrentPages(); | |
| 19 | + var prevPage = pages[pages.length - 2]; //上一个页面 | |
| 20 | + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |
| 21 | + prevPage.setData({ | |
| 22 | + is_zy: 1 | |
| 23 | + }) | |
| 24 | + //清空is_pick_up | |
| 25 | + getApp().request.put("/api/weshop/useraddress/updatePickUp", { | |
| 26 | + data: {user_id: getApp().globalData.user_id, is_pickup: 0}, | |
| 27 | + success: function (s) { | |
| 28 | + } | |
| 29 | + }); | |
| 30 | + | |
| 31 | + this.data.operate = e.operate; | |
| 32 | + }, | |
| 33 | + onShow: function () { | |
| 34 | + var is_back=getApp().globalData.is_cart_old; | |
| 35 | + if (is_back) this.setData({ is_back: is_back}) | |
| 36 | + | |
| 37 | + this.data.curpage = 1; | |
| 38 | + this.data.addresses = []; | |
| 39 | + this.requestAddressList(); | |
| 40 | + console.log(this.data.addresses) | |
| 41 | + }, | |
| 42 | + | |
| 43 | + onReachBottom: function () { | |
| 44 | + if (this.data.total <= 6) return; | |
| 45 | + if (this.data.ismore) return; | |
| 46 | + this.requestAddressList(); | |
| 47 | + }, | |
| 48 | + | |
| 49 | + requestAddressList: function () { | |
| 50 | + var tt = Math.random() * 100 | |
| 51 | + var e = this; | |
| 52 | + t.get(e.data.url + "/api/weshop/useraddress/page", { | |
| 53 | + data: { store_id: os.stoid, user_id: oo.user_id, page: e.data.curpage, pageSize: 20, t: tt }, | |
| 54 | + success: function (t) { | |
| 55 | + e.data.curpage++; | |
| 56 | + var arr1 = e.data.addresses; | |
| 57 | + var arr2 = t.data.data.pageData; | |
| 58 | + var arr3 = [...arr1, ...arr2]; | |
| 59 | + var ismore = 0; | |
| 60 | + if (arr3.length == t.data.data.total) ismore = 1 | |
| 61 | + e.setData({ | |
| 62 | + addresses: arr3, total: t.data.data.total, ismore: ismore, | |
| 63 | + is_address_read:1 | |
| 64 | + }), wx.stopPullDownRefresh(); | |
| 65 | + } | |
| 66 | + }); | |
| 67 | + }, | |
| 68 | + | |
| 69 | + /*----------编辑地址----------*/ | |
| 70 | + editAddress: function (e) { | |
| 71 | + var t = this.getAddressData(e.currentTarget.dataset.id), s = ""; | |
| 72 | + for (var a in t) s += (0 != s.length ? "&" : "?") + a + "=" + t[a]; | |
| 73 | + s && wx.navigateTo({ | |
| 74 | + url: "/packageF/pages/user/add_address/add_address" + s | |
| 75 | + }); | |
| 76 | + }, | |
| 77 | + | |
| 78 | + /*-----选择地址返回确认------*/ | |
| 79 | + selectAddress: function (e) { | |
| 80 | + if (null != this.data.operate) { | |
| 81 | + oo.baddr = e.currentTarget.dataset.item; | |
| 82 | + wx.navigateBack(); | |
| 83 | + } | |
| 84 | + }, | |
| 85 | + | |
| 86 | + getAddressData: function (e) { | |
| 87 | + var t = this.data.addresses; | |
| 88 | + for (var s in t) if (t[s].address_id == e) break; | |
| 89 | + return s ? t[s] : {}; | |
| 90 | + }, | |
| 91 | + | |
| 92 | + go_url: function (e) { | |
| 93 | + var url = e.currentTarget.dataset.url; | |
| 94 | + getApp().goto(url); | |
| 95 | + | |
| 96 | + }, | |
| 97 | + //判断是否选择 | |
| 98 | + add_is_pickup:function(e){ | |
| 99 | + | |
| 100 | + if(this.data.is_back==0) return false; | |
| 101 | + | |
| 102 | + var th = this; | |
| 103 | + var index = e.currentTarget.dataset.ind; | |
| 104 | + var a = this.data.addresses[index]; | |
| 105 | + | |
| 106 | + if (th.data.isloading) return; | |
| 107 | + th.data.isloading=1; | |
| 108 | + | |
| 109 | + t.put("/api/weshop/useraddress/updatePickUp", { | |
| 110 | + data: { user_id: oo.user_id, is_pickup: 0 }, | |
| 111 | + isShowLoading:0, | |
| 112 | + success: function (s) { | |
| 113 | + | |
| 114 | + a.is_pickup = 1; | |
| 115 | + t.put("/api/weshop/useraddress/updateById", { | |
| 116 | + data: a, | |
| 117 | + isShowLoading: 0, | |
| 118 | + success: function (s) { | |
| 119 | + | |
| 120 | + th.data.isloading=0 | |
| 121 | + if (th.data.is_back) { | |
| 122 | + wx.navigateBack({}); | |
| 123 | + } | |
| 124 | + | |
| 125 | + },fail: function (t) { | |
| 126 | + th.data.isloading = 0; | |
| 127 | + } | |
| 128 | + }); | |
| 129 | + }, | |
| 130 | + fail: function (t) { | |
| 131 | + th.data.isloading = 0; | |
| 132 | + } | |
| 133 | + }); | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + } , | |
| 138 | + | |
| 139 | + //获取微信地址 | |
| 140 | + get_wx:function(){ | |
| 141 | + var th=this; | |
| 142 | + wx.getSetting({ | |
| 143 | + success(res) { | |
| 144 | + getApp().globalData.no_clear=1; | |
| 145 | + console.log("vres.authSetting['scope.address']:", res.authSetting['scope.address']); | |
| 146 | + if (res.authSetting['scope.address']) { | |
| 147 | + getApp().globalData.no_clear=1; | |
| 148 | + wx.chooseAddress({ | |
| 149 | + success(res) { | |
| 150 | + th.save_wx_addr(res); | |
| 151 | + } | |
| 152 | + }) | |
| 153 | + | |
| 154 | + } else { | |
| 155 | + if (res.authSetting['scope.address'] == false) { | |
| 156 | + getApp().globalData.no_clear=1; | |
| 157 | + wx.openSetting({ | |
| 158 | + success(res) {} | |
| 159 | + }) | |
| 160 | + } else { | |
| 161 | + | |
| 162 | + getApp().globalData.no_clear=1; | |
| 163 | + wx.chooseAddress({ | |
| 164 | + success(res) { | |
| 165 | + th.save_wx_addr(res); | |
| 166 | + } | |
| 167 | + }) | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } | |
| 171 | + }) | |
| 172 | + }, | |
| 173 | + | |
| 174 | + save_wx_addr:function (res) { | |
| 175 | + var pd={},th=this; | |
| 176 | + pd.store_id=os.stoid; | |
| 177 | + pd.user_id=getApp().globalData.user_id; | |
| 178 | + pd.userName=res.userName; | |
| 179 | + pd.provinceName=res.provinceName; | |
| 180 | + pd.countryName=res.countyName; | |
| 181 | + pd.cityName=res.cityName; | |
| 182 | + pd.detailInfo=res.detailInfo; | |
| 183 | + pd.postalCode=res.postalCode; | |
| 184 | + pd.telNumber=res.telNumber; | |
| 185 | + getApp().request.promisePost("/api/weshop/useraddress/saveWx",{data:pd}).then(res=>{ | |
| 186 | + if(res.data.code==0){ | |
| 187 | + getApp().my_warnning("保存成功",1,th); | |
| 188 | + setTimeout(function () { | |
| 189 | + th.onShow(); | |
| 190 | + },1000) | |
| 191 | + } | |
| 192 | + }) | |
| 193 | + | |
| 194 | + }, | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | +}); | |
| 0 | 199 | \ No newline at end of file | ... | ... |
packageF/pages/user/address_list/address_list.json
0 → 100644
packageF/pages/user/address_list/address_list.wxml
0 → 100644
| 1 | +<!-- 无收货地址提醒页面 --> | |
| 2 | +<view class="topbcolor"></view> | |
| 3 | +<view class="nothing" wx:if="{{is_address_read && addresses.length<=0}}"> | |
| 4 | + <view class="image flex-level"> | |
| 5 | + <image src="{{iurl}}/miniapp/images/nothingaddress.png"></image> | |
| 6 | + </view> | |
| 7 | + | |
| 8 | + <view class="nothingaddress flex-level"> | |
| 9 | + <view>暂无收货地址</view> | |
| 10 | + </view> | |
| 11 | + | |
| 12 | + <view class="address flex jc_sb" style="width:76%; margin-left:12%"> | |
| 13 | + | |
| 14 | + <navigator bindtap="get_wx" class="ye"> | |
| 15 | + <view class="add">+</view> | |
| 16 | + <view class="addAddress">获取微信地址</view> | |
| 17 | + </navigator> | |
| 18 | + | |
| 19 | + <navigator bindtap="go_url" data-url="/packageF/pages/user/add_address/add_address"> | |
| 20 | + <view class="add">+</view> | |
| 21 | + <view class="addAddress">新建收货地址</view> | |
| 22 | + </navigator> | |
| 23 | + | |
| 24 | + | |
| 25 | + </view> | |
| 26 | +</view> | |
| 27 | + | |
| 28 | + <!-- 收货地址页面集合框架 --> | |
| 29 | +<view class="container" wx:if="{{addresses.length>0}}"> | |
| 30 | + <!-- 所有的收货地址框架 --> | |
| 31 | + <view class="address-box"> | |
| 32 | + | |
| 33 | + <!-- 单个收货地址框架 --> | |
| 34 | + <view class="address-user" wx:for="{{addresses}}" wx:key="index"> | |
| 35 | + <!-- 选择icon | |
| 36 | + <view class="icon"> | |
| 37 | + <icon type="success" color="red" size="33rpx" wx:if="{{item.is_pickup==1}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon> | |
| 38 | + <icon class="no_xuanze" color="white" wx:if="{{item.is_pickup==0}}" bindtap="add_is_pickup" data-icon="{{index}}"></icon> | |
| 39 | + </view>--> | |
| 40 | + | |
| 41 | + <!-- 收货地址全部信息 --> | |
| 42 | + <view class="address" bindtap="add_is_pickup" data-ind="{{index}}"> | |
| 43 | + <!-- 个人直接信息 --> | |
| 44 | + <view class="user"> | |
| 45 | + <!-- 名字 --> | |
| 46 | + <view class="userName">{{item.consignee}}</view> | |
| 47 | + <!-- 电话 --> | |
| 48 | + <view class="userPhone">{{item.mobile}}</view> | |
| 49 | + <view class="default" wx:if="{{item.is_default}}">默认地址</view> | |
| 50 | + </view> | |
| 51 | + | |
| 52 | + <!-- 收货地址 --> | |
| 53 | + <view class="ShippingAddress ellipsis-2 ">{{item.more_address}} {{item.address}}</view> | |
| 54 | + </view> | |
| 55 | + | |
| 56 | + <!-- 编辑地址图片 --> | |
| 57 | + <view class="edit" bindtap="editAddress" data-id="{{item.address_id}}"> | |
| 58 | + <image src="{{iurl}}/miniapp/images/dpr.png"></image> | |
| 59 | + </view> | |
| 60 | + </view> | |
| 61 | + | |
| 62 | + </view> | |
| 63 | + <view style="height:210rpx"></view> | |
| 64 | + | |
| 65 | + <!-- 新建收货地址 --> | |
| 66 | + <view class="new flex jc_sb"> | |
| 67 | + <navigator bindtap="get_wx" class="ye"> | |
| 68 | + <view class="add">+</view> | |
| 69 | + <view class="addAddress">获取微信地址</view> | |
| 70 | + </navigator> | |
| 71 | + | |
| 72 | + <navigator bindtap="go_url" data-url="/packageF/pages/user/add_address/add_address"> | |
| 73 | + <view class="add">+</view> | |
| 74 | + <view class="addAddress">新建收货地址</view> | |
| 75 | + </navigator> | |
| 76 | + </view> | |
| 77 | +</view> | |
| 78 | +<warn id="warn"></warn> | |
| 0 | 79 | \ No newline at end of file | ... | ... |
packageF/pages/user/address_list/address_list.wxss
0 → 100644
| 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 { | |
| 35 | + margin-bottom: 200rpx; | |
| 36 | +} | |
| 37 | + | |
| 38 | +.address-box { | |
| 39 | + background-color: white; | |
| 40 | + padding: 25rpx 0 25rpx 25rpx; | |
| 41 | + font-size: 28rpx; | |
| 42 | + border-bottom: 3rpx #f8f8f8 solid; | |
| 43 | +} | |
| 44 | + | |
| 45 | +.address-user { | |
| 46 | + box-sizing: border-box; | |
| 47 | + float: left; | |
| 48 | + width: 150rpx; | |
| 49 | +} | |
| 50 | + | |
| 51 | +.N-name { | |
| 52 | + font-size: 30rpx; | |
| 53 | + padding-bottom: 20rpx; | |
| 54 | + word-break: keep-all; | |
| 55 | + white-space: nowrap; | |
| 56 | + text-overflow: ellipsis; | |
| 57 | + overflow: hidden; | |
| 58 | +} | |
| 59 | + | |
| 60 | +.default { | |
| 61 | + color: white; | |
| 62 | + background-color: red; | |
| 63 | + padding: 4rpx; | |
| 64 | + width: fit-content; | |
| 65 | + border-radius: 6rpx; | |
| 66 | +} | |
| 67 | + | |
| 68 | +.address-info { | |
| 69 | + box-sizing: border-box; | |
| 70 | + float: left; | |
| 71 | + width: 480rpx; | |
| 72 | + padding-left: 10rpx; | |
| 73 | +} | |
| 74 | + | |
| 75 | +.mobile { | |
| 76 | + padding-bottom: 25rpx; | |
| 77 | +} | |
| 78 | + | |
| 79 | +.address { | |
| 80 | + height: 70rpx; | |
| 81 | + overflow: hidden; | |
| 82 | +} | |
| 83 | + | |
| 84 | +.address-edit { | |
| 85 | + box-sizing: border-box; | |
| 86 | + width: 95rpx; | |
| 87 | + float: left; | |
| 88 | + text-align: center; | |
| 89 | + padding-top: 32rpx; | |
| 90 | +} | |
| 91 | + | |
| 92 | +.address-edit>image { | |
| 93 | + width: 36rpx; | |
| 94 | + height: 42rpx; | |
| 95 | +} | |
| 96 | + | |
| 97 | +.address-create { | |
| 98 | + width: 50%; | |
| 99 | + text-align: center; | |
| 100 | + position: fixed; | |
| 101 | + bottom: 80rpx; | |
| 102 | + left: 25%; | |
| 103 | +} | |
| 104 | + | |
| 105 | +.create-btn { | |
| 106 | + font-size: 28rpx; | |
| 107 | + color: white; | |
| 108 | + background-color: #f23030; | |
| 109 | + border-radius: 10rpx; | |
| 110 | + text-align: center; | |
| 111 | + line-height: 80rpx; | |
| 112 | + display: block; | |
| 113 | +} */ | |
| 114 | + | |
| 115 | +page { | |
| 116 | + margin-bottom: 200rpx; | |
| 117 | +} | |
| 118 | + | |
| 119 | +.topbcolor { | |
| 120 | + width: 100%; | |
| 121 | + height: 7rpx; | |
| 122 | + background-color: rgb(245, 245, 245); | |
| 123 | +} | |
| 124 | + | |
| 125 | +.container { | |
| 126 | + margin-top: 7rpx; | |
| 127 | +} | |
| 128 | + | |
| 129 | +.container .address-box { | |
| 130 | + width: 100%; | |
| 131 | +} | |
| 132 | + | |
| 133 | +.container .address-box .address-user { | |
| 134 | + display: flex; | |
| 135 | + justify-content: center; | |
| 136 | + width: 100%; | |
| 137 | + border-bottom: 2rpx solid rgb(245, 245, 245); | |
| 138 | + height: 180rpx; | |
| 139 | + align-items: center; | |
| 140 | +} | |
| 141 | + | |
| 142 | +.container .address-box .address-user .icon { | |
| 143 | + padding-right: 20rpx; | |
| 144 | + display: flex; | |
| 145 | + align-items: center; | |
| 146 | + height: 100%; | |
| 147 | +} | |
| 148 | + | |
| 149 | +.container .address-box .address-user .no_xuanze { | |
| 150 | + width: 31rpx; | |
| 151 | + height: 31rpx; | |
| 152 | + border-radius: 50%; | |
| 153 | + border: 1rpx solid; | |
| 154 | +} | |
| 155 | + | |
| 156 | +.container .address-box .address-user .address { | |
| 157 | + width: 530rpx; | |
| 158 | +} | |
| 159 | + | |
| 160 | +.container .address-box .address-user .address .user { | |
| 161 | + display: flex; | |
| 162 | + align-items: center; | |
| 163 | + width: 500rpx; | |
| 164 | + font-weight: bold; | |
| 165 | + font-size: 31rpx; | |
| 166 | + color: rgb(40, 36, 33); | |
| 167 | +} | |
| 168 | + | |
| 169 | +.container .address-box .address-user .address .user .userName { | |
| 170 | + overflow: hidden; | |
| 171 | + text-overflow: ellipsis; | |
| 172 | + display: -webkit-box; | |
| 173 | + -webkit-box-orient: vertical; | |
| 174 | + -webkit-line-clamp: 1; | |
| 175 | + max-width: 149rpx; | |
| 176 | +} | |
| 177 | + | |
| 178 | +.container .address-box .address-user .address .user .userPhone { | |
| 179 | + margin-left: 41rpx; | |
| 180 | +} | |
| 181 | + | |
| 182 | +.container .address-box .address-user .address .user .default { | |
| 183 | + display: flex; | |
| 184 | + width: 105rpx; | |
| 185 | + height: 31rpx; | |
| 186 | + background-color: rgb(239, 22, 51); | |
| 187 | + justify-content: center; | |
| 188 | + font-size: 20rpx; | |
| 189 | + color: rgb(255, 255, 253); | |
| 190 | + border-radius: 8rpx; | |
| 191 | + margin-left: 21rpx; | |
| 192 | + line-height: 31rpx; | |
| 193 | +} | |
| 194 | + | |
| 195 | +.container .address-box .address-user .address .ShippingAddress { | |
| 196 | + font-size: 24rpx; | |
| 197 | + color: rgb(41, 38, 33); | |
| 198 | + height: 66rpx; | |
| 199 | +} | |
| 200 | + | |
| 201 | +.container .address-box .address-user .edit { | |
| 202 | + display: flex; | |
| 203 | + justify-content: center; | |
| 204 | + margin-left: 60rpx; | |
| 205 | + height: 100%; | |
| 206 | + align-items: center; | |
| 207 | +} | |
| 208 | + | |
| 209 | +.container .address-box .address-user .edit image { | |
| 210 | + width: 41rpx; | |
| 211 | + height: 38rpx; | |
| 212 | + align-items: center; | |
| 213 | +} | |
| 214 | + | |
| 215 | +.container .new { | |
| 216 | + width: 86%; | |
| 217 | + display: flex; | |
| 218 | + position: fixed; | |
| 219 | + bottom: 0rpx; | |
| 220 | + height: 204rpx; | |
| 221 | + align-items: center; | |
| 222 | + background-color: rgb(255, 255, 255); | |
| 223 | + margin-left:7% | |
| 224 | +} | |
| 225 | + | |
| 226 | +.container .new .add { | |
| 227 | + margin-right: 10rpx; | |
| 228 | +} | |
| 229 | + | |
| 230 | +.container navigator { | |
| 231 | + display: flex; | |
| 232 | + width: 300rpx; | |
| 233 | + height: 62rpx; | |
| 234 | + background-color: rgb(239, 22, 51); | |
| 235 | + border-radius: 40rpx; | |
| 236 | + justify-content: center; | |
| 237 | + align-items: center; | |
| 238 | + color: rgb(255, 255, 255); | |
| 239 | + font-size: 27rpx; | |
| 240 | +} | |
| 241 | + | |
| 242 | +.container navigator.ye{ | |
| 243 | + background-color: #fc872d; | |
| 244 | +} | |
| 245 | +.nothing .address navigator.ye{ | |
| 246 | + background-color: #fc872d; | |
| 247 | +} | ... | ... |
pages/user/address_list/address_list.js
| ... | ... | @@ -71,7 +71,7 @@ Page({ |
| 71 | 71 | var t = this.getAddressData(e.currentTarget.dataset.id), s = ""; |
| 72 | 72 | for (var a in t) s += (0 != s.length ? "&" : "?") + a + "=" + t[a]; |
| 73 | 73 | s && wx.navigateTo({ |
| 74 | - url: "/pages/user/add_address/add_address" + s | |
| 74 | + url: "/packageF/pages/user/add_address/add_address" + s | |
| 75 | 75 | }); |
| 76 | 76 | }, |
| 77 | 77 | ... | ... |
pages/user/address_list/address_list.wxml
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <view class="addAddress">获取微信地址</view> |
| 17 | 17 | </navigator> |
| 18 | 18 | |
| 19 | - <navigator bindtap="go_url" data-url="/pages/user/add_address/add_address"> | |
| 19 | + <navigator bindtap="go_url" data-url="/packageF/pages/user/add_address/add_address"> | |
| 20 | 20 | <view class="add">+</view> |
| 21 | 21 | <view class="addAddress">新建收货地址</view> |
| 22 | 22 | </navigator> |
| ... | ... | @@ -69,7 +69,7 @@ |
| 69 | 69 | <view class="addAddress">获取微信地址</view> |
| 70 | 70 | </navigator> |
| 71 | 71 | |
| 72 | - <navigator bindtap="go_url" data-url="/pages/user/add_address/add_address"> | |
| 72 | + <navigator bindtap="go_url" data-url="/packageF/pages/user/add_address/add_address"> | |
| 73 | 73 | <view class="add">+</view> |
| 74 | 74 | <view class="addAddress">新建收货地址</view> |
| 75 | 75 | </navigator> | ... | ... |