From b45eed171519ffe4f95d0d10743e7b3a25fcd569 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 01 七月 2024 15:43:07 +0800 Subject: [PATCH] 2024-07-01 --- src/index.js | 3 src/views/pay/index.jsx | 40 +++++++--- src/menu/components/share/actioncomponent/actionform/index.jsx | 4 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 46 +++++++---- src/views/appcheck/index.jsx | 8 + src/views/appmanage/index.jsx | 12 ++ public/manifest.json | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 57 ++++++++++++- src/tabviews/zshare/actionList/normalbutton/index.jsx | 10 ++ src/templates/zshare/verifycard/index.jsx | 10 ++ src/views/appmanage/submutilform/index.jsx | 45 +++++++++-- 11 files changed, 184 insertions(+), 53 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index 61ef54c..425eba5 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,5 +6,5 @@ "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff", - "mk_version": "20240601" + "mk_version": "20240701" } diff --git a/src/index.js b/src/index.js index b1f8d21..b167b70 100644 --- a/src/index.js +++ b/src/index.js @@ -48,6 +48,7 @@ GLOB.nginx = config.nginx + '' === 'true' GLOB.WXAppID = config.WXAppID || '' GLOB.WXminiAppID = config.WXminiAppID || '' + GLOB.WXMerchID = config.WXMerchID || '' GLOB.WXNotice = config.WXNotice + '' === 'true' GLOB.execType = config.execType === 'x' ? 'x' : '' GLOB.accessToken = {} @@ -60,7 +61,7 @@ GLOB.defLang = '' if (config.WXApps) { - config.WXApps = config.WXApps.filter(app => app.appId && app.appName && ['public', 'miniProgram'].includes(app.appType)) + config.WXApps = config.WXApps.filter(app => app.appId && app.appName && ['public', 'miniProgram', 'merchant'].includes(app.appType)) if (config.WXApps.length) { GLOB.WXApps = config.WXApps } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 7d7dcb9..0d1897c 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -444,7 +444,7 @@ } else if (this.record.pageTemplate === 'pay') { reOptions.Ot = requireOptions.filter(op => op.value === 'requiredSgl') - shows.push('payMode', 'wxApp') + shows.push('payMode', 'wxApp', 'wxMerch') if (this.record.payMode === 'inner') { reRequired.innerFunc = true shows.push('innerFunc') @@ -520,7 +520,7 @@ shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey') } else if (_funcType === 'pay') { - shows.push('payType', 'wxApp', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') + shows.push('payType', 'wxApp', 'wxMerch', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') if (this.record.openmenu && this.record.openmenu !== 'goback') { shows.push('open') } diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index bbf9eb6..4d90ee7 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -331,9 +331,21 @@ extraParam.push('dataM') } + let apps = [] + let merchs = [] if (!appType) { if (typeof(card.openmenu) === 'string') { card.openmenu = [] + } + + if (window.GLOB.WXApps) { + window.GLOB.WXApps.forEach(item => { + if (item.appType === 'merchant') { + merchs.push({value: item.appId, text: item.appName}) + } else { + apps.push({value: item.appId, text: item.appName}) + } + }) } } else { if (typeof(card.openmenu) !== 'string') { @@ -509,10 +521,20 @@ key: 'wxApp', label: '鍏宠仈搴旂敤', initVal: card.wxApp || '', - tooltip: '璇峰叧鑱旀敮浠橈紙鎴栭��娆撅級鐨勫叕浼楀彿鎴栧皬绋嬪簭銆�', + tooltip: '璇峰叧鑱旀敮浠樼殑鍏紬鍙锋垨灏忕▼搴忋��', required: true, - forbid: !!appType || !window.GLOB.WXApps, - options: window.GLOB.WXApps ? window.GLOB.WXApps.map(item => ({value: item.appId, text: item.appName})) : [] + forbid: apps.length === 0, + options: apps + }, + { + type: 'select', + key: 'wxMerch', + label: '鍏宠仈鍟嗘埛', + initVal: card.wxMerch || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍟嗘埛鍙枫��', + required: true, + forbid: merchs.length === 0, + options: merchs }, { type: 'text', @@ -1764,6 +1786,19 @@ extraParam.push('dataM') } + let apps = [] + let merchs = [] + + if (window.GLOB.WXApps) { + window.GLOB.WXApps.forEach(item => { + if (item.appType === 'merchant') { + merchs.push({value: item.appId, text: item.appName}) + } else { + apps.push({value: item.appId, text: item.appName}) + } + }) + } + let forms = [ { type: 'select', @@ -1911,10 +1946,20 @@ key: 'wxApp', label: '鍏宠仈搴旂敤', initVal: card.wxApp || '', - tooltip: '璇峰叧鑱旀敮浠橈紙鎴栭��娆撅級鐨勫叕浼楀彿鎴栧皬绋嬪簭銆�', + tooltip: '璇峰叧鑱旀敮浠樼殑鍏紬鍙锋垨灏忕▼搴忋��', required: true, - forbid: !window.GLOB.WXApps, - options: window.GLOB.WXApps ? window.GLOB.WXApps.map(item => ({value: item.appId, text: item.appName})) : [] + forbid: apps.length === 0, + options: apps + }, + { + type: 'select', + key: 'wxMerch', + label: '鍏宠仈鍟嗘埛', + initVal: card.wxMerch || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍟嗘埛鍙枫��', + required: true, + forbid: merchs.length === 0, + options: merchs }, { type: 'text', diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 1c7f2bb..a3ca370 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -241,8 +241,34 @@ } else if (btn.pageTemplate === 'pay') { _name = '鏀粯' + let appId = '' + let merchId = '' + + if (btn.wxApp) { + appId = btn.wxApp + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === btn.wxApp) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈搴旂敤涓嶅湪鍙敤鍒楄〃涓紝璇烽噸鏂颁繚瀛樻寜閽厤缃紒', + duration: 5 + }) + return + } + } + if (btn.wxMerch) { + merchId = btn.wxMerch + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === btn.wxMerch) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈鍟嗘埛涓嶅湪鍙敤鍒楄〃涓紝璇烽噸鏂颁繚瀛樻寜閽厤缃紒', + duration: 5 + }) + return + } + } + if (btn.payMode === 'system' || btn.payMode === 'inner') { - this.prequest(Id, data[0] || {}) + this.prequest(Id, data[0] || {}, appId, merchId) } else { confirm({ title: '璇峰湪浠樻椤甸潰瀹屾垚璁㈠崟鏀粯銆�', @@ -259,13 +285,7 @@ }, }) - let appId = '' - - if (btn.wxApp && window.GLOB.WXApps && window.GLOB.WXApps.findIndex(item => item.appId === btn.wxApp) > -1) { - appId = btn.wxApp - } - - window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, appId: appId })))) + window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, appId, merchId })))) } } else if (btn.pageTemplate === 'custom') { let url = btn.url @@ -323,7 +343,7 @@ } } - prequest = (ID, data) => { + prequest = (ID, data, appId, merchId) => { const { btn, BID } = this.props let param = null @@ -388,13 +408,7 @@ }, }) - let appId = '' - - if (btn.wxApp && window.GLOB.WXApps && window.GLOB.WXApps.findIndex(item => item.appId === btn.wxApp) > -1) { - appId = btn.wxApp - } - - window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: id, appId: appId })))) + window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: id, appId, merchId })))) } else { this.execError(res) } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index c1320ea..9c00d6e 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2551,8 +2551,16 @@ let domain = '' let appId = window.GLOB.WXAppID || '' - if (verify.wxAppId && window.GLOB.WXApps && window.GLOB.WXApps.findIndex(item => item.appId === verify.wxAppId) > -1) { + if (verify.wxAppId && verify.wxAppId !== appId) { appId = verify.wxAppId + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === verify.wxAppId) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈鍏紬鍙蜂笉鍦ㄥ彲鐢ㄥ垪琛ㄤ腑锛岃閲嶆柊淇濆瓨鎸夐挳閰嶇疆锛�', + duration: 5 + }) + return + } } if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 7c507ab..0e90c0c 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -695,11 +695,19 @@ activeKey = 'cbScripts' } + let oriVerify = fromJS(_verify).toJS() + + if (_verify.wxAppId) { + if (!window.GLOB.WXApps || window.GLOB.WXApps.filter(app => app.appType === 'public').length === 0) { + delete _verify.wxAppId + } + } + this.setState({ activeKey: activeKey, verifyInter: verifyInter, verify: _verify, - oriVerify: fromJS(_verify).toJS() + oriVerify: oriVerify }) if (card.intertype === 'inner') return diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx index c1a2e1e..0351a5a 100644 --- a/src/views/appcheck/index.jsx +++ b/src/views/appcheck/index.jsx @@ -86,6 +86,8 @@ cell.logo = _param.logo || '' cell.wxAppId = _param.wxAppId || '' cell.wxAppName = _param.wxAppName || '' + cell.wxMerchId = _param.wxMerchId || '' + cell.wxMerchName = _param.wxMerchName || '' } return cell @@ -195,8 +197,10 @@ </Col> <Col span={12}> <div className="app-item"> - {item.wxAppName ? <div className="label">鍏宠仈鍏紬鍙�:</div> : null} - {item.wxAppName ? <div className="content">{item.wxAppName}</div> : null} + {item.wxAppName || item.wxMerchName ? <> + <div className="label">鍏宠仈搴旂敤:</div> + <div className="content">{`${item.wxAppName}${item.wxAppName && item.wxMerchName ? ' / ' + item.wxMerchName : item.wxMerchName || ''}`}</div> + </> : null} </div> </Col> <Col span={12}> diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index 910f152..4cfee37 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -487,6 +487,8 @@ cell.share_link = _param.share_link || '' // 鍒嗕韩閾炬帴 cell.wxAppId = _param.wxAppId || '' cell.wxAppName = _param.wxAppName || '' + cell.wxMerchId = _param.wxMerchId || '' + cell.wxMerchName = _param.wxMerchName || '' if (cell.adapter && (cell.adapter === 'true' || cell.adapter === 'false')) { cell.adapter = '' @@ -1039,6 +1041,10 @@ _par.wxAppId = item.wxAppId _par.wxAppName = item.wxAppName || item.wxAppId } + if (item.wxMerchId) { + _par.wxMerchId = item.wxMerchId + _par.wxMerchName = item.wxMerchName || item.wxMerchId + } return _par } @@ -1248,8 +1254,10 @@ </Col> <Col span={12}> <div className="app-item"> - {item.wxAppName ? <div className="label">鍏宠仈鍏紬鍙�:</div> : null} - {item.wxAppName ? <div className="content">{item.wxAppName}</div> : null} + {item.wxAppName || item.wxMerchName ? <> + <div className="label">鍏宠仈搴旂敤:</div> + <div className="content">{`${item.wxAppName}${item.wxAppName && item.wxMerchName ? ' / ' + item.wxMerchName : item.wxMerchName || ''}`}</div> + </> : null} </div> </Col> <Col span={12}> diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx index 0467a7c..cef73e2 100644 --- a/src/views/appmanage/submutilform/index.jsx +++ b/src/views/appmanage/submutilform/index.jsx @@ -21,7 +21,8 @@ typename: 'mob', adapters: [], exts: [], - WXApps: null + WXApps: null, + WXMerchs: null } UNSAFE_componentWillMount() { @@ -48,16 +49,22 @@ } } - let apps = null + let WXApps = null + let WXMerchs = null if (window.GLOB.WXApps) { - apps = window.GLOB.WXApps.filter(app => app.appType === 'public') + WXApps = window.GLOB.WXApps.filter(app => app.appType === 'public') - if (apps.length === 0) { - apps = null + if (WXApps.length === 0) { + WXApps = null + } + WXMerchs = window.GLOB.WXApps.filter(app => app.appType === 'merchant') + + if (WXMerchs.length === 0) { + WXMerchs = null } } - this.setState({typename, adapters, exts, langs: _langs, WXApps: apps}) + this.setState({typename, adapters, exts, langs: _langs, WXApps, WXMerchs}) } /** @@ -77,6 +84,10 @@ if (values.wxAppId) { let app = window.GLOB.WXApps.filter(app => app.appType === 'public' && values.wxAppId === app.appId)[0] values.wxAppName = app ? app.appName : values.wxAppId + } + if (values.wxMerchId) { + let app = window.GLOB.WXApps.filter(app => app.appType === 'merchant' && values.wxMerchId === app.appId)[0] + values.wxMerchName = app ? app.appName : values.wxMerchId } resolve(values) @@ -103,7 +114,7 @@ render() { const { card, type } = this.props const { getFieldDecorator } = this.props.form - const { typename, adapters, exts, langs, WXApps } = this.state + const { typename, adapters, exts, langs, WXApps, WXMerchs } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -194,9 +205,9 @@ </Col> : null} {WXApps ? <Col span={12}> <Form.Item label={ - <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ叕浼楀彿杩涜鏀粯鍙婇��娆俱��"> + <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ叕浼楀彿杩涜鏀粯銆侀��娆俱�佹巿鏉冪櫥褰曘��"> <QuestionCircleOutlined className="mk-form-tip" /> - 鍏宠仈鍏紬鍙� + 鍏宠仈搴旂敤 </Tooltip> }> {getFieldDecorator('wxAppId', { @@ -208,6 +219,22 @@ )} </Form.Item> </Col> : null} + {WXMerchs ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ晢鎴峰彿杩涜鏀粯鍙婇��娆俱��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍏宠仈鍟嗘埛 + </Tooltip> + }> + {getFieldDecorator('wxMerchId', { + initialValue: card ? card.wxMerchId : '' + })( + <Select allowClear> + {WXMerchs.map(item => <Select.Option key={item.appId} value={item.appId}>{item.appName}</Select.Option>)} + </Select> + )} + </Form.Item> + </Col> : null} {typename !== 'pc' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={12}> <Form.Item label={ <Tooltip placement="topLeft" title="鍦ㄥ叕浼楀彿鎴栧皬绋嬪簭涓紝鍙坊鍔犵粦瀹氱郴缁熺敤鎴枫�佽嚜瀹氫箟鍒嗕韩绛夊姛鑳斤紝鑷畾涔夊垎浜缃悗锛屽綋鍓嶅瓙搴旂敤灏嗛粯璁や娇鐢ㄦ鍒嗕韩閾炬帴銆�"> diff --git a/src/views/pay/index.jsx b/src/views/pay/index.jsx index 7230ba5..c3c5575 100644 --- a/src/views/pay/index.jsx +++ b/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 -- Gitblit v1.8.0