first commit
This commit is contained in:
@@ -0,0 +1,781 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
.optionImg {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.optionImg .el-image {
|
||||
height: 100px;
|
||||
width: 50%;
|
||||
border-radius: 10px;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.descriptionClass {
|
||||
padding: 10px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-height: 100px;
|
||||
/*font-size: 13px;*/
|
||||
/*color: #868282;*/
|
||||
}
|
||||
|
||||
.desc_label {
|
||||
width: 75px;
|
||||
-webkit-flex-shrink: 0;
|
||||
flex-shrink: 0;
|
||||
padding-right: 4px;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
color: #7f7f7f;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.desc_value {
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava :edit_scroll="false" ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年  度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="福利项目">
|
||||
<template #func>
|
||||
|
||||
</template>
|
||||
</table-tool>
|
||||
|
||||
<el-table :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"></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">
|
||||
<template scope="{row}" v-if="column.prop=='choiceTime'">
|
||||
<i class="el-icon-time"></i> 
|
||||
{{moment(row.choiceTimeStart).format('YYYY/MM/DD HH:mm')}}
|
||||
<span>- {{moment(row.choiceTimeEnd).format('YYYY/MM/DD HH:mm')}}</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='isChoose'">
|
||||
<span v-if="row.isChoose"><el-tag type="success">已选择</el-tag></span>
|
||||
<span v-else><el-tag type="warning">未选择</el-tag></span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='gist_list'">
|
||||
<span v-if="row.gist_list">{{row.gist_list}}</span>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='receiveAddress'">
|
||||
<span v-if="row.receiveAddress">{{row.receiveAddress}}</span>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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 @click="openChoose(row)" size="mini" type="primary"-->
|
||||
<!-- v-if="new Date().getTime()>moment(row.choiceTimeStart).valueOf()-->
|
||||
<!-- &&new Date().getTime()<moment(row.choiceTimeEnd).valueOf()">选择-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button @click="openChoose(row)" size="mini" type="primary"-->
|
||||
<!-- v-else-if="new Date().getTime()>moment(row.choiceTimeStart).valueOf()-->
|
||||
<!-- &&new Date().getTime()<moment(row.overdueChoiceTimeEnd).valueOf()">选择-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <template v-else>-->
|
||||
<!-- <el-button @click="openView(row)" size="mini" type="primary">查看-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<el-card shadow="never">
|
||||
<el-form :model="formData" label-width="120px" ref="addForm">
|
||||
<el-form-item label="福利名称">
|
||||
<span style="font-weight: bold;font-size: 20px">{{projectInfo.name}}</span>
|
||||
</el-form-item>
|
||||
<el-row :gutter="10">
|
||||
<el-col span="8">
|
||||
<el-form-item label="福利节日">
|
||||
{{projectInfo.festival}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="8" v-if="!projectInfo.flexible">
|
||||
<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-col>
|
||||
<el-col span="8" v-if="projectInfo.isCheckBox==='checkBox'">
|
||||
<el-form-item label="最多选几个">
|
||||
{{projectInfo.multiSelectNum}}个
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="8">
|
||||
<el-form-item label="发放形式">
|
||||
<template>
|
||||
{{welfareProvideMode.find(v=>v.code==projectInfo.provideMode) &&
|
||||
welfareProvideMode.find(v=>v.code==projectInfo.provideMode).description}}
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="8">
|
||||
<el-form-item label="签收形式">
|
||||
<template>
|
||||
{{welfareSignMode.find(v=>v.code==projectInfo.signMode) &&
|
||||
welfareSignMode.find(v=>v.code==projectInfo.signMode).description}}
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="8">
|
||||
<el-form-item label="选择时间">
|
||||
{{projectInfo.choiceTimeStart}}至{{projectInfo.choiceTimeEnd}}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="福利套餐">
|
||||
<el-row :gutter="0">
|
||||
<div :key="subject.id"
|
||||
v-for="subject in projectInfo.welfareProjectSubjects">
|
||||
<el-col :key="oidx" :span="8"
|
||||
v-for="(option, oidx) in subject.options">
|
||||
<el-card shadow="never"
|
||||
style="margin: 5px;">
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex">
|
||||
<el-image
|
||||
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">
|
||||
<span class="desc_label">服务专线</span>
|
||||
<el-tooltip placement="top" :content="option.supplier">
|
||||
<span class="desc_value"
|
||||
style="width: calc(100% - 80px);text-overflow: ellipsis;overflow: hidden">
|
||||
{{option.supplier}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</div>-->
|
||||
<div v-if="option.simpleDesc">
|
||||
<span class="desc_label">备  注</span>
|
||||
<span class="desc_value">
|
||||
{{option.simpleDesc}}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-input-number :disabled="isView"
|
||||
:max="option.maxNum"
|
||||
:min="0"
|
||||
@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>
|
||||
|
||||
|
||||
<!-- <el-row :gutter="10">-->
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <div class="optionImg">-->
|
||||
<!-- <el-image-->
|
||||
<!-- :src="CREATE_PREVIEW_URL(option.imgUrl)"-->
|
||||
<!-- fit="contain"-->
|
||||
<!-- ></el-image>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
<!-- <div class="descriptionClass" style="white-space: pre-line">-->
|
||||
<!-- {{option.supplier}}-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <el-row style="text-align: right">-->
|
||||
<!-- <el-input-number :disabled="isView"-->
|
||||
<!-- :max="option.maxNum"-->
|
||||
<!-- :min="0"-->
|
||||
<!-- @change="numChange(option.selectNum,option,oidx)"-->
|
||||
<!-- style="width: 50%"-->
|
||||
<!-- v-model="option.selectNum"></el-input-number>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="projectInfo.provideMode===3">
|
||||
<el-row gutter="20">
|
||||
<el-col span="24" v-if="!isView">
|
||||
<el-form-item label="收货地址" prop="receiveAddress">
|
||||
<div style="display: flex; column-gap: 10px">
|
||||
<div style="flex: 1">
|
||||
<el-select @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">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-button
|
||||
@click="openAddress"
|
||||
type="primary">添加收货地址
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="24">
|
||||
<el-form-item
|
||||
:rules="{required:true,message: '请确认收货地址', trigger: 'blur'}"
|
||||
label="请确认收货地址"
|
||||
prop="receiveAddress">
|
||||
<el-input :rows="4" disabled maxlength="100"
|
||||
placeholder="选择收货地址联动" type="textarea"
|
||||
v-model="formData.receiveAddress"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-form-item :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">
|
||||
</el-image>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-row class="mt20" justify="end" type="flex">
|
||||
<el-button @click="$refs.guava.index()">关闭</el-button>
|
||||
<el-button @click="doChoose" type="primary" v-if="!isView">确定</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-drawer
|
||||
:visible.sync="descDialogVisible"
|
||||
direction="rtl"
|
||||
size="50%"
|
||||
title="福利详情">
|
||||
<el-card style="margin: 20px" shadow="never">
|
||||
<div v-html="descData"></div>
|
||||
</el-card>
|
||||
</el-drawer>
|
||||
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="addressDialogVisible"
|
||||
title="收货地址"
|
||||
width="30%">
|
||||
|
||||
<el-form :model="formData" label-position="right"
|
||||
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="地址信息"
|
||||
prop="addressList">
|
||||
<el-cascader
|
||||
: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
|
||||
:rules="{required:true,message: '请填写您的详细地址', trigger: 'blur'}"
|
||||
label="详细地址"
|
||||
prop="addressDetail">
|
||||
<el-input maxlength="100"
|
||||
placeholder="请输入详细地址信息,如道路、门牌号、小区、楼栋号、单元等信息"
|
||||
rows="3"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
v-model="formData.addressDetail"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
:rules="{required:true,message: '请填写收货人姓名', trigger: 'blur'}"
|
||||
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"
|
||||
v-model="formData.tel"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="addressDialogVisible = false">取 消</el-button>
|
||||
<el-button @click="doSaveUserAddress" type="primary">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="${base!}/assets/platform/js/chengSh.js"></script>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
addressOptions: [],
|
||||
welfareProvideMode: [],
|
||||
welfareSignMode: [],
|
||||
userSelection: [],
|
||||
userSign: "",
|
||||
dzOptions: chengShiList,
|
||||
addressList: [],
|
||||
descData: "",
|
||||
descDialogVisible: false,
|
||||
|
||||
projectInfo: {},
|
||||
welfareSubject: {},
|
||||
pageForm: {
|
||||
isChoose: false,
|
||||
year: moment().format('YYYY')
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'year', label: '年度'},
|
||||
{prop: 'name', label: '项目名称'},
|
||||
{prop: 'choiceTime', label: '选择时间'},
|
||||
{prop: 'isChoose', label: '是否选择'},
|
||||
{prop: 'gist_list', label: '所选福利'},
|
||||
{prop: 'receiveAddress', label: '收货地址'},
|
||||
],
|
||||
isView: false,
|
||||
isChoice: false,
|
||||
|
||||
addressDialogVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sumSelectNum() {
|
||||
if (this.projectInfo && this.projectInfo.welfareProjectSubjects) {
|
||||
return this.projectInfo.welfareProjectSubjects[0].options.map(v => v.selectNum).reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
||||
}
|
||||
return 0
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
confirmButtonInfo(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}
|
||||
} else if (now > moment(choiceTimeEnd).valueOf()) {
|
||||
return {text: '选择已结束', disabled: true}
|
||||
} else if (now < moment(choiceTimeStart).valueOf()) {
|
||||
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: true}
|
||||
} else {
|
||||
if (now > moment(choiceTimeStart).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
|
||||
return {text: isChoose ? '确定修改' : '确定选择', disabled: false}
|
||||
} else if (now > moment(overdueChoiceTimeEnd).valueOf()) {
|
||||
return {text: '选择已结束', disabled: true}
|
||||
} else if (now < moment(choiceTimeStart).valueOf()) {
|
||||
return {text: '选择未开始', disabled: true}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleChange(val) {
|
||||
if (val) {
|
||||
let provinceName = ""
|
||||
let cityName = ""
|
||||
let countyName = ""
|
||||
const province = this.dzOptions.find(c => c.value === val[0])
|
||||
provinceName = province.label
|
||||
const city = province.children.find(p => p.value === val[1])
|
||||
cityName = city.label
|
||||
if (val.length === 3) {
|
||||
const county = city.children.find(p => p.value === val[2])
|
||||
countyName = county.label
|
||||
this.$set(this.formData, "areaCode", county.value)
|
||||
} else {
|
||||
this.$set(this.formData, "areaCode", city.value)
|
||||
}
|
||||
this.$set(this.formData, "province", provinceName)
|
||||
this.$set(this.formData, "city", cityName)
|
||||
this.$set(this.formData, "county", countyName)
|
||||
|
||||
}
|
||||
},
|
||||
openAddress() {
|
||||
// this.formData = {}
|
||||
this.addressDialogVisible = true
|
||||
// if (this.$refs["addForm"])
|
||||
// this.$refs["addForm"].resetFields();
|
||||
},
|
||||
doSaveUserAddress() {
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message({
|
||||
message: resp.msg,
|
||||
type: 'success'
|
||||
});
|
||||
await this.selectUserAddress()
|
||||
this.addressDialogVisible = false
|
||||
} else {
|
||||
this.$message.error(resp.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//数量更改
|
||||
numChange(value, option, optionIndex) {
|
||||
|
||||
this.$nextTick(() => {
|
||||
// 查找+1按钮
|
||||
const plusButton = document.querySelector('.el-input-number__increase');
|
||||
// 添加点击事件监听器
|
||||
plusButton.addEventListener('click', this.handlePlusButtonClick(value, option, optionIndex));
|
||||
})
|
||||
|
||||
},
|
||||
handlePlusButtonClick(value, option, optionIndex) {
|
||||
const {
|
||||
isCheckBox,
|
||||
multiSelectNum,
|
||||
singleOptionSupportMultipleSelection
|
||||
} = this.projectInfo
|
||||
if (isCheckBox === 'checkBox') {
|
||||
//判断是否支持单个多选
|
||||
if (!singleOptionSupportMultipleSelection && value > 1) {
|
||||
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], 'selectNum', 1)
|
||||
this.$message.warning('此套餐最多只能选择1份');
|
||||
return;
|
||||
}
|
||||
}
|
||||
//获取用户当前选择的数量
|
||||
const selectNums = this.projectInfo.welfareProjectSubjects[0].options.map(v => v.selectNum)
|
||||
const sum = selectNums.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
||||
|
||||
if (sum > multiSelectNum) {
|
||||
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], 'selectNum', value - 1)
|
||||
this.$message.warning('此次福利最多只能选择' + multiSelectNum + '份');
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
async getProjectInfo(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
|
||||
await this.getUserSelection(id)
|
||||
await this.getChoice()
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async openView(row) {
|
||||
this.isView = true
|
||||
await this.getProjectInfo(row.id)
|
||||
//如果已选择
|
||||
if (row.isChoose > 0) {
|
||||
this.$set(this.formData, "receiveAddress", this.userSelection[0].receiveAddress)
|
||||
this.$set(this.formData, "imageUrl", this.userSelection[0].userSign)
|
||||
} else {
|
||||
this.$set(this.formData, "imageUrl", "")
|
||||
}
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
addressChange(val) {
|
||||
const address = this.addressOptions.find(a => a.id === val)
|
||||
if (address) {
|
||||
this.$set(this.formData, "receiveAddress", address.name)
|
||||
}
|
||||
},
|
||||
doChoose() {
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const {
|
||||
isCheckBox,
|
||||
multiSelectNum,
|
||||
singleOptionSupportMultipleSelection
|
||||
} = this.projectInfo
|
||||
if (isCheckBox === "checkBox") {
|
||||
if (this.sumSelectNum < multiSelectNum) {
|
||||
//用户没有选择完
|
||||
this.$message('一共可以选择' + multiSelectNum + '份,您目前只选择了' + this.sumSelectNum + '份,快去选择吧!')
|
||||
return
|
||||
}
|
||||
}
|
||||
if (this.formData.receiveAddress == null || this.formData.receiveAddress === '') {
|
||||
this.$message.warning('请填写收货地址')
|
||||
return
|
||||
}
|
||||
if (this.formData.sign == null || this.formData.sign === '') {
|
||||
this.$message.warning('请签字')
|
||||
return
|
||||
}
|
||||
const formData = this.projectInfo.welfareProjectSubjects[0].options.filter(v => v.selectNum >= 1).map(v => {
|
||||
return {
|
||||
welfareId: this.projectInfo.id,
|
||||
subjectId: v.subjectId,
|
||||
selectOptionId: v.id,
|
||||
receiveAddress: this.formData.receiveAddress,
|
||||
userSign: this.formData.sign,
|
||||
selectNum: v.selectNum
|
||||
}
|
||||
})
|
||||
const {
|
||||
code,
|
||||
msg,
|
||||
data
|
||||
} = await $.post('/platform/welfare/userChoose/confirmSelect', {
|
||||
welfareUserSelections: JSON.stringify(formData),
|
||||
projectId: this.projectInfo.id
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: msg,
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
viewDesc(val) {
|
||||
this.descData = val.description
|
||||
this.descDialogVisible = true
|
||||
},
|
||||
parseJSONOnce(jsonString){
|
||||
try {
|
||||
// 尝试解析JSON字符串
|
||||
return JSON.parse(jsonString);
|
||||
} catch (error) {
|
||||
// 如果解析失败,打印错误信息
|
||||
console.error("Invalid JSON format:", error.message);
|
||||
}
|
||||
},
|
||||
async openChoose(row) {
|
||||
if(row.isAnnualFestival){
|
||||
const unionIdList = this.parseJSONOnce(row.unionIdList)
|
||||
if (!unionIdList.includes(row.welfareUnitId)){
|
||||
this.$message.warning('您不在选择范围内,系统已为您默认选择完毕,可将鼠标移动到左侧所属福利列表,查看选取详情')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.isView = false
|
||||
if (this.confirmButtonInfo(row).disabled) {
|
||||
this.$message.warning("当前时间段无法选择")
|
||||
return
|
||||
}
|
||||
|
||||
await this.getProjectInfo(row.id)
|
||||
this.$set(this.formData, "userName", "${@shiro.getPrincipalProperty('username')}")
|
||||
this.$set(this.formData, "tel", "${@shiro.getPrincipalProperty('mobile')}")
|
||||
|
||||
//如果已选择
|
||||
if (row.isChoose > 0) {
|
||||
this.$set(this.formData, "receiveAddress", this.userSelection[0].receiveAddress)
|
||||
this.$set(this.formData, "addressId", null)
|
||||
this.$set(this.formData, "sign", this.userSelection[0].userSign)
|
||||
} else {
|
||||
const address = this.addressOptions.find(a => a.isDefault)
|
||||
if (address) {
|
||||
this.$set(this.formData, "receiveAddress", address.name)
|
||||
this.$set(this.formData, "addressId", address.id)
|
||||
}
|
||||
}
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
//获取用户选择的数据
|
||||
async getUserSelection(projectId) {
|
||||
const resp = await $.get('/platform/welfare/mine/getUserSelection', {projectId: projectId})
|
||||
this.userSelection = resp.data
|
||||
this.echoUserSelection()
|
||||
},
|
||||
//回显用户选择的数据
|
||||
echoUserSelection() {
|
||||
//获取用户当前选择的数量
|
||||
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
|
||||
const option = this.userSelection.find(x => x.selectOptionId === v.id)
|
||||
if (option) {
|
||||
v.selectNum = option.selectNum
|
||||
} else {
|
||||
v.selectNum = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
async getChoice() {
|
||||
const resp = await $.get('/mobile/welfare/mine/isChoice', {projectId: this.projectInfo.id})
|
||||
this.isChoice = resp.data
|
||||
},
|
||||
async selectUserAddress() {
|
||||
const resp = await $.get('/platform/welfare/addressManage/selectUserAddress')
|
||||
resp.data.map(r => {
|
||||
let defaultName = r.isDefault ? "默认地址" : ""
|
||||
r.defaultName = defaultName
|
||||
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
|
||||
})
|
||||
this.addressOptions = resp.data
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
this.selectUserAddress()
|
||||
getEnumOptions("WelfareProvideMode").then(res => {
|
||||
this.welfareProvideMode = res
|
||||
})
|
||||
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 === "无锡市")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user