Browse Source

【新增】家用商用工程订单

莫绍宝 3 years ago
parent
commit
589cd0e6b8

+ 1 - 1
src/api/supply/engin.js

@@ -270,7 +270,7 @@ export function getComLoginList(params) {
   })
 }
 
-// 商用工程订单 - 获取工程登录列表
+// 商用工程订单 - 获取工程登录详情
 export function getComLoginDetail(params) {
   return request({
     url: '/engin-info/detail',

+ 97 - 88
src/views/supply/engin/components/commerce_form.vue

@@ -10,7 +10,7 @@
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程订单" prop="orderNum">
-            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
@@ -26,37 +26,37 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="产品大类" prop="type">
-            <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" clearable>
+            <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" disabled>
               <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="经销商编码" prop="jxsNum">
-            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" readonly></el-input>
+            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="16">
           <el-form-item label="经销商名称" prop="jxsName">
-            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" readonly></el-input>
+            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="工程登录编号" prop="loginNum">
+          <el-form-item label="工程信息单号" prop="enginNum">
             <div style="display: flex;">
-              <el-input v-model="mainForm.loginNum" placeholder="请选择工程登录" readonly></el-input>
-              <el-button style="margin-left: 10px;" @click="openShareDetail" :disabled="mainForm.loginNum !== ''">选择</el-button>
+              <el-input v-model="mainForm.enginNum" placeholder="请选择工程登录" disabled></el-input>
+              <el-button style="margin-left: 10px;" @click="openShareDetail">选择</el-button>
             </div>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程项目名称" prop="enginName">
-            <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称"></el-input>
+            <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程登录类型" prop="loginType">
-            <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型"></el-input>
+            <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
@@ -66,34 +66,29 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="使用单位" prop="company">
-            <el-input v-model="mainForm.company" placeholder="请输入使用单位"></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="销售类型" prop="saleType">
-            <el-select v-model="mainForm.saleType" placeholder="选择销售类型" style="width: 100%" clearable @change="changeSaleType">
-              <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
-            </el-select>
+            <el-input v-model="mainForm.company" placeholder="请输入使用单位" disabled></el-input>
           </el-form-item>
         </el-col>
+      </el-row>
+      <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="联系人" prop="contactMan">
-            <el-input v-model="mainForm.contactMan" placeholder="请输入联系人"></el-input>
+            <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="固定电话" prop="tel">
-            <el-input v-model="mainForm.tel" placeholder="请输入固定电话"></el-input>
+            <el-input v-model="mainForm.tel" placeholder="请输入固定电话" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="移动电话" prop="phone">
-            <el-input v-model="mainForm.phone" placeholder="请输入移动电话"></el-input>
+            <el-input v-model="mainForm.phone" placeholder="请输入移动电话" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="24" :lg="24">
           <el-form-item label="安装地址" prop="address">
-            <el-input v-model="mainForm.address" placeholder="请输入安装地址"></el-input>
+            <el-input v-model="mainForm.address" placeholder="请输入安装地址" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="24" :lg="24">
@@ -113,14 +108,14 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="制单人" prop="createMan">
-            <el-input v-model="mainForm.createMan" placeholder="请输入制单人" readonly></el-input>
+            <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
           <el-form-item label="制单日期" prop="createDate">
             <el-date-picker
               v-model="mainForm.createDate"
-              readonly
+              disabled
               type="date"
               value-format="yyyy-MM-dd"
               style="width: 100%;"
@@ -212,13 +207,13 @@
             <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100">
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
+        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.directTransferQty" size="small"></el-input>
+            <el-input v-model="scope.row.remark" size="small"></el-input>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -253,8 +248,8 @@
       <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
         <el-row :gutter="20">
           <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item prop="loginNum">
-              <el-input v-model="screenForm.loginNum" placeholder="工程登录编号"></el-input>
+            <el-form-item prop="enginNum">
+              <el-input v-model="screenForm.enginNum" placeholder="工程信息单"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
@@ -286,11 +281,11 @@
           max-height="270">
           <el-table-column align="center" label="" width="100">
             <template slot-scope="scope">
-              <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo)">选择</el-button>
+              <el-button type="primary" size="small" @click="chooseItem(scope.row.enginInfoNo)">选择</el-button>
             </template>
           </el-table-column>
           <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" prop="enginInfoNo" label="工程信息单" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
         </el-table>
@@ -317,7 +312,7 @@
 </template>
 
 <script>
-import { getOrderDetail, getComLoginList, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
+import { getOrderDetail, getComLoginList, getComLoginDetail, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
 import { getDictList, getTypeList } from '@/api/common'
 
 export default {
@@ -342,12 +337,11 @@ export default {
         type: '',
         jxsNum: '',
         jxsName: '',
-        loginNum: '',
+        enginNum: '',
         enginName: '',
         loginType: '',
         factoryNum: '',
         company: '',
-        saleType: '',
         contactMan: '',
         tel: '',
         phone: '',
@@ -363,23 +357,21 @@ export default {
         orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
         jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
         jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
-        loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
+        enginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
         enginName: [{ required: true, message: '请输入工程项目名称', trigger: 'blur' }],
         loginType: [{ required: true, message: '请输入工程登录类型', trigger: 'blur' }],
         company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
-        saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
         // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
         // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
         // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
         address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
       },
-      salesTypeList: [],
       typeList: [],
       goodsList: [],
 
       isShowDialog: false, // 工程登录列表 - 弹窗
       screenForm: {
-        loginNum: '',
+        enginNum: '',
         enginName: '',
         company: '',
       },
@@ -412,7 +404,6 @@ export default {
   created() {
     this.getDictList();
     this.getWalletList();
-    this.getSalesTypeList();
     this.getWarehouseList();
 
     if(this.listItem) {
@@ -471,16 +462,6 @@ export default {
       })
     },
 
-    // 获取销售类型列表
-    getSalesTypeList() {
-      getTypeList({
-        pageNum: 1,
-        pageSize: -1
-      }).then((res) => {
-        this.salesTypeList = res.data.records;
-      })
-    },
-
     // 获取仓库列表
     getWarehouseList() {
       getWarehouseList({
@@ -497,18 +478,18 @@ export default {
         let data = res.data;
         this.mainForm.orderNum = data.enginOrderId;
         this.mainForm.orderDate = data.orderDate;
-        this.mainForm.type = data.refProductCategory;
+        this.mainForm.type = data.mainId;
         this.mainForm.jxsNum = data.customerId;
         this.mainForm.jxsName = data.customerName;
-        this.mainForm.loginNum = data.refEnginRecordNo;
+        this.mainForm.enginNum = data.refEnginRecordNo;
         this.mainForm.enginName = data.refProjectName;
         this.mainForm.loginType = data.refPromiseStatus;
         this.mainForm.factoryNum = data.refFactoryNo;
         this.mainForm.company = data.refUseUnit;
         this.mainForm.saleType = data.saleTypeId;
-        this.mainForm.contactMan = data.aaa;
-        this.mainForm.tel = data.aaa;
-        this.mainForm.phone = data.aaa;
+        this.mainForm.contactMan = data.refLinkman;
+        this.mainForm.tel = data.refTel;
+        this.mainForm.phone = data.refPhone;
         this.mainForm.address = data.refInstallAddress;
         this.mainForm.greeRemark = data.note2;
         this.mainForm.greeReply = data.note1;
@@ -530,7 +511,7 @@ export default {
       getComLoginList({
         pageNum: this.dialogTable_currentPage,
         pageSize: this.dialogTable_pageSize,
-        recordNo: this.screenForm.loginNum,
+        enginInfoNo: this.screenForm.enginNum,
         projectName: this.screenForm.enginName,
         useUnit: this.screenForm.company,
       }).then(res => {
@@ -568,20 +549,45 @@ export default {
 
     // 选择工程登录
     chooseItem(id) {
-      addCom({refEnginRecordNo: id}).then(res => {
+      getComLoginDetail({id}).then(res => {
         this.isShowDialog = false;
-        this.editId = res.data;
-        this.getDetail();
-      })
-    },
-
-    // 选择销售类型
-    changeSaleType() {
-      let obj = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
-      this.goodsList.forEach(item => {
-        item.saleTypeId = obj.id;
-        item.saleTypeCode= obj.saleCode;
-        item.saleTypeName = obj.saleName;
+        let data = res.data;
+        this.mainForm.type = data.productCategory;
+        this.mainForm.saleType = '';
+        this.mainForm.enginNum = data.enginInfoNo;
+        this.mainForm.enginName = data.projectName;
+        this.mainForm.loginType = data.promiseStatus;
+        this.mainForm.company = data.useUnit;
+        this.mainForm.contactMan = data.buyUnitCallMen;
+        this.mainForm.tel = data.buyUnitTel;
+        this.mainForm.phone = data.buyUnitPhone;
+        this.mainForm.address = data.installAddress;
+
+        this.goodsList = data.items.map(item => {
+          return {
+            useRefCount: '',
+            saleTypeName: '',
+            materialNumber: '',
+            materialOldNumber: item.code,
+            materialName: item.name,
+            specification: item.machine,
+            baseUnitId: '',
+            price: item.price,
+            enginNum: '',
+            qty: item.num,
+            customerWalletId2: '',
+            rebateRate: '',
+            discAmount: '',
+            customerWalletId: '',
+            isDirectTransfer: false,
+            directTransferQty: '',
+            hasSendQty: '',
+            remark: item.discri,
+            tax: '',
+            status1: '',
+            status2: '',
+          }
+        })
       })
     },
 
@@ -647,25 +653,20 @@ export default {
     clickSubmitForm(type) {
       this.$refs.mainForm.validate((valid) => {
         if (valid) {
-          let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
+          for(let i=0; i<this.goodsList.length; i++) {
+            if(!this.goodsList[i].customerWalletId) {
+              this.$errorMsg('请选择现金钱包');
+              return;
+            }
+          }
+
           let params = {
             enginOrderId: this.mainForm.orderNum,
             orderDate: this.mainForm.orderDate,
-            refProductCategory: this.mainForm.type || '',
-            // customerId: this.mainForm.jxsNum,
-            // customerName: this.mainForm.jxsName,
-            refEnginRecordNo: this.mainForm.loginNum || '',
-            refProjectName: this.mainForm.enginName || '',
-            refPromiseStatus: this.mainForm.loginType || '',
+            mainId: this.mainForm.type || '',
+            refEnginRecordNo: this.mainForm.enginNum || '',
             refFactoryNo: this.mainForm.factoryNum || '',
-            refUseUnit: this.mainForm.company || '',
-            saleTypeId: this.mainForm.saleType,
-            saleTypeCode: saleTypeItem.saleCode,
-            saleTypeName: saleTypeItem.saleName,
-            // aaa: this.mainForm.contactMan,
-            // aaa: this.mainForm.tel,
-            // aaa: this.mainForm.phone,
-            refInstallAddress: this.mainForm.address || '',
+            buyUnitPhone: this.mainForm.phone,
             note2: this.mainForm.greeRemark || '',
             note1: this.mainForm.greeReply || '',
             remark: this.mainForm.remark || '',
@@ -673,11 +674,19 @@ export default {
             items: this.goodsList,
           }
           if(type === 1) {
-            editCom(params).then(res => {
-              this.$successMsg('编辑成功');
-              this.goBack();
-              this.$parent.getList();
-            })
+            if(this.listItem) {
+              editCom(params).then(res => {
+                this.$successMsg('编辑成功');
+                this.goBack();
+                this.$parent.getList();
+              })
+            }else {
+              addCom(params).then(res => {
+                this.$successMsg('新增成功');
+                this.goBack();
+                this.$parent.getList();
+              })
+            }
           }else if(type === 2) {
             submitCom(params).then(res => {
               this.$successMsg('提交审核成功');

+ 85 - 42
src/views/supply/engin/components/home_form.vue

@@ -10,7 +10,7 @@
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程订单" prop="orderNum">
-            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
@@ -26,37 +26,38 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="产品大类" prop="type">
-            <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" clearable>
+            <el-input v-model="mainForm.type" disabled v-if="listItem"></el-input>
+            <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" disabled v-else>
               <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="经销商编码" prop="jxsNum">
-            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" readonly></el-input>
+            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="16">
           <el-form-item label="经销商名称" prop="jxsName">
-            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" readonly></el-input>
+            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程登录编号" prop="loginNum">
             <div style="display: flex;">
-              <el-input v-model="mainForm.loginNum" placeholder="请选择工程登录" readonly></el-input>
-              <el-button style="margin-left: 10px;" @click="openShareDetail" :disabled="mainForm.loginNum !== ''">选择</el-button>
+              <el-input v-model="mainForm.loginNum" placeholder="请选择工程登录" disabled></el-input>
+              <el-button style="margin-left: 10px;" @click="openShareDetail">选择</el-button>
             </div>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程项目名称" prop="enginName">
-            <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称"></el-input>
+            <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="工程登录类型" prop="loginType">
-            <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型"></el-input>
+            <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
@@ -66,7 +67,7 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="使用单位" prop="company">
-            <el-input v-model="mainForm.company" placeholder="请输入使用单位"></el-input>
+            <el-input v-model="mainForm.company" placeholder="请输入使用单位" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
@@ -78,22 +79,22 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="联系人" prop="contactMan">
-            <el-input v-model="mainForm.contactMan" placeholder="请输入联系人"></el-input>
+            <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="固定电话" prop="tel">
-            <el-input v-model="mainForm.tel" placeholder="请输入固定电话"></el-input>
+            <el-input v-model="mainForm.tel" placeholder="请输入固定电话" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="移动电话" prop="phone">
-            <el-input v-model="mainForm.phone" placeholder="请输入移动电话"></el-input>
+            <el-input v-model="mainForm.phone" placeholder="请输入移动电话" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="24" :lg="24">
           <el-form-item label="安装地址" prop="address">
-            <el-input v-model="mainForm.address" placeholder="请输入安装地址"></el-input>
+            <el-input v-model="mainForm.address" placeholder="请输入安装地址" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="24" :lg="24">
@@ -113,14 +114,14 @@
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="制单人" prop="createMan">
-            <el-input v-model="mainForm.createMan" placeholder="请输入制单人" readonly></el-input>
+            <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
           <el-form-item label="制单日期" prop="createDate">
             <el-date-picker
               v-model="mainForm.createDate"
-              readonly
+              disabled
               type="date"
               value-format="yyyy-MM-dd"
               style="width: 100%;"
@@ -212,13 +213,13 @@
             <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100">
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
+        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.directTransferQty" size="small"></el-input>
+            <el-input v-model="scope.row.remark" size="small"></el-input>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -317,7 +318,7 @@
 </template>
 
 <script>
-import { getOrderDetail, getHomeLoginList, getWarehouseList, addHome, editHome, submitHome, checkStock, getWalletList } from "@/api/supply/engin";
+import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getWalletList } from "@/api/supply/engin";
 import { getDictList, getTypeList } from '@/api/common'
 
 export default {
@@ -497,7 +498,7 @@ export default {
         let data = res.data;
         this.mainForm.orderNum = data.enginOrderId;
         this.mainForm.orderDate = data.orderDate;
-        this.mainForm.type = data.refProductCategory;
+        this.mainForm.type = data.mainId;
         this.mainForm.jxsNum = data.customerId;
         this.mainForm.jxsName = data.customerName;
         this.mainForm.loginNum = data.refEnginRecordNo;
@@ -506,9 +507,9 @@ export default {
         this.mainForm.factoryNum = data.refFactoryNo;
         this.mainForm.company = data.refUseUnit;
         this.mainForm.saleType = data.saleTypeId;
-        this.mainForm.contactMan = data.aaa;
-        this.mainForm.tel = data.aaa;
-        this.mainForm.phone = data.aaa;
+        this.mainForm.contactMan = data.refLinkman;
+        this.mainForm.tel = data.refTel;
+        this.mainForm.phone = data.refPhone;
         this.mainForm.address = data.refInstallAddress;
         this.mainForm.greeRemark = data.note2;
         this.mainForm.greeReply = data.note1;
@@ -568,10 +569,45 @@ export default {
 
     // 选择工程登录
     chooseItem(id) {
-      addHome({refEnginRecordNo: id}).then(res => {
+      getHomeLoginDetail({recordNo: id}).then(res => {
         this.isShowDialog = false;
-        this.editId = res.data;
-        this.getDetail();
+        let data = res.data;
+        this.mainForm.type = data.productCategory;
+        this.mainForm.saleType = '';
+        this.mainForm.loginNum = data.recordNo;
+        this.mainForm.enginName = data.projectName;
+        this.mainForm.loginType = data.promiseStatus;
+        this.mainForm.company = data.useUnit;
+        this.mainForm.contactMan = data.buyUnitCallMen;
+        this.mainForm.tel = data.buyUnitTel;
+        this.mainForm.phone = data.buyUnitPhone;
+        this.mainForm.address = data.installAddress;
+
+        this.goodsList = data.items.map(item => {
+          return {
+            useRefCount: '',
+            saleTypeName: '',
+            materialNumber: '',
+            materialOldNumber: item.code,
+            materialName: item.name,
+            specification: item.machine,
+            baseUnitId: '',
+            price: item.price,
+            enginNum: '',
+            qty: item.num,
+            customerWalletId2: '',
+            rebateRate: '',
+            discAmount: '',
+            customerWalletId: '',
+            isDirectTransfer: false,
+            directTransferQty: '',
+            hasSendQty: '',
+            remark: item.discri,
+            tax: '',
+            status1: '',
+            status2: '',
+          }
+        })
       })
     },
 
@@ -647,25 +683,24 @@ export default {
     clickSubmitForm(type) {
       this.$refs.mainForm.validate((valid) => {
         if (valid) {
+          for(let i=0; i<this.goodsList.length; i++) {
+            if(!this.goodsList[i].customerWalletId) {
+              this.$errorMsg('请选择现金钱包');
+              return;
+            }
+          }
+
           let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
           let params = {
             enginOrderId: this.mainForm.orderNum,
             orderDate: this.mainForm.orderDate,
-            refProductCategory: this.mainForm.type || '',
-            // customerId: this.mainForm.jxsNum,
-            // customerName: this.mainForm.jxsName,
+            mainId: this.mainForm.type || '',
             refEnginRecordNo: this.mainForm.loginNum || '',
-            refProjectName: this.mainForm.enginName || '',
-            refPromiseStatus: this.mainForm.loginType || '',
             refFactoryNo: this.mainForm.factoryNum || '',
-            refUseUnit: this.mainForm.company || '',
             saleTypeId: this.mainForm.saleType,
             saleTypeCode: saleTypeItem.saleCode,
             saleTypeName: saleTypeItem.saleName,
-            // aaa: this.mainForm.contactMan,
-            // aaa: this.mainForm.tel,
-            // aaa: this.mainForm.phone,
-            refInstallAddress: this.mainForm.address || '',
+            buyUnitPhone: this.mainForm.phone,
             note2: this.mainForm.greeRemark || '',
             note1: this.mainForm.greeReply || '',
             remark: this.mainForm.remark || '',
@@ -673,11 +708,19 @@ export default {
             items: this.goodsList,
           }
           if(type === 1) {
-            editHome(params).then(res => {
-              this.$successMsg('编辑成功');
-              this.goBack();
-              this.$parent.getList();
-            })
+            if(this.listItem) {
+              editHome(params).then(res => {
+                this.$successMsg('编辑成功');
+                this.goBack();
+                this.$parent.getList();
+              })
+            }else {
+              addHome(params).then(res => {
+                this.$successMsg('新增成功');
+                this.goBack();
+                this.$parent.getList();
+              })
+            }
           }else if(type === 2) {
             submitHome(params).then(res => {
               this.$successMsg('提交审核成功');

+ 1 - 1
src/views/supply/retail/components/retail_form.vue

@@ -421,7 +421,7 @@ export default {
       getGoodsList({
         pageNum: this.currentPage,
         pageSize: 10,
-        mainId: this.screenForm.type,
+        mainId: this.mainForm.type,
         saleId: this.screenForm.salesType,
         materialCode: this.screenForm.proNum,
         materialName: this.screenForm.proName,