浏览代码

进口调试

qinbai 3 年之前
父节点
当前提交
352a4029b3

+ 13 - 0
src/api/importTrade/purchase.js

@@ -60,3 +60,16 @@ export function getSysNo(prefix) {
     params: {prefix}
   })
 }
+
+//获取采购明细列表
+export function getItemListByConditions(current,size,params) {
+  return request({
+    url: '/api/trade-purchase/purchase-order/getItemListByConditions',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}

+ 8 - 0
src/api/importTrade/receipt.js

@@ -68,3 +68,11 @@ export function confirmReceipt(data) {
     data: data
   })
 }
+//撤销收货
+export function repealReceipt(data) {
+  return request({
+    url: 'api/blade-deliver-goods/importDelivery/cancel',
+    method: 'post',
+    data: data
+  })
+}

+ 43 - 25
src/components/procurement/config/mainList.json

@@ -17,59 +17,77 @@
   "border": true,
   "index": true,
   "selection": true,
-  "menuWidth": 180,
+  "menu": false,
+  "menuWidth": 0,
   "dialogClickModal": false,
   "column":[
     {
+      "label": "合同号",
+      "prop": "orderNo",
+      "search": true,
+      "index": 1,
+      "width":180
+    },
+    {
       "label": "提单号",
       "prop": "billNo",
-      "index": 1,
+      "index": 2,
       "width":180
-    },{
+    },
+    {
+      "label": "供应商",
+      "prop": "strCorpName",
+      "search": true,
+      "index": 3,
+      "width":180
+    },
+    {
       "label": "货物品种",
       "prop": "priceCategory",
-      "index": 2,
+      "index": 4,
       "width":120
     },{
-      "label": "货物详情",
-      "prop": "itemDescription",
-      "index": 3,
-      "width":180
+      "label": "规格名称",
+      "prop": "itemType",
+      "index": 5,
+      "width":120
     },{
-      "label": "箱号",
-      "prop": "containerNo",
-      "index": 4,
-      "width":100
+      "label": "件数",
+      "prop": "purchaseQuantity",
+      "index": 6,
+      "width":120
     },{
       "label": "发票净重(吨)",
       "prop": "invoiceWeight",
-      "index": 5,
+      "index": 7,
       "width":120
     },{
       "label": "码单重量(吨)",
       "prop": "billWeight",
-      "index": 6,
-      "width":120
-    },{
-      "label": "件数",
-      "prop": "purchaseQuantity",
-      "index": 7,
+      "index": 8,
       "width":120
     },{
       "label": "单价",
       "prop": "price",
-      "index": 8,
+      "index": 9,
       "width":120
     },{
       "label": "合同金额",
       "prop": "amount",
-      "index": 9,
-      "width":120
-    },{
-      "label": "税率",
-      "prop": "taxRate",
       "index": 10,
       "width":120
+    },{
+      "label": "采购日期",
+      "prop": "promentDate",
+      "hide": true,
+      "type": "date",
+      "format": "yyyy-MM-dd",
+      "valueFormat": "yyyy-MM-dd",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true,
+      "index": 6,
+      "width":150
     }
   ]
 }

+ 86 - 0
src/components/procurement/index.vue

@@ -0,0 +1,86 @@
+<template>
+  <div>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               ref="crud"
+               @refresh-change="refreshChange"
+               @selection-change="selectionChange"
+               @search-change="searchChange"
+               :page.sync="page"
+               @on-load="onLoad">
+    </avue-crud>
+    <div style="margin-left: 90%">
+       <span slot="footer" class="dialog-footer" >
+           <el-button @click="closeFun()">取 消</el-button>
+           <el-button type="primary" @click="importProMent" :disabled="selectPromentList.length == 0">导入</el-button>
+       </span>
+    </div>
+  </div>
+</template>
+
+<script>
+  import option from './config/mainList.json'
+  import {getItemListByConditions} from "@/api/importTrade/purchase";
+
+  export default {
+    name: "index",
+    props: {
+      itemId: {
+        type: String
+      },
+      closeFun: {
+        type: Function
+      }
+    },
+    data(){
+      return {
+        option:option,
+        loading:false,
+        data:[],
+        selectPromentList:[],
+        page: {
+          pageSize: 10,
+          pagerCount: 5,
+          total: 0,
+        },
+      }
+    },
+    created() {
+
+    },
+    methods:{
+      refreshChange(){
+        this.onLoad(this.page);
+      },
+      searchChange(params,done){
+        this.onLoad(this.page, params);
+        done()
+      },
+      selectionChange(row){
+        this.selectPromentList = row
+      },
+      onLoad(page, params = {}){
+        this.loading = true;
+        if (params.promentDate != undefined) {
+          params.startDate = params.promentDate[0]+ " " + "00:00:00";
+          params.endDate = params.promentDate[1] + " " + "23:59:59";
+          this.$delete(params,'promentDate')
+        }
+        params.tradeType = "JK"
+        getItemListByConditions(page.currentPage, page.pageSize,params).then(res=>{
+          this.data = res.data.data.records
+          this.page.total = res.data.data.total
+        }).finally(()=>{
+          this.loading = false;
+        })
+      },
+      importProMent(){
+        this.$emit('importProMent',this.selectPromentList);
+      }
+    }
+  }
+</script>
+<style scoped>
+
+</style>

+ 0 - 59
src/components/procurement/procurementDetail.vue

@@ -1,59 +0,0 @@
-<template>
-    <div>
-      <avue-crud :option="option"
-                 :table-loading="loading"
-                 :data="data"
-                 ref="crud"
-                 @refresh-change="refreshChange"
-                 :page.sync="page"
-                 @on-load="onLoad">
-      </avue-crud>
-       <span slot="footer" class="dialog-footer" >
-          <el-button type="primary"  @click="closeFun()">关 闭</el-button>
-         <el-button type="primary"  @click="closeFun()">导 入</el-button>
-       </span>
-    </div>
-</template>
-
-<script>
-  import option from "./config/mainList.json"
-
-   export default {
-        name: "detail",
-      props:{
-          status:{
-            type:String
-          },
-        closeFun:{
-          type:Function
-        }
-      },
-      data(){
-          return {
-            option:option,
-            loading:false,
-            data:[],
-            page: {
-              pageSize: 10,
-              pagerCount: 5,
-              total: 0,
-            },
-          }
-      },
-      created() {
-
-      },
-      methods:{
-        refreshChange(){
-
-        },
-        onLoad(){
-
-        }
-      }
-    }
-</script>
-
-<style scoped>
-
-</style>

+ 1 - 1
src/components/selectComponent/customerSelect.vue

@@ -4,7 +4,7 @@
         v-model="value"
         size="small"
         :placeholder="configuration.placeholder"
-        style="border-right: none;"
+        style="border-right: none;width: 100%"
         :disabled="disabled?disabled:false"
         :multiple="configuration.multiple?configuration.multiple:false"
         :collapse-tags="configuration.collapseTags?configuration.collapseTags:false">

+ 31 - 38
src/views/importTrade/receipt/config/customerContact.json

@@ -12,7 +12,7 @@
   "searchMenuSpan": 6,
   "dialogWidth": "60%",
   "align": "center",
-  "delBtn":true,
+  "delBtn":false,
   "tree": true,
   "border": true,
   "index": true,
@@ -35,7 +35,7 @@
     },{
       "label": "合同号",
       "prop": "contractNumber",
-      "index": 1,
+      "index": 2,
       "width":150,
       "rules": [
         {
@@ -47,21 +47,8 @@
     },{
       "label": "货物品种",
       "prop": "priceCategory",
-      "index": 2,
-      "width":120,
-      "rules": [
-        {
-          "required": false,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
-    },{
-      "label": "货物详情",
-      "prop": "itemDescription",
       "index": 3,
-      "width":150,
-      "cell": true,
+      "width":200,
       "rules": [
         {
           "required": false,
@@ -70,18 +57,16 @@
         }
       ]
     },
-    {
-      "label": "箱号",
-      "prop": "containerNo",
+   {
+      "label": "件数",
+      "prop": "actualQuantity",
       "index": 4,
       "width":120
-    },
-   {
-      "label": "发票净重(吨)",
-      "prop": "invoiceWeight",
-      "index": 6,
+    },{
+      "label": "单价",
+      "prop": "price",
+      "index": 5,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -90,11 +75,10 @@
         }
       ]
     },{
-      "label": "码单重量(吨)",
-      "prop": "billWeight",
-      "index": 7,
+      "label": "合同金额",
+      "prop": "contractAmount",
+      "index": 6,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -103,10 +87,17 @@
         }
       ]
     },{
-      "label": "件数",
-      "prop": "actualQuantity",
+      "label": "箱号",
+      "prop": "containerNo",
+      "index": 7,
+      "cell": true,
+      "width":120
+    },{
+      "label": "发票净重(吨)",
+      "prop": "invoiceWeight",
       "index": 8,
       "width":120,
+      "cell": true,
       "rules": [
         {
           "required": false,
@@ -115,10 +106,11 @@
         }
       ]
     },{
-      "label": "单价",
-      "prop": "price",
+      "label": "码单重量(吨)",
+      "prop": "billWeight",
       "index": 9,
       "width":120,
+      "cell": true,
       "rules": [
         {
           "required": false,
@@ -127,10 +119,11 @@
         }
       ]
     },{
-      "label": "合同金额",
-      "prop": "contractAmount",
-      "index": 9,
-      "width":120,
+      "label": "货物详情",
+      "prop": "itemDescription",
+      "index": 10,
+      "width":150,
+      "cell": true,
       "rules": [
         {
           "required": false,
@@ -141,7 +134,7 @@
     },{
       "label": "税率",
       "prop": "taxRate",
-      "index": 10,
+      "index": 11,
       "width":120,
       "cell": true,
       "rules": [

+ 113 - 53
src/views/importTrade/receipt/detailsPageEdit.vue

@@ -9,7 +9,8 @@
       <el-button type="primary"
                  class="el-button--small-yh add-customer-btn-three"
                  :disabled="!form.id"
-                 @click.stop="confirmReceipt">确认收货
+                 @click.stop="confirmReceipt">
+        {{receiptDisable ?"撤销收货":"确认收货"}}
       </el-button>
       <el-button type="success"
                  class="el-button--small-yh add-customer-btn-two"
@@ -19,7 +20,7 @@
       <el-button
         class="el-button--small-yh add-customer-btn"
         type="primary"
-        :disabled="disabled"
+        :disabled="disabled || receiptDisable"
         @click="editCustomer"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
@@ -31,13 +32,13 @@
           <el-row>
             <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
               <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
-                <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="date" placeholder="请选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
+                <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" :disabled="receiptDisable" size="small" type="date" placeholder="请选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
                 <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
-                <el-select v-else-if="item.prop === 'storageId'" style="width: 100%"   v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
+                <el-select v-else-if="item.prop === 'storageId'" style="width: 100%" :disabled="receiptDisable"  v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
                   <el-option v-for="(item,index) in storageIdDic" :key="index" :label="item.cname" :value="item.id"></el-option>
                 </el-select>
-                <el-input type="textarea" v-else-if="(item.prop === 'deliveryRemarks')" v-model="form[item.prop]"   size="small" autocomplete="off" placeholder="请输入"></el-input>
-                <el-input v-else v-model="form[item.prop]" size="small" :disabled="item.disabled?true:false" placeholder="请输入" autocomplete="off"></el-input>
+                <el-input type="textarea" v-else-if="(item.prop === 'deliveryRemarks')" v-model="form[item.prop]"  :disabled="receiptDisable" size="small" autocomplete="off" placeholder="请输入"></el-input>
+                <el-input v-else v-model="form[item.prop]" size="small" :disabled="item.disabled?true:false || receiptDisable" placeholder="请输入" autocomplete="off"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -55,7 +56,7 @@
             @row-del="rowDel"
           >
             <template slot-scope="{row}" slot="billNo">
-              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
               <el-input
                 v-if="row.$cellEdit"
                 v-model="row.billNo"
@@ -67,10 +68,10 @@
               <span v-else>{{ row.billNo }}</span>
             </template>
             <template slot-scope="{row}" slot="contractNumber">
-              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
               <el-select
                 v-if="row.$cellEdit"
-                style="width:90%"
+                style="width:90% !important;"
                 v-model="row.contractNumber"
                 placeholder=" "
                 size="small"
@@ -82,14 +83,24 @@
                   v-for="(item,index) in contractDic"
                   :key="index"
                   :label="item.orderNo"
+                  @change="sumOrderNo()"
                   :value="item.orderNo"
                 ></el-option>
               </el-select>
               <span v-else>{{ row.contractNumber }}</span>
             </template>
             <template slot="priceCategory" slot-scope="{row,index}">
-              <span style="margin-left: 12px;padding-top: 2px">{{ row.priceCategoryNames }}</span>
-              <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.priceCategoryNames"
+                size="small"
+                placeholder="请点击右侧按钮选择"
+                :disabled="true"
+                style="width: 63%"
+              ></el-input>
+              <el-button v-if="row.$cellEdit" size="small" icon="el-icon-search" @click="choice(row)"></el-button>
+              <span v-else>{{ row.priceCategoryNames }}</span>
             </template>
             <template slot="invoiceWeight" slot-scope="{ row }">
               <el-input
@@ -125,9 +136,11 @@
               <span v-else>{{ row.price }}</span>
             </template>
             <template slot="actualQuantity" slot-scope="{ row }">
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
               <el-input
                 v-if="row.$cellEdit"
                 v-model="row.actualQuantity"
+                style="width: 93%"
                 placeholder="请输入"
                 size="small"
                 oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
@@ -139,14 +152,23 @@
               <el-button
                 type="text"
                 size="small"
+                :disabled="receiptDisable"
                 @click="rowCell(row,index)"
               >{{ row.$cellEdit ? '保存' : '修改' }}
               </el-button>
+              <el-button
+                type="text"
+                size="small"
+                :disabled="receiptDisable"
+                @click="rowDel(row,index)"
+              >删除
+              </el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
               <el-button type="primary"
                          icon="el-icon-plus"
                          size="small"
+                         :disabled="receiptDisable"
                          @click="commoditySelection"
               >录入明细
               </el-button>
@@ -202,9 +224,6 @@
       <span slot="footer" class="dialog-footer">
           <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="commodityConfirm" v-if="selectKind != -1"  :disabled="tableData.length !== 1">确定</el-button>
-<!--          <el-button type="primary" @click="importGoods" v-if="commodityData !== true  && selectKind == -1" :disabled="tableData.length !== 1" >导入</el-button>-->
-<!--          <el-button type="primary" @click="importChoice" v-if="commodityData === true  && selectKind == -1"-->
-<!--                     :disabled="tableData.length !== 1">导入</el-button>-->
         </span>
     </el-dialog>
     <el-dialog
@@ -215,10 +234,12 @@
       width="60%"
       :close-on-click-modal="false"
       :destroy-on-close="true"
-      :close-on-press-escape="false">
+      :modal-append-to-body='false'
+      :close-on-press-escape="false"
+      v-dialog-drag>
       <procurement-detail
-        :status="132"
-        :closeFun="procurementClose"
+        @closeFun="!procurementDialog"
+       @importProMent="importProMent"
       >
       </procurement-detail>
     </el-dialog>
@@ -235,7 +256,8 @@ import {detailReceiptList,
   removeGoodsItem,
   getStorage,
   getInventory,
-  confirmReceipt
+  confirmReceipt,
+  repealReceipt
 } from "@/api/importTrade/receipt"
 import {
   getList
@@ -244,7 +266,8 @@ import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.j
 import {detailListData } from "@/api/importTrade/purchase";
 import { contrastObj,contrastList } from "@/util/contrastData";
 import { getOrgOrderNo } from "@/api/importTrade/salesContract"
-import { procurementDetail } from "@/components/procurement/procurementDetail";
+import  procurementDetail from "@/components/procurement/index";
+import _ from "lodash";
 
 export default {
   name: "detailsPageEdit",
@@ -260,6 +283,7 @@ export default {
     return {
       form: {},
       disabled: false,
+      receiptDisable:false,
       customerContact: customerContact,
       contactsForm: {},
       contactsData: [],
@@ -435,6 +459,8 @@ export default {
       detailReceiptList(id).then(res => {
         this.form = res.data.data;
         this.oldForm = Object.assign({},res.data.data);
+        this.receiptDisable = res.data.data.deliveryStatus === "已收货" ?   true :false
+        this.configuration.disabled = this.receiptDisable
         if(this.form.companyName){
           this.configuration.dicData = this.form.companyName
         }
@@ -448,35 +474,40 @@ export default {
         }
       })
     }
-    // else{
-    //   getSysNo("JK-SH").then(res =>{
-    //     this.$set(this.form,"sysNo", res.data.data)
-    //   })
-    // }
     if(this.detailData.params){
       detailListData(this.detailData.params.id).then(res =>{
-        // this.form.orderNo =  res.data.data.orderNo;
-        // this.form.saleman =  res.data.data.salesName;
-        // this.configuration.dicData = res.data.data.corpsName
-        // this.form.corpId = res.data.data.corpsName[0].cname
+        const orderNoList = [];
         res.data.data.itemsVOList.forEach((item,index) =>{
           this.detailData.params.orderItemIds.forEach((e,i) =>{
             if(e ==  index){
               item.srcId =  item.id;
               item.contractNumber =  res.data.data.orderNo;
-              item.actualQuantity =  item.purchaseQuantity;
+              orderNoList.push(item.contractNumber)
+              if(item.actualQuantity !== 0){   //如果收过货
+                item.actualQuantity = _.subtract(item.purchaseQuantity, item.actualQuantity); //收货件数 = 采购件数 - 已收件数
+              }else{
+                item.actualQuantity =  item.purchaseQuantity;
+              }
               item.contractAmount =  item.amount;
               delete item.id
-              delete item.actualQuantity
               this.$refs.crudContact.rowCellAdd(item);
               this.$refs.crudContact.rowCell(item,this.contactsData.length - 1)
             }
           })
         })
+        this.$set(this.form,'orderNo', Array.from(new Set(orderNoList)).join(","))
+        this.$set(this.form,'saleman',res.data.data.salesName)
+        this.$set(this.form,'corpId',res.data.data.corpsName[0].id)
+        this.$set(this.configuration,'dicData', res.data.data.corpsName)
       })
     }
   },
   methods: {
+    sumOrderNo(){
+      //拿到所有明细合同号 去重加逗号放到主表合同号
+      const contractNumberList =  this.contactsData.map(item =>{item.contractNumber})
+      this.$set(this.form,'orderNo', Array.from(new Set(contractNumberList)).join(","))
+    },
     //合计
     totalChange(){
       let invoiceList =  this.contactsData.map(item => {
@@ -499,7 +530,8 @@ export default {
       getOrgOrderNo(row.billNo).then(res =>{
         if(res.data){
           this.contractDic = res.data;
-          row.contractNumber =  res.data[0].orderNo
+          row.contractNumber =  res.data[0].orderNo;
+          this.sumOrderNo()
         }
       }).catch(()=>{
         row.contractNumber = ''
@@ -511,7 +543,7 @@ export default {
         row.price = "";
         row.contractAmount = 0
       } else {
-        row.contractAmount = (row.actualQuantity * row.price).toFixed(2);
+        row.contractAmount = _.multiply(row.actualQuantity,row.price).toFixed(2);
       }
     },
     //件数
@@ -520,7 +552,7 @@ export default {
         row.actualQuantity = "";
         row.contractAmount = 0
       } else {
-        row.contractAmount = (row.actualQuantity * row.price).toFixed(2);
+        row.contractAmount = _.multiply(row.actualQuantity,row.price).toFixed(2);
       }
     },
     //新增商品信息保存触发
@@ -568,12 +600,18 @@ export default {
     editCustomer(status) {
       this.$refs["form"].validate((valid) => {
         for (let i = 0; i < this.contactsData.length; i++) {
-          if (this.contactsData[i].billNo == null) {
+          if (this.contactsData[i].billNo === "") {
             return this.$message.error(`请输入第${i + 1}行的提单号`);
           }
-          if (this.contactsData[i].contractNumber == null) {
+          if (this.contactsData[i].contractNumber === "") {
             return this.$message.error(`请输入第${i + 1}行的合同号`);
           }
+          if (this.contactsData[i].priceCategory === "") {
+            return this.$message.error(`请输入第${i + 1}行的货物品种`);
+          }
+          if (this.contactsData[i].actualQuantity == null) {
+            return this.$message.error(`请输入第${i + 1}行的件数`);
+          }
         }
         if (valid) {
           let submitDto = {
@@ -587,6 +625,7 @@ export default {
               detailReceiptList(res.data.data.id).then(res => {
                 this.form = res.data.data;
                 this.oldForm = Object.assign({},res.data.data);
+                this.receiptDisable = res.data.data.deliveryStatus === "已收货" ?   true :false
                 this.configuration.dicData = this.form.companyName
                 if(this.form.deliveryItemsList){
                   this.contactsData = this.form.deliveryItemsList
@@ -612,7 +651,7 @@ export default {
       if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
         || contrastList(this.upLoadData,this.oldUpLoadData)
       ){
-        this.$confirm("请先保存在进行收货?", {
+        this.$confirm("请先保存在进行操作!", {
           confirmButtonText: "保存",
           cancelButtonText: "取消",
           type: "warning"
@@ -620,17 +659,42 @@ export default {
           this.editCustomer()
         })
       }else{
-        this.$confirm("是否确认收货?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(()=>{
-          this.form.deliveryItemsList = this.contactsData;
-          confirmReceipt(this.form).then(res =>{
+        if(!this.receiptDisable){
+          this.$confirm("是否确认收货?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(()=>{
+            this.form.deliveryItemsList = this.contactsData;
+            confirmReceipt(this.form).then(res =>{
+              if(res.data.success){
+                this.$message.success("收货成功!")
+                this.receiptDisable = res.data.data.deliveryStatus === "已收货" ?   true :false
+              }
+            })
           })
-        })
+        }else{
+          this.$confirm("是否撤销收货!", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(()=>{
+            this.form.deliveryItemsList = this.contactsData;
+            repealReceipt(this.form).then(res =>{
+              if(res.data.success){
+                this.$message.success("撤销成功!")
+                this.receiptDisable = res.data.data.deliveryStatus === "已收货" ?   true :false
+              }
+            })
+          })
+        }
       }
     },
+    //导入采购明细
+    importProMent(list){
+      this.procurementDialog = false;
+      this.$refs.crudContact.rowCellAdd(list);
+    },
     //上传文件保存
     upLoadSave(row, done, loading){
       this.upLoadData.push(row)
@@ -677,14 +741,6 @@ export default {
         this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
         this.contactsData[this.selectKind].itemDescription = this.tableData[0].cnameDescription;
         this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
-        // let  params = {
-        //   corpId : this.form.corpId,
-        //   storageId: this.form.storageId,
-        //   goodId:  this.contactsData[this.selectKind].priceCategory,
-        //   cntrNo: this.contactsData[this.selectKind].containerNo ,
-        //   billNo: this.contactsData[this.selectKind].billNo ,
-        //   contractNumber:  this.contactsData[this.selectKind].contractNumber,
-        // }
         this.dialogVisible = !this.dialogVisible
         this.selectKind = -1;
       }
@@ -817,7 +873,11 @@ export default {
 ::v-deep .el-form-item {
   margin-bottom: 0;
 }
-
+.required_fields{
+  color: #F56C6C;
+  display:inline-block;
+  width: 7%
+}
 .add-customer-btn-two {
   position: fixed;
   right: 150px;

+ 30 - 38
src/views/purchase/contract/config/customerContact.json

@@ -11,7 +11,7 @@
   "refreshBtn": false,
   "searchMenuSpan": 6,
   "align": "center",
-  "delBtn":true,
+  "delBtn":false,
   "dialogWidth": "60%",
   "tree": true,
   "border": true,
@@ -37,7 +37,7 @@
       "label": "货物品种",
       "prop": "priceCategory",
       "index": 2,
-      "width":120,
+      "width":200,
       "cell": false,
       "rules": [
         {
@@ -47,24 +47,26 @@
         }
       ]
     },{
-      "label": "货物详情",
-      "prop": "itemDescription",
+      "label": "规格型号",
+      "prop": "itemType",
       "index": 3,
-      "width":180,
-      "cell": true,
-      "rules": [
-        {
-          "required": false,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
-    },{
-      "label": "箱号",
-      "prop": "cntrNo",
+      "width":150
+    },
+    {
+      "label": "件数",
+      "prop": "purchaseQuantity",
       "index": 4,
-      "width":100,
-      "cell": true,
+      "width":120
+    },{
+      "label": "单价",
+      "prop": "price",
+      "index": 5,
+      "width":120
+    },{
+      "label": "合同金额",
+      "prop": "amount",
+      "index": 6,
+      "width":120,
       "rules": [
         {
           "required": false,
@@ -74,11 +76,10 @@
       ]
     },
     {
-      "label": "已数量",
+      "label": "已数量",
       "prop": "actualQuantity",
-      "index": 4,
+      "index": 7,
       "width":100,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -89,7 +90,7 @@
     },{
       "label": "发票净重(吨)",
       "prop": "invoiceWeight",
-      "index": 5,
+      "index": 8,
       "width":120,
       "rules": [
         {
@@ -101,23 +102,14 @@
     },{
       "label": "码单重量(吨)",
       "prop": "billWeight",
-      "index": 6,
-      "width":120
-    },{
-      "label": "件数",
-      "prop": "purchaseQuantity",
-      "index": 7,
-      "width":120
-    },{
-      "label": "单价",
-      "prop": "price",
-      "index": 8,
+      "index": 9,
       "width":120
     },{
-      "label": "合同金额",
-      "prop": "amount",
-      "index": 9,
-      "width":120,
+      "label": "货物详情",
+      "prop": "itemDescription",
+      "index": 10,
+      "width":180,
+      "cell": true,
       "rules": [
         {
           "required": false,
@@ -128,7 +120,7 @@
     },{
       "label": "税率",
       "prop": "taxRate",
-      "index": 10,
+      "index": 11,
       "width":120,
       "cell": true,
       "rules": [

+ 119 - 46
src/views/purchase/contract/detailsPage.vue

@@ -67,28 +67,63 @@
             @row-update="rowUpdate"
             @row-del="rowDel"
           >
-            <template slot="price" slot-scope="{ row }">
+            <template slot="priceCategory" slot-scope="{row,index}">
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
               <el-input
                 v-if="row.$cellEdit"
-                v-model="row.price"
-                placeholder="请输入"
+                v-model="row.priceCategoryNames"
                 size="small"
-                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-                @input="priceChange(row)"
+                placeholder="请点击右侧按钮选择"
+                :disabled="true"
+                style="width: 63%"
               ></el-input>
-              <span v-else>{{ row.price }}</span>
+              <el-button v-if="row.$cellEdit" size="small" icon="el-icon-search" @click="choice(row)"></el-button>
+              <span v-else>{{ row.priceCategoryNames }}</span>
+            </template>
+            <template slot="itemType" slot-scope="{row,index}">
+              <span v-if="row.$cellEdit"  class="required_fields">*</span>
+              <el-select
+                v-if="row.$cellEdit"
+                v-model="row.itemType"
+                size="small"
+                style="width:90% !important;"
+                clearable
+                filterable
+              >
+                <el-option
+                  v-for="(item,index) in row.specificationList"
+                  :key="index"
+                  :label="item.value"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+              <span v-else>{{ row.itemType }}</span>
             </template>
             <template slot="purchaseQuantity" slot-scope="{ row }">
+              <span v-if="row.$cellEdit" class="required_fields">*</span>
               <el-input
                 v-if="row.$cellEdit"
                 v-model="row.purchaseQuantity"
                 placeholder="请输入"
                 size="small"
+                style="width: 93%"
                 oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
                 @input="quantityChange(row)"
               ></el-input>
               <span v-else>{{ row.purchaseQuantity }}</span>
             </template>
+            <template slot="price" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.price"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                @input="priceChange(row)"
+              ></el-input>
+              <span v-else>{{ row.price }}</span>
+            </template>
             <template slot="invoiceWeight" slot-scope="{ row }">
               <el-input
                 v-if="row.$cellEdit"
@@ -111,17 +146,21 @@
               ></el-input>
               <span v-else>{{ row.billWeight }}</span>
             </template>
-            <template slot="priceCategory" slot-scope="{row,index}">
-              <span style="margin-left: 12px;padding-top: 2px">{{ row.priceCategoryNames }}</span>
-              <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
-            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                 type="text"
                 size="small"
+                :disabled="row.actualQuantity !=0"
                 @click="rowCell(row,index)"
               >{{ row.$cellEdit ? '修改完成' : '修改' }}
               </el-button>
+              <el-button
+                type="text"
+                size="small"
+                :disabled="row.actualQuantity !=0"
+                @click="rowDel(row,index)"
+              >删除
+              </el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
               <el-button type="primary"
@@ -141,7 +180,7 @@
                          size="small"
                          :disabled="selectContact.length == 0"
                          @click="beforePage(false)"
-              >收货单
+              >生成收货单
               </el-button>
               <el-button type="info"
                          size="small"
@@ -249,10 +288,12 @@ import {detailListData, submitData,getSysNo} from "@/api/importTrade/purchase";
 import commodity from "./config/commodity.json"
 import feeInfo from "@/components/fee-info/main";
 import uploadFile from "@/components/upload-file/main";
+import _ from "lodash";
 //商品详情接口
 import {corpsattn, corpsbank,  getDeptLazyTreeS} from "@/api/basicData/configuration"
 import { getList } from "@/api/basicData/commodityType"
 import { contrastObj,contrastList } from "@/util/contrastData";
+import {getSpecification} from "@/api/exportTrade/purchaseContract";
 export default {
   name: "detailsPage",
   props: {
@@ -678,7 +719,7 @@ export default {
         row.price = "";
         row.amount = 0
       } else {
-        row.amount = (row.purchaseQuantity * row.price).toFixed(2);
+        row.amount = _.multiply(row.purchaseQuantity, row.price).toFixed(2);
       }
     },
     currencyChange(value){
@@ -688,7 +729,7 @@ export default {
           this.form.rmbAmount = this.form.orderAmount
         }else{
           this.form.exchangeRate = 6.3843
-          this.form.rmbAmount = this.form.orderAmount * 6.3843
+          this.form.rmbAmount =  _.multiply(this.form.orderAmount, 6.3843)
         }
       }
     },
@@ -715,7 +756,7 @@ export default {
         row.purchaseQuantity = "";
         row.amount = 0
       } else {
-        row.amount = (row.purchaseQuantity * row.price).toFixed(2);
+        row.amount =_.multiply(row.purchaseQuantity,row.price).toFixed(2);
       }
     },
     //修改提交触发
@@ -739,6 +780,15 @@ export default {
             if (this.contactsData[j].billNo == null) {
               return this.$message.error(`请输入第${j + 1}行的提单号`);
             }
+            if (this.contactsData[j].priceCategory === "") {
+              return this.$message.error(`请输入第${j + 1}行的货物品种`);
+            }
+            if (this.contactsData[j].itemType === "") {
+              return this.$message.error(`请输入第${j + 1}行的规格型号`);
+            }
+            if (this.contactsData[j].purchaseQuantity === "") {
+              return this.$message.error(`请输入第${j + 1}行的件数`);
+            }
           }
           let submitDto = {
             ...this.form,
@@ -796,43 +846,55 @@ export default {
           id:this.form.id,
           orderItemIds:this.selectContact.map(i=>{return i.$index})
         }
-        if(type){
-          //进入付款管理
-          if(this.$store.getters.payStatus){
-            this.$alert("付款页面已存在,请保存付款页面再进行操作", "温馨提示", {
-              confirmButtonText: "确定",
-              type: 'warning',
-              callback: action => {
-              }
-            });
-          }else{
-            this.$router.$avueRouter.closeTag('/financialManagement/payment');
-            this.$router.push({
-              path: "/financialManagement/payment",
-              query: {params: params},
-            });
-          }
+        if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
+          || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
+        ){
+          this.$confirm("您已改动数据,是否先保存在进行操作!", {
+            confirmButtonText: "保存",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(() => {
+            this.editCustomer();
+          })
         }else{
-          //进入收货单
-          if(this.$store.getters.takeStatus){
-            this.$alert("收货单页面已存在,请保存收货单再进行操作", "温馨提示", {
-              confirmButtonText: "确定",
-              type: 'warning',
-              callback: action => {
-              }
-            });
+          if(type){
+            //进入付款管理
+            if(this.$store.getters.payStatus){
+              this.$alert("付款页面已存在,请关闭付款页面再进行操作", "温馨提示", {
+                confirmButtonText: "确定",
+                type: 'warning',
+                callback: action => {
+                }
+              });
+            }else{
+              this.$router.$avueRouter.closeTag('/financialManagement/payment');
+              this.$router.push({
+                path: "/financialManagement/payment",
+                query: {params: params},
+              });
+            }
           }else{
-            //关闭一下存在的列表页
-            this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
-            this.$router.push({
-              path: "/importTrade/receipt/index",
-              query: {params: params},
-            });
+            //进入收货单
+            if(this.$store.getters.takeStatus){
+              this.$alert("收货单页面已存在,请关闭收货单再进行操作", "温馨提示", {
+                confirmButtonText: "确定",
+                type: 'warning',
+                callback: action => {
+                }
+              });
+            }else{
+              //关闭一下存在的列表页
+              this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
+              this.$router.push({
+                path: "/importTrade/receipt/index",
+                query: {params: params},
+              });
+            }
           }
         }
       }else{
         this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
-          confirmButtonText: "确定",
+          confirmButtonText: "保存",
           cancelButtonText: "取消",
           type: "warning"
         }).then(() => {
@@ -851,8 +913,14 @@ export default {
         this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
         this.contactsData[this.selectKind].itemId = this.tableData[0].id;
         this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
+        getSpecification({ goodId: this.tableData[0].id}).then(res =>{
+          this.$set(this.contactsData[this.selectKind],'itemType',res.data.data.map(item =>item)[0])
+          this.$set(this.contactsData[this.selectKind],'specificationList',res.data.data.map(item => ({ value: item })))
+        }).finally(()=>{
+          this.selectKind = -1
+        })
         this.dialogVisible = !this.dialogVisible
-        this.selectKind = -1
+
       }
     },
     //新增商品明细保存触发
@@ -1033,6 +1101,11 @@ export default {
   right: 150px;
   top: 115px;
 }
+.required_fields{
+  color: #F56C6C;
+  display:inline-block;
+  width: 7%
+}
 .add-customer-btn {
   position: fixed;
   right: 36px;