|
|
@@ -144,11 +144,17 @@ function isOrderShipped(order: OrderModel): boolean {
|
|
|
|
|
|
// 右侧机构表格配置
|
|
|
const gridRef = ref<VxeGridInstance<Institution>>();
|
|
|
+// 机构列表排序:1-评分升序 2-评分降序 3-订单数升序 4-订单数降序
|
|
|
+const institutionOrderByType = ref<number | undefined>(undefined);
|
|
|
const gridOptions = reactive<VxeGridProps<Institution>>({
|
|
|
border: true,
|
|
|
autoResize: true,
|
|
|
height: '100%',
|
|
|
scrollY: { enabled: true },
|
|
|
+ sortConfig: {
|
|
|
+ remote: true,
|
|
|
+ orders: ['asc', 'desc'],
|
|
|
+ },
|
|
|
columns: [
|
|
|
{
|
|
|
field: 'action',
|
|
|
@@ -173,8 +179,8 @@ const gridOptions = reactive<VxeGridProps<Institution>>({
|
|
|
{ field: 'name', title: '机构名称' },
|
|
|
{ field: 'detailAddress', title: '地址' },
|
|
|
{ field: 'phone', title: '联系电话' },
|
|
|
- { field: 'todayOrderQuantity', title: '当日订单数' },
|
|
|
- { field: 'evaluateScore', title: '机构评分' },
|
|
|
+ { field: 'todayOrderQuantity', title: '当日订单数', sortable: true, sortType: 'number' },
|
|
|
+ { field: 'evaluateScore', title: '机构评分', sortable: true, sortType: 'number' },
|
|
|
],
|
|
|
data: [],
|
|
|
pagerConfig: {
|
|
|
@@ -182,6 +188,18 @@ const gridOptions = reactive<VxeGridProps<Institution>>({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+function mapInstitutionSortToOrderByType(field: string | undefined, order: string | undefined | null) {
|
|
|
+ if (!field || !order) return undefined;
|
|
|
+ if (field === 'evaluateScore') return order === 'asc' ? 1 : 2;
|
|
|
+ if (field === 'todayOrderQuantity') return order === 'asc' ? 3 : 4;
|
|
|
+ return undefined;
|
|
|
+}
|
|
|
+
|
|
|
+async function handleInstitutionSortChange({ field, order }: { field?: string; order?: 'asc' | 'desc' | null }) {
|
|
|
+ institutionOrderByType.value = mapInstitutionSortToOrderByType(field, order);
|
|
|
+ await loadInstitutionList();
|
|
|
+}
|
|
|
+
|
|
|
// 初始化
|
|
|
onMounted(async () => {
|
|
|
await loadOrderCounts();
|
|
|
@@ -462,7 +480,8 @@ async function loadInstitutionList() {
|
|
|
? { timeStart: `${selectedOrder.arrangeDate} ${selectedOrder.arrangeTime}` }
|
|
|
: {}),
|
|
|
// 线下服务 type=2,实体商品 type=1
|
|
|
- type: props.orderType === 'offline' ? 2 : 1
|
|
|
+ type: props.orderType === 'offline' ? 2 : 1,
|
|
|
+ orderByType: institutionOrderByType.value,
|
|
|
};
|
|
|
|
|
|
// 获取可派单机构列表
|
|
|
@@ -1224,7 +1243,12 @@ defineExpose({
|
|
|
<div class="institution-panel">
|
|
|
<div class="panel-title">可派单机构</div>
|
|
|
<div class="institution-grid-wrapper">
|
|
|
- <vxe-grid ref="gridRef" v-bind="gridOptions" :loading="institutionLoading" />
|
|
|
+ <vxe-grid
|
|
|
+ ref="gridRef"
|
|
|
+ v-bind="gridOptions"
|
|
|
+ :loading="institutionLoading"
|
|
|
+ @sort-change="handleInstitutionSortChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|