|
|
|
<template>
|
|
|
|
<view class="order">
|
|
|
|
<view class="order-tab">
|
|
|
|
<u-tabs :list="list" :is-scroll="false" active-color="#222222" inactive-color="#666666" font-size="28" :active-item-style="activeStyle" bar-height="6" bar-width="60" v-model="current" @change="changeTabs"></u-tabs>
|
|
|
|
</view>
|
|
|
|
<view class="order-list">
|
|
|
|
<!-- 订单状态:0待付款1待接单2已接单3服务中4已完成5已取消6已退款 -->
|
|
|
|
<view class="item" v-for="(a,i) in orderList" :key="i" @click="toDetail(a)">
|
|
|
|
<view class="a">订单号:{{a.orderno}}<text>{{a.status == 1?'待接单':a.status == 2?'已接单':a.status == 3?'服务中':a.status == 4?'已完成':a.status == 5?'已取消':'已退款'}}</text></view>
|
|
|
|
<view class="b">
|
|
|
|
<image :src="a.img"></image>
|
|
|
|
<view class="info">
|
|
|
|
<view class="name">{{a.nickname}}</view>
|
|
|
|
<view class="desc">约玩项目:{{a.playConfigName}}</view>
|
|
|
|
<view class="price">¥{{a.totalMoney-a.travelExpensesTotal}}元/{{a.duration}}小时</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="c">
|
|
|
|
<view class="btn btn-01" v-if="a.status == 1" @click.stop="toShengqing(a)">立即接单</view>
|
|
|
|
<view class="btn btn-01" v-if="a.status == 2" @click.stop="toFuwu(a)">开始服务</view>
|
|
|
|
<view class="btn" v-if="a.status == 3">服务中</view>
|
|
|
|
<view class="btn btn-01" v-if="a.status == 4" @click.stop="toDel(a)">删除订单</view>
|
|
|
|
<view class="btn" v-if="a.status == 5">已取消</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="empty" v-if="total == 0 ">
|
|
|
|
<image src="@/static/empty.png"></image>
|
|
|
|
<view class="txt">暂无数据</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
payInfo: {},
|
|
|
|
show: false,
|
|
|
|
payIndex: 0,
|
|
|
|
current: 0,
|
|
|
|
list:[{'name': '全部'},{'name': '待接单'},{'name': '已接单'},{'name': '服务中'},{'name': '已完成'}],
|
|
|
|
activeStyle:{'fontSize': '30rpx'},
|
|
|
|
orderList: [],
|
|
|
|
page: 1,
|
|
|
|
total: 1,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad(o) {
|
|
|
|
this.current = o.type;
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
// onReachBottom() {
|
|
|
|
// const that = this;
|
|
|
|
// uni.showLoading({
|
|
|
|
// title: "加载中"
|
|
|
|
// })
|
|
|
|
// that.page ++;
|
|
|
|
// setTimeout(function() {
|
|
|
|
// that.getList(1);
|
|
|
|
// }, 1000);
|
|
|
|
// },
|
|
|
|
methods: {
|
|
|
|
toDetail(a){
|
|
|
|
uni.navigateTo({
|
|
|
|
url: "/pages/users/order/pdetail?type=1&id="+a.id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//开始服务
|
|
|
|
toFuwu() {
|
|
|
|
const that = this;
|
|
|
|
uni.showModal({
|
|
|
|
title: "温馨提示",
|
|
|
|
content: "是否要开始服务?",
|
|
|
|
async success(res) {
|
|
|
|
if(res.confirm){
|
|
|
|
const { code, data, msg } = await that.$api.serviceOrder({orderId: a.id, userId: uni.getStorageSync("userInfo").id});
|
|
|
|
if(code == 200){
|
|
|
|
uni.showToast({
|
|
|
|
title: "服务开始"
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
that.getList();
|
|
|
|
},2000)
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: msg,
|
|
|
|
icon: "none",
|
|
|
|
position: "bottom"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//立即接单
|
|
|
|
toShengqing(a) {
|
|
|
|
const that = this;
|
|
|
|
uni.showModal({
|
|
|
|
title: "温馨提示",
|
|
|
|
content: "是否接单?",
|
|
|
|
async success(res) {
|
|
|
|
if(res.confirm){
|
|
|
|
const { code, data, msg } = await that.$api.acceptOrder({orderId: a.id, userId: uni.getStorageSync("userInfo").id});
|
|
|
|
if(code == 200){
|
|
|
|
uni.showToast({
|
|
|
|
title: "接单成功"
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
that.getList();
|
|
|
|
},2000)
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: msg,
|
|
|
|
icon: "none",
|
|
|
|
position: "bottom"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//删除订单
|
|
|
|
toDel(a) {
|
|
|
|
const that = this;
|
|
|
|
uni.showModal({
|
|
|
|
title: "温馨提示",
|
|
|
|
content: "是否要删除该订单?",
|
|
|
|
async success(res) {
|
|
|
|
if(res.confirm){
|
|
|
|
const { code, data, msg } = await that.$api.deleteOrder({orderId: a.id,delType: 2, userId: uni.getStorageSync("userInfo").id});
|
|
|
|
if(code == 200){
|
|
|
|
uni.showToast({
|
|
|
|
title: "删除成功"
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
that.getList();
|
|
|
|
},2000)
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: msg,
|
|
|
|
icon: "none",
|
|
|
|
position: "bottom"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//取消订单
|
|
|
|
toCancle(a) {
|
|
|
|
const that = this;
|
|
|
|
uni.showModal({
|
|
|
|
title: "温馨提示",
|
|
|
|
content: "是否要取消该订单?",
|
|
|
|
async success(res) {
|
|
|
|
if(res.confirm){
|
|
|
|
const { code, data, msg } = await that.$api.cancelOrder({orderId: a.id,userId: uni.getStorageSync("userInfo").id});
|
|
|
|
if(code == 200){
|
|
|
|
uni.showToast({
|
|
|
|
title: "取消成功"
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
that.getList();
|
|
|
|
},2000)
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: msg,
|
|
|
|
icon: "none",
|
|
|
|
position: "bottom"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//数组对象去重
|
|
|
|
arrayUnique (arr, name) {
|
|
|
|
var hash = {};
|
|
|
|
return arr.reduce(function (item, next) {
|
|
|
|
hash[next[name]]
|
|
|
|
? ""
|
|
|
|
: (hash[next[name]] = true && item.push(next));
|
|
|
|
return item;
|
|
|
|
}, []);
|
|
|
|
},
|
|
|
|
async getList(type) {
|
|
|
|
const { code, data } = await this.$api.orderList({
|
|
|
|
userId: uni.getStorageSync("userInfo").id,
|
|
|
|
status: this.current == 0?Number(this.current)-1:this.current,
|
|
|
|
limit: 20,
|
|
|
|
page: this.page,
|
|
|
|
userType: 2
|
|
|
|
})
|
|
|
|
if(type == 1){
|
|
|
|
uni.hideLoading();
|
|
|
|
}
|
|
|
|
if(code == 200){
|
|
|
|
// this.total = data.total;
|
|
|
|
// this.orderList = this.arrayUnique([...this.orderList,...data.list],'id');
|
|
|
|
this.total = data.length == 0?0:1;
|
|
|
|
this.orderList = data;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
changeTabs(index){
|
|
|
|
this.current = index
|
|
|
|
this.page = 1;
|
|
|
|
this.orderList = []
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.order{
|
|
|
|
.payPopup{
|
|
|
|
padding: 40rpx;
|
|
|
|
overflow: hidden;
|
|
|
|
.title{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 36rpx;
|
|
|
|
color: #333333;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.btn{
|
|
|
|
width: 100%;
|
|
|
|
line-height: 98rpx;
|
|
|
|
background: linear-gradient(0deg, #000000, #3D3B38);
|
|
|
|
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
|
|
|
|
border-radius: 98rpx;
|
|
|
|
font-weight: 400;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin-top: 30rpx;
|
|
|
|
}
|
|
|
|
.content{
|
|
|
|
padding: 0 30rpx;
|
|
|
|
background: #FFFFFF;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
margin-top: 20rpx;
|
|
|
|
.item{
|
|
|
|
padding: 30rpx 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
font-weight: 400;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333333;
|
|
|
|
border-top: 1px solid #EAEAEA;
|
|
|
|
&:first-child{
|
|
|
|
border-top-color: #FFFFFF;
|
|
|
|
}
|
|
|
|
.a{
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
image{
|
|
|
|
width: 60rpx;
|
|
|
|
height: 60rpx;
|
|
|
|
margin-right: 10rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.b{
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #CCCCCC;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
image{
|
|
|
|
width: 32rpx;
|
|
|
|
height: 32rpx;
|
|
|
|
margin-left: 20rpx;
|
|
|
|
}
|
|
|
|
.img1{
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.img2{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&-on{
|
|
|
|
.b{
|
|
|
|
.img1{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.img2{
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.empty{
|
|
|
|
padding: 150rpx 0;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #222222;
|
|
|
|
image{
|
|
|
|
display: block;
|
|
|
|
width: 460rpx;
|
|
|
|
height: 400rpx;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&-tab{
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
&-list{
|
|
|
|
padding: 0 25rpx 25rpx;
|
|
|
|
overflow: hidden;
|
|
|
|
.item{
|
|
|
|
width: 100%;
|
|
|
|
background: #FFFFFF;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
margin-top: 20rpx;
|
|
|
|
overflow: hidden;
|
|
|
|
.a{
|
|
|
|
height: 84rpx;
|
|
|
|
padding: 0 25rpx;
|
|
|
|
line-height: 84rpx;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #666666;
|
|
|
|
border-bottom: 1px solid #EAEAEA;
|
|
|
|
text{
|
|
|
|
float: right;
|
|
|
|
color: #222222;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.c{
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: flex-end;
|
|
|
|
padding: 0 25rpx 25rpx;
|
|
|
|
overflow: hidden;
|
|
|
|
.btn{
|
|
|
|
width: 161rpx;
|
|
|
|
line-height: 61rpx;
|
|
|
|
background: #FFFFFF;
|
|
|
|
border-radius: 61rpx;
|
|
|
|
border: 1px solid #999999;
|
|
|
|
margin-left: 20rpx;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #666666;
|
|
|
|
text-align: center;
|
|
|
|
&-01{
|
|
|
|
background: linear-gradient(0deg, #000000, #3D3B38);
|
|
|
|
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
|
|
|
|
color: #FFFFFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.b{
|
|
|
|
padding: 30rpx 25rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
image{
|
|
|
|
width: 150rpx;
|
|
|
|
height: 150rpx;
|
|
|
|
border-radius: 10rpx;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
.info{
|
|
|
|
flex: 1;
|
|
|
|
.name{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #333333;
|
|
|
|
line-height: 46rpx;
|
|
|
|
}
|
|
|
|
.desc{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 26rpx;
|
|
|
|
color: #999999;
|
|
|
|
margin-top: 20rpx;
|
|
|
|
}
|
|
|
|
.price{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #222222;
|
|
|
|
margin-top: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|