gang.huang vor 2 Jahren
Ursprung
Commit
80bd941321
3 geänderte Dateien mit 153 neuen und 10 gelöschten Zeilen
  1. 29 0
      src/api/index.js
  2. 1 1
      src/pages/subPages/order.vue
  3. 123 9
      src/pages/subPages/reconciliation.vue

+ 29 - 0
src/api/index.js

@@ -436,6 +436,35 @@ export const getRec = (params) => {
         timeout: 120000,
     })
 }
+
+// 对账管理导出订单
+export const getExportOrder = (params) => {
+    return axios({
+        method: 'post',
+        url: `${Prefix}act=merchant_order&op=create_task&client_type=ajax`,
+        withCredentials: true,
+        headers: {
+            "Content-Type": "application/x-www-form-urlencoded"
+          },
+        data: params,
+        timeout: 120000,
+    })
+}
+
+// 对账管理获取导出订单列表
+export const getExportOrderList = (curpage) => {
+    return axios({
+        method: 'post',
+        url: `${Prefix}act=merchant_order&op=task_list&client_type=ajax&curpage=${curpage}`,
+        withCredentials: true,
+        headers: {
+            "Content-Type": "application/x-www-form-urlencoded"
+          },
+        data: {},
+        timeout: 120000,
+    })
+}
+
 // 设置话费充值
 export const phonrRec = (params) => {
     return axios({

+ 1 - 1
src/pages/subPages/order.vue

@@ -81,7 +81,7 @@
         <div>
             <el-button style="margin-right:10px;margin-bottom:20px" type="primary" @click="queryList">查询</el-button>
             <el-button style="margin-right:10px;margin-left:0px;margin-bottom:20px" type="danger" @click="onReset">重置</el-button>
-            <el-button style="margin-right:10px;margin-left:0px;margin-bottom:20px" type="warning" @click="onExport">导出</el-button>
+            <!-- <el-button style="margin-right:10px;margin-left:0px;margin-bottom:20px" type="warning" @click="onExport">导出</el-button> -->
             <el-button style="margin-right:10px;margin-left:0px;margin-bottom:20px" type="success" @click="onExcopy">复制</el-button>
         </div>
     </el-header>

+ 123 - 9
src/pages/subPages/reconciliation.vue

@@ -15,13 +15,18 @@
           </el-select>
           <el-date-picker
             v-model="dataRange"
-            clearable value-format="timestamp" format="yyyy-MM-dd"
-            type="datetimerange" range-separator="至"
-            start-placeholder="开始日期" end-placeholder="结束日期" style="width:260px;"
+            clearable
+            value-format="timestamp"
+            format="yyyy-MM-dd"
+            placeholder="请选择日期"
+            type="date"
+            style="width:260px;"
             @focus="hFocusDate"
             :disabled="isDisabled"></el-date-picker>
           <el-button style="margin-left:10px;" type="primary" @click="onSearch" :loading="searchLoading">查询</el-button>
           <el-button style="margin-left:10px;" type="danger" @click="onReset">重置</el-button>
+          <el-button style="margin-left:10px;" type="primary" @click="onExportOrder">导出订单</el-button>
+
       </div>
       <el-table :data="tableData" border style="width: 100%;font-size:13px;" v-loading="isLoading">
         <el-table-column align="center" prop="count" label="订单总数" />
@@ -30,20 +35,48 @@
         <el-table-column align="center" prop="sendCount" label="充值中订单数"></el-table-column>
         <el-table-column align="center" prop="refill_amounts" label="总充值金额"></el-table-column>
         <el-table-column align="center" prop="mch_amounts" label="总扣款金额"></el-table-column>
-    </el-table>
+      </el-table>
+
+
+      <el-table :data="exportOrderList" border style="width: 100%;font-size:13px;margin-top:20px;" v-loading="isLoading">
+        <el-table-column align="center" prop="title" label="标题" width="600" />
+        <el-table-column align="center" prop="state" label="状态">
+          <template slot-scope="scope">
+            <el-tag type="info" v-if="scope.row.state == 1">待处理</el-tag>
+            <el-tag v-if="scope.row.state == 2">处理中</el-tag>
+            <el-tag type="success" v-if="scope.row.state == 3">已处理</el-tag>
+            <el-tag type="danger" v-if="scope.row.state == 4">处理错误</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="errorCount" label="操作">
+           <template slot-scope="scope">
+            <el-button size="mini" disabled v-if="scope.row.state != 3">下载</el-button>
+            <el-button type="primary" size="mini" v-if="scope.row.state == 3" @click="downloadfile(scope.row.file_path)">下载</el-button>
+           </template>
+        </el-table-column>
+      </el-table>
+
+      <el-row style="margin-top:10px;" type="flex" justify="end">
+        <el-pagination background layout="prev, pager, next" :page-count="total" @current-change="onPageChange" :current-page="curpage"></el-pagination>
+      </el-row>
+
+
+      
+
+      
     </el-card>
   </div>
 </template>
 
 <script>
 // getRec-对账管理
-import { getRec } from '@/api'
+import { getRec,getExportOrder,getExportOrderList } from '@/api'
 import { RecTime } from '@/utils/constants'
 export default {
   name: 'reconciliation',
   data () {
     return {
-      dataRange: [],
+      dataRange: '',
       startTime: '',
       endTime: '',
       value: '',
@@ -65,10 +98,14 @@ export default {
       isDisabled: false,
       tableData: [],
       isLoading: false,
-      searchLoading: false
+      searchLoading: false,
+      exportOrderList: [],
+      curpage:1,
+      total:5
     }
   },
   created() {
+    this.getExportOrderList();
   },
   // 监听器
   watch: {
@@ -92,6 +129,79 @@ export default {
     }
   },
   methods: {
+    onPageChange(page){
+      if(page == this.curpage) return;
+      this.curpage = page;
+      this.getExportOrderList();
+    },
+    async getExportOrderList(){
+      this.isLoading = true;
+      const res = await getExportOrderList(this.curpage);
+       this.isLoading = false;
+      if(res && res.code == 200) {
+         console.log('getExportOrderList',res.datas);
+         this.exportOrderList = res.datas.data;
+         this.total = res.datas.total;
+      }
+      else {
+        this.$message.warning('获取导出列表失败')
+      }
+    },
+  async onExportOrder(){
+       try {
+        if (!this.value) {
+          if (this.timer) {
+            window.clearTimeout(this.timer)
+          }
+          this.timer = setTimeout(() => {
+            this.$message.warning('请选择日期类型')
+          }, 1000)
+          return
+        }
+        if(!this.dataRange) {
+           this.$message.warning('请选择日期')
+           return;
+        }
+        this.searchLoading = true
+        this.isLoading = true
+        console.log('this.dataRange',this.dataRange);
+        this.startTime = this.dataRange/1000
+        this.endTime = (this.dataRange+86400000)/1000
+        let param = new URLSearchParams()
+        param.append('time_type', this.value)
+        param.append('start_time', this.startTime)
+        param.append('end_time', this.endTime)
+        let res = await getExportOrder(param)
+       
+        if (res && res.code == 200) {
+           console.log('导出订单', res.datas.file_path);
+           if(res.datas.file_path) {
+            this.downloadfile(res.datas.file_path)
+           }
+           else{
+             this.$message.warning('导出任务生成成功')
+             this.curpage = 1;
+             this.getExportOrderList();
+           }
+         
+        }
+        this.isLoading =  false
+        this.searchLoading = false
+      } catch (error) {
+        console.log(error);
+        this.isLoading =  false
+        this.searchLoading = false
+      }
+    },
+    downloadfile(file_path){
+      const a = document.createElement('a');
+            a.href = file_path;
+            a.download = '导出订单';
+            a.style.display = 'none';
+            document.body.appendChild(a);
+            a.click();
+            document.body.removeChild(a);
+    },
     // 查询
     async onSearch() {
       try {
@@ -104,10 +214,14 @@ export default {
           }, 1000)
           return
         }
+         if(!this.dataRange) {
+           this.$message.warning('请选择日期')
+           return;
+        }
         this.searchLoading = true
         this.isLoading = true
-        this.startTime = this.dataRange[0]/1000
-        this.endTime = this.dataRange[1]/1000
+        this.startTime = this.dataRange/1000
+        this.endTime = (this.dataRange+86400000)/1000
         let param = new URLSearchParams()
         param.append('time_type', this.value)
         param.append('start_time', this.startTime)