|
@@ -259,7 +259,6 @@
|
|
|
|
|
|
|
|
<!-- 制单弹窗 -->
|
|
<!-- 制单弹窗 -->
|
|
|
<el-dialog :title="createOrder.title" :visible.sync="createOrder.open" width="1000px" append-to-body :close-on-click-modal="false" @close="createOrderCancel">
|
|
<el-dialog :title="createOrder.title" :visible.sync="createOrder.open" width="1000px" append-to-body :close-on-click-modal="false" @close="createOrderCancel">
|
|
|
- <!-- 内容不变,省略... -->
|
|
|
|
|
<el-form ref="createOrderForm" :model="createOrderForm" :rules="createOrderRules" label-width="120px">
|
|
<el-form ref="createOrderForm" :model="createOrderForm" :rules="createOrderRules" label-width="120px">
|
|
|
<el-form-item label="收货人姓名" prop="realName" required>
|
|
<el-form-item label="收货人姓名" prop="realName" required>
|
|
|
<el-input v-model="createOrderForm.realName" placeholder="请输入收货人姓名" />
|
|
<el-input v-model="createOrderForm.realName" placeholder="请输入收货人姓名" />
|
|
@@ -366,7 +365,12 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="抵扣金额" prop="receiveMoneyId">
|
|
<el-form-item label="抵扣金额" prop="receiveMoneyId">
|
|
|
<el-select v-model="createOrderForm.receiveMoneyId" placeholder="请选择收款记录" @change="handleReceiptChange" clearable>
|
|
<el-select v-model="createOrderForm.receiveMoneyId" placeholder="请选择收款记录" @change="handleReceiptChange" clearable>
|
|
|
- <el-option v-for="item in receiptList" :key="item.id" :label="`${parseTime(item.saleTime)} - ${item.totalFee}元`" :value="item.id" />
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in receiptList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="getReceiptLabel(item)"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="抵扣金额" prop="reduceAmount">
|
|
<el-form-item label="抵扣金额" prop="reduceAmount">
|
|
@@ -407,8 +411,8 @@
|
|
|
<span>{{ orderStatusFormat(scope.row.status) }}</span>
|
|
<span>{{ orderStatusFormat(scope.row.status) }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="实付金额" align="center" prop="payMoney" width="120">
|
|
|
|
|
- <template slot-scope="scope">¥{{ scope.row.payMoney }}</template>
|
|
|
|
|
|
|
+ <el-table-column label="实付金额" align="center" prop="payPrice" width="120">
|
|
|
|
|
+ <template slot-scope="scope">¥{{ scope.row.payPrice }}</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="下单时间" align="center" prop="createTime" width="160">
|
|
<el-table-column label="下单时间" align="center" prop="createTime" width="160">
|
|
|
<template slot-scope="scope">{{ parseTime(scope.row.createTime) }}</template>
|
|
<template slot-scope="scope">{{ parseTime(scope.row.createTime) }}</template>
|
|
@@ -418,8 +422,7 @@
|
|
|
<el-table-column label="收货地址" align="center" prop="userAddress" show-overflow-tooltip />
|
|
<el-table-column label="收货地址" align="center" prop="userAddress" show-overflow-tooltip />
|
|
|
<el-table-column label="支付方式" align="center" prop="payType" width="100">
|
|
<el-table-column label="支付方式" align="center" prop="payType" width="100">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.payType">{{ scope.row.payType }}</span>
|
|
|
|
|
- <span v-else>-</span>
|
|
|
|
|
|
|
+ <span>{{ payTypeFormat(scope.row.payType) }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
@@ -433,7 +436,7 @@
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
<!-- 二维码展示弹窗 -->
|
|
<!-- 二维码展示弹窗 -->
|
|
|
- <el-dialog title="订单二维码" :visible.sync="qrCodeDialogVisible" width="450px" append-to-body :close-on-click-modal="false">
|
|
|
|
|
|
|
+ <el-dialog title="订单二维码" :visible.sync="qrCodeDialogVisible" width="450px" append-to-body :close-on-click-modal="false" @close="onQrCodeDialogClose">
|
|
|
<div style="text-align: center; padding-bottom: 15px;">
|
|
<div style="text-align: center; padding-bottom: 15px;">
|
|
|
<img v-if="qrCodeImage" :src="qrCodeImage" style="width: 100%; max-width: 300px;" />
|
|
<img v-if="qrCodeImage" :src="qrCodeImage" style="width: 100%; max-width: 300px;" />
|
|
|
<div v-else style="text-align: center; padding: 30px;">生成二维码中...</div>
|
|
<div v-else style="text-align: center; padding: 30px;">生成二维码中...</div>
|
|
@@ -592,12 +595,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 订单状态映射(根据后端 FsStoreOrderVO.status 字段)
|
|
// 订单状态映射(根据后端 FsStoreOrderVO.status 字段)
|
|
|
orderStatusMap: {
|
|
orderStatusMap: {
|
|
|
- '-2': '退货成功',
|
|
|
|
|
- '-1': '申请退款',
|
|
|
|
|
- '0': '待发货',
|
|
|
|
|
- '1': '待收货',
|
|
|
|
|
- '2': '已收货',
|
|
|
|
|
- '3': '已完成'
|
|
|
|
|
|
|
+ '-3':'已取消',
|
|
|
|
|
+ '-2': '已退款',
|
|
|
|
|
+ '-1': '退款中',
|
|
|
|
|
+ '0': '待支付',
|
|
|
|
|
+ '1': '待发货',
|
|
|
|
|
+ '2': '待收货',
|
|
|
|
|
+ '3': '交易完成'
|
|
|
},
|
|
},
|
|
|
// 二维码弹窗
|
|
// 二维码弹窗
|
|
|
qrCodeDialogVisible: false,
|
|
qrCodeDialogVisible: false,
|
|
@@ -613,6 +617,26 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 支付方式格式化
|
|
|
|
|
+ payTypeFormat(payType) {
|
|
|
|
|
+ if (!payType) return '-';
|
|
|
|
|
+ const option = this.payTypeOptions.find(item => String(item.dictValue) === String(payType));
|
|
|
|
|
+ return option ? option.dictLabel : payType;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 格式化收款记录显示文本
|
|
|
|
|
+ getReceiptLabel(item) {
|
|
|
|
|
+ if (!item.saleTime) return `无时间 - ${item.totalFee}元`;
|
|
|
|
|
+ const date = new Date(item.saleTime);
|
|
|
|
|
+ if (isNaN(date.getTime())) return `无效时间 - ${item.totalFee}元`;
|
|
|
|
|
+ const year = date.getFullYear();
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0');
|
|
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
|
|
+ const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
|
|
+ const formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
+ return `${formattedTime} - ${item.totalFee}元`;
|
|
|
|
|
+ },
|
|
|
// 订单状态格式化方法
|
|
// 订单状态格式化方法
|
|
|
orderStatusFormat(status) {
|
|
orderStatusFormat(status) {
|
|
|
const key = String(status);
|
|
const key = String(status);
|
|
@@ -641,6 +665,7 @@ export default {
|
|
|
this.createOrderForm.reduceAmount = 0;
|
|
this.createOrderForm.reduceAmount = 0;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
createOrderSubmitForm() {
|
|
createOrderSubmitForm() {
|
|
|
this.$refs["createOrderForm"].validate(valid => {
|
|
this.$refs["createOrderForm"].validate(valid => {
|
|
|
// 手动校验地址联动
|
|
// 手动校验地址联动
|
|
@@ -664,10 +689,24 @@ export default {
|
|
|
};
|
|
};
|
|
|
createUserOrder(params).then(response => {
|
|
createUserOrder(params).then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
- this.msgSuccess("创建成功");
|
|
|
|
|
- this.createOrder.open = false;
|
|
|
|
|
- this.createOrderReset();
|
|
|
|
|
- this.getList();
|
|
|
|
|
|
|
+ // 获取返回的订单数据
|
|
|
|
|
+ const order = response.order;
|
|
|
|
|
+ const payLimitTime = response.payLimitTime;
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否需要显示支付二维码(全款支付且订单未支付)
|
|
|
|
|
+ // 注意:payType === '1' 表示全款支付
|
|
|
|
|
+ if (this.createOrderForm.payType === '1' && order && order.paid === 0) {
|
|
|
|
|
+ // 关闭制单弹窗
|
|
|
|
|
+ this.createOrder.open = false;
|
|
|
|
|
+ this.createOrderReset();
|
|
|
|
|
+ // 显示二维码弹窗
|
|
|
|
|
+ this.showOrderQrCode(order.id);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.msgSuccess("创建成功");
|
|
|
|
|
+ this.createOrder.open = false;
|
|
|
|
|
+ this.createOrderReset();
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
this.$message.error(err.message || '创建订单失败');
|
|
this.$message.error(err.message || '创建订单失败');
|
|
@@ -675,6 +714,43 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ //显示订单二维码弹窗
|
|
|
|
|
+ showOrderQrCode(orderId) {
|
|
|
|
|
+ this.currentOrderId = orderId;
|
|
|
|
|
+ this.qrCodeImage = null;
|
|
|
|
|
+ this.qrCodeDialogVisible = true;
|
|
|
|
|
+
|
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: '正在生成二维码...',
|
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ getQRCode(orderId).then(response => {
|
|
|
|
|
+ if (response.url) {
|
|
|
|
|
+ this.qrCodeImage = response.url;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error('获取二维码失败:返回数据无效');
|
|
|
|
|
+ this.qrCodeDialogVisible = false;
|
|
|
|
|
+ // 二维码生成失败时刷新列表
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ this.$message.error(error.msg || error.message || '生成二维码失败');
|
|
|
|
|
+ this.qrCodeDialogVisible = false;
|
|
|
|
|
+ // 二维码生成失败时刷新列表
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ loading.close();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ onQrCodeDialogClose() {
|
|
|
|
|
+ // 关闭二维码弹窗时刷新客户列表
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ },
|
|
|
createOrderCancel() {
|
|
createOrderCancel() {
|
|
|
this.createOrder.open = false;
|
|
this.createOrder.open = false;
|
|
|
this.createOrderReset();
|
|
this.createOrderReset();
|