qukaidi 3 år sedan
förälder
incheckning
d13576ef8d

+ 9 - 2
src/api/standAlone/saleLeads.js

@@ -14,7 +14,7 @@ export function deleteList(data) {
     url: '/api/trade-purchase/leads/remove',
     method: 'post',
     params: {
-      ids:data
+      ids: data
     }
   })
 }
@@ -47,8 +47,15 @@ export function removeGoods(data) {
 // 请核
 export function pleaseCheck(data) {
   return request({
-    url: '/api/trade-purchase/office-order/check-order',
+    url: '/api/trade-purchase/leads/saveExamine',
     method: 'post',
     data: data
   })
 }
+// 获取服务项目
+export function getGoodsDescList() {
+  return request({
+    url: '/api/blade-client/affairsdesc/getGoodsDescList',
+    method: 'get',
+  })
+}

+ 8 - 1
src/views/saleLeads/config/customerContact.json

@@ -8,7 +8,7 @@
   "addBtn": false,
   "delBtn": false,
   "align": "center",
-  "menuWidth": 120,
+  "menuWidth": 130,
   "refreshBtn": false,
   "showSummary": true,
   "summaryText": "合计",
@@ -23,6 +23,13 @@
       "overHidden": true
     },
     {
+      "label": "服务项目",
+      "prop": "spId",
+      "index": 1,
+      "width": 200,
+      "overHidden": true
+    },
+    {
       "label": "内容",
       "prop": "bizContent",
       "index": 2,

+ 143 - 155
src/views/saleLeads/detail.vue

@@ -2,176 +2,104 @@
   <div class="borderless" v-loading="pageLoading">
     <div class="customer-head">
       <div class="customer-back">
-        <el-button
-          type="danger"
-          style="border: none;background: none;color: red"
-          icon="el-icon-arrow-left"
-          @click="backToList"
-          :loading="btnLoading"
-        >返回列表</el-button>
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
+          @click="backToList" :loading="btnLoading">返回列表</el-button>
       </div>
       <div class="add-customer-btn">
-        <el-button
-          type="primary"
-          size="small"
-          class="el-button--small-yh"
-          @click.stop="openEdit"
-          v-if="disabled"
-        >编 辑</el-button>
-        <el-button
-          type="success"
-          :disabled="!form.id"
-          size="small"
-          @click="copyDoc"
-          :loading="btnLoading"
-          v-if="false"
-        >复制单据</el-button>
-        <el-button
-          type="primary"
-          @click="editCustomer"
-          size="small"
-          :loading="btnLoading"
-        >保存数据</el-button>
+        <el-button type="primary" size="small" class="el-button--small-yh" @click.stop="openEdit"
+          v-if="disabled && !approvalStatus">编 辑
+        </el-button>
+        <el-button type="primary" size="small" class="el-button--small-yh" @click.stop="submit" v-if="form.status == 1">
+          提交
+        </el-button>
+        <el-dropdown style="margin-right: 8px;margin-left: 8px;">
+          <el-button type="primary" size="small">
+            审核处理<i class="el-icon-arrow-down el-icon--right"></i>
+          </el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item :disabled="form.status > 0 || approvalStatus" @click.native="pleaseCheck">请核数据
+            </el-dropdown-item>
+            <el-dropdown-item disabled>审核进度</el-dropdown-item>
+            <el-dropdown-item disabled>撤销请核</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+        <el-button type="success" :disabled="!form.id" size="small" @click="copyDoc" :loading="btnLoading" v-if="false">
+          复制单据</el-button>
+        <el-button type="primary" @click="editCustomer" size="small" :loading="btnLoading">保存数据</el-button>
       </div>
     </div>
     <div class="customer-main">
-      <containerTitle title="基础信息"/>
+      <containerTitle title="基础信息" />
       <basic-container :showBtn="true">
-        <avue-form
-          ref="form"
-          class="trading-form"
-          v-model="form"
-          :option="option"
-        >
-          <template slot="corpId">
-            <crop-select
-              v-model="form.corpId"
-              @getCorpData="getKHData"
-              corpType="KH"
-            />
+        <avue-form ref="form" class="trading-form" v-model="form" :option="option">
+          <template slot-scope="{}" slot="corpNameLabel">
+            <span style="color: #409EFF;cursor: pointer" @click.stop="khEdit">客户名称:</span>
           </template>
+          <!-- <template slot-scope="{row,index}" slot="corpName">
+            <warehous-Kh v-model="form.corpName" :zhKey="true" :disabled="disabled || approvalStatus"
+              @getCropId="getCropId"></warehous-Kh>
+          </template> -->
           <template slot="fromUser">
-            <el-select
-              v-model="form.fromUser"
-              filterable
-              clearable
-              size="small"
-              :disabled="disabled"
-            >
-              <el-option
-                v-for="(item,index) in userList"
-                :key="index"
-                :label="item.realName"
-                :value="item.id"
-              ></el-option>
+            <el-select v-model="form.fromUser" filterable clearable size="small" :disabled="disabled || approvalStatus">
+              <el-option v-for="(item, index) in userList" :key="index" :label="item.realName" :value="item.id">
+              </el-option>
             </el-select>
           </template>
           <template slot="toUser">
-            <el-select
-              v-model="form.toUser"
-              filterable
-              clearable
-              size="small"
-              :disabled="disabled"
-            >
-              <el-option
-                v-for="(item,index) in userList"
-                :key="index"
-                :label="item.realName"
-                :value="item.id"
-              ></el-option>
+            <el-select v-model="form.toUser" filterable clearable size="small" :disabled="disabled || approvalStatus">
+              <el-option v-for="(item, index) in userList" :key="index" :label="item.realName" :value="item.id">
+              </el-option>
             </el-select>
           </template>
         </avue-form>
       </basic-container>
-      <containerTitle title="沟通记录"/>
+      <containerTitle title="沟通记录" />
       <basic-container>
-        <avue-crud
-          ref="crud"
-          :data="dataList"
-          :option="tableOption"
-          :cell-style="cellStyle"
-          @saveColumn="saveColumn"
-          @resetColumn="resetColumn"
-        >
+        <avue-crud ref="crud" :data="dataList" :option="tableOption" :cell-style="cellStyle" @saveColumn="saveColumn"
+          @resetColumn="resetColumn">
           <template slot="menuLeft">
-            <el-button
-              type="primary"
-              icon="el-icon-plus"
-              size="small"
-              @click.stop="newDetails"
-              :disabled="disabled"
-            >录入明细</el-button>
-            <el-button
-              type="info"
-              icon="el-icon-printer"
-              size="small"
-              v-if="false"
-            >报表打印</el-button>
+            <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newDetails"
+              :disabled="disabled || approvalStatus">
+              录入明细</el-button>
+            <el-button type="info" icon="el-icon-printer" size="small" v-if="false">报表打印</el-button>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
-            <el-button
-              size="small"
-              icon="el-icon-edit"
-              type="text"
-              @click="rowCell(row, index)"
-              :disabled="disabled"
-            >{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
-            <el-button
-              size="small"
-              icon="el-icon-delete"
-              type="text"
-              @click="rowDel(row, index)"
-              :disabled="disabled"
-            >删除</el-button>
+            <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
+              :disabled="disabled || approvalStatus">{{
+                  row.$cellEdit ? "保存" : "修改"
+              }}</el-button>
+            <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
+              :disabled="disabled || approvalStatus">
+              删除</el-button>
           </template>
           <template slot="bizDate" slot-scope="{ row, index }">
-            <el-date-picker
-              v-if="row.$cellEdit"
-              v-model="row.bizDate"
-              type="date"
-              placeholder="选择日期"
-              size="small"
-              style="width: 100%"
-              format="yyyy-MM-dd"
-              valueFormat="yyyy-MM-dd"
-            ></el-date-picker>
-            <span v-else>{{row.bizDate}}</span>
+            <el-date-picker v-if="row.$cellEdit" v-model="row.bizDate" type="date" placeholder="选择日期" size="small"
+              style="width: 100%" format="yyyy-MM-dd" valueFormat="yyyy-MM-dd"></el-date-picker>
+            <span v-else>{{ row.bizDate }}</span>
+          </template>
+          <template slot="spId" slot-scope="{ row, index }">
+            <el-select v-if="row.$cellEdit" v-model="row.spId" filterable clearable size="small" :disabled="disabled"
+              @change="spIdChange(row)">
+              <el-option v-for="(item, index) in goodsDescList" :key="index" :label="item.cname" :value="item.id">
+              </el-option>
+            </el-select>
+            <span v-else>{{ row.serviceProjectName }}</span>
           </template>
           <template slot="bizContent" slot-scope="{ row, index }">
-            <el-input
-              v-if="row.$cellEdit"
-              v-model="row.bizContent"
-              size="small"
-              placeholder="输入内容"
-            />
-            <span v-else>{{row.bizContent}}</span>
+            <el-input v-if="row.$cellEdit" v-model="row.bizContent" size="small" placeholder="输入内容" />
+            <span v-else>{{ row.bizContent }}</span>
           </template>
           <template slot="contacts" slot-scope="{ row, index }">
-            <el-input
-              v-if="row.$cellEdit"
-              v-model="row.contacts"
-              size="small"
-              placeholder="输入客户联系人"
-            />
-            <span v-else>{{row.contacts}}</span>
+            <el-input v-if="row.$cellEdit" v-model="row.contacts" size="small" placeholder="输入客户联系人" />
+            <span v-else>{{ row.contacts }}</span>
           </template>
           <template slot="tel" slot-scope="{ row, index }">
-            <el-input
-              v-if="row.$cellEdit"
-              v-model="row.tel"
-              size="small"
-              placeholder="输入联系方式"
-            />
-            <span v-else>{{row.tel}}</span>
+            <el-input v-if="row.$cellEdit" v-model="row.tel" size="small" placeholder="输入联系方式" />
+            <span v-else>{{ row.tel }}</span>
           </template>
           <template slot="approval" slot-scope="{ row, index }">
-            <el-switch
-              v-model="row.approval"
-              :disabled="!row.$cellEdit"
-              :inactive-value="0"
-              :active-value="1"
-            ></el-switch>
+            <el-switch v-model="row.approval" :disabled="!row.$cellEdit" :inactive-value="0" :active-value="1">
+            </el-switch>
           </template>
         </avue-crud>
       </basic-container>
@@ -188,10 +116,10 @@ import {
   IntegerFormat
 } from "@/util/validate";
 import { gainUser } from "@/api/basicData/customerInquiry";
-import {getUserInfo} from "@/api/system/user";
-import {getDeptTree} from "@/api/system/dept";
+import { getUserInfo } from "@/api/system/user";
+import { getDeptTree } from "@/api/system/dept";
 import { getCurrentDate } from "@/util/date";
-import {dataDetail, typeSave, removeGoods, pleaseCheck} from "@/api/standAlone/saleLeads";
+import { dataDetail, typeSave, removeGoods, pleaseCheck, getGoodsDescList } from "@/api/standAlone/saleLeads";
 import { contrastObj, contrastList } from "@/util/contrastData";
 
 export default {
@@ -210,6 +138,7 @@ export default {
       }
     }
     return {
+      approvalStatus: false,
       disabled: false,
       checkDisabled: false,
       pageLoading: false,
@@ -324,9 +253,9 @@ export default {
             span: 8,
             type: 'select',
             dicData: [
-              {label: '沟通中', value: 0},
-              {label: '成交', value: 1},
-              {label: '未成交', value: 2},
+              { label: '沟通中', value: 0 },
+              { label: '成交', value: 1, disabled: true },
+              { label: '未成交', value: 2 },
             ],
             rules: [
               {
@@ -343,7 +272,7 @@ export default {
             minRows: 2,
             span: 24,
             rules: [
-              {validator: validateRemark, trigger: 'blur'}
+              { validator: validateRemark, trigger: 'blur' }
             ]
           },
         ],
@@ -364,6 +293,7 @@ export default {
       loginUserId: null,
       oldForm: {},
       oldDataList: [],
+      goodsDescList: []
     }
   },
   async created() {
@@ -384,6 +314,9 @@ export default {
     getDeptTree().then(res => {
       this.dic = res.data.data
     })
+    getGoodsDescList().then(res => {
+      this.goodsDescList = res.data.data
+    })
     this.getWorkDicts('unit').then(res => {
       this.unitOption = res.data.data;
     })
@@ -397,6 +330,12 @@ export default {
       this.checker = true;
       this.batchNo = this.detailData.check.batchNo
       this.queryData(this.detailData.id);
+    } else if (this.detailData.check) {
+      this.disabled = true;
+      this.option.column.map(e => {
+        this.$set(e, 'disabled', true)
+      })
+      this.queryData(this.detailData.check.billId);
     }
   },
   filters: {
@@ -408,16 +347,20 @@ export default {
     }
   },
   methods: {
+    khEdit() {
+      this.$router.push('/basicData/customerInformation/index')
+    },
     // 查询
     queryData(id) {
       this.pageLoading = true;
-      dataDetail({id: id}).then(res => {
+      dataDetail({ id: id }).then(res => {
         this.form = res.data.data;
-        this.dataList = this.form.itemList? this.form.itemList: [];
+        this.dataList = this.form.itemList ? this.form.itemList : [];
         delete this.form.itemList;
-        this.oldForm = {...this.form};
+        this.oldForm = { ...this.form };
         this.oldDataList = [...this.dataList];
-        this.checkDisabled = this.form.status > 0? true: false;
+        this.checkDisabled = this.form.status > 0 ? true : false;
+        this.approvalStatus = this.form.approvalStatus == "S" || this.form.approvalStatus == "A" ? true : false;
         if (this.form.status > 0) {
           this.option.column.map(e => {
             this.$set(e, 'disabled', true)
@@ -427,6 +370,33 @@ export default {
         this.pageLoading = false;
       })
     },
+    pleaseCheck() {
+      this.$confirm("您确定提交此次申请吗?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.btnLoading = true;
+        this.$set(this.form, 'itemList', this.dataList)
+        const data = {
+          ...this.form,
+          checkType: "xsjh",
+          url: "/saleLeads/index",
+          pageStatus: "this.$store.getters.xsjhStatus",
+          pageLabel: "销售机会"
+        };
+        pleaseCheck(data).then(res => {
+          this.$message({ type: "success", message: '请核成功' });
+          this.disabled = true;
+          this.option.column.map(e => {
+            this.$set(e, 'disabled', true)
+          })
+          this.queryData(this.form.id);
+        }).finally(() => {
+          this.btnLoading = false;
+        })
+      });
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");
@@ -446,6 +416,19 @@ export default {
     copyDoc() {
       this.$emit("copyOrder", this.form.id);
     },
+    submit() {
+      let data = {
+        ...this.form,
+        itemList:this.dataList
+      }
+      this.$router.push({
+        path: '/workManagement/main-items/list',
+        query: { data: data }
+      });
+    },
+    getCropId(row) {
+      this.form.corpId = row
+    },
     //修改提交触发
     editCustomer(status) {
       this.$refs["form"].validate((valid, done) => {
@@ -454,7 +437,7 @@ export default {
           this.btnLoading = true;
           this.$set(this.form, 'itemList', this.dataList)
           typeSave(this.form).then(res => {
-            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+            this.$message({ type: "success", message: this.form.id ? "修改成功!" : "新增成功!" });
             this.queryData(res.data.data);
           }).finally(() => {
             this.btnLoading = false;
@@ -543,7 +526,13 @@ export default {
         }
       });
     },
-    getKHData(row) {},
+    spIdChange(row) {
+      console.log(row)
+      this.goodsDescList.forEach(e => {
+        row.serviceProjectName = e.cname
+        row.chargeProposal = e.remarks
+      });
+    },
     // 验证新旧值对比
     verification() {
       if (contrastObj(this.form, this.oldForm) ||
@@ -566,5 +555,4 @@ export default {
 </script>
 
 <style scoped>
-
 </style>

+ 58 - 87
src/views/saleLeads/index.vue

@@ -1,98 +1,47 @@
 <template>
   <div>
     <basic-container v-show="show" class="page-crad">
-      <avue-crud
-        ref="crud"
-        :option="option"
-        :data="dataList"
-        v-model="form"
-        :page.sync="page"
-        :search.sync="search"
-        :table-loading="loading"
-        :cell-style="cellStyle"
-        @selection-change="selectionChange"
-        @search-change="searchChange"
-        @current-change="currentChange"
-        @size-change="sizeChange"
-        @refresh-change="refreshChange"
-        @on-load="onLoad"
-        @search-criteria-switch="searchCriteriaSwitch"
-        @saveColumn="saveColumn"
-        @resetColumn="resetColumn"
-      >
+      <avue-crud ref="crud" :option="option" :data="dataList" v-model="form" :page.sync="page" :search.sync="search"
+        :table-loading="loading" :cell-style="cellStyle" @selection-change="selectionChange"
+        @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
+        @refresh-change="refreshChange" @on-load="onLoad" @search-criteria-switch="searchCriteriaSwitch"
+        @saveColumn="saveColumn" @resetColumn="resetColumn">
         <template slot="menuLeft">
-          <el-button
-            type="primary"
-            icon="el-icon-plus"
-            size="small"
-            @click.stop="newAdd()"
-          >创建单据</el-button>
-          <el-button
-            type="success"
-            size="small"
-            icon="el-icon-plus"
-            @click.stop="copyDoc()"
-            :disabled="selection.length != 1"
-            v-if="false"
-          >复制单据</el-button>
+          <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newAdd()">创建单据</el-button>
+          <el-button type="success" size="small" icon="el-icon-plus" @click.stop="copyDoc()"
+            :disabled="selection.length != 1" v-if="false">复制单据</el-button>
         </template>
         <template slot-scope="scope" slot="menu">
-          <el-button
-            type="text"
-            icon="el-icon-delete"
-            size="small"
-            @click.stop="rowDel(scope.row, scope.index)"
-            :disabled="scope.row.status == 3"
-          >删除
+          <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(scope.row, scope.index)"
+            :disabled="scope.row.status == 3">删除
           </el-button>
         </template>
-<!--        <template slot="corpNameSearch">-->
-<!--          <crop-select-->
-<!--            v-model="search.corpId"-->
-<!--            corpType="KH"-->
-<!--          ></crop-select>-->
-<!--        </template>-->
+        <!--        <template slot="corpNameSearch">-->
+        <!--          <crop-select-->
+        <!--            v-model="search.corpId"-->
+        <!--            corpType="KH"-->
+        <!--          ></crop-select>-->
+        <!--        </template>-->
         <template slot="fromUserNameSearch">
-          <el-select
-            v-model="search.fromUser"
-            filterable
-            clearable
-            placeholder="请选择 承揽人"
-          >
-            <el-option
-              v-for="(item, index) in contractorOption"
-              :key="index"
-              :value="item.id"
-              :label="item.realName"
-            ></el-option>
+          <el-select v-model="search.fromUser" filterable clearable placeholder="请选择 承揽人">
+            <el-option v-for="(item, index) in contractorOption" :key="index" :value="item.id" :label="item.realName">
+            </el-option>
           </el-select>
         </template>
         <template slot="toUserNameSearch">
-          <el-select
-            v-model="search.toUser"
-            filterable
-            clearable
-            placeholder="请选择 承揽人"
-          >
-            <el-option
-              v-for="(item, index) in oppositePersonOption"
-              :key="index"
-              :value="item.id"
-              :label="item.realName"
-            ></el-option>
+          <el-select v-model="search.toUser" filterable clearable placeholder="请选择 承揽人">
+            <el-option v-for="(item, index) in oppositePersonOption" :key="index" :value="item.id"
+              :label="item.realName"></el-option>
           </el-select>
         </template>
         <template slot="corpName" slot-scope="scope">
-          <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpName }}</span>
+          <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{
+              scope.row.corpName
+          }}</span>
         </template>
       </avue-crud>
     </basic-container>
-    <detail-page
-      @goBack="goBack"
-      @copyOrder="copyOrder"
-      :detailData="detailData"
-      v-if="!show"
-    />
+    <detail-page @goBack="goBack" @copyOrder="copyOrder" :detailData="detailData" v-if="!show" />
   </div>
 </template>
 
@@ -100,7 +49,7 @@
 import option from "./config/mainList.json";
 import detailPage from "./detail";
 import { gainUser } from "@/api/basicData/customerInquiry";
-import {getList, deleteList} from "@/api/standAlone/saleLeads";
+import { getList, deleteList } from "@/api/standAlone/saleLeads";
 
 export default {
   name: "index",
@@ -127,6 +76,27 @@ export default {
       oppositePersonOption: [],
     }
   },
+  activated() {
+    if (!this.show && !this.$store.getters.xsjhStatus) {
+      this.show = true;
+    }
+    setTimeout(() => {
+      if (this.$route.query.check && this.show) {
+        this.detailData = {
+          check: this.$route.query.check
+        }
+        this.show = false;
+        this.$store.commit("XSJH_IN_DETAIL");
+      } else if (this.$route.query.params) {
+        this.detailData = {
+          id: this.$route.query.params,
+          view: true,
+        }
+        this.show = false;
+        this.$store.commit("XSJH_IN_DETAIL");
+      }
+    }, 100);
+  },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(101), option);
     gainUser().then(res => {
@@ -137,7 +107,7 @@ export default {
     this.option.column.forEach(item => {
       if (item.search) i++
     })
-    if (i % 3 !== 0){
+    if (i % 3 !== 0) {
       const num = 3 - Number(i % 3)
       this.option.searchMenuSpan = num * 8;
       this.option.searchMenuPosition = "right";
@@ -145,15 +115,16 @@ export default {
   },
   methods: {
     searchCriteriaSwitch(type) {
-      if (type){
-        this.option.height =  this.option.height - 90
-      }else {
-        this.option.height =  this.option.height + 90
+      if (type) {
+        this.option.height = this.option.height - 90
+      } else {
+        this.option.height = this.option.height + 90
       }
       this.$refs.crud.getTableHeight()
     },
     newAdd() {
       this.show = false;
+      this.$store.commit("XSJH_IN_DETAIL");
     },
     onLoad(page, params) {
       // 重置掉展开
@@ -227,7 +198,7 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
-    copyDoc() {},
+    copyDoc() { },
     selectionChange(list) {
       this.selection = list;
     },
@@ -239,6 +210,7 @@ export default {
         });
       }
       this.detailData = this.$options.data().detailData;
+      this.$store.commit('XSJH_OUT_DETAIL');
       this.show = true;
       this.onLoad(this.page, this.search);
     },
@@ -253,12 +225,12 @@ export default {
       });
     },
     contractorRemoteMethod(name) {
-      gainUser({realName: name}).then(res => {
+      gainUser({ realName: name }).then(res => {
         this.contractorOption = res.data.data;
       })
     },
     oppositePersonRemoteMethod(name) {
-      gainUser({realName: name}).then(res => {
+      gainUser({ realName: name }).then(res => {
         this.oppositePerson = res.data.data;
       })
     },
@@ -293,5 +265,4 @@ export default {
 </script>
 
 <style scoped>
-
 </style>