<!--
|
* @Author: 小明丶
|
* @Date: 2019-08-20 14:07:56
|
* @LastEditors: 小明丶
|
* @LastEditTime: 2020-11-16 16:54:51
|
* @Description: 花呗订单
|
-->
|
<template>
|
<div class="order-hb-box">
|
<v-navbar :title="typeId ==200002? '用户付息' : '商品消费'" fixed>
|
<template v-slot:right>
|
<div class="flex-center-g" @click="isShow = true;">
|
<span>筛选</span>
|
<svg class="icon" aria-hidden="true" style="width:18px;height:18px;">
|
<use xlink:href="#iconshaixuan"></use>
|
</svg>
|
</div>
|
</template>
|
</v-navbar>
|
<!-- 订单列表 -->
|
<div class="order-list">
|
<v-datacard class='info' :list="orderData"></v-datacard>
|
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="init" >
|
<v-order-item :name="item.userName || '无'" :user='item.label' :time='+item.creTime' :list='item.list'
|
v-for="(item,k) in list" :key="k" @click="go(item.orderId)"></v-order-item>
|
</van-list>
|
|
</div>
|
<v-button-circle icon='icondaochu' v-if="hasExport" title='导出' @click="exportFile"></v-button-circle>
|
|
<v-filter v-model="isShow" :belongArr="belongArr" :periodsArr="periodsArr" :statusArr="statusArr" customTitle="分期本金" :hasSearch="true" :zfbVersionArr="zfbVersionArr"
|
@search="(v)=>search(v,true)"></v-filter>
|
|
|
<van-popup v-model="exporShow">
|
<div class="popup-content">
|
<div class="icon-box flex-center-g" >
|
<div class="child flex-center-g" :style="{background:$store.state.backColor, opacity: 0.8}">
|
<svg class="icon" aria-hidden="true" style="width:33px;height:27px;fill:#fff;" @click="$router.back()">
|
<use xlink:href="#iconyoujian"></use>
|
</svg>
|
</div>
|
</div>
|
<p class="text">
|
<span class="top">已将信息发送至邮箱,请注意查收</span>
|
<span v-text="userinfo.email || ''">1244667@163.com</span>
|
</p>
|
<van-button class="btn-submit" @click="exporShow=false;" :style="{color:$store.state.backColor}">确定</van-button>
|
</div>
|
</van-popup>
|
</div>
|
</template>
|
|
<script>
|
import {
|
mapState,
|
mapGetters
|
} from 'vuex';
|
import {
|
getParams
|
} from '@/utils/index';
|
export default {
|
data() {
|
return {
|
loading:false,
|
finished:false,
|
|
exporShow:false,
|
|
isShow: false,
|
list: [],
|
orderData: [],
|
belongArr: [],
|
periodsArr: [],
|
statusArr: [],
|
zfbVersionArr:[],
|
filter: {}
|
}
|
},
|
computed: {
|
...mapState(['userinfo']),
|
...mapGetters(['orgType']),
|
prodId() {
|
return this.$route.query.prodId
|
},
|
typeId(){
|
return this.$route.query.typeId
|
},
|
id() {
|
return this.$route.query.id;
|
},
|
dataLabel(){
|
if(this.orgType===1 || this.orgType===2){
|
return "交易商户数"
|
}else if(this.orgType ===3){
|
return "交易门店数"
|
}else{
|
return "交易门店数"
|
}
|
},
|
hasExport(){
|
if(localStorage.hjToken){
|
return false
|
}else{
|
return true
|
}
|
}
|
},
|
created() {
|
// this.init()
|
console.log(this.orgType)
|
this.getOrderReport()
|
this.getOrderInit()
|
},
|
methods: {
|
search(v,isClear){
|
this.filter.orderId ="";
|
this.finished = false;
|
this.init(v,isClear)
|
this.getOrderReport(v)
|
},
|
// 获取过滤条件
|
getOrderInit() {
|
this.$api.getOrderInit({
|
orgType: this.userinfo.orgType,
|
prodTypeId: this.typeId
|
}).then((res) => {
|
let body = res.body,
|
insTermVoList = body.insTermVoList || [],
|
orderStatusList = body.orderStatusList || [],
|
orgBaseInfVoList = body.orgBaseInfVoList || [],
|
zfbVersionList = body.zfbVersions || [];
|
this.periodsArr = insTermVoList;
|
this.statusArr = orderStatusList;
|
this.belongArr = orgBaseInfVoList;
|
console.log('zfbVersionList:',zfbVersionList)
|
this.zfbVersionArr = zfbVersionList;
|
}).catch((err) => {
|
|
});
|
|
},
|
// 跳转到详情页面
|
go(id) {
|
this.$router.push(`/product/hb-detail?id=${id}&typeId=${this.typeId}`)
|
},
|
calcLabel(item){
|
switch (this.orgType) {
|
case 1:
|
item.label = item.merName
|
break;
|
case 2:
|
item.label = item.merName
|
break;
|
case 3:
|
item.label = item.storeName
|
break;
|
case 4:
|
item.label = item.recordPerson
|
break;
|
}
|
},
|
// 获取订单列表
|
init(params = this.filter,isClear) {
|
let p = getParams(this.orgType, this.id)
|
params.prodTypeId = this.typeId;
|
params = Object.assign(params, p)
|
this.loading = true;
|
this.$api.getHBList(params).then(res => {
|
this.filter = {...params};
|
if(isClear){
|
this.list = [];
|
}
|
let list = res.body || [],
|
len = list.length;
|
if (len) {
|
this.filter.orderId = list[list.length - 1].orderId;
|
list.forEach(item => {
|
this.calcLabel(item)
|
let color = 'success';
|
switch (item.status) {
|
case 1:
|
color = 'success';
|
break;
|
case 2:
|
color = 'error';
|
break;
|
case 0:
|
color = 'warning';
|
break;
|
case 3:
|
color = 'warning';
|
break;
|
}
|
this.list.push({
|
...item,
|
list: [{
|
value: item.settAmt,
|
label: '分期本金(元)',
|
},
|
{
|
value: item.insTermStr,
|
label: '分期期数(月)',
|
},
|
{
|
value: item.statusStr,
|
label: '订单状态',
|
color
|
}
|
]
|
})
|
})
|
}
|
if (len < 10) {
|
this.finished = true;
|
}
|
this.loading = false;
|
this.isShow = false;
|
}).catch((err) => {
|
this.finished = true;
|
this.loading = false;
|
});
|
},
|
//订单导出
|
exportFile() {
|
if (!this.list.length) {
|
this.$notify('暂无数据导出')
|
return;
|
}
|
this.$api.hbExport(this.filter).then((res) => {
|
|
this.exporShow = true;
|
|
// this.$dialog.alert({
|
// showCancelButton: false,
|
// message: `<div>
|
// <p>已将信息发送至邮箱,请注意查收</p>
|
// <p>${this.userinfo.email}</p>
|
// </div>`
|
// }).then(() => {
|
//
|
// });
|
}).catch((err) => {
|
|
});
|
},
|
// 获取订单统计数据
|
getOrderReport(params) {
|
this.$api.getOrderReport({
|
...params,
|
prodId: this.prodId,
|
pageType: 2,
|
}).then(({
|
body
|
}) => {
|
this.orderData = [];
|
this.orderData.push({
|
title: '交易额',
|
num: body.amtNum || 0,
|
})
|
this.orderData.push({
|
title: '交易单数',
|
num: body.orderNum || 0,
|
})
|
let num = body.merNum || 0;
|
if(this.orgType==4){
|
num = "—";
|
}
|
this.orderData.push({
|
title: this.dataLabel,
|
num
|
})
|
}).catch((err) => {
|
|
})
|
},
|
},
|
}
|
</script>
|
|
<style lang="less" scoped>
|
.order-hb-box {
|
padding-top: 44px;
|
background-color: @c-bg-f5;
|
}
|
|
.order-list {
|
padding: 0 8px 30px;
|
|
.info {
|
margin-bottom: 20px;
|
}
|
}
|
.popup-content{
|
height: 150px;
|
width: 280px;
|
border-radius: 3px;
|
.icon-box{
|
z-index: 99999;
|
height: 64px;
|
width: 64px;
|
position: absolute;
|
left: 50%;
|
background:rgba(66,61,93,0.1);
|
border-radius: 50%;
|
transform: translate(-50%,-50%);
|
|
.child{
|
height: 55px;
|
width: 55px;
|
background:rgba(66,61,93,0.8);
|
border-radius: 50%;
|
|
}
|
}
|
.text{
|
width: 210px;
|
text-align: center;
|
margin: 0 auto;
|
padding-top: 50px;
|
line-height: 18px;
|
.top{
|
color: @c-text-666;
|
}
|
}
|
.btn-submit{
|
.lh(44px);
|
position: absolute;
|
width: 100%;
|
bottom: 0;
|
color: @c-text-default;
|
}
|
}
|
</style>
|