352 lines
8.1 KiB
Vue
352 lines
8.1 KiB
Vue
<template>
|
|
<view class="content">
|
|
<!-- tabs -->
|
|
<u-sticky bgColor="#FFF" zIndex="9" >
|
|
<u-tabs
|
|
:current="tabsCurrent"
|
|
:list="tabs"
|
|
keyName="title"
|
|
lineColor="#446EFE"
|
|
:activeStyle="{
|
|
color: '#111',
|
|
fontWeight: 'bold',
|
|
fontSize: '32rpx'
|
|
}"
|
|
:inactiveStyle="{
|
|
color: '#606266',
|
|
fontSize: '30rpx'
|
|
}"
|
|
@click="onTabs"
|
|
></u-tabs>
|
|
</u-sticky>
|
|
<!-- 订单管理列表 -->
|
|
<view class="orders" v-if="orders.length > 0">
|
|
<view class="orders-item" v-for="(item, index) in orders" :key="index">
|
|
<view class="orders-flex">
|
|
<view class="no nowrap" @click="copyNo(item.order_no)">{{item.order_no}}</view>
|
|
<view class="state">{{item.status.text}}</view>
|
|
</view>
|
|
<view class="orders-content">
|
|
<view class="orders-content-item orders-content-bottom" @click="item.is_show_type = !item.is_show_type">
|
|
<label>业务数量</label>
|
|
<view class="nowrap orders-content-type">
|
|
<!-- <text v-for="(itemType, indexType) in item.item_type" :key="indexType" v-if="itemType.number > 0">{{itemType.title}}x{{itemType.number}}</text> -->
|
|
x{{item.items.length}}
|
|
</view>
|
|
<uni-icons class="orders-content-icon" :type="item.is_show_type ? 'top': 'bottom'" size="14" color="gray"></uni-icons>
|
|
</view>
|
|
<view class="orders-content-block" v-show="item.is_show_type">
|
|
<view class="item-flex" v-for="(citem, cindex) in item.items" :key="cindex">
|
|
<view class="item-flex-title">{{citem.institution.title}}({{citem.business_type.title}})</view>
|
|
<view class="item-flex-value">¥{{citem.price}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="orders-content-item">
|
|
<label>客户姓名</label>
|
|
<view class="nowrap">{{item.user.username}}</view>
|
|
</view>
|
|
<view class="orders-content-item">
|
|
<label>客户手机号</label>
|
|
<view class="nowrap">{{item.user.mobile}}</view>
|
|
</view>
|
|
<view class="orders-content-item" v-if="item.total > 0">
|
|
<label>咨询服务费</label>
|
|
<view class="nowrap">¥{{item.total}}</view>
|
|
</view>
|
|
<view class="orders-content-item" v-if="item.diff_prices_pays > 0">
|
|
<label>补差价金额</label>
|
|
<view class="nowrap">¥{{item.diff_prices_pays}}</view>
|
|
</view>
|
|
<view class="orders-content-item">
|
|
<label>下单时间</label>
|
|
<view class="nowrap">{{item.created_at}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="orders-flex">
|
|
<view class="btns">
|
|
<view class="btns-item btns-border" v-if="item.can.service" @click="onOrdersService(item.business_order_id)">匹配服务包</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 分页 -->
|
|
<u-loadmore v-if="pagesShow" :status="status" />
|
|
</view>
|
|
<!-- 订单是空的 -->
|
|
<view class="order-null" v-else>
|
|
<u-empty
|
|
mode="order"
|
|
icon="http://cdn.uviewui.com/uview/empty/order.png"
|
|
text="暂无相关订单"
|
|
>
|
|
</u-empty>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { lists } from '@/apis/interfaces/offline.js'
|
|
import modal from 'uview-ui/libs/config/props/modal';
|
|
export default {
|
|
data() {
|
|
return {
|
|
tabsCurrent : 0,
|
|
tabType : 0,
|
|
tabs : [
|
|
{ key: 'all', title: '全部' }
|
|
],
|
|
orders : [],
|
|
// 分页
|
|
page : {
|
|
current : 1,
|
|
has_more: false,
|
|
},
|
|
pagesShow : false,
|
|
status : ''
|
|
|
|
};
|
|
},
|
|
created() {
|
|
this.tabType = 'all';
|
|
this.getList()
|
|
},
|
|
onShow() {
|
|
// 是否处理当前列表状态
|
|
let isOrderId = this.$store.getters.getOrderId
|
|
if(isOrderId != null){
|
|
this.getList()
|
|
}
|
|
},
|
|
methods: {
|
|
// 切换列表
|
|
onTabs(e){
|
|
this.tabsCurrent = e.index
|
|
this.tabType = this.tabs[e.index].key
|
|
this.page = { current: 1, has_more: false }
|
|
this.orders = []
|
|
this.getList()
|
|
},
|
|
// 变更当前列表状态
|
|
removeListVal(id){
|
|
let ListArr = this.orders
|
|
let ListIndex = ListArr.findIndex(val => val.business_order_id == id)
|
|
if(ListIndex >= 0){
|
|
this.orders.splice(ListIndex, 1)
|
|
}
|
|
this.$store.commit('setOrderId', null)
|
|
},
|
|
// 获取列表
|
|
getList(){
|
|
uni.showLoading({
|
|
title: '加载中...',
|
|
mask : true
|
|
})
|
|
if(this.$store.getters.getOrderId != null){
|
|
this.page = { current: 1, has_more: false }
|
|
this.$store.commit('setOrderId', null)
|
|
}
|
|
lists({
|
|
status: this.tabType,
|
|
page : this.page.current
|
|
}).then(res => {
|
|
let { status, lists } = res;
|
|
lists.data.map(val => {
|
|
val.is_show_type = false
|
|
})
|
|
if(this.tabs.length <= 1){
|
|
this.tabs = status
|
|
}
|
|
let atList = lists.page.current == 1 ? [] : this.orders
|
|
this.orders = atList.concat(lists.data)
|
|
this.page = lists.page
|
|
this.pagesShow = false
|
|
uni.hideLoading()
|
|
}).catch(err => {
|
|
uni.showToast({
|
|
title: err.message,
|
|
icon : 'none'
|
|
})
|
|
})
|
|
},
|
|
// 匹配服务包
|
|
onOrdersService(id){
|
|
this.$Router.push({
|
|
name: 'OfflineService',
|
|
params: {
|
|
orderId: id,
|
|
},
|
|
});
|
|
this.getNextTab = true;
|
|
},
|
|
// 复制订单号码
|
|
copyNo(no){
|
|
uni.setClipboardData({
|
|
data : no,
|
|
success : res => {
|
|
uni.showToast({
|
|
title: '订单号已复制',
|
|
icon : 'none'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onReachBottom() {
|
|
this.pagesShow = true;
|
|
if(this.page.has_more){
|
|
this.status = 'loading';
|
|
this.page.current++
|
|
this.getList()
|
|
return
|
|
}
|
|
this.status = 'nomore';
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
// 订单为空
|
|
.order-null{
|
|
height: 80vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
// 订单列表
|
|
.orders{
|
|
padding: 30rpx 0 10rpx;
|
|
.orders-item{
|
|
margin: 0 30rpx 20rpx;
|
|
background-color: white;
|
|
border-radius: $radius;
|
|
}
|
|
.orders-content{
|
|
padding: 20rpx 30rpx;
|
|
&-item{
|
|
line-height: 70rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 30rpx;
|
|
color: #111111;
|
|
label{
|
|
color: #999999;
|
|
}
|
|
.orders-content-btn{
|
|
color: $main-color;
|
|
}
|
|
&.orders-content-bottom{
|
|
padding-right: 40rpx;
|
|
position: relative;
|
|
.orders-content-icon{
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
}
|
|
}
|
|
}
|
|
&-type{
|
|
text{
|
|
margin-right: 30rpx;
|
|
position: relative;
|
|
display: inline-block;
|
|
&::after{
|
|
position: absolute;
|
|
content: "/";
|
|
width: 30rpx;
|
|
text-align: center;
|
|
font-size: 30rpx;
|
|
top: 0;
|
|
right: -30rpx;
|
|
}
|
|
&:last-child{
|
|
margin-right: 0;
|
|
&::after{
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
&-block{
|
|
background: rgba(68, 110, 254, .03);
|
|
padding: 20rpx;
|
|
font-size: 28rpx;
|
|
border-radius: 10rpx;
|
|
margin: 10rpx 0;
|
|
.item-flex{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
line-height: 50rpx;
|
|
}
|
|
}
|
|
}
|
|
.orders-flex{
|
|
border-bottom: solid 1rpx #F6F6F6;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
padding: 20rpx $padding;
|
|
&:last-child{
|
|
border-top: solid 1rpx #F6F6F6;
|
|
border-bottom: none;
|
|
}
|
|
.no{
|
|
font-size: 30rpx;
|
|
color: #111;
|
|
line-height: 60rpx;
|
|
width: calc(100% - 200rpx);
|
|
}
|
|
.state{
|
|
color: $main-color;
|
|
font-weight: bold;
|
|
font-size: 30rpx;
|
|
line-height: 60rpx;
|
|
width: 200rpx;
|
|
text-align: right;
|
|
}
|
|
.user{
|
|
padding-left: 90rpx;
|
|
position: relative;
|
|
min-height: 70rpx;
|
|
box-sizing: border-box;
|
|
width: calc(100% - 400rpx);
|
|
.user-cover{
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
width: 70rpx;
|
|
height: 70rpx;
|
|
border-radius: 50%;
|
|
background: #ddd;
|
|
}
|
|
.user-name{
|
|
line-height: 70rpx;
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
.btns{
|
|
width: 400rpx;
|
|
text-align: right;
|
|
.btns-item{
|
|
display: inline-block;
|
|
height: 70rpx;
|
|
|
|
line-height: 70rpx;
|
|
background: $main-color;
|
|
color: white;
|
|
border-radius: 35rpx;
|
|
padding: 0 30rpx;
|
|
font-size: 30rpx;
|
|
&.btns-border{
|
|
line-height: 68rpx;
|
|
box-sizing: border-box;
|
|
border:solid 1rpx $main-color;
|
|
background: white;
|
|
color: $main-color;
|
|
margin-right: 20rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|