Commit 3732acb8 authored by xd's avatar xd

Merge branch 'master' of http://114.67.93.201/xulili/ybf

parents f844f059 5c12e612
...@@ -122,3 +122,14 @@ export function getTemplateData(id) { ...@@ -122,3 +122,14 @@ export function getTemplateData(id) {
method: 'post' method: 'post'
}) })
} }
/**
* 删除模板
* @param {} id 模板id
*/
export function deleteTemplate(id) {
return request({
url: `template/delete?id=${id}`,
method: 'delete'
})
}
\ No newline at end of file
...@@ -14,10 +14,6 @@ export function CoutDown(Endtime) { ...@@ -14,10 +14,6 @@ export function CoutDown(Endtime) {
if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) { if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) {
document.getElementById("timer").innerHTML = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒"; document.getElementById("timer").innerHTML = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
} }
if (days <= 0 || hours <= 0) {
console.log('已结束');
document.getElementById("timer").innerHTML = '已结束'
}
function checkTime(i) { //将0-9的数字前面加上0,例1变为01 function checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) { if (i < 10) {
i = "0" + i; i = "0" + i;
......
...@@ -8,14 +8,17 @@ ...@@ -8,14 +8,17 @@
<div class="coupon-content"> <div class="coupon-content">
<img src="../../../public/img/coupon.png" alt="coupon_bg" /> <img src="../../../public/img/coupon.png" alt="coupon_bg" />
<div class="content"> <div class="content">
<div class="money">10</div> <div class="money">{{ couponDetail.unit }}</div>
<div class="split"> <div class="split">
<img src="../../../public/img/split.png" alt="split" /> <img src="../../../public/img/split.png" alt="split" />
</div> </div>
<div class="other"> <div class="other">
<p>满50元可用</p> <p>{{couponDetail.salesUnit}}元可用</p>
<p>有效期:09.09-09.10</p> <p>
<p>全店通用</p> 有效期:
<span style="font-size: 12px;">{{ couponDetail.end_date }}</span>
</p>
<p>{{ couponDetail.deptId }}号店通用</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -28,7 +31,7 @@ ...@@ -28,7 +31,7 @@
<div class="wheel"> <div class="wheel">
<div class="wheel-point" @click="Start_Game"></div> <div class="wheel-point" @click="Start_Game"></div>
<img src="../../../public/img/wheel.png" alt="wheel" /> <img src="../../../public/img/wheel.png" alt="wheel" />
<div class="circle"></div> <!-- <div class="circle"></div> -->
<div <div
class="wheel-bg" class="wheel-bg"
:class="{freeze: freeze}" :class="{freeze: freeze}"
...@@ -50,13 +53,15 @@ ...@@ -50,13 +53,15 @@
</div> </div>
</div> </div>
<div class="awards"> <div class="awards">
<ul> <van-field
<li> class="area"
<span>{{ prizeDesc }}</span> v-model="prizeDesc"
<!-- <span>一等奖:</span> rows="2"
<span>价值280元的优惠券</span>--> autosize
</li> type="textarea"
</ul> show-word-limit
:disabled="false"
/>
</div> </div>
<div class="time-line"> <div class="time-line">
距离结束仅剩 距离结束仅剩
...@@ -76,6 +81,16 @@ ...@@ -76,6 +81,16 @@
<van-overlay :show="showAward && !res_error" @click="showAward = false"> <van-overlay :show="showAward && !res_error" @click="showAward = false">
<div class="wrapper" @click.stop> <div class="wrapper" @click.stop>
<div v-if="isAward" class="block"> <div v-if="isAward" class="block">
<div class="award-coupon">
<img class="bg_img" src="/img/coupon.png" alt="coupon" />
<div class="other">
<p>{{ awardGood.coupon.type }}</p>
<div class="split">
<img src="../../../public/img/split.png" alt="split" />
</div>
<p>{{ awardGood.coupon.unit }}元</p>
</div>
</div>
<p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p> <p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p>
<p style="font-size: 20px;font-weight: bold;">{{ awardGood.prizeName }}!</p> <p style="font-size: 20px;font-weight: bold;">{{ awardGood.prizeName }}!</p>
<p style="font-size: 20px;font-weight: bold;">恭喜您中奖!</p> <p style="font-size: 20px;font-weight: bold;">恭喜您中奖!</p>
...@@ -102,6 +117,7 @@ export default { ...@@ -102,6 +117,7 @@ export default {
components: { wxAuth }, components: { wxAuth },
data() { data() {
return { return {
couponDetail: {},
game_end: false, game_end: false,
res_error: false, res_error: false,
error_message: "", error_message: "",
...@@ -175,7 +191,6 @@ export default { ...@@ -175,7 +191,6 @@ export default {
if (this.$route.query.unionid === undefined) { if (this.$route.query.unionid === undefined) {
this.getUnionid(); this.getUnionid();
} else { } else {
console.log("有unionid");
this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid); this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid);
this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid); this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid);
let params = { let params = {
...@@ -195,16 +210,6 @@ export default { ...@@ -195,16 +210,6 @@ export default {
mounted() { mounted() {
this.getAgentAuth(); this.getAgentAuth();
this.GET_DetailById(this.active_id); this.GET_DetailById(this.active_id);
let cur_date = new Date();
let end_time = new Date(this.timeLine);
if (end_time - cur_date > 0) {
this.timer = setInterval(() => {
CoutDown(this.timeLine);
}, 1000);
} else {
document.getElementById("timer").innerHTML = '已结束';
this.game_end = true;
}
}, },
watch: { watch: {
prizeNumber() { prizeNumber() {
...@@ -222,14 +227,20 @@ export default { ...@@ -222,14 +227,20 @@ export default {
} }
}, },
methods: { methods: {
// 领取 // 领取(
handleGet() { handleGet() {
console.log("中奖奖品信息", this.awardGood); if (this.$route.query.iswxClient === "false") {
this.$toast("企业微信端不能领取");
return;
}
let params = { let params = {
couponId: this.awardGood.activityPrize.couponId, couponId: this.awardGood.activityPrize
? this.awardGood.coupon.id
: this.couponDetail.id,
unionId: this.userBaseInfo.unionid, unionId: this.userBaseInfo.unionid,
vipId: this.userBaseInfo.vipId vipId: this.userBaseInfo.vipId
}; };
console.log("领取", params);
APi_Active.collectMyCoupon(params).then(res => { APi_Active.collectMyCoupon(params).then(res => {
this.showAward = false; this.showAward = false;
this.$toast( this.$toast(
...@@ -249,6 +260,30 @@ export default { ...@@ -249,6 +260,30 @@ export default {
8 8
)}` + time.substring(8); )}` + time.substring(8);
this.prizeListOrigin = res.data.list; this.prizeListOrigin = res.data.list;
this.prizeNumber = res.data.list.length;
if (this.active_type === "coupon") {
let time2 = res.data.coupon.end_date;
res.data.coupon.end_date =
`${time2.substring(0, 4)}-${time2.substring(
4,
6
)}-${time2.substring(6, 8)}` + time2.substring(8);
this.couponDetail = res.data.coupon;
}
if (this.active_type === "wheel") {
let cur_date = new Date();
let end_time = new Date(this.timeLine);
console.log(cur_date);
console.log(end_time);
if (end_time - cur_date > 0) {
this.timer = setInterval(() => {
CoutDown(this.timeLine);
}, 1000);
} else {
document.getElementById("timer").innerHTML = "已结束";
this.game_end = true;
}
}
}); });
}, },
handleCheckAuth() { handleCheckAuth() {
...@@ -262,11 +297,14 @@ export default { ...@@ -262,11 +297,14 @@ export default {
window.location.href = `http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=${redirect_uri}`; window.location.href = `http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=${redirect_uri}`;
}, },
Start_Game() { Start_Game() {
if (this.$route.query.iswxClient === "false") {
this.$toast("企业微信端不能参与抽奖活动");
return;
}
if (this.game_end) { if (this.game_end) {
this.$toast('活动已结束'); this.$toast("活动已结束");
return; return;
} }
console.log("会员基本信息", this.userBaseInfo);
if (!this.userBaseInfo.vipId) { if (!this.userBaseInfo.vipId) {
this.$toast("非会员,"); this.$toast("非会员,");
let url = "http://oysales.oywanhao.com/register"; let url = "http://oysales.oywanhao.com/register";
...@@ -280,12 +318,12 @@ export default { ...@@ -280,12 +318,12 @@ export default {
unionId: this.userBaseInfo.unionid, unionId: this.userBaseInfo.unionid,
userName: this.userBaseInfo.name userName: this.userBaseInfo.name
}; };
console.log("params", params); if (this.rolling) {
if (this.rolling) return; this.$toast("抽奖中,请勿多次点击!");
return;
}
APi_Active.play(params) APi_Active.play(params)
.then(res => { .then(res => {
// const random = parseInt(6 * Math.random(0, 5));
console.log("抽奖结果", res.data);
if (!res.data.prizedId) { if (!res.data.prizedId) {
this.res_error = true; this.res_error = true;
this.$toast(res.data.message); this.$toast(res.data.message);
...@@ -293,16 +331,15 @@ export default { ...@@ -293,16 +331,15 @@ export default {
} }
const { wheelDeg, prizeList } = this; const { wheelDeg, prizeList } = this;
this.rolling = true; this.rolling = true;
const random = prizeList const random = prizeList.map(item => item.id).indexOf(res.data.prizedId);
.map(item => item.id)
.indexOf(res.data.prizeId);
this.wheelDeg = this.wheelDeg =
wheelDeg - wheelDeg -
(wheelDeg % 360) + (wheelDeg % 360) +
6 * 360 - 6 * 360 -
(360 / prizeList.length) * random; (360 / prizeList.length) * random;
setTimeout(() => { setTimeout(() => {
this.awardGood = res.data; this.awardGood = prizeList[random];
this.awardGood.coupon = JSON.parse(this.awardGood.coupon);
this.rolling = false; this.rolling = false;
this.showAward = true; this.showAward = true;
this.isAward = res.data.prizeName !== "谢谢惠顾"; this.isAward = res.data.prizeName !== "谢谢惠顾";
...@@ -396,7 +433,7 @@ export default { ...@@ -396,7 +433,7 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
width: 80%; width: 85%;
height: 92%; height: 92%;
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
...@@ -520,13 +557,10 @@ export default { ...@@ -520,13 +557,10 @@ export default {
.awards { .awards {
width: 80%; width: 80%;
min-height: 100px;
background: #ff9;
margin: 0 auto 10px; margin: 0 auto 10px;
.van-cell {
background: #ff9;
border-radius: 10px; border-radius: 10px;
li {
padding: 10px 20px;
font-size: 0.5rem;
font-weight: bold; font-weight: bold;
} }
} }
...@@ -599,7 +633,32 @@ export default { ...@@ -599,7 +633,32 @@ export default {
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
width: 70%; width: 70%;
padding: 10px 0;
background-color: #fff; background-color: #fff;
.award-coupon {
position: relative;
width: 80%;
.bg_img {
width: 100%;
height: 100%;
}
.other {
display: flex;
justify-content: space-between;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 90%;
height: 60%;
margin: auto;
color: #f00;
p {
margin: 0;
}
}
}
p { p {
margin-bottom: 8px; margin-bottom: 8px;
} }
......
...@@ -127,7 +127,8 @@ export default { ...@@ -127,7 +127,8 @@ export default {
path: "/activeDetail", path: "/activeDetail",
query: { query: {
id: active_id, id: active_id,
active_type: type active_type: type,
iswxClient: 'false'
} }
}); });
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<van-datetime-picker <van-datetime-picker
v-model="startTime" v-model="startTime"
type="datetime" type="datetime"
:min-date="minStartDate"
@cancel="startShow = false" @cancel="startShow = false"
@confirm="handleStartTime" @confirm="handleStartTime"
@change="startTimeChange" @change="startTimeChange"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
<van-datetime-picker <van-datetime-picker
v-model="endTime" v-model="endTime"
type="datetime" type="datetime"
:min-date="minEndDate"
@cancel="endShow = false" @cancel="endShow = false"
@confirm="handleEndTime" @confirm="handleEndTime"
@change="endTimeChange" @change="endTimeChange"
...@@ -107,7 +109,7 @@ ...@@ -107,7 +109,7 @@
/> />
</van-cell-group> </van-cell-group>
<!-- 活动描述 --> <!-- 活动描述 -->
<div class="detail"> <van-cell :required="true" class="detail">
<div class="border"> <div class="border">
<div class="des">活动描述</div> <div class="des">活动描述</div>
<van-field <van-field
...@@ -120,7 +122,7 @@ ...@@ -120,7 +122,7 @@
show-word-limit show-word-limit
/> />
</div> </div>
</div> </van-cell>
<!-- 活动图片 --> <!-- 活动图片 -->
<div class="detail" style="margin-top:0;"> <div class="detail" style="margin-top:0;">
<div class="des">活动图片</div> <div class="des">活动图片</div>
...@@ -137,10 +139,12 @@ import * as API_Active from "@/api/active"; ...@@ -137,10 +139,12 @@ import * as API_Active from "@/api/active";
export default { export default {
data() { data() {
return { return {
minStartDate: null,
minEndDate: null,
checked_coupon: {}, checked_coupon: {},
logo_imgs: [], logo_imgs: [],
bg_imgs: [], bg_imgs: [],
title: "送券", title: "",
title2: "", title2: "",
coupon: "", coupon: "",
newCustomer: "", newCustomer: "",
...@@ -151,26 +155,26 @@ export default { ...@@ -151,26 +155,26 @@ export default {
cashCoupon: "", cashCoupon: "",
limit: "", limit: "",
startTime: new Date(), startTime: new Date(),
startTime1: "2020-04-09 08:25:25", startTime1: "",
endTime: new Date(), endTime: new Date(),
endTime1: "2020-04-10 08:25:25", endTime1: "",
startShow: false, startShow: false,
endShow: false, endShow: false,
message: "123", message: "",
fileList: [], fileList: [],
fileList_show: [], fileList_show: [],
showCoupon: false, showCoupon: false,
coupons: [ coupons: [],
{ name: "选项" }, maxNumber: "",
{ name: "选项" },
{ name: "选项", subname: "描述信息" }
],
maxNumber: "1",
maxNumber_show: false, maxNumber_show: false,
totalLimit: "2", totalLimit: "",
totalLimit_show: false totalLimit_show: false
}; };
}, },
created() {
this.minStartDate = new Date();
this.minEndDate = new Date((new Date()/1000+86400)*1000);
},
methods: { methods: {
getTemplateDate(id) { getTemplateDate(id) {
API_Active.getTemplateData(id).then(res => { API_Active.getTemplateData(id).then(res => {
...@@ -191,7 +195,8 @@ export default { ...@@ -191,7 +195,8 @@ export default {
this.logo_imgs[0] = { url: res.data.activityInfo.logo }; this.logo_imgs[0] = { url: res.data.activityInfo.logo };
this.maxNumber = res.data.activityInfo.joinLimit?.toString(); this.maxNumber = res.data.activityInfo.joinLimit?.toString();
this.totalLimit = res.data.activityInfo.totalLimit?.toString(); this.totalLimit = res.data.activityInfo.totalLimit?.toString();
this.couponId = res.data.activityInfo.couponId; this.checked_coupon = JSON.parse(res.data.activityInfo.coupon);
this.checked_coupon.couponId = res.data.activityInfo.couponId;
this.message = res.activityInfo.des; this.message = res.activityInfo.des;
let imgs = JSON.parse(res.data.activityInfo.image); let imgs = JSON.parse(res.data.activityInfo.image);
let img_list = []; let img_list = [];
...@@ -208,7 +213,6 @@ export default { ...@@ -208,7 +213,6 @@ export default {
this.showCoupon = false; this.showCoupon = false;
}, },
afterImgRead(file) { afterImgRead(file) {
console.log("image");
if (file.length) { if (file.length) {
file.forEach(e => { file.forEach(e => {
let params = new FormData(); let params = new FormData();
...@@ -229,9 +233,17 @@ export default { ...@@ -229,9 +233,17 @@ export default {
} }
}, },
getCoupons() { getCoupons() {
console.log('获取优惠券');
let id = sessionStorage.getItem("oyStallCode") || 1; let id = sessionStorage.getItem("oyStallCode") || 1;
API_Active.getAllCouponsByOyStallCode(id).then(res => { API_Active.getAllCouponsByOyStallCode(id).then(res => {
if (res.data.length === 0 || !res.data.length) {
this.$toast('您所在店铺没有优惠券,请先去创建');
setTimeout(()=>{
this.$router.push('/');
}, 500);
} else {
this.coupons = res.data; this.coupons = res.data;
}
}); });
}, },
async afterLogoRead(file) { async afterLogoRead(file) {
...@@ -262,6 +274,19 @@ export default { ...@@ -262,6 +274,19 @@ export default {
return urls; return urls;
}, },
handleCreate() { handleCreate() {
if (
this.title === '' ||
this.startTime1 == '' ||
this.endTime1 == '' ||
this.logo_imgs.length == 0 ||
this.maxNumber == '' ||
this.totalLimit == '' ||
this.checked_coupon == {} ||
this.message == ''
) {
this.$toast('请完整填写活动表单!');
return;
}
if (new Date(this.startTime1) >= new Date(this.endTime1)) { if (new Date(this.startTime1) >= new Date(this.endTime1)) {
this.$toast("活动开始时间应小于活动开始时间"); this.$toast("活动开始时间应小于活动开始时间");
return; return;
...@@ -280,7 +305,8 @@ export default { ...@@ -280,7 +305,8 @@ export default {
joinLimit: Number(this.maxNumber), joinLimit: Number(this.maxNumber),
// 总发放数量 // 总发放数量
totalLimit: Number(this.totalLimit), totalLimit: Number(this.totalLimit),
couponId: this.checked_coupon.couponId, coupon: JSON.stringify(this.checked_coupon),
couponId: this.checked_coupon.id,
des: this.message, des: this.message,
image: JSON.stringify(this.fileList) image: JSON.stringify(this.fileList)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<van-datetime-picker <van-datetime-picker
v-model="basicInfo.startTime" v-model="basicInfo.startTime"
type="datetime" type="datetime"
:min-date="minStartDate"
@cancel="basicInfo.startShow = false" @cancel="basicInfo.startShow = false"
@confirm="handleBasicSTime" @confirm="handleBasicSTime"
@change="startTimeChange" @change="startTimeChange"
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
<van-datetime-picker <van-datetime-picker
v-model="basicInfo.endTime" v-model="basicInfo.endTime"
type="datetime" type="datetime"
:min-date="minEndDate"
@cancel="basicInfo.endShow = false" @cancel="basicInfo.endShow = false"
@confirm="handleBasicETime" @confirm="handleBasicETime"
@change="endTimeChange" @change="endTimeChange"
...@@ -268,6 +270,8 @@ import { Toast } from "vant"; ...@@ -268,6 +270,8 @@ import { Toast } from "vant";
export default { export default {
data() { data() {
return { return {
minStaetDate: null,
minEndDate: null,
// 选择优惠券 当前下标 // 选择优惠券 当前下标
current_index: -1, current_index: -1,
logo_imgs: [], logo_imgs: [],
...@@ -346,6 +350,10 @@ export default { ...@@ -346,6 +350,10 @@ export default {
confirmTime: new Date() confirmTime: new Date()
}; };
}, },
created() {
this.minStartDate = new Date();
this.minEndDate = new Date((new Date()/1000+86400)*1000);
},
methods: { methods: {
// 获取模板数据 // 获取模板数据
getTemplateDate(id) { getTemplateDate(id) {
...@@ -367,8 +375,8 @@ export default { ...@@ -367,8 +375,8 @@ export default {
)}-${end_time.substring(6, 8)}` + end_time.substring(8); )}-${end_time.substring(6, 8)}` + end_time.substring(8);
this.bg_imgs[0] = { url: res.data.activityInfo.backImage }; this.bg_imgs[0] = { url: res.data.activityInfo.backImage };
this.logo_imgs[0] = { url: res.data.activityInfo.logo }; this.logo_imgs[0] = { url: res.data.activityInfo.logo };
this.basicInfo.jointimes = res.data.activityInfo.joinLimit.toString(); this.basicInfo.jointimes = res.data.activityInfo.joinLimit?.toString();
this.basicInfo.total_join = res.data.activityInfo.totalLimit.toString(); this.basicInfo.total_join = res.data.activityInfo.totalLimit?.toString();
this.message = res.data.activityInfo.des; this.message = res.data.activityInfo.des;
let imgs = JSON.parse(res.data.activityInfo.image); let imgs = JSON.parse(res.data.activityInfo.image);
let img_list = []; let img_list = [];
...@@ -419,7 +427,7 @@ export default { ...@@ -419,7 +427,7 @@ export default {
item.limit = p.personLimit?.toString(); item.limit = p.personLimit?.toString();
item.probability = p.probability?.toString(); item.probability = p.probability?.toString();
item.preLimit = p.limitReceive?.toString(); item.preLimit = p.limitReceive?.toString();
item.checked_coupon.couponId = p.coupon_id; this.checked_coupon = JSON.parse(p.coupon);
prizes.push(item); prizes.push(item);
}); });
this.prizeList = prizes; this.prizeList = prizes;
...@@ -493,7 +501,45 @@ export default { ...@@ -493,7 +501,45 @@ export default {
// console.log(val); // console.log(val);
}, },
handleCreate() { handleCreate() {
if (new Date(this.basicInfo.startTime1) >= new Date(this.basicInfo.endTime1)) { if (
this.basicInfo.title == '' ||
this.basicInfo.startTime1 == '' ||
this.basicInfo.endTime1 == '' ||
this.logo_imgs.length == 0 ||
this.basicInfo.jointimes == '' ||
this.basicInfo.total_join == '' ||
this.message == '' ||
this.prize_produce == ''
) {
this.$toast('请完整填写表单!');
return;
}
this.prizeList.forEach(item => {
if (item.type == "") {
this.$toast('奖项类型必选!');
return;
}
if (item.type == 1) {
if (item.name == '' ||
item.checked_coupon == {} ||
item.total_limit == '' ||
item.limit == '' ||
item.preLimit == '' ||
item.probability == ''
) {
this.$toast('请填写完整奖项设置!');
return;
}
} else {
if(item.probability === '') {
this.$toast('奖项概率不允许为空');
return;
}
}
})
if (
new Date(this.basicInfo.startTime1) >= new Date(this.basicInfo.endTime1)
) {
this.$toast("活动开始时间应小于活动开始时间"); this.$toast("活动开始时间应小于活动开始时间");
return; return;
} }
...@@ -514,7 +560,8 @@ export default { ...@@ -514,7 +560,8 @@ export default {
temp.probability = p.probability; temp.probability = p.probability;
total_probability += Number(p.probability); total_probability += Number(p.probability);
temp.limitReceive = p.preLimit; temp.limitReceive = p.preLimit;
temp.coupon_id = p.checked_coupon.couponId; temp.couponId = p.checked_coupon.id;
temp.coupon = JSON.stringify(p.checked_coupon);
params_prizeList.push(temp); params_prizeList.push(temp);
}); });
if (total_probability != 100) { if (total_probability != 100) {
......
...@@ -224,7 +224,7 @@ export default { ...@@ -224,7 +224,7 @@ export default {
userInfoResOld: "", userInfoResOld: "",
userInfoResNew: "" userInfoResNew: ""
}, },
flag: 2 flag: 1
}; };
}, },
created() { created() {
......
<template> <template>
<div class="lists"> <div class="lists">
<div v-for="(item, index) of active" :key="index"> <div v-for="(item, index) of active" :key="index">
<van-swipe-cell>
<div class="list" @click="listClick(index, item)"> <div class="list" @click="listClick(index, item)">
<div class="list-logos"> <div class="list-logos">
<img class="list-logo" :src="item.logo" /> <img class="list-logo" :src="item.logo" />
...@@ -10,6 +11,10 @@ ...@@ -10,6 +11,10 @@
<div class="list-dsc">{{item.des}}</div> <div class="list-dsc">{{item.des}}</div>
</div> </div>
</div> </div>
<template #right v-if="index > 1">
<van-button square type="danger" text="删除" @click="deleteTemplate(item.id, index)" />
</template>
</van-swipe-cell>
</div> </div>
<span class="more" v-if="active.length && !list_finished" @click="handleMore"> <span class="more" v-if="active.length && !list_finished" @click="handleMore">
查看更多 查看更多
...@@ -53,6 +58,14 @@ export default { ...@@ -53,6 +58,14 @@ export default {
this.getTemplate(this.params); this.getTemplate(this.params);
}, },
methods: { methods: {
deleteTemplate(tem_id, index) {
API_Active.deleteTemplate(id).then(res=>{
if(res.result === 'success') {
this.active.splice(index, 1);
this.$toast('删除成功!');
}
})
},
handleMore() { handleMore() {
this.params.pageNo += 1; this.params.pageNo += 1;
this.getTemplate(this.params); this.getTemplate(this.params);
......
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