mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-19 01:15:53 +08:00
适配重构促销
This commit is contained in:
@@ -60,13 +60,8 @@ export const editPintuan = (params) => {
|
||||
return putRequest('/promotion/pintuan', params,{'Content-type': 'application/json'})
|
||||
}
|
||||
// 手动开启拼团活动
|
||||
export const openPintuan = (pintuanId, params) => {
|
||||
return putRequest(`/promotion/pintuan/open/${pintuanId}`, params)
|
||||
}
|
||||
|
||||
// 手动关闭拼团活动
|
||||
export const closePintuan = (pintuanId) => {
|
||||
return putRequest(`/promotion/pintuan/close/${pintuanId}`)
|
||||
export const editPintuanStatus = (pintuanId, params) => {
|
||||
return putRequest(`/promotion/pintuan/status/${pintuanId}`, params)
|
||||
}
|
||||
|
||||
// 删除拼团活动
|
||||
@@ -179,6 +174,6 @@ export const delFullDiscount = (id) => {
|
||||
return deleteRequest(`/promotion/fullDiscount/${id}`)
|
||||
}
|
||||
// 开启、关闭满减活动
|
||||
export const updateFullDiscount = (id, promotionStatus) => {
|
||||
return putRequest(`/promotion/fullDiscount/status/${id}/${promotionStatus}`)
|
||||
export const updateFullDiscount = (id, params) => {
|
||||
return putRequest(`/promotion/fullDiscount/status/${id}`, params)
|
||||
}
|
||||
|
||||
@@ -283,8 +283,8 @@ export const result = [{
|
||||
level: 2,
|
||||
type: 0,
|
||||
title: "满额活动",
|
||||
path: "full-cut",
|
||||
component: "promotion/fullCut/fullCut",
|
||||
path: "full-discount",
|
||||
component: "promotion/full-discount/full-discount",
|
||||
children: null
|
||||
},
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ export const otherRouter = {
|
||||
path: "add-coupon",
|
||||
title: "店铺优惠券",
|
||||
name: "add-coupon",
|
||||
component: () => import("@/views/promotion/coupon/couponPublish.vue")
|
||||
component: () => import("@/views/promotion/coupon/coupon-publish.vue")
|
||||
},
|
||||
{
|
||||
path: "add-live",
|
||||
@@ -81,19 +81,19 @@ export const otherRouter = {
|
||||
path: "seckill-goods",
|
||||
title: "限时抢购商品",
|
||||
name: "seckill-goods",
|
||||
component: () => import("@/views/promotion/seckill/seckillGoods.vue")
|
||||
component: () => import("@/views/promotion/seckill/seckill-goods.vue")
|
||||
},
|
||||
{
|
||||
path: "pintuan-goods",
|
||||
title: "拼团商品",
|
||||
name: "pintuan-goods",
|
||||
component: () => import("@/views/promotion/pintuan/pintuanGoods.vue")
|
||||
component: () => import("@/views/promotion/pintuan/pintuan-goods.vue")
|
||||
},
|
||||
{
|
||||
path: "new-pintuan",
|
||||
path: "pintuan-edit",
|
||||
title: "新增拼团",
|
||||
name: "new-pintuan",
|
||||
component: () => import("@/views/promotion/pintuan/newPintuan.vue")
|
||||
name: "pintuan-edit",
|
||||
component: () => import("@/views/promotion/pintuan/pintuan-edit.vue")
|
||||
},
|
||||
{
|
||||
path: "order-detail",
|
||||
@@ -116,10 +116,10 @@ export const otherRouter = {
|
||||
import("@/views/order/after-order/reurnGoodsOrderDetail.vue")
|
||||
},
|
||||
{
|
||||
path: "full-cut-detail",
|
||||
path: "full-discount-detail",
|
||||
title: "添加满额活动",
|
||||
name: "full-cut-detail",
|
||||
component: () => import("@/views/promotion/fullCut/newFullCut.vue")
|
||||
name: "full-discount-detail",
|
||||
component: () => import("@/views/promotion/full-discount/full-discount-add.vue")
|
||||
},
|
||||
{
|
||||
path: "export-order-deliver",
|
||||
|
||||
60
seller/src/utils/promotions.js
Normal file
60
seller/src/utils/promotions.js
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
export function promotionsStatusRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "geekblue";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
export function promotionsScopeTypeRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
color = "default";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
color = "yellow";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
color = "pink";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
color = "magenta";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,24 @@
|
||||
<h4>基本信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="活动名称" prop="promotionName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.promotionName"
|
||||
placeholder="活动名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券名称" prop="couponName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.couponName"
|
||||
placeholder="优惠券名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券类型" prop="couponType">
|
||||
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
||||
@@ -18,11 +32,25 @@
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem label="折扣" prop="discount" v-if="form.couponType == 'DISCOUNT'">
|
||||
<Input :disabled="disabled" type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="number"
|
||||
v-model="form.couponDiscount"
|
||||
placeholder="折扣"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="describe">请输入0-10之间数字,可以输入一位小数</span>
|
||||
</FormItem>
|
||||
<FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
|
||||
<Input :disabled="disabled" type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.price"
|
||||
placeholder="面额"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动类型" prop="getType">
|
||||
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
||||
@@ -32,54 +60,132 @@
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="发放数量" v-if="form.getType == 'FREE'" prop="publishNum">
|
||||
<Input :disabled="disabled" v-model="form.publishNum" placeholder="发放数量" style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.publishNum"
|
||||
placeholder="发放数量"
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="tips ml_10">如果发放数量为0时,则代表不限制发放数量</span>
|
||||
</FormItem>
|
||||
</div>
|
||||
<h4>使用限制</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="消费门槛" prop="consumeThreshold">
|
||||
<Input :disabled="disabled" type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.consumeThreshold"
|
||||
placeholder="消费门槛"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="领取限制" v-if="form.getType == 'FREE'" prop="couponLimitNum">
|
||||
<Input :disabled="disabled" v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" />
|
||||
<FormItem
|
||||
label="领取限制"
|
||||
v-if="form.getType == 'FREE'"
|
||||
prop="couponLimitNum"
|
||||
>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.couponLimitNum"
|
||||
placeholder="领取限制"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="tips ml_10">如果领取限制为0时,则代表不限制领取数量</span>
|
||||
</FormItem>
|
||||
<FormItem label="有效期" prop="rangeTime">
|
||||
<DatePicker :disabled="disabled" type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px">
|
||||
<DatePicker
|
||||
:disabled="disabled"
|
||||
type="datetimerange"
|
||||
v-model="form.rangeTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
style="width: 260px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<FormItem label="使用范围" prop="scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<Radio :disabled="disabled" label="ALL">全品类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS">指定商品</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY">部分商品分类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY"
|
||||
>部分商品分类</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<div style="display: flex; margin-bottom: 10px">
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button :disabled="disabled" type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList"
|
||||
>选择商品</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table class="mt_10" :disabled="disabled" border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
class="mt_10"
|
||||
:disabled="disabled"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
|
||||
<img
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
||||
<Cascader :disabled="disabled" @on-change="getGoodsCategory" :data="goodsCategoryList" style="width:300px;" v-model="form.scopeIdGoods"></Cascader>
|
||||
|
||||
<Cascader
|
||||
:disabled="disabled"
|
||||
@on-change="getGoodsCategory"
|
||||
:data="goodsCategoryList"
|
||||
style="width: 300px"
|
||||
v-model="form.scopeIdGoods"
|
||||
></Cascader>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="范围描述" prop="description">
|
||||
<Input :disabled="disabled" v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.description"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<div>
|
||||
<Button :disabled="disabled" type="text" @click="$router.push({ name: 'coupon' })">返回</Button>
|
||||
<Button :disabled="disabled" type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
@click="$router.push({ name: 'coupon' })"
|
||||
>返回</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,10 +258,7 @@ export default {
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
||||
couponLimitNum: [{ required: true, message: "领取限制不能为空" }],
|
||||
price: [
|
||||
{ required: true, message: "请输入面额" },
|
||||
{ validator: checkPrice },
|
||||
],
|
||||
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||
consumeThreshold: [
|
||||
{ required: true, message: "请输入消费门槛" },
|
||||
{ validator: checkWeight },
|
||||
@@ -198,10 +301,7 @@ export default {
|
||||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -284,7 +384,9 @@ export default {
|
||||
data.scopeIdGoods = prevCascader;
|
||||
}
|
||||
data.rangeTime = [];
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
if (data.startTime && data.endTime) {
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
}
|
||||
this.form = data;
|
||||
});
|
||||
},
|
||||
@@ -307,8 +409,7 @@ export default {
|
||||
let scopeId = [];
|
||||
if (
|
||||
params.scopeType == "PORTION_GOODS" &&
|
||||
(!params.promotionGoodsList ||
|
||||
params.promotionGoodsList.length == 0)
|
||||
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
@@ -402,11 +503,9 @@ export default {
|
||||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -520,4 +619,3 @@ h4 {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,12 +2,29 @@
|
||||
<div class="search">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="100" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="100"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="优惠券名称">
|
||||
<Input type="text" v-model="searchForm.couponName" placeholder="请输入优惠券名称" clearable style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.couponName"
|
||||
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>
|
||||
@@ -15,26 +32,71 @@
|
||||
</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" class="search-btn" icon="ios-search">搜索</Button>
|
||||
<Button
|
||||
@click="handleSearch"
|
||||
type="primary"
|
||||
class="search-btn"
|
||||
icon="ios-search"
|
||||
>搜索</Button
|
||||
>
|
||||
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
<Row class="operator padding-row">
|
||||
<Button @click="add" type="primary">添加</Button>
|
||||
<Button @click="delAll" class="ml_10">批量下架</Button>
|
||||
<Button @click="delAll" class="ml_10">批量关闭</Button>
|
||||
</Row>
|
||||
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" @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" @click="see(row)">编辑</Button>
|
||||
<Button v-else type="default" size="small" @click="see(row,'only')">查看</Button>
|
||||
<Button v-if="row.promotionStatus !== 'END'" type="error" size="small" :style="{'marginLeft':'5px'}" @click="remove(row)">下架</Button>
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="see(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button v-else type="default" size="small" @click="see(row, 'only')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'START' || row.promotionStatus === 'NEW'"
|
||||
type="error"
|
||||
size="small"
|
||||
:style="{ marginLeft: '5px' }"
|
||||
@click="remove(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :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>
|
||||
<Page
|
||||
: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>
|
||||
</Card>
|
||||
</div>
|
||||
@@ -42,12 +104,13 @@
|
||||
|
||||
<script>
|
||||
import { getShopCouponList, updateCouponStatus } from "@/api/promotion";
|
||||
import { promotionsStatusRender, promotionsScopeTypeRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "coupon",
|
||||
data() {
|
||||
return {
|
||||
selectDate:[],
|
||||
selectDate: [],
|
||||
loading: true, // 表单加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
@@ -84,7 +147,7 @@ export default {
|
||||
if (params.row.price) {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice((params.row.price || 0), "¥")
|
||||
this.$options.filters.unitPrice(params.row.price || 0, "¥")
|
||||
);
|
||||
} else {
|
||||
return h("div", (params.row.couponDiscount || 0) + "折");
|
||||
@@ -98,7 +161,9 @@ export default {
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.receivedNum + "/" + (params.row.publishNum === 0 ? '不限制' : params.row.publishNum)
|
||||
params.row.receivedNum +
|
||||
"/" +
|
||||
(params.row.publishNum === 0 ? "不限制" : params.row.publishNum)
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -118,32 +183,24 @@ export default {
|
||||
{
|
||||
title: "品类描述",
|
||||
key: "scopeType",
|
||||
width: 100,
|
||||
width: 120,
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
}
|
||||
return h("div", [text]);
|
||||
return promotionsScopeTypeRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "活动时间",
|
||||
|
||||
render: (h, params) => {
|
||||
if (params.row.rangeDayType !== "FIXEDTIME") {
|
||||
if (
|
||||
params?.row?.getType === "ACTIVITY" &&
|
||||
params?.row?.rangeDayType === "DYNAMICTIME"
|
||||
) {
|
||||
return h("div", "长期有效");
|
||||
} else {
|
||||
} else if (params?.row?.startTime && params?.row?.endTime) {
|
||||
return h("div", {
|
||||
domProps: {
|
||||
innerHTML:
|
||||
params.row.startTime + "<br/>" + params.row.endTime,
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -155,33 +212,8 @@ export default {
|
||||
key: "promotionStatus",
|
||||
fixed: "right",
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
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 = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
@@ -256,34 +288,10 @@ export default {
|
||||
this.loading = false;
|
||||
},
|
||||
// 跳转编辑优惠券页面
|
||||
see(v,only) {
|
||||
let data
|
||||
only ? data = { onlyView : true,id: v.id } : data = { id: v.id }
|
||||
this.$router.push({ name: "add-coupon", query:data});
|
||||
},
|
||||
|
||||
// 开启优惠券
|
||||
open(v) {
|
||||
this.$Modal.confirm({
|
||||
title: "确认",
|
||||
content: "确认要上架此优惠券么?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
this.loading = false;
|
||||
let params = {
|
||||
couponIds: v.id,
|
||||
promotionStatus: "START",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("上架成功");
|
||||
this.clearSelectAll();
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
see(v, only) {
|
||||
let data;
|
||||
only ? (data = { onlyView: true, id: v.id }) : (data = { id: v.id });
|
||||
this.$router.push({ name: "add-coupon", query: data });
|
||||
},
|
||||
// 下架优惠券
|
||||
remove(v) {
|
||||
@@ -295,7 +303,6 @@ export default {
|
||||
this.loading = false;
|
||||
let params = {
|
||||
couponIds: v.id,
|
||||
promotionStatus: "CLOSE",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
@@ -312,12 +319,12 @@ export default {
|
||||
// 批量下架
|
||||
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 = [];
|
||||
@@ -327,7 +334,6 @@ export default {
|
||||
|
||||
let params = {
|
||||
couponIds: ids.toString(),
|
||||
promotionStatus: "CLOSE",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
|
||||
@@ -6,81 +6,213 @@
|
||||
<h4>基本信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="活动名称" prop="promotionName">
|
||||
<Input type="text" v-model="form.promotionName" :disabled="form.promotionStatus != 'NEW'" placeholder="活动名称" clearable style="width: 280px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.promotionName"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
placeholder="活动名称"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动时间" prop="rangeTime">
|
||||
<DatePicker type="datetimerange" v-model="form.rangeTime" :disabled="form.promotionStatus != 'NEW'" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options"
|
||||
style="width: 280px">
|
||||
<DatePicker
|
||||
type="datetimerange"
|
||||
v-model="form.rangeTime"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
style="width: 280px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<FormItem label="活动描述" prop="description">
|
||||
<Input v-model="form.description" :disabled="form.promotionStatus != 'NEW'" type="textarea" :rows="4" clearable style="width: 280px" />
|
||||
<Input
|
||||
v-model="form.description"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<h4>优惠设置</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="优惠门槛" prop="fullMoney">
|
||||
<Input type="text" v-model="form.fullMoney" :disabled="form.promotionStatus != 'NEW'" placeholder="优惠门槛" clearable style="width: 280px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.fullMoney"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
placeholder="优惠门槛"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
<span class="describe">消费达到当前金额可以参与优惠</span>
|
||||
</FormItem>
|
||||
<FormItem label="优惠方式">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus">减现金</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate">打折</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus"
|
||||
>减现金</Radio
|
||||
>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate"
|
||||
>打折</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.discountType == 'isFullMinus'" label="优惠金额" prop="fullMinus">
|
||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullMinus" placeholder="优惠金额" clearable style="width: 280px" />
|
||||
<FormItem
|
||||
v-if="form.discountType == 'isFullMinus'"
|
||||
label="优惠金额"
|
||||
prop="fullMinus"
|
||||
>
|
||||
<Input
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="text"
|
||||
v-model="form.fullMinus"
|
||||
placeholder="优惠金额"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.discountType == 'isFullRate'" label="优惠折扣" prop="fullRate">
|
||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullRate" placeholder="优惠折扣" clearable style="width: 280px" />
|
||||
<FormItem
|
||||
v-if="form.discountType == 'isFullRate'"
|
||||
label="优惠折扣"
|
||||
prop="fullRate"
|
||||
>
|
||||
<Input
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="text"
|
||||
v-model="form.fullRate"
|
||||
placeholder="优惠折扣"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
||||
</FormItem>
|
||||
<FormItem label="额外赠送">
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isFreeFreight">免邮费</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon">送优惠券</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift">送赠品</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-if="Cookies.get('userInfoSeller') && JSON.parse(Cookies.get('userInfoSeller')).selfOperated" v-model="form.isPoint">送积分</Checkbox>
|
||||
<Checkbox
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.isFreeFreight"
|
||||
>免邮费</Checkbox
|
||||
>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon"
|
||||
>送优惠券</Checkbox
|
||||
>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift"
|
||||
>送赠品</Checkbox
|
||||
>
|
||||
<Checkbox
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-if="
|
||||
Cookies.get('userInfoSeller') &&
|
||||
JSON.parse(Cookies.get('userInfoSeller')).selfOperated
|
||||
"
|
||||
v-model="form.isPoint"
|
||||
>送积分</Checkbox
|
||||
>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
|
||||
<Select v-model="form.couponId" :disabled="form.promotionStatus != 'NEW'" filterable :remote-method="getCouponList" placeholder="输入优惠券名称搜索" :loading="couponLoading" style="width: 280px">
|
||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{ item.couponName }}</Option>
|
||||
<Select
|
||||
v-model="form.couponId"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
filterable
|
||||
:remote-method="getCouponList"
|
||||
placeholder="输入优惠券名称搜索"
|
||||
:loading="couponLoading"
|
||||
style="width: 280px"
|
||||
>
|
||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{
|
||||
item.couponName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
||||
<Select :disabled="form.promotionStatus != 'NEW'" v-model="form.giftId" filterable :remote-method="getGiftList" placeholder="输入赠品名称搜索" :loading="giftLoading" style="width: 280px">
|
||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{ item.goodsName }}</Option>
|
||||
<Select
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.giftId"
|
||||
filterable
|
||||
:remote-method="getGiftList"
|
||||
placeholder="输入赠品名称搜索"
|
||||
:loading="giftLoading"
|
||||
style="width: 280px"
|
||||
>
|
||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{
|
||||
item.goodsName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
||||
<InputNumber :min="0" :disabled="form.promotionStatus != 'NEW'" v-model="form.point" type="number" style="width: 280px" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.point"
|
||||
type="number"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="使用范围" prop="scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL">全品类</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS">指定商品</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL"
|
||||
>全品类</Radio
|
||||
>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS"
|
||||
>指定商品</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<div style="display: flex; margin-bottom: 10px" v-if="form.promotionStatus == 'NEW'">
|
||||
<div
|
||||
style="display: flex; margin-bottom: 10px"
|
||||
v-if="form.promotionStatus == 'NEW'"
|
||||
>
|
||||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
|
||||
<img
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ index }" slot="action">
|
||||
<Button type="error" :disabled="form.promotionStatus != 'NEW' && id" size="small" ghost @click="delGoods(index)">删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
:disabled="form.promotionStatus != 'NEW' && id"
|
||||
size="small"
|
||||
ghost
|
||||
@click="delGoods(index)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<div>
|
||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||
<Button type="primary" :disabled="form.promotionStatus != 'NEW' && id" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="form.promotionStatus != 'NEW' && id"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,12 +234,11 @@ import { regular } from "@/utils";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
name: "addFullCut",
|
||||
name: "full-discount-add",
|
||||
components: {
|
||||
skuSelect
|
||||
skuSelect,
|
||||
},
|
||||
data() {
|
||||
|
||||
const checkPrice = (rule, value, callback) => {
|
||||
if (!value && value !== 0) {
|
||||
return callback(new Error("面额不能为空"));
|
||||
@@ -132,7 +263,8 @@ export default {
|
||||
};
|
||||
return {
|
||||
Cookies,
|
||||
form: { // 活动表单
|
||||
form: {
|
||||
// 活动表单
|
||||
discountType: "isFullMinus",
|
||||
scopeType: "ALL",
|
||||
promotionGoodsList: [],
|
||||
@@ -141,14 +273,12 @@ export default {
|
||||
id: this.$route.query.id, // 活动id
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectedGoods: [], // 已选商品列表,便于删除
|
||||
formRule: { // 验证规则
|
||||
formRule: {
|
||||
// 验证规则
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
rangeTime: [{ required: true, message: "请选择活动时间" }],
|
||||
description: [{ required: true, message: "请填写活动描述" }],
|
||||
price: [
|
||||
{ required: true, message: "请输入面额" },
|
||||
{ validator: checkPrice },
|
||||
],
|
||||
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||
consumptionLimit: [{ required: true, validator: checkWeight }],
|
||||
fullMoney: [{ required: true, validator: checkWeight }],
|
||||
fullMinus: [
|
||||
@@ -169,7 +299,8 @@ export default {
|
||||
couponList: [], // 店铺优惠券列表
|
||||
giftList: [], // 赠品列表
|
||||
giftLoading: false, // 请求赠品状态
|
||||
columns: [ // 表头
|
||||
columns: [
|
||||
// 表头
|
||||
{
|
||||
type: "selection",
|
||||
width: 60,
|
||||
@@ -185,10 +316,7 @@ export default {
|
||||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -225,12 +353,13 @@ export default {
|
||||
);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
openSkuList() { // 显示商品选择器
|
||||
openSkuList() {
|
||||
// 显示商品选择器
|
||||
this.$refs.skuSelect.open("goods");
|
||||
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList))
|
||||
data.forEach(e => {
|
||||
e.id = e.skuId
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList));
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
getDetail() {
|
||||
@@ -238,11 +367,8 @@ export default {
|
||||
getFullDiscountById(this.id).then((res) => {
|
||||
console.log(res);
|
||||
let data = res.result;
|
||||
if (data.number == -1) {
|
||||
if (data.scopeType === "ALL") {
|
||||
data.promotionGoodsList = [];
|
||||
data.scopeType = "ALL";
|
||||
} else {
|
||||
data.scopeType = "PORTION_GOODS";
|
||||
}
|
||||
if (data.isFullMinus) {
|
||||
data.discountType = "isFullMinus";
|
||||
@@ -262,19 +388,14 @@ export default {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
const strat = this.$options.filters.unixToDate(
|
||||
this.form.rangeTime[0] / 1000
|
||||
);
|
||||
const end = this.$options.filters.unixToDate(
|
||||
this.form.rangeTime[1] / 1000
|
||||
);
|
||||
const strat = this.$options.filters.unixToDate(this.form.rangeTime[0] / 1000);
|
||||
const end = this.$options.filters.unixToDate(this.form.rangeTime[1] / 1000);
|
||||
params.startTime = strat;
|
||||
params.endTime = end;
|
||||
|
||||
if (
|
||||
params.scopeType == "PORTION_GOODS" &&
|
||||
(!params.promotionGoodsList ||
|
||||
params.promotionGoodsList.length == 0)
|
||||
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
@@ -294,7 +415,6 @@ export default {
|
||||
} else {
|
||||
params.isFullRate = true;
|
||||
}
|
||||
delete params.scopeType;
|
||||
delete params.rangeTime;
|
||||
this.submitLoading = true;
|
||||
if (!this.id) {
|
||||
@@ -341,11 +461,9 @@ export default {
|
||||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -376,7 +494,7 @@ export default {
|
||||
pageNumber: 0,
|
||||
getType: "ACTIVITY",
|
||||
couponName: query,
|
||||
promotionStatus:"START"
|
||||
promotionStatus: "START",
|
||||
};
|
||||
this.couponLoading = true;
|
||||
getShopCouponList(params).then((res) => {
|
||||
@@ -422,8 +540,7 @@ h4 {
|
||||
margin-left: 10px;
|
||||
color: #999;
|
||||
}
|
||||
.ivu-form-item{
|
||||
.ivu-form-item {
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
<template>
|
||||
<div class="search">
|
||||
<Card>
|
||||
<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="活动名称">
|
||||
<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>
|
||||
@@ -14,7 +31,13 @@
|
||||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px">
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</Form-item>
|
||||
<Form-item>
|
||||
@@ -33,27 +56,58 @@
|
||||
{{ row.isFullMinus ? "满减" : "满折" }}
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="hours">
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{
|
||||
item
|
||||
}}</Tag>
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<div>
|
||||
<Button type="primary" v-if="row.promotionStatus == 'NEW'" size="small" @click="edit(row)">编辑</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button type="info" v-else size="small" @click="edit(row)">查看</Button>
|
||||
<Button type="success" v-if="row.promotionStatus === 'START'" style="margin-left:5px" size="small"
|
||||
@click="openOrClose(row)">关闭</Button>
|
||||
<Button type="success" v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left:5px" size="small" @click="openOrClose(row)">开启</Button>
|
||||
<Button type="error" :disabled="row.promotionStatus == 'START'" style="margin-left:5px" size="small"
|
||||
@click="del(row)">删除</Button>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus === 'START'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
:disabled="row.promotionStatus == 'START'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="del(row)"
|
||||
>删除</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="page operation">
|
||||
<Page :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>
|
||||
<Page
|
||||
: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>
|
||||
</Card>
|
||||
</div>
|
||||
@@ -145,7 +199,7 @@ export default {
|
||||
methods: {
|
||||
// 改变页码
|
||||
newAct() {
|
||||
this.$router.push({ name: "full-cut-detail" });
|
||||
this.$router.push({ name: "full-discount-detail" });
|
||||
},
|
||||
// 初始化数据
|
||||
init() {
|
||||
@@ -177,7 +231,7 @@ export default {
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.$router.push({ name: "full-cut-detail", query: { id: row.id } });
|
||||
this.$router.push({ name: "full-discount-detail", query: { id: row.id } });
|
||||
},
|
||||
// 删除
|
||||
del(row) {
|
||||
@@ -205,23 +259,70 @@ export default {
|
||||
if (row.promotionStatus === "START") {
|
||||
name = "关闭";
|
||||
status = "CLOSE";
|
||||
this.$Modal.confirm({
|
||||
title: "提示",
|
||||
// 记得确认修改此处
|
||||
content: `确认${name}此活动吗?需要一定时间才能生效,请耐心等待`,
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
updateFullDiscount(row.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(`${name}成功`);
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
let sTime = new Date();
|
||||
sTime.setMinutes(sTime.getMinutes() + 10);
|
||||
let eTime = new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
|
||||
this.openStartTime = sTime.getTime();
|
||||
this.openEndTime = eTime.getTime();
|
||||
this.$Modal.confirm({
|
||||
title: "确认开启(默认为当前时间的十分钟之后)",
|
||||
content: "您确认要开启此拼团活动?",
|
||||
onOk: () => {
|
||||
let params = {
|
||||
startTime: this.openStartTime,
|
||||
endTime: this.openEndTime,
|
||||
};
|
||||
updateFullDiscount(row.id, params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("开启活动成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
render: (h) => {
|
||||
return h("div", [
|
||||
h("DatePicker", {
|
||||
props: {
|
||||
type: "datetimerange",
|
||||
placeholder: "请选择开始时间和结束时间",
|
||||
value: [sTime, eTime],
|
||||
},
|
||||
style: {
|
||||
width: "350px",
|
||||
},
|
||||
on: {
|
||||
input: (val) => {
|
||||
if (val[0]) {
|
||||
this.openStartTime = val[0].getTime();
|
||||
}
|
||||
if (val[1]) {
|
||||
this.openEndTime = val[1].getTime();
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "提示",
|
||||
// 记得确认修改此处
|
||||
content: `确认${name}此活动吗?需要一定时间才能生效,请耐心等待`,
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
updateFullDiscount(row.id, status).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(`${name}成功`);
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取列表数据
|
||||
getDataList() {
|
||||
@@ -7,42 +7,79 @@
|
||||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button @click="delAll">批量删除</Button>
|
||||
<Button @click="getDataList" icon="md-refresh">刷新</Button>
|
||||
<Button type="dashed" @click="openTip = !openTip">{{ openTip ? "关闭提示" : "开启提示" }}</Button>
|
||||
<Button type="dashed" @click="openTip = !openTip">{{
|
||||
openTip ? "关闭提示" : "开启提示"
|
||||
}}</Button>
|
||||
</Row>
|
||||
<Row v-show="openTip" v-if="status == 'manager'">
|
||||
<Row v-show="openTip" v-if="status == 'manager'">
|
||||
<Alert show-icon>
|
||||
已选择 <span >{{ selectCount }}</span> 项
|
||||
已选择 <span>{{ selectCount }}</span> 项
|
||||
<a class="select-clear" @click="clearSelectAll">清空</a>
|
||||
</Alert>
|
||||
</Row>
|
||||
<h3 class="act-goods">活动商品</h3>
|
||||
<Table class="mt_10" :loading="loading" border :columns="goodsColumns" :data="goodsData" ref="table" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
class="mt_10"
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="goodsColumns"
|
||||
:data="goodsData"
|
||||
ref="table"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row, index }" slot="price">
|
||||
<Input v-model="row.price" :disabled="status==='view'" @input="goodsData[index].price = row.price" />
|
||||
<Input
|
||||
v-model="row.price"
|
||||
:disabled="status === 'view'"
|
||||
@input="goodsData[index].price = row.price"
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ index }" slot="action">
|
||||
<Button type="error" size="small" ghost v-if="status === 'manager'" @click="delGoods(index)">删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
ghost
|
||||
v-if="status === 'manager'"
|
||||
@click="delGoods(index)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="page operation">
|
||||
<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>
|
||||
<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>
|
||||
<Row class="operation">
|
||||
<Button @click="closeCurrentPage">返回</Button>
|
||||
<Button v-if="status == 'manager'" type="primary" :loading="submitLoading" @click="save">保存</Button>
|
||||
<Button
|
||||
v-if="status == 'manager'"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="save"
|
||||
>保存</Button
|
||||
>
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<sku-select ref="skuSelect" :goodsData="goodsData" @selectedGoodsData="selectedGoodsData"></sku-select>
|
||||
<sku-select
|
||||
ref="skuSelect"
|
||||
:goodsData="goodsData"
|
||||
@selectedGoodsData="selectedGoodsData"
|
||||
></sku-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getPintuanGoodsList,
|
||||
getPintuanDetail,
|
||||
editPintuan,
|
||||
} from "@/api/promotion.js";
|
||||
import { getPintuanGoodsList, getPintuanDetail, editPintuan } from "@/api/promotion.js";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
export default {
|
||||
components: {
|
||||
@@ -52,7 +89,8 @@ export default {
|
||||
return {
|
||||
openTip: true, // 显示提示
|
||||
loading: false, // 表单加载状态
|
||||
searchForm: { // 搜索框初始化对象
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 0, // 当前页数
|
||||
pageSize: 10, // 页面大小
|
||||
},
|
||||
@@ -63,7 +101,8 @@ export default {
|
||||
data: [], // 表单数据
|
||||
total: 0, // 表单数据总数
|
||||
status: this.$route.query.status, // 查看还是修改
|
||||
columns: [ // 活动详情表头
|
||||
columns: [
|
||||
// 活动详情表头
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
@@ -99,17 +138,12 @@ export default {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{props: {color: color}},
|
||||
text
|
||||
),
|
||||
]);
|
||||
return h("div", [h("Tag", { props: { color: color } }, text)]);
|
||||
},
|
||||
},
|
||||
],
|
||||
goodsColumns: [ // 活动商品表头
|
||||
goodsColumns: [
|
||||
// 活动商品表头
|
||||
{ type: "selection", width: 60, align: "center" },
|
||||
{
|
||||
title: "商品名称",
|
||||
@@ -177,23 +211,27 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
init() { // 初始化数据
|
||||
init() {
|
||||
// 初始化数据
|
||||
this.getDataList();
|
||||
this.getPintuanMsg();
|
||||
},
|
||||
|
||||
changePage(v) { // 分页 改变页数
|
||||
changePage(v) {
|
||||
// 分页 改变页数
|
||||
this.searchForm.pageNumber = v - 1;
|
||||
this.getDataList();
|
||||
this.clearSelectAll();
|
||||
},
|
||||
|
||||
changePageSize(v) { // 分页 改变每页数
|
||||
changePageSize(v) {
|
||||
// 分页 改变每页数
|
||||
this.searchForm.pageSize = v;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
handleSearch() { // 搜索
|
||||
handleSearch() {
|
||||
// 搜索
|
||||
this.searchForm.pageNumber = 0;
|
||||
this.searchForm.pageSize = 10;
|
||||
this.getDataList();
|
||||
@@ -207,7 +245,8 @@ export default {
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
clearSelectAll() { // 清空所有已选项
|
||||
clearSelectAll() {
|
||||
// 清空所有已选项
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
changeSelect(e) {
|
||||
@@ -216,7 +255,8 @@ export default {
|
||||
this.selectCount = e.length;
|
||||
},
|
||||
|
||||
getDataList() { // 获取商品列表
|
||||
getDataList() {
|
||||
// 获取商品列表
|
||||
this.loading = true;
|
||||
this.searchForm.pintuanId = this.$route.query.id;
|
||||
|
||||
@@ -228,15 +268,18 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
getPintuanMsg() { // 获取拼团详情
|
||||
getPintuanMsg() {
|
||||
// 获取拼团详情
|
||||
getPintuanDetail(this.$route.query.id).then((res) => {
|
||||
if (res.success) this.data.push(res.result);
|
||||
});
|
||||
},
|
||||
delGoods(index) { // 删除商品
|
||||
delGoods(index) {
|
||||
// 删除商品
|
||||
this.goodsData.splice(index, 1);
|
||||
},
|
||||
delAll() { // 批量删除商品
|
||||
delAll() {
|
||||
// 批量删除商品
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要删除的数据");
|
||||
return;
|
||||
@@ -255,34 +298,38 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
selectedGoodsData(item) { // 选择商品
|
||||
selectedGoodsData(item) {
|
||||
// 选择商品
|
||||
console.log(item);
|
||||
let list = [];
|
||||
item.forEach((e) => {
|
||||
list.push({
|
||||
goodsName: e.goodsName,
|
||||
price: e.price,
|
||||
originalPrice: e.price,
|
||||
quantity: e.quantity,
|
||||
storeId: e.storeId,
|
||||
sellerName: e.sellerName,
|
||||
thumbnail: e.thumbnail,
|
||||
skuId: e.id,
|
||||
categoryPath: e.categoryPath,
|
||||
});
|
||||
list.push({
|
||||
goodsName: e.goodsName,
|
||||
price: e.price,
|
||||
originalPrice: e.price,
|
||||
quantity: e.quantity,
|
||||
storeId: e.storeId,
|
||||
sellerName: e.sellerName,
|
||||
thumbnail: e.thumbnail,
|
||||
skuId: e.id,
|
||||
categoryPath: e.categoryPath,
|
||||
goodsId: e.goodsId,
|
||||
goodsType: e.goodsType,
|
||||
});
|
||||
});
|
||||
this.goodsData = list;
|
||||
},
|
||||
openSkuList() { // 显示商品选择器
|
||||
openSkuList() {
|
||||
// 显示商品选择器
|
||||
this.$refs.skuSelect.open("goods");
|
||||
let data = JSON.parse(JSON.stringify(this.goodsData))
|
||||
data.forEach(e => {
|
||||
e.id = e.skuId
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.goodsData));
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
@@ -294,8 +341,8 @@ export default {
|
||||
.act-goods {
|
||||
margin: 20px 0;
|
||||
font-size: 15px;
|
||||
&::before{
|
||||
content: '|';
|
||||
&::before {
|
||||
content: "|";
|
||||
color: $theme_color;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
@@ -2,7 +2,13 @@
|
||||
<div class="pintuan">
|
||||
<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"
|
||||
@@ -34,66 +40,64 @@
|
||||
style="width: 200px"
|
||||
></DatePicker>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn " icon="ios-search">搜索</Button>
|
||||
<Button
|
||||
@click="handleSearch"
|
||||
type="primary"
|
||||
class="search-btn"
|
||||
icon="ios-search"
|
||||
>搜索</Button
|
||||
>
|
||||
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
<Row class="operation padding-row">
|
||||
<Button @click="newAct" type="primary">添加</Button>
|
||||
</Row>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
ref="table"
|
||||
>
|
||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table">
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<div class="row">
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'manager')"
|
||||
>管理</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus !== 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'view')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus != 'START'"
|
||||
@click="remove(row)"
|
||||
>删除</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="
|
||||
row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'
|
||||
"
|
||||
size="small"
|
||||
@click="open(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="warning"
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
size="small"
|
||||
@click="close(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
<div class="row">
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'manager')"
|
||||
>管理</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus !== 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'view')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus != 'START'"
|
||||
@click="remove(row)"
|
||||
>删除</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'"
|
||||
size="small"
|
||||
@click="open(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="warning"
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
size="small"
|
||||
@click="close(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Table>
|
||||
@@ -116,12 +120,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPintuanList,
|
||||
deletePintuan,
|
||||
openPintuan,
|
||||
closePintuan,
|
||||
} from "@/api/promotion";
|
||||
import { getPintuanList, deletePintuan, editPintuanStatus } from "@/api/promotion";
|
||||
export default {
|
||||
name: "pintuan",
|
||||
data() {
|
||||
@@ -139,7 +138,7 @@ export default {
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
@@ -206,8 +205,8 @@ export default {
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.searchForm = {}
|
||||
this.selectDate = ''
|
||||
this.searchForm = {};
|
||||
this.selectDate = "";
|
||||
this.searchForm.pageNumber = 0;
|
||||
this.searchForm.pageSize = 10;
|
||||
this.getDataList();
|
||||
@@ -239,11 +238,11 @@ export default {
|
||||
},
|
||||
// 新建拼团
|
||||
newAct() {
|
||||
this.$router.push({ name: "new-pintuan" });
|
||||
this.$router.push({ name: "pintuan-edit" });
|
||||
},
|
||||
// 编辑拼团
|
||||
edit(v) {
|
||||
this.$router.push({ name: "new-pintuan", query: { id: v.id } });
|
||||
this.$router.push({ name: "pintuan-edit", query: { id: v.id } });
|
||||
},
|
||||
// 管理拼团商品
|
||||
manage(v, status) {
|
||||
@@ -251,15 +250,20 @@ export default {
|
||||
},
|
||||
// 手动开启拼团活动
|
||||
open(v) {
|
||||
let sTime = new Date();
|
||||
sTime.setMinutes(sTime.getMinutes() + 10);
|
||||
let eTime = new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
|
||||
this.openStartTime = sTime.getTime();
|
||||
this.openEndTime = eTime.getTime();
|
||||
this.$Modal.confirm({
|
||||
title: "确认开启",
|
||||
title: "确认开启(默认为当前时间的十分钟之后)",
|
||||
content: "您确认要开启此拼团活动?",
|
||||
onOk: () => {
|
||||
let params = {
|
||||
startTime: this.openStartTime,
|
||||
endTime: this.openEndTime,
|
||||
};
|
||||
openPintuan(v.id, params).then((res) => {
|
||||
editPintuanStatus(v.id, params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("开启活动成功");
|
||||
@@ -273,6 +277,7 @@ export default {
|
||||
props: {
|
||||
type: "datetimerange",
|
||||
placeholder: "请选择开始时间和结束时间",
|
||||
value: [sTime, eTime],
|
||||
},
|
||||
style: {
|
||||
width: "350px",
|
||||
@@ -299,7 +304,7 @@ export default {
|
||||
content: "您确认要关闭此拼团活动?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
closePintuan(v.id).then((res) => {
|
||||
editPintuanStatus(v.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("关闭活动成功");
|
||||
@@ -333,9 +338,9 @@ export default {
|
||||
},
|
||||
// 页面缓存处理,从该页面离开时,修改KeepAlive为false,保证进入该页面是刷新
|
||||
beforeRouteLeave(to, from, next) {
|
||||
from.meta.keepAlive = false
|
||||
next()
|
||||
}
|
||||
from.meta.keepAlive = false;
|
||||
next();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@@ -18,45 +18,90 @@
|
||||
</Row>
|
||||
<Row class="operation">
|
||||
<Tabs type="card" v-model="tabCurrent">
|
||||
<TabPane v-for="(tab, tabIndex) in goodsList" :key="tabIndex" :label="tab.hour" :name="tabIndex + ''">
|
||||
<Table :loading="loading" border :columns="goodsColumns" v-if="tabIndex == tabCurrent" :data="tab.list" :ref="'table' + tabIndex"
|
||||
@on-selection-change="changeSelect">
|
||||
<TabPane
|
||||
v-for="(tab, tabIndex) in goodsList"
|
||||
:key="tabIndex"
|
||||
:label="tab.hour"
|
||||
:name="tabIndex + ''"
|
||||
>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="goodsColumns"
|
||||
v-if="tabIndex == tabCurrent"
|
||||
:data="tab.list"
|
||||
:ref="'table' + tabIndex"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="originalPrice">
|
||||
|
||||
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="quantity">
|
||||
<InputNumber :min="0" v-model="row.quantity" :disabled="row.promotionApplyStatus == 'PASS'" @input="
|
||||
goodsList[tabIndex].list[index].quantity = row.quantity
|
||||
" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
v-model="row.quantity"
|
||||
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].quantity = row.quantity"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="price">
|
||||
<InputNumber :min="0" style="width:100%;" v-model="row.price" :disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].price = row.price" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.price"
|
||||
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].price = row.price"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row }" slot="promotionApplyStatus">
|
||||
<Badge status="success" v-if="row.promotionApplyStatus == 'PASS'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge status="blue" v-if="row.promotionApplyStatus == 'APPLY'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge status="error" v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<span v-if="row.promotionApplyStatus == 'REFUSE'" @click="showReason(row.failReason)"
|
||||
class="reason">(拒绝原因)</span>
|
||||
<Badge status="error" v-if="row.promotionApplyStatus == ''"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge
|
||||
status="success"
|
||||
v-if="row.promotionApplyStatus == 'PASS'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="blue"
|
||||
v-if="row.promotionApplyStatus == 'APPLY'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="error"
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<span
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
@click="showReason(row.failReason)"
|
||||
class="reason"
|
||||
>(拒绝原因)</span
|
||||
>
|
||||
<Badge
|
||||
status="error"
|
||||
v-if="row.promotionApplyStatus == ''"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img v-if="row.QRCode" :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px"
|
||||
alt="" />
|
||||
<img
|
||||
v-if="row.QRCode"
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ row, index }" slot="action">
|
||||
<Button type="error" v-if="promotionStatus === 'NEW'" size="small" ghost
|
||||
@click="delGoods(index, row)">删除
|
||||
<Button
|
||||
type="error"
|
||||
v-if="promotionStatus === 'NEW'"
|
||||
size="small"
|
||||
ghost
|
||||
@click="delGoods(index, row)"
|
||||
>删除
|
||||
</Button>
|
||||
</template>
|
||||
</Table>
|
||||
@@ -66,7 +111,12 @@
|
||||
|
||||
<Row class="operation">
|
||||
<Button @click="closeCurrentPage">返回</Button>
|
||||
<Button type="primary" :loading="submitLoading" v-if="promotionStatus === 'NEW'" @click="save">提交
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
v-if="promotionStatus === 'NEW'"
|
||||
@click="save"
|
||||
>提交
|
||||
</Button>
|
||||
</Row>
|
||||
</Card>
|
||||
@@ -87,14 +137,14 @@ export default {
|
||||
components: {
|
||||
skuSelect,
|
||||
},
|
||||
watch:{
|
||||
tabCurrent(val){
|
||||
this.tabIndex = val
|
||||
}
|
||||
watch: {
|
||||
tabCurrent(val) {
|
||||
this.tabIndex = val;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabCurrent:0,
|
||||
tabCurrent: 0,
|
||||
promotionStatus: "", // 活动状态
|
||||
loading: false, // 表单加载状态
|
||||
searchForm: {
|
||||
@@ -292,10 +342,9 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
this.$set(this.goodsList[this.tabIndex], "list", [
|
||||
...way,
|
||||
...this.defaultGoodsList,
|
||||
// ...this.defaultGoodsList,
|
||||
]);
|
||||
// this.$nextTick(() => {
|
||||
// this.$forceUpdate();
|
||||
@@ -305,14 +354,11 @@ export default {
|
||||
// 显示商品选择器
|
||||
|
||||
this.$refs.skuSelect.open("goods");
|
||||
this.$refs.skuSelect.selectedWay = [];
|
||||
console.warn(this.goodsList[this.tabIndex].list);
|
||||
let data = this.goodsList[this.tabIndex].list;
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.selectedWay = data;
|
||||
console.log(this.$refs.skuSelect.selectedWay);
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
unixDate(time) {
|
||||
// 处理报名截止时间
|
||||
Reference in New Issue
Block a user