mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-21 10:25:53 +08:00
commit message
This commit is contained in:
458
manager/src/views/promotion/pointsGoods/addPointsGoods.vue
Normal file
458
manager/src/views/promotion/pointsGoods/addPointsGoods.vue
Normal file
@@ -0,0 +1,458 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<Card>
|
||||
<Form ref="form" :model="form" :rules="formRule">
|
||||
<div class="base-info-item">
|
||||
<h4>添加积分商品</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem astyle="width: 100%">
|
||||
<div style="display: flex; margin-bottom: 10px">
|
||||
<Button type="primary" @click="$refs.skuSelect.open('goods')"
|
||||
>选择商品</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="skuId">
|
||||
<div>{{ row.skuId }}</div>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="settlementPrice">
|
||||
<Input
|
||||
type="number"
|
||||
v-model="row.settlementPrice"
|
||||
@input="
|
||||
pointsGoodsList[index].settlementPrice =
|
||||
row.settlementPrice
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template
|
||||
slot-scope="{ row, index }"
|
||||
slot="pointsGoodsCategory"
|
||||
>
|
||||
<Select
|
||||
v-model="pointsGoodsList[index].pointsGoodsCategoryId"
|
||||
transfer="true"
|
||||
label-in-value="true"
|
||||
@on-change="
|
||||
(val) => {
|
||||
changeCategory(val, index);
|
||||
}
|
||||
"
|
||||
>
|
||||
<Option
|
||||
v-for="item in categoryList"
|
||||
:value="item.id"
|
||||
:key="item.id"
|
||||
>{{ item.name }}</Option
|
||||
>
|
||||
</Select>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="activeStock">
|
||||
<Input
|
||||
type="number"
|
||||
v-model="row.activeStock"
|
||||
@input="
|
||||
pointsGoodsList[index].activeStock = row.activeStock
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="points">
|
||||
<Input
|
||||
type="number"
|
||||
v-model="row.points"
|
||||
@input="pointsGoodsList[index].points = row.points"
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="兑换时间" prop="time">
|
||||
<DatePicker
|
||||
type="datetime"
|
||||
v-model="form.startTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
-
|
||||
<DatePicker
|
||||
type="datetime"
|
||||
v-model="form.endTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
:options="options"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<div>
|
||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</Card>
|
||||
<sku-select
|
||||
ref="skuSelect"
|
||||
@selectedGoodsData="selectedGoodsData"
|
||||
></sku-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addPointsGoods, getPointsGoodsCategoryList } from "@/api/promotion";
|
||||
import { regular } from "@/utils";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
export default {
|
||||
name: "addPoinsGoods",
|
||||
components: {
|
||||
skuSelect,
|
||||
},
|
||||
data() {
|
||||
const isLtEndDate = (rule, value, callback) => {
|
||||
if (new Date(value).getTime() > new Date(this.form.endTime).getTime()) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const isGtStartDate = (rule, value, callback) => {
|
||||
if (new Date(value).getTime() < new Date(this.form.startTime).getTime()) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
maxHeight: "240px",
|
||||
modalType: 0,
|
||||
/** 当前状态/模式 默认发布商品0 编辑商品1 编辑草稿箱商品2 */
|
||||
currentStatus: 0,
|
||||
categoryId: 0,
|
||||
form: {
|
||||
/** 店铺承担比例 */
|
||||
sellerCommission: 0,
|
||||
/** 发行数量 */
|
||||
publishNum: 1,
|
||||
/** 运费承担者 */
|
||||
scopeType: "ALL",
|
||||
/** 限领数量 */
|
||||
couponLimitNum: 1,
|
||||
/** 活动类型 */
|
||||
couponType: "PRICE",
|
||||
/** 优惠券名称 */
|
||||
couponName: "",
|
||||
getType: "FREE",
|
||||
promotionGoodsList: [],
|
||||
},
|
||||
pointsGoodsList: [],
|
||||
categoryList: [],
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectedGoods: [], // 已选商品列表,便于删除
|
||||
formRule: {
|
||||
startTime: [
|
||||
{
|
||||
required: true,
|
||||
type: "date",
|
||||
message: "请选择开始时间",
|
||||
},
|
||||
{
|
||||
trigger: "change",
|
||||
message: "开始时间要小于结束时间",
|
||||
validator: isLtEndDate,
|
||||
},
|
||||
],
|
||||
endTime: [
|
||||
{
|
||||
required: true,
|
||||
type: "date",
|
||||
message: "请选择结束时间",
|
||||
},
|
||||
{
|
||||
trigger: "change",
|
||||
message: "结束时间要大于开始时间",
|
||||
validator: isGtStartDate,
|
||||
},
|
||||
],
|
||||
discount: [
|
||||
{ required: true, message: "请输入折扣" },
|
||||
{
|
||||
pattern: regular.discount,
|
||||
message: "请输入0-10的数字,可有一位小数",
|
||||
},
|
||||
],
|
||||
sellerCommission: [
|
||||
{ required: true, message: "请输入店铺承担比例" },
|
||||
{ pattern: regular.rate, message: "请输入0-100的正整数" },
|
||||
],
|
||||
publishNum: [
|
||||
{ required: true, message: "请输入发放数量" },
|
||||
{ pattern: regular.integer, message: "请输入正整数" },
|
||||
],
|
||||
couponLimitNum: [
|
||||
{ required: true, message: "请输入领取限制" },
|
||||
{ pattern: regular.integer, message: "请输入正整数" },
|
||||
],
|
||||
description: [{ required: true, message: "请输入范围描述" }],
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
type: "selection",
|
||||
width: 60,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "商品名称",
|
||||
key: "goodsName",
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "SKU编码",
|
||||
slot: "skuId",
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "店铺名称",
|
||||
key: "sellerName",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "商品价格",
|
||||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
key: "quantity",
|
||||
minWidth: 20,
|
||||
},
|
||||
{
|
||||
title: "结算价格",
|
||||
slot: "settlementPrice",
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
title: "分类",
|
||||
slot: "pointsGoodsCategory",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "活动库存",
|
||||
slot: "activeStock",
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
title: "兑换积分",
|
||||
slot: "points",
|
||||
minWidth: 40,
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
minWidth: 50,
|
||||
align: "center",
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"Button",
|
||||
{
|
||||
props: {
|
||||
size: "small",
|
||||
type: "error",
|
||||
ghost: true,
|
||||
},
|
||||
on: {
|
||||
click: () => {
|
||||
this.delGoods(params.index);
|
||||
},
|
||||
},
|
||||
},
|
||||
"删除"
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
options: {
|
||||
disabledDate(date) {
|
||||
return date && date.valueOf() < Date.now() - 86400000;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
await this.getCategory();
|
||||
},
|
||||
methods: {
|
||||
async getCategory() {
|
||||
let res = await getPointsGoodsCategoryList();
|
||||
this.categoryList = res.result.records;
|
||||
},
|
||||
/** 保存平台优惠券 */
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
let params = this.pointsGoodsList;
|
||||
const start = this.$options.filters.unixToDate(
|
||||
this.form.startTime / 1000
|
||||
);
|
||||
const end = this.$options.filters.unixToDate(
|
||||
this.form.endTime / 1000
|
||||
);
|
||||
|
||||
if (!params || params.length == 0) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitLoading = true;
|
||||
params = params.map((j) => {
|
||||
j.startTime = start;
|
||||
j.endTime = end;
|
||||
return j;
|
||||
});
|
||||
addPointsGoods(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("积分商品创建成功");
|
||||
this.closeCurrentPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "add-poonts-goods");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
changeCategory(val, index) {
|
||||
this.pointsGoodsList[index].pointsGoodsCategoryName = val.label;
|
||||
},
|
||||
changeSelect(e) {
|
||||
// 已选商品批量选择
|
||||
this.selectedGoods = e;
|
||||
},
|
||||
delSelectGoods() {
|
||||
// 多选删除商品
|
||||
if (this.pointsGoodsList.length <= 0) {
|
||||
this.$Message.warning("您还未选择要删除的数据");
|
||||
return;
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除所选商品吗?",
|
||||
onOk: () => {
|
||||
let ids = [];
|
||||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.pointsGoodsList = this.pointsGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
delGoods(index) {
|
||||
// 删除商品
|
||||
this.form.promotionGoodsList.splice(index, 1);
|
||||
this.pointsGoodsList.splice(index, 1);
|
||||
},
|
||||
selectedGoodsData(item) {
|
||||
// 回显已选商品
|
||||
let ids = [];
|
||||
let list = [];
|
||||
this.form.promotionGoodsList.forEach((e) => {
|
||||
ids.push(e.id);
|
||||
});
|
||||
item.forEach((e) => {
|
||||
if (!ids.includes(e.id)) {
|
||||
list.push({
|
||||
goodsName: e.goodsName,
|
||||
price: e.price,
|
||||
originalPrice: e.price,
|
||||
quantity: e.quantity,
|
||||
storeId: e.storeId,
|
||||
sellerName: e.sellerName,
|
||||
skuId: e.id,
|
||||
...e,
|
||||
});
|
||||
this.pointsGoodsList.push({
|
||||
settlementPrice: 0,
|
||||
pointsGoodsCategoryId: 0,
|
||||
pointsGoodsCategoryName: "",
|
||||
activeStock: 0,
|
||||
points: 0,
|
||||
goodsSku: {
|
||||
...e,
|
||||
},
|
||||
skuId: e.id,
|
||||
});
|
||||
}
|
||||
});
|
||||
this.form.promotionGoodsList.push(...list);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scpoed>
|
||||
h4 {
|
||||
margin-bottom: 10px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
.describe {
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
color: #999;
|
||||
}
|
||||
.wrapper{
|
||||
min-height: 800px;
|
||||
}
|
||||
</style>
|
||||
|
||||
374
manager/src/views/promotion/pointsGoods/editPointsGoods.vue
Normal file
374
manager/src/views/promotion/pointsGoods/editPointsGoods.vue
Normal file
@@ -0,0 +1,374 @@
|
||||
<template>
|
||||
<div>
|
||||
<Card>
|
||||
<Form ref="form" :model="form" :label-width="120" :rules="formRule">
|
||||
<div class="base-info-item">
|
||||
<h4>积分商品信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="商品名称" prop="goodsName">
|
||||
<div>{{ form.goodsSku.goodsName }}</div>
|
||||
</FormItem>
|
||||
<FormItem label="SKU编码" prop="skuId">
|
||||
<div>{{ form.goodsSku.id }}</div>
|
||||
</FormItem>
|
||||
<FormItem label="店铺名称" prop="sellerName">
|
||||
<div>{{ form.goodsSku.sellerName }}</div>
|
||||
</FormItem>
|
||||
<FormItem label="商品价格" prop="goodsPrice">
|
||||
<div>{{ form.goodsSku.price }}</div>
|
||||
</FormItem>
|
||||
<FormItem label="库存" prop="quantity">
|
||||
<div>{{ form.goodsSku.quantity }}</div>
|
||||
</FormItem>
|
||||
<FormItem label="结算价格" prop="settlementPrice">
|
||||
<Input
|
||||
type="num"
|
||||
v-model="form.settlementPrice"
|
||||
placeholder="请填写结算价格"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="分类" prop="pointsGoodsCategoryId">
|
||||
<Select
|
||||
v-model="form.pointsGoodsCategoryId"
|
||||
label-in-value="true"
|
||||
@on-change="
|
||||
(val) => {
|
||||
changeCategory(val, index);
|
||||
}
|
||||
"
|
||||
>
|
||||
<Option
|
||||
v-for="item in categoryList"
|
||||
:value="item.id"
|
||||
:key="item.id"
|
||||
>{{ item.name }}</Option
|
||||
>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem label="活动库存" prop="activeStock">
|
||||
<Input
|
||||
type="number"
|
||||
v-model="form.activeStock"
|
||||
placeholder="请填写活动库存"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="兑换积分" prop="points">
|
||||
<Input
|
||||
type="number"
|
||||
v-model="form.points"
|
||||
placeholder="请填写兑换积分"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动开始时间" prop="startTime">
|
||||
<DatePicker
|
||||
type="datetime"
|
||||
v-model="form.startTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
:options="options"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
-
|
||||
<DatePicker
|
||||
type="datetime"
|
||||
v-model="form.endTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
:options="options"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<Button @click="closeCurrentPage" style="margin-right: 5px"
|
||||
>返回</Button
|
||||
>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>保存</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
updatePointsGoods,
|
||||
getPointsGoodsById,
|
||||
getPointsGoodsCategoryList,
|
||||
} from "@/api/promotion";
|
||||
import { format } from "date-fns";
|
||||
|
||||
export default {
|
||||
name: "addCoupon",
|
||||
data() {
|
||||
return {
|
||||
maxHeight: "240px",
|
||||
modalType: 0,
|
||||
/** 当前状态/模式 默认发布商品0 编辑商品1 编辑草稿箱商品2 */
|
||||
currentStatus: 0,
|
||||
categoryId: 0,
|
||||
form: {
|
||||
/** 活动名称 */
|
||||
promotionName: "",
|
||||
/** 报名截止时间 */
|
||||
applyEndTime: "",
|
||||
/** 活动开始时间 */
|
||||
startTime: "",
|
||||
/** 抢购时间段 */
|
||||
seckillPeriod: [],
|
||||
/** 申请规则 */
|
||||
seckillRule: "",
|
||||
goodsSku: {},
|
||||
promotionStatus: "NEW",
|
||||
},
|
||||
categoryList: [],
|
||||
id: this.$route.query.id,
|
||||
periodTime: 0,
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
|
||||
formRule: {
|
||||
settlementPrice: [{ required: true, message: "请填写结算价格" }],
|
||||
pointsGoodsCategoryId: [
|
||||
{ required: true, message: "请选择积分商品分类" },
|
||||
],
|
||||
points: [{ required: true, message: "请填写兑换积分" }],
|
||||
startTime: [{ required: true, message: "请填写活动开始时间" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
await this.getCategory();
|
||||
// 如果id不为空则查询信息
|
||||
if (this.id) {
|
||||
this.getData();
|
||||
this.modalType = 1;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "edit-points-goods");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
getData() {
|
||||
getPointsGoodsById(this.id).then((res) => {
|
||||
if (res.success) {
|
||||
let data = res.result;
|
||||
this.form = data;
|
||||
}
|
||||
});
|
||||
},
|
||||
async getCategory() {
|
||||
let res = await getPointsGoodsCategoryList();
|
||||
this.categoryList = res.result.records;
|
||||
},
|
||||
/** 保存平台优惠券 */
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const start = this.$options.filters.unixToDate(
|
||||
this.form.startTime / 1000
|
||||
);
|
||||
const end = this.$options.filters.unixToDate(
|
||||
this.form.endTime / 1000
|
||||
);
|
||||
this.form.startTime = start;
|
||||
this.form.endTime = end;
|
||||
this.submitLoading = true;
|
||||
updatePointsGoods(this.form).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("积分商品修改成功");
|
||||
this.closeCurrentPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/*编辑基本信息*/
|
||||
.el-form {
|
||||
padding-bottom: 80px;
|
||||
|
||||
.el-form-item {
|
||||
width: 100%;
|
||||
color: gray;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
/*平铺*/
|
||||
div.base-info-item > div {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
div.base-info-item {
|
||||
margin-bottom: 10px;
|
||||
|
||||
h4 {
|
||||
margin-bottom: 10px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.form-item-view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding-left: 80px;
|
||||
|
||||
.shop-category-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-goods-properts-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
word-break: break-all;
|
||||
white-space: normal;
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.item-goods-properts {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/** 审核信息-拒绝原因 */
|
||||
.auth-info {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
width: 30%;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.goods-name-width {
|
||||
width: 50%;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.el-form-item__content {
|
||||
margin-left: 120px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p.goods-group-manager {
|
||||
padding-left: 7.5%;
|
||||
text-align: left;
|
||||
color: #999;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/*teatarea*/
|
||||
/deep/ .el-textarea {
|
||||
width: 150%;
|
||||
}
|
||||
|
||||
.seo-text {
|
||||
width: 150%;
|
||||
}
|
||||
}
|
||||
|
||||
/*商品描述*/
|
||||
.goods-intro {
|
||||
line-height: 40;
|
||||
}
|
||||
|
||||
/** 底部步骤 */
|
||||
.footer {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #ffc;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
/*图片上传组件第一张图设置封面*/
|
||||
.goods-images {
|
||||
/deep/ li.el-upload-list__item:first-child {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/deep/ li.el-upload-list__item:first-child:after {
|
||||
content: "封";
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
left: -15px;
|
||||
top: -6px;
|
||||
width: 40px;
|
||||
height: 24px;
|
||||
padding-top: 6px;
|
||||
background: #13ce66;
|
||||
text-align: center;
|
||||
-webkit-transform: rotate(-45deg);
|
||||
transform: rotate(-45deg);
|
||||
-webkit-box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.el-form-item__label {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.step-view {
|
||||
width: 33%;
|
||||
height: 40px;
|
||||
font-size: 19px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page {
|
||||
margin-top: 2vh;
|
||||
margin-bottom: 5vh;
|
||||
}
|
||||
</style>
|
||||
336
manager/src/views/promotion/pointsGoods/pointsGoods.vue
Normal file
336
manager/src/views/promotion/pointsGoods/pointsGoods.vue
Normal file
@@ -0,0 +1,336 @@
|
||||
<template>
|
||||
<div class="search">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="商品名称">
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.goodsName"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="积分区间">
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.pointsS"
|
||||
placeholder="请输入开始区间"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
-
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.pointsE"
|
||||
placeholder="请输入结束区间"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="状态">
|
||||
<Select v-model="searchForm.promotionStatus" style="width: 200px">
|
||||
<Option
|
||||
v-for="item in statusList"
|
||||
:value="item.value"
|
||||
:key="item.value"
|
||||
>{{ item.label }}</Option
|
||||
>
|
||||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="SKU编码">
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.skuId"
|
||||
placeholder="请输入SKU编码"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
<Row class="operation padding-row">
|
||||
<Button @click="addPointsGoods" type="primary" >添加积分商品</Button>
|
||||
|
||||
</Row>
|
||||
<Row>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
ref="table"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<div class="div-zoom" >
|
||||
<a>{{ row.goodsSku.goodsName }}</a>
|
||||
</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="price">
|
||||
<div>{{ row.goodsSku.price | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="settlementPrice">
|
||||
<div>{{ row.settlementPrice | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="quantity">
|
||||
<div>{{ row.goodsSku.quantity }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="edit(row.id)"
|
||||
style="margin-right: 5px"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="statusChanged(row.id, 'CLOSE')"
|
||||
style="margin-right: 5px"
|
||||
>停用</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'CLOSE'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="statusChanged(row.id, 'START')"
|
||||
style="margin-right: 5px"
|
||||
>启用</Button
|
||||
>
|
||||
<Button type="error" size="small" @click="close(row.id)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
</Row>
|
||||
<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 {
|
||||
getPointsGoodsList,
|
||||
editPointsGoodsStatus,
|
||||
deletePointsGoodsStatus,
|
||||
} from "@/api/promotion";
|
||||
export default {
|
||||
name: "pointsGoods",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
loading: true, // 表单加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 0, // 当前页数
|
||||
pageSize: 10, // 页面大小
|
||||
order: "desc", // 默认排序方式
|
||||
},
|
||||
statusList: [
|
||||
{ label: "未开始", value: "NEW" },
|
||||
{ label: "已开始", value: "START" },
|
||||
{ label: "已结束", value: "END" },
|
||||
{ label: "已关闭", value: "CLOSE" },
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: "商品名称",
|
||||
slot: "goodsName",
|
||||
minWidth: 120,
|
||||
tooltip: true,
|
||||
},
|
||||
{
|
||||
title: "市场价",
|
||||
slot: "price",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "结算价",
|
||||
slot: "settlementPrice",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "分类",
|
||||
key: "pointsGoodsCategoryName",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "库存数量",
|
||||
slot: "quantity",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "活动剩余库存",
|
||||
key: "activeStock",
|
||||
minWidth:90,
|
||||
},
|
||||
{
|
||||
title: "兑换积分",
|
||||
key: "points",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "所属店铺",
|
||||
key: "storeName",
|
||||
minWidth: 60,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
key: "startTime",
|
||||
minWidth: 140,
|
||||
},
|
||||
{
|
||||
title: "活动结束时间",
|
||||
key: "endTime",
|
||||
minWidth: 140,
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
key: "promotionStatus",
|
||||
minWidth: 60,
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
color = "";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "default";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "blue";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [h("Tag", { props: { color: color } }, text)]);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
slot: "action",
|
||||
align: "center",
|
||||
width: 150,
|
||||
},
|
||||
],
|
||||
data: [], // 表单数据
|
||||
total: 0, // 表单数据总数
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.getDataList();
|
||||
},
|
||||
addPointsGoods() {
|
||||
this.$router.push({ name: "add-points-goods" });
|
||||
},
|
||||
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;
|
||||
if (this.searchForm.pointsS !== "") {
|
||||
this.searchForm.points =
|
||||
this.searchForm.pointsS +
|
||||
"_" +
|
||||
(this.searchForm.pointsE ? this.searchForm.pointsE : "");
|
||||
}
|
||||
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
getDataList() {
|
||||
this.loading = true;
|
||||
getPointsGoodsList(this.searchForm).then((res) => {
|
||||
this.loading = false;
|
||||
if (res.success) {
|
||||
this.data = res.result.records;
|
||||
this.total = res.result.total;
|
||||
}
|
||||
});
|
||||
},
|
||||
edit(id) {
|
||||
this.$router.push({ name: "edit-points-goods", query: { id: id } });
|
||||
},
|
||||
statusChanged(id, status) {
|
||||
let text = "";
|
||||
if (status == "START") {
|
||||
text = "开启";
|
||||
} else if (status == "CLOSE") {
|
||||
text = "关闭";
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "确认" + text,
|
||||
content: "您确认要" + text + "此积分商品?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
editPointsGoodsStatus(id, {
|
||||
promotionStatus: status,
|
||||
}).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(text + "成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
close(id) {
|
||||
this.$Modal.confirm({
|
||||
title: "确认删除",
|
||||
content: "您确认要删除此积分商品?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
deletePointsGoodsStatus(id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("操作成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import "@/styles/table-common.scss";
|
||||
</style>
|
||||
Reference in New Issue
Block a user