Commit 88a255d6 authored by zhengke's avatar zhengke

增加奖品页面

parent d3f49ee4
This diff is collapsed.
<template>
<div class="flexOne">
<div class="query-box">
<ul class="user_time_picker">
<li>
<input type="button" @click="outerVisible = true,dialogTitle='新增奖项',resetInfo()" class="normalBtn" value="新增">
</li>
</ul>
</div>
<div class="clearfix"></div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th>奖项名</th>
<th>奖项数量</th>
<th>奖项状态</th>
<th>奖项类型</th>
<th>操作</th>
</tr>
<tr v-for="item in dataList">
<td>{{item.awardName}}</td>
<td>{{item.awardCount}}</td>
<td>{{item.awardStatus==1?'正常':'禁用'}}</td>
<td v-if="item.awardType==1">谢谢参与</td>
<td v-if="item.awardType==2">一般奖项</td>
<td v-if="item.awardType==3">优惠券</td>
<td>
<el-tooltip class="item" effect="dark" content="修改抽奖信息" placement="top">
<el-button
type="primary"
icon="el-icon-edit"
circle
@click="outerVisible=true,dialogTitle='修改抽奖信息',updateData(item)"
></el-button>
</el-tooltip>
</td>
</tr>
</table>
<div class="noDataNotice" v-if="dataList.length<1">
<i class="iconfont icon-kong"></i>
<p>没有找到你需要的数据</p>
</div>
<el-dialog
custom-class="w800"
:title="dialogTitle"
:visible.sync="outerVisible"
center
:before-close="closeChangeMachie"
>
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px">
<table class="layerTable layerNoIcon">
<tr>
<td>
<el-form-item label="奖项名" prop="awardName">
<el-input v-model="addMsg.awardName" class="w217" placeholder="奖项名"/>
</el-form-item>
</td>
<td>
<el-form-item label="奖项数量" prop="awardCount">
<el-input v-model="addMsg.awardCount" class="w217" @keyup.native="checkInteger(addMsg,'awardCount')" placeholder="奖项数量"/>
</el-form-item>
</td>
</tr>
<td>
<el-form-item label="奖项类型" prop="awardType">
<el-select filterable v-model="addMsg.awardType" class="w217" @change="getAwardRelationId()">
<el-option label="谢谢参与" :value="1"></el-option>
<el-option label="一般奖项" :value="2"></el-option>
<el-option label="优惠券" :value="3"></el-option>
</el-select>
</el-form-item>
</td>
<td>
<el-form-item label="奖项关联" prop="awardRelationId" v-if="addMsg.awardType==3">
<el-select filterable v-model="addMsg.awardRelationId" class="w217" >
<el-option label="不限" :value="0"></el-option>
<el-option v-for="item in awardRelationList" :label="item.couponsName" :value="item.couponId" :key="item.couponId"></el-option>
</el-select>
</el-form-item>
</td>
</tr>
<tr>
<td>
<el-form-item label="排序" prop="rank">
<el-input v-model="addMsg.rank" class="w217" @keyup.native="checkInteger(addMsg,'rank')" placeholder="排序"/>
</el-form-item>
</td>
<td>
<el-form-item label="奖项状态" prop="awardStatus">
<el-select filterable v-model="addMsg.awardStatus" class="w217">
<el-option label="正常" :value="1"></el-option>
<el-option label="禁用" :value="2"></el-option>
</el-select>
</el-form-item>
</td>
</tr>
</table>
</el-form>
<div slot="footer" class="dialog-footer">
<button class="hollowFixedBtn" @click="outerVisible = false">取 消</button> &nbsp;
<button class="normalBtn" @click="submitForm('addMsg')">保存</button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
//请求
msg: {
lotteryId: '',
},
addMsg:{
id:0,
lotteryId:0,
awardName:'',
awardType:1,
//谢谢参与和一般奖项为0,优惠券 请求接口返回
awardRelationId:'',
awardCount:'',
awardStatus:1,
rank:'',
},
rules:{
awardName: [{ required: true, message: "请输入公司", trigger: "blur" }],
awardType: [{ required: true, message: "请选择奖项类型", trigger: "change" }],
awardRelationId: [{required: true, message: "请选择奖项关联", trigger: "change"}],
awardCount: [{ required: true, message: "请输入奖项数量", trigger: "blur" }],
awardStatus: [{ required: true, message: "请选择奖项状态", trigger: "change" }],
rank: [{ required: true, message: "请输入排序", trigger: "blur" }],
},
loading:true,
outerVisible:false,
dialogTitle:'',
dataList:[],
awardRelationList:[],
};
},
mounted() {
this.msg.lotteryId = this.$route.query.lotteryId;
this.getList();
},
filters: {
},
methods: {
//获取数据
getList() {
this.loading = true;
this.apiJavaPost("/api/sell/lottery/getLotteryAwardList", this.msg, res => {
console.log(res,'getList');
this.loading = false;
if (res.data.resultCode === 1) {
this.dataList = res.data.data;
} else {
this.Error(res.data.message)
}
}, null);
},
//提交
submitForm(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.addAward();
} else {
return false;
}
});
},
//提交添加
addAward(){
this.addMsg.lotteryId = this.$route.query.lotteryId;
if(this.addMsg.awardType==1||this.addMsg.awardType==2){
this.addMsg.awardRelationId = 0;
}
this.apiJavaPost("/api/sell/lottery/setLotteryAward", this.addMsg, res => {
console.log(res,'getList');
if (res.data.resultCode === 1) {
this.Success(res.data.message);
this.outerVisible = false;
this.getList();
} else {
this.Error(res.data.message)
}
}, null);
},
//修改信息
updateData(item){
this.addMsg.id=item.id;
this.addMsg.lotteryId = item.lotteryId;
this.addMsg.awardName = item.awardName;
this.addMsg.awardType = item.awardType;
this.addMsg.awardRelationId = item.awardRelationId;
this.addMsg.awardCount = item.awardCount;
this.addMsg.awardStatus = item.awardStatus;
this.addMsg.rank = item.rank;
this.getAwardRelationId();
},
//根据奖项类型请求关联Id
getAwardRelationId(){
let msg = {
couponId:0
}
this.apiJavaPost("/api/sell/lottery/getCouponsList", msg, res => {
if (res.data.resultCode === 1) {
this.awardRelationList = res.data.data;
} else {
this.Error(res.data.message)
}
}, null);
},
//重置信息
resetInfo(){
var newMsg = {
id:0,
lotteryId:0,
awardName:'',
awardType:1,
awardRelationId:'',
awardCount:'',
awardStatus:1,
rank:'',
}
this.addMsg = newMsg;
},
closeChangeMachie(done) {
//弹出框关闭初始化弹框内表单
done();
this.resetForm("addMsg");
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
};
</script>
\ No newline at end of file
......@@ -2739,6 +2739,21 @@ export default {
meta: {
title: '优惠券列表'
}
},
{
path: '/LuckyDraw',
name: 'LuckyDraw',
component: resolve => require(['@/components/activity/LuckyDraw'], resolve),
meta: {
title: '抽奖列表'
}
},{
path: '/awardList',
name: 'awardList',
component: resolve => require(['@/components/activity/awardList'], resolve),
meta: {
title: '奖项列表'
}
}
]
},
......
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