Browse Source

新增导出excel和结算积分的功能

zhangyujun 3 years ago
parent
commit
8f47b51d40
3 changed files with 143 additions and 2 deletions
  1. 15 0
      src/api/proxyscore.js
  2. 127 2
      src/views/proxyscore/index.vue
  3. 1 0
      vue.config.js

+ 15 - 0
src/api/proxyscore.js

@@ -16,4 +16,19 @@ export default new (class Api {
           params:query
       })
   }
+  // 导出积分列表
+  extensionIncomeExport(query){
+    return request({
+      url:"extension/income/export",
+      method:"get",
+      params:query
+    })
+  }
+  //结算积分
+  extensionIncomeExtensionIncomePriceIds(ids){
+    return request({
+      url:"extension/income/extensionIncomePrice/"+ids,
+      method:"get"
+    })
+  }
 })();

+ 127 - 2
src/views/proxyscore/index.vue

@@ -22,13 +22,43 @@
         type="primary"
         >搜索</el-button
       >
+      <el-button
+        type="primary"
+        v-hasPermi="['proxyscore:index:exportExcel']"
+        class="ml20"
+        @click="exportExcel"
+        >导出excel</el-button
+      >
+      <el-button
+        v-hasPermi="['proxyscore:index:balance']"
+        class="ml20"
+        @click="balanceSelectedScore"
+        type="primary"
+        >批量结算积分</el-button
+      >
+
+      <el-button
+        v-hasPermi="['proxyscore:index:balance']"
+        class="ml20"
+        @click="exportExcelBalance"
+        type="primary"
+        >导出和全部结算</el-button
+      >
 
       <span class="pl20 font14" :underline="false"
         >总积分 {{ allProxySCore }}</span
       >
     </div>
     <div class="pl20 pr20">
-      <el-table :data="tableData">
+      <el-table
+        @selection-change="
+          (selection) => {
+            tableDataSelection = selection;
+          }
+        "
+        :data="tableData"
+      >
+        <el-table-column label="微信名" type="selection"></el-table-column>
         <el-table-column label="微信名" prop="nickName"></el-table-column>
         <el-table-column label="微信头像" prop="extensionCount">
           <template slot-scope="scope">
@@ -74,6 +104,15 @@
           label="消费金额"
           prop="costCount"
         ></el-table-column>
+
+        <el-table-column label="结算积分">
+          <template slot-scope="scope">
+            <el-link @click="balanceSingleScore(scope.row)" type="primary"
+              >结算</el-link
+            >
+          </template>
+        </el-table-column>
+
         <!-- achievement -->
       </el-table>
     </div>
@@ -183,11 +222,11 @@ export default {
   data() {
     return {
       proxySchoolList: [],
+      tableDataSelection: [],
       ProxySchoolSelected: "",
       tableData: [],
       subTableVisible: false,
       subTableData: [],
-
       sub1TableVisible: false,
       sub1TableData: [],
     };
@@ -203,6 +242,92 @@ export default {
     },
   },
   methods: {
+    exportExcelBalance() {
+      let that = this;
+
+      this.$confirm("是否导出当前全部代理的数据并且结算?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          that.$message.success("正在处理中,请稍等");
+          return proxyscoreApi.extensionIncomeExport({
+            openid: that.ProxySchoolSelected,
+          });
+        })
+        .then((response) => {
+          this.download(response.data);
+          let ids = this.tableData.map((item) => {
+            return item.id;
+          });
+          proxyscoreApi
+            .extensionIncomeExtensionIncomePriceIds(ids.join(","))
+            .then((res) => {
+              this.$message.success("成功");
+              this.getPage(this.ProxySchoolSelected);
+            });
+        });
+    },
+    exportExcel() {
+      const queryParams = this.queryParams;
+      let that = this;
+
+      this.$confirm("是否导出当前全部代理的数据?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          that.$message.success("正在导出中,请稍等");
+          return proxyscoreApi.extensionIncomeExport({
+            openid: that.ProxySchoolSelected,
+          });
+        })
+        .then((response) => {
+          this.download(response.data);
+        });
+    },
+    balanceSingleScore(item) {
+      this.$confirm("是否结算当前积分?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        proxyscoreApi
+          .extensionIncomeExtensionIncomePriceIds(item.id || 0)
+          .then((res) => {
+            this.$message.success("成功");
+            this.getPage(this.ProxySchoolSelected);
+          });
+      });
+    },
+    balanceSelectedScore() {
+      this.$confirm("是否结算当前选中的积分?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        if (
+          Array.isArray(this.tableDataSelection) &&
+          this.tableDataSelection.length > 0
+        ) {
+          let ids = this.tableDataSelection.map((item) => {
+            return item.id;
+          });
+
+          proxyscoreApi
+            .extensionIncomeExtensionIncomePriceIds(ids.join(","))
+            .then((res) => {
+              this.$message.success("成功");
+              this.tableDataSelection = [];
+              this.getPage(this.ProxySchoolSelected);
+            });
+        } else {
+          return;
+        }
+      });
+    },
     getSubPage(openid) {
       proxyscoreApi
         .extensionIncomeExtensionPoints({

+ 1 - 0
vue.config.js

@@ -34,6 +34,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
+        //process.env.NODE_ENV === "development"?"https://jpcj-admin1.zzxcx.net/stage-api/":"https://jpcj-admin.zzxcx.net/twzd-admin",
         target: process.env.NODE_ENV === "development"?"https://jpcj-admin1.zzxcx.net/stage-api/":"https://jpcj-admin.zzxcx.net/twzd-admin",
         changeOrigin: true,
         pathRewrite: {