2026-01-14 15:43:09 +08:00

106 lines
4.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_day = require("../../common/libraries/day.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "hs-reservation-picker",
props: [
"Enums",
"title",
"pickerIndex",
"value",
"borderTop",
"required",
"valueExpectStartTime",
"valueExpectEndTime",
"icon",
"iconSize"
],
emits: ["change", "update:valueExpectStartTime", "update:valueExpectEndTime"],
setup(__props, { emit }) {
const props = __props;
const borderStyle = "1rpx solid #eee";
const placeholder = "请选择";
const listData = common_vendor.ref([]);
const selectValue = common_vendor.ref("");
const onChange = (e) => {
var _a;
let res = (_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value;
let label_str = listData.value[0][res[0]];
let label_end = listData.value[1][res[1]];
console.log(e, "e");
let str_time = `${label_str == null ? void 0 : label_str.value} ${label_end == null ? void 0 : label_end.str}`;
let end_time = `${label_str == null ? void 0 : label_str.value} ${label_end == null ? void 0 : label_end.end}`;
selectValue.value = `${label_str == null ? void 0 : label_str.label}(${label_end == null ? void 0 : label_end.label})`;
emit("update:valueExpectStartTime", str_time);
emit("update:valueExpectEndTime", end_time);
emit("change", {
str_time,
end_time
});
};
const setDayList = () => {
let dayInfo = common_libraries_day.getCurrentHour();
let day0 = common_libraries_day.getTheFutureDay(0);
let day1 = common_libraries_day.getTheFutureDay(1);
let day2 = common_libraries_day.getTheFutureDay(2);
let timeSlots = common_libraries_day.generateTimeSlots();
listData.value = [
[
{ label: "今天", value: day0 },
{ label: "明天", value: day1 },
{ label: "后天", value: day2 }
],
timeSlots
];
console.log(dayInfo, "day1");
};
const onColumnchange = (e) => {
var _a, _b, _c, _d, _e;
if (((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.column) === 0) {
if ((_b = e == null ? void 0 : e.detail) == null ? void 0 : _b.value) {
let val = (_e = listData.value[(_c = e == null ? void 0 : e.detail) == null ? void 0 : _c.column][(_d = e == null ? void 0 : e.detail) == null ? void 0 : _d.value]) == null ? void 0 : _e.value;
let timeSlots = common_libraries_day.generateTimeSlots(val);
listData.value[1] = timeSlots;
console.log(timeSlots, "timeSlots");
} else {
let timeSlots = common_libraries_day.generateTimeSlots();
listData.value[1] = timeSlots;
console.log(timeSlots, "timeSlots");
}
}
console.log(e, "e");
};
common_vendor.onMounted(() => {
setDayList();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t((props == null ? void 0 : props.title) || "标题"),
b: __props.required
}, __props.required ? {} : {}, {
c: common_vendor.t(selectValue.value || placeholder),
d: common_vendor.p({
type: "right",
size: "15",
color: "#999"
}),
e: common_vendor.n(selectValue.value ? "valueStyle" : "valueStyle placeholderStyle"),
f: props.borderTop ? borderStyle : "",
g: listData.value,
h: common_vendor.o(onChange),
i: common_vendor.o(onColumnchange)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1a4ad8b9"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/components/hs-reservation-picker/hs-reservation-picker.vue"]]);
wx.createComponent(Component);