Browse Source

修改bug

Qukatie 2 years ago
parent
commit
25b06556da

+ 10 - 3
src/api/basicData/Inventory.js

@@ -13,7 +13,14 @@ export const getList = (current, size, params) => {
 }
 export function getAllgoods() {
     return request({
-      url: '/api/blade-client/goodsdesc/descListAll',
-      method: 'get',
+        url: '/api/blade-client/goodsdesc/descListAll',
+        method: 'get',
+    })
+}
+export function submit(data) {
+    return request({
+        url: '/api/blade-stock/stockgoods/update',
+        method: 'POST',
+        data: data
     })
-  }
+}

+ 7 - 0
src/api/basicData/shippingInquiry.js

@@ -115,4 +115,11 @@ export const calculationDomesticFees = (data) => {
     method: 'post',
     data: data
   })
+}
+export const updateIfShipping = (data) => {
+  return request({
+    url: '/api/trade-purchase/shipping-enquiry/updateIfShipping',
+    method: 'post',
+    data: data
+  })
 }

+ 6 - 0
src/components/upload/index.vue

@@ -440,6 +440,9 @@ export default {
       this.option = await this.getColumnData(this.getColumnName(this.enumerationValue),this.originalOptionsThree);
     }else {
       this.option = await this.getColumnData(this.getColumnName(this.enumerationValue),this.originalOptions);
+      this.getWorkDicts("picture_type").then(res => {
+          this.findObject(this.option.column, "version").dicData = res.data.data;
+        });
     }
     this.key++
   },
@@ -471,6 +474,9 @@ export default {
         this.option = this.originalOptions;
         const inSave = await this.delColumnData(this.getColumnName(this.enumerationValue),this.originalOptions);if (inSave) {
           this.$message.success("重置成功");
+          this.getWorkDicts("picture_type").then(res => {
+          this.findObject(this.option.column, "version").dicData = res.data.data;
+        });
           this.$refs.crud.$refs.dialogColumn.columnBox = false;
         }
       }

+ 15 - 2
src/views/Inventory/index.vue

@@ -4,7 +4,8 @@
       <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
         @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
         @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
-        @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
+        @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch"
+        @row-update="handleRowUpdate">
         <template slot="menuLeft">
           <!-- <el-button type="primary" size="mini" @click.stop="newAdd()">新建产品
           </el-button> -->
@@ -48,7 +49,8 @@
 <script>
 import detailsPage from "./detailsPage";
 import { option } from "./js/optionList";
-import { getList, getAllgoods } from "@/api/basicData/Inventory";
+import { getList, getAllgoods, submit } from "@/api/basicData/Inventory";
+import { multiply, sum, subtract, divide } from "@/util/calculate";
 export default {
   name: "index",
   data() {
@@ -159,6 +161,17 @@ export default {
         // });
       });
     },
+    handleRowUpdate(row, index, done, loading) {
+      row.surplusRouteQuantity = row.balanceQuantity
+      //  新成本=((新数量-旧数量)*成本+原结余金额)/新数量
+      row.stockPrice = divide(sum(multiply(subtract(row.balanceQuantity, row.balance), row.stockPrice), row.balanceAmount), row.balanceQuantity)
+      row.balanceAmount = multiply(row.purchasePrice, row.balanceQuantity)
+      submit({ ...row }).then(res => {
+        this.onLoad(this.page, this.search);
+        loading()
+        done()
+      })
+    },
     async saveColumn() {
       const inSave = await this.saveColumnData(
         this.getColumnName(219),

+ 16 - 4
src/views/Inventory/js/optionList.js

@@ -15,6 +15,7 @@ export const option = {
   menuWidth: 50,
   searchIcon: true,
   searchIndex: 2,
+  dialogWidth:400,
   column: [
     {
       label: "产品名称",
@@ -59,6 +60,7 @@ export const option = {
       controls:false,
       overHidden: true,
       cell:true,
+      display:false,
       span:24,
       index:5
     },
@@ -80,10 +82,8 @@ export const option = {
     {
       label: "成本均价",
       prop: "stockPrice",
-      type:'number',
-      controls:false,
       overHidden: true,
-      cell:true,
+      display:false,
       span:24,
       index: 8
     },
@@ -154,7 +154,19 @@ export const option = {
       showColumn: false,
       display:false,
       index: 13
-    }
+    },
+    {
+      label: "库存数量",
+      prop: "balanceQuantity",
+      type:'number',
+      controls:false,
+      overHidden: true,
+      cell:true,
+      hide: true,
+      showColumn: false,
+      span:24,
+      index:5
+    },
   ]
 }
 export const optionList = {

+ 1 - 1
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -299,7 +299,7 @@
           </template>
         </avue-crud>
       </trade-card> -->
-      <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
+      <fee-info ref="feeInfo" :tabShow="2"  :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
         feeUrl="/blade-purchase-sales/orderfees/update" optionType="CK" itemType="报价" @beforeFinance="beforeFinance"
         :inCropId="true" />
       <containerTitle title="合同附件">

+ 88 - 88
src/views/exportTrade/salesContract/components/goodsInfo.vue

@@ -13,10 +13,10 @@
           </el-button>
           <el-button type="info" size="small" @click="cnameData">刷新基础资料</el-button>
           <el-button type="info" size="small" @click="calculate(1)" :disabled="detailData.status == 1"
-            :loading="calculateLoading">计算国内费用
+            :loading="calculateLoading">分摊国内费用
           </el-button>
           <el-button type="info" size="small" @click="calculate(2)" :disabled="detailData.status == 1"
-            :loading="calculateLoading">计算国外费用
+            :loading="calculateLoading">分摊海运费
           </el-button>
         </el-row>
       </template>
@@ -25,7 +25,7 @@
           :disabled="detailData.status == 1" circle></el-button>
       </template>
       <template slot="codeHeader" slot-scope="{column}">
-        <span style="color: #409EFF;cursor: pointer" @click.stop="khEdit('cname')">{{column.label}}</span>
+        <span style="color: #409EFF;cursor: pointer" @click.stop="khEdit('cname')">{{ column.label }}</span>
       </template>
       //操作栏
       <template slot="menu" slot-scope="{ row, index }">
@@ -100,9 +100,9 @@
       <template slot="partsValveNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsValveName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsValveSalePrice?goodsForm.partsValveSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsValveSalePrice ? goodsForm.partsValveSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(0,goodsForm.partsValveValue)"
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(0, goodsForm.partsValveValue)"
             :disabled="disabled"></el-button>
         </div>
       </template>
@@ -110,9 +110,9 @@
       <template slot="partsCapNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsCapName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsCapSalePrice?goodsForm.partsCapSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsCapSalePrice ? goodsForm.partsCapSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(1,goodsForm.partsCapValue)" :disabled="disabled">
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(1, goodsForm.partsCapValue)" :disabled="disabled">
           </el-button>
         </div>
       </template>
@@ -120,9 +120,9 @@
       <template slot="partsHandleNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsHandleName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsHandleSalePrice?goodsForm.partsHandleSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsHandleSalePrice ? goodsForm.partsHandleSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(2,goodsForm.partsHandleValue)"
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(2, goodsForm.partsHandleValue)"
             :disabled="disabled"></el-button>
         </div>
       </template>
@@ -130,9 +130,9 @@
       <template slot="partsColourNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsColourName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsColourSalePrice?goodsForm.partsColourSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsColourSalePrice ? goodsForm.partsColourSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(3,goodsForm.partsColourValue)"
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(3, goodsForm.partsColourValue)"
             :disabled="disabled"></el-button>
         </div>
       </template>
@@ -140,9 +140,9 @@
       <template slot="partsModeNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsModeName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsModeSalePrice?goodsForm.partsModeSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsModeSalePrice ? goodsForm.partsModeSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(4,goodsForm.partsModeValue)" :disabled="disabled">
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(4, goodsForm.partsModeValue)" :disabled="disabled">
           </el-button>
         </div>
       </template>
@@ -151,9 +151,9 @@
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsAuthenticationName" size="small" placeholder="" :disabled="disabled">
             <template
-              slot="append">{{goodsForm.partsAuthenticationSalePrice?goodsForm.partsAuthenticationSalePrice:0}}</template>
+              slot="append">{{ goodsForm.partsAuthenticationSalePrice ? goodsForm.partsAuthenticationSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(5,goodsForm.partsAuthenticationValue)"
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(5, goodsForm.partsAuthenticationValue)"
             :disabled="disabled"></el-button>
         </div>
       </template>
@@ -161,9 +161,9 @@
       <template slot="partsOtherNameForm" slot-scope="{type,disabled}">
         <div style="display:flex;">
           <el-input v-model="goodsForm.partsOtherName" size="small" placeholder="" :disabled="disabled">
-            <template slot="append">{{goodsForm.partsOtherSalePrice?goodsForm.partsOtherSalePrice:0}}</template>
+            <template slot="append">{{ goodsForm.partsOtherSalePrice ? goodsForm.partsOtherSalePrice : 0 }}</template>
           </el-input>
-          <el-button icon="el-icon-edit" size="mini" @click="openpart(6,goodsForm.partsOtherValue)"
+          <el-button icon="el-icon-edit" size="mini" @click="openpart(6, goodsForm.partsOtherValue)"
             :disabled="disabled"></el-button>
         </div>
       </template>
@@ -754,78 +754,78 @@ export default {
     },
     calculate(val) {
       this.form.totalValue = 0
-            this.data.forEach((e, index) => {
-                e.sort = Number(index) + 1
-                this.form.totalValue = sum(multiply(e.outFactoryPrice, e.orderQuantity), this.form.totalValue)
-            })
-            if (val == 1) {
-                let numSum = 0
-                this.orderFeesList.forEach(e => {
-                    if (e.feesType == 2 && e.currency == "CNY") {
-                        console.log(sum, e.amount)
-                        numSum = sum(numSum, e.amount)
-                    }
-                })
-                let num = 0;
-                num = divide(divide(numSum, this.form.totalValue,10), this.form.exchangeRate,10)
-                this.$confirm("总运费:" + divide(numSum, this.form.exchangeRate) + ",单价分摊运费:" + num + ",是否继续更新?", {
-                    confirmButtonText: "确定",
-                    cancelButtonText: "取消",
-                    type: "warning"
-                }).then(() => {
-                    this.data.forEach(e => {
-                        e.shareAmount = multiply(num, e.outFactoryPrice, 10)
-                        e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount)
-                        e.amount = amountCal(
-                            addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount),
-                            e.orderQuantity,
-                            e.freight,
-                            e.insurance,
-                            e.discount
-                        );
-                        e.itemMargin = grossProfitCal(
-                            e.purchaseAmount,
-                            e.partsPrice,
-                            e.outFactoryPrice,
-                            this.form.exchangeRate
-                        );
-                    })
-                })
+      this.data.forEach((e, index) => {
+        e.sort = Number(index) + 1
+        this.form.totalValue = sum(multiply(e.outFactoryPrice, e.orderQuantity), this.form.totalValue)
+      })
+      if (val == 1) {
+        let numSum = 0
+        this.orderFeesList.forEach(e => {
+          if (e.feesType == 2 && e.currency == "CNY") {
+            console.log(sum, e.amount)
+            numSum = sum(numSum, e.amount)
+          }
+        })
+        let num = 0;
+        num = divide(divide(numSum, this.form.totalValue, 10), this.form.exchangeRate, 10)
+        this.$confirm("总运费:" + divide(numSum, this.form.exchangeRate) + ",单价分摊运费:" + num + ",是否继续更新?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.data.forEach(e => {
+            e.shareAmount = multiply(num, e.outFactoryPrice, 10)
+            e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount)
+            e.amount = amountCal(
+              addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.internationalAmount),
+              e.orderQuantity,
+              e.freight,
+              e.insurance,
+              e.discount
+            );
+            e.itemMargin = grossProfitCal(
+              e.purchaseAmount,
+              e.partsPrice,
+              e.outFactoryPrice,
+              this.form.exchangeRate
+            );
+          })
+        })
 
-            } else {
-              let numSum = 0
-                this.orderFeesList.forEach(e => {
-                    if (e.feesType == 2 && e.currency == "USD") {
-                        console.log(sum, e.amount)
-                        numSum = sum(numSum, e.amount)
-                    }
-                })
-                let num = 0;
-                num =divide(numSum, this.form.totalValue,10)
-                this.$confirm("总运费:" + numSum + ",单价分摊运费:" + num + ",是否继续更新?", {
-                    confirmButtonText: "确定",
-                    cancelButtonText: "取消",
-                    type: "warning"
-                }).then(() => {
-                    this.data.forEach(e => {
-                        e.internationalAmount = multiply(num, e.outFactoryPrice, 10)
-                        e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount)
-                        e.amount = amountCal(
-                            addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount),
-                            e.orderQuantity,
-                            e.freight,
-                            e.insurance,
-                            e.discount
-                        );
-                        e.itemMargin = grossProfitCal(
-                            e.purchaseAmount,
-                            e.partsPrice,
-                            e.outFactoryPrice,
-                            this.form.exchangeRate
-                        );
-                    })
-                })
-            }
+      } else {
+        let numSum = 0
+        this.orderFeesList.forEach(e => {
+          if (e.feesType == 2 && e.currency == "USD") {
+            console.log(sum, e.amount)
+            numSum = sum(numSum, e.amount)
+          }
+        })
+        let num = 0;
+        num = divide(numSum, this.form.totalValue, 10)
+        this.$confirm("总运费:" + numSum + ",单价分摊运费:" + num + ",是否继续更新?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.data.forEach(e => {
+            e.internationalAmount = multiply(num, e.outFactoryPrice, 10)
+            e.price = addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount)
+            e.amount = amountCal(
+              addPrice(e.outFactoryPrice, multiply(num, e.outFactoryPrice, 10), e.shareAmount),
+              e.orderQuantity,
+              e.freight,
+              e.insurance,
+              e.discount
+            );
+            e.itemMargin = grossProfitCal(
+              e.purchaseAmount,
+              e.partsPrice,
+              e.outFactoryPrice,
+              this.form.exchangeRate
+            );
+          })
+        })
+      }
     },
     khEdit(status) {
       if (status == 'cname') {

+ 1 - 1
src/views/exportTrade/salesContract/detailsPage.vue

@@ -335,7 +335,7 @@
           </template>
         </avue-crud>
       </trade-card> -->
-      <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
+      <fee-info ref="feeInfo" :tabShow="2"  :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
         feeUrl="/blade-purchase-sales/orderfees/update" optionType="CK" itemType="销售" @beforeFinance="beforeFinance"
         :inCropId="true" />
       <containerTitle title="合同附件"></containerTitle>

+ 32 - 6
src/views/exportTrade/shippingInquiry/detailsPage.vue

@@ -10,6 +10,9 @@
         <el-button type="primary" size="small" v-if="detailData.status == 1" class="el-button--small-yh "
           @click.stop="openEdit" :disabled="form.ifShipping == '船务确认'">编辑
         </el-button>
+        <el-button type="primary" size="small" v-if="detailData.status == 1 && form.ifShipping == '船务确认'"
+          class="el-button--small-yh " @click.stop="revokeOrder">撤销提交
+        </el-button>
         <el-button type="primary" :disabled="disabled && detailData.status == 1 || form.ifShipping == '船务确认'"
           @click="editCustomer('submit')" v-if="form.id && detailData.status != 1" :loading="subLoading" size="small">
           保存数据
@@ -127,7 +130,8 @@ import {
   getPorts,
   delItem,
   commit,
-  calculationDomesticFees
+  calculationDomesticFees,
+  updateIfShipping
 } from "@/api/basicData/shippingInquiry";
 import {
   amountCal,
@@ -155,7 +159,7 @@ export default {
       option: {
         menuBtn: false,
         labelWidth: 100,
-        disabled: true,
+        disabled: false,
         column: [
           {
             label: "系统号",
@@ -197,7 +201,8 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            disabled: true
           },
           {
             label: "报价日期",
@@ -256,24 +261,35 @@ export default {
               label: "dictValue",
               value: "dictValue"
             },
+            disabled: true,
             span: 8
           },
           {
             label: "箱量",
             prop: "boxNumber",
+            disabled: true,
             span: 8
           },
           {
             label: "起订量",
             prop: "minOrder",
+            disabled: true,
             span: 8
           },
           {
             label: "销售指示",
             prop: "orderRemark",
             type: "textarea",
+            disabled: true,
+            minRows: 2,
+            span: 12
+          },
+          {
+            label: "船务备注",
+            prop: "shippingRemark",
+            type: "textarea",
             minRows: 2,
-            span: 24
+            span: 12
           }
         ]
       },
@@ -348,6 +364,9 @@ export default {
       this.getColumnName(32),
       goodsOption
     );
+    if (this.detailData.status == 1) {
+      this.option.disabled = true;
+    }
     getPorts().then(res => {
       this.findObject(this.option.column, "portOfLoad").dicData = res.data;
       this.findObject(this.option.column, "portOfDestination").dicData =
@@ -506,6 +525,12 @@ export default {
     addFreight() {
       this.freightData.push({ $cellEdit: true });
     },
+    revokeOrder() {
+      updateIfShipping({ id: this.form.id, ifShipping: '已提交' }).then(res => {
+        this.$message.success("撤销成功");
+        this.getDetail(this.detailData.id);
+      })
+    },
     calculate(val) {
       this.form.totalValue = 0
       this.data.forEach((e, index) => {
@@ -534,7 +559,7 @@ export default {
             let orderFeesList = this.$refs.feeInfo.submitData();
             this.subLoading = true;
             submit({
-              id: this.form.id,
+              ...this.form,
               orderFreightList: this.freightData,
               orderFeesList: orderFeesList
             })
@@ -576,7 +601,7 @@ export default {
           if (status == "fix") {
             let orderFeesList = this.$refs.feeInfo.submitData();
             commit({
-              id: this.form.id,
+              ...this.form,
               orderFreightList: this.freightData,
               orderFeesList: orderFeesList
             }).then(res => {
@@ -605,6 +630,7 @@ export default {
                 : []
               );
               this.detailData.status = 1
+              this.option.disabled = true
             });
           }
         } else {

+ 67 - 11
src/views/purchaseOrder/detailsPage.vue

@@ -8,6 +8,8 @@
           </el-button>
         </div>
         <div class="add-customer-btn">
+          <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
+          </el-button>
           <el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
             class="el-button--small-yh " @click.stop="openEdit">编辑
           </el-button>
@@ -58,9 +60,9 @@
             <span v-else>{{ row.cname }}</span>
           </template>
           <template slot="unitHeader" slot-scope="{column}">
-                <span style="color: #409EFF;cursor: pointer" @click.stop="$refs.dictbiz.open()">单位
-                </span>
-            </template>
+            <span style="color: #409EFF;cursor: pointer" @click.stop="$refs.dictbiz.open()">单位
+            </span>
+          </template>
           <template slot="storageInQuantity" slot-scope="{ row, index }">
             <el-input-number v-if="row.$cellEdit" v-model="row.storageInQuantity" @change="countChange(row)"
               placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
@@ -109,7 +111,10 @@
           <el-button @click="addressVisible = false" type="primary">确 定</el-button>
         </div>
       </el-dialog>
-      <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts"></dictbiz-dialog>
+      <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts">
+      </dictbiz-dialog>
+      <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="配件系统-采购单" @onClose="onClose()">
+      </report-dialog>
     </div>
   </div>
 </template>
@@ -118,11 +123,13 @@
 import { optionList } from "./js/optionList";
 import { getDetails, submit, getCorpDetails, remove, getAllgoods, save, fixSave, revoke, collectPayment } from "@/api/basicData/salesOrder";
 import feeInfo from "./components/feeInfo.vue";
+import reportDialog from "@/components/report-dialog/main";
 import { multiply, sum, subtract } from "@/util/calculate";
 export default {
   name: "index",
   data() {
     return {
+      switchDialog: false,
       activeName: 'first',
       loadingBtn: false,
       addressTitle: null,
@@ -367,6 +374,7 @@ export default {
       optionList: {},
       goodsoptions: [],
       settlementList: [],
+      orderFilesList: []
     };
   },
   props: {
@@ -376,6 +384,7 @@ export default {
   },
   components: {
     feeInfo,
+    reportDialog
   },
   async created() {
     this.optionList = await this.getColumnData(
@@ -395,6 +404,12 @@ export default {
     });
   },
   methods: {
+    openReport() {
+      this.switchDialog = !this.switchDialog;
+    },
+    onClose(val) {
+      this.switchDialog = val;
+    },
     getAllWorkDicts() {
       this.getWorkDicts("unit").then(res => {
         this.findObject(this.optionList.column, "unit").dicData = res.data.data;
@@ -452,7 +467,8 @@ export default {
         .then(res => {
           this.form = res.data.data;
           this.data = res.data.data.orderItemsList;
-          this.settlementList = res.data.data.settlementList
+          this.settlementList = res.data.data.settlementList;
+          this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
           this.getAddress(res.data.data)
         })
         .finally(() => {
@@ -462,11 +478,13 @@ export default {
     getCorpData(row) {
       if (row) {
         this.form.corpsName = row.cname
+        this.form.corpTel = row.tel
         getCorpDetails({ id: row.id }).then(res => {
           this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
         })
       } else {
         this.form.corpsName = null
+        this.form.corpTel = null
         this.findObject(this.option.column, "arrivalAddress").dicData = []
       }
     },
@@ -516,13 +534,29 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
+          if (this.data.length == 0) {
+            return this.$message.error('请添加一条商品信息');
+          }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          save({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          save({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("保存成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
-              this.settlementList = res.data.data.settlementList
+              this.settlementList = res.data.data.settlementList;
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
+              this.detailData.status = 1
+              this.option.disabled = true;
+              this.option2.disabled = true;
+              this.$refs.crud.refreshTable();
+              this.$refs.feeInfo.refreshTable();
             })
             .finally(() => {
               this.loadingBtn = false;
@@ -536,13 +570,24 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
+          if (this.data.length == 0) {
+            return this.$message.error('请添加一条商品信息');
+          }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          fixSave({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          fixSave({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("修改成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
-              this.settlementList = res.data.data.settlementList
+              this.settlementList = res.data.data.settlementList;
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
             })
             .finally(() => {
               this.loadingBtn = false;
@@ -556,13 +601,24 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
+          if (this.data.length == 0) {
+            return this.$message.error('请添加一条商品信息');
+          }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          submit({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          submit({ ...this.form, billType: 'CG', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("提交成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
-              this.settlementList = res.data.data.settlementList
+              this.settlementList = res.data.data.settlementList;
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
               this.$emit("goBack");
             })
             .finally(() => {

+ 9 - 3
src/views/purchaseOrder/js/optionList.js

@@ -35,9 +35,7 @@ export const option = {
     },
     {
       label: "电话",
-      prop: "tel",
-      type: 'select',
-      dicData: [],
+      prop: "corpTel",
       search: true,
       overHidden: true,
       index: 3
@@ -155,6 +153,14 @@ export const optionList = {
     {
       name: "storageAmount",
       type: "sum"
+    },
+    {
+      name: "storageInQuantity",
+      type: "sum"
+    },
+    {
+      name: "actualQuantity",
+      type: "sum"
     }
   ],
   column: [

+ 59 - 8
src/views/salesOrder/detailsPage.vue

@@ -8,6 +8,8 @@
           </el-button>
         </div>
         <div class="add-customer-btn">
+          <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
+          </el-button>
           <el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
             class="el-button--small-yh " @click.stop="openEdit">编辑
           </el-button>
@@ -25,6 +27,7 @@
           <el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="revokeOrder">
             撤销
           </el-button>
+
         </div>
       </div>
       <!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
@@ -112,6 +115,8 @@
       </el-dialog>
       <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts">
       </dictbiz-dialog>
+      <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="配件系统-销售单" @onClose="onClose()">
+      </report-dialog>
     </div>
   </div>
 </template>
@@ -120,11 +125,13 @@
 import { optionList } from "./js/optionList";
 import { getDetails, submit, getCorpDetails, remove, getAllgoods, save, fixSave, revoke, collectPayment } from "@/api/basicData/salesOrder";
 import feeInfo from "./components/feeInfo.vue";
+import reportDialog from "@/components/report-dialog/main";
 import { multiply, sum, subtract } from "@/util/calculate";
 export default {
   name: "index",
   data() {
     return {
+      switchDialog: false,
       activeName: 'first',
       loadingBtn: false,
       addressTitle: null,
@@ -369,6 +376,7 @@ export default {
       optionList: {},
       goodsoptions: [],
       settlementList: [],
+      orderFilesList: []
     };
   },
   props: {
@@ -378,6 +386,7 @@ export default {
   },
   components: {
     feeInfo,
+    reportDialog
   },
   async created() {
     this.optionList = await this.getColumnData(
@@ -397,6 +406,12 @@ export default {
     });
   },
   methods: {
+    openReport() {
+      this.switchDialog = !this.switchDialog;
+    },
+    onClose(val) {
+      this.switchDialog = val;
+    },
     getAllWorkDicts() {
       this.getWorkDicts("unit").then(res => {
         this.findObject(this.optionList.column, "unit").dicData = res.data.data;
@@ -455,7 +470,8 @@ export default {
         .then(res => {
           this.form = res.data.data;
           this.data = res.data.data.orderItemsList;
-          this.settlementList = res.data.data.settlementList
+          this.settlementList = res.data.data.settlementList;
+          this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
           this.getAddress(res.data.data)
         })
         .finally(() => {
@@ -465,11 +481,13 @@ export default {
     getCorpData(row) {
       if (row) {
         this.form.corpsName = row.cname
+        this.form.corpTel=row.tel
         getCorpDetails({ id: row.id }).then(res => {
           this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
         })
       } else {
         this.form.corpsName = null
+        this.form.corpTel=null
         this.findObject(this.option.column, "arrivalAddress").dicData = []
       }
     },
@@ -512,6 +530,9 @@ export default {
       });
     },
     getPay(row) {
+      // this.form = row;
+      // this.data = row.orderItemsList;
+      // this.settlementList = row.settlementList
       this.getDetail(row.id);
     },
     //修改提交触发
@@ -522,13 +543,21 @@ export default {
           if (this.data.length == 0) {
             return this.$message.error('请添加一条商品信息');
           }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("保存成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
-              this.settlementList = res.data.data.settlementList
+              this.settlementList = res.data.data.settlementList;
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
               this.detailData.status = 1
               this.option.disabled = true;
               this.option2.disabled = true;
@@ -547,13 +576,24 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
+          if (this.data.length == 0) {
+            return this.$message.error('请添加一条商品信息');
+          }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          fixSave({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          fixSave({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("修改成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
               this.settlementList = res.data.data.settlementList
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
             })
             .finally(() => {
               this.loadingBtn = false;
@@ -567,14 +607,25 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
+          if (this.data.length == 0) {
+            return this.$message.error('请添加一条商品信息');
+          }
+          if (this.settlementList.length > 0) {
+            for (let i = 0; i < this.settlementList.length; i++) {
+              if (!this.settlementList[i].id) {
+                return this.$message.error(`请保存第${i + 1}行的费用明细`);
+              }
+            }
+          }
           this.loadingBtn = true;
-          submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
+          submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
             .then(res => {
               this.$message.success("提交成功");
               this.form = res.data.data;
               this.data = res.data.data.orderItemsList;
-              this.settlementList = res.data.data.settlementList
-
+              this.settlementList = res.data.data.settlementList;
+              this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
+              this.$emit("goBack");
             })
             .finally(() => {
               this.loadingBtn = false;
@@ -597,7 +648,7 @@ export default {
             this.form = res.data.data;
             this.data = res.data.data.orderItemsList;
             this.settlementList = res.data.data.settlementList
-            // this.openEdit()
+            this.openEdit()
           })
           .finally(() => {
             this.loadingBtn = false;

+ 9 - 3
src/views/salesOrder/js/optionList.js

@@ -34,9 +34,7 @@ export const option = {
     },
     {
       label: "电话",
-      prop: "tel",
-      type: 'select',
-      dicData: [],
+      prop: "corpTel",
       search: true,
       overHidden: true,
       index: 3
@@ -154,6 +152,14 @@ export const optionList = {
     {
       name: "storageAmount",
       type: "sum"
+    },
+    {
+      name: "storageInQuantity",
+      type: "sum"
+    },
+    {
+      name: "actualQuantity",
+      type: "sum"
     }
   ],
   column: [