地址终于完了233 #31

Manually merged
asd merged 1 commits from zhengjei into master 2019-12-23 16:09:59 +08:00
9 changed files with 93 additions and 40 deletions

View File

@ -21,6 +21,9 @@
color: #999999;
font-size: 28rpx;
}
.shurupla1{
color: #333333;
}
.arrow {
width: 14rpx;
height: 25rpx;

View File

@ -1,7 +1,7 @@
<view class="shuru">
<view class="left">{{left}}</view>
<view class="right"wx:if="{{ifarrow}}" bindtap="choose">
<text class="shurupla">{{right}}</text>
<text class="shurupla1">{{right}}</text>
<view class="arrow"></view>
</view>
<view class="right" wx:else>

View File

@ -28,6 +28,10 @@
font-size: 28rpx;
}
.shuru .right .shurupla1 {
color: #333333;
}
.shuru .right .arrow {
width: 14rpx;
height: 25rpx;

View File

@ -16,7 +16,11 @@ Page({
area:["请选择","请选择","请选择"],
tagDis:[false,true,true],
active:0,
addressCity:"北京市 北京市 北京市"
addressCity:"请选择 请选择 请选择",
countrys:[],
countryid:44,
nowcountry:"中国",
areaid:[]
},
/**
@ -37,9 +41,28 @@ Page({
console.log(this.data.arealist)
})
request({
url: "User/getCountry",
}).then((res)=>{
let country=[]
console.log(res,10000)
for(let i=0;i<res.data.result.length;i++){
country[i]=res.data.result[i].name
}
this.setData({
countrys:country
})
})
},
bindPickerChange(e) {
// console.log(e)
console.log(e.detail.value)
let nowcountry=this.data.countrys[e.detail.value]
this.setData({
countryid:e.detail.value+1,
nowcountry:nowcountry
})
console.log(nowcountry,"zxc")
},
showPopup() {
this.setData({ show: true });
@ -79,6 +102,7 @@ Page({
})
// console.log(this.data.area,123)
this.data.area[0]=e.currentTarget.dataset.name
this.data.areaid[0]=e.currentTarget.dataset.id
// for(let i in this.data.area){
// if(i==type){
// this.data.area[i]=e.currentTarget.dataset.name
@ -112,6 +136,7 @@ Page({
// console.log(this.data.area,123)
this.data.area[1]=e.currentTarget.dataset.name
this.data.areaid[1]=e.currentTarget.dataset.id
// for(let i in this.data.area){
// if(i==type){
// this.data.area[i]=e.currentTarget.dataset.name
@ -148,6 +173,7 @@ Page({
// console.log(this.data.area,123)
this.data.area[2]=e.currentTarget.dataset.name
this.data.areaid[2]=e.currentTarget.dataset.id
// for(let i in this.data.area){
// if(i==type){
// this.data.area[i]=e.currentTarget.dataset.name
@ -167,10 +193,14 @@ Page({
// wx.navigateTo({
// url: "/pages/chooseaddr/chooseaddr"
// })
console.log(this.data.canshu)
console.log(this.data.countryid)
console.log(this.data.area)
console.log(this.data.areaid)
request({
url: "User/validateOpenid",
}).then((res)=>{
// console.log(res,1452)
console.log(res,1452)
this.setData({
userid:res.data.data.user_id
})
@ -181,20 +211,21 @@ Page({
},
method:"POST",
data: {
address: "Wesrdtfyguhijkl",
city: "339",
consignee: "srdtfyguhijokl",
country: 1,
district: "361",
// address: this.data.canshu[4],
city: this.data.areaid[1],
consignee: this.data.canshu[0],
country: this.data.countryid,
address: this.data.canshu[4],
is_default: 0,
mobile: "19953879035",
province: "338",
twon: 0,
user_id: "9",
zipcode: "271103",
mobile: this.data.canshu[1],
province: this.data.areaid[0],
twon: this.data.areaid[2],
user_id:this.data.userid,
zipcode: this.data.canshu[5],
idcard: this.data.canshu[6],
}
}).then((res)=>{
// console.log(res)
console.log(res)
})
})

View File

@ -1,8 +1,8 @@
<view class="addaddress">
<shuru left="收件人" right="姓名需和身份证一致" bindmyevent="onMyEvent" data-no="0"></shuru>
<shuru left="手机号" right="请填入常用的手机号码" bindmyevent="onMyEvent" data-no="1"></shuru>
<picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
<shuru left="国家" right="CN中国大陆" ifarrow="{{true}}" data-no="2"></shuru>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{countrys}}">
<shuru left="国家" right="{{nowcountry}}" ifarrow="{{true}}" data-no="2"></shuru>
</picker>
<!-- <picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
<shuru left="城市信息" right="北京市 北京市 东城区" ifarrow="{{true}}" data-no="3"></shuru>

View File

@ -46,38 +46,43 @@ Page({
wx.showModal({
title: '确认',
content: '要删除这个地址吗?',
success(){
success(res){
console.log(e.currentTarget.dataset.id)
request({
url: "User/validateOpenid",
}).then((res)=>{
t.setData({
userid:res.data.data.user_id
})
if (res.confirm) {
console.log('用户点击确定')
request({
url: "User/del_address",
urldata:{
user_id:res.data.data.user_id,
id:e.currentTarget.dataset.id
},
url: "User/validateOpenid",
}).then((res)=>{
console.log(res)
t.setData({
userid:res.data.data.user_id
})
request({
url: "User/getAddressList",
url: "User/del_address",
urldata:{
user_id:t.data.userid
user_id:res.data.data.user_id,
id:e.currentTarget.dataset.id
},
}).then((res)=>{
console.log(res)
t.setData({
addresslist:res.data.result
request({
url: "User/getAddressList",
urldata:{
user_id:t.data.userid
},
}).then((res)=>{
console.log(res)
t.setData({
addresslist:res.data.result
})
})
})
})
})
})
})
} else if (res.cancel) {
console.log('用户点击取消')
console.log("不能动啊")
}

View File

@ -1,4 +1,7 @@
.chooseaddress {
.box{
height: 910rpx
}
.addr {
margin-left: 30rpx;
}

View File

@ -1,7 +1,10 @@
<view class="chooseaddress">
<scroll-view class="box" scroll-y="{{true}}">
<view class="addr" wx:for="{{addresslist}}">
<address binddelete="delete" binddefault="setdefault"data-id="{{item.address_id}}" username="{{item.consignee}}" address="{{item.address}}" tel="{{item.mobile}}" youzheng="{{item.zipcode}}" isdefault="{{item.is_default}}"></address>
</view>
</scroll-view>
<!-- <view class="addr">
<address></address>
</view>

View File

@ -1,3 +1,7 @@
.chooseaddress .box {
height: 910rpx;
}
.chooseaddress .addr {
margin-left: 30rpx;
}