小程序提交

This commit is contained in:
2025-07-20 18:22:59 +08:00
parent a1d21c67b8
commit fa2a7b3499
61 changed files with 2505 additions and 944 deletions

View File

@ -1,3 +1,4 @@
import { baseUrl, globalImgUrl } from "../../../request";
// pages/course/createCourseOrder/createCourseOrder.js
Page({
@ -6,13 +7,56 @@ Page({
*/
data: {
courseId: 0, // 课程id
courseObj: '', // 课程对象
globalImgUrl, // 全局图片
},
// 创建订单方法
createOrder(e) {
const courseId = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/pages/course/waitPayOrder/waitPayOrder?id=${courseId}`,
createOrder() {
const { courseId } = this.data;
let orderId ;
wx.request({
url: baseUrl + '/courseOrder/add',
method: 'POST',
data: {
courseId: courseId
},
header: {
Authorization :wx.getStorageSync('token'),
},
success : res => {
console.log(res);
this.setData({
orderId: res.data.data
})
wx.navigateTo({
url: `/pages/course/orderDetail/orderDetail?id=${this.data.orderId}`,
})
}
})
},
// 获取课程详情
getCourseDetail() {
const cid = this.data.courseId;
wx.request({
url: baseUrl + '/course/detail/id',
method: 'POST',
data: {
id: cid
},
header: {
Authorization :wx.getStorageSync('token'),
},
success : res => {
console.log(res);
if (res.data.code === 1) {
this.setData({
courseObj: res.data.data,
})
}
}
})
},
@ -24,6 +68,7 @@ Page({
this.setData({
courseId: options.id,
})
this.getCourseDetail()
},
/**

View File

@ -4,14 +4,14 @@
<view class="flex-row items-center section">
<image
class="shrink-0 image"
src="https://ide.code.fun/api/image?token=6859f7a14ae84d0012334fa9&name=9c2a22f14e2bd768cbd40d939693e4a8.png"
src="{{ globalImgUrl + courseObj.image }}"
/>
<view class="flex-col flex-1 ml-11">
<text class="self-start text">区块链和加密数字货币(随报随学认证班)(随报随学认证班)</text>
<text class="self-start text">{{ courseObj.name }}</text>
<view class="flex-row items-center self-stretch group mt-15">
<text class="text_2">¥999</text>
<text class="text_2">¥{{ courseObj.originPrice }}</text>
<view class="flex-col justify-start relative ml-1">
<text class="text_3">¥999</text>
<text class="text_3">¥{{ courseObj.discountPrice }}</text>
<view class="divider pos"></view>
</view>
</view>
@ -19,7 +19,7 @@
</view>
<view class="flex-row justify-between items-center section_2 mt-14">
<text class="font">商品价格</text>
<text class="font text_4">¥999</text>
<text class="font text_4">¥{{ courseObj.discountPrice }}</text>
</view>
<view class="flex-row justify-between items-center section_3 mt-14">
<view class="flex-row items-center">
@ -37,8 +37,8 @@
<!-- 固定在底部的区域 -->
<view class="footer">
<view class="flex-row justify-between items-center section_4">
<text class="font text_5">应付¥999</text>
<view class="flex-col justify-center items-center text-wrapper" bind:tap="createOrder" data-id="{{ '1' }}">
<text class="font text_5">应付¥{{ courseObj.discountPrice }}</text>
<view class="flex-col justify-center items-center text-wrapper" bind:tap="createOrder">
<text class="font text_6">立即支付</text>
</view>
</view>