hurx 2 săptămâni în urmă
părinte
comite
b93df6af1a
1 a modificat fișierele cu 37 adăugiri și 4 ștergeri
  1. 37 4
      src/views/order/orderAssignment/splitAssignDialog.vue

+ 37 - 4
src/views/order/orderAssignment/splitAssignDialog.vue

@@ -148,11 +148,20 @@
               <span class="label">分配对象类型:</span>
               <el-select v-model="assignForm.targetType" placeholder="请选择分配对象类型" clearable style="flex: 1" @change="handleTargetTypeChange">
                 <el-option label="自营" value="zy" />
-                <el-option label="BP伙伴商" value="bp" />
+                <el-option label="供应商" value="srm" />
               </el-select>
             </div>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="12" v-show="assignForm.targetType === 'zy'">
+            <div class="target-input-wrapper">
+              <span class="required-mark">*</span>
+              <span class="label">自营客户: </span>
+              <el-select v-model="assignForm.targetId" :placeholder="'请选择自营客户'" clearable filterable style="flex: 1">
+                <el-option v-for="item in customerList" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
+            </div>
+          </el-col>
+          <el-col :span="12" v-show="assignForm.targetType === 'srm'">
             <div class="target-input-wrapper">
               <span class="required-mark">*</span>
               <span class="label">供应商: </span>
@@ -223,7 +232,7 @@ import { OrderSplitAssignForm, OrderProductAssignRule, OrderAssignmentForm } fro
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { sys_platform_code, order_assignment_status } = toRefs<any>(proxy?.useDict('sys_platform_code', 'order_assignment_status'));
-
+import { listCustomerInfo } from '@/api/customer/customerFile/customerInfo';
 const emit = defineEmits(['success']);
 
 const buttonLoading = ref(false);
@@ -272,6 +281,10 @@ const cachedSupplierList = ref<any[]>([]);
 // 伙伴商列表
 const partnerList = ref<any[]>([]);
 
+// 自营客户列表
+const customerList = ref<any[]>([]);
+const cachedCustomerList = ref<any[]>([]);
+
 // 标签页
 const activeTab = ref('pending');
 
@@ -340,12 +353,32 @@ const handleTargetTypeChange = () => {
   assignForm.targetId = '';
 
   if (assignForm.targetType === 'zy') {
-    // loadCustomerData();
+    loadCustomerData();
   } else if (assignForm.targetType === 'srm') {
     supplierList.value = cachedSupplierList.value;
   }
 };
 
+/** 加载自营客户数据 */
+const loadCustomerData = async () => {
+  if (cachedCustomerList.value.length > 0) {
+    customerList.value = cachedCustomerList.value;
+    return;
+  }
+  try {
+    const res: any = await listCustomerInfo({ pageNum: 1, pageSize: 1000 });
+    const list = res.rows || res.data || [];
+    cachedCustomerList.value = list.map((item: any) => ({
+      ...item,
+      id: item.id,
+      name: item.customerName
+    }));
+    customerList.value = cachedCustomerList.value;
+  } catch (error) {
+    console.error('获取自营客户列表失败', error);
+  }
+};
+
 /** 预加载供应商数据 */
 const loadSupplierData = async () => {
   if (cachedSupplierList.value.length > 0) return;