修改一些发现的问题,新增秒杀活动设置,优惠券动态时间 以及 精准发圈用户和小程序直播页面

This commit is contained in:
lemon橪
2021-06-04 17:35:59 +08:00
parent 3eee6b35e8
commit 40bf9781b1
41 changed files with 598 additions and 3815 deletions

View File

@@ -2,29 +2,12 @@
<div class="seckill">
<Card>
<Row>
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="活动名称" prop="promotionName">
<Input
type="text"
v-model="searchForm.promotionName"
placeholder="请输入活动名称"
clearable
style="width: 200px"
/>
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable style="width: 200px" />
</Form-item>
<Form-item label="活动状态" prop="promotionStatus">
<Select
v-model="searchForm.promotionStatus"
placeholder="请选择"
clearable
style="width: 200px"
>
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
<Option value="NEW">未开始</Option>
<Option value="START">已开始/上架</Option>
<Option value="END">已结束/下架</Option>
@@ -32,120 +15,69 @@
</Select>
</Form-item>
<Form-item label="活动时间">
<DatePicker
v-model="selectDate"
type="daterange"
clearable
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px"></DatePicker>
</Form-item>
<Button
@click="handleSearch"
type="primary"
icon="ios-search"
class="search-btn"
>搜索</Button
>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="operation padding-row">
<Button type="primary" @click="add">添加活动</Button>
</Row>
<Tabs value="list" @on-click="clickTabPane">
<TabPane label="秒杀活动列表" name="list">
<Table :loading="loading" border :columns="columns" :data="data" ref="table" class="page">
<template slot-scope="{ row }" slot="action">
<Button type="info" size="small" class="mr_5" v-if="row.promotionStatus == 'NEW'" @click="edit(row)">编辑</Button>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
class="page"
>
<template slot-scope="{ row }" slot="action">
<Button
type="info"
size="small"
class="mr_5"
v-if="row.promotionStatus == 'NEW'"
@click="edit(row)"
>编辑</Button
>
<Button type="info" size="small" class="mr_5" v-else @click="manage(row)">查看</Button>
<Button
type="info"
size="small"
class="mr_5"
v-else
@click="manage(row)"
>查看</Button
>
<Button type="primary" size="small" class="mr_5" v-if="row.promotionStatus == 'NEW'" @click="manage(row)">管理</Button>
<Button
type="primary"
size="small"
class="mr_5"
v-if="row.promotionStatus == 'NEW'"
@click="manage(row)"
>管理</Button
>
<!-- <Button type="success" size="small" class="mr_5" v-if="row.promotionStatus == 'NEW' || row.promotionStatus == 'END'" @click="upper(row)">上架</Button> -->
<Button
type="error"
size="small"
v-if="
<Button type="error" size="small" v-if="
row.promotionStatus == 'START' || row.promotionStatus == 'NEW'
"
class="mr_5"
@click="off(row)"
>下架</Button
>
&nbsp;
<Button
type="error"
size="small"
v-if="row.promotionStatus == 'CLOSE'"
ghost
@click="expire(row)"
>删除</Button
>
</template>
</Table>
" class="mr_5" @click="off(row)">下架</Button>
&nbsp;
<Button type="error" size="small" v-if="row.promotionStatus == 'CLOSE'" ghost @click="expire(row)">删除</Button>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Page style="margin: 20px 0;" :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</TabPane>
<TabPane label="秒杀活动设置" name="setup">
<setupSeckill v-if="setupFlag"></setupSeckill>
</TabPane>
</Tabs>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber + 1"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</div>
</template>
<script>
import { getSeckillList, delSeckill, closeSeckill } from "@/api/promotion";
import setupSeckill from "@/views/promotion/seckill/setupSeckill";
export default {
name: "seckill",
components: {
setupSeckill,
},
data() {
return {
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 0, // 当前页数
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "startTime",
order: "desc", // 默认排序方式
},
columns: [ // 表单
setupFlag: false, //默认不请求设置
columns: [
// 表单
{
title: "活动名称",
key: "promotionName",
@@ -227,14 +159,27 @@ export default {
};
},
methods: {
clickTabPane(name) {
if (name == "setup") {
this.setupFlag = true;
} else {
this.setupFlag = false;
}
},
// 初始化信息
init() {
this.getDataList();
},
// 点击分页
changePage(v) {
this.searchForm.pageNumber = v - 1;
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
// 设置每页大小
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
@@ -287,6 +232,7 @@ export default {
},
});
},
// 获取数据集合
getDataList() {
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
@@ -313,7 +259,7 @@ export default {
</script>
<style lang="scss">
@import "@/styles/table-common.scss";
.mr_5{
.mr_5 {
margin: 0 5px;
}
</style>

View File

@@ -0,0 +1,151 @@
<template>
<div>
<Form :model="form" :label-width="120">
<FormItem label="每日场次设置">
<Row :gutter="16" class="row">
<Col class="time-item" @click.native="handleClickTime(item,index)" v-for="(item,index) in this.times" :key="index" span="3">
<div class="time" :class="{'active':item.check}">{{item.time}}:00</div>
</Col>
</Row>
</FormItem>
<FormItem label="秒杀规则">
<Input type="textarea" :autosize="{minRows: 4,}" v-model="form.seckillRule" placeholder="申请规则" clearable style="width: 360px; margin-left:10px" />
</FormItem>
<FormItem>
<div class="foot-btn">
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
</div>
</FormItem>
</Form>
<!-- 选择时间 -->
</div>
</template>
<script>
import { getSetting, setSetting } from "@/api/index";
export default {
data() {
return {
submitLoading: false,
selectedTime: [],
times: [], //时间集合 1-24点
form: {
seckillRule: "",
},
};
},
mounted() {
/**
* 初始化
*/
this.init();
},
methods: {
/**
* 关闭当前页面
*/
closeCurrentPage() {
this.$store.commit("removeTag", "manager-seckill-add");
localStorage.pageOpenedList = JSON.stringify(
this.$store.state.app.pageOpenedList
);
this.$router.go(-1);
},
/**
* 提交秒杀信息
*/
async handleSubmit() {
let hours = this.times
.filter((item) => {
return item.check;
})
.map((item) => {
return item.time;
})
.join(",");
let result = await setSetting("SECKILL_SETTING", {
seckillRule: this.form.seckillRule,
hours,
});
if (result.success) {
this.$Message.success("设置成功!");
this.init();
}
},
/**
* 初始化当前信息
*/
async init() {
let result = await getSetting("SECKILL_SETTING");
if (result.success) {
this.form.seckillRule = result.result.seckillRule;
this.times=[]
for (let i = 0; i < 24; i++) {
// 将数据拆出
if (result.result.hours) {
let way = result.result.hours.split(",");
way.forEach((hours) => {
if (hours == i) {
this.times.push({
time: i,
check: true,
});
}
});
if (!this.times[i]) {
this.times.push({
time: i,
check: false,
});
}
}
}
}
},
/**
* 选中时间
*/
handleClickTime(val, index) {
val.check = !val.check;
},
},
};
</script>
<style scoped lang="scss">
.row {
width: 50%;
}
.foot-btn {
margin-left: 10px;
}
.time-list {
display: flex;
flex-wrap: wrap;
}
.active {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
color: #fff;
background: $theme_color !important;
}
.time {
width: 100%;
cursor: pointer;
transition: 0.35s;
border-radius: 0.8em;
justify-content: center;
align-items: center;
display: flex;
background: #f3f5f7;
height: 100%;
}
.time-item {
height: 50px;
margin: 8px 0;
font-size: 15px;
}
</style>