|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="page"> |
|
|
|
<!-- 导航栏 --> |
|
|
|
<navbar :title="orderStatus === 'pending' ? '待支付订单' : '订单详情' " leftClick @leftClick="navigateBack" bgColor="#019245" |
|
|
|
<navbar title="订单详情 " leftClick @leftClick="navigateBack" bgColor="#019245" |
|
|
|
color="#fff" /> |
|
|
|
|
|
|
|
<!-- 店铺信息 --> |
|
|
@ -56,11 +56,11 @@ |
|
|
|
<text class="info-label">合计:</text> |
|
|
|
<text class="info-value price">¥{{ orderDetail.priceAll }}</text> |
|
|
|
</view> |
|
|
|
<view class="info-item"> |
|
|
|
<view class="info-item" v-if="this.orderDetail.status != '-1'" > |
|
|
|
<text class="info-label">创建时间:</text> |
|
|
|
<text class="info-value">{{ orderDetail.createTime }}</text> |
|
|
|
</view> |
|
|
|
<view class="info-item"> |
|
|
|
<view class="info-item" v-if="this.orderDetail.status != '-1'"> |
|
|
|
<text class="info-label">订单编号:</text> |
|
|
|
<text class="info-value">{{orderDetail.id}}</text> |
|
|
|
</view> |
|
|
@ -68,7 +68,7 @@ |
|
|
|
</view> |
|
|
|
<view class="discount-info-container"> |
|
|
|
<!-- 优惠信息 --> |
|
|
|
<view class="discount-info"> |
|
|
|
<view class="discount-info" @click="gotoCoupon"> |
|
|
|
<view class="discount-header"> |
|
|
|
<text>优惠</text> |
|
|
|
</view> |
|
|
@ -77,7 +77,7 @@ |
|
|
|
<image src="@/static/image/券.webp" mode="aspectFill" class="coupon-icon" /> |
|
|
|
<view>新用户立减</view> |
|
|
|
</view> |
|
|
|
<text class="discount-amount">-¥{{ orderDetail.pricePreferential }}</text> |
|
|
|
<text class="discount-amount">-¥{{ orderDetail.pricePreferential || 0 }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
@ -114,7 +114,7 @@ |
|
|
|
<view class="bottom-bar"> |
|
|
|
<view class="total-section"> |
|
|
|
<text class="total-label">共{{ orderDetail.goodsList.length || 0 }}个,<text style="color: black;">合计</text> </text> |
|
|
|
<text class="total-price">¥{{ orderDetail.pricePay }}</text> |
|
|
|
<text class="total-price">¥{{ orderDetail.pricePay || cartPay }}</text> |
|
|
|
</view> |
|
|
|
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '待支付'">立即下单</view> |
|
|
|
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '已送达'">立即取餐</view> |
|
|
@ -124,7 +124,8 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import navbar from '@/components/base/navbar.vue' |
|
|
|
|
|
|
|
import { mapState } from 'vuex' |
|
|
|
import Cart from '../../pages/index/cart.vue' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
navbar |
|
|
@ -135,41 +136,66 @@ |
|
|
|
payMethod: 'weixin', |
|
|
|
showAllFoods: false, |
|
|
|
orderStatus: '', |
|
|
|
orderDetail: { } |
|
|
|
orderDetail: { }, |
|
|
|
cartDiscount: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
statusText() { |
|
|
|
const statusMap = { |
|
|
|
'pending': '等待支付', |
|
|
|
'processing': '正在出餐', |
|
|
|
'shipping': '正在配送中', |
|
|
|
'delivered': '已送达,等待取餐', |
|
|
|
'completed': '订单已完成', |
|
|
|
'canceled': '订单已取消' |
|
|
|
} |
|
|
|
return statusMap[this.orderDetail.status] || '等待支付' |
|
|
|
}, |
|
|
|
...mapState(['cartData']), |
|
|
|
// statusText() { |
|
|
|
// const statusMap = { |
|
|
|
// 'pending': '等待支付', |
|
|
|
// 'processing': '正在出餐', |
|
|
|
// 'shipping': '正在配送中', |
|
|
|
// 'delivered': '已送达,等待取餐', |
|
|
|
// 'completed': '订单已完成', |
|
|
|
// 'canceled': '订单已取消' |
|
|
|
// } |
|
|
|
// return statusMap[this.orderDetail.status] || '等待支付' |
|
|
|
// }, |
|
|
|
showedFoods() { |
|
|
|
return this.showAllFoods ? this.orderDetail.goodsList : this.orderDetail.goodsList.slice(0, 3) |
|
|
|
}, |
|
|
|
teamLeader() { |
|
|
|
return this.orderDetail.teamLeader |
|
|
|
} |
|
|
|
}, |
|
|
|
cartPay() { |
|
|
|
return this.orderDetail.priceAll - this.cartDiscount |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
|
|
|
|
if (options.id) { |
|
|
|
// 如果是购物车调过来的结账页面 |
|
|
|
if (options.status === 'cart') { |
|
|
|
this.showCartData() |
|
|
|
// 独一无二代表购物车的状态 |
|
|
|
this.orderStatus = '-1' |
|
|
|
} |
|
|
|
else if (options.id) { |
|
|
|
this.getOrderDetail(options.id) |
|
|
|
this.orderStatus = options.status |
|
|
|
} |
|
|
|
this.orderStatus = options.status |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 返回上一页 |
|
|
|
navigateBack() { |
|
|
|
uni.navigateBack() |
|
|
|
}, |
|
|
|
|
|
|
|
// 如果是购物车结账页面 |
|
|
|
showCartData() { |
|
|
|
this.$api('queryMyLeader', {}, res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.orderDetail.teamLeader = |
|
|
|
{ |
|
|
|
...res.result |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('cartData', this.cartData); |
|
|
|
this.orderDetail.goodsList = this.cartData.sendData |
|
|
|
this.orderDetail.priceAll = this.cartData.priceAll |
|
|
|
}, |
|
|
|
// 获取订单详情 |
|
|
|
getOrderDetail(id) { |
|
|
|
this.id = id |
|
|
@ -178,8 +204,6 @@ |
|
|
|
}, res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.orderDetail = res.result.records[0] |
|
|
|
// console.log('111', this.orderDetail); |
|
|
|
console.log('222', this.showedFoods); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
@ -215,6 +239,13 @@ |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, 2000) |
|
|
|
}, |
|
|
|
|
|
|
|
// 去优惠页面 |
|
|
|
gotoCoupon() { |
|
|
|
this.$utils.navigateTo({ |
|
|
|
url: '/pages_order/mine/coupon?isUseinOrder=true' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|