|
|
|
|
@ -63,6 +63,12 @@
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="orderForm-wrap">
|
|
|
|
|
<view class="orderForm-wx" @click="getWxAddress">
|
|
|
|
|
<u-icon name="weixin-circle-fill" color="#3fc14d" size="40"></u-icon>
|
|
|
|
|
<view>获取微信地址</view>
|
|
|
|
|
<u-icon name="arrow-right" size="28"></u-icon>
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<u-form-item label="收货人" prop="contact" label-position="left">
|
|
|
|
|
<u-input v-model="form.contact" placeholder="请填写收货人姓名" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
@ -120,7 +126,7 @@
|
|
|
|
|
<view v-html="tips"></view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="agreeinfo-btn">
|
|
|
|
|
<view @click="closeAgree" :class="isAgree?'canAgree':''">我同意<text
|
|
|
|
|
<view @click="closeAgree" :class="isAgree?'canAgree':''">我已阅读并知晓<text
|
|
|
|
|
v-if="isAgreeTime>0">({{isAgreeTime}})</text></view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -210,7 +216,7 @@
|
|
|
|
|
import {
|
|
|
|
|
toast,
|
|
|
|
|
isMobile,
|
|
|
|
|
isNull,
|
|
|
|
|
isNull,
|
|
|
|
|
parseAddress
|
|
|
|
|
} from '@/common/util.js'
|
|
|
|
|
import solarLunar from '@/node_modules/solarlunar';
|
|
|
|
|
@ -373,12 +379,49 @@
|
|
|
|
|
methods: {
|
|
|
|
|
async getAddress() {
|
|
|
|
|
const res = await this.$u.api.getUserAddress()
|
|
|
|
|
this.listAddress = res.address
|
|
|
|
|
console.log("this.type",this.type)
|
|
|
|
|
this.listAddress = res.address
|
|
|
|
|
console.log("this.type", this.type)
|
|
|
|
|
if (!(this.type == 'edit')) {
|
|
|
|
|
this.showAddress = this.listAddress.length > 0 ? true : false
|
|
|
|
|
}
|
|
|
|
|
console.log("this.type",this.type,this.showAddress)
|
|
|
|
|
}
|
|
|
|
|
console.log("this.type", this.type, this.showAddress)
|
|
|
|
|
},
|
|
|
|
|
getWxAddress(e) {
|
|
|
|
|
let _this = this
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: 'scope.address',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log("authorize", res)
|
|
|
|
|
uni.chooseAddress({
|
|
|
|
|
success(res) {
|
|
|
|
|
console.log(res)
|
|
|
|
|
_this.form.contact = res.userName
|
|
|
|
|
_this.form.mobile = res.telNumber
|
|
|
|
|
_this.form.area = res.provinceName + res.cityName + res.countyName
|
|
|
|
|
_this.form.address = res.detailInfo
|
|
|
|
|
_this.$u.api.matchRegion({
|
|
|
|
|
province: res.provinceName,
|
|
|
|
|
city: res.cityName,
|
|
|
|
|
district: res.countyName
|
|
|
|
|
}).then(res1 => {
|
|
|
|
|
_this.form.province_id = res1.province_id ? res1
|
|
|
|
|
.province_id.id : ''
|
|
|
|
|
_this.form.city_id = res1.city_id ? res1.city_id.id : ''
|
|
|
|
|
_this.form.district_id = res1.district_id ? res1
|
|
|
|
|
.district_id.id : ''
|
|
|
|
|
})
|
|
|
|
|
console.log("_this", _this.form)
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
console.log("authorize-fail", res)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// async getExpress() {
|
|
|
|
|
// const res = await this.$u.api.getExpress()
|
|
|
|
|
@ -406,25 +449,25 @@
|
|
|
|
|
await this.$u.api.getDates({
|
|
|
|
|
card_number: this.form.card_number
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let data = res.card
|
|
|
|
|
if(data.open_dates && data.open_dates.length===0){
|
|
|
|
|
toast("当前无可提货时间")
|
|
|
|
|
return
|
|
|
|
|
let data = res.card
|
|
|
|
|
if (data.open_dates && data.open_dates.length === 0) {
|
|
|
|
|
toast("当前无可提货时间")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (data.open_dates) {
|
|
|
|
|
for (var k in data.open_dates) {
|
|
|
|
|
if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) {
|
|
|
|
|
if(this.isAfterTwoDays(k)){
|
|
|
|
|
let _k = this.momentDay(k)
|
|
|
|
|
this.listDates.push({
|
|
|
|
|
canUse: data.open_dates[k],
|
|
|
|
|
..._k
|
|
|
|
|
})
|
|
|
|
|
if (data.open_dates[k]['quantity'] - data.open_dates[k]['booked'] > 0) {
|
|
|
|
|
if (this.isAfterTwoDays(k)) {
|
|
|
|
|
let _k = this.momentDay(k)
|
|
|
|
|
this.listDates.push({
|
|
|
|
|
canUse: data.open_dates[k],
|
|
|
|
|
..._k
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
toast("当前无可提货时间")
|
|
|
|
|
} else {
|
|
|
|
|
toast("当前无可提货时间")
|
|
|
|
|
}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
|
|
@ -480,8 +523,8 @@
|
|
|
|
|
},
|
|
|
|
|
changeArea(e) {
|
|
|
|
|
// return
|
|
|
|
|
if (e) {
|
|
|
|
|
console.log("e",e)
|
|
|
|
|
if (e) {
|
|
|
|
|
console.log("e", e)
|
|
|
|
|
let data = e.data
|
|
|
|
|
let _this = this
|
|
|
|
|
_this.form.area = ''
|
|
|
|
|
@ -510,29 +553,31 @@
|
|
|
|
|
success(res) {
|
|
|
|
|
console.log("res", res)
|
|
|
|
|
// _this.form.area = res.address
|
|
|
|
|
_this.form.address = res.name
|
|
|
|
|
// 根据地址匹配 省市区
|
|
|
|
|
let pca = parseAddress(res.address)
|
|
|
|
|
if(pca.length>0){
|
|
|
|
|
_this.form.area = pca.join('')
|
|
|
|
|
_this.$u.api.matchRegion({
|
|
|
|
|
province: pca[0],
|
|
|
|
|
city: pca[1],
|
|
|
|
|
district: pca[2]
|
|
|
|
|
}).then(res => {
|
|
|
|
|
_this.form.province_id = res.province_id ? res.province_id.id : ''
|
|
|
|
|
_this.form.city_id = res.city_id ? res.city_id.id : ''
|
|
|
|
|
_this.form.district_id = res.district_id ? res.district_id.id : ''
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:'未获取到地址,重新获取',
|
|
|
|
|
icon:'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_this.form.address = res.name
|
|
|
|
|
// 根据地址匹配 省市区
|
|
|
|
|
let pca = parseAddress(res.address)
|
|
|
|
|
if (pca.length > 0) {
|
|
|
|
|
_this.form.area = pca.join('')
|
|
|
|
|
_this.$u.api.matchRegion({
|
|
|
|
|
province: pca[0],
|
|
|
|
|
city: pca[1],
|
|
|
|
|
district: pca[2]
|
|
|
|
|
}).then(res => {
|
|
|
|
|
_this.form.province_id = res.province_id ? res
|
|
|
|
|
.province_id.id : ''
|
|
|
|
|
_this.form.city_id = res.city_id ? res.city_id.id : ''
|
|
|
|
|
_this.form.district_id = res.district_id ? res
|
|
|
|
|
.district_id.id : ''
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '未获取到地址,重新获取',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
console.log("fail", res)
|
|
|
|
|
@ -861,6 +906,17 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.orderForm {
|
|
|
|
|
&-wx {
|
|
|
|
|
color: #000;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
>view {
|
|
|
|
|
margin: 0 20rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&-wrap {
|
|
|
|
|
padding: 40rpx 24rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
|