|
|
@ -132,11 +132,10 @@ Page({ |
|
|
// 检查是否有保存的表单数据
|
|
|
// 检查是否有保存的表单数据
|
|
|
const savedProgress = wx.getStorageSync('settlement_data'); |
|
|
const savedProgress = wx.getStorageSync('settlement_data'); |
|
|
if (savedProgress) { |
|
|
if (savedProgress) { |
|
|
console.log('发现保存的表单数据,恢复表单数据并自动提交申请'); |
|
|
console.log('发现保存的表单数据,恢复表单数据'); |
|
|
// 恢复表单数据
|
|
|
// 恢复表单数据
|
|
|
this.loadSettlementProgress(); |
|
|
this.loadSettlementProgress(); |
|
|
// 自动提交申请
|
|
|
// 不再自动提交申请,避免重复提交
|
|
|
this.submitApplication(); |
|
|
|
|
|
} |
|
|
} |
|
|
}, 500); |
|
|
}, 500); |
|
|
} |
|
|
} |
|
|
@ -208,6 +207,12 @@ Page({ |
|
|
console.log('清除入驻进度'); |
|
|
console.log('清除入驻进度'); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
saveFormData() { |
|
|
|
|
|
this.saveSettlementProgress(); |
|
|
|
|
|
console.log('表单数据已实时保存'); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 更新全局入驻状态
|
|
|
// 更新全局入驻状态
|
|
|
updateGlobalSettlementStatus(status) { |
|
|
updateGlobalSettlementStatus(status) { |
|
|
// 可以在这里调用全局状态管理
|
|
|
// 可以在这里调用全局状态管理
|
|
|
@ -351,6 +356,8 @@ Page({ |
|
|
collaborationid: identity, // 使用数据库字段名
|
|
|
collaborationid: identity, // 使用数据库字段名
|
|
|
showIdentityError: false |
|
|
showIdentityError: false |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 公司名称输入(带实时验证)
|
|
|
// 公司名称输入(带实时验证)
|
|
|
@ -374,6 +381,8 @@ Page({ |
|
|
showCompanyNameError: showError, |
|
|
showCompanyNameError: showError, |
|
|
companyNameError: errorMessage |
|
|
companyNameError: errorMessage |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 公司名称获得焦点
|
|
|
// 公司名称获得焦点
|
|
|
@ -419,6 +428,8 @@ Page({ |
|
|
showRegionError: showError, |
|
|
showRegionError: showError, |
|
|
regionError: errorMessage |
|
|
regionError: errorMessage |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 详细地址输入(带实时验证)
|
|
|
// 详细地址输入(带实时验证)
|
|
|
@ -439,6 +450,8 @@ Page({ |
|
|
showDetailedAddressError: showError, |
|
|
showDetailedAddressError: showError, |
|
|
detailedAddressError: errorMessage |
|
|
detailedAddressError: errorMessage |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 详细地址获得焦点
|
|
|
// 详细地址获得焦点
|
|
|
@ -508,6 +521,8 @@ Page({ |
|
|
currentCooperationDetail: null, |
|
|
currentCooperationDetail: null, |
|
|
pendingCooperationValue: '' |
|
|
pendingCooperationValue: '' |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 选择合作模式(内部调用,带验证)
|
|
|
// 选择合作模式(内部调用,带验证)
|
|
|
@ -519,6 +534,8 @@ Page({ |
|
|
showCooperationError: false, |
|
|
showCooperationError: false, |
|
|
cooperationError: '' |
|
|
cooperationError: '' |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 上传LICENSE
|
|
|
// 上传LICENSE
|
|
|
@ -535,6 +552,8 @@ Page({ |
|
|
name: `营业执照_${new Date().getTime()}.jpg` |
|
|
name: `营业执照_${new Date().getTime()}.jpg` |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@ -542,6 +561,8 @@ Page({ |
|
|
// 删除LICENSE
|
|
|
// 删除LICENSE
|
|
|
deleteBusinessLicense() { |
|
|
deleteBusinessLicense() { |
|
|
this.setData({ businesslicenseurl: null }); // 使用数据库字段名
|
|
|
this.setData({ businesslicenseurl: null }); // 使用数据库字段名
|
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 上传动物检疫合格证明
|
|
|
// 上传动物检疫合格证明
|
|
|
@ -558,6 +579,8 @@ Page({ |
|
|
name: `动物检疫合格证明_${new Date().getTime()}.jpg` |
|
|
name: `动物检疫合格证明_${new Date().getTime()}.jpg` |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@ -565,6 +588,8 @@ Page({ |
|
|
// 删除动物检疫合格证明
|
|
|
// 删除动物检疫合格证明
|
|
|
deleteAnimalQuarantine() { |
|
|
deleteAnimalQuarantine() { |
|
|
this.setData({ proofurl: null }); // 使用数据库字段名
|
|
|
this.setData({ proofurl: null }); // 使用数据库字段名
|
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 上传法人身份证
|
|
|
// 上传法人身份证
|
|
|
@ -581,6 +606,8 @@ Page({ |
|
|
name: `法人身份证_${new Date().getTime()}.jpg` |
|
|
name: `法人身份证_${new Date().getTime()}.jpg` |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@ -588,6 +615,8 @@ Page({ |
|
|
// 删除法人身份证
|
|
|
// 删除法人身份证
|
|
|
deleteIdCard() { |
|
|
deleteIdCard() { |
|
|
this.setData({ proofurl: null }); // 使用与动物检疫合格证明相同的字段名
|
|
|
this.setData({ proofurl: null }); // 使用与动物检疫合格证明相同的字段名
|
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 上传品牌授权链文件
|
|
|
// 上传品牌授权链文件
|
|
|
@ -604,6 +633,8 @@ Page({ |
|
|
name: `品牌授权链_${new Date().getTime()}.jpg` |
|
|
name: `品牌授权链_${new Date().getTime()}.jpg` |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@ -611,6 +642,8 @@ Page({ |
|
|
// 删除品牌授权链文件
|
|
|
// 删除品牌授权链文件
|
|
|
deleteBrandAuth() { |
|
|
deleteBrandAuth() { |
|
|
this.setData({ brandurl: null }); // 使用数据库字段名
|
|
|
this.setData({ brandurl: null }); // 使用数据库字段名
|
|
|
|
|
|
// 实时保存表单数据
|
|
|
|
|
|
this.saveFormData(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 获取文件类型显示名称
|
|
|
// 获取文件类型显示名称
|
|
|
@ -652,15 +685,19 @@ Page({ |
|
|
|
|
|
|
|
|
// 提交申请
|
|
|
// 提交申请
|
|
|
async submitApplication() { |
|
|
async submitApplication() { |
|
|
// 检查用户是否已登录
|
|
|
console.log('===== 开始提交入驻申请 ====='); |
|
|
|
|
|
|
|
|
|
|
|
// 第一步:保存当前表单数据(确保数据不丢失)
|
|
|
|
|
|
this.saveSettlementProgress(); |
|
|
|
|
|
console.log('表单数据已保存到本地存储'); |
|
|
|
|
|
|
|
|
|
|
|
// 第二步:检查用户是否已登录
|
|
|
const openid = wx.getStorageSync('openid'); |
|
|
const openid = wx.getStorageSync('openid'); |
|
|
const userId = wx.getStorageSync('userId'); |
|
|
const userId = wx.getStorageSync('userId'); |
|
|
|
|
|
|
|
|
// 如果未登录,显示登录弹窗
|
|
|
// 如果未登录,显示登录弹窗
|
|
|
if (!openid || !userId) { |
|
|
if (!openid || !userId) { |
|
|
console.log('用户未登录,显示授权弹窗'); |
|
|
console.log('用户未登录,显示授权弹窗'); |
|
|
// 保存当前表单数据
|
|
|
|
|
|
this.saveSettlementProgress(); |
|
|
|
|
|
// 显示一键登录弹窗
|
|
|
// 显示一键登录弹窗
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showOneKeyLoginModal: true |
|
|
showOneKeyLoginModal: true |
|
|
@ -670,7 +707,11 @@ Page({ |
|
|
|
|
|
|
|
|
console.log('使用已登录用户信息提交申请:', openid, userId); |
|
|
console.log('使用已登录用户信息提交申请:', openid, userId); |
|
|
|
|
|
|
|
|
// 先上传所有文件
|
|
|
// 第三步:重新加载最新数据(确保使用最新的表单数据)
|
|
|
|
|
|
this.loadSettlementProgress(); |
|
|
|
|
|
console.log('提交前重新加载数据完成'); |
|
|
|
|
|
|
|
|
|
|
|
// 第四步:先上传所有文件
|
|
|
wx.showLoading({ |
|
|
wx.showLoading({ |
|
|
title: '正在上传文件...', |
|
|
title: '正在上传文件...', |
|
|
mask: true |
|
|
mask: true |
|
|
@ -717,15 +758,13 @@ Page({ |
|
|
wx.hideLoading(); |
|
|
wx.hideLoading(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 准备提交数据(与后端API要求的字段名匹配)
|
|
|
// 第五步:准备提交数据
|
|
|
// 尝试多种方式获取手机号,确保contactPhone不为空
|
|
|
// 尝试多种方式获取手机号
|
|
|
// 1. 先尝试直接获取常见的手机号存储键
|
|
|
|
|
|
let contactPhone = wx.getStorageSync('phone') || |
|
|
let contactPhone = wx.getStorageSync('phone') || |
|
|
wx.getStorageSync('userPhone') || |
|
|
wx.getStorageSync('userPhone') || |
|
|
wx.getStorageSync('mobile') || |
|
|
wx.getStorageSync('mobile') || |
|
|
''; |
|
|
''; |
|
|
|
|
|
|
|
|
// 2. 如果上述方式没获取到,尝试从userInfo对象中获取
|
|
|
|
|
|
if (!contactPhone) { |
|
|
if (!contactPhone) { |
|
|
const userInfo = wx.getStorageSync('userInfo'); |
|
|
const userInfo = wx.getStorageSync('userInfo'); |
|
|
if (userInfo && userInfo.phoneNumber && userInfo.phoneNumber !== '未绑定') { |
|
|
if (userInfo && userInfo.phoneNumber && userInfo.phoneNumber !== '未绑定') { |
|
|
@ -735,154 +774,85 @@ Page({ |
|
|
|
|
|
|
|
|
console.log('最终获取到的手机号:', contactPhone); |
|
|
console.log('最终获取到的手机号:', contactPhone); |
|
|
|
|
|
|
|
|
// 根据后端API要求构建submitData对象(使用独立的省市区字段)
|
|
|
// 手机号为空时使用默认值
|
|
|
|
|
|
if (!contactPhone) { |
|
|
|
|
|
contactPhone = 'default_phone'; |
|
|
|
|
|
console.log('使用默认手机号:', contactPhone); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 构建submitData对象(使用最新的表单数据)
|
|
|
const submitData = { |
|
|
const submitData = { |
|
|
openid: openid, |
|
|
openid: openid, |
|
|
collaborationid: this.data.collaborationid, // 合作商身份ID
|
|
|
collaborationid: this.data.collaborationid, |
|
|
company: this.data.company || '', // 客户公司名称
|
|
|
company: this.data.company || '', |
|
|
province: this.data.province, // 省份
|
|
|
province: this.data.province, |
|
|
city: this.data.city, // 城市
|
|
|
city: this.data.city, |
|
|
district: this.data.district, // 区县
|
|
|
district: this.data.district, |
|
|
detailedaddress: this.data.detailedaddress || '', // 详细地址(即使为空也要传递)
|
|
|
detailedaddress: this.data.detailedaddress || '', |
|
|
cooperation: this.data.cooperation === '货源委托' ? 'wholesale' : this.data.cooperation, // 合作模式映射为后端期望的值
|
|
|
cooperation: this.data.cooperation === '货源委托' ? 'wholesale' : this.data.cooperation, |
|
|
phoneNumber: contactPhone, // 后端期望的字段名是phoneNumber
|
|
|
phoneNumber: contactPhone, |
|
|
businesslicenseurl: uploadedFiles.businessLicenseFile || '', // 营业执照URL
|
|
|
businesslicenseurl: uploadedFiles.businessLicenseFile || '', |
|
|
proofurl: uploadedFiles.animalQuarantineFile || '', // 动物检疫证明或法人身份证URL(两者共用一个字段)
|
|
|
proofurl: uploadedFiles.animalQuarantineFile || '', |
|
|
brandurl: uploadedFiles.brandAuthFile || '', // 品牌授权链URL
|
|
|
brandurl: uploadedFiles.brandAuthFile || '', |
|
|
userId: userId |
|
|
userId: userId |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 特别记录详细地址字段,确保它被正确提交
|
|
|
// 详细日志记录
|
|
|
console.log('详细地址字段值:', submitData.detailedaddress); |
|
|
console.log('===== 提交数据详细信息 ====='); |
|
|
console.log('详细地址字段类型:', typeof submitData.detailedaddress); |
|
|
console.log('公司名称:', submitData.company); |
|
|
console.log('详细地址字段是否存在:', 'detailedaddress' in submitData); |
|
|
console.log('合作商身份:', submitData.collaborationid); |
|
|
|
|
|
console.log('合作模式:', submitData.cooperation); |
|
|
// 记录省市区字段内容
|
|
|
console.log('详细地址:', submitData.detailedaddress); |
|
|
console.log('省市区字段内容(提交数据):', submitData.province, submitData.city, submitData.district); |
|
|
console.log('省市区:', submitData.province, submitData.city, submitData.district); |
|
|
|
|
|
console.log('手机号:', submitData.phoneNumber); |
|
|
|
|
|
console.log('营业执照URL:', submitData.businesslicenseurl); |
|
|
|
|
|
console.log('资质文件URL:', submitData.proofurl); |
|
|
|
|
|
console.log('============================='); |
|
|
|
|
|
|
|
|
// 保存提交数据到本地存储,供首页检查使用
|
|
|
// 保存提交数据到本地存储,供首页检查使用
|
|
|
wx.setStorageSync('preSubmitData', submitData); |
|
|
wx.setStorageSync('preSubmitData', submitData); |
|
|
console.log('已保存preSubmitData:', submitData); |
|
|
console.log('已保存preSubmitData:', submitData); |
|
|
|
|
|
|
|
|
// 检查必填字段是否为空
|
|
|
// 第六步:严格的表单验证
|
|
|
console.log('提交数据检查 - contactPhone:', contactPhone); |
|
|
console.log('开始表单验证'); |
|
|
console.log('提交数据检查 - identityType:', this.data.collaborationid); |
|
|
|
|
|
console.log('提交数据检查 - cooperationMode:', this.data.cooperation); |
|
|
// 检查必填字段
|
|
|
console.log('提交数据检查 - cooperationValue:', submitData.cooperation); // 检查映射后的值
|
|
|
const requiredFields = [ |
|
|
console.log('提交数据检查 - contactName:', this.data.company); |
|
|
{ name: '合作商身份', value: this.data.collaborationid, error: '请选择合作商身份' }, |
|
|
console.log('提交数据检查 - 省市区:', submitData.province, submitData.city, submitData.district); |
|
|
{ name: '公司名称', value: this.data.company, error: '请填写公司名称' }, |
|
|
// 检查所有字段是否完整
|
|
|
{ name: '省份', value: this.data.province, error: '请选择省份' }, |
|
|
console.log('提交数据完整性检查:', { |
|
|
{ name: '城市', value: this.data.city, error: '请选择城市' }, |
|
|
hasOpenid: !!submitData.openid, |
|
|
{ name: '区县', value: this.data.district, error: '请选择区县' }, |
|
|
hasCollaborationid: !!submitData.collaborationid, |
|
|
{ name: '详细地址', value: this.data.detailedaddress, error: '请填写详细地址' }, |
|
|
hasCompany: !!submitData.company, |
|
|
{ name: '合作模式', value: this.data.cooperation, error: '请选择合作模式' }, |
|
|
hasProvince: !!submitData.province, |
|
|
{ name: '营业执照', value: this.data.businesslicenseurl, error: '请上传营业执照' }, |
|
|
hasCity: !!submitData.city, |
|
|
{ name: '资质文件', value: this.data.proofurl, error: this.data.collaborationid === 'chicken' ? '请上传动物检疫合格证明' : '请上传法人身份证正反面' } |
|
|
hasDistrict: !!submitData.district, |
|
|
]; |
|
|
hasDetailedAddress: !!submitData.detailedaddress, |
|
|
|
|
|
hasCooperation: !!submitData.cooperation, |
|
|
for (const field of requiredFields) { |
|
|
hasPhoneNumber: !!submitData.phoneNumber, |
|
|
if (!field.value) { |
|
|
hasBusinessLicense: !!submitData.businesslicenseurl, |
|
|
wx.showToast({ |
|
|
hasProofUrl: !!submitData.proofurl, |
|
|
title: field.error, |
|
|
hasBrandUrl: !!submitData.brandurl |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
|
|
|
console.error(`提交失败:${field.error}`); |
|
|
// 表单验证 - 检查必填字段
|
|
|
return; |
|
|
if (!openid) { |
|
|
} |
|
|
wx.showToast({ |
|
|
|
|
|
title: '请先登录', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.data.collaborationid) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请选择合作商身份', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.data.cooperation) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请选择合作模式', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!this.data.company) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请填写公司名称', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!this.data.detailedaddress || !this.data.detailedaddress.trim()) { |
|
|
// 检查详细地址是否为空字符串
|
|
|
|
|
|
if (this.data.detailedaddress && !this.data.detailedaddress.trim()) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '请填写详细地址', |
|
|
title: '请填写详细地址', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
|
|
|
console.error('提交失败:详细地址为空'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 手机号为空时使用默认值,不再强制要求
|
|
|
console.log('所有验证通过,准备提交到服务器'); |
|
|
if (!contactPhone) { |
|
|
|
|
|
contactPhone = 'default_phone'; |
|
|
|
|
|
console.log('使用默认手机号:', contactPhone); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证省市区字段是否填写完整(用于构建region字段)
|
|
|
|
|
|
if (!this.data.province || !this.data.city || !this.data.district) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请填写完整地址', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证营业执照
|
|
|
|
|
|
if (!this.data.businesslicenseurl) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showBusinessLicenseError: true, |
|
|
|
|
|
businessLicenseError: '请上传营业执照' |
|
|
|
|
|
}); |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '请上传营业执照', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showBusinessLicenseError: false, |
|
|
|
|
|
businessLicenseError: '' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证动物检疫合格证明或法人身份证
|
|
|
|
|
|
if (!this.data.proofurl) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showProofError: true, |
|
|
|
|
|
proofError: this.data.collaborationid === 'chicken' ? '请上传动物检疫合格证明' : '请上传法人身份证正反面' |
|
|
|
|
|
}); |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: this.data.collaborationid === 'chicken' ? '请上传动物检疫合格证明' : '请上传法人身份证正反面', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showProofError: false, |
|
|
|
|
|
proofError: '' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 记录省市区字段内容
|
|
|
|
|
|
console.log('省市区字段内容:', this.data.province, this.data.city, this.data.district); |
|
|
|
|
|
|
|
|
|
|
|
// 文件上传现在为选填,不再强制要求
|
|
|
// 记录文件上传状态
|
|
|
console.log('文件上传状态:', { |
|
|
console.log('文件上传状态:', { |
|
|
businessLicenseFile: !!uploadedFiles.businessLicenseFile, |
|
|
businessLicenseFile: !!uploadedFiles.businessLicenseFile, |
|
|
animalQuarantineFile: !!uploadedFiles.animalQuarantineFile, |
|
|
animalQuarantineFile: !!uploadedFiles.animalQuarantineFile, |
|
|
@ -890,28 +860,10 @@ Page({ |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 调用后端API提交入驻申请
|
|
|
// 第七步:调用后端API提交数据
|
|
|
// 使用API.BASE_URL构建正确的请求路径
|
|
|
|
|
|
const API = require('../../utils/api'); |
|
|
const API = require('../../utils/api'); |
|
|
console.log('开始提交入驻申请,API地址:', API.BASE_URL + '/api/settlement/submit'); |
|
|
console.log('开始提交入驻申请,API地址:', API.BASE_URL + '/api/settlement/submit'); |
|
|
console.log('提交的完整数据:', submitData); |
|
|
console.log('提交的完整数据:', submitData); |
|
|
// 详细检查后端必需的关键字段(使用独立的省市区字段)
|
|
|
|
|
|
const requiredFieldsCheck = { |
|
|
|
|
|
openid: { value: submitData.openid, exists: !!submitData.openid }, |
|
|
|
|
|
collaborationid: { value: submitData.collaborationid, exists: !!submitData.collaborationid }, |
|
|
|
|
|
cooperation: { value: submitData.cooperation, exists: !!submitData.cooperation }, |
|
|
|
|
|
company: { value: submitData.company, exists: !!submitData.company }, |
|
|
|
|
|
phoneNumber: { value: submitData.phoneNumber, exists: !!submitData.phoneNumber }, |
|
|
|
|
|
province: { value: submitData.province, exists: !!submitData.province }, |
|
|
|
|
|
city: { value: submitData.city, exists: !!submitData.city }, |
|
|
|
|
|
district: { value: submitData.district, exists: !!submitData.district } |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
console.log('后端必需字段详细检查:', requiredFieldsCheck); |
|
|
|
|
|
|
|
|
|
|
|
// 检查是否所有必需字段都已填写
|
|
|
|
|
|
const allRequiredFieldsExist = Object.values(requiredFieldsCheck).every(field => field.exists); |
|
|
|
|
|
console.log('是否所有后端必需字段都已填写:', allRequiredFieldsExist); |
|
|
|
|
|
|
|
|
|
|
|
const result = await new Promise((resolve, reject) => { |
|
|
const result = await new Promise((resolve, reject) => { |
|
|
wx.request({ |
|
|
wx.request({ |
|
|
@ -928,17 +880,17 @@ Page({ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
console.log('入驻申请提交结果:', result); |
|
|
console.log('入驻申请提交结果:', result); |
|
|
console.log('请求状态码:', result.code); |
|
|
|
|
|
console.log('请求消息:', result.message); |
|
|
|
|
|
|
|
|
|
|
|
if (result && result.success) { |
|
|
if (result && result.success) { |
|
|
// 更新本地状态
|
|
|
// 提交成功处理
|
|
|
|
|
|
console.log('提交成功!服务器返回:', result); |
|
|
wx.setStorageSync('settlementStatus', 'underreview'); |
|
|
wx.setStorageSync('settlementStatus', 'underreview'); |
|
|
// 保存applicationId到本地存储,供撤回功能使用
|
|
|
|
|
|
const appId = result.data?.id || null; |
|
|
const appId = result.data?.id || null; |
|
|
if (appId) { |
|
|
if (appId) { |
|
|
wx.setStorageSync('applicationId', appId); |
|
|
wx.setStorageSync('applicationId', appId); |
|
|
|
|
|
console.log('保存applicationId:', appId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
@ -947,10 +899,10 @@ Page({ |
|
|
duration: 2000 |
|
|
duration: 2000 |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 跳转到审核状态页面 - 立即执行
|
|
|
// 跳转到审核状态页面
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
currentStep: 3, // 设置为第4步(审核状态页面)
|
|
|
currentStep: 3, |
|
|
partnerstatus: 'underreview', // 使用数据库字段名 (原auditStatus)
|
|
|
partnerstatus: 'underreview', |
|
|
applicationId: appId |
|
|
applicationId: appId |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -962,16 +914,12 @@ Page({ |
|
|
console.error('更新用户类型失败:', err); |
|
|
console.error('更新用户类型失败:', err); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 调用API获取用户完整数据 - 异步执行,不影响跳转
|
|
|
// 清除进度数据
|
|
|
API.getUserInfo().then(userRes => { |
|
|
|
|
|
console.log('用户完整数据:', userRes.data); |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.error('获取用户数据失败:', err); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 清除进度数据,因为已经提交了
|
|
|
|
|
|
this.clearSettlementProgress(); |
|
|
this.clearSettlementProgress(); |
|
|
|
|
|
console.log('===== 入驻申请提交成功 ====='); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
// 提交失败处理
|
|
|
|
|
|
console.error('提交失败,服务器返回:', result); |
|
|
if (result.code === 400 && result.message.includes('已有待审核的入驻申请')) { |
|
|
if (result.code === 400 && result.message.includes('已有待审核的入驻申请')) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: result.message, |
|
|
title: result.message, |
|
|
@ -997,6 +945,7 @@ Page({ |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
console.log('===== 提交流程结束 ====='); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|