完成商户分账信息查询功能

This commit is contained in:
赵毅 2025-12-05 10:09:05 +08:00
parent 61b44c2e5f
commit 2f2e11cc6b
3 changed files with 169 additions and 139 deletions

View File

@ -638,7 +638,7 @@ export default {
ecQuery() { ecQuery() {
const storeValue = uni.getStorageSync('storeValue'); const storeValue = uni.getStorageSync('storeValue');
if (!storeValue || !storeValue.ec_apply_id) { if (!storeValue || !storeValue.contractId) {
uni.showToast({ uni.showToast({
title: '请先提交申请', title: '请先提交申请',
icon: 'none' icon: 'none'

View File

@ -218,12 +218,13 @@ page {
.submit-section { .submit-section {
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: flex;
} }
.submit-btn { .submit-btn,
.submit-btn1 {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
background-color: #007aff;
color: #fff; color: #fff;
font-size: 28rpx; font-size: 28rpx;
border-radius: 8rpx; border-radius: 8rpx;
@ -232,6 +233,16 @@ page {
box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.3); box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.3);
} }
.submit-btn {
background-color: #007aff;
margin-left: 5rpx;
}
.submit-btn1 {
background-color: #ff4016;
margin-right: 5rpx;
}
.submit-btn:active { .submit-btn:active {
background-color: #0051d5; background-color: #0051d5;
transform: scale(0.98); transform: scale(0.98);

View File

@ -5,30 +5,32 @@
<view class="form-section"> <view class="form-section">
<view class="form-item"> <view class="form-item">
<label class="form-label required">商户号</label> <label class="form-label required">商户号</label>
<input type="number" class="form-input" v-model.number="formData.mch_id" placeholder="请输入商户号" required> <input type="number" class="form-input" v-model.number="formData.mch_id" placeholder="请输入商户号"
required>
</view> </view>
<view class="form-item"> <view class="form-item">
<label class="form-label">拉卡拉内部商户号</label> <label class="form-label">拉卡拉内部商户号</label>
<input type="text" class="form-input" v-model="formData.merInnerNo" placeholder="请输入拉卡拉内部商户号(可选)"> <input type="text" class="form-input" v-model="formData.merInnerNo" placeholder="请输入拉卡拉内部商户号(可选)">
</view> </view>
<view class="form-item"> <view class="form-item">
<label class="form-label">银联商户号</label> <label class="form-label">银联商户号</label>
<input type="text" class="form-input" v-model="formData.merCupNo" placeholder="请输入银联商户号(可选)"> <input type="text" class="form-input" v-model="formData.merCupNo" placeholder="请输入银联商户号(可选)">
</view> </view>
<view class="form-item"> <view class="form-item">
<label class="form-label required">联系手机号</label> <label class="form-label required">联系手机号</label>
<input type="number" class="form-input" v-model="formData.contactMobile" placeholder="请输入联系手机号" required> <input type="number" class="form-input" v-model="formData.contactMobile" placeholder="请输入联系手机号"
required>
</view> </view>
<view class="form-item"> <view class="form-item">
<label class="form-label">电子分账协议号</label> <label class="form-label">电子分账协议号</label>
<input type="text" class="form-input" v-model="formData.eleContractNo" placeholder="请输入电子分账协议号(可选)"> <input type="text" class="form-input" v-model="formData.eleContractNo" placeholder="请输入电子分账协议号(可选)">
</view> </view>
</view> </view>
<!-- 附件上传 --> <!-- 附件上传 -->
<view class="form-section"> <view class="form-section">
<h3 class="section-title">附件上传可选</h3> <h3 class="section-title">附件上传可选</h3>
@ -49,19 +51,21 @@
<button class="add-attachment-btn" @click="addFile">添加附件</button> <button class="add-attachment-btn" @click="addFile">添加附件</button>
</view> </view>
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->
<view class="form-section submit-section"> <view class="form-section submit-section">
<button type="button" class="submit-btn1" @click="ecQuery">结果查询</button>
<button type="submit" class="submit-btn" @click="submitForm">提交申请</button> <button type="submit" class="submit-btn" @click="submitForm">提交申请</button>
</view> </view>
</form> </form>
<!-- 文件附件类型弹窗 --> <!-- 文件附件类型弹窗 -->
<view class="popup" v-if="showFileAttachTypePopup >= 0"> <view class="popup" v-if="showFileAttachTypePopup >= 0">
<view class="popup-content"> <view class="popup-content">
<view class="popup-title">选择附件类型</view> <view class="popup-title">选择附件类型</view>
<view class="popup-list"> <view class="popup-list">
<view class="popup-item" v-for="type in fileAttachTypeOptions" :key="type.value" @click="selectFileAttachType(showFileAttachTypePopup, type)"> <view class="popup-item" v-for="type in fileAttachTypeOptions" :key="type.value"
@click="selectFileAttachType(showFileAttachTypePopup, type)">
{{ type.label }} {{ type.label }}
</view> </view>
</view> </view>
@ -95,10 +99,10 @@ export default {
} }
] // ] //
}, },
// //
showFileAttachTypePopup: -1, showFileAttachTypePopup: -1,
// API // API
fileAttachTypeOptions: [ fileAttachTypeOptions: [
{ value: 'BUSINESS_LICENSE', label: '营业执照' }, { value: 'BUSINESS_LICENSE', label: '营业执照' },
@ -110,122 +114,122 @@ export default {
] ]
}; };
}, },
methods: { methods: {
// //
addFile() { addFile() {
this.formData.fileData.push({ this.formData.fileData.push({
attType: '', attType: '',
attFileId: '', attFileId: '',
attachName: '' attachName: ''
});
},
//
selectFileAttachType(index, type) {
this.formData.fileData[index].attType = type.value;
this.showFileAttachTypePopup = -1;
},
//
getAttachTypeLabel(typeValue) {
if (!typeValue) return '';
const option = this.fileAttachTypeOptions.find(type => type.value === typeValue);
return option ? option.label : '';
},
//
removeFile(index) {
this.formData.fileData.splice(index, 1);
},
//
uploadFile(index) {
const fileData = this.formData.fileData[index];
//
if (!fileData.attType) {
uni.showToast({
title: '请先选择附件类型',
icon: 'none'
}); });
}, return;
}
//
selectFileAttachType(index, type) { // uni.chooseMessageFile API
this.formData.fileData[index].attType = type.value; uni.chooseMessageFile({
this.showFileAttachTypePopup = -1; count: 1,
}, type: 'file',
extension: ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png'], //
// success: (res) => {
getAttachTypeLabel(typeValue) { const tempFile = res.tempFiles[0];
if (!typeValue) return ''; console.log("选择的文件:", tempFile);
const option = this.fileAttachTypeOptions.find(type => type.value === typeValue);
return option ? option.label : ''; //
}, fileData.attachName = tempFile.name;
// //
removeFile(index) { uni.showLoading({
this.formData.fileData.splice(index, 1); title: '上传中',
}, mask: true
});
//
uploadFile(index) { // 使uni.uploadFile
const fileData = this.formData.fileData[index]; uni.uploadFile({
url: RequsetUrl + apiArr.upload, // URL
// filePath: tempFile.path, //
if (!fileData.attType) { name: 'file', // key
formData: {
attType: fileData.attType //
},
header: {
Authorization: uni.getStorageSync("ctoken") //
},
success: (uploadRes) => {
//
const res = JSON.parse(uploadRes.data);
//
fileData.attFileId = res.data.respData.attFileId;
fileData.attachName = tempFile.name; //
uni.showToast({
title: '上传成功',
icon: 'success'
});
},
fail: (error) => {
console.error('文件上传失败:', error);
uni.showToast({
title: '上传失败',
icon: 'none'
});
},
complete: () => {
uni.hideLoading(); //
}
});
},
fail: (err) => {
console.error('选择文件失败:', err);
uni.showToast({ uni.showToast({
title: '请先选择附件类型', title: '选择文件失败',
icon: 'none' icon: 'none'
}); });
return;
} }
});
// uni.chooseMessageFile API },
uni.chooseMessageFile({
count: 1,
type: 'file',
extension: ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png'], //
success: (res) => {
const tempFile = res.tempFiles[0];
console.log("选择的文件:", tempFile);
//
fileData.attachName = tempFile.name;
//
uni.showLoading({
title: '上传中',
mask: true
});
// 使uni.uploadFile
uni.uploadFile({
url: RequsetUrl + apiArr.upload, // URL
filePath: tempFile.path, //
name: 'file', // key
formData: {
attType: fileData.attType //
},
header: {
Authorization: uni.getStorageSync("ctoken") //
},
success: (uploadRes) => {
//
const res = JSON.parse(uploadRes.data);
//
fileData.attFileId = res.data.respData.attFileId;
fileData.attachName = tempFile.name; //
uni.showToast({
title: '上传成功',
icon: 'success'
});
},
fail: (error) => {
console.error('文件上传失败:', error);
uni.showToast({
title: '上传失败',
icon: 'none'
});
},
complete: () => {
uni.hideLoading(); //
}
});
},
fail: (err) => {
console.error('选择文件失败:', err);
uni.showToast({
title: '选择文件失败',
icon: 'none'
});
}
});
},
// //
validateForm() { validateForm() {
const { formData } = this; const { formData } = this;
// //
if (!formData.mch_id) { if (!formData.mch_id) {
uni.showToast({ title: '请输入商户号', icon: 'none' }); uni.showToast({ title: '请输入商户号', icon: 'none' });
return false; return false;
} }
if (!formData.contactMobile) { if (!formData.contactMobile) {
uni.showToast({ title: '请输入联系手机号', icon: 'none' }); uni.showToast({ title: '请输入联系手机号', icon: 'none' });
return false; return false;
@ -233,22 +237,49 @@ export default {
uni.showToast({ title: '请输入有效的手机号', icon: 'none' }); uni.showToast({ title: '请输入有效的手机号', icon: 'none' });
return false; return false;
} }
return true; return true;
}, },
ecQuery() {
// const storeValue = uni.getStorageSync('storeValue');
// if (!storeValue || !storeValue.contractId) {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// return;
// }
// const params = {
// contractId: storeValue.contractId
// }
request(apiArr.queryLedgerMer, "POST", {}).then(res => {
if (res.respData.splitStatus === 'VALID') {
uni.showToast({
title: '审核通过',
icon: 'success'
});
} else if (res.respData.contractStatus === 'INVALID') {
uni.showToast({
title: '审核未通过',
icon: 'none'
});
}
})
},
// //
submitForm() { submitForm() {
// //
if (!this.validateForm()) { if (!this.validateForm()) {
return; return;
} }
uni.showLoading({ uni.showLoading({
title: '提交中...', title: '提交中...',
mask: true mask: true
}); });
// //
const submitData = { const submitData = {
mch_id: this.formData.mch_id, mch_id: this.formData.mch_id,
@ -258,7 +289,7 @@ export default {
eleContractNo: this.formData.eleContractNo, eleContractNo: this.formData.eleContractNo,
attachments: [] attachments: []
}; };
// attFileIdattachments // attFileIdattachments
const validFiles = this.formData.fileData.filter(file => file.attFileId); const validFiles = this.formData.fileData.filter(file => file.attFileId);
if (validFiles.length > 0) { if (validFiles.length > 0) {
@ -268,28 +299,16 @@ export default {
attachStorePath: file.attFileId attachStorePath: file.attFileId
})); }));
} }
console.log('提交的数据:', submitData); console.log('提交的数据:', submitData);
// applyLedgerMer
request(apiArr.applyLedgerMer, "POST", submitData).then(res => { request(apiArr.applyLedgerMer, "POST", submitData).then(res => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({
if (res && res.cmdRetCode === 'SUCCESS') { title: '提交成功',
uni.showToast({ icon: 'success'
title: '提交成功', });
icon: 'success' uni.setStorageSync('storeValue', { fz_apply_id: res.resp_data.ec_apply_id });
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
uni.showToast({
title: res?.retMsg || '提交失败',
icon: 'none'
});
}
}).catch(error => { }).catch(error => {
uni.hideLoading(); uni.hideLoading();
console.error('提交失败:', error); console.error('提交失败:', error);