547 lines
14 KiB
Vue
Raw Normal View History

2025-04-01 09:03:51 +08:00
<template>
<view class="box flex flex-column flex-start align-items">
<view class="top flex ">
<image :src="detail.headimage" mode="" style="width: 280rpx;height: 200rpx;border-radius: 12rpx;"></image>
<view class="rightBox flex flex-column flex-start">
<span class="name">{{detail.title}}</span>
<span class="minge">开始时间:{{detail.start_time_text}}</span>
<span class="minge">结束时间:{{detail.end_time_text}}</span>
<span class="minge">课程销量:{{detail.sale}}</span>
<span class="minge" v-if="detail.feel == 0">课程价格:
<span style="color: #FF2323;font-weight: 800;">{{'¥' + detail.price}}</span>
</span>
<span class="minge" v-if="detail.feel == 1">
<span style="color: #FF2323;font-weight: 800;">免费</span>
</span>
</view>
</view>
<view class="con-center flex flex-column flex-start align-items" style="margin-top: 24rpx;min-height: 73vh;">
<view class="flex align-items" style="width: 100%;justify-content: flex-start;">
<view class="search flex align-items" style="width: 508rpx;">
<span class="dashed flex align-items justify-center">
<image src="../../static/center/search.png" mode=""></image>
</span>
<span class="line-search"></span>
<input type="text" placeholder="搜索课程" v-model="keywords" @input="onInput" class="input"
placeholder-class="plasty" />
</view>
<span class="searchBtn" @click.stop="addClass()">搜索</span>
</view>
<view class="header flex align-items w-100" style="justify-content: space-between;">
<span class="s-header flex justify-center align-items" v-for="(item,index) in headers" :key="index"
:class="{ selected: headerSelected(item.status) }"
@click="selectheader(item.status)">{{item.text}}</span>
</view>
<span class="line"></span>
<view class="centerBox flex justify-start align-items flex-column" v-for="(item,index) in list" :key="index"
@click.stop="toRefund(item.id)">
<view class="flex w-100 space-between hui align-items">
<span>订单号</span>
<span>{{item.order_no}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;">
<span>购买人/联系电话</span>
<span class="flex align-items" style="color: #71D0FF;"
@click.stop="callPhone(item.user.mobile)">{{item.user.realname || item.user.nickname}}/{{item.user.mobile}}
<span>
<image src="../../static/tel.png" mode="" style="width: 36rpx;height: 36rpx;"></image>
</span>
</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;" v-if="selected == 0">
<span>创建时间</span>
<span>{{item.createtime | formatDateTime}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;" v-if="selected == 3">
<span>购买时间</span>
<span>{{item.paytime_text}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;" v-if="selected == 4">
<span>发起时间</span>
<span>{{item.serviceorder.createtime | formatDateTime}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;" v-if="selected == 6">
<span>退款时间</span>
<span>{{item.serviceorder.refundtime_text}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;" v-if="selected == 9">
<span>完成时间</span>
<span>{{item.serviceorder.checkouttime_text}}</span>
</view>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;">
<span>订单状态</span>
<span class="status" v-if="item.status == 4" style="font-size: 26rpx;color: #FF2323;">售后中</span>
<span class="status" v-if="item.status == 0" style="font-size: 26rpx;color: #008CFF;">待支付</span>
<span class="status" v-if="item.status == 3" style="font-size: 26rpx;color: #008CFF;">使用中</span>
<span class="status" v-if="item.status == 6" style="font-size: 26rpx;color: #FF2323;">已退款</span>
<span class="status" v-if="item.status == 9" style="font-size: 26rpx;color: #34DC12;">已完成</span>
</view>
<span class="box-line"></span>
<view class="flex w-100 space-between hui align-items" style="margin-top: 8rpx;"
v-if=" item.status == 4">
<span>售后状态</span>
<span class="status" style="color: #FF2323;font-size: 26rpx;"
v-if="item.serviceorder.status == 1 && item.status == 4">待处理</span>
<span class="status" v-if="item.serviceorder.status == 4 && item.status == 4">处理中</span>
<span class="status" v-if="item.serviceorder.status == 7 && item.status == 4">已结单</span>
<span class="status" v-if="item.serviceorder.status == -3 && item.status == 4">已取消</span>
<span class="status" v-if="item.serviceorder.status == -3 && item.status == 4">已取消</span>
</view>
<view class="flex w-100" style="justify-content: flex-end;margin-top: 24rpx;">
<span class="copy" style="margin-right: 10rpx;" @click.stop="copy(item.order_no)">复制消息</span>
<span class="refund" v-if="item.status == 3" @click.stop="toRefund(item.id)">退款</span>
<span class="refundNone" v-if="item.status == 0">退款</span>
<span class="refund"
v-if="(item.serviceorder.status == 1 || item.serviceorder.status == 4) && item.status == 4"
@click.stop="toRefund(item.id)">处理</span>
<span class="refundNone"
v-if="(item.serviceorder.status == 7 || item.serviceorder.status == -3) && item.status == 4">处理</span>
</view>
</view>
</view>
<u-loadmore :status="loadStatus" />
</view>
</template>
<script>
export default {
data() {
return {
detail: {},
page: 1,
limit: 10,
selected: '0,3,6,9,4',
list: [],
keywords: '',
classes_lib_id: '',
loadStatus: 'loading',
count: 0,
headers: [{
status: '0,3,6,9,4',
text: '全部'
},
{
status: '0',
text: '待支付'
},
{
status: '3',
text: '使用中'
},
{
status: '4',
text: '售后中'
},
{
status: '6',
text: '已退款'
},
{
status: '9',
text: '已完成'
}
],
};
},
filters: {
formatDateTime(timestamp) {
if (!timestamp) return '';
const date = new Date(timestamp * 1000);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
},
onLoad(option) {
this.classes_lib_id = option.id
// this.getList(this.selected)
},
onShow() {
this.page = 1
this.list = []
this.getDetail(this.classes_lib_id)
this.getList(this.selected);
},
onReachBottom() {
if (this.list.length < this.count) {
this.page++;
this.getList(this.selected);
}
},
methods: {
// 跳转
toRefund(id) {
uni.navigateTo({
url: "/packageA/my/refund?id=" + id
})
},
copy(order) {
uni.setClipboardData({
data: order, //要被复制的内容
success: () => {
uni.showToast({
title: "复制订单号成功"
})
}
})
},
getDetail(id) {
uni.$u.http.get('/api/school/classes/detail', {
params: {
id: id,
}
}).then(res => {
if (res.code == 1) {
this.detail = res.data.detail
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
}).catch(error => {});
},
getList(status) {
uni.$u.http.get('/api/school/worker/order/order_list', {
params: {
keywords: this.keywords,
page: this.page,
limit: this.limit,
status: status,
classes_lib_id: this.classes_lib_id
}
}).then(res => {
if (res.code == 1) {
this.count = res.data.count
this.list = [...this.list, ...res.data.list];
if (this.list.length >= res.data.count) {
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.loadStatus = 'loading';
}
}).catch(error => {
console.error('请求失败', error);
this.loadStatus = 'loading';
});
},
selectheader(status) {
const that = this
that.selected = status;
console.log(status, '')
that.page = 1
that.list = []
that.getList(status)
},
headerSelected(status) {
return this.selected === status;
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
})
}
}
}
</script>
<style lang="scss" scoped>
.w-100 {
width: 100%;
}
.flex {
display: flex;
}
.flex-start {
align-items: flex-start;
}
.justify-center {
justify-content: center;
}
.align-items {
align-items: center;
}
.flex-column {
flex-flow: column;
}
.justify-start {
justify-content: start;
}
.line {
margin-top: 12rpx;
width: 690rpx;
height: 1rpx;
background: #008CFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.space-between {
justify-content: space-between;
}
.hui {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
.box {
width: 750rpx;
background: #F1F2F8;
.con-center {
width: 690rpx;
// margin-top: 25rpx;
}
.top {
width: 690rpx;
padding: 32rpx 30rpx;
background: #FFFFFF;
.rightBox {
margin-left: 32rpx;
width: 378rpx;
.line-row {
width: 382rpx;
height: 1rpx;
background: #D9D9D9;
box-shadow: 1rpx 1rpx 0rpx 0rpx rgba(102, 102, 102, 0.25);
margin: 14rpx 0 6rpx 0;
}
.price {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FF2323;
}
.name {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #343434;
margin-bottom: 16rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/* 设置行数 */
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
/* 防止单词被截断 */
}
.minge {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
margin-top: 8rpx;
height: 32rpx;
}
.money {
font-weight: 800;
font-size: 24rpx;
color: #FF2323;
span {
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
}
}
}
.centerBack {
position: fixed;
width: 100%;
height: 100%;
top: 25rpx;
left: 0;
z-index: -1;
}
.header {
// height: 50rpx;
margin-top: 37rpx;
.s-header {
// width: 104rpx;
width: 84rpx;
height: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #9E9E9E;
}
.s-header.selected {
// width: 104rpx;
padding: 10rpx 10rpx;
height: 50rpx;
background: #008CFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 28rpx;
color: #FFFFFF;
line-height: 26rpx;
}
}
.searchBtn {
width: 164rpx;
height: 64rpx;
background: #008CFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
margin-left: 18rpx;
}
}
.search {
width: 690rpx;
height: 64rpx;
background: #FFFFFF;
box-shadow: 2rpx 2rpx 0rpx 0rpx rgba(0, 0, 0, 0.4);
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #008CFF;
.dashed {
image {
width: 52rpx;
height: 52rpx;
}
}
.line-search {
width: 2rpx;
height: 42rpx;
background: #008CFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.input {
// border: 4rpx solid #EAEAEA;
padding-left: 12rpx;
height: 100%;
width: 100%;
}
/deep/ .input-placeholder {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #C0C0C0;
line-height: 32rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
}
.centerBox {
width: 642rpx;
padding: 24rpx 24rpx 32rpx 24rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin-top: 24rpx;
.box-line {
width: 635rpx;
height: 1rpx;
background: #C0C0C0;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin-top: 13rpx;
}
.status {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 26rpx;
color: #008CFF;
}
}
.copy {
width: 138rpx;
height: 48rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #008CFF;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #008CFF;
display: flex;
justify-content: center;
align-items: center;
letter-spacing: 8rpx;
}
.refundNone {
width: 138rpx;
height: 48rpx;
background: #D9D9D9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
}
.refund {
width: 138rpx;
height: 48rpx;
background: #008CFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
}
</style>