<template>
|
<!-- 订单列表 -->
|
<view>
|
<view class="header">
|
<search-bar @confirm="search" placeholder="输入会员姓名、手机号、订单号" class="mb-0"></search-bar>
|
</view>
|
<view>
|
<h-tabs
|
class="tab"
|
:activeIndex="orderStatus"
|
@tabClick="tabChange"
|
:tabData="tabs"
|
:config="{
|
color: '#abb1cc',
|
activeColor: '#518EFF',
|
underLineColor: '#518EFF',
|
underLineHeight: 4,
|
fontSize: '28',
|
underLineWidth: 60,
|
}"
|
/>
|
<view class="list">
|
<view class="list-item" v-for="item in list">
|
<navigator :url="'./orderDetail?orderId='+item.orderId" hover-class="none">
|
<view class="list-header">
|
<text>订单号: {{item.orderNo}}</text>
|
<text :class="caculateColor(item.orderStatus)">{{item.orderStatus}}</text>
|
</view>
|
<view class="list-content">
|
<view class="flex flex-v flex-1">
|
<text class="font-bold font-15">{{item.vipName}}</text>
|
<text class="gray">{{item.orderTime}}</text>
|
</view>
|
<view class="flex justify-between flex-1">
|
<view>
|
<view>应付金额</view>
|
<view>实付金额</view>
|
<view>欠款总额</view>
|
</view>
|
<view class="right">
|
<view>¥ {{item.needPay | formatNum}}</view>
|
<view>¥ {{item.realPay | formatNum}}</view>
|
<view>¥ {{item.arrears | formatNum}}</view>
|
</view>
|
</view>
|
</view>
|
</navigator>
|
<view class="list-footer" v-if="item.orderStatus!=='已取消'">
|
<text class="blue-btn small-btn" @click="cancelOrder(item.orderId)">取消订单</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
|
import searchBar from '../../components/searchBar/index.vue';
|
export default {
|
components: {
|
HTabs,
|
searchBar
|
},
|
data() {
|
return {
|
orderStatus: 0,
|
tabs:[
|
{
|
state: 0,
|
name: '全部'
|
},
|
{
|
state: 1,
|
name: '待付款'
|
},
|
{
|
state: 2,
|
name: '已付款'
|
},
|
{
|
state: 3,
|
name: '欠款'
|
},
|
],
|
list: []
|
}
|
},
|
onLoad(options) {
|
if(options.status){
|
this.orderStatus = Number(options.status);
|
}
|
this.loadList()
|
},
|
methods:{
|
loadList(){
|
this.$httpUtils.request('/api/order/findOrderList', {
|
pageNum: 1,
|
pageSize: 100,
|
queryKey: this.queryKey,
|
orderStatus: this.orderStatus
|
}, 'POST').then((res) => {
|
if(res.status == 200){
|
this.list = res.rows;
|
}
|
})
|
},
|
search(val){
|
this.queryKey = val;
|
this.loadList();
|
},
|
tabChange(index){
|
if(this.orderStatus === index){
|
return;
|
}
|
this.orderStatus = index;
|
this.loadList();
|
},
|
caculateColor(status){
|
if(status==='待付款'){
|
return 'blue'
|
} else if(status === '已付款'){
|
return 'blueness'
|
} else if(status === '欠款'){
|
return 'red'
|
} else {
|
return 'gray'
|
}
|
},
|
cancelOrder(id){
|
uni.showModal({
|
title: '提示',
|
content: '确定取消订单吗?',
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
this.$httpUtils.request('/api/order/cancelOrder/'+id).then((res) => {
|
if(res.status == 200){
|
this.loadList()
|
}
|
this.$toast.info(res.info);
|
})
|
}
|
}
|
});
|
}
|
}
|
}
|
</script>
|
|
<style>
|
page{
|
background: #F6F6F8;
|
}
|
.header{
|
padding: 10px 10px 5px;
|
background: #FFFFFF;
|
}
|
.tab{
|
background: #FFFFFF;
|
border-bottom: 1px solid #EDEAF4;
|
}
|
.list-item{
|
background: #FFFFFF;
|
border-radius: 4px;
|
margin: 10px;
|
color: #3a3f3f;
|
border: 1px solid #EDEAF4;
|
padding: 0 10px;
|
}
|
.list-header{
|
display: flex;
|
justify-content: space-between;
|
padding: 12px 0;
|
font-size: 15px;
|
border-bottom: 1px solid #EDEAF4;
|
}
|
.list-content{
|
display: flex;
|
justify-content: space-between;
|
padding: 12px 0;
|
font-size: 14px;
|
line-height: 28px;
|
}
|
.list-footer{
|
display: flex;
|
justify-content: flex-end;
|
padding: 10px 0;
|
border-top: 1px solid #EDEAF4;
|
}
|
</style>
|