This commit is contained in:
Paidax
2025-05-09 10:03:47 +08:00
parent 3d5927ec6f
commit 69ae3c7409
7 changed files with 926 additions and 650 deletions
@@ -523,6 +523,7 @@ public class WelfareCommonController {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
id, id,
mobile,
loginname, loginname,
username, username,
personType, personType,
@@ -571,8 +572,9 @@ public class WelfareCommonController {
List<ExcelExportEntity> entityList = new ArrayList<>(); List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("工号", "loginname", 20)); entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("姓名", "username", 20)); entityList.add(new ExcelExportEntity("姓名", "username", 20));
entityList.add(new ExcelExportEntity("联系电话", "mobile", 20));
entityList.add(new ExcelExportEntity("在职状态", "userState", 20)); entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
entityList.add(new ExcelExportEntity("人员性质", "personType", 20)); // entityList.add(new ExcelExportEntity("人员类型", "personType", 20));
entityList.add(new ExcelExportEntity("所属工会", "unionname", 50)); entityList.add(new ExcelExportEntity("所属工会", "unionname", 50));
entityList.add(new ExcelExportEntity("所属单位", "unitname", 50)); entityList.add(new ExcelExportEntity("所属单位", "unitname", 50));
@@ -44,6 +44,7 @@ import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy; import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -97,6 +98,7 @@ public class WelfareListController {
@Param(value = "provideMode", required = false) Integer provideMode, @Param(value = "provideMode", required = false) Integer provideMode,
@Param(value = "optionId", required = false) String optionId, @Param(value = "optionId", required = false) String optionId,
@Param(value = "month", required = false) String month, @Param(value = "month", required = false) String month,
@Param(value = "isChoose", required = false) Integer isChoose,
@Param(value = "courierNumber", required = false) String courierNumber) { @Param(value = "courierNumber", required = false) String courierNumber) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
@@ -141,6 +143,14 @@ public class WelfareListController {
cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit()); cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit());
cnd.andEX("wl.unitid", "=", pageParam.getUnit()); cnd.andEX("wl.unitid", "=", pageParam.getUnit());
if (isChoose != null) {
if (isChoose.equals(1)) {
cnd.and("wus.selectUserId", "is not", null);
} else if (isChoose.equals(2)) {
cnd.and("wus.selectUserId", "is", null);
}
}
if (Lang.isNotEmpty(pageParam.getPersonTypes())) { if (Lang.isNotEmpty(pageParam.getPersonTypes())) {
String personTypes = pageParam.getPersonTypes(); String personTypes = pageParam.getPersonTypes();
String[] personTypeArray = Json.fromJsonAsArray(String.class, personTypes); String[] personTypeArray = Json.fromJsonAsArray(String.class, personTypes);
@@ -665,6 +675,36 @@ public class WelfareListController {
} }
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object queryNotWelfareListUsers(@Param("projectId") String projectId, @Param("query") String query){
if (StrUtil.isBlank(query)) {
return null;
}
Sql sql = Sqls.create("""
SELECT
id,
loginname,
username,
unitid,
unitname
FROM
`user`
$condition
AND id not in (select userId from welfare_list where projectId = @projectId)
""").setParam("projectId", projectId);
Cnd cnd = Cnd.NEW();
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("loginname", query);
seg.orLike("username", query);
cnd.and(seg);
sql.setCondition(cnd);
Pagination pagination = welfareListService.listPageMap(1, 10, sql);
return pagination;
}
@At @At
@ViReturn @ViReturn
@RequiresPermissions("welfare.list.mange") @RequiresPermissions("welfare.list.mange")
@@ -682,4 +722,36 @@ public class WelfareListController {
} }
return null; return null;
} }
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object addWelfareList(@Param("projectId") String projectId, @Param("userIds") String[] userIds) {
List<String> userIdList = Arrays.stream(userIds).collect(Collectors.toList());
Sql sql = Sqls.create("select id,loginname,username,unionid,unitid,userState,personType from `user` where id in (@userIdList)")
.setParam("userIdList", userIdList);
sql.setCallback(Sqls.callback.maps());
dao.execute(sql);
List<NutMap> userInfoList = (List<NutMap>) sql.getResult();
List<WelfareList> welfareLists = userInfoList.stream().map(v -> {
WelfareList welfareList = new WelfareList();
welfareList.setId(R.UU32());
welfareList.setProjectId(projectId);
welfareList.setUserId(v.getString("id"));
welfareList.setWelfareUnitId(v.getString("unionid"));
welfareList.setWelfareSecondLevelUnitId(v.getString("unitid"));
welfareList.setIsReceive(null);
welfareList.setIsAutoSelect(null);
welfareList.setUserState(v.getString("userState"));
welfareList.setPersonType(v.getString("personType"));
return welfareList;
}).collect(Collectors.toList());
dao.fastInsert(welfareLists);
return null;
}
} }
@@ -1,10 +1,13 @@
package io.v.nutz.zhgh.welfare.controller; package io.v.nutz.zhgh.welfare.controller;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination; import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.SimpleService; import io.v.nutz.base.service.SimpleService;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.slog.annotation.SLog; import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.welfare.model.WelfareList; import io.v.nutz.zhgh.welfare.model.WelfareList;
@@ -14,6 +17,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain; import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
@@ -27,6 +31,7 @@ import org.nutz.mvc.annotation.Param;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* @ClassName WelfareChooseController * @ClassName WelfareChooseController
@@ -39,12 +44,17 @@ import java.util.List;
@At("/platform/welfare/userChoose") @At("/platform/welfare/userChoose")
public class WelfareUserChooseController { public class WelfareUserChooseController {
@Inject
private Dao dao;
@Inject @Inject
private SimpleService simpleService; private SimpleService simpleService;
@Inject
private SysUserService sysUserService;
@Inject @Inject
private WelfareProjectService welfareProjectService; private WelfareProjectService welfareProjectService;
private final ReentrantLock lock = new ReentrantLock(true);
@At("") @At("")
@Ok("beetl:/platform/welfare/userChoose.html") @Ok("beetl:/platform/welfare/userChoose.html")
@RequiresPermissions("welfare.user.choose") @RequiresPermissions("welfare.user.choose")
@@ -94,30 +104,44 @@ public class WelfareUserChooseController {
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@SLog(type = "welfare", tag = "pc电脑选福利", msg = "福利") @SLog(type = "welfare", tag = "pc电脑选福利", msg = "福利")
@RequiresPermissions("welfare.user.choose") @RequiresPermissions("welfare.user.choose")
public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress) { public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress,
//删除上次选择的 @Param(value = "mobile",required = false) String mobile) {
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId) try {
.and("selectUserId", "=", ShiroUtil.getUserId())); lock.lock();
String userId = ShiroUtil.getUserId();
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", userId));
List<WelfareUserSelection> insertList = new ArrayList<>(); List<WelfareUserSelection> insertList = new ArrayList<>();
List<String> ids = Json.fromJsonAsList(String.class, chooseIds); List<String> ids = Json.fromJsonAsList(String.class, chooseIds);
ids.forEach(s -> { ids.forEach(s -> {
WelfareUserSelection selection = new WelfareUserSelection(); WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(projectId); selection.setWelfareId(projectId);
selection.setSubjectId(subjectId); selection.setSubjectId(subjectId);
selection.setSelectUserId(ShiroUtil.getUserId()); selection.setSelectUserId(userId);
selection.setSelectTime(new Date()); selection.setSelectTime(new Date());
selection.setSelectOptionId(s); selection.setSelectOptionId(s);
selection.setReceiveAddress(receiveAddress); selection.setReceiveAddress(receiveAddress);
insertList.add(selection); insertList.add(selection);
}); });
simpleService.dao().insert(insertList); simpleService.dao().insert(insertList);
simpleService.dao().update(WelfareList.class, simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true), Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId) Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId())); .and("userId", "=", userId));
return null;
if (StrUtil.isNotBlank(mobile)) {
dao.update(Sys_user.class, Chain.make("mobile", mobile), Cnd.where("id", "=", userId));
}
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
} finally {
lock.unlock();
}
} }
@@ -127,31 +151,55 @@ public class WelfareUserChooseController {
@SLog(type = "welfare", tag = "选择福利", msg = "福利") @SLog(type = "welfare", tag = "选择福利", msg = "福利")
@RequiresPermissions("welfare.user.choose") @RequiresPermissions("welfare.user.choose")
public Result confirmSelect(@Param("welfareUserSelections") WelfareUserSelection[] welfareUserSelections, public Result confirmSelect(@Param("welfareUserSelections") WelfareUserSelection[] welfareUserSelections,
String projectId) { String projectId, @Param(value = "mobile",required = false) String mobile) {
int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getUserId())); try {
if (count == 0) { lock.lock();
return Result.error("您暂无权限!"); String userId = ShiroUtil.getUserId();
int count = simpleService.dao().count(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", userId));
if (count <= 0) {
return Result.error("您不在此次选择名单中,如有疑问请及时联系校工会");
}
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class,
Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", userId));
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
welfareUserSelection.setSelectUserId(userId);
welfareUserSelection.setSelectTime(new Date());
}
simpleService.dao().insert(welfareUserSelections);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", userId));
if (StrUtil.isNotBlank(mobile)) {
dao.update(Sys_user.class, Chain.make("mobile", mobile), Cnd.where("id", "=", userId));
}
return Result.success("选择成功");
} catch (Exception e) {
e.printStackTrace();
return Result.error();
} finally {
lock.unlock();
} }
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class,
Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
welfareUserSelection.setSelectUserId(ShiroUtil.getUserId());
welfareUserSelection.setSelectTime(new Date());
}
simpleService.dao().insert(welfareUserSelections);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return Result.success("选择成功");
} }
@At
@ViReturn
@RequiresPermissions("welfare.user.choose")
public Object getUserMobile() {
Sql sql = Sqls.create("SELECT mobile FROM sys_user WHERE id = @userId").setParam("userId", ShiroUtil.getUserId());
sql.setCallback(Sqls.callback.str());
dao.execute(sql);
return sql.getResult();
}
} }
@@ -322,6 +322,9 @@ layout("/mobile/platform.html"){
style="border-radius: 8px; background: #ffffff" style="border-radius: 8px; background: #ffffff"
></van-card> ></van-card>
<div class="van-hairline--top"></div> <div class="van-hairline--top"></div>
<van-cell>
<van-field label="联系方式" v-model="mobile" required placeholder="请输入联系方式" type="tel" maxlength="11"></van-field>
</van-cell>
<van-cell @click="openShoppingPopup(item,index)" is-link title="收货门店" v-if="item.shoppingId"> <van-cell @click="openShoppingPopup(item,index)" is-link title="收货门店" v-if="item.shoppingId">
<template #label>{{item.receiveAddress?item.receiveAddress:'暂未选择'}}</template> <template #label>{{item.receiveAddress?item.receiveAddress:'暂未选择'}}</template>
</van-cell> </van-cell>
@@ -420,7 +423,8 @@ layout("/mobile/platform.html"){
optionIndex: null, optionIndex: null,
optionData: {}, optionData: {},
clickUpOrDown: false clickUpOrDown: false,
mobile: ""
} }
}, },
computed: { computed: {
@@ -613,6 +617,12 @@ layout("/mobile/platform.html"){
return return
} }
} }
if (!this.mobile || !this.mobile.match(/^1[3-9]\d{9}$/)) {
this.$modal.msg("请填写正确的手机号码")
return
}
const notReceiveAddress = [] const notReceiveAddress = []
const formData = this.projectInfo.welfareProjectSubjects[0].options const formData = this.projectInfo.welfareProjectSubjects[0].options
.filter((v) => v.selectNum >= 1) .filter((v) => v.selectNum >= 1)
@@ -639,11 +649,15 @@ layout("/mobile/platform.html"){
}) })
if (code === 0) { if (code === 0) {
this.getUserSelection(this.projectId) this.getUserSelection(this.projectId)
this.$modal.msgSuccess(msg) // this.$modal.msgSuccess(msg)
pjaxReplace("/mobile/welfare/list/receive_success?projectId=" + this.projectId + "&provideMode=" + this.projectInfo.provideMode)
} else { } else {
this.$modal.msgError(msg) vant.Dialog.alert({
title: "温馨提示",
message: msg
})
} }
this.confirmPopup = false // this.confirmPopup = false
}, },
//查看详情 //查看详情
@@ -714,6 +728,12 @@ layout("/mobile/platform.html"){
async getShoppingType() { async getShoppingType() {
const resp = await $.get("/platform/shoppingType/apply/getShoppingType") const resp = await $.get("/platform/shoppingType/apply/getShoppingType")
return resp.data return resp.data
},
async getUserMobile() {
const resp = await $.post("/platform/welfare/userChoose/getUserMobile")
if (resp.code === 0) {
this.$set(this, "mobile", resp.data)
}
} }
}, },
async created() { async created() {
@@ -739,8 +759,15 @@ layout("/mobile/platform.html"){
window.sessionStorage.removeItem("welfareProjectSelectInfo" + loginname) window.sessionStorage.removeItem("welfareProjectSelectInfo" + loginname)
// this.selectAddressPopup = true // this.selectAddressPopup = true
} else { } else {
const flag = localStorage.getItem("reload")
if (flag) {
window.location.reload()
localStorage.removeItem("reload")
}
this.getProjectInfo() this.getProjectInfo()
} }
await this.getUserMobile()
} }
}) })
window.addEventListener("pageshow", (e) => { window.addEventListener("pageshow", (e) => {
@@ -8,38 +8,47 @@ layout("/mobile/platform.html"){
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
<van-sticky> <van-sticky>
<van-nav-bar :title="title" left-arrow <van-nav-bar :title="title" left-arrow @click-left="back"></van-nav-bar>
@click-left="history.back()"></van-nav-bar>
</van-sticky> </van-sticky>
<div style="text-align: center;margin-top: 200px;"> <div style="text-align: center; margin-top: 200px">
<svg t="1642388297798" class="icon" viewBox="0 0 1024 1024" version="1.1" <svg
xmlns="http://www.w3.org/2000/svg" t="1642388297798"
p-id="3082" width="80" height="80"> class="icon"
<path d="M37.36963 583.753525a440.246475 430.879529 90 1 0 861.759058 0 440.246475 430.879529 90 1 0-861.759058 0Z" viewBox="0 0 1024 1024"
fill="#07C160" p-id="3083"></path> version="1.1"
<path d="M247.376566 529.799914L391.065522 674.425565l299.742281-299.742281 59.948456 59.948456-359.690737 358.754043L187.240771 589.748371z" xmlns="http://www.w3.org/2000/svg"
fill="#FFFFFF" p-id="3084"></path> p-id="3082"
<path d="M955.330366 240.548613h-83.927839a30.723584 30.723584 0 0 0-31.472939 30.161567v1.124034a30.910923 30.910923 0 0 0 30.348906 31.472939H955.330366a30.723584 30.723584 0 0 0 31.2856-30.348906v-1.124033A30.536245 30.536245 0 0 0 955.330366 240.548613z m-72.125487-168.605033a32.222295 32.222295 0 0 0-43.837308 4.121457L786.725333 141.071644a31.285601 31.285601 0 0 0 48.146104 39.903191l52.080221-64.819268a30.536245 30.536245 0 0 0-2.810084-42.900614zM683.126907 0.005433a30.910923 30.910923 0 0 0-31.47294 30.161567v84.864533a30.723584 30.723584 0 0 0 30.348906 31.285601h1.124034a30.536245 30.536245 0 0 0 31.2856-30.161567V31.291033A30.723584 30.723584 0 0 0 684.25094 0.005433z" width="80"
fill="#07C160" p-id="3085"></path> height="80"
>
<path
d="M37.36963 583.753525a440.246475 430.879529 90 1 0 861.759058 0 440.246475 430.879529 90 1 0-861.759058 0Z"
fill="#07C160"
p-id="3083"
></path>
<path
d="M247.376566 529.799914L391.065522 674.425565l299.742281-299.742281 59.948456 59.948456-359.690737 358.754043L187.240771 589.748371z"
fill="#FFFFFF"
p-id="3084"
></path>
<path
d="M955.330366 240.548613h-83.927839a30.723584 30.723584 0 0 0-31.472939 30.161567v1.124034a30.910923 30.910923 0 0 0 30.348906 31.472939H955.330366a30.723584 30.723584 0 0 0 31.2856-30.348906v-1.124033A30.536245 30.536245 0 0 0 955.330366 240.548613z m-72.125487-168.605033a32.222295 32.222295 0 0 0-43.837308 4.121457L786.725333 141.071644a31.285601 31.285601 0 0 0 48.146104 39.903191l52.080221-64.819268a30.536245 30.536245 0 0 0-2.810084-42.900614zM683.126907 0.005433a30.910923 30.910923 0 0 0-31.47294 30.161567v84.864533a30.723584 30.723584 0 0 0 30.348906 31.285601h1.124034a30.536245 30.536245 0 0 0 31.2856-30.161567V31.291033A30.723584 30.723584 0 0 0 684.25094 0.005433z"
fill="#07C160"
p-id="3085"
></path>
</svg> </svg>
<div style="margin-top: 20px;">{{code=='2' ? '您已领取' : '您已选择'}}</div> <div style="margin-top: 20px">{{code=='2' ? '您已领取' : '您已选择'}}</div>
<div style="margin: 20px auto 0px auto;width: 300px;word-break: break-all"> <div style="margin: 20px auto 0px auto; width: 300px; word-break: break-all">福利品: {{selectOptionNames}}</div>
福利品: {{selectOptionNames}} <van-button style="margin-top: 20px; width: 100px" size="small" hairline type="primary" @click="back">返回</van-button>
</div>
<van-button style="margin-top: 20px;width: 100px" size="small" hairline type="primary"
@click="back">返回
</van-button>
</div> </div>
</div> </div>
<script> <script>
<!--#include("/mobile/welfare/include/mixins.js"){}#--> <!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({ const vue = new Vue({
el: '#app', el: "#app",
mixins: [mobileMixins, welfareMixins], mixins: [mobileMixins, welfareMixins],
data() { data() {
return { return {
@@ -48,11 +57,12 @@ layout("/mobile/platform.html"){
}, },
methods: { methods: {
async getUserSelection() { async getUserSelection() {
const resp = await $.get('/mobile/welfare/mine/getUserSelect', {projectId: this.projectId}) const resp = await $.get("/mobile/welfare/mine/getUserSelect", { projectId: this.projectId })
this.selectOptionNames = resp.data this.selectOptionNames = resp.data
}, },
back() { back() {
window.history.go(-1) pjaxReplace("/mobile/welfare/list/receive?projectId=" + this.projectId)
localStorage.setItem("reload", "1")
} }
}, },
created() { created() {
@@ -63,7 +73,7 @@ layout("/mobile/platform.html"){
} }
this.provideMode = GetQueryString("provideMode") this.provideMode = GetQueryString("provideMode")
this.code = GetQueryString("code") this.code = GetQueryString("code")
this.title = this.code === '1' ? "选择结果" : '领取结果' this.title = this.code === "1" ? "选择结果" : "领取结果"
} }
}) })
</script> </script>
File diff suppressed because it is too large Load Diff
@@ -29,7 +29,7 @@ layout("/layouts/platform.html"){
} }
.desc_label { .desc_label {
width: 75px; /*width: 75px;*/
-webkit-flex-shrink: 0; -webkit-flex-shrink: 0;
flex-shrink: 0; flex-shrink: 0;
padding-right: 4px; padding-right: 4px;
@@ -56,12 +56,12 @@ layout("/layouts/platform.html"){
<div class="search-item-label">年&emsp;&emsp;度:</div> <div class="search-item-label">年&emsp;&emsp;度:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-date-picker <el-date-picker
@change="doSearch" @change="doSearch"
placeholder="请选择" placeholder="请选择"
style="width: 100%" style="width: 100%"
type="year" type="year"
v-model="pageForm.year" v-model="pageForm.year"
value-format="yyyy" value-format="yyyy"
></el-date-picker> ></el-date-picker>
</div> </div>
</div> </div>
@@ -77,34 +77,34 @@ layout("/layouts/platform.html"){
</table-tool> </table-tool>
<el-table <el-table
:data="tableData" :data="tableData"
:size="tableSize" :size="tableSize"
@sort-change="pageOrder" @sort-change="pageOrder"
ref="table" ref="table"
row-key="id" row-key="id"
style="width: 100%" style="width: 100%"
v-loading="tableLoading" v-loading="tableLoading"
> >
<el-table-column <el-table-column
:index="indexMethod" :index="indexMethod"
align="center" align="center"
header-align="center" header-align="center"
label="序号" label="序号"
type="index" type="index"
width="80px" width="80px"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
:key="column.prop" :key="column.prop"
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:sortable="column.sortable" :sortable="column.sortable"
:width="column.width" :width="column.width"
align="center" align="center"
header-align="center" header-align="center"
min-width="100px" min-width="100px"
show-overflow-tooltip show-overflow-tooltip
v-for="column in tableColumns" v-for="column in tableColumns"
> >
<template scope="{row}" v-if="column.prop=='choiceTime'"> <template scope="{row}" v-if="column.prop=='choiceTime'">
<i class="el-icon-time"></i> <i class="el-icon-time"></i>
@@ -130,9 +130,7 @@ layout("/layouts/platform.html"){
<el-table-column align="center" header-align="center" label="操作" prop="userOnline" width="150px"> <el-table-column align="center" header-align="center" label="操作" prop="userOnline" width="150px">
<template scope="{row}"> <template scope="{row}">
<el-button type="primary" size="mini" @click="openChoose(row)"> <el-button type="primary" size="mini" @click="openChoose(row)">{{confirmButtonInfo(row).text}}</el-button>
{{confirmButtonInfo(row).text}}
</el-button>
<!-- <el-button @click="openChoose(row)" size="mini" type="primary"--> <!-- <el-button @click="openChoose(row)" size="mini" type="primary"-->
<!-- v-if="new Date().getTime()>moment(row.choiceTimeStart).valueOf()--> <!-- v-if="new Date().getTime()>moment(row.choiceTimeStart).valueOf()-->
@@ -155,7 +153,7 @@ layout("/layouts/platform.html"){
<template #edit> <template #edit>
<el-card shadow="never"> <el-card shadow="never">
<el-form :model="formData" label-width="120px" ref="addForm"> <el-form :model="formData" label-width="120px" ref="addForm" :rules="addFormRules">
<el-form-item label="福利名称"> <el-form-item label="福利名称">
<span style="font-weight: bold; font-size: 20px">{{projectInfo.name}}</span> <span style="font-weight: bold; font-size: 20px">{{projectInfo.name}}</span>
</el-form-item> </el-form-item>
@@ -167,8 +165,7 @@ layout("/layouts/platform.html"){
<el-form-item label="福利礼品">{{projectInfo.gift}}</el-form-item> <el-form-item label="福利礼品">{{projectInfo.gift}}</el-form-item>
</el-col> </el-col>
<el-col span="8"> <el-col span="8">
<el-form-item label="选择形式">{{projectInfo.isCheckBox==='checkBox'?'多选':'单选'}} <el-form-item label="选择形式">{{projectInfo.isCheckBox==='checkBox'?'多选':'单选'}}</el-form-item>
</el-form-item>
</el-col> </el-col>
<el-col span="8" v-if="projectInfo.isCheckBox==='checkBox'"> <el-col span="8" v-if="projectInfo.isCheckBox==='checkBox'">
<el-form-item label="最多选几个">{{projectInfo.multiSelectNum}}个</el-form-item> <el-form-item label="最多选几个">{{projectInfo.multiSelectNum}}个</el-form-item>
@@ -190,9 +187,7 @@ layout("/layouts/platform.html"){
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col span="8"> <el-col span="8">
<el-form-item label="选择时间"> <el-form-item label="选择时间">{{projectInfo.choiceTimeStart}}至{{projectInfo.choiceTimeEnd}}</el-form-item>
{{projectInfo.choiceTimeStart}}至{{projectInfo.choiceTimeEnd}}
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -204,26 +199,26 @@ layout("/layouts/platform.html"){
<div slot="header" style="display: flex; justify-content: space-between"> <div slot="header" style="display: flex; justify-content: space-between">
<div style="color: #000; font-size: 18px">{{option.optionName}}</div> <div style="color: #000; font-size: 18px">{{option.optionName}}</div>
<div> <div>
<el-button @click.stop="viewDesc(option)" type="text">套餐详情 <el-button @click.stop="viewDesc(option)" type="text">套餐详情</el-button>
</el-button>
</div> </div>
</div> </div>
<div style="display: grid; grid-template-rows: auto 1fr auto; height: 200px"> <div style="display: grid; grid-template-rows: auto 1fr auto; height: 200px">
<div style="display: flex"> <div style="display: flex">
<el-image <el-image
style="width: 150px; height: 150px" style="width: 150px; height: 150px"
:src="CREATE_PREVIEW_URL(option.imgUrl)" :src="CREATE_PREVIEW_URL(option.imgUrl)"
fit="contain" fit="contain"
></el-image> ></el-image>
<div style="width: calc(100% - 150px); padding-left: 20px; position: relative"> <div style="width: calc(100% - 150px); padding-left: 20px; position: relative">
<div style="white-space: nowrap; display: flex"> <div style="white-space: normal; display: flex">
<span class="desc_label"></span> <span class="desc_label"></span>
<el-tooltip placement="top" :content="option.supplier"> <el-tooltip placement="top" :content="option.supplier">
<!-- style="width: calc(100% - 80px);text-overflow: ellipsis;overflow: hidden;overflow-y: auto;height: 100px;" -->
<span <span
class="desc_value" class="desc_value"
style="width: calc(100% - 80px); text-overflow: ellipsis; overflow: hidden" style="text-overflow: ellipsis; overflow: hidden; overflow-y: auto; height: 100px"
> >
{{ option.supplier }} {{ option.supplier }}
</span> </span>
@@ -235,30 +230,31 @@ layout("/layouts/platform.html"){
</div> </div>
<div> <div>
<el-input-number <el-input-number
:disabled="isView" :disabled="isView"
:max="option.maxNum" :max="option.maxNum"
:min="0" :min="0"
@keydown.native="onKeydown" @keydown.native="onKeydown"
@change="numChange(option.selectNum, option, oidx)" @change="numChange(option.selectNum, option, oidx)"
style="width: 150px; position: absolute; right: 0; bottom: 0" style="width: 150px; position: absolute; right: 0; bottom: 0"
v-model="option.selectNum" v-model="option.selectNum"
></el-input-number> ></el-input-number>
</div> </div>
</div> </div>
</div> </div>
<div style="margin-top: 17px"> <div style="margin-top: 17px">
<el-select <el-select
style="width: 100%" style="width: 100%"
clearable clearable
:disabled="option.selectNum == 0" filterable
placeholder="请选择取货门店" v-if="option.receiveAddressList && option.receiveAddressList.length > 0 && option.selectNum > 0"
v-model="option.receiveAddress" placeholder="请选择取货门店"
v-model="option.receiveAddress"
> >
<el-option <el-option
v-for="item in option.receiveAddressList" v-for="item in option.receiveAddressList"
:key="item.address" :key="item.address"
:label="item.address" :label="item.address"
:value="item.address" :value="item.address"
></el-option> ></el-option>
</el-select> </el-select>
</div> </div>
@@ -269,6 +265,21 @@ layout("/layouts/platform.html"){
</el-row> </el-row>
</el-form-item> </el-form-item>
<el-row gutter="20">
<el-col span="24">
<el-form-item label="联系方式" prop="mobile">
<el-input
v-model="formData.mobile"
placeholder="请输入联系方式"
:disabled="isView"
maxlength="11"
type="text"
show-word-limit
></el-input>
</el-form-item>
</el-col>
</el-row>
<template v-if="projectInfo.provideMode===3"> <template v-if="projectInfo.provideMode===3">
<el-row gutter="20"> <el-row gutter="20">
<el-col span="24" v-if="!isView"> <el-col span="24" v-if="!isView">
@@ -276,17 +287,17 @@ layout("/layouts/platform.html"){
<div style="display: flex; column-gap: 10px"> <div style="display: flex; column-gap: 10px">
<div style="flex: 1"> <div style="flex: 1">
<el-select <el-select
@change="addressChange" @change="addressChange"
filterable filterable
placeholder="请选择收货地址" placeholder="请选择收货地址"
style="width: 100%" style="width: 100%"
v-model="formData.addressId" v-model="formData.addressId"
> >
<el-option <el-option
:key="item.id" :key="item.id"
:label="item.name+' '+item.defaultName" :label="item.name+' '+item.defaultName"
:value="item.id" :value="item.id"
v-for="item in addressOptions" v-for="item in addressOptions"
></el-option> ></el-option>
</el-select> </el-select>
</div> </div>
@@ -302,17 +313,17 @@ layout("/layouts/platform.html"){
</el-col> </el-col>
<el-col span="24"> <el-col span="24">
<el-form-item <el-form-item
:rules="{required:true,message: '请确认收货地址', trigger: 'blur'}" :rules="{required:true,message: '请确认收货地址', trigger: 'blur'}"
label="请确认收货地址" label="请确认收货地址"
prop="receiveAddress" prop="receiveAddress"
> >
<el-input <el-input
:rows="4" :rows="4"
disabled disabled
maxlength="100" maxlength="100"
placeholder="选择收货地址联动" placeholder="选择收货地址联动"
type="textarea" type="textarea"
v-model="formData.receiveAddress" v-model="formData.receiveAddress"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -320,20 +331,20 @@ layout("/layouts/platform.html"){
</template> </template>
<el-form-item <el-form-item
:rules="{required:true,message: '请签字', trigger: 'blur'}" :rules="{required:true,message: '请签字', trigger: 'blur'}"
label="签字" label="签字"
prop="sign" prop="sign"
v-if="projectInfo.signMode===2" v-if="projectInfo.signMode===2"
> >
<template v-if="isChoice===0||!isView"> <template v-if="isChoice===0||!isView">
<sign :is_value_base64="false" :qz.sync="formData.sign" prefix="welfare" ref="sign"></sign> <sign :is_value_base64="false" :qz.sync="formData.sign" prefix="welfare" ref="sign"></sign>
</template> </template>
<template v-else> <template v-else>
<el-image <el-image
:src="'/signature/getSignData?path=' +formData.imageUrl" :src="'/signature/getSignData?path=' +formData.imageUrl"
fit="contain" fit="contain"
style="height: 100px; width: 100%" style="height: 100px; width: 100%"
v-if="formData.imageUrl" v-if="formData.imageUrl"
></el-image> ></el-image>
<span v-else>暂无</span> <span v-else>暂无</span>
</template> </template>
@@ -355,31 +366,30 @@ layout("/layouts/platform.html"){
</el-drawer> </el-drawer>
<el-dialog :close-on-click-modal="false" :visible.sync="addressDialogVisible" title="收货地址" width="40%"> <el-dialog :close-on-click-modal="false" :visible.sync="addressDialogVisible" title="收货地址" width="40%">
<el-form :model="formData" label-position="right" :rules="formRules" label-suffix=":" label-width="120px" <el-form :model="formData" label-position="right" :rules="formRules" label-suffix=":" label-width="120px" ref="addForm">
ref="addForm">
<el-row :gutter="60"> <el-row :gutter="60">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="地址信息" prop="addressList"> <el-form-item label="地址信息" prop="addressList">
<el-cascader <el-cascader
:options="dzOptions" :options="dzOptions"
:props="{ expandTrigger: 'hover' }" :props="{ expandTrigger: 'hover' }"
@change="handleChange" @change="handleChange"
clearable clearable
placeholder="请选择地址信息" placeholder="请选择地址信息"
style="width: 100%" style="width: 100%"
v-model="formData.addressList" v-model="formData.addressList"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="详细地址" prop="addressDetail"> <el-form-item label="详细地址" prop="addressDetail">
<el-input <el-input
maxlength="100" maxlength="100"
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息" placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
rows="3" rows="3"
show-word-limit show-word-limit
type="textarea" type="textarea"
v-model="formData.addressDetail" v-model="formData.addressDetail"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -390,21 +400,20 @@ layout("/layouts/platform.html"){
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="手机号码" prop="tel"> <el-form-item label="手机号码" prop="tel">
<el-input maxlength="11" placeholder="请填写手机号码" clearable <el-input maxlength="11" placeholder="请填写手机号码" clearable v-model="formData.tel"></el-input>
v-model="formData.tel"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="是否默认" prop="isDefault"> <el-form-item label="是否默认" prop="isDefault">
<el-switch <el-switch
v-model="formData.isDefault" v-model="formData.isDefault"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949" inactive-color="#ff4949"
active-value="1" active-value="1"
inactive-value="0" inactive-value="0"
active-text="是" active-text="是"
inactive-text="否" inactive-text="否"
></el-switch> ></el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -440,12 +449,12 @@ layout("/layouts/platform.html"){
year: moment().format("YYYY") year: moment().format("YYYY")
}, },
tableColumns: [ tableColumns: [
{prop: "year", label: "年度"}, { prop: "year", label: "年度" },
{prop: "name", label: "项目名称"}, { prop: "name", label: "项目名称" },
{prop: "choiceTime", label: "选择时间"}, { prop: "choiceTime", label: "选择时间" },
{prop: "isChoose", label: "是否选择"}, { prop: "isChoose", label: "是否选择" },
{prop: "gist_list", label: "所选福利"}, { prop: "gist_list", label: "所选福利" },
{prop: "receiveAddress", label: "收货地址"} { prop: "receiveAddress", label: "收货地址" }
], ],
isView: false, isView: false,
isChoice: false, isChoice: false,
@@ -453,12 +462,18 @@ layout("/layouts/platform.html"){
addressDialogVisible: false, addressDialogVisible: false,
formRules: { formRules: {
addressList: [{required: true, message: "请选择地址信息", trigger: ["blur", "change"]}], addressList: [{ required: true, message: "请选择地址信息", trigger: ["blur", "change"] }],
addressDetail: [{required: true, message: "请填写您的详细地址", trigger: ["blur", "change"]}], addressDetail: [{ required: true, message: "请填写您的详细地址", trigger: ["blur", "change"] }],
userName: [{required: true, message: "请填写收货人姓名", trigger: ["blur", "change"]}], userName: [{ required: true, message: "请填写收货人姓名", trigger: ["blur", "change"] }],
tel: [ tel: [
{required: true, message: "必填", trigger: ["blur", "change"]}, { required: true, message: "必填", trigger: ["blur", "change"] },
{pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号"} { pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号" }
]
},
addFormRules: {
mobile: [
{ required: true, message: "必填", trigger: ["blur", "change"] },
{ pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号" }
] ]
}, },
@@ -485,30 +500,30 @@ layout("/layouts/platform.html"){
} }
}, },
confirmButtonInfo(row) { confirmButtonInfo(row) {
const {choiceTimeEnd, choiceTimeStart, overdueChoiceTimeEnd, isChoose, selectTime} = row const { choiceTimeEnd, choiceTimeStart, overdueChoiceTimeEnd, isChoose, selectTime } = row
const now = moment().valueOf() const now = moment().valueOf()
if (overdueChoiceTimeEnd == null || overdueChoiceTimeEnd === "") { if (overdueChoiceTimeEnd == null || overdueChoiceTimeEnd === "") {
if (now > moment(choiceTimeStart).valueOf() && now < moment(choiceTimeEnd).valueOf()) { if (now > moment(choiceTimeStart).valueOf() && now < moment(choiceTimeEnd).valueOf()) {
return {text: isChoose ? "修改" : "选择", disabled: false} return { text: isChoose ? "修改" : "选择", disabled: false }
} else if (now > moment(choiceTimeEnd).valueOf()) { } else if (now > moment(choiceTimeEnd).valueOf()) {
return {text: "选择已结束", disabled: true} return { text: "选择已结束", disabled: true }
} else if (now < moment(choiceTimeStart).valueOf()) { } else if (now < moment(choiceTimeStart).valueOf()) {
return {text: "选择未开始", disabled: true} return { text: "选择未开始", disabled: true }
} }
} else { } else {
//已选择了不能再动了 //已选择了不能再动了
if (isChoose) { if (isChoose) {
if (moment(selectTime).valueOf() > moment(choiceTimeEnd).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) { if (moment(selectTime).valueOf() > moment(choiceTimeEnd).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: "修改", disabled: false} return { text: "修改", disabled: false }
} }
return {text: "选择已结束", disabled: true} return { text: "选择已结束", disabled: true }
} else { } else {
if (now > moment(choiceTimeStart).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) { if (now > moment(choiceTimeStart).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: isChoose ? "修改" : "选择", disabled: false} return { text: isChoose ? "修改" : "选择", disabled: false }
} else if (now > moment(overdueChoiceTimeEnd).valueOf()) { } else if (now > moment(overdueChoiceTimeEnd).valueOf()) {
return {text: "选择已结束", disabled: true} return { text: "选择已结束", disabled: true }
} else if (now < moment(choiceTimeStart).valueOf()) { } else if (now < moment(choiceTimeStart).valueOf()) {
return {text: "选择未开始", disabled: true} return { text: "选择未开始", disabled: true }
} }
} }
} }
@@ -568,7 +583,7 @@ layout("/layouts/platform.html"){
}) })
}, },
handlePlusButtonClick(value, option, optionIndex) { handlePlusButtonClick(value, option, optionIndex) {
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo const { isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection } = this.projectInfo
if (isCheckBox === "checkBox") { if (isCheckBox === "checkBox") {
//判断是否支持单个多选 //判断是否支持单个多选
if (!singleOptionSupportMultipleSelection && value > 1) { if (!singleOptionSupportMultipleSelection && value > 1) {
@@ -588,7 +603,7 @@ layout("/layouts/platform.html"){
}, },
async getProjectInfo(id) { async getProjectInfo(id) {
const resp = await $.get("/platform/welfare/common/findOne", {projectId: id}) const resp = await $.get("/platform/welfare/common/findOne", { projectId: id })
if (resp.code === 0) { if (resp.code === 0) {
resp.data.multiSelectNum = resp.data.multiSelectNum ? resp.data.multiSelectNum : 1 resp.data.multiSelectNum = resp.data.multiSelectNum ? resp.data.multiSelectNum : 1
this.projectInfo = resp.data this.projectInfo = resp.data
@@ -619,7 +634,7 @@ layout("/layouts/platform.html"){
doChoose() { doChoose() {
this.$refs["addForm"].validate(async (valid) => { this.$refs["addForm"].validate(async (valid) => {
if (valid) { if (valid) {
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo const { isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection } = this.projectInfo
if (isCheckBox === "checkBox") { if (isCheckBox === "checkBox") {
if (this.sumSelectNum < multiSelectNum) { if (this.sumSelectNum < multiSelectNum) {
//用户没有选择完 //用户没有选择完
@@ -683,9 +698,10 @@ layout("/layouts/platform.html"){
} }
}) })
console.log(formData) console.log(formData)
const {code, msg, data} = await $.post("/platform/welfare/userChoose/confirmSelect", { const { code, msg, data } = await $.post("/platform/welfare/userChoose/confirmSelect", {
welfareUserSelections: JSON.stringify(formData), welfareUserSelections: JSON.stringify(formData),
projectId: this.projectInfo.id projectId: this.projectInfo.id,
mobile: this.formData.mobile
}) })
if (code === 0) { if (code === 0) {
this.$message.success("您已完成本次福利选择。") this.$message.success("您已完成本次福利选择。")
@@ -732,7 +748,7 @@ layout("/layouts/platform.html"){
}, },
//获取用户选择的数据 //获取用户选择的数据
async getUserSelection(projectId) { async getUserSelection(projectId) {
const resp = await $.get("/platform/welfare/mine/getUserSelection", {projectId: projectId}) const resp = await $.get("/platform/welfare/mine/getUserSelection", { projectId: projectId })
this.userSelection = resp.data this.userSelection = resp.data
this.echoUserSelection() this.echoUserSelection()
}, },
@@ -751,7 +767,7 @@ layout("/layouts/platform.html"){
}) })
}, },
async getChoice() { async getChoice() {
const resp = await $.get("/mobile/welfare/mine/isChoice", {projectId: this.projectInfo.id}) const resp = await $.get("/mobile/welfare/mine/isChoice", { projectId: this.projectInfo.id })
this.isChoice = resp.data this.isChoice = resp.data
}, },
async selectUserAddress() { async selectUserAddress() {
@@ -772,12 +788,18 @@ layout("/layouts/platform.html"){
}, },
// 获取供应商 // 获取供应商
async getShoppingType() { async getShoppingType() {
const {data} = await $.get("/platform/shoppingType/apply/getShoppingType") const { data } = await $.get("/platform/shoppingType/apply/getShoppingType")
this.projectInfo.welfareProjectSubjects[0].options.forEach((item) => { this.projectInfo.welfareProjectSubjects[0].options.forEach((item) => {
item.receiveAddressList = data.find((v) => v.id === item.shoppingId)?.offlineStores item.receiveAddressList = data.find((v) => v.id === item.shoppingId)?.offlineStores
}) })
console.log(this.projectInfo.welfareProjectSubjects[0]) console.log(this.projectInfo.welfareProjectSubjects[0])
},
async getUserMobile() {
const resp = await $.post("/platform/welfare/userChoose/getUserMobile")
if (resp.code === 0) {
this.$set(this.formData, "mobile", resp.data)
}
} }
}, },
async created() { async created() {
@@ -789,6 +811,7 @@ layout("/layouts/platform.html"){
getEnumOptions("WelfareSignMode").then((res) => { getEnumOptions("WelfareSignMode").then((res) => {
this.welfareSignMode = res this.welfareSignMode = res
}) })
await this.getUserMobile()
} }
}) })
</script> </script>