bztang-admin/plugins/new-member-prize/views/admin/add.blade.php

1629 lines
68 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@extends('layouts.base')
@section('title', '新人奖')
@section('content')
<link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
<style>
.left-conOne{
float:left;
margin-right:2%;
width:375px;
height:667px;
border: 1px solid #e1e1e1;
background: url({{ plugin_assets('new-member-prize', 'views/admin/ht_popupbg_1.png') }}) no-repeat;
background-size:cover;
}
.left-conTwo{
float:left;
margin-right:2%;
width:375px;
height:667px;
background: url({{ plugin_assets('new-member-prize', 'views/admin/ht_popupbg_2.png') }}) no-repeat;
background-size: contain;
}
.left-conThree{
float:left;
margin-right:2%;
width:375px;
height:667px;
background: url({{ plugin_assets('new-member-prize', 'views/admin/ht_popupbg_3.png') }}) no-repeat;
background-size:cover;
}
.left-conFour{
float:left;
margin-right:2%;
width:375px;
height:667px;
background: url({{ plugin_assets('new-member-prize', 'views/admin/ht_popupbg_4.png') }}) no-repeat;
background-size: contain;
}
.left-conFive{
float:left;
margin-right:2%;
width:375px;
height:667px;
background: url({{ plugin_assets('new-member-prize', 'views/admin/ht_popupbg_5.png') }}) no-repeat;
background-size: contain;
}
#re_content{
margin-top:20px;
}
.bg-style {
height: 100vh;
background: white;
padding: 40px 0;
}
label{
margin-bottom:0;
}
.people{
height:20px;
width:110px;
}
.people .el-input__inner{
height:20px;
width:100px;
margin-left:10px;
}
.el-checkbox-group{
font-size: inherit!important;
}
.list_total_num{
margin-top:20px;
}
.el-table__header-wrapper{
margin-top:20px;
}
.el-tag{font-weight:700;font-size:15px;}
.rightlist-head{padding:15px 0;line-height:50px;}
.rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
.el-button+.el-button {margin-left: 0px;}
.el-breadcrumb{font-size:16px;}
.el-breadcrumb__inner a{font-weight: 500;}
.tip{color:#333;font-size:12px;}
/* 上传图片 */
.avatar-uploader .el-upload {margin-top:15px;border: 1px dashed #d9d9d9;border-radius: 6px;cursor: pointer;position: relative;overflow: hidden;}
.avatar-uploader .el-upload:hover {border-color: #409EFF;}
.avatar-uploader-icon {font-size: 28px;color: #8c939d;width: 48px;height: 48px;line-height: 48px;text-align: center;}
.avatar {width: 48px;height: 48px;display: block;}
.el-upload-tip{width:178px;margin:0;padding:0;color:#999;text-align:center;}
input[type=file] {display: none;}
.avatar-uploader-box{position:relative;width:60px;}
.avatar-tip-text{position:absolute;width:48px;height:20px;line-height:28px;bottom:0;background:#000;opacity:0.7;color:#fff;font-size:12px;}
.el-icon-circle-close{position:absolute;top:10px;right:0;color:#999;}
/* 添加奖品弹出框 */
.addAwrad .tag{
word-wrap:break-word;
padding:7px;
}
.addAwrad .tag span{
padding:5px;
margin-bottom:5px;
display:inline-block;
border-radius:4px;
margin-right:5px;
}
/* 编辑奖品弹出框 */
.editAwrad .tag{
word-wrap:break-word;
padding:7px;
}
.editAwrad .tag span{
padding:5px;
margin-bottom:5px;
display:inline-block;
border-radius:4px;
margin-right:5px;
}
.Coupon .tag{
word-wrap:break-word;
padding:7px;
}
.Coupon .tag span{
padding:5px;
margin-bottom:5px;
display:inline-block;
border-radius:4px;
margin-right:5px;
}
.classNormal{
border:solid 1px #eee;
}
.classred{
border:solid 1px red;
}
.el-step.is-simple .el-step__head{
display: flex;
align-items: center;
margin-bottom: 2px;
}
.vue-title-left {
width: 4px;
height: 18px;
margin-top: 6px;
background: #29ba9c;
display: inline-block;
margin-right: 10px;
}
.vue-title-content {
font-size: 14px;
flex: 1;
}
.tab-pane {
padding: 10px;
background: #eff3f6;
display: flex;
}
.tab-pane .left {
background: white;
padding: 2px 10px;
width: 200px;
border-radius: 10px;
overflow-y: auto;
height: 530px;
overflow-x: hidden;
}
.tab-pane .acitve-submenu {
background-color: #eaf8f5;
}
.tab-pane .acitve-submenu-item {
color:rgb(41, 186, 156);
}
.tab-pane .el-submenu__icon-arrow {
display: none;
}
.tab-pane .el-menu-item-group__title {
padding-top: 0 ;
padding-bottom: 0 ;
}
.tab-pane .el-menu-item {
height: 100%;
min-width: 162px;
padding: 0;
}
.tab-pane .el-menu {
border-right:none
}
.el-dialog__header {
padding-bottom: 0 !important;
}
.tab-pane .right {
margin-left: 10px;
width: calc(100% - 200px);
}
.tab-pane .right .single-table {
margin-top: 10px;
height: 420px;
overflow: auto;
}
.tab-pane .right-top {
background: white;
padding: 2px 10px 20px 10px;
border-radius: 10px;
}
.tab-pane .search-pane {
display: flex;
justify-content: space-between;
padding: 0 15px;
}
.el-menu-name {
display: flex;
padding: 10px 13px 10px 0px;
}
.tab-pane-page {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 10px;
}
.tab-pane-page .el-button {
margin-left: 10px;
}
.upload-box:hover { border-color: #29ba9c; color: #29ba9c; }
.upload-box {
width: 40px;
height: 40px;
display: flex;
cursor: pointer;
border: 1px dashed #dde2ee;
justify-content: center;
align-items: center;
border-radius: 5px;
}
/* 上传图片 */
.avatar-uploader .el-upload {
margin-top: 15px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #29ba9c;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar_box {
width: 80%;
height: 80%;
margin: 0 auto;
}
.avatar {
width: 50%;
height: 50%;
object-fit: cover;
}
.el-upload-tip {
width: 178px;
margin: 0;
padding: 0;
color: #999;
text-align: center;
}
input[type="file"] {
display: none;
}
.avatar-uploader-box {
position: relative;
margin-top: 20px;
width: 200px;
}
.el-icon-circle-close {
position: absolute;
top: 0;
right: 0;
color: #999;
}
/*弹窗上传图片*/
#upload-img {
}
#upload-img .avatar {
width: 100px;
height: 100px;
display: block;
}
#upload-img .avatar-uploader-box {
position: relative;
margin: 20px 0 0 10px;
width: 110px;
}
#upload-img .el-icon-circle-close {
position: absolute;
top: -7px;
right: 1px;
color: #999;
}
.imgList {
display: flex;
flex-wrap: wrap;
margin: 10px auto;
}
/* 辅助色 */
.vue-assist-color,
.el-link-assist,
.el-link:hover {
color: #ff9b19 !important;
}
/* 选中及未选图片样式 */
.upload-box:hover {
border-color: #29ba9c;
color: #29ba9c;
}
.upload-boxed {
width: 150px;
height: 150px;
position: relative;
border-radius: 5px;
}
.upload-boxed-text {
position: absolute;
bottom: 0;
line-height: 32px;
color: #fff;
text-align: center;
width: 100%;
background: #000;
opacity: 0.7;
border-radius: 0px 0px 5px 5px;
}
.upload-boxed-list {
display: flex;
position: relative;
border-radius: 5px;
flex-wrap: wrap;
}
.upload-boxed-list-a {
width:150px;
height:150px;
margin:0 10px 5px 0;
position: relative;
}
.upload-boxed-list-a .el-icon-close {
position: absolute;
top: -5px;
right: -5px;
color: #fff;
background: #333;
border-radius: 50%;
cursor: pointer;
}
/* 上传图片 */
.avatar-uploader .el-upload {
margin-top: 15px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #29ba9c;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
/* 选中及未选图片样式 */
.upload-box:hover {
border-color: #29ba9c;
color: #29ba9c;
}
.upload-boxed {
width: 150px;
height: 150px;
position: relative;
border-radius: 5px;
}
.upload-boxed-text {
position: absolute;
bottom: 0;
line-height: 32px;
color: #fff;
text-align: center;
width: 100%;
background: #000;
opacity: 0.7;
border-radius: 0px 0px 5px 5px;
}
.upload-boxed-list {
display: flex;
position: relative;
border-radius: 5px;
flex-wrap: wrap;
}
.upload-boxed-list-a {
width:150px;
height:150px;
margin:0 10px 5px 0;
position: relative;
}
.upload-boxed-list-a .el-icon-close {
position: absolute;
top: -5px;
right: -5px;
color: #fff;
background: #333;
border-radius: 50%;
cursor: pointer;
}
</style>
<!-- tab -->
<div id='re_content' v-loading="all_loading">
<div class="rightlist-head">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item><a href="{{ yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.index') }}">新人礼</a></el-breadcrumb-item>
<el-breadcrumb-item>创建活动</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="bg-style">
<el-steps :active="active" simple style="width:90%;margin:0 auto">
<el-step title="1、创建活动" icon="el-icon-edit"></el-step>
<el-step title="2、奖品设置" icon="el-icon-setting"></el-step>
<el-step title="3、页面设置" icon="el-icon-goods"></el-step>
</el-steps>
<!-- content start -->
<div style="width:1100px;margin:50px auto">
<!-- left -->
<div class="left-conOne" v-if="form.background_type==0">
<div style="padding-top: 45%;padding-left: 17%;font-size: 24px;color: #fff;">
[[form.title]]
</div>
</div>
<div class="left-conTwo" v-if="form.background_type==1">
<div style="padding-top: 45%;padding-left: 15%;font-size: 24px;color: #b07e54;;">
[[form.title]]
</div>
</div>
<div class="left-conThree" v-if="form.background_type==2">
<div style="padding-top: 65%;font-size: 24px;color: #fff;text-align:center;">
[[form.title]]
</div>
</div>
<div class="left-conFour" v-if="form.background_type==3">
<div style="padding-top: 45%;padding-left: 15%;font-size: 24px;color: #fff;text-align:left;">
[[form.title]]
</div>
</div>
<div class="left-conFive" v-if="form.background_type==4">
<div style="padding-top: 45%;padding-left: 15%;font-size: 24px;color: #fff;text-align:left;">
[[form.title]]
</div>
</div>
<!-- right -->
<!-- step 1 -->
<el-form ref="form" :model="form" label-width="20%">
<div v-if="active==0" class="right-con" style="width:600px;border:1px solid #e1e1e1;background:#fafafa;float:left;">
<div style="line-height:40px;padding-left:15px;font-weight:900;">基本信息</div>
<hr style="padding:0;margin:0"/>
<template>
<el-form-item label="活动名称" prop="name" style="margin-top:20px;">
<el-input v-model="form.name" style="width:70%"></el-input>
</el-form-item>
<el-form-item label="活动时间" prop="time">
<el-row>
<el-date-picker v-model="form.activity_time" value-format="timestamp" type="datetimerange" range-separator="" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-row>
</el-form-item>
<el-form-item label="活动渠道" >
<template>
<el-checkbox-group v-model="form.activity_type">
<div>
<el-checkbox label="0">微信公众号</el-checkbox>
</div>
<div>
<el-checkbox label="1">微信小程序</el-checkbox>
</div>
<div>
<el-checkbox label="2">H5/封装APP/支付宝</el-checkbox>
</div>
</el-checkbox-group>
</template>
</el-form-item>
<el-form-item label="领取条件" >
<template>
<el-radio-group v-model="form.receive_type">
<div>
<el-radio label="0" style="margin-top:10px;">新注册会员</el-radio>
</div>
<div>
<el-radio label="1" style="margin-top:10px;">无消费记录会员</el-radio>
</div>
<div>
<el-radio label="2" style="margin-top:10px;">直推客户满<el-input placeholder="请输入内容" class="people" v-model="form.num"></el-input><span></span></el-radio>
</div>
<div>
<el-radio label="4" style="margin-top:10px;">选择会员标签</el-radio>
</div>
<div class="select-goods" style="margin-top:10px;" v-if="form.receive_type==4">
<el-button @click.stop="openDialog()">
<i class="el-icon-plus"></i> 添加标签
</el-button>
<div style="position:relative;margin-top:10px;display:inline-block;" >
<span v-if="form.tags" v-for="(item,index) in form.tags">
<el-tag effect="plain" style="margin-right:10px; margin-bottom:10px; cursor: pointer;user-select: none;" :closable="true" @close="handleCloseTag(index)" :key="index">[[item.title]]</el-tag>
</span>
</div>
</div>
<div>
<el-radio label="3" style="margin-top:10px;">购买指定商品会员</el-radio>
</div>
</el-radio-group>
<div class="select-goods" style="margin-top:10px;" v-if="form.receive_type==3">
<el-input v-model="titleList.join(',')" style="width:70%;" disabled></el-input>
<el-button @click="openGoods()" type="primary">选择商品</el-button>
<div style="position:relative;margin-top:10px;display:inline-block;" >
<div style="font-size:12px;">可指定多件商品,只需购买其中一件就可以获得奖励</div>
<div style="display:flex;flex-wrap:wrap;">
<template v-for="(item,index) in thumbList">
<div style="display:flex;width: 100px;height: 100px;box-sizing: border-box;margin-right: 10px;position:relative;margin-top:10px;">
<img :src="item.thumb" style="display:inline-block;width:90%;padding: 10px;border: solid 1px #ccc;">
<div style="margin-top:-10px;position:absolute;right:0;top:0;" @click="delGoods(item)">
x
</div>
</div>
</template>
</div>
</div>
</div>
<el-radio-group v-model="form.pay" v-if="form.receive_type==3">
<el-radio label="0" style="margin-top:10px;">付款后</el-radio>
<el-radio label="1" style="margin-top:10px;">完成后</el-radio>
</el-radio-group>
</template>
</el-form-item>
<el-form-item label="">
<template>
<p style="padding-right:15px;font-size:12px;">
同一种领取条件、同一活动时间只能创建一个活动领取条件为新注册会员活动存在的新注册会员获得新注册会员领取条件的新人礼如果不存在新注册会员活动但是存在无消费记录会员活动的新注册会员获得无消费记录会员新人礼同一活动时间无消费记录、直推客户数量满N人、会员标签、购买指定商品会员领取条件的活动不能同时发布
</p>
</template>
</el-form-item>
</template>
</div>
<div v-if="active==1" class="right-con" style="width:600px;border:1px solid #e1e1e1;background:#fafafa;float:left;">
<div style="line-height:40px;padding-left:15px;font-weight:900;">添加奖品</div>
<hr style="padding:0;margin:0"/>
<el-button type="primary" size="mini" style="margin:5px" @click="addAward()" >添加奖品</el-button>
<!-- 表格start -->
<template>
<el-table :data="award_list" style="width: 100%" v-loading="search_loading">
<el-table-column prop="name" label="名称" align="center"></el-table-column>
<el-table-column prop="award" label="礼品" align="center" >
<template slot-scope="scope">
<div v-if="scope.row.prize_type==1">
优惠券
</div>
<div v-if="scope.row.prize_type==2">
积分
</div>
<div v-if="scope.row.prize_type==3">
可用爱心值
</div>
<div v-if="scope.row.prize_type==5">
冻结爱心值
</div>
<div v-if="scope.row.prize_type==4">
余额
</div>
</template>
</el-table-column>
<el-table-column prop="received_num" label="发放" align="center" >
<template slot-scope="scope">
<div>
[[scope.row.received_num]]
</div>
</template>
</el-table-column>
<el-table-column prop="prize_num" label="数量" align="center"></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<a @click="editAward(scope, award_list)">编辑</a>
<a @click="open(scope, award_list)">删除</a>
</template>
</el-table-column>
</el-table>
</template>
</div>
<div v-if="active==2" class="right-con" style="width:600px;border:1px solid #e1e1e1;background:#fafafa;float:left;">
<div style="line-height:40px;padding-left:15px;font-weight:900;">页面设置</div>
<hr style="padding:0;margin:0"/>
<template>
<el-form-item label="领取条件" style="margin-top:20px;">
<template>
<el-radio-group v-model="form.background_type" style="margin-top: 10px">
<el-radio label="0">样式一</el-radio>
<el-radio label="1">样式二</el-radio>
<el-radio label="2" >样式三</el-radio>
<el-radio label="3">样式四</el-radio>
<el-radio label="4" style="margin-top: 10px">自定义样式</el-radio>
</el-radio-group>
</template>
</el-form-item>
<el-form-item>
<div v-if="form.background_type==4" style="margin-top: 10px">
<div class="upload-box" @click="openUpload()" style="width:140px;height:140px" v-if="!form.diy_pic">
<i class="el-icon-plus" style="font-size:32px"></i>
</div>
<div @click="openUpload()" style="width:140px;height:140px" class="upload-boxed" v-if="form.diy_pic">
<img :src="form.diy_pic" alt=""
style="width:140px;height:140px;border-radius: 5px;cursor: pointer;">
</div>
<span>建议尺寸500*824</span>
</div>
</el-form-item>
<el-form-item label="标题">
<el-input placeholder="请输入标题" v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="领取后H5跳转链接">
<el-input placeholder="输入跳转链接" v-model="form.after_url"></el-input>
</el-form-item>
<el-form-item label="领取后小程序跳转链接">
<el-input placeholder="输入跳转链接" v-model="form.after_mini"></el-input>
</el-form-item>
</template>
</div>
</el-form>
</div>
<div style="width:100%;display:block;float:left;text-align:center;margin:30px 0;" v-if="active==0||active==1||active==2">
<a href="{{ yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.index') }}"><el-button v-if="active==0">取消</el-button></a>
<el-button @click="last()" v-if="active==1||active==2">
上一步
</el-button>
<el-button type="success" @click="next()" v-if="active==1||active==0">
下一步
</el-button>
<el-button type="success" @click="submit()" v-if="active==2">
完成
</el-button>
</div>
</div>
<!-- 添加奖品弹出框 -->
<el-dialog title="添加奖品" :visible.sync="is_add_dialog" @close="closePop" class="addAwrad" :lock-scroll="true">
<div >
<el-form ref="award_form" :model="award_form" label-width="20%">
<template>
<el-form-item label="名称" prop="name">
<el-input v-model="award_form.name" style="width:70%" placeholder="最多可填6个字"></el-input>
</el-form-item>
<el-form-item label="奖品" prop="award_type">
<div>
<el-radio v-model.munber="award_form.award_type" :label="1" >优惠券</el-radio>
<el-select
v-model="award_form.coupon"
v-if="award_form.award_type==1"
filterable
remote
style="width:50%"
@change="getCount"
reserve-keyword
placeholder="请输入关键词"
:remote-method="loadAward"
:loading="loading"
>
<el-option
v-for="item in AwardList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-input v-model="award_form.coupon_num" style="width:50px;display:inline-block;" v-if="award_form.award_type==1"></el-input>
<div style="margin-left:10px;display:inline-block;" v-if="award_form.coupon">可用库存[[lasttotal]]</div>
</div>
<div style="margin:5px 0">
<el-radio v-model.munber="award_form.award_type" :label="2" >积分</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="award_form.coin">
<template slot="append">积分</template>
</el-input>
</div>
<div style="margin:5px 0" v-if="love_status == 1">
<el-radio v-model.munber="award_form.award_type" :label="3" >可用[[love_name]]</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="love_use">
<template slot="append">可用[[love_name]]</template>
</el-input>
</div>
<div style="margin:5px 0" v-if="love_status == 1">
<el-radio v-model.munber="award_form.award_type" :label="5" >冻结[[love_name]]</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="love_froze">
<template slot="append">冻结[[love_name]]</template>
</el-input>
</div>
<div style="margin:5px 0">
<el-radio v-model.munber="award_form.award_type" :label="4" >余额</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="award_form.rest">
<template slot="append">余额</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="数量" prop="name">
<el-input v-model="award_form.number" style="width:70%">
<template slot="append"></template>
</el-input>
</el-form-item>
</template>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="is_add_dialog = false"> </el-button>
<el-button type="primary" @click="choose()"> </el-button>
</span>
</el-dialog>
<!-- 会话框 -->
<el-dialog title="选择标签" :visible.sync="dialogVisible" width="55%" :before-close="handleClose" v-if="tagInfo">
<div class="tab-pane">
<div class="left">
<div class="vue-title">
<div class="vue-title-left"></div>
<div class="vue-title-content">标签组</div>
</div>
<el-menu
default-active="1"
:default-openeds="openeds"
class="el-menu-vertical-demo">
<el-submenu index="1" :class="select_group_id === '' ? 'acitve-submenu' : ''" >
<template slot="title">
<div @click="handleSelect('')">
<i class="el-icon-folder-opened" :class="select_group_id === '' ? 'acitve-submenu-item' : ''"></i>
<span :class="select_group_id === '' ? 'acitve-submenu-item' : ''">全部分组</span>
</div>
</template>
<el-menu-item-group>
<el-menu-item v-for="(item,index) in menu_item_list" :key="index">
<div class="el-menu-name" :style="[{color:( Number(select_group_id) == item.id ? '#29ba9c':'')}]" @click="handleSelect(item.id)">
<i class="el-icon-folder-opened" :style="[{color:( Number(select_group_id) == item.id ? '#29ba9c':'')}]" ></i>
<span style="white-space: normal !important;line-height: normal;">[[item.title]]</span>
</div>
</el-menu-item>
</el-menu-item-group>
</el-submenu>
</el-menu>
</div>
<div class="right">
<div class="right-top">
<div class="vue-title">
<div class="vue-title-left"></div>
<div class="vue-title-content">标签列表</div>
</div>
<div class="search-pane">
<el-input placeholder="标签名称" style="width: 40%;" v-model="tag_keyword"></el-input>
<el-button type="primary" @click="search1(1)">搜索</el-button>
</div>
</div>
<div class="single-table">
<el-table ref="singleTable" :data="tagData">
<el-table-column label="ID" prop="id"></el-table-column>
<el-table-column label="标签名称" prop="title"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" @click="makeMemberTags(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<div class="vue-page tab-pane-page">
<el-row>
<el-col align="right">
<el-pagination layout="prev, pager, next,jumper" @current-change="search1" :total="tag_total" :page-size="tag_per_page" :current-page="tag_current_page" background></el-pagination>
</el-col>
</el-row>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 编辑奖品弹出框 -->
<el-dialog title="编辑奖品" :visible.sync="is_edit_dialog" @close="closeEdit" class="editAwrad" :lock-scroll="true">
<div>
<el-form ref="edit_form" :model="edit_form" :rules="rules" label-width="20%">
<template>
<el-form-item label="名称" prop="name">
<el-input v-model="edit_form.name" style="width:70%" placeholder="最多可填6个字" ></el-input>
</el-form-item>
<el-form-item label="奖品" prop="prize_type">
<div>
<el-radio v-model="edit_form.prize_type" :label="1" >优惠券</el-radio>
<el-select
v-model="edit_form.coupon_id"
v-if="edit_form.prize_type==1"
filterable
remote
style="width:50%"
@change="getEdit"
reserve-keyword
placeholder="请输入关键词"
:remote-method="loadEdit"
:loading="loading"
>
<el-option
v-for="item in EditList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-input v-model="edit_form.coupon_num" style="width:50px;display:inline-block;" v-if="edit_form.prize_type==1"></el-input>
<div style="margin-left:10px;display:inline-block;" v-if="edit_form.prize_type==1">可用库存[[lasttotal]]</div>
</div>
<div style="margin:5px 0">
<el-radio v-model="edit_form.prize_type" :label="2" >积分</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="edit_form.point" >
<template slot="append">积分</template>
</el-input>
</div>
<div style="margin:5px 0" v-if="love_status == 1">
<el-radio v-model.munber="award_form.award_type" :label="3" >可用[[love_name]]</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="love_use">
<template slot="append">可用[[love_name]]</template>
</el-input>
</div>
<div style="margin:5px 0" v-if="love_status == 1">
<el-radio v-model.munber="award_form.award_type" :label="5" >冻结[[love_name]]</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="love_froze">
<template slot="append">冻结[[love_name]]</template>
</el-input>
</div>
<div style="margin:5px 0">
<el-radio v-model="edit_form.prize_type" :label="4" >余额</el-radio>
<el-input style="width:60%;padding-left:20px" v-model="edit_form.amount" >
<template slot="append">余额</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="数量" prop="name">
<el-input v-model="edit_form.prize_num" style="width:70%">
<template slot="append"></template>
</el-input>
</el-form-item>
</template>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="is_edit_dialog = false"> </el-button>
<el-button type="primary" @click="editChoose()"> </el-button>
</span>
</el-dialog>
<!--end-->
<upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp"
@sure="sureImg"></upload-img>
<el-dialog :visible.sync="goodsShow" width="60%" center title="选择商品">
<div>
<div>
<el-input v-model="keyword" style="width:70%"></el-input>
<el-button type="primary" @click="searchGoods()">搜索</el-button>
</div>
<el-table :data="goods_list" style="width: 100%;height:500px;overflow:auto">
<el-table-column label="ID" prop="id" align="center" width="100px"></el-table-column>
<el-table-column label="商品信息">
<template slot-scope="scope">
<div v-if="scope.row" style="display:flex;align-items: center">
<img v-if="scope.row.thumb" :src="scope.row.thumb" style="width:50px;height:50px"></img>
<div style="margin-left:10px">[[scope.row.title]]</div>
</div>
</template>
</el-table-column>
<el-table-column prop="refund_time" label="操作" align="center" width="320">
<template slot-scope="scope">
<el-button @click="sureGoods(scope.row)">
选择
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
@include('public.admin.uploadImg')
<script>
var vm = new Vue({
el: "#re_content",
delimiters: ['[[', ']]'],
data() {
let love_name ='{!! $love_name ?: '爱心值' !!}'
let love_status = {!! $love_status !!};
return {
lasttotal:0,
goods_list:[],
goodsShow:false,
love_name:String(love_name),
love_status:love_status,
arr:[],
AwardList:[],
EditList:[],
all_loading:false,
search_loading:false,
search_form:{},
real_search_form:"",
uploadShow: false,
chooseImgName: '',
old_edit_form_coupon:'',
award_list:[
],
active:0,
thumbList:[],
titleList:[],
love_froze:'',
love_use:'',
form:{
name:'',
num:'',
activity_time:[],
activity_type:['0'],
receive_type:'0',
background_type:'0',
title:'',
after_url:'',
after_mini:'',
diy_pic:'',
style_pic:'',
goods:[],
tags:[],
pay:'0',
},
award_form:{
name:'',
award_type:1,
coupon:'',
number:'',
coin:'',
love:'',
rest:'',
coupon_num:'',
},
edit_form:{
},
is_add_dialog:false,
is_edit_dialog:false,
loading:false,
rules:{},
keyword:'',
// 标签
//当前打开的 sub-menu 的 index 的数组
openeds:["1"],
dialogVisible: false,
select_group_id:"",
tagData: [],
menu_item_list:[],
tag_total: 1,
tag_current_page: 1,
tag_per_page: 1,
tag_keyword:"",
tagInfo:false,
}
},
created () {
},
methods: {
getCount(val){
this.AwardList.forEach((item,index)=>{
if(item.id==val){
if(item.total!=-1){
this.lasttotal=item.lasttotal
}else{
this.lasttotal='无限量'
}
}
})
},
getEdit(val){
this.EditList.forEach((item,index)=>{
if(item.id==val){
if(item.total!=-1){
this.lasttotal=item.lasttotal
}else{
this.lasttotal='无限量'
}
}
})
},
openGoods() {
this.goodsShow = true;
},
delGoods(item){
this.thumbList.forEach((list,index)=>{
if(list.thumb==item.thumb){
this.thumbList.splice(index,1)
this.titleList.splice(index,1)
this.form.goods.splice(index,1)
}
})
},
searchGoods() {
let that = this;
this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.getGoods') !!}',{kwd:this.keyword}).then(response => {
if (response.data.result) {
this.goods_list = response.data.data;
} else {
this.$message({message: response.data.msg,type: 'error'});
}
},response => {
this.$message({message: response.data.msg,type: 'error'});
});
},
confirmGoods(){
},
sureGoods(item) {
let status=0;
this.form.goods.some((list,index,key)=>{
if(list==item.id){
status=1
this.$message({message: '该商品已被选中',type: 'error'});
return true
}
})
if(status==1){
return false
}
this.thumbList.push(item)
this.titleList.push(`[`+item.id+`]`+item.title) ;
this.form.goods.push(item.id)
},
openDialog(row) {
//打开回话框
this.dialogVisible = true
//请求标签列表
this.handleTagsList(1);
//请求标签组列表
this.getTagsGroupList();
},
//3.请求标签的列表数据
handleTagsList(page) {
let group_id = {};
if(this.select_group_id) {
group_id = { group_id : this.select_group_id };
}
this.$http.post("{!!yzWebFullUrl('plugin.member-tags.Backend.controllers.tag.get-tags-list')!!}", {
search:{
...group_id,
title:this.tag_keyword,
},
page
}).then(({data,result,msg}) => {
if(data.result) {
this.tagData = data.data.data;
this.tag_current_page = data.data.current_page;
this.tag_total = data.data.total;
this.tag_per_page = data.data.per_page;
}else {
console.log(data.msg);
}
})
},
//5.选择完标签关闭弹窗
handleClose() {
this.dialogVisible = false
},
// 标签搜索
search1(page) {
this.handleTagsList(page);
},
// 获取标签分组数据
getTagsGroupList() {
this.tagInfo = false;
this.$http.get("{!!yzWebFullUrl('plugin.member-tags.Backend.controllers.tag.getGroupList')!!}", {}).then(({data,result,msg}) => {
if(data.result) {
this.menu_item_list = data.data;
}else {
console.log(data.msg);
}
this.tagInfo = true;
})
},
handleCloseTag(index) {
this.form.tags.splice(index,1);
},
// 选中的分组
handleSelect(id){
this.select_group_id = id;
this.tag_keyword = "";
this.handleTagsList(1);
},
makeMemberTags(item) {
for(let i=0;i<this.form.tags.length;i++) {
if(item.id == this.form.tags[i].id){
this.$message.error("此标签已经选择!无需重复操作!");
return false;
}
}
this.form.tags.push({id:item.id,title:item.title});
},
openUpload() {
this.uploadShow = true
},
changeProp(val) {
if (val == true) {
this.uploadShow = false;
}
else {
this.uploadShow = true;
}
},
sureImg(name, image, image_url) {
this.form.diy_pic = image_url;
this.form.style_pic = image;
},
deleteAward(scope, rows){
rows.splice(scope.$index, 1);
this.arr.map((item,index,key)=>{
if(item===scope.row.id){
this.arr.splice(index,1);
}
})
let json={
id:scope.row.id
}
this.$http.post("{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.delPrize') !!}",json).then(function (response){
this.getList();
},function (response) {
console.log(response);
}
);
},
open(scope, rows) {
this.$confirm('此操作将永久删除该奖品, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!',
callback:this.deleteAward(scope, rows)
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
closePop(){
this.is_add_dialog=false;
},
closeEdit(){
this.is_edit_dialog=false;
},
next() {
if(this.active===0){
if(this.form.name===''){
this.$message.error("请输入活动名称");
return
}
if(this.form.activity_type.length<=0){
this.$message.error("请选择活动渠道");
return
}
}
if(this.active===1){
if(this.award_list.length<=0){
this.$message.error("请先添加奖品");
return
}
}
if(this.active<=2){
this.active++;
}
},
last() {
this.active--;
},
addAward() {
this.love_use = ''
this.love_froze = ''
this.award_form={
name:'',
award_type:1,
coupon:'',
number:'',
coin:'',
love:'',
coupon_num:'',
},
this.is_add_dialog = true;
},
editAward(scope, rows){
let json={
id:scope.row.id
}
this.$http.post("{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.editPrize') !!}",json).then(response => {
if (response.data.result) {
this.edit_form=response.data.data.prize;
if(this.edit_form.prize_type===1){
this.old_edit_form_coupon=this.edit_form.coupon.id;
this.edit_form.coupon_id=this.edit_form.coupon.name;
this.lasttotal=this.edit_form.coupon.total==-1?'无限量':this.edit_form.coupon.lasttotal;
this.love_use = '';
this.love_froze = '';
this.edit_form.point='';
this.edit_form.amount='';
}
if(this.edit_form.prize_type==2){
this.love_use = '';
this.love_froze = '';
this.edit_form.amount='';
this.edit_form.coupon_id='';
}
if(this.edit_form.prize_type==3){
this.edit_form.point='';
this.edit_form.amount='';
this.edit_form.coupon_id='';
this.love_froze = '';
this.love_use = response.data.data.prize.love;
}
if(this.edit_form.prize_type==4){
this.love_use = '';
this.love_froze = '';
this.edit_form.point='';
this.edit_form.coupon_id='';
}
if(this.edit_form.prize_type==5){
this.edit_form.point='';
this.edit_form.amount='';
this.edit_form.coupon_id='';
this.love_use = '';
this.love_froze = response.data.data.prize.love;
}
}
else {
this.$message({message: response.data.msg,type: 'error'});
}
});
this.is_edit_dialog = true;
},
getList(){
this.$http.post("{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.getPrizeList') !!}",{'prize_id':this.arr}).then(response => {
if (response.data.result) {
this.award_list=response.data.data.prize_list;
}
else {
this.$message({message: response.data.msg,type: 'error'});
}
});
},
// 确认选中奖品
choose() {
if(this.award_form.name===''){
this.$message.error('请填写正确的奖品名称');
return ;
}
switch (this.award_form.award_type) {
case 1:
if(this.award_form.coupon===''||this.award_form.coupon===null||this.award_form.coupon===undefined){
this.$message.error("请选择优惠券");
return
}
if(this.award_form.coupon_num==''){
this.$message.error("优惠券份数不能为空");
return
}
if(this.award_form.coupon_num<=0){
this.$message.error("优惠券份数必须大于0");
return
}
// if(this.award_form.coupon_num>15){
// this.$message.error("优惠券份数必须小于15");
// return
// }
break;
case 2:
if(this.award_form.coin===''){
this.$message.error("请填写积分");
return
}
if(isNaN(this.award_form.coin)){
this.$message.error("积分需为数字");
return
}
break;
case 3:
if(this.love_use===''){
this.$message.error(`请填写可用${this.love_name}`);
return
}
if(isNaN(this.love_use)){
this.$message.error(`可用${this.love_name}需为数字`);
return
}
break;
case 4:
if(this.award_form.rest===''){
this.$message.error("请填写余额");
return
}
if(isNaN(this.award_form.rest)){
this.$message.error("余额需为数字");
return
}
break;
case 5:
if(this.love_froze===''){
this.$message.error(`请填写冻结${this.love_name}`);
return
}
if(isNaN(this.love_froze)){
this.$message.error(`冻结${this.love_name}需为数字`);
return
}
break;
}
if(this.award_form.number===''){
this.$message.error("请填写数量");
return
}
if(isNaN(this.award_form.number)){
this.$message.error("数量需为数字");
return
}
let i =0;
let status=0;
this.award_list.some((item,index)=>{
if(item.prize_type==this.award_form.award_type){
status=1
switch (this.award_form.award_type) {
case 2:
this.$message.error("奖品列表最多添加一份积分奖品");
break;
case 3:
this.$message.error("奖品列表最多添加一份可用爱心值奖品");
break;
case 4:
this.$message.error("奖品列表最多添加一份余额奖品");
break;
case 5:
this.$message.error("奖品列表最多添加一份冻结爱心值奖品");
break;
}
if(item.prize_type==1){
i++
}
}
})
if(status ==1 && this.award_form.award_type!=1){
return false
}
if(i >=5 && this.award_form.award_type==1) {
this.$message.error("奖品列表最多添加五分份优惠券奖品");
return false
}
let json={
name:this.award_form.name,
prize_type:this.award_form.award_type,
coupon_id:this.award_form.award_type===1?this.award_form.coupon:'',
prize_num:this.award_form.number,
point:this.award_form.award_type===2?this.award_form.coin:'',
love_use:this.award_form.award_type===3?this.love_use:'',
love_froze:this.award_form.award_type===5?this.love_froze:'',
amount:this.award_form.award_type===4?this.award_form.rest:'',
coupon_num:this.award_form.award_type===1?this.award_form.coupon_num:'',
}
this.$http.post("{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.addPrize') !!}",{'post_data':json}).then(response => {
if (response.data.result) {
this.$message({message: "添加奖品成功",type: 'success'});
this.arr.push(response.data.data.id);
this.getList();
}
else {
this.$message({message: response.data.msg,type: 'error'});
}
});
this.is_add_dialog=false;
},
editChoose(){
if(this.edit_form.name===''){
this.$message.error('请填写正确的奖品名称');
return ;
}
switch (this.edit_form.prize_type) {
case 1:
if(this.edit_form.coupon_id===''||this.edit_form.coupon_id===null||this.edit_form.coupon_id===undefined){
this.$message.error("请选择优惠券");
return
}
if(this.edit_form.coupon_num==''){
this.$message.error("优惠券份数不能为空");
return
}
if(this.edit_form.coupon_num<=0){
this.$message.error("优惠券份数必须大于0");
return
}
// 不清楚是什么需求,这边先注释
// if(this.edit_form.coupon_num>15){
// this.$message.error("优惠券份数必须小于15");
// return
// }
break;
case 2:
if(this.edit_form.point===''){
this.$message.error("请填写积分");
return
}
if(isNaN(this.edit_form.point)){
this.$message.error("积分需为数字");
return
}
break;
case 3:
if(this.love_use===''){
this.$message.error(`请填写${this.love_name}`);
return
}
if(isNaN(this.love_use)){
this.$message.error(`${this.love_name}需为数字`);
return
}
break;
case 4:
if(this.edit_form.amount===''){
this.$message.error("请填写余额");
return
}
if(isNaN(this.edit_form.amount)){
this.$message.error("余额需为数字");
return
}
break;
case 5:
if(this.love_froze===''){
this.$message.error(`请填写${this.love_name}`);
return
}
if(isNaN(this.love_froze)){
this.$message.error(`${this.love_name}需为数字`);
return
}
break;
}
if(this.edit_form.prize_num===''){
this.$message.error("请填写数量");
return
}
if(isNaN(this.edit_form.prize_num)){
this.$message.error("数量需为数字");
return
}
if(typeof(this.edit_form.coupon_id)==="string"){
this.edit_form.coupon_id=this.old_edit_form_coupon;
}
let i=0;
let status=0
this.award_list.some((item,index)=>{
if(item.id==this.edit_form.id){
}else{
if(item.prize_type==this.edit_form.prize_type){
status=1
switch (this.edit_form.prize_type) {
case 2:
this.$message.error("奖品列表最多添加一份积分奖品");
break;
case 3:
this.$message.error("奖品列表最多添加一份爱心值奖品");
break;
case 4:
this.$message.error("奖品列表最多添加一份余额奖品");
break;
case 5:
this.$message.error("奖品列表最多添加一份冻结爱心值奖品");
break;
}
if(this.edit_form.prize_type==1){
i++
}
if(i >=5) {
this.$message.error("奖品列表最多添加五分份优惠券奖品");
return
}
}
}
})
if(status ==1 && this.edit_form.prize_type!=1){
return false
}
if(i >=5 && this.edit_form.prize_type==1) {
this.$message.error("奖品列表最多添加五分份优惠券奖品");
return false
}
let json={
amount:this.edit_form.prize_type===4?this.edit_form.amount:'',
coupon_id:this.edit_form.prize_type===1?this.edit_form.coupon_id:'',
love_use:this.edit_form.award_type===3?this.love_use:'',
love_froze:this.edit_form.award_type===5?this.love_froze:'',
name:this.edit_form.name,
point:this.edit_form.prize_type===2?this.edit_form.point:'',
prize_num:this.edit_form.prize_num,
prize_type:this.edit_form.prize_type,
coupon_num:this.edit_form.prize_type===1?this.edit_form.coupon_num:''
}
this.$http.post("{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.editPrize') !!}",{id:this.edit_form.id,'post_data':json}).then(response => {
if (response.data.result) {
this.$message({message: "编辑奖品成功",type: 'success'});
this.getList();
}
else {
this.$message({message: response.data.msg,type: 'error'});
}
});
this.is_edit_dialog=false;
},
submit() {
if(this.active===2){
let json={
name:this.form.name,
start_time:Number(String(this.form.activity_time[0]).substring(0,10)),
end_time:Number(String(this.form.activity_time[1]).substring(0,10)),
receive_type:this.form.receive_type,
activity_type:this.form.activity_type,
style_pic:this.form.style_pic,
after_url:this.form.after_url,
after_mini:this.form.after_mini,
receive_content:{
goods_id:this.form.receive_type==3?this.form.goods:[],
pay:this.form.receive_type==3?this.form.pay:'0',
tags:this.form.receive_type==4?this.form.tags:[],
num:this.form.receive_type==2?this.form.num:'',
},
prize_id:this.arr,
background_type:this.form.background_type,
title:this.form.title,
}
this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.addActivity') !!}',{'post_data':json}).then(function (response){
if (response.data.result) {
this.$message({message: "创建活动成功",type: 'success'});
window.location.href="{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.index') !!}"
} else {
this.$message({message: response.data.msg,type: 'error'});
}
},function (response) {
this.$message({message: response.data.msg,type: 'error'});
})
}
},
loadAward(query) {
if (query !== '') {
this.loading = true;
this.AwardList = [];
this.$http.post("{!! yzWebUrl('plugin.new-member-prize.admin.controllers.activity.getCoupons') !!}",{kwd:query}).then(response => {
this.AwardList = response.data.data.coupons;
this.loading = false;
}, response => {
this.$message({type: 'error',message: response.data.msg});
console.log(response);
});
} else {
this.AwardList = [];
}
},
loadEdit(query) {
if (query !== '') {
this.loading = true;
this.EditList=[];
this.$http.post("{!! yzWebUrl('plugin.new-member-prize.admin.controllers.activity.getCoupons') !!}",{kwd:query}).then(response => {
this.EditList = response.data.data.coupons;
this.loading = false;
}, response => {
this.$message({type: 'error',message: response.data.msg});
console.log(response);
});
} else {
this.EditList = [];
}
},
},
});
</script>
@endsection