添加收货地址接口

main
jinna 2 years ago
parent d09219e41c
commit b8b787f5d8
  1. 99
      pages/pages_zhentou/form/form.vue
  2. 180
      pages/pages_zhentou/myPage/address.vue
  3. 4
      pages/pages_zhentou/order/checkOrder.vue

@ -25,17 +25,17 @@
<uni-forms ref="valiForm" :rules="rules" :model="valiFormData" labelWidth="180px"
label-position="top">
<uni-forms-item label="姓名" required name="username" :label-style="{'font-size':'40rpx'}">
<uni-easyinput v-model="valiFormData.username" placeholder="请输入姓名" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.username" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="手机" required name="phone">
<uni-easyinput v-model="valiFormData.phone" placeholder="请输入手机" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.phone" placeholder="请输入手机" />
</uni-forms-item>
<uni-forms-item label="地址" required name="address">
<!-- <uni-data-picker v-model="valiFormData.city" :localdata="aCityData" popup-title="选择城市">
</uni-data-picker> -->
<!-- <view class="">
<!-- <uni-forms-item label="地址" required name="address">
<uni-data-picker v-model="valiFormData.city" :localdata="aCityData" popup-title="选择城市">
</uni-data-picker>
<view class="">
<button class="button" type="primary" @click="toggle('bottom')"><text class="button-text">顶部</text></button>
</view> -->
</view>
<picker class="picker_box" :range="locationArr" @change="cityChange" mode="multiSelector"
@columnchange="columnchange" :value="multiIndex">
@ -47,28 +47,28 @@
</view>
</picker>
<uni-easyinput class="address_item" v-model="valiFormData.address" placeholder="详细地址" />
</uni-forms-item>
</uni-forms-item> -->
<uni-forms-item label="身高" required name="height">
<p class="item_txt">单位厘米cm</p>
<uni-easyinput v-model="valiFormData.height" placeholder="请输入身高" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.height" placeholder="请输入身高" />
</uni-forms-item>
<uni-forms-item label="体重" required name="weight">
<p class="item_txt">单位公斤kg</p>
<uni-easyinput v-model="valiFormData.weight" placeholder="请输入体重" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.weight" placeholder="请输入体重" />
</uni-forms-item>
<uni-forms-item label="肩颈宽度">
<p class="item_txt">单位厘米cm</p>
<uni-easyinput v-model="valiFormData.neckShoulderWidth" placeholder="请输入肩颈宽度" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.neckShoulderWidth" placeholder="请输入肩颈宽度" />
</uni-forms-item>
<uni-forms-item label="颈肩宽度示意图">
<view class="wid_pre">
<img class="wid_img" :src="imgPrefix + 'jian.png'" alt="">
<uni-data-checkbox v-model="valiFormData.width" :localdata="widthData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.width" :localdata="widthData" />
</view>
</uni-forms-item>
<uni-forms-item label="颈长">
<p class="item_txt">单位厘米cm</p>
<uni-easyinput v-model="valiFormData.neckLength" placeholder="请输入颈长" />
<uni-easyinput :disabled="isDisabled" v-model="valiFormData.neckLength" placeholder="请输入颈长" />
</uni-forms-item>
<uni-forms-item label="颈长示意图">
<view class="hei_pre">
@ -77,37 +77,37 @@
</view>
</uni-forms-item>
<uni-forms-item label="年龄">
<uni-data-checkbox v-model="valiFormData.ageRange" :localdata="ageData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.ageRange" :localdata="ageData" />
</uni-forms-item>
<uni-forms-item label="您每晚的睡眠时间">
<uni-data-checkbox v-model="valiFormData.sleepLength" :localdata="sleepData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.sleepLength" :localdata="sleepData" />
</uni-forms-item>
<uni-forms-item label="您习惯的睡眠姿势" required name="sleepingPosture">
<view class="pos_box">
<view class="pos_pre">
<img class="hei_img" :src="imgPrefix + 'yang.jpg'" alt="">
<uni-data-checkbox v-model="valiFormData.sleepingPosture"
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.sleepingPosture"
:localdata="sleepPosData" />
</view>
<view class="pos_pre">
<img class="hei_img" :src="imgPrefix + 'ce.jpg'" alt="">
<uni-data-checkbox v-model="valiFormData.sleepingPosture"
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.sleepingPosture"
:localdata="sleepPosData1" />
</view>
</view>
</uni-forms-item>
<uni-forms-item label="您习惯的枕头软硬度" required name="pillowHardness">
<uni-data-checkbox v-model="valiFormData.pillowHardness" :localdata="posData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.pillowHardness" :localdata="posData" />
</uni-forms-item>
<uni-forms-item label="您喜欢的枕头类型" required name="pillowMaterial">
<uni-data-checkbox v-model="valiFormData.pillowMaterial" :localdata="matData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.pillowMaterial" :localdata="matData" />
</uni-forms-item>
<uni-forms-item label="您现在的颈椎出现问题了吗">
<uni-data-checkbox v-model="valiFormData.cervicalVertebra" :localdata="cerData" />
<uni-data-checkbox :disabled="isDisabled" v-model="valiFormData.cervicalVertebra" :localdata="cerData" />
</uni-forms-item>
<uni-forms-item label="您的其他需求">
<uni-easyinput type="textarea" v-model="valiFormData.otherNeed" />
<uni-easyinput :disabled="isDisabled" type="textarea" v-model="valiFormData.otherNeed" />
</uni-forms-item>
</uni-forms>
<button class="btn_box" @click="submit('valiForm')">提交</button>
@ -203,12 +203,12 @@
}
}]
},
address: {
rules: [{
required: true,
errorMessage: '地址不能为空'
}]
},
// address: {
// rules: [{
// required: true,
// errorMessage: ''
// }]
// },
height: {
rules: [{
required: true,
@ -332,7 +332,8 @@
sleepPosData1: [{
text: '侧睡',
value: 2
}, ]
}, ],
isDisabled:false,
}
},
onShow(){
@ -366,18 +367,18 @@
// console.log(this.a)
this.getData()
console.log(options)
if(options.phone){
if(options.pageFrom == 'order'){
this.phoneNumber = options.phone
this.getInfo()
}
// this.getCurrentArea('')
},
methods: {
//
getInfo(){
uni.request({
// this.phoneNumber
url:getApp().globalData.baseUrl + '/blade-desk/custom-made-info/get-newest?phone=13214521014' ,
url:getApp().globalData.baseUrl + '/blade-desk/custom-made-info/get-newest?phone=15932584136' ,
method:'GET',
header:{
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
@ -406,24 +407,36 @@
this.city = res.data.data.city == '-1' ? '' :res.data.data.city;
this.district = res.data.data.district == '-1' ? '' :res.data.data.district;
// this.getCurrentArea(this.province)
console.log(this.valiFormData)
if(this.valiFormData.username !== '' &&
this.valiFormData.phone !== '' && this.valiFormData.height !== '' &&
this.valiFormData.weight !== '' && this.valiFormData.pillowHardness !== '' &&
this.valiFormData.pillowMaterial !== '' && this.valiFormData.sleepingPosture !== ''){
this.isDisabled = true
}else{
this.isDisabled = false
}
}
}
})
},
// getCurrentArea(value){
// this.allCityData.map((item,index) =>{
// if(item.province == value){
// this.multiIndex[0] = index
// item.citys.map((item1,index1) =>{
// this.locationArr[1].push(item.city);
// if(item1.city == this.city){
getCurrentArea(value){
this.allCityData.map((item,index) =>{
if(item.province == value){
this.multiIndex[0] = index
item.citys.map((item1,index1) =>{
if(item1.city == this.province){
console.log('111')
this.locationArr[1].push(item.city);
}
if(item1.city == this.city){
// }
// })
}
})
// }
// })
// },
}
})
},
toggle(type) {
this.$refs.popup.open(type)
},

@ -9,7 +9,7 @@
<span class="phone_txt">{{item.phone}}</span>
</view>
<view class="bottom">
{{item.province}} {{item.city}} {{item.area}}{{item.address}}
{{item.province}}{{item.city}}{{item.area}}{{item.address}}
</view>
</view>
<view class="edit_box" @click="handleEdit(item)">
@ -19,12 +19,17 @@
</view>
</view>
<view class="bottom_item">
<view v-if="item.isDefault == 0" class="no_checked"></view>
<view v-if="item.isDefault == 1" class="checked">
<p class="item"></p>
<view class="no_checked_box" v-if="item.isDefault == 0" @click="handleDefault(item)">
<view class="no_checked"></view>
<p class="no_default" >设为默认</p>
</view>
<p class="no_default" v-if="item.isDefault == 0" @click="handleDefault(item)">设为默认</p>
<p v-if="item.isDefault == 1" class="default_txt">默认地址</p>
<view class="check_box" v-if="item.isDefault == 1">
<view class="checked">
<p class="item"></p>
</view>
<p class="default_txt">默认地址</p>
</view>
</view>
</view>
<uni-load-more iconType="circle" :status="status" @clickLoadMore="loadMore"
@ -41,7 +46,7 @@
<view class="tit_txt">
{{title}}
</view>
<view class="image_box">
<view class="image_box" @click="closePop">
<image class="img" src="../../../static/image/cancel.png" mode=""></image>
</view>
</view>
@ -66,21 +71,22 @@
<view class="left_item">
位置
</view>
<!-- <view class="right_item">
山东省青岛市市北区
</view> -->
<view class="right_item">
<!-- 山东省青岛市市北区 -->
<!-- <view class="right_icon" @click="changeAddress">
<image src="../../../static/image/icon-arrow-right.png"></image>
</view> -->
<picker class="picker_box" :range="locationArr" @change="cityChange" mode="multiSelector"
@columnchange="columnchange" :value="multiIndex">
<view class="city_box" v-if="province !== '' && city !== ''">
{{province}} / {{city}} {{district ? '/' : ''}} {{district}}
</view>
<view class="city_box" v-if="province == '' && city == '' && district == ''">
<span style="color: #999;">请选择地区</span>
</view>
</picker>
<picker class="picker_box" :range="locationArr" @change="cityChange" mode="multiSelector"
@columnchange="columnchange" :value="multiIndex">
<view class="city_box" v-if="province !== '' && city !== ''">
{{province}} / {{city}} {{district ? '/' : ''}} {{district}}
</view>
<view class="city_box" v-if="province == '' && city == '' && district == ''">
<span style="color: #999;">请选择地区</span>
</view>
</picker>
</view>
</view>
<view class="content_item">
<view class="left_item">
@ -89,9 +95,9 @@
<view class="right_item">
<uni-easyinput type="textarea" :inputBorder="false" autoHeight v-model="address" placeholder="请输入详细地址"></uni-easyinput>
</view>
<view class="right_icon" @click="handlePosition">
<!-- <view class="right_icon" @click="handlePosition">
<image src="../../../static/image/position.png"></image>
</view>
</view> -->
</view>
</view>
<view class="button_box">
@ -175,7 +181,7 @@
phone:this.buyPhone,
province:this.province,
city:this.city,
district:this.district ? this.district : '',
area:this.district ? this.district : '',
address:this.address,
isDefault:0
}
@ -193,6 +199,7 @@
title: '新增成功',
icon: 'none'
})
this.addressData = []
this.$refs.popup.close();
this.hasMore = true;
this.current = 0;
@ -215,7 +222,7 @@
phone:this.buyPhone,
province:this.province,
city:this.city,
district:this.district ? this.district : '',
area:this.district ? this.district : '',
address:this.address,
}
uni.request({
@ -262,8 +269,47 @@
this.province = item.province;
this.city = item.city;
this.district = item.area;
this.getCurrentArea(this.province)
this.$refs.popup.open('bottom')
},
//
getCurrentArea(value){
this.locationArr[1] = []
this.locationArr[2] = []
this.allCityData.map((item,index) =>{
if(item.province == this.province){
this.multiIndex[0] = index;
item.citys.map((item1,index1) =>{
if(item1.city == this.province){
console.log(item1)
item1.areas.map((item2,index2) =>{
if(item2.area == this.city){
this.multiIndex[1] = index2;
}
this.locationArr[1].push(item2.area);
})
}else{
if(item1.city == this.city){
this.multiIndex[1] = index1;
item1.areas.map((item3,index3) =>{
this.locationArr[2].push(item3.area)
if(item3.area == this.district){
console.log('item3 ==>',item3)
console.log('index3 ==>',index3)
this.multiIndex[2] = index3;
}
})
}
this.locationArr[1].push(item1.city);
}
})
}
})
console.log('multiIndex',this.multiIndex)
console.log('locationArr',this.locationArr)
},
//
handleDelete(){
uni.showModal({
@ -348,7 +394,7 @@
}
})
},
//
turnToOrder(item){
if(this.pageFrom == 1){
var pages = getCurrentPages(); //
@ -357,13 +403,8 @@
console.log(pages)
console.log(prevPage)
if(prevPage.__route__ == 'pages/pages_zhentou/order/confirmOrder'){
prevPage.__data__.changeAddress(
{
name:item.consignee,
phone:item.phone,
address:item.province + item.city + (item.area ? item.area : '') + item.address,
}
)
prevPage.__data__.changeAddress(item);
uni.navigateBack()
}
}
},
@ -373,7 +414,7 @@
},
//
getData() {
console.log(this.allCityData)
this.locationArr = [[],[],[]]
this.allCityData.map(item => {
this.locationArr[0].push(item.province);
})
@ -383,15 +424,15 @@
console.log(this.locationArr)
},
//
cityChange(e) {
console.log('111')
this.multiIndex = e.detail.value;
console.log(this.locationArr)
this.province = this.locationArr[0][this.multiIndex[0]]
this.city = this.locationArr[1][this.multiIndex[1]]
this.district = this.locationArr[2][this.multiIndex[2]];
this.address = ''
},
//
columnchange(e) {
let value = e.detail.value;
console.log(e.detail)
@ -442,6 +483,8 @@
this.province = '';
this.city = '';
this.district = '';
this.getData();
this.multiIndex = [0,0,0]
this.$refs.popup.open('bottom')
},
//
@ -501,7 +544,7 @@
this.current = this.current + 1;
this.staus = 'loading';
uni.request({
url: getApp().globalData.baseUrl + '/address/list?userId=' + this.userInfo.id + '&current=' + this
url: getApp().globalData.baseUrl + '/address/list?id=' + this.userInfo.id + '&current=' + this
.current + '&size=' + this.size,
method: 'GET',
header:{
@ -556,34 +599,45 @@
height: 25%;
display: flex;
align-items: center;
.no_checked{
width: 28rpx;
height: 28rpx;
background: #FFFFFF;
border: 1rpx solid #666666;
border-radius: 50%;
margin: 0 30rpx;
.no_checked_box{
width: 100%;
display: flex;
.no_checked{
width: 28rpx;
height: 28rpx;
background: #FFFFFF;
border: 1rpx solid #666666;
border-radius: 50%;
margin: 0 30rpx;
}
}
.checked{
width: 28rpx;
height: 28rpx;
background: #FFFFFF;
border: 1rpx solid #D73232;
border-radius: 50%;
margin: 0 30rpx;
.check_box{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.item{
width: 16rpx;
height: 16rpx;
background: #D73232;
.checked{
width: 28rpx;
height: 28rpx;
background: #FFFFFF;
border: 1rpx solid #D73232;
border-radius: 50%;
margin: 0 30rpx;
display: flex;
align-items: center;
justify-content: center;
.item{
width: 16rpx;
height: 16rpx;
background: #D73232;
border-radius: 50%;
}
}
}
.default_txt{
font-size: 22rpx;
color: #D73232;
@ -726,6 +780,7 @@
margin-left: 30rpx;
font-size: 26rpx;
color: #333;
}
.right_item{
@ -736,6 +791,19 @@
margin-left: 30rpx;
font-size: 26rpx;
color: #333;
.picker_box{
padding-left: 20rpx;
}
/deep/.uni-easyinput__content{
// padding-left: 30rpx;
.uni-easyinput__content-textarea{
min-height: 40rpx !important;
padding-left: 20rpx;
}
}
}
.right_icon{

@ -76,7 +76,7 @@
<p class="btn" v-if="orderData.status == 1" @click="cancelOrder">取消订单</p>
<p class="btn confirm" v-if="orderData.status == 1">立即支付</p>
<!-- <p class="btn confirm info" v-if="orderData.status == 3" @click="handleInfo(item)">完善定制信息</p> -->
<p class="btn confirm info" v-if="orderData.status == 4" @click="handleInfo">完善定制信息</p>
<p class="btn confirm info" v-if="orderData.status == 2" @click="handleInfo">完善定制信息</p>
<p class="btn" v-if="orderData.status == 0" @click="handleDelete">删除订单</p>
<p class="btn confirm" v-if="orderData.status == 0" @click="clickCustom">再次定制</p>
</view>
@ -247,7 +247,7 @@
// ,
handleInfo(){
uni.navigateTo({
url:"/pages/pages_zhentou/form/form?phone=" + this.orderData.buyerPhone
url:"/pages/pages_zhentou/form/form?phone=" + this.orderData.buyerPhone + '&pageFrom=order'
})
},
//

Loading…
Cancel
Save