适配重构促销

master
paulGao 2021-12-11 13:50:58 +08:00
parent fd1d32d431
commit edef393535
40 changed files with 2532 additions and 1486 deletions

View File

@ -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"> &nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="item-price-title"> &nbsp;&nbsp;&nbsp;&nbsp;</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']"> &nbsp;&nbsp;</span> <span class="item-price-title" v-if="promotionMap['SECKILL']"
<span class="item-price">{{skuDetail.promotionPrice | unitPrice("¥")}}</span> > &nbsp;&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="item-price-title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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;
} }

View File

@ -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="/">去选购&gt;</router-link> <router-link to="/">去选购&gt;</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;
} }

View File

@ -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 => {

View File

@ -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")
} }
] ]
}; };

View File

@ -0,0 +1,60 @@
export function promotionsStatusRender(h, params) {
let text = "未知",
color = "red";
if (params.row.promotionStatus == "NEW") {
text = "未开始";
color = "geekblue";
} else if (params.row.promotionStatus == "START") {
text = "已开始";
color = "green";
} else if (params.row.promotionStatus == "END") {
text = "已结束";
color = "red";
} else if (params.row.promotionStatus == "CLOSE") {
text = "已关闭";
color = "red";
}
return h("div", [
h(
"Tag",
{
props: {
color: color,
},
},
text
),
]);
}
export function promotionsScopeTypeRender(h, params) {
let text = "未知",
color = "red";
if (params.row.scopeType == "ALL") {
text = "全品类";
color = "default";
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
text = "商品分类";
color = "yellow";
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
text = "店铺分类";
color = "pink";
} else if (params.row.scopeType == "PORTION_GOODS") {
text = "指定商品";
color = "magenta";
}
return h("div", [
h(
"Tag",
{
props: {
color: color,
},
},
text
),
]);
}

View File

@ -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>

View File

@ -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>

View File

@ -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(() => {});
}, },
}); });
}, },

View File

@ -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>

View File

@ -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();
}, },

View File

@ -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>&nbsp;
>&nbsp; <Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox>&nbsp;
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox
>&nbsp;
<Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>&nbsp; <Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>&nbsp;
<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>

View File

@ -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() {

View File

@ -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, "¥")
);
}, },
}, },
{ {
@ -199,7 +216,7 @@ export default {
this.$Message.error("活动库存不能为0且不能超过商品库存"); this.$Message.error("活动库存不能为0且不能超过商品库存");
return; return;
} }
// //
if (!regular.money.test(res.settlementPrice)) { if (!regular.money.test(res.settlementPrice)) {
checkResult = false; checkResult = false;
@ -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>

View File

@ -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,

View File

@ -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 },
}); });
}, },

View File

@ -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: {

View File

@ -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>

View File

@ -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>

View File

@ -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();

View File

@ -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>

View File

@ -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
>
&nbsp; &nbsp;
<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();

View File

@ -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;
} }
</style> .menu-input {
width: 500px;
}
</style>

View File

@ -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)
} }

View File

@ -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
}, },
{ {

View File

@ -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",

View File

@ -0,0 +1,60 @@
export function promotionsStatusRender(h, params) {
let text = "未知",
color = "red";
if (params.row.promotionStatus == "NEW") {
text = "未开始";
color = "geekblue";
} else if (params.row.promotionStatus == "START") {
text = "已开始";
color = "green";
} else if (params.row.promotionStatus == "END") {
text = "已结束";
color = "red";
} else if (params.row.promotionStatus == "CLOSE") {
text = "已关闭";
color = "red";
}
return h("div", [
h(
"Tag",
{
props: {
color: color,
},
},
text
),
]);
}
export function promotionsScopeTypeRender(h, params) {
let text = "未知",
color = "red";
if (params.row.scopeType == "ALL") {
text = "全品类";
color = "default";
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
text = "商品分类";
color = "yellow";
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
text = "店铺分类";
color = "pink";
} else if (params.row.scopeType == "PORTION_GOODS") {
text = "指定商品";
color = "magenta";
}
return h("div", [
h(
"Tag",
{
props: {
color: color,
},
},
text
),
]);
}

View File

@ -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>

View File

@ -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();

View File

@ -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>

View File

@ -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() {

View File

@ -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;

View File

@ -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
>&nbsp; >&nbsp;
<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
>&nbsp; >&nbsp;
<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
>&nbsp; >&nbsp;
<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
>&nbsp; >&nbsp;
<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 {
}, },
// KeepAlivefalse // KeepAlivefalse
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">

View File

@ -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) {
// //