Commit 243e7bda by 高淑倩

确认订单地址

parent f1350a3d
...@@ -49,7 +49,6 @@ wxService.page({ ...@@ -49,7 +49,6 @@ wxService.page({
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
...@@ -7,7 +7,7 @@ wxService.page({ ...@@ -7,7 +7,7 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
addressInfo: '', addressInfo: [],
showSelectCoupon: false, showSelectCoupon: false,
skuIds: [], skuIds: [],
trolleySku2Buy: Array, trolleySku2Buy: Array,
...@@ -24,8 +24,7 @@ wxService.page({ ...@@ -24,8 +24,7 @@ wxService.page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
// 地址列表
this.getAddressList()
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -39,11 +38,74 @@ wxService.page({ ...@@ -39,11 +38,74 @@ wxService.page({
}) })
} }
this.initCitys() this.initCitys()
// 地址列表
this.getAddressList()
}, },
// 提交
formSubmit(e){ formSubmit(e) {
console.log('提交', e) const { goodsAddress } = this.data
// 保存地址 && 支付
if (goodsAddress) {
if (!e.detail.value.name) {
wx.showToast({
title: `请输入姓名`,
icon: 'none'
})
return false;
}
if (!e.detail.value.phone) {
wx.showToast({
title: `请输入电话`,
icon: 'none'
})
return false;
}
if (!this.data.cityView) {
wx.showToast({
title: `请选择地区`,
icon: 'none'
})
return false;
}
if (!e.detail.value.address) {
wx.showToast({
title: `请输入详细地址`,
icon: 'none'
})
return false;
}
this.setData({
params: {
userId: memberId,
name: e.detail.value.name,
phone: e.detail.value.phone,
fullArea: this.data.cityView,
address: e.detail.value.address,
type: this.data.isSelect ? 1 : 0
}
})
wx.showLoading({
title: '加载中'
})
wxService.post(`/member/addressManage/save`, this.data.params).then(res => {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `保存成功`,
icon: 'none'
})
// 调起支付
this.handelGobuy()
}
})
} else {
// 调起支付
this.handelGobuy()
}
}, },
initCitys() { initCitys() {
wxService.getC1().then((c1) => { wxService.getC1().then((c1) => {
...@@ -65,8 +127,8 @@ wxService.page({ ...@@ -65,8 +127,8 @@ wxService.page({
this.setData({ this.setData({
multiIndex, multiIndex,
cityView cityView
},()=>{ }, () => {
console.log('================0', this.data.cityView,this.data.multiIndex) console.log('================0', this.data.cityView, this.data.multiIndex)
}) })
} }
}, },
...@@ -130,9 +192,8 @@ wxService.page({ ...@@ -130,9 +192,8 @@ wxService.page({
}) })
}, },
handelGobuy() { handelGobuy() {
this.formSubmit()
const { trolleySku2Buy } = this.data const { trolleySku2Buy } = this.data
// this.getBill(trolleySku2Buy) // 下单 this.getBill(trolleySku2Buy) // 下单
}, },
// 下单 // 下单
getBill(trolleySku2Buy) { getBill(trolleySku2Buy) {
...@@ -176,6 +237,24 @@ wxService.page({ ...@@ -176,6 +237,24 @@ wxService.page({
this.setData({ this.setData({
goodsAddress: true goodsAddress: true
}) })
} else {
// 缓存有没有地址
let hasDefalut = wx.getStorageSync('_defalutAddress')
let _defalutAddress = null
if(hasDefalut) {
_defalutAddress = hasDefalut
} else {
data.forEach(item=>{
if(item.type == 1){
_defalutAddress = item
}
})
}
this.setData({
addressInfo: _defalutAddress
})
} }
} }
}).finally(() => { }).finally(() => {
...@@ -189,7 +268,6 @@ wxService.page({ ...@@ -189,7 +268,6 @@ wxService.page({
this.setData({ this.setData({
goodsAddress: false, goodsAddress: false,
addressInfo: res, addressInfo: res,
}) })
}, },
fail: function (err) { fail: function (err) {
......
...@@ -35,16 +35,16 @@ ...@@ -35,16 +35,16 @@
<input class="address-input address-detail" name="address" placeholder="请输入路名门牌号" /> <input class="address-input address-detail" name="address" placeholder="请输入路名门牌号" />
</view> </view>
</block> </block>
<block wx:if="{{!goodsAddress}}"> <block wx:if="{{!goodsAddress}}">
<view class="address-list" bindtap="selectAddress"> <view class="address-list" bindtap="selectAddress">
<view class="address-info"> <view class="address-info">
<view> <view>
<text class="user-name">{{addressInfo.userName}}</text> <image class="defalut-add-img" src="{{addressInfo.type == 1 ? '/assets/imgs/7_1_0/08_22/defalut.png' : '/assets/imgs/7_1_0/08_22/no-defalut.png'}}" />
<text class="phone-number">{{addressInfo.telNumber}}</text> <text class="user-name">{{addressInfo.name}}</text>
<text class="phone-number">{{addressInfo.phone}}</text>
</view> </view>
<view class="address-list-detail"> <view class="address-list-detail">
{{addressInfo.provinceName}} {{addressInfo.cityName}} {{addressInfo.countyName}} {{addressInfo.detailInfo}} {{addressInfo.fullArea}} {{addressInfo.address}}
</view> </view>
<view class="arrow-right-wrap"> <view class="arrow-right-wrap">
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> <image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
......
/* pages/confirmOrder/confirmOrder.wxss */ /* pages/confirmOrder/confirmOrder.wxss */
@import './../../base/base.wxss'; @import './../../base/base.wxss';
.defalut-add-img {
width: 84rpx;
height: 33rpx;
border-radius: 16rpx;
/* background-color: rgba(203, 60, 60, 1); */
}
.address-wrap{ .address-wrap{
padding: 0 30rpx; padding: 0 30rpx;
} }
......
...@@ -24,7 +24,15 @@ wxService.page({ ...@@ -24,7 +24,15 @@ wxService.page({
onLoad: function (options) { onLoad: function (options) {
}, },
handelCheckShopAddress(e) {
const index = e.currentTarget.dataset.index
const item = this.data.addressList[index]
wx.setStorageSync('_defalutAddress', item)
setTimeout(() => {
wxService.router().back()
}, 300)
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
bindtouchstart="drawStart" bindtouchstart="drawStart"
bindtouchmove="drawMove" bindtouchmove="drawMove"
bindtouchend="drawEnd" bindtouchend="drawEnd"
bindtap='handelCheckShopAddress'
style="right:{{item.right}}rpx" style="right:{{item.right}}rpx"
data-id="{{item.id}}"
data-index="{{index}}" data-index="{{index}}"
> >
<view class="name"> <view class="name">
...@@ -27,7 +29,7 @@ ...@@ -27,7 +29,7 @@
data-type="{{item.type}}" data-type="{{item.type}}"
data-id="{{item.id}}" data-id="{{item.id}}"
> >
<view class="{{item.type == 1 ? 'theme-color' : ''}} circle-radio"> <view class="{{item.type == 1 ? 'theme-color' : ''}} circle-radio check-default-address">
<image <image
wx:if="{{item.type == 1}}" wx:if="{{item.type == 1}}"
class="tick-success" class="tick-success"
......
...@@ -80,9 +80,11 @@ page{ ...@@ -80,9 +80,11 @@ page{
.tick-success{ .tick-success{
width: 18rpx; width: 18rpx;
} }
.default-address{ .default-address{
display: flex; display: flex;
margin-top: 25rpx; margin-top: 25rpx;
width: 250rpx;
} }
.setting-default{ .setting-default{
margin-left: 19rpx; margin-left: 19rpx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment