商家端添加注释,删除无用代码,优化样式

This commit is contained in:
mabo
2021-07-19 18:03:35 +08:00
parent 07f41f5cb6
commit 5062cad2b0
40 changed files with 799 additions and 1573 deletions

View File

@@ -24,9 +24,8 @@
<Row class="operator padding-row">
<Button @click="add" type="primary">添加</Button>
<Button @click="delAll" class="ml_10">批量下架</Button>
<!-- <Button @click="upAll">批量上架</Button> -->
</Row>
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect">
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" @on-selection-change="changeSelect">
<template slot-scope="{ row }" slot="action">
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" style="margin-right: 10px" @click="edit(row)">编辑</Button>
<Button v-if="row.promotionStatus !== 'CLOSE'" type="error" size="small" @click="remove(row)">下架</Button>
@@ -55,17 +54,6 @@ export default {
sort: "startTime", // 默认排序字段
order: "desc", // 默认排序方式
},
form: {
// 添加或编辑表单对象初始化数据
promotionName: "",
},
// 表单验证规则
formValidate: {
promotionName: [
{ required: true, message: "不能为空", trigger: "blur" },
],
},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
@@ -238,15 +226,6 @@ export default {
this.searchForm.pageNumber = 0;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
@@ -254,6 +233,7 @@ export default {
this.selectList = e;
this.selectCount = e.length;
},
// 获取列表数据
getDataList() {
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
@@ -263,7 +243,6 @@ export default {
this.searchForm.startTime = null;
this.searchForm.endTime = null;
}
// 带多条件搜索参数获取表单数据 请自行修改接口
getShopCouponList(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
@@ -274,14 +253,14 @@ export default {
this.total = this.data.length;
this.loading = false;
},
// 跳转编辑优惠券页面
edit(v) {
this.$router.push({ name: "add-coupon", query: { id: v.id } });
},
// 下架优惠券
remove(v) {
this.$Modal.confirm({
title: "确认下架",
// 记得确认修改此处
content: "确认要下架此优惠券么?",
loading: true,
onOk: () => {
@@ -290,7 +269,6 @@ export default {
couponIds: v.id,
promotionStatus: "CLOSE",
};
// 批量删除
updateCouponStatus(params).then((res) => {
this.$Modal.remove();
if (res.success) {
@@ -302,44 +280,15 @@ export default {
},
});
},
upAll() {
if (this.selectCount <= 0) {
this.$Message.warning("请选择要上架的优惠券");
return;
}
this.$Modal.confirm({
title: "确认上架",
content: "您确认要上架所选的 " + this.selectCount + " 条数据?",
loading: true,
onOk: () => {
let ids = [];
this.selectList.forEach(function (e) {
ids.push(e.id);
});
let params = {
couponIds: ids.toString(),
promotionStatus: "START",
};
// 批量上架
updateCouponStatus(params).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("上架成功");
this.clearSelectAll();
this.getDataList();
}
});
},
});
},
// 批量下架
delAll() {
if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要作废的优惠券");
this.$Message.warning("您还未选择要下架的优惠券");
return;
}
this.$Modal.confirm({
title: "确认作废",
content: "您确认要作废所选的 " + this.selectCount + " 条数据?",
title: "确认下架",
content: "您确认要下架所选的 " + this.selectCount + " 条数据?",
loading: true,
onOk: () => {
let ids = [];
@@ -351,7 +300,6 @@ export default {
couponIds: ids.toString(),
promotionStatus: "CLOSE",
};
// 批量删除
updateCouponStatus(params).then((res) => {
this.$Modal.remove();
if (res.success) {

View File

@@ -33,7 +33,7 @@
<FormItem label="发放数量" v-if="form.getType == 'FREE'" prop="publishNum">
<Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px" />
<div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
<span class="tips ml_10">如果发放数量为0时,则代表不限制发放数量</span>
</FormItem>
</div>
<h4>使用限制</h4>
@@ -43,7 +43,7 @@
</FormItem>
<FormItem label="领取限制" v-if="form.getType == 'FREE'" prop="couponLimitNum">
<Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" />
<div class="tips">如果领取限制为0时,则代表不限制领取数量</div>
<span class="tips ml_10">如果领取限制为0时,则代表不限制领取数量</span>
</FormItem>
<FormItem label="有效期" prop="rangeTime">
<DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px">
@@ -125,7 +125,6 @@ export default {
return {
modalType: 0, // 判断是新增还是编辑优惠券 0 新增 1 编辑
categoryId: 0, // 分类id
form: {
/** 店铺承担比例 */
sellerCommission: 0,
@@ -148,12 +147,6 @@ export default {
submitLoading: false, // 添加或编辑提交状态
selectedGoods: [], // 已选商品列表,便于删除
goodsCategoryList: [], // 商品分类列表
shopCategoryList: [], // 店铺分类列表
cascaderProps: {
multiple: true,
label: "name",
value: "id",
}, // 级联选择器配置项
formRule: {
promotionName: [{ required: true, message: "活动名称不能为空" }],
couponName: [{ required: true, message: "优惠券名称不能为空" }],
@@ -241,6 +234,7 @@ export default {
},
},
],
// 时间选择器可选范围
options: {
disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000;
@@ -257,6 +251,7 @@ export default {
}
},
methods: {
// 获取回显数据
getCoupon() {
getShopCoupon(this.id).then((res) => {
let data = res.result;
@@ -292,7 +287,7 @@ export default {
this.form = data;
});
},
/** 保存平台优惠券 */
/** 保存优惠券 */
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {

View File

@@ -1,49 +1,49 @@
<template>
<div class="full-cut">
<Card>
<Row>
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="活动名称">
<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"
>
<Option value="NEW">开始</Option>
<Option value="START">开始/</Option>
<Option value="END">已结束/下架</Option>
<Option value="CLOSE">紧急关闭/作废</Option>
</Select>
</Form-item>
<Form-item label="活动时间">
<DatePicker
v-model="selectDate"
type="daterange"
clearable
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" class="search-btn" icon="ios-search">搜索</Button>
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="活动名称">
<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"
>
<Option value="NEW">未开始</Option>
<Option value="START">开始/上架</Option>
<Option value="END">结束/</Option>
<Option value="CLOSE">紧急关闭/作废</Option>
</Select>
</Form-item>
<Form-item label="活动时间">
<DatePicker
v-model="selectDate"
type="daterange"
clearable
placeholder="选择起始时间"
style="width: 200px"
></DatePicker>
</Form-item>
<Form-item>
<Button @click="handleSearch" type="primary" class="search-btn">搜索</Button>
<Button @click="handleReset" class="ml_10">重置</Button>
</Form>
</Row>
</Form-item>
</Form>
<Row class="operation">
<Button type="primary" @click="newAct">新增</Button>
</Row>
@@ -184,29 +184,31 @@ export default {
};
},
methods: {
// 改变页码
newAct() {
// 新增活动
this.$router.push({ name: "full-cut-detail" });
},
// 初始化数据
init() {
this.getDataList();
},
// 改变页数
changePage(v) {
// 改变页数
this.searchForm.pageNumber = v - 1;
this.getDataList();
},
// 改变页码
changePageSize(v) {
// 改变页码
this.searchForm.pageSize = v;
this.getDataList();
},
// 搜索
handleSearch() {
// 搜索
this.searchForm.pageNumber = 0;
this.searchForm.pageSize = 10;
this.getDataList();
},
// 重置
handleReset() {
this.selectDate = ''
this.searchForm = {}
@@ -214,11 +216,11 @@ export default {
this.searchForm.pageSize = 10;
this.getDataList();
},
// 编辑
edit(row) {
// 编辑
this.$router.push({ name: "full-cut-detail", query: { id: row.id } });
},
// 删除
del(row) {
this.$Modal.confirm({
title: "提示",
@@ -237,6 +239,7 @@ export default {
},
});
},
// 获取列表数据
getDataList() {
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {

View File

@@ -259,7 +259,7 @@ import skuSelect from "@/views/lili-dialog";
export default {
name: "addFullCut",
components: {
skuSelect,
skuSelect
},
data() {
const checkPrice = (rule, value, callback) => {

View File

@@ -131,7 +131,6 @@
<FormItem>
<Button type="primary" v-if="liveStatus=='NEW'" @click="createLives()">保存</Button>
</FormItem>
</Form>
</Card>
@@ -162,7 +161,7 @@ export default {
},
data() {
return {
spinShow: false,
spinShow: false, // loading加载
liveGoodsVisible: false, //选择商品
imageVisible: false, //查看图片的dailog
imageSrc: "", //查看图片的路径
@@ -172,7 +171,6 @@ export default {
// 不能选择今天以前的时间
optionsTime: {
disabledDate(date) {
// console.log(data)
return date && date.valueOf() < Date.now() - 86400000;
},
},
@@ -237,8 +235,7 @@ export default {
width: 250,
},
],
liveData: [], //直播商品集合
commodityList: "", //商品集合
liveData: [] //直播商品集合
};
},
mounted() {
@@ -285,7 +282,6 @@ export default {
// 将选择的商品回调给表格
this.liveData = data.commodityList;
this.commodityList = data.commodityList;
// 将时间格式化
this.$set(

View File

@@ -40,7 +40,7 @@ export default {
data() {
return {
// 查询数据的总数
total: "",
total: 0,
// 查询的form
searchForm: {
pageSize: 10,

View File

@@ -144,6 +144,7 @@ export default {
],
// 表格商品详情
liveGoodsData: [],
// 已选商品
selectedGoods: [],
};
},
@@ -208,18 +209,6 @@ export default {
* 回调参数补充
*/
selectedLiveGoods(val, index) {
// if (!val.___selected) {
// val.___selected = true;
// this.$set(this.liveGoodsData[index], "___selected", true);
// this.selectedGoods.push(this.liveGoodsData[index]);
// } else {
// this.$nextTick(() => {
// val.___selected = false;
// this.$set(this.liveGoodsData[index], "___selected", true);
// this.selectedGoods.splice(index, 1);
// });
// }
this.$emit("selectedGoods", val);
},

View File

@@ -130,6 +130,7 @@ export default {
);
this.$router.go(-1);
},
// 提交活动
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
@@ -167,6 +168,7 @@ export default {
}
});
},
// 获取详情
getDetail() {
getPintuanDetail(this.id).then((res) => {
if (res.success) {

View File

@@ -1,11 +0,0 @@
.search {
.operation {
margin-bottom: 2vh;
}
.page {
margin-top: 2vh;
}
}
.row {
margin-bottom: 5px;
}

View File

@@ -1,5 +1,5 @@
<template>
<div class="search">
<div class="pintuan">
<Card>
<Row>
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
@@ -47,9 +47,6 @@
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
>
<template slot-scope="{ row }" slot="action">
<div class="row">
@@ -128,7 +125,6 @@ import {
} from "@/api/promotion";
export default {
name: "pintuan",
components: {},
data() {
return {
loading: true, // 表单加载状态
@@ -140,8 +136,6 @@ export default {
order: "desc", // 默认排序方式
},
selectDate: null, // 选择的时间
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "活动名称",
@@ -191,23 +185,27 @@ export default {
};
},
methods: {
// 初始化数据
init() {
this.getDataList();
},
// 改变页码
changePage(v) {
this.searchForm.pageNumber = v - 1;
this.getDataList();
this.clearSelectAll();
},
// 改变页数
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
// 搜索
handleSearch() {
this.searchForm.pageNumber = 0;
this.searchForm.pageSize = 10;
this.getDataList();
},
// 重置
handleReset() {
this.searchForm = {}
this.selectDate = ''
@@ -215,20 +213,14 @@ export default {
this.searchForm.pageSize = 10;
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
// 时间段分别赋值
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
// 获取列表数据
getDataList() {
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
@@ -238,7 +230,6 @@ export default {
this.searchForm.startTime = null;
this.searchForm.endTime = null;
}
// 带多条件搜索参数获取表单数据 请自行修改接口
getPintuanList(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
@@ -247,15 +238,19 @@ export default {
}
});
},
// 新建拼团
newAct() {
this.$router.push({ name: "new-pintuan" });
},
// 编辑拼团
edit(v) {
this.$router.push({ name: "new-pintuan", query: { id: v.id } });
},
// 管理拼团商品
manage(v, status) {
this.$router.push({ name: "pintuan-goods", query: { id: v.id, status: status } });
},
// 手动开启拼团活动
open(v) {
this.$Modal.confirm({
title: "确认开启",
@@ -298,6 +293,7 @@ export default {
},
});
},
// 关闭拼团活动
close(v) {
this.$Modal.confirm({
title: "确认关闭",
@@ -314,6 +310,7 @@ export default {
},
});
},
// 删除拼团活动
remove(v) {
this.$Modal.confirm({
title: "确认删除",
@@ -338,6 +335,5 @@ export default {
};
</script>
<style lang="scss">
@import "pintuan.scss";
@import "@/styles/table-common.scss";
</style>

View File

@@ -146,6 +146,7 @@ export default {
);
this.$router.go(-1);
},
// 保存商品
save() {
if (this.goodsData.length == 0) {
this.$Modal.warning({ title: "提示", content: "请选择活动商品" });
@@ -203,8 +204,6 @@ export default {
this.searchForm.pageNumber = 0;
this.searchForm.promotionName = "";
this.selectDate = null;
// 重新加载数据
this.getDataList();
},
@@ -229,7 +228,6 @@ export default {
}
});
},
getPintuanMsg() { // 获取拼团详情
getPintuanDetail(this.$route.query.id).then((res) => {
if (res.success) this.data.push(res.result);

View File

@@ -28,6 +28,7 @@
:columns="columns"
:data="data"
ref="table"
class="mt_10"
sortable="custom"
>
<template slot-scope="{ row }" slot="applyEndTime">
@@ -141,22 +142,27 @@ export default {
};
},
methods: {
// 初始化数据
init() {
this.getDataList();
},
// 分页 改变页码
changePage(v) {
this.searchForm.pageNumber = v - 1;
this.getDataList();
},
// 分页 改变页数
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
// 搜索
handleSearch() {
this.searchForm.pageNumber = 0;
this.searchForm.pageSize = 10;
this.getDataList();
},
// 重置
handleReset() {
this.searchForm = {};
this.selectDate = "";
@@ -164,10 +170,11 @@ export default {
this.searchForm.pageSize = 10;
this.getDataList();
},
// 管理
manage(row) {
this.$router.push({ name: "seckill-goods", query: { id: row.id } });
},
// 获取列表数据
getDataList() {
this.loading = true;
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
@@ -201,10 +208,7 @@ export default {
},
activated() {
this.init();
},
mounted() {
this.init();
},
}
};
</script>
<style lang="scss" scoped>

View File

@@ -16,11 +16,6 @@
<Button @click="delAll">批量删除</Button>
</template>
</Row>
<Row v-show="openTip" v-if="promotionStatus == 'NEW'">
<Alert show-icon>
已选择 <span class="select-count">{{ selectCount }}</span>
</Alert>
</Row>
<Row class="operation">
<Tabs type="card" v-model="tabIndex">
<TabPane
@@ -136,7 +131,6 @@ import {
seckillGoodsList,
seckillDetail,
setSeckillGoods,
removeSeckillGoods,
} from "@/api/promotion.js";
import skuSelect from "@/views/lili-dialog";
export default {
@@ -146,7 +140,6 @@ export default {
data() {
return {
promotionStatus: "", // 活动状态
openTip: true,
loading: false, // 表单加载状态
searchForm: {
// 搜索框初始化对象
@@ -204,10 +197,6 @@ export default {
slot: "promotionApplyStatus",
minWidth: 30,
},
// {
// title: "商品二维码",
// slot: "QRCode",
// },
{
title: "操作",
slot: "action",
@@ -217,7 +206,6 @@ export default {
goodsList: [] // 商品列表
};
},
computed: {},
methods: {
// 关闭当前页面
closeCurrentPage() {
@@ -227,18 +215,8 @@ export default {
);
this.$router.go(-1);
},
// 提交秒杀商品
save() {
// 提交
// for(let i=0;i<this.goodsData.length;i++){
// let data = this.goodsData[i]
// if(!data.price){
// this.$Modal.warning({
// title:'提示',
// content:`请填写【${data.goodsName}】的价格`
// })
// return
// }
// }
let list = JSON.parse(JSON.stringify(this.goodsList));
let params = {
@@ -260,10 +238,11 @@ export default {
}
});
},
// 初始化数据
init() {
this.getSeckillMsg();
},
// 清除选中状态
clearSelectAll() {
this.$refs.table.selectAll(false);
},
@@ -316,19 +295,10 @@ export default {
}
});
},
delGoods(index, id) {
delGoods(index) {
// 删除商品
// if (id) {
// removeSeckillGoods(this.$route.query.id, id).then((res) => {
// if (res.success) {
// this.goodsList[this.tabIndex].list.splice(index, 1);
// this.$Message.success("删除成功!");
// }
// });
// } else {
this.goodsList[this.tabIndex].list.splice(index, 1);
this.$Message.success("删除成功!");
// }
this.goodsList[this.tabIndex].list.splice(index, 1);
this.$Message.success("删除成功!");
},
delAll() { // 删除当前时段全部数据
if (this.selectCount <= 0) {
@@ -350,11 +320,6 @@ export default {
].list.filter((item) => {
return !ids.includes(item.id);
});
// removeSeckillGoods(this.$route.query.id, ids).then((res) => {
// if (res.success) {
// this.$Message.success("删除成功!");
// }
// });
},
});
},
@@ -406,22 +371,20 @@ export default {
}
return [];
},
// 格式化申请状态
promotionApplyStatus(key) {
switch (key) {
case "APPLY":
return "申请";
break;
case "PASS":
return "通过";
break;
case "REFUSE":
return "拒绝";
break;
default:
return "未申请";
break;
}
},
// 展示审核拒绝原因
showReason(reason) {
this.$Modal.info({
title: "拒绝原因",