Commit 1dfde597 authored by zhangjianguo's avatar zhangjianguo

优惠券

parent 3e85bb52
<template>
<div class="addAutoreleaseCoupon">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">自动发放优惠券</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>自动发放优惠券编辑</span>
</div>
</div>
<div class="el-card__body" style="background-color: white; padding: 15px 50% 15px 0 ;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="small">
<el-form-item label="触发事件" class="is-required" style="width: 50%">
<el-select v-model="msg.TriggerType" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.Id"
:label="item.Name"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发放的优惠券" class="is-required" style="width: 50%">
<el-select v-model="msg.DiscountCouponId" placeholder="请选择">
<el-option
v-for="item in options2"
:key="item.ID"
:label="item.Name"
:value="item.ID">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发放次数" prop="GrantNum" class="is-required">
<el-tooltip class="item" effect="dark" content="每个用户可发放次数;如不限制发放次数,请填写0" placement="top"
style="position: absolute;left: -10px;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: 30%;"/>
<el-checkbox v-model="checked" @change="checked==true? msg.GrantNum=0:msg.GrantNum=1" style="margin-left: 10px">无限制</el-checkbox>
</el-form-item>
<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="flex-wrap: wrap;" flex="dir:left">
<div flex="dir:top cross:center" class="user-item" v-for="(item,index) in UserList" :label="item.Id" :key="index">
<img :src="item.Photo" alt="" class="avatar">
<div class="username">{{item.AliasName}}</div>
<button type="button" class="el-button close el-button--danger is-circle" @click="delUserList(index)"><i class="el-icon-close"></i></button>
</div>
</div>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading2">保存</el-button>
<!--选择用户-->
<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="输入用户ID、昵称搜索" class="el-input__inner" v-model="msg_t.AliasName">
<div class="el-input-group__append"><button type="button" class="el-button el-button--default" @click="search"><!----><!----><span>搜索</span></button></div>
</div>
<el-table
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
:v-loading="loading"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="Id"
label="ID"
width="176">
</el-table-column>
<el-table-column
label="所在平台"
width="174">
<template slot-scope="scope">
<img v-if="scope.row.Source==1" style="width:24px;height:24px" src="../../assets/img/statistics/wechat.png" alt="" class="platform-img">
<img v-if="scope.row.Source==2" style="width:24px;height:24px" src="../../assets/img/statistics/zhifubao.png" alt="" class="platform-img">
<img v-if="scope.row.Source==3" style="width:24px;height:24px" src="../../assets/img/statistics/douyin.png" alt="" class="platform-img">
<img v-if="scope.row.Source==4" style="width:24px;height:24px" src="../../assets/img/statistics/baidu.png" alt="" class="platform-img">
</template>
</el-table-column>
<el-table-column
prop="AliasName"
label="昵称"
show-overflow-tooltip>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg_t.pageSize"
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",
data(){
return{
msg:{
ID:0,
TriggerType:0,
DiscountCouponId:0,
GrantNum:1,
IsAll:0,
UserList:[]
},
rules:{
GrantNum:[
{required: true, message: "最多发放次数不能为空", trigger: "blur"}
]
},
checked:false,
options:[],
options2:[],
Name:'',
category:false,
tableData: [],
msg_t:{
pageIndex:1,
pageSize:10,
AliasName:''
},
count:0,
loading:false,
UserList:[],
Storage:[],
loading2:false
}
},
created(){
this.getrigger()
this.getrigger2()
this.getList()
setTimeout(()=>{
if(this.$route.query.ID){
this.gettRepositoryList(this.$route.query.ID)
}
},10)
},
methods:{
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
}
}
console.log(this.UserList)
} else {
this.Info(res.data.message);
}
})
},
getrigger(){
this.apipost("/api/Coupon/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("/api/Coupon/GetAllDiscountCouponList",{}, 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.category = true;
this.getList()
},
getList(){
this.loading =true
this.apipost("/api/User/GetPageListByKey",this.msg_t, 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);
}
})
},
getProductList(){
if(this.UserList.length>0){
let newStorage =[]
for(let i= 0;i<this.UserList.length;i++){
for(let j= 0;j<this.Storage.length;j++){
if(this.UserList[i].Id != this.Storage[j].Id){
newStorage.push(this.Storage[j])
}
}
}
this.UserList = this.UserList.concat(newStorage)
}else {
this.UserList = this.UserList.concat(this.Storage)
}
this.category = false;
},
search(){
this.getList();
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let UList =[];
for(let i= 0;i<this.UserList.length;i++){
UList.push({'UserId':this.UserList[i].Id})
}
this.msg.UserList= UList
this.loading2 = true;
this.apipost("/api/Coupon/AddOrUpdateSelfMotion",this.msg, res => {
this.loading2 = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} 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)
},
cancel(){
this.$router.go(-1)
}
}
}
</script>
<style >
.addAutoreleaseCoupon .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.addAutoreleaseCoupon .el-input--small .el-input__inner{
margin-left: 10px;
height: 32px;
line-height: 32px;
}
.addAutoreleaseCoupon .form-body{
background-color: #fff;
padding: 10px 50% 10px 20px;
min-width: 1000px;
}
.addAutoreleaseCoupon .user-item {
border: 1px #eeeeee solid;
padding: 20px;
margin-right: 20px;
margin-bottom: 20px;
width: 120px;
height: 120px;
position: relative;
}
.addAutoreleaseCoupon .user-item .close {
position: absolute;
right: -10px;
top: -10px;
padding: 0;
border-radius: 100px;
width: 20px;
height: 20px;
}
.addAutoreleaseCoupon .user-item .avatar {
width: 50px;
height: 50px;
}
</style>
...@@ -34,9 +34,8 @@ ...@@ -34,9 +34,8 @@
<el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用</el-radio> <el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用</el-radio>
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2" >当面付</el-radio> <el-radio :label="4" v-model="msg.UseType" @change="getUseType2" >当面付</el-radio>
</div> </div>
<div class="splist" v-if="msg.UseType==1"> <div class="splist" v-if="msg.UseType==1">
<div v-for="(item,index) in msg.ProductList" :label="item.ProductId" :key="index" style="margin-right: 20px;" class="el-tag el-tag--warning el-tag--plain"> <div v-for="(item,index) in AppointList" :label="item.ProductId" :key="index" style="margin-right: 20px;" class="el-tag el-tag--warning el-tag--plain">
<span>{{item.Name}}</span> <span>{{item.Name}}</span>
<i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i> <i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i>
</div> </div>
...@@ -297,7 +296,7 @@ ...@@ -297,7 +296,7 @@
ProductList:[],//指定商品类型的数组 ProductList:[],//指定商品类型的数组
StartDate:'', StartDate:'',
EndDate:'', EndDate:'',
value:'', value:[],
}, },
checkedkeys:[],//默认选中的 checkedkeys:[],//默认选中的
huiyuan:false, huiyuan:false,
...@@ -338,6 +337,7 @@ ...@@ -338,6 +337,7 @@
category:false, category:false,
ProductCategoryTreeList:[], ProductCategoryTreeList:[],
commoditylist:[],//商品的list commoditylist:[],//商品的list
AppointList:[],//指定商品分类
defaultProps: { defaultProps: {
children: 'ChildList', children: 'ChildList',
label: 'Name' label: 'Name'
...@@ -357,13 +357,14 @@ ...@@ -357,13 +357,14 @@
tableData:[], tableData:[],
loading_t:false, loading_t:false,
count:0, count:0,
multipleSelection:[] multipleSelection:[],
AppointList2:[],
} }
}, },
created(){ created(){
this.getMemberGradeList() this.getMemberGradeList()
this.getProductCategoryTreeList() this.getProductCategoryTreeList()
this.getProductGoodsPageList()
}, },
...@@ -401,6 +402,24 @@ ...@@ -401,6 +402,24 @@
}else { }else {
this.zhongxin=true this.zhongxin=true
} }
this.msg.MemberLevelList=res.data.data?res.data.data:[];
if(res.data.data.UseType==1){
let ProductList = res.data.data.ProductList;
let newData = []
for(let i= 0;i<ProductList.length;i++){
this.checkedkeys.push(ProductList[i].ProductId)
for(let j=0;j<this.ProductCategoryTreeList.length;j++){
if(ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id){
newData.push(this.ProductCategoryTreeList[j])
}
if(this.ProductCategoryTreeList[j].ChildList.length>0){
this.getReturn(ProductList[i],this.ProductCategoryTreeList[j].ChildList)
}
}
}
this.AppointList = this.AppointList2.concat(newData)
}
if(res.data.data.UseType==2){ if(res.data.data.UseType==2){
let ProductList = res.data.data.ProductList; let ProductList = res.data.data.ProductList;
let newData = [] let newData = []
...@@ -411,21 +430,30 @@ ...@@ -411,21 +430,30 @@
} }
} }
} }
console.log(ProductList)
console.log(this.tableData)
this.commoditylist = newData this.commoditylist = newData
} }
} else { } else {
this.Info(res.data.message); this.Info(res.data.message);
} }
}) })
}, },
getReturn(ProductList,data){
for(let i=0;i<data.length;i++){
if(ProductList.ProductId == data[i].Id){
this.AppointList2.push(data[i])
}
if(data[i].ChildList.length>0){
this.getReturn(ProductList,data[i].ChildList)
}
}
},
getProductCategoryTreeList(){ getProductCategoryTreeList(){
this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => { this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.ProductCategoryTreeList = res.data.data this.ProductCategoryTreeList = res.data.data
this.getProductGoodsPageList()
} else { } else {
// this.Info(res.data.message); // this.Info(res.data.message);
} }
...@@ -547,7 +575,7 @@ ...@@ -547,7 +575,7 @@
}, },
getUseType(val){ getUseType(val){
if(val ==1){ if(val ==1){
this.category=true this.category=true;
this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染 this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.$refs.tree.setCheckedKeys(this.checkedkeys); this.$refs.tree.setCheckedKeys(this.checkedkeys);
}); });
...@@ -560,7 +588,7 @@ ...@@ -560,7 +588,7 @@
this.checkedkeys=[] this.checkedkeys=[]
}, },
deleteProduct(item,index){ deleteProduct(item,index){
this.msg.ProductList.splice(index,1) this.AppointList.splice(index,1)
for(let i = 0;i<this.checkedkeys.length;i++){ for(let i = 0;i<this.checkedkeys.length;i++){
if(this.checkedkeys[i]==item.ProductId){ if(this.checkedkeys[i]==item.ProductId){
this.checkedkeys.splice(i,1) this.checkedkeys.splice(i,1)
...@@ -589,6 +617,12 @@ ...@@ -589,6 +617,12 @@
ProductList.push({'ProductId':this.commoditylist[i].Id,}) ProductList.push({'ProductId':this.commoditylist[i].Id,})
} }
this.msg.ProductList =ProductList this.msg.ProductList =ProductList
}else if(this.msg.UseType==1){
let ProductList= []
for(let i = 0;i<this.AppointList.length;i++){
ProductList.push({'ProductId':this.AppointList[i].ProductId,})
}
this.msg.ProductList =ProductList
} }
this.apipost("/api/Coupon/AddOrUpdateDiscountCoupon",this.msg , res => { this.apipost("/api/Coupon/AddOrUpdateDiscountCoupon",this.msg , res => {
this.loading= false this.loading= false
...@@ -619,9 +653,12 @@ ...@@ -619,9 +653,12 @@
} }
} }
} }
this.msg.ProductList= ProductList this.AppointList= ProductList
} }
},
mounted(){
} }
} }
</script> </script>
......
<template> <template>
<div class="autorelease"> <div class="autorelease">
发放 <div class="el-card__header">
<span>自动发放</span>
<div style="display: flex;flex-direction: row;align-items: center">
<el-button type="primary" class="el-button--small" @click="addRecharge">添加自动发放方案</el-button>
</div>
</div>
<div style="padding: 20px;background: #fff;">
<el-table
:data="tableData"
header-cell-class-name="headClass"
style="width: 1707px;"
border
:v-loading="loading"
>
<el-table-column
prop="ID"
label="ID"
width="343">
</el-table-column>
<el-table-column
prop="TriggerTypeStr"
label="触发事件"
width="341">
</el-table-column>
<el-table-column
prop="DiscountCouponName"
label="优惠券"
width="341">
</el-table-column>
<el-table-column
prop="GrantNum"
label="发放次数限制"
width="341">
<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="操作"
>
<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>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:total="count">
</el-pagination>
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "autorelease" name: "autorelease",
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
},
tableData:[],
count:0,
loading:false
}
},
created(){
this.getDateList();
},
methods:{
getDateList(){
this.loading=true;
this.apipost("/api/Coupon/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.$router.push('/addAutoreleaseCoupon');
},
Edit(row){
this.$router.push({
name: 'addAutoreleaseCoupon',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/Coupon/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> </script>
<style scoped> <style >
.autorelease .el-card__header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.autorelease .el-button--small{
padding: 9px 15px;
}
.autorelease .content .searchInput{
border: 1px solid #DCDFE6;
border-radius: 4px;
margin-left: 20px;
}
.autorelease .content .searchInput .el-input__inner{
border:none;outline:none;
height: 30px;
line-height: 30px;
}
.autorelease .content .searchInput{
line-height: normal;
display: inline-table;
border-collapse: separate;
border-spacing: 0;
width:250px;
}
.autorelease .content{
background: #fff;
margin-top:10px;
padding: 15px;
box-sizing: border-box;
}
</style> </style>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="发放优惠券" placement="top" > <el-tooltip class="item" effect="dark" content="发放优惠券" placement="top" >
<img src="../../assets/img/setup/send.png" alt="" class="imgstyle" @click="Edit(scope.row)"> <img src="../../assets/img/setup/send.png" alt="" class="imgstyle" @click="grant(scope.row)">
</el-tooltip> </el-tooltip>
<el-tooltip class="item" effect="dark" content="编辑" placement="top" > <el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)"> <img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
...@@ -158,6 +158,15 @@ ...@@ -158,6 +158,15 @@
this.$router.push('/addCoupon'); this.$router.push('/addCoupon');
}, },
grant(row){
var arr=JSON.stringify(row)
this.$router.push({
name: 'grantCouPon',
query: {
row
}
});
},
Edit(row){ Edit(row){
this.$router.push({ this.$router.push({
name: 'addCoupon', name: 'addCoupon',
......
<template>
<div class="grantCouPon">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">优惠券管理</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>优惠券发放</span>
</div>
</div>
<div class="el-card__body" style="background-color: white; padding: 15px 50% 15px 0 ;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="medium">
<el-form-item label="优惠券名称">
<span>{{record.Name}}</span>
</el-form-item>
<el-form-item label="最低消费金额(元)">
<span>{{record.MinConsumePrice}}</span>
</el-form-item>
<el-form-item label="优惠金额(元)">
<span>{{record.DiscountsPrice}}</span>
</el-form-item>
<el-form-item label="剩余数量">
<div v-if="record.TotalNum ==-1">{{record.TotalNum ==-1? '无限制领取':record.TotalNum}}</div>
<div v-if="record.TotalNum !=-1">{{record.ResidueNum}}</div>
</el-form-item>
<el-form-item label="优惠券有效期">
<div v-if="record.IndateType==1">领取后{{record.IndateDay}}天内有效</div>
<div v-if="record.IndateType==2">开始时间:{{record.StartDate}}</div>
<div v-if="record.IndateType==2">结束时间:{{record.EndDate}}</div>
</el-form-item>
<el-form-item label="发送数量" prop="GrantNum">
<el-input v-model="msg.GrantNum" size="small" style="width: 40%" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/>
</el-form-item>
<el-form-item label="发放对象" >
<el-tooltip class="item" effect="dark" content="请输入昵称/ID/手机号查找用户" placement="top"
style="position: absolute;left: -10px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="AliasName" style="width: 20%;margin-left: 5px" placeholder="昵称/ID/手机号" size="small"/>
<el-button :loading="loading" @click="lookup" size="small">查找用户</el-button>
<div style="width: 80%;display: flex;flex-direction: row;flex-wrap: wrap" v-if="ByPhone.length>0">
<el-checkbox-group v-model="msg.UserIds" @change = 'SelectBy'>
<el-checkbox-button v-for="(item,index) in ByPhone" :label="item.Id" :key="index" >
<img :src="item.Photo" alt="" class="avatar">
<div class="username">{{item.AliasName}}</div>
</el-checkbox-button>
</el-checkbox-group>
</div>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading2">保存</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</template>
<script>
export default {
name: "grantCouPon",
data(){
return{
record:{},
msg:{
GrantNum:0,
UserIds:[],
},
AliasName:'',
rules:{
GrantNum:[
{ validator: this.DiscountsPrice, trigger: 'blur' }
]
},
loading:false,
loading2:false,
ByPhone:[],
}
},
created(){
if(this.$route.query.row){
this.record = this.$route.query.row
}
},
methods:{
cancel(){
this.$router.go(-1)
},
lookup(){
this.loading = true;
this.apipost("/api/User/GetListByPhoneOrAliasName",{'AliasName':this.AliasName}, res => {
this.loading = false;
if (res.data.resultCode == 1) {
this.ByPhone = res.data.data
} else {
this.Info(res.data.message);
}
})
},
SelectBy(val){
this.msg.UserIds = val
},
DiscountsPrice(rule, value, callback) {
if(value>0){
return callback();
}else {
return callback(new Error('发送数量需大于零'));
}
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let UserIds = ''
if(this.msg.UserIds.length>0){
UserIds = this.msg.UserIds.join(",")
}
let data = {
ID: this.record.ID,
GrantNum :this.msg.GrantNum,
UserIds:UserIds,
}
this.apipost("/api/Coupon/GrantCoupon",data, res => {
this.loading2 = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
}
}
}
</script>
<style >
.grantCouPon .form-box {
background: #fff;
padding: 18px 50% 18px 0;
margin-top: 10px;
}
.grantCouPon .el-input--small .el-input__inner{
height: 32px;
line-height: 32px;
}
.grantCouPon .username{
margin-top: 10px;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.grantCouPon .el-checkbox-button__inner {
border: 1px solid #e2e2e2;
height: 125px;
width: 120px;
padding-top: 15px;
text-align: center;
margin: 0 20px 20px 0;
cursor: pointer;
border-radius: 0!important;
}
.grantCouPon .el-checkbox-button, .el-checkbox-button__inner{
display: inline-block;
position: relative;
}
.grantCouPon .user-list .avatar {
height: 60px;
width: 60px;
border-radius: 30px;
}
</style>
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
<el-input v-model="msg.LongAndLat" :disabled="true" class="inputM_l"/> <el-input v-model="msg.LongAndLat" :disabled="true" class="inputM_l"/>
</el-form-item> </el-form-item>
<el-form-item label="地图" style="margin-top: 15px" label-width="80px"> <el-form-item label="地图" style="margin-top: 15px" label-width="80px">
<button class="el-button el-button--default el-button--small inputM_l"> <button class="el-button el-button--default el-button--small inputM_l" @click="isShowMap=true">
展开地图 展开地图
</button> </button>
</el-form-item> </el-form-item>
...@@ -898,19 +898,24 @@ ...@@ -898,19 +898,24 @@
<el-button size="small" type="danger" @click="getChoiceLink()">确 定</el-button> <el-button size="small" type="danger" @click="getChoiceLink()">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 地图选址 -->
<el-dialog title="地图展示" :visible.sync="isShowMap" width="960px">
<commonMap @map-submit="mapEvent"></commonMap>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import ChooseImg from "@/components/global/ChooseImg.vue"; import ChooseImg from "@/components/global/ChooseImg.vue";
import chooseMeun from "../common/chooseMeun.vue"; import chooseMeun from "../common/chooseMeun.vue";
import commonMap from "../common/commonMap.vue";
export default { export default {
name: "basicSetUp", name: "basicSetUp",
components: { components: {
ChooseImg, ChooseImg,
chooseMeun chooseMeun,
commonMap
}, },
data() { data() {
return { return {
...@@ -994,6 +999,7 @@ ...@@ -994,6 +999,7 @@
ConsultWay: [], ConsultWay: [],
}, },
isShowMap:false,
isShowLink:false, isShowLink:false,
Choiceimg:0, Choiceimg:0,
changeState:false, changeState:false,
...@@ -1148,6 +1154,14 @@ ...@@ -1148,6 +1154,14 @@
return callback(); return callback();
} }
}, },
//得到地图信息
mapEvent(e) {
this.msg.LongAndLat =e.lat + ',' + e.long;
this.msg.Address =e.address;
this.isShowMap=false;
},
//获取选择链接 //获取选择链接
getChoiceLink(){ getChoiceLink(){
//调用子组件方法 //调用子组件方法
......
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