Commit 76a5cd1d authored by leiqingsong's avatar leiqingsong

添加活动列表删除

parent 3732acb8
......@@ -14,6 +14,17 @@ export function createActive(params) {
})
}
/**
* 删除活动
* @param {*} id 活动id
*/
export function deleteActive(id) {
return request({
url: `activity/delete?id=${id}`,
method: 'delete'
})
}
/**
* 获取活动列表
*/
......
......@@ -15,7 +15,7 @@
<div class="other">
<p>{{couponDetail.salesUnit}}元可用</p>
<p>
有效期:
有效期
<span style="font-size: 12px;">{{ couponDetail.end_date }}</span>
</p>
<p>{{ couponDetail.deptId }}号店通用</p>
......@@ -189,7 +189,7 @@ export default {
if (!sessionStorage.getItem("userId")) {
// 1.获取code
if (this.$route.query.unionid === undefined) {
this.getUnionid();
// this.getUnionid();
} else {
this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid);
this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid);
......
......@@ -5,12 +5,8 @@
</div>
<div class="active">
<template v-for="(item, index) in wheelList">
<div
v-if="index < wheelActive_limit"
class="list"
:key="item.id"
@click="toDetail(item.id, item.activityType)"
>
<van-swipe-cell v-if="index < wheelActive_limit" :key="item.id">
<div class="list" @click="toDetail(item.id, item.activityType)">
<div class="left">
<img :src="item.logo" alt="logo" style="width:100%;height:100%;" />
</div>
......@@ -19,6 +15,10 @@
<p>{{ item.des }}</p>
</div>
</div>
<template #right v-if="flag == 1">
<van-button square type="danger" text="删除" @click="deleteWheelAct(item.id, index)" />
</template>
</van-swipe-cell>
</template>
<span
class="more"
......@@ -32,7 +32,8 @@
<div v-if="couponList.length > 0" class="fg">送券活动</div>
<div class="active">
<template v-for="(item, index) in couponList">
<div v-if="index < couponActive_limit" class="list" :key="item.id" @click="toDetail(item.id, item.activityType)">
<van-swipe-cell v-if="index < couponActive_limit" :key="item.id">
<div class="list" @click="toDetail(item.id, item.activityType)">
<div class="left">
<img :src="item.logo" alt="logo" style="width:100%;height:100%;" />
</div>
......@@ -41,6 +42,10 @@
<p>{{ item.des }}</p>
</div>
</div>
<template #right v-if="flag == 1">
<van-button square type="danger" text="删除" @click="deleteCouponAct(item.id, index)" />
</template>
</van-swipe-cell>
</template>
<span
class="more"
......@@ -59,6 +64,7 @@ import * as API_Active from "@/api/active";
export default {
data() {
return {
flag: 1,
wheelActive_limit: 3,
wheelList_finished: false,
couponActive_limit: 3,
......@@ -78,20 +84,37 @@ export default {
mounted() {
this.getWheelActive();
this.getCouponActive();
// this.flag = sessionStorage.getItem("role");
},
methods: {
deleteCouponAct(id, index) {
API_Active.deleteActive(id).then(res => {
if (res.result === "success") {
this.wheelList.splice(index, 1);
this.$toast("删除成功!");
}
});
},
deleteWheelAct(id, index) {
API_Active.deleteActive(id).then(res => {
if (res.result === "success") {
this.wheelList.splice(index, 1);
this.$toast("删除成功!");
}
});
},
async getCouponActive() {
let res = await this.getActiveList("coupon");
this.couponList.push.apply(this.couponList, res.data.list);
if (res.data.list === []) {
this.couponList_finished = true
this.couponList_finished = true;
}
},
async getWheelActive() {
let res = await this.getActiveList("wheel");
this.wheelList.push.apply(this.wheelList, res.data.list);
if (res.data.list === []) {
this.wheelList_finished = true
this.wheelList_finished = true;
}
},
handleActiveMore(type) {
......@@ -102,16 +125,15 @@ export default {
} else if (type === "coupon") {
this.couponActive_limit += 3;
this.coupon_params.pageNo += 1;
this.getCouponActive()
this.getCouponActive();
}
},
// 获取 活动列表
async getActiveList(type) {
let page_params = {};
if (type === 'wheel') {
if (type === "wheel") {
page_params = this.wheel_params;
}
else if (type === 'coupon') {
} else if (type === "coupon") {
page_params = this.coupon_params;
}
let params = {
......@@ -128,7 +150,7 @@ export default {
query: {
id: active_id,
active_type: type,
iswxClient: 'false'
iswxClient: "false"
}
});
}
......
......@@ -172,7 +172,7 @@ export default {
};
},
created() {
this.minStartDate = new Date();
this.minStartDate = new Date((new Date()/1000+3600)*1000)
this.minEndDate = new Date((new Date()/1000+86400)*1000);
},
methods: {
......
......@@ -351,7 +351,7 @@ export default {
};
},
created() {
this.minStartDate = new Date();
this.minStartDate = new Date((new Date()/1000+3600)*1000);
this.minEndDate = new Date((new Date()/1000+86400)*1000);
},
methods: {
......
......@@ -59,7 +59,7 @@ export default {
},
methods: {
deleteTemplate(tem_id, index) {
API_Active.deleteTemplate(id).then(res=>{
API_Active.deleteTemplate(tem_id).then(res=>{
if(res.result === 'success') {
this.active.splice(index, 1);
this.$toast('删除成功!');
......
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