瀏覽代碼

经销商修改

lichao 3 年之前
父節點
當前提交
60ebd3a61b

+ 7 - 1
src/components/finance/config/option.json

@@ -100,11 +100,17 @@
       ]
     },
     {
+      "label": "数量",
+      "prop": "quantity",
+      "index": 6,
+      "width": 120,
+      "overHidden": true
+    },
+    {
       "label": "单价",
       "prop": "price",
       "overHidden": true,
       "index": 7,
-      "cell": true,
       "width": 120
     },
     {

+ 33 - 0
src/components/finance/financialAccount.vue

@@ -99,6 +99,30 @@
           </el-select>
           <span v-else>{{ row.unit }}</span>
         </template>
+        <template slot-scope="{row,index}" slot="price">
+          <el-input-number
+            v-if="row.$cellEdit"
+            v-model="row.price"
+            size="small"
+            :controls="false"
+            :precision="2"
+            @input="amountChange(row)"
+            style="width: 100%"
+          />
+          <span v-else>{{ row.price }}</span>
+        </template>
+        <template slot-scope="{row,index}" slot="quantity">
+          <el-input-number
+            v-if="row.$cellEdit"
+            v-model="row.quantity"
+            size="small"
+            :controls="false"
+            :precision="0"
+            @input="amountChange(row)"
+            style="width: 100%"
+          />
+          <span v-else>{{ row.quantity }}</span>
+        </template>
       </avue-crud>
       <div class="dialogButton">
         <el-button size="small" :loading="submitButton" @click="$emit('choceFun')">取消</el-button>
@@ -380,6 +404,15 @@
       resetColumn(){
 
       },
+      amountChange(row) {
+        if (!row.quantity) {
+          row.quantity = 0;
+        }
+        if (!row.price) {
+          row.price = 0;
+        }
+        row.amount = Number(row.price) * Number(row.quantity)
+      },
     }
   }
 </script>

+ 10 - 0
src/util/date.js

@@ -72,3 +72,13 @@ export function defaultDate(type) {
     ];
   }
 }
+// 获得当前日期
+export function getCurrentDate(type = 'dateTime') {
+  const date = new Date();
+  const currentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+  if (type == 'date') {
+    return dateFormat(currentDate, 'yyyy-MM-dd')
+  } else if (type == 'dateTime') {
+    return dateFormat(currentDate, 'yyyy-MM-dd') + ' 00:00:00'
+  }
+}

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

@@ -31,7 +31,7 @@
       "label": "产品编码",
       "prop": "code",
       "index": 1,
-      "width": 100,
+      "width": 200,
       "overHidden": true
     },
     {

+ 144 - 2
src/views/dealer/purchase/detail.vue

@@ -105,8 +105,31 @@
               icon="el-icon-printer"
               size="small"
               @click.stop="openReport()"
-            >报 表</el-button
+            >报 表</el-button>
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-download"
+              @click="downloadHandle"
+            >下载模板</el-button>
+            <el-upload
+              :action="baseURL"
+              :headers="headers"
+              :disabled="disabled || confirmDisabled"
+              :on-progress="uploading"
+              :show-file-list=false
+              accept=".xls,.xlsx"
+              multiple
+              :on-success="importTemplate"
+              :on-error="uploadError"
+              style="float: right"
             >
+              <el-button
+                type="primary"
+                size="small"
+                icon="el-icon-upload"
+              >导 入</el-button>
+            </el-upload>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button
@@ -126,6 +149,33 @@
             >删除</el-button
             >
           </template>
+          <template slot="code" slot-scope="{ row, index }">
+            <span v-if="row.$cellEdit" style="display:flex">
+              <el-select
+                v-model="row.code"
+                placeholder="请选择"
+                filterable
+                size="small"
+                style="width:60%"
+                @change="codeChange(row, index)"
+                :disabled="!form.storageId"
+              >
+                <el-option
+                  v-for="item in goodsoptions"
+                  :key="item.id"
+                  :label="item.code"
+                  :value="item.code"
+                >
+                </el-option>
+              </el-select>
+              <el-button
+                icon="el-icon-search"
+                size="small"
+                @click="rePick(row, index)"
+              ></el-button>
+            </span>
+            <span v-else> {{ row.code }}</span>
+          </template>
           <template slot="cname" slot-scope="{ row, index }">
             <span v-if="row.$cellEdit" style="display:flex">
               <el-select
@@ -133,6 +183,7 @@
                 placeholder="请选择"
                 size="small"
                 style="width:60%"
+                filterable
                 @change="cnameChange(row, index)"
                 :disabled="!form.lotNo"
               >
@@ -352,6 +403,8 @@ import checkSchedule from "@/components/check/checkSchedule";
 import  billApplication from "@/components/bill/billApplication";
 import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
 import {getDetail} from "@/api/basicData/inventoryAccount";
+import { getToken } from "@/util/auth";
+import { getCurrentDate } from "@/util/date";
 
 export default {
   name: "detail",
@@ -571,6 +624,8 @@ export default {
       financialAccountDialog:false,
       feesOption: [],
       unitOption: [],
+      baseURL: '/api/blade-purchase-sales/orderitems/importDealerOrder',
+      headers: { "Blade-Auth": 'Bearer ' + getToken()},
     }
   },
   async created() {
@@ -595,6 +650,7 @@ export default {
     feeList().then(res => {
       this.feesOption = res.data.data.records
     });
+    this.$set(this.form, 'businesDate', getCurrentDate());
     this.$set(this.form, 'status', 0);
     if (this.detailData.query) {
       this.disabled = true;
@@ -941,6 +997,47 @@ export default {
         }
       });
     },
+    codeChange(row) {
+      let form = {};
+      this.goodsoptions.forEach(async e => {
+        if (e.code == row.code) {
+          if (e.batch == 0) {
+            form = await this.getStockInfo({
+              tradeType: 'JXS',
+              goodsId: e.id,
+              storageId: this.form.storageId,
+            })
+            e.storageQuantity = form.stock;
+            e.purchaseAmount = form.purchaseAmount;
+            e.arr = [];
+          } else {
+            e.storageQuantity = 0
+            e.purchaseAmount = 0;
+            e.arr = await this.getLotNo({
+              itemId: e.id,
+              storageId: this.form.storageId,
+              tradeType: 'JXS'
+            });
+          }
+          row.itemId = e.id;
+          row.storageQuantity =  e.storageQuantity;
+          row.cname = e.cname;
+          row.code = e.code;
+          row.corpId = e.corpId;
+          row.corpName = e.corpName;
+          row.brandItem = e.brandItem;
+          row.specsOne = e.specsOne;
+          row.specsTwo = e.specsTwo;
+          row.typeno = e.typeno;
+          row.unit = e.unit;
+          row.size = e.size;
+          row.arr = e.arr;
+          row.priceCategory = e.goodsTypeName;
+          row.purchaseAmount = e.purchaseAmount;
+          row.batch = e.batch;
+        }
+      });
+    },
     cnameChange(row) {
       let form = {};
       this.goodsoptions.forEach(async e => {
@@ -1032,7 +1129,9 @@ export default {
           amount: e.amount,
           costType: this.feesOption.find(item => item.cname == '货款')? this.feesOption.find(item => item.cname == '货款').id: null,
           srcFeesId: e.id,
-          cname: e.cname
+          cname: e.cname,
+          price: e.price,
+          quantity: e.orderQuantity,
         }
         this.applyPaymentList.push(form);
       })
@@ -1082,6 +1181,49 @@ export default {
         this.btnLoading = false;
       })
     },
+    // 下载模板
+    downloadHandle() {
+      this.$confirm('是否下载模板文件?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        window.open(
+          `/api/blade-purchase-sales/orderitems/exportDealerOrder?${
+            this.website.tokenHeader
+          }=${getToken()}`
+        );
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      })
+    },
+    //文件上传时
+    uploading(event, file, fileList) {
+      this.openFullScreen(false, '文件正在解析中');
+    },
+    importTemplate(res, file) {
+      this.openFullScreen(true)
+      res.data.forEach(item => {
+      })
+      this.dataList = this.dataList.concat(res.data)
+    },
+    uploadError(err, file, fileList) {
+      this.openFullScreen(true)
+      this.$message.error(JSON.parse(err.message).msg)
+    },
+    //遮罩层
+    openFullScreen(res, text) {
+      const loading = this.$loading({
+        lock: true,
+        text: text,
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      if (res === true) loading.close();
+    },
   },
 }
 </script>

+ 1 - 1
src/views/dealer/sales/config/customerContact.json

@@ -31,7 +31,7 @@
       "label": "产品编码",
       "prop": "code",
       "index": 1,
-      "width": 100,
+      "width": 200,
       "overHidden": true
     },
     {

+ 1 - 1
src/views/dealer/sales/config/mainList.json

@@ -73,7 +73,7 @@
       "overHidden": true
     },
     {
-      "label": "经办人",
+      "label": "业务员",
       "prop": "chargeMember",
       "search": true,
       "index": 7,

+ 162 - 4
src/views/dealer/sales/detail.vue

@@ -85,6 +85,7 @@
           <template slot="storageId">
             <warehouse-select
               v-model="form.storageId"
+              @returnBack="storageChange"
               :configuration="configurationWarehouse"
               :disabled="disabled || confirmDisabled"/>
           </template>
@@ -129,8 +130,33 @@
               icon="el-icon-printer"
               size="small"
               @click.stop="openReport"
-            >报 表</el-button
+            >报 表</el-button>
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-download"
+              @click="downloadHandle"
+            >下载模板</el-button>
+            <el-upload
+              :action="baseURL"
+              :headers="headers"
+              :disabled="disabled || confirmDisabled || !form.storageId"
+              :on-progress="uploading"
+              :show-file-list=false
+              :data="uploadParam"
+              accept=".xls,.xlsx"
+              multiple
+              :on-success="importTemplate"
+              :on-error="uploadError"
+              style="float: right"
             >
+              <el-button
+                type="primary"
+                size="small"
+                icon="el-icon-upload"
+                :disabled="disabled || confirmDisabled || !form.storageId"
+              >导 入</el-button>
+            </el-upload>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button
@@ -150,12 +176,40 @@
             >删除</el-button
             >
           </template>
+          <template slot="code" slot-scope="{ row, index }">
+            <span v-if="row.$cellEdit" style="display:flex">
+              <el-select
+                v-model="row.code"
+                placeholder="请选择"
+                filterable
+                size="small"
+                style="width:60%"
+                @change="codeChange(row, index)"
+                :disabled="!form.storageId"
+              >
+                <el-option
+                  v-for="item in goodsoptions"
+                  :key="item.id"
+                  :label="item.code"
+                  :value="item.code"
+                >
+                </el-option>
+              </el-select>
+              <el-button
+                icon="el-icon-search"
+                size="small"
+                @click="rePick(row, index)"
+              ></el-button>
+            </span>
+            <span v-else> {{ row.code }}</span>
+          </template>
           <template slot="cname" slot-scope="{ row, index }">
             <span v-if="row.$cellEdit" style="display:flex">
               <el-select
                 v-model="row.itemId"
                 placeholder="请选择"
                 size="small"
+                filterable
                 style="width:60%"
                 @change="cnameChange(row, index)"
                 :disabled="!form.storageId"
@@ -174,7 +228,6 @@
                 @click="rePick(row, index)"
               ></el-button>
             </span>
-
             <span v-else> {{ row.cname }}</span>
           </template>
           <template slot="orderQuantity" slot-scope="{ row, index }">
@@ -414,6 +467,8 @@ import checkSchedule from "@/components/check/checkSchedule";
 import  billApplication from "@/components/bill/billApplication";
 import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
 import {getDetail} from "@/api/basicData/inventoryAccount";
+import { getToken } from "@/util/auth";
+import { getCurrentDate } from "@/util/date";
 
 export default {
   name: "detail",
@@ -503,7 +558,7 @@ export default {
             span: 8,
           },
           {
-            label: "经办人",
+            label: "业务员",
             prop: "chargeMember",
             span: 8,
           },
@@ -656,6 +711,9 @@ export default {
       financialAccountDialog:false,
       feesOption: [],
       unitOption: [],
+      baseURL: '/api/blade-purchase-sales/orderitems/importDealerOrder',
+      headers: { "Blade-Auth": 'Bearer ' + getToken()},
+      uploadParam: {},
     }
   },
   async created() {
@@ -683,6 +741,7 @@ export default {
     feeList().then(res => {
       this.feesOption = res.data.data.records
     });
+    this.$set(this.form, 'businesDate', getCurrentDate());
     this.$set(this.form, 'status', 0);
     if (this.detailData.query) {
       this.disabled = true;
@@ -725,6 +784,11 @@ export default {
       dataDetail(id).then(res => {
         this.form = res.data.data;
         this.form.amount = Number(this.form.amount).toFixed(2);
+        if (this.form.storageId) {
+          this.uploadParam = {
+            storageId: this.form.storageId
+          }
+        }
         this.confirmDisabled = this.form.status == 3? true: false;
         if (this.confirmDisabled) {
           this.option.column.map(e => {
@@ -1121,6 +1185,47 @@ export default {
         }
       });
     },
+    codeChange(row) {
+      let form = {};
+      this.goodsoptions.forEach(async e => {
+        if (e.code == row.code) {
+          if (e.batch == 0) {
+            form = await this.getStockInfo({
+              tradeType: 'JXS',
+              goodsId: e.id,
+              storageId: this.form.storageId,
+            })
+            e.storageQuantity = form.stock;
+            e.purchaseAmount = form.purchaseAmount;
+            e.arr = [];
+          } else {
+            e.storageQuantity = 0
+            e.purchaseAmount = 0;
+            e.arr = await this.getLotNo({
+              itemId: e.id,
+              storageId: this.form.storageId,
+              tradeType: 'JXS'
+            });
+          }
+          row.itemId = e.id;
+          row.storageQuantity =  e.storageQuantity;
+          row.cname = e.cname;
+          row.code = e.code;
+          row.corpId = e.corpId;
+          row.corpName = e.corpName;
+          row.brandItem = e.brandItem;
+          row.specsOne = e.specsOne;
+          row.specsTwo = e.specsTwo;
+          row.typeno = e.typeno;
+          row.unit = e.unit;
+          row.size = e.size;
+          row.arr = e.arr;
+          row.priceCategory = e.goodsTypeName;
+          row.purchaseAmount = e.purchaseAmount;
+          row.batch = e.batch;
+        }
+      });
+    },
     cnameChange(row) {
       let form = {};
       this.goodsoptions.forEach(async e => {
@@ -1222,7 +1327,9 @@ export default {
           amount: e.amount,
           costType: this.feesOption.find(item => item.cname == '货款')? this.feesOption.find(item => item.cname == '货款').id: null,
           srcFeesId: e.id,
-          cname: e.cname
+          cname: e.cname,
+          price: e.price,
+          quantity: e.orderQuantity,
         }
         this.applyPaymentList.push(form);
       })
@@ -1270,6 +1377,57 @@ export default {
         this.btnLoading = false;
       })
     },
+    // 下载模板
+    downloadHandle() {
+      this.$confirm('是否下载模板文件?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        window.open(
+          `/api/blade-purchase-sales/orderitems/exportDealerOrder?${
+            this.website.tokenHeader
+          }=${getToken()}`
+        );
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消'
+        });
+      })
+    },
+    //文件上传时
+    uploading(event, file, fileList) {
+      this.openFullScreen(false, '文件正在解析中');
+    },
+    importTemplate(res, file) {
+      this.openFullScreen(true)
+      res.data.forEach(item => {
+      })
+      this.dataList = this.dataList.concat(res.data)
+    },
+    uploadError(err, file, fileList) {
+      this.openFullScreen(true)
+      this.$message.error(JSON.parse(err.message).msg)
+    },
+    //遮罩层
+    openFullScreen(res, text) {
+      const loading = this.$loading({
+        lock: true,
+        text: text,
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      if (res === true) loading.close();
+    },
+    // 仓库选择
+    storageChange(value) {
+      if (this.form.storageId) {
+        this.uploadParam = {
+          storageId: value
+        }
+      }
+    },
   },
 }
 </script>