浏览代码

计划单

zhouhao 2 年之前
父节点
当前提交
2e72e80077
共有 1 个文件被更改,包括 91 次插入94 次删除
  1. 91 94
      src/views/supply/retail/components/retail_form.vue

+ 91 - 94
src/views/supply/retail/components/retail_form.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="detail-container">
-    <el-page-header @back="goBack" :content="listItem ? '编辑' : '新增'"></el-page-header>
+    <el-page-header :content="listItem ? '编辑' : '新增'" @back="goBack" />
 
     <div class="main-title">
       <div class="title">订单信息</div>
@@ -17,7 +17,7 @@
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="订单号" prop="orderNum">
-            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled />
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
@@ -29,8 +29,7 @@
               value-format="yyyy-MM-dd"
               style="width: 100%"
               placeholder="系统自动生成"
-            >
-            </el-date-picker>
+            />
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
@@ -48,8 +47,7 @@
                 :key="item.adminUserId"
                 :label="item.nickName"
                 :value="item.adminUserId"
-              >
-              </el-option>
+              />
             </el-select>
           </el-form-item>
         </el-col>
@@ -57,22 +55,22 @@
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="经销商编码" prop="jxsNum">
-            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
+            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled />
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="16">
           <el-form-item label="经销商名称" prop="jxsName">
-            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
+            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled />
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="文件编号" prop="fileNum">
-            <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
+            <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号" />
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="16">
           <el-form-item label="表头备注" prop="remark">
-            <el-input v-model="mainForm.remark" placeholder="请输入表头备注"></el-input>
+            <el-input v-model="mainForm.remark" placeholder="请输入表头备注" />
           </el-form-item>
         </el-col>
         <el-col :span="24" :sm="12" :lg="12">
@@ -89,20 +87,22 @@
     <div class="main-title">
       <div class="title">货品信息</div>
       <div>
-        <el-select v-model="warehouseValue" placeholder="请选择发货仓库"
-                   @change="handleWarehouseValue"
-                   size="small" style="margin-right: 10px"
+        <el-select
+          v-model="warehouseValue"
+          placeholder="请选择发货仓库"
+          size="small"
+          style="margin-right: 10px"
+          @change="handleWarehouseValue"
         >
           <el-option
-            :label="item.name"
-            :value="item.id"
             v-for="(item, index) in warehouseList"
             :key="index"
-
-          ></el-option>
+            :label="item.name"
+            :value="item.id"
+          />
         </el-select>
         <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
-        <el-divider direction="vertical"></el-divider>
+        <el-divider direction="vertical" />
         <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
       </div>
     </div>
@@ -119,24 +119,24 @@
         show-summary
         :summary-method="$getSummaries"
       >
-        <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
+        <el-table-column align="center" label="序号" type="index" width="50" />
         <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="140" show-overflow-tooltip>
           <template slot-scope="scope">
             <el-select
+              v-if="listItem"
               v-model="scope.row.saleTypeId"
               placeholder="选择销售类型"
               size="mini"
               clearable
               style="width: 100%"
               @change="changeSaleType(scope.$index)"
-              v-if="listItem"
             >
               <el-option
                 v-for="item in salesTypeList"
                 :key="item.id"
                 :label="item.saleName"
                 :value="item.id"
-              ></el-option>
+              />
             </el-select>
             <div v-else>{{ scope.row.saleTypeName }}</div>
           </template>
@@ -147,24 +147,24 @@
           prop="materialCode"
           min-width="120"
           show-overflow-tooltip
-        ></el-table-column>
+        />
         <el-table-column
           align="center"
           label="产品编码"
           prop="materialOldNumber"
           min-width="120"
           show-overflow-tooltip
-        ></el-table-column>
+        />
         <el-table-column
           align="center"
           label="产品名称"
           prop="materialName"
           min-width="160"
           show-overflow-tooltip
-        ></el-table-column>
+        />
         <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.specification" size="small" v-if="listItem"></el-input>
+            <el-input v-if="listItem" v-model="scope.row.specification" size="small" />
             <div v-else>{{ scope.row.specification }}</div>
           </template>
         </el-table-column>
@@ -174,7 +174,7 @@
           prop="unit"
           min-width="100"
           show-overflow-tooltip
-        ></el-table-column>
+        />
         <!-- <el-table-column align="left" label="文件编号" prop="fileNo" min-width="200" show-overflow-tooltip>
           <template slot-scope="scope">
                <el-input v-model="scope.row.fileNo" size="small" ></el-input>
@@ -183,18 +183,18 @@
         <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
             <el-input
+              v-if="listItem && !isDealer"
               v-model="scope.row.price"
               size="small"
               type="number"
               @mousewheel.native.prevent
-              v-if="listItem && !isDealer"
-            ></el-input>
+            />
             <div v-else>{{ scope.row.price | numToFixed }}</div>
           </template>
         </el-table-column>
         <el-table-column align="right" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.qty" size="small" type="number" @mousewheel.native.prevent></el-input>
+            <el-input v-model="scope.row.qty" size="small" type="number" @mousewheel.native.prevent />
           </template>
         </el-table-column>
         <el-table-column align="right" label="订单金额" prop="compute_amount" min-width="100" show-overflow-tooltip>
@@ -216,8 +216,7 @@
                 :key="item.customerWalletId"
                 :label="item.customerWalletName"
                 :value="item.customerWalletId"
-              >
-              </el-option>
+              />
             </el-select>
           </template>
         </el-table-column>
@@ -253,8 +252,7 @@
                 :key="item.customerWalletId"
                 :label="item.customerWalletName"
                 :value="item.customerWalletId"
-              >
-              </el-option>
+              />
             </el-select>
           </template>
         </el-table-column>
@@ -262,9 +260,9 @@
           <template slot-scope="scope">
             {{
               ((scope.row.price * scope.row.qty * 100 -
-                  (((scope.row.price - scope.row.discAmount) * scope.row.qty * (scope.row.rebateRate * 100)) / 100) *
-                  100 -
-                  ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
+                (((scope.row.price - scope.row.discAmount) * scope.row.qty * (scope.row.rebateRate * 100)) / 100) *
+                100 -
+                ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
                 100)
                 | numToFixed
             }}
@@ -272,16 +270,16 @@
         </el-table-column>
         <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
           <template slot-scope="scope">
-            <el-checkbox v-model="scope.row.isDirectTransfer" @change="hasRak($event, scope.row)"></el-checkbox>
+            <el-checkbox v-model="scope.row.isDirectTransfer" @change="hasRak($event, scope.row)" />
           </template>
         </el-table-column>
-        <el-table-column align="right" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
+        <el-table-column align="right" label="直调数量" prop="directTransferQty" min-width="100" />
         <el-table-column align="center" label="备注" prop="remark" min-width="160">
           <template slot-scope="scope">
-            <el-input v-model="scope.row.remark" size="small"></el-input>
+            <el-input v-model="scope.row.remark" size="small" />
           </template>
         </el-table-column>
-        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip />
         <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip v-if="!listItem">
           <template slot-scope="scope">
             <div>{{ scope.row.status1 | status1Filter }}</div>
@@ -319,7 +317,7 @@
     <div class="page-footer">
       <div class="footer">
         <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
-        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px">
+        <el-popconfirm title="确定关闭吗?" style="margin-left: 10px" @onConfirm="goBack">
           <el-button slot="reference">返回列表</el-button>
         </el-popconfirm>
       </div>
@@ -336,30 +334,30 @@
                   :key="item.id"
                   :label="item.saleName"
                   :value="item.id"
-                ></el-option>
+                />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :xs="12" :sm="6" :lg="6">
             <el-form-item prop="proNum">
-              <el-input v-model="screenForm.proNum" placeholder="请输入物料编码"></el-input>
+              <el-input v-model="screenForm.proNum" placeholder="请输入物料编码" />
             </el-form-item>
           </el-col>
           <el-col :xs="12" :sm="6" :lg="6">
             <el-form-item prop="proName">
-              <el-input v-model="screenForm.proName" placeholder="请输入产品名称"></el-input>
+              <el-input v-model="screenForm.proName" placeholder="请输入产品名称" />
             </el-form-item>
           </el-col>
           <el-col :xs="12" :sm="6" :lg="6">
             <el-form-item prop="proModel">
-              <el-input v-model="screenForm.proModel" placeholder="请输入产品型号"></el-input>
+              <el-input v-model="screenForm.proModel" placeholder="请输入产品型号" />
             </el-form-item>
           </el-col>
           <el-col :xs="12" :sm="6" :lg="6">
             <el-form-item prop="price1" style="display: flex">
-              <el-input v-model="screenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
+              <el-input v-model="screenForm.price1" placeholder="请输入价格" style="width: 46%" />
               <span> - </span>
-              <el-input v-model="screenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
+              <el-input v-model="screenForm.price2" placeholder="请输入价格" style="width: 46%" />
             </el-form-item>
           </el-col>
           <el-col :xs="12" :sm="12" :lg="18" class="tr">
@@ -383,61 +381,60 @@
             height="400"
             @selection-change="leftSelectionChange"
           >
-            <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect"></el-table-column>
+            <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect" />
             <el-table-column
               align="center"
               label="物料编码"
               prop="materialNumber"
               min-width="120"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品编码"
               prop="materialOldNumber"
               min-width="120"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品名称"
               prop="name"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品型号"
               prop="specification"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品价格"
               prop="batchPrice"
               min-width="80"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="销售类型"
               prop="saleName"
               min-width="80"
               show-overflow-tooltip
-            ></el-table-column>
+            />
           </el-table>
           <div class="pagination clearfix" style="margin-top: 10px">
             <div class="fr">
               <el-pagination
-                @current-change="handleTableCurrentChange"
                 :current-page="currentPage"
                 :page-size="10"
                 background
                 layout="prev, pager, next"
                 :total="listTotal"
-              >
-              </el-pagination>
+                @current-change="handleTableCurrentChange"
+              />
             </div>
           </div>
         </div>
@@ -458,49 +455,49 @@
             height="400"
             @selection-change="rightSelectionChange"
           >
-            <el-table-column align="center" type="selection" width="55"></el-table-column>
+            <el-table-column align="center" type="selection" width="55" />
             <el-table-column
               align="center"
               label="销售类型"
               prop="saleName"
               min-width="80"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="物料编码"
               prop="materialNumber"
               min-width="120"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品编码"
               prop="materialOldNumber"
               min-width="120"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品名称"
               prop="name"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品型号"
               prop="specification"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品价格"
               prop="batchPrice"
               min-width="80"
               show-overflow-tooltip
-            ></el-table-column>
+            />
           </el-table>
         </div>
       </div>
@@ -531,14 +528,13 @@ let that
 export default {
   name: 'RetailForm',
   componentName: 'RetailForm',
-  props: ['listItem'],
   filters: {
     status1Filter(val) {
-      let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue
-      let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue
-      let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue
-      let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue
-      let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue
+      const STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue
+      const STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue
+      const STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue
+      const STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue
+      const STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue
       if (val === '' || val === null || val === undefined) {
         return '未检查'
       } else if (val <= 0) {
@@ -554,15 +550,15 @@ export default {
     drag: {
       bing: function(el) {
         console.log(el)
-        let oDiv = el
+        const oDiv = el
         oDiv.onmousedown = e => {
           console.log('onmousedown')
-          let disX = e.clientX - oDiv.offsetLeft
-          let disY = e.clientY - oDiv.offSetTop
+          const disX = e.clientX - oDiv.offsetLeft
+          const disY = e.clientY - oDiv.offSetTop
 
           document.onmousemove = e => {
-            let left = e.clientX - disX
-            let top = e.clientY - disY
+            const left = e.clientX - disX
+            const top = e.clientY - disY
             oDiv.style.left = left + 'px'
             oDiv.style.top = top + 'px'
           }
@@ -575,6 +571,7 @@ export default {
       }
     }
   },
+  props: ['listItem'],
   data() {
     return {
       mainForm: {
@@ -586,7 +583,7 @@ export default {
         fileNum: '',
         remark: '',
         salesMan: '',
-        isPlanOrder: true
+        isPlanOrder: this.listItem ? '' : true
       },
       mainFormRules: {
         // date: [
@@ -636,13 +633,13 @@ export default {
     },
 
     outSalesmanList() {
-      let list = []
+      const list = []
       if (this.goodsList && this.goodsList.length) {
         this.goodsList.forEach(item => {
           if (item.serviceId) {
-            let hasItem = findElem(list, 'adminUserId', item.serviceId)
+            const hasItem = findElem(list, 'adminUserId', item.serviceId)
             if (hasItem < 0) {
-              let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId)
+              const obj = this.salesmanList.find(o => o.adminUserId == item.serviceId)
               if (obj) {
                 list.push(obj)
               }
@@ -723,7 +720,7 @@ export default {
     // 获取详情
     getDetail() {
       getDetail({ id: this.listItem.id }).then(res => {
-        let data = res.data
+        const data = res.data
         this.mainForm.orderNum = data.id
         this.mainForm.date = data.theTime.slice(0, 10)
         this.mainForm.salesMan = data.k3ServiceId
@@ -839,12 +836,12 @@ export default {
         price2: this.screenForm.price2,
         customerId: this.listItem ? this.listItem.customerId : ''
       }).then(res => {
-        let oldGoodsList = this.goodsList
-        let newGoodsList = res.data.records
+        const oldGoodsList = this.goodsList
+        const newGoodsList = res.data.records
         for (let i = 0; i < oldGoodsList.length; i++) {
-          let oldItem = oldGoodsList[i]
+          const oldItem = oldGoodsList[i]
           for (let j = 0; j < newGoodsList.length; j++) {
-            let newItem = newGoodsList[j]
+            const newItem = newGoodsList[j]
             if (newItem.id === oldItem.id) {
               newGoodsList[j].selected = true
               break
@@ -941,8 +938,8 @@ export default {
 
     // 数组去重
     delRepeat(arr1, arr2) {
-      let allArr = arr1.concat(arr2) // 两个数组对象合并
-      let newArr = [] // 存放去重后数据的新数组
+      const allArr = arr1.concat(arr2) // 两个数组对象合并
+      const newArr = [] // 存放去重后数据的新数组
       for (let i = 0; i < allArr.length; i++) {
         // 循环allArr数组对象的内容
         let flag = true // 建立标记,判断数据是否重复,true为不重复
@@ -973,8 +970,8 @@ export default {
 
     // 删除
     deleteGoods() {
-      let rightGoodsList = this.rightGoodsList
-      let rightSelection = this.rightSelection
+      const rightGoodsList = this.rightGoodsList
+      const rightSelection = this.rightSelection
       for (let i = 0; i < rightGoodsList.length; i++) {
         for (let j = 0; j < rightSelection.length; j++) {
           if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
@@ -1005,7 +1002,7 @@ export default {
     // 修改返利钱包
     changeWallet(index) {
       if (this.goodsList[index].customerWalletId2) {
-        let obj = this.goodsList[index].rebateWallets.find(
+        const obj = this.goodsList[index].rebateWallets.find(
           o => o.customerWalletId == this.goodsList[index].customerWalletId2
         )
         this.goodsList[index].rebateRate = obj.rebateRate
@@ -1018,7 +1015,7 @@ export default {
 
     changeSaleType(index) {
       if (this.goodsList[index].saleTypeId) {
-        let obj = this.salesTypeList.find(o => o.id == this.goodsList[index].saleTypeId)
+        const obj = this.salesTypeList.find(o => o.id == this.goodsList[index].saleTypeId)
         this.goodsList[index].saleTypeName = obj.saleName
         this.goodsList[index].saleTypeCode = obj.saleCode
       } else {
@@ -1035,7 +1032,7 @@ export default {
       if (!this.goodsList) {
         return this.$errorMsg('请添加货品')
       }
-      let ids = []
+      const ids = []
       this.goodsList.forEach(item => {
         ids.push(item.materialId)
       })
@@ -1089,7 +1086,7 @@ export default {
             this.$errorMsg(`仓库必选`)
             return
           }
-          let goodsList = JSON.parse(JSON.stringify(this.goodsList))
+          const goodsList = JSON.parse(JSON.stringify(this.goodsList))
           goodsList.forEach(item => {
             delete item.rebateWallets
             delete item.wallets
@@ -1098,10 +1095,10 @@ export default {
             }
           })
 
-          let saleManItem = this.mainForm.salesMan
+          const saleManItem = this.mainForm.salesMan
             ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan)
             : ''
-          let params = {
+          const params = {
             // theTime: this.mainForm.date + ' 00:00:00',
             // mainId: this.mainForm.type,
             // mainName,