|
@@ -22,8 +22,6 @@
|
|
|
<el-date-picker
|
|
|
class="yezi_date"
|
|
|
v-model="dataRange"
|
|
|
- :disabled="isDisabled"
|
|
|
- @focus="hFocusDate"
|
|
|
clearable
|
|
|
value-format="timestamp"
|
|
|
format="yyyy-MM-dd HH:mm:ss"
|
|
@@ -81,8 +79,8 @@
|
|
|
<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="success" @click="onExcopy">复制</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="onStatistics">按小时统计</el-button>
|
|
|
</div>
|
|
|
</el-header>
|
|
|
|
|
@@ -116,6 +114,25 @@
|
|
|
<el-row style="margin-top:10px;" type="flex" justify="end">
|
|
|
<el-pagination background layout="prev, pager, next" :total="total" :page-size="pageSize" :current-page="pageNumber" @current-change="onPageChange"></el-pagination>
|
|
|
</el-row>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="统计"
|
|
|
+ :visible.sync="statisticsDialogShow"
|
|
|
+ width="80%"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="statisticsTableData"
|
|
|
+ >
|
|
|
+ <el-table-column align="center" prop="date" label="日期"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="successOrders" label="成功单量"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="successPrices" label="成功金额"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="failOrders" label="失败单量"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="abnormalOrders" label="异常单子"></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</el-container>
|
|
|
</el-card>
|
|
|
</template>
|
|
@@ -133,6 +150,8 @@ export default {
|
|
|
name: 'order',
|
|
|
data() {
|
|
|
return {
|
|
|
+ statisticsDialogShow:false,
|
|
|
+ statisticsTableData:[],
|
|
|
tableData: [],
|
|
|
pageSize: 200,
|
|
|
pageNumber: 1,
|
|
@@ -229,6 +248,70 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ formatStatisticsTableData(datas){
|
|
|
+ const statisticsArr = [];
|
|
|
+ if(datas.length == 0) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ datas.map(item=>{
|
|
|
+ const obj = {
|
|
|
+ date:item[0],
|
|
|
+ successOrders:item[1],
|
|
|
+ successPrices:item[2],
|
|
|
+ failOrders:item[3],
|
|
|
+ abnormalOrders:item[4]
|
|
|
+ };
|
|
|
+ statisticsArr.push(obj)
|
|
|
+
|
|
|
+ })
|
|
|
+ console.log('formatStatisticsTableData',statisticsArr);
|
|
|
+ return statisticsArr;
|
|
|
+ },
|
|
|
+ async onStatistics(){
|
|
|
+ if (this.dataRange == null || !this.dataRange[0] || !this.dataRange[1]) {
|
|
|
+ this.startTime = ''
|
|
|
+ this.endTime = ''
|
|
|
+ this.$message.error('请选择日期');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('dataRange',this.dataRange);
|
|
|
+ if(this.dataRange[0] && this.dataRange[1] && this.dataRange[1] - this.dataRange[0] > 172800000) {
|
|
|
+ this.$message.error('开始和结束日期不得大于2日');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.startTime = this.dataRange[0]/1000 || ''
|
|
|
+ this.endTime = this.dataRange[1]/1000 || ''
|
|
|
+ }
|
|
|
+ this.statisticsDialogShow = true;
|
|
|
+ this.isLoading = true
|
|
|
+ try {
|
|
|
+ let param = new URLSearchParams()
|
|
|
+ param.append('stat', true)
|
|
|
+ param.append('start_time', this.startTime)
|
|
|
+ param.append('end_time', this.endTime)
|
|
|
+ // param.append('card_type', this.RechargeType)
|
|
|
+ // param.append('order_state', this.RechargeStatus)
|
|
|
+ // param.append('refill_amount', this.amount)
|
|
|
+ // param.append('mch_order', this.mch_order)
|
|
|
+ // param.append('time', this.time)
|
|
|
+ // param.append('card_no', this.card_no)
|
|
|
+ // param.append('order_sn', this.order_sn)
|
|
|
+ // param.append('quality', this.quality)
|
|
|
+ // const res = await queryList(this.pageNumber, startTime, endTime, this.RechargeType)
|
|
|
+ const res = await queryList(param)
|
|
|
+ console.log('统计', res);
|
|
|
+ if (res && res.code == 200) {
|
|
|
+ this.statisticsTableData = this.formatStatisticsTableData(res.datas.data)
|
|
|
+ // this.tableData = res.datas.data
|
|
|
+ // this.total = res.datas.total * this.pageSize
|
|
|
+ }
|
|
|
+ this.isLoading = false
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.isLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取订单列表
|
|
|
async getOrderList () {
|
|
|
this.isLoading = true
|
|
@@ -378,17 +461,17 @@ export default {
|
|
|
this.dataRange[1] = timeEnd
|
|
|
}
|
|
|
},
|
|
|
- // 时间获取焦点
|
|
|
- hFocusDate() {
|
|
|
- if (!this.mch_order && !this.order_sn && !this.card_no) {
|
|
|
- if (this.timer) {
|
|
|
- window.clearTimeout(this.timer)
|
|
|
- }
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- this.$message.warning('请先输入单号')
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- },
|
|
|
+ // // 时间获取焦点
|
|
|
+ // hFocusDate() {
|
|
|
+ // if (!this.mch_order && !this.order_sn && !this.card_no) {
|
|
|
+ // if (this.timer) {
|
|
|
+ // window.clearTimeout(this.timer)
|
|
|
+ // }
|
|
|
+ // this.timer = setTimeout(() => {
|
|
|
+ // this.$message.warning('请先输入单号')
|
|
|
+ // }, 1000)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
// 导出
|
|
|
async onExport() {
|
|
|
if (this.dataRange == null) {
|