hurx преди 2 месеца
родител
ревизия
1a10a2d1db

+ 63 - 0
src/api/customer/complaintsSuggestions/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { ComplaintsSuggestionsVO, ComplaintsSuggestionsForm, ComplaintsSuggestionsQuery } from '@/api/customer/complaintsSuggestions/types';
+
+/**
+ * 查询投诉与建议记录列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listComplaintsSuggestions = (query?: ComplaintsSuggestionsQuery): AxiosPromise<ComplaintsSuggestionsVO[]> => {
+  return request({
+    url: '/customer/complaintsSuggestions/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询投诉与建议记录详细
+ * @param id
+ */
+export const getComplaintsSuggestions = (id: string | number): AxiosPromise<ComplaintsSuggestionsVO> => {
+  return request({
+    url: '/customer/complaintsSuggestions/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增投诉与建议记录
+ * @param data
+ */
+export const addComplaintsSuggestions = (data: ComplaintsSuggestionsForm) => {
+  return request({
+    url: '/customer/complaintsSuggestions',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改投诉与建议记录
+ * @param data
+ */
+export const updateComplaintsSuggestions = (data: ComplaintsSuggestionsForm) => {
+  return request({
+    url: '/customer/complaintsSuggestions',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除投诉与建议记录
+ * @param id
+ */
+export const delComplaintsSuggestions = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/customer/complaintsSuggestions/' + id,
+    method: 'delete'
+  });
+};

+ 245 - 0
src/api/customer/complaintsSuggestions/types.ts

@@ -0,0 +1,245 @@
+export interface ComplaintsSuggestionsVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 投诉/建议编号
+   */
+  complainNo: string;
+
+  /**
+   * 用户id
+   */
+  userId: string | number;
+
+  /**
+   * 用户编号
+   */
+  userNo: string;
+
+  /**
+   * 称呼
+   */
+  userName: string;
+
+  /**
+   * 联系电话
+   */
+  phone: string;
+
+  /**
+   * 反馈类型
+   */
+  feedbackType: string;
+
+  /**
+   * 反馈内容
+   */
+  feedbackContent: string;
+
+  /**
+   * 相关图片路径
+   */
+  relatedPictures: string;
+
+  /**
+   * 处理时间
+   */
+  processTime: string;
+
+  /**
+   * 处理人员姓名
+   */
+  processStaff: string;
+
+  /**
+   * 处理结果
+   */
+  processResult: string;
+
+  /**
+   * 处理过程反馈
+   */
+  processFeedback: string;
+
+  /**
+   * 处理评价
+   */
+  processEvaluation: number;
+
+  /**
+   * 最终结果反馈
+   */
+  resultFeedback: string;
+
+  /**
+   * 备注
+   */
+  remark: string;
+}
+
+export interface ComplaintsSuggestionsForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 投诉/建议编号
+   */
+  complainNo?: string;
+
+  /**
+   * 用户id
+   */
+  userId?: string | number;
+
+  /**
+   * 用户编号
+   */
+  userNo?: string;
+
+  /**
+   * 称呼
+   */
+  userName?: string;
+
+  /**
+   * 联系电话
+   */
+  phone?: string;
+
+  /**
+   * 反馈类型
+   */
+  feedbackType?: string;
+
+  /**
+   * 反馈内容
+   */
+  feedbackContent?: string;
+
+  /**
+   * 相关图片路径
+   */
+  relatedPictures?: string;
+
+  /**
+   * 处理时间
+   */
+  processTime?: string;
+
+  /**
+   * 处理人员姓名
+   */
+  processStaff?: string;
+
+  /**
+   * 处理结果
+   */
+  processResult?: string;
+
+  /**
+   * 处理过程反馈
+   */
+  processFeedback?: string;
+
+  /**
+   * 处理评价
+   */
+  processEvaluation?: number;
+
+  /**
+   * 最终结果反馈
+   */
+  resultFeedback?: string;
+
+  /**
+   * 备注
+   */
+  remark?: string;
+}
+
+export interface ComplaintsSuggestionsQuery extends PageQuery {
+  /**
+   * 投诉/建议编号
+   */
+  complainNo?: string;
+
+  /**
+   * 用户id
+   */
+  userId?: string | number;
+
+  /**
+   * 用户编号
+   */
+  userNo?: string;
+
+  /**
+   * 称呼
+   */
+  userName?: string;
+
+  /**
+   * 联系电话
+   */
+  phone?: string;
+
+  /**
+   * 反馈类型
+   */
+  feedbackType?: string;
+
+  /**
+   * 反馈内容
+   */
+  feedbackContent?: string;
+
+  /**
+   * 相关图片路径
+   */
+  relatedPictures?: string;
+
+  /**
+   * 处理时间
+   */
+  processTime?: string;
+
+  /**
+   * 处理人员姓名
+   */
+  processStaff?: string;
+
+  /**
+   * 处理结果
+   */
+  processResult?: string;
+
+  /**
+   * 处理过程反馈
+   */
+  processFeedback?: string;
+
+  /**
+   * 处理评价
+   */
+  processEvaluation?: number;
+
+  /**
+   * 最终结果反馈
+   */
+  resultFeedback?: string;
+
+  /**
+   * 平台标识
+   */
+  platformCode?: string;
+
+  /**
+   * 日期范围参数
+   */
+  params?: any;
+}

+ 2 - 2
src/api/customer/customerFile/purchaseHabit/index.ts

@@ -66,12 +66,12 @@ export const delPurchaseHabit = (id: string | number | Array<string | number>) =
  * 新增客户采购习惯
  * @param data
  */
-export const getCustomerPurchaseHabitData = (customerNo: string | number): AxiosPromise<PurchaseHabitVO> => {
+export const getCustomerPurchaseHabitData = (customerId: string | number): AxiosPromise<PurchaseHabitVO> => {
   return request({
     url: '/customer/purchaseHabit/getCustomerPurchaseHabitData',
     method: 'get',
     params: {
-      customerNo: customerNo
+      customerId: customerId
     }
   });
 };

+ 8 - 0
src/api/customer/customerFile/purchaseHabit/types.ts

@@ -4,6 +4,8 @@ export interface PurchaseHabitVO {
    */
   id: string | number;
 
+  customerId: string | number;
+
   /**
    * 客户编号
    */
@@ -86,6 +88,8 @@ export interface PurchaseHabitForm extends BaseEntity {
    */
   id?: string | number;
 
+  customerId?: string | number;
+
   /**
    * 客户编号
    */
@@ -163,6 +167,10 @@ export interface PurchaseHabitForm extends BaseEntity {
 }
 
 export interface PurchaseHabitQuery extends PageQuery {
+  /**
+   * 客户ID
+   */
+  customerId?: string | number;
   /**
    * 客户编号
    */

+ 1 - 1
src/api/customer/invoiceType/index.ts

@@ -1,6 +1,6 @@
 import request from '@/utils/request';
 import { AxiosPromise } from 'axios';
-import { InvoiceTypeVO, InvoiceTypeForm, InvoiceTypeQuery } from '@/api/system/invoiceType/types';
+import { InvoiceTypeVO, InvoiceTypeForm, InvoiceTypeQuery } from '@/api/customer/invoiceType/types';
 
 /**
  * 查询发票类型列表

+ 63 - 0
src/api/order/orderEvaluation/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { OrderEvaluationVO, OrderEvaluationForm, OrderEvaluationQuery } from '@/api/order/orderEvaluation/types';
+
+/**
+ * 查询订单评价列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listOrderEvaluation = (query?: OrderEvaluationQuery): AxiosPromise<OrderEvaluationVO[]> => {
+  return request({
+    url: '/order/orderEvaluation/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询订单评价详细
+ * @param id
+ */
+export const getOrderEvaluation = (id: string | number): AxiosPromise<OrderEvaluationVO> => {
+  return request({
+    url: '/order/orderEvaluation/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增订单评价
+ * @param data
+ */
+export const addOrderEvaluation = (data: OrderEvaluationForm) => {
+  return request({
+    url: '/order/orderEvaluation',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改订单评价
+ * @param data
+ */
+export const updateOrderEvaluation = (data: OrderEvaluationForm) => {
+  return request({
+    url: '/order/orderEvaluation',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除订单评价
+ * @param id
+ */
+export const delOrderEvaluation = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/order/orderEvaluation/' + id,
+    method: 'delete'
+  });
+};

+ 155 - 0
src/api/order/orderEvaluation/types.ts

@@ -0,0 +1,155 @@
+export interface OrderEvaluationVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 关联订单ID
+   */
+  orderId: string | number;
+
+  /**
+   * 订单编号(业务单号)
+   */
+  orderNo: string;
+
+  /**
+   * 物流服务评分(例如1-5分)
+   */
+  logistics: number;
+
+  /**
+   * 商品配送评分(例如1-5分)
+   */
+  deliverGoods: number;
+
+  /**
+   * 整体配送体验评分(例如1-5分)
+   */
+  delivery: number;
+
+  /**
+   * 评价类型:1-首次评价,2-追评
+   */
+  evaluationType: string;
+
+  /**
+   * 关联客户ID
+   */
+  customerId: string | number;
+
+  /**
+   * 客户编号
+   */
+  customerNo: string;
+
+  /**
+   * 备注
+   */
+  remark: string;
+}
+
+export interface OrderEvaluationForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 关联订单ID
+   */
+  orderId?: string | number;
+
+  /**
+   * 订单编号(业务单号)
+   */
+  orderNo?: string;
+
+  /**
+   * 物流服务评分(例如1-5分)
+   */
+  logistics?: number;
+
+  /**
+   * 商品配送评分(例如1-5分)
+   */
+  deliverGoods?: number;
+
+  /**
+   * 整体配送体验评分(例如1-5分)
+   */
+  delivery?: number;
+
+  /**
+   * 评价类型:1-首次评价,2-追评
+   */
+  evaluationType?: string;
+
+  /**
+   * 关联客户ID
+   */
+  customerId?: string | number;
+
+  /**
+   * 客户编号
+   */
+  customerNo?: string;
+
+  /**
+   * 备注
+   */
+  remark?: string;
+}
+
+export interface OrderEvaluationQuery extends PageQuery {
+  /**
+   * 关联订单ID
+   */
+  orderId?: string | number;
+
+  /**
+   * 订单编号(业务单号)
+   */
+  orderNo?: string;
+
+  /**
+   * 物流服务评分(例如1-5分)
+   */
+  logistics?: number;
+
+  /**
+   * 商品配送评分(例如1-5分)
+   */
+  deliverGoods?: number;
+
+  /**
+   * 整体配送体验评分(例如1-5分)
+   */
+  delivery?: number;
+
+  /**
+   * 评价类型:1-首次评价,2-追评
+   */
+  evaluationType?: string;
+
+  /**
+   * 关联客户ID
+   */
+  customerId?: string | number;
+
+  /**
+   * 客户编号
+   */
+  customerNo?: string;
+
+  /**
+   * 平台标识
+   */
+  platformCode?: string;
+
+  /**
+   * 日期范围参数
+   */
+  params?: any;
+}

+ 12 - 0
src/api/order/orderMain/index.ts

@@ -65,6 +65,18 @@ export const updateOrderMain = (data: OrderMainForm) => {
   });
 };
 
+/**
+ * 确认订单
+ * @param data
+ */
+export const orderAffirm = (data: OrderMainForm) => {
+  return request({
+    url: '/order/orderMain/orderAffirm',
+    method: 'put',
+    data: data
+  });
+};
+
 /**
  * 删除订单主信息
  * @param id

+ 16 - 18
src/views/customer/customerFile/customerInfo/add.vue

@@ -145,7 +145,13 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="详细地址" prop="address">
-              <el-cascader v-model="codeArr" :options="regionData" placeholder="请选择" @change="handleChange" style="width: 100%"></el-cascader>
+              <el-cascader
+                v-model="codeArr"
+                :options="regionData as any"
+                placeholder="请选择"
+                @change="handleChange"
+                style="width: 100%"
+              ></el-cascader>
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -295,11 +301,7 @@
       <el-table :data="contactList" border>
         <el-table-column type="index" label="序号" align="center" width="60" />
         <el-table-column label="联系人姓名" align="center" prop="contactName" min-width="120" />
-        <el-table-column label="职位" align="center" prop="roleId" min-width="120">
-          <template #default="{ row }">
-            <span>{{ getRoleName(row.roleId) }}</span>
-          </template>
-        </el-table-column>
+        <el-table-column label="职位" align="center" prop="roleName" min-width="120"> </el-table-column>
         <el-table-column label="手机号" align="center" prop="phone" min-width="150" />
         <el-table-column label="固定电话" align="center" prop="officePhone" min-width="150" />
         <el-table-column label="邮箱地址" align="center" prop="email" min-width="180" />
@@ -753,11 +755,6 @@ const salesRules = {
 
 // 获取角色名称
 const getRoleName = (roleId: string | number | undefined) => {
-  const roleMap: Record<string, string> = {
-    '1': '采购经理',
-    '2': '财务',
-    '3': '其他'
-  };
   return roleMap[String(roleId)] || '-';
 };
 
@@ -919,19 +916,21 @@ const removeInvoice = (index: number) => {
 // 提交表单
 const handleSubmit = async () => {
   try {
-    // 验证基本信息表单
+    // 1. 业务前置校验
+    if (contactList.value.length < 1) {
+      ElMessage.warning('请至少添加一名联系人!');
+      return;
+    }
+
+    // 2. 表单字段校验
     await formRef.value?.validate();
-    // 验证销售信息表单
     await salesFormRef.value?.validate();
 
     submitLoading.value = true;
 
-    // 将客户编号赋值到表单
-    form.customerNo = customerNumber.value;
-
-    // 组装提交数据,按照后端要求的结构
     const submitData: CustomerInfoForm = {
       ...form,
+      customerNo: customerNumber.value,
       customerBusinessBo: businessForm,
       customerSalesInfoBo: salesForm,
       customerContactBoList: contactList.value,
@@ -940,7 +939,6 @@ const handleSubmit = async () => {
 
     await addCustomerInfo(submitData);
     ElMessage.success('添加成功');
-
     router.back();
   } catch (error) {
     console.error('保存失败:', error);

+ 34 - 4
src/views/customer/customerFile/customerInfo/components/addContactDialog.vue

@@ -30,10 +30,8 @@
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="采购角色" prop="roleId">
-            <el-select v-model="form.roleId" placeholder="请选择" class="w-full">
-              <el-option label="采购经理" value="1" />
-              <el-option label="财务" value="2" />
-              <el-option label="其他" value="3" />
+            <el-select v-model="form.roleId" placeholder="请选择采购角色" clearable filterable style="width: 100%" @change="handleRoleChange">
+              <el-option v-for="role in roleOptions" :key="role.roleId" :label="role.roleName" :value="role.roleId" />
             </el-select>
           </el-form-item>
         </el-col>
@@ -79,6 +77,8 @@
 
 <script setup lang="ts">
 import type { CustomerContactForm } from '@/api/customer/customerFile/customerContact/types';
+import { listRole } from '@/api/system/role';
+import type { RoleVO } from '@/api/system/role/types';
 import { regionData } from 'element-china-area-data';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { sys_platform_yes_no, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_platform_yes_no', 'sys_user_sex'));
@@ -92,6 +92,8 @@ interface Emits {
   (e: 'confirm', data: CustomerContactForm): void;
 }
 
+const roleOptions = ref<RoleVO[]>([]);
+
 const props = withDefaults(defineProps<Props>(), {
   modelValue: false,
   editData: undefined
@@ -113,6 +115,7 @@ const form = reactive<CustomerContactForm>({
   officePhoneTwo: '',
   gender: '0',
   roleId: undefined,
+  roleName: '',
   deptId: undefined,
   email: '',
   isPrimary: '1',
@@ -135,6 +138,11 @@ const rules = {
   addressDetail: [{ required: true, message: '请输入详细地址', trigger: 'blur' }]
 };
 
+const handleRoleChange = (roleId: string | number) => {
+  const role = roleOptions.value.find((r) => r.roleId === roleId);
+  form.roleName = role?.roleName;
+};
+
 // 监听编辑数据
 watch(
   () => props.editData,
@@ -180,6 +188,24 @@ const handleChange = (val: string[]) => {
   form.provincialCityCounty = names.join('/');
 };
 
+/** 加载角色列表 */
+const loadRoleOptions = async () => {
+  try {
+    const res: any = await listRole({
+      pageNum: 1,
+      pageSize: 9999,
+      roleName: '',
+      roleKey: '',
+      status: ''
+    } as any);
+
+    roleOptions.value = res?.rows || res?.data?.rows || res?.data || [];
+  } catch (error) {
+    console.error('加载角色列表失败:', error);
+    roleOptions.value = [];
+  }
+};
+
 // 确认
 const handleConfirm = async () => {
   try {
@@ -191,6 +217,10 @@ const handleConfirm = async () => {
   }
 };
 
+onMounted(() => {
+  loadRoleOptions();
+});
+
 // 关闭
 const handleClose = () => {
   formRef.value?.resetFields();

+ 9 - 5
src/views/customer/customerFile/customerInfo/overview/procurementProfile.vue

@@ -187,6 +187,7 @@ const dialog = reactive<DialogOption>({
 
 const initFormData: PurchaseHabitForm = {
   id: undefined,
+  customerId: undefined,
   customerNo: undefined,
   monthPurchase: undefined,
   yearPurchase: undefined,
@@ -208,6 +209,7 @@ const data = reactive<PageData<PurchaseHabitForm, PurchaseHabitQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
+    customerId: undefined,
     customerNo: undefined,
     monthPurchase: undefined,
     yearPurchase: undefined,
@@ -244,11 +246,11 @@ const getList = async () => {
 
 /** 加载客户采购画像数据 */
 const loadCustomerPurchaseData = async () => {
-  if (!props.customerNo) return;
+  if (!props.customerId) return;
 
   try {
     loading.value = true;
-    const res = await getCustomerPurchaseHabitData(props.customerNo);
+    const res = await getCustomerPurchaseHabitData(props.customerId);
     if (res.data) {
       Object.assign(form.value, res.data);
 
@@ -272,6 +274,7 @@ const loadCustomerPurchaseData = async () => {
       }
     } else {
       // 如果没有数据,设置客户编号并初始化数组
+      form.value.customerId = props.customerId;
       form.value.customerNo = props.customerNo;
       purchaseCategoryArr.value = [];
       adaptSceneArr.value = [];
@@ -280,6 +283,7 @@ const loadCustomerPurchaseData = async () => {
   } catch (error) {
     console.error('加载采购画像数据失败:', error);
     // 如果加载失败,设置客户编号并初始化数组
+    form.value.customerId = props.customerId;
     form.value.customerNo = props.customerNo;
     purchaseCategoryArr.value = [];
     adaptSceneArr.value = [];
@@ -349,9 +353,9 @@ onMounted(() => {
 
 // 监听props变化
 watch(
-  () => props.customerNo,
-  (newCustomerNo) => {
-    if (newCustomerNo) {
+  () => props.customerId,
+  (newCustomerId) => {
+    if (newCustomerId) {
       loadCustomerPurchaseData();
     }
   }

+ 4 - 4
src/views/customer/customerFile/customerInfo/overview/shippingAddress.vue

@@ -14,7 +14,7 @@
       <el-table v-loading="loading" border :data="shippingAddressList" @selection-change="handleSelectionChange">
         <el-table-column label="收货地址编号" align="center" prop="shippingAddressNo" />
         <el-table-column label="收货人" align="center" prop="consignee" />
-        <el-table-column label="部门名称" align="center" prop="deptName" />
+        <!-- <el-table-column label="部门名称" align="center" prop="deptName" /> -->
         <el-table-column label="手机号码" align="center" prop="phone" />
         <el-table-column label="详细地址" align="center" prop="address" />
         <el-table-column label="默认地址" align="center" prop="defaultAddress">
@@ -47,9 +47,9 @@
         <el-form-item label="收货人" prop="consignee">
           <el-input v-model="form.consignee" placeholder="请输入收货人姓名" />
         </el-form-item>
-        <el-form-item label="部门名称" prop="deptName">
+        <!-- <el-form-item label="部门名称" prop="deptName">
           <el-input v-model="form.deptName" placeholder="请输入部门名称" />
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="手机号码" prop="phone">
           <el-input v-model="form.phone" placeholder="请输入联系电话" />
         </el-form-item>
@@ -57,7 +57,7 @@
           <el-input v-model="form.postal" placeholder="请输入邮政编码" />
         </el-form-item>
         <el-form-item label="详细地址" prop="provincialCityCountry">
-          <el-cascader v-model="codeArr" :options="regionData" placeholder="请选择" @change="handleChange" style="width: 100%"></el-cascader>
+          <el-cascader v-model="codeArr" :options="regionData as any" placeholder="请选择" @change="handleChange" style="width: 100%"></el-cascader>
         </el-form-item>
         <el-form-item prop="address">
           <el-input v-model="form.address" type="textarea" placeholder="请输入内容" />

+ 31 - 9
src/views/order/orderMain/index.vue

@@ -22,7 +22,12 @@
           <el-col :span="8">
             <el-form-item label="归属公司" prop="companyId">
               <el-select v-model="form.companyId" placeholder="请选择" style="width: 100%" filterable>
-                <el-option v-for="company in companyList" :key="company.id" :label="company.companyName" :value="company.id" />
+                <el-option
+                  v-for="company in companyList"
+                  :key="company.id"
+                  :label="`${company.companyCode} , ${company.companyName}`"
+                  :value="company.id"
+                />
               </el-select>
             </el-form-item>
           </el-col>
@@ -37,7 +42,12 @@
                 :loading="customerLoading"
                 @change="handleCustomerChange"
               >
-                <el-option v-for="customer in customerList" :key="customer.id" :label="customer.customerName" :value="customer.id" />
+                <el-option
+                  v-for="customer in customerList"
+                  :key="customer.id"
+                  :label="`${customer.customerNo} , ${customer.customerName}`"
+                  :value="customer.id"
+                />
               </el-select>
             </el-form-item>
           </el-col>
@@ -81,10 +91,7 @@
           <!-- 第四行 -->
           <el-col :span="8">
             <el-form-item label="发票类型" prop="invoiceType">
-              <el-select v-model="form.invoiceType" placeholder="请选择" style="width: 100%" disabled>
-                <el-option label="普通发票" value="1" />
-                <el-option label="增值税发票" value="2" />
-              </el-select>
+              <el-select v-model="form.invoiceType" placeholder="请选择" style="width: 100%" disabled> </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -332,6 +339,7 @@ import { OrderMainVO, OrderMainQuery, OrderMainForm } from '@/api/order/orderMai
 import FileSelector from '@/components/FileSelector/index.vue';
 import { listCompany } from '@/api/company/company';
 import { listCustomerDept } from '@/api/system/dept';
+import { getInvoiceType } from '@/api/customer/invoiceType';
 import { CompanyVO } from '@/api/company/company/types';
 import { listWarehouse, getWarehouse } from '@/api/company/warehouse';
 import { WarehouseVO, WarehouseQuery } from '@/api/company/warehouse/types';
@@ -346,7 +354,6 @@ import SelectProductDetail from './components/selectProductDetail.vue';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { order_status, fee_type, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'fee_type', 'pay_method'));
-import { regionData } from 'element-china-area-data';
 const buttonLoading = ref(false);
 const loading = ref(true);
 const ids = ref<Array<string | number>>([]);
@@ -664,8 +671,8 @@ const submitForm = () => {
         }));
 
         if (form.value.payType == '0') {
-          //如果选项信用支付  则订单状态为待发货
-          form.value.orderStatus = '2';
+          //如果选项信用支付  则订单状态为待待确认
+          form.value.orderStatus = '1';
         }
 
         // 组装提交数据
@@ -909,6 +916,7 @@ const handleCustomerChange = async (customerId: string | number) => {
     form.value.businessStaff = undefined;
     form.value.customerService = undefined;
     form.value.businessDept = undefined;
+    form.value.invoiceType === undefined;
     customerDeptList.value = [];
     // 清空收货地址显示信息
     addressDisplay.value = {
@@ -937,6 +945,9 @@ const handleCustomerChange = async (customerId: string | number) => {
     // 获取客户部门列表
     await getCustomerDeptList(customerId);
 
+    // 获取客户开票类型信息
+    getCustmerInvoiceType(customerInfo.invoiceTypeId);
+
     // 获取客户收货地址列表
     await loadAddressList(customerId);
   } catch (error) {
@@ -956,6 +967,17 @@ const getCustomerDeptList = async (customerId: string | number) => {
   }
 };
 
+/** 获取客户开票类型信息 */
+const getCustmerInvoiceType = async (invoiceTypeId: string | number) => {
+  try {
+    const res = await getInvoiceType(invoiceTypeId);
+    form.value.invoiceType = res.data.invoiceTypeNo + ',' + res.data.invoiceTypeName;
+  } catch (error) {
+    console.error('获取客户开票类型信息失败:', error);
+    form.value.invoiceType = '';
+  }
+};
+
 // 加载地址列表
 const loadAddressList = async (customerId: string | number) => {
   if (!customerId) {

+ 14 - 1
src/views/order/saleOrder/index.vue

@@ -40,7 +40,7 @@
     <el-card shadow="never">
       <template #header>
         <el-row :gutter="10" class="mb8">
-          <el-col :span="15"> 销售订单信息列表 </el-col>
+          <el-col :span="13"> 销售订单信息列表 </el-col>
           <el-col :span="1.5">
             <el-button type="primary" @click="handleCloseOrder()" :disabled="!ids.length" plain>关闭订单</el-button>
           </el-col>
@@ -383,6 +383,13 @@ const handleReview = (row?: OrderMainVO) => {
   });
 };
 
+const handleAffirm = (row?: OrderMainVO) => {
+  router.push({
+    path: '/order-manage/order-affirm',
+    query: { id: row.id }
+  });
+};
+
 /** 审核按钮操作 */
 const handleCheck = async (row?: OrderMainVO) => {
   const oldValue = row.checkStatus; // 保存旧值
@@ -580,6 +587,12 @@ const getButtonsByStatus = (orderStatus: string, checkStatus: string): ActionBut
   // 待支付状态:显示查看按钮
   if (orderStatus === OrderStatus.PENDING_PAYMENT) {
     buttons.push({ label: '查看', handler: handleReview });
+    buttons.push({ label: '确认订单', handler: handleAffirm });
+  }
+  // 待确认状态:显示确认订单按钮
+  if (orderStatus === OrderStatus.PENDING_CONFIRM) {
+    buttons.push({ label: '查看', handler: handleReview });
+    buttons.push({ label: '确认订单', handler: handleAffirm });
   }
 
   // 待审核:显示审核按钮

+ 551 - 0
src/views/order/saleOrder/orderAffirm.vue

@@ -0,0 +1,551 @@
+<template>
+  <div class="p-2">
+    <!-- 订单流程 -->
+    <el-card shadow="never" class="mb-2">
+      <div class="order-steps">
+        <span class="step-title">订单确认</span>
+      </div>
+    </el-card>
+
+    <!-- 订单基本信息 -->
+    <el-card shadow="never" class="mb-2">
+      <template #header>
+        <div class="card-header">
+          <span>订单基本信息</span>
+          <span> 订单日期:{{ orderInfo.orderTime }}</span>
+        </div>
+      </template>
+
+      <el-form ref="orderMainFormRef" :model="orderInfo" label-width="100px">
+        <el-row :gutter="20">
+          <!-- 第一行 -->
+          <el-col :span="8">
+            <el-form-item label="归属公司">
+              <el-input :value="orderInfo.companyName || orderInfo.companyId" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="客户名称">
+              <el-input :value="orderInfo.customerName || orderInfo.customerId" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第二行 -->
+          <el-col :span="8"> </el-col>
+          <el-col :span="8">
+            <el-form-item label="信用额度">
+              <el-input v-model="orderInfo.creditLimit" placeholder="0" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="剩余额度">
+              <el-input value="0" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第三行 -->
+          <el-col :span="8">
+            <el-form-item label="业务人员">
+              <el-input v-model="orderInfo.businessStaff" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="客服人员">
+              <el-input v-model="orderInfo.customerService" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="业务部门">
+              <el-input v-model="orderInfo.businessDept" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第四行 -->
+          <el-col :span="8">
+            <el-form-item label="发票类型">
+              <el-select v-model="orderInfo.invoiceType" placeholder="请选择" style="width: 100%" disabled>
+                <el-option label="普通发票" value="1" />
+                <el-option label="增值税发票" value="2" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="支付方式">
+              <el-select v-model="orderInfo.payType" placeholder="请选择" style="width: 100%" disabled>
+                <el-option v-for="dict in pay_method" :key="dict.value" :label="dict.label" :value="dict.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="预收货日">
+              <el-date-picker
+                v-model="orderInfo.expectedDeliveryTime"
+                type="date"
+                placeholder="请选择"
+                value-format="YYYY-MM-DD"
+                style="width: 100%"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第五行 -->
+          <el-col :span="8">
+            <el-form-item label="发货仓库">
+              <el-input :value="orderInfo.warehouseName || orderInfo.warehouseId" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="费用类型">
+              <el-select v-model="orderInfo.expenseType" style="width: 100%" disabled>
+                <el-option v-for="dict in fee_type" :key="dict.value" :label="dict.label" :value="dict.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="下单部门">
+              <el-input :value="orderInfo.userDeptName || orderInfo.userDept" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第六行 -->
+          <el-col :span="24">
+            <el-form-item label="采购事由">
+              <el-input v-model="orderInfo.purchaseReason" placeholder="请输入采购事由" type="textarea" :rows="2" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row :gutter="20">
+          <!-- 第七行 -->
+          <el-col :span="24">
+            <el-form-item label="订单备注">
+              <el-input v-model="orderInfo.remark" placeholder="请输入订单备注" type="textarea" :rows="2" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-card>
+
+    <!-- 收货地址 -->
+    <el-card shadow="never" class="mb-2">
+      <template #header>
+        <div class="card-header">
+          <span>收货地址</span>
+        </div>
+      </template>
+
+      <el-form :model="addressInfo" label-width="100px">
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="收货人姓名">
+              <el-input v-model="addressInfo.consignee" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="手机号码">
+              <el-input v-model="addressInfo.phone" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="详细地址">
+              <el-input v-model="addressInfo.provincialCityCountry" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item>
+              <el-input v-model="addressInfo.address" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-card>
+
+    <!-- 商品明细 -->
+    <el-card shadow="never" class="mb-2">
+      <template #header>
+        <div class="card-header">
+          <span>商品明细</span>
+        </div>
+      </template>
+      <el-table :data="productList" border style="width: 100%">
+        <el-table-column prop="productCode" label="产品编码" width="130" align="center" />
+        <el-table-column label="商品图片" align="center">
+          <template #default="scope">
+            <el-image v-if="scope.row.productImage" :src="scope.row.productImage" style="width: 60px; height: 60px" fit="cover" />
+            <span v-else>暂无图片</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="商品信息">
+          <template #default="scope">
+            <div>{{ scope.row.productName }}</div>
+            <div v-if="scope.row.brandName">品牌: {{ scope.row.brandName }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="taxRate" label="税率" align="center">
+          <template #default="scope"> 增值税{{ scope.row.taxRate }}% </template>
+        </el-table-column>
+        <el-table-column prop="productUnit" label="单位" align="center" />
+        <el-table-column prop="minSellingPrice" label="最低售价" align="center" />
+        <el-table-column prop="minOrderQuantity" label="起订量" align="center" />
+        <el-table-column prop="unitPrice" label="含税单价" align="center">
+          <template #default="scope"> ¥{{ Number(scope.row.unitPrice || 0).toFixed(2) }} </template>
+        </el-table-column>
+        <el-table-column prop="orderQuantity" label="数量" align="center">
+          <template #default="scope">
+            <el-input-number
+              v-model="scope.row.orderQuantity"
+              :min="1"
+              :precision="0"
+              :controls="false"
+              @change="handleQuantityChange(scope.$index)"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column prop="amount" label="小计" align="center">
+          <template #default="scope"> ¥{{ calculateSubtotal(scope.row).toFixed(2) }} </template>
+        </el-table-column>
+      </el-table>
+
+      <div class="mt-2 text-right">
+        <span>商品数:{{ totalQuantity }} 合计金额:¥ {{ totalAmount.toFixed(2) }}</span>
+      </div>
+    </el-card>
+
+    <!-- 信息汇总 -->
+    <el-card shadow="never" class="mb-2">
+      <template #header>
+        <div class="card-header">
+          <span>信息汇总</span>
+        </div>
+      </template>
+
+      <el-table :data="summaryData" border style="width: 100%">
+        <el-table-column prop="quantity" label="商品数量" align="center" />
+        <el-table-column prop="shippingFee" label="运费" align="center" />
+        <el-table-column prop="totalAmount" label="订单总金额" align="center" />
+        <el-table-column prop="payableAmount" label="应付款金额" align="center" />
+      </el-table>
+    </el-card>
+
+    <!-- 底部按钮 -->
+    <div class="text-center mt-4">
+      <el-button @click="goBack">返回</el-button>
+      <el-button type="primary" :loading="buttonLoading" @click="confirmOrder">确认订单</el-button>
+    </div>
+  </div>
+</template>
+
+<script setup name="OrderAffirm" lang="ts">
+import { getOrderMain, orderAffirm } from '@/api/order/orderMain';
+import { OrderMainVO } from '@/api/order/orderMain/types';
+import { getShippingAddress } from '@/api/customer/customerFile/shippingAddress';
+import { getCompany } from '@/api/company/company';
+import { getWarehouse } from '@/api/company/warehouse';
+import { getCustomerInfo } from '@/api/customer/customerFile/customerInfo';
+import { getDept } from '@/api/system/dept';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { pay_method, fee_type } = toRefs<any>(proxy?.useDict('pay_method', 'fee_type'));
+const router = useRouter();
+
+const buttonLoading = ref(false);
+const loading = ref(true);
+
+// 订单信息
+const orderInfo = ref<any>({});
+// 收货地址信息
+const addressInfo = ref<any>({});
+// 商品列表
+const productList = ref<any[]>([]);
+
+// 计算商品总数
+const totalQuantity = computed(() => {
+  return productList.value.reduce((sum, item) => {
+    return sum + (Number(item.orderQuantity) || 0);
+  }, 0);
+});
+
+// 计算商品总金额
+const totalAmount = computed(() => {
+  return productList.value.reduce((sum, item) => {
+    return sum + calculateSubtotal(item);
+  }, 0);
+});
+
+// 计算应付款金额(订单总金额 + 运费)
+const payableAmount = computed(() => {
+  const shipping = Number(orderInfo.value.shippingFee) || 0;
+  return totalAmount.value + shipping;
+});
+
+// 汇总数据(用于表格显示)
+const summaryData = computed(() => {
+  return [
+    {
+      quantity: totalQuantity.value,
+      shippingFee: `¥${(Number(orderInfo.value.shippingFee) || 0).toFixed(2)}`,
+      totalAmount: `¥${totalAmount.value.toFixed(2)}`,
+      payableAmount: `¥${payableAmount.value.toFixed(2)}`
+    }
+  ];
+});
+
+// 计算单个商品小计
+const calculateSubtotal = (product: any) => {
+  return Number(product.orderQuantity || 0) * Number(product.unitPrice || 0);
+};
+
+// 数量变化时重新计算
+const handleQuantityChange = (index: number) => {
+  // 数量变化时自动重新计算小计
+  const product = productList.value[index];
+  if (product) {
+    // 确保数量至少为1
+    if (product.orderQuantity < 1) {
+      product.orderQuantity = 1;
+    }
+  }
+};
+
+// 获取公司详细信息
+const getCompanyDetail = async (companyId: string | number) => {
+  try {
+    const res = await getCompany(companyId);
+    return res.data?.companyName || companyId;
+  } catch (error) {
+    console.error('获取公司信息失败:', error);
+    return companyId;
+  }
+};
+
+// 获取仓库详细信息
+const getWarehouseDetail = async (warehouseId: string | number) => {
+  try {
+    const res = await getWarehouse(warehouseId);
+    return res.data?.warehouseName || warehouseId;
+  } catch (error) {
+    console.error('获取仓库信息失败:', error);
+    return warehouseId;
+  }
+};
+
+// 获取收货地址详细信息
+const getShippingAddressDetail = async (addressId: string | number) => {
+  try {
+    const res = await getShippingAddress(addressId);
+    return res.data;
+  } catch (error) {
+    console.error('获取收货地址失败:', error);
+    return null;
+  }
+};
+
+// 获取客户详细信息
+const getCustomerDetail = async (customerId: string | number) => {
+  try {
+    const res = await getCustomerInfo(customerId);
+    return res.data?.customerName || customerId;
+  } catch (error) {
+    console.error('获取客户信息失败:', error);
+    return customerId;
+  }
+};
+
+// 获取部门详细信息
+const getDeptDetail = async (deptId: string | number) => {
+  try {
+    const res = await getDept(deptId);
+    return res.data?.deptName || deptId;
+  } catch (error) {
+    console.error('获取部门信息失败:', error);
+    return deptId;
+  }
+};
+
+// 获取订单详情
+const getOrderDetail = async (orderId: string | number) => {
+  try {
+    loading.value = true;
+    const res = await getOrderMain(orderId);
+    const data = res.data;
+
+    // 设置订单基本信息
+    orderInfo.value = data || {};
+
+    // 获取并设置公司名称
+    if (data?.companyId) {
+      const companyName = await getCompanyDetail(data.companyId);
+      orderInfo.value.companyName = companyName;
+    }
+
+    // 获取并设置客户名称
+    if (data?.customerId) {
+      const customerName = await getCustomerDetail(data.customerId);
+      orderInfo.value.customerName = customerName;
+    }
+
+    // 获取并设置仓库名称
+    if (data?.warehouseId) {
+      const warehouseName = await getWarehouseDetail(data.warehouseId);
+      orderInfo.value.warehouseName = warehouseName;
+    }
+
+    // 获取并设置下单部门名称
+    if (data?.userDept) {
+      const deptName = await getDeptDetail(data.userDept);
+      orderInfo.value.userDeptName = deptName;
+    }
+
+    // 设置收货地址信息
+    if ((data as any)?.shippingAddressVo) {
+      addressInfo.value = (data as any).shippingAddressVo;
+    } else if (data?.shippingAddressId) {
+      // 如果没有地址对象,调用API获取地址详情
+      const addressDetail = await getShippingAddressDetail(data.shippingAddressId);
+      if (addressDetail) {
+        addressInfo.value = addressDetail;
+      } else {
+        addressInfo.value = { ...addressInfo.value, id: data.shippingAddressId };
+      }
+    }
+
+    // 设置商品列表 - 支持多种可能的字段名
+    let products = [];
+    if ((data as any)?.orderProductVoList && (data as any).orderProductVoList.length > 0) {
+      products = (data as any).orderProductVoList;
+    } else if ((data as any)?.orderProductList && (data as any).orderProductList.length > 0) {
+      products = (data as any).orderProductList;
+    } else if ((data as any)?.productList && (data as any).productList.length > 0) {
+      products = (data as any).productList;
+    }
+
+    if (products.length > 0) {
+      productList.value = products.map((product: any) => ({
+        ...product,
+        // 确保有正确的数量字段
+        orderQuantity: product.orderQuantity || product.quantity || 1,
+        // 确保有正确的单价字段
+        unitPrice: product.unitPrice || product.orderPrice || product.price || 0,
+        // 确保有正确的产品编码字段
+        productCode: product.productCode || product.productNo || product.code || '',
+        // 确保有正确的产品名称字段
+        productName: product.productName || product.name || '',
+        // 确保有正确的单位字段
+        unitName: product.unitName || product.unit || ''
+      }));
+      console.log('商品列表数据:', productList.value); // 调试日志
+    }
+  } catch (error) {
+    console.error('获取订单详情失败:', error);
+    proxy?.$modal.msgError('获取订单详情失败');
+  } finally {
+    loading.value = false;
+  }
+};
+
+// 确认订单
+const confirmOrder = async () => {
+  // 验证商品数量
+  for (const product of productList.value) {
+    if (!product.orderQuantity || product.orderQuantity <= 0) {
+      proxy?.$modal.msgError('商品数量必须大于0');
+      return;
+    }
+  }
+
+  try {
+    buttonLoading.value = true;
+
+    // 组装商品数据
+    const orderProductBos = productList.value.map((product) => ({
+      id: product.id,
+      orderQuantity: product.orderQuantity
+    }));
+
+    // 调用确认订单接口
+    await orderAffirm({
+      id: orderInfo.value.id,
+      orderProductBos: orderProductBos
+    } as any);
+
+    proxy?.$modal.msgSuccess('订单确认成功');
+
+    // 返回订单列表
+    router.push('/order-manage/order-list');
+  } catch (error) {
+    console.error('确认订单失败:', error);
+    proxy?.$modal.msgError('确认订单失败,请重试');
+  } finally {
+    buttonLoading.value = false;
+  }
+};
+
+// 返回上一页
+const goBack = () => {
+  router.back();
+};
+
+// 页面加载时获取订单ID并加载订单详情
+onMounted(() => {
+  const route = useRoute();
+  const orderId = route.query.id;
+  if (orderId) {
+    getOrderDetail(orderId as string);
+  } else {
+    proxy?.$modal.msgError('缺少订单ID参数');
+    router.back();
+  }
+});
+</script>
+
+<style scoped lang="scss">
+.order-steps {
+  padding: 10px 0;
+
+  .step-title {
+    font-size: 16px;
+    font-weight: bold;
+    color: #303133;
+  }
+}
+
+.card-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  font-weight: bold;
+}
+
+.mb-2 {
+  margin-bottom: 16px;
+}
+
+.mt-2 {
+  margin-top: 16px;
+}
+
+.mt-4 {
+  margin-top: 32px;
+}
+
+.text-right {
+  text-align: right;
+}
+
+.text-center {
+  text-align: center;
+}
+</style>