Przeglądaj źródła

报表-月度现金流

lk 5 lat temu
rodzic
commit
f3218bf2de

+ 1 - 1
components/menu/data.js

@@ -43,7 +43,7 @@ export default [{
       },
       {
         title: "月度现金流报表",
-        path: baseUrl + ""
+        path: baseUrl + "report_cash"
       },
       {
         title: "待支出订单报表",

+ 43 - 1
pages/main/index/artificial_orders.vue

@@ -1,5 +1,7 @@
 <template>
+
   <div id="cloud-balance" style="height: 100%; " v-if="hasAuth">
+    <div class="i-title">{{ title }}</div>
     <div class="type-boxs">
       <div class="clear">
         <div class="floatr">
@@ -219,7 +221,9 @@ export default {
       tableData: [],
       localData: {
         env: "test"
-      }
+      },
+      title:'',
+      queryData:{}
     };
   },
   computed: {
@@ -229,9 +233,25 @@ export default {
   },
   mounted() {
     // this.getTableData();
+    this.queryDataFormat();
     this.getFinanceList();
   },
   methods: {
+    queryDataFormat() {
+      let query = this.$route.query;
+      if (JSON.stringify(query) === "{}") {
+        return ;
+      }
+      if(!query.start_time || !query.end_time) return
+      let data = {
+        start_time: query.start_time,
+        end_time: query.end_time,
+      }
+      this.queryData = data;
+      let startDate = new Date(query.start_time) || new Date();
+      this.title = startDate.getFullYear() + "年" + (startDate.getMonth() + 1) + "月份人工收入订单";
+      return true;
+    },
     clickDev(uid) {
       this.$router.push({ path: "/main/orders_detail", params: { id: uid } });
     },
@@ -289,6 +309,14 @@ export default {
         artificial_mark: 1,
         channel: "admin_confirm"
       };
+      if(this.title !== ""){
+        body.isBoos = 1;
+      }
+      if(this.queryData.start_time && this.queryData.end_time){
+        body.start_time = this.queryData.start_time;
+        body.end_time = this.queryData.end_time;
+        body.date_type = 2;
+      }
       const res = await this.$post("/api/admin/order/get_orders", body);
       if (res.status === 0) {
         this.hasAuth = 0;
@@ -305,8 +333,15 @@ export default {
         page_size: this.currentPageSize,
         artificial_mark: 1
       };
+
       var url =
         window.location.host + "/api/admin/order/export?" + "artificial_mark=1";
+      if(this.title !== ""){
+        url += "&isBoos=1";
+      }
+      if(this.queryData.start_time && this.queryData.end_time){
+        url += "&start_time="+this.queryData.start_time+"&end_time="+this.queryData.end_time+"&date_type=2";
+      }
       window.location.href = "http://" + url;
     },
     createOrder() {
@@ -406,4 +441,11 @@ export default {
 .el-form:last-child {
   margin-bottom: 22px;
 }
+.i-title {
+  margin: 0 0 10px 10px;
+  font-size: 20px;
+  font-weight: 600;
+
+}
+
 </style>

+ 458 - 0
pages/main/index/cash_form.vue

@@ -0,0 +1,458 @@
+<template>
+  <div>
+    <div class="i-title">{{ title }}</div>
+    <div style="text-align: right;margin-bottom: 10px">
+      <el-button @click="exportList" class="export-excel" type="primary">导出报表</el-button>
+    </div>
+    <div>
+      <el-table :data="tableData" border width="100%">
+        <el-table-column label="订单名称">
+          <template slot-scope="scope">
+            <span class="lblue point">
+              <nuxt-link
+                target="_blank"
+                :to="{path:'/main/orders_detail?id='+scope.row.order_no}"
+              >{{ scope.row.product_title }}</nuxt-link>
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column label="用户">
+          <template slot-scope="scope">
+            <a
+              class="link-type"
+              :href="scope.row.user_url"
+              target="_blank"
+            >{{ scope.row.user_info.nickname }}({{ scope.row.uid }})</a>
+          </template>
+        </el-table-column>
+        <el-table-column label="实际金额">
+          <template slot-scope="scope">
+            <template v-if="scope.row.channel != 'admin_confirm'">
+              <!--            技术信用-->
+              <div
+                v-if="scope.row.product_type == 13"
+              >
+                <!--退款-->
+                <span
+                  v-if="scope.row.order_type == 8"
+                >{{ (scope.row.real_amount / 100).toFixed(2) }}
+              </span>
+                <template v-else-if="scope.row.order_type == 4">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <!--            提现-->
+              <div v-else-if="scope.row.product_type == 200">
+                <span class="green">
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+              </div>
+              <!--            充值-->
+              <div v-else-if="scope.row.product_type == 3">
+                <div v-if="scope.row.operator_uid==41266">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </div>
+                <div v-else>
+                  <span class="red">+{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                </div>
+              </div>
+              <!--            扣款-->
+              <div v-else-if="scope.row.product_type == 300">
+                <div v-if="scope.row.operator_uid==41266">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </div>
+                <div v-else>
+                  <span class="red">+{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                </div>
+              </div>
+              <!--            云端意向金-->
+              <div v-else-if="scope.row.product_type == 8">
+                <!--如果不是余额购买-->
+                <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+              </div>
+              <!--            雇佣-->
+              <div v-else-if="scope.row.product_type == 4">
+                <!--退款-->
+                <span v-if="scope.row.order_type == 8">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <!--结薪-->
+                <span v-else-if="scope.row.order_type == 5">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <template v-else-if="scope.row.order_type == 4 || scope.row.order_type == 1">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <!--            云端押金-->
+              <div v-else-if="scope.row.product_type == 400">
+                <!--退款-->
+                <span v-if="scope.row.order_type == 8">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <template v-else-if="scope.row.order_type == 1">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <!--            云端工作-->
+              <div v-else-if="scope.row.product_type == 9">
+                <!--退款-->
+                <span v-if="scope.row.order_type == 8">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <!--结薪-->
+                <template v-else-if="scope.row.order_type == 5">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance' && scope.row.channel != 'qingtuanbao'" class="green">
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <!--托管-->
+                <template v-else-if="scope.row.order_type == 1">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <!--            整包-->
+              <div v-else-if="scope.row.product_type == 2">
+                <!--退款-->
+                <span v-if="scope.row.order_type == 8">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <!--结薪-->
+                <template v-else-if="scope.row.order_type == 5">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance' && scope.row.channel != 'qingtuanbao'" class="green">
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <!--托管-->
+                <template v-else-if="scope.row.order_type == 1">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance' && scope.row.channel != 'qingtuanbao'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <!--解冻-->
+                <template v-else-if="scope.row.order_type == 7">
+                  <!--如果不是余额购买-->
+                  <span v-if="scope.row.channel != 'balance' && scope.row.channel != 'qingtuanbao'" class="green">
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                  <span v-else>
+                  {{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                </template>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <!--            查看机会-->
+              <div v-else-if="scope.row.product_type == 1">
+                <!--如果不是余额购买-->
+                <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+              </div>
+              <!--            其他-->
+              <div v-else>
+                <!--如果不是余额购买-->
+                <span v-if="scope.row.channel != 'balance'" class="red">
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+                <span v-else>
+                  +{{ (scope.row.real_amount / 100).toFixed(2) }}
+                </span>
+              </div>
+            </template>
+            <template v-else>
+              <div v-if="scope.row.operator_uid != '41266'">
+                  <span
+                    v-if="parseInt(scope.row.real_amount)>0"
+                    class="red"
+                  >+{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <span
+                  v-else-if="parseInt(scope.row.real_amount) == 0">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <span v-else class="green">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+              <div v-else>
+                <span
+                  v-if="parseInt(scope.row.real_amount)>0"
+                >+{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <span
+                  v-else-if="parseInt(scope.row.real_amount) == 0">{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+                <span v-else>{{ (scope.row.real_amount / 100).toFixed(2) }}</span>
+              </div>
+            </template>
+          </template>
+        </el-table-column>
+        <el-table-column prop="channel_name" label="支付方式"></el-table-column>
+        <el-table-column prop="order_state_name" label="订单状态"></el-table-column>
+        <el-table-column prop label="创建时间">
+          <template slot-scope="scope">
+            <span>{{ formatDate(scope.row.created_at) }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="到账时间">
+          <template slot-scope="scope">
+            <span>{{ formatDate(scope.row.pay_time) }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop label="订单编号">
+          <template slot-scope="scope">
+            <nuxt-link
+              target="_blank"
+              :to="{path:'/main/orders_detail?id='+scope.row.order_no}"
+            >{{ scope.row.order_no }}
+            </nuxt-link>
+          </template>
+        </el-table-column>
+        <el-table-column prop="out_order_id" label="支付编号"></el-table-column>
+        <el-table-column width="100" label="订单类型">
+          <template slot-scope="scope">{{ scope.row.product_type_name }}</template>
+        </el-table-column>
+        <el-table-column prop="order_type_name" label="交易类型">
+          <template slot-scope="scope">
+            <span>{{ scope.row.order_type_name }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="关联项目">
+          <template slot-scope="scope">
+            <a
+              :href="scope.row.related_project.url?scope.row.related_project.url:'#'"
+              target="_blank"
+            >
+              <span
+                class="lblue"
+              >{{ scope.row.related_project.name ? scope.row.related_project.name : "--" }}</span>
+            </a>
+          </template>
+        </el-table-column>
+        <el-table-column prop="operator_uid" label="人工">
+          <template slot-scope="scope">
+            <span v-if="scope.row.operator_info.nickname">{{ scope.row.operator_info.nickname }}</span>
+            <span>({{ scope.row.operator_uid }})</span>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div>
+      <el-pagination
+        @current-change="onClickPage"
+        :current-page.sync="pageInfo.page"
+        :page-size="pageInfo.size"
+        layout="total, prev, pager, next"
+        :total="pageInfo.total"
+      ></el-pagination>
+    </div>
+
+  </div>
+</template>
+
+<script>
+
+export default {
+  data() {
+    return {
+      pageInfo: {
+        page: 1,
+        size: 20,
+        total: 0,
+      },
+      title: "",
+      activeName: '1',
+      orderType: "",
+      tableData: [],
+      queryData: {}
+    };
+  },
+  mounted() {
+    if (!this.queryDataFormat()) {
+      return false;
+    }
+    this.getTableData();
+  },
+  methods: {
+    // 获取列表数据
+    async getTableData() {
+      this.$post("/api/admin/order/get_orders", this.queryData).then(res => {
+        let data = res.data;
+        if (res.status === 1) {
+          this.tableData = data.orders;
+          this.pageInfo.total = data.count;
+        }
+      });
+    },
+
+    async exportList() {
+      let url =
+        window.location.host +
+        "/api/admin/order/export?product_type=" +
+        this.queryData.product_type +
+        "&start_time=" +
+        this.queryData.start_time +
+        "&end_time=" +
+        this.queryData.end_time +
+        "&date_type=" +
+        this.queryData.date_type +
+        "&status=" +
+        this.queryData.status +
+        "&artificial_mark=" +
+        0 +
+        "&active_name=cash_income";
+      window.location.href = "http://" + url;
+    },
+    onClickPage() {
+      this.queryDataFormat();
+      this.getTableData();
+    },
+    handleClick(tab, event) {
+      this.queryDataFormat();
+      this.getTableData();
+    },
+    queryDataFormat() {
+      let query = this.$route.query;
+      if (JSON.stringify(query) === "{}") {
+        this.$message.error('参数不正确');
+        return false;
+      }
+      let arr = ['alipay', 'wxpay', 'apple'];
+      if (!arr.includes(query.channel)) {
+        this.$message.error('渠道不正确');
+        return false;
+      }
+      let data = {
+        view: "platform",
+        channel: query.channel,
+        start_time: query.start_time,
+        end_time: query.end_time,
+        date_type: 2,                              //1到账时间2创建时间
+        status: 401,                               //401订单支付成功
+        artificial_mark: 0,                        //0为开启人工财务1开启
+        page: this.pageInfo.page,
+        page_size: this.pageInfo.size,
+        active_name: 'cash_income'
+
+      }
+      this.formatTitle(data.channel, data.start_time);
+      this.queryData = data;
+      return true;
+    },
+    formatTitle(channel, date) {
+      let startDate = new Date(date);
+      let title = '';
+      switch (channel) {
+        case 'alipay':
+          title = '支付宝';
+          break;
+        case 'wxpay':
+          title = '微信';
+          break;
+        case 'apple':
+          title = '苹果';
+          break;
+      }
+      this.title = startDate.getFullYear() + "年" + (startDate.getMonth() + 1) + "月份" + title + "收入订单";
+    },
+    formatDate(time) {
+      if (time === "0") {
+        return "--";
+      }
+      let now = new Date(time * 1000);
+      let year = now.getFullYear();
+      let month = now.getMonth() + 1;
+      let date = now.getDate();
+      let hour = now.getHours();
+      let minute = now.getMinutes();
+      let second = now.getSeconds();
+      if (hour < 10) {
+        hour = "0" + hour;
+      }
+      if (minute < 10) {
+        minute = "0" + minute;
+      }
+      if (second < 10) {
+        second = "0" + second;
+      }
+      return (
+        year +
+        "-" +
+        month +
+        "-" +
+        date +
+        " " +
+        hour +
+        ":" +
+        minute +
+        ":" +
+        second
+      );
+    },
+  }
+};
+</script>
+
+<style scoped>
+.i-title {
+  margin: 0 0 10px 10px;
+  font-size: 20px;
+  font-weight: 600;
+
+}
+
+.table {
+  height: calc(100% - 80px);
+}
+
+.text-title {
+  font-weight: 600;
+}
+
+.header-bar > div {
+  margin-bottom: 5px;
+}
+
+.green {
+  color: rgba(37, 155, 36, 1);
+}
+
+.orange {
+  color: rgba(255, 152, 0, 1);
+}
+
+.red {
+  color: rgb(255, 2, 30);
+}
+</style>

+ 2 - 1
pages/main/index/orders.vue

@@ -653,10 +653,11 @@ export default {
       if (JSON.stringify(query) === "{}") {
         return ;
       }
-      this.productType[0] = query.product_type * 1;
+      this.productType[0] = query.product_type ? query.product_type * 1 : 0;
       let startDate = new Date(query.start_time);
       let endDate = new Date(query.end_time);
       this.timeRange = [startDate,endDate];
+      this.payType[0] = query.channel || 0;
     },
     formatDate(time) {
       if (time === "0") {

+ 5 - 1
pages/main/index/project_form.vue

@@ -352,7 +352,7 @@
     </div>
     <div>
       <el-pagination
-        @current-change="getTableData"
+        @current-change="onClickPage"
         :current-page.sync="pageInfo.page"
         :page-size="pageInfo.size"
         layout="total, prev, pager, next"
@@ -452,6 +452,10 @@ export default {
       }
       window.location.href = "http://" + url;
     },
+    onClickPage(){
+      this.queryDataFormat();
+      this.getTableData();
+    },
     handleClick(tab, event) {
       if (tab.name === "2") {
         this.orderType = "1";     //托管

+ 198 - 0
pages/main/index/report_cash.vue

@@ -0,0 +1,198 @@
+<template>
+  <div>
+    <div style="text-align: right;margin-bottom: 10px">
+      <el-button @click="exportList" class="export-excel" type="primary">导出报表</el-button>
+    </div>
+    <div class="table">
+      <el-table
+        v-if="tableData.length"
+        border
+        style="width: 100%"
+        :data="tableData"
+      >
+        <el-table-column
+          v-for="(prop, index) of tableProps"
+          :key="index"
+          :prop="prop"
+          :label="tableHeaders[index]"
+        >
+          <template slot-scope="scope">
+            <el-button
+              type="text"
+              v-if="prop === 'alipayIncome'"
+              @click="clickProject(scope.row,'alipay')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'wechatIncome'"
+              @click="clickProject(scope.row,'wxpay')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'appleIncome'"
+              @click="clickProject(scope.row,'apple')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'p'"
+              @click="clickProject(scope.row,'admin_confirm')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'alipayOutcome'"
+              @click="clickProject(scope.row,'alipay_outcome')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'gongMallOutcome'"
+              @click="clickProject(scope.row,'gongmall')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'qingtuanbaoOutcome'"
+              @click="clickProject(scope.row,'qingtuanbao')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <el-button
+              type="text"
+              v-else-if="prop === 'kaifabaoOutcome'"
+              @click="clickProject(scope.row,'kaifabao')"
+            >{{ scope.row[prop] }}
+            </el-button>
+            <span v-else>{{ scope.row[prop] }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div>
+      <el-pagination
+        @current-change="getTableData"
+        :current-page.sync="pageInfo.page"
+        :page-size="pageInfo.size"
+        layout="total, prev, pager, next"
+        :total="pageInfo.total"
+      ></el-pagination>
+    </div>
+
+  </div>
+</template>
+
+<script>
+
+export default {
+  data() {
+    return {
+      pageInfo: {
+        page: 1,
+        size: 20,
+        total: 0,
+      },
+      // 列表头显示内容
+      tableHeaders: [],
+      // 列表头字段
+      tableProps: [],
+      // 列表数据
+      tableData: []
+    };
+  },
+  mounted() {
+    this.getTableData();
+  },
+  methods: {
+    // 获取列表数据
+    async getTableData() {
+      this.tableData = [];
+      const res = await this.$post("/api/admin/ReportForm/index", {
+        id: 'MonthCashTotal'
+      });
+      let data = res.data;
+      this.tableData = data.list;
+      this.pageInfo.total = Number(data.total);
+      this.pageInfo.page = data.totalPage;
+      this.setTitles(data.titles);
+    },
+    async exportList() {
+      let url = window.location.host + "/api/admin/ReportForm/export?id=MonthCashTotal";
+      window.location.href = "http://" + url;
+    },
+    setTitles(title) {
+      for (let i in title) {
+        this.tableProps.push(i);
+        this.tableHeaders.push(title[i]);
+      }
+    },
+    clickProject(row, channel) {
+      let path = "";
+      let arr = ['alipay', 'wxpay', 'apple', 'admin_confirm', 'alipay_outcome', 'gongmall','qingtuanbao','kaifabao'];
+      if (!arr.includes(channel)) {
+        this.$message.error('渠道不正确');
+        return;
+      }
+      if (channel === "admin_confirm") {
+        path = "/main/artificial_orders"
+      }
+      switch (channel) {
+        case 'alipay':
+        case 'wxpay':
+        case 'apple':
+          path = "/main/cash_form";
+          break;
+        case 'admin_confirm':
+          path = "/main/artificial_orders";
+          break;
+        case 'alipay_outcome':
+          path = "/main/withdraw";
+          break;
+        case 'gongmall':
+        case 'qingtuanbao':
+        case 'kaifabao':
+          path = "/main/orders";
+          break;
+      }
+      if (path === "") return;
+      //2020-10-1 00:00:00
+      let date = row.month;
+      if (!date || date.length < 6) {
+        this.$message.error('时间格式不正确');
+        return;
+      }
+      let year = date.substring(0, 4);
+      let month = date.substring(4, 6);
+      let data = {
+        channel: channel,
+        start_time: this.beginTime(year, month),
+        end_time: this.lastTime(year, month)
+      };
+      this.$router.push({path: path, query: data});
+    },
+    beginTime(year, month) {
+      if (month.length <= 1) {
+        let month = "0" + month;
+      }
+      let startTime = year + '-' + month + '-' + "01" + " 00:00:00";
+      return startTime;
+    },
+    lastTime(year, month) {
+      if (month.length <= 1) {
+        let month = "0" + month;
+      }
+      let day = new Date(year, month, 0);
+      let lastdate = year + '-' + month + '-' + day.getDate();
+      let lastTime = lastdate + " 23:59:59";
+      return lastTime;
+    }
+  }
+};
+</script>
+
+<style scoped>
+.table {
+  height: calc(100% - 80px);
+}
+</style>

+ 24 - 4
pages/main/index/withdraw.vue

@@ -121,13 +121,28 @@ export default {
       // 列表头字段
       tableProps,
       // 列表数据
-      tableData: []
+      tableData: [],
+      queryData : {}
     };
   },
   mounted() {
+    this.queryDataFormat();
     this.getTableData();
   },
   methods: {
+    queryDataFormat() {
+      let query = this.$route.query;
+      if (JSON.stringify(query) === "{}") {
+        return false;
+      }
+      if(!query.start_time || !query.end_time) return ;
+      let data = {
+        start_time: query.start_time,
+        end_time: query.end_time,
+      }
+      this.queryData = data;
+      return true;
+    },
     changeSelect(status) {
       this.getTableData();
     },
@@ -164,10 +179,15 @@ export default {
     // 获取列表数据
     async getTableData(page = this.currentPage) {
       this.tableData = [];
-      const res = await this.$post("/api/admin/payment/listDraw", {
+      let query = {
         page,
-        status: this.selectValue
-      });
+        status: this.selectValue,
+      };
+      if(this.queryData.start_time && this.queryData.end_time){
+        query.start_time = this.queryData.start_time;
+        query.end_time = this.queryData.end_time;
+      }
+      const res = await this.$post("/api/admin/payment/listDraw", query);
       const data = res.data;
       this.tableData = this.formatTableData(res.data.list);
       this.totalCount = Number(data.total);