king
2024-07-01 b45eed171519ffe4f95d0d10743e7b3a25fcd569
src/views/pay/index.jsx
@@ -27,37 +27,46 @@
    second: 60,
    overdue: false,
    overdone: false,
    appId: ''
    appId: '',
    merchId: ''
  }
  UNSAFE_componentWillMount () {
    let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
    let _appId = param.appId || window.GLOB.WXAppID || window.GLOB.WXminiAppID || ''
    let appId = param.appId || window.GLOB.WXAppID || window.GLOB.WXminiAppID || ''
    let merchId = param.merchId || window.GLOB.WXMerchID || ''
    this.setState({
      orderId: param.ID,
      appId: _appId
      appId: appId,
      merchId: merchId
    })
    if (param.ID && _appId) {
      this.getOrder(param.ID, _appId)
    if (param.ID && appId && merchId) {
      this.getOrder(param.ID, appId, merchId)
    } else if (!param.ID) {
      notification.warning({
        top: 92,
        message: '未获取到订单ID!',
        duration: 5
      })
    } else if (!_appId) {
    } else if (!appId) {
      notification.warning({
        top: 92,
        message: '未获取到应用ID!',
        duration: 5
      })
    } else if (!merchId) {
      notification.warning({
        top: 92,
        message: '未获取到商户号!',
        duration: 5
      })
    }
  }
  getOrder = (Id, appId) => {
  getOrder = (Id, appId, merchId) => {
    let param = {
      func: 's_get_weixin_pay_native',
      ID: Id
@@ -108,7 +117,7 @@
          return
        }
        Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, app_id: appId }).then(result => {
        Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, app_id: appId, mchid: merchId }).then(result => {
          if (result.status && result.code_url) {
            this.setState({
              qrcode: result.code_url
@@ -183,7 +192,7 @@
  }
  resetQrcode = () => {
    const { orderNo, appId } = this.state
    const { orderNo, appId, merchId } = this.state
    if (!orderNo) {
      notification.warning({
@@ -199,9 +208,16 @@
        duration: 5
      })
      return
    } else if (!merchId) {
      notification.warning({
        top: 10,
        message: '未获取到商户号!',
        duration: 5
      })
      return
    }
    Api.getWxNativePay({ 'out_biz_no': orderNo, app_id: appId }).then(result => {
    Api.getWxNativePay({ 'out_biz_no': orderNo, app_id: appId, mchid: merchId }).then(result => {
      if (result.status && result.code_url) {
        this.setState({
          qrcode: result.code_url,
@@ -219,9 +235,9 @@
    })
  }
  onChange = () => {
  // onChange = () => {
  }
  // }
  render () {
    const { logo, name, orderNo, icp, copyRight, total, unit, qrcode, second, overdue, overdone } = this.state