;(function () {
  var _excluded = ['params', 'list']
  function _objectWithoutProperties(source, excluded) {
    if (source == null) return {}
    var target = _objectWithoutPropertiesLoose(source, excluded)
    var key, i
    if (Object.getOwnPropertySymbols) {
      var sourceSymbolKeys = Object.getOwnPropertySymbols(source)
      for (i = 0; i < sourceSymbolKeys.length; i++) {
        key = sourceSymbolKeys[i]
        if (excluded.indexOf(key) >= 0) continue
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue
        target[key] = source[key]
      }
    }
    return target
  }
  function _objectWithoutPropertiesLoose(source, excluded) {
    if (source == null) return {}
    var target = {}
    var sourceKeys = Object.keys(source)
    var key, i
    for (i = 0; i < sourceKeys.length; i++) {
      key = sourceKeys[i]
      if (excluded.indexOf(key) >= 0) continue
      target[key] = source[key]
    }
    return target
  }
  function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object)
    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object)
      enumerableOnly &&
        (symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable
        })),
        keys.push.apply(keys, symbols)
    }
    return keys
  }
  function _objectSpread(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {}
      i % 2
        ? ownKeys(Object(source), !0).forEach(function (key) {
            _defineProperty(target, key, source[key])
          })
        : Object.getOwnPropertyDescriptors
        ? Object.defineProperties(
            target,
            Object.getOwnPropertyDescriptors(source)
          )
        : ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(
              target,
              key,
              Object.getOwnPropertyDescriptor(source, key)
            )
          })
    }
    return target
  }
  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      })
    } else {
      obj[key] = value
    }
    return obj
  }
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
    try {
      var info = gen[key](arg)
      var value = info.value
    } catch (error) {
      reject(error)
      return
    }
    if (info.done) {
      resolve(value)
    } else {
      Promise.resolve(value).then(_next, _throw)
    }
  }
  function _asyncToGenerator(fn) {
    return function () {
      var self = this,
        args = arguments
      return new Promise(function (resolve, reject) {
        var gen = fn.apply(self, args)
        function _next(value) {
          asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value)
        }
        function _throw(err) {
          asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err)
        }
        _next(undefined)
      })
    }
  }
  System.register(
    [
      './index-legacy.595c24c3.js',
      './vendor-legacy.09f20d09.js',
      './index-legacy.f25f109a3.js',
      './index-legacy.637f3556.js',
      './index-legacy.637f35562.js',
      './item-legacy.bddec109.js',
      './hooks-legacy.b91b3b59.js',
      './index-legacy.f25f109a6.js'
    ],
    function (exports) {
      'use strict'
      var state,
        ColResult,
        request,
        defineComponent,
        createVNode,
        List$1,
        isVNode,
        Fragment,
        Tabs,
        Tab,
        styles,
        Item,
        useList
      return {
        setters: [
          function (module) {
            state = module.s
            ColResult = module.C
            request = module.r
          },
          function (module) {
            defineComponent = module.d
            createVNode = module.a
            List$1 = module.M
            isVNode = module.x
            Fragment = module.F
            Tabs = module.v
            Tab = module.w
          },
          function () {},
          function () {},
          function () {},
          function (module) {
            styles = module.s
            Item = module.I
          },
          function (module) {
            useList = module.a
          },
          function () {}
        ],
        execute: function execute() {
          function _isSlot(s) {
            return (
              typeof s === 'function' ||
              (Object.prototype.toString.call(s) === '[object Object]' &&
                !isVNode(s))
            )
          }
          var List = defineComponent({
            name: 'coupon-list',
            props: { useState: { type: String, default: 'USABLE' } },
            data: function data() {
              return {
                list: [],
                listState: {
                  dataShow: true, // 判断是否有数据
                  loading: false,
                  finished: false
                },
                params: { useState: this.useState, page: 1, rows: 20 }
              }
            },
            mounted: function mounted() {
              this.getList()
            },
            methods: {
              getList: function getList() {
                var _this = this
                return _asyncToGenerator(
                  /*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
                    var result, params, list, res
                    return regeneratorRuntime.wrap(
                      function _callee$(_context) {
                        while (1) {
                          switch ((_context.prev = _context.next)) {
                            case 0:
                              _context.prev = 0
                              _context.next = 3
                              return useList(
                                ''.concat(
                                  state.platformApi,
                                  '/couponInfo/page'
                                ),
                                _objectSpread(
                                  { params: _this.params, list: _this.list },
                                  _this.listState
                                )
                              )
                            case 3:
                              result = _context.sent
                              ;(params = result.params),
                                (list = result.list),
                                (res = _objectWithoutProperties(
                                  result,
                                  _excluded
                                ))
                              _this.params = params
                              _this.list = list
                              _this.listState = res
                              _context.next = 12
                              break
                            case 10:
                              _context.prev = 10
                              _context.t0 = _context['catch'](0)
                            case 12:
                            case 'end':
                              return _context.stop()
                          }
                        }
                      },
                      _callee,
                      null,
                      [[0, 10]]
                    )
                  })
                )()
              }
            },
            render: function render() {
              var _this2 = this
              var _slot
              return createVNode(Fragment, null, [
                this.listState.dataShow
                  ? createVNode(
                      List$1,
                      {
                        loading: this.listState.loading,
                        'onUpdate:loading': function onUpdateLoading($event) {
                          return (_this2.listState.loading = $event)
                        },
                        finished: this.listState.finished,
                        finishedText: ' ',
                        class: [this.list.length > 0 && styles.list],
                        onLoad: this.getList,
                        immediateCheck: false
                      },
                      _isSlot(
                        (_slot = this.list.map(function (item) {
                          return createVNode(Item, { item: item }, null)
                        }))
                      )
                        ? _slot
                        : {
                            default: function _default() {
                              return [_slot]
                            }
                          }
                    )
                  : createVNode(
                      ColResult,
                      {
                        btnStatus: false,
                        classImgSize: 'SMALL',
                        tips: '暂无优惠券'
                      },
                      null
                    )
              ])
            }
          })
          var index = exports(
            'default',
            defineComponent({
              name: 'coupon-container',
              data: function data() {
                return { couponCount: { total: 0, useState: 'USABLE' } }
              },
              mounted: function mounted() {
                var _this3 = this
                return _asyncToGenerator(
                  /*#__PURE__*/ regeneratorRuntime.mark(function _callee2() {
                    var url, res, result
                    return regeneratorRuntime.wrap(
                      function _callee2$(_context2) {
                        while (1) {
                          switch ((_context2.prev = _context2.next)) {
                            case 0:
                              _context2.prev = 0 // 判断是哪个端
                              url =
                                state.platformType === 'STUDENT'
                                  ? '/api-student'
                                  : '/api-teacher'
                              _context2.next = 4
                              return request.get(
                                ''.concat(url, '/couponInfo/statInfo')
                              )
                            case 4:
                              res = _context2.sent
                              result = res.data || []
                              _this3.couponCount = result.find(function (
                                result
                              ) {
                                return result.useState === 'USABLE'
                              })
                              console.log(
                                result.find(function (result) {
                                  return result.useState === 'USABLE'
                                })
                              )
                              _context2.next = 12
                              break
                            case 10:
                              _context2.prev = 10
                              _context2.t0 = _context2['catch'](0)
                            case 12:
                            case 'end':
                              return _context2.stop()
                          }
                        }
                      },
                      _callee2,
                      null,
                      [[0, 10]]
                    )
                  })
                )()
              },
              render: function render() {
                var _this4 = this
                return createVNode('div', { class: styles.coupons }, [
                  createVNode(
                    Tabs,
                    { color: '#01C1B5', lineWidth: 44, sticky: true },
                    {
                      default: function _default() {
                        return [
                          createVNode(
                            Tab,
                            {
                              title: '\u53EF\u4F7F\u7528'.concat(
                                _this4.couponCount.total > 0
                                  ? '(' + _this4.couponCount.total + '张)'
                                  : ''
                              )
                            },
                            {
                              default: function _default() {
                                return [createVNode(List, null, null)]
                              }
                            }
                          ),
                          createVNode(
                            Tab,
                            { title: '已使用' },
                            {
                              default: function _default() {
                                return [
                                  createVNode(List, { useState: 'USED' }, null)
                                ]
                              }
                            }
                          ),
                          createVNode(
                            Tab,
                            { title: '已失效' },
                            {
                              default: function _default() {
                                return [
                                  createVNode(
                                    List,
                                    { useState: 'EXPIRED' },
                                    null
                                  )
                                ]
                              }
                            }
                          )
                        ]
                      }
                    }
                  )
                ])
              }
            })
          )
        }
      }
    }
  )
})()
