适配重构促销
parent
fd1d32d431
commit
edef393535
|
@ -19,7 +19,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="goodsConfig mt_10">
|
<div class="goodsConfig mt_10">
|
||||||
<span @click="collect" ><Icon type="ios-heart" :color="isCollected ? '#ed3f14' : '#666'" />{{isCollected?'已收藏':'收藏'}}</span>
|
<span @click="collect"
|
||||||
|
><Icon type="ios-heart" :color="isCollected ? '#ed3f14' : '#666'" />{{
|
||||||
|
isCollected ? "已收藏" : "收藏"
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 右侧商品信息、活动信息、操作展示 -->
|
<!-- 右侧商品信息、活动信息、操作展示 -->
|
||||||
|
@ -30,10 +34,13 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="sell-point">
|
<div class="sell-point">
|
||||||
{{skuDetail.sellingPoint}}
|
{{ skuDetail.sellingPoint }}
|
||||||
</div>
|
</div>
|
||||||
<!-- 限时秒杀 -->
|
<!-- 限时秒杀 -->
|
||||||
<Promotion v-if="promotionMap['SECKILL']" :time="promotionMap['SECKILL'].endTime"></Promotion>
|
<Promotion
|
||||||
|
v-if="promotionMap['SECKILL']"
|
||||||
|
:time="promotionMap['SECKILL'].endTime"
|
||||||
|
></Promotion>
|
||||||
<!-- 商品详细 价格、优惠券、促销 -->
|
<!-- 商品详细 价格、优惠券、促销 -->
|
||||||
<div class="item-detail-price-row">
|
<div class="item-detail-price-row">
|
||||||
<div class="item-price-left">
|
<div class="item-price-left">
|
||||||
|
@ -41,19 +48,25 @@
|
||||||
<div class="item-price-row" v-if="!skuDetail.promotionPrice">
|
<div class="item-price-row" v-if="!skuDetail.promotionPrice">
|
||||||
<p>
|
<p>
|
||||||
<span class="item-price-title">价 格</span>
|
<span class="item-price-title">价 格</span>
|
||||||
<span class="item-price">{{skuDetail.price | unitPrice("¥")}}</span>
|
<span class="item-price">{{ skuDetail.price | unitPrice("¥") }}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- 秒杀价格 -->
|
<!-- 秒杀价格 -->
|
||||||
<div class="item-price-row" v-if="skuDetail.promotionPrice">
|
<div class="item-price-row" v-if="skuDetail.promotionPrice">
|
||||||
<p>
|
<p>
|
||||||
<span class="item-price-title" v-if="promotionMap['SECKILL']">秒 杀 价</span>
|
<span class="item-price-title" v-if="promotionMap['SECKILL']"
|
||||||
<span class="item-price">{{skuDetail.promotionPrice | unitPrice("¥")}}</span>
|
>秒 杀 价</span
|
||||||
<span class="item-price-old">{{skuDetail.price | unitPrice("¥")}}</span>
|
>
|
||||||
|
<span class="item-price">{{
|
||||||
|
skuDetail.promotionPrice | unitPrice("¥")
|
||||||
|
}}</span>
|
||||||
|
<span class="item-price-old">{{
|
||||||
|
skuDetail.price | unitPrice("¥")
|
||||||
|
}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- 优惠券展示 -->
|
<!-- 优惠券展示 -->
|
||||||
<div class="item-price-row" v-if="promotionMap['COUPON'].length">
|
<div class="item-price-row" v-if="promotionMap['COUPON'].length">
|
||||||
<p>
|
<p>
|
||||||
<span class="item-price-title">优 惠 券</span>
|
<span class="item-price-title">优 惠 券</span>
|
||||||
<span
|
<span
|
||||||
|
@ -61,10 +74,14 @@
|
||||||
v-for="(item, index) in promotionMap['COUPON']"
|
v-for="(item, index) in promotionMap['COUPON']"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="receiveCoupon(item.id)"
|
@click="receiveCoupon(item.id)"
|
||||||
|
>
|
||||||
|
<span v-if="item.couponType == 'PRICE'"
|
||||||
|
>满{{ item.consumeThreshold }}减{{ item.price }}</span
|
||||||
>
|
>
|
||||||
<span v-if="item.couponType == 'PRICE'">满{{ item.consumeThreshold }}减{{item.price}}</span>
|
<span v-if="item.couponType == 'DISCOUNT'"
|
||||||
<span v-if="item.couponType == 'DISCOUNT'">满{{ item.consumeThreshold }}打{{item.couponDiscount}}折</span>
|
>满{{ item.consumeThreshold }}打{{ item.couponDiscount }}折</span
|
||||||
</span>
|
>
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- 满减展示 -->
|
<!-- 满减展示 -->
|
||||||
|
@ -72,8 +89,20 @@
|
||||||
<p>
|
<p>
|
||||||
<span class="item-price-title">促 销</span>
|
<span class="item-price-title">促 销</span>
|
||||||
<span class="item-promotion">满减</span>
|
<span class="item-promotion">满减</span>
|
||||||
<span class="item-desc-pintuan" v-if="promotionMap['FULL_DISCOUNT'].fullMinus">满{{ promotionMap['FULL_DISCOUNT'].fullMoney }}元,立减现金{{ promotionMap['FULL_DISCOUNT'].fullMinus}}元</span>
|
<span
|
||||||
<span class="item-desc-pintuan" v-if="promotionMap['FULL_DISCOUNT'].fullRate">满{{ promotionMap['FULL_DISCOUNT'].fullMoney }}元,立享{{ promotionMap['FULL_DISCOUNT'].fullRate}}折</span>
|
class="item-desc-pintuan"
|
||||||
|
v-if="promotionMap['FULL_DISCOUNT'].fullMinus"
|
||||||
|
>满{{ promotionMap["FULL_DISCOUNT"].fullMoney }}元,立减现金{{
|
||||||
|
promotionMap["FULL_DISCOUNT"].fullMinus
|
||||||
|
}}元</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="item-desc-pintuan"
|
||||||
|
v-if="promotionMap['FULL_DISCOUNT'].fullRate"
|
||||||
|
>满{{ promotionMap["FULL_DISCOUNT"].fullMoney }}元,立享{{
|
||||||
|
promotionMap["FULL_DISCOUNT"].fullRate
|
||||||
|
}}折</span
|
||||||
|
>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -92,9 +121,13 @@
|
||||||
<p>{{ sku.name }}</p>
|
<p>{{ sku.name }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-select-column">
|
<div class="item-select-column">
|
||||||
<div class="item-select-row" v-for="(item) in sku.values" :key="item.value">
|
<div class="item-select-row" v-for="item in sku.values" :key="item.value">
|
||||||
<div class="item-select-box" @click="select(index, item.value)"
|
<div
|
||||||
:class="{ 'item-select-box-active': item.value === currentSelceted[index] }"
|
class="item-select-box"
|
||||||
|
@click="select(index, item.value)"
|
||||||
|
:class="{
|
||||||
|
'item-select-box-active': item.value === currentSelceted[index],
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div class="item-select-intro">
|
<div class="item-select-intro">
|
||||||
<p>{{ item.value }}</p>
|
<p>{{ item.value }}</p>
|
||||||
|
@ -110,26 +143,57 @@
|
||||||
<p>数量</p>
|
<p>数量</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-select-row">
|
<div class="item-select-row">
|
||||||
<InputNumber :min="1" :disabled="skuDetail.quantity === 0" v-model="count"></InputNumber>
|
<InputNumber
|
||||||
<span class="inventory"> 库存{{skuDetail.quantity}}</span>
|
:min="1"
|
||||||
|
:disabled="skuDetail.quantity === 0"
|
||||||
|
v-model="count"
|
||||||
|
></InputNumber>
|
||||||
|
<span class="inventory"> 库存{{ skuDetail.quantity }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-select" v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS' && skuDetail.weight !== 0">
|
<div
|
||||||
|
class="item-select"
|
||||||
|
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS' && skuDetail.weight !== 0"
|
||||||
|
>
|
||||||
<div class="item-select-title">
|
<div class="item-select-title">
|
||||||
<p>重量</p>
|
<p>重量</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-select-row">
|
<div class="item-select-row">
|
||||||
<span class="inventory"> {{skuDetail.weight}}kg</span>
|
<span class="inventory"> {{ skuDetail.weight }}kg</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="add-buy-car" v-if="$route.query.way === 'POINT' && skuDetail.isAuth === 'PASS'">
|
<div
|
||||||
<Button type="error" :loading="loading" :disabled="skuDetail.quantity === 0" @click="pointPay">积分购买</Button>
|
class="add-buy-car"
|
||||||
|
v-if="$route.query.way === 'POINT' && skuDetail.isAuth === 'PASS'"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="error"
|
||||||
|
:loading="loading"
|
||||||
|
:disabled="skuDetail.quantity === 0"
|
||||||
|
@click="pointPay"
|
||||||
|
>积分购买</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="add-buy-car" v-if="$route.query.way !== 'POINT' && skuDetail.isAuth === 'PASS'">
|
<div
|
||||||
<Button type="error" v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'" :loading="loading" :disabled="skuDetail.quantity === 0" @click="addShoppingCartBtn">加入购物车</Button>
|
class="add-buy-car"
|
||||||
<Button type="warning" :loading="loading1" :disabled="skuDetail.quantity === 0" @click="buyNow">立即购买</Button>
|
v-if="$route.query.way !== 'POINT' && skuDetail.isAuth === 'PASS'"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="error"
|
||||||
|
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'"
|
||||||
|
:loading="loading"
|
||||||
|
:disabled="skuDetail.quantity === 0"
|
||||||
|
@click="addShoppingCartBtn"
|
||||||
|
>加入购物车</Button
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="warning"
|
||||||
|
:loading="loading1"
|
||||||
|
:disabled="skuDetail.quantity === 0"
|
||||||
|
@click="buyNow"
|
||||||
|
>立即购买</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -137,20 +201,25 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Promotion from './Promotion.vue';
|
import Promotion from "./Promotion.vue";
|
||||||
import PicZoom from 'vue-piczoom'; // 图片放大
|
import PicZoom from "vue-piczoom"; // 图片放大
|
||||||
import { collectGoods, isCollection, receiveCoupon, cancelCollect } from '@/api/member.js';
|
import {
|
||||||
import { addCartGoods } from '@/api/cart.js';
|
collectGoods,
|
||||||
|
isCollection,
|
||||||
|
receiveCoupon,
|
||||||
|
cancelCollect,
|
||||||
|
} from "@/api/member.js";
|
||||||
|
import { addCartGoods } from "@/api/cart.js";
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowGoods',
|
name: "ShowGoods",
|
||||||
props: {
|
props: {
|
||||||
// 商品数据
|
// 商品数据
|
||||||
detail: {
|
detail: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
count: 1, // 商品数量
|
count: 1, // 商品数量
|
||||||
imgIndex: 0, // 展示图片下标
|
imgIndex: 0, // 展示图片下标
|
||||||
|
@ -158,24 +227,26 @@ export default {
|
||||||
imgList: [{}], // 商品图片列表
|
imgList: [{}], // 商品图片列表
|
||||||
skuDetail: this.detail.data, // sku详情
|
skuDetail: this.detail.data, // sku详情
|
||||||
goodsSpecList: this.detail.specs, // 商品spec
|
goodsSpecList: this.detail.specs, // 商品spec
|
||||||
promotionMap: { // 活动状态
|
promotionMap: {
|
||||||
|
// 活动状态
|
||||||
SECKILL: null,
|
SECKILL: null,
|
||||||
FULL_DISCOUNT: null,
|
FULL_DISCOUNT: null,
|
||||||
COUPON: []
|
COUPON: [],
|
||||||
}, // 促销活动
|
}, // 促销活动
|
||||||
formatList: [], // 选择商品品类的数组
|
formatList: [], // 选择商品品类的数组
|
||||||
loading: false, // 立即购买loading
|
loading: false, // 立即购买loading
|
||||||
loading1: false, // 加入购物车loading
|
loading1: false, // 加入购物车loading
|
||||||
isCollected: false // 是否收藏
|
isCollected: false, // 是否收藏
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: { PicZoom, Promotion },
|
components: { PicZoom, Promotion },
|
||||||
methods: {
|
methods: {
|
||||||
select (index, value) { // 选择规格
|
select(index, value) {
|
||||||
|
// 选择规格
|
||||||
this.$set(this.currentSelceted, index, value);
|
this.$set(this.currentSelceted, index, value);
|
||||||
let selectedSkuId = this.goodsSpecList.find((i) => {
|
let selectedSkuId = this.goodsSpecList.find((i) => {
|
||||||
let matched = true;
|
let matched = true;
|
||||||
let specValues = i.specValues.filter((j) => j.specName !== 'images');
|
let specValues = i.specValues.filter((j) => j.specName !== "images");
|
||||||
for (let n = 0; n < specValues.length; n++) {
|
for (let n = 0; n < specValues.length; n++) {
|
||||||
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
||||||
matched = false;
|
matched = false;
|
||||||
|
@ -187,76 +258,86 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/goodsDetail',
|
path: "/goodsDetail",
|
||||||
query: { skuId: selectedSkuId.skuId, goodsId: this.skuDetail.goodsId }
|
query: { skuId: selectedSkuId.skuId, goodsId: this.skuDetail.goodsId },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addShoppingCartBtn () { // 添加购物车
|
addShoppingCartBtn() {
|
||||||
const params = {
|
// 添加购物车
|
||||||
num: this.count,
|
|
||||||
skuId: this.skuDetail.id
|
|
||||||
};
|
|
||||||
this.loading = true;
|
|
||||||
addCartGoods(params).then(res => {
|
|
||||||
this.loading = false;
|
|
||||||
if (res.success) {
|
|
||||||
this.$router.push({path: '/shoppingCart', query: {detail: this.skuDetail, count: this.count}});
|
|
||||||
} else {
|
|
||||||
this.$Message.warning(res.message);
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buyNow () { // 立即购买
|
|
||||||
const params = {
|
const params = {
|
||||||
num: this.count,
|
num: this.count,
|
||||||
skuId: this.skuDetail.id,
|
skuId: this.skuDetail.id,
|
||||||
cartType: 'BUY_NOW'
|
};
|
||||||
|
this.loading = true;
|
||||||
|
addCartGoods(params)
|
||||||
|
.then((res) => {
|
||||||
|
this.loading = false;
|
||||||
|
if (res.success) {
|
||||||
|
this.$router.push({
|
||||||
|
path: "/shoppingCart",
|
||||||
|
query: { detail: this.skuDetail, count: this.count },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$Message.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buyNow() {
|
||||||
|
// 立即购买
|
||||||
|
const params = {
|
||||||
|
num: this.count,
|
||||||
|
skuId: this.skuDetail.id,
|
||||||
|
cartType: "BUY_NOW",
|
||||||
};
|
};
|
||||||
// 虚拟商品购买
|
// 虚拟商品购买
|
||||||
if (this.skuDetail.goodsType === 'VIRTUAL_GOODS') {
|
if (this.skuDetail.goodsType === "VIRTUAL_GOODS") {
|
||||||
params.cartType = 'VIRTUAL'
|
params.cartType = "VIRTUAL";
|
||||||
}
|
}
|
||||||
this.loading1 = true;
|
this.loading1 = true;
|
||||||
addCartGoods(params).then(res => {
|
addCartGoods(params)
|
||||||
this.loading1 = false;
|
.then((res) => {
|
||||||
if (res.success) {
|
this.loading1 = false;
|
||||||
this.$router.push({path: '/pay', query: {way: params.cartType}});
|
if (res.success) {
|
||||||
} else {
|
this.$router.push({ path: "/pay", query: { way: params.cartType } });
|
||||||
this.$Message.warning(res.message);
|
} else {
|
||||||
}
|
this.$Message.warning(res.message);
|
||||||
}).catch(() => {
|
}
|
||||||
this.loading1 = false;
|
})
|
||||||
});
|
.catch(() => {
|
||||||
|
this.loading1 = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
async collect () { // 收藏商品
|
async collect() {
|
||||||
|
// 收藏商品
|
||||||
if (this.isCollected) {
|
if (this.isCollected) {
|
||||||
let cancel = await cancelCollect('GOODS', this.skuDetail.id)
|
let cancel = await cancelCollect("GOODS", this.skuDetail.id);
|
||||||
if (cancel.success) {
|
if (cancel.success) {
|
||||||
this.$Message.success('取消收藏成功')
|
this.$Message.success("取消收藏成功");
|
||||||
this.isCollected = false
|
this.isCollected = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let collect = await collectGoods('GOODS', this.skuDetail.id);
|
let collect = await collectGoods("GOODS", this.skuDetail.id);
|
||||||
if (collect.code === 200) {
|
if (collect.code === 200) {
|
||||||
this.isCollected = true;
|
this.isCollected = true;
|
||||||
this.$Message.success('收藏商品成功,可以前往个人中心我的收藏查看');
|
this.$Message.success("收藏商品成功,可以前往个人中心我的收藏查看");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 格式化数据
|
// 格式化数据
|
||||||
formatSku (list) {
|
formatSku(list) {
|
||||||
let arr = [{}];
|
let arr = [{}];
|
||||||
list.forEach((item, index) => {
|
list.forEach((item, index) => {
|
||||||
item.specValues.forEach((spec, specIndex) => {
|
item.specValues.forEach((spec, specIndex) => {
|
||||||
let name = spec.specName;
|
let name = spec.specName;
|
||||||
let values = {
|
let values = {
|
||||||
value: spec.specValue,
|
value: spec.specValue,
|
||||||
quantity: item.quantity
|
quantity: item.quantity,
|
||||||
};
|
};
|
||||||
if (name === 'images') {
|
if (name === "images") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +356,7 @@ export default {
|
||||||
if (!keys.includes(name)) {
|
if (!keys.includes(name)) {
|
||||||
arr.push({
|
arr.push({
|
||||||
name: name,
|
name: name,
|
||||||
values: [values]
|
values: [values],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -286,55 +367,67 @@ export default {
|
||||||
|
|
||||||
let cur = list.filter((i) => i.skuId === this.$route.query.skuId)[0];
|
let cur = list.filter((i) => i.skuId === this.$route.query.skuId)[0];
|
||||||
if (cur) {
|
if (cur) {
|
||||||
cur.specValues.filter((i) => i.specName !== 'images')
|
cur.specValues
|
||||||
|
.filter((i) => i.specName !== "images")
|
||||||
.forEach((value, _index) => {
|
.forEach((value, _index) => {
|
||||||
this.currentSelceted[_index] = value.specValue;
|
this.currentSelceted[_index] = value.specValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.skuList = list;
|
this.skuList = list;
|
||||||
},
|
},
|
||||||
receiveCoupon (id) { // 领取优惠券
|
receiveCoupon(id) {
|
||||||
receiveCoupon(id).then(res => {
|
// 领取优惠券
|
||||||
|
receiveCoupon(id).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('优惠券领取成功')
|
this.$Message.success("优惠券领取成功");
|
||||||
} else {
|
} else {
|
||||||
this.$Message.warning(res.message)
|
this.$Message.warning(res.message);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
promotion () { // 格式化促销活动,返回当前促销的对象
|
promotion() {
|
||||||
|
// 格式化促销活动,返回当前促销的对象
|
||||||
if (!this.detail.promotionMap) return false;
|
if (!this.detail.promotionMap) return false;
|
||||||
let keysArr = Object.keys(this.detail.promotionMap);
|
let keysArr = Object.keys(this.detail.promotionMap);
|
||||||
if (keysArr.length === 0) return false;
|
if (keysArr.length === 0) return false;
|
||||||
|
|
||||||
for (let i = 0; i < keysArr.length; i++) {
|
for (let i = 0; i < keysArr.length; i++) {
|
||||||
let key = keysArr[i].split('-')[0]
|
let key = keysArr[i].split("-")[0];
|
||||||
if (key === 'COUPON') {
|
if (
|
||||||
this.promotionMap[key].push(this.detail.promotionMap[keysArr[i]])
|
(new Date(this.detail.promotionMap[keysArr[i]].startTime).getTime >
|
||||||
|
new Date().getTime() &&
|
||||||
|
new Date(this.detail.promotionMap[keysArr[i]].endTime).getTime <
|
||||||
|
new Date().getTime()) ||
|
||||||
|
this.detail.promotionMap[keysArr[i]].getType !== "FREE"
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (key === "COUPON") {
|
||||||
|
this.promotionMap[key].push(this.detail.promotionMap[keysArr[i]]);
|
||||||
} else {
|
} else {
|
||||||
this.promotionMap[key] = this.detail.promotionMap[keysArr[i]]
|
this.promotionMap[key] = this.detail.promotionMap[keysArr[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
// 用户登录才会判断是否收藏
|
// 用户登录才会判断是否收藏
|
||||||
if (this.Cookies.getItem('userInfo')) {
|
if (this.Cookies.getItem("userInfo")) {
|
||||||
isCollection('GOODS', this.skuDetail.id).then(res => {
|
isCollection("GOODS", this.skuDetail.id).then((res) => {
|
||||||
if (res.success && res.result) {
|
if (res.success && res.result) {
|
||||||
this.isCollected = true;
|
this.isCollected = true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.detail.data.specList.forEach(e => {
|
this.detail.data.specList.forEach((e) => {
|
||||||
if (e.specName === 'images') {
|
if (e.specName === "images") {
|
||||||
this.imgList = e.specImage
|
this.imgList = e.specImage;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.formatSku(this.goodsSpecList);
|
this.formatSku(this.goodsSpecList);
|
||||||
this.promotion()
|
this.promotion();
|
||||||
document.title = this.skuDetail.goodsName
|
document.title = this.skuDetail.goodsName;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -346,7 +439,6 @@ export default {
|
||||||
}
|
}
|
||||||
.inventory {
|
.inventory {
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.global_color {
|
.global_color {
|
||||||
|
@ -597,7 +689,7 @@ export default {
|
||||||
|
|
||||||
.add-buy-car {
|
.add-buy-car {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
>*{
|
> * {
|
||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +699,7 @@ export default {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
> span {
|
> span {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
&:hover{
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
<!-- LOGO 搜索 -->
|
<!-- LOGO 搜索 -->
|
||||||
<div class="width_1200 logo">
|
<div class="width_1200 logo">
|
||||||
<div>
|
<div>
|
||||||
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
|
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
|
||||||
<div>
|
<div>
|
||||||
购物车(<span>{{ goodsTotal }}</span>)
|
购物车(<span>{{ goodsTotal }}</span
|
||||||
|
>)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Search :showTag="false" :showLogo="false"></Search>
|
<Search :showTag="false" :showLogo="false"></Search>
|
||||||
|
@ -17,9 +18,15 @@
|
||||||
<div class="available-area">
|
<div class="available-area">
|
||||||
<div class="cart-steps">
|
<div class="cart-steps">
|
||||||
<span :class="stepIndex == 0 ? 'active' : ''">1.我的购物车</span>
|
<span :class="stepIndex == 0 ? 'active' : ''">1.我的购物车</span>
|
||||||
<Icon :class="stepIndex == 0 ? 'active-arrow' : ''" custom="icomoon icon-next"></Icon>
|
<Icon
|
||||||
|
:class="stepIndex == 0 ? 'active-arrow' : ''"
|
||||||
|
custom="icomoon icon-next"
|
||||||
|
></Icon>
|
||||||
<span :class="stepIndex == 1 ? 'active' : ''">2.填写订单信息</span>
|
<span :class="stepIndex == 1 ? 'active' : ''">2.填写订单信息</span>
|
||||||
<Icon :class="stepIndex == 1 ? 'active-arrow' : ''" custom="icomoon icon-next"></Icon>
|
<Icon
|
||||||
|
:class="stepIndex == 1 ? 'active-arrow' : ''"
|
||||||
|
custom="icomoon icon-next"
|
||||||
|
></Icon>
|
||||||
<span :class="stepIndex == 2 ? 'active' : ''">3.成功提交订单</span>
|
<span :class="stepIndex == 2 ? 'active' : ''">3.成功提交订单</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +34,9 @@
|
||||||
<div class="cart-goods">
|
<div class="cart-goods">
|
||||||
<div class="cart-goods-title">
|
<div class="cart-goods-title">
|
||||||
<div class="width_60">
|
<div class="width_60">
|
||||||
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')">全选</Checkbox>
|
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
|
||||||
|
>全选</Checkbox
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="goods-title">商品</div>
|
<div class="goods-title">商品</div>
|
||||||
<div class="width_150">单价(元)</div>
|
<div class="width_150">单价(元)</div>
|
||||||
|
@ -39,83 +48,140 @@
|
||||||
<p>购物车空空如也</p>
|
<p>购物车空空如也</p>
|
||||||
<router-link to="/">去选购></router-link>
|
<router-link to="/">去选购></router-link>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="cart-goods-items" v-for="(shop, index) in cartList" :key="index">
|
<div
|
||||||
|
v-else
|
||||||
|
class="cart-goods-items"
|
||||||
|
v-for="(shop, index) in cartList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<div class="shop-name">
|
<div class="shop-name">
|
||||||
<div>
|
<div>
|
||||||
<Checkbox v-model="shop.checked" @on-change="changeChecked(shop.checked, 'shop', shop.storeId)"></Checkbox>
|
<Checkbox
|
||||||
<span class="go-shop-page" @click="goShopPage(shop.storeId)">{{shop.storeName}}</span>
|
v-model="shop.checked"
|
||||||
|
@on-change="changeChecked(shop.checked, 'shop', shop.storeId)"
|
||||||
|
></Checkbox>
|
||||||
|
<span class="go-shop-page" @click="goShopPage(shop.storeId)">{{
|
||||||
|
shop.storeName
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="shop-coupon" v-if="shop.couponList.length" :class="couponAvailable === index ? 'shop-coupon-show' : ''" @click.stop="showCoupon(shop.id, index)">
|
<span
|
||||||
|
class="shop-coupon"
|
||||||
|
v-if="shop.couponList.length"
|
||||||
|
:class="couponAvailable === index ? 'shop-coupon-show' : ''"
|
||||||
|
@click.stop="showCoupon(shop.id, index)"
|
||||||
|
>
|
||||||
<!-- 优惠券模态框 -->
|
<!-- 优惠券模态框 -->
|
||||||
<div v-if="couponAvailable === index">
|
<div v-if="couponAvailable === index">
|
||||||
<div class="coupon-item" v-for="(item, index) in shop.couponList" :key="index">
|
<div
|
||||||
|
class="coupon-item"
|
||||||
|
v-for="(item, index) in shop.couponList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<span v-if="item.couponType === 'PRICE'">¥{{ item.price }}</span>
|
<span v-if="item.couponType === 'PRICE'">¥{{ item.price }}</span>
|
||||||
<span v-if="item.couponType === 'DISCOUNT'">{{ item.couponDiscount }}折</span>
|
<span v-if="item.couponType === 'DISCOUNT'"
|
||||||
<span>满{{item.consumeThreshold}}元可用</span>
|
>{{ item.couponDiscount }}折</span
|
||||||
<Button class="coupon-btn" size="small" type="primary" @click="receiveShopCoupon(item)" :disabled="item.disabled">{{ item.disabled ? "已领取" : "领取" }}</Button>
|
>
|
||||||
|
<span>满{{ item.consumeThreshold }}元可用</span>
|
||||||
|
<Button
|
||||||
|
class="coupon-btn"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
@click="receiveShopCoupon(item)"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
>{{ item.disabled ? "已领取" : "领取" }}</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<div class="promotion-notice">{{shop.promotionNotice}}</div>
|
<div class="promotion-notice">{{ shop.promotionNotice }}</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-for="(goods, goodsIndex) in shop.skuList">
|
<template v-for="(goods, goodsIndex) in shop.skuList">
|
||||||
<div class="goods-item" :key="goodsIndex">
|
<div class="goods-item" :key="goodsIndex">
|
||||||
<div class="width_60">
|
<div class="width_60">
|
||||||
<Checkbox v-model="goods.checked" @on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"></Checkbox>
|
<Checkbox
|
||||||
|
v-model="goods.checked"
|
||||||
|
@on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"
|
||||||
|
></Checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div class="goods-title" @click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)">
|
<div
|
||||||
<img :src="
|
class="goods-title"
|
||||||
goods.goodsSku.thumbnail || '../assets/images/goodsDetail/item-detail-1.jpg'
|
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
|
||||||
" />
|
>
|
||||||
|
<img
|
||||||
|
:src="
|
||||||
|
goods.goodsSku.thumbnail ||
|
||||||
|
'../assets/images/goodsDetail/item-detail-1.jpg'
|
||||||
|
"
|
||||||
|
/>
|
||||||
<div>
|
<div>
|
||||||
<p>{{ goods.goodsSku.goodsName }}</p>
|
<p>{{ goods.goodsSku.goodsName }}</p>
|
||||||
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
||||||
<div class="promotion" :key="promotionIndex" v-if="promotion.promotionType === 'SECKILL'">
|
<div
|
||||||
|
class="promotion"
|
||||||
|
:key="promotionIndex"
|
||||||
|
v-if="promotion.promotionType === 'SECKILL'"
|
||||||
|
>
|
||||||
<span>秒杀</span>
|
<span>秒杀</span>
|
||||||
<promotion :time="promotion.endTime" type="cart"></promotion>
|
<promotion :time="promotion.endTime" type="cart"></promotion>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
||||||
<div class="promotion" :key="promotionIndex" v-if="promotion.promotionType === 'FULL_DISCOUNT'">
|
<div
|
||||||
|
class="promotion"
|
||||||
|
:key="promotionIndex"
|
||||||
|
v-if="promotion.promotionType === 'FULL_DISCOUNT'"
|
||||||
|
>
|
||||||
<span>满优惠活动</span>
|
<span>满优惠活动</span>
|
||||||
<promotion :time="promotion.endTime" type="cart"></promotion>
|
<promotion :time="promotion.endTime" type="cart"></promotion>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
|
||||||
<div class="promotion" :key="promotionIndex" v-if="promotion.promotionType === 'COUPON'">
|
|
||||||
<span>优惠券</span>
|
|
||||||
<promotion :time="promotion.endTime" type="cart"></promotion>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="width_150">
|
<div class="width_150">
|
||||||
{{ goods.purchasePrice | unitPrice("¥") }}
|
{{ goods.purchasePrice | unitPrice("¥") }}
|
||||||
</div>
|
</div>
|
||||||
<div class="width_100">
|
<div class="width_100">
|
||||||
<InputNumber :min="1" size="small" v-model="goods.num" @on-change="changeNum(goods.num, goods.goodsSku.id)"></InputNumber>
|
<InputNumber
|
||||||
<div class="fontsize_12">{{goods.goodsSku.quantity > 0 ? '有货' : '无货'}}</div>
|
:min="1"
|
||||||
|
size="small"
|
||||||
|
v-model="goods.num"
|
||||||
|
@on-change="changeNum(goods.num, goods.goodsSku.id)"
|
||||||
|
></InputNumber>
|
||||||
|
<div class="fontsize_12">
|
||||||
|
{{ goods.goodsSku.quantity > 0 ? "有货" : "无货" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="width_150">
|
<div class="width_150">
|
||||||
{{ goods.subTotal | unitPrice("¥") }}
|
{{ goods.subTotal | unitPrice("¥") }}
|
||||||
</div>
|
</div>
|
||||||
<div class="width_100">
|
<div class="width_100">
|
||||||
<span class="handle-btn" v-if="!goods.errorMessage" @click="delGoods(goods.goodsSku.id)">删除</span>
|
<span
|
||||||
<span class="handle-btn" v-if="!goods.errorMessage" @click="collectGoods(goods.goodsSku.id)">收藏</span>
|
class="handle-btn"
|
||||||
|
v-if="!goods.errorMessage"
|
||||||
|
@click="delGoods(goods.goodsSku.id)"
|
||||||
|
>删除</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="handle-btn"
|
||||||
|
v-if="!goods.errorMessage"
|
||||||
|
@click="collectGoods(goods.goodsSku.id)"
|
||||||
|
>收藏</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="error-goods" v-if="goods.errorMessage">
|
<div class="error-goods" v-if="goods.errorMessage">
|
||||||
<div>{{goods.errorMessage}}</div>
|
<div>{{ goods.errorMessage }}</div>
|
||||||
<Button type="primary" @click="delGoods(goods.goodsSku.id)">删除</Button>
|
<Button type="primary" @click="delGoods(goods.goodsSku.id)">删除</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<!-- 底部支付栏 -->
|
<!-- 底部支付栏 -->
|
||||||
<div class="cart-goods-footer">
|
<div class="cart-goods-footer">
|
||||||
<div>
|
<div>
|
||||||
<div class="width_60">
|
<div class="width_60">
|
||||||
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')">全选</Checkbox>
|
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
|
||||||
|
>全选</Checkbox
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="width_100 handle-btn" @click="delGoods">删除选中商品</div>
|
<div class="width_100 handle-btn" @click="delGoods">删除选中商品</div>
|
||||||
<!-- <div class="width_100 handle-btn" @click="collectGoods">移到我的收藏</div> -->
|
<!-- <div class="width_100 handle-btn" @click="collectGoods">移到我的收藏</div> -->
|
||||||
|
@ -123,13 +189,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="selected-count">
|
<div class="selected-count">
|
||||||
已选择<span>{{ checkedNum }}</span>件商品
|
已选择<span>{{ checkedNum }}</span
|
||||||
|
>件商品
|
||||||
</div>
|
</div>
|
||||||
<div class="ml_20 save-price">
|
<div class="ml_20 save-price">
|
||||||
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
|
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml_20 total-price">
|
<div class="ml_20 total-price">
|
||||||
总价(不含运费):<div>{{ priceDetailDTO.flowPrice | unitPrice("¥") }}</div>
|
总价(不含运费):
|
||||||
|
<div>{{ priceDetailDTO.flowPrice | unitPrice("¥") }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pay ml_20" @click="pay">去结算</div>
|
<div class="pay ml_20" @click="pay">去结算</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,21 +210,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Promotion from '@/components/goodsDetail/Promotion';
|
import Promotion from "@/components/goodsDetail/Promotion";
|
||||||
import Search from '@/components/Search';
|
import Search from "@/components/Search";
|
||||||
import * as APICart from '@/api/cart';
|
import * as APICart from "@/api/cart";
|
||||||
import * as APIMember from '@/api/member';
|
import * as APIMember from "@/api/member";
|
||||||
export default {
|
export default {
|
||||||
name: 'Cart',
|
name: "Cart",
|
||||||
beforeRouteEnter (to, from, next) {
|
beforeRouteEnter(to, from, next) {
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Search,
|
Search,
|
||||||
Promotion
|
Promotion,
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
couponAvailable: false, // 展示优惠券
|
couponAvailable: false, // 展示优惠券
|
||||||
stepIndex: 0, // 当前处于哪一步,购物车==0,填写订单信息==1,成功提交订单==2
|
stepIndex: 0, // 当前处于哪一步,购物车==0,填写订单信息==1,成功提交订单==2
|
||||||
|
@ -167,44 +235,44 @@ export default {
|
||||||
cartList: [], // 购物车列表
|
cartList: [], // 购物车列表
|
||||||
couponList: [], // 优惠券列表
|
couponList: [], // 优惠券列表
|
||||||
priceDetailDTO: {}, // 价格明细
|
priceDetailDTO: {}, // 价格明细
|
||||||
skuList: [] // sku列表
|
skuList: [], // sku列表
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 跳转商品详情
|
// 跳转商品详情
|
||||||
goGoodsDetail (skuId, goodsId) {
|
goGoodsDetail(skuId, goodsId) {
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: '/goodsDetail',
|
path: "/goodsDetail",
|
||||||
query: { skuId, goodsId }
|
query: { skuId, goodsId },
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, '_blank');
|
window.open(routeUrl.href, "_blank");
|
||||||
},
|
},
|
||||||
// 跳转店铺首页
|
// 跳转店铺首页
|
||||||
goShopPage (id) {
|
goShopPage(id) {
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: '/Merchant',
|
path: "/Merchant",
|
||||||
query: { id }
|
query: { id },
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, '_blank');
|
window.open(routeUrl.href, "_blank");
|
||||||
},
|
},
|
||||||
// 收藏商品
|
// 收藏商品
|
||||||
collectGoods (id) {
|
collectGoods(id) {
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: '收藏',
|
title: "收藏",
|
||||||
content: '<p>商品收藏后可在个人中心我的收藏查看</p>',
|
content: "<p>商品收藏后可在个人中心我的收藏查看</p>",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
APIMember.collectGoods('GOODS', id).then((res) => {
|
APIMember.collectGoods("GOODS", id).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('收藏商品成功');
|
this.$Message.success("收藏商品成功");
|
||||||
this.getCartList();
|
this.getCartList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onCancel: () => {}
|
onCancel: () => {},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 删除商品
|
// 删除商品
|
||||||
delGoods (id) {
|
delGoods(id) {
|
||||||
const idArr = [];
|
const idArr = [];
|
||||||
if (!id) {
|
if (!id) {
|
||||||
const list = this.cartList;
|
const list = this.cartList;
|
||||||
|
@ -217,51 +285,51 @@ export default {
|
||||||
idArr.push(id);
|
idArr.push(id);
|
||||||
}
|
}
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: '删除',
|
title: "删除",
|
||||||
content: '<p>确定要删除该商品吗?</p>',
|
content: "<p>确定要删除该商品吗?</p>",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => {
|
APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('删除成功');
|
this.$Message.success("删除成功");
|
||||||
this.getCartList();
|
this.getCartList();
|
||||||
} else {
|
} else {
|
||||||
this.$Message.error(res.message);
|
this.$Message.error(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 清空购物车
|
// 清空购物车
|
||||||
clearCart () {
|
clearCart() {
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: '提示',
|
title: "提示",
|
||||||
content: '<p>确定要清空购物车吗?清空后不可恢复</p>',
|
content: "<p>确定要清空购物车吗?清空后不可恢复</p>",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
APICart.clearCart().then((res) => {
|
APICart.clearCart().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('清空购物车成功');
|
this.$Message.success("清空购物车成功");
|
||||||
this.getCartList();
|
this.getCartList();
|
||||||
} else {
|
} else {
|
||||||
this.$Message.error(res.message);
|
this.$Message.error(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 跳转支付页面
|
// 跳转支付页面
|
||||||
pay () {
|
pay() {
|
||||||
if (this.checkedNum) {
|
if (this.checkedNum) {
|
||||||
this.$router.push({ path: '/pay', query: { way: 'CART' } });
|
this.$router.push({ path: "/pay", query: { way: "CART" } });
|
||||||
} else {
|
} else {
|
||||||
this.$Message.warning('请至少选择一件商品');
|
this.$Message.warning("请至少选择一件商品");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 展示优惠券
|
// 展示优惠券
|
||||||
showCoupon (storeId, index) {
|
showCoupon(storeId, index) {
|
||||||
this.couponAvailable = index;
|
this.couponAvailable = index;
|
||||||
},
|
},
|
||||||
// 设置购买数量
|
// 设置购买数量
|
||||||
changeNum (val, id) {
|
changeNum(val, id) {
|
||||||
console.log(val, id);
|
console.log(val, id);
|
||||||
APICart.setCartGoodsNum({ skuId: id, num: val }).then((res) => {
|
APICart.setCartGoodsNum({ skuId: id, num: val }).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
@ -271,12 +339,12 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 设置商品选中状态
|
// 设置商品选中状态
|
||||||
async changeChecked (status, type, id) {
|
async changeChecked(status, type, id) {
|
||||||
const check = status ? 1 : 0;
|
const check = status ? 1 : 0;
|
||||||
if (type === 'all') {
|
if (type === "all") {
|
||||||
// 全选
|
// 全选
|
||||||
await APICart.setCheckedAll({ checked: check });
|
await APICart.setCheckedAll({ checked: check });
|
||||||
} else if (type === 'shop') {
|
} else if (type === "shop") {
|
||||||
// 选中店铺所有商品
|
// 选中店铺所有商品
|
||||||
await APICart.setCheckedSeller({ checked: check, storeId: id });
|
await APICart.setCheckedSeller({ checked: check, storeId: id });
|
||||||
} else {
|
} else {
|
||||||
|
@ -287,17 +355,17 @@ export default {
|
||||||
this.getCartList();
|
this.getCartList();
|
||||||
},
|
},
|
||||||
// 领取优惠券
|
// 领取优惠券
|
||||||
async receiveShopCoupon (item) {
|
async receiveShopCoupon(item) {
|
||||||
let res = await APIMember.receiveCoupon(item.id);
|
let res = await APIMember.receiveCoupon(item.id);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$set(item, 'disabled', true);
|
this.$set(item, "disabled", true);
|
||||||
this.$Message.success('领取成功');
|
this.$Message.success("领取成功");
|
||||||
} else {
|
} else {
|
||||||
this.$Message.error(res.message);
|
this.$Message.error(res.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 购物车列表
|
// 购物车列表
|
||||||
async getCartList () {
|
async getCartList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
try {
|
try {
|
||||||
let res = await APICart.cartGoodsAll();
|
let res = await APICart.cartGoodsAll();
|
||||||
|
@ -326,15 +394,15 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
this.getCartList();
|
this.getCartList();
|
||||||
APICart.cartCount().then((res) => {
|
APICart.cartCount().then((res) => {
|
||||||
// 购物车商品数量
|
// 购物车商品数量
|
||||||
if (res.success) this.goodsTotal = res.result;
|
if (res.success) this.goodsTotal = res.result;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -657,12 +725,12 @@ export default {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.cart-goods-footer > div{
|
.cart-goods-footer > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.total-price{
|
.total-price {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ export const getPintuanGoodsList = params => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭拼团活动
|
// 关闭拼团活动
|
||||||
export const closePintuan = pintuanId => {
|
export const updatePintuanStatus = (pintuanId, params) => {
|
||||||
return putRequest(`/promotion/pintuan/close/${pintuanId}`);
|
return putRequest(`/promotion/pintuan/status/${pintuanId}`, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 修改砍价活动商品
|
// 修改砍价活动商品
|
||||||
|
@ -187,12 +187,14 @@ export const saveSeckill = params => {
|
||||||
|
|
||||||
// 修改秒杀活动
|
// 修改秒杀活动
|
||||||
export const updateSeckill = params => {
|
export const updateSeckill = params => {
|
||||||
return putRequest("/promotion/seckill", params);
|
return putRequest("/promotion/seckill", params, {
|
||||||
|
"Content-type": "application/json"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭秒杀活动
|
// 关闭秒杀活动
|
||||||
export const closeSeckill = id => {
|
export const updateSeckillStatus = (id, params) => {
|
||||||
return putRequest(`/promotion/seckill/close/${id}`);
|
return putRequest(`/promotion/seckill/status/${id}`, params);
|
||||||
};
|
};
|
||||||
// 删除秒杀商品
|
// 删除秒杀商品
|
||||||
export const delSeckillGoods = params => {
|
export const delSeckillGoods = params => {
|
||||||
|
|
|
@ -154,103 +154,103 @@ export const otherRouter = {
|
||||||
component: () => import("@/views/goods/goods-info/goodsDetail.vue")
|
component: () => import("@/views/goods/goods-info/goodsDetail.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/add-points-goods",
|
path: "promotions/add-points-goods",
|
||||||
title: "添加积分商品",
|
title: "添加积分商品",
|
||||||
name: "add-points-goods",
|
name: "add-points-goods",
|
||||||
component: () =>
|
component: () =>
|
||||||
import("@/views/promotion/pointsGoods/addPointsGoods.vue")
|
import("@/views/promotions/points-goods/points-goods-add.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/edit-points-goods",
|
path: "promotions/edit-points-goods",
|
||||||
title: "修改积分商品",
|
title: "修改积分商品",
|
||||||
name: "edit-points-goods",
|
name: "edit-points-goods",
|
||||||
component: () =>
|
component: () =>
|
||||||
import("@/views/promotion/pointsGoods/editPointsGoods.vue")
|
import("@/views/promotions/points-goods/points-goods-edit.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/manager-points-goods-category",
|
path: "promotions/manager-points-goods-category",
|
||||||
title: "积分商品分类",
|
title: "积分商品分类",
|
||||||
name: "manager-points-goods-category",
|
name: "manager-points-goods-category",
|
||||||
component: () =>
|
component: () =>
|
||||||
import("@/views/promotion/pointsGoodsCategory/pointsGoodsCategory.vue")
|
import("@/views/promotions/points-goods-category/points-goods-category.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/add-kanJia-activity-goods",
|
path: "promotions/add-kanJia-activity-goods",
|
||||||
title: "添加砍价活动",
|
title: "添加砍价活动",
|
||||||
name: "add-kanJia-activity-goods",
|
name: "add-kanJia-activity-goods",
|
||||||
component: () => import("@/views/promotion/kanjia/kanjiaActivityAddGoods.vue")
|
component: () => import("@/views/promotions/kanjia/kanjia-activity-add-goods.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/edit-kanJia-activity-goods",
|
path: "promotions/edit-kanJia-activity-goods",
|
||||||
title: "修改砍价活动",
|
title: "修改砍价活动",
|
||||||
name: "edit-kanJia-activity-goods",
|
name: "edit-kanJia-activity-goods",
|
||||||
component: () => import("@/views/promotion/kanjia/kanjiaActivityEditGoods.vue")
|
component: () => import("@/views/promotions/kanjia/kanjia-activity-edit-goods.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/manager-coupon",
|
path: "promotions/manager-coupon",
|
||||||
title: "平台优惠券",
|
title: "平台优惠券",
|
||||||
name: "manager-coupon",
|
name: "manager-coupon",
|
||||||
component: () => import("@/views/promotion/coupon/coupon.vue")
|
component: () => import("@/views/promotions/coupon/coupon.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/add-platform-coupon",
|
path: "promotions/add-platform-coupon",
|
||||||
title: "添加平台优惠券",
|
title: "添加平台优惠券",
|
||||||
name: "add-platform-coupon",
|
name: "add-platform-coupon",
|
||||||
component: () => import("@/views/promotion/coupon/couponPublish.vue")
|
component: () => import("@/views/promotions/coupon/coupon-publish.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/edit-platform-coupon",
|
path: "promotions/edit-platform-coupon",
|
||||||
title: "编辑平台优惠券",
|
title: "编辑平台优惠券",
|
||||||
name: "edit-platform-coupon",
|
name: "edit-platform-coupon",
|
||||||
component: () => import("@/views/promotion/coupon/couponPublish.vue")
|
component: () => import("@/views/promotions/coupon/coupon-publish.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "coupon-activity/add",
|
path: "promotions/add-coupon-activity",
|
||||||
title: "添加优惠券活动",
|
title: "添加优惠券活动",
|
||||||
name: "add-coupon-activity",
|
name: "add-coupon-activity",
|
||||||
component: () => import("@/views/promotion/couponActivity/couponPublish.vue")
|
component: () => import("@/views/promotions/coupon-activity/coupon-publish.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "coupon-activity/edit",
|
path: "promotions/edit-coupon-activity",
|
||||||
title: "编辑平台优惠券活动",
|
title: "编辑平台优惠券活动",
|
||||||
name: "edit-coupon-activity",
|
name: "edit-coupon-activity",
|
||||||
component: () => import("@/views/promotion/couponActivity/couponPublish.vue")
|
component: () => import("@/views/promotions/coupon-activity/coupon-publish.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/coupon-activity-info",
|
path: "promotions/coupon-activity-info",
|
||||||
title: "券活动详情",
|
title: "券活动详情",
|
||||||
name: "coupon-activity-info",
|
name: "coupon-activity-info",
|
||||||
component: () => import("@/views/promotion/couponActivity/couponInfo.vue")
|
component: () => import("@/views/promotions/coupon-activity/coupon-info.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/manager-pintuan",
|
path: "promotions/manager-pintuan",
|
||||||
title: "平台拼团",
|
title: "平台拼团",
|
||||||
name: "manager-pintuan",
|
name: "manager-pintuan",
|
||||||
component: () => import("@/views/promotion/pintuan/pintuan.vue")
|
component: () => import("@/views/promotions/pintuan/pintuan.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/pintuan/pintuan-goods",
|
path: "promotions/pintuan/pintuan-goods",
|
||||||
title: "拼团商品",
|
title: "拼团商品",
|
||||||
name: "pintuan-goods",
|
name: "pintuan-goods",
|
||||||
component: () => import("@/views/promotion/pintuan/pintuanGoods.vue")
|
component: () => import("@/views/promotions/pintuan/pintuan-goods.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/full-cut-detail",
|
path: "promotions/full-discount-detail",
|
||||||
title: "满减满折详情",
|
title: "满减满折详情",
|
||||||
name: "full-cut-detail",
|
name: "full-discount-detail",
|
||||||
component: () => import("@/views/promotion/fullCut/fullCutDetail.vue")
|
component: () => import("@/views/promotions/full-discount/full-discount-detail.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/seckill/manager-seckill-add",
|
path: "promotions/seckill/manager-seckill-add",
|
||||||
title: "编辑秒杀活动",
|
title: "编辑秒杀活动",
|
||||||
name: "manager-seckill-add",
|
name: "manager-seckill-add",
|
||||||
component: () => import("@/views/promotion/seckill/addSeckill.vue")
|
component: () => import("@/views/promotions/seckill/seckill-add.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "promotion/seckill/seckill-goods",
|
path: "promotions/seckill/seckill-goods",
|
||||||
title: "秒杀商品",
|
title: "秒杀商品",
|
||||||
name: "seckill-goods",
|
name: "seckill-goods",
|
||||||
component: () => import("@/views/promotion/seckill/seckillGoods.vue")
|
component: () => import("@/views/promotions/seckill/seckill-goods.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/floorList/renovation",
|
path: "/floorList/renovation",
|
||||||
|
@ -271,10 +271,10 @@ export const otherRouter = {
|
||||||
component: () => import("@/views/sys/message/smsSign.vue")
|
component: () => import("@/views/sys/message/smsSign.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "liveDetail",
|
path: "live-detail",
|
||||||
title: "查看直播",
|
title: "查看直播",
|
||||||
name: "liveDetail",
|
name: "live-detail",
|
||||||
component: () => import("@/views/promotion/live/liveDetail.vue")
|
component: () => import("@/views/promotions/live/live-detail.vue")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,31 @@
|
||||||
<span>{{ couponActivity.promotionName }}</span>
|
<span>{{ couponActivity.promotionName }}</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动类型">
|
<FormItem label="活动类型">
|
||||||
<span v-if="couponActivity.couponActivityType === 'REGISTERED'" >新人发券</span>
|
<span v-if="couponActivity.couponActivityType === 'REGISTERED'"
|
||||||
|
>新人发券</span
|
||||||
|
>
|
||||||
<spin v-else>精确发券</spin>
|
<spin v-else>精确发券</spin>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动范围" v-if="couponActivity.couponActivityType === 'SPECIFY'" >
|
<FormItem
|
||||||
<span v-if="couponActivity.activityScope === 'ALL'" >全部会员</span>
|
label="活动范围"
|
||||||
|
v-if="couponActivity.couponActivityType === 'SPECIFY'"
|
||||||
|
>
|
||||||
|
<span v-if="couponActivity.activityScope === 'ALL'">全部会员</span>
|
||||||
<spin v-else>指定会员</spin>
|
<spin v-else>指定会员</spin>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动时间">
|
<FormItem label="活动时间">
|
||||||
<span>{{ couponActivity.startTime }}~{{ couponActivity.endTime }}</span>
|
<span>{{ couponActivity.startTime }}~{{ couponActivity.endTime }}</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动状态">
|
<FormItem label="活动状态">
|
||||||
<span v-if="couponActivity.promotionStatus==='NEW'">新建</span>
|
<span v-if="couponActivity.promotionStatus === 'NEW'">未开始</span>
|
||||||
<span v-if="couponActivity.promotionStatus==='START'">已开始</span>
|
<span v-if="couponActivity.promotionStatus === 'START'">已开始</span>
|
||||||
<span v-if="couponActivity.promotionStatus==='END'">已结束</span>
|
<span v-if="couponActivity.promotionStatus === 'END'">已结束</span>
|
||||||
<span v-if="couponActivity.promotionStatus==='CLOSE'">已废弃</span>
|
<span v-if="couponActivity.promotionStatus === 'CLOSE'">已关闭</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<h4>优惠券列表</h4>
|
<h4>优惠券列表</h4>
|
||||||
<Table :columns="couponColumn" :data="couponData" ref="table">
|
<Table :columns="couponColumn" :data="couponData" ref="table"> </Table>
|
||||||
</Table>
|
<template v-if="couponActivity.activityScopeInfo && memberData.length > 0">
|
||||||
<template v-if="couponActivity.activityScopeInfo && memberData.length>0">
|
|
||||||
<h4 class="mt_10">会员列表列表</h4>
|
<h4 class="mt_10">会员列表列表</h4>
|
||||||
<Table :columns="memberColumn" :data="memberData"></Table>
|
<Table :columns="memberColumn" :data="memberData"></Table>
|
||||||
</template>
|
</template>
|
||||||
|
@ -44,28 +48,26 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getCouponActivity} from "@/api/promotion";
|
import { getCouponActivity } from "@/api/promotion";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "couponActivityInfo",
|
name: "coupon-activity-info",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: this.$route.query.id,//表单id
|
id: this.$route.query.id, //表单id
|
||||||
couponActivity: {
|
couponActivity: {}, //券活动
|
||||||
|
|
||||||
},//券活动
|
|
||||||
couponColumn: [
|
couponColumn: [
|
||||||
{
|
{
|
||||||
title: "优惠券名称",
|
title: "优惠券名称",
|
||||||
key: 'couponName'
|
key: "couponName",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "优惠券金额",
|
title: "优惠券金额",
|
||||||
key: 'price',
|
key: "price",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知";
|
let text = "未知";
|
||||||
if (params.row.couponType === "DISCOUNT") {
|
if (params.row.couponType === "DISCOUNT") {
|
||||||
text = params.row.price + "折";
|
text = params.row.couponDiscount + "折";
|
||||||
} else if (params.row.couponType === "PRICE") {
|
} else if (params.row.couponType === "PRICE") {
|
||||||
text = "¥" + params.row.price;
|
text = "¥" + params.row.price;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,7 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "优惠券类型",
|
title: "优惠券类型",
|
||||||
key: 'couponType',
|
key: "couponType",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知";
|
let text = "未知";
|
||||||
if (params.row.couponType == "DISCOUNT") {
|
if (params.row.couponType == "DISCOUNT") {
|
||||||
|
@ -88,7 +90,7 @@ export default {
|
||||||
{
|
{
|
||||||
title: "赠送数量",
|
title: "赠送数量",
|
||||||
key: "num",
|
key: "num",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
couponData: [],
|
couponData: [],
|
||||||
memberColumn: [
|
memberColumn: [
|
||||||
|
@ -173,4 +175,3 @@ div.base-info-item {
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,81 +6,143 @@
|
||||||
<h4>活动信息</h4>
|
<h4>活动信息</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="活动名称" prop="promotionName">
|
<FormItem label="活动名称" prop="promotionName">
|
||||||
<Input type="text" v-model="form.promotionName" placeholder="请填写活动名称" clearable style="width: 260px"/>
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="form.promotionName"
|
||||||
|
placeholder="请填写活动名称"
|
||||||
|
clearable
|
||||||
|
style="width: 260px"
|
||||||
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动时间">
|
<FormItem label="活动时间">
|
||||||
<DatePicker type="datetimerange" :options="options" v-model="rangeTime" format="yyyy-MM-dd HH:mm:ss"
|
<DatePicker
|
||||||
placeholder="请选择活动时间" style="width: 260px">
|
type="datetimerange"
|
||||||
|
:options="options"
|
||||||
|
v-model="rangeTime"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择活动时间"
|
||||||
|
style="width: 260px"
|
||||||
|
>
|
||||||
</DatePicker>
|
</DatePicker>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="优惠券活动类型" prop="couponActivityType">
|
<FormItem label="优惠券活动类型" prop="couponActivityType">
|
||||||
<RadioGroup type="button" button-style="solid" v-model="form.couponActivityType">
|
<RadioGroup
|
||||||
|
type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model="form.couponActivityType"
|
||||||
|
>
|
||||||
<Radio label="REGISTERED">新人发券</Radio>
|
<Radio label="REGISTERED">新人发券</Radio>
|
||||||
<Radio label="SPECIFY">精确发券</Radio>
|
<Radio label="SPECIFY">精确发券</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动范围" prop="activityScope" v-if="form.couponActivityType==='SPECIFY'">
|
<FormItem
|
||||||
|
label="活动范围"
|
||||||
|
prop="activityScope"
|
||||||
|
v-if="form.couponActivityType === 'SPECIFY'"
|
||||||
|
>
|
||||||
<RadioGroup type="button" button-style="solid" v-model="form.activityScope">
|
<RadioGroup type="button" button-style="solid" v-model="form.activityScope">
|
||||||
<Radio label="ALL">全部会员</Radio>
|
<Radio label="ALL">全部会员</Radio>
|
||||||
<Radio label="DESIGNATED">指定会员</Radio>
|
<Radio label="DESIGNATED">指定会员</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="选择会员" prop="scopeType"
|
<FormItem
|
||||||
v-if="form.couponActivityType==='SPECIFY' && form.activityScope==='DESIGNATED'">
|
label="选择会员"
|
||||||
<Button type="primary" icon="ios-add" @click="addVip" ghost>选择会员</Button>
|
prop="scopeType"
|
||||||
<div style="margin-top:24px;" v-if="form.activityScope == 'DESIGNATED'">
|
v-if="
|
||||||
<Table border :columns="userColumns" :data="this.selectedMember">
|
form.couponActivityType === 'SPECIFY' &&
|
||||||
</Table>
|
form.activityScope === 'DESIGNATED'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<Button type="primary" icon="ios-add" @click="addVip" ghost
|
||||||
|
>选择会员</Button
|
||||||
|
>
|
||||||
|
<div style="margin-top: 24px" v-if="form.activityScope == 'DESIGNATED'">
|
||||||
|
<Table border :columns="userColumns" :data="this.selectedMember"> </Table>
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<h4>配置优惠券</h4>
|
<h4>配置优惠券</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="选择优惠券" prop="scopeType">
|
<FormItem label="选择优惠券" prop="scopeType">
|
||||||
<Button type="primary" :loading="submitLoading" @click="showSelector">选择优惠券</Button>
|
<Button type="primary" :loading="submitLoading" @click="showSelector"
|
||||||
|
>选择优惠券</Button
|
||||||
|
>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="赠送配置" prop="scopeType">
|
<FormItem label="赠送配置" prop="scopeType">
|
||||||
|
|
||||||
<Table border :columns="columns" :data="this.selectCouponList">
|
<Table border :columns="columns" :data="this.selectCouponList">
|
||||||
<template slot="sendNum" slot-scope="scope">
|
<template slot="sendNum" slot-scope="scope">
|
||||||
<Input type="text" v-model="form.couponActivityItems[scope.index].num" placeholder="赠送数量"/>
|
<Input
|
||||||
<Input type="text" v-model="form.couponActivityItems[scope.index].couponId" v-show="false"/>
|
type="text"
|
||||||
|
v-model="form.couponActivityItems[scope.index].num"
|
||||||
|
placeholder="赠送数量"
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="form.couponActivityItems[scope.index].couponId"
|
||||||
|
v-show="false"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||||
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||||
|
>提交</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
<Modal @on-ok="()=>{this.showCouponSelect = false}" @on-cancel="()=>{this.showCouponSelect = false}"
|
<Modal
|
||||||
v-model="showCouponSelect" width="80%">
|
@on-ok="
|
||||||
<couponTemplate :checked="true" :selectedList="selectCouponList" getType="ACTIVITY" @selected="selectedCoupon"/>
|
() => {
|
||||||
|
this.showCouponSelect = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@on-cancel="
|
||||||
|
() => {
|
||||||
|
this.showCouponSelect = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
v-model="showCouponSelect"
|
||||||
|
width="80%"
|
||||||
|
>
|
||||||
|
<couponTemplate
|
||||||
|
:checked="true"
|
||||||
|
:selectedList="selectCouponList"
|
||||||
|
getType="ACTIVITY"
|
||||||
|
promotionStatus="START"
|
||||||
|
@selected="selectedCoupon"
|
||||||
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal width="1200" v-model="checkUserList">
|
<Modal width="1200" v-model="checkUserList">
|
||||||
<userList v-if="checkUserList" @callback="callbackSelectUser" :selectedList="selectedMember" ref="memberLayout"/>
|
<userList
|
||||||
|
v-if="checkUserList"
|
||||||
|
@callback="callbackSelectUser"
|
||||||
|
:selectedList="selectedMember"
|
||||||
|
ref="memberLayout"
|
||||||
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import couponTemplate from "@/views/promotion/coupon/coupon";
|
import couponTemplate from "@/views/promotions/coupon/coupon";
|
||||||
import userList from "@/views/member/list/index";
|
import userList from "@/views/member/list/index";
|
||||||
import {saveActivityCoupon} from "@/api/promotion";
|
import { saveActivityCoupon } from "@/api/promotion";
|
||||||
|
import { promotionsScopeTypeRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "addCouponActivity",
|
name: "add-coupon-activity",
|
||||||
components: {
|
components: {
|
||||||
couponTemplate,
|
couponTemplate,
|
||||||
userList
|
userList,
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
options: {
|
options: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
|
@ -98,14 +160,14 @@ export default {
|
||||||
startTime: "", //开始时间
|
startTime: "", //开始时间
|
||||||
endTime: "", //结束时间
|
endTime: "", //结束时间
|
||||||
memberDTOS: [], //指定会员范围
|
memberDTOS: [], //指定会员范围
|
||||||
couponActivityItems: [],//优惠券列表
|
couponActivityItems: [], //优惠券列表
|
||||||
},
|
},
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
selectCouponList: [], //选择的优惠券列表
|
selectCouponList: [], //选择的优惠券列表
|
||||||
formRule: {
|
formRule: {
|
||||||
promotionName: [{required: true, message: "活动名称不能为空"}],
|
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||||
rangeTime: [{required: true, message: "请选择活动有效期"}],
|
rangeTime: [{ required: true, message: "请选择活动有效期" }],
|
||||||
description: [{required: true, message: "请输入范围描述"}],
|
description: [{ required: true, message: "请输入范围描述" }],
|
||||||
},
|
},
|
||||||
// 用户表格
|
// 用户表格
|
||||||
userColumns: [
|
userColumns: [
|
||||||
|
@ -160,19 +222,9 @@ export default {
|
||||||
{
|
{
|
||||||
title: "品类描述",
|
title: "品类描述",
|
||||||
key: "scopeType",
|
key: "scopeType",
|
||||||
width: 100,
|
width: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知";
|
return promotionsScopeTypeRender(h, params);
|
||||||
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]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -181,10 +233,7 @@ export default {
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.price) {
|
if (params.row.price) {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return h("div", params.row.couponDiscount + "折");
|
return h("div", params.row.couponDiscount + "折");
|
||||||
}
|
}
|
||||||
|
@ -255,8 +304,8 @@ export default {
|
||||||
this.form.memberDTOS = this.selectedMember.map((item) => {
|
this.form.memberDTOS = this.selectedMember.map((item) => {
|
||||||
return {
|
return {
|
||||||
nickName: item.nickName,
|
nickName: item.nickName,
|
||||||
id: item.id
|
id: item.id,
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -276,7 +325,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
num: 0,
|
num: 0,
|
||||||
couponId: item.id,
|
couponId: item.id,
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 添加指定用户
|
// 添加指定用户
|
||||||
|
@ -292,12 +341,8 @@ export default {
|
||||||
},
|
},
|
||||||
/** 保存平台优惠券 */
|
/** 保存平台优惠券 */
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.form.startTime = this.$options.filters.unixToDate(
|
this.form.startTime = this.$options.filters.unixToDate(this.rangeTime[0] / 1000);
|
||||||
this.rangeTime[0] / 1000
|
this.form.endTime = this.$options.filters.unixToDate(this.rangeTime[1] / 1000);
|
||||||
);
|
|
||||||
this.form.endTime = this.$options.filters.unixToDate(
|
|
||||||
this.rangeTime[1] / 1000
|
|
||||||
);
|
|
||||||
|
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
@ -318,9 +363,7 @@ export default {
|
||||||
// 关闭当前页面
|
// 关闭当前页面
|
||||||
closeCurrentPage() {
|
closeCurrentPage() {
|
||||||
this.$store.commit("removeTag", "add-platform-coupon");
|
this.$store.commit("removeTag", "add-platform-coupon");
|
||||||
localStorage.pageOpenedList = JSON.stringify(
|
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||||
this.$store.state.app.pageOpenedList
|
|
||||||
);
|
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -355,4 +398,3 @@ h4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -4,33 +4,55 @@
|
||||||
<Row class="operation padding-row">
|
<Row class="operation padding-row">
|
||||||
<Button @click="add" type="primary">添加活动</Button>
|
<Button @click="add" type="primary">添加活动</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom">
|
<Table
|
||||||
|
:loading="loading"
|
||||||
|
border
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
ref="table"
|
||||||
|
sortable="custom"
|
||||||
|
>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button type="info" size="small" style="margin-right: 10px" @click="info(row)">
|
<Button type="info" size="small" style="margin-right: 10px" @click="info(row)">
|
||||||
查看
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
<Button v-if="!checked && row.promotionStatus === 'START' || row.promotionStatus === 'NEW'" type="error"
|
<Button
|
||||||
size="small" style="margin-right: 10px" @click="remove(row)">停止
|
v-if="
|
||||||
|
(!checked && row.promotionStatus === 'START') ||
|
||||||
|
row.promotionStatus === 'NEW'
|
||||||
|
"
|
||||||
|
type="error"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
@click="remove(row)"
|
||||||
|
>关闭
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<Row type="flex" justify="end" class="mt_10">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
|
<Page
|
||||||
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
|
:current="searchForm.pageNumber"
|
||||||
size="small" show-total show-elevator show-sizer></Page>
|
: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>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getCouponActivityList, closeActivity } from "@/api/promotion";
|
||||||
getCouponActivityList,
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
closeActivity,
|
|
||||||
} from "@/api/promotion";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "couponActivity",
|
name: "coupon-activity",
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -51,9 +73,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {
|
formValidate: {
|
||||||
promotionName: [
|
promotionName: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||||
{required: true, message: "不能为空", trigger: "blur"},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
selectList: [], // 多选数据
|
selectList: [], // 多选数据
|
||||||
|
@ -70,7 +90,7 @@ export default {
|
||||||
key: "couponActivityType",
|
key: "couponActivityType",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.couponActivityType === 'REGISTERED') {
|
if (params.row.couponActivityType === "REGISTERED") {
|
||||||
return h("div", ["注册赠券"]);
|
return h("div", ["注册赠券"]);
|
||||||
} else {
|
} else {
|
||||||
return h("div", ["精确发券"]);
|
return h("div", ["精确发券"]);
|
||||||
|
@ -95,11 +115,13 @@ export default {
|
||||||
title: "活动时间",
|
title: "活动时间",
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h("div", {
|
if (params.row.startTime && params.row.endTime) {
|
||||||
domProps: {
|
return h("div", {
|
||||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
domProps: {
|
||||||
},
|
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -108,32 +130,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
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
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -162,11 +159,11 @@ export default {
|
||||||
},
|
},
|
||||||
//增加券活动
|
//增加券活动
|
||||||
add() {
|
add() {
|
||||||
this.$router.push({name: "add-coupon-activity"});
|
this.$router.push({ name: "add-coupon-activity" });
|
||||||
},
|
},
|
||||||
//查看详情
|
//查看详情
|
||||||
info(v) {
|
info(v) {
|
||||||
this.$router.push({name: "coupon-activity-info", query: {id: v.id}});
|
this.$router.push({ name: "coupon-activity-info", query: { id: v.id } });
|
||||||
},
|
},
|
||||||
// 分页 修改页码
|
// 分页 修改页码
|
||||||
changePage(v) {
|
changePage(v) {
|
||||||
|
@ -206,24 +203,25 @@ export default {
|
||||||
},
|
},
|
||||||
//跳转编辑
|
//跳转编辑
|
||||||
edit(v) {
|
edit(v) {
|
||||||
this.$router.push({name: "edit-platform-coupon", query: {id: v.id}});
|
this.$router.push({ name: "edit-platform-coupon", query: { id: v.id } });
|
||||||
},
|
},
|
||||||
//停止活动
|
//停止活动
|
||||||
remove(v) {
|
remove(v) {
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: "确认停止",
|
title: "确认关闭",
|
||||||
// 记得确认修改此处
|
content: "确认要关闭此优惠券活动么?关闭活动只能重新创建",
|
||||||
content: "确认要停止此优惠券活动么?停止活动只能重新创建",
|
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
// 删除
|
// 删除
|
||||||
closeActivity(v.id).then((res) => {
|
closeActivity(v.id)
|
||||||
if (res.success) {
|
.then((res) => {
|
||||||
this.$Message.success("优惠券活动已停止");
|
if (res.success) {
|
||||||
this.getDataList();
|
this.$Message.success("优惠券活动已关闭");
|
||||||
this.$Modal.remove()
|
this.getDataList();
|
||||||
}
|
this.$Modal.remove();
|
||||||
}).catch(() => {});
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
|
@ -6,10 +6,24 @@
|
||||||
<h4>基本信息</h4>
|
<h4>基本信息</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="活动名称" prop="promotionName">
|
<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>
|
||||||
<FormItem label="优惠券名称" prop="couponName">
|
<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>
|
||||||
<FormItem label="优惠券类型" prop="couponType">
|
<FormItem label="优惠券类型" prop="couponType">
|
||||||
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
||||||
|
@ -17,12 +31,30 @@
|
||||||
<Option value="PRICE">减免现金</Option>
|
<Option value="PRICE">减免现金</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="折扣" prop="couponDiscount" v-if="form.couponType == 'DISCOUNT'">
|
<FormItem
|
||||||
<Input :disabled="disabled" type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px"/>
|
label="折扣"
|
||||||
|
prop="couponDiscount"
|
||||||
|
v-if="form.couponType == 'DISCOUNT'"
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
:disabled="disabled"
|
||||||
|
type="number"
|
||||||
|
v-model="form.couponDiscount"
|
||||||
|
placeholder="折扣"
|
||||||
|
clearable
|
||||||
|
style="width: 260px"
|
||||||
|
/>
|
||||||
<span class="describe">请输入0-10之间数字,可以输入一位小数</span>
|
<span class="describe">请输入0-10之间数字,可以输入一位小数</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
|
<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>
|
||||||
<FormItem label="活动类型" prop="getType">
|
<FormItem label="活动类型" prop="getType">
|
||||||
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
||||||
|
@ -32,48 +64,91 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="店铺承担比例" prop="storeCommission">
|
<FormItem label="店铺承担比例" prop="storeCommission">
|
||||||
<Input :disabled="disabled" v-model="form.storeCommission" placeholder="店铺承担比例" style="width: 260px">
|
<Input
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="form.storeCommission"
|
||||||
|
placeholder="店铺承担比例"
|
||||||
|
style="width: 260px"
|
||||||
|
>
|
||||||
<span slot="append">%</span>
|
<span slot="append">%</span>
|
||||||
</Input>
|
</Input>
|
||||||
<span class="describe">店铺承担比例,输入0-100之间数值</span>
|
<span class="describe">店铺承担比例,输入0-100之间数值</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="发放数量" prop="publishNum" v-if="form.getType==='FREE'">
|
<FormItem label="发放数量" prop="publishNum" v-if="form.getType === 'FREE'">
|
||||||
<Input :disabled="disabled" v-model="form.publishNum" placeholder="发放数量" style="width: 260px"/>
|
<Input
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="form.publishNum"
|
||||||
|
placeholder="发放数量"
|
||||||
|
style="width: 260px"
|
||||||
|
/>
|
||||||
<div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
|
<div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="领取数量限制" prop="couponLimitNum" v-if="form.getType==='FREE'">
|
<FormItem
|
||||||
<Input :disabled="disabled" v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px"/>
|
label="领取数量限制"
|
||||||
|
prop="couponLimitNum"
|
||||||
|
v-if="form.getType === 'FREE'"
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
:disabled="disabled"
|
||||||
|
v-model="form.couponLimitNum"
|
||||||
|
placeholder="领取限制"
|
||||||
|
clearable
|
||||||
|
style="width: 260px"
|
||||||
|
/>
|
||||||
<div class="tips">如果领取数量为0时,则代表不限制领取数量</div>
|
<div class="tips">如果领取数量为0时,则代表不限制领取数量</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="范围描述" prop="description">
|
<FormItem label="范围描述" prop="description">
|
||||||
<Input :disabled="disabled" v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable
|
<Input
|
||||||
style="width: 260px"/>
|
:disabled="disabled"
|
||||||
|
v-model="form.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
maxlength="50"
|
||||||
|
show-word-limit
|
||||||
|
clearable
|
||||||
|
style="width: 260px"
|
||||||
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<h4>使用限制</h4>
|
<h4>使用限制</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="消费门槛" prop="consumeThreshold">
|
<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>
|
||||||
<FormItem label="有效期" prop="rangeTime">
|
<FormItem label="有效期" prop="rangeTime">
|
||||||
<div v-if="form.getType == 'ACTIVITY'">
|
<div v-if="form.getType == 'ACTIVITY'">
|
||||||
<RadioGroup v-model="rangeTimeType">
|
<RadioGroup v-model="rangeTimeType">
|
||||||
|
<Radio :disabled="disabled" :label="1">起止时间</Radio>
|
||||||
<Radio :disabled="disabled" :label="1">
|
|
||||||
起止时间
|
|
||||||
</Radio>
|
|
||||||
<Radio :disabled="disabled" :label="0">固定时间</Radio>
|
<Radio :disabled="disabled" :label="0">固定时间</Radio>
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="rangeTimeType == 1">
|
<div v-if="rangeTimeType == 1">
|
||||||
<DatePicker :disabled="disabled" type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择"
|
<DatePicker
|
||||||
:options="options" style="width: 260px">
|
:disabled="disabled"
|
||||||
|
type="datetimerange"
|
||||||
|
v-model="form.rangeTime"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择"
|
||||||
|
:options="options"
|
||||||
|
style="width: 260px"
|
||||||
|
>
|
||||||
</DatePicker>
|
</DatePicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="effectiveDays" v-if="rangeTimeType == 0">
|
<div class="effectiveDays" v-if="rangeTimeType == 0">
|
||||||
领取当天开始
|
领取当天开始
|
||||||
<InputNumber v-model="form.effectiveDays" :min="1" style="width:100px;" :max="365"/>
|
<InputNumber
|
||||||
|
v-model="form.effectiveDays"
|
||||||
|
:min="1"
|
||||||
|
style="width: 100px"
|
||||||
|
:max="365"
|
||||||
|
/>
|
||||||
天内有效(1-365间的整数)
|
天内有效(1-365间的整数)
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
@ -82,31 +157,62 @@
|
||||||
<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="ALL">全品类</Radio>
|
||||||
<Radio :disabled="disabled" label="PORTION_GOODS">指定商品</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>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||||
<div style="display: flex; margin-bottom: 10px">
|
<div style="display: flex; margin-bottom: 10px">
|
||||||
<Button :disabled="disabled" type="primary" @click="openSkuList">选择商品</Button>
|
<Button :disabled="disabled" type="primary" @click="openSkuList"
|
||||||
<Button :disabled="disabled" type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
>选择商品</Button
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
:disabled="disabled"
|
||||||
|
type="error"
|
||||||
|
ghost
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@click="delSelectGoods"
|
||||||
|
>批量删除</Button
|
||||||
|
>
|
||||||
</div>
|
</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">
|
<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>
|
||||||
</Table>
|
</Table>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
||||||
|
<Cascader
|
||||||
<Cascader :disabled="disabled" :data="goodsCategoryList" style="width:260px;"
|
:disabled="disabled"
|
||||||
v-model="form.scopeIdGoods"></Cascader>
|
:data="goodsCategoryList"
|
||||||
|
style="width: 260px"
|
||||||
|
v-model="form.scopeIdGoods"
|
||||||
|
></Cascader>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<div>
|
<div>
|
||||||
<Button :disabled="disabled" type="text" @click="closeCurrentPage">返回</Button>
|
<Button :disabled="disabled" type="text" @click="closeCurrentPage"
|
||||||
<Button :disabled="disabled" type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
>返回</Button
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
:disabled="disabled"
|
||||||
|
type="primary"
|
||||||
|
:loading="submitLoading"
|
||||||
|
@click="handleSubmit"
|
||||||
|
>提交</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -122,8 +228,8 @@ import {
|
||||||
getPlatformCoupon,
|
getPlatformCoupon,
|
||||||
editPlatformCoupon,
|
editPlatformCoupon,
|
||||||
} from "@/api/promotion";
|
} from "@/api/promotion";
|
||||||
import {getCategoryTree} from "@/api/goods";
|
import { getCategoryTree } from "@/api/goods";
|
||||||
import {regular} from "@/utils";
|
import { regular } from "@/utils";
|
||||||
import skuSelect from "@/views/lili-dialog";
|
import skuSelect from "@/views/lili-dialog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -140,14 +246,15 @@ export default {
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
$route(e) { // 监听路由,参数变化调取接口
|
$route(e) {
|
||||||
|
// 监听路由,参数变化调取接口
|
||||||
this.id = e.query.id;
|
this.id = e.query.id;
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
this.getCoupon()
|
this.getCoupon();
|
||||||
} else {
|
} else {
|
||||||
this.$refs.form.resetFields()
|
this.$refs.form.resetFields();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const checkPrice = (rule, value, callback) => {
|
const checkPrice = (rule, value, callback) => {
|
||||||
|
@ -200,37 +307,34 @@ export default {
|
||||||
selectedGoods: [], // 已选商品列表,便于删除
|
selectedGoods: [], // 已选商品列表,便于删除
|
||||||
goodsCategoryList: [], // 商品分类列表
|
goodsCategoryList: [], // 商品分类列表
|
||||||
formRule: {
|
formRule: {
|
||||||
promotionName: [{required: true, message: "活动名称不能为空"}],
|
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||||
couponName: [{required: true, message: "优惠券名称不能为空"}],
|
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
||||||
price: [
|
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||||
{required: true, message: "请输入面额"},
|
rangeTime: [{ required: true, message: "请选择优惠券有效期" }],
|
||||||
{validator: checkPrice},
|
|
||||||
],
|
|
||||||
rangeTime: [{required: true, message: "请选择优惠券有效期"}],
|
|
||||||
consumeThreshold: [
|
consumeThreshold: [
|
||||||
{required: true, message: "请输入消费门槛"},
|
{ required: true, message: "请输入消费门槛" },
|
||||||
{validator: checkWeight},
|
{ validator: checkWeight },
|
||||||
],
|
],
|
||||||
couponDiscount: [
|
couponDiscount: [
|
||||||
{required: true, message: "请输入折扣"},
|
{ required: true, message: "请输入折扣" },
|
||||||
{
|
{
|
||||||
pattern: regular.discount,
|
pattern: regular.discount,
|
||||||
message: "请输入0-10的数字,可有一位小数",
|
message: "请输入0-10的数字,可有一位小数",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
storeCommission: [
|
storeCommission: [
|
||||||
{required: true, message: "请输入店铺承担比例"},
|
{ required: true, message: "请输入店铺承担比例" },
|
||||||
{pattern: regular.rate, message: "请输入0-100的正整数"},
|
{ pattern: regular.rate, message: "请输入0-100的正整数" },
|
||||||
],
|
],
|
||||||
publishNum: [
|
publishNum: [
|
||||||
{required: true, message: "请输入发放数量"},
|
{ required: true, message: "请输入发放数量" },
|
||||||
{pattern: regular.Integer, message: "请输入正整数"},
|
{ pattern: regular.Integer, message: "请输入正整数" },
|
||||||
],
|
],
|
||||||
couponLimitNum: [
|
couponLimitNum: [
|
||||||
{required: true, message: "领取限制不能为空"},
|
{ required: true, message: "领取限制不能为空" },
|
||||||
{pattern: regular.Integer, message: "请输入正整数"},
|
{ pattern: regular.Integer, message: "请输入正整数" },
|
||||||
],
|
],
|
||||||
description: [{required: true, message: "请输入范围描述"}],
|
description: [{ required: true, message: "请输入范围描述" }],
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -248,10 +352,7 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -292,7 +393,7 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted() {
|
||||||
await this.getCagetoryList();
|
await this.getCagetoryList();
|
||||||
// 如果id不为空则查询信息
|
// 如果id不为空则查询信息
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
|
@ -306,12 +407,12 @@ export default {
|
||||||
getPlatformCoupon(this.id).then((res) => {
|
getPlatformCoupon(this.id).then((res) => {
|
||||||
let data = res.result;
|
let data = res.result;
|
||||||
if (!data.promotionGoodsList) data.promotionGoodsList = [];
|
if (!data.promotionGoodsList) data.promotionGoodsList = [];
|
||||||
|
this.rangeTimeType = data.rangeDayType === "DYNAMICTIME" ? 0 : 1;
|
||||||
if (data.scopeType == "PORTION_GOODS_CATEGORY") {
|
if (data.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||||
let prevCascader = data.scopeId.split(",");
|
let prevCascader = data.scopeId.split(",");
|
||||||
function next(params, prev) {
|
function next(params, prev) {
|
||||||
for (let i = 0; i < params.length; i++) {
|
for (let i = 0; i < params.length; i++) {
|
||||||
const item = params[i];
|
const item = params[i];
|
||||||
|
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
next(item.children, [...prev, item]);
|
next(item.children, [...prev, item]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -336,7 +437,9 @@ export default {
|
||||||
data.scopeIdGoods = prevCascader;
|
data.scopeIdGoods = prevCascader;
|
||||||
}
|
}
|
||||||
data.rangeTime = [];
|
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;
|
this.form = data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -367,10 +470,9 @@ export default {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
params.scopeType == "PORTION_GOODS" &&
|
params.scopeType == "PORTION_GOODS" &&
|
||||||
(!params.promotionGoodsList ||
|
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||||
params.promotionGoodsList.length == 0)
|
|
||||||
) {
|
) {
|
||||||
this.$Modal.warning({title: "提示", content: "请选择指定商品"});
|
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +480,7 @@ export default {
|
||||||
params.scopeType == "PORTION_GOODS_CATEGORY" &&
|
params.scopeType == "PORTION_GOODS_CATEGORY" &&
|
||||||
(!params.scopeIdGoods || params.scopeIdGoods.length == 0)
|
(!params.scopeIdGoods || params.scopeIdGoods.length == 0)
|
||||||
) {
|
) {
|
||||||
this.$Modal.warning({title: "提示", content: "请选择商品分类"});
|
this.$Modal.warning({ title: "提示", content: "请选择商品分类" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,9 +531,7 @@ export default {
|
||||||
// 关闭当前页面
|
// 关闭当前页面
|
||||||
closeCurrentPage() {
|
closeCurrentPage() {
|
||||||
this.$store.commit("removeTag", "add-platform-coupon");
|
this.$store.commit("removeTag", "add-platform-coupon");
|
||||||
localStorage.pageOpenedList = JSON.stringify(
|
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||||
this.$store.state.app.pageOpenedList
|
|
||||||
);
|
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
openSkuList() {
|
openSkuList() {
|
||||||
|
@ -461,11 +561,9 @@ export default {
|
||||||
this.selectedGoods.forEach(function (e) {
|
this.selectedGoods.forEach(function (e) {
|
||||||
ids.push(e.id);
|
ids.push(e.id);
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||||
(item) => {
|
return !ids.includes(item.id);
|
||||||
return !ids.includes(item.id);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -485,6 +583,11 @@ export default {
|
||||||
storeId: e.storeId,
|
storeId: e.storeId,
|
||||||
storeName: e.storeName,
|
storeName: e.storeName,
|
||||||
skuId: e.id,
|
skuId: e.id,
|
||||||
|
categoryPath: e.categoryPath,
|
||||||
|
thumbnail: e.small,
|
||||||
|
goodsType: e.goodsType,
|
||||||
|
goodsId: e.goodsId,
|
||||||
|
originPrice: e.price,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList = list;
|
this.form.promotionGoodsList = list;
|
||||||
|
@ -517,7 +620,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return {value: item.id, label: item.name, children: item.children};
|
return { value: item.id, label: item.name, children: item.children };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
filterCategoryId(list, idArr) {
|
filterCategoryId(list, idArr) {
|
||||||
|
@ -567,4 +670,3 @@ h4 {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,12 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form mb_10">
|
<Form
|
||||||
|
ref="searchForm"
|
||||||
|
:model="searchForm"
|
||||||
|
inline
|
||||||
|
:label-width="70"
|
||||||
|
class="search-form mb_10"
|
||||||
|
>
|
||||||
<Form-item label="活动名称" prop="couponName">
|
<Form-item label="活动名称" prop="couponName">
|
||||||
<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>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -14,28 +31,74 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</Form-item>
|
||||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn"
|
||||||
|
>搜索</Button
|
||||||
|
>
|
||||||
</Form>
|
</Form>
|
||||||
<Row class="operation padding-row" v-if="getType !== 'ACTIVITY'">
|
<Row class="operation padding-row" v-if="getType !== 'ACTIVITY'">
|
||||||
<Button @click="add" type="primary">添加优惠券</Button>
|
<Button @click="add" type="primary">添加优惠券</Button>
|
||||||
<Button @click="delAll">批量下架</Button>
|
<Button @click="delAll">批量关闭</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Table v-if="refreshTable" :loading="loading" border :columns="columns" :data="data" ref="table" class="mt_10" @on-selection-change="changeSelect">
|
<Table
|
||||||
|
v-if="refreshTable"
|
||||||
|
:loading="loading"
|
||||||
|
border
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
ref="table"
|
||||||
|
class="mt_10"
|
||||||
|
@on-selection-change="changeSelect"
|
||||||
|
>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" @click="see(row)">编辑
|
<Button
|
||||||
|
v-if="row.promotionStatus !== 'START'"
|
||||||
|
type="info"
|
||||||
|
size="small"
|
||||||
|
@click="see(row)"
|
||||||
|
>编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button v-else type="default" size="small" @click="see(row,'onlyView')">查看
|
<Button v-else type="default" size="small" @click="see(row, 'onlyView')"
|
||||||
|
>查看
|
||||||
</Button>
|
</Button>
|
||||||
<Button class="ml_5" v-if="row.promotionStatus === 'START' || row.promotionStatus === 'NEW'" type="error" size="small" @click="remove(row)">下架
|
<Button
|
||||||
|
class="ml_5"
|
||||||
|
v-if="row.promotionStatus === 'START' || row.promotionStatus === 'NEW'"
|
||||||
|
type="error"
|
||||||
|
size="small"
|
||||||
|
@click="close(row)"
|
||||||
|
>关闭
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
class="ml_5"
|
||||||
|
v-if="row.promotionStatus === 'CLOSE'"
|
||||||
|
type="error"
|
||||||
|
size="small"
|
||||||
|
@click="remove(row)"
|
||||||
|
>删除
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<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"
|
<Page
|
||||||
show-total show-elevator show-sizer></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>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +107,9 @@
|
||||||
import {
|
import {
|
||||||
getPlatformCouponList,
|
getPlatformCouponList,
|
||||||
updatePlatformCouponStatus,
|
updatePlatformCouponStatus,
|
||||||
|
deletePlatformCoupon,
|
||||||
} from "@/api/promotion";
|
} from "@/api/promotion";
|
||||||
|
import { promotionsStatusRender, promotionsScopeTypeRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "coupon",
|
name: "coupon",
|
||||||
|
@ -87,10 +152,7 @@ export default {
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.price) {
|
if (params.row.price) {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return h("div", params.row.couponDiscount + "折");
|
return h("div", params.row.couponDiscount + "折");
|
||||||
}
|
}
|
||||||
|
@ -104,10 +166,11 @@ export default {
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h(
|
||||||
"div",
|
"div",
|
||||||
params.row.receivedNum + "/" + (params.row.publishNum === 0 ? '不限制' : params.row.publishNum)
|
params.row.receivedNum +
|
||||||
|
"/" +
|
||||||
|
(params.row.publishNum === 0 ? "不限制" : params.row.publishNum)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "优惠券类型",
|
title: "优惠券类型",
|
||||||
|
@ -116,43 +179,35 @@ export default {
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "";
|
let text = "";
|
||||||
if (params.row.couponType === "DISCOUNT") {
|
if (params.row.couponType === "DISCOUNT") {
|
||||||
return h("Tag", {props: {color: "blue",},}, "打折");
|
return h("Tag", { props: { color: "blue" } }, "打折");
|
||||||
} else if (params.row.couponType === "PRICE") {
|
} else if (params.row.couponType === "PRICE") {
|
||||||
return h("Tag", {props: {color: "geekblue",},}, "减免现金");
|
return h("Tag", { props: { color: "geekblue" } }, "减免现金");
|
||||||
}else {
|
} else {
|
||||||
return h("Tag", {props: {color: "purple",},}, "未知");
|
return h("Tag", { props: { color: "purple" } }, "未知");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "品类描述",
|
title: "品类描述",
|
||||||
key: "scopeType",
|
key: "scopeType",
|
||||||
width: 100,
|
width: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知";
|
return promotionsScopeTypeRender(h, params);
|
||||||
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]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动时间",
|
title: "活动时间",
|
||||||
width: 150,
|
width: 150,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.getType === "ACTIVITY" && params.row.rangeDayType == 'DYNAMICTIME') {
|
if (
|
||||||
|
params?.row?.getType === "ACTIVITY" &&
|
||||||
|
params?.row?.rangeDayType === "DYNAMICTIME"
|
||||||
|
) {
|
||||||
return h("div", "长期有效");
|
return h("div", "长期有效");
|
||||||
} else {
|
} else if (params?.row?.startTime && params?.row?.endTime) {
|
||||||
return h("div", {
|
return h("div", {
|
||||||
domProps: {
|
domProps: {
|
||||||
innerHTML:
|
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||||
params.row.startTime + "<br/>" + params.row.endTime,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -164,32 +219,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
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
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
minWidth: 70,
|
minWidth: 70,
|
||||||
},
|
},
|
||||||
|
@ -204,7 +234,7 @@ export default {
|
||||||
data: [], // 表单数据
|
data: [], // 表单数据
|
||||||
total: 0, // 表单数据总数
|
total: 0, // 表单数据总数
|
||||||
refreshTable: true, // 修改选中状态后刷新表格
|
refreshTable: true, // 修改选中状态后刷新表格
|
||||||
selectDate:[], //选中的信息
|
selectDate: [], //选中的信息
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -213,17 +243,21 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
promotionStatus: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
//已选择优惠券
|
//已选择优惠券
|
||||||
selectedList: {
|
selectedList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: ()=>{
|
default: () => {
|
||||||
return []
|
return [];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route(to, from) {
|
$route(to, from) {
|
||||||
if (to.fullPath == "/promotion/manager-coupon") {
|
if (to.fullPath == "/promotions/manager-coupon") {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -249,42 +283,49 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.refreshTable = false;
|
this.refreshTable = false;
|
||||||
this.$nextTick(() =>{
|
this.$nextTick(() => {
|
||||||
this.refreshTable = true;
|
this.refreshTable = true;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
check() { // 选中的优惠券
|
check() {
|
||||||
|
// 选中的优惠券
|
||||||
this.$emit("selected", this.selectList);
|
this.$emit("selected", this.selectList);
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
init() {
|
init() {
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
add() { // 跳转添加页面
|
add() {
|
||||||
|
// 跳转添加页面
|
||||||
this.$router.push({ name: "add-platform-coupon" });
|
this.$router.push({ name: "add-platform-coupon" });
|
||||||
},
|
},
|
||||||
info(v) { // 查看优惠券
|
info(v) {
|
||||||
|
// 查看优惠券
|
||||||
this.$router.push({ name: "platform-coupon-info", query: { id: v.id } });
|
this.$router.push({ name: "platform-coupon-info", query: { id: v.id } });
|
||||||
},
|
},
|
||||||
changePage(v) { // 改变页码
|
changePage(v) {
|
||||||
|
// 改变页码
|
||||||
this.searchForm.pageNumber = v;
|
this.searchForm.pageNumber = v;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
changePageSize(v) { // 改变页数
|
changePageSize(v) {
|
||||||
|
// 改变页数
|
||||||
this.searchForm.pageNumber = 1;
|
this.searchForm.pageNumber = 1;
|
||||||
this.searchForm.pageSize = v;
|
this.searchForm.pageSize = v;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
handleSearch() { // 搜索
|
handleSearch() {
|
||||||
|
// 搜索
|
||||||
this.searchForm.pageNumber = 1;
|
this.searchForm.pageNumber = 1;
|
||||||
this.searchForm.pageSize = 10;
|
this.searchForm.pageSize = 10;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
clearSelectAll() { // 清除选中状态
|
clearSelectAll() {
|
||||||
|
// 清除选中状态
|
||||||
this.$refs.table.selectAll(false);
|
this.$refs.table.selectAll(false);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -293,9 +334,10 @@ export default {
|
||||||
changeSelect(e) {
|
changeSelect(e) {
|
||||||
this.selectList = e;
|
this.selectList = e;
|
||||||
this.selectCount = e.length;
|
this.selectCount = e.length;
|
||||||
if (this.getType === 'ACTIVITY') this.check()
|
if (this.getType === "ACTIVITY") this.check();
|
||||||
},
|
},
|
||||||
getDataList() { // 获取数据
|
getDataList() {
|
||||||
|
// 获取数据
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
|
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
|
||||||
this.searchForm.startTime = this.selectDate[0].getTime();
|
this.searchForm.startTime = this.selectDate[0].getTime();
|
||||||
|
@ -315,27 +357,29 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
see(v,only) { // 跳转编辑页面
|
see(v, only) {
|
||||||
let data
|
// 跳转编辑页面
|
||||||
only ? data = { onlyView : true,id: v.id } : data = { id: v.id }
|
let data;
|
||||||
this.$router.push({ name: "edit-platform-coupon", query:data });
|
only ? (data = { onlyView: true, id: v.id }) : (data = { id: v.id });
|
||||||
|
this.$router.push({ name: "edit-platform-coupon", query: data });
|
||||||
},
|
},
|
||||||
remove(v) { // 下架优惠券
|
close(v) {
|
||||||
|
// 下架优惠券
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: "确认下架",
|
title: "确认关闭",
|
||||||
// 记得确认修改此处
|
// 记得确认修改此处
|
||||||
content: "确认要下架此优惠券么?",
|
content: "确认要关闭此优惠券么?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
// 删除
|
// 删除
|
||||||
updatePlatformCouponStatus({
|
updatePlatformCouponStatus({
|
||||||
couponIds: v.id,
|
couponIds: v.id,
|
||||||
promotionStatus: "CLOSE",
|
effectiveDays: 0,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("优惠券已作废");
|
this.$Message.success("优惠券已关闭");
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -345,7 +389,31 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delAll() { // 批量下架
|
remove(v) {
|
||||||
|
// 下架优惠券
|
||||||
|
this.$Modal.confirm({
|
||||||
|
title: "确认删除",
|
||||||
|
// 记得确认修改此处
|
||||||
|
content: "确认要删除此优惠券么?",
|
||||||
|
loading: true,
|
||||||
|
onOk: () => {
|
||||||
|
// 删除
|
||||||
|
deletePlatformCoupon(v.id)
|
||||||
|
.then((res) => {
|
||||||
|
this.$Modal.remove();
|
||||||
|
if (res.success) {
|
||||||
|
this.$Message.success("优惠券已删除");
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$Modal;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
delAll() {
|
||||||
|
// 批量下架
|
||||||
if (this.selectCount <= 0) {
|
if (this.selectCount <= 0) {
|
||||||
this.$Message.warning("您还未选择要下架的优惠券");
|
this.$Message.warning("您还未选择要下架的优惠券");
|
||||||
return;
|
return;
|
||||||
|
@ -380,7 +448,11 @@ export default {
|
||||||
//如果作为组件方式,传入了类型值,则搜索参数附加类型
|
//如果作为组件方式,传入了类型值,则搜索参数附加类型
|
||||||
if (this.getType) {
|
if (this.getType) {
|
||||||
this.searchForm.getType = this.getType;
|
this.searchForm.getType = this.getType;
|
||||||
this.columns.pop()
|
this.columns.pop();
|
||||||
|
}
|
||||||
|
if (this.promotionStatus) {
|
||||||
|
this.searchForm.promotionStatus = this.promotionStatus;
|
||||||
|
this.columns.pop();
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
|
@ -88,10 +88,8 @@
|
||||||
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="额外赠送">
|
<FormItem label="额外赠送">
|
||||||
<Checkbox v-model="form.isFreeFreight" disabled>免邮费</Checkbox
|
<Checkbox v-model="form.isFreeFreight" disabled>免邮费</Checkbox>
|
||||||
>
|
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox>
|
||||||
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox
|
|
||||||
>
|
|
||||||
<Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>
|
<Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>
|
||||||
<Checkbox v-model="form.isPoint" disabled>送积分</Checkbox>
|
<Checkbox v-model="form.isPoint" disabled>送积分</Checkbox>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
@ -105,12 +103,9 @@
|
||||||
:loading="couponLoading"
|
:loading="couponLoading"
|
||||||
style="width: 260px"
|
style="width: 260px"
|
||||||
>
|
>
|
||||||
<Option
|
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{
|
||||||
v-for="item in couponList"
|
item.couponName
|
||||||
:value="item.id"
|
}}</Option>
|
||||||
:key="item.id"
|
|
||||||
>{{ item.couponName }}</Option
|
|
||||||
>
|
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
||||||
|
@ -123,21 +118,13 @@
|
||||||
:loading="giftLoading"
|
:loading="giftLoading"
|
||||||
style="width: 260px"
|
style="width: 260px"
|
||||||
>
|
>
|
||||||
<Option
|
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{
|
||||||
v-for="item in giftList"
|
item.goodsName
|
||||||
:value="item.id"
|
}}</Option>
|
||||||
:key="item.id"
|
|
||||||
>{{ item.goodsName }}</Option
|
|
||||||
>
|
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
||||||
<Input
|
<Input v-model="form.point" type="number" disabled style="width: 260px" />
|
||||||
v-model="form.point"
|
|
||||||
type="number"
|
|
||||||
disabled
|
|
||||||
style="width: 260px"
|
|
||||||
/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="使用范围" prop="scopeType">
|
<FormItem label="使用范围" prop="scopeType">
|
||||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||||
|
@ -146,23 +133,31 @@
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||||
style="width: 100%"
|
<Table border :columns="columns" :data="form.promotionGoodsList">
|
||||||
v-if="form.scopeType == 'PORTION_GOODS'"
|
|
||||||
>
|
|
||||||
<Table
|
|
||||||
border
|
|
||||||
:columns="columns"
|
|
||||||
:data="form.promotionGoodsList"
|
|
||||||
>
|
|
||||||
<template slot-scope="{ row }" slot="goodsName">
|
<template slot-scope="{ row }" slot="goodsName">
|
||||||
<div>
|
<div>
|
||||||
<a class="mr_10" @click="linkTo(row.goodsId,row.skuId)">{{row.goodsName}}</a>
|
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
|
||||||
|
row.goodsName
|
||||||
|
}}</a>
|
||||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<vue-qr :text="wapLinkTo(row.goodsId,row.skuId)" :margin="0" colorDark="#000" colorLight="#fff" :size="150"></vue-qr>
|
<vue-qr
|
||||||
|
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||||
|
:margin="0"
|
||||||
|
colorDark="#000"
|
||||||
|
colorLight="#fff"
|
||||||
|
:size="150"
|
||||||
|
></vue-qr>
|
||||||
</div>
|
</div>
|
||||||
<img src="../../../assets/qrcode.svg" style="vertical-align:middle;" class="hover-pointer" width="20" height="20" alt="">
|
<img
|
||||||
|
src="../../../assets/qrcode.svg"
|
||||||
|
style="vertical-align: middle"
|
||||||
|
class="hover-pointer"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</Poptip>
|
</Poptip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -182,15 +177,16 @@
|
||||||
<script>
|
<script>
|
||||||
import { getPlatformCouponList, getFullDiscountById } from "@/api/promotion";
|
import { getPlatformCouponList, getFullDiscountById } from "@/api/promotion";
|
||||||
import { getGoodsSkuData } from "@/api/goods";
|
import { getGoodsSkuData } from "@/api/goods";
|
||||||
import vueQr from 'vue-qr'
|
import vueQr from "vue-qr";
|
||||||
export default {
|
export default {
|
||||||
name: "addFullCut",
|
name: "add-full-discount",
|
||||||
components: {
|
components: {
|
||||||
"vue-qr":vueQr
|
"vue-qr": vueQr,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: { // 表单
|
form: {
|
||||||
|
// 表单
|
||||||
discountType: "isFullMinus",
|
discountType: "isFullMinus",
|
||||||
scopeType: "ALL",
|
scopeType: "ALL",
|
||||||
promotionGoodsList: [],
|
promotionGoodsList: [],
|
||||||
|
@ -215,17 +211,14 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "库存",
|
title: "库存",
|
||||||
key: "quantity",
|
key: "quantity",
|
||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
disabledDate(date) {
|
disabledDate(date) {
|
||||||
|
@ -246,11 +239,8 @@ export default {
|
||||||
// 获取活动详情
|
// 获取活动详情
|
||||||
getFullDiscountById(this.id).then((res) => {
|
getFullDiscountById(this.id).then((res) => {
|
||||||
let data = res.result;
|
let data = res.result;
|
||||||
if (!data.promotionGoodsList) {
|
if (!data.scopeType === "ALL") {
|
||||||
data.promotionGoodsList = [];
|
data.promotionGoodsList = [];
|
||||||
data.scopeType = "ALL";
|
|
||||||
} else {
|
|
||||||
data.scopeType = "PORTION_GOODS";
|
|
||||||
}
|
}
|
||||||
if (data.isFullMinus) {
|
if (data.isFullMinus) {
|
||||||
data.discountType = "isFullMinus";
|
data.discountType = "isFullMinus";
|
||||||
|
@ -271,7 +261,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageNumber: 0,
|
pageNumber: 0,
|
||||||
couponName: query,
|
couponName: query,
|
||||||
promotionStatus:"START"
|
promotionStatus: "START",
|
||||||
};
|
};
|
||||||
this.couponLoading = true;
|
this.couponLoading = true;
|
||||||
getPlatformCouponList(params).then((res) => {
|
getPlatformCouponList(params).then((res) => {
|
||||||
|
@ -318,4 +308,3 @@ h4 {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,13 +2,29 @@
|
||||||
<div class="full-cut">
|
<div class="full-cut">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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">
|
<Form-item label="活动名称" prop="promotionName">
|
||||||
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable
|
<Input
|
||||||
style="width: 200px" />
|
type="text"
|
||||||
|
v-model="searchForm.promotionName"
|
||||||
|
placeholder="请输入活动名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -16,13 +32,33 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</DatePicker>
|
||||||
</Form-item>
|
</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
|
||||||
|
>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table" class="mt_10" sortable="custom">
|
<Table
|
||||||
|
:loading="loading"
|
||||||
|
border
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
ref="table"
|
||||||
|
class="mt_10"
|
||||||
|
sortable="custom"
|
||||||
|
>
|
||||||
<template slot-scope="{ row }" slot="applyEndTime">
|
<template slot-scope="{ row }" slot="applyEndTime">
|
||||||
{{ unixDate(row.applyEndTime) }}
|
{{ unixDate(row.applyEndTime) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -30,28 +66,50 @@
|
||||||
{{ row.isFullMinus ? "满减" : "满折" }}
|
{{ row.isFullMinus ? "满减" : "满折" }}
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="hours">
|
<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>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<div>
|
<div>
|
||||||
<Button type="info" size="small" @click="view(row)">查看</Button>
|
<Button type="info" size="small" @click="view(row)">查看</Button>
|
||||||
<Button type="error" v-if="row.promotionStatus === 'START'" style="margin-left:5px" size="small"
|
<Button
|
||||||
@click="openOrClose(row)">关闭</Button>
|
type="error"
|
||||||
<Button type="success" v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
v-if="row.promotionStatus === 'START'"
|
||||||
style="margin-left:5px" size="small" @click="openOrClose(row)">开启</Button>
|
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
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<Row type="flex" justify="end" class="mt_10">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
<Page
|
||||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
:current="searchForm.pageNumber"
|
||||||
show-sizer></Page>
|
: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>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getFullDiscountList, updateFullDiscount } from "@/api/promotion.js";
|
import { getFullDiscountList, updateFullDiscount } from "@/api/promotion.js";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -98,32 +156,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
color = "purple";
|
|
||||||
if (params.row.promotionStatus == "NEW") {
|
|
||||||
text = "未开始";
|
|
||||||
color = "geekblue";
|
|
||||||
} else if (params.row.promotionStatus == "START") {
|
|
||||||
text = "已开始";
|
|
||||||
color = "blue";
|
|
||||||
} else if (params.row.promotionStatus == "END") {
|
|
||||||
text = "已结束";
|
|
||||||
color = "green";
|
|
||||||
} else if (params.row.promotionStatus == "CLOSE") {
|
|
||||||
text = "已关闭";
|
|
||||||
color = "volcano";
|
|
||||||
}
|
|
||||||
return h("div", [
|
|
||||||
h(
|
|
||||||
"Tag",
|
|
||||||
{
|
|
||||||
props: {
|
|
||||||
color: color,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
text
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -203,7 +236,7 @@ export default {
|
||||||
},
|
},
|
||||||
view(row) {
|
view(row) {
|
||||||
// 查看
|
// 查看
|
||||||
this.$router.push({ name: "full-cut-detail", query: { id: row.id } });
|
this.$router.push({ name: "full-discount-detail", query: { id: row.id } });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
|
@ -13,21 +13,33 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem astyle="width: 100%">
|
<FormItem astyle="width: 100%">
|
||||||
<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="skuId">
|
<template slot-scope="{ row }" slot="skuId">
|
||||||
<div>{{ row.skuId }}</div>
|
<div>{{ row.skuId }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ index }" slot="settlementPrice">
|
<template slot-scope="{ index }" slot="settlementPrice">
|
||||||
<InputNumber :min="0" v-model="form.promotionGoodsList[index].settlementPrice" />
|
<InputNumber
|
||||||
|
:min="0"
|
||||||
|
v-model="form.promotionGoodsList[index].settlementPrice"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ index }" slot="lowestPrice">
|
<template slot-scope="{ index }" slot="lowestPrice">
|
||||||
<InputNumber :min="0" v-model="form.promotionGoodsList[index].lowestPrice" />
|
<InputNumber
|
||||||
|
:min="0"
|
||||||
|
v-model="form.promotionGoodsList[index].lowestPrice"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ index }" slot="highestPrice">
|
<template slot-scope="{ index }" slot="highestPrice">
|
||||||
<InputNumber :min="0" v-model="form.promotionGoodsList[index].highestPrice" />
|
<InputNumber
|
||||||
|
:min="0"
|
||||||
|
v-model="form.promotionGoodsList[index].highestPrice"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ index }" slot="stock">
|
<template slot-scope="{ index }" slot="stock">
|
||||||
<InputNumber :min="0" v-model="form.promotionGoodsList[index].stock" />
|
<InputNumber :min="0" v-model="form.promotionGoodsList[index].stock" />
|
||||||
|
@ -35,13 +47,21 @@
|
||||||
</Table>
|
</Table>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动时间" prop="rangeTime">
|
<FormItem label="活动时间" prop="rangeTime">
|
||||||
<DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择"
|
<DatePicker
|
||||||
:options="options" style="width: 260px">
|
type="datetimerange"
|
||||||
|
v-model="form.rangeTime"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择"
|
||||||
|
:options="options"
|
||||||
|
style="width: 260px"
|
||||||
|
>
|
||||||
</DatePicker>
|
</DatePicker>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<div>
|
<div>
|
||||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||||
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||||
|
>提交</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +77,7 @@ import { regular } from "@/utils";
|
||||||
import skuSelect from "@/views/lili-dialog";
|
import skuSelect from "@/views/lili-dialog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "addKanJiaActivityGoods",
|
name: "add-kanjia-activity-goods",
|
||||||
components: {
|
components: {
|
||||||
skuSelect,
|
skuSelect,
|
||||||
},
|
},
|
||||||
|
@ -92,10 +112,7 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
width: 120,
|
width: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -260,9 +277,7 @@ export default {
|
||||||
// 关闭当前页面
|
// 关闭当前页面
|
||||||
closeCurrentPage() {
|
closeCurrentPage() {
|
||||||
this.$store.commit("removeTag", "add-kan-jia-goods");
|
this.$store.commit("removeTag", "add-kan-jia-goods");
|
||||||
localStorage.pageOpenedList = JSON.stringify(
|
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||||
this.$store.state.app.pageOpenedList
|
|
||||||
);
|
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
openSkuList() {
|
openSkuList() {
|
||||||
|
@ -310,7 +325,7 @@ export default {
|
||||||
item.forEach((e) => {
|
item.forEach((e) => {
|
||||||
list.push({
|
list.push({
|
||||||
settlementPrice: e.settlementPrice || 0,
|
settlementPrice: e.settlementPrice || 0,
|
||||||
purchasePrice: 0,
|
purchasePrice: 0,
|
||||||
lowestPrice: e.lowestPrice || 0,
|
lowestPrice: e.lowestPrice || 0,
|
||||||
highestPrice: e.highestPrice || 0,
|
highestPrice: e.highestPrice || 0,
|
||||||
stock: e.stock || 0,
|
stock: e.stock || 0,
|
||||||
|
@ -363,4 +378,3 @@ h4 {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,12 +2,29 @@
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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="goodsName">
|
<Form-item label="商品名称" prop="goodsName">
|
||||||
<Input type="text" v-model="searchForm.goodsName" placeholder="请输入商品名称" clearable style="width: 200px" />
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="searchForm.goodsName"
|
||||||
|
placeholder="请输入商品名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -15,28 +32,59 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</DatePicker>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
<Button
|
||||||
|
@click="handleSearch"
|
||||||
|
type="primary"
|
||||||
|
icon="ios-search"
|
||||||
|
class="search-btn"
|
||||||
|
>搜索</Button
|
||||||
|
>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="operation padding-row">
|
<Row class="operation padding-row">
|
||||||
<Button @click="add" type="primary">添加砍价</Button>
|
<Button @click="add" type="primary">添加砍价</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom"
|
<Table
|
||||||
@on-sort-change="changeSort">
|
:loading="loading"
|
||||||
|
border
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
ref="table"
|
||||||
|
sortable="custom"
|
||||||
|
@on-sort-change="changeSort"
|
||||||
|
>
|
||||||
<template slot-scope="{ row }" slot="goodsName">
|
<template slot-scope="{ row }" slot="goodsName">
|
||||||
<div>
|
<div>
|
||||||
<a class="mr_10" @click="linkTo(row.goodsSku.goodsId,row.skuId)">{{row.goodsName}}</a>
|
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
|
||||||
|
row.goodsName
|
||||||
|
}}</a>
|
||||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
|
<vue-qr
|
||||||
<vue-qr :text="wapLinkTo(row.goodsSku.goodsId,row.skuId)" :margin="0" colorDark="#000" colorLight="#fff"
|
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||||
:size="150"></vue-qr>
|
:margin="0"
|
||||||
|
colorDark="#000"
|
||||||
|
colorLight="#fff"
|
||||||
|
:size="150"
|
||||||
|
></vue-qr>
|
||||||
</div>
|
</div>
|
||||||
<img src="../../../assets/qrcode.svg" style="vertical-align:middle;" class="hover-pointer" width="20"
|
<img
|
||||||
height="20" alt="">
|
src="../../../assets/qrcode.svg"
|
||||||
|
style="vertical-align: middle"
|
||||||
|
class="hover-pointer"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</Poptip>
|
</Poptip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -45,24 +93,47 @@
|
||||||
<div>{{ row.endTime }}</div>
|
<div>{{ row.endTime }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="quantity">
|
<template slot-scope="{ row }" slot="quantity">
|
||||||
<div>{{ row.goodsSku.quantity }}</div>
|
<div>{{ row.stock }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button v-if="row.promotionStatus != 'NEW'" size="small" style="margin-right: 10px"
|
<Button
|
||||||
@click="edit(row,'onlyView')">查看
|
v-if="row.promotionStatus != 'NEW'"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
@click="edit(row, 'onlyView')"
|
||||||
|
>查看
|
||||||
</Button>
|
</Button>
|
||||||
<Button v-if="row.promotionStatus === 'NEW'" type="info" size="small" style="margin-right: 10px"
|
<Button
|
||||||
@click="edit(row)">编辑
|
v-if="row.promotionStatus === 'NEW'"
|
||||||
|
type="info"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
@click="edit(row)"
|
||||||
|
>编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'END'" type="error" size="small"
|
<Button
|
||||||
style="margin-right: 10px" @click="delAll(row)">删除
|
v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'END'"
|
||||||
|
type="error"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
@click="delAll(row)"
|
||||||
|
>删除
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="page">
|
<Row type="flex" justify="end" class="page">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
<Page
|
||||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
:current="searchForm.pageNumber"
|
||||||
show-sizer></Page>
|
: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>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,6 +141,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getKanJiaGoodsList, delKanJiaGoods } from "@/api/promotion";
|
import { getKanJiaGoodsList, delKanJiaGoods } from "@/api/promotion";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
import vueQr from "vue-qr";
|
import vueQr from "vue-qr";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -172,32 +244,7 @@ export default {
|
||||||
title: "状态",
|
title: "状态",
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
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
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
width: 100,
|
width: 100,
|
||||||
},
|
},
|
||||||
|
@ -217,7 +264,7 @@ export default {
|
||||||
props: {},
|
props: {},
|
||||||
watch: {
|
watch: {
|
||||||
$route(to, from) {
|
$route(to, from) {
|
||||||
if (to.fullPath == "/promotion/manager-coupon") {
|
if (to.fullPath == "/promotions/manager-coupon") {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -284,11 +331,11 @@ export default {
|
||||||
this.total = this.data.length;
|
this.total = this.data.length;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
edit(v,type) {
|
edit(v, type) {
|
||||||
let data = {
|
let data = {
|
||||||
id:v.id
|
id: v.id,
|
||||||
}
|
};
|
||||||
type ? data.onlyView = true : ''
|
type ? (data.onlyView = true) : "";
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "edit-kanJia-activity-goods",
|
name: "edit-kanJia-activity-goods",
|
||||||
query: data,
|
query: data,
|
|
@ -1,18 +1,31 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Card>
|
<Card>
|
||||||
|
|
||||||
<Tabs v-model="searchForm.status">
|
<Tabs v-model="searchForm.status">
|
||||||
<!-- 标签栏 -->
|
<!-- 标签栏 -->
|
||||||
<TabPane v-for="(item,index) in tabs" :key="index" :name="item.status" :label="item.title">
|
<TabPane
|
||||||
|
v-for="(item, index) in tabs"
|
||||||
|
:key="index"
|
||||||
|
:name="item.status"
|
||||||
|
:label="item.title"
|
||||||
|
>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<Table :columns="liveColumns" :data="liveData"></Table>
|
<Table :columns="liveColumns" :data="liveData"></Table>
|
||||||
<Row type="flex" style="margin:20px;" justify="end" class="mt_10">
|
<Row type="flex" style="margin: 20px" justify="end" class="mt_10">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePageNumber" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
|
<Page
|
||||||
size="small" show-total show-elevator show-sizer></Page>
|
:current="searchForm.pageNumber"
|
||||||
|
:total="total"
|
||||||
|
:page-size="searchForm.pageSize"
|
||||||
|
@on-change="changePageNumber"
|
||||||
|
@on-page-size-change="changePageSize"
|
||||||
|
:page-size-opts="[10, 20, 50]"
|
||||||
|
size="small"
|
||||||
|
show-total
|
||||||
|
show-elevator
|
||||||
|
show-sizer
|
||||||
|
></Page>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -58,10 +71,7 @@ export default {
|
||||||
title: "直播开始时间",
|
title: "直播开始时间",
|
||||||
key: "createTime",
|
key: "createTime",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("span", this.$options.filters.unixToDate(params.row.startTime));
|
||||||
"span",
|
|
||||||
this.$options.filters.unixToDate(params.row.startTime)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -117,12 +127,12 @@ export default {
|
||||||
{
|
{
|
||||||
title: "直播状态",
|
title: "直播状态",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if(params.row.status == "NEW"){
|
if (params.row.status == "NEW") {
|
||||||
return h("div", [h("tag", {props: {color: "blue"}}, "未开始")]);
|
return h("div", [h("tag", { props: { color: "blue" } }, "未开始")]);
|
||||||
}else if(params.row.status == "START"){
|
} else if (params.row.status == "START") {
|
||||||
return h("div", [h("tag", {props: {color: "green"}}, "直播中")]);
|
return h("div", [h("tag", { props: { color: "green" } }, "直播中")]);
|
||||||
}else{
|
} else {
|
||||||
return h("div", [h("tag", {props: {color: "volcano"}}, "已结束")]);
|
return h("div", [h("tag", { props: { color: "volcano" } }, "已结束")]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -227,7 +237,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
getLiveDetail(val) {
|
getLiveDetail(val) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/liveDetail",
|
path: "/live-detail",
|
||||||
query: { ...val, liveStatus: this.searchForm.status },
|
query: { ...val, liveStatus: this.searchForm.status },
|
||||||
});
|
});
|
||||||
},
|
},
|
|
@ -2,34 +2,45 @@
|
||||||
<div class="pintuan-goods">
|
<div class="pintuan-goods">
|
||||||
<Card>
|
<Card>
|
||||||
<h4>活动详情</h4>
|
<h4>活动详情</h4>
|
||||||
<Table style="margin: 10px 0" border
|
<Table style="margin: 10px 0" border :columns="columns" :data="data"></Table>
|
||||||
:columns="columns"
|
|
||||||
:data="data"
|
|
||||||
></Table>
|
|
||||||
|
|
||||||
<h4>商品信息</h4>
|
<h4>商品信息</h4>
|
||||||
<Table
|
<Table
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
border
|
border
|
||||||
class="operation"
|
class="operation"
|
||||||
:columns="goodsColumns"
|
:columns="goodsColumns"
|
||||||
:data="goodsData"
|
:data="goodsData"
|
||||||
ref="table"
|
ref="table"
|
||||||
sortable="custom"
|
sortable="custom"
|
||||||
>
|
>
|
||||||
<template slot-scope="{ row }" slot="goodsName">
|
<template slot-scope="{ row }" slot="goodsName">
|
||||||
<div>
|
<div>
|
||||||
<a class="mr_10" @click="linkTo(row.goodsId,row.skuId)">{{row.goodsName}}</a>
|
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
|
||||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
row.goodsName
|
||||||
<div slot="content">
|
}}</a>
|
||||||
<vue-qr :text="wapLinkTo(row.goodsId,row.skuId)" :margin="0" colorDark="#000" colorLight="#fff" :size="150"></vue-qr>
|
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||||
</div>
|
<div slot="content">
|
||||||
<img src="../../../assets/qrcode.svg" style="vertical-align:middle;" class="hover-pointer" width="20" height="20" alt="">
|
<vue-qr
|
||||||
</Poptip>
|
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||||
</div>
|
:margin="0"
|
||||||
</template>
|
colorDark="#000"
|
||||||
|
colorLight="#fff"
|
||||||
</Table>
|
:size="150"
|
||||||
|
></vue-qr>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
src="../../../assets/qrcode.svg"
|
||||||
|
style="vertical-align: middle"
|
||||||
|
class="hover-pointer"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</Poptip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Table>
|
||||||
<Row type="flex" justify="end" class="page operation">
|
<Row type="flex" justify="end" class="page operation">
|
||||||
<Page
|
<Page
|
||||||
:current="searchForm.pageNumber"
|
:current="searchForm.pageNumber"
|
||||||
|
@ -49,8 +60,13 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getPintuanGoodsList, getPintuanDetail } from "@/api/promotion.js";
|
import { getPintuanGoodsList, getPintuanDetail } from "@/api/promotion.js";
|
||||||
|
import vueQr from "vue-qr";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
"vue-qr": vueQr,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false, // 表单加载状态
|
loading: false, // 表单加载状态
|
||||||
|
@ -66,17 +82,17 @@ export default {
|
||||||
{
|
{
|
||||||
title: "活动名称",
|
title: "活动名称",
|
||||||
key: "promotionName",
|
key: "promotionName",
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动开始时间",
|
title: "活动开始时间",
|
||||||
key: "startTime",
|
key: "startTime",
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动结束时间",
|
title: "活动结束时间",
|
||||||
key: "endTime",
|
key: "endTime",
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "成团人数",
|
title: "成团人数",
|
||||||
|
@ -91,32 +107,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
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
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -138,15 +129,11 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
minWidth: 50,
|
minWidth: 50,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
goodsData: [] // 商品数据
|
goodsData: [], // 商品数据
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
|
@ -39,9 +39,7 @@
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
></DatePicker>
|
></DatePicker>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Button @click="handleSearch" type="primary" class="search-btn"
|
<Button @click="handleSearch" type="primary" class="search-btn">搜索</Button>
|
||||||
>搜索</Button
|
|
||||||
>
|
|
||||||
</Form>
|
</Form>
|
||||||
<Table
|
<Table
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
@ -52,19 +50,13 @@
|
||||||
class="mt_10"
|
class="mt_10"
|
||||||
>
|
>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button
|
<Button type="info" size="small" @click="view(row)" style="margin-right: 5px"
|
||||||
type="info"
|
|
||||||
size="small"
|
|
||||||
@click="view(row)"
|
|
||||||
style="margin-right: 5px"
|
|
||||||
>查看</Button
|
>查看</Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="error"
|
type="error"
|
||||||
size="small"
|
size="small"
|
||||||
:disabled="
|
:disabled="row.promotionStatus == 'END' || row.promotionStatus == 'CLOSE'"
|
||||||
row.promotionStatus == 'END' || row.promotionStatus == 'CLOSE'
|
|
||||||
"
|
|
||||||
@click="close(row)"
|
@click="close(row)"
|
||||||
>关闭
|
>关闭
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -89,13 +81,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPintuanList, closePintuan } from "@/api/promotion";
|
import { getPintuanList, updatePintuanStatus } from "@/api/promotion";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "pintuan",
|
name: "pintuan",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectDate:[], //选中的数据
|
selectDate: [], //选中的数据
|
||||||
loading: true, // 表单加载状态
|
loading: true, // 表单加载状态
|
||||||
searchForm: {
|
searchForm: {
|
||||||
// 搜索框初始化对象
|
// 搜索框初始化对象
|
||||||
|
@ -104,7 +97,8 @@ export default {
|
||||||
sort: "startTime",
|
sort: "startTime",
|
||||||
order: "desc", // 默认排序方式
|
order: "desc", // 默认排序方式
|
||||||
},
|
},
|
||||||
columns: [ // 表头
|
columns: [
|
||||||
|
// 表头
|
||||||
{
|
{
|
||||||
title: "活动名称",
|
title: "活动名称",
|
||||||
key: "promotionName",
|
key: "promotionName",
|
||||||
|
@ -116,30 +110,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
width: 110,
|
width: 110,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
color = "";
|
|
||||||
if (params.row.promotionStatus == "NEW") {
|
|
||||||
text = "未开始";
|
|
||||||
color = "geekblue";
|
|
||||||
} else if (params.row.promotionStatus == "START") {
|
|
||||||
text = "已开始";
|
|
||||||
color = "blue";
|
|
||||||
} else if (params.row.promotionStatus == "END") {
|
|
||||||
text = "已结束";
|
|
||||||
color = "green";
|
|
||||||
} else if (params.row.promotionStatus == "CLOSE") {
|
|
||||||
text = "已关闭";
|
|
||||||
color = "volcano";
|
|
||||||
}
|
|
||||||
return h("div", [
|
|
||||||
h(
|
|
||||||
"Tag",
|
|
||||||
{
|
|
||||||
props: { color: color },
|
|
||||||
},
|
|
||||||
text
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -152,12 +123,12 @@ export default {
|
||||||
{
|
{
|
||||||
title: "活动开始时间",
|
title: "活动开始时间",
|
||||||
key: "startTime",
|
key: "startTime",
|
||||||
width: 180
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动结束时间",
|
title: "活动结束时间",
|
||||||
key: "endTime",
|
key: "endTime",
|
||||||
width: 180
|
width: 180,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -226,7 +197,7 @@ export default {
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
// 删除
|
// 删除
|
||||||
closePintuan(v.id).then((res) => {
|
updatePintuanStatus(v.id).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("操作成功");
|
this.$Message.success("操作成功");
|
||||||
|
@ -243,7 +214,7 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.ivu-form-item{
|
.ivu-form-item {
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -34,14 +34,11 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template
|
<template slot-scope="{ row, index }" slot="pointsGoodsCategory">
|
||||||
slot-scope="{ row, index }"
|
|
||||||
slot="pointsGoodsCategory"
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
v-model="promotionGoodsList[index].pointsGoodsCategoryId"
|
v-model="promotionGoodsList[index].pointsGoodsCategoryId"
|
||||||
transfer="true"
|
:transfer="true"
|
||||||
label-in-value="true"
|
:label-in-value="true"
|
||||||
@on-change="
|
@on-change="
|
||||||
(val) => {
|
(val) => {
|
||||||
changeCategory(val, index);
|
changeCategory(val, index);
|
||||||
|
@ -90,10 +87,7 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<div>
|
<div>
|
||||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||||
<Button
|
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||||
type="primary"
|
|
||||||
:loading="submitLoading"
|
|
||||||
@click="handleSubmit"
|
|
||||||
>提交</Button
|
>提交</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,10 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
<sku-select
|
<sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
|
||||||
ref="skuSelect"
|
|
||||||
@selectedGoodsData="selectedGoodsData"
|
|
||||||
></sku-select>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -198,10 +189,7 @@ export default {
|
||||||
key: "goodsName",
|
key: "goodsName",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", params.row.goodsSku.goodsName);
|
||||||
"div",
|
|
||||||
params.row.goodsSku.goodsName
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -214,10 +202,7 @@ export default {
|
||||||
key: "storeName",
|
key: "storeName",
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", params.row.goodsSku.storeName);
|
||||||
"div",
|
|
||||||
params.row.goodsSku.storeName
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -236,10 +221,7 @@ export default {
|
||||||
key: "quantity",
|
key: "quantity",
|
||||||
minWidth: 20,
|
minWidth: 20,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", params.row.goodsSku.quantity);
|
||||||
"div",
|
|
||||||
params.row.goodsSku.quantity
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -308,12 +290,8 @@ export default {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let params = this.promotionGoodsList;
|
let params = this.promotionGoodsList;
|
||||||
const start = this.$options.filters.unixToDate(
|
const start = this.$options.filters.unixToDate(this.form.startTime / 1000);
|
||||||
this.form.startTime / 1000
|
const end = this.$options.filters.unixToDate(this.form.endTime / 1000);
|
||||||
);
|
|
||||||
const end = this.$options.filters.unixToDate(
|
|
||||||
this.form.endTime / 1000
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!params || params.length == 0) {
|
if (!params || params.length == 0) {
|
||||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||||
|
@ -339,15 +317,12 @@ export default {
|
||||||
// 关闭当前页面
|
// 关闭当前页面
|
||||||
closeCurrentPage() {
|
closeCurrentPage() {
|
||||||
this.$store.commit("removeTag", "add-points-goods");
|
this.$store.commit("removeTag", "add-points-goods");
|
||||||
localStorage.pageOpenedList = JSON.stringify(
|
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||||
this.$store.state.app.pageOpenedList
|
|
||||||
);
|
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
// 选择分类
|
// 选择分类
|
||||||
changeCategory(val, index) {
|
changeCategory(val, index) {
|
||||||
this.promotionGoodsList[index].pointsGoodsCategoryName = val.label;
|
this.promotionGoodsList[index].pointsGoodsCategoryName = val.label;
|
||||||
console.log(this.promotionGoodsList);
|
|
||||||
},
|
},
|
||||||
// 变更选中状态
|
// 变更选中状态
|
||||||
changeSelect(e) {
|
changeSelect(e) {
|
||||||
|
@ -368,11 +343,9 @@ export default {
|
||||||
this.selectedGoods.forEach(function (e) {
|
this.selectedGoods.forEach(function (e) {
|
||||||
ids.push(e.id);
|
ids.push(e.id);
|
||||||
});
|
});
|
||||||
this.promotionGoodsList = this.promotionGoodsList.filter(
|
this.promotionGoodsList = this.promotionGoodsList.filter((item) => {
|
||||||
(item) => {
|
return !ids.includes(item.id);
|
||||||
return !ids.includes(item.id);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -380,12 +353,13 @@ export default {
|
||||||
// 删除商品
|
// 删除商品
|
||||||
this.promotionGoodsList.splice(index, 1);
|
this.promotionGoodsList.splice(index, 1);
|
||||||
},
|
},
|
||||||
openSkuList() { // 显示商品选择器
|
openSkuList() {
|
||||||
|
// 显示商品选择器
|
||||||
this.$refs.skuSelect.open("goods");
|
this.$refs.skuSelect.open("goods");
|
||||||
let data = JSON.parse(JSON.stringify(this.promotionGoodsList))
|
let data = JSON.parse(JSON.stringify(this.promotionGoodsList));
|
||||||
data.forEach(e => {
|
data.forEach((e) => {
|
||||||
e.id = e.skuId
|
e.id = e.skuId;
|
||||||
})
|
});
|
||||||
this.$refs.skuSelect.goodsData = data;
|
this.$refs.skuSelect.goodsData = data;
|
||||||
},
|
},
|
||||||
selectedGoodsData(item) {
|
selectedGoodsData(item) {
|
||||||
|
@ -395,12 +369,16 @@ export default {
|
||||||
const obj = {
|
const obj = {
|
||||||
settlementPrice: e.settlementPrice || 0,
|
settlementPrice: e.settlementPrice || 0,
|
||||||
pointsGoodsCategoryId: e.pointsGoodsCategoryId || 0,
|
pointsGoodsCategoryId: e.pointsGoodsCategoryId || 0,
|
||||||
pointsGoodsCategoryName:e.pointsGoodsCategoryName || "",
|
pointsGoodsCategoryName: e.pointsGoodsCategoryName || "",
|
||||||
activeStock:e.activeStock || 0,
|
activeStock: e.activeStock || 0,
|
||||||
points:e.points || 0,
|
points: e.points || 0,
|
||||||
skuId: e.id,
|
skuId: e.id,
|
||||||
goodsSku: e.goodsSku || e
|
goodsId: e.goodsId,
|
||||||
}
|
originalPrice: e.price || 0,
|
||||||
|
thumbnail: e.thumbnail || "",
|
||||||
|
goodsName: e.goodsName || "",
|
||||||
|
goodsSku: e,
|
||||||
|
};
|
||||||
list.push(obj);
|
list.push(obj);
|
||||||
});
|
});
|
||||||
this.promotionGoodsList = list;
|
this.promotionGoodsList = list;
|
||||||
|
@ -426,8 +404,7 @@ h4 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
.wrapper{
|
.wrapper {
|
||||||
min-height: 800px;
|
min-height: 800px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,25 +2,62 @@
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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="商品名称">
|
<Form-item label="商品名称">
|
||||||
<Input type="text" v-model="searchForm.goodsName" placeholder="请输入商品名称" clearable style="width: 200px" />
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="searchForm.goodsName"
|
||||||
|
placeholder="请输入商品名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="积分区间">
|
<Form-item label="积分区间">
|
||||||
<Input type="text" v-model="searchForm.pointsS" placeholder="请输入开始区间" clearable style="width: 200px" />
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="searchForm.pointsS"
|
||||||
|
placeholder="请输入开始区间"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
-
|
-
|
||||||
<Input type="text" v-model="searchForm.pointsE" placeholder="请输入结束区间" clearable style="width: 200px" />
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="searchForm.pointsE"
|
||||||
|
placeholder="请输入结束区间"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="状态">
|
<Form-item label="状态">
|
||||||
<Select v-model="searchForm.promotionStatus" style="width: 200px">
|
<Select v-model="searchForm.promotionStatus" style="width: 200px">
|
||||||
<Option v-for="item in statusList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
<Option v-for="item in statusList" :value="item.value" :key="item.value">{{
|
||||||
|
item.label
|
||||||
|
}}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="SKU编码">
|
<Form-item label="SKU编码">
|
||||||
<Input type="text" v-model="searchForm.skuId" placeholder="请输入SKU编码" clearable style="width: 200px" />
|
<Input
|
||||||
|
type="text"
|
||||||
|
v-model="searchForm.skuId"
|
||||||
|
placeholder="请输入SKU编码"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
<Button
|
||||||
|
@click="handleSearch"
|
||||||
|
type="primary"
|
||||||
|
icon="ios-search"
|
||||||
|
class="search-btn"
|
||||||
|
>搜索</Button
|
||||||
|
>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="operation padding-row">
|
<Row class="operation padding-row">
|
||||||
|
@ -29,38 +66,84 @@
|
||||||
<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="goodsName">
|
<template slot-scope="{ row }" slot="goodsName">
|
||||||
<div>
|
<div>
|
||||||
<a class="mr_10" @click="linkTo(row.goodsSku.goodsId,row.goodsSku.skuId)">{{row.goodsSku.goodsName}}</a>
|
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
|
||||||
|
row.goodsName
|
||||||
|
}}</a>
|
||||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<vue-qr :text="wapLinkTo(row.goodsSku.goodsId,row.goodsSku.skuId)" :margin="0" colorDark="#000" colorLight="#fff" :size="150"></vue-qr>
|
<vue-qr
|
||||||
|
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||||
|
:margin="0"
|
||||||
|
colorDark="#000"
|
||||||
|
colorLight="#fff"
|
||||||
|
:size="150"
|
||||||
|
></vue-qr>
|
||||||
</div>
|
</div>
|
||||||
<img src="../../../assets/qrcode.svg" style="vertical-align:middle;" class="hover-pointer" width="20" height="20" alt="">
|
<img
|
||||||
|
src="../../../assets/qrcode.svg"
|
||||||
|
style="vertical-align: middle"
|
||||||
|
class="hover-pointer"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</Poptip>
|
</Poptip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="price">
|
<template slot-scope="{ row }" slot="price">
|
||||||
<div>{{ row.goodsSku.price | unitPrice("¥") }}</div>
|
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="settlementPrice">
|
<template slot-scope="{ row }" slot="settlementPrice">
|
||||||
<div>{{ row.settlementPrice | unitPrice("¥") }}</div>
|
<div>{{ row.settlementPrice | unitPrice("¥") }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="quantity">
|
<template slot-scope="{ row }" slot="quantity">
|
||||||
<div>{{ row.goodsSku.quantity }}</div>
|
<div>{{ row.activeStock }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="startTime">
|
<template slot-scope="{ row }" slot="startTime">
|
||||||
<div>{{ row.startTime }}</div>
|
<div>{{ row.startTime }}</div>
|
||||||
<div>{{ row.endTime }}</div>
|
<div>{{ row.endTime }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<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
|
||||||
<Button v-if="row.promotionStatus == 'START'" type="warning" size="small" @click="statusChanged(row.id, 'CLOSE')" style="margin-right: 5px">停用</Button>
|
v-if="row.promotionStatus == 'NEW'"
|
||||||
<Button v-if="row.promotionStatus == 'CLOSE'" type="warning" size="small" @click="statusChanged(row.id, 'START')" style="margin-right: 5px">启用</Button>
|
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>
|
<Button type="error" size="small" @click="close(row.id)">删除</Button>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<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"
|
<Page
|
||||||
show-total show-elevator show-sizer></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>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,11 +155,13 @@ import {
|
||||||
editPointsGoodsStatus,
|
editPointsGoodsStatus,
|
||||||
deletePointsGoodsStatus,
|
deletePointsGoodsStatus,
|
||||||
} from "@/api/promotion";
|
} from "@/api/promotion";
|
||||||
import vueQr from 'vue-qr'
|
import vueQr from "vue-qr";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "pointsGoods",
|
name: "pointsGoods",
|
||||||
components: {
|
components: {
|
||||||
"vue-qr":vueQr
|
"vue-qr": vueQr,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -94,7 +179,8 @@ export default {
|
||||||
{ label: "已结束", value: "END" },
|
{ label: "已结束", value: "END" },
|
||||||
{ label: "已关闭", value: "CLOSE" },
|
{ label: "已关闭", value: "CLOSE" },
|
||||||
],
|
],
|
||||||
columns: [ // 表头
|
columns: [
|
||||||
|
// 表头
|
||||||
{
|
{
|
||||||
title: "商品名称",
|
title: "商品名称",
|
||||||
slot: "goodsName",
|
slot: "goodsName",
|
||||||
|
@ -142,22 +228,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
color = "";
|
|
||||||
if (params.row.promotionStatus == "NEW") {
|
|
||||||
text = "未开始";
|
|
||||||
color = "geekblue";
|
|
||||||
} else if (params.row.promotionStatus == "START") {
|
|
||||||
text = "已开始";
|
|
||||||
color = "blue";
|
|
||||||
} else if (params.row.promotionStatus == "END") {
|
|
||||||
text = "已结束";
|
|
||||||
color = "green";
|
|
||||||
} else if (params.row.promotionStatus == "CLOSE") {
|
|
||||||
text = "已关闭";
|
|
||||||
color = "volcano";
|
|
||||||
}
|
|
||||||
return h("div", [h("Tag", { props: { color: color } }, text)]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -225,10 +296,15 @@ export default {
|
||||||
this.$router.push({ name: "edit-points-goods", query: { id: id } });
|
this.$router.push({ name: "edit-points-goods", query: { id: id } });
|
||||||
},
|
},
|
||||||
// 启用 停用积分商品
|
// 启用 停用积分商品
|
||||||
statusChanged(id, status) {
|
statusChanged(id, status, startTime, endTime) {
|
||||||
let text = "";
|
let text = "";
|
||||||
|
let params = {};
|
||||||
if (status == "START") {
|
if (status == "START") {
|
||||||
text = "开启";
|
text = "开启";
|
||||||
|
params = {
|
||||||
|
startTime: startTime,
|
||||||
|
endTime: endTime,
|
||||||
|
};
|
||||||
} else if (status == "CLOSE") {
|
} else if (status == "CLOSE") {
|
||||||
text = "关闭";
|
text = "关闭";
|
||||||
}
|
}
|
||||||
|
@ -237,9 +313,7 @@ export default {
|
||||||
content: "您确认要" + text + "此积分商品?",
|
content: "您确认要" + text + "此积分商品?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
editPointsGoodsStatus(id, {
|
editPointsGoodsStatus(id, params).then((res) => {
|
||||||
promotionStatus: status,
|
|
||||||
}).then((res) => {
|
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success(text + "成功");
|
this.$Message.success(text + "成功");
|
||||||
|
@ -266,7 +340,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
|
@ -53,11 +53,7 @@
|
||||||
v-show="showAddPeriod"
|
v-show="showAddPeriod"
|
||||||
@on-blur="addPeriodTime"
|
@on-blur="addPeriodTime"
|
||||||
></InputNumber>
|
></InputNumber>
|
||||||
<Button
|
<Button type="default" @click="addPeriod">添加时间段</Button>
|
||||||
type="default"
|
|
||||||
@click="addPeriod"
|
|
||||||
>添加时间段</Button
|
|
||||||
>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="申请规则" prop="seckillRule">
|
<FormItem label="申请规则" prop="seckillRule">
|
||||||
<Input
|
<Input
|
||||||
|
@ -71,11 +67,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="foot-btn">
|
<div class="foot-btn">
|
||||||
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
|
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
|
||||||
<Button
|
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||||
type="primary"
|
>提交</Button
|
||||||
:loading="submitLoading"
|
>
|
||||||
@click="handleSubmit"
|
|
||||||
>提交</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -104,7 +98,7 @@ export default {
|
||||||
promotionStatus: "NEW",
|
promotionStatus: "NEW",
|
||||||
},
|
},
|
||||||
id: this.$route.query.id, // 活动id
|
id: this.$route.query.id, // 活动id
|
||||||
periodTime: null, // 抢购时间段
|
periodTime: null, // 抢购时间段
|
||||||
showAddPeriod: false, // input显隐
|
showAddPeriod: false, // input显隐
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
|
|
||||||
|
@ -140,11 +134,13 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addPeriod() { // 添加时间段显示input
|
addPeriod() {
|
||||||
|
// 添加时间段显示input
|
||||||
this.addPeriodTime();
|
this.addPeriodTime();
|
||||||
this.showAddPeriod = true;
|
this.showAddPeriod = true;
|
||||||
},
|
},
|
||||||
addPeriodTime() { // 添加秒杀时间段
|
addPeriodTime() {
|
||||||
|
// 添加秒杀时间段
|
||||||
this.showAddPeriod = false;
|
this.showAddPeriod = false;
|
||||||
if (
|
if (
|
||||||
this.periodTime !== null &&
|
this.periodTime !== null &&
|
||||||
|
@ -153,7 +149,8 @@ export default {
|
||||||
this.form.seckillPeriod.push(this.periodTime);
|
this.form.seckillPeriod.push(this.periodTime);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removePeriodTime(event, name) { // 移除秒杀时间段
|
removePeriodTime(event, name) {
|
||||||
|
// 移除秒杀时间段
|
||||||
this.form.seckillPeriod = this.form.seckillPeriod.filter((i) => i !== name);
|
this.form.seckillPeriod = this.form.seckillPeriod.filter((i) => i !== name);
|
||||||
},
|
},
|
||||||
// // 申请截止时间格式化
|
// // 申请截止时间格式化
|
||||||
|
@ -175,8 +172,13 @@ export default {
|
||||||
delete this.form.updateTime;
|
delete this.form.updateTime;
|
||||||
delete this.form.endTime;
|
delete this.form.endTime;
|
||||||
delete this.form.seckillApplyList;
|
delete this.form.seckillApplyList;
|
||||||
|
let params = this.form;
|
||||||
|
params.startTime = this.$options.filters.unixToDate(this.form.startTime / 1000);
|
||||||
|
params.applyEndTime = this.$options.filters.unixToDate(
|
||||||
|
this.form.applyEndTime / 1000
|
||||||
|
);
|
||||||
// 编辑
|
// 编辑
|
||||||
updateSeckill(this.form).then((res) => {
|
updateSeckill(params).then((res) => {
|
||||||
this.submitLoading = false;
|
this.submitLoading = false;
|
||||||
if (res && res.success) {
|
if (res && res.success) {
|
||||||
this.$Message.success("编辑成功");
|
this.$Message.success("编辑成功");
|
||||||
|
@ -202,7 +204,7 @@ h4 {
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.ivu-form-item{
|
.ivu-form-item {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -2,13 +2,29 @@
|
||||||
<div class="seckill">
|
<div class="seckill">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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">
|
<Form-item label="活动名称" prop="promotionName">
|
||||||
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable
|
<Input
|
||||||
style="width: 200px" />
|
type="text"
|
||||||
|
v-model="searchForm.promotionName"
|
||||||
|
placeholder="请输入活动名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -16,53 +32,107 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</DatePicker>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
|
|
||||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
<Button
|
||||||
|
@click="handleSearch"
|
||||||
|
type="primary"
|
||||||
|
icon="ios-search"
|
||||||
|
class="search-btn"
|
||||||
|
>搜索</Button
|
||||||
|
>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Tabs value="list" class="mt_10" @on-click="clickTabPane">
|
<Tabs value="list" class="mt_10" @on-click="clickTabPane">
|
||||||
<TabPane label="秒杀活动列表" name="list">
|
<TabPane label="秒杀活动列表" name="list">
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table" class="mt_10">
|
<Table
|
||||||
|
:loading="loading"
|
||||||
|
border
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
ref="table"
|
||||||
|
class="mt_10"
|
||||||
|
>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button type="info" size="small" class="mr_5" v-if="row.promotionStatus == 'NEW'"
|
<Button
|
||||||
@click="edit(row)">编辑</Button>
|
type="info"
|
||||||
|
size="small"
|
||||||
|
class="mr_5"
|
||||||
|
v-if="row.promotionStatus == 'NEW'"
|
||||||
|
@click="edit(row)"
|
||||||
|
>编辑</Button
|
||||||
|
>
|
||||||
|
|
||||||
<Button type="info" size="small" class="mr_5" v-else @click="manage(row)">查看</Button>
|
<Button type="info" size="small" class="mr_5" v-else @click="manage(row)"
|
||||||
|
>查看</Button
|
||||||
|
>
|
||||||
|
|
||||||
<Button type="success" size="small" class="mr_5" v-if="row.promotionStatus == 'NEW'"
|
<Button
|
||||||
@click="manage(row)">管理</Button>
|
type="success"
|
||||||
|
size="small"
|
||||||
|
class="mr_5"
|
||||||
|
v-if="row.promotionStatus == 'NEW'"
|
||||||
|
@click="manage(row)"
|
||||||
|
>管理</Button
|
||||||
|
>
|
||||||
|
|
||||||
<Button type="error" size="small" v-if="
|
<Button
|
||||||
row.promotionStatus == 'START' || row.promotionStatus == 'NEW'
|
type="error"
|
||||||
" class="mr_5" @click="off(row)">下架</Button>
|
size="small"
|
||||||
|
v-if="row.promotionStatus == 'START' || row.promotionStatus == 'NEW'"
|
||||||
|
class="mr_5"
|
||||||
|
@click="off(row)"
|
||||||
|
>下架</Button
|
||||||
|
>
|
||||||
|
|
||||||
<Button type="error" size="small" v-if="row.promotionStatus == 'CLOSE'" ghost
|
<Button
|
||||||
@click="expire(row)">删除</Button>
|
type="error"
|
||||||
|
size="small"
|
||||||
|
v-if="row.promotionStatus == 'CLOSE'"
|
||||||
|
ghost
|
||||||
|
@click="expire(row)"
|
||||||
|
>删除</Button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<Row type="flex" justify="end" class="mt_10">
|
||||||
<Page style="margin: 20px 0;" :current="searchForm.pageNumber" :total="total"
|
<Page
|
||||||
:page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize"
|
style="margin: 20px 0"
|
||||||
:page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></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>
|
</Row>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane label="秒杀活动设置" name="setup">
|
<TabPane label="秒杀活动设置" name="setup">
|
||||||
|
|
||||||
<setupSeckill v-if="setupFlag"></setupSeckill>
|
<setupSeckill v-if="setupFlag"></setupSeckill>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getSeckillList, delSeckill, closeSeckill } from "@/api/promotion";
|
import { getSeckillList, delSeckill, updateSeckillStatus } from "@/api/promotion";
|
||||||
import setupSeckill from "@/views/promotion/seckill/setupSeckill";
|
import setupSeckill from "@/views/promotions/seckill/seckill-setup";
|
||||||
|
import { promotionsStatusRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "seckill",
|
name: "seckill",
|
||||||
components: {
|
components: {
|
||||||
|
@ -105,15 +175,7 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.promotionStatus == "NEW") {
|
return promotionsStatusRender(h, params);
|
||||||
return h("Tag", { props: { color: "geekblue" } }, "新建");
|
|
||||||
} else if (params.row.promotionStatus == "START") {
|
|
||||||
return h("Tag", { props: { color: "green" } }, "开始");
|
|
||||||
} else if (params.row.promotionStatus == "END") {
|
|
||||||
return h("Tag", { props: { color: "volcano" } }, "结束");
|
|
||||||
} else if (params.row.promotionStatus == "CLOSE") {
|
|
||||||
return h("Tag", { props: { color: "red" } }, "结束");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -179,7 +241,7 @@ export default {
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "您确定要下架该活动吗?",
|
content: "您确定要下架该活动吗?",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
closeSeckill(v.id).then((res) => {
|
updateSeckillStatus(v.id).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("下架成功");
|
this.$Message.success("下架成功");
|
||||||
this.getDataList();
|
this.getDataList();
|
|
@ -1,15 +1,19 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<!-- 筛选项和操作按钮 -->
|
<!-- 筛选项和操作按钮 -->
|
||||||
<Row class="operation">
|
<Row class="operation">
|
||||||
<i-switch v-model="strict" class="selectModel" size="large" style="margin-right: 5px">
|
<i-switch
|
||||||
|
v-model="strict"
|
||||||
|
class="selectModel"
|
||||||
|
size="large"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
>
|
||||||
<span slot="open">级联</span>
|
<span slot="open">级联</span>
|
||||||
<span slot="close">单选</span>
|
<span slot="close">单选</span>
|
||||||
</i-switch>
|
</i-switch>
|
||||||
<Button @click="addRootMenu" >添加顶级菜单</Button>
|
<Button @click="addRootMenu">添加顶级菜单</Button>
|
||||||
<Button @click="addMenu" type="primary" >添加子菜单</Button>
|
<Button @click="addMenu" type="primary">添加子菜单</Button>
|
||||||
<Button @click="delAll">批量删除</Button>
|
<Button @click="delAll">批量删除</Button>
|
||||||
<Dropdown @on-click="handleDropdown">
|
<Dropdown @on-click="handleDropdown">
|
||||||
<Button>
|
<Button>
|
||||||
|
@ -31,9 +35,7 @@
|
||||||
<Alert show-icon>
|
<Alert show-icon>
|
||||||
当前选择编辑:
|
当前选择编辑:
|
||||||
<span class="select-title">{{ editTitle }}</span>
|
<span class="select-title">{{ editTitle }}</span>
|
||||||
<a class="select-clear" v-if="form.id" @click="cancelEdit"
|
<a class="select-clear" v-if="form.id" @click="cancelEdit">取消选择</a>
|
||||||
>取消选择</a
|
|
||||||
>
|
|
||||||
</Alert>
|
</Alert>
|
||||||
<Input
|
<Input
|
||||||
v-model="searchKey"
|
v-model="searchKey"
|
||||||
|
@ -56,12 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :md="15" :lg="13" :xl="9" style="margin-left: 10px">
|
<Col :md="15" :lg="13" :xl="9" style="margin-left: 10px">
|
||||||
<Form
|
<Form ref="form" :model="form" :label-width="110" :rules="formValidate">
|
||||||
ref="form"
|
|
||||||
:model="form"
|
|
||||||
:label-width="110"
|
|
||||||
:rules="formValidate"
|
|
||||||
>
|
|
||||||
<FormItem label="类型" prop="type">
|
<FormItem label="类型" prop="type">
|
||||||
<div v-show="form.level == 0">
|
<div v-show="form.level == 0">
|
||||||
<Icon
|
<Icon
|
||||||
|
@ -81,41 +78,41 @@
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="菜单名称" prop="title">
|
<FormItem label="菜单名称" prop="title">
|
||||||
<Input v-model="form.title" />
|
<Input class="menu-input" v-model="form.title" />
|
||||||
</FormItem>
|
|
||||||
<FormItem label="路由地址" prop="path" v-if="form.level != 0" class="block-tool">
|
|
||||||
<Tooltip placement="right" content="路由地址,英文唯一,跳转页面,路径展示用 ">
|
|
||||||
<Input v-model="form.path"/>
|
|
||||||
</Tooltip>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem
|
||||||
label="路由名称"
|
label="路由地址"
|
||||||
prop="name"
|
prop="path"
|
||||||
|
v-if="form.level != 0"
|
||||||
class="block-tool"
|
class="block-tool"
|
||||||
>
|
>
|
||||||
<Tooltip placement="right" content="路由name,需英文唯一,跳转页面用" transfer>
|
<Tooltip
|
||||||
<Input v-model="form.name"/>
|
placement="right"
|
||||||
|
content="路由地址,英文唯一,跳转页面,路径展示用 "
|
||||||
|
>
|
||||||
|
<Input class="menu-input" v-model="form.path" />
|
||||||
|
</Tooltip>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label="路由名称" prop="name" class="block-tool">
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
content="路由name,需英文唯一,跳转页面用"
|
||||||
|
transfer
|
||||||
|
>
|
||||||
|
<Input class="menu-input" v-model="form.name" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="文件路径" prop="frontRoute" v-if="form.level != 0">
|
<FormItem label="文件路径" prop="frontRoute" v-if="form.level != 0">
|
||||||
<Input v-model="form.frontRoute"/>
|
<Input class="menu-input" v-model="form.frontRoute" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="权限url" v-if="form.level != 0" class="block-tool">
|
<FormItem label="权限url" v-if="form.level != 0" class="block-tool">
|
||||||
<Tooltip placement="right" content="*号模糊匹配,逗号分割" transfer>
|
<Tooltip placement="right" content="*号模糊匹配,逗号分割" transfer>
|
||||||
<Input v-model="form.permission"/>
|
<Input class="menu-input" v-model="form.permission" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="排序值" prop="sortOrder">
|
<FormItem label="排序值" prop="sortOrder">
|
||||||
<Tooltip
|
<Tooltip trigger="hover" placement="right" content="值越小越靠前,支持小数">
|
||||||
trigger="hover"
|
<InputNumber :max="1000" :min="0" v-model="form.sortOrder"></InputNumber>
|
||||||
placement="right"
|
|
||||||
content="值越小越靠前,支持小数"
|
|
||||||
>
|
|
||||||
<InputNumber
|
|
||||||
:max="1000"
|
|
||||||
:min="0"
|
|
||||||
v-model="form.sortOrder"
|
|
||||||
></InputNumber>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<Form-item>
|
<Form-item>
|
||||||
|
@ -124,9 +121,8 @@
|
||||||
@click="submitEdit"
|
@click="submitEdit"
|
||||||
:loading="submitLoading"
|
:loading="submitLoading"
|
||||||
type="primary"
|
type="primary"
|
||||||
>保存
|
>保存
|
||||||
</Button
|
</Button>
|
||||||
>
|
|
||||||
<Button @click="handleReset">重置</Button>
|
<Button @click="handleReset">重置</Button>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -142,78 +138,48 @@
|
||||||
:width="500"
|
:width="500"
|
||||||
:styles="{ top: '30px' }"
|
:styles="{ top: '30px' }"
|
||||||
>
|
>
|
||||||
<Form
|
<Form ref="formAdd" :model="formAdd" :label-width="100" :rules="formValidate">
|
||||||
ref="formAdd"
|
|
||||||
:model="formAdd"
|
|
||||||
:label-width="100"
|
|
||||||
:rules="formValidate"
|
|
||||||
>
|
|
||||||
<div v-if="showParent">
|
<div v-if="showParent">
|
||||||
<FormItem label="上级节点:">{{ parentTitle }}</FormItem>
|
<FormItem label="上级节点:">{{ parentTitle }}</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<FormItem label="类型" prop="type">
|
<FormItem label="类型" prop="type">
|
||||||
<div v-show="formAdd.level == 0">
|
<div v-show="formAdd.level == 0">
|
||||||
<Icon
|
<Icon type="ios-navigate-outline" size="16" style="margin-right: 5px"></Icon>
|
||||||
type="ios-navigate-outline"
|
|
||||||
size="16"
|
|
||||||
style="margin-right: 5px"
|
|
||||||
></Icon>
|
|
||||||
<span>顶级菜单</span>
|
<span>顶级菜单</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="formAdd.level != 0">
|
<div v-show="formAdd.level != 0">
|
||||||
<Icon
|
<Icon type="ios-list-box-outline" size="16" style="margin-right: 5px"></Icon>
|
||||||
type="ios-list-box-outline"
|
|
||||||
size="16"
|
|
||||||
style="margin-right: 5px"
|
|
||||||
></Icon>
|
|
||||||
<span>页面菜单</span>
|
<span>页面菜单</span>
|
||||||
</div>
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="菜单名称" prop="title">
|
||||||
label="菜单名称"
|
<Input class="menu-input" v-model="formAdd.title" />
|
||||||
prop="title"
|
|
||||||
>
|
|
||||||
<Input v-model="formAdd.title"/>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="路由地址" prop="path" v-if="formAdd.level != 0">
|
<FormItem label="路由地址" prop="path" v-if="formAdd.level != 0">
|
||||||
<Input v-model="formAdd.path"/>
|
<Input v-model="formAdd.path" />
|
||||||
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="路由名称" prop="name" class="block-tool">
|
||||||
label="路由名称"
|
|
||||||
prop="name"
|
|
||||||
class="block-tool"
|
|
||||||
>
|
|
||||||
<Tooltip placement="right" content="路由name,需英文唯一,跳转页面用">
|
<Tooltip placement="right" content="路由name,需英文唯一,跳转页面用">
|
||||||
<Input v-model="formAdd.name"/>
|
<Input v-model="formAdd.name" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="文件路径" prop="frontRoute" v-if="formAdd.level != 0">
|
<FormItem label="文件路径" prop="frontRoute" v-if="formAdd.level != 0">
|
||||||
<Input v-model="formAdd.frontRoute"/>
|
<Input v-model="formAdd.frontRoute" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="权限url" v-if="formAdd.level != 0">
|
<FormItem label="权限url" v-if="formAdd.level != 0">
|
||||||
<Input v-model="formAdd.permission"/>
|
<Input v-model="formAdd.permission" />
|
||||||
<div class="desc">*号模糊匹配,逗号分割</div>
|
<div class="desc">*号模糊匹配,逗号分割</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="排序值" prop="sortOrder">
|
<FormItem label="排序值" prop="sortOrder">
|
||||||
<Tooltip
|
<Tooltip trigger="hover" placement="right" content="值越小越靠前,支持小数">
|
||||||
trigger="hover"
|
<InputNumber :max="1000" :min="0" v-model="formAdd.sortOrder"></InputNumber>
|
||||||
placement="right"
|
|
||||||
content="值越小越靠前,支持小数"
|
|
||||||
>
|
|
||||||
<InputNumber
|
|
||||||
:max="1000"
|
|
||||||
:min="0"
|
|
||||||
v-model="formAdd.sortOrder"
|
|
||||||
></InputNumber>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<Button type="text" @click="menuModalVisible = false">取消</Button>
|
<Button type="text" @click="menuModalVisible = false">取消</Button>
|
||||||
<Button type="primary" :loading="submitLoading" @click="submitAdd"
|
<Button type="primary" :loading="submitLoading" @click="submitAdd">提交</Button>
|
||||||
>提交</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
@ -245,7 +211,8 @@ export default {
|
||||||
parentTitle: "", // 父级标题
|
parentTitle: "", // 父级标题
|
||||||
editTitle: "", // 编辑标题
|
editTitle: "", // 编辑标题
|
||||||
modalTitle: "", // modal标题
|
modalTitle: "", // modal标题
|
||||||
form: { // 表单数据
|
form: {
|
||||||
|
// 表单数据
|
||||||
id: "",
|
id: "",
|
||||||
title: "",
|
title: "",
|
||||||
name: "",
|
name: "",
|
||||||
|
@ -254,19 +221,17 @@ export default {
|
||||||
parentId: "",
|
parentId: "",
|
||||||
sortOrder: 0,
|
sortOrder: 0,
|
||||||
level: 0,
|
level: 0,
|
||||||
permission: ''
|
permission: "",
|
||||||
},
|
},
|
||||||
formAdd: { // 添加表单
|
formAdd: {
|
||||||
|
// 添加表单
|
||||||
},
|
},
|
||||||
formValidate: { // 验证规则
|
formValidate: {
|
||||||
title: [{required: true, message: "菜单名称名称不能为空", trigger: "blur"}],
|
// 验证规则
|
||||||
name: [
|
title: [{ required: true, message: "菜单名称名称不能为空", trigger: "blur" }],
|
||||||
{required: true, message: "路由名称不能为空", trigger: "blur"},
|
name: [{ required: true, message: "路由名称不能为空", trigger: "blur" }],
|
||||||
],
|
path: [{ required: true, message: "路由地址不能为空", trigger: "blur" }],
|
||||||
path: [{required: true, message: "路由地址不能为空", trigger: "blur"}],
|
frontRoute: [{ required: true, message: "文件地址不能为空", trigger: "blur" }],
|
||||||
frontRoute: [
|
|
||||||
{required: true, message: "文件地址不能为空", trigger: "blur"},
|
|
||||||
],
|
|
||||||
sortOrder: [
|
sortOrder: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -286,7 +251,8 @@ export default {
|
||||||
this.getAllList();
|
this.getAllList();
|
||||||
},
|
},
|
||||||
|
|
||||||
renderContent(h, {root, node, data}) { // 渲染树形结构前面图标
|
renderContent(h, { root, node, data }) {
|
||||||
|
// 渲染树形结构前面图标
|
||||||
let icon = "";
|
let icon = "";
|
||||||
if (data.level == 0) {
|
if (data.level == 0) {
|
||||||
icon = "ios-navigate";
|
icon = "ios-navigate";
|
||||||
|
@ -420,7 +386,6 @@ export default {
|
||||||
// 选择菜单
|
// 选择菜单
|
||||||
selectTree(v) {
|
selectTree(v) {
|
||||||
if (v.length > 0) {
|
if (v.length > 0) {
|
||||||
|
|
||||||
let str = JSON.stringify(v);
|
let str = JSON.stringify(v);
|
||||||
let menu = JSON.parse(str);
|
let menu = JSON.parse(str);
|
||||||
this.form = menu[0];
|
this.form = menu[0];
|
||||||
|
@ -434,7 +399,7 @@ export default {
|
||||||
search() {
|
search() {
|
||||||
if (this.searchKey) {
|
if (this.searchKey) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
searchPermission({title: this.searchKey}).then((res) => {
|
searchPermission({ title: this.searchKey }).then((res) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.data = res.result;
|
this.data = res.result;
|
||||||
|
@ -486,7 +451,7 @@ export default {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("编辑成功");
|
this.$Message.success("编辑成功");
|
||||||
// 标记重新获取菜单数据
|
// 标记重新获取菜单数据
|
||||||
this.$store.commit('setAdded', false);
|
this.$store.commit("setAdded", false);
|
||||||
util.initRouter(this);
|
util.initRouter(this);
|
||||||
this.init();
|
this.init();
|
||||||
this.menuModalVisible = false;
|
this.menuModalVisible = false;
|
||||||
|
@ -506,7 +471,7 @@ export default {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("添加成功");
|
this.$Message.success("添加成功");
|
||||||
// 标记重新获取菜单数据
|
// 标记重新获取菜单数据
|
||||||
this.$store.commit('setAdded', false);
|
this.$store.commit("setAdded", false);
|
||||||
util.initRouter(this);
|
util.initRouter(this);
|
||||||
this.init();
|
this.init();
|
||||||
this.menuModalVisible = false;
|
this.menuModalVisible = false;
|
||||||
|
@ -535,7 +500,7 @@ export default {
|
||||||
parentId: this.form.id,
|
parentId: this.form.id,
|
||||||
level: Number(this.form.level) + 1,
|
level: Number(this.form.level) + 1,
|
||||||
sortOrder: 0,
|
sortOrder: 0,
|
||||||
permission:'' // 权限url
|
permission: "", // 权限url
|
||||||
};
|
};
|
||||||
if (this.form.level == 0) {
|
if (this.form.level == 0) {
|
||||||
this.formAdd.path = "/";
|
this.formAdd.path = "/";
|
||||||
|
@ -549,7 +514,7 @@ export default {
|
||||||
this.showParent = false;
|
this.showParent = false;
|
||||||
this.formAdd = {
|
this.formAdd = {
|
||||||
level: 0,
|
level: 0,
|
||||||
sortOrder: 0
|
sortOrder: 0,
|
||||||
};
|
};
|
||||||
this.menuModalVisible = true;
|
this.menuModalVisible = true;
|
||||||
},
|
},
|
||||||
|
@ -579,7 +544,7 @@ export default {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("删除成功");
|
this.$Message.success("删除成功");
|
||||||
// 标记重新获取菜单数据
|
// 标记重新获取菜单数据
|
||||||
this.$store.commit('setAdded', false);
|
this.$store.commit("setAdded", false);
|
||||||
util.initRouter(this);
|
util.initRouter(this);
|
||||||
this.selectList = [];
|
this.selectList = [];
|
||||||
this.selectCount = 0;
|
this.selectCount = 0;
|
||||||
|
@ -601,8 +566,11 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "@/styles/tree-common.scss";
|
@import "@/styles/tree-common.scss";
|
||||||
.desc{
|
.desc {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
.menu-input {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -60,13 +60,8 @@ export const editPintuan = (params) => {
|
||||||
return putRequest('/promotion/pintuan', params,{'Content-type': 'application/json'})
|
return putRequest('/promotion/pintuan', params,{'Content-type': 'application/json'})
|
||||||
}
|
}
|
||||||
// 手动开启拼团活动
|
// 手动开启拼团活动
|
||||||
export const openPintuan = (pintuanId, params) => {
|
export const editPintuanStatus = (pintuanId, params) => {
|
||||||
return putRequest(`/promotion/pintuan/open/${pintuanId}`, params)
|
return putRequest(`/promotion/pintuan/status/${pintuanId}`, params)
|
||||||
}
|
|
||||||
|
|
||||||
// 手动关闭拼团活动
|
|
||||||
export const closePintuan = (pintuanId) => {
|
|
||||||
return putRequest(`/promotion/pintuan/close/${pintuanId}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除拼团活动
|
// 删除拼团活动
|
||||||
|
@ -179,6 +174,6 @@ export const delFullDiscount = (id) => {
|
||||||
return deleteRequest(`/promotion/fullDiscount/${id}`)
|
return deleteRequest(`/promotion/fullDiscount/${id}`)
|
||||||
}
|
}
|
||||||
// 开启、关闭满减活动
|
// 开启、关闭满减活动
|
||||||
export const updateFullDiscount = (id, promotionStatus) => {
|
export const updateFullDiscount = (id, params) => {
|
||||||
return putRequest(`/promotion/fullDiscount/status/${id}/${promotionStatus}`)
|
return putRequest(`/promotion/fullDiscount/status/${id}`, params)
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,8 +283,8 @@ export const result = [{
|
||||||
level: 2,
|
level: 2,
|
||||||
type: 0,
|
type: 0,
|
||||||
title: "满额活动",
|
title: "满额活动",
|
||||||
path: "full-cut",
|
path: "full-discount",
|
||||||
component: "promotion/fullCut/fullCut",
|
component: "promotion/full-discount/full-discount",
|
||||||
children: null
|
children: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ export const otherRouter = {
|
||||||
path: "add-coupon",
|
path: "add-coupon",
|
||||||
title: "店铺优惠券",
|
title: "店铺优惠券",
|
||||||
name: "add-coupon",
|
name: "add-coupon",
|
||||||
component: () => import("@/views/promotion/coupon/couponPublish.vue")
|
component: () => import("@/views/promotion/coupon/coupon-publish.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-live",
|
path: "add-live",
|
||||||
|
@ -81,19 +81,19 @@ export const otherRouter = {
|
||||||
path: "seckill-goods",
|
path: "seckill-goods",
|
||||||
title: "限时抢购商品",
|
title: "限时抢购商品",
|
||||||
name: "seckill-goods",
|
name: "seckill-goods",
|
||||||
component: () => import("@/views/promotion/seckill/seckillGoods.vue")
|
component: () => import("@/views/promotion/seckill/seckill-goods.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "pintuan-goods",
|
path: "pintuan-goods",
|
||||||
title: "拼团商品",
|
title: "拼团商品",
|
||||||
name: "pintuan-goods",
|
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: "新增拼团",
|
title: "新增拼团",
|
||||||
name: "new-pintuan",
|
name: "pintuan-edit",
|
||||||
component: () => import("@/views/promotion/pintuan/newPintuan.vue")
|
component: () => import("@/views/promotion/pintuan/pintuan-edit.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "order-detail",
|
path: "order-detail",
|
||||||
|
@ -116,10 +116,10 @@ export const otherRouter = {
|
||||||
import("@/views/order/after-order/reurnGoodsOrderDetail.vue")
|
import("@/views/order/after-order/reurnGoodsOrderDetail.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "full-cut-detail",
|
path: "full-discount-detail",
|
||||||
title: "添加满额活动",
|
title: "添加满额活动",
|
||||||
name: "full-cut-detail",
|
name: "full-discount-detail",
|
||||||
component: () => import("@/views/promotion/fullCut/newFullCut.vue")
|
component: () => import("@/views/promotion/full-discount/full-discount-add.vue")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "export-order-deliver",
|
path: "export-order-deliver",
|
||||||
|
|
|
@ -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>
|
<h4>基本信息</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="活动名称" prop="promotionName">
|
<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>
|
||||||
<FormItem label="优惠券名称" prop="couponName">
|
<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>
|
||||||
<FormItem label="优惠券类型" prop="couponType">
|
<FormItem label="优惠券类型" prop="couponType">
|
||||||
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
||||||
|
@ -18,11 +32,25 @@
|
||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="折扣" prop="discount" v-if="form.couponType == 'DISCOUNT'">
|
<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>
|
<span class="describe">请输入0-10之间数字,可以输入一位小数</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
|
<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>
|
||||||
<FormItem label="活动类型" prop="getType">
|
<FormItem label="活动类型" prop="getType">
|
||||||
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
||||||
|
@ -32,54 +60,132 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="发放数量" v-if="form.getType == 'FREE'" prop="publishNum">
|
<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>
|
<span class="tips ml_10">如果发放数量为0时,则代表不限制发放数量</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<h4>使用限制</h4>
|
<h4>使用限制</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="消费门槛" prop="consumeThreshold">
|
<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>
|
||||||
<FormItem label="领取限制" v-if="form.getType == 'FREE'" prop="couponLimitNum">
|
<FormItem
|
||||||
<Input :disabled="disabled" v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" />
|
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>
|
<span class="tips ml_10">如果领取限制为0时,则代表不限制领取数量</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="有效期" prop="rangeTime">
|
<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>
|
</DatePicker>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="使用范围" prop="scopeType">
|
<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="ALL">全品类</Radio>
|
||||||
<Radio :disabled="disabled" label="PORTION_GOODS">指定商品</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>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||||
<div style="display: flex; margin-bottom: 10px">
|
<div style="display: flex; margin-bottom: 10px">
|
||||||
<Button :disabled="disabled" type="primary" @click="openSkuList">选择商品</Button>
|
<Button :disabled="disabled" type="primary" @click="openSkuList"
|
||||||
<Button :disabled="disabled" type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
>选择商品</Button
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
:disabled="disabled"
|
||||||
|
type="error"
|
||||||
|
ghost
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@click="delSelectGoods"
|
||||||
|
>批量删除</Button
|
||||||
|
>
|
||||||
</div>
|
</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">
|
<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>
|
||||||
</Table>
|
</Table>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
<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>
|
||||||
|
|
||||||
<FormItem label="范围描述" prop="description">
|
<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>
|
</FormItem>
|
||||||
<div>
|
<div>
|
||||||
<Button :disabled="disabled" type="text" @click="$router.push({ name: 'coupon' })">返回</Button>
|
<Button
|
||||||
<Button :disabled="disabled" type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
:disabled="disabled"
|
||||||
|
type="text"
|
||||||
|
@click="$router.push({ name: 'coupon' })"
|
||||||
|
>返回</Button
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
:disabled="disabled"
|
||||||
|
type="primary"
|
||||||
|
:loading="submitLoading"
|
||||||
|
@click="handleSubmit"
|
||||||
|
>提交</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -152,10 +258,7 @@ export default {
|
||||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||||
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
||||||
couponLimitNum: [{ required: true, message: "领取限制不能为空" }],
|
couponLimitNum: [{ required: true, message: "领取限制不能为空" }],
|
||||||
price: [
|
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||||
{ required: true, message: "请输入面额" },
|
|
||||||
{ validator: checkPrice },
|
|
||||||
],
|
|
||||||
consumeThreshold: [
|
consumeThreshold: [
|
||||||
{ required: true, message: "请输入消费门槛" },
|
{ required: true, message: "请输入消费门槛" },
|
||||||
{ validator: checkWeight },
|
{ validator: checkWeight },
|
||||||
|
@ -198,10 +301,7 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -284,7 +384,9 @@ export default {
|
||||||
data.scopeIdGoods = prevCascader;
|
data.scopeIdGoods = prevCascader;
|
||||||
}
|
}
|
||||||
data.rangeTime = [];
|
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;
|
this.form = data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -307,8 +409,7 @@ export default {
|
||||||
let scopeId = [];
|
let scopeId = [];
|
||||||
if (
|
if (
|
||||||
params.scopeType == "PORTION_GOODS" &&
|
params.scopeType == "PORTION_GOODS" &&
|
||||||
(!params.promotionGoodsList ||
|
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||||
params.promotionGoodsList.length == 0)
|
|
||||||
) {
|
) {
|
||||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||||
return;
|
return;
|
||||||
|
@ -402,11 +503,9 @@ export default {
|
||||||
this.selectedGoods.forEach(function (e) {
|
this.selectedGoods.forEach(function (e) {
|
||||||
ids.push(e.id);
|
ids.push(e.id);
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||||
(item) => {
|
return !ids.includes(item.id);
|
||||||
return !ids.includes(item.id);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -520,4 +619,3 @@ h4 {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,12 +2,29 @@
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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="优惠券名称">
|
<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>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -15,26 +32,71 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</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>
|
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="operator padding-row">
|
<Row class="operator padding-row">
|
||||||
<Button @click="add" type="primary">添加</Button>
|
<Button @click="add" type="primary">添加</Button>
|
||||||
<Button @click="delAll" class="ml_10">批量下架</Button>
|
<Button @click="delAll" class="ml_10">批量关闭</Button>
|
||||||
</Row>
|
</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">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" @click="see(row)">编辑</Button>
|
<Button
|
||||||
<Button v-else type="default" size="small" @click="see(row,'only')">查看</Button>
|
v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'"
|
||||||
<Button v-if="row.promotionStatus !== 'END'" type="error" size="small" :style="{'marginLeft':'5px'}" @click="remove(row)">下架</Button>
|
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>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<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]"
|
<Page
|
||||||
size="small" show-total show-elevator show-sizer></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>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,12 +104,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getShopCouponList, updateCouponStatus } from "@/api/promotion";
|
import { getShopCouponList, updateCouponStatus } from "@/api/promotion";
|
||||||
|
import { promotionsStatusRender, promotionsScopeTypeRender } from "@/utils/promotions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "coupon",
|
name: "coupon",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectDate:[],
|
selectDate: [],
|
||||||
loading: true, // 表单加载状态
|
loading: true, // 表单加载状态
|
||||||
searchForm: {
|
searchForm: {
|
||||||
// 搜索框初始化对象
|
// 搜索框初始化对象
|
||||||
|
@ -84,7 +147,7 @@ export default {
|
||||||
if (params.row.price) {
|
if (params.row.price) {
|
||||||
return h(
|
return h(
|
||||||
"div",
|
"div",
|
||||||
this.$options.filters.unitPrice((params.row.price || 0), "¥")
|
this.$options.filters.unitPrice(params.row.price || 0, "¥")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return h("div", (params.row.couponDiscount || 0) + "折");
|
return h("div", (params.row.couponDiscount || 0) + "折");
|
||||||
|
@ -98,7 +161,9 @@ export default {
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h(
|
||||||
"div",
|
"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: "品类描述",
|
title: "品类描述",
|
||||||
key: "scopeType",
|
key: "scopeType",
|
||||||
width: 100,
|
width: 120,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知";
|
return promotionsScopeTypeRender(h, params);
|
||||||
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]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动时间",
|
title: "活动时间",
|
||||||
|
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.rangeDayType !== "FIXEDTIME") {
|
if (
|
||||||
|
params?.row?.getType === "ACTIVITY" &&
|
||||||
|
params?.row?.rangeDayType === "DYNAMICTIME"
|
||||||
|
) {
|
||||||
return h("div", "长期有效");
|
return h("div", "长期有效");
|
||||||
} else {
|
} else if (params?.row?.startTime && params?.row?.endTime) {
|
||||||
return h("div", {
|
return h("div", {
|
||||||
domProps: {
|
domProps: {
|
||||||
innerHTML:
|
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||||
params.row.startTime + "<br/>" + params.row.endTime,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -155,33 +212,8 @@ export default {
|
||||||
key: "promotionStatus",
|
key: "promotionStatus",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
let text = "未知",
|
return promotionsStatusRender(h, params);
|
||||||
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
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
|
@ -256,34 +288,10 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
// 跳转编辑优惠券页面
|
// 跳转编辑优惠券页面
|
||||||
see(v,only) {
|
see(v, only) {
|
||||||
let data
|
let data;
|
||||||
only ? data = { onlyView : true,id: v.id } : data = { id: v.id }
|
only ? (data = { onlyView: true, id: v.id }) : (data = { id: v.id });
|
||||||
this.$router.push({ name: "add-coupon", query:data});
|
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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 下架优惠券
|
// 下架优惠券
|
||||||
remove(v) {
|
remove(v) {
|
||||||
|
@ -295,7 +303,6 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
let params = {
|
let params = {
|
||||||
couponIds: v.id,
|
couponIds: v.id,
|
||||||
promotionStatus: "CLOSE",
|
|
||||||
};
|
};
|
||||||
updateCouponStatus(params).then((res) => {
|
updateCouponStatus(params).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
|
@ -312,12 +319,12 @@ export default {
|
||||||
// 批量下架
|
// 批量下架
|
||||||
delAll() {
|
delAll() {
|
||||||
if (this.selectCount <= 0) {
|
if (this.selectCount <= 0) {
|
||||||
this.$Message.warning("您还未选择要下架的优惠券");
|
this.$Message.warning("您还未选择要关闭的优惠券");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: "确认下架",
|
title: "确认关闭",
|
||||||
content: "您确认要下架所选的 " + this.selectCount + " 条数据?",
|
content: "您确认要关闭所选的 " + this.selectCount + " 条数据?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
let ids = [];
|
let ids = [];
|
||||||
|
@ -327,7 +334,6 @@ export default {
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
couponIds: ids.toString(),
|
couponIds: ids.toString(),
|
||||||
promotionStatus: "CLOSE",
|
|
||||||
};
|
};
|
||||||
updateCouponStatus(params).then((res) => {
|
updateCouponStatus(params).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
|
|
|
@ -6,81 +6,213 @@
|
||||||
<h4>基本信息</h4>
|
<h4>基本信息</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="活动名称" prop="promotionName">
|
<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>
|
||||||
<FormItem label="活动时间" prop="rangeTime">
|
<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"
|
<DatePicker
|
||||||
style="width: 280px">
|
type="datetimerange"
|
||||||
|
v-model="form.rangeTime"
|
||||||
|
:disabled="form.promotionStatus != 'NEW'"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择"
|
||||||
|
:options="options"
|
||||||
|
style="width: 280px"
|
||||||
|
>
|
||||||
</DatePicker>
|
</DatePicker>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="活动描述" prop="description">
|
<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>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>优惠设置</h4>
|
<h4>优惠设置</h4>
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem label="优惠门槛" prop="fullMoney">
|
<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>
|
<span class="describe">消费达到当前金额可以参与优惠</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="优惠方式">
|
<FormItem label="优惠方式">
|
||||||
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
|
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
|
||||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus">减现金</Radio>
|
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus"
|
||||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate">打折</Radio>
|
>减现金</Radio
|
||||||
|
>
|
||||||
|
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate"
|
||||||
|
>打折</Radio
|
||||||
|
>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem v-if="form.discountType == 'isFullMinus'" label="优惠金额" prop="fullMinus">
|
<FormItem
|
||||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullMinus" placeholder="优惠金额" clearable style="width: 280px" />
|
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>
|
||||||
<FormItem v-if="form.discountType == 'isFullRate'" label="优惠折扣" prop="fullRate">
|
<FormItem
|
||||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullRate" placeholder="优惠折扣" clearable style="width: 280px" />
|
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>
|
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="额外赠送">
|
<FormItem label="额外赠送">
|
||||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isFreeFreight">免邮费</Checkbox>
|
<Checkbox
|
||||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon">送优惠券</Checkbox>
|
:disabled="form.promotionStatus != 'NEW'"
|
||||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift">送赠品</Checkbox>
|
v-model="form.isFreeFreight"
|
||||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-if="Cookies.get('userInfoSeller') && JSON.parse(Cookies.get('userInfoSeller')).selfOperated" v-model="form.isPoint">送积分</Checkbox>
|
>免邮费</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>
|
||||||
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
|
<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">
|
<Select
|
||||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{ item.couponName }}</Option>
|
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>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
<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">
|
<Select
|
||||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{ item.goodsName }}</Option>
|
: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>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
<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>
|
||||||
<FormItem label="使用范围" prop="scopeType">
|
<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="form.promotionStatus != 'NEW'" label="ALL">全品类</Radio>
|
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL"
|
||||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS">指定商品</Radio>
|
>全品类</Radio
|
||||||
|
>
|
||||||
|
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS"
|
||||||
|
>指定商品</Radio
|
||||||
|
>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
<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="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>
|
</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">
|
<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>
|
||||||
<template slot-scope="{ index }" slot="action">
|
<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>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,12 +234,11 @@ import { regular } from "@/utils";
|
||||||
import skuSelect from "@/views/lili-dialog";
|
import skuSelect from "@/views/lili-dialog";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
export default {
|
export default {
|
||||||
name: "addFullCut",
|
name: "full-discount-add",
|
||||||
components: {
|
components: {
|
||||||
skuSelect
|
skuSelect,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
const checkPrice = (rule, value, callback) => {
|
const checkPrice = (rule, value, callback) => {
|
||||||
if (!value && value !== 0) {
|
if (!value && value !== 0) {
|
||||||
return callback(new Error("面额不能为空"));
|
return callback(new Error("面额不能为空"));
|
||||||
|
@ -132,7 +263,8 @@ export default {
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
Cookies,
|
Cookies,
|
||||||
form: { // 活动表单
|
form: {
|
||||||
|
// 活动表单
|
||||||
discountType: "isFullMinus",
|
discountType: "isFullMinus",
|
||||||
scopeType: "ALL",
|
scopeType: "ALL",
|
||||||
promotionGoodsList: [],
|
promotionGoodsList: [],
|
||||||
|
@ -141,14 +273,12 @@ export default {
|
||||||
id: this.$route.query.id, // 活动id
|
id: this.$route.query.id, // 活动id
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
selectedGoods: [], // 已选商品列表,便于删除
|
selectedGoods: [], // 已选商品列表,便于删除
|
||||||
formRule: { // 验证规则
|
formRule: {
|
||||||
|
// 验证规则
|
||||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||||
rangeTime: [{ required: true, message: "请选择活动时间" }],
|
rangeTime: [{ required: true, message: "请选择活动时间" }],
|
||||||
description: [{ required: true, message: "请填写活动描述" }],
|
description: [{ required: true, message: "请填写活动描述" }],
|
||||||
price: [
|
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||||
{ required: true, message: "请输入面额" },
|
|
||||||
{ validator: checkPrice },
|
|
||||||
],
|
|
||||||
consumptionLimit: [{ required: true, validator: checkWeight }],
|
consumptionLimit: [{ required: true, validator: checkWeight }],
|
||||||
fullMoney: [{ required: true, validator: checkWeight }],
|
fullMoney: [{ required: true, validator: checkWeight }],
|
||||||
fullMinus: [
|
fullMinus: [
|
||||||
|
@ -169,7 +299,8 @@ export default {
|
||||||
couponList: [], // 店铺优惠券列表
|
couponList: [], // 店铺优惠券列表
|
||||||
giftList: [], // 赠品列表
|
giftList: [], // 赠品列表
|
||||||
giftLoading: false, // 请求赠品状态
|
giftLoading: false, // 请求赠品状态
|
||||||
columns: [ // 表头
|
columns: [
|
||||||
|
// 表头
|
||||||
{
|
{
|
||||||
type: "selection",
|
type: "selection",
|
||||||
width: 60,
|
width: 60,
|
||||||
|
@ -185,10 +316,7 @@ export default {
|
||||||
key: "price",
|
key: "price",
|
||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||||
"div",
|
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -225,12 +353,13 @@ export default {
|
||||||
);
|
);
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
openSkuList() { // 显示商品选择器
|
openSkuList() {
|
||||||
|
// 显示商品选择器
|
||||||
this.$refs.skuSelect.open("goods");
|
this.$refs.skuSelect.open("goods");
|
||||||
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList))
|
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList));
|
||||||
data.forEach(e => {
|
data.forEach((e) => {
|
||||||
e.id = e.skuId
|
e.id = e.skuId;
|
||||||
})
|
});
|
||||||
this.$refs.skuSelect.goodsData = data;
|
this.$refs.skuSelect.goodsData = data;
|
||||||
},
|
},
|
||||||
getDetail() {
|
getDetail() {
|
||||||
|
@ -238,11 +367,8 @@ export default {
|
||||||
getFullDiscountById(this.id).then((res) => {
|
getFullDiscountById(this.id).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
let data = res.result;
|
let data = res.result;
|
||||||
if (data.number == -1) {
|
if (data.scopeType === "ALL") {
|
||||||
data.promotionGoodsList = [];
|
data.promotionGoodsList = [];
|
||||||
data.scopeType = "ALL";
|
|
||||||
} else {
|
|
||||||
data.scopeType = "PORTION_GOODS";
|
|
||||||
}
|
}
|
||||||
if (data.isFullMinus) {
|
if (data.isFullMinus) {
|
||||||
data.discountType = "isFullMinus";
|
data.discountType = "isFullMinus";
|
||||||
|
@ -262,19 +388,14 @@ export default {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const params = JSON.parse(JSON.stringify(this.form));
|
const params = JSON.parse(JSON.stringify(this.form));
|
||||||
const strat = this.$options.filters.unixToDate(
|
const strat = this.$options.filters.unixToDate(this.form.rangeTime[0] / 1000);
|
||||||
this.form.rangeTime[0] / 1000
|
const end = this.$options.filters.unixToDate(this.form.rangeTime[1] / 1000);
|
||||||
);
|
|
||||||
const end = this.$options.filters.unixToDate(
|
|
||||||
this.form.rangeTime[1] / 1000
|
|
||||||
);
|
|
||||||
params.startTime = strat;
|
params.startTime = strat;
|
||||||
params.endTime = end;
|
params.endTime = end;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
params.scopeType == "PORTION_GOODS" &&
|
params.scopeType == "PORTION_GOODS" &&
|
||||||
(!params.promotionGoodsList ||
|
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||||
params.promotionGoodsList.length == 0)
|
|
||||||
) {
|
) {
|
||||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||||
return;
|
return;
|
||||||
|
@ -294,7 +415,6 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
params.isFullRate = true;
|
params.isFullRate = true;
|
||||||
}
|
}
|
||||||
delete params.scopeType;
|
|
||||||
delete params.rangeTime;
|
delete params.rangeTime;
|
||||||
this.submitLoading = true;
|
this.submitLoading = true;
|
||||||
if (!this.id) {
|
if (!this.id) {
|
||||||
|
@ -341,11 +461,9 @@ export default {
|
||||||
this.selectedGoods.forEach(function (e) {
|
this.selectedGoods.forEach(function (e) {
|
||||||
ids.push(e.id);
|
ids.push(e.id);
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||||
(item) => {
|
return !ids.includes(item.id);
|
||||||
return !ids.includes(item.id);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -376,7 +494,7 @@ export default {
|
||||||
pageNumber: 0,
|
pageNumber: 0,
|
||||||
getType: "ACTIVITY",
|
getType: "ACTIVITY",
|
||||||
couponName: query,
|
couponName: query,
|
||||||
promotionStatus:"START"
|
promotionStatus: "START",
|
||||||
};
|
};
|
||||||
this.couponLoading = true;
|
this.couponLoading = true;
|
||||||
getShopCouponList(params).then((res) => {
|
getShopCouponList(params).then((res) => {
|
||||||
|
@ -422,8 +540,7 @@ h4 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
.ivu-form-item{
|
.ivu-form-item {
|
||||||
margin-bottom: 24px !important;
|
margin-bottom: 24px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,12 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<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="活动名称">
|
<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>
|
||||||
<Form-item label="活动状态" prop="promotionStatus">
|
<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="NEW">未开始</Option>
|
||||||
<Option value="START">已开始/上架</Option>
|
<Option value="START">已开始/上架</Option>
|
||||||
<Option value="END">已结束/下架</Option>
|
<Option value="END">已结束/下架</Option>
|
||||||
|
@ -14,7 +31,13 @@
|
||||||
</Select>
|
</Select>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item label="活动时间">
|
<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>
|
</DatePicker>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
<Form-item>
|
<Form-item>
|
||||||
|
@ -33,27 +56,58 @@
|
||||||
{{ row.isFullMinus ? "满减" : "满折" }}
|
{{ row.isFullMinus ? "满减" : "满折" }}
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="hours">
|
<template slot-scope="{ row }" slot="hours">
|
||||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{
|
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>
|
||||||
item
|
|
||||||
}}</Tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<div>
|
<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="info" v-else size="small" @click="edit(row)">查看</Button>
|
||||||
<Button type="success" v-if="row.promotionStatus === 'START'" style="margin-left:5px" size="small"
|
<Button
|
||||||
@click="openOrClose(row)">关闭</Button>
|
type="success"
|
||||||
<Button type="success" v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
v-if="row.promotionStatus === 'START'"
|
||||||
style="margin-left:5px" size="small" @click="openOrClose(row)">开启</Button>
|
style="margin-left: 5px"
|
||||||
<Button type="error" :disabled="row.promotionStatus == 'START'" style="margin-left:5px" size="small"
|
size="small"
|
||||||
@click="del(row)">删除</Button>
|
@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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="page operation">
|
<Row type="flex" justify="end" class="page operation">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
<Page
|
||||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
:current="searchForm.pageNumber"
|
||||||
show-sizer></Page>
|
: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>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -145,7 +199,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 改变页码
|
// 改变页码
|
||||||
newAct() {
|
newAct() {
|
||||||
this.$router.push({ name: "full-cut-detail" });
|
this.$router.push({ name: "full-discount-detail" });
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
init() {
|
init() {
|
||||||
|
@ -177,7 +231,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 编辑
|
// 编辑
|
||||||
edit(row) {
|
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) {
|
del(row) {
|
||||||
|
@ -205,23 +259,70 @@ export default {
|
||||||
if (row.promotionStatus === "START") {
|
if (row.promotionStatus === "START") {
|
||||||
name = "关闭";
|
name = "关闭";
|
||||||
status = "CLOSE";
|
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() {
|
getDataList() {
|
|
@ -7,42 +7,79 @@
|
||||||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||||
<Button @click="delAll">批量删除</Button>
|
<Button @click="delAll">批量删除</Button>
|
||||||
<Button @click="getDataList" icon="md-refresh">刷新</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>
|
||||||
<Row v-show="openTip" v-if="status == 'manager'">
|
<Row v-show="openTip" v-if="status == 'manager'">
|
||||||
<Alert show-icon>
|
<Alert show-icon>
|
||||||
已选择 <span >{{ selectCount }}</span> 项
|
已选择 <span>{{ selectCount }}</span> 项
|
||||||
<a class="select-clear" @click="clearSelectAll">清空</a>
|
<a class="select-clear" @click="clearSelectAll">清空</a>
|
||||||
</Alert>
|
</Alert>
|
||||||
</Row>
|
</Row>
|
||||||
<h3 class="act-goods">活动商品</h3>
|
<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">
|
<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>
|
||||||
<template slot-scope="{ index }" slot="action">
|
<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>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
<Row type="flex" justify="end" class="page operation">
|
<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]"
|
<Page
|
||||||
size="small" show-total show-elevator show-sizer></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>
|
||||||
<Row class="operation">
|
<Row class="operation">
|
||||||
<Button @click="closeCurrentPage">返回</Button>
|
<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>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<sku-select ref="skuSelect" :goodsData="goodsData" @selectedGoodsData="selectedGoodsData"></sku-select>
|
<sku-select
|
||||||
|
ref="skuSelect"
|
||||||
|
:goodsData="goodsData"
|
||||||
|
@selectedGoodsData="selectedGoodsData"
|
||||||
|
></sku-select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getPintuanGoodsList, getPintuanDetail, editPintuan } from "@/api/promotion.js";
|
||||||
getPintuanGoodsList,
|
|
||||||
getPintuanDetail,
|
|
||||||
editPintuan,
|
|
||||||
} from "@/api/promotion.js";
|
|
||||||
import skuSelect from "@/views/lili-dialog";
|
import skuSelect from "@/views/lili-dialog";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -52,7 +89,8 @@ export default {
|
||||||
return {
|
return {
|
||||||
openTip: true, // 显示提示
|
openTip: true, // 显示提示
|
||||||
loading: false, // 表单加载状态
|
loading: false, // 表单加载状态
|
||||||
searchForm: { // 搜索框初始化对象
|
searchForm: {
|
||||||
|
// 搜索框初始化对象
|
||||||
pageNumber: 0, // 当前页数
|
pageNumber: 0, // 当前页数
|
||||||
pageSize: 10, // 页面大小
|
pageSize: 10, // 页面大小
|
||||||
},
|
},
|
||||||
|
@ -63,7 +101,8 @@ export default {
|
||||||
data: [], // 表单数据
|
data: [], // 表单数据
|
||||||
total: 0, // 表单数据总数
|
total: 0, // 表单数据总数
|
||||||
status: this.$route.query.status, // 查看还是修改
|
status: this.$route.query.status, // 查看还是修改
|
||||||
columns: [ // 活动详情表头
|
columns: [
|
||||||
|
// 活动详情表头
|
||||||
{
|
{
|
||||||
title: "活动名称",
|
title: "活动名称",
|
||||||
key: "promotionName",
|
key: "promotionName",
|
||||||
|
@ -99,17 +138,12 @@ export default {
|
||||||
text = "已关闭";
|
text = "已关闭";
|
||||||
color = "red";
|
color = "red";
|
||||||
}
|
}
|
||||||
return h("div", [
|
return h("div", [h("Tag", { props: { color: color } }, text)]);
|
||||||
h(
|
|
||||||
"Tag",
|
|
||||||
{props: {color: color}},
|
|
||||||
text
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
goodsColumns: [ // 活动商品表头
|
goodsColumns: [
|
||||||
|
// 活动商品表头
|
||||||
{ type: "selection", width: 60, align: "center" },
|
{ type: "selection", width: 60, align: "center" },
|
||||||
{
|
{
|
||||||
title: "商品名称",
|
title: "商品名称",
|
||||||
|
@ -177,23 +211,27 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init() { // 初始化数据
|
init() {
|
||||||
|
// 初始化数据
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
this.getPintuanMsg();
|
this.getPintuanMsg();
|
||||||
},
|
},
|
||||||
|
|
||||||
changePage(v) { // 分页 改变页数
|
changePage(v) {
|
||||||
|
// 分页 改变页数
|
||||||
this.searchForm.pageNumber = v - 1;
|
this.searchForm.pageNumber = v - 1;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
this.clearSelectAll();
|
this.clearSelectAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
changePageSize(v) { // 分页 改变每页数
|
changePageSize(v) {
|
||||||
|
// 分页 改变每页数
|
||||||
this.searchForm.pageSize = v;
|
this.searchForm.pageSize = v;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSearch() { // 搜索
|
handleSearch() {
|
||||||
|
// 搜索
|
||||||
this.searchForm.pageNumber = 0;
|
this.searchForm.pageNumber = 0;
|
||||||
this.searchForm.pageSize = 10;
|
this.searchForm.pageSize = 10;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
|
@ -207,7 +245,8 @@ export default {
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
|
|
||||||
clearSelectAll() { // 清空所有已选项
|
clearSelectAll() {
|
||||||
|
// 清空所有已选项
|
||||||
this.$refs.table.selectAll(false);
|
this.$refs.table.selectAll(false);
|
||||||
},
|
},
|
||||||
changeSelect(e) {
|
changeSelect(e) {
|
||||||
|
@ -216,7 +255,8 @@ export default {
|
||||||
this.selectCount = e.length;
|
this.selectCount = e.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataList() { // 获取商品列表
|
getDataList() {
|
||||||
|
// 获取商品列表
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.searchForm.pintuanId = this.$route.query.id;
|
this.searchForm.pintuanId = this.$route.query.id;
|
||||||
|
|
||||||
|
@ -228,15 +268,18 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getPintuanMsg() { // 获取拼团详情
|
getPintuanMsg() {
|
||||||
|
// 获取拼团详情
|
||||||
getPintuanDetail(this.$route.query.id).then((res) => {
|
getPintuanDetail(this.$route.query.id).then((res) => {
|
||||||
if (res.success) this.data.push(res.result);
|
if (res.success) this.data.push(res.result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delGoods(index) { // 删除商品
|
delGoods(index) {
|
||||||
|
// 删除商品
|
||||||
this.goodsData.splice(index, 1);
|
this.goodsData.splice(index, 1);
|
||||||
},
|
},
|
||||||
delAll() { // 批量删除商品
|
delAll() {
|
||||||
|
// 批量删除商品
|
||||||
if (this.selectCount <= 0) {
|
if (this.selectCount <= 0) {
|
||||||
this.$Message.warning("您还未选择要删除的数据");
|
this.$Message.warning("您还未选择要删除的数据");
|
||||||
return;
|
return;
|
||||||
|
@ -255,34 +298,38 @@ export default {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
selectedGoodsData(item) { // 选择商品
|
selectedGoodsData(item) {
|
||||||
|
// 选择商品
|
||||||
console.log(item);
|
console.log(item);
|
||||||
let list = [];
|
let list = [];
|
||||||
item.forEach((e) => {
|
item.forEach((e) => {
|
||||||
list.push({
|
list.push({
|
||||||
goodsName: e.goodsName,
|
goodsName: e.goodsName,
|
||||||
price: e.price,
|
price: e.price,
|
||||||
originalPrice: e.price,
|
originalPrice: e.price,
|
||||||
quantity: e.quantity,
|
quantity: e.quantity,
|
||||||
storeId: e.storeId,
|
storeId: e.storeId,
|
||||||
sellerName: e.sellerName,
|
sellerName: e.sellerName,
|
||||||
thumbnail: e.thumbnail,
|
thumbnail: e.thumbnail,
|
||||||
skuId: e.id,
|
skuId: e.id,
|
||||||
categoryPath: e.categoryPath,
|
categoryPath: e.categoryPath,
|
||||||
});
|
goodsId: e.goodsId,
|
||||||
|
goodsType: e.goodsType,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.goodsData = list;
|
this.goodsData = list;
|
||||||
},
|
},
|
||||||
openSkuList() { // 显示商品选择器
|
openSkuList() {
|
||||||
|
// 显示商品选择器
|
||||||
this.$refs.skuSelect.open("goods");
|
this.$refs.skuSelect.open("goods");
|
||||||
let data = JSON.parse(JSON.stringify(this.goodsData))
|
let data = JSON.parse(JSON.stringify(this.goodsData));
|
||||||
data.forEach(e => {
|
data.forEach((e) => {
|
||||||
e.id = e.skuId
|
e.id = e.skuId;
|
||||||
})
|
});
|
||||||
this.$refs.skuSelect.goodsData = data;
|
this.$refs.skuSelect.goodsData = data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -294,8 +341,8 @@ export default {
|
||||||
.act-goods {
|
.act-goods {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
&::before{
|
&::before {
|
||||||
content: '|';
|
content: "|";
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
|
@ -2,7 +2,13 @@
|
||||||
<div class="pintuan">
|
<div class="pintuan">
|
||||||
<Card>
|
<Card>
|
||||||
<Row>
|
<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">
|
<Form-item label="活动名称" prop="promotionName">
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -34,66 +40,64 @@
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
></DatePicker>
|
></DatePicker>
|
||||||
</Form-item>
|
</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>
|
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="operation padding-row">
|
<Row class="operation padding-row">
|
||||||
<Button @click="newAct" type="primary">添加</Button>
|
<Button @click="newAct" type="primary">添加</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Table
|
<Table :loading="loading" border :columns="columns" :data="data" ref="table">
|
||||||
:loading="loading"
|
|
||||||
border
|
|
||||||
:columns="columns"
|
|
||||||
:data="data"
|
|
||||||
ref="table"
|
|
||||||
>
|
|
||||||
<template slot-scope="{ row }" slot="action">
|
<template slot-scope="{ row }" slot="action">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
size="small"
|
size="small"
|
||||||
v-if="row.promotionStatus == 'NEW'"
|
v-if="row.promotionStatus == 'NEW'"
|
||||||
@click="edit(row)"
|
@click="edit(row)"
|
||||||
>编辑</Button
|
>编辑</Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="info"
|
type="info"
|
||||||
v-if="row.promotionStatus == 'NEW'"
|
v-if="row.promotionStatus == 'NEW'"
|
||||||
size="small"
|
size="small"
|
||||||
@click="manage(row, 'manager')"
|
@click="manage(row, 'manager')"
|
||||||
>管理</Button
|
>管理</Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="info"
|
type="info"
|
||||||
v-if="row.promotionStatus !== 'NEW'"
|
v-if="row.promotionStatus !== 'NEW'"
|
||||||
size="small"
|
size="small"
|
||||||
@click="manage(row, 'view')"
|
@click="manage(row, 'view')"
|
||||||
>查看</Button
|
>查看</Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="error"
|
type="error"
|
||||||
size="small"
|
size="small"
|
||||||
v-if="row.promotionStatus != 'START'"
|
v-if="row.promotionStatus != 'START'"
|
||||||
@click="remove(row)"
|
@click="remove(row)"
|
||||||
>删除</Button
|
>删除</Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="success"
|
type="success"
|
||||||
v-if="
|
v-if="row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'"
|
||||||
row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'
|
size="small"
|
||||||
"
|
@click="open(row)"
|
||||||
size="small"
|
>开启</Button
|
||||||
@click="open(row)"
|
>
|
||||||
>开启</Button
|
<Button
|
||||||
>
|
type="warning"
|
||||||
<Button
|
v-if="row.promotionStatus == 'START'"
|
||||||
type="warning"
|
size="small"
|
||||||
v-if="row.promotionStatus == 'START'"
|
@click="close(row)"
|
||||||
size="small"
|
>关闭</Button
|
||||||
@click="close(row)"
|
>
|
||||||
>关闭</Button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -116,12 +120,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getPintuanList, deletePintuan, editPintuanStatus } from "@/api/promotion";
|
||||||
getPintuanList,
|
|
||||||
deletePintuan,
|
|
||||||
openPintuan,
|
|
||||||
closePintuan,
|
|
||||||
} from "@/api/promotion";
|
|
||||||
export default {
|
export default {
|
||||||
name: "pintuan",
|
name: "pintuan",
|
||||||
data() {
|
data() {
|
||||||
|
@ -139,7 +138,7 @@ export default {
|
||||||
{
|
{
|
||||||
title: "活动名称",
|
title: "活动名称",
|
||||||
key: "promotionName",
|
key: "promotionName",
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "活动开始时间",
|
title: "活动开始时间",
|
||||||
|
@ -206,8 +205,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 重置
|
// 重置
|
||||||
handleReset() {
|
handleReset() {
|
||||||
this.searchForm = {}
|
this.searchForm = {};
|
||||||
this.selectDate = ''
|
this.selectDate = "";
|
||||||
this.searchForm.pageNumber = 0;
|
this.searchForm.pageNumber = 0;
|
||||||
this.searchForm.pageSize = 10;
|
this.searchForm.pageSize = 10;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
|
@ -239,11 +238,11 @@ export default {
|
||||||
},
|
},
|
||||||
// 新建拼团
|
// 新建拼团
|
||||||
newAct() {
|
newAct() {
|
||||||
this.$router.push({ name: "new-pintuan" });
|
this.$router.push({ name: "pintuan-edit" });
|
||||||
},
|
},
|
||||||
// 编辑拼团
|
// 编辑拼团
|
||||||
edit(v) {
|
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) {
|
manage(v, status) {
|
||||||
|
@ -251,15 +250,20 @@ export default {
|
||||||
},
|
},
|
||||||
// 手动开启拼团活动
|
// 手动开启拼团活动
|
||||||
open(v) {
|
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({
|
this.$Modal.confirm({
|
||||||
title: "确认开启",
|
title: "确认开启(默认为当前时间的十分钟之后)",
|
||||||
content: "您确认要开启此拼团活动?",
|
content: "您确认要开启此拼团活动?",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
let params = {
|
let params = {
|
||||||
startTime: this.openStartTime,
|
startTime: this.openStartTime,
|
||||||
endTime: this.openEndTime,
|
endTime: this.openEndTime,
|
||||||
};
|
};
|
||||||
openPintuan(v.id, params).then((res) => {
|
editPintuanStatus(v.id, params).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("开启活动成功");
|
this.$Message.success("开启活动成功");
|
||||||
|
@ -273,6 +277,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
type: "datetimerange",
|
type: "datetimerange",
|
||||||
placeholder: "请选择开始时间和结束时间",
|
placeholder: "请选择开始时间和结束时间",
|
||||||
|
value: [sTime, eTime],
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
width: "350px",
|
width: "350px",
|
||||||
|
@ -299,7 +304,7 @@ export default {
|
||||||
content: "您确认要关闭此拼团活动?",
|
content: "您确认要关闭此拼团活动?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
closePintuan(v.id).then((res) => {
|
editPintuanStatus(v.id).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("关闭活动成功");
|
this.$Message.success("关闭活动成功");
|
||||||
|
@ -333,9 +338,9 @@ export default {
|
||||||
},
|
},
|
||||||
// 页面缓存处理,从该页面离开时,修改KeepAlive为false,保证进入该页面是刷新
|
// 页面缓存处理,从该页面离开时,修改KeepAlive为false,保证进入该页面是刷新
|
||||||
beforeRouteLeave(to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
from.meta.keepAlive = false
|
from.meta.keepAlive = false;
|
||||||
next()
|
next();
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -18,45 +18,90 @@
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="operation">
|
<Row class="operation">
|
||||||
<Tabs type="card" v-model="tabCurrent">
|
<Tabs type="card" v-model="tabCurrent">
|
||||||
<TabPane v-for="(tab, tabIndex) in goodsList" :key="tabIndex" :label="tab.hour" :name="tabIndex + ''">
|
<TabPane
|
||||||
<Table :loading="loading" border :columns="goodsColumns" v-if="tabIndex == tabCurrent" :data="tab.list" :ref="'table' + tabIndex"
|
v-for="(tab, tabIndex) in goodsList"
|
||||||
@on-selection-change="changeSelect">
|
: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">
|
<template slot-scope="{ row }" slot="originalPrice">
|
||||||
|
|
||||||
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row, index }" slot="quantity">
|
<template slot-scope="{ row, index }" slot="quantity">
|
||||||
<InputNumber :min="0" v-model="row.quantity" :disabled="row.promotionApplyStatus == 'PASS'" @input="
|
<InputNumber
|
||||||
goodsList[tabIndex].list[index].quantity = row.quantity
|
:min="0"
|
||||||
" />
|
v-model="row.quantity"
|
||||||
|
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||||
|
@input="goodsList[tabIndex].list[index].quantity = row.quantity"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row, index }" slot="price">
|
<template slot-scope="{ row, index }" slot="price">
|
||||||
<InputNumber :min="0" style="width:100%;" v-model="row.price" :disabled="row.promotionApplyStatus == 'PASS'"
|
<InputNumber
|
||||||
@input="goodsList[tabIndex].list[index].price = row.price" />
|
:min="0"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="row.price"
|
||||||
|
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||||
|
@input="goodsList[tabIndex].list[index].price = row.price"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row }" slot="promotionApplyStatus">
|
<template slot-scope="{ row }" slot="promotionApplyStatus">
|
||||||
<Badge status="success" v-if="row.promotionApplyStatus == 'PASS'"
|
<Badge
|
||||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
status="success"
|
||||||
<Badge status="blue" v-if="row.promotionApplyStatus == 'APPLY'"
|
v-if="row.promotionApplyStatus == 'PASS'"
|
||||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||||
<Badge status="error" v-if="row.promotionApplyStatus == 'REFUSE'"
|
/>
|
||||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
<Badge
|
||||||
<span v-if="row.promotionApplyStatus == 'REFUSE'" @click="showReason(row.failReason)"
|
status="blue"
|
||||||
class="reason">(拒绝原因)</span>
|
v-if="row.promotionApplyStatus == 'APPLY'"
|
||||||
<Badge status="error" v-if="row.promotionApplyStatus == ''"
|
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||||
: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>
|
||||||
|
|
||||||
<template slot-scope="{ row }" slot="QRCode">
|
<template slot-scope="{ row }" slot="QRCode">
|
||||||
<img v-if="row.QRCode" :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px"
|
<img
|
||||||
alt="" />
|
v-if="row.QRCode"
|
||||||
|
:src="row.QRCode || '../../../assets/lili.png'"
|
||||||
|
width="50px"
|
||||||
|
height="50px"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="{ row, index }" slot="action">
|
<template slot-scope="{ row, index }" slot="action">
|
||||||
<Button type="error" v-if="promotionStatus === 'NEW'" size="small" ghost
|
<Button
|
||||||
@click="delGoods(index, row)">删除
|
type="error"
|
||||||
|
v-if="promotionStatus === 'NEW'"
|
||||||
|
size="small"
|
||||||
|
ghost
|
||||||
|
@click="delGoods(index, row)"
|
||||||
|
>删除
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -66,7 +111,12 @@
|
||||||
|
|
||||||
<Row class="operation">
|
<Row class="operation">
|
||||||
<Button @click="closeCurrentPage">返回</Button>
|
<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>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -87,14 +137,14 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
skuSelect,
|
skuSelect,
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
tabCurrent(val){
|
tabCurrent(val) {
|
||||||
this.tabIndex = val
|
this.tabIndex = val;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabCurrent:0,
|
tabCurrent: 0,
|
||||||
promotionStatus: "", // 活动状态
|
promotionStatus: "", // 活动状态
|
||||||
loading: false, // 表单加载状态
|
loading: false, // 表单加载状态
|
||||||
searchForm: {
|
searchForm: {
|
||||||
|
@ -292,10 +342,9 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.$set(this.goodsList[this.tabIndex], "list", [
|
this.$set(this.goodsList[this.tabIndex], "list", [
|
||||||
...way,
|
...way,
|
||||||
...this.defaultGoodsList,
|
// ...this.defaultGoodsList,
|
||||||
]);
|
]);
|
||||||
// this.$nextTick(() => {
|
// this.$nextTick(() => {
|
||||||
// this.$forceUpdate();
|
// this.$forceUpdate();
|
||||||
|
@ -305,14 +354,11 @@ export default {
|
||||||
// 显示商品选择器
|
// 显示商品选择器
|
||||||
|
|
||||||
this.$refs.skuSelect.open("goods");
|
this.$refs.skuSelect.open("goods");
|
||||||
this.$refs.skuSelect.selectedWay = [];
|
|
||||||
console.warn(this.goodsList[this.tabIndex].list);
|
|
||||||
let data = this.goodsList[this.tabIndex].list;
|
let data = this.goodsList[this.tabIndex].list;
|
||||||
data.forEach((e) => {
|
data.forEach((e) => {
|
||||||
e.id = e.skuId;
|
e.id = e.skuId;
|
||||||
});
|
});
|
||||||
this.$refs.skuSelect.selectedWay = data;
|
this.$refs.skuSelect.goodsData = data;
|
||||||
console.log(this.$refs.skuSelect.selectedWay);
|
|
||||||
},
|
},
|
||||||
unixDate(time) {
|
unixDate(time) {
|
||||||
// 处理报名截止时间
|
// 处理报名截止时间
|
Loading…
Reference in New Issue