commit
This commit is contained in:
+29
-3
@@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
@@ -77,15 +78,31 @@ public class WelfareSelectionSituationController {
|
||||
@ApiOperation("获取某个用户选择信息")
|
||||
public Result getUserSelection(String projectId, String userId) {
|
||||
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
|
||||
Sys_user user = dao.fetch(Sys_user.class, userId);
|
||||
String welfareMobile = user == null ? null : user.getWelfareMobile();
|
||||
// 管理员代选详情返回被代选用户的当前福利电话。
|
||||
list.forEach(selection -> selection.setWelfareMobile(welfareMobile));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 管理员为指定用户提交福利选择。
|
||||
*
|
||||
* @param selections 选择项数组,每项包含选项 ID、选择数量,以及按项目要求填写的地址或签名
|
||||
* @param projectId 福利项目 ID
|
||||
* @param userId 被代选用户 ID
|
||||
* @param welfareMobile 被代选用户福利电话,须为 11 位手机号码
|
||||
* @return Result;成功时返回“选择成功”,校验失败时返回对应错误信息
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "welfare", tag = "选择福利", msg = "代选福利")
|
||||
@SaCheckPermission("welfare.selection.situation")
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId, String userId) {
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId, String userId, String welfareMobile) {
|
||||
if (welfareMobile == null || !welfareMobile.matches("^1[3456789]\\d{9}$")) {
|
||||
return Result.error("请输入正确的福利电话");
|
||||
}
|
||||
WelfareProject project = dao.fetch(WelfareProject.class, projectId);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if(project.getChoiceTimeEnd().getTime()<new Date().getTime()){
|
||||
@@ -104,6 +121,9 @@ public class WelfareSelectionSituationController {
|
||||
return Result.error("选择的数量不能超过" + multiSelectNum);
|
||||
}
|
||||
|
||||
// 管理员代选时同步维护被代选用户的福利电话,后续福利业务统一读取该字段。
|
||||
dao.update(Sys_user.class, Chain.make("welfareMobile", welfareMobile), Cnd.where("id", "=", userId));
|
||||
|
||||
//删除上次选择的
|
||||
dao.clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", userId));
|
||||
for (WelfareUserSelection welfareUserSelection : selections) {
|
||||
@@ -135,11 +155,17 @@ public class WelfareSelectionSituationController {
|
||||
situationService.exportXlsx(pageForm, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取被代选用户的福利电话。
|
||||
*
|
||||
* @param userId 被代选用户 ID
|
||||
* @return Result,data 为字符串类型的福利电话;用户不存在或尚未维护时为空
|
||||
*/
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result getMobileByUserId(String userId) {
|
||||
public Result getWelfareMobileByUserId(String userId) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, userId);
|
||||
return Result.success().addData(user.getMobile());
|
||||
return Result.success().addData(user == null ? null : user.getWelfareMobile());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+33
-1
@@ -6,6 +6,7 @@ import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.welfare.model.WelfareList;
|
||||
@@ -82,11 +83,22 @@ public class WelfareUserSelectController {
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交当前用户的福利选择。
|
||||
*
|
||||
* @param selections 选择项数组,每项包含选项 ID、选择数量,以及按项目要求填写的地址或签名
|
||||
* @param projectId 福利项目 ID
|
||||
* @param welfareMobile 当前用户福利电话,须为 11 位手机号码
|
||||
* @return Result;成功时返回“选择成功”,校验失败时返回对应错误信息
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(type = "welfare", tag = "选择福利", msg = "福利")
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId) {
|
||||
public Result confirmSelect(@Param("selections") WelfareUserSelection[] selections, String projectId, String welfareMobile) {
|
||||
if (welfareMobile == null || !welfareMobile.matches("^1[3456789]\\d{9}$")) {
|
||||
return Result.error("请输入正确的福利电话");
|
||||
}
|
||||
WelfareProject project = dao.fetch(WelfareProject.class, projectId);
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if (project.getChoiceTimeEnd().getTime() < new Date().getTime()) {
|
||||
@@ -105,6 +117,9 @@ public class WelfareUserSelectController {
|
||||
return Result.error("选择的数量不能超过" + project.getMultiSelectNum());
|
||||
}
|
||||
|
||||
// 福利电话以用户资料为唯一数据源,福利选择记录不再重复保存普通 mobile 字段。
|
||||
dao.update(Sys_user.class, Chain.make("welfareMobile", welfareMobile), Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
|
||||
//删除上次选择的
|
||||
dao.clear(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", SecurityUtil.getUserId()));
|
||||
for (WelfareUserSelection welfareUserSelection : selections) {
|
||||
@@ -121,7 +136,24 @@ public class WelfareUserSelectController {
|
||||
@ApiOperation("获取用户选择信息")
|
||||
public Result getUserSelection(String projectId) {
|
||||
List<WelfareUserSelection> list = dao.query(WelfareUserSelection.class, Cnd.where(WelfareUserSelection::getWelfareId, "=", projectId).and(WelfareUserSelection::getSelectUserId, "=", SecurityUtil.getUserId()));
|
||||
Sys_user user = dao.fetch(Sys_user.class, SecurityUtil.getUserId());
|
||||
String welfareMobile = user == null ? null : user.getWelfareMobile();
|
||||
// 选择记录返回当前福利电话,供 PC 与 H5 的选择详情统一回显。
|
||||
list.forEach(selection -> selection.setWelfareMobile(welfareMobile));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的福利电话。
|
||||
*
|
||||
* @return 字符串类型的福利电话;用户不存在或尚未维护时返回空值
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("welfare.user.select")
|
||||
@ApiOperation("获取当前用户福利电话")
|
||||
public Result getWelfareMobile() {
|
||||
Sys_user user = dao.fetch(Sys_user.class, SecurityUtil.getUserId());
|
||||
return Result.success().addData(user == null ? null : user.getWelfareMobile());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,11 +86,17 @@ public class WelfareUserSelection extends BaseModel implements Serializable {
|
||||
@Default("0")
|
||||
private Boolean isSelectByAdmin;
|
||||
|
||||
@Deprecated
|
||||
@Column
|
||||
@Comment("手机号")
|
||||
@Comment("历史联系电话(福利选择流程不再使用)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 当前用户福利电话,仅用于福利选择查询结果回显,不映射选择记录表字段。
|
||||
*/
|
||||
private String welfareMobile;
|
||||
|
||||
@Column
|
||||
@Comment("物流信息")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
|
||||
@@ -157,7 +157,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.mobile,
|
||||
u.welfareMobile,
|
||||
un.name unionname,
|
||||
it.name unitname,
|
||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||
@@ -187,7 +187,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("福利电话", "welfareMobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
|
||||
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 20));
|
||||
@@ -703,6 +703,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
t2.loginname,
|
||||
t2.username,
|
||||
t2.sex,
|
||||
t2.welfareMobile,
|
||||
DATE_FORMAT(t2.birthday, '%Y-%m-%d') AS birthday
|
||||
FROM
|
||||
`welfare_list` t1
|
||||
@@ -765,7 +766,7 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginname", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "username", 20));
|
||||
exportEntities.add(new ExcelExportEntity("性别", "sex", 20));
|
||||
exportEntities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("福利电话", "welfareMobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("身份证号", "idCard", 30));
|
||||
exportEntities.add(new ExcelExportEntity("在职状态", "userState", 20));
|
||||
exportEntities.add(new ExcelExportEntity("聘用方式", "preparedBy", 20));
|
||||
|
||||
+1
-4
@@ -57,7 +57,6 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
|
||||
t1.welfareUnitName,
|
||||
t1.welfareUnitId,
|
||||
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
|
||||
GROUP_CONCAT(DISTINCT t2.mobile) AS mobile,
|
||||
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
|
||||
CASE
|
||||
WHEN MAX(t2.isSelectByAdmin) = 1 THEN '是'
|
||||
@@ -122,7 +121,6 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
|
||||
t1.welfareUnionName,
|
||||
t1.welfareUnitName,
|
||||
GROUP_CONCAT(DISTINCT t3.optionName) AS selectedOptions,
|
||||
COALESCE(GROUP_CONCAT(DISTINCT NULLIF(t2.mobile, '')), t4.mobile) AS mobile,
|
||||
GROUP_CONCAT(DISTINCT t2.receiveAddress) AS receiveAddress,
|
||||
CASE
|
||||
WHEN MAX(t2.isSelectByAdmin) = 1 THEN '是'
|
||||
@@ -190,8 +188,7 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
|
||||
entities.add(new ExcelExportEntity("所属工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("所选福利", "selectedOptions", 20));
|
||||
entities.add(new ExcelExportEntity("是否管理员代选", "selectByAdminName", 20));
|
||||
entities.add(new ExcelExportEntity("福利号码", "welfareMobile", 20));
|
||||
entities.add(new ExcelExportEntity("联系电话", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("福利电话", "welfareMobile", 20));
|
||||
|
||||
if(project.getProvideMode() == 3){
|
||||
entities.add(new ExcelExportEntity("收货地址", "receiveAddress", 40));
|
||||
|
||||
@@ -158,7 +158,7 @@ public class WelfareSingleServiceImpl extends BaseServiceImpl implements Welfare
|
||||
u.username AS userName,
|
||||
u.unitname AS unitName,
|
||||
u.unionname AS unionName,
|
||||
u.mobile,
|
||||
u.welfareMobile,
|
||||
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName ,'(',wpus.selectNum,'份)') optionName,
|
||||
wpus.courierNumber
|
||||
|
||||
+6
-6
@@ -151,7 +151,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday,
|
||||
wpus.mobile,
|
||||
u.welfareMobile,
|
||||
CASE WHEN MAX(wpus.isSelectByAdmin) = 1 THEN '管理员代选' ELSE '个人选择' END AS selectByAdminName,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
@@ -192,7 +192,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
wl.welfareUnionName,
|
||||
u.postDoctoralJoinDate,
|
||||
DATE_FORMAT(u.birthday, '%Y-%m-%d') AS birthday,
|
||||
wpus.mobile,
|
||||
u.welfareMobile,
|
||||
CASE WHEN MAX(wpus.isSelectByAdmin) = 1 THEN '管理员代选' ELSE '个人选择' END AS selectByAdminName,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
@@ -232,7 +232,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
entities.add(new ExcelExportEntity("进站时间", "postDoctoralJoinDate", 20));
|
||||
entities.add(new ExcelExportEntity("单位", "welfareUnitName", 20));
|
||||
entities.add(new ExcelExportEntity("工会", "welfareUnionName", 20));
|
||||
entities.add(new ExcelExportEntity("手机号", "mobile", 20));
|
||||
entities.add(new ExcelExportEntity("福利电话", "welfareMobile", 20));
|
||||
entities.add(new ExcelExportEntity("选择方式", "selectByAdminName", 20));
|
||||
entities.add(new ExcelExportEntity("所选福利", "selectOptionName", 20));
|
||||
|
||||
@@ -356,7 +356,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
u.username AS userName,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
wpus.mobile,
|
||||
u.welfareMobile,
|
||||
GROUP_CONCAT(DISTINCT wpso.optionName, '(', wpus.selectNum, '份)') selectOptionName
|
||||
FROM
|
||||
welfare_project_user_selection wpus
|
||||
@@ -384,7 +384,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("电话号码", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("福利电话", "welfareMobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在分工会", "welfareUnionName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所在单位", "welfareUnitName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("选择方式", "selectByAdminName", 20));
|
||||
@@ -396,7 +396,7 @@ public class WelfareStatisticsServiceImpl extends BaseServiceImpl<WelfareProject
|
||||
u.username AS userName,
|
||||
wl.welfareUnitName,
|
||||
wl.welfareUnionName,
|
||||
wpus.mobile,
|
||||
u.welfareMobile,
|
||||
wpus.selectOptionId,
|
||||
wpso.optionName,
|
||||
CASE WHEN MAX(wpus.isSelectByAdmin) = 1 THEN '管理员代选' ELSE '个人选择' END AS selectByAdminName,
|
||||
|
||||
@@ -36,8 +36,8 @@ const selectView = {
|
||||
</div>
|
||||
<div class="project-info-content">
|
||||
<div class="info-item">
|
||||
<div class="info-label">联系电话</div>
|
||||
<div class="info-value">{{ mergedSelections[0]?.mobile || '暂无' }}</div>
|
||||
<div class="info-label">福利电话</div>
|
||||
<div class="info-value">{{ mergedSelections[0]?.welfareMobile || '暂无' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -135,14 +135,14 @@ const optionSelect = {
|
||||
append-to-body
|
||||
custom-class="welfare-confirm-dialog">
|
||||
<div class="confirm-content">
|
||||
<!-- 联系电话输入 -->
|
||||
<!-- 福利电话输入:统一读写用户资料中的 welfareMobile -->
|
||||
<div class="confirm-mobile-section">
|
||||
<div class="confirm-section-title">联系信息</div>
|
||||
<el-form :model="contactForm" ref="contactForm" :rules="contactRules" label-width="80px">
|
||||
<el-form-item prop="mobile" label="联系电话">
|
||||
<el-form-item prop="welfareMobile" label="福利电话">
|
||||
<el-input
|
||||
v-model="contactForm.mobile"
|
||||
placeholder="请输入手机号码"
|
||||
v-model="contactForm.welfareMobile"
|
||||
placeholder="请输入福利电话"
|
||||
maxlength="11"
|
||||
clearable>
|
||||
</el-input>
|
||||
@@ -230,15 +230,15 @@ const optionSelect = {
|
||||
showOptionDetailDialog: false, // 选项详情弹窗
|
||||
selectedOption: null, // 当前选中的选项
|
||||
contactForm: {
|
||||
mobile: "", // 联系电话,
|
||||
welfareMobile: "", // 福利电话
|
||||
receiveAddress: ""
|
||||
},
|
||||
contactRules: {
|
||||
mobile: [
|
||||
{ required: true, message: "请输入联系电话", trigger: "blur" },
|
||||
welfareMobile: [
|
||||
{ required: true, message: "请输入福利电话", trigger: "blur" },
|
||||
{
|
||||
pattern: /^1[3456789]\d{9}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
message: "请输入正确的福利电话",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
@@ -325,7 +325,7 @@ const optionSelect = {
|
||||
|
||||
this.selectedRadioId = null
|
||||
this.contactForm = {
|
||||
mobile: "",
|
||||
welfareMobile: "",
|
||||
receiveAddress: ""
|
||||
}
|
||||
|
||||
@@ -376,18 +376,8 @@ const optionSelect = {
|
||||
this.userSelection = resp.data
|
||||
this.hasSubmittedBefore = this.userSelection.length > 0
|
||||
|
||||
if (this.userSelection && this.userSelection.length > 0) {
|
||||
this.contactForm.mobile = this.userSelection[0]?.mobile
|
||||
} else {
|
||||
if (this.isProxySelect) {
|
||||
// 否则使用默认手机号
|
||||
$.post("/platform/welfare/selection/situation/getMobileByUserId", { userId: this.userId }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.contactForm.mobile = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// 福利电话始终从用户资料回显,不再读取选择记录中的 mobile。
|
||||
this.getWelfareMobile()
|
||||
|
||||
// 地址回显
|
||||
if (this.projectInfo.provideMode === 3) {
|
||||
@@ -422,9 +412,22 @@ const optionSelect = {
|
||||
})
|
||||
},
|
||||
|
||||
// 获取本人或被代选用户的福利电话,返回值为字符串或空值。
|
||||
getWelfareMobile() {
|
||||
const url = this.isProxySelect
|
||||
? "/platform/welfare/selection/situation/getWelfareMobileByUserId"
|
||||
: "/platform/welfare/userSelect/getWelfareMobile"
|
||||
const formData = this.isProxySelect ? { userId: this.userId } : {}
|
||||
this.$axios.post(url, formData).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(this.contactForm, "welfareMobile", res.data || "")
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 执行提交
|
||||
doSubmit() {
|
||||
// 验证手机号
|
||||
// 校验福利电话和按配送方式动态要求的收货地址。
|
||||
this.$refs.contactForm.validate((valid) => {
|
||||
if (!valid) {
|
||||
return
|
||||
@@ -442,7 +445,6 @@ const optionSelect = {
|
||||
{
|
||||
selectOptionId: this.selectedRadioId,
|
||||
selectNum: 1,
|
||||
mobile: this.contactForm.mobile,
|
||||
receiveAddress: this.contactForm.receiveAddress
|
||||
}
|
||||
]
|
||||
@@ -453,7 +455,6 @@ const optionSelect = {
|
||||
selections = this.selectedOptions.map((option) => ({
|
||||
selectOptionId: option.id,
|
||||
selectNum: option.selectNum,
|
||||
mobile: this.contactForm.mobile,
|
||||
receiveAddress: this.contactForm.receiveAddress
|
||||
}))
|
||||
}
|
||||
@@ -461,6 +462,7 @@ const optionSelect = {
|
||||
let url = "/platform/welfare/userSelect/confirmSelect"
|
||||
const formData = {
|
||||
projectId: this.projectId,
|
||||
welfareMobile: this.contactForm.welfareMobile,
|
||||
selections: JSON.stringify(selections)
|
||||
}
|
||||
if (this.isProxySelect) {
|
||||
@@ -471,8 +473,6 @@ const optionSelect = {
|
||||
this.$axios
|
||||
.post(url, formData)
|
||||
.then((res) => {
|
||||
this.isSubmitting = false
|
||||
|
||||
if (res.code === 0) {
|
||||
this.showConfirmDialog = false
|
||||
this.$message.success("选择成功")
|
||||
@@ -482,8 +482,10 @@ const optionSelect = {
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 网络异常由全局请求处理器提示。
|
||||
})
|
||||
.finally(() => {
|
||||
this.isSubmitting = false
|
||||
// this.$message.error("网络错误,请重试")
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -190,7 +190,7 @@ layout("/layouts/platform.html"){
|
||||
{ prop: "welfareUnitName", label: "所属单位", sortable: true },
|
||||
{ prop: "selectedOptions", label: "所选福利", sortable: true },
|
||||
{ prop: "selectByAdminName", label: "是否管理员代选", sortable: true },
|
||||
{ prop: "welfareMobile", label: "福利号码", sortable: true }
|
||||
{ prop: "welfareMobile", label: "福利电话", sortable: true }
|
||||
],
|
||||
optionSelectVisible: false,
|
||||
selectByAdminDialogVisible: false,
|
||||
|
||||
@@ -65,7 +65,7 @@ const selectedUser = {
|
||||
{ prop: "preparedBy", label: "聘用方式", width: 120, sortable: true },
|
||||
{ prop: "postDoctoralJoinDate", label: "进站时间", sortable: true },
|
||||
{ label: "单位", prop: "welfareUnitName" },
|
||||
{ label: "手机号", prop: "mobile" },
|
||||
{ label: "福利电话", prop: "welfareMobile" },
|
||||
{ label: "选择方式", prop: "selectByAdminName" },
|
||||
{ label: "所选福利", prop: "selectOptionName" }
|
||||
]
|
||||
|
||||
@@ -53,8 +53,8 @@ const selectView = {
|
||||
</div>
|
||||
<div class="welfare-card__content">
|
||||
<div class="info-row">
|
||||
<div class="info-row__label">联系电话</div>
|
||||
<div class="info-row__value">{{ mergedSelections[0]?.mobile || '暂无' }}</div>
|
||||
<div class="info-row__label">福利电话</div>
|
||||
<div class="info-row__value">{{ mergedSelections[0]?.welfareMobile || '暂无' }}</div>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<div class="info-row__label">收货地址</div>
|
||||
|
||||
@@ -358,8 +358,8 @@ layout("/layouts/platform_h5.html"){
|
||||
column-gap: 10px;
|
||||
}
|
||||
|
||||
/* 手机号输入样式 */
|
||||
.mobile-input-section {
|
||||
/* 福利电话输入样式 */
|
||||
.welfare-mobile-input-section {
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
@@ -367,17 +367,17 @@ layout("/layouts/platform_h5.html"){
|
||||
border: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.mobile-input-section .van-field {
|
||||
.welfare-mobile-input-section .van-field {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
.mobile-input-section .van-field__label {
|
||||
.welfare-mobile-input-section .van-field__label {
|
||||
width: 70px;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.mobile-input-section .van-field__control {
|
||||
.welfare-mobile-input-section .van-field__control {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
@@ -678,14 +678,14 @@ layout("/layouts/platform_h5.html"){
|
||||
<div class="confirm-sheet-title">确认选择</div>
|
||||
|
||||
<div class="confirm-content-scroll">
|
||||
<!-- 手机号输入 -->
|
||||
<div class="mobile-input-section">
|
||||
<!-- 福利电话输入:统一读写用户资料中的 welfareMobile -->
|
||||
<div class="welfare-mobile-input-section">
|
||||
<van-field
|
||||
v-model="formData.mobile"
|
||||
label="联系电话"
|
||||
placeholder="请输入手机号码"
|
||||
:error="mobileError"
|
||||
@focus="mobileError = false"
|
||||
v-model="formData.welfareMobile"
|
||||
label="福利电话"
|
||||
placeholder="请输入福利电话"
|
||||
:error="welfareMobileError"
|
||||
@focus="welfareMobileError = false"
|
||||
maxlength="11"
|
||||
required
|
||||
></van-field>
|
||||
@@ -792,10 +792,10 @@ layout("/layouts/platform_h5.html"){
|
||||
hasSubmittedBefore: false, // 是否之前提交过
|
||||
showOptionDetailDialog: false, // 选项详情弹窗
|
||||
selectedOption: null, // 当前选中的选项
|
||||
mobileError: false, // 手机号错误标记
|
||||
welfareMobileError: false, // 福利电话错误标记
|
||||
formData: {
|
||||
userSign: "", // 用户签名
|
||||
mobile: "", // 手机号码
|
||||
welfareMobile: "", // 福利电话
|
||||
address: "" // 收货地址
|
||||
},
|
||||
|
||||
@@ -884,18 +884,13 @@ layout("/layouts/platform_h5.html"){
|
||||
this.userSelection = resp.data
|
||||
this.hasSubmittedBefore = this.userSelection.length > 0
|
||||
|
||||
// 如果有用户选择数据,从中获取手机号
|
||||
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) {
|
||||
this.formData.mobile = this.userSelection[0].mobile
|
||||
|
||||
// 获取签名信息(如果有)
|
||||
// 历史选择仅负责回显签名,福利电话始终从用户资料获取。
|
||||
if (this.userSelection && this.userSelection.length > 0) {
|
||||
if (this.userSelection[0].userSign) {
|
||||
this.formData.userSign = this.userSelection[0].userSign
|
||||
this.$set(this.formData, "userSign", this.userSelection[0].userSign)
|
||||
}
|
||||
} else if (this.$store.user && this.$store.user.mobile) {
|
||||
// 如果没有选择过,使用store中的默认手机号
|
||||
this.formData.mobile = this.$store.user.mobile
|
||||
}
|
||||
this.getWelfareMobile()
|
||||
|
||||
// 地址回显
|
||||
if (this.projectInfo.provideMode === 3) {
|
||||
@@ -930,6 +925,15 @@ layout("/layouts/platform_h5.html"){
|
||||
})
|
||||
},
|
||||
|
||||
// 获取当前用户福利电话,返回值为字符串或空值。
|
||||
getWelfareMobile() {
|
||||
this.$axios.post("/platform/welfare/userSelect/getWelfareMobile", {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(this.formData, "welfareMobile", res.data || "")
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 执行提交
|
||||
doSubmit() {
|
||||
// 再次检查截止时间
|
||||
@@ -941,8 +945,8 @@ layout("/layouts/platform_h5.html"){
|
||||
return
|
||||
}
|
||||
|
||||
// 验证手机号
|
||||
if (!this.validateMobile()) {
|
||||
// 验证福利电话
|
||||
if (!this.validateWelfareMobile()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -975,8 +979,7 @@ layout("/layouts/platform_h5.html"){
|
||||
selections = [
|
||||
{
|
||||
selectOptionId: this.selectedRadioId,
|
||||
selectNum: 1,
|
||||
mobile: this.formData.mobile
|
||||
selectNum: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -985,8 +988,7 @@ layout("/layouts/platform_h5.html"){
|
||||
else {
|
||||
selections = this.selectedOptions.map((option) => ({
|
||||
selectOptionId: option.id,
|
||||
selectNum: option.selectNum,
|
||||
mobile: this.formData.mobile
|
||||
selectNum: option.selectNum
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1007,12 +1009,10 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$axios
|
||||
.post("/platform/welfare/userSelect/confirmSelect", {
|
||||
projectId: this.projectId,
|
||||
welfareMobile: this.formData.welfareMobile,
|
||||
selections: JSON.stringify(selections)
|
||||
})
|
||||
.then((res) => {
|
||||
loading.clear()
|
||||
this.isSubmitting = false
|
||||
|
||||
if (res.code === 0) {
|
||||
this.$toast.success("选择成功")
|
||||
setTimeout(() => {
|
||||
@@ -1023,24 +1023,26 @@ layout("/layouts/platform_h5.html"){
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$toast.fail("网络错误,请重试")
|
||||
})
|
||||
.finally(() => {
|
||||
loading.clear()
|
||||
this.isSubmitting = false
|
||||
this.$toast.fail("网络错误,请重试")
|
||||
})
|
||||
},
|
||||
|
||||
// 验证手机号
|
||||
validateMobile() {
|
||||
if (!this.formData.mobile) {
|
||||
this.mobileError = true
|
||||
this.$toast.fail("请输入手机号码")
|
||||
// 验证福利电话必填且为有效的 11 位手机号码,返回布尔值。
|
||||
validateWelfareMobile() {
|
||||
if (!this.formData.welfareMobile) {
|
||||
this.welfareMobileError = true
|
||||
this.$toast.fail("请输入福利电话")
|
||||
return false
|
||||
}
|
||||
|
||||
const mobileReg = /^1[3456789]\d{9}$/
|
||||
if (!mobileReg.test(this.formData.mobile)) {
|
||||
this.mobileError = true
|
||||
this.$toast.fail("请输入正确的手机号码")
|
||||
if (!mobileReg.test(this.formData.welfareMobile)) {
|
||||
this.welfareMobileError = true
|
||||
this.$toast.fail("请输入正确的福利电话")
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user