;(function () {
  function _toConsumableArray(arr) {
    return (
      _arrayWithoutHoles(arr) ||
      _iterableToArray(arr) ||
      _unsupportedIterableToArray(arr) ||
      _nonIterableSpread()
    )
  }
  function _nonIterableSpread() {
    throw new TypeError(
      'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
    )
  }
  function _unsupportedIterableToArray(o, minLen) {
    if (!o) return
    if (typeof o === 'string') return _arrayLikeToArray(o, minLen)
    var n = Object.prototype.toString.call(o).slice(8, -1)
    if (n === 'Object' && o.constructor) n = o.constructor.name
    if (n === 'Map' || n === 'Set') return Array.from(o)
    if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
      return _arrayLikeToArray(o, minLen)
  }
  function _iterableToArray(iter) {
    if (
      (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||
      iter['@@iterator'] != null
    )
      return Array.from(iter)
  }
  function _arrayWithoutHoles(arr) {
    if (Array.isArray(arr)) return _arrayLikeToArray(arr)
  }
  function _arrayLikeToArray(arr, len) {
    if (len == null || len > arr.length) len = arr.length
    for (var i = 0, arr2 = new Array(len); i < len; i++) {
      arr2[i] = arr[i]
    }
    return arr2
  }
  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'],
    function (exports) {
      'use strict'
      var state, request, reactive, Dialog
      return {
        setters: [
          function (module) {
            state = module.s
            request = module.r
          },
          function (module) {
            reactive = module.h
            Dialog = module.D
          }
        ],
        execute: function execute() {
          var original = function original() {
            return {
              orderType: '',
              orderInfo: { orderNo: '', actualPrice: 0, payStatus: true },
              orderObject: {
                orderNo: '',
                actualPrice: 0,
                orderName: '',
                orderDesc: '',
                orderType: '',
                recomUserId: null,
                orderList: [],
                activityId: '',
                couponId: '',
                discountPrice: 0
              }
            }
          }
          var orderStatus = exports('o', reactive(original()))
          var resestState = exports('r', function () {
            Object.assign(orderStatus, original())
          })
          var orderInfos = exports('b', function () {
            var orderList = orderStatus.orderObject.orderList || []
            return orderList.map(function (item) {
              var params = {
                goodType: item.orderType,
                goodName: item.goodsName,
                recomUserId: item.recomUserId,
                bizContent: {}
              }
              if (item.orderType === 'VIDEO') {
                params.bizContent = {
                  videoLessonGroupId: item.courseGroupId,
                  payMoney: item.coursePrice || 0
                }
              } else if (item.orderType === 'LIVE') {
                params.bizContent = { groupId: item.courseGroupId }
              } else if (item.orderType === 'PRACTICE') {
                var tempTime = item.classTime || []
                var classCourse = []
                tempTime.forEach(function (time) {
                  classCourse.push({
                    classDate: time.classDate,
                    startTime: time.startTime,
                    endTime: time.endTime
                  })
                })
                params.bizContent = {
                  courseGroupName: item.courseGroupName,
                  courseIntroduce: item.courseIntroduce,
                  subjectId: item.subjectId,
                  singleCourseMinutes: item.singleCourseMinutes,
                  courseNum: item.courseNum,
                  coursePrice: item.coursePrice,
                  teacherId: item.teacherId,
                  classTime: classCourse
                }
              } else if (item.orderType === 'VIP') {
                params.bizContent = item.id
              } else if (item.orderType === 'MUSIC') {
                params.bizContent = {
                  musicSheetId: item.id,
                  actualPrice: item.actualPrice || 0,
                  clientType: state.platformType
                }
              } else if (item.orderType === 'PINAO_ROOM') {
                params.bizContent = item.id
              } else if (item.orderType === 'ACTI_REGIST') {
                params.bizContent = { activityId: item.activityId }
              }
              return params
            })
          })
          var onSubmitZero = exports(
            'a',
            /*#__PURE__*/ (function () {
              var _ref = _asyncToGenerator(
                /*#__PURE__*/ regeneratorRuntime.mark(function _callee(
                  callBack
                ) {
                  var orderObject, url, res, result
                  return regeneratorRuntime.wrap(
                    function _callee$(_context) {
                      while (1) {
                        switch ((_context.prev = _context.next)) {
                          case 0:
                            _context.prev = 0
                            orderObject = orderStatus.orderObject
                            url =
                              state.platformType === 'TEACHER'
                                ? '/api-teacher/userOrder/executeOrder'
                                : '/api-student/userOrder/executeOrder'
                            _context.next = 5
                            return request.post(url, {
                              data: {
                                orderName: orderObject.orderName,
                                orderDesc: orderObject.orderDesc,
                                orderType: orderObject.orderType,
                                actualPrice: orderObject.actualPrice || 0,
                                recomUserId: orderObject.recomUserId,
                                activityId: orderObject.activityId,
                                orderInfos: _toConsumableArray(orderInfos())
                              }
                            })
                          case 5:
                            res = _context.sent
                            result = res.data || {}
                            if (result.status == 'PAID') {
                              if (callBack) {
                                callBack()
                              } else {
                                Dialog.alert({
                                  message: '\u9886\u53D6\u6210\u529F',
                                  confirmButtonText: '\u786E\u5B9A',
                                  confirmButtonColor: '#01C1B5'
                                })
                              }
                            } else {
                              Dialog.alert({
                                message: result.msg,
                                confirmButtonText: '\u786E\u5B9A',
                                confirmButtonColor: '#01C1B5'
                              })
                            }
                            _context.next = 13
                            break
                          case 10:
                            _context.prev = 10
                            _context.t0 = _context['catch'](0)
                            Dialog.alert({
                              title: '\u63D0\u793A',
                              message:
                                '\u652F\u4ED8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01',
                              confirmButtonText: '\u786E\u5B9A',
                              confirmButtonColor: '#01C1B5'
                            })
                          case 13:
                          case 'end':
                            return _context.stop()
                        }
                      }
                    },
                    _callee,
                    null,
                    [[0, 10]]
                  )
                })
              )
              return function (_x) {
                return _ref.apply(this, arguments)
              }
            })()
          )
        }
      }
    }
  )
})()
