Jelajahi Sumber

售后服务bug修改

jingshuyong 11 bulan lalu
induk
melakukan
9f4b2270c1

+ 21 - 0
src/api/salesServiceManagement/index.js

@@ -11,6 +11,15 @@ export async function getPageSalesDemand(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 关闭需求
+export async function closeDemand(id) {
+  const res = await request.post(`/eom/afterSalesDemand/close/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 //新增
 export async function saveSalesDemand(data) {
   const res = await request.post('/eom/afterSalesDemand/save', data);
@@ -422,3 +431,15 @@ export async function checkByWorkId(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 评论 校验当前登录人是否可以评论
+export async function afterSalesEvaluation(id) {
+  const res = await request.get(
+    `/eom/afterSalesEvaluation/checkByWorkId/${id}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 5
src/views/salesServiceManagement/components/applyForSpare.vue

@@ -239,7 +239,7 @@
           userName: '',
           purpose: '',
           userId: '',
-          useDeptId: '',
+          useDeptId: ''
         },
         rules: {},
         tableList: [],
@@ -328,7 +328,7 @@
           }
         ],
         executorList: [], // 使用人列表
-          receptionUserId:'', // 领用人id
+        receptionUserId: '' // 领用人id
       };
     },
 
@@ -361,12 +361,15 @@
         this.form.userName = data.name;
       },
       //选择部门(搜索)
-      searchDeptNodeClick(info, data) {
+      searchDeptNodeClick(info, data,type) {
         if (info) {
           // 根据部门获取人员
           this.form.useDeptName = data.name;
           const params = { groupId: info };
           this.getUserList(params);
+          if(type && type == 'init'){
+            return;
+          }
           this.form.userName = '';
           this.$set(this.form, 'userId', '');
         } else {
@@ -394,9 +397,11 @@
       },
       async getSalesWorkOrderDetail(row) {
         this.form = row || {};
-        console.log(row,'row')
         this.receptionUserId = row.receptionUserId;
         this.tableList = row.details || [];
+        let info = this.$store.state.user?.info;
+        this.$set(this.form, 'useDeptId', info.groupId);
+        this.searchDeptNodeClick(info.groupId, { name: info.groupName },'init');
       },
       del(id) {
         this.tableList = this.tableList.filter((item) => item.id != id);
@@ -450,7 +455,6 @@
                   businessType: '申请备品备件'
                 }
               };
-              console.log(params,'params ++++++ params')
               this.$refs.processSubmitDialogRef.init(params);
             });
             // this.$message({

+ 29 - 3
src/views/salesServiceManagement/components/info.vue

@@ -178,6 +178,29 @@
           :disabled="!tableOperate"
         ></el-input>
       </template>
+      <template v-slot:batchNo="{ row }">
+        <el-input
+          v-model="row.batchNo"
+          placeholder="请输入"
+          :disabled="!tableOperate"
+        ></el-input>
+      </template>
+      <template v-slot:barcodes="{ row }">
+        <el-input
+          v-model="row.barcodes"
+          placeholder="请输入"
+          :disabled="!tableOperate"
+        ></el-input>
+      </template>
+      <template v-slot:shipmentDate="{ row }">
+        <el-date-picker
+          v-model="row.shipmentDate"
+          type="datetime"
+          placeholder="选择结束时间"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+        ></el-date-picker>
+      </template>
       <template v-slot:expand="{ row, $index }">
         <div
           style="width: calc(100% - 55px); min-height: 60px; margin-left: 55px"
@@ -641,22 +664,25 @@
             showOverflowTooltip: true
           },
           {
+            slot: 'batchNo',
             prop: 'batchNo',
             label: '批次号',
             align: 'center',
-            showOverflowTooltip: true
+            minWidth: 135
           },
           {
+            slot: 'barcodes',
             prop: 'barcodes',
             label: '发货条码',
             align: 'center',
-            showOverflowTooltip: true
+            minWidth: 135
           },
           {
+            slot: 'shipmentDate',
             prop: 'shipmentDate',
             label: '发货时间',
             align: 'center',
-            showOverflowTooltip: true
+            minWidth: 180
           },
           {
             prop: 'guaranteePeriodDeadline',

+ 5 - 5
src/views/salesServiceManagement/demandList/components/searchTable.vue

@@ -8,16 +8,16 @@ export default {
     return {
       auditStatus: [
         {
-          label: '待审核',
+          label: '待提交',
           value: '0'
         },
         {
-          label: '已拒绝',
-          value: 2
+          label: '已提交',
+          value: 1
         },
         {
-          label: '已通过',
-          value: 1
+          label: '已关闭',
+          value: 2
         },
         {
           label: '已撤回',

+ 78 - 25
src/views/salesServiceManagement/demandList/index.vue

@@ -40,11 +40,11 @@
             type="primary"
             :underline="false"
             @click="openEdit(row, 'edit')"
-            v-if="row.demandStatus != 1"
+            v-if="btnShow(row)"
             >修改</el-link
           >
           <el-popconfirm
-            v-if="row.demandStatus != 1"
+            v-if="btnShow(row)"
             class="ele-action"
             title="确定要删除此售后需求吗?"
             @confirm="handleRemove(row)"
@@ -59,10 +59,10 @@
             type="primary"
             :underline="false"
             @click="handleCommand('handleAudit', row)"
-            v-if="row.demandStatus != 1"
+            v-if="btnShow(row)"
             >提交</el-link
           >
-          <el-popconfirm
+          <!-- <el-popconfirm
             v-if="row.demandStatus == 1"
             class="ele-action"
             title="确定要撤回此售后需求吗?"
@@ -75,6 +75,16 @@
                 >撤回</el-link
               >
             </template>
+          </el-popconfirm> -->
+          <el-popconfirm
+            v-if="btnShow(row)"
+            class="ele-action"
+            title="确定要关闭此售后需求吗?"
+            @confirm="closeRevoke(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="primary" :underline="false">关闭</el-link>
+            </template>
           </el-popconfirm>
 
           <!-- <el-dropdown
@@ -160,11 +170,21 @@
 </template>
 
 <script>
+  const workOrderStatus = [
+    { code: 0, label: '待执行' },
+    { code: 1, label: '已接收' },
+    { code: 2, label: '执行中' },
+    { code: 3, label: '待验收' },
+    { code: 4, label: '待评价' },
+    { code: 5, label: '已完成' },
+    { code: 6, label: '验收不通过' }
+  ];
   import {
     getPageSalesDemand,
     deleteSalesDemand,
     auditSalesDemand,
-    revokeSalesDemand
+    revokeSalesDemand,
+    closeDemand
   } from '@/api/salesServiceManagement/index.js';
   import search from './components/searchTable.vue';
   import AddDialog from './components/addDialog.vue';
@@ -199,6 +219,13 @@
             showOverflowTooltip: true,
             minWidth: 110
           },
+          {
+            prop: 'name',
+            label: '需求名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
           {
             prop: 'contactCode',
             label: '客户编码',
@@ -236,38 +263,50 @@
               return this.$util.toDateString(cellValue);
             }
           },
-          // {
-          //   prop: 'approvalUserName',
-          //   label: '审核人',
-          //   align: 'center',
-          //   showOverflowTooltip: true
-          // },
-          // {
-          //   prop: 'approvalTime',
-          //   label: '审核时间',
-          //   align: 'center',
-          //   showOverflowTooltip: true,
-          //   formatter: (_row, _column, cellValue) => {
-          //     return this.$util.toDateString(cellValue);
-          //   }
-          // },
           {
             prop: 'demandStatus',
-            label: '状态',
+            label: '需求状态',
             align: 'center',
             showOverflowTooltip: true,
             formatter: (_row, _column, cellValue) => {
               return cellValue == 0
                 ? '待提交'
-                : cellValue == 2
-                ? '已拒绝'
                 : cellValue == 1
                 ? '已提交'
+                : cellValue == 2
+                ? '已关闭'
                 : cellValue == 3
-                ? '已撤回'
+                ? '已完成'
                 : '';
             }
           },
+          {
+            prop: 'planStatus',
+            label: '计划状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (item) => {
+              return {
+                0: '待派单',
+                1: '已派单',
+                2: '执行中',
+                3: '已完成',
+                4: '已撤回',
+                5: '已驳回'
+              }[item.planStatus];
+            }
+          },
+          {
+            prop: 'orderStatus',
+            label: '工单状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return workOrderStatus.find(
+                (item) => item.code == row.orderStatus
+              )?.label;
+            }
+          },
           {
             columnKey: 'action',
             slot: 'action',
@@ -300,7 +339,14 @@
         levelList: []
       };
     },
-    computed: {},
+    computed: {
+      btnShow() {
+        return (row) => {
+          // let flag = row.demandStatus  == 0;
+          return row.demandStatus == 0;
+        };
+      }
+    },
     created() {
       this.requestDict('报修来源');
       this.requestDict('报修状态');
@@ -384,6 +430,13 @@
       //     }
       //   });
       // },
+      //
+      async closeRevoke(row) {
+        const res = await closeDemand(row.id);
+        if (!res) return;
+        this.$message.success('关闭成功!');
+        this.reload();
+      },
       async handleRevoke(row) {
         const res = await revokeSalesDemand({ id: row.id });
         if (!res) return;

+ 1 - 1
src/views/salesServiceManagement/workOrder/components/declarationDialog.vue

@@ -320,7 +320,7 @@
 
     <div slot="footer" class="footer">
       <el-button type="primary" @click="submitAdd" v-if="type != 'view'">{{
-        type == 'edit' ? '提交' : '报工'
+        type == 'edit' ? '保存' : '报工'
       }}</el-button>
 
       <el-button type="primary" @click="saveAdd" v-if="type == 'report'"

+ 36 - 25
src/views/salesServiceManagement/workOrder/index.vue

@@ -110,6 +110,7 @@
             @click="handleCommand('checkAndAccept', row)"
             >验收</el-link
           >
+          <!--    v-if="row.orderStatus == 4" -->
           <el-link
             type="primary"
             v-if="row.orderStatus == 4"
@@ -199,7 +200,8 @@
     receiveSalesWorkOrder,
     checkAndAccept,
     getSalesWorkOrderById,
-    checkByWorkId
+    checkByWorkId,
+    afterSalesEvaluation
   } from '@/api/salesServiceManagement/index';
   import { getByCode } from '@/api/system/dictionary-data';
   import dictMixins from '@/mixins/dictMixins';
@@ -211,7 +213,7 @@
       applyForSpare,
       declarationDialog,
       redeployOther,
-      addDialog,
+      addDialog
       // fileMain
     },
     data() {
@@ -465,27 +467,28 @@
       },
       async addSpareItems(row) {
         let data = await getSalesWorkOrderById(row.id);
-        this.$refs.edit.open(
-          {
-            receivingDeptName: data.executeGroupName,
-            receivingDeptId: data.executeGroupId,
-            recipientName: data.executeUserName,
-            recipientId: data.executeUserId,
-            name: data.name,
-            receptionUserId:data.receptionUserId,
-            id: data.id,
-            details: data.costListVOS.filter((item) => {
-              if (item.typeId == 2 && item.isApply != 1) {
-                item.totalPrice = item.settlementPrice;
-                item.categoryCode = item.code;
-                item.categoryName = item.name;
+        let dataP = {
+          receivingDeptName: data.executeGroupName,
+          receivingDeptId: data.executeGroupId,
+          recipientName: data.executeUserName,
+          recipientId: data.executeUserId,
+          name: data.name,
+          receptionUserId: data.receptionUserId,
+          id: data.id,
+          userId: data.executeUserId,
+          userName: data.executeUserName,
+          details: data.costListVOS.filter((item) => {
+            if (item.typeId == 2 && item.isApply != 1) {
+              item.totalPrice = item.settlementPrice;
+              item.categoryCode = item.code;
+              item.categoryName = item.name;
 
-                return item;
-              }
-            })
-          },
-          'work'
-        );
+              return item;
+            }
+          })
+        };
+        console.log(dataP, 'dataPdataPdataPdataPdataPdataPdataPdataP');
+        this.$refs.edit.open(JSON.parse(JSON.stringify(dataP)), 'work');
       },
       //接收
       async handleReceive(row) {
@@ -526,7 +529,12 @@
         }
         this.$refs.declarationDialogRef.open(row, type);
       },
-      async permission(row) {
+      // 校验
+      async permission(row, command) {
+        // 点评论的话不走这个方法
+        if (command == 'evaluate') {
+          return true;
+        }
         try {
           await checkByWorkId(row.id);
           return true;
@@ -538,7 +546,7 @@
         this.$refs.declarationDialogRef.open(row, 'view');
       },
       async handleCommand(command, row) {
-        let flag = await this.permission(row);
+        let flag = await this.permission(row, command);
         if (!flag) return;
         if (command === 'addSpareItems') {
           this.addSpareItems(row);
@@ -550,7 +558,10 @@
           this.toRedeploy(row);
         }
         if (command == 'evaluate') {
-          this.$refs.addDialogRef.open(row, 'add');
+          try {
+            await afterSalesEvaluation(row.id);
+            this.$refs.addDialogRef.open(row, 'add');
+          } catch (err) {}
         }
         if (command == 'checkAndAccept') {
           this.visibleCheckAndAccept = true;