Commit 21d3670f authored by xd's avatar xd

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

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