Forráskód Böngészése

进口库存调试

qinbai 3 éve
szülő
commit
85c240ac97

+ 18 - 0
src/api/importTrade/invoice.js

@@ -43,3 +43,21 @@ export function removeGoodsItem(data) {
     }
   })
 }
+
+//确认发货
+export function confirmGoods(data) {
+  return request({
+    url: '/api/blade-deliver-goods/importDelivery/save',
+    method: 'post',
+    data: data
+  })
+}
+
+//撤销发货
+export function cancelGoods(data) {
+  return request({
+    url: '/api/blade-deliver-goods/importDelivery/repeal',
+    method: 'post',
+    data: data
+  })
+}

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

@@ -1,5 +1,5 @@
 <template>
-  <span class="select-component" style="display:inline-flex;">
+  <span class="select-component" style="display:inline-flex;width: 100%">
     <el-select
         v-model="value"
         size="small"

+ 15 - 5
src/views/importTrade/invoice/config/customerContact.json

@@ -23,7 +23,6 @@
       "prop": "billNo",
       "index": 1,
       "width":150,
-      "cell": true,
       "rules": [
         {
           "required": true,
@@ -36,7 +35,6 @@
       "prop": "contractNumber",
       "index": 2,
       "width":150,
-      "cell": true,
       "rules": [
         {
           "required": true,
@@ -70,11 +68,23 @@
         }
       ]
     },{
+      "label": "箱号",
+      "prop": "cntrNo",
+      "index": 4,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "发票净重(吨)",
       "prop": "invoiceWeight",
       "index": 5,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -87,7 +97,6 @@
       "prop": "billWeight",
       "index": 6,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -95,7 +104,8 @@
           "trigger": "blur"
         }
       ]
-    },{
+    },
+   {
       "label": "件数",
       "prop": "actualQuantity",
       "index": 7,

+ 195 - 64
src/views/importTrade/invoice/detailsPageEdit.vue

@@ -6,6 +6,12 @@
                    @click="backToList">返回列表
         </el-button>
       </div>
+      <el-button type="primary"
+                 class="el-button--small-yh add-customer-btn-three"
+                 :disabled="!form.id"
+                 @click.stop="confirmGoods">
+        {{goodsDisable ? "撤回发货":"确认发货"}}
+      </el-button>
       <el-button type="success"
                  class="el-button--small-yh add-customer-btn-two"
                  :disabled="true"
@@ -14,7 +20,7 @@
       <el-button
         class="el-button--small-yh add-customer-btn"
         type="primary"
-        :disabled="disabled"
+        :disabled="disabled  || goodsDisable"
         @click="editCustomer"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
@@ -26,15 +32,18 @@
           <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="item.disabled?true:false || goodsDisable" 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"/>
-                <selectComponent v-else-if="item.prop === 'salesCompany'" v-model="form[item.prop]" :configuration="sConfiguration"/>
-                <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false" placeholder="请输入"  size="small" autocomplete="off"></el-input>
+                <el-select v-else-if="item.prop === 'storageId'" style="width: 100%" :disabled="item.disabled?true:false || goodsDisable"  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')" :disabled="item.disabled?true:false || goodsDisable" v-model="form[item.prop]"   size="small" autocomplete="off" placeholder="请输入"></el-input>
+                <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false || goodsDisable" placeholder="请输入"  size="small" autocomplete="off"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
         </basic-container>
-        <containerTitle title="货明细"></containerTitle>
+        <containerTitle title="货明细"></containerTitle>
         <basic-container style="margin-bottom: 10px">
           <avue-crud
             :option="customerContact"
@@ -46,6 +55,65 @@
             @row-update="rowUpdate"
             @row-del="rowDel"
           >
+            <template slot-scope="{row}" slot="billNo">
+              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.billNo"
+                style="width: 90%"
+                placeholder=" "
+                size="small"
+                @change="bingOut(row)"
+              ></el-input>
+              <span v-else>{{ row.billNo }}</span>
+            </template>
+            <template slot-scope="{row}" slot="contractNumber">
+              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
+              <el-select
+                v-if="row.$cellEdit"
+                style="width:90%"
+                v-model="row.contractNumber"
+                placeholder=" "
+                size="small"
+                clearable
+                filterable
+              >
+                <el-option
+                  style="width:90%"
+                  v-for="(item,index) in contractDic"
+                  :key="index"
+                  :label="item.orderNo"
+                  :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" :disabled="goodsDisable" style="float: right" @click="choice(row)">选择</el-button>
+            </template>
+            <template slot="invoiceWeight" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.invoiceWeight"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
+                @input="totalChange(row.invoiceWeight)"
+              ></el-input>
+              <span v-else>{{ row.invoiceWeight }}</span>
+            </template>
+            <template slot="billWeight" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.billWeight"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
+                @input="totalChange(row.billWeight)"
+              ></el-input>
+              <span v-else>{{ row.billWeight }}</span>
+            </template>
             <template slot="price" slot-scope="{ row }">
               <el-input
                 v-if="row.$cellEdit"
@@ -68,14 +136,11 @@
               ></el-input>
               <span v-else>{{ row.actualQuantity }}</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="goodsDisable"
                 @click="rowCell(row,index)"
               >{{ row.$cellEdit ? '保存' : '修改' }}
               </el-button>
@@ -84,6 +149,7 @@
               <el-button type="primary"
                          icon="el-icon-plus"
                          size="small"
+                         :disabled="goodsDisable"
                          @click="commoditySelection"
               >新增
               </el-button>
@@ -151,13 +217,17 @@
 import customerContact from "./config/customerContact.json"
 import {detailInvoiceList,
   submitInvoiceList,
-  removeGoodsItem,} from "@/api/importTrade/invoice"
+  removeGoodsItem,
+  confirmGoods,
+  cancelGoods
+} from "@/api/importTrade/invoice"
 import {getDeptLazyTree } from "@/api/basicData/basicFeesDesc";
 import commodity from "./config/commodity.json"
 import {corpsbank, getList} from "@/api/basicData/deliveryNotice"
 import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json";
-import {getSysNo} from "@/api/importTrade/purchase";
 import { contrastObj,contrastList } from "@/util/contrastData";
+import {getStorage} from "@/api/importTrade/receipt"
+import { getOrgOrderNo } from "@/api/importTrade/salesContract"
 
 export default {
   name: "detailsPageEdit",
@@ -170,9 +240,12 @@ export default {
     return {
       form: {},
       disabled: false,
+      goodsDisable:false,
       customerContact: customerContact,
       contactsForm: {},
       contactsData: [],
+      storageIdDic:[],
+      contractDic:[],
       selectKind:-1,
       configuration:{
         multipleChoices:false,
@@ -183,15 +256,6 @@ export default {
         placeholder:'请点击右边按钮选择',
         dicData:[]
       },
-      sConfiguration:{
-        multipleChoices:false,
-        multiple:false,
-        disabled:false,
-        searchShow:true,
-        collapseTags:false,
-        placeholder:'请点击右边按钮选择',
-        dicData:[]
-      },
       basicData: {
         column: [
           {
@@ -199,8 +263,9 @@ export default {
             prop: 'sysNo',
             disabled:true,
           }, {
-            label: '合同号',
-            prop: 'orderNo',
+            label: '客户名称',
+            prop: 'corpId',
+            type:'component',
             rules: [
               {
                 required: true,
@@ -209,32 +274,19 @@ export default {
               }
             ]
           }, {
-            label: '发货日期',
-            prop: 'businessDate',
-            type:'datetime',
-            rules: [
-              {
-                required: false,
-                message: ' ',
-                trigger: 'blur'
-              }
-            ]
-          }, {
-            label: '业务员',
-            prop: 'saleman',
-            dicData: [],
+            label: '仓库名称',
+            prop: 'storageId',
             rules: [
               {
-                required: false,
+                required: true,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
-            label: '销售公司',
-            prop: 'salesCompany',
-            type:'component',
-            dicData: [],
+            label: '发货日期',
+            prop: 'businessDate',
+            type:'datetime',
             rules: [
               {
                 required: false,
@@ -243,9 +295,8 @@ export default {
               }
             ]
           }, {
-            label: '工厂/贸易商名称',
-            prop: 'corpId',
-            type:'component',
+            label: '业务员',
+            prop: 'saleman',
             dicData: [],
             rules: [
               {
@@ -254,10 +305,10 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '仓库名称',
-            prop: 'storageId',
-            dicData: [],
+          },  {
+            label: '发票重量',
+            prop: 'invoiceWeight',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -265,9 +316,10 @@ export default {
                 trigger: 'blur'
               }
             ]
-          },  {
-            label: '发票重量',
-            prop: 'invoiceWeight',
+          },{
+            label: '码单重量',
+            prop: 'billWeight',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -275,7 +327,7 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
+          },{
             label: '备注',
             prop: 'deliveryRemarks',
             span: 24,
@@ -332,13 +384,16 @@ export default {
     }
   },
   created() {
+    getStorage().then(res =>{
+      this.storageIdDic = res.data
+    })
     if (this.detailData.id) {
       let id = this.detailData.id.replace(/\"/g, "")
       detailInvoiceList(id).then(res => {
         this.form = res.data.data;
         this.oldForm = Object.assign({},res.data.data);
-        this.configuration.dicData = this.form.companyName
-        this.sConfiguration.dicData = this.form.salesCompanyNameList
+        this.goodsDisable = res.data.data.deliveryStatus === "已发货" ?   true :false
+        // this.configuration.dicData = this.form.companyName
         if(this.form.deliveryItemsList){
           this.contactsData = this.form.deliveryItemsList
           this.oldContactsData = this.deepClone(this.form.deliveryItemsList)
@@ -348,25 +403,51 @@ export default {
           this.oldUpLoadData = this.deepClone(this.form.deliveryFilesList)
         }
       })
-    }else {
-      getSysNo("JK-FH").then(res => {
-        this.$set(this.form, "sysNo", res.data.data)
-      })
     }
     if (this.detailData.form) {
       this.form = JSON.parse(this.detailData.form);
       this.form.id = null
+      this.form.sysNo = null
       this.form.orderItemsList.forEach(item =>{
+        item.srcId = item.id
+        item.contractNumber = item.orgOrderNo
+        item.contractAmount = item.amount
+        delete item.actualQuantity
         delete item.id
       })
       this.contactsData = this.form.orderItemsList
       delete this.form.orderItemsList
-      getSysNo("JK-FH").then(res => {
-        this.$set(this.form, "sysNo", res.data.data)
-      })
     }
   },
   methods: {
+    //码单合计
+    totalChange(){
+      let invoiceList =  this.contactsData.map(item => {
+        if(!item.invoiceWeight){
+          item.invoiceWeight = 0
+        }
+        return parseFloat(item.invoiceWeight);
+      });
+      let billList =  this.contactsData.map(item => {
+        if(!item.billWeight){
+          item.billWeight = 0
+        }
+        return parseFloat(item.billWeight);
+      });
+      this.form.invoiceWeight = invoiceList.reduce((n,m) => n + m)
+      this.form.billWeight = billList.reduce((n,m) => n + m)
+    },
+    //提单号带出合同号
+    bingOut(row){
+      getOrgOrderNo(row.billNo).then(res =>{
+        if(res.data){
+          this.contractDic = res.data;
+          row.contractNumber =  res.data[0].orderNo
+        }
+      }).catch(()=>{
+        row.contractNumber = ''
+      })
+    },
     //单价
     priceChange(row) {
       if (!row.price) {
@@ -444,6 +525,49 @@ export default {
         }
       })
     },
+    confirmGoods(){
+      if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
+        || contrastList(this.upLoadData,this.oldUpLoadData)
+      ){
+        this.$confirm("请先保存在进行操作!", {
+          confirmButtonText: "保存",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(()=>{
+          this.editCustomer()
+        })
+      }else{
+        if(!this.goodsDisable){
+          this.$confirm("是否确认发货?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(()=>{
+            this.form.deliveryItemsList = this.contactsData;
+            confirmGoods(this.form).then(res =>{
+              if(res.data.success){
+                this.$message.success("发货成功!")
+                this.goodsDisable = res.data.data.deliveryStatus === "已发货" ?   true :false
+              }
+            })
+          })
+        }else{
+          this.$confirm("是否撤回发货?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(()=>{
+            this.form.deliveryItemsList = this.contactsData;
+            cancelGoods(this.form).then(res =>{
+              if(res.data.success){
+                this.$message.success("撤销成功!")
+                this.goodsDisable = res.data.data.deliveryStatus === "已发货" ?   true :false
+              }
+            })
+          })
+        }
+      }
+    },
     //修改提交触发
     editCustomer(status) {
       this.$refs["form"].validate((valid) => {
@@ -466,8 +590,8 @@ export default {
               detailInvoiceList(res.data.data.id).then(res => {
                 this.form = res.data.data;
                 this.oldForm = Object.assign({},res.data.data);
-                this.configuration.dicData = this.form.companyName
-                this.sConfiguration.dicData = this.form.salesCompanyNameList
+                this.goodsDisable = res.data.data.deliveryStatus === "已发货" ?   true :false
+                // this.configuration.dicData = this.form.companyName
                 if(this.form.deliveryItemsList){
                   this.contactsData = this.form.deliveryItemsList
                   this.oldContactsData = this.deepClone(this.form.deliveryItemsList)
@@ -551,7 +675,6 @@ export default {
     },
     //确认导入触发
     importGoods() {
-      // this.contactsData = this.contactsData.concat(this.tableData)
       if (this.tableData.length > 0) {
         for (let item in this.tableData) {
           const params = {
@@ -665,4 +788,12 @@ export default {
     }
   }
 }
+.add-customer-btn-three {
+  position: fixed;
+  right: 266px;
+  top: 115px;
+}
+::v-deep .el-form-item__content{
+  line-height: 32px;
+}
 </style>

+ 30 - 26
src/views/importTrade/receipt/detailsPageEdit.vue

@@ -54,28 +54,6 @@
             @row-update="rowUpdate"
             @row-del="rowDel"
           >
-            <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="actualQuantity" slot-scope="{ row }">
-              <el-input
-                v-if="row.$cellEdit"
-                v-model="row.actualQuantity"
-                placeholder="请输入"
-                size="small"
-                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-                @input="quantityChange(row)"
-              ></el-input>
-              <span v-else>{{ row.actualQuantity }}</span>
-            </template>
             <template slot-scope="{row}" slot="billNo">
               <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
               <el-input
@@ -109,6 +87,10 @@
               </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>
+            </template>
             <template slot="invoiceWeight" slot-scope="{ row }">
               <el-input
                 v-if="row.$cellEdit"
@@ -131,9 +113,27 @@
               ></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 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="actualQuantity" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.actualQuantity"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                @input="quantityChange(row)"
+              ></el-input>
+              <span v-else>{{ row.actualQuantity }}</span>
             </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
@@ -467,6 +467,7 @@ export default {
               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)
             }
@@ -498,7 +499,10 @@ export default {
       getOrgOrderNo(row.billNo).then(res =>{
         if(res.data){
           this.contractDic = res.data;
+          row.contractNumber =  res.data[0].orderNo
         }
+      }).catch(()=>{
+        row.contractNumber = ''
       })
     },
     //单价
@@ -616,7 +620,7 @@ export default {
           this.editCustomer()
         })
       }else{
-        this.$confirm("是否确认全部收货?", {
+        this.$confirm("是否确认收货?", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 1 - 1
src/views/purchase/contract/config/customerContact.json

@@ -61,7 +61,7 @@
       ]
     },{
       "label": "箱号",
-      "prop": "containerNo",
+      "prop": "cntrNo",
       "index": 4,
       "width":100,
       "cell": true,

+ 18 - 16
src/views/purchase/contract/detailsPage.vue

@@ -788,24 +788,13 @@ export default {
       this.selectContact = row;
     },
     beforePage(type){
-      let list = []
-      for (let item in this.selectContact){
-        if (!this.selectContact[item].id){
-          return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.editCustomer();
-            return
-          })
-        }else {
-          list.push(this.selectContact[item].$index)
-        }
-      }
+      let id =   this.selectContact.map(item=>{
+        return  item.id ? true : false
+      })
+      if(id.findIndex(item => item != true) == -1){
         const params = {
           id:this.form.id,
-          orderItemIds:list
+          orderItemIds:this.selectContact.map(i=>{return i.$index})
         }
         if(type){
           //进入付款管理
@@ -840,6 +829,15 @@ export default {
               query: {params: params},
             });
           }
+        }
+      }else{
+        this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.editCustomer();
+        })
       }
     },
     //选择货物品种
@@ -851,6 +849,7 @@ export default {
     commodityConfirm(){
       if(this.tableData){
         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)
         this.dialogVisible = !this.dialogVisible
         this.selectKind = -1
@@ -1046,4 +1045,7 @@ export default {
 .avue-upload /deep/ .avue-upload__icon {
   line-height: 178px !important;
 }
+::v-deep .el-form-item__content{
+  line-height: 32px;
+}
 </style>

+ 22 - 4
src/views/salesManagement/salesContract/config/importInventory.json

@@ -36,7 +36,6 @@
       "prop": "orgOrderNo",
       "index": 2,
       "width":150,
-      "cell": true,
       "rules": [
         {
           "required": true,
@@ -67,7 +66,6 @@
       "prop": "invoiceWeight",
       "index": 5,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -80,7 +78,6 @@
       "prop": "billWeight",
       "index": 6,
       "width":120,
-      "cell": true,
       "rules": [
         {
           "required": false,
@@ -90,6 +87,26 @@
       ]
     },
     {
+      "label": "发货数量",
+      "prop": "actualQuantity",
+      "index": 7,
+      "width":120
+    },
+    {
+      "label": "箱号",
+      "prop": "cntrNo",
+      "index": 7,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
       "label": "库存",
       "prop": "kucun",
       "index": 7,
@@ -97,7 +114,8 @@
     },
     {
       "label": "件数",
-      "prop": "actualQuantity",
+      "prop": "orderQuantity",
+      "cell": true,
       "index": 7,
       "width":120,
       "rules": [

+ 143 - 62
src/views/salesManagement/salesContract/detailsPage.vue

@@ -35,20 +35,12 @@
                     :value="data.value"
                   ></el-option>
                 </el-select>
-                <el-select v-else-if="item.prop === 'currency'" style="width: 100%"   v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
+                <el-select v-else-if="item.prop === 'currency'" style="width: 100%"   v-model="form[item.prop]" size="small" placeholder="请选择" @change="currencyChange" clearable filterable>
                   <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
                 </el-select>
                 <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
                 <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="bConfiguration"/>
                 <port-info  v-else-if="(item.prop === 'portOfDestination' || item.prop === 'portOfLoad'  )"  v-model="form[item.prop]"></port-info>
-                <el-input
-                  size="small"
-                  v-else-if="(item.prop === 'exchangeRate')"
-                  v-model="form[item.prop]"
-                  oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-                  @change="rateChange"
-                  placeholder="请输入"
-                ><template slot="append">%</template></el-input>
                 <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]"   size="small" autocomplete="off" placeholder="请输入"></el-input>
                 <el-input type="age" v-else v-model="form[item.prop]" size="small" :disabled="item.disabled?true:false" autocomplete="off" placeholder="请输入"></el-input>
               </el-form-item>
@@ -79,25 +71,70 @@
               ></el-input>
               <span v-else>{{ row.price }}</span>
             </template>
-            <template slot="actualQuantity" slot-scope="{ row }">
+            <template slot="orderQuantity" slot-scope="{ row }">
               <el-input
                 v-if="row.$cellEdit"
-                v-model="row.actualQuantity"
+                v-model="row.orderQuantity"
                 placeholder="请输入"
                 size="small"
                 oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
                 @input="quantityChange(row)"
               ></el-input>
-              <span v-else>{{ row.actualQuantity }}</span>
+              <span v-else>{{ row.orderQuantity }}</span>
             </template>
             <template slot-scope="{row}" slot="billNo">
+              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
               <el-input
                 v-if="row.$cellEdit"
                 v-model="row.billNo"
+                style="width: 90%"
                 placeholder=" "
                 size="small"
                 @change="bingOut(row)"
               ></el-input>
+              <span v-else>{{ row.billNo }}</span>
+            </template>
+            <template slot-scope="{row}" slot="orgOrderNo">
+              <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
+              <el-select
+                v-if="row.$cellEdit"
+                style="width:90%"
+                v-model="row.orgOrderNo"
+                placeholder=" "
+                size="small"
+                clearable
+                filterable
+              >
+                <el-option
+                  v-for="(item,index) in contractDic"
+                  :key="index"
+                  :label="item.orderNo"
+                  :value="item.orderNo"
+                ></el-option>
+              </el-select>
+              <span v-else>{{ row.orgOrderNo }}</span>
+            </template>
+            <template slot="invoiceWeight" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.invoiceWeight"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
+                @input="totalChange(row.invoiceWeight)"
+              ></el-input>
+              <span v-else>{{ row.invoiceWeight }}</span>
+            </template>
+            <template slot="billWeight" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.billWeight"
+                placeholder="请输入"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
+                @input="totalChange(row.billWeight)"
+              ></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>
@@ -250,6 +287,7 @@ export default {
       orderFeesList:[],
       orderFilesList:[],
       currencyDic:[],
+      contractDic:[],
       selectKind:-1,
       configuration:{
         multipleChoices:false,
@@ -278,7 +316,7 @@ export default {
             disabled:true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -437,7 +475,7 @@ export default {
           {
             label: '发票重量',
             prop: 'invoiceWeight',
-            data: [],
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -448,6 +486,7 @@ export default {
           }, {
             label: '码单重量',
             prop: 'billWeight',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -458,7 +497,6 @@ export default {
           },{
             label: '销售单价',
             prop: 'salesPrice',
-            data: [],
             rules: [
               {
                 required: false,
@@ -472,6 +510,7 @@ export default {
           }, {
             label: '汇率',
             prop: 'exchangeRate',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -490,7 +529,7 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
+          },{
             label: "备注",
             span: 24,
             prop: "orderRemark",
@@ -638,33 +677,63 @@ export default {
           this.oldFilesList = this.deepClone(this.form.orderFilesList)
         }
       })
-    }else{
-      getSysNo("JK-XS").then(res =>{
-        this.$set(this.form,"sysNo", res.data.data)
-      })
     }
+    // else{
+    //   getSysNo("JK-XS").then(res =>{
+    //     this.$set(this.form,"sysNo", res.data.data)
+    //   })
+    // }
   },
   components: {
     feeInfo,
     uploadFile
   },
   methods: {
+    //合计
+    totalChange(){
+      let invoiceList =  this.importInventoryData.map(item => {
+        if(!item.invoiceWeight){
+          item.invoiceWeight = 0
+        }
+        return parseFloat(item.invoiceWeight);
+      });
+      let billList =  this.importInventoryData.map(item => {
+        if(!item.billWeight){
+          item.billWeight = 0
+        }
+        return parseFloat(item.billWeight);
+      });
+      this.form.invoiceWeight = invoiceList.reduce((n,m) => n + m)
+      this.form.billWeight = billList.reduce((n,m) => n + m)
+    },
+    //汇率
+    currencyChange(value){
+      if(this.form.orderAmount){
+        if(value === "人民币"){
+          this.form.exchangeRate = 1
+          // this.form.rmbAmount = this.form.orderAmount
+        }else{
+          this.form.exchangeRate = 6.3843
+          // this.form.rmbAmount = this.form.orderAmount * 6.3843
+        }
+      }
+    },
     //单价
     priceChange(row) {
       if (!row.price) {
         row.price = "";
         row.amount = 0
       } else {
-        row.amount = (row.actualQuantity * row.price).toFixed(2);
+        row.amount = (row.orderQuantity * row.price).toFixed(2);
       }
     },
     //件数
     quantityChange(row) {
-      if (!row.actualQuantity) {
-        row.actualQuantity = "";
+      if (!row.orderQuantity) {
+        row.orderQuantity = "";
         row.amount = 0
       } else {
-        row.amount = (row.actualQuantity * row.price).toFixed(2);
+        row.amount = (row.orderQuantity * row.price).toFixed(2);
       }
     },
     editCustomer(status) {
@@ -683,10 +752,10 @@ export default {
         }
         let orderUpLoadList = this.$refs.uploadFile.submitData();
         for (let j = 0; j < this.importInventoryData.length; j++) {
-          if (this.importInventoryData[j].billNo == null) {
+          if (this.importInventoryData[j].billNo === "") {
             return this.$message.error(`请输入商品明细第${j + 1}行的提单号`);
           }
-          if (this.importInventoryData[j].orgOrderNo == null) {
+          if (this.importInventoryData[j].orgOrderNo === "") {
             return this.$message.error(`请输入商品明细第${j + 1}行的合同号`);
           }
         }
@@ -743,54 +812,62 @@ export default {
     },
     //生成发货单
     generateShipmentD(){
-      let lsit = []
-      for (let item in this.selection){
-        if (!this.selection[item].id){
-          return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.editCustomer()
-          }).catch(() => {
-            this.$message({
-              type: 'info',
-              message: '已取消'
-            });
+      let id =   this.selection.map(item=>{
+        return  item.id ? true : false
+      })
+      if(id.findIndex(item => item != true) == -1){
+        const params = {
+          id:this.form.id,
+          orderItemIds:this.selection.map(i=>{return i.id})
+        }
+        if(this.$store.getters.goStatus){
+          this.$alert("发货单已存在,请保存发货单再进行操作", "温馨提示", {
+            confirmButtonText: "确定",
+            type: 'warning',
+            callback: action => {
+            }
           });
-        }else {
-          lsit.push(this.selection[item].id)
+        }else{
+          generateShipment(params).then(res=>{
+            this.$router.push({
+              path: "/importTrade/invoice/index",
+              query: {form: JSON.stringify(res.data.data)},
+            });
+          })
         }
-      }
-      let data = {
-        id:this.form.id,
-        orderItemIds: lsit
-      }
-      if(this.$store.getters.goStatus){
-        this.$alert("发货单已存在,请保存发货单再进行操作", "温馨提示", {
-          confirmButtonText: "确定",
-          type: 'warning',
-          callback: action => {
-          }
-        });
       }else{
-        generateShipment(data).then(res=>{
-          this.$router.push({
-            path: "/importTrade/invoice/index",
-            query: {form: JSON.stringify(res.data.data)},
-          });
+        this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.editCustomer();
         })
       }
     },
     //提单号带出合同号
     bingOut(row){
+      console.log(row)
       getOrgOrderNo(row.billNo).then(res =>{
-        console.log(res.data)
+        if(res.data){
+          console.log(res.data[0])
+          this.contractDic = res.data;
+          row.orgOrderNo =  res.data[0].orderNo
+          row.cntrNo =  res.data[0].cntrNo
+        }
+      }).catch(()=>{
+        row.orgOrderNo = ''
       })
     },
     //商品明细导入
     newDetails(){
-      this.dialogVisible = !this.dialogVisible
+      const params ={
+        billWeight:0,
+        invoiceWeight:0,
+        price:0,
+        orderQuantity:0,
+      }
+      this.$refs.importInventory.rowCellAdd(params);
     },
     //商品编辑
     rowCell(row, index) {
@@ -842,6 +919,7 @@ export default {
     commodityConfirm(){
       if(this.tableData){
         this.importInventoryData[this.selectKind].priceCategory = this.tableData[0].id;
+        this.importInventoryData[this.selectKind].itemId = this.tableData[0].id;
         this.$set(this.importInventoryData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
         this.dialogVisible = !this.dialogVisible
         this.selectKind = -1
@@ -866,7 +944,7 @@ export default {
             priceCategoryNames:this.tableData[item].cname,
             itemId:this.tableData[item].id,
             cname:this.tableData[item].cname,
-            actualQuantity:0,
+            orderQuantity:0,
             price:0,
             amount:0.00,
           }
@@ -986,4 +1064,7 @@ export default {
   margin-bottom: 0;
 }
 
+::v-deep .el-form-item__content{
+  line-height: 32px;
+}
 </style>