|
|
@ -4,9 +4,31 @@ |
|
|
|
bgColor="#f7f7f7"> |
|
|
|
<view class="content"> |
|
|
|
|
|
|
|
<!-- 地址 --> |
|
|
|
<!-- 配送方式选择 --> |
|
|
|
<view class="delivery-method"> |
|
|
|
<view class="title">配送方式</view> |
|
|
|
<view class="options"> |
|
|
|
<view |
|
|
|
:class="['option', { active: deliveryMethod === '0' }]" |
|
|
|
@click="selectDeliveryMethod('0')" |
|
|
|
> |
|
|
|
<view class="icon">🚚</view> |
|
|
|
<view class="text">外卖配送</view> |
|
|
|
</view> |
|
|
|
<view |
|
|
|
:class="['option', { active: deliveryMethod === '1' }]" |
|
|
|
@click="selectDeliveryMethod('1')" |
|
|
|
> |
|
|
|
<view class="icon">🏪</view> |
|
|
|
<view class="text">到店自提</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 地址(仅外卖显示) --> |
|
|
|
<view class="address" |
|
|
|
@click="openAddress"> |
|
|
|
@click="openAddress" |
|
|
|
v-if="deliveryMethod === '0'"> |
|
|
|
<image src="../../static/address/selectIcon.png" mode=""></image> |
|
|
|
<view class=""> |
|
|
|
{{ address.name }} |
|
|
@ -20,6 +42,17 @@ |
|
|
|
name="arrow-right"></uv-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 店铺地址(仅到店自提显示) --> |
|
|
|
<view class="store-address" v-if="deliveryMethod == '1' && detail.shop && detail.shop.address"> |
|
|
|
<view> |
|
|
|
<addressSpot |
|
|
|
:address="detail.shop.address" |
|
|
|
:latitude="detail.shop.latitude" |
|
|
|
:longitude="detail.shop.longitude" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 商品信息和数量 --> |
|
|
|
<view class="submit-info"> |
|
|
@ -143,6 +176,7 @@ |
|
|
|
num : 1, |
|
|
|
unit : {}, |
|
|
|
addressTotal : 0, |
|
|
|
deliveryMethod : '0', |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -190,14 +224,19 @@ |
|
|
|
|
|
|
|
let data = { |
|
|
|
shopId : this.detail.id,//商品id |
|
|
|
addressId : this.address.id,//地址id |
|
|
|
num : this.num, |
|
|
|
deliveryMethod: this.deliveryMethod |
|
|
|
} |
|
|
|
|
|
|
|
if(this.$utils.verificationAll(data, { |
|
|
|
addressId : '请选择地址', |
|
|
|
})){ |
|
|
|
return |
|
|
|
// 外卖配送需要地址 |
|
|
|
if (this.deliveryMethod === 'delivery') { |
|
|
|
if (!this.address.id) { |
|
|
|
return uni.showToast({ |
|
|
|
title: '请选择收货地址', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
data.addressId = this.address.id |
|
|
|
} |
|
|
|
|
|
|
|
this.$api('createPointsOrder', data, res => { |
|
|
@ -213,17 +252,20 @@ |
|
|
|
let data = { |
|
|
|
shopId : this.detail.id,//商品id |
|
|
|
// skuId : this.unit.id,//规格id |
|
|
|
addressId : this.address.id,//地址id |
|
|
|
// sku : this.unit.title,//规格 |
|
|
|
num : this.num, |
|
|
|
deliveryMethod: this.deliveryMethod |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.$utils.verificationAll(data, { |
|
|
|
// skuId : '请选择规格', |
|
|
|
addressId : '请选择地址', |
|
|
|
})){ |
|
|
|
return |
|
|
|
// 外卖配送需要地址 |
|
|
|
if (this.deliveryMethod == '0') { |
|
|
|
if (!this.address.id) { |
|
|
|
return uni.showToast({ |
|
|
|
title: '请选择收货地址', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
data.addressId = this.address.id |
|
|
|
} |
|
|
|
|
|
|
|
this.$api('createOrder', data, res => { |
|
|
@ -252,6 +294,9 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
selectDeliveryMethod(method){ |
|
|
|
this.deliveryMethod = method |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -261,6 +306,40 @@ |
|
|
|
max-height: 80vh; |
|
|
|
overflow: hidden; |
|
|
|
overflow-y: auto; |
|
|
|
.delivery-method{ |
|
|
|
padding: 20rpx; |
|
|
|
background-color: #fff; |
|
|
|
.title{ |
|
|
|
font-size: 30rpx; |
|
|
|
padding: 10rpx; |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
.options{ |
|
|
|
display: flex; |
|
|
|
gap: 20rpx; |
|
|
|
.option{ |
|
|
|
padding: 15rpx 30rpx; |
|
|
|
border: 2rpx solid #F3F3F3; |
|
|
|
border-radius: 10rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
flex: 1; |
|
|
|
background-color: #F6F6F6; |
|
|
|
&.active{ |
|
|
|
border-color: $uni-price-color; |
|
|
|
background-color: $uni-price-color; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
.icon{ |
|
|
|
margin-right: 10rpx; |
|
|
|
} |
|
|
|
.text{ |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.address{ |
|
|
|
display: flex; |
|
|
|
padding: 20rpx; |
|
|
|