This commit is contained in:
Paidax
2024-12-26 13:48:24 +08:00
parent d6c4f48afc
commit a45b3d638a
5 changed files with 145 additions and 77 deletions
@@ -78,9 +78,9 @@ public class WelfareUserChooseController {
Cnd cnd = Cnd.NEW();
cnd.and("wp.provideMode", "in", "2,3");
cnd.and("wl.userId", "=", ShiroUtil.getUserId());
cnd.andEX("YEAR(wp.choiceTimeStart)", "in", year);
cnd.and("wp.isDisabled", "=", 0);
cnd.and("wp.id","!=","fe1d51dafc104a1482cc946d05312e78");
cnd.groupBy("wp.id");
cnd.desc("YEAR(wp.choiceTimeStart)");
sql.setCondition(cnd);
@@ -139,7 +139,11 @@ layout("/mobile/platform.html"){
right: 0;
transform: rotate(23deg);
z-index: 1;
}
}
.van-submit-bar__button {
width: 150px;
}
</style>
<div id="app" v-cloak>
@@ -274,7 +278,8 @@ layout("/mobile/platform.html"){
</van-submit-bar>
</template>
<van-popup :style="{ height: '70%' }" closeable position="bottom" safe-area-inset-bottom
<van-popup :style="{ height: '70%' }" closeable :close-on-click-overlay="false" position="bottom" safe-area-inset-bottom
v-model="selectAddressPopup">
<div style="height: 100%">
<div style="font-size: 16px;font-weight: bold;text-align: center;padding-top: 16px;">
@@ -287,10 +292,17 @@ layout("/mobile/platform.html"){
<span style="font-size: 15px">{{item.address}}</span>
</template>
<template #label>
<div style="font-size: 14px;line-height: 1.5rem">
<div>{{"地区:" + item.province + item.city + item.county}}</div>
<div>{{"收件人:" + item.name}}</div>
<div>{{"联系方式" + item.tel}}</div>
<div style="display: flex">
<div style="font-size: 14px;line-height: 1.5rem;width: 80%">
<div>{{"地区:" + item.province + item.city + item.county}}</div>
<div>{{"收件人" + item.name}}</div>
<div>{{"联系方式:" + item.tel}}</div>
</div>
<div style="width: 20%;display: flex;align-content: flex-end;flex-wrap: wrap;flex-direction: column;justify-content: space-around;">
<van-button @click="editAddress(item)" style="width: 80px;font-size: 14px" round type="info" size="small">编辑</van-button>
<van-button @click="deleteAddress(item)" style="width: 80px;font-size: 14px" round type="danger" size="small">删除</van-button>
</div>
</div>
</template>
</van-cell>
@@ -306,7 +318,6 @@ layout("/mobile/platform.html"){
</van-button>
</div>
</div>
</van-popup>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom
@@ -443,7 +454,7 @@ layout("/mobile/platform.html"){
if (overdueChoiceTimeEnd == null || overdueChoiceTimeEnd === '') {
if (now > moment(choiceTimeStart).valueOf() && now < moment(choiceTimeEnd).valueOf()) {
return {text: this.isSelect ? '确定修改' : '确定选择', disabled: false}
return {text: this.isSelect ? '选好了,下一步' : '选好了,下一步', disabled: false}
} else if (now > moment(choiceTimeEnd).valueOf()) {
return {text: '选择已结束', disabled: true}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -453,12 +464,12 @@ layout("/mobile/platform.html"){
//已选择了不能再动了
if (this.isSelect) {
if (moment(this.selectTime).valueOf() > moment(choiceTimeEnd).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: '确定修改', disabled: false}
return {text: '下一步', disabled: false}
}
return {text: '选择已结束', disabled: true}
} else {
if (now > moment(choiceTimeStart).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: this.isSelect ? '确定修改' : '确定选择', disabled: false}
return {text: this.isSelect ? '选好了,下一步' : '选好了,下一步', disabled: false}
} else if (now > moment(overdueChoiceTimeEnd).valueOf()) {
return {text: '选择已结束', disabled: true}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -477,6 +488,46 @@ layout("/mobile/platform.html"){
}
},
methods: {
editAddress(item) {
pjaxReplace('/mobile/welfare/mine/addressEdit?projectId=' + this.projectId + '&id=' + item.id)
window.sessionStorage.setItem('welfareProjectId', this.projectId)
const formData = {
projectInfo: this.projectInfo,
signData: this.signData || null
}
window.sessionStorage.setItem('welfareProjectSelectInfo' + "${@shiro.getPrincipalProperty('loginname')}", JSON.stringify(formData))
},
deleteAddress(item) {
this.selectAddressPopup = true
// 确认要删除该地址吗
this.$dialog.confirm({
title: '提示',
message: '确认要删除该地址吗'
}).then(async () => {
const loading = this.$toast.loading({
message: '删除中...',
forbidClick: true,
overlay: true,
duration: 0
})
const resp = await $.post('/mobile/welfare/mine/deleteAddress', {id: item.id})
loading.close()
if (resp.code === 0) {
this.$toast.success(resp.msg)
}
await this.selectAddressList()
if (this.addressList && this.addressList.length > 0) {
const resp = this.addressList.find(v=> v.isDefault)
this.addressClick(resp)
} else {
this.selectAddress = ''
}
this.selectAddressPopup = true
}).catch(() => {
this.selectAddressPopup = true
})
},
// top字体颜色
getRankColor(rank) {
switch(rank) {
@@ -602,6 +653,7 @@ layout("/mobile/platform.html"){
}
this.confirmPopup = false
await this.getProjectInfo()
window.location.reload()
},
//查看详情
@@ -640,6 +692,10 @@ layout("/mobile/platform.html"){
//地址列表点击
addressClick(item) {
if (item == null) {
this.selectAddress = null
return
}
const {province, city, county, address, name, tel} = item
this.selectAddress = "收货地址:" + province + city + county + address + "," + "收件人:" + name + "," + "联系方式:" + tel
},
@@ -662,12 +718,15 @@ layout("/mobile/platform.html"){
//回显用户选择的数据
echoUserSelection() {
let selectNum = 0;
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
const option = this.userSelection.find(x => x.selectOptionId === v.id)
if (option) {
v.selectNum = option.selectNum
selectNum = Number(selectNum) + Number(v.selectNum)
}
})
this.selectNum = selectNum
},
},
created() {
@@ -64,14 +64,13 @@ layout("/layouts/platform.html"){
title="收货地址"
:close-on-click-modal="false"
:visible.sync="dialogVisible"
width="30%">
width="40%">
<el-form :model="formData" label-position="right"
<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 :rules="{required:true,message: '请选择地址信息', trigger: 'blur'}"
label="地址信息"
<el-form-item label="地址信息"
prop="addressList">
<el-cascader
:options="dzOptions"
@@ -84,10 +83,7 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写您的详细地址', trigger: 'blur'}"
label="详细地址"
prop="addressDetail">
<el-form-item label="详细地址" prop="addressDetail">
<el-input maxlength="100"
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
rows="3"
@@ -97,25 +93,31 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写收货人姓名', trigger: 'blur'}"
label="收货人姓名"
prop="userName">
<el-form-item label="收货人姓名" prop="userName">
<el-input maxlength="11"
placeholder="请填写收货人姓名"
v-model="formData.userName"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写手机号码', trigger: 'blur'}"
label="手机号码"
prop="tel">
<el-input maxlength="11" placeholder="请填写手机号码"
type="tel"
<el-form-item label="手机号码" prop="tel">
<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="否">
</el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
@@ -140,7 +142,13 @@ layout("/layouts/platform.html"){
{prop: 'address', label: '所在地区'},
{prop: 'addressDetail', label: '详细地址'},
{prop: 'tel', label: '电话'},
]
],
formRules: {
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: '请输入正确的手机号'}],
},
}
},
methods: {
@@ -181,7 +189,10 @@ layout("/layouts/platform.html"){
},
openAddress() {
this.formData = {}
this.formData = {
userName: "${@shiro.getPrincipalProperty('username')}",
tel: "${@shiro.getPrincipalProperty('mobile')}"
}
this.dialogVisible = true
if (this.$refs["addForm"])
this.$refs["addForm"].resetFields();
@@ -251,10 +262,6 @@ layout("/layouts/platform.html"){
},
async created() {
this.pageData()
if ("${@shiro.hasRole('sysadmin')}" === 'false') {
this.dzOptions = this.dzOptions.filter(d => d.label === "江苏省")
this.dzOptions[0].children = this.dzOptions[0].children.filter(d => d.label === "无锡市")
}
}
})
</script>
@@ -618,20 +618,16 @@ layout("/layouts/platform.html"){
this.$refs.openQRCode.openCode('/mobile/welfare/list/receive?projectId=' + row.id)
},
isCheckBoxChange() {
this.formData.welfareProjectSubjects = [{
subjectName: '请输入福利信息',
subjectType: this.formData.isCheckBox ? this.formData.isCheckBox : 'radio',
defaultOption: null,
options: [
{
optionType: "套餐",
optionName: '福利1',
optionNameId: '',
optionSort: '1',
imgUrl: ''
}
]
}]
this.formData.welfareProjectSubjects.forEach(v=> {
v.subjectType = this.formData.isCheckBox ? this.formData.isCheckBox : 'radio'
})
// this.formData.welfareProjectSubjects = [{
// subjectName: '请输入福利信息',
// subjectType: this.formData.isCheckBox ? this.formData.isCheckBox : 'radio',
// defaultOption: null,
//
// }]
},
async handleAvatarSuccess(res, file) {
@@ -312,6 +312,7 @@ layout("/layouts/platform.html"){
</div>
</div>
<span style="color: #ac3111">温馨提示:填写默认收货地址后,系统会自动选择默认地址;如未设置默认,请您在添加收货地址后在此下拉框进行选择</span>
</el-form-item>
</el-col>
<el-col span="24">
@@ -368,14 +369,13 @@ layout("/layouts/platform.html"){
:close-on-click-modal="false"
:visible.sync="addressDialogVisible"
title="收货地址"
width="30%">
width="40%">
<el-form :model="formData" label-position="right"
<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 :rules="{required:true,message: '请选择地址信息', trigger: 'blur'}"
label="地址信息"
<el-form-item label="地址信息"
prop="addressList">
<el-cascader
:options="dzOptions"
@@ -388,10 +388,7 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写您的详细地址', trigger: 'blur'}"
label="详细地址"
prop="addressDetail">
<el-form-item label="详细地址" prop="addressDetail">
<el-input maxlength="100"
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
rows="3"
@@ -401,25 +398,31 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写收货人姓名', trigger: 'blur'}"
label="收货人姓名"
prop="userName">
<el-form-item label="收货人姓名" prop="userName">
<el-input maxlength="11"
placeholder="请填写收货人姓名"
v-model="formData.userName"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item
:rules="{required:true,message: '请填写手机号码', trigger: 'blur'}"
label="手机号码"
prop="tel">
<el-input maxlength="11" placeholder="请填写手机号码"
type="tel"
<el-form-item label="手机号码" prop="tel">
<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="否">
</el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
@@ -464,6 +467,13 @@ layout("/layouts/platform.html"){
isChoice: false,
addressDialogVisible: false,
formRules: {
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: '请输入正确的手机号'}],
},
}
},
computed: {
@@ -480,7 +490,7 @@ layout("/layouts/platform.html"){
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}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -490,12 +500,12 @@ layout("/layouts/platform.html"){
//已选择了不能再动了
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}
} 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}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -745,6 +755,9 @@ layout("/layouts/platform.html"){
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
})
this.addressOptions = resp.data
this.formData.addressId = this.addressOptions.find(v=> v.isDefault).id
},
},
async created() {
@@ -756,13 +769,6 @@ layout("/layouts/platform.html"){
getEnumOptions("WelfareSignMode").then(res => {
this.welfareSignMode = res
})
if ("${@shiro.hasRole('sysadmin')}" === 'false') {
this.dzOptions = this.dzOptions.filter(d => d.label === "江苏省")
this.dzOptions[0].children = this.dzOptions[0].children.filter(d => d.label === "无锡市")
}
}
})