|
|
@@ -95,6 +95,69 @@
|
|
|
</el-row>
|
|
|
</template>
|
|
|
</el-form>
|
|
|
+
|
|
|
+ <!-- 入驻材料 -->
|
|
|
+ <el-divider content-position="left">入驻材料</el-divider>
|
|
|
+ <el-form
|
|
|
+ ref="materialFormRef"
|
|
|
+ :model="materialForm"
|
|
|
+ :rules="materialRules"
|
|
|
+ label-suffix=":"
|
|
|
+ label-width="auto"
|
|
|
+ label-position="right"
|
|
|
+ >
|
|
|
+ <el-form-item label="营业执照" prop="business_license">
|
|
|
+ <SingleImageUpload
|
|
|
+ v-model="materialForm.business_license"
|
|
|
+ accept="image/*"
|
|
|
+ :max-file-size="5"
|
|
|
+ :show-tip="true"
|
|
|
+ tip-text="支持 jpg/png 格式,文件大小不超过 5MB"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="业务场景描述" prop="business_scenario">
|
|
|
+ <el-input
|
|
|
+ v-model="materialForm.business_scenario"
|
|
|
+ type="textarea"
|
|
|
+ :rows="4"
|
|
|
+ placeholder="请描述企业的业务场景"
|
|
|
+ maxlength="2000"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="业务上下游合同" prop="business_contracts">
|
|
|
+ <el-upload
|
|
|
+ ref="contractUploadRef"
|
|
|
+ v-model:file-list="contractFileList"
|
|
|
+ action="#"
|
|
|
+ :accept="'.pdf,.doc,.docx,.jpg,.jpeg,.png'"
|
|
|
+ :before-upload="handleContractBeforeUpload"
|
|
|
+ :http-request="handleContractUpload"
|
|
|
+ :on-remove="handleContractRemove"
|
|
|
+ :limit="10"
|
|
|
+ multiple
|
|
|
+ drag
|
|
|
+ >
|
|
|
+ <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
|
|
|
+ <div class="el-upload__text">拖拽文件到此处或 <em>点击上传</em></div>
|
|
|
+ <template #tip>
|
|
|
+ <div class="el-upload__tip">支持 pdf/doc/docx/jpg/png,单个不超过10MB,最多10个文件</div>
|
|
|
+ </template>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="法人手持身份证" prop="legal_rep_id_photo">
|
|
|
+ <SingleImageUpload
|
|
|
+ v-model="materialForm.legal_rep_id_photo"
|
|
|
+ accept="image/*"
|
|
|
+ :max-file-size="5"
|
|
|
+ :show-tip="true"
|
|
|
+ tip-text="支持 jpg/png 格式,文件大小不超过 5MB"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -104,9 +167,13 @@ import {
|
|
|
} from "@/api/module_payment/enterprise";
|
|
|
import EnterpriseAPI from "@/api/module_payment/enterprise";
|
|
|
import ProviderAPI, { type ServiceProviderOption } from "@/api/module_system/service_provider";
|
|
|
+import ParamsAPI from "@/api/module_system/params";
|
|
|
+import SingleImageUpload from "@/components/Upload/SingleImageUpload.vue";
|
|
|
+import { UploadFilled } from "@element-plus/icons-vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { computed, onMounted, reactive, ref, watch } from "vue";
|
|
|
import { useLoadingAction } from "@/composables/useLoadingAction";
|
|
|
+import type { UploadRawFile, UploadRequestOptions, UploadUserFile } from "element-plus";
|
|
|
|
|
|
interface Props {
|
|
|
type: "apply" | "update";
|
|
|
@@ -182,12 +249,103 @@ watch(
|
|
|
formData.alipay_id_type = 'openid';
|
|
|
formData.identity = data.identity_open_id;
|
|
|
}
|
|
|
+ // 回显入驻材料
|
|
|
+ materialForm.business_license = data.business_license || "";
|
|
|
+ materialForm.business_scenario = data.business_scenario || "";
|
|
|
+ materialForm.legal_rep_id_photo = data.legal_rep_id_photo || "";
|
|
|
+ if (data.business_contracts) {
|
|
|
+ try {
|
|
|
+ const contracts = typeof data.business_contracts === "string"
|
|
|
+ ? JSON.parse(data.business_contracts)
|
|
|
+ : data.business_contracts;
|
|
|
+ contractFileList.value = (contracts as any[]).map((url: string, i: number) => ({
|
|
|
+ name: url.split("/").pop() || `contract_${i + 1}`,
|
|
|
+ url,
|
|
|
+ }));
|
|
|
+ } catch { /* ignore parse error */ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
);
|
|
|
|
|
|
+// ---------- 入驻材料 ----------
|
|
|
+const materialFormRef = ref();
|
|
|
+const contractUploadRef = ref();
|
|
|
+const materialForm = reactive({
|
|
|
+ business_license: "",
|
|
|
+ business_scenario: "",
|
|
|
+ business_contracts: "",
|
|
|
+ legal_rep_id_photo: "",
|
|
|
+});
|
|
|
+
|
|
|
+const materialRules = reactive({
|
|
|
+ business_license: [{ required: true, message: "请上传营业执照", trigger: "change" }],
|
|
|
+ business_scenario: [
|
|
|
+ { required: true, message: "请输入业务场景描述", trigger: "blur" },
|
|
|
+ { max: 2000, message: "不超过2000字", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ business_contracts: [{ required: true, message: "请上传业务上下游合同", trigger: "change" }],
|
|
|
+ legal_rep_id_photo: [{ required: true, message: "请上传法人手持身份证照片", trigger: "change" }],
|
|
|
+});
|
|
|
+
|
|
|
+const contractFileList = ref<UploadUserFile[]>([]);
|
|
|
+
|
|
|
+function handleContractBeforeUpload(file: UploadRawFile) {
|
|
|
+ const allowed = [".pdf", ".doc", ".docx", ".jpg", ".jpeg", ".png"];
|
|
|
+ const ext = "." + file.name.split(".").pop()?.toLowerCase();
|
|
|
+ if (!allowed.includes(ext)) {
|
|
|
+ ElMessage.warning("合同文件仅支持 pdf/doc/docx/jpg/png 格式");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (file.size > 10 * 1024 * 1024) {
|
|
|
+ ElMessage.warning("单个文件不能超过10MB");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+async function handleContractUpload(options: UploadRequestOptions) {
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append("file", options.file);
|
|
|
+ try {
|
|
|
+ const res = await ParamsAPI.uploadFile(formData);
|
|
|
+ if (res.data.code === 0 && res.data.data) {
|
|
|
+ const fileInfo = res.data.data;
|
|
|
+ // 替换 el-upload 已添加的条目,避免 push 导致重复
|
|
|
+ const idx = contractFileList.value.findIndex((f: any) => f.uid === options.file.uid);
|
|
|
+ const entry: any = {
|
|
|
+ name: fileInfo.file_name,
|
|
|
+ url: fileInfo.file_url,
|
|
|
+ status: "success",
|
|
|
+ };
|
|
|
+ if (idx >= 0) {
|
|
|
+ contractFileList.value[idx] = entry;
|
|
|
+ } else {
|
|
|
+ contractFileList.value.push(entry);
|
|
|
+ }
|
|
|
+ materialForm.business_contracts = JSON.stringify(
|
|
|
+ contractFileList.value.map((f: any) => f.url).filter(Boolean)
|
|
|
+ );
|
|
|
+ options.onSuccess(res.data);
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.data.msg || "上传失败");
|
|
|
+ options.onError(res.data as any);
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ ElMessage.error("合同上传失败");
|
|
|
+ options.onError(e as any);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function handleContractRemove(_file: UploadUserFile, fileList: UploadUserFile[]) {
|
|
|
+ contractFileList.value = fileList;
|
|
|
+ materialForm.business_contracts = JSON.stringify(
|
|
|
+ fileList.map((f) => f.url).filter(Boolean)
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
const identityLabel = computed(() => {
|
|
|
const map: Record<string, string> = {
|
|
|
ALIPAY_USER_ID: "支付宝uid",
|
|
|
@@ -254,10 +412,16 @@ async function submitForm() {
|
|
|
const valid = await dataFormRef.value?.validate().catch(() => false);
|
|
|
if (!valid || isSubmitting.value) return;
|
|
|
|
|
|
+ // 仅 apply 类型校验入驻材料
|
|
|
+ if (props.type === "apply") {
|
|
|
+ const materialValid = await materialFormRef.value?.validate().catch(() => false);
|
|
|
+ if (!materialValid) return;
|
|
|
+ }
|
|
|
+
|
|
|
isSubmitting.value = true;
|
|
|
|
|
|
try {
|
|
|
- const submitData: { identity_type: string; identity?: string; identity_open_id?: string; service_provider_id?: number | null; scope_label?: string } = {
|
|
|
+ const submitData: Record<string, any> = {
|
|
|
identity_type: formData.identity_type,
|
|
|
identity: undefined,
|
|
|
identity_open_id: undefined,
|
|
|
@@ -265,6 +429,14 @@ async function submitForm() {
|
|
|
scope_label: formData.scope_label,
|
|
|
};
|
|
|
|
|
|
+ // 入驻材料
|
|
|
+ if (props.type === "apply") {
|
|
|
+ submitData.business_license = materialForm.business_license;
|
|
|
+ submitData.business_scenario = materialForm.business_scenario;
|
|
|
+ submitData.business_contracts = materialForm.business_contracts;
|
|
|
+ submitData.legal_rep_id_photo = materialForm.legal_rep_id_photo;
|
|
|
+ }
|
|
|
+
|
|
|
// 根据ID类型设置相应的字段
|
|
|
if (formData.identity_type === 'ALIPAY_USER_ID') {
|
|
|
if (formData.alipay_id_type === 'uid') {
|
|
|
@@ -305,6 +477,14 @@ async function submitForm() {
|
|
|
function resetForm() {
|
|
|
Object.assign(formData, JSON.parse(JSON.stringify(initialFormData)));
|
|
|
dataFormRef.value?.resetFields();
|
|
|
+ Object.assign(materialForm, {
|
|
|
+ business_license: "",
|
|
|
+ business_scenario: "",
|
|
|
+ business_contracts: "",
|
|
|
+ legal_rep_id_photo: "",
|
|
|
+ });
|
|
|
+ contractFileList.value = [];
|
|
|
+ materialFormRef.value?.resetFields();
|
|
|
}
|
|
|
|
|
|
defineExpose({
|