|
@@ -2,46 +2,49 @@
|
|
|
<div class="order-manage-container">
|
|
<div class="order-manage-container">
|
|
|
<div class="page-title"><i class="title-bar"></i><span>历史购买</span></div>
|
|
<div class="page-title"><i class="title-bar"></i><span>历史购买</span></div>
|
|
|
<!-- 搜索栏 -->
|
|
<!-- 搜索栏 -->
|
|
|
- <div class="search-bar">
|
|
|
|
|
- <el-input v-model="queryParams.keyword" placeholder="搜索订单号" style="width: 200px" clearable @keyup.enter="handleQuery">
|
|
|
|
|
- <template #prefix
|
|
|
|
|
- ><el-icon><Search /></el-icon
|
|
|
|
|
- ></template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.dateRange"
|
|
|
|
|
- type="daterange"
|
|
|
|
|
- range-separator="—"
|
|
|
|
|
- start-placeholder="开始日期"
|
|
|
|
|
- end-placeholder="结束日期"
|
|
|
|
|
- style="width: 240px"
|
|
|
|
|
- />
|
|
|
|
|
- <el-button type="primary" @click="handleQuery">搜索</el-button>
|
|
|
|
|
- <el-button @click="handleReset">重置</el-button>
|
|
|
|
|
|
|
+ <div class="flex-row-between">
|
|
|
|
|
+ <div class="flex-row-start">
|
|
|
|
|
+ <el-input v-model="queryParams.keyword" placeholder="搜索订单号" style="width: 260px" clearable @keyup.enter="handleQuery">
|
|
|
|
|
+ <template #prefix
|
|
|
|
|
+ ><el-icon><Search /></el-icon
|
|
|
|
|
+ ></template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="queryParams.dateRange"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="—"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ style="width: 260px; margin-left: 10px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-button type="primary" @click="handleQuery">搜索</el-button>
|
|
|
|
|
+ <el-button @click="handleReset">重置</el-button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <!-- 筛选栏 -->
|
|
|
|
|
- <div class="filter-bar">
|
|
|
|
|
- <span class="filter-label">下单部门</span>
|
|
|
|
|
- <el-tree-select
|
|
|
|
|
- v-model="queryParams.department"
|
|
|
|
|
- style="width: 100px"
|
|
|
|
|
- :data="deptList"
|
|
|
|
|
- :props="{ value: 'deptId', label: 'deptName', children: 'children' }"
|
|
|
|
|
- value-key="deptId"
|
|
|
|
|
- placeholder="请选择"
|
|
|
|
|
- check-strictly
|
|
|
|
|
- :render-after-expand="false"
|
|
|
|
|
- clearable
|
|
|
|
|
- >
|
|
|
|
|
- </el-tree-select>
|
|
|
|
|
- <span class="filter-label">状态</span>
|
|
|
|
|
- <el-select v-model="queryParams.status" placeholder="请选择" style="width: 100px" clearable>
|
|
|
|
|
- <el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- <span class="filter-label">支付方式</span>
|
|
|
|
|
- <el-select v-model="queryParams.payType" placeholder="请选择" style="width: 100px" clearable
|
|
|
|
|
- ><el-option v-for="dict in pay_method" :key="dict.value" :label="dict.label" :value="dict.value"
|
|
|
|
|
- /></el-select>
|
|
|
|
|
|
|
+ <div class="flex-row-between" style="margin-top: 10px">
|
|
|
|
|
+ <div class="flex-row-start">
|
|
|
|
|
+ <el-tree-select
|
|
|
|
|
+ v-model="queryParams.department"
|
|
|
|
|
+ style="width: 160px"
|
|
|
|
|
+ :data="deptList"
|
|
|
|
|
+ :props="{ value: 'deptId', label: 'deptName', children: 'children' }"
|
|
|
|
|
+ value-key="deptId"
|
|
|
|
|
+ placeholder="下单部门"
|
|
|
|
|
+ check-strictly
|
|
|
|
|
+ :render-after-expand="false"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-tree-select>
|
|
|
|
|
+ <el-select v-model="queryParams.status" placeholder="状态" style="width: 160px; margin-left: 10px" clearable>
|
|
|
|
|
+ <el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-select v-model="queryParams.payType" placeholder="支付方式" style="width: 160px; margin-left: 10px" clearable
|
|
|
|
|
+ ><el-option v-for="dict in pay_method" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex-row-start"></div>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- Tab切换 -->
|
|
<!-- Tab切换 -->
|
|
|
<div class="tab-bar">
|
|
<div class="tab-bar">
|
|
@@ -54,20 +57,27 @@
|
|
|
<!-- 订单列表 -->
|
|
<!-- 订单列表 -->
|
|
|
<div class="order-list">
|
|
<div class="order-list">
|
|
|
<div v-for="order in orderList" :key="order.id" class="order-card">
|
|
<div v-for="order in orderList" :key="order.id" class="order-card">
|
|
|
- <div class="order-header">
|
|
|
|
|
- <span class="order-time">{{ order.orderTime }}</span>
|
|
|
|
|
- <span class="order-info">订单号:{{ order.orderNo }}</span>
|
|
|
|
|
- <span class="order-info">下单人:{{ order.orderPerson }}</span>
|
|
|
|
|
- <span class="order-info">部门:{{ order.department }}</span>
|
|
|
|
|
- <el-button type="danger" size="small" @click="handleAddCart(order)">批量加入购物车</el-button>
|
|
|
|
|
- <el-button type="primary" link class="expand-btn" @click="handleExpand(order)"
|
|
|
|
|
- >{{ order.expanded ? '收起' : '展开' }} <el-icon><ArrowDown /></el-icon
|
|
|
|
|
- ></el-button>
|
|
|
|
|
|
|
+ <div class="order-header flex-row-between">
|
|
|
|
|
+ <div class="flex-row-start" style="gap: 0 15px">
|
|
|
|
|
+ <el-checkbox style="margin: 2px 0px 0px 0" v-model="order.checked" @change="handleOrderCheck" />
|
|
|
|
|
+ <div>{{ order.orderTime }}</div>
|
|
|
|
|
+ <div>订单号:{{ order.orderNo }}</div>
|
|
|
|
|
+ <div>下单人:{{ order.orderPerson }}</div>
|
|
|
|
|
+ <div>部门:{{ order.department }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex-row-start">
|
|
|
|
|
+ <div class="expand-btn" @click="handleAddCart(order)">批量加入购物车</div>
|
|
|
|
|
+ <div class="open-btn" v-if="order.products && order.products.length > 5" @click="handleExpand(order)">
|
|
|
|
|
+ <span style="margin-right: 5px"> {{ order.expanded ? '收起' : '展开' }}</span>
|
|
|
|
|
+ <el-icon v-if="order.expanded"><ArrowUp /></el-icon>
|
|
|
|
|
+ <el-icon v-else><ArrowDown /></el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="order.countdown" class="countdown-bar">订单锁定剩余时间:{{ order.countdown }}</div>
|
|
<div v-if="order.countdown" class="countdown-bar">订单锁定剩余时间:{{ order.countdown }}</div>
|
|
|
<div class="product-list">
|
|
<div class="product-list">
|
|
|
- <div v-for="(item, itemIndex) in order.expanded ? order.products : order.products.slice(0, 1)" :key="itemIndex" class="product-row">
|
|
|
|
|
- <div class="product-cell product-info-cell">
|
|
|
|
|
|
|
+ <div v-for="(item, itemIndex) in order.expanded ? order.products : order.products.slice(0, 5)" :key="itemIndex" class="product-row">
|
|
|
|
|
+ <div class="product-info-cell">
|
|
|
<div class="product-image">
|
|
<div class="product-image">
|
|
|
<el-image :src="item.image" fit="contain"
|
|
<el-image :src="item.image" fit="contain"
|
|
|
><template #error
|
|
><template #error
|
|
@@ -76,39 +86,40 @@
|
|
|
></el-image>
|
|
></el-image>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="product-detail">
|
|
<div class="product-detail">
|
|
|
- <div class="product-name">{{ item.name }}</div>
|
|
|
|
|
- <div class="product-spec">{{ item.spec1 }} {{ item.spec2 }}</div>
|
|
|
|
|
|
|
+ <div class="product-name ellipsis">{{ item.name }}</div>
|
|
|
|
|
+ <div class="product-spec">{{ item.spec1 }} | {{ item.spec2 }}</div>
|
|
|
<div class="product-price">¥{{ item.price }}</div>
|
|
<div class="product-price">¥{{ item.price }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="product-quantity">x{{ item.quantity }}</div>
|
|
<div class="product-quantity">x{{ item.quantity }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="product-cell amount-cell" v-if="itemIndex === 0">
|
|
|
|
|
|
|
+ <div class="amount-cell" v-if="itemIndex === 0">
|
|
|
<div class="amount-info">
|
|
<div class="amount-info">
|
|
|
- <span class="label">支付款</span><span class="value highlight">¥{{ order.payAmount }}</span>
|
|
|
|
|
|
|
+ <span class="label">支付款:</span><span class="value highlight">¥{{ order.payAmount }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="amount-info">
|
|
<div class="amount-info">
|
|
|
<span class="label">含运费:</span><span class="value">¥{{ order.freight }}</span>
|
|
<span class="label">含运费:</span><span class="value">¥{{ order.freight }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <!-- <div class="product-cell status-cell" v-if="itemIndex === 0">
|
|
|
|
|
- <span class="status-text" :style="{ color: getStatusColor(order.status) }">{{ order.statusText }}</span>
|
|
|
|
|
- <el-button type="primary" link size="small" @click="handleViewDetail(order)">查看订单轨迹</el-button>
|
|
|
|
|
- <template v-if="order.auditStatus"
|
|
|
|
|
- ><span :class="['audit-status', getAuditStatusClass(order.auditStatus)]">{{ order.auditStatus }}</span
|
|
|
|
|
- ><el-button type="primary" link size="small">查看审批流</el-button></template
|
|
|
|
|
- >
|
|
|
|
|
- <el-button v-if="order.fileCount" type="primary" link size="small">审核文件({{ order.fileCount }})</el-button>
|
|
|
|
|
- </div> -->
|
|
|
|
|
- <div class="product-cell action-cell" v-if="itemIndex === 0">
|
|
|
|
|
- <el-button type="primary" link size="small" @click="handleAddCart(order)">加入购物车</el-button>
|
|
|
|
|
|
|
+ <div v-else style="width: 200px"></div>
|
|
|
|
|
+ <div class="status-cell">
|
|
|
|
|
+ <el-button size="small" @click="handleAddCart(order)">加入购物车</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 显示更多商品提示 -->
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="!order.expanded && order.products && order.products.length > 5"
|
|
|
|
|
+ class="more-products-hint"
|
|
|
|
|
+ @click="handleExpand(order)"
|
|
|
|
|
+ style="cursor: pointer"
|
|
|
|
|
+ >
|
|
|
|
|
+ 该订单共 {{ order.products.length }} 件商品,点击展开查看全部
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<el-empty v-if="orderList.length === 0" description="暂无订单" />
|
|
<el-empty v-if="orderList.length === 0" description="暂无订单" />
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
|
- <TablePagination v-model:page="queryParams.pageNum" v-model:page-size="queryParams.pageSize" :total="total" @change="handleQuery" />
|
|
|
|
|
|
|
+ <TablePagination v-model:page="queryParams.pageNum" v-model:page-size="queryParams.pageSize" :total="total" @change="fetchOrderList" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -126,8 +137,8 @@ import { addProductShoppingCart } from '@/api/goods/index';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { order_status, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'pay_method'));
|
|
const { order_status, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'pay_method'));
|
|
|
|
|
|
|
|
-const router = useRouter();
|
|
|
|
|
const activeTab = ref('all');
|
|
const activeTab = ref('all');
|
|
|
|
|
+const selectAll = ref(false);
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
|
|
|
|
|
const deptList = ref([]);
|
|
const deptList = ref([]);
|
|
@@ -159,7 +170,7 @@ watch(activeTab, (newTab) => {
|
|
|
fetchOrderList();
|
|
fetchOrderList();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-const queryParams = reactive({ keyword: '', dateRange: null, department: '', status: '', payType: '', pageNum: 1, pageSize: 5 });
|
|
|
|
|
|
|
+const queryParams = reactive({ keyword: '', dateRange: [], department: '', status: '', payType: '', pageNum: 1, pageSize: 5 });
|
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
const allOrders = ref<any[]>([]);
|
|
const allOrders = ref<any[]>([]);
|
|
|
|
|
|
|
@@ -213,6 +224,35 @@ const loadDeptTree = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 单个加入购物车 */
|
|
|
|
|
+const handleAddCart = async (order: any) => {
|
|
|
|
|
+ const res = await getOrderProducts([order.id]);
|
|
|
|
|
+ if (res.code === 200 && res.rows) {
|
|
|
|
|
+ const products = res.rows.map((p: any) => ({
|
|
|
|
|
+ productId: p.productId,
|
|
|
|
|
+ productNum: p.orderQuantity || 0
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ const promises = products.map((item) => addProductShoppingCart({ productId: item.productId, productNum: item.productNum }));
|
|
|
|
|
+ Promise.all(promises).then(() => {
|
|
|
|
|
+ ElMessage.success(`已将${products.length}件商品加入购物车`);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // addProductShoppingCart({ productId: item.id, productNum: 1 }).then((res: any) => {
|
|
|
|
|
+ // if (res.code == 200) {
|
|
|
|
|
+ // ElMessage.success('已加入购物车');
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+};
|
|
|
|
|
+const formatDate = (date: Date | string | number): string => {
|
|
|
|
|
+ if (!date) return '';
|
|
|
|
|
+ const d = new Date(date);
|
|
|
|
|
+ const year = d.getFullYear();
|
|
|
|
|
+ const month = String(d.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(d.getDate()).padStart(2, '0');
|
|
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
|
|
+};
|
|
|
// 获取订单列表
|
|
// 获取订单列表
|
|
|
const fetchOrderList = async () => {
|
|
const fetchOrderList = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
@@ -227,13 +267,54 @@ const fetchOrderList = async () => {
|
|
|
if (queryParams.department) params.department = queryParams.department;
|
|
if (queryParams.department) params.department = queryParams.department;
|
|
|
if (queryParams.status) params.orderStatuses = queryParams.status; // 使用orderStatuses支持多状态查询
|
|
if (queryParams.status) params.orderStatuses = queryParams.status; // 使用orderStatuses支持多状态查询
|
|
|
if (queryParams.payType) params.payType = queryParams.payType;
|
|
if (queryParams.payType) params.payType = queryParams.payType;
|
|
|
- if (queryParams.dateRange && queryParams.dateRange.length === 2) {
|
|
|
|
|
- params.beginTime = queryParams.dateRange[0];
|
|
|
|
|
- params.endTime = queryParams.dateRange[1];
|
|
|
|
|
|
|
+ if (queryParams.dateRange && queryParams.dateRange.length == 2) {
|
|
|
|
|
+ // params.beginTime = queryParams.dateRange[0];
|
|
|
|
|
+ // params.endTime = queryParams.dateRange[1];
|
|
|
|
|
+ params.params = {
|
|
|
|
|
+ beginTime: formatDate(queryParams.dateRange[0]), // 将日期转换为字符串格式
|
|
|
|
|
+
|
|
|
|
|
+ endTime: formatDate(queryParams.dateRange[1]) // 将日期转换为字符串格式
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ console.log('发送到后端的参数:', params);
|
|
|
const res = await getOrderList(params);
|
|
const res = await getOrderList(params);
|
|
|
|
|
+ console.log('后端返回的数据:', res);
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
|
|
+ // 调试:打印后端返回的第一条订单数据
|
|
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
|
|
+ console.log('后端���回的订单状态值:', res.rows[0].orderStatus);
|
|
|
|
|
+ console.log('完整的订单数据:', res.rows[0]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取订单商品数据
|
|
|
|
|
+ const orderProductsMap: Record<number, any[]> = {};
|
|
|
|
|
+ const orderIds = (res.rows || []).map((o: any) => o.id);
|
|
|
|
|
+ if (orderIds.length > 0) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const prodRes = await getOrderProducts(orderIds);
|
|
|
|
|
+ if (prodRes.code === 200 && prodRes.rows) {
|
|
|
|
|
+ prodRes.rows.forEach((p: any) => {
|
|
|
|
|
+ if (!orderProductsMap[p.orderId]) {
|
|
|
|
|
+ orderProductsMap[p.orderId] = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ orderProductsMap[p.orderId].push({
|
|
|
|
|
+ id: p.id,
|
|
|
|
|
+ productId: p.productId,
|
|
|
|
|
+ image: p.productImage || '',
|
|
|
|
|
+ name: p.productName || '',
|
|
|
|
|
+ spec1: p.productUnit || '',
|
|
|
|
|
+ spec2: p.productNo || '',
|
|
|
|
|
+ price: p.orderPrice || 0,
|
|
|
|
|
+ quantity: p.orderQuantity || 0
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error('获取商品列表失败:', e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 将后端数据转换为前端需要的格式
|
|
// 将后端数据转换为前端需要的格式
|
|
|
allOrders.value = (res.rows || []).map((order: OrderMain) => ({
|
|
allOrders.value = (res.rows || []).map((order: OrderMain) => ({
|
|
|
id: order.id,
|
|
id: order.id,
|
|
@@ -248,10 +329,17 @@ const fetchOrderList = async () => {
|
|
|
countdown: '',
|
|
countdown: '',
|
|
|
auditStatus: order.checkStatus,
|
|
auditStatus: order.checkStatus,
|
|
|
fileCount: 0,
|
|
fileCount: 0,
|
|
|
|
|
+ checked: false,
|
|
|
expanded: false,
|
|
expanded: false,
|
|
|
- products: [] // 商品信息需要单独加载
|
|
|
|
|
|
|
+ products: orderProductsMap[order.id] || [] // 商品信息已加载
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
|
|
+ // 调试:打印转换后的订单状态
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ '转换后的订单状态分布:',
|
|
|
|
|
+ allOrders.value.map((o) => o.status)
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
total.value = res.total || 0;
|
|
total.value = res.total || 0;
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -263,47 +351,18 @@ const fetchOrderList = async () => {
|
|
|
|
|
|
|
|
const orderList = computed(() => allOrders.value);
|
|
const orderList = computed(() => allOrders.value);
|
|
|
|
|
|
|
|
-const getStatusColor = (status: string) =>
|
|
|
|
|
- ({ completed: '#67c23a', preOrder: '#e6a23c', shipping: '#409eff', cancelled: '#909399' })[status] || '#909399';
|
|
|
|
|
-const getAuditStatusClass = (auditStatus: string) => (auditStatus === '审批通过' ? 'success' : auditStatus === '审批驳回' ? 'danger' : 'warning');
|
|
|
|
|
-
|
|
|
|
|
const handleExpand = async (order: any) => {
|
|
const handleExpand = async (order: any) => {
|
|
|
const orderIndex = allOrders.value.findIndex((o) => o.id === order.id);
|
|
const orderIndex = allOrders.value.findIndex((o) => o.id === order.id);
|
|
|
if (orderIndex === -1) return;
|
|
if (orderIndex === -1) return;
|
|
|
|
|
|
|
|
- const currentOrder = allOrders.value[orderIndex];
|
|
|
|
|
-
|
|
|
|
|
- if (!currentOrder.expanded && currentOrder.products.length === 0) {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await getOrderProducts([order.id]);
|
|
|
|
|
- if (res.code === 200 && res.rows) {
|
|
|
|
|
- const products = res.rows.map((p: any) => ({
|
|
|
|
|
- id: p.productId || p.id,
|
|
|
|
|
- image: p.productImage || '',
|
|
|
|
|
- name: p.productName || '',
|
|
|
|
|
- spec1: p.productUnit || '',
|
|
|
|
|
- spec2: p.productNo || '',
|
|
|
|
|
- price: p.orderPrice || 0,
|
|
|
|
|
- quantity: p.orderQuantity || 0
|
|
|
|
|
- }));
|
|
|
|
|
-
|
|
|
|
|
- // 替换整个数组以触发响应式更新
|
|
|
|
|
- allOrders.value = allOrders.value.map((o, i) => (i === orderIndex ? { ...o, expanded: true, products } : o));
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('加载商品失败:', error);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 替换整个数组以触发响应式更新
|
|
// 替换整个数组以触发响应式更新
|
|
|
allOrders.value = allOrders.value.map((o, i) => (i === orderIndex ? { ...o, expanded: !o.expanded } : o));
|
|
allOrders.value = allOrders.value.map((o, i) => (i === orderIndex ? { ...o, expanded: !o.expanded } : o));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const handleViewDetail = (order: any) => {
|
|
|
|
|
- router.push(`/order/orderManage/detail/${order.orderNo}`);
|
|
|
|
|
|
|
+const handleOrderCheck = () => {
|
|
|
|
|
+ selectAll.value = orderList.value.every((order) => order.checked);
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
|
queryParams.pageNum = 1;
|
|
queryParams.pageNum = 1;
|
|
|
fetchOrderList();
|
|
fetchOrderList();
|
|
@@ -317,44 +376,6 @@ const handleReset = () => {
|
|
|
fetchOrderList();
|
|
fetchOrderList();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 加入购物车
|
|
|
|
|
-const handleAddCart = async (order: any) => {
|
|
|
|
|
- try {
|
|
|
|
|
- // 如果商品列表为空,先加载商品
|
|
|
|
|
- if (!order.products || order.products.length === 0) {
|
|
|
|
|
- const res = await getOrderProducts([order.id]);
|
|
|
|
|
- if (res.code === 200 && res.rows) {
|
|
|
|
|
- order.products = res.rows.map((p: any) => ({
|
|
|
|
|
- id: p.productId || p.id,
|
|
|
|
|
- image: p.productImage || '',
|
|
|
|
|
- name: p.productName || '',
|
|
|
|
|
- spec1: p.productUnit || '',
|
|
|
|
|
- spec2: p.productNo || '',
|
|
|
|
|
- price: p.orderPrice || 0,
|
|
|
|
|
- quantity: p.orderQuantity || 0
|
|
|
|
|
- }));
|
|
|
|
|
- } else {
|
|
|
|
|
- ElMessage.warning('无法获取订单商品信息');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 批量加入购物车
|
|
|
|
|
- const promises = order.products.map((product: any) =>
|
|
|
|
|
- addProductShoppingCart({
|
|
|
|
|
- productId: product.id,
|
|
|
|
|
- productNum: product.quantity || 1
|
|
|
|
|
- })
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- await Promise.all(promises);
|
|
|
|
|
- ElMessage.success(`已将${order.products.length}件商品加入购物车`);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('加入购物车失败:', error);
|
|
|
|
|
- ElMessage.error('加入购物车失败');
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
// 页面加载时获取订单列表
|
|
// 页面加载时获取订单列表
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadDeptTree();
|
|
loadDeptTree();
|
|
@@ -364,13 +385,14 @@ onMounted(() => {
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
.order-manage-container {
|
|
.order-manage-container {
|
|
|
- width: 100%;
|
|
|
|
|
padding: 20px;
|
|
padding: 20px;
|
|
|
background: #fff;
|
|
background: #fff;
|
|
|
min-height: 100%;
|
|
min-height: 100%;
|
|
|
|
|
+ width: 100%;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
- max-height: calc(100vh - 120px);
|
|
|
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
+ // max-height: calc(100vh - 120px); // 减去顶部导航栏和其他元素高度
|
|
|
}
|
|
}
|
|
|
.page-title {
|
|
.page-title {
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
@@ -387,22 +409,7 @@ onMounted(() => {
|
|
|
background: #e60012;
|
|
background: #e60012;
|
|
|
border-radius: 2px;
|
|
border-radius: 2px;
|
|
|
}
|
|
}
|
|
|
-.search-bar {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- gap: 15px;
|
|
|
|
|
- margin-bottom: 15px;
|
|
|
|
|
-}
|
|
|
|
|
-.filter-bar {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- gap: 10px;
|
|
|
|
|
- margin-bottom: 15px;
|
|
|
|
|
- .filter-label {
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
- color: #666;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
.tab-bar {
|
|
.tab-bar {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
@@ -433,8 +440,8 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.order-list {
|
|
.order-list {
|
|
|
- flex: 1;
|
|
|
|
|
- overflow-y: auto;
|
|
|
|
|
|
|
+ // flex: 1;
|
|
|
|
|
+ // overflow-y: auto;
|
|
|
margin-bottom: 15px;
|
|
margin-bottom: 15px;
|
|
|
.order-card {
|
|
.order-card {
|
|
|
border: 1px solid #eee;
|
|
border: 1px solid #eee;
|
|
@@ -442,19 +449,20 @@ onMounted(() => {
|
|
|
margin-bottom: 15px;
|
|
margin-bottom: 15px;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
.order-header {
|
|
.order-header {
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- gap: 15px;
|
|
|
|
|
padding: 12px 15px;
|
|
padding: 12px 15px;
|
|
|
background: #f9f9f9;
|
|
background: #f9f9f9;
|
|
|
border-bottom: 1px solid #eee;
|
|
border-bottom: 1px solid #eee;
|
|
|
- font-size: 13px;
|
|
|
|
|
- color: #666;
|
|
|
|
|
- .order-time {
|
|
|
|
|
- color: #333;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #101828;
|
|
|
.expand-btn {
|
|
.expand-btn {
|
|
|
- margin-left: auto;
|
|
|
|
|
|
|
+ color: #165dff;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .open-btn {
|
|
|
|
|
+ color: #364153;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.countdown-bar {
|
|
.countdown-bar {
|
|
@@ -467,7 +475,7 @@ onMounted(() => {
|
|
|
.product-list {
|
|
.product-list {
|
|
|
.product-row {
|
|
.product-row {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- border-bottom: 1px solid #f5f5f5;
|
|
|
|
|
|
|
+ // border-bottom: 1px solid #f5f5f5;
|
|
|
&:last-child {
|
|
&:last-child {
|
|
|
border-bottom: none;
|
|
border-bottom: none;
|
|
|
}
|
|
}
|
|
@@ -479,9 +487,9 @@ onMounted(() => {
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
}
|
|
}
|
|
|
.product-info-cell {
|
|
.product-info-cell {
|
|
|
|
|
+ display: flex;
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
- flex-direction: row;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
|
|
+ padding: 15px;
|
|
|
gap: 15px;
|
|
gap: 15px;
|
|
|
.product-image {
|
|
.product-image {
|
|
|
width: 80px;
|
|
width: 80px;
|
|
@@ -504,21 +512,22 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
.product-detail {
|
|
.product-detail {
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
|
|
+ width: 0;
|
|
|
.product-name {
|
|
.product-name {
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
- color: #333;
|
|
|
|
|
|
|
+ color: #000000;
|
|
|
margin-bottom: 5px;
|
|
margin-bottom: 5px;
|
|
|
- line-height: 1.4;
|
|
|
|
|
}
|
|
}
|
|
|
.product-spec {
|
|
.product-spec {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
color: #999;
|
|
color: #999;
|
|
|
- margin-bottom: 5px;
|
|
|
|
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
}
|
|
|
.product-price {
|
|
.product-price {
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
color: #e60012;
|
|
color: #e60012;
|
|
|
|
|
+ margin-bottom: 5px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.product-quantity {
|
|
.product-quantity {
|
|
@@ -527,13 +536,14 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.amount-cell {
|
|
.amount-cell {
|
|
|
- width: 120px;
|
|
|
|
|
- border-left: 1px solid #f5f5f5;
|
|
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+ padding: 15px;
|
|
|
.amount-info {
|
|
.amount-info {
|
|
|
margin-bottom: 5px;
|
|
margin-bottom: 5px;
|
|
|
.label {
|
|
.label {
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
color: #999;
|
|
color: #999;
|
|
|
|
|
+ margin-right: 4px;
|
|
|
}
|
|
}
|
|
|
.value {
|
|
.value {
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
@@ -547,16 +557,18 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.status-cell {
|
|
.status-cell {
|
|
|
- width: 120px;
|
|
|
|
|
- border-left: 1px solid #f5f5f5;
|
|
|
|
|
|
|
+ width: 140px;
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
+ display: flex;
|
|
|
align-items: flex-start;
|
|
align-items: flex-start;
|
|
|
- gap: 5px;
|
|
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ gap: 10px;
|
|
|
.status-text {
|
|
.status-text {
|
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
|
}
|
|
}
|
|
|
.audit-status {
|
|
.audit-status {
|
|
|
- font-size: 12px;
|
|
|
|
|
|
|
+ font-size: 14px;
|
|
|
&.success {
|
|
&.success {
|
|
|
color: #e60012;
|
|
color: #e60012;
|
|
|
}
|
|
}
|
|
@@ -575,6 +587,78 @@ onMounted(() => {
|
|
|
gap: 3px;
|
|
gap: 3px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ .more-products-hint {
|
|
|
|
|
+ padding: 10px 15px;
|
|
|
|
|
+ background: #f5f5f5;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ border-top: 1px solid #f0f0f0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.bottom-bar {
|
|
|
|
|
+ background: #fafafa;
|
|
|
|
|
+ border: 1px solid #eee;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ padding: 15px 20px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ .bottom-right {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 15px;
|
|
|
|
|
+ .selected-info {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ em {
|
|
|
|
|
+ color: #e60012;
|
|
|
|
|
+ font-style: normal;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.evaluate-product {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 15px;
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
+ background: #f9f9f9;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
+ .product-image {
|
|
|
|
|
+ width: 60px;
|
|
|
|
|
+ height: 60px;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ .el-image {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ .image-placeholder {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .product-info {
|
|
|
|
|
+ .product-name {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ margin-bottom: 5px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .product-spec {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #999;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
:deep(.table-pagination) {
|
|
:deep(.table-pagination) {
|