;(wx.webpackJsonp = wx.webpackJsonp || []).push([
  [8971],
  {
    4785: function (e, n, a) {
      var r = a(4160),
        o = a(5652),
        t = a(4107),
        c = a(2555),
        s = a(8878),
        i = a.n(s),
        u = a(4269),
        d = a(2573),
        l = a.n(d),
        p = a(4752),
        m = a(3150),
        f = a(3716),
        v = a(4576),
        g = a(9933),
        h = a(2012),
        S = a(5602),
        _ = a(5765),
        y = a(4911),
        w = function () {
          var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '支付失败'
          l().showToast({ title: e, icon: 'none' }), l().navigateBack()
        },
        A = function (e, n, a, r) {
          var o = 'bug' === e ? 2 : 1,
            t = 'https://m.damai.cn/shows/orders.html',
            c = function (e) {
              l().navigateBack({
                delta: o,
                complete: function () {
                  y.A.navTo(e, {}, { needLogin: !0, navigateType: 'redirectTo' })
                },
              })
            },
            s = function (e) {
              l().showToast({ title: '支付失败', icon: 'none' })
              var n = r || t
              if ('requestPayment:fail cancel' === (null == e ? void 0 : e.errMsg)) {
                if (!a) return l().navigateBack({ delta: 1 })
                n = a
              }
              c(n)
            }
          l().requestPayment({
            signType: 'MD5',
            timeStamp: n.timeStamp + '',
            nonceStr: n.nonceStr,
            package: n.package,
            paySign: n.paySign,
            success: function (e) {
              'requestPayment:ok' === e.errMsg ? (l().showToast({ title: '支付成功', icon: 'none' }), c(r || t)) : s(e)
            },
            fail: s,
          })
        },
        I = function (e) {
          var n,
            a,
            r = (function (e) {
              var n = e.code,
                a = { code: n, message: e.message }
              switch (n) {
                case 'MAPIE97003':
                case 'FAIL_BIZ_UC_FAIL_SYS_SESSION_EXPIRED':
                case 'FAIL_SYS_SESSION_EXPIRED':
                  return a
                case 'P-10000-11-16-013':
                case 'P-10000-11-16-014':
                case 'P-10000-11-17-016':
                case 'P-10000-11-17-017':
                case 'P-10000-11-17-018':
                case 'P-10000-11-17-019':
                case 'P-10000-11-17-020':
                case 'P-10000-11-17-021':
                case 'FAIL_SYS_REQUEST_QUEUED':
                  return (a.code = n), (a.message = '亲，同一时间下单人数过多，建议您稍后再试'), a
                case 'B-00203-200-421':
                  f.A.clearCache()
                default:
                  return a
              }
            })(e),
            o = (null == r ? void 0 : r.message) || '小二很忙，请稍后再试吧~',
            t = null == r || null === (n = r.code) || void 0 === n ? void 0 : n.split('-')
          switch ((null == t || null === (a = t[2]) || void 0 === a ? void 0 : a[0]) || '1') {
            case '2':
            case '3':
              l().showModal({
                content: o,
                cancelText: '我知道了',
                confirmText: '重新选购',
                success: function (e) {
                  var n = e.confirm,
                    a = e.cancel
                  n && l().navigateBack({ delta: 2 }), a && l().navigateBack()
                },
              })
              break
            case '4':
              l().showModal({
                showCancel: !1,
                content: o,
                confirmText: '去支付',
                success: function (e) {
                  e.confirm &&
                    l().navigateBack({
                      delta: 2,
                      complete: function () {
                        y.A.navTo(
                          (0, h.Jv)({ page: 'shows_orders', query: { spm: 'a2obt.orderconfirm.bottom.dconfirm' } }),
                          {},
                          { needLogin: !0, navigateType: 'redirectTo' },
                        )
                      },
                    })
                },
              })
              break
            case '1':
            default:
              return (
                l().showToast({ title: o, icon: 'none' }),
                void setTimeout(function () {
                  return l().navigateBack()
                }, 1e3)
              )
          }
        },
        T = function (e, n, a) {
          var r,
            o = n || {},
            t = o.backUrl,
            c = o.nextUrl,
            s = o.bizOrderId,
            i = o.alipayWapCashierUrl,
            u = new _.g(t),
            d = (null == u || null === (r = u.params) || void 0 === r ? void 0 : r.orderId) || '',
            l = t && d && '0' !== d ? (0, g.g)(t, {}, a) : (0, g.g)(t, { orderId: s }),
            p = (0, h.Jv)({ page: 'shows_order', query: { orderId: s, spm: 'a2obt.orderconfirm.bottom.dconfirm' } })
          setTimeout(function () {
            if (c)
              try {
                var n = JSON.parse(decodeURIComponent(i))
                A(e, n, p, l)
              } catch (e) {
                ;(0, f.V)('pay_parse_params_error', e), w()
              }
            else y.A.navTo(p, {}, { needLogin: !0, navigateType: 'redirectTo' })
          }, 400)
        },
        k = (function () {
          var e = (0, c.A)(
            (0, o.A)().m(function e(n) {
              var a, r, t, c, s
              return (0, o.A)().w(function (e) {
                for (;;)
                  switch (e.n) {
                    case 0:
                      return l().showLoading(), (e.n = 1), S.A.createOrder(n)
                    case 1:
                      ;(a = e.v),
                        (r = (0, v.A)(a, 2)),
                        (t = r[0]),
                        (c = r[1]),
                        l().hideLoading(),
                        t ? I(t) : T(n.from, c, null == n || null === (s = n.ext) || void 0 === s ? void 0 : s.prevUrl)
                    case 2:
                      return e.a(2)
                  }
              }, e)
            }),
          )
          return function (n) {
            return e.apply(this, arguments)
          }
        })(),
        U = a(6070)
      Page(
        (0, r.eU)(
          function () {
            var e = (0, d.useRouter)(),
              n = (null == e ? void 0 : e.params) || {},
              a = n.len,
              r = n.ext,
              s = n.from,
              v = n.params,
              g = n.cancelUrl,
              h = n.callbackUrl
            return (
              (0, d.useLoad)(
                (0, c.A)(
                  (0, o.A)().m(function e() {
                    var n, c, u, d, S, _, y, I, T
                    return (0, o.A)().w(
                      function (e) {
                        for (;;)
                          switch ((e.p = e.n)) {
                            case 0:
                              if ((p.Ay.sendPV({}, { _pageRoute: 'pages/pay/index' }), !a || !r)) {
                                e.n = 5
                                break
                              }
                              if (((n = v.length), Number(a) === n)) {
                                e.n = 1
                                break
                              }
                              return (
                                (c = l().getDeviceInfo()),
                                (0, f.V)('pay_params_cutoff', { len: a, info: c, paramsLen: n }),
                                w(),
                                e.a(2)
                              )
                            case 1:
                              return (
                                (e.p = 1),
                                (u = JSON.parse(i().decompressFromEncodedURIComponent(r))),
                                (d = JSON.parse(i().decompressFromEncodedURIComponent(v))),
                                (S = (u || {}).itemId),
                                (e.n = 2),
                                f.A.getWasmHeader(S)
                              )
                            case 2:
                              ;(_ = e.v),
                                (y = JSON.stringify(
                                  (0, t.A)((0, t.A)({}, _), JSON.parse((null == d ? void 0 : d.feature) || '{}')),
                                )),
                                k({ from: s, ext: u, data: (0, t.A)((0, t.A)({}, d), {}, { feature: y }) }),
                                (e.n = 4)
                              break
                            case 3:
                              ;(e.p = 3),
                                (T = e.v),
                                (0, m.ZV)(T),
                                (0, f.V)('pay_wasm_parse_error', { len: a, ext: r, params: v, error: T }),
                                w()
                            case 4:
                              e.n = 6
                              break
                            case 5:
                              try {
                                ;(I = JSON.parse(decodeURIComponent(decodeURIComponent(v)))),
                                  A(s, I, decodeURIComponent(g || ''), decodeURIComponent(h || ''))
                              } catch (e) {
                                ;(0, m.ZV)(e), (0, f.V)('pay_common_parse_error', { err: e, params: v }), w()
                              }
                            case 6:
                              return e.a(2)
                          }
                      },
                      e,
                      null,
                      [[1, 3]],
                    )
                  }),
                ),
              ),
              (0, U.jsx)(u.Ss, {})
            )
          },
          'pages/pay/index',
          { root: { cn: [] } },
          { navigationBarTitleText: '', spmB: 'pay' } || {},
        ),
      )
    },
  },
  function (e) {
    e.O(0, [6907, 8096, 2076], function () {
      return (n = 4785), e((e.s = n))
      var n
    }),
      e.O()
  },
])
