Commit 0ec3923c authored by lihui's avatar lihui

feat:api

parent a755542a
This diff is collapsed.
......@@ -17,6 +17,7 @@
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"dayjs": "^1.10.6",
"element-plus": "^1.0.2-beta.44",
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",
......
<template>
<div class="manage-wrapper">
<div
class="manage-wrapper"
v-loading="tableLoading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<el-form
ref="form"
:model="activity"
......@@ -23,7 +29,7 @@
</el-select>
</el-form-item>
<el-form-item style="margin-left: 50px">
<el-button type="primary">搜索</el-button>
<el-button type="primary" @click="getActivityList">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="goReleaseProduc"
......@@ -33,13 +39,7 @@
</div>
<!-- 列表 -->
<div
class="table-wrapper"
v-loading="tableLoading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<div class="table-wrapper">
<el-table :data="tableActivityList" border style="width: 100%">
<el-table-column
align="center"
......@@ -62,17 +62,6 @@
label="活动状态"
width="width"
>
<template #default="scope">
<span>
{{
scope.row.online_status == 1
? "启用"
: scope.row.online_status == 2
? "关闭"
: "到期"
}}
</span>
</template>
</el-table-column>
<el-table-column
align="center"
......@@ -116,7 +105,7 @@
width="width"
>
</el-table-column>
<el-table-column align="center" prop="prop" label="操作" width="250">
<el-table-column align="center" prop="scope" label="操作" width="250">
<template #default="scope">
<el-button
type="primary"
......@@ -127,6 +116,7 @@
<el-popconfirm title="确定要结束本次拼单吗?">
<template #reference>
<el-button
v-show="scope.row.status === 1"
type="primary"
size="small"
@click="handleEnd(scope.row)"
......@@ -137,6 +127,7 @@
<el-popconfirm title="确定要开启本次拼单吗?">
<template #reference>
<el-button
v-show="scope.row.status === 2 || scope.row.status === 3"
type="primary"
size="small"
@click="handleStart(scope.row)"
......@@ -158,7 +149,13 @@
<!-- 分页 -->
<div class="pagination-wrapper">
<el-pagination background layout="prev, pager, next" :total="100">
<el-pagination
background
layout="prev, pager, next"
:total="pageCount"
:page-size="10"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
</el-form>
......@@ -166,6 +163,7 @@
</template>
<script>
import ActivityService from "@/service/Activity/index";
import dayJs from "dayjs";
export default {
name: "Manage",
data() {
......@@ -174,6 +172,7 @@ export default {
activityName: "",
online_status: ""
},
pageCount: 0, // 总条数
currentPage: 1, //当前页码
pageSize: 10, // 每页条数
tableActivityList: [],
......@@ -192,9 +191,10 @@ export default {
}
],
options: [
{ value: "0", label: "未开始" },
{ value: "1", label: "进行中" },
{ value: "2", label: "已结束" }
{ value: "", label: "全部" },
{ value: "1", label: "未开始" },
{ value: "2", label: "进行中" },
{ value: "3", label: "已结束" }
]
};
},
......@@ -203,42 +203,44 @@ export default {
// 获取商品列表
async getActivityList() {
let params = {
marketing_name: "",
marketing_id: "",
online_status: "",
marketing_name: this.activity.activityName,
online_status: this.activity.online_status,
// marketing_id: "",
page: this.currentPage,
page_size: this.pageSize
};
try {
this.tableLoading = true;
let data = await ActivityService.getActivityList();
let data = await ActivityService.getActivityList(params);
this.filterTableActiveList(data.result);
this.pageCount = data.count;
this.tableLoading = false;
} catch {
this.tableLoading = false;
}
},
// API数据转table展示数据
filterTableActiveList(tableData) {
this.tableActivityList = tableData.map(item => {
let activityStatusText = "";
switch (item.online_status) {
case 1:
activityStatusText = "启用";
break;
case 2:
activityStatusText = "关闭";
break;
case 3:
activityStatusText = "到期";
break;
let dateNow = dayJs();
if (dateNow.diff(dayJs(item.start_time))) {
// 开始时间大于当前时间 return 未开始
activityStatusText = "未开始";
} else if (dayJs(item.end_time).diff(dayJs(item.start_time)) > 0) {
// 结束时间大于开始时间 return 进行中
activityStatusText = "进行中";
} else if (dateNow.diff(dayJs(item.end_time)) > 0) {
// 当前时间大于结束时间 return 已结束
activityStatusText = "已结束";
}
return {
activiteId: item.marketing_id,
activiteHead: item.marketing_name,
activiteStatus: item.online_status,
orderNumber: activityStatusText,
activiteStatus: activityStatusText,
status: item.online_status,
orderNumber: 33,
soldGoods: "",
pay: "",
discounts: "",
......@@ -248,6 +250,12 @@ export default {
});
},
// 更改页数
handleCurrentChange(val) {
this.currentPage = val;
this.getActivityList();
},
// 点击活动标题
handleHeadline() {},
// 发布拼单
......
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