154 lines
4.7 KiB
JavaScript
154 lines
4.7 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const store_modules_user = require("../../store/modules/user.js");
|
|
const api_booking_integral_index = require("../../api/booking/integral/index.js");
|
|
require("../../utils/request.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const api_system_user_index = require("../../api/system/user/index.js");
|
|
const store_modules_tenant = require("../../store/modules/tenant.js");
|
|
store_modules_tenant.useTenantStore();
|
|
const userStore = store_modules_user.useUserStore();
|
|
const currentDate = /* @__PURE__ */ new Date();
|
|
const currentMonth = currentDate.getFullYear() + "-" + (currentDate.getMonth() + 1).toString().padStart(2, "0");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
userInfo: {},
|
|
list: [],
|
|
statusBarHeight: 104,
|
|
isLogin: false,
|
|
form: {
|
|
name: "",
|
|
phone: ""
|
|
},
|
|
dateTime: currentMonth,
|
|
fields: {},
|
|
logo: "",
|
|
bookingUser: {},
|
|
server: [],
|
|
order: [],
|
|
showCalendar: false,
|
|
selected: [],
|
|
todaySign: false
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.reload();
|
|
},
|
|
onReady() {
|
|
this.$nextTick(() => {
|
|
this.showCalendar = true;
|
|
});
|
|
},
|
|
methods: {
|
|
async reload(e) {
|
|
const app = this;
|
|
const { dateTime } = this;
|
|
const userInfo = await userStore.fetchUserInfo();
|
|
if (Object.keys(userInfo).length > 0) {
|
|
app.isLogin = true;
|
|
app.userInfo = userInfo;
|
|
} else {
|
|
app.isLogin = false;
|
|
}
|
|
api_booking_integral_index.getSignData({
|
|
dateTime
|
|
}).then((res) => {
|
|
common_vendor.index.hideLoading();
|
|
if (res.message == "您今天已经签到过了") {
|
|
app.todaySign = true;
|
|
}
|
|
app.selected = [];
|
|
res.data.map((d) => {
|
|
app.selected.push({
|
|
date: d.dateTime,
|
|
info: "已签到"
|
|
});
|
|
});
|
|
});
|
|
},
|
|
navTo(item) {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
utils_common.openUrl(item);
|
|
},
|
|
// 弹出登录提示框
|
|
openLogin() {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
},
|
|
onSign() {
|
|
const app = this;
|
|
app.openLogin();
|
|
app.todaySign = true;
|
|
api_booking_integral_index.addIntegral({}).then((res) => {
|
|
api_system_user_index.updatePointsBySign();
|
|
app.userInfo.points++;
|
|
common_vendor.index.showToast({
|
|
title: "签到成功",
|
|
icon: "success"
|
|
});
|
|
setTimeout(() => {
|
|
app.reload();
|
|
}, 1e3);
|
|
}).catch((err) => {
|
|
});
|
|
this.$forceUpdate();
|
|
},
|
|
onMonthSwitch(e) {
|
|
this.dateTime = e.year + "-" + e.month.toString().padStart(2, "0");
|
|
this.reload();
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uni_calendar2 = common_vendor.resolveComponent("uni-calendar");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
(_easycom_uv_button2 + _easycom_uni_card2 + _easycom_uni_calendar2 + _easycom_ws_login2)();
|
|
}
|
|
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_uni_calendar = () => "../../uni_modules/uni-calendar/components/uni-calendar/uni-calendar.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
if (!Math) {
|
|
(_easycom_uv_button + _easycom_uni_card + _easycom_uni_calendar + _easycom_ws_login)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.t($data.userInfo.points),
|
|
b: common_vendor.o($options.onSign),
|
|
c: common_vendor.p({
|
|
disabled: $data.todaySign,
|
|
customStyle: {
|
|
background: "linear-gradient(to right, #70b915, #008e04)",
|
|
borderRadius: "30px",
|
|
color: "#ffffff"
|
|
},
|
|
text: "签到"
|
|
}),
|
|
d: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
}),
|
|
e: common_vendor.o($options.onMonthSwitch),
|
|
f: common_vendor.p({
|
|
selected: $data.selected,
|
|
showMonth: true
|
|
}),
|
|
g: common_vendor.sr("login", "57f0d352-3"),
|
|
h: common_vendor.o($options.reload),
|
|
i: 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/user/integral.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|