s-coupon-select.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_s_coupon_list2 = common_vendor.resolveComponent("s-coupon-list");
  5. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  6. (_easycom_s_coupon_list2 + _easycom_su_popup2)();
  7. }
  8. const _easycom_s_coupon_list = () => "../s-coupon-list/s-coupon-list.js";
  9. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  10. if (!Math) {
  11. (_easycom_s_coupon_list + _easycom_su_popup)();
  12. }
  13. const _sfc_main = {
  14. __name: "s-coupon-select",
  15. props: {
  16. modelValue: {
  17. // 优惠劵列表
  18. type: Object,
  19. default() {
  20. }
  21. },
  22. show: {
  23. type: Boolean,
  24. default: false
  25. }
  26. },
  27. emits: ["confirm", "close"],
  28. setup(__props, { emit: emits }) {
  29. const props = __props;
  30. const state = common_vendor.reactive({
  31. couponInfo: common_vendor.computed(() => props.modelValue),
  32. // 优惠劵列表
  33. couponId: 0
  34. // 选中的优惠劵编号
  35. });
  36. function radioChange(couponId) {
  37. if (state.couponId === couponId) {
  38. state.couponId = 0;
  39. } else {
  40. state.couponId = couponId;
  41. }
  42. }
  43. const onConfirm = () => {
  44. emits("confirm", state.couponId);
  45. };
  46. return (_ctx, _cache) => {
  47. return {
  48. a: common_vendor.f(state.couponInfo, (item, index, i0) => {
  49. return {
  50. a: state.couponId === item.id,
  51. b: common_vendor.o(($event) => radioChange(item.id), index),
  52. c: common_vendor.o(($event) => radioChange(item.id), index),
  53. d: "7362f63a-1-" + i0 + ",7362f63a-0",
  54. e: common_vendor.p({
  55. data: item,
  56. type: "user",
  57. disabled: false
  58. }),
  59. f: index
  60. };
  61. }),
  62. b: common_vendor.o(onConfirm),
  63. c: common_vendor.o(($event) => emits("close")),
  64. d: common_vendor.p({
  65. show: __props.show,
  66. type: "bottom",
  67. round: "20",
  68. showClose: true,
  69. backgroundColor: "#f2f2f2"
  70. })
  71. };
  72. };
  73. }
  74. };
  75. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7362f63a"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/sheep/components/s-coupon-select/s-coupon-select.vue"]]);
  76. wx.createComponent(Component);