Browse Source

提交消费明细

caojunjie 3 years ago
parent
commit
4c045319ca

+ 1 - 1
src/api/statisticAnalysis/salesDetails.js

@@ -3,7 +3,7 @@ import request from '@/router/axios';
 // 查询销售明细
 export function getList(current, size, params) {
     return request({
-        url: '/api/exportOrder/selBusinessOrder',
+        url: '/api/blade-purchase-sales/exportOrder/selBusinessOrder',
         method: 'get',
         params: {
             ...params,

+ 4 - 0
src/enums/column-name.js

@@ -502,6 +502,10 @@ const columnName = [{
     name: '统计分析销售人员提成'
   },
   {
+    code: 130.1,
+    name: '统计分析-销售明细(N)'
+  },
+  {
     code: 131,
     name: '贸易客户列表'
   },

+ 140 - 100
src/views/statisticAnalysis/salesDetails/index.vue

@@ -2,26 +2,26 @@
   <div>
     <basic-container class="page-crad">
       <avue-crud
-        ref="crud"
-        :option="option"
-        :data="dataList"
-        :page.sync="page"
-        :search.sync="search"
-        :cell-style="cellStyle"
-        @search-change="searchChange"
-        @current-change="currentChange"
-        @size-change="sizeChange"
-        @refresh-change="refreshChange"
-        @on-load="onLoad"
-        :table-loading="loading"
-        :summary-method="summaryMethod"
-        @saveColumn="saveColumn"
-        @resetColumn="resetColumn"
-        @search-criteria-switch="searchCriteriaSwitch"
+          ref="crud"
+          :option="option"
+          :data="dataList"
+          :page.sync="page"
+          :search.sync="search"
+          :cell-style="cellStyle"
+          @search-change="searchChange"
+          @current-change="currentChange"
+          @size-change="sizeChange"
+          @refresh-change="refreshChange"
+          @on-load="onLoad"
+          :table-loading="loading"
+          @saveColumn="saveColumn"
+          @resetColumn="resetColumn"
+          @search-criteria-switch="searchCriteriaSwitch"
       >
         <template slot="menuLeft">
           <el-button type="info" size="small" @click="outExport"
-            >导出</el-button
+          >导出
+          </el-button
           >
         </template>
         <template slot="corpIdSearch">
@@ -29,13 +29,13 @@
         </template>
         <template slot="businesDateSearch">
           <el-date-picker
-            v-model="search.businesDate"
-            type="daterange"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            format="yyyy-MM-dd"
-            value-format="yyyy-MM-dd HH:mm:ss"
-            :default-time="['00:00:00', '23:59:59']"
+              v-model="search.businesDate"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              format="yyyy-MM-dd"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              :default-time="['00:00:00', '23:59:59']"
           >
           </el-date-picker>
         </template>
@@ -45,8 +45,9 @@
 </template>
 
 <script>
-import { getToken } from "@/util/auth";
-import { getList } from  "@/api/statisticAnalysis/salesDetails"
+import {getToken} from "@/util/auth";
+import {getList} from "@/api/statisticAnalysis/salesDetails"
+
 export default {
   name: "index",
   data() {
@@ -62,10 +63,10 @@ export default {
         total: 0,
         pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
       },
-      option: {
+      option:{},
+      optionBack: {
         searchShow: true,
-        searchMenuSpan: 16,
-        align: "center",
+        searchMenuPosition: "right",
         searchSpan: 8,
         border: true,
         index: true,
@@ -73,10 +74,31 @@ export default {
         viewBtn: false,
         editBtn: false,
         delBtn: false,
-        showSummary: true,
         searchIcon: true,
-        searchIndex: 2,
         menu: false,
+        summaryText: "合计",
+        showSummary: true,
+        sumColumnList: [{
+          name: "quantity",
+          type: "sum",
+          decimals: 2
+        },{
+          name: "amount",
+          type: "sum",
+          decimals: 2
+        },{
+          name: "price",
+          type: "sum",
+          decimals: 2
+        },{
+          name: "settlmentAmount",
+          type: "sum",
+          decimals: 2
+        },{
+          name: "feesAmount",
+          type: "sum",
+          decimals: 2
+        }],
         column: [
           {
             label: "客户名称",
@@ -85,78 +107,87 @@ export default {
             width: 100,
             search: true,
             formatter: row => {
-              return row.corpsName;
+              return row.corpName;
             }
           },
-          {
-            label: "品牌",
-            prop: "billType",
-            type: "select",
-            hide: true,
-            showColumn: false,
-            search: true
-          },
+          // {
+          //   label: "品牌",
+          //   prop: "billType",
+          //   type: "select",
+          //   hide: true,
+          //   showColumn: false,
+          //   search: true
+          // },
           {
             label: "日期",
-            prop: "businesDate",
-            type: "date",
-            format: "yyyy-MM-dd",
+            prop: "careteTime",
+            type: "datetime",
+            format: 'yyyy-MM-dd HH:mm:ss',
+            valueFormat: 'yyyy-MM-dd HH:mm:ss',
+            searchRange: true,
+            searchDefaultTime: ['00:00:00', '23:59:59'],
             overHidden: true,
             search: true,
             width: 100
           },
           {
             label: "业务员",
-            prop: "portOfLoad",
+            prop: "brand",
             overHidden: true,
             search: true,
-            width: 100
+            width: 100,
+            type: "select",
+            dicUrl: "/api/blade-user/userList?roleAlias=业务员",
+            props: {
+              label: "realName",
+              value: "id"
+            },
           },
           {
             label: "产品编码",
-            prop: "portOfDestination",
+            prop: "commodityCode",
             overHidden: true,
             width: 100
           },
           {
             label: "规格",
-            prop: "transport",
+            prop: "typeno",
             overHidden: true,
             width: 100
           },
           {
             label: "花纹",
-            prop: "procurementCost",
+            prop: "brandItem",
             overHidden: true,
             width: 100
           },
           {
             label: "数量",
-            prop: "partsCost",
+            prop: "quantity",
             overHidden: true,
             width: 100
           },
           {
             label: "金额",
-            prop: "purchasePrice",
+            prop: "amount",
             overHidden: true,
             width: 100
           },
           {
             label: "单价",
-            prop: "amount",
+            prop: "price",
             overHidden: true,
             width: 100
           },
           {
             label: "回款额",
-            prop: "grossProfit",
+            prop: "settlmentAmount",
             overHidden: true,
             width: 100
           },
           {
             label: "包装费",
-            prop: "grossProfitRate",
+            prop: "feesAmount",
             overHidden: true,
             width: 100
           },
@@ -170,9 +201,18 @@ export default {
       }
     };
   },
-  filters: {
-    decimalFormat(num) {
-      return num ? Number(num).toFixed(2) : "0.00";
+  async created() {
+    // this.option = await this.getColumnData(this.getColumnName(130.1), this.optionBack);
+    this.option = this.optionBack
+    console.log(this.option);
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0) {
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
     }
   },
   methods: {
@@ -205,26 +245,51 @@ export default {
     },
     onLoad(page, params = {}) {
       this.loading = true;
+      let data = params
+      if (data.careteTime) {
+        data.beginCreateTime = data.careteTime[0]
+        data.endCreateTime = data.careteTime[1]
+        delete data.careteTime
+      }
       getList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.search)
+          page.currentPage,
+          page.pageSize,
+          Object.assign(data)
       ).then(res => {
-          if (res.data.data.records) {
-            res.data.data.records.forEach(e => {
-              e.itemLoading = true;
-            });
-          }
-          this.dataList = res.data.data.records ? res.data.data.records : [];
-          this.page.total = res.data.data.total;
-          if (this.page.total) {
-            this.option.height = window.innerHeight - 210;
-          }
-        }).finally(() => {
-          this.loading = false;
-        });
+        if (res.data.data.records) {
+          res.data.data.records.forEach(e => {
+            e.itemLoading = true;
+          });
+        }
+        this.dataList = res.data.data.records ? res.data.data.records : [];
+        this.page.total = res.data.data.total;
+        if (this.page.total) {
+          this.option.height = window.innerHeight - 210;
+        }
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+
+    //列保存触发
+    async saveColumn() {
+      const inSave = await this.saveColumnData(this.getColumnName(130.1),this.option);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    async resetColumn() {
+      this.option = this.optionBack;
+      const inSave = await this.delColumnData(this.getColumnName(130.1), this.optionBack);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    editOpen(row) {
     },
-    editOpen(row) {},
     outExport() {
       // if (!this.search.billType) {
       //   return this.$message.error("请选择类别");
@@ -235,33 +300,6 @@ export default {
       //   }=${getToken()}&billType=${this.search.billType}`
       // );
     },
-    summaryMethod({ columns, data }) {
-      const sums = [];
-      // if (columns.length > 0) {
-      //   columns.forEach((item, index) => {
-      //     sums[0] = "合计";
-      //     if (item.property == "purchasePrice" || item.property == "amount") {
-      //       let amountSum = 0;
-      //       let purchaseAmountSum = 0;
-      //       data.forEach(e => {
-      //         amountSum = _.add(amountSum, Number(e.amount));
-      //         purchaseAmountSum = _.add(
-      //           purchaseAmountSum,
-      //           Number(e.purchasePrice)
-      //         );
-      //       });
-      //       //入库金额总计
-      //       if (item.property == "purchasePrice") {
-      //         sums[index] = micrometerFormat(purchaseAmountSum);
-      //       }
-      //       if (item.property == "amount") {
-      //         sums[index] = micrometerFormat(amountSum);
-      //       }
-      //     }
-      //   });
-      // }
-      return sums;
-    }
   }
 };
 </script>
@@ -270,9 +308,11 @@ export default {
 .page-crad ::v-deep .basic-container__card {
   height: 94.2vh;
 }
+
 ::v-deep .el-table__expanded-cell[class*="cell"] {
   padding: 0px;
 }
+
 .itemTable ::v-deep .el-table {
   width: 100%;
 }