This commit is contained in:
@QQNZX 2023-11-15 18:42:06 +08:00
parent 1c320b17c1
commit b3e199acb6
3 changed files with 735 additions and 207 deletions

View File

@ -3,12 +3,27 @@ import request from '@/utils/request'
// 查询推荐有礼列表
export function listActiveRecommend(query) {
return request({
url: '/business/marketingActivity/activeRecommend/list',
url: 'business/marketingActivity/activeRecommend',
method: 'get',
params: query
})
}
//优惠券
export function listFavorable(query) {
return request({
url: 'business/marketingActivity/cardFavorable',
method: 'get',
params: query
})
}
// 兑换券
export function listExchange(query) {
return request({
url: 'business/marketingActivity/cardExchange',
method: 'get',
params: query
})
}
// 查询推荐有礼详细
export function getActiveRecommend(id) {
return request({
@ -20,7 +35,7 @@ export function getActiveRecommend(id) {
// 新增推荐有礼
export function addActiveRecommend(data) {
return request({
url: '/business/marketingActivity/activeRecommend',
url: 'business/marketingActivity/activeRecommend',
method: 'post',
data: data
})
@ -29,7 +44,7 @@ export function addActiveRecommend(data) {
// 修改推荐有礼
export function updateActiveRecommend(data) {
return request({
url: '/business/marketingActivity/activeRecommend',
url: 'business/marketingActivity/activeRecommend',
method: 'put',
data: data
})

View File

@ -654,7 +654,6 @@ export default {
activeEndTime00: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
adaptUserType: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
], dieselUserLevel: [
@ -942,8 +941,6 @@ export default {
this.form.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
this.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '2')
this.form.shiwudata = response.data.activeConsumptionChildList.filter(item => item.activeGift == '4')
this.open = true;
this.title = "修改消费有礼活动";
});

View File

@ -1,220 +1,509 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属连锁店id" prop="chainStoreId">
<el-input
v-model="queryParams.chainStoreId"
placeholder="请输入所属连锁店id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input
v-model="queryParams.storeId"
placeholder="请输入所属店铺id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="活动图片" prop="activePictureUrl">
<el-input
v-model="queryParams.activePictureUrl"
placeholder="请输入活动图片"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="赠送积分" prop="points">
<el-input
v-model="queryParams.points"
placeholder="请输入赠送积分"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="赠送成长值" prop="growthValue">
<el-input
v-model="queryParams.growthValue"
placeholder="请输入赠送成长值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="分享标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入分享标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="奖励显示 0优惠券 1成长值总额 2积分总额" prop="rewardDisplay">
<el-input
v-model="queryParams.rewardDisplay"
placeholder="请输入奖励显示 0优惠券 1成长值总额 2积分总额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="活动规则" prop="activeRule">
<el-input
v-model="queryParams.activeRule"
placeholder="请输入活动规则"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否在线 0在线 1 下线" prop="isonline">
<el-input
v-model="queryParams.isonline"
placeholder="请输入是否在线 0在线 1 下线"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['business/marketingActivity:activeRecommend:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business/marketingActivity:activeRecommend:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business/marketingActivity:activeRecommend:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['business/marketingActivity:activeRecommend:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: 20px">推荐有礼</span>
<el-table v-loading="loading" :data="activeRecommendList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="所属连锁店id" align="center" prop="chainStoreId" />
<el-table-column label="所属店铺id" align="center" prop="storeId" />
<el-table-column label="活动图片" align="center" prop="activePictureUrl" />
<el-table-column label="邀请人获得 0优惠券 1兑换券 2成长值 3积分" align="center" prop="inviterGiftType" />
<el-table-column label="赠送积分" align="center" prop="points" />
<el-table-column label="赠送成长值" align="center" prop="growthValue" />
<el-table-column label="新用户获得 0优惠券 " align="center" prop="newuserGiftType" />
<el-table-column label="分享标题" align="center" prop="title" />
<el-table-column label="邀请二维码类型 0小程序二维码 1参数二维码" align="center" prop="invitationCodeType" />
<el-table-column label="奖励显示 0优惠券 1成长值总额 2积分总额" align="center" prop="rewardDisplay" />
<el-table-column label="活动规则" align="center" prop="activeRule" />
<el-table-column label="活动状态 0进行中 1 待生效 2已结束" align="center" prop="status" />
<el-table-column label="是否在线 0在线 1 下线" align="center" prop="isonline" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business/marketingActivity:activeRecommend:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business/marketingActivity:activeRecommend:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改推荐有礼对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属连锁店id" prop="chainStoreId">
<el-input v-model="form.chainStoreId" placeholder="请输入所属连锁店id" />
</el-form-item>
<el-form-item label="所属店铺id" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入所属店铺id" />
</el-form-item>
<el-form-item label="活动图片" prop="activePictureUrl">
<el-input v-model="form.activePictureUrl" placeholder="请输入活动图片" />
<el-upload
:action="uploadAction"
list-type="picture-card"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccess">
<img
v-if="this.ruleForm.activePictureUrl"
:src="imagePath + this.ruleForm.activePictureUrl"
class="list-img"
/>
<i v-if="!this.ruleForm.activePictureUrl" class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="赠送积分" prop="points">
<el-input v-model="form.points" placeholder="请输入赠送积分" />
<el-form-item label="邀请人获得" prop="inviterGiftType">
<el-checkbox-group v-model="ruleForm.inviterGiftType" >
<el-checkbox v-for="city in Typelist" :label="city.type" :key="city.type">{{city.text}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="赠送成长值" prop="growthValue">
<el-input v-model="form.growthValue" placeholder="请输入赠送成长值" />
<!-- 优惠券-->
<div class="xh-box" v-if="ruleForm.inviterGiftType && ruleForm.inviterGiftType.indexOf('0')>-1" >
<div class="box-bt"> <div >赠送卡券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistFavorable()" >新增</el-button> </div>
<div style="margin: 10px 0px">
<el-table
:data="ruleForm.ylist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="0">
</el-table-column>
<el-table-column
prop="giftCardType"
label="券类型"
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="240">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" > <el-input-number v-model="scope.row.validityZero" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 1" > <el-input-number v-model="scope.row.validityOne" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 2" > <el-input-number v-model="scope.row.validityTwo" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="deletedata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 兑换券-->
<div class="xh-box" v-if="ruleForm.inviterGiftType && ruleForm.inviterGiftType.indexOf('1')>-1" >
<div class="box-bt"> <div >选择兑换券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistExchange()" >新增</el-button> </div>
<div style="margin: 10px 0px">
<el-table
:data="ruleForm.dlist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="80">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
<!-- <span>{{scope.row.fullDeduction}} {{scope.row.discountAmount}} </span>-->
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="240">
<template slot-scope="scope">
<span > <el-input-number v-model="scope.row.giftCardTime" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="deletedhdata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-form-item label="积分" prop="points" v-if="ruleForm.inviterGiftType && ruleForm.inviterGiftType.indexOf('3')>-1" >
<el-input-number v-model="ruleForm.points" controls-position="right" :min="0" :max="999999999"></el-input-number>
</el-form-item>
<el-form-item label="成长值 " prop="growthValue" v-if="ruleForm.inviterGiftType && ruleForm.inviterGiftType.indexOf('2')>-1">
<el-input-number v-model="ruleForm.growthValue" controls-position="right" :min="0" :max="999999999"></el-input-number>
</el-form-item>
<el-form-item label="新用户获得" prop="resource">
<el-radio-group v-model="ruleForm.resource">
<el-radio label="0">优惠券</el-radio>
<el-radio label="1">新人有礼活动</el-radio>
</el-radio-group>
</el-form-item>
<!-- 新用户-->
<div class="xh-box" v-if=" ruleForm.resource == 0 " >
<div class="box-bt"> <div >赠送卡券</div> <el-button type="primary" icon="el-icon-plus" @click="xgetlistFavorable()" >新增</el-button> </div>
<div style="margin: 10px 0px">
<el-table
:data="ruleForm.xylist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="0">
</el-table-column>
<el-table-column
prop="giftCardType"
label="券类型"
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="240">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" > <el-input-number v-model="scope.row.validityZero" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 1" > <el-input-number v-model="scope.row.validityOne" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 2" > <el-input-number v-model="scope.row.validityTwo" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="xdeletedata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-form-item label="分享标题" prop="title">
<el-input v-model="form.title" placeholder="请输入分享标题" />
<el-input v-model="ruleForm.title"></el-input>
</el-form-item>
<el-form-item label="奖励显示 0优惠券 1成长值总额 2积分总额" prop="rewardDisplay">
<el-input v-model="form.rewardDisplay" placeholder="请输入奖励显示 0优惠券 1成长值总额 2积分总额" />
<el-form-item label="分享图片" prop="titleUrl">
<el-upload
:action="uploadAction"
list-type="picture-card"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccesss">
<img
v-if="this.ruleForm.titleUrl"
:src="imagePath + this.ruleForm.titleUrl"
class="list-img"
/>
<i v-if="!this.ruleForm.titleUrl" class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="邀请二维码" prop="invitationCodeType">
<el-radio-group v-model="ruleForm.invitationCodeType">
<el-radio label="0">小程序码</el-radio>
<el-radio label="1">参数二维码</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="奖励显示" prop="rewardDisplay">
<el-radio-group v-model="ruleForm.rewardDisplay">
<el-radio label="0">优惠券总额</el-radio>
<el-radio label="1">成长值总额</el-radio>
<el-radio label="2">积分总额</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="活动规则" prop="activeRule">
<el-input v-model="form.activeRule" placeholder="请输入活动规则" />
<el-input type="textarea" v-model="ruleForm.activeRule"></el-input>
</el-form-item>
<el-form-item label="是否在线 0在线 1 下线" prop="isonline">
<el-input v-model="form.isonline" placeholder="请输入是否在线 0在线 1 下线" />
<el-form-item label="活动状态" prop="status">
<el-radio-group v-model="ruleForm.status">
<el-radio label="0">进行中</el-radio>
<el-radio label="1">待生效</el-radio>
<el-radio label="2">已结束</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-card>
<!-- 优惠券列表 - 新用户获得 -->
<el-dialog title="优惠券列表" :visible.sync="xdialogTableVisible">
<el-table
:data="xylist"
border
style="width: 100%">
<el-table-column
prop="name"
label="卡券名称"
width="80">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="100">
<template slot-scope="scope">
<span v-if="scope.row.type == 0" >油品券</span>
<span v-if="scope.row.type == 1" >商品券</span>
<span v-if="scope.row.type == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="100">
<template slot-scope="scope">
<span>{{scope.row.fullDeduction}} {{scope.row.discountAmount}} </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="180">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" >{{scope.row.validityZero}} </span>
<span v-if="scope.row.timeType == 1" >{{scope.row.validityOne}} </span>
<span v-if="scope.row.timeType == 2" >{{scope.row.validityTwo}} </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="chosedataxyh(scope.row)"
>选择</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 优惠券列表 - 邀请人获得 -->
<el-dialog title="优惠券列表" :visible.sync="dialogTableVisible">
<el-table
:data="ylist"
border
style="width: 100%">
<el-table-column
prop="name"
label="卡券名称"
width="80">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="100">
<template slot-scope="scope">
<span v-if="scope.row.type == 0" >油品券</span>
<span v-if="scope.row.type == 1" >商品券</span>
<span v-if="scope.row.type == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="100">
<template slot-scope="scope">
<span>{{scope.row.fullDeduction}} {{scope.row.discountAmount}} </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="180">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" >{{scope.row.validityZero}} </span>
<span v-if="scope.row.timeType == 1" >{{scope.row.validityOne}} </span>
<span v-if="scope.row.timeType == 2" >{{scope.row.validityTwo}} </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="chosedata(scope.row)"
>选择</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 兑换券列表-->
<el-dialog title="兑换券列表" :visible.sync="dialogTableVisibledh">
<el-table
:data="dlist"
border
style="width: 100%">
<el-table-column
prop="name"
label="卡券名称"
width="100">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="100">
<template slot-scope="scope">
<span v-if="scope.row.type == 0" >油品券</span>
<span v-if="scope.row.type == 1" >商品券</span>
<span v-if="scope.row.type == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="使用说明"
width="100">
<template slot-scope="scope">
<span>{{scope.row.useInstructions}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="180">
<template slot-scope="scope">
<span >{{scope.row.validity}} </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="Favorabledata(scope.row)"
>选择</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 添加或修改推荐有礼对话框 -->
</div>
</template>
<script>
import { listActiveRecommend, getActiveRecommend, delActiveRecommend, addActiveRecommend, updateActiveRecommend } from "@/api/EventMarketing/activeRecommend";
import { listActiveRecommend, getActiveRecommend, delActiveRecommend, addActiveRecommend, updateActiveRecommend,listFavorable,listExchange } from "@/api/EventMarketing/activeRecommend";
import ImageUpload from '@/components/ImageUpload'
import {getToken} from "@/utils/auth";
export default {
name: "ActiveRecommend",
data() {
return {
imagePath:'http://192.168.0.196:8080/',
//
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload',
//
uploadFiles: [],
uploadHeader: { 'Access-Token' : getToken() },
pddhidlist:[],//id
xpdidlist:[],//id
pdidlist:[],//id
xdialogTableVisible:false,
dialogTableVisible:false,//
dialogTableVisibledh:false,//
ruleForm: {
id:1,
activePictureUrl: '',
titleUrl:'',
ylist:[],
dlist:[],
xylist:[],
inviterGiftType:[],
name: '',
points:'',
growthValue:'',
region: '',
activeConsumptionChildList:[],
},
xylist:[],
Typelist:[
{text:'优惠券',type:'0'},
{text:'兑换券',type:'1'},
{text:'成长值',type:'2'},
{text:'积分',type:'3'},
],
ylist:[],
dlist:[],
//
loading: true,
//
@ -237,6 +526,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
id:1,
chainStoreId: null,
storeId: null,
activePictureUrl: null,
@ -255,22 +545,237 @@ export default {
form: {},
//
rules: {
activePictureUrl: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
inviterGiftType: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
points: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
growthValue: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
title: [
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
invitationCodeType:[
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
rewardDisplay:[
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
status:[
{ required: true, message: '必填项不能为空', trigger: 'blur' },
],
activeRule:[
{ required: true, message: '必填项不能为空', trigger: 'blur' },
]
}
};
},
created() {
this.getList();
},
components:{
ImageUpload
},
methods: {
//
handleUploadSuccess(file) {
console.log('图片上传成功',file)
this.ruleForm.activePictureUrl = file.data.fileName
},
//
handleUploadSuccesss(file) {
console.log('图片上传成功',file)
this.ruleForm.titleUrl = file.data.fileName
},
/** 查询推荐有礼列表 */
getList() {
this.loading = true;
listActiveRecommend(this.queryParams).then(response => {
this.activeRecommendList = response.rows;
this.total = response.total;
getActiveRecommend(1).then(response => {
this.ruleForm = response.data
console.log( response.data.records)
this.ruleForm.xylist = response.data.activeConsumptionChildList.filter(item => item.giftUserType == '1')
this.ruleForm.ylist = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
this.ruleForm.dlist = response.data.activeConsumptionChildList.filter(item => item.activeGift == '0')
console.log(this.ruleForm.xylist)
console.log(this.ruleForm.ylist)
console.log(this.ruleForm.dlist)
this.loading = false;
});
},
//
getlistFavorable(){
listFavorable().then(res=>{
if(res.code == 200){
this.dialogTableVisible = true
this.ylist = res.data.records
}
})
},
// -
xgetlistFavorable(){
listFavorable().then(res=>{
if(res.code == 200){
this.xdialogTableVisible = true
this.xylist = res.data.records
}
})
},
//
getlistExchange(){
listExchange().then(res=>{
if(res.code==200){
this.dialogTableVisibledh = true
this.dlist = res.data.records
}
})
},
//
Favorabledata(row){
this.dialogTableVisibledh = false
if(this.pddhidlist.indexOf(row.id)>-1 ){
this.$message.error("该兑换卡券已存在")
return
}
this.pddhidlist.push(row.id)
console.log(row)
let data ={
activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id
goodsName:"" , //
goodsTotal: "", //
vouchersId:row.id, //id
giftCardName:row.name, //
giftCardType: row.type, //
validityZero: null,
validityOne: null,
validityTwo:null,
validity:row.validity,
giftCardDetail: row.useInstructions , //
giftCardTime: row.validity, //
giftCardTotal: 1 //
}
this.ruleForm.dlist.push(data)
this.$message.success("新增成功")
},
//
chosedataxyh(row){
this.xdialogTableVisible = false
if(this.xpdidlist.indexOf(row.id)>-1 ){
this.$message.error("该优惠卡券已存在")
return
}
this.xpdidlist.push(row.id)
let data ={
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName:"" , //
goodsTotal: "", //
vouchersId:row.id, //id
giftCardName:row.name, //
giftCardType: row.type, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo:row.validityTwo,
giftCardDetail: "满"+ row.fullDeduction+"减 "+row.discountAmount+"元" , //
giftCardTime: "", //
giftCardTotal: 1//
}
this.ruleForm.xylist.push(data)
this.$message.success("新增成功")
},
//
chosedata(row){
this.dialogTableVisible = false
if(this.pdidlist.indexOf(row.id)>-1 ){
this.$message.error("该优惠卡券已存在")
return
}
this.pdidlist.push(row.id)
let data ={
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName:"" , //
goodsTotal: "", //
vouchersId:row.id, //id
giftCardName:row.name, //
giftCardType: row.type, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo:row.validityTwo,
giftCardDetail: "满"+ row.fullDeduction+"减 "+row.discountAmount+"元" , //
giftCardTime: "", //
giftCardTotal: 1//
}
this.ruleForm.ylist.push(data)
this.$message.success("新增成功")
},
//
xdeletedata(row){
if(this.ruleForm.xylist&&this.ruleForm.xylist.length>0){
let delIdx=-1;
for ( let item of this.ruleForm.xylist) {
delIdx++;
if (item.id===row.id){
break
}
}
this.pdidlist.splice(delIdx,1);
this.ruleForm.xylist.splice(delIdx,1);
}
},
//
deletedata(row){
if(this.ruleForm.ylist&&this.ruleForm.ylist.length>0){
let delIdx=-1;
for ( let item of this.ruleForm.ylist) {
delIdx++;
if (item.id===row.id){
break
}
}
this.pdidlist.splice(delIdx,1);
this.ruleForm.ylist.splice(delIdx,1);
}
},
//
deletedhdata(row){
if(this.ruleForm.dlist&&this.ruleForm.dlist.length>0){
let delIdx=-1;
for ( let item of this.ruleForm.dlist) {
delIdx++;
if (item.id===row.id){
break
}
}
this.pddhidlist.splice(delIdx,1);
this.ruleForm.dlist.splice(delIdx,1);
}
},
//
cancel() {
this.open = false;
@ -334,16 +839,21 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.ruleForm.activeConsumptionChildList = this.ruleForm.ylist.concat(this.ruleForm.dlist,this.ruleForm.xylist);
console.log(this.ruleForm.activeConsumptionChildList)
console.log(this.ruleForm)
this.$refs["ruleForm"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateActiveRecommend(this.form).then(response => {
if (this.ruleForm.id != null) {
updateActiveRecommend(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addActiveRecommend(this.form).then(response => {
addActiveRecommend(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -371,3 +881,9 @@ export default {
}
};
</script>
<style scoped lang="scss">
.list-img{
width: 100%;
height: 100%;
}
</style>