acdr-ui/dist/dev/mp-weixin/modules/mall/sheep/components/s-coupon-select/s-coupon-select.js

91 lines
2.8 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
2024-10-01 09:15:35 +08:00
const common_vendor = require("../../../../../common/vendor.js");
2024-09-19 07:20:14 +08:00
if (!Array) {
const _easycom_s_coupon_list2 = common_vendor.resolveComponent("s-coupon-list");
const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
(_easycom_s_coupon_list2 + _easycom_su_popup2)();
}
const _easycom_s_coupon_list = () => "../s-coupon-list/s-coupon-list.js";
const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
if (!Math) {
(_easycom_s_coupon_list + _easycom_su_popup)();
}
const _sfc_main = {
__name: "s-coupon-select",
props: {
modelValue: {
// 优惠劵列表
type: Object,
default() {
}
},
show: {
type: Boolean,
default: false
}
},
emits: ["confirm", "close"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const state = common_vendor.reactive({
couponInfo: common_vendor.computed(() => props.modelValue),
// 优惠劵列表
couponId: void 0
// 选中的优惠劵编号
});
function radioChange(couponId) {
if (state.couponId === couponId) {
state.couponId = void 0;
} else {
state.couponId = couponId;
}
}
const onConfirm = () => {
emits("confirm", state.couponId);
};
return (_ctx, _cache) => {
return {
a: common_vendor.f(state.couponInfo.filter((coupon) => coupon.match), (item, index, i0) => {
return {
a: common_vendor.t(item.description || "已达到使用门槛"),
b: state.couponId === item.id,
c: common_vendor.o(($event) => radioChange(item.id), index),
d: common_vendor.o(($event) => radioChange(item.id), index),
2024-10-01 09:15:35 +08:00
e: "5cd309e6-1-" + i0 + ",5cd309e6-0",
2024-09-19 07:20:14 +08:00
f: common_vendor.p({
data: item,
type: "user",
disabled: false
}),
g: index
};
}),
b: common_vendor.f(state.couponInfo.filter((coupon) => !coupon.match), (item, k0, i0) => {
return {
a: common_vendor.t(item.description || "未达到使用门槛"),
2024-10-01 09:15:35 +08:00
b: "5cd309e6-2-" + i0 + ",5cd309e6-0",
2024-09-19 07:20:14 +08:00
c: common_vendor.p({
data: item,
type: "user",
disabled: true
}),
d: item.id
};
}),
c: common_vendor.o(onConfirm),
d: common_vendor.o(($event) => emits("close")),
e: common_vendor.p({
show: __props.show,
type: "bottom",
round: "20",
showClose: true,
backgroundColor: "#f2f2f2"
})
};
};
}
};
2024-10-01 09:15:35 +08:00
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5cd309e6"]]);
2024-09-19 07:20:14 +08:00
wx.createComponent(Component);