| | |
| | | loading: false, |
| | | disabled: false, |
| | | hidden: false, |
| | | dict: window.GLOB.dict |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | */ |
| | | actionTrigger = (triggerId, record, type, lid) => { |
| | | const { btn, BID, selectedData, LID } = this.props |
| | | const { loading } = this.state |
| | | const { loading, dict } = this.state |
| | | |
| | | if (loading) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | |
| | | let error = '' |
| | | |
| | | if (btn.funcType === 'shareLink' && window.GLOB.systemType === 'production' && !btn.shareProUrl) { |
| | | error = '尚未设置正式系统链接地址!' |
| | | error = dict['no_prod_link'] || '尚未设置正式系统链接地址!' |
| | | } else if (btn.funcType === 'refund') { |
| | | if (data.length === 0) { |
| | | error = '请选择行!' |
| | | error = dict['select_row'] || '请选择行!' |
| | | } else if (data.length !== 1) { |
| | | error = '请选择单行数据!' |
| | | error = dict['select_single_row'] || '请选择单行数据!' |
| | | } else if (!data[0].$$uuid) { |
| | | error = '未获取到订单编号!' |
| | | error = dict['no_ordercode'] || '未获取到订单编号!' |
| | | } |
| | | } |
| | | |
| | |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: btn.tipTitle || '确定要执行吗?', |
| | | title: btn.tipTitle || dict['exec_sure'] || '确定要执行吗?', |
| | | okText: dict['ok'] || '确定', |
| | | cancelText: dict['cancel'] || '取消', |
| | | onOk() { |
| | | that.execRefund(orderId) |
| | | }, |
| | |
| | | execRefund = (orderId) => { |
| | | Api.setRefund(orderId).then(res => { |
| | | if (!res.status) { |
| | | this.execError({ErrCode: 'E', message: '执行失败!', ...res}) |
| | | this.execError({ErrCode: 'E', message: window.GLOB.dict['exc_fail'] || '执行失败!', ...res}) |
| | | } else { |
| | | this.execSuccess({ErrCode: 'S', ...res}) |
| | | } |
| | |
| | | title: btn.shareTip |
| | | }) |
| | | } else { |
| | | message.success('已复制到剪切板。') |
| | | message.success(window.GLOB.dict['copied'] || '已复制到剪切板。') |
| | | } |
| | | } |
| | | |
| | | execSuccess = (res = {}) => { |
| | | const { btn } = this.props |
| | | const { dict } = this.state |
| | | |
| | | if (res.ErrCode === 'S' || !res.ErrCode) { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | message: res.message || dict['exc_success'] || '执行成功!', |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } else if (res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.message || '执行成功!' |
| | | title: res.message || dict['exc_success'] || '执行成功!', |
| | | okText: dict['got_it'] || '知道了' |
| | | }) |
| | | } else if (res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | |
| | | |
| | | execError = (res) => { |
| | | const { btn } = this.props |
| | | const { dict } = this.state |
| | | |
| | | if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) { |
| | | res.ErrCode = 'E' |
| | |
| | | |
| | | if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || '执行失败!', |
| | | title: res.message || dict['exc_fail'] || '执行失败!', |
| | | okText: dict['got_it'] || '知道了' |
| | | }) |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || '执行失败!', |
| | | message: res.message || dict['exc_fail'] || '执行失败!', |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || '执行失败!', |
| | | message: res.message || dict['exc_fail'] || '执行失败!', |
| | | duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || '执行失败!') |
| | | message.error(res.message || dict['exc_fail'] || '执行失败!') |
| | | } |
| | | |
| | | this.setState({ |