Files
gxtyzx-uniapp/dist/dev/mp-weixin/package/course/detail.js
T

450 lines
13 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_booking_course_index = require("../../api/booking/course/index.js");
const store_modules_car = require("../../store/modules/car.js");
store_modules_car.useCarStore();
const _sfc_main = {
data() {
return {
id: 0,
// 课程信息
course: {},
// 课程相册
photo: [],
isLogin: false,
disabled: true,
options: [
{
icon: "headphones",
text: "客服"
},
{
icon: "upload",
text: "分享"
}
],
buttonGroup: [
{
text: "立即报名",
backgroundColor: "linear-gradient(90deg, #FE6035, #EF1224)",
color: "#fff"
}
],
radio2: 0,
sex: [
{
text: "幼儿基础班(10次课,10天连续上课)",
value: 0
},
{
text: "少年基础班(10次课,10天连续上课)",
value: 1
},
{
text: "少年基础班(10次课,10天连续上课)",
value: 2
},
{
text: "成人基础班(10次课,10天连续上课)",
value: 3
}
],
teacher: [
{
text: "姚教练",
value: 0
}
],
student: [
{
text: "全红婵",
value: 0
}
]
};
},
onLoad(option) {
this.id = option.id;
this.reload();
},
onShow() {
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
this.isLogin = true;
}
},
methods: {
async reload() {
const app = this;
Promise.all([app.getCourse()]).then((res) => {
const course = res[0];
app.course = course;
common_vendor.index.setNavigationBarTitle({
title: course.courseName
});
if (course.files) {
app.photo = JSON.parse(course.files);
}
});
},
getCourse() {
return new Promise((resolve, reject) => {
api_booking_course_index.getCourse(this.id).then((result) => {
resolve(result);
}).catch(reject);
});
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
common_vendor.index.navigateTo({
url
});
},
onClick(e) {
const app = this;
const { course } = app;
console.log("e: ", e);
if (e.index == 0) {
common_vendor.wx$1.openCustomerServiceChat({
extInfo: { url: `` },
corpId: `setting.config.wxqykf.corpId`,
success(res) {
}
});
}
if (e.index == 1) {
common_vendor.index.share({
provider: "weixin",
scene: "WXSceneSession",
type: 5,
imageUrl: "",
title: course.name,
miniProgram: {
id: "gh_abcdefg",
path: "package/course/detail?id=" + app.id,
type: 0,
webUrl: "http://apps.gxwebsoft.com/gxtyzx-h5/#/package/course/detail?id=" + app.id
},
success: (ret) => {
console.log(JSON.stringify(ret));
}
});
}
},
mapTo(item) {
const arr = item.lngAndLat.split(",");
common_vendor.index.openLocation({
latitude: parseFloat(arr[1]),
longitude: parseFloat(arr[0]),
success: function() {
console.log("success");
}
});
},
openBookingTel() {
common_vendor.index.navigateTo({
url: "/package/course/checkout?id=" + this.id
});
},
closeBookingTel() {
this.$refs.popup.close();
},
callPhone(phone) {
common_vendor.index.makePhoneCall({
phoneNumber: phone
});
},
onMap() {
common_vendor.index.getLocation({
type: "gcj02",
//返回可以用于uni.openLocation的经纬度
success: function(res) {
console.log("返回可以用于uni.openLocation的经纬度: ", res);
const latitude = this.course.latitude;
const longitude = this.course.longitude;
common_vendor.index.openLocation({
latitude,
longitude,
success: function() {
console.log("success");
}
});
}
});
},
openUrl(url) {
common_vendor.index.navigateTo({
url
});
},
save() {
if (!this.disabled) {
common_vendor.index.showToast({
title: "请先阅读并同意订票协议",
icon: "none"
});
return false;
}
common_vendor.index.navigateTo({
url: "/package/course/checkout?id=" + this.id
});
}
}
};
if (!Array) {
const _easycom_uv_swiper2 = common_vendor.resolveComponent("uv-swiper");
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
const _easycom_uni_tag2 = common_vendor.resolveComponent("uni-tag");
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
const _easycom_uv_cell_group2 = common_vendor.resolveComponent("uv-cell-group");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_uv_image2 = common_vendor.resolveComponent("uv-image");
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
const _easycom_uv_text2 = common_vendor.resolveComponent("uv-text");
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
const _easycom_uni_goods_nav2 = common_vendor.resolveComponent("uni-goods-nav");
const _easycom_uni_data_checkbox2 = common_vendor.resolveComponent("uni-data-checkbox");
const _easycom_uv_tags2 = common_vendor.resolveComponent("uv-tags");
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
(_easycom_uv_swiper2 + _easycom_uv_cell2 + _easycom_uni_tag2 + _easycom_uv_icon2 + _easycom_uv_cell_group2 + _easycom_uni_card2 + _easycom_uv_image2 + _easycom_uv_avatar2 + _easycom_uv_text2 + _easycom_uv_gap2 + _easycom_uni_goods_nav2 + _easycom_uni_data_checkbox2 + _easycom_uv_tags2 + _easycom_uv_button2 + _easycom_uni_popup2 + _easycom_ws_login2)();
}
const _easycom_uv_swiper = () => "../../uni_modules/uv-swiper/components/uv-swiper/uv-swiper.js";
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
const _easycom_uni_tag = () => "../../uni_modules/uni-tag/components/uni-tag/uni-tag.js";
const _easycom_uv_icon = () => "../../uni_modules/uv-icon/components/uv-icon/uv-icon.js";
const _easycom_uv_cell_group = () => "../../uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.js";
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
const _easycom_uv_image = () => "../../uni_modules/uv-image/components/uv-image/uv-image.js";
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
const _easycom_uv_text = () => "../../uni_modules/uv-text/components/uv-text/uv-text.js";
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
const _easycom_uni_goods_nav = () => "../../uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.js";
const _easycom_uni_data_checkbox = () => "../../uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.js";
const _easycom_uv_tags = () => "../../uni_modules/uv-tags/components/uv-tags/uv-tags.js";
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
if (!Math) {
(_easycom_uv_swiper + _easycom_uv_cell + _easycom_uni_tag + _easycom_uv_icon + _easycom_uv_cell_group + _easycom_uni_card + _easycom_uv_image + _easycom_uv_avatar + _easycom_uv_text + _easycom_uv_gap + _easycom_uni_goods_nav + _easycom_uni_data_checkbox + _easycom_uv_tags + _easycom_uv_button + _easycom_uni_popup + _easycom_ws_login)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.p({
list: $data.photo,
indicator: true,
indicatorMode: "line",
circular: true,
height: "200",
radius: "0"
}),
b: $data.course.courseName
}, $data.course.courseName ? {
c: common_vendor.t($data.course.courseName),
d: common_vendor.p({
cellStyle: {
padding: "10px 5px"
},
border: false
}),
e: common_vendor.t($data.course.price),
f: common_vendor.p({
text: `${$data.course.classPeriod}课时`,
inverted: true,
type: "error"
}),
g: common_vendor.p({
cellStyle: {
padding: "10px 5px"
},
border: false
}),
h: common_vendor.p({
size: "50rpx",
name: "map-fill",
color: "#5ac725"
}),
i: common_vendor.o(($event) => $options.mapTo($data.course)),
j: common_vendor.p({
title: $data.course.merchantName,
label: `距离【${$data.course.merchantName}】3.8公里·约7分钟`,
isLink: true,
border: false,
cellStyle: {
padding: "10px 5px"
}
}),
k: common_vendor.p({
title: "年龄限制",
label: $data.course.ageLimit,
border: false,
cellStyle: {
padding: "10px 5px"
}
}),
l: common_vendor.p({
title: "报名时间",
label: $data.course.bmTime,
border: false,
cellStyle: {
padding: "10px 5px"
}
}),
m: common_vendor.p({
customStyle: {
backgroundColor: "#ffffff"
},
border: false
}),
n: common_vendor.p({
border: false,
["is-shadow"]: false,
padding: 0
})
} : {}, {
o: common_vendor.p({
src: `https://oss.wsdns.cn/20240608/1ce5b3f9b33b48b2bc9d68644e8ba6f4.jpg`
}),
p: $data.course.content,
q: common_vendor.p({
title: "课程介绍",
["is-shadow"]: false,
border: false,
padding: 0
}),
r: common_vendor.p({
src: "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKf8Lvm8WN0LnV2B6vYzyGJVxk2XW3j1mtDzicA60KhWRRjyU8ORiascwInkbqhVibRm2A1O1tRRbzhA/132",
size: "54"
}),
s: common_vendor.p({
text: "游泳教练",
align: "center",
size: "16"
}),
t: common_vendor.p({
text: "游泳企事业800",
type: "warning",
size: "12"
}),
v: common_vendor.o(($event) => $options.openUrl(`/package/teacher/detail?id=1`)),
w: common_vendor.p({
title: "课程教练",
["is-shadow"]: false,
border: false,
padding: 0
}),
x: common_vendor.p({
height: "80"
}),
y: common_vendor.o($options.onClick),
z: common_vendor.o($options.openBookingTel),
A: common_vendor.p({
fill: true,
options: $data.options,
["button-group"]: $data.buttonGroup
}),
B: common_vendor.p({
height: "10"
}),
C: common_vendor.p({
mode: "price",
color: "#ff0000",
bold: true,
size: "20",
text: $data.course.price
}),
D: common_vendor.p({
cellStyle: {
padding: "10px 15px"
},
border: false
}),
E: common_vendor.p({
title: "规格",
border: false
}),
F: common_vendor.o(($event) => $data.radio2 = $event),
G: common_vendor.p({
mode: "tag",
localdata: $data.sex,
modelValue: $data.radio2
}),
H: common_vendor.p({
border: false,
cellStyle: {
padding: "0 15px"
}
}),
I: common_vendor.p({
title: "班级/教练",
border: false
}),
J: common_vendor.o(($event) => _ctx.radio3 = $event),
K: common_vendor.p({
mode: "tag",
localdata: $data.teacher,
modelValue: _ctx.radio3
}),
L: common_vendor.p({
border: false,
cellStyle: {
padding: "0 15px"
}
}),
M: common_vendor.p({
title: "报名学员",
border: false
}),
N: common_vendor.o(($event) => _ctx.radio4 = $event),
O: common_vendor.p({
mode: "tag",
localdata: $data.student,
modelValue: _ctx.radio4
}),
P: common_vendor.p({
text: "新增",
type: "info",
size: "mini",
icon: "plus",
plain: true
}),
Q: common_vendor.p({
border: false,
cellStyle: {
padding: "0 15px"
}
}),
R: common_vendor.o($options.save),
S: common_vendor.p({
disabled: !$data.disabled,
customStyle: {
background: "linear-gradient(to right, #FE6035, #EF1224)",
borderRadius: "0 30px 30px 0",
color: "#ffffff",
border: "none",
padding: "22px 30px"
},
text: "下一步"
}),
T: common_vendor.p({
customStyle: {
backgroundColor: "#ffffff"
},
border: false
}),
U: common_vendor.sr("popup", "5f91cfa3-18"),
V: common_vendor.p({
type: "center"
}),
W: common_vendor.sr("login", "5f91cfa3-34"),
X: common_vendor.o($options.reload),
Y: common_vendor.p({
logo: _ctx.logo
})
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5f91cfa3"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/course/detail.vue"]]);
wx.createPage(MiniProgramPage);