This commit is contained in:
Lx 2025-04-17 11:17:38 +08:00
parent 457b953046
commit bca7aef387
3 changed files with 647 additions and 604 deletions

View File

@ -22,8 +22,8 @@
<view class="course-detail"> <view class="course-detail">
<text class="course-title">{{ orderData.courseName }}</text> <text class="course-title">{{ orderData.courseName }}</text>
<view class='course-twoType'> <view class='course-twoType'>
<text class="course-type" >{{ getLicenseTypeDescription(orderData.courseType) }}</text> <text class="course-type">{{ getLicenseTypeDescription(orderData.courseType) }}</text>
<text class="course-type" >{{ orderData.courseType }}</text> <text class="course-type">{{ orderData.courseType }}</text>
</view> </view>
<text class="course-desc">{{ courseDetails.tittle }}</text> <text class="course-desc">{{ courseDetails.tittle }}</text>
</view> </view>
@ -139,9 +139,9 @@
</template> </template>
<script> <script>
import headers from "@/components/header/headers.vue"; import headers from "@/components/header/headers.vue";
import request from '@/utils/request.js' import request from '@/utils/request.js'
export default { export default {
components: { components: {
headers headers
}, },
@ -239,18 +239,33 @@ export default {
}, 1500) }, 1500)
}, */ }, */
async handlePay() { async handlePay() {
uni.showLoading({ title: '跳转支付中...' }); uni.showLoading({
title: '跳转支付中...'
});
try { try {
const res = await this.directWxPay(this.orderData.id, this.orderData.orderNo, this.orderData.payType); const res = await this.directWxPay(this.orderData.id, this.orderData.orderNo, this.orderData
.payType);
if (res === 'success') { if (res === 'success') {
uni.showToast({ title: '支付成功', icon: 'success' }); uni.showToast({
title: '支付成功',
icon: 'success'
});
} else if (res === 'cancelled') { } else if (res === 'cancelled') {
uni.showToast({ title: '已取消支付', icon: 'none' }); uni.showToast({
title: '已取消支付',
icon: 'none'
});
} else { } else {
uni.showToast({ title: '支付失败,请重试', icon: 'none' }); uni.showToast({
title: '支付失败,请重试',
icon: 'none'
});
} }
} catch (error) { } catch (error) {
uni.showToast({ title: '支付异常', icon: 'none' }); uni.showToast({
title: '支付异常',
icon: 'none'
});
console.error('支付异常', error); console.error('支付异常', error);
} finally { } finally {
uni.hideLoading(); uni.hideLoading();
@ -307,7 +322,10 @@ export default {
return result; return result;
} catch (error) { } catch (error) {
console.error("支付失败:", error); console.error("支付失败:", error);
uni.showToast({ title: '支付失败,请重试', icon: 'none' }); uni.showToast({
title: '支付失败,请重试',
icon: 'none'
});
return 'fail'; return 'fail';
} }
}, },
@ -320,7 +338,8 @@ export default {
resolve(res.errMsg === 'requestPayment:ok' ? 'success' : 'fail'); resolve(res.errMsg === 'requestPayment:ok' ? 'success' : 'fail');
}, },
fail: (err) => { fail: (err) => {
resolve(err.errMsg === 'requestPayment:fail cancel' ? 'cancelled' : 'fail'); resolve(err.errMsg === 'requestPayment:fail cancel' ? 'cancelled' :
'fail');
} }
}); });
}); });
@ -345,7 +364,7 @@ export default {
}, },
// users // users
updateSysUsersNickName(){ updateSysUsersNickName() {
request({ request({
url: '/app-api/system/user/update', url: '/app-api/system/user/update',
method: 'PUT', method: 'PUT',
@ -379,7 +398,8 @@ export default {
money: this.orderData.reserveMoney, money: this.orderData.reserveMoney,
indent: this.orderData.userNo, indent: this.orderData.userNo,
phone: this.orderData.userPhone, phone: this.orderData.userPhone,
time: this.getCurrentDateTime() time: this.getCurrentDateTime(),
endTime: this.getEndTime(),
}; };
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData))
@ -400,6 +420,21 @@ export default {
return `${year}-${month}-${day} ${hours}:${minutes}`; return `${year}-${month}-${day} ${hours}:${minutes}`;
// return now; // return now;
}, },
//
getEndTime() {
const now = new Date();
now.setFullYear(now.getFullYear() + 3); //
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
getLicenseTypeDescription(code) { getLicenseTypeDescription(code) {
const licenseMap = { const licenseMap = {
@ -439,211 +474,219 @@ export default {
}); });
}, },
} }
} }
</script> </script>
<style scoped> <style scoped>
.order-detail-container { .order-detail-container {
padding-bottom: 200rpx; padding-bottom: 200rpx;
background-color: #f7f7f7; background-color: #f7f7f7;
min-height: 100vh; min-height: 100vh;
} }
/* 头部样式 */ /* 头部样式 */
.header { .header {
position: relative; position: relative;
} }
.navbar { .navbar {
height: 88rpx; height: 88rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #ffffff; background-color: #ffffff;
position: relative; position: relative;
} }
.navbar-title { .navbar-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
} }
.status-card { .status-card {
height: 40rpx; height: 40rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #fff; color: #fff;
} }
.status-0 { .status-0 {
background: linear-gradient(to right, #ff976a, #ff6600); background: linear-gradient(to right, #ff976a, #ff6600);
} }
.status-1 {
background: linear-gradient(to right, #ffcc00, #ff9900);
}
.status-2 {
background: linear-gradient(to right, #19be6b, #00b050);
}
.status-3 {
background: linear-gradient(to right, #dd6161, #cc0000);
}
.status-4 {
background: linear-gradient(to right, #909399, #808080);
}
.status-text { .status-1 {
background: linear-gradient(to right, #ffcc00, #ff9900);
}
.status-2 {
background: linear-gradient(to right, #19be6b, #00b050);
}
.status-3 {
background: linear-gradient(to right, #dd6161, #cc0000);
}
.status-4 {
background: linear-gradient(to right, #909399, #808080);
}
.status-text {
font-size: 28rpx; font-size: 28rpx;
margin-top: 2rpx; margin-top: 2rpx;
} }
/* 卡片通用样式 */ /* 卡片通用样式 */
.info-card, .course-card, .price-card { .info-card,
.course-card,
.price-card {
margin: 30rpx; margin: 30rpx;
background: #fff; background: #fff;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.05); box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
} }
/* 信息项样式 */ /* 信息项样式 */
.info-item { .info-item {
padding: 24rpx 30rpx; padding: 24rpx 30rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 2rpx solid #f5f5f5; border-bottom: 2rpx solid #f5f5f5;
} }
.info-title { .info-title {
color: #666; color: #666;
font-size: 28rpx; font-size: 28rpx;
} }
.info-value { .info-value {
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
} }
/* 课程卡片样式 */ /* 课程卡片样式 */
.course-header { .course-header {
padding: 30rpx 30rpx 0; padding: 30rpx 30rpx 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.course-twoType { .course-twoType {
width: 90%; width: 90%;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
} }
.course-type { .course-type {
font-size: 22rpx; font-size: 22rpx;
padding: 4rpx 16rpx; padding: 4rpx 16rpx;
border-radius: 8rpx; border-radius: 8rpx;
color: #fff; color: #fff;
background-color: #2979ff; background-color: #2979ff;
margin-right: 10rpx; margin-right: 10rpx;
} }
.type-C1 { .type-C1 {
background-color: #19be6b; background-color: #19be6b;
} }
.type-C2 {
background-color: #2979ff;
}
.order-time { .type-C2 {
background-color: #2979ff;
}
.order-time {
font-size: 24rpx; font-size: 24rpx;
color: #909399; color: #909399;
} }
.course-info { .course-info {
padding: 0 30rpx 30rpx; padding: 0 30rpx 30rpx;
display: flex; display: flex;
} }
.course-image { .course-image {
width: 240rpx; width: 240rpx;
height: 180rpx; height: 180rpx;
border-radius: 8rpx; border-radius: 8rpx;
} }
.course-detail { .course-detail {
flex: 1; flex: 1;
margin-left: 24rpx; margin-left: 24rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.course-title { .course-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
margin-bottom: 12rpx; margin-bottom: 12rpx;
color: #333; color: #333;
} }
.course-desc { .course-desc {
font-size: 24rpx; font-size: 24rpx;
color: #909399; color: #909399;
line-height: 1.5; line-height: 1.5;
margin-bottom: 8rpx; margin-bottom: 8rpx;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 3; /* 限制显示3行 */ -webkit-line-clamp: 3;
/* 限制显示3行 */
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
/* 价格卡片样式 */ /* 价格卡片样式 */
.price-card { .price-card {
padding: 30rpx; padding: 30rpx;
} }
.price-row { .price-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.price-row.total { .price-row.total {
margin-top: 20rpx; margin-top: 20rpx;
padding-top: 20rpx; padding-top: 20rpx;
border-top: 2rpx dashed #eee; border-top: 2rpx dashed #eee;
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
} }
.price-label { .price-label {
color: #666; color: #666;
} }
.price-value { .price-value {
color: #ff6600; color: #ff6600;
} }
/* 底部按钮样式 */ /* 底部按钮样式 */
.footer { .footer {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
background: #fff; background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.05); box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
/* .pay-button { /* .pay-button {
height: 80rpx; height: 80rpx;
background-color: #ff9900; background-color: #ff9900;
border-radius: 40rpx; border-radius: 40rpx;
@ -660,28 +703,29 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} */ } */
.pay-button, .pay-button,
.cancel-button { .cancel-button {
flex: 1; flex: 1;
height: 80rpx; height: 80rpx;
margin: 0 10rpx; /* 两个按钮之间留点间距 */ margin: 0 10rpx;
/* 两个按钮之间留点间距 */
border-radius: 40rpx; border-radius: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.pay-button { .pay-button {
background-color: #ff9900; background-color: #ff9900;
} }
.cancel-button { .cancel-button {
background-color: #ff0105; background-color: #ff0105;
} }
.pay-button-text { .pay-button-text {
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
</style> </style>

View File

@ -54,6 +54,8 @@
if (options.data) { if (options.data) {
this.contractData = JSON.parse(decodeURIComponent(options.data)); this.contractData = JSON.parse(decodeURIComponent(options.data));
this.callback = options.callback; this.callback = options.callback;
this.tenantId = this.contractData.tenantId
console.log('options', this.contractData)
} }
this.callback = options.callback; this.callback = options.callback;
this.userData = uni.getStorageSync('userInfo'); this.userData = uni.getStorageSync('userInfo');
@ -122,11 +124,11 @@
async signatureChange(e) { async signatureChange(e) {
this.imgUrl = e this.imgUrl = e
let res = await request({ let res = await request({
url: '/app-api/small/driveSchool/obtainContract', url: '/app-api/small/driveSchool/obtainContract/add',
method: 'post', method: 'post',
data: { data: {
userName: this.contractData.name, userName: this.contractData.name,
tenantId: this.tenantId, tenantId: this.contractData.tenantId,
userId: this.userData.id, userId: this.userData.id,
content: this.content, content: this.content,
userUrl: this.userUrl, userUrl: this.userUrl,

View File

@ -8,9 +8,6 @@
<scroll-view :style="{ height: scrollHeight + 'px' }" scroll-y="true" class="scroll-view"> <scroll-view :style="{ height: scrollHeight + 'px' }" scroll-y="true" class="scroll-view">
<view class="group_3 flex-col"> <view class="group_3 flex-col">
<image style="width: 100%; height: 100%;" :src="imagesUrl + '/' + courseDetails.photo" /> <image style="width: 100%; height: 100%;" :src="imagesUrl + '/' + courseDetails.photo" />
v-if="courseDetails.photo" />
<u-empty mode="data" text='暂无图片' v-else>
</u-empty>
</view> </view>
<view class="group_4 flex-col"> <view class="group_4 flex-col">
<view class="section_2 flex-row justify-between"> <view class="section_2 flex-row justify-between">