Compare commits
No commits in common. "67e3422bfef1768461dfc504649653ae2e005f4f" and "4b9b4c5f93261aa025e3dff6c6f556c12b7f7996" have entirely different histories.
67e3422bfe
...
4b9b4c5f93
|
|
@ -648,16 +648,26 @@
|
|||
<div class="modal-body">
|
||||
<form id="inviteForm">
|
||||
<div class="form-group">
|
||||
<label class="form-label required">操作类型</label>
|
||||
<select class="form-select" id="inviteOperationType" onchange="handleInviteOperationTypeChange()">
|
||||
<option value="">请选择操作类型</option>
|
||||
<option value="bind_market_manager">绑定收益人是市场经营者</option>
|
||||
<option value="create_supplier">创建新收益人(供货商)</option>
|
||||
<option value="bind_existing_supplier">绑定已存在的供货商账号</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="inviteSupplierAccountGroup" style="display: none;">
|
||||
<label class="form-label required">供货商手机号</label>
|
||||
<input type="tel" class="form-input" id="inviteSupplierAccount" placeholder="请输入供货商手机号" maxlength="11">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group" id="inviteSupplierNameGroup" style="display: none;">
|
||||
<label class="form-label required">供货商账号名称</label>
|
||||
<input type="text" class="form-input" id="inviteSupplierName" placeholder="请输入供货商账号名称">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group" id="inviteSupplierPasswordGroup" style="display: none;">
|
||||
<label class="form-label required">密码</label>
|
||||
<input type="password" class="form-input" id="invitePassword" placeholder="请输入密码">
|
||||
</div>
|
||||
|
|
@ -874,9 +884,13 @@
|
|||
// 邀请摊主 - 打开弹窗
|
||||
function openInviteModal() {
|
||||
// 重置表单
|
||||
document.getElementById('inviteOperationType').value = '';
|
||||
document.getElementById('inviteSupplierAccount').value = '';
|
||||
document.getElementById('inviteSupplierName').value = '';
|
||||
document.getElementById('invitePassword').value = '';
|
||||
document.getElementById('inviteSupplierAccountGroup').style.display = 'none';
|
||||
document.getElementById('inviteSupplierNameGroup').style.display = 'none';
|
||||
document.getElementById('inviteSupplierPasswordGroup').style.display = 'none';
|
||||
|
||||
// 显示弹窗
|
||||
document.getElementById('inviteModal').classList.add('show');
|
||||
|
|
@ -887,38 +901,91 @@
|
|||
document.getElementById('inviteModal').classList.remove('show');
|
||||
}
|
||||
|
||||
// 处理邀请弹窗中的操作类型变化
|
||||
function handleInviteOperationTypeChange() {
|
||||
const operationType = document.getElementById('inviteOperationType').value;
|
||||
const supplierAccountGroup = document.getElementById('inviteSupplierAccountGroup');
|
||||
const supplierNameGroup = document.getElementById('inviteSupplierNameGroup');
|
||||
const supplierPasswordGroup = document.getElementById('inviteSupplierPasswordGroup');
|
||||
|
||||
if (operationType === 'create_supplier') {
|
||||
// 创建新收益人 - 显示手机号、账号名称和密码
|
||||
supplierAccountGroup.style.display = 'block';
|
||||
supplierNameGroup.style.display = 'block';
|
||||
supplierPasswordGroup.style.display = 'block';
|
||||
} else if (operationType === 'bind_existing_supplier') {
|
||||
// 绑定已存在的供货商 - 只显示手机号
|
||||
supplierAccountGroup.style.display = 'block';
|
||||
supplierNameGroup.style.display = 'none';
|
||||
supplierPasswordGroup.style.display = 'none';
|
||||
} else {
|
||||
// 绑定市场经营者 - 隐藏所有
|
||||
supplierAccountGroup.style.display = 'none';
|
||||
supplierNameGroup.style.display = 'none';
|
||||
supplierPasswordGroup.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// 提交邀请
|
||||
function submitInvite() {
|
||||
const supplierAccount = document.getElementById('inviteSupplierAccount').value;
|
||||
const supplierName = document.getElementById('inviteSupplierName').value;
|
||||
const password = document.getElementById('invitePassword').value;
|
||||
const operationType = document.getElementById('inviteOperationType').value;
|
||||
|
||||
if (!supplierAccount) {
|
||||
alert('请输入供货商手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^1[3-9]\d{9}$/.test(supplierAccount)) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!supplierName) {
|
||||
alert('请输入供货商账号名称');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
alert('请输入密码');
|
||||
if (!operationType) {
|
||||
alert('请选择操作类型');
|
||||
return;
|
||||
}
|
||||
|
||||
const inviteData = {
|
||||
supplierAccount: supplierAccount,
|
||||
supplierName: supplierName,
|
||||
password: password
|
||||
operationType: operationType
|
||||
};
|
||||
|
||||
// 创建新收益人
|
||||
if (operationType === 'create_supplier') {
|
||||
const supplierAccount = document.getElementById('inviteSupplierAccount').value;
|
||||
const supplierName = document.getElementById('inviteSupplierName').value;
|
||||
const password = document.getElementById('invitePassword').value;
|
||||
|
||||
if (!supplierAccount) {
|
||||
alert('请输入供货商手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^1[3-9]\d{9}$/.test(supplierAccount)) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!supplierName) {
|
||||
alert('请输入供货商账号名称');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
alert('请输入密码');
|
||||
return;
|
||||
}
|
||||
|
||||
inviteData.supplierAccount = supplierAccount;
|
||||
inviteData.supplierName = supplierName;
|
||||
inviteData.password = password;
|
||||
}
|
||||
// 绑定已存在的供货商
|
||||
else if (operationType === 'bind_existing_supplier') {
|
||||
const supplierAccount = document.getElementById('inviteSupplierAccount').value;
|
||||
|
||||
if (!supplierAccount) {
|
||||
alert('请输入供货商手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^1[3-9]\d{9}$/.test(supplierAccount)) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
inviteData.supplierAccount = supplierAccount;
|
||||
}
|
||||
|
||||
console.log('邀请摊主数据:', inviteData);
|
||||
|
||||
// TODO: 调用后端API发送邀请
|
||||
|
|
|
|||
Loading…
Reference in New Issue