feat(shopro_huifu): 添加汇付进件管理功能

- 新增汇付进件管理模块,支持新建、编辑进件流程
- 实现用户角色绑定验证功能,确保进件角色的有效性
- 集成Vue.js前端界面,提供完整的表单操作体验
- 支持个人和企业两种账户类型的进件资料录入
- 添加银行支行搜索功能,方便结算账户信息填写
- 完善进件状态管理和审核流程控制
- 增加图片上传组件,支持身份证、营业执照等证件上传
```
这个提交包含在:
可乐加冰
2026-09-29 15:40:36 +08:00
父节点 f2bca20a22
当前提交 2e7cbefdcd
共有 11 个文件被更改,包括 1307 次插入 和 3 次删除

查看文件

@@ -1,5 +1,8 @@
define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
var areaCache = null;
var branchTimer = null;
function withVue(callback) {
if (typeof Vue !== 'undefined') {
callback(Vue);
@@ -22,6 +25,262 @@ define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
});
}
function defaultForm() {
return {
account_type: 'indv',
bank_account_type: '0',
name: '',
cert_no: '',
cert_validity_type: '1',
cert_begin_date: '',
cert_end_date: '',
mobile_no: '',
reg_detail: '',
shopro_province_id: '',
shopro_city_id: '',
shopro_district_id: '',
prov_id: '',
area_id: '',
district_id: '',
card_no: '',
card_name: '',
branch_code: '',
branch_name: '',
mp: '',
id_card_front_url: '',
id_card_back_url: '',
bank_card_url: '',
reg_name: '',
license_code: '',
license_validity_type: '1',
license_begin_date: '',
license_end_date: '',
legal_name: '',
legal_mobile: '',
legal_cert_no: '',
legal_cert_validity_type: '1',
legal_cert_begin_date: '',
legal_cert_end_date: '',
license_url: '',
legal_id_front_url: '',
legal_id_back_url: '',
account_permit_url: ''
};
}
function createFormMixin() {
return {
data: function () {
return {
isEdit: false,
editId: 0,
userId: '',
userLabel: '',
roleKey: '',
roleType: '',
roleRefId: 0,
roleLabel: '',
userOptions: [],
userLoading: false,
roleOptions: [],
form: defaultForm(),
regionPath: [],
areaOptions: [],
areaProps: { value: 'id', label: 'name', children: 'children' },
branchKeyword: '',
branchResults: [],
uploadUrl: Fast.api.fixurl('ajax/upload'),
saving: false
};
},
computed: {
bankMobile: {
get: function () {
return this.form.account_type === 'ent' ? this.form.legal_mobile : this.form.mobile_no;
},
set: function (val) {
if (this.form.account_type === 'ent') {
this.form.legal_mobile = val;
} else {
this.form.mobile_no = val;
}
this.form.mp = val;
}
}
},
mounted: function () {
this.loadAreaTree();
this.initFromConfig();
},
methods: {
initFromConfig: function () {
var init = (typeof Config !== 'undefined' && Config.onboardForm) ? Config.onboardForm : null;
if (!init) return;
this.isEdit = true;
this.editId = init.onboard_id || 0;
this.userId = init.user_id;
this.userLabel = init.user_label || '';
this.roleType = init.role_type;
this.roleRefId = init.role_ref_id;
this.roleKey = init.role_type + ':' + init.role_ref_id;
this.roleLabel = init.role_label || '';
this.form = Object.assign(defaultForm(), init.form || {});
this.branchKeyword = this.form.branch_name || '';
this.restoreRegionPath();
},
loadAreaTree: function () {
var vm = this;
var done = function (data) {
areaCache = data || [];
vm.areaOptions = areaCache;
vm.restoreRegionPath();
};
if (areaCache) {
done(areaCache);
return;
}
Fast.api.ajax({ url: 'shopro/area/getCascader', type: 'GET' }, function (ret, res) {
done(res.data || []);
return false;
});
},
restoreRegionPath: function () {
var ids = [];
if (this.form.shopro_province_id) ids.push(parseInt(this.form.shopro_province_id, 10));
if (this.form.shopro_city_id) ids.push(parseInt(this.form.shopro_city_id, 10));
if (this.form.shopro_district_id) ids.push(parseInt(this.form.shopro_district_id, 10));
this.regionPath = ids.filter(function (n) { return !!n; });
},
onRegionChange: function (val) {
val = val || [];
this.form.shopro_province_id = val[0] ? String(val[0]) : '';
this.form.shopro_city_id = val[1] ? String(val[1]) : '';
this.form.shopro_district_id = val[2] ? String(val[2]) : '';
this.form.prov_id = this.form.shopro_province_id;
this.form.area_id = this.form.shopro_city_id;
this.form.district_id = this.form.shopro_district_id;
},
searchUser: function (keyword) {
if (!keyword) return;
var vm = this;
vm.userLoading = true;
Fast.api.ajax({
url: 'shopro/user/user/index',
type: 'GET',
data: { offset: 0, limit: 20, searchWhere: keyword }
}, function (ret, res) {
vm.userOptions = (res.data && res.data.rows) || [];
vm.userLoading = false;
return false;
}, function () {
vm.userLoading = false;
});
},
onUserChange: function () {
var vm = this;
vm.roleKey = '';
vm.roleType = '';
vm.roleRefId = 0;
vm.roleOptions = [];
if (!vm.userId) return;
Fast.api.ajax({
url: 'shopro_huifu/onboard/userRoles',
type: 'GET',
data: { user_id: vm.userId }
}, function (ret, res) {
var data = res.data || {};
vm.roleOptions = data.roles || [];
if (data.user) {
vm.userLabel = (data.user.nickname || '') + ' (' + (data.user.mobile || data.user.id) + ')';
}
return false;
});
},
onRoleChange: function () {
var parts = String(this.roleKey || '').split(':');
this.roleType = parts[0] || '';
this.roleRefId = parseInt(parts[1] || '0', 10);
var role = this.roleOptions.find(function (item) {
return item.role_type === this.roleType && item.role_ref_id === this.roleRefId;
}.bind(this));
this.roleLabel = role ? role.role_label : '';
},
onBranchInput: function () {
var vm = this;
clearTimeout(branchTimer);
branchTimer = setTimeout(function () {
if (!vm.branchKeyword) {
vm.branchResults = [];
return;
}
Fast.api.ajax({
url: 'shopro_huifu/onboard/searchBranch',
type: 'GET',
data: {
keyword: vm.branchKeyword,
area_id: vm.form.area_id || vm.form.shopro_city_id
}
}, function (ret, res) {
vm.branchResults = res.data || [];
return false;
});
}, 300);
},
selectBranch: function (item) {
this.form.branch_code = item.branch_code;
this.form.branch_name = item.branch_name;
this.branchKeyword = item.branch_name;
this.branchResults = [];
if (item.prov_id) this.form.prov_id = item.prov_id;
if (item.area_id) this.form.area_id = item.area_id;
},
onUploadSuccess: function (field, res) {
if (res && res.code === 1 && res.data && res.data.url) {
this.form[field] = res.data.fullurl || res.data.url;
return;
}
this.$message.error((res && res.msg) || '上传失败');
},
closeForm: function () {
Fast.api.close();
},
submitForm: function () {
var vm = this;
if (!vm.isEdit) {
if (!vm.userId) {
Toastr.error('请选择用户');
return;
}
if (!vm.roleType || !vm.roleRefId) {
Toastr.error('请选择进件角色');
return;
}
}
vm.saving = true;
var url = vm.isEdit
? ('shopro_huifu/onboard/edit/ids/' + vm.editId)
: 'shopro_huifu/onboard/add';
Fast.api.ajax({
url: url,
type: 'POST',
data: {
user_id: vm.userId,
role_type: vm.roleType,
role_ref_id: vm.roleRefId,
form: vm.form
}
}, function () {
vm.saving = false;
Fast.api.close();
return false;
}, function () {
vm.saving = false;
});
}
}
};
}
var Controller = {
index: function () {
withVue(function (Vue) {
@@ -49,6 +308,30 @@ define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
this.getList();
},
methods: {
openCreate: function () {
var vm = this;
Backend.api.open('shopro_huifu/onboard/add', '新建汇付进件', {
area: ['900px', '90%'],
callback: function () {
vm.getList();
}
});
},
openEdit: function (id) {
var vm = this;
Backend.api.open('shopro_huifu/onboard/edit/ids/' + id, '编辑汇付进件', {
area: ['900px', '90%'],
callback: function () {
vm.getList();
if (vm.detailVisible && vm.detailId === id) {
vm.openDetail(id);
}
}
});
},
canEditRow: function (row) {
return ['draft', 'failed', 'rejected'].indexOf(row.onboard_status) >= 0;
},
getList: function () {
var vm = this;
vm.loading = true;
@@ -131,6 +414,11 @@ define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
this.retryRow(this.detailId);
}
},
editFromDetail: function () {
if (this.detailId) {
this.openEdit(this.detailId);
}
},
statusText: function (status) {
var map = {
draft: '待后台审核',
@@ -144,7 +432,7 @@ define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
return map[status] || status || '-';
},
roleText: function (role) {
return role === 'regional_agent' ? '区域代理' : (role === 'promoter' ? '推广员' : role);
return role === 'regional_agent' ? '区域公司' : (role === 'promoter' ? '推广员' : role);
},
formatTime: function (ts) {
if (!ts) return '-';
@@ -155,6 +443,17 @@ define(['jquery', 'bootstrap', 'backend'], function ($, undefined, Backend) {
}
});
});
},
add: function () {
withVue(function (Vue) {
new Vue({
el: '#huifuOnboardAdd',
mixins: [createFormMixin()]
});
});
},
edit: function () {
Controller.add();
}
};
return Controller;