浏览代码

提交报价管理新增类型字段,类型判断显示新字段

hezhanp 7 月之前
父节点
当前提交
8b49ef83e4

文件差异内容过多而无法显示
+ 277 - 352
src/BIZComponents/inventoryTable.vue


文件差异内容过多而无法显示
+ 1482 - 780
src/BIZComponents/inventoryTableDetails.vue


+ 14 - 35
src/BIZComponents/setProduct.js

@@ -1,11 +1,9 @@
 import Vue from 'vue';
 
 //改变数量
-export function changeCount(row, countObj, noDiscountSingle, quoteType = 1) {
-  let total = row[countObj.countKey] || 0; // 基础数量
+export function changeCount(row, countObj, noDiscountSingle) {
+  let total = row[countObj.countKey] || 0;
   let data = row;
-
-  // 处理包装规格转换(保持原有逻辑)
   if (row.packageDispositionList) {
     let endIndex = row.packageDispositionList.findIndex(
       (ite) => row[countObj.unitIdKey] == ite.id
@@ -17,38 +15,15 @@ export function changeCount(row, countObj, noDiscountSingle, quoteType = 1) {
       );
     }
   }
-  data['totalCount'] = total; // 转换后的总数量
 
-  // 折让单价逻辑(保持原有)
+  data['totalCount'] = total;
   data['discountSinglePrice'] = !noDiscountSingle
     ? data.singlePrice
     : data.discountSinglePrice;
 
-  // 计算总重量(保持原有)
   setWeight(data);
-
-  // 核心:计算合计(totalPrice)
-  // 1. 确定使用的单价:生产加工类型用含税单价,其他用singlePrice
-  const basePrice =
-    quoteType === 2
-      ? Number(row.includingTaxPrice) || 0 // 生产加工:用含税单价
-      : Number(row.singlePrice) || 0; // 其他类型:用原单价
-
-  // 2. 根据计价方式计算合计
-  if (row[countObj.countKey] && basePrice) {
-    if (row.pricingWay === 1) {
-      // 按数量计价:数量 * 单价
-      data['totalPrice'] = Number(row[countObj.countKey]) * basePrice;
-    } else if (row.pricingWay === 2) {
-      // 按重量计价:数量 * 单重 * 单价
-      data['totalPrice'] =
-        Number(row[countObj.countKey]) *
-        (Number(row.singleWeight) || 0) *
-        basePrice;
-    } else {
-      data['totalPrice'] = 0;
-    }
-    // 折让合计逻辑(保持原有)
+  if (row[countObj.countKey] && row.singlePrice) {
+    data['totalPrice'] = row[countObj.countKey] * row.singlePrice;
     data['discountTotalPrice'] = !noDiscountSingle
       ? data.totalPrice
       : data.discountTotalPrice;
@@ -56,8 +31,12 @@ export function changeCount(row, countObj, noDiscountSingle, quoteType = 1) {
     data['totalPrice'] = 0;
     data['discountTotalPrice'] = 0;
   }
-
+  // getNotaxSinglePrice(data);
   return data;
+  // if (row) {
+  //   singleWeightChange(row, index);
+  // }
+  // return getNumTotalPrice(arr, noDiscountSingle);
 }
 function setWeight(row) {
   if (row.weightUnit == row.measuringUnit) {
@@ -71,11 +50,11 @@ function setWeight(row) {
 export function getAllPrice(arr) {
   let sum = 0;
   arr.forEach((item) => {
-    // 累加所有行的合计(totalPrice),兼容可能的非数字情况
-    sum += Number(item.totalPrice) || 0;
+    if (item.totalPrice) {
+      sum += Number(item.totalPrice);
+    }
   });
-  // 保留两位小数,避免NaN
-  return isNaN(sum) ? '0.00' : sum.toFixed(2);
+  return isNaN(sum) ? 0 : sum.toFixed(2);
 }
 // //计算不含税单价
 // function getNotaxSinglePrice(row) {

+ 9 - 4
src/views/salesServiceManagement/components/productDialog.vue

@@ -241,11 +241,16 @@ export default {
       const res = await getProductList(this.searchForm);
       let list = res.list.map((el) => {
         return {
-          categoryModel: el.modelType,
-          categoryName: el.name,
-          categoryCode: el.code,
+          categoryModel: el.modelType, // 型号
+          categoryName: el.name, // 名称
+          categoryCode: el.code, // 编码
           categoryLevelPath: el.categoryLevelPath,
-          id: el.id
+          id: el.id,
+          // 补充以下映射
+          specification: el.specification, // 规格
+          level: el.level, // 级别
+          weight: el.netWeight, // 重量(取净重)
+          weightUnit: el.weightUnit // 重量单位
         };
       });
       this.tableData = list;

+ 93 - 137
src/views/salesServiceManagement/demandList/index.vue

@@ -64,20 +64,6 @@
             v-if="btnShow(row) && $hasPermission('eom:aftersalesdemand:submit')"
             >提交</el-link
           >
-          <!-- <el-popconfirm
-            v-if="row.demandStatus == 1"
-            class="ele-action"
-            title="确定要撤回此售后需求吗?"
-            @confirm="handleCommand('handleRevoke', row)"
-          >
-            <template v-slot:reference>
-              <el-link
-                type="primary"
-                :underline="false"
-                >撤回</el-link
-              >
-            </template>
-          </el-popconfirm> -->
           <el-popconfirm
             v-if="btnShow(row) && $hasPermission('eom:aftersalesdemand:close')"
             class="ele-action"
@@ -89,20 +75,6 @@
             </template>
           </el-popconfirm>
 
-          <!-- <el-dropdown
-            @command="(command) => handleCommand(command, row)"
-            v-if="row.demandStatus == 0"
-          >
-            <span class="el-dropdown-link">
-              操作菜单
-              <i class="el-icon-arrow-down el-icon--right"></i>
-            </span>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item command="handleRevoke">撤回</el-dropdown-item>
-              <el-dropdown-item command="handleAudit">提交</el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown> -->
-
           <el-link
             v-if="dispatchShow(row)"
             type="primary"
@@ -120,64 +92,19 @@
       :dialogTitle="addDialogTitle"
       @refresh="reload"
     />
-    <!-- 审核弹窗 -->
-    <!-- <ele-modal
-      :centered="true"
-      :visible.sync="auditDialog"
-      title="审核"
-      :close-on-click-modal="false"
-      width="25%"
-      append-to-body
-      @close="handleClose"
-    >
-      <el-form ref="form" :model="formData">
-        <el-form-item
-          prop="approvalResult"
-          label="审核结果"
-          :rules="{
-            required: true,
-            message: '请选择',
-            trigger: 'change'
-          }"
-        >
-          <el-select
-            v-model="formData.approvalResult"
-            placeholder="请选择"
-            style="width: 100%"
-            clearable
-          >
-            <el-option
-              v-for="item in approvalResultOptions"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item
-          prop="rejectCause"
-          label="审核意见"
-          :rules="{
-            required: formData.approvalResult == 0,
-            message: '请输入',
-            trigger: 'change'
-          }"
-        >
-          <el-input
-            v-model="formData.rejectCause"
-            placeholder="请输入"
-            type="textarea"
-          ></el-input>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="footer">
-        <el-button type="primary" @click="handleSubmit">确认</el-button>
-        <el-button @click="handleClose">取消</el-button>
-      </div>
-    </ele-modal> -->
+    
     <SubmitDialog ref="submitRef" @savExit="reload" />
-
     <dispatchDialog ref="dispatchRef" @savExit="reload" />
+    
+    <!-- 流程提交对话框 -->
+    <process-submit-dialog
+      :isNotNeedProcess="false"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+      :callBack="processCallBack"
+    ></process-submit-dialog>
   </div>
 </template>
 
@@ -197,24 +124,27 @@ import {
   auditSalesDemand,
   revokeSalesDemand,
   closeDemand,
-  getSalesDemandById
+  getSalesDemandById,
+  demandSubmit
 } from '@/api/salesServiceManagement/index.js';
 import search from './components/searchTable.vue';
 import AddDialog from './components/addDialog.vue';
 import { getByCode } from '@/api/system/dictionary-data';
 import dictMixins from '@/mixins/dictMixins';
 import SubmitDialog from './components/submitDialog.vue';
-
 import dispatchDialog from './components/dispatchDialog.vue';
-
 import { contactDetail } from '@/api/saleManage/contact';
+import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+import { getCurrentUser } from '@/utils/token-util';
+
 export default {
   mixins: [dictMixins],
   components: {
     search,
     AddDialog,
     SubmitDialog,
-    dispatchDialog
+    dispatchDialog,
+    processSubmitDialog
   },
   data() {
     return {
@@ -351,8 +281,6 @@ export default {
       infoData: {},
       repairInfoLogs: [],
       addDialogTitle: '新建售后需求',
-      // auditDialog: false,
-
       rowData: {},
       formData: {
         approvalResult: null,
@@ -375,22 +303,23 @@ export default {
         associationType: '1'
       },
       kkform: {},
-
       afterSalesTypeMap: {},
-      afterSalesTypeList: []
+      afterSalesTypeList: [],
+      // 流程对话框相关
+      processSubmitDialogFlag: false,
+      processedData: null,
+      currentRow: null
     };
   },
   computed: {
     btnShow() {
       return (row) => {
-        // let flag = row.demandStatus  == 0;
         return row.demandStatus == 0;
       };
     },
     dispatchShow() {
       return (row) => {
         return !row.planStatus && row.afterSalesType !== 3;
-        // console.log(row);
       };
     }
   },
@@ -469,35 +398,76 @@ export default {
       });
     },
     handleAudit(row) {
-      this.$refs.submitRef.open(row, 'list', '列表');
-      // this.auditDialog = true;
-      // this.rowData = row;
+      // 判断售后类型是否为3
+      if (row.afterSalesType === '3' || row.afterSalesType === 3) {
+        this.currentRow = row;
+        this.prepareProcessSubmit();
+      } else {
+        this.$refs.submitRef.open(row, 'list', '列表');
+      }
+    },
+    // 准备流程提交
+    async prepareProcessSubmit() {
+      try {
+        const detailRes = await getSalesDemandById(this.currentRow.id);
+        if (!detailRes) {
+          this.$message.error('获取详情失败');
+          return;
+        }
+        
+        this.processedData = {
+          id: this.currentRow.id,
+          submitSource: 3 // 标识来自列表提交
+        };
+        
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          const processParams = {
+            businessKey: 'after_sale_quality_issues_feedback',
+            formCreateUserId: getCurrentUser().id
+          };
+          this.$refs.processSubmitDialogRef.init(processParams);
+        });
+      } catch (error) {
+        this.$message.error('准备提交失败:' + (error.message || '未知错误'));
+      }
     },
-    // handleClose() {
-    //   this.auditDialog = false;
-    // },
-    // async handleSubmit() {
-    //   this.$refs.form.validate(async (valid) => {
-    //     if (valid) {
-    //       const data = this.$store.state.user.info;
+    // 流程对话框的回调函数
+    async processCallBack() {
+      try {
+        if (!this.processedData || !this.currentRow) {
+          this.$message.error('未获取到提交数据');
+          return 1;
+        }
+
+        // 调用提交接口
+        const businessId = await demandSubmit(this.processedData);
+        if (!businessId) {
+          this.$message.error('提交失败,未获取到业务ID');
+          return 1;
+        }
+
+        // 获取详情
+        const detailRes = await getSalesDemandById(businessId);
+        if (!detailRes) {
+          this.$message.error('获取详情失败');
+          return 1;
+        }
+
+        // 更新流程对话框的表单数据
+        this.$refs.processSubmitDialogRef.form.businessId = businessId;
+        this.$refs.processSubmitDialogRef.form.variables = {
+          businessCode: detailRes.code,
+          businessName: detailRes.name,
+          businessType: '质量问题反馈'
+        };
 
-    //       let pdata = {
-    //         id: this.rowData.id,
-    //         approvalResult: this.formData.approvalResult,
-    //         rejectCause: this.formData.rejectCause,
-    //         approvalUserId: data.userId,
-    //         approvalUserName: data.name
-    //       };
-    //       const res = await auditSalesDemand(pdata);
-    //       if (res) {
-    //         this.$message.success('审核成功!');
-    //         this.auditDialog = false;
-    //         this.reload();
-    //       }
-    //     }
-    //   });
-    // },
-    //
+        return 0; // 返回0表示成功
+      } catch (error) {
+        this.$message.error('提交失败:' + (error.message || '未知错误'));
+        return 1; // 返回1表示失败
+      }
+    },
     async closeRevoke(row) {
       const res = await closeDemand(row.id);
       if (!res) return;
@@ -511,7 +481,6 @@ export default {
       this.reload();
     },
     handleCommand(command, row) {
-      console.log(command,row)
       if (command === 'handleRevoke') {
         this.handleRevoke(row);
       }
@@ -523,7 +492,6 @@ export default {
       const res = await getSalesDemandById(id);
 
       this.dispatchForm = res;
-      // detailForm = res;
       let productDetail = res.productDetail ? res.productDetail : [];
       let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
       let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
@@ -544,9 +512,6 @@ export default {
         ? String(res.associationType)
         : '1';
       this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
-      // if (faultDetailList.length > 0) {
-      //   this.isOrder = true;
-      // }
     },
 
     async dispatchFn(row) {
@@ -573,23 +538,17 @@ export default {
         : '1';
       this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
 
-      // await this.dispatchFormFn(row.id);
       let pData = await this.handleParameter();
 
       if (!pData) {
         return;
       }
 
-      console.log(pData);
-
       this.$refs.dispatchRef.open(pData, 'dispatch');
-
-      // console.log(this.$refs.addDialogRef);
     },
     savExit() {},
     async contactDetail(id, type) {
       if (!id) {
-        // this.contractInfo = {};
         return;
       }
       let { base, other, linkList } = await contactDetail(id);
@@ -610,7 +569,6 @@ export default {
         return false;
       }
       try {
-        // let valid = await this.$refs.infoRef.getValidate();
         let expectedTime = data.expectedTime
           ? this.formatDate(data.expectedTime)
           : '';
@@ -632,7 +590,6 @@ export default {
           contactInfoVOS: data.contactInfoVOS,
           associationType: data.associationType
         };
-        // 如果选的销售订单并且 没有售后对象数据
         if (pData.associationType == '2' && pData.productDetail.length == 0) {
           delete pData.productDetail;
           pData.faultDetailList = data.faultDetailList;
@@ -644,7 +601,6 @@ export default {
         return pData;
       } catch (err) {}
     },
-    // 标准时间函数 ***
     formatDate(dateString) {
       const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
       if (isStandardFormat) {
@@ -660,7 +616,7 @@ export default {
         const day = String(date.getDate()).padStart(2, '0');
         return `${year}-${month}-${day}`;
       } catch (error) {
-        return dateString; // 转换失败时返回原始字符串
+        return dateString;
       }
     }
   }
@@ -685,4 +641,4 @@ export default {
     padding: 0 5px 0 10px;
   }
 }
-</style>
+</style>

部分文件因为文件数量过多而无法显示