1781 lines
44 KiB
Vue
Raw Normal View History

2025-04-01 09:03:51 +08:00
<template>
<view class="box flex justify-start flex-column align-items" :class="{ 'no-scroll': overlay }">
<view class="swiper">
<u-swiper :list="detail.images" indicator indicatorMode="line" :indicator-style="{ bottom: '60rpx' }"
height="580rpx" circular></u-swiper>
</view>
<view class="nav">
<u-navbar :is-back="true" leftIconColor="#FFFFFF" :autoBack='true' title="课程详情" :bgColor="background"
:titleStyle='titleStyle'> </u-navbar>
</view>
<view class="con-center w-100 flex justify-center flex-column align-items flex-start">
<view class="first-box flex flex-start flex-column justify-start">
<view class="flex align-items">
<span class="sigh flex justify-center align-items">报名中</span>
<span class="first-name">{{detail.title}}</span>
</view>
<!-- <view class="flex w-100 align-items" style="margin-top:28rpx;justify-content: space-between;">
<span class="first-money" v-if="detail.feel == 0">{{detail.price}}</span>
<span class="first-money" v-if="detail.feel == 1"></span>
<view class="flex align-items justify-center"
style="width: 30%;justify-content: flex-end;margin-right: 24rpx;">
<span
class="first-mine">{{ Number(detail.sign_num + detail.virtual_num)}}/{{detail.limit_num}}</span>
<span class="first-txt">名额</span>
<image src="../../static/center/minge.png" mode="" class="icon-size"></image>
</view>
</view> -->
<!-- <span class="line"></span> -->
<span class="first-image flex align-items" style="margin-top: 38rpx;">
<image src="../../static/center/authorize.png" mode="" class="icon-size"></image>
<span style="color: #FF4810;">{{'报名人数: ' + Number(detail.sign_num + detail.virtual_num)}} /
{{detail.limit_num}}</span>
</span>
<span class="first-image flex align-items" style="margin: 16rpx 0;">
<image src="../../static/center/Alarm.png" mode="" class="icon-size"></image>
<span>{{formattedTime.formattedTime}} (共计{{formattedTimeList.length}})</span>
</span>
<span class="first-image flex align-items"
@click.stop="toMap(detail.latitude,detail.longitude,detail.address_detail)">
<image src="../../static/center/address.png" mode="" class="icon-size"></image>
<span>{{detail.address_detail}}</span>
</span>
</view>
<!-- 正在参与 -->
<view class="second-box flex align-items space-between">
<span class="number">{{virtual_people >= 10000 ? '9999+' : virtual_people}}人正在参与</span>
<view class="flex align-items">
<u-avatar-group :urls="people.unpaid_user_data" :extraValue="people.unpaid_user_data.length - 5"
keyName="head_image" size="24" gap="0.2"></u-avatar-group>
<span class="flex justify-center align-items">
<image src="/static/center/right_.png" mode="" style="width: 20rpx;height: 20rpx;"></image>
</span>
</view>
</view>
<!-- 报名成功 -->
<view class="third flex flex-column" style="justify-content: flex-start;">
<view class="third-center flex " style="justify-content: space-between;">
<view class="scroll-container ">
<view v-for="(item, index) in people.paid_user_data" :key="index" class="item">
<view class="flex align-items" style="justify-content: space-between;">
<image :src="item.head_image" mode="" style="width: 40rpx; height: 40rpx;">
</image>
<span
style="width: 72rpx; overflow: hidden; white-space: nowrap;">{{item.nickname}}</span>
<span class="line-colum"></span>
<span>报名成功</span>
</view>
<span>{{ item.createTime }}</span>
</view>
</view>
</view>
</view>
<view class="four flex justify-start align-items flex-column">
<view class="four-top">
<view class="left flex align-items">
<span>授课教师</span>
</view>
</view>
<view class="four-box flex justify-start align-items w-100" @click="toTeacher(detail.teacher.id)">
<view class="four-header flex align-items w-100" style="justify-content: space-between;">
<view class="flex align-items" style="justify-content: start; width: 70%;">
<image :src="detail.teacher.head_image" mode=""
style="width: 96rpx; height: 96rpx;border-radius: 96rpx;">
</image>
<span class="flex justify-center flex-column"
style="align-items: flex-start;margin-left: 18rpx;">
<span class="four-name">{{detail.teacher.name}}</span>
<span class="jigou">{{detail.shop.name}}</span>
<!-- <span class="flex align-items rate">
<u-rate :count="count" active-color="#FFBC2C" v-model="detail.teacher.teacher_star"
allowHalf="true" readonly></u-rate>
{{detail.teacher.teacher_star}}
</span> -->
</span>
</view>
<view class="four-right flex justify-center align-items">
详情
</view>
</view>
</view>
<span class="line" style="width: 93%;"></span>
<span class="tt-detail flex ">
<u-parse :content="detail.teacher.content"></u-parse>
</span>
</view>
<!-- 机构 -->
<view class="five flex align-items" style="justify-content: space-around;" @click="toMeDetail()">
<image :src="detail.shop.logo" mode="" style="width: 64rpx; height: 64rpx;border-radius: 64rpx;">
<span class="five-name white-space">{{detail.shop.name}}</span>
<span class="five-address white-space">{{detail.shop.address_detail}}</span>
<image src="/static/center/blockRight.png" mode="" style="width: 28rpx; height: 28rpx;"></image>
</view>
<!-- 课程详情 -->
<view class="six flex flex-column" style="justify-content: flex-start;margin-top: 64rpx;">
<view class="six-top flex align-items space-between">
<view class="left flex align-items">
<span>课程详情</span>
</view>
</view>
<view class="six-center flex first-txt flex-column" style="padding: 0rpx 30rpx;">
<u-parse :content="detail.content" :tagStyle="style"></u-parse>
</view>
</view>
<!-- 课程须知 -->
<view class="six flex flex-column" style="justify-content: flex-start;margin-bottom: 106rpx;">
<view class="six-top flex align-items space-between">
<view class="left flex align-items">
<span>课程须知</span>
</view>
</view>
<view class="six-center flex first-txt flex-column">
<u-parse :content="detail.notice" :tagStyle="style"></u-parse>
<!-- <rich-text :nodes="detail.notice" style="width: 100%;" :tagStyle="style"></rich-text> -->
</view>
</view>
<view class="footer flex align-items" style="justify-content: space-between;">
<view class="footer-left">
<view @click="callPhone(detail.user.mobile)">
<image src="../../static/center/phone.png" mode=""></image>
<span>电话</span>
</view>
<view @click="overlayShow()">
<!-- <view @click="Share()"> -->
<image src="../../static/center/share.png" mode=""></image>
<span>分享</span>
</view>
<view v-if="is_collect == 0" @click="Collect(1)">
<image src="../../static/center/Collect.png" mode=""></image>
<span>收藏</span>
</view>
<view v-if="is_collect != 0" @click="Collect(0)">
<image src="../../static/center/Collected.png" mode=""></image>
<span>已收藏</span>
</view>
</view>
<view class="footer-right flex justify-center align-items">
<span v-if="type == 0 && detail.feel == 0" @click="sign()"> 购买 </span>
<span v-if="type == 0 && detail.feel == 1" @click="sign()"> 马上报名 </span>
<span v-if="type == 1 && detail.feel == 0" @click="buy()"> 立即支付 </span>
<span v-if="type == 1 && detail.feel == 1" @click="buy()"> 确认报名 </span>
<span v-if="type == 2" @click="open()"> 我要预约 </span>
<span v-if="type == 3" @click="confimTime()"> 确认时间 </span>
<!-- <image src="../../static/center/signUp.png" mode="" v-if="type == 0" @click="sign()"></image>
<image src="../../static/center/appointment.png" mode="" v-else-if="type == 1" @click="open()"></image>
<image src="../../static/center/Confirm.png" mode="" v-else="type == 2" @click="confimTime()"></image> -->
</view>
</view>
</view>
<!-- 课程时间 -->
<u-popup :show="show" mode="bottom" :round="10" :zIndex="99999" :custom-style="popupStyle" @close="close"
@open="open">
<view class="popupBox flex justify-start align-items flex-column">
<view class="pop-header flex align-items" style="justify-content: space-between;">
<image src="../../static/center/classTime.png" mode="" style="width: 252rpx; height: 48rpx;">
</image>
<span @click="cancel">取消选择</span>
</view>
<!-- <span class="line"></span> -->
<view class="times flex align-items justify-center" style="flex-wrap: wrap;">
<span class="selectTime flex justify-center align-items" v-for="(item,index) in timeList"
:key="index" :class="{ selected: timeSelected(item) }" @click="selectTime(item)">
{{item.name}}</span>
</view>
</view>
</u-popup>
<!-- 购买弹窗 -->
<u-popup :show="buyShow" mode="center" :round="10" :zIndex="99999" :custom-style="popupStyle" @close="buyClose"
@open="buyOpen" safeAreaInsetBottom="false" closeable="true">
<view class="popupBox flex justify-start align-items flex-column">
<view class="pop-header flex align-items flex-column flex-start">
<span class="name white-space">{{detail.title}}</span>
<span class="price">
<span v-if="detail.feel == 0">{{detail.price}}</span>
<span v-if="detail.feel == 1">公益</span>
</span>
<!-- <image src="../../static/center/buy.png" mode="" style="width: 168rpx; height: 48rpx;">
</image> -->
</view>
<view class="popup flex-column">
<span class="first-image flex align-items" style="margin: 16rpx 0;">
<image src="../../static/center/Alarm.png" mode="" class="icon-size"></image>
<span>{{formattedTime.formattedTime}} (共计{{formattedTimeList.length}})</span>
</span>
<span class="first-image flex align-items">
<image src="../../static/center/address.png" mode="" class="icon-size"></image>
<span>{{detail.address_detail}}</span>
</span>
<!-- <image :src="detail.headimage" mode="" style="width: 200rpx; height: 140rpx;"></image>
<view class="popur-right flex flex-column">
<span class="name white-space">{{detail.title}}</span>
<span class="address">地址:{{detail.address_detail}}</span>
<span class="date">开始时间:{{detail.start_time_text}}</span>
<span class="time">结束时间:{{detail.end_time_text}}</span>
<span class="line-row"></span>
<span class="price">
课程价格:
<span v-if="detail.feel == 0">{{detail.price}}</span>
<span v-if="detail.feel == 1">免费</span>
</span>
</view> -->
</view>
<view class="popup-footer flex " @click="buy()">
<span v-if="type == 1 && detail.feel == 0"> </span>
<span v-if="type == 1 && detail.feel == 1"> </span>
<!-- <image src="../../static/center/price.png" mode="" style="width: 642rpx;height: 80rpx;"></image> -->
<u-loading-icon :vertical="true" v-if="uloadingShow"></u-loading-icon>
</view>
</view>
</u-popup>
<u-overlay :show="overlay" class="pos">
<view class="btnList">
<span class="save" @click.stop="save()"> </span>
<!-- <span class="sharePoster" @click.stop="sharePoster()">
</span> -->
<button open-type="share" class="no-border-button" plain="true">
<span> </span>
</button>
</view>
<view class="Poster" style="z-index: 9999;height: 1230rpx;">
<span class="posterClose" @click.stop="overlay = false">
<image src="../../static/center/close.png" mode="" style="width: 64rpx;height: 64rpx;"></image>
</span>
<image :src="path" mode="widthFix" style="width: 690rpx;height: 1230rpx;"></image>
<l-painter isCanvasToTempFilePath ref="painter" @success="path = $event" hidden
css="width: 750rpx;height:1230rpx; padding-bottom: 40rpx; background-image: url('https://testy.hschool.com.cn//uploads/20241219/6f46474364fe7ae36295cb8d96854b52.png')">
<l-painter-image :src="userInfo.avatar"
css="margin-left: 40rpx; margin-top: 100rpx; width: 90rpx; height: 90rpx; border-radius: 50%;" />
<l-painter-view css="margin-top: 100rpx; padding-left: 20rpx; display: inline-block">
<l-painter-text :text="userInfo.realname || userInfo.nickname"
css="display: block; padding-bottom: 10rpx; color: #181818; font-size: 34rpx; fontWeight: bold" />
<l-painter-text text="邀请您一起上课" css="color: #7A7A7A; font-size: 24rpx" />
</l-painter-view>
<l-painter-view
css="margin-left: 35rpx; margin-top: 24rpx; padding: 32rpx; box-sizing: border-box; background: #fff; border-radius: 16rpx; width: 690rpx; box-shadow: 0 20rpx 58rpx rgba(0,0,0,.15)">
<l-painter-image :src="detail.headimage"
css="object-fit: cover; object-position: 50% 50%; width: 626rpx; height: 448rpx; border-radius: 12rpx;" />
<l-painter-view css=" width: 626rpx;display: flex;alignItems: center;">
<l-painter-view>
<l-painter-view
css="margin-top: 32rpx; color: #FF0000; font-weight: bold; font-size: 28rpx; line-height: 1em;">
<l-painter-text text="¥" css="vertical-align: bottom;font-size: 42rpx"
v-if="detail.feel == 0" />
<l-painter-text :text="detail.price" css="vertical-align: bottom; font-size: 58rpx"
v-if="detail.feel == 0" />
<l-painter-text text="免费" css="vertical-align: bottom;font-size: 42rpx"
v-if="detail.feel == 1" />
</l-painter-view>
<l-painter-view css="margin-top: 24rpx;">
<l-painter-text :text="formattedTitle" css="color: #343434;font-size: 36rpx;" />
</l-painter-view>
<l-painter-text
css="line-clamp: 2; color: #333333; line-height: 1.8em; font-size: 26rpx;display: block; width: 380rpx; padding-right:32rpx; box-sizing: border-box"
:text="'讲师:' + detail.teacher.name"></l-painter-text>
<l-painter-text
css="line-clamp: 2; color: #333333; line-height: 1.8em; font-size: 26rpx;display: block;margin-bottom:30rpx; width: 380rpx; padding-right:32rpx; box-sizing: border-box"
:text="detail.address_detail"></l-painter-text>
</l-painter-view>
<l-painter-view css="margin-top: 24rpx;">
<l-painter-qrcode css="width: 200rpx; height: 200rpx;" :text="qrUrl"></l-painter-qrcode>
</l-painter-view>
</l-painter-view>
</l-painter-view>
</l-painter>
</view>
</u-overlay>
</view>
</template>
<script>
import dayjs from 'dayjs';
export default {
computed: {
formattedTitle() {
if (this.detail.title.length > 9) {
return this.detail.title.slice(0, 9) + '..';
}
return this.detail.title;
},
formattedTimeList() {
return this.timeList.map(item => {
const startTime = dayjs.unix(item.start_time).format('YYYY-MM-DD HH:mm:ss');
const endTime = dayjs.unix(item.end_time).format('HH:mm:ss');
return {
formattedTime: `${startTime}~${endTime}`,
limit_num: item.limit_num,
sign_num: item.sign_num
};
});
},
formattedTime() {
const startTime = dayjs.unix(this.detail.start_time).format('YYYY-MM-DD HH:mm');
const endTime = dayjs.unix(this.detail.end_time).format('YYYY-MM-DD HH:mm');
return {
formattedTime: `${startTime}~${endTime}`
};
}
},
data() {
return {
style: {
// 字符串的形式
img: 'width: 100%'
},
scrollTop: 0,
overlay: false,
userInfo: {},
path: 'https://testy.hschool.com.cn//uploads/20241219/3406baf51fcc28c63c31ebcee5c9c75e.jpg',
uloadingShow: false,
show: false,
buyShow: false,
type: 0, // 0 支付 1 立即购买 2 预约 3确认时间
id: 1,
count: 5,
value: 5,
order_no: '',
PayPirce: 0,
notice: '',
detail: {},
people: {},
qrUrl: '',
is_collect: 0,
virtual_people: 0,
popupStyle: {
width: '690rpx',
height: '716rpx',
margin: '0 auto', // 水平居中
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center'
},
timeList: [],
selectedTime: null,
// indexBackgroundImage: indexBackgroundImage,
orderId: "",
classes_lib_spec_id: '',
order_no2: '',
mobile: '',
is_show_model: false, //是否显示分享模态窗
background: '#ffffff00',
titleStyle: {
color: '#FFFFFF'
},
};
},
onShareTimeline() {
return {
title: this.detail.title, //分享的标题
imageUrl: this.detail.headimage, //展示的图片这里是本地路径的写法也可以写http或https开头的图片路径
query: `id=${this.id}`
}
},
onLoad(options) {
this.userInfo = uni.getStorageSync("userInfo")
this.id = options.id
// this.id = 1
if (options.type == 2) {
this.type = 2
this.orderId = options.orderId
}
if (options.type == 1) {
this.type = 1
this.order_no = options.order_no
this.pament()
}
console.log(options.id)
this.getDetail()
this.getPeople()
this.getTime()
this.getShare()
},
methods: {
overlayShow() {
const token = uni.getStorageSync('token')
if (token) {
this.overlay = true
} else {
uni.showToast({
title: '请登录',
icon: 'none',
duration: 2000,
complete: function() {
setTimeout(function() {
uni.switchTab({
url: '/pages/my/index',
});
}, 2000);
}
});
}
},
getShare() {
uni.$u.http.post('/api/wechat_util/link', {
path: 'pages/center/detail',
query: `id=${this.id}`,
}).then(res => {
if (res.code == 1) {
this.qrUrl = res.data.url_link
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
}).catch(error => {
uni.showToast({
title: '请求失败,请稍后再试',
icon: 'none',
duration: 2000
});
});
},
// 时间转换函数
timeago(timestamp) {
const now = new Date().getTime(); // 当前时间(毫秒)
const diff = (now - timestamp * 1000) / 1000; // 时间差(秒)
if (diff < 60) {
return `${Math.floor(diff)}秒前`;
} else if (diff < 3600) {
return `${Math.floor(diff / 60)}分钟前`;
} else if (diff < 86400) {
return `${Math.floor(diff / 3600)}小时前`;
} else if (diff < 2592000) { // 30天
return `${Math.floor(diff / 86400)}天前`;
} else {
return `${Math.floor(diff / 2592000)}个月前`;
}
},
// sharePoster() {
// //获取带参数二维码并传递
// this.is_show_model = false
// this.$refs.poster.showCanvas()
// },
// 获取课时规格
getTime() {
uni.$u.http.get('/api/school/classes/spec', {
params: {
id: this.id,
}
}).then(res => {
if (res.code == 1) {
this.timeList = res.data.spec;
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
}).catch(error => {
uni.showToast({
title: '请求失败,请稍后再试',
icon: 'none',
duration: 2000
});
});
},
// 获取报名详情
getPeople() {
const that = this
uni.$u.http.get('/api/school/classes/people', {
params: {
id: that.id,
}
}).then(res => {
if (res.code == 1) {
that.processPeopleData(res.data).then(processedData => {
that.people = processedData;
console.log('that.people', that.people)
});
} else {
that.showErrorToast(res.msg);
}
}).catch(error => {
that.showErrorToast('请求失败,请稍后再试');
});
},
// 数据转换
processPeopleData(data) {
return new Promise((resolve) => {
const paidUserData = data.paid_user_data.map(item => {
item.createTime = this.timeago(item.time);
return item;
}).reverse();
const unpaidUserData = data.unpaid_user_data
const processedData = {
unpaid_user_data: unpaidUserData,
paid_user_data: paidUserData
}
resolve(processedData);
});
},
// 提示
showErrorToast(msg) {
uni.showToast({
title: msg,
icon: 'none',
duration: 2000
});
},
// 获取详情
getDetail() {
uni.$u.http.get('/api/school/classes/detail', {
params: {
id: this.id,
}
}).then(res => {
if (res.code == 1) {
this.detail = res.data.detail
this.notice = res.data.detail.notice.replace(/<[^>]*>/g, '')
this.virtual_people = res.data.detail.views
if (res.data.detail.is_collect != 0) {
this.is_collect = 1
} else {
this.is_collect = 0
}
if (this.detail.user.realname) {
this.detail.user.realname = this.detail.user.realname.slice(0, 1) + 'XX';
}
this.mobile = this.detail.user.mobile.slice(0, 3) + 'XXXX' + this.detail.user.mobile.slice(
7);
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
}).catch(error => {});
},
// 报名 0 支付 1 立即购买 2 预约 3确认时间
sign() {
this.buyShow = true
this.type = 3
// uni.navigateTo({
// url: '/pages/CashierDesk/CashierDesk?id=' + this.id
// })
},
buy() {
this.uloadingShow = true
this.getMoney()
},
// 购买弹窗 type = 0 支付 1 立即购买 2 预约 3确认时间
buyOpen() {
this.buyShow = true
this.type = 1
},
// 预约弹窗 type = 2 0 支付 1 立即购买 2 预约 3确认时间
open() {
this.show = true
this.type = 3
},
// 确认时间 type = 0 0 支付 1 立即购买 2 预约 3确认时间
confimTime() {
uni.$u.http.post('/api/school/hour_order/confirm', {
classes_order_id: this.orderId,
classes_lib_spec_id: this.classes_lib_spec_id,
order_no: this.order_no2,
is_compute: 1
}).then(res => {
if (res.code == 1) {
this.order_no2 = res.data.order_no
this.timeCreat(res.data.order_no)
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
this.type = 2
// _this.$api.toast(res.msg);
}
}).catch(error => {
});
this.show = false
this.type = 0
},
// 预约下单
timeCreat(order_no) {
uni.$u.http.post('/api/school/hour_order/create', {
order_no: order_no,
}).then(res => {
if (res.code == 1) {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000,
complete: function() {
setTimeout(function() {
uni.reLaunch({
url: "/packageA/my/makeList?status=" + -1
})
}, 2000);
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
this.type = 2
// _this.$api.toast(res.msg);
}
}).catch(error => {
});
},
// 教师详情
toTeacher(id) {
uni.navigateTo({
url: `/pages/center/teacherDetail?id=${id}`
})
},
// 导航
toMap(latitude, longitude, name) {
uni.openLocation({
latitude: parseFloat(latitude),
longitude: parseFloat(longitude),
name: name,
success: function() {
console.log('success');
}
});
},
// 机构详情
toMeDetail() {
uni.navigateTo({
url: "/pages/center/MechanismDetail?id=" + this.detail.shop.id
})
},
close() {
this.type = 0
this.selectedTime = null
this.show = false
},
buyClose() {
this.type = 0
this.selectedTime = null
this.buyShow = false
},
// 返回首页
toIndex() {
uni.switchTab({
url: "/pages/index/index"
})
},
// 保存海报
save() {
let base64 = this.path.replace(/^data:image\/\w+;base64,/, ""); //图片替换
let filePath = wx.env.USER_DATA_PATH + '/qrcode.png';
uni.getFileSystemManager().writeFile({
filePath: filePath, //创建一个临时文件名
data: base64, //写入的文本或二进制数据
encoding: 'base64', //写入当前文件的字符编码
success: (res) => {
uni.saveImageToPhotosAlbum({
filePath: filePath,
success: () => {
uni.showToast({
title: '保存成功',
icon: "none",
duration: 5000
})
},
fail: (err) => {
console.log(err);
uni.showToast({
title: '保存失败',
icon: "none",
duration: 5000
})
}
})
},
fail: (err) => {
console.log(err)
}
})
},
//分享发布
sharePoster() { //分享图片给好友按钮的点击事件函数
let that = this
this.base64ToFilePath(this.path, (filePath) => {
console.log(filePath);
wx.showShareImageMenu({ //分享给朋友
path: filePath,
success: (res) => {
console.log("分享成功:", res);
},
fail: (err) => {
console.log("分享取消:", err);
},
})
})
},
base64ToFilePath(base64data, callback) {
const time = new Date().getTime();
const imgPath = `${wx.env.USER_DATA_PATH}/addFriends${time}share_qrcode.png`;
const imageData = base64data.replace(/^data:image\/\w+;base64,/, "");
const fileSystemManager = uni.getFileSystemManager();
fileSystemManager.writeFile({
filePath: imgPath,
data: imageData,
encoding: 'base64',
success: () => {
callback(imgPath);
},
fail: (err) => {
console.error('Write file failed:', err);
uni.showToast({
title: '写入文件失败',
icon: 'none'
});
}
});
},
// 收藏和取消
Collect(number) {
uni.$u.http.post('/api/school/classes/collect', {
id: this.id,
is_collect: number
}).then(res => {
if (res.code == 1) {
this.is_collect = number
if (number == 0) {
uni.showToast({
title: '取消收藏',
icon: 'none',
duration: 2000
})
} else {
uni.showToast({
title: '收藏成功',
icon: 'none',
duration: 2000
})
}
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
// _this.$api.toast(res.msg);
}
}).catch(error => {
});
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
})
},
// 取消选择
cancel() {
this.selectedTime = null
},
selectTime(time) {
this.selectedTime = time;
this.classes_lib_spec_id = time.id
},
timeSelected(time) {
return this.selectedTime === time;
},
moveScroll() {},
// 获取价格
getMoney() {
uni.$u.http.post('/api/school/order/confirm', {
classes_lib_id: this.id,
order_no: this.order_no,
is_compute: 1
}).then(res => {
if (res.code == 1) {
this.PayPirce = res.data.order_data.totalprice
this.order_no = res.data.order_no
this.create(this.order_no, this.PayPirce)
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
// _this.$api.toast(res.msg);
}
this.uloadingShow = false
}).catch(error => {
});
},
// 创建订单
create(order_no, PayPirce) {
uni.$u.http.post('/api/school/order/create', {
order_no: order_no,
}).then(res => {
if (res.code == 1) {
if (PayPirce != 0) {
this.pament()
} else {
this.uloadingShow = false
uni.showToast({
title: '创建成功',
icon: 'success',
duration: 2000,
complete: function() {
setTimeout(function() {
uni.redirectTo({
url: "/packageA/my/orderList?status=" + 3
})
}, 2000);
}
});
}
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
that.uloadingShow = false
// _this.$api.toast(res.msg);
}
}).catch(error => {
});
},
// 支付
pament() {
let that = this
that.uloadingShow = false
uni.$u.http.post('/api/school/pay/payment', {
type: 'wechat',
order_no: that.order_no,
platform: 'miniapp'
}).then(res => {
if (res.code == 1) {
wx.requestPayment({
timeStamp: res.data.paydata.timeStamp, //时间戳
nonceStr: res.data.paydata.nonceStr, //随机字符串
package: res.data.paydata.package, //prepay_id
signType: res.data.paydata.signType, //签名算法MD5
paySign: res.data.paydata.paySign, //签名
success(res) {
if (res.errMsg == "requestPayment:ok") {
that.order_no = ''
uni.redirectTo({
url: "/packageA/my/orderList?status=" + 3
})
console.log('支付成功', res)
} else {
that.uloadingShow = false
console.log('支付失败')
}
},
fail(res) {
that.uloadingShow = false
console.log('支付失败', res)
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
// _this.$api.toast(res.msg);
}
}).catch(error => {
});
},
},
}
</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;
}
.white-space {
overflow: hidden;
/* 确保超出容器的文本被隐藏 */
white-space: nowrap;
/* 确保文本在一行内显示 */
text-overflow: ellipsis;
/* 使用省略号表示被截断的文本 */
width: 100%;
}
.con-center {
background: white;
border-radius: 20rpx;
position: absolute;
top: 540rpx;
}
.space-between {
justify-content: space-between;
}
.swiper {
width: 100%;
height: 580rpx;
}
.box {
position: relative;
}
.first-box {
width: 690rpx;
background: #FFFFFF;
padding-left: 24rpx;
margin-top: 40rpx;
border-radius: 20rpx;
.sigh {
width: 88rpx;
height: 40rpx;
background: #BEEE03;
border-radius: 4rpx 4rpx 4rpx 4rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #222222;
}
.first-name{
width: 586rpx;
height: 52rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 34rpx;
color: #222222;
margin-left: 16rpx;
}
.first-mine {
height: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
.first-txt {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
line-height: 32rpx;
margin: 0 6rpx;
}
.first-image {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
span {
width: 650rpx;
height: 40rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #222222;
}
}
}
.second-box {
width: 690rpx;
height: 64rpx;
background: #222222;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin: 48rpx 0 16rpx 0;
.number {
height: 40rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #FFFFFF;
margin-left: 32rpx;
}
view {
span {
width: 24rpx;
height: 24rpx;
background: rgba(255, 255, 255, 0.4);
border-radius: 24rpx;
margin: 0 22rpx 0 4rpx;
}
}
}
.third {
width: 690rpx;
.third-box {
margin: 12rpx 0 0 24rpx;
}
.third-center {
margin-top: 28rpx;
width: 100%;
height: 242rpx;
overflow: hidden;
position: relative;
}
.scroll-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
animation: scroll 12s linear infinite;
}
@keyframes scroll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(calc(-100% + 8 * 100px));
/* 8 * 100px 是假设每个项目的宽度为 100px */
}
}
.item {
display: flex;
width: 94%;
align-items: center;
justify-content: space-between;
padding: 22rpx 24rpx 24rpx 24rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #222222;
height: 32rpx;
/* 假设每条数据的高度为60rpx */
}
.item image {
margin-right: 10rpx;
}
.line-colum {
margin: 0 10rpx;
border-left: 1rpx solid #ccc;
height: 42rpx;
}
.item span {
margin-right: 10rpx;
}
@keyframes scroll {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-240rpx);
/* 总高度为 4 * 60rpx = 240rpx */
}
}
}
.four {
margin-top: 48rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
width: 690rpx;
// height: 338rpx;
.four-top {
width: 100%;
margin: 0 0 48rpx 0;
.left {
background-image: url("/static/center/footer.png");
background-repeat: no-repeat;
background-position: left bottom;
span {
width: 128rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #222222;
}
}
}
.four-box {
.four-header {
.four-name {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #000000;
}
.jigou {
height: 42rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #000000;
margin-top: 8rpx;
}
.rate {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 26rpx;
color: #FFBC2C;
line-height: 26rpx;
}
}
.four-right {
width: 116rpx;
height: 48rpx;
background: #222222;
border-radius: 200rpx 200rpx 200rpx 200rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #BEEE03;
}
}
.tt-detail {
width: 690rpx;
// padding: 0rpx 24rpx 18rpx 24rpx;
justify-content: flex-start;
align-items: left;
flex-flow: column;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
span {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
/* 设置行数 */
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5em;
/* 根据需要调整行高 */
max-height: 6em;
/* 行高 * 行数 */
}
}
}
.five {
width: 690rpx;
height: 96rpx;
background: linear-gradient(90deg, #FDF850 0%, #85EE9C 100%);
border-radius: 200rpx 200rpx 200rpx 200rpx;
margin-top: 30rpx;
.five-name {
width: 250rpx;
height: 48rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #000000;
margin: 0 32rpx 0 24rpx;
}
.five-address {
width: 182rpx;
height: 40rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #000000;
}
}
.six {
margin-top: 64rpx;
width: 750rpx;
// background: linear-gradient(to bottom, #F1F2F8 0%, #FFFFFF 1%, #FFFFFF 100%);
align-items: center;
.six-top {
width: 690rpx;
.left {
background-image: url("/static/center/footer.png");
background-repeat: no-repeat;
background-position: left bottom;
span {
width: 160rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 40rpx;
color: #222222;
line-height: 47rpx;
}
}
}
.six-box {
width: 690rpx;
margin: 12rpx 0 0 24rpx;
}
.six-center {
width: 670rpx;
margin-top: 41rpx;
.s-footer {
padding: 24rpx;
width: 642rpx;
span {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
}
.s-footer .h4 {
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 36rpx;
color: #656565;
}
}
}
.line {
width: 95%;
height: 1rpx;
background: #D9D9D9;
margin: 19rpx 0 19rpx 0;
}
.icon-size {
width: 28rpx;
height: 28rpx;
margin-right: 12rpx;
}
.footer {
width: 100%;
height: 166rpx;
background: #ffffff;
// box-shadow: 0rpx -2rpx 0rpx 0rpx rgba(0, 0, 0, 0.4);
border-radius: 0rpx 0rpx 0rpx 0rpx;
position: sticky;
z-index: 99;
/* 绝对定位 */
bottom: 0;
/* 定位在底部 */
left: 0;
/* 定位在左边 */
.footer-left {
position: absolute;
left: 30rpx;
display: flex;
view {
display: flex;
justify-content: center;
align-items: center;
flex-flow: column;
margin-right: 40rpx;
width: 48rpx;
span {
text-align: center;
width: 48rpx;
height: 34rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 22rpx;
color: #A4A4A4;
}
}
image {
width: 48rpx;
height: 48rpx;
}
}
.footer-right {
position: absolute;
right: 30rpx;
width: 440rpx;
height: 100rpx;
background: #222222;
border-radius: 200rpx;
span {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #BEEE03;
}
}
}
.popupBox {
width: 690rpx;
height: 716rpx;
.pop-header {
width: 100%;
background-image: url("/static/center/bg.png");
background-repeat: no-repeat;
background-position: left bottom;
height: 265rpx;
span {
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #343434;
}
.name {
width: 594rpx;
height: 66rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 44rpx;
color: #222222;
margin-top: 80rpx;
}
.price {
width: 594rpx;
height: 66rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 44rpx;
color: #FF4810;
margin-top: 16rpx;
span {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 36rpx;
color: #FF2323;
line-height: 32rpx;
}
}
}
.popup {
display: flex;
align-items: self-start;
justify-content: center;
width: 594rpx;
}
.popup-footer {
position: absolute;
left: 48rpx;
bottom: 48rpx;
span {
width: 594rpx;
height: 100rpx;
background: #222222;
border-radius: 200rpx 200rpx 200rpx 200rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #BEEE03;
display: flex;
justify-content: center;
align-items: center;
}
}
.line {
width: 642rpx;
height: 1rpx;
background: #D9D9D9;
box-shadow: 1rpx 1rpx 0rpx 0rpx rgba(102, 102, 102, 0.25);
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.times {
width: 93%;
.selectTime {
width: 288rpx;
height: 50rpx;
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 1rpx solid #D9D9D9;
color: #4B4B4B;
font-family: 'PingFang SC', 'PingFang SC';
font-weight: 500;
font-size: 24rpx;
padding-left: 15rpx;
cursor: pointer;
margin: 24rpx 32rpx 0 0;
white-space: nowrap;
/* 防止文本换行 */
text-overflow: ellipsis;
/* 超出部分显示省略号 */
overflow: hidden;
/* 隐藏超出部分 */
text-align: left;
/* 文字靠左对齐 */
line-height: 50rpx;
/* 垂直居中对齐 */
box-sizing: border-box;
/* 确保 padding 和 border 不影响宽度和高度 */
display: inline-block;
/* 确保容器内文字正确对齐 */
}
}
.selectTime.selected {
width: 288rpx;
height: 50rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
background: #008CFF;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FFFFFF;
cursor: pointer;
margin: 24rpx 32rpx 0 0;
}
}
.share {
position: fixed;
color: #FFFFFF;
right: 0;
bottom: 190rpx;
background: linear-gradient(to bottom right, #FE726B, #FE956B);
padding: 10rpx 10rpx 10rpx 20rpx;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
box-shadow: 0 0 20upx rgba(0, 0, 0, .09);
}
.cancel {
width: 100vw;
padding: 30rpx;
text-align: center;
background: #FFFFFF;
color: red;
font-weight: bold;
font-size: 30rpx;
}
.md-content {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 50rpx 0;
background-color: white;
}
.md-content-item {
margin: 0 70rpx;
position: relative;
}
.md-content-item image {
width: 100rpx;
height: 100rpx;
}
.md-content-item view {
margin-top: 15rpx;
font-size: 28rpx;
}
.sharebtn {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
}
.cu-modal {
position: fixed;
bottom: 166rpx;
left: 0;
z-index: 999999;
}
.gj {
.title {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 32rpx;
color: #4B4B4B;
span {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #4B4B4B;
}
}
.scroll {
width: 642rpx;
max-height: 340rpx;
view {
margin: 24rpx;
width: 600rpx;
height: 56rpx;
background: #E8E8E8;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
justify-content: center;
align-items: center;
.title {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #7A7A7A;
}
.red {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #FF5F5F;
}
.lan {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #008CFF;
}
}
}
}
/deep/ ::-webkit-scrollbar {
/*滚动条整体样式*/
width: 4px !important;
height: 1px !important;
overflow: auto !important;
background: #ccc !important;
-webkit-appearance: auto !important;
display: block;
}
/deep/ ::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px !important;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background: #7b7979 !important;
}
/deep/ ::-webkit-scrollbar-track {
/*滚动条里面轨道*/
// box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
// border-radius: 10px !important;
background: #FFFFFF !important;
}
.Poster {
position: relative;
top: 21rpx;
left: 30rpx;
width: 690rpx;
}
.posterClose {
position: absolute;
right: 8rpx;
top: 8rpx;
}
.pos {
position: relative;
}
.btnList {
width: 690rpx;
position: absolute;
bottom: 150rpx;
left: 30rpx;
display: flex;
justify-content: space-evenly;
span {
width: 250rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 401rpx 401rpx 401rpx 401rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #008CFF;
display: flex;
justify-content: center;
align-items: center;
}
.save {}
}
.no-scroll {
overflow: hidden;
height: 100vh;
}
/deep/ ._root {
padding: 0 10rpx;
}
.no-border-button {
background-color: transparent;
/* 去掉背景色 */
border: none;
/* 去掉边框 */
padding: 0;
/* 去掉内边距 */
margin: 0;
/* 去掉外边距 */
display: inline-flex;
/* 使按钮内容居中 */
align-items: center;
/* 垂直居中 */
justify-content: center;
/* 水平居中 */
flex-flow: column;
height: 80rpx;
line-height: inherit;
span {
width: 250rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 401rpx 401rpx 401rpx 401rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #008CFF;
display: flex;
justify-content: center;
align-items: center;
}
}
</style>