Commit 23eb6d7b authored by youjie's avatar youjie

自动发放

parent 9c34f36d
...@@ -8086,5 +8086,11 @@ export const obj = { ...@@ -8086,5 +8086,11 @@ export const obj = {
caistpccjsfoot: '彩色(图片尺寸:128x107)', caistpccjsfoot: '彩色(图片尺寸:128x107)',
}, },
//#endregion //#endregion
//#region ending v1.0.2
v102:{
tianjzdfffa: '添加自动发放方案',
chufasj: '触发事件',
},
//#endregion
} }
export default obj; export default obj;
<template>
<div class="page_fnDm page_RecPayQuery">
<div class="query-box" style="margin-bottom: 0px;">
<ul class="clearfix">
<li class="hight_query">
<button class="hollowFixedBtn" @click="getDateList()">{{$t('pub.searchBtn')}}</button>
<button class="normalBtn" @click="addRecharge">{{$t('objFill.v102.tianjzdfffa')}}</button>
</li>
</ul>
</div>
<div class="_fnDm_content" v-loading='loading' style="padding-top: 20px;">
<el-table
:data="tableData"
style="width: 100%;"
border
v-loading="loading"
>
<el-table-column
prop="ID"
label="ID" width="100">
</el-table-column>
<el-table-column
prop="TriggerTypeStr"
label="触发事件">
</el-table-column>
<el-table-column
prop="DiscountCouponName"
label="优惠券">
</el-table-column>
<el-table-column
prop="GrantNum"
label="发放次数限制">
<template slot-scope="scope">
<div v-if="scope.row.GrantNum==0">
无限制
</div>
<div v-if="scope.row.GrantNum>0">
{{scope.row.GrantNum}}
</div>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作" width="100"
>
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top" >
<img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:total="count">
</el-pagination>
<addAutorelease v-if="addAutoreleaseShow"
:infoData="infoData"
@Success="infoData=null,addAutoreleaseShow=false,getDateList()"
@close="infoData=null,addAutoreleaseShow=false"/>
</div>
</template>
<script>
import addAutorelease from "./components/addAutorelease";
export default {
name: "autorelease",
components: {addAutorelease},
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
BranchId: -1,
TriggerType: -1
},
tableData:[],
count:0,
loading:false,
addAutoreleaseShow: false,
infoData: null,
options: [],
}
},
created(){
this.getDateList();
},
methods:{
getrigger(){
this.apipost("coupon_post_GetTriggerTypeEnumList",{}, res => {
if (res.data.resultCode == 1) {
this.options = res.data.data;
this.options.unshift({
Name: '不限',
Id: -1
})
} else {
this.Info(res.data.message);
}
})
},
getDateList(){
this.loading=true;
this.apipost("coupon_post_GetSelfMotionPageLis", this.msg, res => {
this.loading=false;
if(res.data.resultCode==1){
this.tableData = res.data.data.pageData;
this.count = res.data.data.count;
}else {
this.Info(res.data.message);
}
})
},
addRecharge(){
this.addAutoreleaseShow = true
},
Edit(row){
this.infoData = row
this.addAutoreleaseShow = true
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"coupon_post_DelDiscountSelfMotion",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getDateList();
} else {
that.Error(res.data.message);
}
},
);
});
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getDateList();
},
}
}
</script>
<style scoped>
/deep/.el-table th.el-table__cell {
background-color: #E6E6E6;
}
.el-form-item{
margin-bottom:5px;
}
</style>
\ No newline at end of file
<template>
<div class="addAutoreleaseCoupon">
<el-dialog @closed="closedDialog" :modal="true" :visible.sync="dialogTableVisible"
:close-on-click-modal="false" class="addContacts"
width="700px">
<div class="add-tit" slot="title">
<p v-if="msg.ID==0"><span></span>自动发放优惠券</p>
<p v-else><span></span>自动发放优惠券编辑</p>
<span icon="el-icon-close"></span>
</div>
<div class="form-box">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="120px" size="small">
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="触发事件" class="is-required" >
<el-select v-model="msg.TriggerType" placeholder="请选择" style="width: 100%">
<el-option
v-for="item in options"
:key="item.Id"
:label="item.Name"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发放的优惠券" class="is-required" >
<el-select v-model="msg.DiscountCouponId" placeholder="请选择" style="width: 100%">
<el-option
v-for="item in options2"
:key="item.id"
:label="item.couponsName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="口令" class="is-required" v-if="msg.TriggerType==5" >
<el-input v-model="msg.KeyWord" class="el-input--small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发放次数" prop="GrantNum" class="is-required">
<el-tooltip class="item" effect="dark" content="每个用户可发放次数;如不限制发放次数,请填写0" placement="top"
style="position: absolute;left: -100px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="msg.GrantNum" class="el-input--small" :disabled="checked" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''" style="width: 50%;"/>
<el-checkbox v-model="checked" @change="checked==true? msg.GrantNum=0:msg.GrantNum=1" style="margin-left: 10px">无限制</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开始时间" >
<el-date-picker size="small" v-model="msg.RegisterDate" type="date" style="width: 100%"
value-format="yyyy-MM-dd" placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公司" >
<el-select v-model="msg.BranchId" placeholder="请选择公司" style="width: 100%">
<el-option
v-for="item in companyList"
:key="item.Id"
:label="item.BName"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发放类型" >
<el-select v-model="msg.SelfMotionType" placeholder="请选择发放类型" style="width: 100%">
<el-option
v-for="item in SelfMotionList"
:key="item.Id"
:label="item.Name"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="领取人" >
<el-radio-group v-model="msg.IsAll" >
<el-radio :label="0">所有用户</el-radio>
<el-radio :label="1">指定用户</el-radio>
<button class="el-button el-button--text" v-if="msg.IsAll ==1" @click="choice">选择用户</button>
</el-radio-group>
<div style="display: flex; flex-wrap: wrap;">
<div class="user-item" v-for="(item,index) in UserList"
:label="item.ID" :key="index">
<div class="username">{{item.CustomerName?item.CustomerName:'-'}}</div>
<button type="button" class="el-button closeName el-button--danger is-circle" @click="delUserList(index)"><i class="el-icon-close"></i></button>
</div>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" class="add-box-btn" @click="preserve('msg')" :loading="loading2">{{$t('pub.sureBtn')}}</el-button>
<el-button class="add-box-btn add-box-cancel" @click="dialogTableVisible = false, resetForm('msg')">{{$t('pub.cancelBtn')}}</el-button>
</div>
</el-dialog>
<!--选择用户-->
<el-dialog title="选择用户" :visible.sync="category" width="612px">
<div class="el-input el-input--small el-input-group el-input-group--append">
<input type="text" autocomplete="off" placeholder="输入名称搜索" class="el-input__inner" v-model="msg_t.CustomerName">
<div class="el-input-group__append">
<button type="button" class="el-button el-button--default" @click="search"><span>搜索</span></button>
</div>
</div>
<el-table
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
v-loading="loading"
row-key="ID"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="50" reserve-selection>
</el-table-column>
<el-table-column
prop="ID"
label="ID"
width="100">
</el-table-column>
<el-table-column
label="客户">
<template slot-scope="scope">
{{ scope.row.CustomerName }}
</template>
</el-table-column>
<!-- <el-table-column
prop="EmName"
label="销售" width="120"
show-overflow-tooltip>
</el-table-column> -->
</el-table>
<el-pagination style="text-align:center"
background
@current-change="handleCurrentChange"
:page-size="msg_t.pageSize"
:current-page.sync="msg_t.pageIndex"
layout="prev, pager, next"
:total="count">
</el-pagination>
<div slot="footer" class="dialog-footer">
<el-button @click="category = false">取 消</el-button>
<el-button type="primary" @click="getProductList">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "addAutoreleaseCoupon",
props:['infoData'],
data(){
return{
msg:{
ID:0,
TriggerType:0,
DiscountCouponId:0,
GrantNum:1,
IsAll:0,
UserList:[],
RegisterDate:'',
KeyWord:'',
BranchId: -1,
SelfMotionType: 1
},
rules:{
GrantNum:[
{required: true, message: "最多发放次数不能为空", trigger: "blur"}
]
},
checked:false,
options:[],
options2:[],
Name:'',
category:false,
tableData: [],
msg_t:{
pageIndex:1,
pageSize:8,
// Name:'',
// SmallShopId:0,
CustomerName: "",
CreateBy: "-1",
DepartmentId: "-1",
Brand: -1,
allDepartment: 0,
CustomerStatus: '',
OperationStatus: '',
jySort: 'desc',
rtsSort: '',
orderBy: 'TradeMoney desc',
ExceptionCount: 0,
fanYong: -1,
STime: '',
ETime: ''
},
count:0,
loading:false,
UserList:[],
Storage:[],
loading2:false,
dialogTableVisible: true,
getCompanyMsg: {
RB_Group_Id: "0",
Status: "0"
},
companyList: [],
SelfMotionList: [
{Name:'通用',Id:0},
{Name:'同业',Id:1},
{Name:'直客',Id:2},
]
}
},
created(){
let userInfo = this.getLocalStorage();
this.getCompanyMsg.RB_Group_Id = userInfo.RB_Group_id
this.getrigger()
this.getrigger2()
this.getCompany()
this.getList()
setTimeout(()=>{
if(this.$route.query.ID){
this.gettRepositoryList(this.$route.query.ID)
}
},10)
},
mounted(){
if(this.infoData) this.getInfo()
},
methods:{
getInfo(){
this.apipost("coupon_post_GettRepositoryList",{
ID: this.infoData.ID
}, res => {
if (res.data.resultCode == 1) {
console.log(res.data.data,'--------infoData=null,')
let data = res.data.data
this.msg = {
ID: data.ID,
TriggerType:data.TriggerType,
DiscountCouponId:data.DiscountCouponId,
GrantNum:data.GrantNum,
IsAll:data.IsAll,
UserList:[],
RegisterDate:data.RegisterDate,
KeyWord:data.KeyWord,
BranchId: data.BranchId,
SelfMotionType: data.SelfMotionType
}
this.UserList = data.UserList
} else {
this.Info(res.data.message);
}
})
},
handleClose(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
}
},
resetForm(formName) {
// 重置表单
this.msg = {
ID:0,
TriggerType:0,
DiscountCouponId:0,
GrantNum:1,
IsAll:0,
UserList:[],
RegisterDate:'',
KeyWord:'',
};
this.$refs[formName].resetFields();
this.$emit("close");
},
closedDialog() {
this.$emit("close");
},
gettRepositoryList(ID){
this.apipost("/api/Coupon/GettRepositoryList",{'ID':ID} , res => {
if (res.data.resultCode == 1) {
this.msg = res.data.data
if(res.data.data.GrantNum==0){
this.checked=true
}
if(res.data.data.UserList){
this.UserList= res.data.data.UserList
for(let i = 0;i<this.UserList.length;i++){
this.UserList[i].Id = this.UserList[i].UserId
}
}
} else {
this.Info(res.data.message);
}
})
},
getCompany() {
this.apipost(
"admin_get_BranchGetList",
this.getCompanyMsg,
res => {
if (res.data.resultCode == 1) {
this.companyList = res.data.data;
this.companyList.unshift({
BName: '不限',
Id: -1
})
} else {
}
},
err => {}
);
},
getrigger(){
this.apipost("coupon_post_GetTriggerTypeEnumList",{}, res => {
if (res.data.resultCode == 1) {
this.options = res.data.data;
this.msg.TriggerType = res.data.data[0].Id
} else {
this.Info(res.data.message);
}
})
},
getrigger2(){
this.apipost("coupon_post_GetDropDowmList",{"CouponsName":"","BranchId":-1}, res => {
if (res.data.resultCode == 1) {
this.options2 = res.data.data;
this.msg.DiscountCouponId = res.data.data[0].id
} else {
this.Info(res.data.message);
}
})
},
choice(){
this.options2.forEach(x=>{
if(x.ID == this.msg.DiscountCouponId){
this.msg_t.SmallShopId = x.SmallShopId
}
})
this.category = true;
// this.msg_t.pageIndex =1
// this.getList()
},
getList(){
this.loading =true
this.apipost("app_customer_GetCustomerListForCareOf",this.msg_t, res => {
this.loading =false
if (res.data.resultCode == 1) {
this.tableData = res.data.data.pages.pageData;
this.count = res.data.data.pages.count;
} else {
this.Info(res.data.message);
}
})
},
getProductList(){
this.UserList = this.Storage.length>0? JSON.parse(JSON.stringify(this.Storage)):[]
this.category = false;
},
search(){
this.msg_t.pageIndex =1
this.getList();
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let UList =[];
if(this.UserList&&this.UserList.length>0&&this.IsAll!=0){
for(let i= 0;i<this.UserList.length;i++){
UList.push({'UserId':this.UserList[i].ID})
}
console.log(UList,';-----')
this.msg.UserList= UList
}
if(this.msg.RegisterDate==null){
this.msg.RegisterDate=''
}
if(this.msg.TriggerType==5 && this.msg.KeyWord==''){
this.Error('请填写口令')
return false
}
this.loading2 = true;
this.apipost("coupon_post_AddOrUpdateSelfMotion",this.msg, res => {
this.loading2 = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$emit('Success');
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
handleSelectionChange(val){
this.Storage = val
},
handleCurrentChange(val) {
this.msg_t.pageIndex = val;
this.getList();
},
delUserList(index){
this.UserList.splice(index,1)
this.handleClose([this.Storage[index]])
},
cancel(){
this.$router.go(-1)
}
}
}
</script>
<style >
.user-item {
/* border: 1px #eeeeee solid; */
/* padding: 20px; */
margin-right: 30px;
margin-bottom: 0px;
position: relative;
}
.user-item .closeName {
position: absolute;
right: -10px;
top: 2px;
padding: 0;
width: 18px;
height: 18px;
/* border-radius: 100px; */
}
</style>
<style scoped>
/deep/.el-table th.el-table__cell {
background-color: #E6E6E6;
}
.el-form-item{
margin-bottom:5px;
}
</style>
\ No newline at end of file
...@@ -5699,6 +5699,14 @@ export default { ...@@ -5699,6 +5699,14 @@ export default {
meta: { meta: {
title: '抽奖列表' title: '抽奖列表'
} }
},
{
path: '/autorelease',
name: 'autorelease',
component: resolve => require(['@/components/activity/autorelease'], resolve),
meta: {
title: '自动发放'
}
}, { }, {
path: '/awardList', path: '/awardList',
name: 'awardList', name: 'awardList',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment