绚火健康
This commit is contained in:
179
pages/site/add/add.js
Normal file
179
pages/site/add/add.js
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
nameValue : '', // 姓名
|
||||
mobile : '', // 电话
|
||||
address : '', // 地址
|
||||
isDefault : '', // 默认地址
|
||||
// 省份选择
|
||||
areasArr : [],
|
||||
areaId : 0,
|
||||
areaIndex : 0,
|
||||
|
||||
// 市级选择
|
||||
cityArr : [],
|
||||
cityId : 0,
|
||||
cityIndex : 0,
|
||||
|
||||
// 区域选择
|
||||
regiArr : [],
|
||||
regiId : 0,
|
||||
regiIndex : 0,
|
||||
|
||||
disabled : false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
experience: options.experience
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取省市区列表
|
||||
this.createInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 省市区列表
|
||||
*/
|
||||
createInfo() {
|
||||
wx.$api.site.create().then(res => {
|
||||
let areas = res.data,
|
||||
areaIndex = this.data.areaIndex
|
||||
|
||||
this.setData({
|
||||
areasArr : areas,
|
||||
areaId : areas[areaIndex].id,
|
||||
|
||||
})
|
||||
this.citylist(areas[areaIndex].id)
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 所在省份-下拉
|
||||
*/
|
||||
areasChange(e) {
|
||||
let area = this.data.areasArr,
|
||||
index = e.detail.value,
|
||||
atcode = area[index].id
|
||||
if (index != this.data.areaIndex) {
|
||||
this.setData({
|
||||
areaIndex : index,
|
||||
areaId : atcode
|
||||
})
|
||||
// 获取市级列表
|
||||
this.citylist(atcode)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级列表
|
||||
*/
|
||||
citylist(cityId) {
|
||||
wx.$api.site.create({
|
||||
parent_id: cityId
|
||||
}).then(res=>{
|
||||
let cityArr = res.data
|
||||
this.setData({
|
||||
cityId : cityArr[0].id,
|
||||
cityIndex : 0,
|
||||
cityArr : cityArr
|
||||
})
|
||||
|
||||
// 获取区级列表
|
||||
this.regilist(cityArr[0].id)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级下拉筛选
|
||||
*/
|
||||
cityDrop(e) {
|
||||
let city = this.data.cityArr,
|
||||
index = e.detail.value,
|
||||
citycode = city[index].id
|
||||
if (index != this.data.cityIndex) {
|
||||
this.setData({
|
||||
cityIndex : index,
|
||||
cityId : citycode
|
||||
})
|
||||
|
||||
// 获取市级列表
|
||||
this.regilist(citycode)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 区列表
|
||||
*/
|
||||
regilist(areaId) {
|
||||
wx.$api.site.create({
|
||||
parent_id: areaId
|
||||
}).then(res=>{
|
||||
this.setData({
|
||||
regiArr : res.data,
|
||||
regiId : res.data[0].id,
|
||||
regiIndex : 0
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 区下拉筛选
|
||||
*/
|
||||
regiDrop(e) {
|
||||
let newIndex = e.detail.value
|
||||
this.setData({
|
||||
regiIndex : newIndex,
|
||||
regiId : this.data.regiArr[newIndex].id
|
||||
})
|
||||
},
|
||||
|
||||
/*
|
||||
姓名截取
|
||||
*/
|
||||
bindinput(e) {
|
||||
this.setData({
|
||||
nameValue: e.detail.value.substr(0,5)
|
||||
})
|
||||
},
|
||||
|
||||
// 提交表单
|
||||
siteform(e) {
|
||||
let value = e.detail.value
|
||||
let data = {
|
||||
name : this.data.nameValue,
|
||||
mobile : value.mobile,
|
||||
address : value.address,
|
||||
province_id : this.data.areaId,
|
||||
city_id : this.data.cityId,
|
||||
district_id : this.data.regiId
|
||||
}
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
wx.$api.site.siteAdd(data).then(res => {
|
||||
wx.navigateBack()
|
||||
}).catch(() =>{
|
||||
this.setData({
|
||||
disabled: false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/site/add/add.json
Normal file
4
pages/site/add/add.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "新增地址"
|
||||
}
|
||||
44
pages/site/add/add.wxml
Normal file
44
pages/site/add/add.wxml
Normal file
@@ -0,0 +1,44 @@
|
||||
<form bindsubmit="siteform" class="site-form">
|
||||
<view class="site-input">
|
||||
<label>收货人</label>
|
||||
<input placeholder="请输入收货人姓名" name="name" type="text" value="{{nameValue}}" bindinput="bindinput"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>手机号码</label>
|
||||
<input placeholder="请输入手机号码" maxlength="11" name="mobile" type="number"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在省份</label>
|
||||
<picker bindchange="areasChange" value="{{areaIndex}}" range="{{areasArr}}" range-key="name">
|
||||
<view class="picker">
|
||||
{{ areasArr[areaIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在城市</label>
|
||||
<picker bindchange="cityDrop" value="{{cityIndex}}" range="{{cityArr}}" range-key="name" class="conneColor">
|
||||
<view class="picker">
|
||||
{{ cityArr[cityIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在区域</label>
|
||||
<picker bindchange="regiDrop" value="{{regiIndex}}" range="{{regiArr}}" range-key="name" class="conneColor">
|
||||
<view class="picker">
|
||||
{{ regiArr[regiIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>收货地址</label>
|
||||
<input placeholder="请输入详细地址" name="address"></input>
|
||||
</view>
|
||||
<view class="site-btn">
|
||||
<button form-type="submit" size="mini" disabled="{{disabled}}">保存</button>
|
||||
</view>
|
||||
</form>
|
||||
79
pages/site/add/add.wxss
Normal file
79
pages/site/add/add.wxss
Normal file
@@ -0,0 +1,79 @@
|
||||
.site-form {
|
||||
background: white;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.site-input {
|
||||
padding: 0 30rpx 0 200rpx;
|
||||
position: relative;
|
||||
line-height: 110rpx;
|
||||
min-height: 110rpx;
|
||||
border-bottom: 2rpx solid #f3f3f3;
|
||||
}
|
||||
|
||||
.site-input::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 30rpx;
|
||||
right: 0;
|
||||
height: 1rpx;
|
||||
content: "";
|
||||
background: #e4e6f2;
|
||||
}
|
||||
|
||||
.site-input:last-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.site-input label {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.site-input input {
|
||||
height: 110rpx;
|
||||
}
|
||||
|
||||
.site-input image {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: calc(50% - 22rpx);
|
||||
}
|
||||
|
||||
.site-btn {
|
||||
padding: 20rpx 30rpx;
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.site-btn button[size="mini"] {
|
||||
width: 100%;
|
||||
background: #e92152;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.site-btn button[disabled] {
|
||||
background: #e92152 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.site-switch {
|
||||
font-size: 32rpx;
|
||||
margin: 30rpx;
|
||||
display: flex;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.site-switch text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.site-switch-active {
|
||||
color: #797979;
|
||||
}
|
||||
225
pages/site/edit/edit.js
Normal file
225
pages/site/edit/edit.js
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
data: {
|
||||
addressId : '',
|
||||
nameValue : '',
|
||||
mobile : '',
|
||||
address : '',
|
||||
isDefault : '',
|
||||
disabled : false,
|
||||
|
||||
//省份选择
|
||||
areas : [],
|
||||
areaId : '',
|
||||
areaIndex : 0,
|
||||
|
||||
//市级选择
|
||||
cityList : [],
|
||||
cityId : 0,
|
||||
cityIndex : 0,
|
||||
|
||||
//区域选择
|
||||
regiList : [],
|
||||
regiId : 0,
|
||||
regiIndex : 0,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
addressId: options.addressid
|
||||
})
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 获取收货人信息
|
||||
this.getUserAddress()
|
||||
},
|
||||
|
||||
/**
|
||||
* 收货人信息
|
||||
*/
|
||||
getUserAddress(){
|
||||
wx.$api.site.siteSee(this.data.addressId).then(res => {
|
||||
let areasValue = res.data.provinces.findIndex(val=> val.name == res.data.province.name),
|
||||
cityValue = res.data.cities.findIndex(val=> val.name == res.data.city.name),
|
||||
regiValue = res.data.districts.findIndex(val=> val.name == res.data.district.name)
|
||||
this.setData({
|
||||
nameValue : res.data.name,
|
||||
mobile : res.data.mobile,
|
||||
areas : res.data.provinces,
|
||||
cityList : res.data.cities,
|
||||
regiList : res.data.districts,
|
||||
areaIndex : areasValue,
|
||||
cityIndex : cityValue,
|
||||
regiIndex : regiValue,
|
||||
areaId : res.data.province.region_id,
|
||||
cityId : res.data.city.region_id,
|
||||
regiId : res.data.district.region_id,
|
||||
address : res.data.address,
|
||||
isDefault : res.data.default
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 省市区列表
|
||||
*/
|
||||
createInfo() {
|
||||
wx.$api.site.create().then(res => {
|
||||
let areas = res.data,
|
||||
areaIndex = this.data.areaIndex
|
||||
this.setData({
|
||||
areas : areas,
|
||||
areaId : areas[areaIndex].id,
|
||||
})
|
||||
|
||||
this.citylist(areas[areaIndex].id)
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 所在省份-下拉
|
||||
*/
|
||||
areasChange(e) {
|
||||
let area = this.data.areas,
|
||||
index = e.detail.value,
|
||||
atcode = area[index].id
|
||||
if (index != this.data.areaIndex) {
|
||||
this.setData({
|
||||
areaIndex : index,
|
||||
areaId : atcode
|
||||
})
|
||||
// 获取市级列表
|
||||
this.citylist(atcode)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级列表
|
||||
*/
|
||||
citylist(cityId) {
|
||||
wx.$api.site.create({
|
||||
parent_id: cityId
|
||||
}).then(res=>{
|
||||
let cityArr = res.data
|
||||
this.setData({
|
||||
cityId : cityArr[0].id,
|
||||
cityIndex : 0,
|
||||
cityList : cityArr
|
||||
})
|
||||
|
||||
// 获取区级列表
|
||||
this.regilist(cityArr[0].id)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 市级下拉筛选
|
||||
*/
|
||||
cityDrop(e) {
|
||||
let city = this.data.cityList,
|
||||
index = e.detail.value,
|
||||
citycode = city[index].id
|
||||
if (index != this.data.cityIndex) {
|
||||
this.setData({
|
||||
cityIndex : index,
|
||||
cityId : citycode
|
||||
})
|
||||
|
||||
// 获取区列表
|
||||
this.regilist(citycode)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 区列表
|
||||
*/
|
||||
regilist(areaId) {
|
||||
wx.$api.site.create({
|
||||
parent_id: areaId
|
||||
}).then(res=>{
|
||||
this.setData({
|
||||
regiList : res.data,
|
||||
regiId : res.data[0].id,
|
||||
regiIndex : 0
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 区下拉筛选
|
||||
*/
|
||||
regiDrop(e) {
|
||||
let newIndex = e.detail.value
|
||||
this.setData({
|
||||
regiIndex : newIndex,
|
||||
regiId : this.data.regiList[newIndex].id
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 默认地址
|
||||
*/
|
||||
addressDefault() {
|
||||
wx.$api.site.siteDefault(this.data.addressId).then(res => {
|
||||
this.setData({
|
||||
isDefault: !this.data.isDefault
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/*
|
||||
姓名截取
|
||||
*/
|
||||
bindinput(e) {
|
||||
this.setData({
|
||||
nameValue: e.detail.value.substr(0,5)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交表单
|
||||
*/
|
||||
siteform(e) {
|
||||
let value = e.detail.value
|
||||
let data = {
|
||||
name : this.data.nameValue,
|
||||
mobile : value.mobile,
|
||||
address : value.address,
|
||||
province_id : this.data.areaId,
|
||||
city_id : this.data.cityId,
|
||||
district_id : this.data.regiId,
|
||||
is_default : this.data.isDefault
|
||||
}
|
||||
wx.$api.site.siteEdit(this.data.addressId, data).then(res => {
|
||||
this.setData({
|
||||
disabled: true
|
||||
})
|
||||
wx.navigateBack()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除地址
|
||||
*/
|
||||
addressRemove(){
|
||||
wx.showModal({
|
||||
title : '提示',
|
||||
content : '是否删除地址',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.showLoading({
|
||||
title: '删除中',
|
||||
})
|
||||
wx.$api.site.siteDel(this.data.addressId).then(res=>{
|
||||
wx.navigateBack()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
4
pages/site/edit/edit.json
Normal file
4
pages/site/edit/edit.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "编辑地址"
|
||||
}
|
||||
52
pages/site/edit/edit.wxml
Normal file
52
pages/site/edit/edit.wxml
Normal file
@@ -0,0 +1,52 @@
|
||||
<form bindsubmit="siteform" class="site-form">
|
||||
<view class="site-input">
|
||||
<label>收货人</label>
|
||||
<input placeholder="请输入收货人姓名" name="name" value="{{nameValue}}" type="text" bindinput="bindinput"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>手机号码</label>
|
||||
<input placeholder="请输入手机号码" maxlength="11" name="mobile" type="number" value="{{mobile}}"></input>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在省份</label>
|
||||
<picker bindchange="areasChange" value="{{areaIndex}}" range="{{areas}}" range-key="name" name="region_id">
|
||||
<view class="picker">
|
||||
{{ areas[areaIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在城市</label>
|
||||
<picker bindchange="cityDrop" value="{{cityIndex}}" range="{{cityList}}" range-key="name" class="conneColor" name="city_id">
|
||||
<view class="picker">
|
||||
{{ cityList[cityIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>所在区域</label>
|
||||
<picker bindchange="regiDrop" value="{{regiIndex}}" range="{{regiList}}" range-key="name" class="conneColor" name="district_id">
|
||||
<view class="picker">
|
||||
{{ regiList[regiIndex].name }}
|
||||
</view>
|
||||
<image src="/static/icons/orderArrow.png"></image>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="site-input">
|
||||
<label>收货地址</label>
|
||||
<input placeholder="请输入详细地址" name="address" value="{{address}}"></input>
|
||||
</view>
|
||||
<view class="site-switch">
|
||||
<text>设置默认地址</text>
|
||||
<switch style='zoom:.6;' bindchange="addressDefault" color="#ff9951" checked="{{isDefault}}" />
|
||||
</view>
|
||||
<view class="site-del" bindtap="addressRemove">
|
||||
<image class="site-del-img" src="/static/icons/siteDel.png"></image>
|
||||
<text>删除地址</text>
|
||||
</view>
|
||||
<view class="site-btn">
|
||||
<button form-type="submit" size="mini" disabled="{{disabled}}">保存</button>
|
||||
</view>
|
||||
</form>
|
||||
99
pages/site/edit/edit.wxss
Normal file
99
pages/site/edit/edit.wxss
Normal file
@@ -0,0 +1,99 @@
|
||||
.site-form {
|
||||
background: white;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.site-input {
|
||||
padding: 0 30rpx 0 200rpx;
|
||||
position: relative;
|
||||
line-height: 110rpx;
|
||||
min-height: 110rpx;
|
||||
}
|
||||
|
||||
.site-input::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 30rpx;
|
||||
right: 0;
|
||||
height: 1rpx;
|
||||
content: "";
|
||||
background: #e4e6f2;
|
||||
}
|
||||
|
||||
.site-input:last-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.site-input label {
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.site-input input {
|
||||
height: 110rpx;
|
||||
}
|
||||
|
||||
.site-input image {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: calc(50% - 22rpx);
|
||||
}
|
||||
|
||||
.site-btn {
|
||||
padding: 20rpx 30rpx;
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.site-btn button[size="mini"] {
|
||||
width: 100%;
|
||||
background: #e92152;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.site-btn button[disabled] {
|
||||
background: #e92152 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.site-switch {
|
||||
font-size: 32rpx;
|
||||
margin: 30rpx;
|
||||
display: flex;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.site-switch text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.site-switch-active {
|
||||
color: #797979;
|
||||
}
|
||||
|
||||
.site-del {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 40rpx;
|
||||
padding-top: 60rpx;
|
||||
border-top: 2rpx solid rgb(228, 230, 242);
|
||||
color: #ff9951;
|
||||
}
|
||||
|
||||
.site-del-btn {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.site-del-img {
|
||||
width: 46rpx;
|
||||
height: 46rpx;
|
||||
display: inline-block;
|
||||
vertical-align: -10rpx;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
76
pages/site/index.js
Normal file
76
pages/site/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
type : '', //类型
|
||||
listArr : [] //收货地址
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
if(options) {
|
||||
this.setData({
|
||||
type: options.type
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取地址列表
|
||||
this.listInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 地址列表
|
||||
*/
|
||||
listInfo (){
|
||||
wx.$api.site.siteList().then(res => {
|
||||
this.setData({
|
||||
listArr: res.data
|
||||
})
|
||||
}).catch(err => { })
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址
|
||||
*/
|
||||
selectAddress(e){
|
||||
let atAdds = this.data.listArr[e.currentTarget.dataset.index]
|
||||
let pages = getCurrentPages(),
|
||||
prepage = pages[pages.length-2]
|
||||
|
||||
if(this.data.type == 'goodsAddress') {
|
||||
prepage.setData({
|
||||
address: atAdds,
|
||||
addressId: atAdds.address_id
|
||||
})
|
||||
wx.navigateBack()
|
||||
return
|
||||
}
|
||||
prepage.setData({
|
||||
address: atAdds
|
||||
})
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
/**
|
||||
* 编辑地址
|
||||
*/
|
||||
addressEdit(e) {
|
||||
wx.navigateTo({
|
||||
url: './edit/edit?addressid=' + e.currentTarget.dataset.id,
|
||||
})
|
||||
},
|
||||
})
|
||||
4
pages/site/index.json
Normal file
4
pages/site/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "地址管理"
|
||||
}
|
||||
37
pages/site/index.wxml
Normal file
37
pages/site/index.wxml
Normal file
@@ -0,0 +1,37 @@
|
||||
<view class="list" wx:if="{{listArr.length > 0}}">
|
||||
<view class="address" wx:for="{{listArr}}" wx:key="listArr">
|
||||
<!-- "hover-class="none" url="./edit/edit?id={{item.address_id}} -->
|
||||
<view class="address-top">
|
||||
<view class="address-img">
|
||||
<image src="/static/icons/siteIcon.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="address-cont">
|
||||
<view class="address-cont-title">
|
||||
<view class="address-cont-name">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="address-cont-mobile">
|
||||
{{item.mobile}}
|
||||
</view>
|
||||
<view class="address-cont-default" wx:if="{{item.default}}">
|
||||
默认
|
||||
</view>
|
||||
</view>
|
||||
<view class="nowrap-multi address-cont-text">{{item.full_address}}</view>
|
||||
</view>
|
||||
<image src="/static/icons/siteEdit.png" bindtap="addressEdit" data-id="{{item.address_id}}" class="address-btn"></image>
|
||||
</view>
|
||||
<view class="select" wx:if="{{type == 'selectAddress' || type == 'goodsAddress'}}">
|
||||
<view class="select-btn" bindtap="selectAddress" data-index="{{index}}">
|
||||
选择地址
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pack-center pages-hint" wx:else>
|
||||
<image src="/static/imgs/cont_null.png"></image>
|
||||
<view>暂无收货地址</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<navigator hover-class="none" url="./add/add" class="btn">添加收货地址</navigator>
|
||||
</view>
|
||||
116
pages/site/index.wxss
Normal file
116
pages/site/index.wxss
Normal file
@@ -0,0 +1,116 @@
|
||||
page{
|
||||
background-color: #f4f4f6;
|
||||
}
|
||||
|
||||
.list {
|
||||
border-bottom: 90px solid transparent;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.address {
|
||||
background-color: #FFFFFF;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.address:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.address-top {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.address-img {
|
||||
background-color: #eeeeee;
|
||||
border-radius: 50%;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
|
||||
.address-img image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.address-btn {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-top: 62rpx;
|
||||
}
|
||||
|
||||
.address-cont {
|
||||
width: calc(100% - 102rpx);
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.address-cont-title {
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.address-cont-mobile {
|
||||
margin: 0 20rpx;
|
||||
color: rgb(104, 104, 104);
|
||||
}
|
||||
|
||||
.address-cont-default {
|
||||
background-color: #ff9951;
|
||||
color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
border-radius: 40rpx;
|
||||
padding: 0 15rpx;
|
||||
height: 38rpx;
|
||||
line-height: 38rpx;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
.address-cont-text {
|
||||
line-height: 42rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.select {
|
||||
text-align: right;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.select-btn {
|
||||
border: 2rpx solid #e92152;
|
||||
color: #ff9951;
|
||||
display: inline-block;
|
||||
font-size: 28rpx;
|
||||
padding: 0 30rpx;
|
||||
line-height: 54rpx;
|
||||
border-radius: 5rpx;
|
||||
}
|
||||
|
||||
/* 按钮 */
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 90px;
|
||||
background-color: #FFFFFF;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 9;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.btn {
|
||||
line-height: 50px;
|
||||
background-color: #e92152;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user