|
|
@@ -72,7 +72,6 @@
|
|
|
<el-table-column label="真实姓名" align="center" prop="userRealName" />
|
|
|
<el-table-column label="身份证号" align="center" prop="userIdCard" />
|
|
|
<el-table-column label="账号ID" align="center" prop="userAccountId" />
|
|
|
- <el-table-column label="用户收货地址" align="center" prop="userAddress" />
|
|
|
<el-table-column label="订单编号" align="center" prop="orderSn" />
|
|
|
<el-table-column label="订单总金额" align="center" prop="totalAmount" />
|
|
|
<el-table-column label="订单状态" align="center" prop="status" width="100">
|
|
|
@@ -82,6 +81,8 @@
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="物流单号" align="center" prop="waybillNumber" />
|
|
|
+ <el-table-column label="用户收货地址" align="center" prop="userAddress" />
|
|
|
<el-table-column label="创建人" align="center" prop="createdBy" />
|
|
|
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
|
|
<template #default="scope">
|
|
|
@@ -90,15 +91,20 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
+ <el-tooltip content="录入物流订单号" placement="top">
|
|
|
+ <el-button link type="success" icon="Edit" @click="handleInputWaybillNumber(scope.row)" v-hasPermi="['physical:order:edit']"
|
|
|
+ >录入单号</el-button
|
|
|
+ >
|
|
|
+ </el-tooltip>
|
|
|
<el-tooltip content="修改地址" placement="top">
|
|
|
- <el-button link type="success" icon="Edit" v-hasPermi="['physical:order:edit']"></el-button>
|
|
|
+ <el-button link type="success" icon="Edit" v-hasPermi="['physical:order:edit']">修改地址</el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="修改" placement="top">
|
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['physical:order:edit']"></el-button>
|
|
|
+ <el-tooltip content="发货" placement="top">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleShipment(scope.row)" v-hasPermi="['physical:order:edit']">发货</el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="删除" placement="top">
|
|
|
+<!-- <el-tooltip content="删除" placement="top">
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['physical:order:remove']"></el-button>
|
|
|
- </el-tooltip>
|
|
|
+ </el-tooltip>-->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -137,13 +143,25 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="录入物流订单号" v-model="waybillDialog.visible" width="400px" append-to-body>
|
|
|
+ <el-form ref="waybillFormRef" :model="waybillForm" label-width="100px">
|
|
|
+ <el-form-item label="物流单号" required>
|
|
|
+ <el-input v-model="waybillForm.waybillNumber" placeholder="请输入物流单号" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitWaybillForm">确 定</el-button>
|
|
|
+ <el-button @click="cancelWaybill">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Order" lang="ts">
|
|
|
-import { listOrder, getOrder, delOrder, addOrder, updateOrder } from '@/api/system/physical/order';
|
|
|
+import { listOrder, getOrder, delOrder, addOrder, updateOrder, updateOrderSelective, sendShipment } from '@/api/system/physical/order';
|
|
|
import { OrderVO, OrderQuery, OrderForm } from '@/api/system/physical/order/types';
|
|
|
-import { OrderItemVO } from '@/api/system/physical/orderItem/types';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
const orderList = ref<OrderVO[]>([]);
|
|
|
@@ -157,7 +175,7 @@ const total = ref(0);
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const orderFormRef = ref<ElFormInstance>();
|
|
|
-
|
|
|
+const waybillFormRef = ref<ElFormInstance>();
|
|
|
const dialog = reactive<DialogOption>({
|
|
|
visible: false,
|
|
|
title: ''
|
|
|
@@ -207,7 +225,7 @@ const data = reactive<PageData<OrderForm, OrderQuery>>({
|
|
|
status: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: '订单状态:pending_payment=待支付, paid=已支付, shipped=已发货, completed=已完成, cancelled=已取消不能为空',
|
|
|
+ message: '订单状态不能为空',
|
|
|
trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
@@ -313,6 +331,7 @@ const handleExport = () => {
|
|
|
/** 获取订单状态文本 */
|
|
|
const getOrderStatusText = (status: string): string => {
|
|
|
const statusMap: Record<string, string> = {
|
|
|
+ no_shipped: '待发货',
|
|
|
pending_payment: '待支付',
|
|
|
paid: '已支付',
|
|
|
shipped: '已发货',
|
|
|
@@ -338,4 +357,58 @@ const getOrderStatusType = (status: string): 'success' | 'warning' | 'info' | 'd
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
});
|
|
|
+const waybillDialog = reactive({
|
|
|
+ visible: false,
|
|
|
+ currentOrderId: undefined as string | number | undefined
|
|
|
+});
|
|
|
+
|
|
|
+const waybillForm = reactive({
|
|
|
+ waybillNumber: ''
|
|
|
+});
|
|
|
+/** 录入物流单号按钮操作 */
|
|
|
+const handleInputWaybillNumber = (row: OrderVO) => {
|
|
|
+ waybillForm.waybillNumber = '';
|
|
|
+ waybillDialog.currentOrderId = row.id;
|
|
|
+ waybillDialog.visible = true;
|
|
|
+};
|
|
|
+/** 取消录入物流单号 */
|
|
|
+const cancelWaybill = () => {
|
|
|
+ waybillForm.waybillNumber = '';
|
|
|
+ waybillDialog.visible = false;
|
|
|
+ waybillDialog.currentOrderId = undefined;
|
|
|
+};
|
|
|
+/** 提交录入物流单号 */
|
|
|
+const submitWaybillForm = async () => {
|
|
|
+ if (!waybillForm.waybillNumber) {
|
|
|
+ proxy?.$modal.msgError('请输入物流单号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ buttonLoading.value = true;
|
|
|
+ try {
|
|
|
+ await updateOrderSelective({
|
|
|
+ id: waybillDialog.currentOrderId,
|
|
|
+ waybillNumber: waybillForm.waybillNumber
|
|
|
+ } as OrderForm);
|
|
|
+ proxy?.$modal.msgSuccess('录入成功');
|
|
|
+ waybillDialog.visible = false;
|
|
|
+ waybillDialog.currentOrderId = undefined;
|
|
|
+ waybillForm.waybillNumber = '';
|
|
|
+ await getList();
|
|
|
+ } finally {
|
|
|
+ buttonLoading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+/** 发货按钮操作 */
|
|
|
+const handleShipment = async (row: OrderVO) => {
|
|
|
+ const orderId = row.id;
|
|
|
+ await proxy?.$modal.confirm('确认要对该订单进行发货操作吗?');
|
|
|
+ buttonLoading.value = true;
|
|
|
+ try {
|
|
|
+ await sendShipment({ id: orderId } as OrderForm);
|
|
|
+ proxy?.$modal.msgSuccess('发货成功');
|
|
|
+ await getList();
|
|
|
+ } finally {
|
|
|
+ buttonLoading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|