Prechádzať zdrojové kódy

Finish Hotfix-zh-292

howie 2 rokov pred
rodič
commit
0f8b6e72c9
1 zmenil súbory, kde vykonal 140 pridanie a 130 odobranie
  1. 140 130
      src/views/finance/rebate_form.vue

+ 140 - 130
src/views/finance/rebate_form.vue

@@ -1,30 +1,29 @@
 <template>
   <div class="app-container">
     <span>返利单</span>
-    <el-divider></el-divider>
+    <el-divider />
     <!-- 表头 -->
     <div>
       <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
         <el-row :gutter="20">
           <el-col :xs="24" :sm="12" :lg="6">
             <el-form-item label="返利单号" prop="">
-              <el-input disabled placeholder="系统自动生成"></el-input>
+              <el-input disabled placeholder="系统自动生成" />
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
             <el-form-item label="返利日期" prop="">
-              <el-date-picker disabled class="selectStyle" v-model="searchForm.theTime" type="datetime" placeholder="系统自动生成" default-time="23:59:59" value-format="yyyy-MM-dd HH:mm:ss">
-              </el-date-picker>
+              <el-date-picker v-model="searchForm.theTime" disabled class="selectStyle" type="datetime" placeholder="系统自动生成" default-time="23:59:59" value-format="yyyy-MM-dd HH:mm:ss" />
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
             <el-form-item label="备注" prop="remark">
-              <el-input v-model="searchForm.remark" placeholder="请输入"></el-input>
+              <el-input v-model="searchForm.remark" placeholder="请输入" />
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
             <el-form-item label="制单人" prop="">
-              <el-input disabled v-model="searchForm.createBy" placeholder="请输入"></el-input>
+              <el-input v-model="searchForm.createBy" disabled placeholder="请输入" />
             </el-form-item>
           </el-col>
           <!-- <el-col :xs="24" :sm="12" :lg="6">
@@ -46,8 +45,8 @@
     <!-- 按钮 -->
     <div class="btn-group clearfix">
       <div class="fl">
-        <el-popconfirm v-if="$checkBtnRole('del', $route.meta.roles)" @onConfirm="delSeletFn" title="这是一段内容确定删除吗?">
-          <el-button :disabled="selectList.length < 1" type="danger" size="mini" class="textColor delStyle" icon="el-icon-minus" slot="reference">批量删除</el-button>
+        <el-popconfirm v-if="$checkBtnRole('del', $route.meta.roles)" title="这是一段内容确定删除吗?" @onConfirm="delSeletFn">
+          <el-button slot="reference" :disabled="selectList.length < 1" type="danger" size="mini" class="textColor delStyle" icon="el-icon-minus">批量删除</el-button>
         </el-popconfirm>
       </div>
       <div class="fr">
@@ -65,93 +64,104 @@
     <!-- 列表 -->
     <div class="mymain-container">
       <div class="table">
-        <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe :row-class-name="rouClassNameFn" @row-click="onRowClick" @selection-change="selectionChange" show-summary :summary-method="getSummaries">
-          <el-table-column align="center" type="selection" width="51" show-overflow-tooltip></el-table-column>
+        <el-table
+          v-loading="listLoading"
+          :data="dataList"
+          element-loading-text="Loading"
+          border
+          fit
+          highlight-current-row
+          stripe
+          :row-class-name="rouClassNameFn"
+          show-summary
+          :summary-method="getSummaries"
+          @row-click="onRowClick"
+          @selection-change="selectionChange"
+        >
+          <el-table-column align="center" type="selection" width="51" show-overflow-tooltip />
           <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" disabled v-model="scope.row.customerNumber"></el-input>
+              <el-input v-model="scope.row.customerNumber" style="width: 100%" size="mini" disabled />
             </template>
           </el-table-column>
-          <el-table-column align="left" label="经销商名称" prop="customerName" min-width="200" show-overflow-tooltip>
+          <el-table-column align="left" label="经销商名称" prop="customerName" min-width="300" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-select size="mini" @change="changeCustomerFn($event, scope.$index, scope.row)" v-model="scope.row.customerId" placeholder="请选择" filterable>
-                <el-option v-for="item in customerData" :key="item.id" :label="item.name" :value="item.id">
-                </el-option>
+              <el-select v-model="scope.row.customerId" style="width: 100%" size="mini" placeholder="请选择" filterable @change="changeCustomerFn($event, scope.$index, scope.row)">
+                <el-option v-for="item in customerData" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </template>
           </el-table-column>
           <el-table-column align="left" label="返利类型" prop="customerWalletId" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-select size="mini" v-model="scope.row.customerWalletId" placeholder="请选择" filterable>
-                <el-option v-for="item in scope.row.walletList" :key="item.customerWalletId" :label="item.name" :value="item.customerWalletId">
-                </el-option>
+              <el-select v-model="scope.row.customerWalletId" style="width: 100%" size="mini" placeholder="请选择" filterable>
+                <el-option v-for="item in scope.row.walletList" :key="item.customerWalletId" :label="item.name" :value="item.customerWalletId" />
               </el-select>
             </template>
           </el-table-column>
           <el-table-column align="right" label="返利总金额" prop="amount" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" class="mountclass" type="number" @mousewheel.native.prevent v-model="scope.row.amount"></el-input>
+              <el-input v-model="scope.row.amount" size="mini" style="width: 100%" class="mountclass" type="number" @mousewheel.native.prevent />
             </template>
           </el-table-column>
           <el-table-column align="right" label="暂扣返利" prop="withholdAmount" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" class="mountclass" type="number" @mousewheel.native.prevent v-model="scope.row.withholdAmount"></el-input>
+              <el-input v-model="scope.row.withholdAmount" style="width: 100%" size="mini" class="mountclass" type="number" @mousewheel.native.prevent />
             </template>
           </el-table-column>
           <el-table-column align="left" label="政策文件流水号" prop="policyFileNo" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.policyFileNo"></el-input>
+              <el-input v-model="scope.row.policyFileNo" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="政策文号" prop="policyDocNo" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.policyDocNo"></el-input>
+              <el-input v-model="scope.row.policyDocNo" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="政策年份" prop="policyYear" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.policyYear"></el-input>
+              <el-input v-model="scope.row.policyYear" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="政策月份" prop="policyMonth" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.policyMonth"></el-input>
+              <el-input v-model="scope.row.policyMonth" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="政策归属部门" prop="policyOrg" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.policyOrg"></el-input>
+              <el-input v-model="scope.row.policyOrg" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="客户区域" prop="customerArea" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.customerArea"></el-input>
+              <el-input v-model="scope.row.customerArea" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="客户属性" prop="customerAttr" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.customerAttr"></el-input>
+              <el-input v-model="scope.row.customerAttr" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="建立实际归属客户" prop="rewardActualCustomers" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.rewardActualCustomers"></el-input>
+              <el-input v-model="scope.row.rewardActualCustomers" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="备注1" prop="remark1" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.remark1"></el-input>
+              <el-input v-model="scope.row.remark1" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
           <el-table-column align="left" label="备注2" prop="remark2" min-width="160" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-input size="mini" v-model="scope.row.remark2"></el-input>
+              <el-input v-model="scope.row.remark2" style="width: 100%" size="mini" />
             </template>
           </el-table-column>
         </el-table>
       </div>
     </div>
-    <br />
+    <br>
 
     <!-- 按钮 -->
     <div class="btn-group clearfix">
@@ -171,8 +181,8 @@
 </template>
 
 <script>
-import { mapGetters } from "vuex";
-import { downloadFiles, handleImport } from "@/utils/util";
+import { mapGetters } from 'vuex'
+import { downloadFiles, handleImport } from '@/utils/util'
 
 import {
   getCustomerList,
@@ -180,8 +190,8 @@ import {
   getRebateOrderAdd,
   getRebateOrderApply,
   getRebateOrderList,
-  getRebateOrderDownLoad,
-} from "@/api/finance/rebate_form";
+  getRebateOrderDownLoad
+} from '@/api/finance/rebate_form'
 export default {
   data() {
     return {
@@ -194,10 +204,10 @@ export default {
       searchForm: {
         // theTime: "",
 
-        remark: "",
-        createBy: "",
+        remark: '',
+        createBy: ''
       },
-      delIndex: null,
+      delIndex: null
       // rules: {
       //   theTime: [
       //     {
@@ -207,83 +217,83 @@ export default {
       //     },
       //   ],
       // },
-    };
+    }
   },
 
   computed: {
-    ...mapGetters(["name"]),
+    ...mapGetters(['name'])
   },
   created() {
-    this.getCustomerData();
-    this.searchForm.createBy = this.name;
+    this.getCustomerData()
+    this.searchForm.createBy = this.name
   },
   methods: {
-    //合计
+    // 合计
     getSummaries(param) {
-      const { columns, data } = param;
-      const sums = [];
+      const { columns, data } = param
+      const sums = []
       columns.forEach((column, index) => {
         if (index === 0) {
-          sums[index] = "合计";
+          sums[index] = '合计'
         }
         if (index === 4) {
-          let map2 = data.map((v) => {
-            return v.amount * 1;
-          });
+          const map2 = data.map((v) => {
+            return v.amount * 1
+          })
           sums[index] = map2
             .reduce((prev, curr) => {
-              const value = Number(curr);
+              const value = Number(curr)
               if (!isNaN(value)) {
-                return (prev + curr) * 1;
+                return (prev + curr) * 1
               } else {
-                return prev * 1;
+                return prev * 1
               }
             }, 0)
-            .toFixed(2);
+            .toFixed(2)
         }
         if (index === 5) {
-          let map2 = data.map((v) => {
-            return v.withholdAmount * 1;
-          });
+          const map2 = data.map((v) => {
+            return v.withholdAmount * 1
+          })
           sums[index] = map2
             .reduce((prev, curr) => {
-              const value = Number(curr);
+              const value = Number(curr)
               if (!isNaN(value)) {
-                return (prev + curr) * 1;
+                return (prev + curr) * 1
               } else {
-                return prev * 1;
+                return prev * 1
               }
             }, 0)
-            .toFixed(2);
+            .toFixed(2)
         }
-      });
+      })
 
-      return sums;
+      return sums
     },
-    //删除
+    // 删除
     delSeletFn() {
-      this.selectList.sort(function (a, b) {
-        return b - a;
-      });
+      this.selectList.sort(function(a, b) {
+        return b - a
+      })
 
       for (let index = 0; index < this.selectList.length; index++) {
         // console.log(index);
-        this.dataList.splice(this.selectList[index], 1);
+        this.dataList.splice(this.selectList[index], 1)
       }
     },
-    //选择项改变
+    // 选择项改变
     selectionChange(v) {
-      this.selectList = v.map((v) => v.index);
+      this.selectList = v.map((v) => v.index)
     },
 
     // 导入
     async handleImport(param) {
-      this.listLoading = true;
-      const file = param.file;
-      const formData = new FormData();
-      formData.append("file", file);
-      let result = await handleImport("rebate/order/import", formData);
-      this.importFileList = [];
+      this.listLoading = true
+      const file = param.file
+      const formData = new FormData()
+      formData.append('file', file)
+      const result = await handleImport('rebate/order/import', formData)
+      this.importFileList = []
       if (result.code == 200) {
         // let Arr = result.data.items;
         // let list = [];
@@ -318,36 +328,36 @@ export default {
         // let aa = [...this.dataList, ...list];
 
         // this.dataList = aa;
-        this.$message.success("导入成功");
-        this.$router.push("/finance/rebate/rebate_list");
+        this.$message.success('导入成功')
+        this.$router.push('/finance/rebate/rebate_list')
       } else {
-        this.$message.error(result.message);
+        this.$message.error(result.message)
       }
-      this.listLoading = false;
+      this.listLoading = false
     },
-    //下载模板
+    // 下载模板
     async downLoadFn() {
-      downloadFiles("rebate/order/download");
+      downloadFiles('rebate/order/download')
     },
-    //重置
+    // 重置
     cancelFn() {
       this.searchForm = {
-        theTime: "",
-        createTime: "",
-        remark: "",
-        createBy: "",
-      };
+        theTime: '',
+        createTime: '',
+        remark: '',
+        createBy: ''
+      }
     },
     rouClassNameFn({ row, rowIndex }) {
-      //把每一行的索引放进row
-      row.index = rowIndex;
+      // 把每一行的索引放进row
+      row.index = rowIndex
     },
     onRowClick(row, event, column) {
-      this.delIndex = row.index;
+      this.delIndex = row.index
     },
-    //删除行
+    // 删除行
     delRowFn() {
-      this.dataList.splice(this.delIndex, 1);
+      this.dataList.splice(this.delIndex, 1)
     },
     // //提交审批
     // async submitFn() {
@@ -358,63 +368,63 @@ export default {
     //   await getRebateOrderApply({ id: arr[index].rebateOrderId });
     //   this.$message.success("提交审批成功");
     // },
-    //新增
+    // 新增
     async addFn() {
-      let arr;
-      await this.$refs.searchForm.validate();
+      let arr
+      await this.$refs.searchForm.validate()
       this.dataList.forEach((v) => {
         arr = v.walletList.filter(
           (i) => i.customerWalletId == v.customerWalletId
-        );
-        v.walletName = arr[0].name;
-      });
-      await getRebateOrderAdd({ ...this.searchForm, items: this.dataList });
-      this.$message.success("保存成功");
-      this.$router.push("/finance/rebate/rebate_list");
+        )
+        v.walletName = arr[0].name
+      })
+      await getRebateOrderAdd({ ...this.searchForm, items: this.dataList })
+      this.$message.success('保存成功')
+      this.$router.push('/finance/rebate/rebate_list')
     },
-    //选择经销商名称事件
+    // 选择经销商名称事件
     async changeCustomerFn(v, index, value) {
-      value.customerWalletId = "";
+      value.customerWalletId = ''
 
       const res = await getWalletCustomerList({
         customerId: v,
-        type: "REBATE",
-      });
-      const res2 = this.customerData.filter((i) => i.id == v);
+        type: 'REBATE'
+      })
+      const res2 = this.customerData.filter((i) => i.id == v)
 
-      this.$set(this.dataList[index], "customerNumber", res2[0].number);
-      this.$set(this.dataList[index], "customerName", res2[0].name);
+      this.$set(this.dataList[index], 'customerNumber', res2[0].number)
+      this.$set(this.dataList[index], 'customerName', res2[0].name)
 
-      this.$set(this.dataList[index], "walletList", res.data);
+      this.$set(this.dataList[index], 'walletList', res.data)
     },
-    //获取经销商数据
+    // 获取经销商数据
     async getCustomerData() {
-      const res = await getCustomerList({ pageSize: -1, pageNum: 1 });
-      this.customerData = res.data.records;
+      const res = await getCustomerList({ pageSize: -1, pageNum: 1 })
+      this.customerData = res.data.records
     },
 
-    //添加行
+    // 添加行
     addRowFn() {
       this.dataList.push({
-        customerNumber: "",
-        customerName: "",
-        customerWalletId: "",
+        customerNumber: '',
+        customerName: '',
+        customerWalletId: '',
         amount: null,
         withholdAmount: null,
-        policyFileNo: "",
-        policyDocNo: "",
-        policyYear: "",
-        policyMonth: "",
-        policyOrg: "",
-        customerArea: "",
-        customerAttr: "",
-        rewardActualCustomers: "",
-        remark1: "",
-        remark2: "",
-      });
-    },
-  },
-};
+        policyFileNo: '',
+        policyDocNo: '',
+        policyYear: '',
+        policyMonth: '',
+        policyOrg: '',
+        customerArea: '',
+        customerAttr: '',
+        rewardActualCustomers: '',
+        remark1: '',
+        remark2: ''
+      })
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>