diff --git a/src/pages/MerchantMgm/MerchantInfo/index.scss b/src/pages/MerchantMgm/MerchantInfo/index.scss index 5cbda4a..05073c9 100644 --- a/src/pages/MerchantMgm/MerchantInfo/index.scss +++ b/src/pages/MerchantMgm/MerchantInfo/index.scss @@ -265,6 +265,9 @@ $color-primary : var(--color-primary); .form-item{ margin: 15px 0px; } + .charge-type-sel { + margin: 0; + } .form-item-address{ margin-left: 125px; } @@ -395,7 +398,7 @@ $color-primary : var(--color-primary); #modal-pay { .pay { .ant-form-item-label{ - width: 150px; + width: 186px; text-align-last: right; } .form-item{ @@ -571,7 +574,7 @@ $color-primary : var(--color-primary); flex-direction: column; .clear-wrap { - width: 300px; + width: 100%; .item { margin: 20px; @@ -579,10 +582,16 @@ $color-primary : var(--color-primary); .item-title { display: inline-block; - width: 100px; + width: 150px; text-align-last: end; white-space: nowrap; } + >.on-click-look { + // margin-left: 100px; + padding: 0 50px; + color: #177ddc; + cursor: pointer; + } } } } @@ -629,3 +638,20 @@ $color-primary : var(--color-primary); } } +.clear-account-open { + .ant-modal-body { + padding-top: 0; + .content { + padding: 0 20px; + >.item { + padding: 20px 0; + @include textEllipsis; + >.item-title { + display: inline-block; + width: 186px; + text-align: right; + } + } + } + } +} diff --git a/src/pages/MerchantMgm/MerchantInfo/loadable.jsx b/src/pages/MerchantMgm/MerchantInfo/loadable.jsx index 14cd00d..3614d71 100644 --- a/src/pages/MerchantMgm/MerchantInfo/loadable.jsx +++ b/src/pages/MerchantMgm/MerchantInfo/loadable.jsx @@ -112,6 +112,8 @@ const MerchantInfo = (props) => { const [zhiMiniVisible2, setZhiMiniVisible2] = useState(false) const [editId, setEditId] = useState(""); // 编辑是所需要的id const [companyAddress, setCompanyAddress] = useState([]); // 获取公司地址 + const [clearAccount, setClearAccount] = useState({}); // 清结算模块 + const [clearAccountOpen, setClearAccountOpen] = useState({modalOpen: false, data: {}}); // 清结算模块查看modal //表头 const columns = [ { @@ -269,26 +271,26 @@ const MerchantInfo = (props) => { const PAY = [ { label: '青岛账户', - value: 1, + value: "1", }, { label: '特约商户账户', - value: 2, + value: "2", }, { label: '独立账户', - value: 3, + value: "3", }, ] //手续费承担方 const CHARGE_TYPE = [ { label: '商户', - value: 1, + value: "1", }, { label: '青岛', - value: 2, + value: "2", }, ] //上传按钮 @@ -454,7 +456,7 @@ const MerchantInfo = (props) => { //创建商户 const createData = () => { setCreateVisible(true) - + setClearAccount({}) systemForm.setFieldsValue( { tenantName: '', @@ -481,6 +483,48 @@ const MerchantInfo = (props) => { bank_num: '' } ) + clearForm.setFieldsValue( + { + pay_type: null + } + ) + qingdaoFrom.setFieldsValue({ + sort_percent: "", + sort_cycle: "", + sell_rate: "", + charge_type: null, + sell_cycle: "" + }) + weiPayFrom.setFieldsValue({ + weChat_payid: "", + weChat_shopid: "", + wechat_aplkey: "", + wechat_private_key: "" + }) + zhiPayForm.setFieldsValue({ + zhifubao_payid: "", + zhifubao_shopid: "", + zhifubao_private_key: "", + zhifubao_public_key: "" + }) + weiMiniForm.setFieldsValue({ + wechat_public_payid: "", + wechat_public_shopid: "", + wechat_public_aplkey: "", + wechat_public_private_key: "" + }) + zhiMiniForm.setFieldsValue({ + zhifubao_life_payid: "", + zhifubao_life_shopid: "", + zhifubao_life_private_key: "", + zhifubao_life_public_key: "" + }) + weiPayForm2.setFieldsValue({ + weChat_merchant_account: "" + }) + weiMiniForm2.setFieldsValue({ + wechat_public_account: "" + }) } //关闭创建商户-点击取消 const createOncancel = () => { @@ -510,22 +554,22 @@ const MerchantInfo = (props) => { var weiPayFrom2Value = {} var weiMiniForm2Value = {} //systemForm的处理 - await systemForm.validateFields().then(async (value) => { - var start = moment(value.last_time[0]?._d).format('YYYY-MM-DD HH:mm:ss') - var end = moment(value.last_time[1]?._d).format('YYYY-MM-DD HH:mm:ss') - const { tenantName, tenantCode, tenantType, businessType } = value - systemFormValue = { tenantCode, tenantName, tenantType, businessType, start, end } - }) - //accountForm的处理 - await accountForm.validateFields().then(async (value) => { - const { companyName, city, address, connect_name, connect_phone, email } = value - accountFormValue = { companyName, city, address, connect_name, connect_phone, email } - }) - //businessForm处理 - await businessForm.validateFields().then(async (value) => { - const { bank_name, bank_address, bank_num } = value - businessFormValue = { bank_name, bank_address, bank_num } - }) + // await systemForm.validateFields().then(async (value) => { + // var start = moment(value.last_time[0]?._d).format('YYYY-MM-DD HH:mm:ss') + // var end = moment(value.last_time[1]?._d).format('YYYY-MM-DD HH:mm:ss') + // const { tenantName, tenantCode, tenantType, businessType } = value + // systemFormValue = { tenantCode, tenantName, tenantType, businessType, start, end } + // }) + // //accountForm的处理 + // await accountForm.validateFields().then(async (value) => { + // const { companyName, city, address, connect_name, connect_phone, email } = value + // accountFormValue = { companyName, city, address, connect_name, connect_phone, email } + // }) + // //businessForm处理 + // await businessForm.validateFields().then(async (value) => { + // const { bank_name, bank_address, bank_num } = value + // businessFormValue = { bank_name, bank_address, bank_num } + // }) //clearForm处理 await clearForm.validateFields().then(async (value) => { const { pay_type } = value @@ -541,47 +585,95 @@ const MerchantInfo = (props) => { if (singleVisible) { //weipayform的处理 await weiPayFrom.validateFields().then(async (value) => { - const { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } = value - weiPayFromValue = { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } + if(JSON.stringify(value) != "{}") { + const { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } = value + weiPayFromValue = { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } + } else { + const { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } = clearAccount + weiPayFromValue = { weChat_payid, weChat_shopid, wechat_aplkey, wechat_private_key } + } }) //zhiPayForm的处理 await zhiPayForm.validateFields().then(async (value) => { - const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value - zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + if(JSON.stringify(value) != "{}") { + const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value + zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + } else { + const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = clearAccount + zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + } }) //weiMiniForm的处理 await weiMiniForm.validateFields().then(async (value) => { - const { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } = value - weiMiniFormValue = { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } + if(JSON.stringify(value) != "{}") { + const { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } = value + weiMiniFormValue = { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } + } else { + const { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } = clearAccount + weiMiniFormValue = { wechat_public_payid, wechat_public_shopid, wechat_public_aplkey, wechat_public_private_key } + } }) //zhiMiniForm的处理 await zhiMiniForm.validateFields().then(async (value) => { - const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value - zhiMiniFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + if(JSON.stringify(value) != "{}") { + const { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } = value + zhiMiniFormValue = { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } + } else { + const { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } = clearAccount + zhiMiniFormValue = { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } + } }) + if(JSON.stringify(weiPayFromValue) == "{}") return message.error("App(微信支付)未配置!") + if(JSON.stringify(zhiPayFormValue) == "{}") return message.error("App(支付宝支付)未配置!") + if(JSON.stringify(weiMiniFormValue) == "{}") return message.error("微信公众号及小程序未配置!") + if(JSON.stringify(zhiMiniFormValue) == "{}") return message.error("支付宝生活号及小程序未配置!") } if (specialVisible) { //weiPayform2的处理 await weiPayForm2.validateFields().then(async (value) => { - const { weChat_merchant_account } = value - weiPayFrom2Value = { weChat_merchant_account } + if(JSON.stringify(value) != "{}") { + const { weChat_merchant_account } = value + weiPayFrom2Value = { weChat_merchant_account } + } else { + const { weChat_merchant_account } = clearAccount + weiPayFrom2Value = { weChat_merchant_account } + } }) //zhiPayForm的处理 await zhiPayForm.validateFields().then(async (value) => { - const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value - zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + if(JSON.stringify(value) != "{}") { + const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value + zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + } else { + const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = clearAccount + zhiPayFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + } }) //weiMiniForm的处理 await weiMiniForm2.validateFields().then(async (value) => { - const { wechat_public_account } = value - weiMiniForm2Value = { wechat_public_account } + if(JSON.stringify(value) != "{}") { + const { wechat_public_account } = value + weiMiniForm2Value = { wechat_public_account } + } else { + const { wechat_public_account } = clearAccount + weiMiniForm2Value = { wechat_public_account } + } }) //zhiMiniForm的处理 await zhiMiniForm.validateFields().then(async (value) => { - const { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } = value - zhiMiniFormValue = { zhifubao_payid, zhifubao_shopid, zhifubao_private_key, zhifubao_public_key } + if(JSON.stringify(value) != "{}") { + const { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } = value + zhiMiniFormValue = { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } + } else { + const { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } = clearAccount + zhiMiniFormValue = { zhifubao_life_payid, zhifubao_life_shopid, zhifubao_life_private_key, zhifubao_life_public_key } + } }) - } + if(JSON.stringify(weiPayFrom2Value) == "{}") return message.error("App(微信支付)未配置!") + if(JSON.stringify(zhiPayFormValue) == "{}") return message.error("APP(支付宝支付)未配置!") + if(JSON.stringify(weiMiniForm2Value) == "{}") return message.error("微信公众号及小程序未配置!") + if(JSON.stringify(zhiMiniFormValue) == "{}") return message.error("支付宝生活号及小程序未配置!") + } const data = editId ? {...systemFormValue, ...accountFormValue, ...businessFormValue,...clearFormValue, ...qingdaoFormValue, ...weiPayFromValue, ...zhiPayFormValue, ...weiMiniFormValue, ...zhiMiniFormValue, ...weiPayFrom2Value, ...weiMiniForm2Value, business_license: imgList, id: editId, uid} @@ -657,6 +749,101 @@ const MerchantInfo = (props) => { bank_num: res?.data?.bank_num || "" } ) + clearForm.setFieldsValue({ + pay_type: res?.data?.pay_type || "" + }) + if (res?.data?.pay_type == 1) { + setQingDaoVisible(true) + setSpecialVisible(false) + setSingleVisible(false) + qingdaoFrom.setFieldsValue({ + sort_percent: res?.data?.sort_percent || "", + sort_cycle: res?.data?.sort_cycle || "", + sell_rate: res?.data?.sell_rate || "", + charge_type: res?.data?.charge_type || "", + sell_cycle: res?.data?.sell_cycle || "", + }) + } else if (res?.data?.pay_type == 2) { + setSpecialVisible(true) + setQingDaoVisible(false) + setSingleVisible(false) + weiPayForm2.setFieldsValue({ + weChat_merchant_account: res?.data?.wechat_merchant_account || "", + }) + zhiPayForm.setFieldsValue({ + zhifubao_payid: res?.data?.zhifubao_payid || "", + zhifubao_shopid: res?.data?.zhifubao_shopid || "", + zhifubao_private_key: res?.data?.zhifubao_private_key || "", + zhifubao_public_key: res?.data?.zhifubao_public_key || "", + }) + weiMiniForm2.setFieldsValue({ + wechat_public_account: res?.data?.wechat_public_account || "", + }) + zhiMiniForm.setFieldsValue({ + zhifubao_life_payid: res?.data?.zhifubao_life_payid || "", + zhifubao_life_shopid: res?.data?.zhifubao_life_shopid || "", + zhifubao_life_private_key: res?.data?.zhifubao_life_private_key || "", + zhifubao_life_public_key: res?.data?.zhifubao_life_public_key || "", + }) + setClearAccount({ + weChat_merchant_account: res?.data?.wechat_merchant_account || "", + zhifubao_payid: res?.data?.zhifubao_payid || "", + zhifubao_shopid: res?.data?.zhifubao_shopid || "", + zhifubao_private_key: res?.data?.zhifubao_private_key || "", + zhifubao_public_key: res?.data?.zhifubao_public_key || "", + wechat_public_account: res?.data?.wechat_public_account || "", + zhifubao_life_payid: res?.data?.zhifubao_life_payid || "", + zhifubao_life_shopid: res?.data?.zhifubao_life_shopid || "", + zhifubao_life_private_key: res?.data?.zhifubao_life_private_key || "", + zhifubao_life_public_key: res?.data?.zhifubao_life_public_key || "" + }) + } else if(res?.data?.pay_type == 3) { + setSingleVisible(true) + setQingDaoVisible(false) + setSpecialVisible(false) + weiPayFrom.setFieldsValue({ + weChat_payid: res?.data?.wechat_payid || "", + weChat_shopid: res?.data?.wechat_shopid || "", + wechat_aplkey: res?.data?.wechat_aplkey || "", + wechat_private_key: res?.data?.wechat_private_key || "", + }) + zhiPayForm.setFieldsValue({ + zhifubao_payid: res?.data?.zhifubao_payid || "", + zhifubao_shopid: res?.data?.zhifubao_shopid || "", + zhifubao_private_key: res?.data?.zhifubao_private_key || "", + zhifubao_public_key: res?.data?.zhifubao_public_key || "", + }) + weiMiniForm.setFieldsValue({ + wechat_public_payid: res?.data?.wechat_public_payid || "", + wechat_public_shopid: res?.data?.wechat_public_shopid || "", + wechat_public_aplkey: res?.data?.wechat_public_aplkey || "", + wechat_public_private_key: res?.data?.wechat_public_private_key || "", + }) + zhiMiniForm.setFieldsValue({ + zhifubao_life_payid: res?.data?.zhifubao_life_payid || "", + zhifubao_life_shopid: res?.data?.zhifubao_life_shopid || "", + zhifubao_life_private_key: res?.data?.zhifubao_life_private_key || "", + zhifubao_life_public_key: res?.data?.zhifubao_life_public_key || "", + }) + setClearAccount({ + weChat_payid: res?.data?.wechat_payid || "", + weChat_shopid: res?.data?.wechat_shopid || "", + wechat_aplkey: res?.data?.wechat_aplkey || "", + wechat_private_key: res?.data?.wechat_private_key || "", + zhifubao_payid: res?.data?.zhifubao_payid || "", + zhifubao_shopid: res?.data?.zhifubao_shopid || "", + zhifubao_private_key: res?.data?.zhifubao_private_key || "", + zhifubao_public_key: res?.data?.zhifubao_public_key || "", + wechat_public_payid: res?.data?.wechat_public_payid || "", + wechat_public_shopid: res?.data?.wechat_public_shopid || "", + wechat_public_aplkey: res?.data?.wechat_public_aplkey || "", + wechat_public_private_key: res?.data?.wechat_public_private_key || "", + zhifubao_life_payid: res?.data?.zhifubao_life_payid || "", + zhifubao_life_shopid: res?.data?.zhifubao_life_shopid || "", + zhifubao_life_private_key: res?.data?.zhifubao_life_private_key || "", + zhifubao_life_public_key: res?.data?.zhifubao_life_public_key || "", + }) + } setFileList(res?.data?.business_license? res?.data?.business_license : []) setImgList(res?.data?.business_license? res?.data?.business_license : []) } else { @@ -684,6 +871,74 @@ const MerchantInfo = (props) => { err => { console.log(err); } ) } + // 清结算模块查看按钮 + const $clearAccountLook = (value, title) => { + if(value?.pay_type == 2 || value?.pay_type == 3) { + setClearAccountOpen({modalOpen: true, data: value || {}, title}) + } + } + // 清结算模块查看详情 + const $clearAccountDetail = (value) => { + let tem = ""; + // pay_type 2: 特约商户账户 3: 独立账户 + // APP微信支付 + let wxApp = + value?.data?.pay_type == 2 ? + <> +