添加收货地址接口

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

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

@ -76,7 +76,7 @@
<p class="btn" v-if="orderData.status == 1" @click="cancelOrder">取消订单</p> <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" 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 == 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" v-if="orderData.status == 0" @click="handleDelete">删除订单</p>
<p class="btn confirm" v-if="orderData.status == 0" @click="clickCustom">再次定制</p> <p class="btn confirm" v-if="orderData.status == 0" @click="clickCustom">再次定制</p>
</view> </view>
@ -247,7 +247,7 @@
// , // ,
handleInfo(){ handleInfo(){
uni.navigateTo({ 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