mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-20 01:45:53 +08:00
fix bugs
This commit is contained in:
@@ -42,12 +42,7 @@
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ row, index }" slot="action">
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
@click="delGoods(index,row)"
|
||||
>删除
|
||||
</Button>
|
||||
<Button type="error" size="small" @click="delGoods(index, row)">删除 </Button>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
@@ -68,244 +63,247 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
seckillGoodsList,
|
||||
seckillDetail,
|
||||
auditApplySeckill,
|
||||
delSeckillGoods
|
||||
} from "@/api/promotion.js";
|
||||
import {
|
||||
seckillGoodsList,
|
||||
seckillDetail,
|
||||
auditApplySeckill,
|
||||
delSeckillGoods,
|
||||
} from "@/api/promotion.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
promotionStatus: "", // 活动状态
|
||||
showModal: false, // modal显隐
|
||||
openTip: true, // 显示提示
|
||||
loading: false, // 表单加载状态
|
||||
submitLoading: false, // 加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 0, // 当前页数
|
||||
pageSize: 100, // 页面大小
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
promotionStatus: "", // 活动状态
|
||||
showModal: false, // modal显隐
|
||||
openTip: true, // 显示提示
|
||||
loading: false, // 表单加载状态
|
||||
submitLoading: false, // 加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 0, // 当前页数
|
||||
pageSize: 10, // 页面大小
|
||||
},
|
||||
total: 0, // 总数
|
||||
selectList: [], // 多选数据
|
||||
selectCount: 0, // 多选计数
|
||||
data: [], // 表单数据
|
||||
columns: [
|
||||
// 表头
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
minWidth: 120,
|
||||
},
|
||||
total: 0, // 总数
|
||||
selectList: [], // 多选数据
|
||||
selectCount: 0, // 多选计数
|
||||
data: [], // 表单数据
|
||||
columns: [ // 表头
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
key: "startTime",
|
||||
},
|
||||
{
|
||||
title: "报名截止时间",
|
||||
slot: "applyEndTime",
|
||||
},
|
||||
{
|
||||
title: "时间场次",
|
||||
slot: "hours",
|
||||
},
|
||||
{
|
||||
title: "活动状态",
|
||||
key: "promotionStatus",
|
||||
minWidth: 80,
|
||||
sortable: false,
|
||||
render: (h, params) => {
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "新建",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "success",
|
||||
text: "开始",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "结束",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "废弃",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
goodsColumns: [ // 商品表单
|
||||
{
|
||||
title: "商品名称",
|
||||
key: "goodsName",
|
||||
minWidth: 120,
|
||||
tooltip: true
|
||||
},
|
||||
{
|
||||
title: "商品价格",
|
||||
slot: "originalPrice",
|
||||
width: 110,
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
slot: "quantity",
|
||||
minWidth: 30,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: "活动价格",
|
||||
slot: "price",
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: "商家名称",
|
||||
key: "storeName",
|
||||
minWidth: 100,
|
||||
tooltip: true
|
||||
|
||||
},
|
||||
{
|
||||
title: "活动场次",
|
||||
width: 100,
|
||||
slot: "time",
|
||||
},
|
||||
// {
|
||||
// title: "状态",
|
||||
// slot: "promotionApplyStatus",
|
||||
// width: 90,
|
||||
// },
|
||||
{
|
||||
title: "操作",
|
||||
slot: "action",
|
||||
width: 150,
|
||||
align: "center",
|
||||
},
|
||||
],
|
||||
goodsList: [], // 商品列表
|
||||
params: { // 请求参数
|
||||
seckillId: this.$route.query.id,
|
||||
applyStatus: "PASS",
|
||||
failReason: "",
|
||||
ids: "",
|
||||
{
|
||||
title: "活动开始时间",
|
||||
key: "startTime",
|
||||
},
|
||||
rules: { // 验证规则
|
||||
failReason: [{required: true, message: "请输入拒绝原因"}],
|
||||
{
|
||||
title: "报名截止时间",
|
||||
slot: "applyEndTime",
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 初始化数据
|
||||
init() {
|
||||
this.getSeckillMsg();
|
||||
},
|
||||
// 分页 改变页码
|
||||
changePage(v) {
|
||||
this.searchForm.pageNumber = v;
|
||||
this.getDataList();
|
||||
this.clearSelectAll();
|
||||
},
|
||||
// 分页 改变页数
|
||||
changePageSize(v) {
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.searchForm.pageSize = v;
|
||||
this.getDataList();
|
||||
},
|
||||
// 清除选中状态
|
||||
clearSelectAll() {
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
|
||||
getDataList() {
|
||||
// 获取商品详情
|
||||
this.loading = true;
|
||||
this.searchForm.seckillId = this.$route.query.id;
|
||||
seckillGoodsList(this.searchForm).then((res) => {
|
||||
this.loading = false;
|
||||
if (res.success && res.result) {
|
||||
this.goodsList = res.result.records;
|
||||
this.total = res.result.total;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getSeckillMsg() {
|
||||
// 获取活动详情
|
||||
seckillDetail(this.$route.query.id).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
this.data = [];
|
||||
this.data.push(res.result);
|
||||
this.promotionStatus = res.result.promotionStatus;
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
delGoods(index, row) {
|
||||
// 删除商品
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除该商品吗?删除后不可恢复",
|
||||
onOk: () => {
|
||||
const params = {
|
||||
seckillId: row.seckillId,
|
||||
id: row.id
|
||||
{
|
||||
title: "时间场次",
|
||||
slot: "hours",
|
||||
},
|
||||
{
|
||||
title: "活动状态",
|
||||
key: "promotionStatus",
|
||||
minWidth: 80,
|
||||
sortable: false,
|
||||
render: (h, params) => {
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "新建",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "success",
|
||||
text: "开始",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "结束",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
return h("div", [
|
||||
h("Badge", {
|
||||
props: {
|
||||
status: "error",
|
||||
text: "废弃",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
}
|
||||
delSeckillGoods(params).then(res => {
|
||||
if (res.success) {
|
||||
this.goodsList.splice(index, 1);
|
||||
this.$Message.success("删除成功!");
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
],
|
||||
goodsColumns: [
|
||||
// 商品表单
|
||||
{
|
||||
title: "商品名称",
|
||||
key: "goodsName",
|
||||
minWidth: 120,
|
||||
tooltip: true,
|
||||
},
|
||||
{
|
||||
title: "商品价格",
|
||||
slot: "originalPrice",
|
||||
width: 110,
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
slot: "quantity",
|
||||
minWidth: 30,
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: "活动价格",
|
||||
slot: "price",
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: "商家名称",
|
||||
key: "storeName",
|
||||
minWidth: 100,
|
||||
tooltip: true,
|
||||
},
|
||||
{
|
||||
title: "活动场次",
|
||||
width: 100,
|
||||
slot: "time",
|
||||
},
|
||||
// {
|
||||
// title: "状态",
|
||||
// slot: "promotionApplyStatus",
|
||||
// width: 90,
|
||||
// },
|
||||
{
|
||||
title: "操作",
|
||||
slot: "action",
|
||||
width: 150,
|
||||
align: "center",
|
||||
},
|
||||
],
|
||||
goodsList: [], // 商品列表
|
||||
params: {
|
||||
// 请求参数
|
||||
seckillId: this.$route.query.id,
|
||||
applyStatus: "PASS",
|
||||
failReason: "",
|
||||
ids: "",
|
||||
},
|
||||
unixDate(time) {
|
||||
// 处理报名截止时间
|
||||
return this.$options.filters.unixToDate(new Date(time) / 1000);
|
||||
rules: {
|
||||
// 验证规则
|
||||
failReason: [{ required: true, message: "请输入拒绝原因" }],
|
||||
},
|
||||
unixHours(item) {
|
||||
// 处理小时场次
|
||||
let hourArr = item.split(",");
|
||||
for (let i = 0; i < hourArr.length; i++) {
|
||||
hourArr[i] += ":00";
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 初始化数据
|
||||
init() {
|
||||
this.getSeckillMsg();
|
||||
},
|
||||
// 分页 改变页码
|
||||
changePage(v) {
|
||||
this.searchForm.pageNumber = v;
|
||||
this.getDataList();
|
||||
this.clearSelectAll();
|
||||
},
|
||||
// 分页 改变页数
|
||||
changePageSize(v) {
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.searchForm.pageSize = v;
|
||||
this.getDataList();
|
||||
},
|
||||
// 清除选中状态
|
||||
clearSelectAll() {
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
|
||||
getDataList() {
|
||||
// 获取商品详情
|
||||
this.loading = true;
|
||||
this.searchForm.seckillId = this.$route.query.id;
|
||||
seckillGoodsList(this.searchForm).then((res) => {
|
||||
this.loading = false;
|
||||
if (res.success && res.result) {
|
||||
this.goodsList = res.result.records;
|
||||
this.total = res.result.total;
|
||||
}
|
||||
return hourArr;
|
||||
});
|
||||
},
|
||||
|
||||
getSeckillMsg() {
|
||||
// 获取活动详情
|
||||
seckillDetail(this.$route.query.id).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
this.data = [];
|
||||
this.data.push(res.result);
|
||||
this.promotionStatus = res.result.promotionStatus;
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
delGoods(index, row) {
|
||||
// 删除商品
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除该商品吗?删除后不可恢复",
|
||||
onOk: () => {
|
||||
const params = {
|
||||
seckillId: row.seckillId,
|
||||
id: row.id,
|
||||
};
|
||||
delSeckillGoods(params).then((res) => {
|
||||
if (res.success) {
|
||||
this.goodsList.splice(index, 1);
|
||||
this.$Message.success("删除成功!");
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
unixDate(time) {
|
||||
// 处理报名截止时间
|
||||
return this.$options.filters.unixToDate(new Date(time) / 1000);
|
||||
},
|
||||
unixHours(item) {
|
||||
// 处理小时场次
|
||||
let hourArr = item.split(",");
|
||||
for (let i = 0; i < hourArr.length; i++) {
|
||||
hourArr[i] += ":00";
|
||||
}
|
||||
return hourArr;
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.operation {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.operation {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.reason {
|
||||
cursor: pointer;
|
||||
color: #2d8cf0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.reason {
|
||||
cursor: pointer;
|
||||
color: #2d8cf0;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user