微信支付、福利
This commit is contained in:
@@ -3,8 +3,6 @@ layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
.optionImg {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
@@ -49,7 +47,6 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava :edit_scroll="false" ref="guava">
|
||||
<template>
|
||||
@@ -59,50 +56,59 @@ layout("/layouts/platform.html"){
|
||||
<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>
|
||||
@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>
|
||||
<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>
|
||||
<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
|
||||
: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">
|
||||
: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')}}
|
||||
<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>
|
||||
|
||||
@@ -122,12 +128,9 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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}">
|
||||
<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()-->
|
||||
@@ -143,7 +146,6 @@ layout("/layouts/platform.html"){
|
||||
<!-- </template>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
@@ -153,29 +155,20 @@ layout("/layouts/platform.html"){
|
||||
<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>
|
||||
<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-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-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>
|
||||
<el-form-item label="最多选几个">{{projectInfo.multiSelectNum}}个</el-form-item>
|
||||
</el-col>
|
||||
<el-col span="8">
|
||||
<el-form-item label="发放形式">
|
||||
@@ -194,91 +187,76 @@ 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>
|
||||
|
||||
<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 :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>
|
||||
<el-button @click.stop="viewDesc(option)" type="text">套餐详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex">
|
||||
<el-image
|
||||
style="width: 150px;height: 150px;"
|
||||
<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"
|
||||
></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>
|
||||
></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"
|
||||
@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"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in option.receiveAddressList"
|
||||
:key="item.address"
|
||||
:label="item.address"
|
||||
:value="item.address"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</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>
|
||||
@@ -291,58 +269,68 @@ layout("/layouts/platform.html"){
|
||||
<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-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>
|
||||
: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>
|
||||
<el-button @click="openAddress" type="primary">添加收货地址</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<span style="color: #ac3111">
|
||||
温馨提示:填写默认收货地址后,系统会自动选择默认地址;如未设置默认,请您在添加收货地址后在此下拉框进行选择
|
||||
</span>
|
||||
</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>
|
||||
: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">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
@@ -354,85 +342,76 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-drawer
|
||||
:visible.sync="descDialogVisible"
|
||||
direction="rtl"
|
||||
size="50%"
|
||||
title="福利详情">
|
||||
<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-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-row :gutter="60">
|
||||
<el-col :span="24">
|
||||
<el-form-item :rules="{required:true,message: '请选择地址信息', trigger: 'blur'}"
|
||||
label="地址信息"
|
||||
prop="addressList">
|
||||
<el-form-item label="地址信息" prop="addressList">
|
||||
<el-cascader
|
||||
:options="dzOptions"
|
||||
:props="{ expandTrigger: 'hover' }"
|
||||
@change="handleChange"
|
||||
clearable
|
||||
placeholder="请选择地址信息"
|
||||
style="width: 100%"
|
||||
v-model="formData.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 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 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 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>
|
||||
|
||||
<span class="dialog-footer" slot="footer">
|
||||
<el-button @click="addressDialogVisible = false">取 消</el-button>
|
||||
<el-button @click="doSaveUserAddress" type="primary">保存</el-button>
|
||||
</span>
|
||||
<el-button @click="addressDialogVisible = false">取 消</el-button>
|
||||
<el-button @click="doSaveUserAddress" type="primary">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
@@ -450,56 +429,78 @@ layout("/layouts/platform.html"){
|
||||
welfareSubject: {},
|
||||
pageForm: {
|
||||
isChoose: false,
|
||||
year: moment().format('YYYY')
|
||||
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,
|
||||
|
||||
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: "请输入正确的手机号" }
|
||||
]
|
||||
},
|
||||
|
||||
// 供应商
|
||||
shoppingType: [],
|
||||
// 门店地址
|
||||
offlineStoresOption: []
|
||||
}
|
||||
},
|
||||
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 this.projectInfo.welfareProjectSubjects[0].options
|
||||
.map((v) => v.selectNum)
|
||||
.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
||||
}
|
||||
return 0
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onKeydown(event) {
|
||||
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") {
|
||||
event.preventDefault()
|
||||
}
|
||||
},
|
||||
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 (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}
|
||||
if (moment(selectTime).valueOf() > moment(choiceTimeEnd).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,12 +510,12 @@ layout("/layouts/platform.html"){
|
||||
let provinceName = ""
|
||||
let cityName = ""
|
||||
let countyName = ""
|
||||
const province = this.dzOptions.find(c => c.value === val[0])
|
||||
const province = this.dzOptions.find((c) => c.value === val[0])
|
||||
provinceName = province.label
|
||||
const city = province.children.find(p => p.value === val[1])
|
||||
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])
|
||||
const county = city.children.find((p) => p.value === val[2])
|
||||
countyName = county.label
|
||||
this.$set(this.formData, "areaCode", county.value)
|
||||
} else {
|
||||
@@ -523,7 +524,6 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, "province", provinceName)
|
||||
this.$set(this.formData, "city", cityName)
|
||||
this.$set(this.formData, "county", countyName)
|
||||
|
||||
}
|
||||
},
|
||||
openAddress() {
|
||||
@@ -540,64 +540,56 @@ layout("/layouts/platform.html"){
|
||||
this.doSearch()
|
||||
this.$message({
|
||||
message: resp.msg,
|
||||
type: 'success'
|
||||
});
|
||||
type: "success"
|
||||
})
|
||||
await this.selectUserAddress()
|
||||
this.addressDialogVisible = false
|
||||
} else {
|
||||
this.$message.error(resp.msg);
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//数量更改
|
||||
numChange(value, option, optionIndex) {
|
||||
|
||||
this.$nextTick(() => {
|
||||
// 查找+1按钮
|
||||
const plusButton = document.querySelector('.el-input-number__increase');
|
||||
const plusButton = document.querySelector(".el-input-number__increase")
|
||||
// 添加点击事件监听器
|
||||
plusButton.addEventListener('click', this.handlePlusButtonClick(value, option, optionIndex));
|
||||
plusButton.addEventListener("click", this.handlePlusButtonClick(value, option, optionIndex))
|
||||
})
|
||||
|
||||
},
|
||||
handlePlusButtonClick(value, option, optionIndex) {
|
||||
const {
|
||||
isCheckBox,
|
||||
multiSelectNum,
|
||||
singleOptionSupportMultipleSelection
|
||||
} = this.projectInfo
|
||||
if (isCheckBox === 'checkBox') {
|
||||
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;
|
||||
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 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 + '份');
|
||||
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})
|
||||
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()
|
||||
await this.getShoppingType()
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async openView(row) {
|
||||
this.isView = true
|
||||
await this.getProjectInfo(row.id)
|
||||
@@ -611,7 +603,7 @@ layout("/layouts/platform.html"){
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
addressChange(val) {
|
||||
const address = this.addressOptions.find(a => a.id === val)
|
||||
const address = this.addressOptions.find((a) => a.id === val)
|
||||
if (address) {
|
||||
this.$set(this.formData, "receiveAddress", address.name)
|
||||
}
|
||||
@@ -619,54 +611,76 @@ 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) {
|
||||
//用户没有选择完
|
||||
this.$message('一共可以选择' + multiSelectNum + '份,您目前只选择了' + this.sumSelectNum + '份,快去选择吧!')
|
||||
this.$message.warning("一共可以选择" + multiSelectNum + "份,您目前只选择了" + this.sumSelectNum + "份,快去选择吧!")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (this.sumSelectNum === 0) {
|
||||
//用户选择了多份
|
||||
this.$message.warning("您还没有选择福利套餐,快去选择吧!")
|
||||
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 chooseOptions = this.projectInfo.welfareProjectSubjects[0].options
|
||||
.filter((v) => v.selectNum > 0)
|
||||
.map((item) => {
|
||||
return { optionName: item.optionName, selectNum: item.selectNum, receiveAddress: item.receiveAddress }
|
||||
})
|
||||
let isReceiveAddress = true
|
||||
for (const item of chooseOptions) {
|
||||
if (!item.receiveAddress) {
|
||||
this.$message.warning(item.optionName + "还没有选择收货门店哦")
|
||||
isReceiveAddress = false
|
||||
break
|
||||
}
|
||||
})
|
||||
const {
|
||||
code,
|
||||
msg,
|
||||
data
|
||||
} = await $.post('/platform/welfare/userChoose/confirmSelect', {
|
||||
}
|
||||
if (!isReceiveAddress) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.projectInfo.provideMode == 3) {
|
||||
if (this.formData.receiveAddress == null || this.formData.receiveAddress === "") {
|
||||
this.$message.warning("请填写收货地址")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (![1, 4].includes(this.projectInfo.signMode)) {
|
||||
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.projectInfo.provideMode === 3 ? this.formData.receiveAddress : v.receiveAddress,
|
||||
userSign: this.formData.sign,
|
||||
selectNum: v.selectNum
|
||||
}
|
||||
})
|
||||
console.log(formData)
|
||||
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'
|
||||
});
|
||||
this.$message.success("您已完成本次福利选择。")
|
||||
} else {
|
||||
this.$message({
|
||||
message: msg,
|
||||
type: 'warning'
|
||||
});
|
||||
type: "warning"
|
||||
})
|
||||
}
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
@@ -695,7 +709,7 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, "addressId", null)
|
||||
this.$set(this.formData, "sign", this.userSelection[0].userSign)
|
||||
} else {
|
||||
const address = this.addressOptions.find(a => a.isDefault)
|
||||
const address = this.addressOptions.find((a) => a.isDefault)
|
||||
if (address) {
|
||||
this.$set(this.formData, "receiveAddress", address.name)
|
||||
this.$set(this.formData, "addressId", address.id)
|
||||
@@ -705,58 +719,67 @@ 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()
|
||||
},
|
||||
//回显用户选择的数据
|
||||
echoUserSelection() {
|
||||
//获取用户当前选择的数量
|
||||
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
|
||||
const option = this.userSelection.find(x => x.selectOptionId === v.id)
|
||||
this.projectInfo.welfareProjectSubjects[0].options.forEach((v) => {
|
||||
const option = this.userSelection.find((x) => x.selectOptionId === v.id)
|
||||
if (option) {
|
||||
v.selectNum = option.selectNum
|
||||
this.$set(v, "receiveAddress", option.receiveAddress)
|
||||
} else {
|
||||
v.selectNum = 0
|
||||
this.$set(v, "receiveAddress", "")
|
||||
}
|
||||
})
|
||||
},
|
||||
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() {
|
||||
const resp = await $.get('/platform/welfare/addressManage/selectUserAddress')
|
||||
resp.data.map(r => {
|
||||
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
|
||||
this.$nextTick(() => {
|
||||
const address = this.addressOptions.find((v) => v.isDefault)
|
||||
if (address) {
|
||||
this.$set(this.formData, "addressId", address.id)
|
||||
this.$set(this.formData, "receiveAddress", address.name)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取供应商
|
||||
async 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 created() {
|
||||
this.pageData()
|
||||
this.selectUserAddress()
|
||||
getEnumOptions("WelfareProvideMode").then(res => {
|
||||
getEnumOptions("WelfareProvideMode").then((res) => {
|
||||
this.welfareProvideMode = res
|
||||
})
|
||||
getEnumOptions("WelfareSignMode").then(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