Browse Source

返利增加明细查询

lichao 3 years ago
parent
commit
50b9e96584

+ 8 - 0
src/api/basicData/customerInformation.js

@@ -133,3 +133,11 @@ export function getCorpsattn(query) {
     params: query
   })
 }
+// 客户id查找返利明细
+export function getRebateDetail(query) {
+  return request({
+    url: '/api/blade-client/basiccorpsprofitchange/list',
+    method: 'get',
+    params: query
+  })
+}

+ 4 - 2
src/views/maintenance/rebate/config/mainList.json

@@ -9,7 +9,7 @@
   "addBtn": false,
   "align": "center",
   "menuWidth": "120",
-  "menu": false,
+  "menu": true,
   "showSummary": true,
   "searchIcon": true,
   "searchIndex": 2,
@@ -33,7 +33,9 @@
       "index": 2,
       "minWidth": 80,
       "overHidden": true,
-      "searchSpan": 8
+      "searchSpan": 8,
+      "cell": false,
+      "slot": true
     },{
       "label": "已用返利",
       "prop": "usedProfit",

+ 93 - 18
src/views/maintenance/rebate/index.vue

@@ -17,19 +17,25 @@
         @saveColumn="saveColumn"
         @resetColumn="resetColumn"
         @expand-change="expandChange"
+        @row-update="rowUpdate"
       >
         <template slot-scope="scope" slot="expand">
           <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
-            <el-table-column  label="发货单号" prop="billNo" align="center" show-overflow-tooltip width="200"></el-table-column>
-            <el-table-column  label="金额" prop="overpayment" align="center" show-overflow-tooltip width="200"></el-table-column>
-            <el-table-column  label="消费类型" prop="overpaymentType" align="center" show-overflow-tooltip width="200">
-              <template slot-scope="scope">
-                <span>{{ scope.row.overpaymentType == 0? '增加': '消费' }}</span>
-              </template>
+            <el-table-column  label="订单号" prop="orderNo" align="center" show-overflow-tooltip width="200"></el-table-column>
+            <el-table-column  label="变动总返利" prop="changeProfitReturn" align="center" show-overflow-tooltip width="200"></el-table-column>
+            <el-table-column  label="变动已用返利" prop="changeUsedProfit" align="center" show-overflow-tooltip width="200">
             </el-table-column>
-            <el-table-column  label="创建时间" prop="createTime" align="center" show-overflow-tooltip width="200"></el-table-column>
-            <el-table-column  label="创建人" prop="createUserName" align="center" show-overflow-tooltip width="200"></el-table-column>
+            <el-table-column  label="变动可用返利" prop="changeSurplusProfit" align="center" show-overflow-tooltip width="200"></el-table-column>
+            <el-table-column  label="变动本月待到账返利" prop="changeMonthProfit" align="center" show-overflow-tooltip width="200"></el-table-column>
+            <el-table-column  label="变动时间" prop="createTime" align="center" show-overflow-tooltip width="200"></el-table-column>
           </el-table>
+          <el-pagination
+            :total="page.total"
+            small
+            hide-on-single-page
+            @size-change="insideSizeChange"
+            @current-change="insideCurrentChange"
+          ></el-pagination>
         </template>
         <template slot="corpIdSearch">
           <crop-select
@@ -40,6 +46,25 @@
         <template slot-scope="scope" slot="corpId">
           {{ scope.row.corpName }}
         </template>
+        <template slot-scope="{ row, index }" slot="profitReturn">
+          <el-input
+            v-if="row.$cellEdit"
+            v-model="row.profitReturn"
+            placeholder="请输入"
+            size="small"
+            oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+            @change="profitChange(row)"
+          ></el-input>
+          <span v-else>{{row.profitReturn}}</span>
+        </template>
+        <template slot="menu" slot-scope="{ row, index }">
+          <el-button
+            size="small"
+            icon="el-icon-edit"
+            type="text"
+            @click="rowCell(row, index)"
+          >{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
+        </template>
       </avue-crud>
     </basic-container>
   </div>
@@ -47,7 +72,8 @@
 
 <script>
 import option from './config/mainList.json';
-import {customerList} from "@/api/basicData/customerInformation";
+import {customerList,getRebateDetail} from "@/api/basicData/customerInformation";
+import {typeSave} from "@/api/basicData/customerInformation";
 
 export default {
   name: "index",
@@ -63,6 +89,12 @@ export default {
       },
       search: {},
       loading: false,
+      saveProfit: 0,
+      insidePage: {
+        total: 0,
+        size: 10,
+        current: 1,
+      },
     }
   },
   async created() {
@@ -111,19 +143,17 @@ export default {
       customerList(queryParams).then(res => {
         this.dataList = res.data.data.records;
         this.page.total = res.data.data.total;
+        if (this.page.total) {
+          this.option.height = window.innerHeight - 260;
+        }
+        this.dataList.forEach(item => {
+          this.$set(item,'insideList',[])
+          this.$set(item,'loading', true)
+        })
       }).finally(() => {
         this.loading = false;
       });
     },
-    // 表格展开触发
-    expandChange(row, index) {
-      if (row.loading) {
-        overpaymentDetail({pid: row.id}).then(res => {
-          row.insideList = res.data.data? res.data.data.records: []
-          row.loading = false
-        })
-      }
-    },
     async saveColumn() {
       const inSave = await this.saveColumnData(
         this.getColumnName(68),
@@ -147,6 +177,51 @@ export default {
         this.$refs.crud.$refs.dialogColumn.columnBox = false;
       }
     },
+    //编辑
+    rowCell(row, index) {
+      this.$refs.crud.rowCell(row, index)
+      if (row.$cellEdit) {
+        this.saveProfit = row.profitReturn
+      }
+    },
+    // 修改保存调用
+    rowUpdate(row, index, done) {
+      typeSave(row).then(res => {
+        this.$message.success(row.id? '修改成功':'新增成功')
+      })
+      done()
+    },
+    profitChange(row) {
+      if (Number(row.profitReturn) < Number(row.usedProfit)) {
+        row.profitReturn = this.saveProfit
+        return this.$message.error('总返利不能小于使用返利')
+      }
+      row.surplusProfit = (Number(row.profitReturn) - Number(row.usedProfit)).toFixed(2)
+    },
+    expandGetList() {
+      // const data = {
+      //   corpId: row.id
+      // }
+      // getRebateDetail({corpId: row.id}).then(res => {
+      //   row.insideList = res.data.data? res.data.data.records: []
+      //   row.loading = false
+      // })
+    },
+    // 表格展开触发
+    expandChange(row, index) {
+      if (row.loading) {
+        getRebateDetail({corpId: row.id}).then(res => {
+          row.insideList = res.data.data? res.data.data.records: []
+          row.loading = false
+        })
+      }
+    },
+    insideSizeChange(val) {
+      this.insidePage.size = val
+    },
+    insideCurrentChange(val) {
+      this.insidePage.current = val
+    },
   },
 }
 </script>