|
|
|
@@ -96,22 +96,29 @@
|
|
|
|
|
|
|
|
|
|
<!-- 订单信息 -->
|
|
|
|
|
<view class="door-order-card" v-if="orderInfo">
|
|
|
|
|
<!-- 商品列表 -->
|
|
|
|
|
<view class="door-product-list" v-if="orderInfo.products && orderInfo.products.length">
|
|
|
|
|
<view class="door-product-item" v-for="(p, idx) in orderInfo.products" :key="idx">
|
|
|
|
|
<image class="door-product-img" :src="p.image" mode="aspectFill" />
|
|
|
|
|
<view class="door-product-info">
|
|
|
|
|
<text class="door-product-name">{{ p.name }}</text>
|
|
|
|
|
<text class="door-product-price">¥{{ getDecimal(p.unit_price) }} x {{ p.qty }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="door-order-row">
|
|
|
|
|
<text class="door-order-label">订单编号</text>
|
|
|
|
|
<text class="door-order-value">{{ orderInfo.order_no }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="door-order-row">
|
|
|
|
|
<text class="door-order-label">商品数量</text>
|
|
|
|
|
<text class="door-order-value">{{ orderInfo.product_count || '-' }} 件</text>
|
|
|
|
|
<text class="door-order-value">{{ orderInfo.total_qty || '-' }} 件</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="door-order-row total">
|
|
|
|
|
<text class="door-order-label">订单金额</text>
|
|
|
|
|
<text class="door-order-value door-price">¥{{ orderInfo.total_amount || '0.00' }}</text>
|
|
|
|
|
<text class="door-order-value door-price">¥{{ getDecimal(orderInfo.total_amount) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="door-order-card" v-else-if="orderLoading">
|
|
|
|
|
<text class="door-order-loading">加载订单信息...</text>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="door-btn-area">
|
|
|
|
|
<view class="door-btn-detail" @click="goOrderDetail">查看订单详情</view>
|
|
|
|
@@ -206,7 +213,8 @@ export default {
|
|
|
|
|
this.step = 'closed';
|
|
|
|
|
} else if (latestStatus === 201) {
|
|
|
|
|
this.step = 'complete';
|
|
|
|
|
this.fetchOrder(flowId);
|
|
|
|
|
const orderId = ret.data[0].order_id || '';
|
|
|
|
|
this.fetchOrder(orderId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -224,13 +232,21 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 查询订单信息
|
|
|
|
|
async fetchOrder(flowId) {
|
|
|
|
|
async fetchOrder(orderId) {
|
|
|
|
|
if (!orderId || !this.userId) {
|
|
|
|
|
this.orderLoading = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.orderLoading = true;
|
|
|
|
|
try {
|
|
|
|
|
const res = await get('/order/getByFlowId', { flow_id: flowId });
|
|
|
|
|
const res = await get('/user/orders', {
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 1,
|
|
|
|
|
filter: JSON.stringify({ user_id: this.userId, order_id: orderId })
|
|
|
|
|
});
|
|
|
|
|
const ret = res.data || {};
|
|
|
|
|
if (ret.code === 0 && ret.data) {
|
|
|
|
|
this.orderInfo = ret.data;
|
|
|
|
|
if (ret.code === 0 && Array.isArray(ret.data) && ret.data.length > 0) {
|
|
|
|
|
this.orderInfo = ret.data[0];
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('[door-panel] 获取订单信息失败:', e);
|
|
|
|
@@ -239,10 +255,18 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// MongoDB Decimal128 转换
|
|
|
|
|
getDecimal(val) {
|
|
|
|
|
if (val == null) return '0.00';
|
|
|
|
|
if (typeof val === 'object' && val.$numberDecimal) return val.$numberDecimal;
|
|
|
|
|
return String(val);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 跳转订单详情
|
|
|
|
|
goOrderDetail() {
|
|
|
|
|
if (this.orderInfo) {
|
|
|
|
|
const orderId = this.orderInfo.order_id || this.orderInfo.order_no;
|
|
|
|
|
const orderId = this.orderInfo.order_id || '';
|
|
|
|
|
uni.setStorageSync('__order_detail_cache', this.orderInfo);
|
|
|
|
|
uni.navigateTo({ url: `/pages/order/detail?order_id=${orderId}` });
|
|
|
|
|
} else if (this.flowId) {
|
|
|
|
|
uni.navigateTo({ url: `/pages/order/detail?flow_id=${this.flowId}` });
|
|
|
|
@@ -519,6 +543,44 @@ export default {
|
|
|
|
|
padding: 24rpx 30rpx;
|
|
|
|
|
margin-top: 16rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 商品列表 */
|
|
|
|
|
.door-product-list {
|
|
|
|
|
margin-bottom: 12rpx;
|
|
|
|
|
}
|
|
|
|
|
.door-product-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 12rpx 0;
|
|
|
|
|
}
|
|
|
|
|
.door-product-item + .door-product-item {
|
|
|
|
|
border-top: 1rpx solid rgba(255, 255, 255, 0.06);
|
|
|
|
|
}
|
|
|
|
|
.door-product-img {
|
|
|
|
|
width: 80rpx;
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
background: rgba(255, 255, 255, 0.1);
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
.door-product-info {
|
|
|
|
|
flex: 1;
|
|
|
|
|
margin-left: 16rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 6rpx;
|
|
|
|
|
}
|
|
|
|
|
.door-product-name {
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: rgba(255, 255, 255, 0.85);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
.door-product-price {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: rgba(255, 255, 255, 0.45);
|
|
|
|
|
}
|
|
|
|
|
.door-order-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|