feature/pay-0704-ch
ch 4 years ago
parent ae3ed669a3
commit 84db73c9b3

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-07-04 16:42:21 * @Date: 2022-07-04 16:42:21
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-07 15:51:16 * @LastEditTime: 2022-07-07 16:26:45
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -131,24 +131,27 @@
return meRules; return meRules;
}); });
const formEl = ref(); const formEl = ref(null);
store.dispatch('application/getMerchantList'); const init = () => {
store.dispatch('application/getPayType'); store.dispatch('application/getMerchantList');
onActivated(() => { store.dispatch('application/getPayType');
handlelLoadData(); form.mchInfo = {};
}); formEl.value.resetFields();
/**
* 如果是编辑需要加载初始数据加载
*/
const handlelLoadData = async () => {
let id = route.params.id; let id = route.params.id;
if (id && form.id !== id) { if (id && form.id !== id) {
let res = await store.dispatch('application/detail', id); handlelLoadDetail(id);
res.payCodes = res.payCodes.split(',');
Object.assign(form, res);
} }
}; };
onActivated(init);
/**
* 编辑加载初始数据加载
*/
const handlelLoadDetail = async (id) => {
let res = await store.dispatch('application/detail', id);
res.payCodes = res.payCodes.split(',');
Object.assign(form, res);
};
/** /**
* 切换商户时需要拿到当前商户信息用来应用判断属于哪个平台 * 切换商户时需要拿到当前商户信息用来应用判断属于哪个平台
*/ */
@ -191,8 +194,6 @@
} catch (e) {} } catch (e) {}
}; };
const handleCancel = () => { const handleCancel = () => {
Object.assign(form, defaultForm);
formEl.value.resetFields();
router.push({ name: 'PayApplication' }); router.push({ name: 'PayApplication' });
}; };
</script> </script>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-15 17:29:32 * @Date: 2022-06-15 17:29:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-06 16:46:56 * @LastEditTime: 2022-07-07 16:32:44
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -92,10 +92,13 @@
await store.dispatch('application/search', { ...state.condition }); await store.dispatch('application/search', { ...state.condition });
loading.value = false; loading.value = false;
}; };
const init = () => {
store.dispatch('application/getMerchantList');
store.dispatch('application/getPayType');
handleSearch();
};
store.dispatch('application/getMerchantList'); onActivated(init);
store.dispatch('application/getPayType');
onActivated(handleSearch);
/** /**
* 重置 * 重置
*/ */

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-07-04 16:42:21 * @Date: 2022-07-04 16:42:21
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-07 15:50:18 * @LastEditTime: 2022-07-07 16:30:11
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -62,34 +62,38 @@
const aliFormEl = ref(); const aliFormEl = ref();
const wxFormEl = ref(); const wxFormEl = ref();
store.dispatch('merchant/getMerchantPlatform'); const init = () => {
onActivated(() => { store.dispatch('merchant/getMerchantPlatform');
handlelLoadData(); formEl.value.resetFields();
}); wxFormEl.value && wxFormEl.value.resetFields();
aliFormEl.value && aliFormEl.value.resetFields();
let id = route.params.id;
if (id && form.id !== id) {
handlelLoadDetail();
}
};
onActivated(init);
/** /**
* 如果是编辑需要加载初始数据加载 * 如果是编辑需要加载初始数据加载
*/ */
const handlelLoadData = async () => { const handlelLoadDetail = async () => {
let id = route.params.id; let res = await store.dispatch('merchant/detail', id);
if (id && form.id !== id) { if (res.mchCode === 'alipay') {
let res = await store.dispatch('merchant/detail', id); const publicKey = res.aliMchData.publicKey;
if (res.mchCode === 'alipay') { if (publicKey) {
const publicKey = res.aliMchData.publicKey; res.aliMchData.hasPublicKey = publicKey;
if (publicKey) { delete res.aliMchData.publicKey;
res.aliMchData.hasPublicKey = publicKey;
delete res.aliMchData.publicKey;
}
} else {
const { apiKey, apiKeyV3, serialNo } = res.wxMchData;
res.wxMchData.hasApiKey = apiKey;
delete res.wxMchData.apiKey;
res.wxMchData.hasApiKeyV3 = apiKeyV3;
delete res.wxMchData.apiKeyV3;
res.wxMchData.hasSerialNo = serialNo;
delete res.wxMchData.serialNo;
} }
Object.assign(form, res); } else {
const { apiKey, apiKeyV3, serialNo } = res.wxMchData;
res.wxMchData.hasApiKey = apiKey;
delete res.wxMchData.apiKey;
res.wxMchData.hasApiKeyV3 = apiKeyV3;
delete res.wxMchData.apiKeyV3;
res.wxMchData.hasSerialNo = serialNo;
delete res.wxMchData.serialNo;
} }
Object.assign(form, res);
}; };
const handleSave = async () => { const handleSave = async () => {
let validate = false; let validate = false;
@ -108,10 +112,6 @@
.catch(() => {}); .catch(() => {});
}; };
const handleCancel = () => { const handleCancel = () => {
Object.assign(form, defaultForm);
wxFormEl.value && wxFormEl.value.resetFields();
aliFormEl.value && aliFormEl.value.resetFields();
formEl.value.resetFields();
router.push({ name: 'PayMerchant' }); router.push({ name: 'PayMerchant' });
}; };
</script> </script>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-15 17:29:32 * @Date: 2022-06-15 17:29:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-06 14:34:01 * @LastEditTime: 2022-07-07 16:31:04
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -72,6 +72,11 @@
const state = reactive({ const state = reactive({
condition: { ..._condition }, condition: { ..._condition },
}); });
const init = () => {
store.dispatch('merchant/getMerchantPlatform');
handleSearch();
};
onActivated(init);
/** /**
* 搜索 * 搜索
@ -82,8 +87,6 @@
loading.value = false; loading.value = false;
}; };
store.dispatch('merchant/getMerchantPlatform');
onActivated(handleSearch);
/** /**
* 重置 * 重置
*/ */

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-15 17:29:32 * @Date: 2022-06-15 17:29:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-07 14:38:28 * @LastEditTime: 2022-07-07 16:34:27
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -109,6 +109,14 @@
condition: { ..._condition }, condition: { ..._condition },
}); });
store.dispatch('payOrder/getPayType');
const init = () => {
store.dispatch('payOrder/getMerchantList');
store.dispatch('payOrder/getApplicationList');
handleSearch();
};
onActivated(init);
/** /**
* 搜索 * 搜索
*/ */
@ -123,11 +131,6 @@
await store.dispatch('payOrder/search', par); await store.dispatch('payOrder/search', par);
loading.value = false; loading.value = false;
}; };
store.dispatch('payOrder/getMerchantList');
store.dispatch('payOrder/getApplicationList');
store.dispatch('payOrder/getPayType');
onActivated(handleSearch);
/** /**
* 重置 * 重置
*/ */

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-15 17:29:32 * @Date: 2022-06-15 17:29:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-07 15:30:13 * @LastEditTime: 2022-07-07 16:33:53
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -102,6 +102,14 @@
condition: { ..._condition }, condition: { ..._condition },
}); });
store.dispatch('refundOrder/getPayType');
const init = () => {
store.dispatch('refundOrder/getMerchantList');
store.dispatch('refundOrder/getApplicationList');
handleSearch();
};
onActivated(init);
/** /**
* 搜索 * 搜索
*/ */
@ -117,10 +125,6 @@
loading.value = false; loading.value = false;
}; };
store.dispatch('refundOrder/getMerchantList');
store.dispatch('refundOrder/getApplicationList');
store.dispatch('refundOrder/getPayType');
onActivated(handleSearch);
/** /**
* 重置 * 重置
*/ */

Loading…
Cancel
Save