增加审核未通过修改提交资料
This commit is contained in:
@@ -5,6 +5,14 @@
|
||||
<div class="fn-flex fn-flex-column" style="min-height:100vh;">
|
||||
<div class="fn-flex-item pt30">
|
||||
<div class="box-shadow-darkGray inner10 ulib-r20 pb30">
|
||||
<van-notice-bar
|
||||
v-if="form.reason"
|
||||
style="background: rgba(255, 255, 255, 0.5);"
|
||||
wrapable
|
||||
:scrollable="false"
|
||||
>
|
||||
<span class="color-000">审核未通过原因:</span><span class="text-color-theme">{{form.reason}}</span>
|
||||
</van-notice-bar>
|
||||
<van-field label="手机号" input-align="right" v-model="form.mobile" readonly/>
|
||||
<van-field label="姓名" input-align="right" placeholder="请输入姓名" v-model="form.name" :rules="[{ required: true, message: '请输入姓名' }]"/>
|
||||
<!-- 购车城市 -->
|
||||
@@ -29,7 +37,7 @@
|
||||
|
||||
<div class="upload-box ml20 mr20">
|
||||
<van-uploader v-model="form.invoiceFile" :multiple="false" :max-count="1" accept="image/*" :after-read="onInvoiceRead">
|
||||
<template #preview-cover="{ file }">
|
||||
<template #preview-cover="{ file }" v-if="file && file.name">
|
||||
<div class="preview-cover van-ellipsis">{{ file.name }}</div>
|
||||
</template>
|
||||
<div class="fn-flex fn-flex-column fn-flex-center mt30">
|
||||
@@ -53,7 +61,7 @@
|
||||
</div>
|
||||
<div class="upload-box ml20 mr20">
|
||||
<van-uploader v-model="form.insuranceFile" :multiple="false" :max-count="1" accept="image/*" :after-read="onInsuranceRead">
|
||||
<template #preview-cover="{ file }">
|
||||
<template #preview-cover="{ file }" v-if="file && file.name">
|
||||
<div class="preview-cover van-ellipsis">{{ file.name }}</div>
|
||||
</template>
|
||||
<div class="fn-flex fn-flex-column fn-flex-center mt30">
|
||||
@@ -124,7 +132,8 @@ import { getBasicConfig } from '@/utils/basicSetting'
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
// 优惠券id
|
||||
const couponId = ref(route.params.couponId || route.query.couponId || '');
|
||||
// 获取补贴ID(从路由参数或查询参数中获取)
|
||||
const subsidyId = ref(route.params.id || route.query.id || '');
|
||||
|
||||
@@ -142,7 +151,8 @@ const form = reactive({
|
||||
invoiceFile: [],
|
||||
insuranceFile: [],
|
||||
invoiceUrl: '',
|
||||
insuranceUrl: ''
|
||||
insuranceUrl: '',
|
||||
reason: ''
|
||||
});
|
||||
|
||||
// 选择器可见性
|
||||
@@ -170,18 +180,22 @@ const rules = {
|
||||
|
||||
// 组件挂载时检查补贴ID
|
||||
onMounted( async() => {
|
||||
if (!subsidyId.value) {
|
||||
showToast('缺少补贴ID参数');
|
||||
console.warn('补贴ID未找到,请检查路由参数');
|
||||
}
|
||||
// if (!couponId.value) {
|
||||
// showToast('缺少补贴ID参数');
|
||||
// console.warn('补贴ID未找到,请检查路由参数');
|
||||
// }
|
||||
await getGuideInfo();
|
||||
await getMobile(subsidyId.value);
|
||||
if(subsidyId.value){ //编辑
|
||||
await getSubsidyInfo(subsidyId.value);
|
||||
}else{
|
||||
await getMobile(couponId.value);
|
||||
}
|
||||
});
|
||||
|
||||
// API方法定义
|
||||
const getMobile = async (subsidyId) => {
|
||||
const getMobile = async (couponId) => {
|
||||
try {
|
||||
const response = await api.get('/auto/ucenter/couponDetail', { id:subsidyId });
|
||||
const response = await api.get('/auto/ucenter/couponDetail', { id:couponId });
|
||||
if (response.code === 200) {
|
||||
form.mobile = response.data.mobile;
|
||||
}
|
||||
@@ -372,6 +386,26 @@ const submitSubsidyData = async (submitData) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改审核资料
|
||||
* @param {Object} submitData - 修改数据
|
||||
*/
|
||||
const reSubmitSubsidyData = async (submitData) => {
|
||||
try {
|
||||
const response = await api.put('/auto/subsidy', {
|
||||
...submitData
|
||||
});
|
||||
if (response.code === 200) {
|
||||
return response;
|
||||
} else {
|
||||
throw new Error(response.message || '提交失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('修改审核资料异常:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// 城市选择确认
|
||||
// const onCityConfirm = (value) => {
|
||||
// form.city = value[0];
|
||||
@@ -500,9 +534,9 @@ const onInsuranceRead = async (file) => {
|
||||
const validateForm = () => {
|
||||
const errors = [];
|
||||
|
||||
if (!subsidyId.value) {
|
||||
errors.push('缺少补贴ID');
|
||||
}
|
||||
// if (!subsidyId.value) {
|
||||
// errors.push('缺少补贴ID');
|
||||
// }
|
||||
|
||||
if (!form.cityId) {
|
||||
errors.push('请选择购车城市');
|
||||
@@ -545,9 +579,13 @@ const onSubmit = async (values) => {
|
||||
|
||||
// 显示确认弹窗
|
||||
try {
|
||||
let message = '确定要提交审核资料吗?提交后将无法修改。';
|
||||
if(subsidyId.value){
|
||||
message = '确定要修改审核资料吗?';
|
||||
}
|
||||
await showConfirmDialog({
|
||||
title: '确认提交',
|
||||
message: '确定要提交审核资料吗?提交后将无法修改。',
|
||||
message: message,
|
||||
confirmButtonText: '确定提交',
|
||||
cancelButtonText: '取消',
|
||||
});
|
||||
@@ -557,6 +595,7 @@ const onSubmit = async (values) => {
|
||||
|
||||
const submitData = {
|
||||
id: subsidyId.value,
|
||||
couponId: couponId.value,
|
||||
bizId: form.storeId,
|
||||
cityId: form.cityId,
|
||||
brandId: form.brandId,
|
||||
@@ -567,9 +606,12 @@ const onSubmit = async (values) => {
|
||||
};
|
||||
|
||||
console.log('提交参数:', submitData);
|
||||
|
||||
const result = await submitSubsidyData(submitData);
|
||||
|
||||
if(subsidyId.value){ //重新提交
|
||||
console.log('重新提交审核');
|
||||
await reSubmitSubsidyData(submitData);
|
||||
}else{
|
||||
const result = await submitSubsidyData(submitData);
|
||||
}
|
||||
showToast('提交成功!');
|
||||
|
||||
// 提交成功后跳转到我的补贴页面
|
||||
@@ -618,6 +660,19 @@ const showPopContent = (item,type=1) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 获取补贴详情
|
||||
const getSubsidyInfo = async (couponId) => {
|
||||
try {
|
||||
const response = await api.get('/auto/subsidy/detail', { id:couponId });
|
||||
if (response.code === 200) {
|
||||
console.log('补贴详情:', response.data);
|
||||
Object.assign(form, response.data);
|
||||
console.log('form表单数据:',form);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -154,7 +154,7 @@ const goLink = (index) => {
|
||||
const bindShowCode = (item) => {
|
||||
if(Number(item.btText.status)===1){
|
||||
let id = item.id;
|
||||
router.push({ path: '/my/allowance/form', query: { id } })
|
||||
router.push({ path: '/my/allowance/form', query: { couponId:id } })
|
||||
}
|
||||
// code.value = item.sid;
|
||||
// popCodeTitle.value = item.title;
|
||||
|
||||
Reference in New Issue
Block a user