|
|
@ -87,7 +87,7 @@ |
|
|
|
<text>备注</text> |
|
|
|
</view> |
|
|
|
<view class="remark-content"> |
|
|
|
<input v-if="orderDetail.status_dictText === '待支付'" type="text" v-model="orderDetail.remark" |
|
|
|
<input v-if="orderStatus === '0'" type="text" v-model="orderDetail.remark" |
|
|
|
placeholder="请输入您要备注的内容" placeholder-style="font-size: 28rpx" /> |
|
|
|
<text v-else>{{orderDetail.remark || '无备注信息'}}</text> |
|
|
|
</view> |
|
|
@ -95,17 +95,17 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 支付方式 --> |
|
|
|
<uv-radio-group v-model="payMethod" v-if="orderDetail.status_dictText === '待支付'"> |
|
|
|
<uv-radio-group v-model="payMethod" v-if="orderStatus === '0' || orderStatus === '-1'"> |
|
|
|
<view class="payment-methods"> |
|
|
|
<view class="payment-item"> |
|
|
|
<uv-icon name="weixin-circle-fill" size="70rpx" color="#019245" /> |
|
|
|
<text class="payment-name">微信支付</text> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="weixin" /> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="0" /> |
|
|
|
</view> |
|
|
|
<view class="payment-item"> |
|
|
|
<uv-icon name="red-packet" size="70rpx" color="#019245" /> |
|
|
|
<text class="payment-name">账户余额<text class="balance-text">(余额: ¥{{ userInfo.balance }})</text></text> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="account" /> |
|
|
|
<uv-radio activeColor="#019245" size="40rpx" name="1" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-radio-group> |
|
|
@ -116,8 +116,8 @@ |
|
|
|
<text class="total-label">共{{ orderDetail.goodsList.length || 0 }}个,<text style="color: black;">合计</text> </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> |
|
|
|
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '0' || orderStatus === '-1'">立即下单</view> |
|
|
|
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '2'">立即取餐</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -125,7 +125,6 @@ |
|
|
|
<script> |
|
|
|
import navbar from '@/components/base/navbar.vue' |
|
|
|
import { mapState } from 'vuex' |
|
|
|
import Cart from '../../pages/index/cart.vue' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
navbar |
|
|
@ -133,36 +132,32 @@ import Cart from '../../pages/index/cart.vue' |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
payMethod: 'weixin', |
|
|
|
payMethod: '0', |
|
|
|
showAllFoods: false, |
|
|
|
orderStatus: '', |
|
|
|
orderDetail: { }, |
|
|
|
cartDiscount: 0 |
|
|
|
cartDiscount: 0, |
|
|
|
teamLeader: {} |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...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 |
|
|
|
}, |
|
|
|
|
|
|
|
orderStatus() { |
|
|
|
return this.orderDetail.status |
|
|
|
}, |
|
|
|
// 格式为 goodId,goodNum;goodId2,goodsNum |
|
|
|
goodss() { |
|
|
|
return this.orderDetail.goodsList.map(item => { |
|
|
|
return `${item.id},${item.num}` |
|
|
|
}).join(';') |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
@ -174,7 +169,6 @@ import Cart from '../../pages/index/cart.vue' |
|
|
|
} |
|
|
|
else if (options.id) { |
|
|
|
this.getOrderDetail(options.id) |
|
|
|
this.orderStatus = options.status |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -186,15 +180,12 @@ import Cart from '../../pages/index/cart.vue' |
|
|
|
showCartData() { |
|
|
|
this.$api('queryMyLeader', {}, res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.orderDetail.teamLeader = |
|
|
|
{ |
|
|
|
...res.result |
|
|
|
} |
|
|
|
this.teamLeader = res.result |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('cartData', this.cartData); |
|
|
|
this.orderDetail.goodsList = this.cartData.sendData |
|
|
|
this.orderDetail.priceAll = this.cartData.priceAll |
|
|
|
this.orderDetail.status = '-1' |
|
|
|
}, |
|
|
|
// 获取订单详情 |
|
|
|
getOrderDetail(id) { |
|
|
@ -204,7 +195,6 @@ import Cart from '../../pages/index/cart.vue' |
|
|
|
}, res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.orderDetail = res.result.records[0] |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
@ -214,31 +204,34 @@ import Cart from '../../pages/index/cart.vue' |
|
|
|
uni.showLoading({ |
|
|
|
title: '支付处理中...' |
|
|
|
}) |
|
|
|
|
|
|
|
// 模拟支付过程 |
|
|
|
setTimeout(() => { |
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
title: '支付成功', |
|
|
|
icon: 'success', |
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
// 正常订单调用支付接口 |
|
|
|
if(this.orderStatus === '0'){ |
|
|
|
this.$api('payOrder',{ |
|
|
|
id: this.id, |
|
|
|
payMethod: this.payMethod |
|
|
|
}, res => { |
|
|
|
uni.hideLoading() |
|
|
|
console.log('res', res); |
|
|
|
}) |
|
|
|
|
|
|
|
// 支付成功后,跳转回订单列表页面,并刷新 |
|
|
|
setTimeout(() => { |
|
|
|
this.navigateBack() |
|
|
|
// 页面栈中的order页面需要刷新 |
|
|
|
const pages = getCurrentPages() |
|
|
|
const prevPage = pages[pages.length - 2] |
|
|
|
if (prevPage && prevPage.route.includes('order')) { |
|
|
|
// 更新上一页的数据 |
|
|
|
prevPage.$vm.loadMockOrders() |
|
|
|
prevPage.$vm.filterOrdersByStatus(1) // 切换到待出餐Tab |
|
|
|
prevPage.$vm.current = 1 // 更新Tab索引 |
|
|
|
} |
|
|
|
// 购物车调用创造订单接口 |
|
|
|
else if(this.orderStatus === '-1'){ |
|
|
|
this.$api('createOrder',{ |
|
|
|
priceAll: this.orderDetail.priceAll, |
|
|
|
pricePay: this.orderDetail.priceAll - 0, |
|
|
|
pricePreferential: 0, |
|
|
|
payType: this.payMethod, |
|
|
|
leaderId: this.teamLeader.id, |
|
|
|
goodss: this.goodss |
|
|
|
}, res => { |
|
|
|
uni.hideLoading() |
|
|
|
console.log('res', res); |
|
|
|
if(res.code === 200){ |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, 2000) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 去优惠页面 |
|
|
|