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("""
SELECT
id,
mobile,
loginname,
username,
personType,
@@ -571,8 +572,9 @@ public class WelfareCommonController {
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("姓名", "username", 20));
entityList.add(new ExcelExportEntity("联系电话", "mobile", 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("所属单位", "unitname", 50));
@@ -44,6 +44,7 @@ import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
@@ -97,6 +98,7 @@ public class WelfareListController {
@Param(value = "provideMode", required = false) Integer provideMode,
@Param(value = "optionId", required = false) String optionId,
@Param(value = "month", required = false) String month,
@Param(value = "isChoose", required = false) Integer isChoose,
@Param(value = "courierNumber", required = false) String courierNumber) {
Sql sql = Sqls.create("""
SELECT
@@ -141,6 +143,14 @@ public class WelfareListController {
cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit());
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())) {
String personTypes = pageParam.getPersonTypes();
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
@ViReturn
@RequiresPermissions("welfare.list.mange")
@@ -682,4 +722,36 @@ public class WelfareListController {
}
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;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
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.utils.ShiroUtil;
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.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
@@ -27,6 +31,7 @@ import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
/**
* @ClassName WelfareChooseController
@@ -39,12 +44,17 @@ import java.util.List;
@At("/platform/welfare/userChoose")
public class WelfareUserChooseController {
@Inject
private Dao dao;
@Inject
private SimpleService simpleService;
@Inject
private SysUserService sysUserService;
@Inject
private WelfareProjectService welfareProjectService;
private final ReentrantLock lock = new ReentrantLock(true);
@At("")
@Ok("beetl:/platform/welfare/userChoose.html")
@RequiresPermissions("welfare.user.choose")
@@ -94,30 +104,44 @@ public class WelfareUserChooseController {
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "welfare", tag = "pc电脑选福利", msg = "福利")
@RequiresPermissions("welfare.user.choose")
public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress) {
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", ShiroUtil.getUserId()));
public Object doChoose(String chooseIds, String projectId, String subjectId, String receiveAddress,
@Param(value = "mobile",required = false) String mobile) {
try {
lock.lock();
String userId = ShiroUtil.getUserId();
//删除上次选择的
simpleService.dao().clear(WelfareUserSelection.class, Cnd.where("welfareId", "=", projectId)
.and("selectUserId", "=", userId));
List<WelfareUserSelection> insertList = new ArrayList<>();
List<String> ids = Json.fromJsonAsList(String.class, chooseIds);
ids.forEach(s -> {
WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(projectId);
selection.setSubjectId(subjectId);
selection.setSelectUserId(ShiroUtil.getUserId());
selection.setSelectTime(new Date());
selection.setSelectOptionId(s);
selection.setReceiveAddress(receiveAddress);
insertList.add(selection);
});
simpleService.dao().insert(insertList);
simpleService.dao().update(WelfareList.class,
Chain.make("isReceive", true),
Cnd.where("projectId", "=", projectId)
.and("userId", "=", ShiroUtil.getUserId()));
return null;
List<WelfareUserSelection> insertList = new ArrayList<>();
List<String> ids = Json.fromJsonAsList(String.class, chooseIds);
ids.forEach(s -> {
WelfareUserSelection selection = new WelfareUserSelection();
selection.setWelfareId(projectId);
selection.setSubjectId(subjectId);
selection.setSelectUserId(userId);
selection.setSelectTime(new Date());
selection.setSelectOptionId(s);
selection.setReceiveAddress(receiveAddress);
insertList.add(selection);
});
simpleService.dao().insert(insertList);
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();
}
}
@@ -127,31 +151,55 @@ public class WelfareUserChooseController {
@SLog(type = "welfare", tag = "选择福利", msg = "福利")
@RequiresPermissions("welfare.user.choose")
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()));
if (count == 0) {
return Result.error("您暂无权限!");
try {
lock.lock();
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"
></van-card>
<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">
<template #label>{{item.receiveAddress?item.receiveAddress:'暂未选择'}}</template>
</van-cell>
@@ -420,7 +423,8 @@ layout("/mobile/platform.html"){
optionIndex: null,
optionData: {},
clickUpOrDown: false
clickUpOrDown: false,
mobile: ""
}
},
computed: {
@@ -613,6 +617,12 @@ layout("/mobile/platform.html"){
return
}
}
if (!this.mobile || !this.mobile.match(/^1[3-9]\d{9}$/)) {
this.$modal.msg("请填写正确的手机号码")
return
}
const notReceiveAddress = []
const formData = this.projectInfo.welfareProjectSubjects[0].options
.filter((v) => v.selectNum >= 1)
@@ -639,11 +649,15 @@ layout("/mobile/platform.html"){
})
if (code === 0) {
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 {
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() {
const resp = await $.get("/platform/shoppingType/apply/getShoppingType")
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() {
@@ -739,8 +759,15 @@ layout("/mobile/platform.html"){
window.sessionStorage.removeItem("welfareProjectSelectInfo" + loginname)
// this.selectAddressPopup = true
} else {
const flag = localStorage.getItem("reload")
if (flag) {
window.location.reload()
localStorage.removeItem("reload")
}
this.getProjectInfo()
}
await this.getUserMobile()
}
})
window.addEventListener("pageshow", (e) => {
@@ -8,38 +8,47 @@ layout("/mobile/platform.html"){
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar :title="title" left-arrow
@click-left="history.back()"></van-nav-bar>
<van-nav-bar :title="title" left-arrow @click-left="back"></van-nav-bar>
</van-sticky>
<div style="text-align: center;margin-top: 200px;">
<svg t="1642388297798" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3082" width="80" 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>
<div style="text-align: center; margin-top: 200px">
<svg
t="1642388297798"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="3082"
width="80"
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>
<div style="margin-top: 20px;">{{code=='2' ? '您已领取' : '您已选择'}}</div>
<div style="margin: 20px auto 0px auto;width: 300px;word-break: break-all">
福利品: {{selectOptionNames}}
</div>
<van-button style="margin-top: 20px;width: 100px" size="small" hairline type="primary"
@click="back">返回
</van-button>
<div style="margin-top: 20px">{{code=='2' ? '您已领取' : '您已选择'}}</div>
<div style="margin: 20px auto 0px auto; width: 300px; word-break: break-all">福利品: {{selectOptionNames}}</div>
<van-button style="margin-top: 20px; width: 100px" size="small" hairline type="primary" @click="back">返回</van-button>
</div>
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
el: "#app",
mixins: [mobileMixins, welfareMixins],
data() {
return {
@@ -48,11 +57,12 @@ layout("/mobile/platform.html"){
},
methods: {
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
},
back() {
window.history.go(-1)
pjaxReplace("/mobile/welfare/list/receive?projectId=" + this.projectId)
localStorage.setItem("reload", "1")
}
},
created() {
@@ -63,7 +73,7 @@ layout("/mobile/platform.html"){
}
this.provideMode = GetQueryString("provideMode")
this.code = GetQueryString("code")
this.title = this.code === '1' ? "选择结果" : '领取结果'
this.title = this.code === "1" ? "选择结果" : "领取结果"
}
})
</script>
File diff suppressed because it is too large Load Diff
@@ -29,7 +29,7 @@ layout("/layouts/platform.html"){
}
.desc_label {
width: 75px;
/*width: 75px;*/
-webkit-flex-shrink: 0;
flex-shrink: 0;
padding-right: 4px;
@@ -56,12 +56,12 @@ layout("/layouts/platform.html"){
<div class="search-item-label">年&emsp;&emsp;度:</div>
<div class="search-item-option">
<el-date-picker
@change="doSearch"
placeholder="请选择"
style="width: 100%"
type="year"
v-model="pageForm.year"
value-format="yyyy"
@change="doSearch"
placeholder="请选择"
style="width: 100%"
type="year"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</div>
</div>
@@ -77,34 +77,34 @@ layout("/layouts/platform.html"){
</table-tool>
<el-table
:data="tableData"
:size="tableSize"
@sort-change="pageOrder"
ref="table"
row-key="id"
style="width: 100%"
v-loading="tableLoading"
:data="tableData"
:size="tableSize"
@sort-change="pageOrder"
ref="table"
row-key="id"
style="width: 100%"
v-loading="tableLoading"
>
<el-table-column
:index="indexMethod"
align="center"
header-align="center"
label="序号"
type="index"
width="80px"
:index="indexMethod"
align="center"
header-align="center"
label="序号"
type="index"
width="80px"
></el-table-column>
<el-table-column
:key="column.prop"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
:width="column.width"
align="center"
header-align="center"
min-width="100px"
show-overflow-tooltip
v-for="column in tableColumns"
:key="column.prop"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
:width="column.width"
align="center"
header-align="center"
min-width="100px"
show-overflow-tooltip
v-for="column in tableColumns"
>
<template scope="{row}" v-if="column.prop=='choiceTime'">
<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">
<template scope="{row}">
<el-button type="primary" size="mini" @click="openChoose(row)">
{{confirmButtonInfo(row).text}}
</el-button>
<el-button type="primary" size="mini" @click="openChoose(row)">{{confirmButtonInfo(row).text}}</el-button>
<!-- <el-button @click="openChoose(row)" size="mini" type="primary"-->
<!-- v-if="new Date().getTime()>moment(row.choiceTimeStart).valueOf()-->
@@ -155,7 +153,7 @@ layout("/layouts/platform.html"){
<template #edit>
<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="福利名称">
<span style="font-weight: bold; font-size: 20px">{{projectInfo.name}}</span>
</el-form-item>
@@ -167,8 +165,7 @@ layout("/layouts/platform.html"){
<el-form-item label="福利礼品">{{projectInfo.gift}}</el-form-item>
</el-col>
<el-col span="8">
<el-form-item label="选择形式">{{projectInfo.isCheckBox==='checkBox'?'多选':'单选'}}
</el-form-item>
<el-form-item label="选择形式">{{projectInfo.isCheckBox==='checkBox'?'多选':'单选'}}</el-form-item>
</el-col>
<el-col span="8" v-if="projectInfo.isCheckBox==='checkBox'">
<el-form-item label="最多选几个">{{projectInfo.multiSelectNum}}个</el-form-item>
@@ -190,9 +187,7 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-col>
<el-col span="8">
<el-form-item label="选择时间">
{{projectInfo.choiceTimeStart}}至{{projectInfo.choiceTimeEnd}}
</el-form-item>
<el-form-item label="选择时间">{{projectInfo.choiceTimeStart}}至{{projectInfo.choiceTimeEnd}}</el-form-item>
</el-col>
</el-row>
@@ -204,26 +199,26 @@ layout("/layouts/platform.html"){
<div slot="header" style="display: flex; justify-content: space-between">
<div style="color: #000; font-size: 18px">{{option.optionName}}</div>
<div>
<el-button @click.stop="viewDesc(option)" type="text">套餐详情
</el-button>
<el-button @click.stop="viewDesc(option)" type="text">套餐详情</el-button>
</div>
</div>
<div style="display: grid; grid-template-rows: auto 1fr auto; height: 200px">
<div style="display: flex">
<el-image
style="width: 150px; height: 150px"
:src="CREATE_PREVIEW_URL(option.imgUrl)"
fit="contain"
style="width: 150px; height: 150px"
:src="CREATE_PREVIEW_URL(option.imgUrl)"
fit="contain"
></el-image>
<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>
<el-tooltip placement="top" :content="option.supplier">
<!-- style="width: calc(100% - 80px);text-overflow: ellipsis;overflow: hidden;overflow-y: auto;height: 100px;" -->
<span
class="desc_value"
style="width: calc(100% - 80px); text-overflow: ellipsis; overflow: hidden"
class="desc_value"
style="text-overflow: ellipsis; overflow: hidden; overflow-y: auto; height: 100px"
>
{{ option.supplier }}
</span>
@@ -235,30 +230,31 @@ layout("/layouts/platform.html"){
</div>
<div>
<el-input-number
:disabled="isView"
:max="option.maxNum"
:min="0"
@keydown.native="onKeydown"
@change="numChange(option.selectNum, option, oidx)"
style="width: 150px; position: absolute; right: 0; bottom: 0"
v-model="option.selectNum"
:disabled="isView"
:max="option.maxNum"
:min="0"
@keydown.native="onKeydown"
@change="numChange(option.selectNum, option, oidx)"
style="width: 150px; position: absolute; right: 0; bottom: 0"
v-model="option.selectNum"
></el-input-number>
</div>
</div>
</div>
<div style="margin-top: 17px">
<el-select
style="width: 100%"
clearable
:disabled="option.selectNum == 0"
placeholder="请选择取货门店"
v-model="option.receiveAddress"
style="width: 100%"
clearable
filterable
v-if="option.receiveAddressList && option.receiveAddressList.length > 0 && option.selectNum > 0"
placeholder="请选择取货门店"
v-model="option.receiveAddress"
>
<el-option
v-for="item in option.receiveAddressList"
:key="item.address"
:label="item.address"
:value="item.address"
v-for="item in option.receiveAddressList"
:key="item.address"
:label="item.address"
:value="item.address"
></el-option>
</el-select>
</div>
@@ -269,6 +265,21 @@ layout("/layouts/platform.html"){
</el-row>
</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">
<el-row gutter="20">
<el-col span="24" v-if="!isView">
@@ -276,17 +287,17 @@ layout("/layouts/platform.html"){
<div style="display: flex; column-gap: 10px">
<div style="flex: 1">
<el-select
@change="addressChange"
filterable
placeholder="请选择收货地址"
style="width: 100%"
v-model="formData.addressId"
@change="addressChange"
filterable
placeholder="请选择收货地址"
style="width: 100%"
v-model="formData.addressId"
>
<el-option
:key="item.id"
:label="item.name+' '+item.defaultName"
:value="item.id"
v-for="item in addressOptions"
:key="item.id"
:label="item.name+' '+item.defaultName"
:value="item.id"
v-for="item in addressOptions"
></el-option>
</el-select>
</div>
@@ -302,17 +313,17 @@ layout("/layouts/platform.html"){
</el-col>
<el-col span="24">
<el-form-item
:rules="{required:true,message: '请确认收货地址', trigger: 'blur'}"
label="请确认收货地址"
prop="receiveAddress"
:rules="{required:true,message: '请确认收货地址', trigger: 'blur'}"
label="请确认收货地址"
prop="receiveAddress"
>
<el-input
:rows="4"
disabled
maxlength="100"
placeholder="选择收货地址联动"
type="textarea"
v-model="formData.receiveAddress"
:rows="4"
disabled
maxlength="100"
placeholder="选择收货地址联动"
type="textarea"
v-model="formData.receiveAddress"
></el-input>
</el-form-item>
</el-col>
@@ -320,20 +331,20 @@ layout("/layouts/platform.html"){
</template>
<el-form-item
:rules="{required:true,message: '请签字', trigger: 'blur'}"
label="签字"
prop="sign"
v-if="projectInfo.signMode===2"
:rules="{required:true,message: '请签字', trigger: 'blur'}"
label="签字"
prop="sign"
v-if="projectInfo.signMode===2"
>
<template v-if="isChoice===0||!isView">
<sign :is_value_base64="false" :qz.sync="formData.sign" prefix="welfare" ref="sign"></sign>
</template>
<template v-else>
<el-image
:src="'/signature/getSignData?path=' +formData.imageUrl"
fit="contain"
style="height: 100px; width: 100%"
v-if="formData.imageUrl"
:src="'/signature/getSignData?path=' +formData.imageUrl"
fit="contain"
style="height: 100px; width: 100%"
v-if="formData.imageUrl"
></el-image>
<span v-else>暂无</span>
</template>
@@ -355,31 +366,30 @@ layout("/layouts/platform.html"){
</el-drawer>
<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"
ref="addForm">
<el-form :model="formData" label-position="right" :rules="formRules" label-suffix=":" label-width="120px" ref="addForm">
<el-row :gutter="60">
<el-col :span="24">
<el-form-item label="地址信息" prop="addressList">
<el-cascader
:options="dzOptions"
:props="{ expandTrigger: 'hover' }"
@change="handleChange"
clearable
placeholder="请选择地址信息"
style="width: 100%"
v-model="formData.addressList"
:options="dzOptions"
:props="{ expandTrigger: 'hover' }"
@change="handleChange"
clearable
placeholder="请选择地址信息"
style="width: 100%"
v-model="formData.addressList"
></el-cascader>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="详细地址" prop="addressDetail">
<el-input
maxlength="100"
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
rows="3"
show-word-limit
type="textarea"
v-model="formData.addressDetail"
maxlength="100"
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
rows="3"
show-word-limit
type="textarea"
v-model="formData.addressDetail"
></el-input>
</el-form-item>
</el-col>
@@ -390,21 +400,20 @@ layout("/layouts/platform.html"){
</el-col>
<el-col :span="24">
<el-form-item label="手机号码" prop="tel">
<el-input maxlength="11" placeholder="请填写手机号码" clearable
v-model="formData.tel"></el-input>
<el-input maxlength="11" placeholder="请填写手机号码" clearable v-model="formData.tel"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="是否默认" prop="isDefault">
<el-switch
v-model="formData.isDefault"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0"
active-text="是"
inactive-text="否"
v-model="formData.isDefault"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0"
active-text="是"
inactive-text="否"
></el-switch>
</el-form-item>
</el-col>
@@ -440,12 +449,12 @@ layout("/layouts/platform.html"){
year: moment().format("YYYY")
},
tableColumns: [
{prop: "year", label: "年度"},
{prop: "name", label: "项目名称"},
{prop: "choiceTime", label: "选择时间"},
{prop: "isChoose", label: "是否选择"},
{prop: "gist_list", label: "所选福利"},
{prop: "receiveAddress", label: "收货地址"}
{ prop: "year", label: "年度" },
{ prop: "name", label: "项目名称" },
{ prop: "choiceTime", label: "选择时间" },
{ prop: "isChoose", label: "是否选择" },
{ prop: "gist_list", label: "所选福利" },
{ prop: "receiveAddress", label: "收货地址" }
],
isView: false,
isChoice: false,
@@ -453,12 +462,18 @@ layout("/layouts/platform.html"){
addressDialogVisible: false,
formRules: {
addressList: [{required: true, message: "请选择地址信息", trigger: ["blur", "change"]}],
addressDetail: [{required: true, message: "请填写您的详细地址", trigger: ["blur", "change"]}],
userName: [{required: true, message: "请填写收货人姓名", trigger: ["blur", "change"]}],
addressList: [{ required: true, message: "请选择地址信息", trigger: ["blur", "change"] }],
addressDetail: [{ required: true, message: "请填写您的详细地址", trigger: ["blur", "change"] }],
userName: [{ required: true, message: "请填写收货人姓名", trigger: ["blur", "change"] }],
tel: [
{required: true, message: "必填", trigger: ["blur", "change"]},
{pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号"}
{ required: true, message: "必填", trigger: ["blur", "change"] },
{ 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) {
const {choiceTimeEnd, choiceTimeStart, overdueChoiceTimeEnd, isChoose, selectTime} = row
const { choiceTimeEnd, choiceTimeStart, overdueChoiceTimeEnd, isChoose, selectTime } = row
const now = moment().valueOf()
if (overdueChoiceTimeEnd == null || overdueChoiceTimeEnd === "") {
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()) {
return {text: "选择已结束", disabled: true}
return { text: "选择已结束", disabled: true }
} else if (now < moment(choiceTimeStart).valueOf()) {
return {text: "选择未开始", disabled: true}
return { text: "选择未开始", disabled: true }
}
} else {
//已选择了不能再动了
if (isChoose) {
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 {
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()) {
return {text: "选择已结束", disabled: true}
return { text: "选择已结束", disabled: true }
} 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) {
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo
const { isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection } = this.projectInfo
if (isCheckBox === "checkBox") {
//判断是否支持单个多选
if (!singleOptionSupportMultipleSelection && value > 1) {
@@ -588,7 +603,7 @@ layout("/layouts/platform.html"){
},
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) {
resp.data.multiSelectNum = resp.data.multiSelectNum ? resp.data.multiSelectNum : 1
this.projectInfo = resp.data
@@ -619,7 +634,7 @@ layout("/layouts/platform.html"){
doChoose() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo
const { isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection } = this.projectInfo
if (isCheckBox === "checkBox") {
if (this.sumSelectNum < multiSelectNum) {
//用户没有选择完
@@ -683,9 +698,10 @@ layout("/layouts/platform.html"){
}
})
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),
projectId: this.projectInfo.id
projectId: this.projectInfo.id,
mobile: this.formData.mobile
})
if (code === 0) {
this.$message.success("您已完成本次福利选择。")
@@ -732,7 +748,7 @@ layout("/layouts/platform.html"){
},
//获取用户选择的数据
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.echoUserSelection()
},
@@ -751,7 +767,7 @@ layout("/layouts/platform.html"){
})
},
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
},
async selectUserAddress() {
@@ -772,12 +788,18 @@ layout("/layouts/platform.html"){
},
// 获取供应商
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) => {
item.receiveAddressList = data.find((v) => v.id === item.shoppingId)?.offlineStores
})
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() {
@@ -789,6 +811,7 @@ layout("/layouts/platform.html"){
getEnumOptions("WelfareSignMode").then((res) => {
this.welfareSignMode = res
})
await this.getUserMobile()
}
})
</script>