|
|
@ -7,14 +7,13 @@ |
|
|
|
<image src="@/static/image/多人下单.webp" mode="aspectFit" class="place-order-title-image" /> |
|
|
|
<text class="number">{{ item.sales }}</text><text class="text">人下单</text> |
|
|
|
<view class="place-order-title-close" @click="close"> |
|
|
|
<uv-icon name="close" size="40rpx"></uv-icon> |
|
|
|
<uv-icon name="close" size="40rpx" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 选择取餐地点 --> |
|
|
|
<view class="place-order-address" @click="gotoPickupPoint"> |
|
|
|
<uv-icon name="map-fill" color="#019245" size="55rpx"> |
|
|
|
</uv-icon> |
|
|
|
<uv-icon name="map-fill" color="#019245" size="55rpx" /> |
|
|
|
|
|
|
|
<text style="font-size: 42rpx;" v-show="!pickupPoint"> |
|
|
|
请选择取餐地点 |
|
|
@ -23,11 +22,11 @@ |
|
|
|
<view class="place-order-address-content-name"> |
|
|
|
{{ pickupPoint.name }},{{ pickupPoint.phone }} |
|
|
|
</view> |
|
|
|
<view class="place-order-address-content-address"> {{ pickupPoint.area }} {{ pickupPoint.address }} </view> |
|
|
|
<view class="place-order-address-content-address"> {{ pickupPoint.area }} {{ pickupPoint.address |
|
|
|
}} </view> |
|
|
|
</view> |
|
|
|
<view class="place-order-address-arrow"> |
|
|
|
<uv-icon name="arrow-right" size="40rpx"> |
|
|
|
</uv-icon> |
|
|
|
<uv-icon name="arrow-right" size="40rpx" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
@ -38,7 +37,8 @@ |
|
|
|
<image :src="item.image" mode="aspectFill" class="item-image"></image> |
|
|
|
<view style="font-size: 36rpx;"> |
|
|
|
<view>{{ item.name }}</view> |
|
|
|
<view style="color: red; ">¥{{ item.price }}</view> |
|
|
|
<view style="color: red; ">¥{{ priceAll }}</view> |
|
|
|
<view style="color: red; ">实付¥{{ pricePay }}</view> |
|
|
|
<view style="margin-top: 30rpx;"> |
|
|
|
<uv-number-box v-model="value" button-size="36"></uv-number-box> |
|
|
|
</view> |
|
|
@ -47,7 +47,7 @@ |
|
|
|
|
|
|
|
<!-- 选项框 --> |
|
|
|
<uv-radio-group v-model="payMethod"> |
|
|
|
<view class="option-box" > |
|
|
|
<view class="option-box"> |
|
|
|
<view class="option-box-item"> |
|
|
|
<uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" /> |
|
|
|
<text style="flex: 1;"> |
|
|
@ -59,9 +59,10 @@ |
|
|
|
<uv-icon name="red-packet" size="70rpx" color="#019245" /> |
|
|
|
<text style="flex: 1;"> |
|
|
|
账户余额 |
|
|
|
<text style="color: gray; margin-left: 20rpx;">(余额: ¥{{ userInfo.balance ? userInfo.balance.toFixed(2) : 0 }})</text> |
|
|
|
<text style="color: gray; margin-left: 20rpx;">(余额: ¥{{ userInfo.balance ? |
|
|
|
userInfo.balance.toFixed(2) : 0 }})</text> |
|
|
|
</text> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="1" /> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="1" :disabled="userInfo.balance < pricePay" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-radio-group> |
|
|
@ -72,9 +73,11 @@ |
|
|
|
<view class="discount"> |
|
|
|
<text style="font-size: 35rpx;">优惠</text> |
|
|
|
<view style="display: flex; align-items: center; gap: 20rpx" @click="gotoCoupon"> |
|
|
|
<image src="@/static/image/券.webp" mode="aspectFill" class="discount-image" /> |
|
|
|
<text>{{ couponData.couponId_dictText || '请选择您的优惠卷' }}</text> |
|
|
|
<text style="color: red;">-¥{{ couponData.discount || 0 }}</text> |
|
|
|
<image src="@/static/image/券.webp" mode="aspectFill" class="discount-image" |
|
|
|
v-if="couponData.id" /> |
|
|
|
<text v-if="couponData.id">{{ couponData.couponId_dictText || '优惠卷' }}</text> |
|
|
|
<text v-else style="color: gray;">请选择您的优惠卷</text> |
|
|
|
<text style="color: red;" v-if="couponData.discount">-¥{{ couponData.discount || 0 }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
@ -102,7 +105,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { mapState } from 'vuex' |
|
|
|
import { mapState, mapMutations } from 'vuex' |
|
|
|
export default { |
|
|
|
name: 'placeOrder', |
|
|
|
data() { |
|
|
@ -122,16 +125,19 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
...mapState(['userInfo']), |
|
|
|
...mapState(['couponData']), |
|
|
|
...mapState(['userInfo', 'couponData']), |
|
|
|
priceAll () { |
|
|
|
return this.item.price * this.value |
|
|
|
}, |
|
|
|
goodss () { |
|
|
|
return `${this.item.id},${this.value},${this.priceAll};` |
|
|
|
}, |
|
|
|
pricePay () { |
|
|
|
return (this.priceAll - ( this.couponData.discount || 0 )) > 0 ? (this.priceAll - ( this.couponData.discount || 0 )) : 0.01 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapMutations(['clearCouponData']), |
|
|
|
// 跳转到优惠卷选择页面 |
|
|
|
gotoCoupon() { |
|
|
|
this.$utils.navigateTo('/pages_order/mine/coupon?usein=1') |
|
|
@ -186,11 +192,11 @@ export default { |
|
|
|
}) |
|
|
|
this.$api('createOrder', { |
|
|
|
priceAll: this.priceAll, |
|
|
|
pricePay: this.priceAll - ( this.couponData.discount || 0 ), |
|
|
|
pricePay: this.pricePay, |
|
|
|
pricePreferential: this.couponData.discount || 0, |
|
|
|
payType: this.payMethod, |
|
|
|
leaderId: this.pickupPoint.id, |
|
|
|
couponId: this.couponData.id || '', |
|
|
|
userCouponId: this.couponData.id || '', |
|
|
|
goodss: this.goodss, |
|
|
|
remark: this.remark |
|
|
|
}, res => { |
|
|
@ -199,16 +205,25 @@ export default { |
|
|
|
if (this.payMethod == '0') { |
|
|
|
uni.requestPaymentWxPay(res) |
|
|
|
.then(n => { |
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
setTimeout(uni.redirectTo, 500, { |
|
|
|
url: '/pages/index/order?tabIndex=1' |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
uni.showToast({ |
|
|
|
title: '支付失败', |
|
|
|
icon: 'error' |
|
|
|
}) |
|
|
|
setTimeout(uni.redirectTo, 500, { |
|
|
|
url: '/pages/index/order?tabIndex=0' |
|
|
|
}) |
|
|
|
}) |
|
|
|
}else { |
|
|
|
uni.showToast({ |
|
|
|
title: '下单成功', |
|
|
|
icon: 'success' |
|
|
|
}) |
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
setTimeout(uni.redirectTo, 500, { |
|
|
|
url: '/pages/index/order?tabIndex=1' |
|
|
|
}) |
|
|
|
} |
|
|
@ -221,6 +236,7 @@ export default { |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
uni.$off('updatePickupPoint'); |
|
|
|
this.clearCouponData(); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|