Bläddra i källkod

修改完善国内销售订单

lichao 3 år sedan
förälder
incheckning
ee487d0963

+ 1 - 1
src/views/businessManagement/salesOrder/configuration/advantageProject.json

@@ -105,7 +105,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入备注",
           "trigger": "blur"
         }

+ 6 - 3
src/views/businessManagement/salesOrder/configuration/customerContact.json

@@ -21,6 +21,7 @@
     {
       "label": "排序",
       "prop": "sort",
+      "type": "number",
       "index": 1,
       "width":100,
       "cell": true,
@@ -101,7 +102,7 @@
       "prop": "specificationAndModel",
       "index": 4,
       "width":100,
-      "cell": false,
+      "cell": true,
       "rules": [
         {
           "required": false,
@@ -114,7 +115,8 @@
       "prop": "orderQuantity",
       "index": 5,
       "width":100,
-      "cell": true,
+      "cell": false,
+      "slot": true,
       "rules": [
         {
           "required": false,
@@ -153,7 +155,8 @@
       "prop": "price",
       "index": 6,
       "width":100,
-      "cell": true,
+      "cell": false,
+      "slot": true,
       "rules": [
         {
           "required": false,

+ 9 - 3
src/views/businessManagement/salesOrder/configuration/mainList.json

@@ -29,13 +29,13 @@
             "label": "销售订单号",
             "prop": "orderNo",
             "search": true,
-            "index": 1,
+            "index": 2,
             "width":100
         },{
             "label": "主订单号",
             "prop": "morderNo",
             "search": true,
-            "index": 2,
+            "index": 3,
             "width":100
         },{
             "label": "发货地址",
@@ -51,7 +51,7 @@
             "width":100
         },{
             "type": "select",
-            "dicUrl": "/api/blade-system/dict/dictionary?code=user_type",
+            "dicUrl": "/api/blade-system/dict-biz/dictionary?code=payment_term",
             "props": {
                 "label": "dictValue",
                 "value": "dictKey"
@@ -81,12 +81,18 @@
             "width":100
         },{
             "label": "要求发货日期",
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
             "prop": "requiredDeliveryDate",
             "search": true,
             "index": 8,
             "width":100
         },{
             "label": "要求到货日期",
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
             "prop": "requiredArrivalDate",
             "search": true,
             "index": 8,

+ 135 - 26
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -9,7 +9,7 @@
       </div>
       <el-button
           class="el-button--small-yh add-customer-btn"
-          type="success" style="right: 140px;">
+          type="success" style="right: 140px;" @click="copyOrder">
         复制新单
       </el-button>
       <el-button
@@ -30,6 +30,9 @@
                                 size="small" type="datetime" 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 === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%">
+                  <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
+                </el-select>
                 <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
               </el-form-item>
             </el-col>
@@ -42,7 +45,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="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
                 <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="configuration"/>
-                <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
+                <el-input v-else-if="(item.prop === 'advancePayment') || (item.prop === 'settlmentAmount')" v-model="form[item.prop]" size="small" autocomplete="off" @change="computedCost"></el-input>
+                <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -64,6 +68,26 @@
               <span style="float: left;padding-top: 2px">{{ row.code }}</span>
               <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
             </template>
+            <template slot="orderQuantity" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.orderQuantity"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                @change="quantityChange(row)"
+              ></el-input>
+              <span v-else>{{ row.orderQuantity }}</span>
+            </template>
+            <template slot="price" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.price"
+                size="small"
+                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                @change="priceChange(row)"
+              ></el-input>
+              <span v-else>{{ row.price }}</span>
+            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                   type="text"
@@ -146,7 +170,8 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeGoods">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -186,7 +211,8 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closePolicy">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -234,7 +260,8 @@
         top="8vh"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeFees">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -410,6 +437,7 @@ import {
   corpsfiles,
   corpsitem,
   getList,
+  getGoodsList,
   detailList,
   generateShipment
 } from "@/api/basicData/configuration"
@@ -427,6 +455,7 @@ import {
   policyList,
   policyColumn
 } from "@/api/basicData/basicFeesDesc";
+import _ from "lodash";
 
 export default {
   name: "detailsPage",
@@ -453,6 +482,7 @@ export default {
       dialogCost: false,
       treeDeptId: '',
       treeDeptIdCost: '',
+      treePolicyId: '',
       pageCost: {
         pageSize: 10,
         currentPage: 1,
@@ -597,7 +627,7 @@ export default {
             ]
           }, {
             label: '单据状态',
-            prop: 'status1',
+            prop: 'status',
             rules: [
               {
                 required: false,
@@ -637,7 +667,8 @@ export default {
             ]
           }, {
             label: '应收未收款',
-            prop: 'settlmentAmount',//无
+            prop: 'accountsReceivable',//无
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -926,7 +957,8 @@ export default {
             }
           }
         ]
-      }
+      },
+      paymentOption: [],
     }
   },
   //初始化查询
@@ -935,6 +967,13 @@ export default {
       let id = this.$route.query.id.replace(/\"/g, "")
       this.queryData(id)
     }
+    if (this.$route.query.copyId) {
+      let id = this.$route.query.copyId.replace(/\"/g, "")
+      this.queryData(id, true)
+    }
+    this.getWorkDicts("payment_term").then(res => {
+      this.paymentOption = res.data.data
+    })
   },
   watch: {
     '$route'(to, from) {
@@ -951,7 +990,7 @@ export default {
     }
   },
   methods: {
-    queryData(id){
+    queryData(id, isCopy = false){
       detail(id).then(res => {
         console.log(res.data.data)
         this.form = res.data.data;
@@ -959,15 +998,35 @@ export default {
         this.advantageProjectData = this.form.orderFeesList
         this.bankOfDepositData = this.form.orderFilesList
         this.configuration.dicData = this.form.corpName
-        delete this.form.orderItemsList
+        this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
+        // delete this.form.orderItemsList
         delete this.form.orderFeesList
         delete this.form.orderFilesList
         delete this.form.corpName
+        delete this.form.belongToCorpList
+        if (isCopy) {
+          delete this.form.id
+          this.contactsData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.advantageProjectData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.bankOfDepositData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+        }
       });
     },
+    // 复制新单
+    copyOrder() {
+      this.queryData(this.form.id, true)
+    },
     //点击行可编辑
     handleRowClick(row, event, column) {
-      console.log(row.$index)
     },
     //商品编辑
     rowCell(row, index) {
@@ -977,7 +1036,7 @@ export default {
     //费用编辑
     rowCellTwo(row, index) {
       console.log(row)
-      this.$refs.crudProject.rowCellTwo(row, index)
+      this.$refs.crudProject.rowCell(row, index)
     },
     //费用新增触发
     costIncrease() {
@@ -1046,6 +1105,7 @@ export default {
     },
     //导入商品触发
     importChoice() {
+      // this.contactsData = this.contactsData.concat(this.tableData)
       if (this.tableData.length === 1) {
         this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
         this.contactsData[this.choiceIndexT].code = this.tableData[0].code
@@ -1059,7 +1119,6 @@ export default {
     },
     //费用编辑导入触发
     choiceCost() {
-      console.log('1111')
       if (this.tableDataCost.length === 1) {
         this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
         this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
@@ -1070,7 +1129,6 @@ export default {
     },
     //费用导入触发
     importCost() {
-      console.log('111111')
       // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
       if (this.tableDataCost.length > 0) {
         for (let item in this.tableDataCost) {
@@ -1102,14 +1160,25 @@ export default {
       this.tableData = []
       this.dialogVisible = false
     },
+    closeGoods() {
+      this.tableData = [];
+      this.treeDeptId = "";
+    },
+    closeFees() {
+      this.treeDeptIdCost = "";
+      this.treeData = [];
+    },
+    closePolicy() {
+      this.treePolicyId = '';
+      this.dataPolicy = [];
+      this.contactsDataBuyFree = [];
+    },
     //选中触发
     selectionChange(list) {
-      console.log(list);
       this.tableData = list
     },
     //费用选中触发
     selectionChangeCost(list) {
-      console.log(list);
       this.tableDataCost = list
     },
     //导入页左商品类型查询
@@ -1120,14 +1189,14 @@ export default {
     },
     //导入页销售政策查询
     policyNodeClick(data) {
-      console.log(data.id)
-      detailList(data.id).then(res => {
-        console.log(res.data.data)
-        //特价促销
-        this.dataPolicy = res.data.data.specialItemList
-        //买赠促销
-        this.contactsDataBuyFree = res.data.data.presentItemList
-      })
+      this.treePolicyId = data.id
+      // detailList(data.id).then(res => {
+      //   //特价促销
+      //   this.dataPolicy = res.data.data.specialItemList
+      //   //买赠促销
+      //   this.contactsDataBuyFree = res.data.data.presentItemList
+      // })
+      this.policyOnLoad()
     },
     //导入页左费用类型查询
     nodeClickCost(data) {
@@ -1151,7 +1220,6 @@ export default {
     //导入商品政策
     importPolicy() {
       let list = this.policyData.concat(this.policyDataTwo)
-      console.log(list)
       for (let item in list) {
         console.log(list[item])
         this.$refs.crudContact.rowCellAdd(list[item]);
@@ -1210,10 +1278,19 @@ export default {
     rowUpdateProject(row, index, done, loading) {
       done(row);
     },
+    policyOnLoad(params = {}) {
+      // this.policyLoading = true;
+      detailList(this.treePolicyId).then(res => {
+        //特价促销
+        this.dataPolicy = res.data.data.specialItemList
+        //买赠促销
+        this.contactsDataBuyFree = res.data.data.presentItemList
+      })
+    },
     //商品列表查询
     onLoad(page, params = {}) {
       this.loading = true;
-      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
+      getGoodsList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
         console.log(res)
         const data = res.data.data;
         this.page.total = data.total;
@@ -1321,6 +1398,38 @@ export default {
         }
       });
     },
+    // 计算应收未收款
+    computedCost() {
+      // 应收预付款
+      let advancePayment = 0;
+      // 已收款
+      let settlmentAmount = 0;
+      if (this.form.advancePayment) {
+        advancePayment = this.form.advancePayment
+      }
+      if (this.form.settlmentAmount) {
+        settlmentAmount = this.form.settlmentAmount
+      }
+      this.$set(this.form, "accountsReceivable", Number(advancePayment) - Number(settlmentAmount)).toFixed(2);
+    },
+    quantityChange(row) {
+      console.log(row)
+      if (!row.orderQuantity) {
+        row.orderQuantity = 0;
+      } else {
+        // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
+        this.$set(row,"amount",_.multiply(row.price, row.orderQuantity).toFixed(2))
+
+      }
+    },
+    priceChange(row) {
+      if (!row.price) {
+        row.price = 0;
+      } else {
+        // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
+        this.$set(row,"amount",_.multiply(row.price, row.orderQuantity).toFixed(2))
+      }
+    },
     //返回列表
     backToList() {
       this.$router.$avueRouter.closeTag();

+ 19 - 4
src/views/businessManagement/salesOrder/index.vue

@@ -21,7 +21,7 @@
                @on-load="onLoad"
                @tree-load="treeLoad">
       <template slot="menuLeft" slot-scope="{size}">
-        <el-button type="success" :size="size">复制新单</el-button>
+        <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制新单</el-button>
         <el-button type="info" :size="size">导出报表</el-button>
       </template>
       <template slot-scope="scope" slot="menu">
@@ -68,7 +68,12 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      selection: [],
     }
   },
   created() {
@@ -156,6 +161,14 @@ export default {
         query: {id: JSON.stringify(row.id)},
       });
     },
+    // 复制新单
+    copyOrder() {
+      const id = this.selection[0].id;
+      this.$router.push({
+        path: "/salesOrder_detailsPageEdit",
+        query: {copyId: JSON.stringify(id)},
+      });
+    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";
@@ -174,8 +187,10 @@ export default {
     searchReset() {
       console.log('1')
     },
-    selectionChange() {
-      console.log('1')
+    // 选择框
+    selectionChange(list) {
+      this.selection = list;
+      this.single = list.length !== 1;
     },
     currentChange() {
       console.log('1')