index.eb8fe2d3.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. var g = Object.defineProperty
  2. var o = Object.getOwnPropertySymbols
  3. var r = Object.prototype.hasOwnProperty,
  4. u = Object.prototype.propertyIsEnumerable
  5. var d = (t, s, e) =>
  6. s in t
  7. ? g(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e })
  8. : (t[s] = e),
  9. p = (t, s) => {
  10. for (var e in s || (s = {})) r.call(s, e) && d(t, e, s[e])
  11. if (o) for (var e of o(s)) u.call(s, e) && d(t, e, s[e])
  12. return t
  13. }
  14. var c = (t, s) => {
  15. var e = {}
  16. for (var a in t) r.call(t, a) && s.indexOf(a) < 0 && (e[a] = t[a])
  17. if (t != null && o)
  18. for (var a of o(t)) s.indexOf(a) < 0 && u.call(t, a) && (e[a] = t[a])
  19. return e
  20. }
  21. import { s as f, C as L, r as j } from './index.9e4b607f.js'
  22. import {
  23. d as m,
  24. a as i,
  25. M as y,
  26. x,
  27. F as C,
  28. v as A,
  29. w as n
  30. } from './vendor.3506a68e.js'
  31. /* empty css */ /* empty css */ /* empty css */ import {
  32. s as h,
  33. I as E
  34. } from './item.c80360f7.js'
  35. import { a as b } from './hooks.6a14d51f.js'
  36. /* empty css */ function I(t) {
  37. return (
  38. typeof t == 'function' ||
  39. (Object.prototype.toString.call(t) === '[object Object]' && !x(t))
  40. )
  41. }
  42. var l = m({
  43. name: 'coupon-list',
  44. props: { useState: { type: String, default: 'USABLE' } },
  45. data() {
  46. return {
  47. list: [],
  48. listState: { dataShow: !0, loading: !1, finished: !1 },
  49. params: { useState: this.useState, page: 1, rows: 20 }
  50. }
  51. },
  52. mounted() {
  53. this.getList()
  54. },
  55. methods: {
  56. async getList() {
  57. try {
  58. const t = await b(
  59. `${f.platformApi}/couponInfo/page`,
  60. p({ params: this.params, list: this.list }, this.listState)
  61. ),
  62. { params: e, list: a } = t,
  63. S = c(t, ['params', 'list'])
  64. ;(this.params = e), (this.list = a), (this.listState = S)
  65. } catch {}
  66. }
  67. },
  68. render() {
  69. let t
  70. return i(C, null, [
  71. this.listState.dataShow
  72. ? i(
  73. y,
  74. {
  75. loading: this.listState.loading,
  76. 'onUpdate:loading': s => (this.listState.loading = s),
  77. finished: this.listState.finished,
  78. finishedText: ' ',
  79. class: [this.list.length > 0 && h.list],
  80. onLoad: this.getList,
  81. immediateCheck: !1
  82. },
  83. I((t = this.list.map(s => i(E, { item: s }, null))))
  84. ? t
  85. : { default: () => [t] }
  86. )
  87. : i(
  88. L,
  89. {
  90. btnStatus: !1,
  91. classImgSize: 'SMALL',
  92. tips: '\u6682\u65E0\u4F18\u60E0\u5238'
  93. },
  94. null
  95. )
  96. ])
  97. }
  98. }),
  99. F = m({
  100. name: 'coupon-container',
  101. data() {
  102. return { couponCount: { total: 0, useState: 'USABLE' } }
  103. },
  104. async mounted() {
  105. try {
  106. const t =
  107. f.platformType === 'STUDENT' ? '/api-student' : '/api-teacher',
  108. e = (await j.get(`${t}/couponInfo/statInfo`)).data || []
  109. ;(this.couponCount = e.find(a => a.useState === 'USABLE')),
  110. console.log(e.find(a => a.useState === 'USABLE'))
  111. } catch {}
  112. },
  113. render() {
  114. return i('div', { class: h.coupons }, [
  115. i(
  116. A,
  117. { color: '#01C1B5', lineWidth: 44, sticky: !0 },
  118. {
  119. default: () => [
  120. i(
  121. n,
  122. {
  123. title: `\u53EF\u4F7F\u7528${
  124. this.couponCount.total > 0
  125. ? '(' + this.couponCount.total + '\u5F20)'
  126. : ''
  127. }`
  128. },
  129. { default: () => [i(l, null, null)] }
  130. ),
  131. i(
  132. n,
  133. { title: '\u5DF2\u4F7F\u7528' },
  134. { default: () => [i(l, { useState: 'USED' }, null)] }
  135. ),
  136. i(
  137. n,
  138. { title: '\u5DF2\u5931\u6548' },
  139. { default: () => [i(l, { useState: 'EXPIRED' }, null)] }
  140. )
  141. ]
  142. }
  143. )
  144. ])
  145. }
  146. })
  147. export { F as default }