273 lines
7.5 KiB
JavaScript
273 lines
7.5 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_booking_card_index = require("../../api/booking/card/index.js");
|
|
require("../../utils/request.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const _sfc_main = {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
isRefresh: false,
|
|
isLogin: false,
|
|
userId: 0,
|
|
where: {
|
|
page: 1,
|
|
cardCode: "月/年卡",
|
|
sceneType: "showCanBuyVipCard"
|
|
},
|
|
canReset: false,
|
|
loadMore: "more",
|
|
logo: "",
|
|
items: ["月/年卡", "次卡", "充值卡"],
|
|
cardList: [],
|
|
styles: [
|
|
{
|
|
value: "button",
|
|
text: "按钮",
|
|
checked: true
|
|
},
|
|
{
|
|
value: "text",
|
|
text: "文字"
|
|
}
|
|
],
|
|
colors: ["#333333", "#4cd964", "#dd524d"],
|
|
current: 0,
|
|
colorIndex: 0,
|
|
activeColor: "#108001",
|
|
styleType: "text",
|
|
getWeek: utils_common.getWeek,
|
|
// 骨架屏
|
|
hideTools: true
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
this.openLogin();
|
|
this.reload();
|
|
console.log("判断是否刷新: ", option);
|
|
if (option.isRefresh) {
|
|
this.isRefresh = true;
|
|
}
|
|
},
|
|
onShow(e) {
|
|
console.log("判断是否刷新: ", e);
|
|
this.openLogin();
|
|
if (this.isRefresh) {
|
|
this.reload();
|
|
}
|
|
},
|
|
// 触底函数
|
|
onReachBottom() {
|
|
const app = this;
|
|
const { where } = this;
|
|
if (app.canReset) {
|
|
app.where.page = ++where.page;
|
|
app.reload();
|
|
}
|
|
},
|
|
methods: {
|
|
reload() {
|
|
const app = this;
|
|
const { where, userId } = this;
|
|
if (userId == 0) {
|
|
app.openLogin();
|
|
return;
|
|
}
|
|
app.loadMore = "loading";
|
|
api_booking_card_index.pageCard(where).then((res) => {
|
|
const list = res.list.map((d) => {
|
|
console.log(d);
|
|
return d;
|
|
});
|
|
if (app.cardList.length < res.count) {
|
|
app.cardList = app.cardList.concat(list);
|
|
app.canReset = true;
|
|
app.loadMore = "no-more";
|
|
} else {
|
|
app.canReset = false;
|
|
app.loadMore = "no-more";
|
|
}
|
|
app.isRefresh = false;
|
|
app.hideTools = false;
|
|
}).catch(() => {
|
|
common_vendor.index.showToast({
|
|
title: "请检查您的网络.",
|
|
icon: "none"
|
|
});
|
|
app.isRefresh = false;
|
|
app.hideTools = false;
|
|
});
|
|
},
|
|
onClickItem(e, text) {
|
|
const { where, userId } = this;
|
|
const index = e.currentIndex;
|
|
if (this.current !== e.currentIndex) {
|
|
this.current = e.currentIndex;
|
|
}
|
|
if (index == 0) {
|
|
where.cardCode = "月/年卡";
|
|
}
|
|
if (index == 1) {
|
|
where.cardCode = "次卡";
|
|
}
|
|
if (index == 2) {
|
|
where.cardCode = "充值卡";
|
|
}
|
|
this.where.page = 1;
|
|
this.cardList = [];
|
|
this.hideTools = true;
|
|
this.reload();
|
|
},
|
|
openUrl(url) {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
},
|
|
toPay(orderId) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/package/booking/confirm?id=" + orderId
|
|
});
|
|
},
|
|
closeOrder(item) {
|
|
common_vendor.index.showModal({
|
|
title: "确定取消此订单?",
|
|
success(o) {
|
|
if (o.confirm) ;
|
|
}
|
|
});
|
|
},
|
|
// 弹出登录提示框
|
|
async openLogin() {
|
|
this.userId = common_vendor.index.getStorageSync("user_id");
|
|
if (!this.userId) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
|
|
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
(_easycom_uni_segmented_control2 + _easycom_uv_avatar2 + _easycom_uv_skeleton2 + _easycom_uni_card2 + _easycom_ws_login2)();
|
|
}
|
|
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
|
|
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
|
const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
if (!Math) {
|
|
(_easycom_uni_segmented_control + _easycom_uv_avatar + _easycom_uv_skeleton + _easycom_uni_card + _easycom_ws_login)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.o($options.onClickItem),
|
|
b: common_vendor.p({
|
|
current: $data.current,
|
|
values: $data.items,
|
|
styleType: $data.styleType,
|
|
activeColor: $data.activeColor,
|
|
inActiveColor: "#808080"
|
|
}),
|
|
c: common_vendor.f($data.cardList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: "8f2f2dbe-1-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.merchantAvatar,
|
|
size: "36"
|
|
}),
|
|
c: common_vendor.t(item.cardName),
|
|
d: item.cardCode == "月/年卡"
|
|
}, item.cardCode == "月/年卡" ? {
|
|
e: common_vendor.t(item.month)
|
|
} : {}, {
|
|
f: item.cardCode == "次卡"
|
|
}, item.cardCode == "次卡" ? {
|
|
g: common_vendor.t(item.number)
|
|
} : {}, {
|
|
h: item.cardCode == "充值卡"
|
|
}, item.cardCode == "充值卡" ? {
|
|
i: common_vendor.t(item.discount)
|
|
} : {}, {
|
|
j: common_vendor.t(`¥${item.price}`),
|
|
k: common_vendor.o(($event) => $options.openUrl("/package/card/checkout?cardId=" + item.cardId), index),
|
|
l: `url(${item.image}) no-repeat center center`,
|
|
m: index
|
|
});
|
|
}),
|
|
d: $data.cardList.length == 0
|
|
}, $data.cardList.length == 0 ? {
|
|
e: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
f: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
g: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
h: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
i: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
j: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
k: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
l: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
m: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
n: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
o: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
p: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
})
|
|
} : {}, {
|
|
q: common_vendor.sr("login", "8f2f2dbe-14"),
|
|
r: common_vendor.o($options.reload),
|
|
s: common_vendor.p({
|
|
logo: $data.logo
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/card/index.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|