Compare commits

...

3 Commits

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

@ -38,7 +38,6 @@ addresslist:{}
}) })
}, },
consigneeRegionInput: function (e) { consigneeRegionInput: function (e) {
this.setData({ this.setData({
consigneeRegion: e.detail.value consigneeRegion: e.detail.value
}) })
@ -95,6 +94,7 @@ addresslist:{}
addresslist.name=this.data.consigneeName addresslist.name=this.data.consigneeName
addresslist.phone=this.data.phone addresslist.phone=this.data.phone
addresslist.address=this.data.consigneeRegion addresslist.address=this.data.consigneeRegion
console.log(this.data.consigneeRegion)
addresslist.detailedAddress=this.data.detailedAddress addresslist.detailedAddress=this.data.detailedAddress
addresslist.check=check addresslist.check=check
this.setData({ this.setData({
@ -171,43 +171,58 @@ addresslist:{}
var that = this var that = this
var city = that.data.city var city = that.data.city
var value = that.data.value var value = that.data.value
this.startAddressAnimation(false) that.startAddressAnimation(false)
console.log(value)
// 将选择的城市信息显示到输入框 // 将选择的城市信息显示到输入框
var consigneeRegion = that.data.provinces[value[0]].name + '-' + that.data.citys[value[1]].name + '-' + that.data.areas[value[2]].name var consigneeRegion = that.data.provinces[value[0]].name + '-' + that.data.citys[value[1]].name + '-' + that.data.areas[value[2]].name
console.log(consigneeRegion)
that.setData({ that.setData({
consigneeRegion: consigneeRegion, consigneeRegion: consigneeRegion
}) })
}, },
// 处理省市县联动逻辑 // 处理省市县联动逻辑
cityChange: function (e) { cityChange: function (e) {
var value = e.detail.value var value = e.detail.value
console.log(value)
var provinces = this.data.provinces var provinces = this.data.provinces
var citys = this.data.citys var citys = this.data.citys
var areas = this.data.areas var areas = this.data.areas
var provinceNum = value[0] var provinceNum = value[0]
var cityNum = value[1] var cityNum = value[1]
var countyNum = value[2] var countyNum = value[2]
console.log(provinceNum)
// 如果省份选择项和之前不一样,表示滑动了省份,此时市默认是省的第一组数据, // 如果省份选择项和之前不一样,表示滑动了省份,此时市默认是省的第一组数据,
if (this.data.value[0] != provinceNum) { if (this.data.value[0] != provinceNum) {
var id = provinces[provinceNum].id var pid = provinces[provinceNum].id
console.log(pid)
console.log(address._citys[pid][0])
console.log(address._citys[pid][0].id)
this.setData({ this.setData({
value: [provinceNum, 0, 0], value: [provinceNum, 0, 0],
citys: _citys[id], citys: address._citys[pid],
areas: _areas[_citys[id][0].id], areas: address._areas[address._citys[pid][0].id],
}) })
} else if (this.data.value[1] != cityNum) { } else if (this.data.value[1] != cityNum) {
// 滑动选择了第二项数据,即市,此时区显示省市对应的第一组数据 // 滑动选择了第二项数据,即市,此时区显示省市对应的第一组数据
var id = citys[cityNum].id var id = citys[cityNum].id
this.setData({ this.setData({
value: [provinceNum, cityNum, 0], value: [provinceNum, cityNum, 0],
areas: _areas[citys[cityNum].id], areas: address.areas[citys[cityNum].id],
}) })
} else { }
console.log(provinceNum)
console.log(cityNum)
console.log(countyNum)
// 滑动选择了区 // 滑动选择了区
this.setData({ this.setData({
value: [provinceNum, cityNum, countyNum] value: [provinceNum, cityNum, countyNum]
}) })
}
}, },

@ -20,7 +20,7 @@
<view class="address-msg"> <view class="address-msg">
<view class="item-msg">所在地区</view> <view class="item-msg">所在地区</view>
<view class="section" bindtap='select'> <view class="section" bindtap='select'>
<input disabled="disabled" placeholder="省市区县、乡镇等" value="{{consigneeRegion}}" bindblur="consigneeRegionInput" placeholder-class="phcolor"></input> <input disabled="disabled" placeholder="省市区县、乡镇等" data-value="{{consigneeRegion}}" bindblur="consigneeRegionInput" placeholder-class="phcolor"></input>
</view> </view>
<view class="address-rights" bindtap='select'> <view class="address-rights" bindtap='select'>
@ -30,7 +30,7 @@
<view class="address-msg"> <view class="address-msg">
<view class="item-msg">详细地址</view> <view class="item-msg">详细地址</view>
<view class="section"> <view class="section">
<input type="text" placeholder="街道、楼牌号等" value="{{detailedAddress}}" bindblur="detailedAddressInput" placeholder-class="phcolor"></input> <input type="text" placeholder="街道、楼牌号等" data-value="{{detailedAddress}}" bindblur="detailedAddressInput" placeholder-class="phcolor"></input>
</view> </view>
</view> </view>
<view class="label"> <view class="label">

@ -17,8 +17,6 @@ Page({
}, },
delAddress:function(event){ delAddress:function(event){
var that = this;
const index = event.currentTarget.id; const index = event.currentTarget.id;
console.log(index) console.log(index)
let addressList = this.data. addressList;//购物车所有的商品数据 let addressList = this.data. addressList;//购物车所有的商品数据
@ -61,12 +59,13 @@ Page({
}) //还需修改 }) //还需修改
.get({ .get({
success: res => { success: res => {
console.log(res.data.address) console.log(res.data[0].address)
console.log(res.data) console.log(res.data)
//这一步很重要给ne赋值没有这一步的话前台就不会显示值 //这一步很重要给ne赋值没有这一步的话前台就不会显示值
this.setData({ this.setData({
addressList: res.data[0].address addressList: res.data[0].address
}) })
console.log(addressList)
} }
}) })

@ -34,11 +34,9 @@ Page({
onLoad: function (options) { onLoad: function (options) {
let foodid =options.id let foodid =options.id
var userid=app.globalData.openid var userid=app.globalData.openid
console.log('1111w '); // console.log('1111w ');
console.log(userid) console.log(userid)
this.setData({ this.setData({
userid:userid userid:userid

@ -19,7 +19,7 @@ Page({
}, },
allCheckbox: function(tap) { allCheckbox: function(tap) {
var a = 0 //设置初始总价格
var index = tap.currentTarget.dataset.index var index = tap.currentTarget.dataset.index
console.log(index)//获取索引值 console.log(index)//获取索引值
let address = this.data.addresslist //获取地址列表 let address = this.data.addresslist //获取地址列表

Loading…
Cancel
Save