Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop-ui
commit
9eecc603db
|
@ -19,7 +19,11 @@
|
|||
</div>
|
||||
|
||||
<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>
|
||||
<!-- 右侧商品信息、活动信息、操作展示 -->
|
||||
|
@ -30,10 +34,13 @@
|
|||
</p>
|
||||
</div>
|
||||
<div class="sell-point">
|
||||
{{skuDetail.sellingPoint}}
|
||||
{{ skuDetail.sellingPoint }}
|
||||
</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-price-left">
|
||||
|
@ -41,19 +48,25 @@
|
|||
<div class="item-price-row" v-if="!skuDetail.promotionPrice">
|
||||
<p>
|
||||
<span class="item-price-title">价 格</span>
|
||||
<span class="item-price">{{skuDetail.price | unitPrice("¥")}}</span>
|
||||
<span class="item-price">{{ skuDetail.price | unitPrice("¥") }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- 秒杀价格 -->
|
||||
<div class="item-price-row" v-if="skuDetail.promotionPrice">
|
||||
<p>
|
||||
<span class="item-price-title" v-if="promotionMap['SECKILL']">秒 杀 价</span>
|
||||
<span class="item-price">{{skuDetail.promotionPrice | unitPrice("¥")}}</span>
|
||||
<span class="item-price-old">{{skuDetail.price | unitPrice("¥")}}</span>
|
||||
<span class="item-price-title" v-if="promotionMap['SECKILL']"
|
||||
>秒 杀 价</span
|
||||
>
|
||||
<span class="item-price">{{
|
||||
skuDetail.promotionPrice | unitPrice("¥")
|
||||
}}</span>
|
||||
<span class="item-price-old">{{
|
||||
skuDetail.price | unitPrice("¥")
|
||||
}}</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- 优惠券展示 -->
|
||||
<div class="item-price-row" v-if="promotionMap['COUPON'].length">
|
||||
<div class="item-price-row" v-if="promotionMap['COUPON'].length">
|
||||
<p>
|
||||
<span class="item-price-title">优 惠 券</span>
|
||||
<span
|
||||
|
@ -61,10 +74,14 @@
|
|||
v-for="(item, index) in promotionMap['COUPON']"
|
||||
:key="index"
|
||||
@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'">满{{ item.consumeThreshold }}打{{item.couponDiscount}}折</span>
|
||||
</span>
|
||||
<span v-if="item.couponType == 'DISCOUNT'"
|
||||
>满{{ item.consumeThreshold }}打{{ item.couponDiscount }}折</span
|
||||
>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<!-- 满减展示 -->
|
||||
|
@ -72,8 +89,20 @@
|
|||
<p>
|
||||
<span class="item-price-title">促 销</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 class="item-desc-pintuan" v-if="promotionMap['FULL_DISCOUNT'].fullRate">满{{ promotionMap['FULL_DISCOUNT'].fullMoney }}元,立享{{ promotionMap['FULL_DISCOUNT'].fullRate}}折</span>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,9 +121,13 @@
|
|||
<p>{{ sku.name }}</p>
|
||||
</div>
|
||||
<div class="item-select-column">
|
||||
<div class="item-select-row" v-for="(item) in sku.values" :key="item.value">
|
||||
<div class="item-select-box" @click="select(index, item.value)"
|
||||
:class="{ 'item-select-box-active': item.value === currentSelceted[index] }"
|
||||
<div class="item-select-row" v-for="item in sku.values" :key="item.value">
|
||||
<div
|
||||
class="item-select-box"
|
||||
@click="select(index, item.value)"
|
||||
:class="{
|
||||
'item-select-box-active': item.value === currentSelceted[index],
|
||||
}"
|
||||
>
|
||||
<div class="item-select-intro">
|
||||
<p>{{ item.value }}</p>
|
||||
|
@ -110,26 +143,57 @@
|
|||
<p>数量</p>
|
||||
</div>
|
||||
<div class="item-select-row">
|
||||
<InputNumber :min="1" :disabled="skuDetail.quantity === 0" v-model="count"></InputNumber>
|
||||
<span class="inventory"> 库存{{skuDetail.quantity}}</span>
|
||||
<InputNumber
|
||||
:min="1"
|
||||
:disabled="skuDetail.quantity === 0"
|
||||
v-model="count"
|
||||
></InputNumber>
|
||||
<span class="inventory"> 库存{{ skuDetail.quantity }}</span>
|
||||
</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">
|
||||
<p>重量</p>
|
||||
</div>
|
||||
<div class="item-select-row">
|
||||
<span class="inventory"> {{skuDetail.weight}}kg</span>
|
||||
<span class="inventory"> {{ skuDetail.weight }}kg</span>
|
||||
</div>
|
||||
</div>
|
||||
<div 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
|
||||
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 class="add-buy-car" 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
|
||||
class="add-buy-car"
|
||||
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>
|
||||
|
@ -137,20 +201,25 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Promotion from './Promotion.vue';
|
||||
import PicZoom from 'vue-piczoom'; // 图片放大
|
||||
import { collectGoods, isCollection, receiveCoupon, cancelCollect } from '@/api/member.js';
|
||||
import { addCartGoods } from '@/api/cart.js';
|
||||
import Promotion from "./Promotion.vue";
|
||||
import PicZoom from "vue-piczoom"; // 图片放大
|
||||
import {
|
||||
collectGoods,
|
||||
isCollection,
|
||||
receiveCoupon,
|
||||
cancelCollect,
|
||||
} from "@/api/member.js";
|
||||
import { addCartGoods } from "@/api/cart.js";
|
||||
export default {
|
||||
name: 'ShowGoods',
|
||||
name: "ShowGoods",
|
||||
props: {
|
||||
// 商品数据
|
||||
detail: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
count: 1, // 商品数量
|
||||
imgIndex: 0, // 展示图片下标
|
||||
|
@ -158,24 +227,26 @@ export default {
|
|||
imgList: [{}], // 商品图片列表
|
||||
skuDetail: this.detail.data, // sku详情
|
||||
goodsSpecList: this.detail.specs, // 商品spec
|
||||
promotionMap: { // 活动状态
|
||||
promotionMap: {
|
||||
// 活动状态
|
||||
SECKILL: null,
|
||||
FULL_DISCOUNT: null,
|
||||
COUPON: []
|
||||
COUPON: [],
|
||||
}, // 促销活动
|
||||
formatList: [], // 选择商品品类的数组
|
||||
loading: false, // 立即购买loading
|
||||
loading1: false, // 加入购物车loading
|
||||
isCollected: false // 是否收藏
|
||||
isCollected: false, // 是否收藏
|
||||
};
|
||||
},
|
||||
components: { PicZoom, Promotion },
|
||||
methods: {
|
||||
select (index, value) { // 选择规格
|
||||
select(index, value) {
|
||||
// 选择规格
|
||||
this.$set(this.currentSelceted, index, value);
|
||||
let selectedSkuId = this.goodsSpecList.find((i) => {
|
||||
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++) {
|
||||
if (specValues[n].specValue !== this.currentSelceted[n]) {
|
||||
matched = false;
|
||||
|
@ -187,76 +258,86 @@ export default {
|
|||
}
|
||||
});
|
||||
this.$router.push({
|
||||
path: '/goodsDetail',
|
||||
query: { skuId: selectedSkuId.skuId, goodsId: this.skuDetail.goodsId }
|
||||
path: "/goodsDetail",
|
||||
query: { skuId: selectedSkuId.skuId, goodsId: this.skuDetail.goodsId },
|
||||
});
|
||||
},
|
||||
|
||||
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 () { // 立即购买
|
||||
addShoppingCartBtn() {
|
||||
// 添加购物车
|
||||
const params = {
|
||||
num: this.count,
|
||||
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') {
|
||||
params.cartType = 'VIRTUAL'
|
||||
if (this.skuDetail.goodsType === "VIRTUAL_GOODS") {
|
||||
params.cartType = "VIRTUAL";
|
||||
}
|
||||
this.loading1 = true;
|
||||
addCartGoods(params).then(res => {
|
||||
this.loading1 = false;
|
||||
if (res.success) {
|
||||
this.$router.push({path: '/pay', query: {way: params.cartType}});
|
||||
} else {
|
||||
this.$Message.warning(res.message);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loading1 = false;
|
||||
});
|
||||
addCartGoods(params)
|
||||
.then((res) => {
|
||||
this.loading1 = false;
|
||||
if (res.success) {
|
||||
this.$router.push({ path: "/pay", query: { way: params.cartType } });
|
||||
} else {
|
||||
this.$Message.warning(res.message);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading1 = false;
|
||||
});
|
||||
},
|
||||
async collect () { // 收藏商品
|
||||
async collect() {
|
||||
// 收藏商品
|
||||
if (this.isCollected) {
|
||||
let cancel = await cancelCollect('GOODS', this.skuDetail.id)
|
||||
let cancel = await cancelCollect("GOODS", this.skuDetail.id);
|
||||
if (cancel.success) {
|
||||
this.$Message.success('取消收藏成功')
|
||||
this.isCollected = false
|
||||
this.$Message.success("取消收藏成功");
|
||||
this.isCollected = false;
|
||||
}
|
||||
} else {
|
||||
let collect = await collectGoods('GOODS', this.skuDetail.id);
|
||||
let collect = await collectGoods("GOODS", this.skuDetail.id);
|
||||
if (collect.code === 200) {
|
||||
this.isCollected = true;
|
||||
this.$Message.success('收藏商品成功,可以前往个人中心我的收藏查看');
|
||||
this.$Message.success("收藏商品成功,可以前往个人中心我的收藏查看");
|
||||
}
|
||||
}
|
||||
},
|
||||
// 格式化数据
|
||||
formatSku (list) {
|
||||
formatSku(list) {
|
||||
let arr = [{}];
|
||||
list.forEach((item, index) => {
|
||||
item.specValues.forEach((spec, specIndex) => {
|
||||
let name = spec.specName;
|
||||
let values = {
|
||||
value: spec.specValue,
|
||||
quantity: item.quantity
|
||||
quantity: item.quantity,
|
||||
};
|
||||
if (name === 'images') {
|
||||
if (name === "images") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,7 +356,7 @@ export default {
|
|||
if (!keys.includes(name)) {
|
||||
arr.push({
|
||||
name: name,
|
||||
values: [values]
|
||||
values: [values],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -286,55 +367,67 @@ export default {
|
|||
|
||||
let cur = list.filter((i) => i.skuId === this.$route.query.skuId)[0];
|
||||
if (cur) {
|
||||
cur.specValues.filter((i) => i.specName !== 'images')
|
||||
cur.specValues
|
||||
.filter((i) => i.specName !== "images")
|
||||
.forEach((value, _index) => {
|
||||
this.currentSelceted[_index] = value.specValue;
|
||||
});
|
||||
}
|
||||
this.skuList = list;
|
||||
},
|
||||
receiveCoupon (id) { // 领取优惠券
|
||||
receiveCoupon(id).then(res => {
|
||||
receiveCoupon(id) {
|
||||
// 领取优惠券
|
||||
receiveCoupon(id).then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success('优惠券领取成功')
|
||||
this.$Message.success("优惠券领取成功");
|
||||
} else {
|
||||
this.$Message.warning(res.message)
|
||||
this.$Message.warning(res.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
promotion () { // 格式化促销活动,返回当前促销的对象
|
||||
promotion() {
|
||||
// 格式化促销活动,返回当前促销的对象
|
||||
if (!this.detail.promotionMap) return false;
|
||||
let keysArr = Object.keys(this.detail.promotionMap);
|
||||
if (keysArr.length === 0) return false;
|
||||
|
||||
for (let i = 0; i < keysArr.length; i++) {
|
||||
let key = keysArr[i].split('-')[0]
|
||||
if (key === 'COUPON') {
|
||||
this.promotionMap[key].push(this.detail.promotionMap[keysArr[i]])
|
||||
let key = keysArr[i].split("-")[0];
|
||||
if (
|
||||
(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 {
|
||||
this.promotionMap[key] = this.detail.promotionMap[keysArr[i]]
|
||||
this.promotionMap[key] = this.detail.promotionMap[keysArr[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
// 用户登录才会判断是否收藏
|
||||
if (this.Cookies.getItem('userInfo')) {
|
||||
isCollection('GOODS', this.skuDetail.id).then(res => {
|
||||
if (this.Cookies.getItem("userInfo")) {
|
||||
isCollection("GOODS", this.skuDetail.id).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
this.isCollected = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
this.detail.data.specList.forEach(e => {
|
||||
if (e.specName === 'images') {
|
||||
this.imgList = e.specImage
|
||||
this.detail.data.specList.forEach((e) => {
|
||||
if (e.specName === "images") {
|
||||
this.imgList = e.specImage;
|
||||
}
|
||||
})
|
||||
});
|
||||
this.formatSku(this.goodsSpecList);
|
||||
this.promotion()
|
||||
document.title = this.skuDetail.goodsName
|
||||
}
|
||||
this.promotion();
|
||||
document.title = this.skuDetail.goodsName;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -346,7 +439,6 @@ export default {
|
|||
}
|
||||
.inventory {
|
||||
padding-left: 4px;
|
||||
|
||||
}
|
||||
|
||||
.global_color {
|
||||
|
@ -597,7 +689,7 @@ export default {
|
|||
|
||||
.add-buy-car {
|
||||
margin-top: 15px;
|
||||
>*{
|
||||
> * {
|
||||
margin: 0 4px;
|
||||
}
|
||||
}
|
||||
|
@ -607,7 +699,7 @@ export default {
|
|||
justify-content: space-between;
|
||||
> span {
|
||||
padding-right: 10px;
|
||||
&:hover{
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: $theme_color;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
<!-- LOGO 搜索 -->
|
||||
<div class="width_1200 logo">
|
||||
<div>
|
||||
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
|
||||
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
|
||||
<div>
|
||||
购物车(<span>{{ goodsTotal }}</span>)
|
||||
购物车(<span>{{ goodsTotal }}</span
|
||||
>)
|
||||
</div>
|
||||
</div>
|
||||
<Search :showTag="false" :showLogo="false"></Search>
|
||||
|
@ -17,9 +18,15 @@
|
|||
<div class="available-area">
|
||||
<div class="cart-steps">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +34,9 @@
|
|||
<div class="cart-goods">
|
||||
<div class="cart-goods-title">
|
||||
<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 class="goods-title">商品</div>
|
||||
<div class="width_150">单价(元)</div>
|
||||
|
@ -39,83 +48,140 @@
|
|||
<p>购物车空空如也</p>
|
||||
<router-link to="/">去选购></router-link>
|
||||
</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>
|
||||
<Checkbox 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>
|
||||
<Checkbox
|
||||
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>
|
||||
<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 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 === 'DISCOUNT'">{{ item.couponDiscount }}折</span>
|
||||
<span>满{{item.consumeThreshold}}元可用</span>
|
||||
<Button class="coupon-btn" size="small" type="primary" @click="receiveShopCoupon(item)" :disabled="item.disabled">{{ item.disabled ? "已领取" : "领取" }}</Button>
|
||||
<span v-if="item.couponType === 'DISCOUNT'"
|
||||
>{{ item.couponDiscount }}折</span
|
||||
>
|
||||
<span>满{{ item.consumeThreshold }}元可用</span>
|
||||
<Button
|
||||
class="coupon-btn"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="receiveShopCoupon(item)"
|
||||
:disabled="item.disabled"
|
||||
>{{ item.disabled ? "已领取" : "领取" }}</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<div class="promotion-notice">{{shop.promotionNotice}}</div>
|
||||
<div class="promotion-notice">{{ shop.promotionNotice }}</div>
|
||||
</div>
|
||||
<template v-for="(goods, goodsIndex) in shop.skuList">
|
||||
<div class="goods-item" :key="goodsIndex">
|
||||
<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 class="goods-title" @click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)">
|
||||
<img :src="
|
||||
goods.goodsSku.thumbnail || '../assets/images/goodsDetail/item-detail-1.jpg'
|
||||
" />
|
||||
<div
|
||||
class="goods-title"
|
||||
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
|
||||
>
|
||||
<img
|
||||
:src="
|
||||
goods.goodsSku.thumbnail ||
|
||||
'../assets/images/goodsDetail/item-detail-1.jpg'
|
||||
"
|
||||
/>
|
||||
<div>
|
||||
<p>{{ goods.goodsSku.goodsName }}</p>
|
||||
<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>
|
||||
<promotion :time="promotion.endTime" type="cart"></promotion>
|
||||
</div>
|
||||
</template>
|
||||
<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>
|
||||
<promotion :time="promotion.endTime" type="cart"></promotion>
|
||||
</div>
|
||||
</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 class="width_150">
|
||||
{{ goods.purchasePrice | unitPrice("¥") }}
|
||||
</div>
|
||||
<div class="width_100">
|
||||
<InputNumber :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>
|
||||
<InputNumber
|
||||
: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 class="width_150">
|
||||
{{ goods.subTotal | unitPrice("¥") }}
|
||||
</div>
|
||||
<div class="width_100">
|
||||
<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>
|
||||
<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 class="error-goods" v-if="goods.errorMessage">
|
||||
<div>{{goods.errorMessage}}</div>
|
||||
<div>{{ goods.errorMessage }}</div>
|
||||
<Button type="primary" @click="delGoods(goods.goodsSku.id)">删除</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</div>
|
||||
<!-- 底部支付栏 -->
|
||||
<div class="cart-goods-footer">
|
||||
<div>
|
||||
<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 class="width_100 handle-btn" @click="delGoods">删除选中商品</div>
|
||||
<!-- <div class="width_100 handle-btn" @click="collectGoods">移到我的收藏</div> -->
|
||||
|
@ -123,13 +189,15 @@
|
|||
</div>
|
||||
<div>
|
||||
<div class="selected-count">
|
||||
已选择<span>{{ checkedNum }}</span>件商品
|
||||
已选择<span>{{ checkedNum }}</span
|
||||
>件商品
|
||||
</div>
|
||||
<div class="ml_20 save-price">
|
||||
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
|
||||
</div>
|
||||
<div class="ml_20 total-price">
|
||||
总价(不含运费):<div>{{ priceDetailDTO.flowPrice | unitPrice("¥") }}</div>
|
||||
总价(不含运费):
|
||||
<div>{{ priceDetailDTO.flowPrice | unitPrice("¥") }}</div>
|
||||
</div>
|
||||
<div class="pay ml_20" @click="pay">去结算</div>
|
||||
</div>
|
||||
|
@ -142,21 +210,21 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Promotion from '@/components/goodsDetail/Promotion';
|
||||
import Search from '@/components/Search';
|
||||
import * as APICart from '@/api/cart';
|
||||
import * as APIMember from '@/api/member';
|
||||
import Promotion from "@/components/goodsDetail/Promotion";
|
||||
import Search from "@/components/Search";
|
||||
import * as APICart from "@/api/cart";
|
||||
import * as APIMember from "@/api/member";
|
||||
export default {
|
||||
name: 'Cart',
|
||||
beforeRouteEnter (to, from, next) {
|
||||
name: "Cart",
|
||||
beforeRouteEnter(to, from, next) {
|
||||
window.scrollTo(0, 0);
|
||||
next();
|
||||
},
|
||||
components: {
|
||||
Search,
|
||||
Promotion
|
||||
Promotion,
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
couponAvailable: false, // 展示优惠券
|
||||
stepIndex: 0, // 当前处于哪一步,购物车==0,填写订单信息==1,成功提交订单==2
|
||||
|
@ -167,44 +235,44 @@ export default {
|
|||
cartList: [], // 购物车列表
|
||||
couponList: [], // 优惠券列表
|
||||
priceDetailDTO: {}, // 价格明细
|
||||
skuList: [] // sku列表
|
||||
skuList: [], // sku列表
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 跳转商品详情
|
||||
goGoodsDetail (skuId, goodsId) {
|
||||
goGoodsDetail(skuId, goodsId) {
|
||||
let routeUrl = this.$router.resolve({
|
||||
path: '/goodsDetail',
|
||||
query: { skuId, goodsId }
|
||||
path: "/goodsDetail",
|
||||
query: { skuId, goodsId },
|
||||
});
|
||||
window.open(routeUrl.href, '_blank');
|
||||
window.open(routeUrl.href, "_blank");
|
||||
},
|
||||
// 跳转店铺首页
|
||||
goShopPage (id) {
|
||||
goShopPage(id) {
|
||||
let routeUrl = this.$router.resolve({
|
||||
path: '/Merchant',
|
||||
query: { id }
|
||||
path: "/Merchant",
|
||||
query: { id },
|
||||
});
|
||||
window.open(routeUrl.href, '_blank');
|
||||
window.open(routeUrl.href, "_blank");
|
||||
},
|
||||
// 收藏商品
|
||||
collectGoods (id) {
|
||||
collectGoods(id) {
|
||||
this.$Modal.confirm({
|
||||
title: '收藏',
|
||||
content: '<p>商品收藏后可在个人中心我的收藏查看</p>',
|
||||
title: "收藏",
|
||||
content: "<p>商品收藏后可在个人中心我的收藏查看</p>",
|
||||
onOk: () => {
|
||||
APIMember.collectGoods('GOODS', id).then((res) => {
|
||||
APIMember.collectGoods("GOODS", id).then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success('收藏商品成功');
|
||||
this.$Message.success("收藏商品成功");
|
||||
this.getCartList();
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {}
|
||||
onCancel: () => {},
|
||||
});
|
||||
},
|
||||
// 删除商品
|
||||
delGoods (id) {
|
||||
delGoods(id) {
|
||||
const idArr = [];
|
||||
if (!id) {
|
||||
const list = this.cartList;
|
||||
|
@ -217,51 +285,51 @@ export default {
|
|||
idArr.push(id);
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: '删除',
|
||||
content: '<p>确定要删除该商品吗?</p>',
|
||||
title: "删除",
|
||||
content: "<p>确定要删除该商品吗?</p>",
|
||||
onOk: () => {
|
||||
APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success('删除成功');
|
||||
this.$Message.success("删除成功");
|
||||
this.getCartList();
|
||||
} else {
|
||||
this.$Message.error(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 清空购物车
|
||||
clearCart () {
|
||||
clearCart() {
|
||||
this.$Modal.confirm({
|
||||
title: '提示',
|
||||
content: '<p>确定要清空购物车吗?清空后不可恢复</p>',
|
||||
title: "提示",
|
||||
content: "<p>确定要清空购物车吗?清空后不可恢复</p>",
|
||||
onOk: () => {
|
||||
APICart.clearCart().then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success('清空购物车成功');
|
||||
this.$Message.success("清空购物车成功");
|
||||
this.getCartList();
|
||||
} else {
|
||||
this.$Message.error(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 跳转支付页面
|
||||
pay () {
|
||||
pay() {
|
||||
if (this.checkedNum) {
|
||||
this.$router.push({ path: '/pay', query: { way: 'CART' } });
|
||||
this.$router.push({ path: "/pay", query: { way: "CART" } });
|
||||
} else {
|
||||
this.$Message.warning('请至少选择一件商品');
|
||||
this.$Message.warning("请至少选择一件商品");
|
||||
}
|
||||
},
|
||||
// 展示优惠券
|
||||
showCoupon (storeId, index) {
|
||||
showCoupon(storeId, index) {
|
||||
this.couponAvailable = index;
|
||||
},
|
||||
// 设置购买数量
|
||||
changeNum (val, id) {
|
||||
changeNum(val, id) {
|
||||
console.log(val, id);
|
||||
APICart.setCartGoodsNum({ skuId: id, num: val }).then((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;
|
||||
if (type === 'all') {
|
||||
if (type === "all") {
|
||||
// 全选
|
||||
await APICart.setCheckedAll({ checked: check });
|
||||
} else if (type === 'shop') {
|
||||
} else if (type === "shop") {
|
||||
// 选中店铺所有商品
|
||||
await APICart.setCheckedSeller({ checked: check, storeId: id });
|
||||
} else {
|
||||
|
@ -287,17 +355,17 @@ export default {
|
|||
this.getCartList();
|
||||
},
|
||||
// 领取优惠券
|
||||
async receiveShopCoupon (item) {
|
||||
async receiveShopCoupon(item) {
|
||||
let res = await APIMember.receiveCoupon(item.id);
|
||||
if (res.success) {
|
||||
this.$set(item, 'disabled', true);
|
||||
this.$Message.success('领取成功');
|
||||
this.$set(item, "disabled", true);
|
||||
this.$Message.success("领取成功");
|
||||
} else {
|
||||
this.$Message.error(res.message);
|
||||
}
|
||||
},
|
||||
// 购物车列表
|
||||
async getCartList () {
|
||||
async getCartList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
let res = await APICart.cartGoodsAll();
|
||||
|
@ -326,15 +394,15 @@ export default {
|
|||
} catch (error) {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
this.getCartList();
|
||||
APICart.cartCount().then((res) => {
|
||||
// 购物车商品数量
|
||||
if (res.success) this.goodsTotal = res.result;
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -657,12 +725,12 @@ export default {
|
|||
color: #999;
|
||||
}
|
||||
}
|
||||
.cart-goods-footer > div{
|
||||
.cart-goods-footer > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.total-price{
|
||||
.total-price {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ export const getPintuanGoodsList = params => {
|
|||
};
|
||||
|
||||
// 关闭拼团活动
|
||||
export const closePintuan = pintuanId => {
|
||||
return putRequest(`/promotion/pintuan/close/${pintuanId}`);
|
||||
export const updatePintuanStatus = (pintuanId, params) => {
|
||||
return putRequest(`/promotion/pintuan/status/${pintuanId}`, params);
|
||||
};
|
||||
|
||||
// 修改砍价活动商品
|
||||
|
@ -187,12 +187,14 @@ export const saveSeckill = params => {
|
|||
|
||||
// 修改秒杀活动
|
||||
export const updateSeckill = params => {
|
||||
return putRequest("/promotion/seckill", params);
|
||||
return putRequest("/promotion/seckill", params, {
|
||||
"Content-type": "application/json"
|
||||
});
|
||||
};
|
||||
|
||||
// 关闭秒杀活动
|
||||
export const closeSeckill = id => {
|
||||
return putRequest(`/promotion/seckill/close/${id}`);
|
||||
export const updateSeckillStatus = (id, params) => {
|
||||
return putRequest(`/promotion/seckill/status/${id}`, params);
|
||||
};
|
||||
// 删除秒杀商品
|
||||
export const delSeckillGoods = params => {
|
||||
|
|
|
@ -154,103 +154,103 @@ export const otherRouter = {
|
|||
component: () => import("@/views/goods/goods-info/goodsDetail.vue")
|
||||
},
|
||||
{
|
||||
path: "promotion/add-points-goods",
|
||||
path: "promotions/add-points-goods",
|
||||
title: "添加积分商品",
|
||||
name: "add-points-goods",
|
||||
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: "修改积分商品",
|
||||
name: "edit-points-goods",
|
||||
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: "积分商品分类",
|
||||
name: "manager-points-goods-category",
|
||||
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: "添加砍价活动",
|
||||
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: "修改砍价活动",
|
||||
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: "平台优惠券",
|
||||
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: "添加平台优惠券",
|
||||
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: "编辑平台优惠券",
|
||||
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: "添加优惠券活动",
|
||||
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: "编辑平台优惠券活动",
|
||||
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: "券活动详情",
|
||||
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: "平台拼团",
|
||||
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: "拼团商品",
|
||||
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: "满减满折详情",
|
||||
name: "full-cut-detail",
|
||||
component: () => import("@/views/promotion/fullCut/fullCutDetail.vue")
|
||||
name: "full-discount-detail",
|
||||
component: () => import("@/views/promotions/full-discount/full-discount-detail.vue")
|
||||
},
|
||||
{
|
||||
path: "promotion/seckill/manager-seckill-add",
|
||||
path: "promotions/seckill/manager-seckill-add",
|
||||
title: "编辑秒杀活动",
|
||||
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: "秒杀商品",
|
||||
name: "seckill-goods",
|
||||
component: () => import("@/views/promotion/seckill/seckillGoods.vue")
|
||||
component: () => import("@/views/promotions/seckill/seckill-goods.vue")
|
||||
},
|
||||
{
|
||||
path: "/floorList/renovation",
|
||||
|
@ -271,10 +271,10 @@ export const otherRouter = {
|
|||
component: () => import("@/views/sys/message/smsSign.vue")
|
||||
},
|
||||
{
|
||||
path: "liveDetail",
|
||||
path: "live-detail",
|
||||
title: "查看直播",
|
||||
name: "liveDetail",
|
||||
component: () => import("@/views/promotion/live/liveDetail.vue")
|
||||
name: "live-detail",
|
||||
component: () => import("@/views/promotions/live/live-detail.vue")
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
export function promotionsStatusRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "geekblue";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
export function promotionsScopeTypeRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
color = "default";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
color = "yellow";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
color = "pink";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
color = "magenta";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -9,27 +9,31 @@
|
|||
<span>{{ couponActivity.promotionName }}</span>
|
||||
</FormItem>
|
||||
<FormItem label="活动类型">
|
||||
<span v-if="couponActivity.couponActivityType === 'REGISTERED'" >新人发券</span>
|
||||
<span v-if="couponActivity.couponActivityType === 'REGISTERED'"
|
||||
>新人发券</span
|
||||
>
|
||||
<spin v-else>精确发券</spin>
|
||||
</FormItem>
|
||||
<FormItem label="活动范围" v-if="couponActivity.couponActivityType === 'SPECIFY'" >
|
||||
<span v-if="couponActivity.activityScope === 'ALL'" >全部会员</span>
|
||||
<FormItem
|
||||
label="活动范围"
|
||||
v-if="couponActivity.couponActivityType === 'SPECIFY'"
|
||||
>
|
||||
<span v-if="couponActivity.activityScope === 'ALL'">全部会员</span>
|
||||
<spin v-else>指定会员</spin>
|
||||
</FormItem>
|
||||
<FormItem label="活动时间">
|
||||
<span>{{ couponActivity.startTime }}~{{ couponActivity.endTime }}</span>
|
||||
</FormItem>
|
||||
<FormItem label="活动状态">
|
||||
<span v-if="couponActivity.promotionStatus==='NEW'">新建</span>
|
||||
<span v-if="couponActivity.promotionStatus==='START'">已开始</span>
|
||||
<span v-if="couponActivity.promotionStatus==='END'">已结束</span>
|
||||
<span v-if="couponActivity.promotionStatus==='CLOSE'">已废弃</span>
|
||||
<span v-if="couponActivity.promotionStatus === 'NEW'">未开始</span>
|
||||
<span v-if="couponActivity.promotionStatus === 'START'">已开始</span>
|
||||
<span v-if="couponActivity.promotionStatus === 'END'">已结束</span>
|
||||
<span v-if="couponActivity.promotionStatus === 'CLOSE'">已关闭</span>
|
||||
</FormItem>
|
||||
</div>
|
||||
<h4>优惠券列表</h4>
|
||||
<Table :columns="couponColumn" :data="couponData" ref="table">
|
||||
</Table>
|
||||
<template v-if="couponActivity.activityScopeInfo && memberData.length>0">
|
||||
<Table :columns="couponColumn" :data="couponData" ref="table"> </Table>
|
||||
<template v-if="couponActivity.activityScopeInfo && memberData.length > 0">
|
||||
<h4 class="mt_10">会员列表列表</h4>
|
||||
<Table :columns="memberColumn" :data="memberData"></Table>
|
||||
</template>
|
||||
|
@ -44,28 +48,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getCouponActivity} from "@/api/promotion";
|
||||
import { getCouponActivity } from "@/api/promotion";
|
||||
|
||||
export default {
|
||||
name: "couponActivityInfo",
|
||||
name: "coupon-activity-info",
|
||||
data() {
|
||||
return {
|
||||
id: this.$route.query.id,//表单id
|
||||
couponActivity: {
|
||||
|
||||
},//券活动
|
||||
id: this.$route.query.id, //表单id
|
||||
couponActivity: {}, //券活动
|
||||
couponColumn: [
|
||||
{
|
||||
title: "优惠券名称",
|
||||
key: 'couponName'
|
||||
key: "couponName",
|
||||
},
|
||||
{
|
||||
title: "优惠券金额",
|
||||
key: 'price',
|
||||
key: "price",
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.couponType === "DISCOUNT") {
|
||||
text = params.row.price + "折";
|
||||
text = params.row.couponDiscount + "折";
|
||||
} else if (params.row.couponType === "PRICE") {
|
||||
text = "¥" + params.row.price;
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ export default {
|
|||
},
|
||||
{
|
||||
title: "优惠券类型",
|
||||
key: 'couponType',
|
||||
key: "couponType",
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.couponType == "DISCOUNT") {
|
||||
|
@ -88,7 +90,7 @@ export default {
|
|||
{
|
||||
title: "赠送数量",
|
||||
key: "num",
|
||||
}
|
||||
},
|
||||
],
|
||||
couponData: [],
|
||||
memberColumn: [
|
||||
|
@ -173,4 +175,3 @@ div.base-info-item {
|
|||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -6,81 +6,143 @@
|
|||
<h4>活动信息</h4>
|
||||
<div class="form-item-view">
|
||||
<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 label="活动时间">
|
||||
<DatePicker type="datetimerange" :options="options" v-model="rangeTime" format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择活动时间" style="width: 260px">
|
||||
<DatePicker
|
||||
type="datetimerange"
|
||||
:options="options"
|
||||
v-model="rangeTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择活动时间"
|
||||
style="width: 260px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
|
||||
<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="SPECIFY">精确发券</Radio>
|
||||
</RadioGroup>
|
||||
</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">
|
||||
<Radio label="ALL">全部会员</Radio>
|
||||
<Radio label="DESIGNATED">指定会员</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem label="选择会员" prop="scopeType"
|
||||
v-if="form.couponActivityType==='SPECIFY' && 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>
|
||||
<FormItem
|
||||
label="选择会员"
|
||||
prop="scopeType"
|
||||
v-if="
|
||||
form.couponActivityType === 'SPECIFY' &&
|
||||
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>
|
||||
</FormItem>
|
||||
</div>
|
||||
<h4>配置优惠券</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="选择优惠券" prop="scopeType">
|
||||
<Button type="primary" :loading="submitLoading" @click="showSelector">选择优惠券</Button>
|
||||
<Button type="primary" :loading="submitLoading" @click="showSelector"
|
||||
>选择优惠券</Button
|
||||
>
|
||||
</FormItem>
|
||||
<FormItem label="赠送配置" prop="scopeType">
|
||||
|
||||
<Table border :columns="columns" :data="this.selectCouponList">
|
||||
<template slot="sendNum" slot-scope="scope">
|
||||
<Input type="text" v-model="form.couponActivityItems[scope.index].num" placeholder="赠送数量"/>
|
||||
<Input type="text" v-model="form.couponActivityItems[scope.index].couponId" v-show="false"/>
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.couponActivityItems[scope.index].num"
|
||||
placeholder="赠送数量"
|
||||
/>
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.couponActivityItems[scope.index].couponId"
|
||||
v-show="false"
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<div>
|
||||
<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>
|
||||
</Form>
|
||||
</Card>
|
||||
<Modal @on-ok="()=>{this.showCouponSelect = false}" @on-cancel="()=>{this.showCouponSelect = false}"
|
||||
v-model="showCouponSelect" width="80%">
|
||||
<couponTemplate :checked="true" :selectedList="selectCouponList" getType="ACTIVITY" @selected="selectedCoupon"/>
|
||||
<Modal
|
||||
@on-ok="
|
||||
() => {
|
||||
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 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import couponTemplate from "@/views/promotion/coupon/coupon";
|
||||
import couponTemplate from "@/views/promotions/coupon/coupon";
|
||||
import userList from "@/views/member/list/index";
|
||||
import {saveActivityCoupon} from "@/api/promotion";
|
||||
import { saveActivityCoupon } from "@/api/promotion";
|
||||
import { promotionsScopeTypeRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "addCouponActivity",
|
||||
name: "add-coupon-activity",
|
||||
components: {
|
||||
couponTemplate,
|
||||
userList
|
||||
userList,
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
options: {
|
||||
disabledDate(date) {
|
||||
|
@ -98,14 +160,14 @@ export default {
|
|||
startTime: "", //开始时间
|
||||
endTime: "", //结束时间
|
||||
memberDTOS: [], //指定会员范围
|
||||
couponActivityItems: [],//优惠券列表
|
||||
couponActivityItems: [], //优惠券列表
|
||||
},
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectCouponList: [], //选择的优惠券列表
|
||||
formRule: {
|
||||
promotionName: [{required: true, message: "活动名称不能为空"}],
|
||||
rangeTime: [{required: true, message: "请选择活动有效期"}],
|
||||
description: [{required: true, message: "请输入范围描述"}],
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
rangeTime: [{ required: true, message: "请选择活动有效期" }],
|
||||
description: [{ required: true, message: "请输入范围描述" }],
|
||||
},
|
||||
// 用户表格
|
||||
userColumns: [
|
||||
|
@ -160,19 +222,9 @@ export default {
|
|||
{
|
||||
title: "品类描述",
|
||||
key: "scopeType",
|
||||
width: 100,
|
||||
width: 120,
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
}
|
||||
return h("div", [text]);
|
||||
return promotionsScopeTypeRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -181,10 +233,7 @@ export default {
|
|||
minWidth: 120,
|
||||
render: (h, params) => {
|
||||
if (params.row.price) {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
} else {
|
||||
return h("div", params.row.couponDiscount + "折");
|
||||
}
|
||||
|
@ -255,8 +304,8 @@ export default {
|
|||
this.form.memberDTOS = this.selectedMember.map((item) => {
|
||||
return {
|
||||
nickName: item.nickName,
|
||||
id: item.id
|
||||
}
|
||||
id: item.id,
|
||||
};
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
@ -276,7 +325,7 @@ export default {
|
|||
return {
|
||||
num: 0,
|
||||
couponId: item.id,
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
// 添加指定用户
|
||||
|
@ -292,12 +341,8 @@ export default {
|
|||
},
|
||||
/** 保存平台优惠券 */
|
||||
handleSubmit() {
|
||||
this.form.startTime = this.$options.filters.unixToDate(
|
||||
this.rangeTime[0] / 1000
|
||||
);
|
||||
this.form.endTime = this.$options.filters.unixToDate(
|
||||
this.rangeTime[1] / 1000
|
||||
);
|
||||
this.form.startTime = this.$options.filters.unixToDate(this.rangeTime[0] / 1000);
|
||||
this.form.endTime = this.$options.filters.unixToDate(this.rangeTime[1] / 1000);
|
||||
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
|
@ -318,9 +363,7 @@ export default {
|
|||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "add-platform-coupon");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
},
|
||||
|
@ -355,4 +398,3 @@ h4 {
|
|||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -4,33 +4,55 @@
|
|||
<Row class="operation padding-row">
|
||||
<Button @click="add" type="primary">添加活动</Button>
|
||||
</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">
|
||||
<Button type="info" size="small" style="margin-right: 10px" @click="info(row)">
|
||||
查看
|
||||
</Button>
|
||||
<Button v-if="!checked && row.promotionStatus === 'START' || row.promotionStatus === 'NEW'" type="error"
|
||||
size="small" style="margin-right: 10px" @click="remove(row)">停止
|
||||
<Button
|
||||
v-if="
|
||||
(!checked && row.promotionStatus === 'START') ||
|
||||
row.promotionStatus === 'NEW'
|
||||
"
|
||||
type="error"
|
||||
size="small"
|
||||
style="margin-right: 10px"
|
||||
@click="remove(row)"
|
||||
>关闭
|
||||
</Button>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
|
||||
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
|
||||
size="small" show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCouponActivityList,
|
||||
closeActivity,
|
||||
} from "@/api/promotion";
|
||||
import { getCouponActivityList, closeActivity } from "@/api/promotion";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "couponActivity",
|
||||
name: "coupon-activity",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
|
@ -51,9 +73,7 @@ export default {
|
|||
},
|
||||
// 表单验证规则
|
||||
formValidate: {
|
||||
promotionName: [
|
||||
{required: true, message: "不能为空", trigger: "blur"},
|
||||
],
|
||||
promotionName: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
},
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectList: [], // 多选数据
|
||||
|
@ -70,7 +90,7 @@ export default {
|
|||
key: "couponActivityType",
|
||||
minWidth: 120,
|
||||
render: (h, params) => {
|
||||
if (params.row.couponActivityType === 'REGISTERED') {
|
||||
if (params.row.couponActivityType === "REGISTERED") {
|
||||
return h("div", ["注册赠券"]);
|
||||
} else {
|
||||
return h("div", ["精确发券"]);
|
||||
|
@ -95,11 +115,13 @@ export default {
|
|||
title: "活动时间",
|
||||
minWidth: 150,
|
||||
render: (h, params) => {
|
||||
return h("div", {
|
||||
domProps: {
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
if (params.row.startTime && params.row.endTime) {
|
||||
return h("div", {
|
||||
domProps: {
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -108,32 +130,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
fixed: "right",
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "default";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -162,11 +159,11 @@ export default {
|
|||
},
|
||||
//增加券活动
|
||||
add() {
|
||||
this.$router.push({name: "add-coupon-activity"});
|
||||
this.$router.push({ name: "add-coupon-activity" });
|
||||
},
|
||||
//查看详情
|
||||
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) {
|
||||
|
@ -206,24 +203,25 @@ export default {
|
|||
},
|
||||
//跳转编辑
|
||||
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) {
|
||||
this.$Modal.confirm({
|
||||
title: "确认停止",
|
||||
// 记得确认修改此处
|
||||
content: "确认要停止此优惠券活动么?停止活动只能重新创建",
|
||||
title: "确认关闭",
|
||||
content: "确认要关闭此优惠券活动么?关闭活动只能重新创建",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
closeActivity(v.id).then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("优惠券活动已停止");
|
||||
this.getDataList();
|
||||
this.$Modal.remove()
|
||||
}
|
||||
}).catch(() => {});
|
||||
closeActivity(v.id)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("优惠券活动已关闭");
|
||||
this.getDataList();
|
||||
this.$Modal.remove();
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
});
|
||||
},
|
|
@ -6,10 +6,24 @@
|
|||
<h4>基本信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="活动名称" prop="promotionName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px"/>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.promotionName"
|
||||
placeholder="活动名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券名称" prop="couponName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px"/>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.couponName"
|
||||
placeholder="优惠券名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券类型" prop="couponType">
|
||||
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
||||
|
@ -17,12 +31,30 @@
|
|||
<Option value="PRICE">减免现金</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem label="折扣" prop="couponDiscount" v-if="form.couponType == 'DISCOUNT'">
|
||||
<Input :disabled="disabled" type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px"/>
|
||||
<FormItem
|
||||
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>
|
||||
</FormItem>
|
||||
<FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
|
||||
<Input :disabled="disabled" type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px"/>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.price"
|
||||
placeholder="面额"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动类型" prop="getType">
|
||||
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
||||
|
@ -32,48 +64,91 @@
|
|||
</FormItem>
|
||||
|
||||
<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>
|
||||
</Input>
|
||||
<span class="describe">店铺承担比例,输入0-100之间数值</span>
|
||||
</FormItem>
|
||||
<FormItem label="发放数量" prop="publishNum" v-if="form.getType==='FREE'">
|
||||
<Input :disabled="disabled" v-model="form.publishNum" placeholder="发放数量" style="width: 260px"/>
|
||||
<FormItem label="发放数量" prop="publishNum" v-if="form.getType === 'FREE'">
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.publishNum"
|
||||
placeholder="发放数量"
|
||||
style="width: 260px"
|
||||
/>
|
||||
<div class="tips">如果发放数量为0时,则代表不限制发放数量</div>
|
||||
</FormItem>
|
||||
<FormItem label="领取数量限制" prop="couponLimitNum" v-if="form.getType==='FREE'">
|
||||
<Input :disabled="disabled" v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px"/>
|
||||
<FormItem
|
||||
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>
|
||||
</FormItem>
|
||||
<FormItem label="范围描述" prop="description">
|
||||
<Input :disabled="disabled" v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable
|
||||
style="width: 260px"/>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.description"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
<h4>使用限制</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="消费门槛" prop="consumeThreshold">
|
||||
<Input :disabled="disabled" type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px"/>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.consumeThreshold"
|
||||
placeholder="消费门槛"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="有效期" prop="rangeTime">
|
||||
<div v-if="form.getType == 'ACTIVITY'">
|
||||
<RadioGroup v-model="rangeTimeType">
|
||||
|
||||
<Radio :disabled="disabled" :label="1">
|
||||
起止时间
|
||||
</Radio>
|
||||
<Radio :disabled="disabled" :label="1">起止时间</Radio>
|
||||
<Radio :disabled="disabled" :label="0">固定时间</Radio>
|
||||
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div v-if="rangeTimeType == 1">
|
||||
<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>
|
||||
</div>
|
||||
<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间的整数)
|
||||
</div>
|
||||
</FormItem>
|
||||
|
@ -82,31 +157,62 @@
|
|||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<Radio :disabled="disabled" label="ALL">全品类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS">指定商品</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY">部分商品分类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY"
|
||||
>部分商品分类</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<div style="display: flex; margin-bottom: 10px">
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button :disabled="disabled" type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList"
|
||||
>选择商品</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt=""/>
|
||||
<img
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
||||
|
||||
<Cascader :disabled="disabled" :data="goodsCategoryList" style="width:260px;"
|
||||
v-model="form.scopeIdGoods"></Cascader>
|
||||
|
||||
<Cascader
|
||||
:disabled="disabled"
|
||||
:data="goodsCategoryList"
|
||||
style="width: 260px"
|
||||
v-model="form.scopeIdGoods"
|
||||
></Cascader>
|
||||
</FormItem>
|
||||
<div>
|
||||
<Button :disabled="disabled" type="text" @click="closeCurrentPage">返回</Button>
|
||||
<Button :disabled="disabled" type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
||||
<Button :disabled="disabled" type="text" @click="closeCurrentPage"
|
||||
>返回</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -122,8 +228,8 @@ import {
|
|||
getPlatformCoupon,
|
||||
editPlatformCoupon,
|
||||
} from "@/api/promotion";
|
||||
import {getCategoryTree} from "@/api/goods";
|
||||
import {regular} from "@/utils";
|
||||
import { getCategoryTree } from "@/api/goods";
|
||||
import { regular } from "@/utils";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
|
||||
export default {
|
||||
|
@ -140,14 +246,15 @@ export default {
|
|||
},
|
||||
deep: true,
|
||||
},
|
||||
$route(e) { // 监听路由,参数变化调取接口
|
||||
$route(e) {
|
||||
// 监听路由,参数变化调取接口
|
||||
this.id = e.query.id;
|
||||
if (this.id) {
|
||||
this.getCoupon()
|
||||
this.getCoupon();
|
||||
} else {
|
||||
this.$refs.form.resetFields()
|
||||
this.$refs.form.resetFields();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const checkPrice = (rule, value, callback) => {
|
||||
|
@ -200,37 +307,34 @@ export default {
|
|||
selectedGoods: [], // 已选商品列表,便于删除
|
||||
goodsCategoryList: [], // 商品分类列表
|
||||
formRule: {
|
||||
promotionName: [{required: true, message: "活动名称不能为空"}],
|
||||
couponName: [{required: true, message: "优惠券名称不能为空"}],
|
||||
price: [
|
||||
{required: true, message: "请输入面额"},
|
||||
{validator: checkPrice},
|
||||
],
|
||||
rangeTime: [{required: true, message: "请选择优惠券有效期"}],
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
||||
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||
rangeTime: [{ required: true, message: "请选择优惠券有效期" }],
|
||||
consumeThreshold: [
|
||||
{required: true, message: "请输入消费门槛"},
|
||||
{validator: checkWeight},
|
||||
{ required: true, message: "请输入消费门槛" },
|
||||
{ validator: checkWeight },
|
||||
],
|
||||
couponDiscount: [
|
||||
{required: true, message: "请输入折扣"},
|
||||
{ required: true, message: "请输入折扣" },
|
||||
{
|
||||
pattern: regular.discount,
|
||||
message: "请输入0-10的数字,可有一位小数",
|
||||
},
|
||||
],
|
||||
storeCommission: [
|
||||
{required: true, message: "请输入店铺承担比例"},
|
||||
{pattern: regular.rate, message: "请输入0-100的正整数"},
|
||||
{ required: true, message: "请输入店铺承担比例" },
|
||||
{ pattern: regular.rate, message: "请输入0-100的正整数" },
|
||||
],
|
||||
publishNum: [
|
||||
{required: true, message: "请输入发放数量"},
|
||||
{pattern: regular.Integer, message: "请输入正整数"},
|
||||
{ required: true, message: "请输入发放数量" },
|
||||
{ pattern: regular.Integer, message: "请输入正整数" },
|
||||
],
|
||||
couponLimitNum: [
|
||||
{required: true, message: "领取限制不能为空"},
|
||||
{pattern: regular.Integer, message: "请输入正整数"},
|
||||
{ required: true, message: "领取限制不能为空" },
|
||||
{ pattern: regular.Integer, message: "请输入正整数" },
|
||||
],
|
||||
description: [{required: true, message: "请输入范围描述"}],
|
||||
description: [{ required: true, message: "请输入范围描述" }],
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
|
@ -248,10 +352,7 @@ export default {
|
|||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -292,7 +393,7 @@ export default {
|
|||
},
|
||||
};
|
||||
},
|
||||
async mounted () {
|
||||
async mounted() {
|
||||
await this.getCagetoryList();
|
||||
// 如果id不为空则查询信息
|
||||
if (this.id) {
|
||||
|
@ -306,12 +407,12 @@ export default {
|
|||
getPlatformCoupon(this.id).then((res) => {
|
||||
let data = res.result;
|
||||
if (!data.promotionGoodsList) data.promotionGoodsList = [];
|
||||
this.rangeTimeType = data.rangeDayType === "DYNAMICTIME" ? 0 : 1;
|
||||
if (data.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
let prevCascader = data.scopeId.split(",");
|
||||
function next(params, prev) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const item = params[i];
|
||||
|
||||
if (item.children) {
|
||||
next(item.children, [...prev, item]);
|
||||
} else {
|
||||
|
@ -336,7 +437,9 @@ export default {
|
|||
data.scopeIdGoods = prevCascader;
|
||||
}
|
||||
data.rangeTime = [];
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
if (data.startTime && data.endTime) {
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
}
|
||||
this.form = data;
|
||||
});
|
||||
},
|
||||
|
@ -367,10 +470,9 @@ export default {
|
|||
|
||||
if (
|
||||
params.scopeType == "PORTION_GOODS" &&
|
||||
(!params.promotionGoodsList ||
|
||||
params.promotionGoodsList.length == 0)
|
||||
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({title: "提示", content: "请选择指定商品"});
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -378,7 +480,7 @@ export default {
|
|||
params.scopeType == "PORTION_GOODS_CATEGORY" &&
|
||||
(!params.scopeIdGoods || params.scopeIdGoods.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({title: "提示", content: "请选择商品分类"});
|
||||
this.$Modal.warning({ title: "提示", content: "请选择商品分类" });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -429,9 +531,7 @@ export default {
|
|||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "add-platform-coupon");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
openSkuList() {
|
||||
|
@ -461,11 +561,9 @@ export default {
|
|||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -485,6 +583,11 @@ export default {
|
|||
storeId: e.storeId,
|
||||
storeName: e.storeName,
|
||||
skuId: e.id,
|
||||
categoryPath: e.categoryPath,
|
||||
thumbnail: e.small,
|
||||
goodsType: e.goodsType,
|
||||
goodsId: e.goodsId,
|
||||
originPrice: e.price,
|
||||
});
|
||||
});
|
||||
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) {
|
||||
|
@ -567,4 +670,3 @@ h4 {
|
|||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,12 +1,29 @@
|
|||
<template>
|
||||
<div class="search">
|
||||
<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">
|
||||
<Input type="text" v-model="searchForm.couponName" placeholder="请输入活动名称" clearable style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.couponName"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -14,28 +31,74 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px"></DatePicker>
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
></DatePicker>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn"
|
||||
>搜索</Button
|
||||
>
|
||||
</Form>
|
||||
<Row class="operation padding-row" v-if="getType !== 'ACTIVITY'">
|
||||
<Button @click="add" type="primary">添加优惠券</Button>
|
||||
<Button @click="delAll">批量下架</Button>
|
||||
<Button @click="delAll">批量关闭</Button>
|
||||
</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">
|
||||
<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 v-else type="default" size="small" @click="see(row,'onlyView')">查看
|
||||
<Button v-else type="default" size="small" @click="see(row, 'onlyView')"
|
||||
>查看
|
||||
</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>
|
||||
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
|
||||
show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
|
@ -44,7 +107,9 @@
|
|||
import {
|
||||
getPlatformCouponList,
|
||||
updatePlatformCouponStatus,
|
||||
deletePlatformCoupon,
|
||||
} from "@/api/promotion";
|
||||
import { promotionsStatusRender, promotionsScopeTypeRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "coupon",
|
||||
|
@ -87,10 +152,7 @@ export default {
|
|||
width: 100,
|
||||
render: (h, params) => {
|
||||
if (params.row.price) {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
} else {
|
||||
return h("div", params.row.couponDiscount + "折");
|
||||
}
|
||||
|
@ -104,10 +166,11 @@ export default {
|
|||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.receivedNum + "/" + (params.row.publishNum === 0 ? '不限制' : params.row.publishNum)
|
||||
params.row.receivedNum +
|
||||
"/" +
|
||||
(params.row.publishNum === 0 ? "不限制" : params.row.publishNum)
|
||||
);
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
title: "优惠券类型",
|
||||
|
@ -116,43 +179,35 @@ export default {
|
|||
render: (h, params) => {
|
||||
let text = "";
|
||||
if (params.row.couponType === "DISCOUNT") {
|
||||
return h("Tag", {props: {color: "blue",},}, "打折");
|
||||
return h("Tag", { props: { color: "blue" } }, "打折");
|
||||
} else if (params.row.couponType === "PRICE") {
|
||||
return h("Tag", {props: {color: "geekblue",},}, "减免现金");
|
||||
}else {
|
||||
return h("Tag", {props: {color: "purple",},}, "未知");
|
||||
return h("Tag", { props: { color: "geekblue" } }, "减免现金");
|
||||
} else {
|
||||
return h("Tag", { props: { color: "purple" } }, "未知");
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "品类描述",
|
||||
key: "scopeType",
|
||||
width: 100,
|
||||
width: 120,
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
}
|
||||
return h("div", [text]);
|
||||
return promotionsScopeTypeRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "活动时间",
|
||||
width: 150,
|
||||
render: (h, params) => {
|
||||
if (params.row.getType === "ACTIVITY" && params.row.rangeDayType == 'DYNAMICTIME') {
|
||||
if (
|
||||
params?.row?.getType === "ACTIVITY" &&
|
||||
params?.row?.rangeDayType === "DYNAMICTIME"
|
||||
) {
|
||||
return h("div", "长期有效");
|
||||
} else {
|
||||
} else if (params?.row?.startTime && params?.row?.endTime) {
|
||||
return h("div", {
|
||||
domProps: {
|
||||
innerHTML:
|
||||
params.row.startTime + "<br/>" + params.row.endTime,
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -164,32 +219,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
fixed: "right",
|
||||
render: (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
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
minWidth: 70,
|
||||
},
|
||||
|
@ -204,7 +234,7 @@ export default {
|
|||
data: [], // 表单数据
|
||||
total: 0, // 表单数据总数
|
||||
refreshTable: true, // 修改选中状态后刷新表格
|
||||
selectDate:[], //选中的信息
|
||||
selectDate: [], //选中的信息
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -213,17 +243,21 @@ export default {
|
|||
type: String,
|
||||
default: "",
|
||||
},
|
||||
promotionStatus: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
//已选择优惠券
|
||||
selectedList: {
|
||||
type: Array,
|
||||
default: ()=>{
|
||||
return []
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
if (to.fullPath == "/promotion/manager-coupon") {
|
||||
if (to.fullPath == "/promotions/manager-coupon") {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
@ -249,42 +283,49 @@ export default {
|
|||
});
|
||||
}
|
||||
this.refreshTable = false;
|
||||
this.$nextTick(() =>{
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
})
|
||||
});
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
check() { // 选中的优惠券
|
||||
check() {
|
||||
// 选中的优惠券
|
||||
this.$emit("selected", this.selectList);
|
||||
},
|
||||
// 初始化数据
|
||||
init() {
|
||||
this.getDataList();
|
||||
},
|
||||
add() { // 跳转添加页面
|
||||
add() {
|
||||
// 跳转添加页面
|
||||
this.$router.push({ name: "add-platform-coupon" });
|
||||
},
|
||||
info(v) { // 查看优惠券
|
||||
info(v) {
|
||||
// 查看优惠券
|
||||
this.$router.push({ name: "platform-coupon-info", query: { id: v.id } });
|
||||
},
|
||||
changePage(v) { // 改变页码
|
||||
changePage(v) {
|
||||
// 改变页码
|
||||
this.searchForm.pageNumber = v;
|
||||
this.getDataList();
|
||||
},
|
||||
changePageSize(v) { // 改变页数
|
||||
changePageSize(v) {
|
||||
// 改变页数
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.searchForm.pageSize = v;
|
||||
this.getDataList();
|
||||
},
|
||||
handleSearch() { // 搜索
|
||||
handleSearch() {
|
||||
// 搜索
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.searchForm.pageSize = 10;
|
||||
this.getDataList();
|
||||
},
|
||||
clearSelectAll() { // 清除选中状态
|
||||
clearSelectAll() {
|
||||
// 清除选中状态
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
/**
|
||||
|
@ -293,9 +334,10 @@ export default {
|
|||
changeSelect(e) {
|
||||
this.selectList = e;
|
||||
this.selectCount = e.length;
|
||||
if (this.getType === 'ACTIVITY') this.check()
|
||||
if (this.getType === "ACTIVITY") this.check();
|
||||
},
|
||||
getDataList() { // 获取数据
|
||||
getDataList() {
|
||||
// 获取数据
|
||||
this.loading = true;
|
||||
if (this.selectDate && this.selectDate[0] && this.selectDate[1]) {
|
||||
this.searchForm.startTime = this.selectDate[0].getTime();
|
||||
|
@ -315,27 +357,29 @@ export default {
|
|||
this.loading = false;
|
||||
},
|
||||
|
||||
see(v,only) { // 跳转编辑页面
|
||||
let data
|
||||
only ? data = { onlyView : true,id: v.id } : data = { id: v.id }
|
||||
this.$router.push({ name: "edit-platform-coupon", query:data });
|
||||
see(v, only) {
|
||||
// 跳转编辑页面
|
||||
let 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({
|
||||
title: "确认下架",
|
||||
title: "确认关闭",
|
||||
// 记得确认修改此处
|
||||
content: "确认要下架此优惠券么?",
|
||||
content: "确认要关闭此优惠券么?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
updatePlatformCouponStatus({
|
||||
couponIds: v.id,
|
||||
promotionStatus: "CLOSE",
|
||||
effectiveDays: 0,
|
||||
})
|
||||
.then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("优惠券已作废");
|
||||
this.$Message.success("优惠券已关闭");
|
||||
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) {
|
||||
this.$Message.warning("您还未选择要下架的优惠券");
|
||||
return;
|
||||
|
@ -380,7 +448,11 @@ export default {
|
|||
//如果作为组件方式,传入了类型值,则搜索参数附加类型
|
||||
if (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();
|
||||
},
|
|
@ -88,10 +88,8 @@
|
|||
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
||||
</FormItem>
|
||||
<FormItem label="额外赠送">
|
||||
<Checkbox v-model="form.isFreeFreight" disabled>免邮费</Checkbox
|
||||
>
|
||||
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox
|
||||
>
|
||||
<Checkbox v-model="form.isFreeFreight" disabled>免邮费</Checkbox>
|
||||
<Checkbox v-model="form.isCoupon" disabled>送优惠券</Checkbox>
|
||||
<Checkbox v-model="form.isGift" disabled>送赠品</Checkbox>
|
||||
<Checkbox v-model="form.isPoint" disabled>送积分</Checkbox>
|
||||
</FormItem>
|
||||
|
@ -105,12 +103,9 @@
|
|||
:loading="couponLoading"
|
||||
style="width: 260px"
|
||||
>
|
||||
<Option
|
||||
v-for="item in couponList"
|
||||
:value="item.id"
|
||||
:key="item.id"
|
||||
>{{ item.couponName }}</Option
|
||||
>
|
||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{
|
||||
item.couponName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
||||
|
@ -123,21 +118,13 @@
|
|||
:loading="giftLoading"
|
||||
style="width: 260px"
|
||||
>
|
||||
<Option
|
||||
v-for="item in giftList"
|
||||
:value="item.id"
|
||||
:key="item.id"
|
||||
>{{ item.goodsName }}</Option
|
||||
>
|
||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{
|
||||
item.goodsName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
||||
<Input
|
||||
v-model="form.point"
|
||||
type="number"
|
||||
disabled
|
||||
style="width: 260px"
|
||||
/>
|
||||
<Input v-model="form.point" type="number" disabled style="width: 260px" />
|
||||
</FormItem>
|
||||
<FormItem label="使用范围" prop="scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
|
@ -146,23 +133,31 @@
|
|||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
style="width: 100%"
|
||||
v-if="form.scopeType == 'PORTION_GOODS'"
|
||||
>
|
||||
<Table
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
>
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<Table border :columns="columns" :data="form.promotionGoodsList">
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -182,15 +177,16 @@
|
|||
<script>
|
||||
import { getPlatformCouponList, getFullDiscountById } from "@/api/promotion";
|
||||
import { getGoodsSkuData } from "@/api/goods";
|
||||
import vueQr from 'vue-qr'
|
||||
import vueQr from "vue-qr";
|
||||
export default {
|
||||
name: "addFullCut",
|
||||
name: "add-full-discount",
|
||||
components: {
|
||||
"vue-qr":vueQr
|
||||
"vue-qr": vueQr,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: { // 表单
|
||||
form: {
|
||||
// 表单
|
||||
discountType: "isFullMinus",
|
||||
scopeType: "ALL",
|
||||
promotionGoodsList: [],
|
||||
|
@ -215,17 +211,14 @@ export default {
|
|||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "库存",
|
||||
key: "quantity",
|
||||
minWidth: 40,
|
||||
}
|
||||
},
|
||||
],
|
||||
options: {
|
||||
disabledDate(date) {
|
||||
|
@ -246,11 +239,8 @@ export default {
|
|||
// 获取活动详情
|
||||
getFullDiscountById(this.id).then((res) => {
|
||||
let data = res.result;
|
||||
if (!data.promotionGoodsList) {
|
||||
if (!data.scopeType === "ALL") {
|
||||
data.promotionGoodsList = [];
|
||||
data.scopeType = "ALL";
|
||||
} else {
|
||||
data.scopeType = "PORTION_GOODS";
|
||||
}
|
||||
if (data.isFullMinus) {
|
||||
data.discountType = "isFullMinus";
|
||||
|
@ -271,7 +261,7 @@ export default {
|
|||
pageSize: 10,
|
||||
pageNumber: 0,
|
||||
couponName: query,
|
||||
promotionStatus:"START"
|
||||
promotionStatus: "START",
|
||||
};
|
||||
this.couponLoading = true;
|
||||
getPlatformCouponList(params).then((res) => {
|
||||
|
@ -318,4 +308,3 @@ h4 {
|
|||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,13 +2,29 @@
|
|||
<div class="full-cut">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="活动名称" prop="promotionName">
|
||||
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable
|
||||
style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.promotionName"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -16,13 +32,33 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px">
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</Form-item>
|
||||
<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>
|
||||
</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">
|
||||
{{ unixDate(row.applyEndTime) }}
|
||||
</template>
|
||||
|
@ -30,28 +66,50 @@
|
|||
{{ row.isFullMinus ? "满减" : "满折" }}
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="hours">
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{item}}</Tag>
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<div>
|
||||
<Button type="info" size="small" @click="view(row)">查看</Button>
|
||||
<Button type="error" v-if="row.promotionStatus === 'START'" style="margin-left:5px" size="small"
|
||||
@click="openOrClose(row)">关闭</Button>
|
||||
<Button type="success" v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left:5px" size="small" @click="openOrClose(row)">开启</Button>
|
||||
<Button
|
||||
type="error"
|
||||
v-if="row.promotionStatus === 'START'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>开启</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
||||
show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getFullDiscountList, updateFullDiscount } from "@/api/promotion.js";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -98,32 +156,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
minWidth: 60,
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
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
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -203,7 +236,7 @@ export default {
|
|||
},
|
||||
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() {
|
|
@ -13,21 +13,33 @@
|
|||
</FormItem>
|
||||
|
||||
<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">
|
||||
<div>{{ row.skuId }}</div>
|
||||
</template>
|
||||
|
||||
<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 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 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 slot-scope="{ index }" slot="stock">
|
||||
<InputNumber :min="0" v-model="form.promotionGoodsList[index].stock" />
|
||||
|
@ -35,13 +47,21 @@
|
|||
</Table>
|
||||
</FormItem>
|
||||
<FormItem label="活动时间" prop="rangeTime">
|
||||
<DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择"
|
||||
:options="options" style="width: 260px">
|
||||
<DatePicker
|
||||
type="datetimerange"
|
||||
v-model="form.rangeTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
style="width: 260px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<div>
|
||||
<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>
|
||||
|
@ -57,7 +77,7 @@ import { regular } from "@/utils";
|
|||
import skuSelect from "@/views/lili-dialog";
|
||||
|
||||
export default {
|
||||
name: "addKanJiaActivityGoods",
|
||||
name: "add-kanjia-activity-goods",
|
||||
components: {
|
||||
skuSelect,
|
||||
},
|
||||
|
@ -92,10 +112,7 @@ export default {
|
|||
key: "price",
|
||||
width: 120,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -199,7 +216,7 @@ export default {
|
|||
this.$Message.error("活动库存不能为0且不能超过商品库存");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 结算价格金额格式校验
|
||||
if (!regular.money.test(res.settlementPrice)) {
|
||||
checkResult = false;
|
||||
|
@ -260,9 +277,7 @@ export default {
|
|||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "add-kan-jia-goods");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
openSkuList() {
|
||||
|
@ -310,7 +325,7 @@ export default {
|
|||
item.forEach((e) => {
|
||||
list.push({
|
||||
settlementPrice: e.settlementPrice || 0,
|
||||
purchasePrice: 0,
|
||||
purchasePrice: 0,
|
||||
lowestPrice: e.lowestPrice || 0,
|
||||
highestPrice: e.highestPrice || 0,
|
||||
stock: e.stock || 0,
|
||||
|
@ -363,4 +378,3 @@ h4 {
|
|||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,12 +2,29 @@
|
|||
<div class="search">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="商品名称" prop="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 label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -15,28 +32,59 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px">
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</Form-item>
|
||||
<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>
|
||||
</Row>
|
||||
<Row class="operation padding-row">
|
||||
<Button @click="add" type="primary">添加砍价</Button>
|
||||
</Row>
|
||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom"
|
||||
@on-sort-change="changeSort">
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
ref="table"
|
||||
sortable="custom"
|
||||
@on-sort-change="changeSort"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<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>
|
||||
<div slot="content">
|
||||
|
||||
<vue-qr :text="wapLinkTo(row.goodsSku.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>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -45,24 +93,47 @@
|
|||
<div>{{ row.endTime }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="quantity">
|
||||
<div>{{ row.goodsSku.quantity }}</div>
|
||||
<div>{{ row.stock }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button v-if="row.promotionStatus != 'NEW'" size="small" style="margin-right: 10px"
|
||||
@click="edit(row,'onlyView')">查看
|
||||
<Button
|
||||
v-if="row.promotionStatus != 'NEW'"
|
||||
size="small"
|
||||
style="margin-right: 10px"
|
||||
@click="edit(row, 'onlyView')"
|
||||
>查看
|
||||
</Button>
|
||||
<Button v-if="row.promotionStatus === 'NEW'" type="info" size="small" style="margin-right: 10px"
|
||||
@click="edit(row)">编辑
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'NEW'"
|
||||
type="info"
|
||||
size="small"
|
||||
style="margin-right: 10px"
|
||||
@click="edit(row)"
|
||||
>编辑
|
||||
</Button>
|
||||
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'END'" type="error" size="small"
|
||||
style="margin-right: 10px" @click="delAll(row)">删除
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'END'"
|
||||
type="error"
|
||||
size="small"
|
||||
style="margin-right: 10px"
|
||||
@click="delAll(row)"
|
||||
>删除
|
||||
</Button>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="page">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
||||
show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
|
@ -70,6 +141,7 @@
|
|||
|
||||
<script>
|
||||
import { getKanJiaGoodsList, delKanJiaGoods } from "@/api/promotion";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
import vueQr from "vue-qr";
|
||||
|
||||
export default {
|
||||
|
@ -172,32 +244,7 @@ export default {
|
|||
title: "状态",
|
||||
key: "promotionStatus",
|
||||
render: (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
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
|
@ -217,7 +264,7 @@ export default {
|
|||
props: {},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
if (to.fullPath == "/promotion/manager-coupon") {
|
||||
if (to.fullPath == "/promotions/manager-coupon") {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
@ -284,11 +331,11 @@ export default {
|
|||
this.total = this.data.length;
|
||||
this.loading = false;
|
||||
},
|
||||
edit(v,type) {
|
||||
edit(v, type) {
|
||||
let data = {
|
||||
id:v.id
|
||||
}
|
||||
type ? data.onlyView = true : ''
|
||||
id: v.id,
|
||||
};
|
||||
type ? (data.onlyView = true) : "";
|
||||
this.$router.push({
|
||||
name: "edit-kanJia-activity-goods",
|
||||
query: data,
|
|
@ -1,18 +1,31 @@
|
|||
<template>
|
||||
<div>
|
||||
<Card>
|
||||
|
||||
<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>
|
||||
</Tabs>
|
||||
<Table :columns="liveColumns" :data="liveData"></Table>
|
||||
<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]"
|
||||
size="small" show-total show-elevator show-sizer></Page>
|
||||
<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]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -58,10 +71,7 @@ export default {
|
|||
title: "直播开始时间",
|
||||
key: "createTime",
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"span",
|
||||
this.$options.filters.unixToDate(params.row.startTime)
|
||||
);
|
||||
return h("span", this.$options.filters.unixToDate(params.row.startTime));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -117,12 +127,12 @@ export default {
|
|||
{
|
||||
title: "直播状态",
|
||||
render: (h, params) => {
|
||||
if(params.row.status == "NEW"){
|
||||
return h("div", [h("tag", {props: {color: "blue"}}, "未开始")]);
|
||||
}else if(params.row.status == "START"){
|
||||
return h("div", [h("tag", {props: {color: "green"}}, "直播中")]);
|
||||
}else{
|
||||
return h("div", [h("tag", {props: {color: "volcano"}}, "已结束")]);
|
||||
if (params.row.status == "NEW") {
|
||||
return h("div", [h("tag", { props: { color: "blue" } }, "未开始")]);
|
||||
} else if (params.row.status == "START") {
|
||||
return h("div", [h("tag", { props: { color: "green" } }, "直播中")]);
|
||||
} else {
|
||||
return h("div", [h("tag", { props: { color: "volcano" } }, "已结束")]);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -227,7 +237,7 @@ export default {
|
|||
*/
|
||||
getLiveDetail(val) {
|
||||
this.$router.push({
|
||||
path: "/liveDetail",
|
||||
path: "/live-detail",
|
||||
query: { ...val, liveStatus: this.searchForm.status },
|
||||
});
|
||||
},
|
|
@ -2,34 +2,45 @@
|
|||
<div class="pintuan-goods">
|
||||
<Card>
|
||||
<h4>活动详情</h4>
|
||||
<Table style="margin: 10px 0" border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
></Table>
|
||||
<Table style="margin: 10px 0" border :columns="columns" :data="data"></Table>
|
||||
|
||||
<h4>商品信息</h4>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
class="operation"
|
||||
:columns="goodsColumns"
|
||||
:data="goodsData"
|
||||
ref="table"
|
||||
sortable="custom"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<div>
|
||||
<a class="mr_10" @click="linkTo(row.goodsId,row.skuId)">{{row.goodsName}}</a>
|
||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||
<div slot="content">
|
||||
<vue-qr :text="wapLinkTo(row.goodsId,row.skuId)" :margin="0" colorDark="#000" colorLight="#fff" :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>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
class="operation"
|
||||
:columns="goodsColumns"
|
||||
:data="goodsData"
|
||||
ref="table"
|
||||
sortable="custom"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<div>
|
||||
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
|
||||
row.goodsName
|
||||
}}</a>
|
||||
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
|
||||
<div slot="content">
|
||||
<vue-qr
|
||||
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||
:margin="0"
|
||||
colorDark="#000"
|
||||
colorLight="#fff"
|
||||
: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">
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
|
@ -49,8 +60,13 @@
|
|||
</template>
|
||||
<script>
|
||||
import { getPintuanGoodsList, getPintuanDetail } from "@/api/promotion.js";
|
||||
import vueQr from "vue-qr";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
"vue-qr": vueQr,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false, // 表单加载状态
|
||||
|
@ -66,17 +82,17 @@ export default {
|
|||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
key: "startTime",
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "活动结束时间",
|
||||
key: "endTime",
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "成团人数",
|
||||
|
@ -91,32 +107,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
minWidth: 100,
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
color = "";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "default";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "blue";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -138,15 +129,11 @@ export default {
|
|||
key: "price",
|
||||
minWidth: 50,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
goodsData: [] // 商品数据
|
||||
goodsData: [], // 商品数据
|
||||
};
|
||||
},
|
||||
methods: {
|
|
@ -39,9 +39,7 @@
|
|||
style="width: 200px"
|
||||
></DatePicker>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn"
|
||||
>搜索</Button
|
||||
>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn">搜索</Button>
|
||||
</Form>
|
||||
<Table
|
||||
:loading="loading"
|
||||
|
@ -52,19 +50,13 @@
|
|||
class="mt_10"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button
|
||||
type="info"
|
||||
size="small"
|
||||
@click="view(row)"
|
||||
style="margin-right: 5px"
|
||||
<Button type="info" size="small" @click="view(row)" style="margin-right: 5px"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
:disabled="
|
||||
row.promotionStatus == 'END' || row.promotionStatus == 'CLOSE'
|
||||
"
|
||||
:disabled="row.promotionStatus == 'END' || row.promotionStatus == 'CLOSE'"
|
||||
@click="close(row)"
|
||||
>关闭
|
||||
</Button>
|
||||
|
@ -89,13 +81,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getPintuanList, closePintuan } from "@/api/promotion";
|
||||
import { getPintuanList, updatePintuanStatus } from "@/api/promotion";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "pintuan",
|
||||
data() {
|
||||
return {
|
||||
selectDate:[], //选中的数据
|
||||
selectDate: [], //选中的数据
|
||||
loading: true, // 表单加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
|
@ -104,7 +97,8 @@ export default {
|
|||
sort: "startTime",
|
||||
order: "desc", // 默认排序方式
|
||||
},
|
||||
columns: [ // 表头
|
||||
columns: [
|
||||
// 表头
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
|
@ -116,30 +110,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
width: 110,
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
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
|
||||
),
|
||||
]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -152,12 +123,12 @@ export default {
|
|||
{
|
||||
title: "活动开始时间",
|
||||
key: "startTime",
|
||||
width: 180
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: "活动结束时间",
|
||||
key: "endTime",
|
||||
width: 180
|
||||
width: 180,
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -226,7 +197,7 @@ export default {
|
|||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
closePintuan(v.id).then((res) => {
|
||||
updatePintuanStatus(v.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("操作成功");
|
||||
|
@ -243,7 +214,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.ivu-form-item{
|
||||
margin-bottom: 0 !important;
|
||||
.ivu-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
|
@ -34,14 +34,11 @@
|
|||
/>
|
||||
</template>
|
||||
|
||||
<template
|
||||
slot-scope="{ row, index }"
|
||||
slot="pointsGoodsCategory"
|
||||
>
|
||||
<template slot-scope="{ row, index }" slot="pointsGoodsCategory">
|
||||
<Select
|
||||
v-model="promotionGoodsList[index].pointsGoodsCategoryId"
|
||||
transfer="true"
|
||||
label-in-value="true"
|
||||
:transfer="true"
|
||||
:label-in-value="true"
|
||||
@on-change="
|
||||
(val) => {
|
||||
changeCategory(val, index);
|
||||
|
@ -90,10 +87,7 @@
|
|||
</FormItem>
|
||||
<div>
|
||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
|
@ -101,10 +95,7 @@
|
|||
</div>
|
||||
</Form>
|
||||
</Card>
|
||||
<sku-select
|
||||
ref="skuSelect"
|
||||
@selectedGoodsData="selectedGoodsData"
|
||||
></sku-select>
|
||||
<sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -198,10 +189,7 @@ export default {
|
|||
key: "goodsName",
|
||||
minWidth: 120,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.goodsSku.goodsName
|
||||
);
|
||||
return h("div", params.row.goodsSku.goodsName);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -214,10 +202,7 @@ export default {
|
|||
key: "storeName",
|
||||
minWidth: 60,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.goodsSku.storeName
|
||||
);
|
||||
return h("div", params.row.goodsSku.storeName);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -236,10 +221,7 @@ export default {
|
|||
key: "quantity",
|
||||
minWidth: 20,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.goodsSku.quantity
|
||||
);
|
||||
return h("div", params.row.goodsSku.quantity);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -308,12 +290,8 @@ export default {
|
|||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
let params = this.promotionGoodsList;
|
||||
const start = this.$options.filters.unixToDate(
|
||||
this.form.startTime / 1000
|
||||
);
|
||||
const end = this.$options.filters.unixToDate(
|
||||
this.form.endTime / 1000
|
||||
);
|
||||
const start = this.$options.filters.unixToDate(this.form.startTime / 1000);
|
||||
const end = this.$options.filters.unixToDate(this.form.endTime / 1000);
|
||||
|
||||
if (!params || params.length == 0) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
|
@ -339,15 +317,12 @@ export default {
|
|||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
this.$store.commit("removeTag", "add-points-goods");
|
||||
localStorage.pageOpenedList = JSON.stringify(
|
||||
this.$store.state.app.pageOpenedList
|
||||
);
|
||||
localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
// 选择分类
|
||||
changeCategory(val, index) {
|
||||
this.promotionGoodsList[index].pointsGoodsCategoryName = val.label;
|
||||
console.log(this.promotionGoodsList);
|
||||
},
|
||||
// 变更选中状态
|
||||
changeSelect(e) {
|
||||
|
@ -368,11 +343,9 @@ export default {
|
|||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.promotionGoodsList = this.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.promotionGoodsList = this.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -380,12 +353,13 @@ export default {
|
|||
// 删除商品
|
||||
this.promotionGoodsList.splice(index, 1);
|
||||
},
|
||||
openSkuList() { // 显示商品选择器
|
||||
openSkuList() {
|
||||
// 显示商品选择器
|
||||
this.$refs.skuSelect.open("goods");
|
||||
let data = JSON.parse(JSON.stringify(this.promotionGoodsList))
|
||||
data.forEach(e => {
|
||||
e.id = e.skuId
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.promotionGoodsList));
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
selectedGoodsData(item) {
|
||||
|
@ -395,12 +369,16 @@ export default {
|
|||
const obj = {
|
||||
settlementPrice: e.settlementPrice || 0,
|
||||
pointsGoodsCategoryId: e.pointsGoodsCategoryId || 0,
|
||||
pointsGoodsCategoryName:e.pointsGoodsCategoryName || "",
|
||||
activeStock:e.activeStock || 0,
|
||||
points:e.points || 0,
|
||||
pointsGoodsCategoryName: e.pointsGoodsCategoryName || "",
|
||||
activeStock: e.activeStock || 0,
|
||||
points: e.points || 0,
|
||||
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);
|
||||
});
|
||||
this.promotionGoodsList = list;
|
||||
|
@ -426,8 +404,7 @@ h4 {
|
|||
margin-left: 10px;
|
||||
color: #999;
|
||||
}
|
||||
.wrapper{
|
||||
.wrapper {
|
||||
min-height: 800px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,25 +2,62 @@
|
|||
<div class="search">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="商品名称">
|
||||
<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 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 label="状态">
|
||||
<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>
|
||||
</Form-item>
|
||||
<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>
|
||||
<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>
|
||||
</Row>
|
||||
<Row class="operation padding-row">
|
||||
|
@ -29,38 +66,84 @@
|
|||
<Table :loading="loading" border :columns="columns" :data="data" ref="table">
|
||||
<template slot-scope="{ row }" slot="goodsName">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="price">
|
||||
<div>{{ row.goodsSku.price | unitPrice("¥") }}</div>
|
||||
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="settlementPrice">
|
||||
<div>{{ row.settlementPrice | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="quantity">
|
||||
<div>{{ row.goodsSku.quantity }}</div>
|
||||
<div>{{ row.activeStock }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="startTime">
|
||||
<div>{{ row.startTime }}</div>
|
||||
<div>{{ row.endTime }}</div>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button v-if="row.promotionStatus == 'NEW'" type="info" size="small" @click="edit(row.id)" style="margin-right: 5px">编辑</Button>
|
||||
<Button v-if="row.promotionStatus == 'START'" type="warning" size="small" @click="statusChanged(row.id, 'CLOSE')" style="margin-right: 5px">停用</Button>
|
||||
<Button v-if="row.promotionStatus == 'CLOSE'" type="warning" size="small" @click="statusChanged(row.id, 'START')" style="margin-right: 5px">启用</Button>
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="edit(row.id)"
|
||||
style="margin-right: 5px"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="statusChanged(row.id, 'CLOSE')"
|
||||
style="margin-right: 5px"
|
||||
>关闭</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus == 'CLOSE'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="statusChanged(row.id, 'START')"
|
||||
style="margin-right: 5px"
|
||||
>开启</Button
|
||||
>
|
||||
<Button type="error" size="small" @click="close(row.id)">删除</Button>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
|
||||
show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
|
@ -72,11 +155,13 @@ import {
|
|||
editPointsGoodsStatus,
|
||||
deletePointsGoodsStatus,
|
||||
} from "@/api/promotion";
|
||||
import vueQr from 'vue-qr'
|
||||
import vueQr from "vue-qr";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "pointsGoods",
|
||||
components: {
|
||||
"vue-qr":vueQr
|
||||
"vue-qr": vueQr,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -94,7 +179,8 @@ export default {
|
|||
{ label: "已结束", value: "END" },
|
||||
{ label: "已关闭", value: "CLOSE" },
|
||||
],
|
||||
columns: [ // 表头
|
||||
columns: [
|
||||
// 表头
|
||||
{
|
||||
title: "商品名称",
|
||||
slot: "goodsName",
|
||||
|
@ -142,22 +228,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
width: 100,
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
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)]);
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -225,10 +296,15 @@ export default {
|
|||
this.$router.push({ name: "edit-points-goods", query: { id: id } });
|
||||
},
|
||||
// 启用 停用积分商品
|
||||
statusChanged(id, status) {
|
||||
statusChanged(id, status, startTime, endTime) {
|
||||
let text = "";
|
||||
let params = {};
|
||||
if (status == "START") {
|
||||
text = "开启";
|
||||
params = {
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
};
|
||||
} else if (status == "CLOSE") {
|
||||
text = "关闭";
|
||||
}
|
||||
|
@ -237,9 +313,7 @@ export default {
|
|||
content: "您确认要" + text + "此积分商品?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
editPointsGoodsStatus(id, {
|
||||
promotionStatus: status,
|
||||
}).then((res) => {
|
||||
editPointsGoodsStatus(id, params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(text + "成功");
|
||||
|
@ -266,7 +340,7 @@ export default {
|
|||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
|
@ -53,11 +53,7 @@
|
|||
v-show="showAddPeriod"
|
||||
@on-blur="addPeriodTime"
|
||||
></InputNumber>
|
||||
<Button
|
||||
type="default"
|
||||
@click="addPeriod"
|
||||
>添加时间段</Button
|
||||
>
|
||||
<Button type="default" @click="addPeriod">添加时间段</Button>
|
||||
</FormItem>
|
||||
<FormItem label="申请规则" prop="seckillRule">
|
||||
<Input
|
||||
|
@ -71,11 +67,9 @@
|
|||
</div>
|
||||
<div class="foot-btn">
|
||||
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button>
|
||||
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
|
@ -104,7 +98,7 @@ export default {
|
|||
promotionStatus: "NEW",
|
||||
},
|
||||
id: this.$route.query.id, // 活动id
|
||||
periodTime: null, // 抢购时间段
|
||||
periodTime: null, // 抢购时间段
|
||||
showAddPeriod: false, // input显隐
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
|
||||
|
@ -140,11 +134,13 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
addPeriod() { // 添加时间段显示input
|
||||
addPeriod() {
|
||||
// 添加时间段显示input
|
||||
this.addPeriodTime();
|
||||
this.showAddPeriod = true;
|
||||
},
|
||||
addPeriodTime() { // 添加秒杀时间段
|
||||
addPeriodTime() {
|
||||
// 添加秒杀时间段
|
||||
this.showAddPeriod = false;
|
||||
if (
|
||||
this.periodTime !== null &&
|
||||
|
@ -153,7 +149,8 @@ export default {
|
|||
this.form.seckillPeriod.push(this.periodTime);
|
||||
}
|
||||
},
|
||||
removePeriodTime(event, name) { // 移除秒杀时间段
|
||||
removePeriodTime(event, name) {
|
||||
// 移除秒杀时间段
|
||||
this.form.seckillPeriod = this.form.seckillPeriod.filter((i) => i !== name);
|
||||
},
|
||||
// // 申请截止时间格式化
|
||||
|
@ -175,8 +172,13 @@ export default {
|
|||
delete this.form.updateTime;
|
||||
delete this.form.endTime;
|
||||
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;
|
||||
if (res && res.success) {
|
||||
this.$Message.success("编辑成功");
|
||||
|
@ -202,7 +204,7 @@ h4 {
|
|||
line-height: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
.ivu-form-item{
|
||||
.ivu-form-item {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
|
@ -2,13 +2,29 @@
|
|||
<div class="seckill">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="活动名称" prop="promotionName">
|
||||
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable
|
||||
style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.promotionName"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -16,53 +32,107 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px">
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</Form-item>
|
||||
|
||||
<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>
|
||||
</Row>
|
||||
<Tabs value="list" class="mt_10" @on-click="clickTabPane">
|
||||
<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">
|
||||
<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-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'"
|
||||
@click="manage(row)">管理</Button>
|
||||
<Button
|
||||
type="success"
|
||||
size="small"
|
||||
class="mr_5"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
@click="manage(row)"
|
||||
>管理</Button
|
||||
>
|
||||
|
||||
<Button type="error" size="small" v-if="
|
||||
row.promotionStatus == 'START' || row.promotionStatus == 'NEW'
|
||||
" class="mr_5" @click="off(row)">下架</Button>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'START' || row.promotionStatus == 'NEW'"
|
||||
class="mr_5"
|
||||
@click="off(row)"
|
||||
>下架</Button
|
||||
>
|
||||
|
||||
<Button type="error" size="small" v-if="row.promotionStatus == 'CLOSE'" ghost
|
||||
@click="expire(row)">删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'CLOSE'"
|
||||
ghost
|
||||
@click="expire(row)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page style="margin: 20px 0;" :current="searchForm.pageNumber" :total="total"
|
||||
:page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]" size="small" show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
style="margin: 20px 0"
|
||||
: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>
|
||||
</TabPane>
|
||||
<TabPane label="秒杀活动设置" name="setup">
|
||||
|
||||
<setupSeckill v-if="setupFlag"></setupSeckill>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getSeckillList, delSeckill, closeSeckill } from "@/api/promotion";
|
||||
import setupSeckill from "@/views/promotion/seckill/setupSeckill";
|
||||
import { getSeckillList, delSeckill, updateSeckillStatus } from "@/api/promotion";
|
||||
import setupSeckill from "@/views/promotions/seckill/seckill-setup";
|
||||
import { promotionsStatusRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "seckill",
|
||||
components: {
|
||||
|
@ -105,15 +175,7 @@ export default {
|
|||
key: "promotionStatus",
|
||||
width: 100,
|
||||
render: (h, params) => {
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
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" } }, "结束");
|
||||
}
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -179,7 +241,7 @@ export default {
|
|||
title: "提示",
|
||||
content: "您确定要下架该活动吗?",
|
||||
onOk: () => {
|
||||
closeSeckill(v.id).then((res) => {
|
||||
updateSeckillStatus(v.id).then((res) => {
|
||||
if (res.success) {
|
||||
this.$Message.success("下架成功");
|
||||
this.getDataList();
|
|
@ -1,15 +1,19 @@
|
|||
|
||||
<template>
|
||||
<div class="search">
|
||||
<Card>
|
||||
<!-- 筛选项和操作按钮 -->
|
||||
<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="close">单选</span>
|
||||
</i-switch>
|
||||
<Button @click="addRootMenu" >添加顶级菜单</Button>
|
||||
<Button @click="addMenu" type="primary" >添加子菜单</Button>
|
||||
<Button @click="addRootMenu">添加顶级菜单</Button>
|
||||
<Button @click="addMenu" type="primary">添加子菜单</Button>
|
||||
<Button @click="delAll">批量删除</Button>
|
||||
<Dropdown @on-click="handleDropdown">
|
||||
<Button>
|
||||
|
@ -31,9 +35,7 @@
|
|||
<Alert show-icon>
|
||||
当前选择编辑:
|
||||
<span class="select-title">{{ editTitle }}</span>
|
||||
<a class="select-clear" v-if="form.id" @click="cancelEdit"
|
||||
>取消选择</a
|
||||
>
|
||||
<a class="select-clear" v-if="form.id" @click="cancelEdit">取消选择</a>
|
||||
</Alert>
|
||||
<Input
|
||||
v-model="searchKey"
|
||||
|
@ -56,12 +58,7 @@
|
|||
</div>
|
||||
</Col>
|
||||
<Col :md="15" :lg="13" :xl="9" style="margin-left: 10px">
|
||||
<Form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:label-width="110"
|
||||
:rules="formValidate"
|
||||
>
|
||||
<Form ref="form" :model="form" :label-width="110" :rules="formValidate">
|
||||
<FormItem label="类型" prop="type">
|
||||
<div v-show="form.level == 0">
|
||||
<Icon
|
||||
|
@ -81,41 +78,41 @@
|
|||
</div>
|
||||
</FormItem>
|
||||
<FormItem label="菜单名称" prop="title">
|
||||
<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>
|
||||
<Input class="menu-input" v-model="form.title" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="路由名称"
|
||||
prop="name"
|
||||
label="路由地址"
|
||||
prop="path"
|
||||
v-if="form.level != 0"
|
||||
class="block-tool"
|
||||
>
|
||||
<Tooltip placement="right" content="路由name,需英文唯一,跳转页面用" transfer>
|
||||
<Input v-model="form.name"/>
|
||||
<Tooltip
|
||||
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>
|
||||
</FormItem>
|
||||
<FormItem label="文件路径" prop="frontRoute" v-if="form.level != 0">
|
||||
<Input v-model="form.frontRoute"/>
|
||||
<Input class="menu-input" v-model="form.frontRoute" />
|
||||
</FormItem>
|
||||
<FormItem label="权限url" v-if="form.level != 0" class="block-tool">
|
||||
<Tooltip placement="right" content="*号模糊匹配,逗号分割" transfer>
|
||||
<Input v-model="form.permission"/>
|
||||
<Input class="menu-input" v-model="form.permission" />
|
||||
</Tooltip>
|
||||
</FormItem>
|
||||
<FormItem label="排序值" prop="sortOrder">
|
||||
<Tooltip
|
||||
trigger="hover"
|
||||
placement="right"
|
||||
content="值越小越靠前,支持小数"
|
||||
>
|
||||
<InputNumber
|
||||
:max="1000"
|
||||
:min="0"
|
||||
v-model="form.sortOrder"
|
||||
></InputNumber>
|
||||
<Tooltip trigger="hover" placement="right" content="值越小越靠前,支持小数">
|
||||
<InputNumber :max="1000" :min="0" v-model="form.sortOrder"></InputNumber>
|
||||
</Tooltip>
|
||||
</FormItem>
|
||||
<Form-item>
|
||||
|
@ -124,9 +121,8 @@
|
|||
@click="submitEdit"
|
||||
:loading="submitLoading"
|
||||
type="primary"
|
||||
>保存
|
||||
</Button
|
||||
>
|
||||
>保存
|
||||
</Button>
|
||||
<Button @click="handleReset">重置</Button>
|
||||
</Form-item>
|
||||
</Form>
|
||||
|
@ -142,78 +138,48 @@
|
|||
:width="500"
|
||||
:styles="{ top: '30px' }"
|
||||
>
|
||||
<Form
|
||||
ref="formAdd"
|
||||
:model="formAdd"
|
||||
:label-width="100"
|
||||
:rules="formValidate"
|
||||
>
|
||||
<Form ref="formAdd" :model="formAdd" :label-width="100" :rules="formValidate">
|
||||
<div v-if="showParent">
|
||||
<FormItem label="上级节点:">{{ parentTitle }}</FormItem>
|
||||
</div>
|
||||
<FormItem label="类型" prop="type">
|
||||
<div v-show="formAdd.level == 0">
|
||||
<Icon
|
||||
type="ios-navigate-outline"
|
||||
size="16"
|
||||
style="margin-right: 5px"
|
||||
></Icon>
|
||||
<Icon type="ios-navigate-outline" size="16" style="margin-right: 5px"></Icon>
|
||||
<span>顶级菜单</span>
|
||||
</div>
|
||||
<div v-show="formAdd.level != 0">
|
||||
<Icon
|
||||
type="ios-list-box-outline"
|
||||
size="16"
|
||||
style="margin-right: 5px"
|
||||
></Icon>
|
||||
<Icon type="ios-list-box-outline" size="16" style="margin-right: 5px"></Icon>
|
||||
<span>页面菜单</span>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="菜单名称"
|
||||
prop="title"
|
||||
>
|
||||
<Input v-model="formAdd.title"/>
|
||||
<FormItem label="菜单名称" prop="title">
|
||||
<Input class="menu-input" v-model="formAdd.title" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="路由地址" prop="path" v-if="formAdd.level != 0">
|
||||
<Input v-model="formAdd.path"/>
|
||||
|
||||
<Input v-model="formAdd.path" />
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="路由名称"
|
||||
prop="name"
|
||||
class="block-tool"
|
||||
>
|
||||
<FormItem label="路由名称" prop="name" class="block-tool">
|
||||
<Tooltip placement="right" content="路由name,需英文唯一,跳转页面用">
|
||||
<Input v-model="formAdd.name"/>
|
||||
<Input v-model="formAdd.name" />
|
||||
</Tooltip>
|
||||
</FormItem>
|
||||
<FormItem label="文件路径" prop="frontRoute" v-if="formAdd.level != 0">
|
||||
<Input v-model="formAdd.frontRoute"/>
|
||||
<Input v-model="formAdd.frontRoute" />
|
||||
</FormItem>
|
||||
<FormItem label="权限url" v-if="formAdd.level != 0">
|
||||
<Input v-model="formAdd.permission"/>
|
||||
<Input v-model="formAdd.permission" />
|
||||
<div class="desc">*号模糊匹配,逗号分割</div>
|
||||
</FormItem>
|
||||
<FormItem label="排序值" prop="sortOrder">
|
||||
<Tooltip
|
||||
trigger="hover"
|
||||
placement="right"
|
||||
content="值越小越靠前,支持小数"
|
||||
>
|
||||
<InputNumber
|
||||
:max="1000"
|
||||
:min="0"
|
||||
v-model="formAdd.sortOrder"
|
||||
></InputNumber>
|
||||
<Tooltip trigger="hover" placement="right" content="值越小越靠前,支持小数">
|
||||
<InputNumber :max="1000" :min="0" v-model="formAdd.sortOrder"></InputNumber>
|
||||
</Tooltip>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div slot="footer">
|
||||
<Button type="text" @click="menuModalVisible = false">取消</Button>
|
||||
<Button type="primary" :loading="submitLoading" @click="submitAdd"
|
||||
>提交</Button>
|
||||
<Button type="primary" :loading="submitLoading" @click="submitAdd">提交</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
|
@ -245,7 +211,8 @@ export default {
|
|||
parentTitle: "", // 父级标题
|
||||
editTitle: "", // 编辑标题
|
||||
modalTitle: "", // modal标题
|
||||
form: { // 表单数据
|
||||
form: {
|
||||
// 表单数据
|
||||
id: "",
|
||||
title: "",
|
||||
name: "",
|
||||
|
@ -254,19 +221,17 @@ export default {
|
|||
parentId: "",
|
||||
sortOrder: 0,
|
||||
level: 0,
|
||||
permission: ''
|
||||
permission: "",
|
||||
},
|
||||
formAdd: { // 添加表单
|
||||
formAdd: {
|
||||
// 添加表单
|
||||
},
|
||||
formValidate: { // 验证规则
|
||||
title: [{required: true, message: "菜单名称名称不能为空", trigger: "blur"}],
|
||||
name: [
|
||||
{required: true, message: "路由名称不能为空", trigger: "blur"},
|
||||
],
|
||||
path: [{required: true, message: "路由地址不能为空", trigger: "blur"}],
|
||||
frontRoute: [
|
||||
{required: true, message: "文件地址不能为空", trigger: "blur"},
|
||||
],
|
||||
formValidate: {
|
||||
// 验证规则
|
||||
title: [{ required: true, message: "菜单名称名称不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "路由名称不能为空", trigger: "blur" }],
|
||||
path: [{ required: true, message: "路由地址不能为空", trigger: "blur" }],
|
||||
frontRoute: [{ required: true, message: "文件地址不能为空", trigger: "blur" }],
|
||||
sortOrder: [
|
||||
{
|
||||
required: true,
|
||||
|
@ -286,7 +251,8 @@ export default {
|
|||
this.getAllList();
|
||||
},
|
||||
|
||||
renderContent(h, {root, node, data}) { // 渲染树形结构前面图标
|
||||
renderContent(h, { root, node, data }) {
|
||||
// 渲染树形结构前面图标
|
||||
let icon = "";
|
||||
if (data.level == 0) {
|
||||
icon = "ios-navigate";
|
||||
|
@ -420,7 +386,6 @@ export default {
|
|||
// 选择菜单
|
||||
selectTree(v) {
|
||||
if (v.length > 0) {
|
||||
|
||||
let str = JSON.stringify(v);
|
||||
let menu = JSON.parse(str);
|
||||
this.form = menu[0];
|
||||
|
@ -434,7 +399,7 @@ export default {
|
|||
search() {
|
||||
if (this.searchKey) {
|
||||
this.loading = true;
|
||||
searchPermission({title: this.searchKey}).then((res) => {
|
||||
searchPermission({ title: this.searchKey }).then((res) => {
|
||||
this.loading = false;
|
||||
if (res.success) {
|
||||
this.data = res.result;
|
||||
|
@ -486,7 +451,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("编辑成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit('setAdded', false);
|
||||
this.$store.commit("setAdded", false);
|
||||
util.initRouter(this);
|
||||
this.init();
|
||||
this.menuModalVisible = false;
|
||||
|
@ -506,7 +471,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("添加成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit('setAdded', false);
|
||||
this.$store.commit("setAdded", false);
|
||||
util.initRouter(this);
|
||||
this.init();
|
||||
this.menuModalVisible = false;
|
||||
|
@ -535,7 +500,7 @@ export default {
|
|||
parentId: this.form.id,
|
||||
level: Number(this.form.level) + 1,
|
||||
sortOrder: 0,
|
||||
permission:'' // 权限url
|
||||
permission: "", // 权限url
|
||||
};
|
||||
if (this.form.level == 0) {
|
||||
this.formAdd.path = "/";
|
||||
|
@ -549,7 +514,7 @@ export default {
|
|||
this.showParent = false;
|
||||
this.formAdd = {
|
||||
level: 0,
|
||||
sortOrder: 0
|
||||
sortOrder: 0,
|
||||
};
|
||||
this.menuModalVisible = true;
|
||||
},
|
||||
|
@ -579,7 +544,7 @@ export default {
|
|||
if (res.success) {
|
||||
this.$Message.success("删除成功");
|
||||
// 标记重新获取菜单数据
|
||||
this.$store.commit('setAdded', false);
|
||||
this.$store.commit("setAdded", false);
|
||||
util.initRouter(this);
|
||||
this.selectList = [];
|
||||
this.selectCount = 0;
|
||||
|
@ -601,8 +566,11 @@ export default {
|
|||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "@/styles/tree-common.scss";
|
||||
.desc{
|
||||
.desc {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
.menu-input {
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -60,13 +60,8 @@ export const editPintuan = (params) => {
|
|||
return putRequest('/promotion/pintuan', params,{'Content-type': 'application/json'})
|
||||
}
|
||||
// 手动开启拼团活动
|
||||
export const openPintuan = (pintuanId, params) => {
|
||||
return putRequest(`/promotion/pintuan/open/${pintuanId}`, params)
|
||||
}
|
||||
|
||||
// 手动关闭拼团活动
|
||||
export const closePintuan = (pintuanId) => {
|
||||
return putRequest(`/promotion/pintuan/close/${pintuanId}`)
|
||||
export const editPintuanStatus = (pintuanId, params) => {
|
||||
return putRequest(`/promotion/pintuan/status/${pintuanId}`, params)
|
||||
}
|
||||
|
||||
// 删除拼团活动
|
||||
|
@ -179,6 +174,6 @@ export const delFullDiscount = (id) => {
|
|||
return deleteRequest(`/promotion/fullDiscount/${id}`)
|
||||
}
|
||||
// 开启、关闭满减活动
|
||||
export const updateFullDiscount = (id, promotionStatus) => {
|
||||
return putRequest(`/promotion/fullDiscount/status/${id}/${promotionStatus}`)
|
||||
export const updateFullDiscount = (id, params) => {
|
||||
return putRequest(`/promotion/fullDiscount/status/${id}`, params)
|
||||
}
|
||||
|
|
|
@ -89,6 +89,11 @@ export const getRefundGoodsAddress = () => {
|
|||
export const saveRefundGoodsAddress = (params) => {
|
||||
return putRequest(`/settings/storeAfterSaleAddress`, params)
|
||||
}
|
||||
//修改im商户id
|
||||
export const updatEmerchantId = (params) => {
|
||||
return putRequest(`/settings/merchantEuid`, params)
|
||||
}
|
||||
|
||||
|
||||
//修改保存库存预警数
|
||||
export const updateStockWarning = (params) => {
|
||||
|
@ -113,4 +118,3 @@ export const editShipTemplate = (id, params, headers) => {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -283,8 +283,8 @@ export const result = [{
|
|||
level: 2,
|
||||
type: 0,
|
||||
title: "满额活动",
|
||||
path: "full-cut",
|
||||
component: "promotion/fullCut/fullCut",
|
||||
path: "full-discount",
|
||||
component: "promotion/full-discount/full-discount",
|
||||
children: null
|
||||
},
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ export const otherRouter = {
|
|||
path: "add-coupon",
|
||||
title: "店铺优惠券",
|
||||
name: "add-coupon",
|
||||
component: () => import("@/views/promotion/coupon/couponPublish.vue")
|
||||
component: () => import("@/views/promotion/coupon/coupon-publish.vue")
|
||||
},
|
||||
{
|
||||
path: "add-live",
|
||||
|
@ -81,19 +81,19 @@ export const otherRouter = {
|
|||
path: "seckill-goods",
|
||||
title: "限时抢购商品",
|
||||
name: "seckill-goods",
|
||||
component: () => import("@/views/promotion/seckill/seckillGoods.vue")
|
||||
component: () => import("@/views/promotion/seckill/seckill-goods.vue")
|
||||
},
|
||||
{
|
||||
path: "pintuan-goods",
|
||||
title: "拼团商品",
|
||||
name: "pintuan-goods",
|
||||
component: () => import("@/views/promotion/pintuan/pintuanGoods.vue")
|
||||
component: () => import("@/views/promotion/pintuan/pintuan-goods.vue")
|
||||
},
|
||||
{
|
||||
path: "new-pintuan",
|
||||
path: "pintuan-edit",
|
||||
title: "新增拼团",
|
||||
name: "new-pintuan",
|
||||
component: () => import("@/views/promotion/pintuan/newPintuan.vue")
|
||||
name: "pintuan-edit",
|
||||
component: () => import("@/views/promotion/pintuan/pintuan-edit.vue")
|
||||
},
|
||||
{
|
||||
path: "order-detail",
|
||||
|
@ -116,10 +116,10 @@ export const otherRouter = {
|
|||
import("@/views/order/after-order/reurnGoodsOrderDetail.vue")
|
||||
},
|
||||
{
|
||||
path: "full-cut-detail",
|
||||
path: "full-discount-detail",
|
||||
title: "添加满额活动",
|
||||
name: "full-cut-detail",
|
||||
component: () => import("@/views/promotion/fullCut/newFullCut.vue")
|
||||
name: "full-discount-detail",
|
||||
component: () => import("@/views/promotion/full-discount/full-discount-add.vue")
|
||||
},
|
||||
{
|
||||
path: "export-order-deliver",
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
export function promotionsStatusRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "geekblue";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
export function promotionsScopeTypeRender(h, params) {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
color = "default";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
color = "yellow";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
color = "pink";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
color = "magenta";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -6,10 +6,24 @@
|
|||
<h4>基本信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="活动名称" prop="promotionName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.promotionName"
|
||||
placeholder="活动名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券名称" prop="couponName">
|
||||
<Input :disabled="disabled" type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.couponName"
|
||||
placeholder="优惠券名称"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="优惠券类型" prop="couponType">
|
||||
<Select :disabled="disabled" v-model="form.couponType" style="width: 260px">
|
||||
|
@ -18,11 +32,25 @@
|
|||
</Select>
|
||||
</FormItem>
|
||||
<FormItem label="折扣" prop="discount" v-if="form.couponType == 'DISCOUNT'">
|
||||
<Input :disabled="disabled" type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="number"
|
||||
v-model="form.couponDiscount"
|
||||
placeholder="折扣"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="describe">请输入0-10之间数字,可以输入一位小数</span>
|
||||
</FormItem>
|
||||
<FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'">
|
||||
<Input :disabled="disabled" type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.price"
|
||||
placeholder="面额"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动类型" prop="getType">
|
||||
<Select :disabled="disabled" v-model="form.getType" style="width: 260px">
|
||||
|
@ -32,54 +60,132 @@
|
|||
</FormItem>
|
||||
|
||||
<FormItem label="发放数量" v-if="form.getType == 'FREE'" prop="publishNum">
|
||||
<Input :disabled="disabled" v-model="form.publishNum" placeholder="发放数量" style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.publishNum"
|
||||
placeholder="发放数量"
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="tips ml_10">如果发放数量为0时,则代表不限制发放数量</span>
|
||||
</FormItem>
|
||||
</div>
|
||||
<h4>使用限制</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="消费门槛" prop="consumeThreshold">
|
||||
<Input :disabled="disabled" type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
v-model="form.consumeThreshold"
|
||||
placeholder="消费门槛"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="领取限制" v-if="form.getType == 'FREE'" prop="couponLimitNum">
|
||||
<Input :disabled="disabled" v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" />
|
||||
<FormItem
|
||||
label="领取限制"
|
||||
v-if="form.getType == 'FREE'"
|
||||
prop="couponLimitNum"
|
||||
>
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.couponLimitNum"
|
||||
placeholder="领取限制"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
<span class="tips ml_10">如果领取限制为0时,则代表不限制领取数量</span>
|
||||
</FormItem>
|
||||
<FormItem label="有效期" prop="rangeTime">
|
||||
<DatePicker :disabled="disabled" type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px">
|
||||
<DatePicker
|
||||
:disabled="disabled"
|
||||
type="datetimerange"
|
||||
v-model="form.rangeTime"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
style="width: 260px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<FormItem label="使用范围" prop="scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<Radio :disabled="disabled" label="ALL">全品类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS">指定商品</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY">部分商品分类</Radio>
|
||||
<Radio :disabled="disabled" label="PORTION_GOODS_CATEGORY"
|
||||
>部分商品分类</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<div style="display: flex; margin-bottom: 10px">
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button :disabled="disabled" type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
||||
<Button :disabled="disabled" type="primary" @click="openSkuList"
|
||||
>选择商品</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table class="mt_10" :disabled="disabled" border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
class="mt_10"
|
||||
:disabled="disabled"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
|
||||
<img
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'">
|
||||
<Cascader :disabled="disabled" @on-change="getGoodsCategory" :data="goodsCategoryList" style="width:300px;" v-model="form.scopeIdGoods"></Cascader>
|
||||
|
||||
<Cascader
|
||||
:disabled="disabled"
|
||||
@on-change="getGoodsCategory"
|
||||
:data="goodsCategoryList"
|
||||
style="width: 300px"
|
||||
v-model="form.scopeIdGoods"
|
||||
></Cascader>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="范围描述" prop="description">
|
||||
<Input :disabled="disabled" v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable style="width: 260px" />
|
||||
<Input
|
||||
:disabled="disabled"
|
||||
v-model="form.description"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</FormItem>
|
||||
<div>
|
||||
<Button :disabled="disabled" type="text" @click="$router.push({ name: 'coupon' })">返回</Button>
|
||||
<Button :disabled="disabled" type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="text"
|
||||
@click="$router.push({ name: 'coupon' })"
|
||||
>返回</Button
|
||||
>
|
||||
<Button
|
||||
:disabled="disabled"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -152,10 +258,7 @@ export default {
|
|||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
couponName: [{ required: true, message: "优惠券名称不能为空" }],
|
||||
couponLimitNum: [{ required: true, message: "领取限制不能为空" }],
|
||||
price: [
|
||||
{ required: true, message: "请输入面额" },
|
||||
{ validator: checkPrice },
|
||||
],
|
||||
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||
consumeThreshold: [
|
||||
{ required: true, message: "请输入消费门槛" },
|
||||
{ validator: checkWeight },
|
||||
|
@ -198,10 +301,7 @@ export default {
|
|||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -284,7 +384,9 @@ export default {
|
|||
data.scopeIdGoods = prevCascader;
|
||||
}
|
||||
data.rangeTime = [];
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
if (data.startTime && data.endTime) {
|
||||
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
|
||||
}
|
||||
this.form = data;
|
||||
});
|
||||
},
|
||||
|
@ -307,8 +409,7 @@ export default {
|
|||
let scopeId = [];
|
||||
if (
|
||||
params.scopeType == "PORTION_GOODS" &&
|
||||
(!params.promotionGoodsList ||
|
||||
params.promotionGoodsList.length == 0)
|
||||
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
|
@ -402,11 +503,9 @@ export default {
|
|||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -520,4 +619,3 @@ h4 {
|
|||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,12 +2,29 @@
|
|||
<div class="search">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="100" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="100"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="优惠券名称">
|
||||
<Input type="text" v-model="searchForm.couponName" placeholder="请输入优惠券名称" clearable style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.couponName"
|
||||
placeholder="请输入优惠券名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -15,26 +32,71 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px"></DatePicker>
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
></DatePicker>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn" icon="ios-search">搜索</Button>
|
||||
<Button
|
||||
@click="handleSearch"
|
||||
type="primary"
|
||||
class="search-btn"
|
||||
icon="ios-search"
|
||||
>搜索</Button
|
||||
>
|
||||
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
<Row class="operator padding-row">
|
||||
<Button @click="add" type="primary">添加</Button>
|
||||
<Button @click="delAll" class="ml_10">批量下架</Button>
|
||||
<Button @click="delAll" class="ml_10">批量关闭</Button>
|
||||
</Row>
|
||||
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
class="mt_10"
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
ref="table"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" @click="see(row)">编辑</Button>
|
||||
<Button v-else type="default" size="small" @click="see(row,'only')">查看</Button>
|
||||
<Button v-if="row.promotionStatus !== 'END'" type="error" size="small" :style="{'marginLeft':'5px'}" @click="remove(row)">下架</Button>
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="see(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button v-else type="default" size="small" @click="see(row, 'only')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
v-if="row.promotionStatus === 'START' || row.promotionStatus === 'NEW'"
|
||||
type="error"
|
||||
size="small"
|
||||
:style="{ marginLeft: '5px' }"
|
||||
@click="remove(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="mt_10">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
|
||||
size="small" show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
|
@ -42,12 +104,13 @@
|
|||
|
||||
<script>
|
||||
import { getShopCouponList, updateCouponStatus } from "@/api/promotion";
|
||||
import { promotionsStatusRender, promotionsScopeTypeRender } from "@/utils/promotions";
|
||||
|
||||
export default {
|
||||
name: "coupon",
|
||||
data() {
|
||||
return {
|
||||
selectDate:[],
|
||||
selectDate: [],
|
||||
loading: true, // 表单加载状态
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
|
@ -84,7 +147,7 @@ export default {
|
|||
if (params.row.price) {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice((params.row.price || 0), "¥")
|
||||
this.$options.filters.unitPrice(params.row.price || 0, "¥")
|
||||
);
|
||||
} else {
|
||||
return h("div", (params.row.couponDiscount || 0) + "折");
|
||||
|
@ -98,7 +161,9 @@ export default {
|
|||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
params.row.receivedNum + "/" + (params.row.publishNum === 0 ? '不限制' : params.row.publishNum)
|
||||
params.row.receivedNum +
|
||||
"/" +
|
||||
(params.row.publishNum === 0 ? "不限制" : params.row.publishNum)
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -118,32 +183,24 @@ export default {
|
|||
{
|
||||
title: "品类描述",
|
||||
key: "scopeType",
|
||||
width: 100,
|
||||
width: 120,
|
||||
render: (h, params) => {
|
||||
let text = "未知";
|
||||
if (params.row.scopeType == "ALL") {
|
||||
text = "全品类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") {
|
||||
text = "商品分类";
|
||||
} else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") {
|
||||
text = "店铺分类";
|
||||
} else if (params.row.scopeType == "PORTION_GOODS") {
|
||||
text = "指定商品";
|
||||
}
|
||||
return h("div", [text]);
|
||||
return promotionsScopeTypeRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "活动时间",
|
||||
|
||||
render: (h, params) => {
|
||||
if (params.row.rangeDayType !== "FIXEDTIME") {
|
||||
if (
|
||||
params?.row?.getType === "ACTIVITY" &&
|
||||
params?.row?.rangeDayType === "DYNAMICTIME"
|
||||
) {
|
||||
return h("div", "长期有效");
|
||||
} else {
|
||||
} else if (params?.row?.startTime && params?.row?.endTime) {
|
||||
return h("div", {
|
||||
domProps: {
|
||||
innerHTML:
|
||||
params.row.startTime + "<br/>" + params.row.endTime,
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -155,33 +212,8 @@ export default {
|
|||
key: "promotionStatus",
|
||||
fixed: "right",
|
||||
render: (h, params) => {
|
||||
let text = "未知",
|
||||
color = "red";
|
||||
if (params.row.promotionStatus == "NEW") {
|
||||
text = "未开始";
|
||||
color = "default";
|
||||
} else if (params.row.promotionStatus == "START") {
|
||||
text = "已开始";
|
||||
color = "green";
|
||||
} else if (params.row.promotionStatus == "END") {
|
||||
text = "已结束";
|
||||
color = "red";
|
||||
} else if (params.row.promotionStatus == "CLOSE") {
|
||||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{
|
||||
props: {
|
||||
color: color,
|
||||
},
|
||||
},
|
||||
text
|
||||
),
|
||||
]);
|
||||
}
|
||||
return promotionsStatusRender(h, params);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
|
@ -256,34 +288,10 @@ export default {
|
|||
this.loading = false;
|
||||
},
|
||||
// 跳转编辑优惠券页面
|
||||
see(v,only) {
|
||||
let data
|
||||
only ? data = { onlyView : true,id: v.id } : data = { id: v.id }
|
||||
this.$router.push({ name: "add-coupon", query:data});
|
||||
},
|
||||
|
||||
// 开启优惠券
|
||||
open(v) {
|
||||
this.$Modal.confirm({
|
||||
title: "确认",
|
||||
content: "确认要上架此优惠券么?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
this.loading = false;
|
||||
let params = {
|
||||
couponIds: v.id,
|
||||
promotionStatus: "START",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("上架成功");
|
||||
this.clearSelectAll();
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
see(v, only) {
|
||||
let data;
|
||||
only ? (data = { onlyView: true, id: v.id }) : (data = { id: v.id });
|
||||
this.$router.push({ name: "add-coupon", query: data });
|
||||
},
|
||||
// 下架优惠券
|
||||
remove(v) {
|
||||
|
@ -295,7 +303,6 @@ export default {
|
|||
this.loading = false;
|
||||
let params = {
|
||||
couponIds: v.id,
|
||||
promotionStatus: "CLOSE",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
|
@ -312,12 +319,12 @@ export default {
|
|||
// 批量下架
|
||||
delAll() {
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要下架的优惠券");
|
||||
this.$Message.warning("您还未选择要关闭的优惠券");
|
||||
return;
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "确认下架",
|
||||
content: "您确认要下架所选的 " + this.selectCount + " 条数据?",
|
||||
title: "确认关闭",
|
||||
content: "您确认要关闭所选的 " + this.selectCount + " 条数据?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
let ids = [];
|
||||
|
@ -327,7 +334,6 @@ export default {
|
|||
|
||||
let params = {
|
||||
couponIds: ids.toString(),
|
||||
promotionStatus: "CLOSE",
|
||||
};
|
||||
updateCouponStatus(params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
|
|
|
@ -6,81 +6,213 @@
|
|||
<h4>基本信息</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="活动名称" prop="promotionName">
|
||||
<Input type="text" v-model="form.promotionName" :disabled="form.promotionStatus != 'NEW'" placeholder="活动名称" clearable style="width: 280px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.promotionName"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
placeholder="活动名称"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="活动时间" prop="rangeTime">
|
||||
<DatePicker type="datetimerange" v-model="form.rangeTime" :disabled="form.promotionStatus != 'NEW'" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options"
|
||||
style="width: 280px">
|
||||
<DatePicker
|
||||
type="datetimerange"
|
||||
v-model="form.rangeTime"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择"
|
||||
:options="options"
|
||||
style="width: 280px"
|
||||
>
|
||||
</DatePicker>
|
||||
</FormItem>
|
||||
<FormItem label="活动描述" prop="description">
|
||||
<Input v-model="form.description" :disabled="form.promotionStatus != 'NEW'" type="textarea" :rows="4" clearable style="width: 280px" />
|
||||
<Input
|
||||
v-model="form.description"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<h4>优惠设置</h4>
|
||||
<div class="form-item-view">
|
||||
<FormItem label="优惠门槛" prop="fullMoney">
|
||||
<Input type="text" v-model="form.fullMoney" :disabled="form.promotionStatus != 'NEW'" placeholder="优惠门槛" clearable style="width: 280px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="form.fullMoney"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
placeholder="优惠门槛"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
<span class="describe">消费达到当前金额可以参与优惠</span>
|
||||
</FormItem>
|
||||
<FormItem label="优惠方式">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus">减现金</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate">打折</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullMinus"
|
||||
>减现金</Radio
|
||||
>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="isFullRate"
|
||||
>打折</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.discountType == 'isFullMinus'" label="优惠金额" prop="fullMinus">
|
||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullMinus" placeholder="优惠金额" clearable style="width: 280px" />
|
||||
<FormItem
|
||||
v-if="form.discountType == 'isFullMinus'"
|
||||
label="优惠金额"
|
||||
prop="fullMinus"
|
||||
>
|
||||
<Input
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="text"
|
||||
v-model="form.fullMinus"
|
||||
placeholder="优惠金额"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.discountType == 'isFullRate'" label="优惠折扣" prop="fullRate">
|
||||
<Input :disabled="form.promotionStatus != 'NEW'" type="text" v-model="form.fullRate" placeholder="优惠折扣" clearable style="width: 280px" />
|
||||
<FormItem
|
||||
v-if="form.discountType == 'isFullRate'"
|
||||
label="优惠折扣"
|
||||
prop="fullRate"
|
||||
>
|
||||
<Input
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
type="text"
|
||||
v-model="form.fullRate"
|
||||
placeholder="优惠折扣"
|
||||
clearable
|
||||
style="width: 280px"
|
||||
/>
|
||||
<span class="describe">优惠折扣为0-10之间数字,可有一位小数</span>
|
||||
</FormItem>
|
||||
<FormItem label="额外赠送">
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isFreeFreight">免邮费</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon">送优惠券</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift">送赠品</Checkbox>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-if="Cookies.get('userInfoSeller') && JSON.parse(Cookies.get('userInfoSeller')).selfOperated" v-model="form.isPoint">送积分</Checkbox>
|
||||
<Checkbox
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.isFreeFreight"
|
||||
>免邮费</Checkbox
|
||||
>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isCoupon"
|
||||
>送优惠券</Checkbox
|
||||
>
|
||||
<Checkbox :disabled="form.promotionStatus != 'NEW'" v-model="form.isGift"
|
||||
>送赠品</Checkbox
|
||||
>
|
||||
<Checkbox
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-if="
|
||||
Cookies.get('userInfoSeller') &&
|
||||
JSON.parse(Cookies.get('userInfoSeller')).selfOperated
|
||||
"
|
||||
v-model="form.isPoint"
|
||||
>送积分</Checkbox
|
||||
>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isCoupon" label="赠送优惠券" prop="couponId">
|
||||
<Select v-model="form.couponId" :disabled="form.promotionStatus != 'NEW'" filterable :remote-method="getCouponList" placeholder="输入优惠券名称搜索" :loading="couponLoading" style="width: 280px">
|
||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{ item.couponName }}</Option>
|
||||
<Select
|
||||
v-model="form.couponId"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
filterable
|
||||
:remote-method="getCouponList"
|
||||
placeholder="输入优惠券名称搜索"
|
||||
:loading="couponLoading"
|
||||
style="width: 280px"
|
||||
>
|
||||
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{
|
||||
item.couponName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isGift" label="赠品" prop="giftId">
|
||||
<Select :disabled="form.promotionStatus != 'NEW'" v-model="form.giftId" filterable :remote-method="getGiftList" placeholder="输入赠品名称搜索" :loading="giftLoading" style="width: 280px">
|
||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{ item.goodsName }}</Option>
|
||||
<Select
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.giftId"
|
||||
filterable
|
||||
:remote-method="getGiftList"
|
||||
placeholder="输入赠品名称搜索"
|
||||
:loading="giftLoading"
|
||||
style="width: 280px"
|
||||
>
|
||||
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{
|
||||
item.goodsName
|
||||
}}</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem v-if="form.isPoint" label="赠积分" prop="point">
|
||||
<InputNumber :min="0" :disabled="form.promotionStatus != 'NEW'" v-model="form.point" type="number" style="width: 280px" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
:disabled="form.promotionStatus != 'NEW'"
|
||||
v-model="form.point"
|
||||
type="number"
|
||||
style="width: 280px"
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="使用范围" prop="scopeType">
|
||||
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL">全品类</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS">指定商品</Radio>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="ALL"
|
||||
>全品类</Radio
|
||||
>
|
||||
<Radio :disabled="form.promotionStatus != 'NEW'" label="PORTION_GOODS"
|
||||
>指定商品</Radio
|
||||
>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
|
||||
<div style="display: flex; margin-bottom: 10px" v-if="form.promotionStatus == 'NEW'">
|
||||
<div
|
||||
style="display: flex; margin-bottom: 10px"
|
||||
v-if="form.promotionStatus == 'NEW'"
|
||||
>
|
||||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button type="error" ghost style="margin-left: 10px" @click="delSelectGoods">批量删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
ghost
|
||||
style="margin-left: 10px"
|
||||
@click="delSelectGoods"
|
||||
>批量删除</Button
|
||||
>
|
||||
</div>
|
||||
<Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
border
|
||||
:columns="columns"
|
||||
:data="form.promotionGoodsList"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" />
|
||||
<img
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ index }" slot="action">
|
||||
<Button type="error" :disabled="form.promotionStatus != 'NEW' && id" size="small" ghost @click="delGoods(index)">删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
:disabled="form.promotionStatus != 'NEW' && id"
|
||||
size="small"
|
||||
ghost
|
||||
@click="delGoods(index)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
</FormItem>
|
||||
|
||||
<div>
|
||||
<Button type="text" @click="closeCurrentPage">返回</Button>
|
||||
<Button type="primary" :disabled="form.promotionStatus != 'NEW' && id" :loading="submitLoading" @click="handleSubmit">提交</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="form.promotionStatus != 'NEW' && id"
|
||||
:loading="submitLoading"
|
||||
@click="handleSubmit"
|
||||
>提交</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,12 +234,11 @@ import { regular } from "@/utils";
|
|||
import skuSelect from "@/views/lili-dialog";
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
name: "addFullCut",
|
||||
name: "full-discount-add",
|
||||
components: {
|
||||
skuSelect
|
||||
skuSelect,
|
||||
},
|
||||
data() {
|
||||
|
||||
const checkPrice = (rule, value, callback) => {
|
||||
if (!value && value !== 0) {
|
||||
return callback(new Error("面额不能为空"));
|
||||
|
@ -132,7 +263,8 @@ export default {
|
|||
};
|
||||
return {
|
||||
Cookies,
|
||||
form: { // 活动表单
|
||||
form: {
|
||||
// 活动表单
|
||||
discountType: "isFullMinus",
|
||||
scopeType: "ALL",
|
||||
promotionGoodsList: [],
|
||||
|
@ -141,14 +273,12 @@ export default {
|
|||
id: this.$route.query.id, // 活动id
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectedGoods: [], // 已选商品列表,便于删除
|
||||
formRule: { // 验证规则
|
||||
formRule: {
|
||||
// 验证规则
|
||||
promotionName: [{ required: true, message: "活动名称不能为空" }],
|
||||
rangeTime: [{ required: true, message: "请选择活动时间" }],
|
||||
description: [{ required: true, message: "请填写活动描述" }],
|
||||
price: [
|
||||
{ required: true, message: "请输入面额" },
|
||||
{ validator: checkPrice },
|
||||
],
|
||||
price: [{ required: true, message: "请输入面额" }, { validator: checkPrice }],
|
||||
consumptionLimit: [{ required: true, validator: checkWeight }],
|
||||
fullMoney: [{ required: true, validator: checkWeight }],
|
||||
fullMinus: [
|
||||
|
@ -169,7 +299,8 @@ export default {
|
|||
couponList: [], // 店铺优惠券列表
|
||||
giftList: [], // 赠品列表
|
||||
giftLoading: false, // 请求赠品状态
|
||||
columns: [ // 表头
|
||||
columns: [
|
||||
// 表头
|
||||
{
|
||||
type: "selection",
|
||||
width: 60,
|
||||
|
@ -185,10 +316,7 @@ export default {
|
|||
key: "price",
|
||||
minWidth: 40,
|
||||
render: (h, params) => {
|
||||
return h(
|
||||
"div",
|
||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
||||
);
|
||||
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -225,12 +353,13 @@ export default {
|
|||
);
|
||||
this.$router.go(-1);
|
||||
},
|
||||
openSkuList() { // 显示商品选择器
|
||||
openSkuList() {
|
||||
// 显示商品选择器
|
||||
this.$refs.skuSelect.open("goods");
|
||||
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList))
|
||||
data.forEach(e => {
|
||||
e.id = e.skuId
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList));
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
getDetail() {
|
||||
|
@ -238,11 +367,8 @@ export default {
|
|||
getFullDiscountById(this.id).then((res) => {
|
||||
console.log(res);
|
||||
let data = res.result;
|
||||
if (data.number == -1) {
|
||||
if (data.scopeType === "ALL") {
|
||||
data.promotionGoodsList = [];
|
||||
data.scopeType = "ALL";
|
||||
} else {
|
||||
data.scopeType = "PORTION_GOODS";
|
||||
}
|
||||
if (data.isFullMinus) {
|
||||
data.discountType = "isFullMinus";
|
||||
|
@ -262,19 +388,14 @@ export default {
|
|||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
const strat = this.$options.filters.unixToDate(
|
||||
this.form.rangeTime[0] / 1000
|
||||
);
|
||||
const end = this.$options.filters.unixToDate(
|
||||
this.form.rangeTime[1] / 1000
|
||||
);
|
||||
const strat = this.$options.filters.unixToDate(this.form.rangeTime[0] / 1000);
|
||||
const end = this.$options.filters.unixToDate(this.form.rangeTime[1] / 1000);
|
||||
params.startTime = strat;
|
||||
params.endTime = end;
|
||||
|
||||
if (
|
||||
params.scopeType == "PORTION_GOODS" &&
|
||||
(!params.promotionGoodsList ||
|
||||
params.promotionGoodsList.length == 0)
|
||||
(!params.promotionGoodsList || params.promotionGoodsList.length == 0)
|
||||
) {
|
||||
this.$Modal.warning({ title: "提示", content: "请选择指定商品" });
|
||||
return;
|
||||
|
@ -294,7 +415,6 @@ export default {
|
|||
} else {
|
||||
params.isFullRate = true;
|
||||
}
|
||||
delete params.scopeType;
|
||||
delete params.rangeTime;
|
||||
this.submitLoading = true;
|
||||
if (!this.id) {
|
||||
|
@ -341,11 +461,9 @@ export default {
|
|||
this.selectedGoods.forEach(function (e) {
|
||||
ids.push(e.id);
|
||||
});
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
||||
(item) => {
|
||||
return !ids.includes(item.id);
|
||||
}
|
||||
);
|
||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter((item) => {
|
||||
return !ids.includes(item.id);
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -376,7 +494,7 @@ export default {
|
|||
pageNumber: 0,
|
||||
getType: "ACTIVITY",
|
||||
couponName: query,
|
||||
promotionStatus:"START"
|
||||
promotionStatus: "START",
|
||||
};
|
||||
this.couponLoading = true;
|
||||
getShopCouponList(params).then((res) => {
|
||||
|
@ -422,8 +540,7 @@ h4 {
|
|||
margin-left: 10px;
|
||||
color: #999;
|
||||
}
|
||||
.ivu-form-item{
|
||||
.ivu-form-item {
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,12 +1,29 @@
|
|||
<template>
|
||||
<div class="search">
|
||||
<Card>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="活动名称">
|
||||
<Input type="text" v-model="searchForm.promotionName" placeholder="请输入活动名称" clearable style="width: 200px" />
|
||||
<Input
|
||||
type="text"
|
||||
v-model="searchForm.promotionName"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
</Form-item>
|
||||
<Form-item label="活动状态" prop="promotionStatus">
|
||||
<Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px">
|
||||
<Select
|
||||
v-model="searchForm.promotionStatus"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<Option value="NEW">未开始</Option>
|
||||
<Option value="START">已开始/上架</Option>
|
||||
<Option value="END">已结束/下架</Option>
|
||||
|
@ -14,7 +31,13 @@
|
|||
</Select>
|
||||
</Form-item>
|
||||
<Form-item label="活动时间">
|
||||
<DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px">
|
||||
<DatePicker
|
||||
v-model="selectDate"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="选择起始时间"
|
||||
style="width: 200px"
|
||||
>
|
||||
</DatePicker>
|
||||
</Form-item>
|
||||
<Form-item>
|
||||
|
@ -33,27 +56,58 @@
|
|||
{{ row.isFullMinus ? "满减" : "满折" }}
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="hours">
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{
|
||||
item
|
||||
}}</Tag>
|
||||
<Tag v-for="item in unixHours(row.hours)" :key="item">{{ item }}</Tag>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<div>
|
||||
<Button type="primary" v-if="row.promotionStatus == 'NEW'" size="small" @click="edit(row)">编辑</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button type="info" v-else size="small" @click="edit(row)">查看</Button>
|
||||
<Button type="success" v-if="row.promotionStatus === 'START'" style="margin-left:5px" size="small"
|
||||
@click="openOrClose(row)">关闭</Button>
|
||||
<Button type="success" v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left:5px" size="small" @click="openOrClose(row)">开启</Button>
|
||||
<Button type="error" :disabled="row.promotionStatus == 'START'" style="margin-left:5px" size="small"
|
||||
@click="del(row)">删除</Button>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus === 'START'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="openOrClose(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
:disabled="row.promotionStatus == 'START'"
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
@click="del(row)"
|
||||
>删除</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="page operation">
|
||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
||||
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" show-total show-elevator
|
||||
show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
|
@ -145,7 +199,7 @@ export default {
|
|||
methods: {
|
||||
// 改变页码
|
||||
newAct() {
|
||||
this.$router.push({ name: "full-cut-detail" });
|
||||
this.$router.push({ name: "full-discount-detail" });
|
||||
},
|
||||
// 初始化数据
|
||||
init() {
|
||||
|
@ -177,7 +231,7 @@ export default {
|
|||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.$router.push({ name: "full-cut-detail", query: { id: row.id } });
|
||||
this.$router.push({ name: "full-discount-detail", query: { id: row.id } });
|
||||
},
|
||||
// 删除
|
||||
del(row) {
|
||||
|
@ -205,23 +259,70 @@ export default {
|
|||
if (row.promotionStatus === "START") {
|
||||
name = "关闭";
|
||||
status = "CLOSE";
|
||||
this.$Modal.confirm({
|
||||
title: "提示",
|
||||
// 记得确认修改此处
|
||||
content: `确认${name}此活动吗?需要一定时间才能生效,请耐心等待`,
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
updateFullDiscount(row.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(`${name}成功`);
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
let sTime = new Date();
|
||||
sTime.setMinutes(sTime.getMinutes() + 10);
|
||||
let eTime = new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
|
||||
this.openStartTime = sTime.getTime();
|
||||
this.openEndTime = eTime.getTime();
|
||||
this.$Modal.confirm({
|
||||
title: "确认开启(默认为当前时间的十分钟之后)",
|
||||
content: "您确认要开启此拼团活动?",
|
||||
onOk: () => {
|
||||
let params = {
|
||||
startTime: this.openStartTime,
|
||||
endTime: this.openEndTime,
|
||||
};
|
||||
updateFullDiscount(row.id, params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("开启活动成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
render: (h) => {
|
||||
return h("div", [
|
||||
h("DatePicker", {
|
||||
props: {
|
||||
type: "datetimerange",
|
||||
placeholder: "请选择开始时间和结束时间",
|
||||
value: [sTime, eTime],
|
||||
},
|
||||
style: {
|
||||
width: "350px",
|
||||
},
|
||||
on: {
|
||||
input: (val) => {
|
||||
if (val[0]) {
|
||||
this.openStartTime = val[0].getTime();
|
||||
}
|
||||
if (val[1]) {
|
||||
this.openEndTime = val[1].getTime();
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "提示",
|
||||
// 记得确认修改此处
|
||||
content: `确认${name}此活动吗?需要一定时间才能生效,请耐心等待`,
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
// 删除
|
||||
updateFullDiscount(row.id, status).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success(`${name}成功`);
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取列表数据
|
||||
getDataList() {
|
|
@ -7,42 +7,79 @@
|
|||
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||
<Button @click="delAll">批量删除</Button>
|
||||
<Button @click="getDataList" icon="md-refresh">刷新</Button>
|
||||
<Button type="dashed" @click="openTip = !openTip">{{ openTip ? "关闭提示" : "开启提示" }}</Button>
|
||||
<Button type="dashed" @click="openTip = !openTip">{{
|
||||
openTip ? "关闭提示" : "开启提示"
|
||||
}}</Button>
|
||||
</Row>
|
||||
<Row v-show="openTip" v-if="status == 'manager'">
|
||||
<Row v-show="openTip" v-if="status == 'manager'">
|
||||
<Alert show-icon>
|
||||
已选择 <span >{{ selectCount }}</span> 项
|
||||
已选择 <span>{{ selectCount }}</span> 项
|
||||
<a class="select-clear" @click="clearSelectAll">清空</a>
|
||||
</Alert>
|
||||
</Row>
|
||||
<h3 class="act-goods">活动商品</h3>
|
||||
<Table class="mt_10" :loading="loading" border :columns="goodsColumns" :data="goodsData" ref="table" @on-selection-change="changeSelect">
|
||||
<Table
|
||||
class="mt_10"
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="goodsColumns"
|
||||
:data="goodsData"
|
||||
ref="table"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row, index }" slot="price">
|
||||
<Input v-model="row.price" :disabled="status==='view'" @input="goodsData[index].price = row.price" />
|
||||
<Input
|
||||
v-model="row.price"
|
||||
:disabled="status === 'view'"
|
||||
@input="goodsData[index].price = row.price"
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ index }" slot="action">
|
||||
<Button type="error" size="small" ghost v-if="status === 'manager'" @click="delGoods(index)">删除</Button>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
ghost
|
||||
v-if="status === 'manager'"
|
||||
@click="delGoods(index)"
|
||||
>删除</Button
|
||||
>
|
||||
</template>
|
||||
</Table>
|
||||
<Row type="flex" justify="end" class="page operation">
|
||||
<Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
|
||||
size="small" show-total show-elevator show-sizer></Page>
|
||||
<Page
|
||||
:current="searchForm.pageNumber + 1"
|
||||
:total="total"
|
||||
:page-size="searchForm.pageSize"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changePageSize"
|
||||
:page-size-opts="[10, 20, 50]"
|
||||
size="small"
|
||||
show-total
|
||||
show-elevator
|
||||
show-sizer
|
||||
></Page>
|
||||
</Row>
|
||||
<Row class="operation">
|
||||
<Button @click="closeCurrentPage">返回</Button>
|
||||
<Button v-if="status == 'manager'" type="primary" :loading="submitLoading" @click="save">保存</Button>
|
||||
<Button
|
||||
v-if="status == 'manager'"
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
@click="save"
|
||||
>保存</Button
|
||||
>
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
<sku-select ref="skuSelect" :goodsData="goodsData" @selectedGoodsData="selectedGoodsData"></sku-select>
|
||||
<sku-select
|
||||
ref="skuSelect"
|
||||
:goodsData="goodsData"
|
||||
@selectedGoodsData="selectedGoodsData"
|
||||
></sku-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getPintuanGoodsList,
|
||||
getPintuanDetail,
|
||||
editPintuan,
|
||||
} from "@/api/promotion.js";
|
||||
import { getPintuanGoodsList, getPintuanDetail, editPintuan } from "@/api/promotion.js";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
export default {
|
||||
components: {
|
||||
|
@ -52,7 +89,8 @@ export default {
|
|||
return {
|
||||
openTip: true, // 显示提示
|
||||
loading: false, // 表单加载状态
|
||||
searchForm: { // 搜索框初始化对象
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 0, // 当前页数
|
||||
pageSize: 10, // 页面大小
|
||||
},
|
||||
|
@ -63,7 +101,8 @@ export default {
|
|||
data: [], // 表单数据
|
||||
total: 0, // 表单数据总数
|
||||
status: this.$route.query.status, // 查看还是修改
|
||||
columns: [ // 活动详情表头
|
||||
columns: [
|
||||
// 活动详情表头
|
||||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
|
@ -99,17 +138,12 @@ export default {
|
|||
text = "已关闭";
|
||||
color = "red";
|
||||
}
|
||||
return h("div", [
|
||||
h(
|
||||
"Tag",
|
||||
{props: {color: color}},
|
||||
text
|
||||
),
|
||||
]);
|
||||
return h("div", [h("Tag", { props: { color: color } }, text)]);
|
||||
},
|
||||
},
|
||||
],
|
||||
goodsColumns: [ // 活动商品表头
|
||||
goodsColumns: [
|
||||
// 活动商品表头
|
||||
{ type: "selection", width: 60, align: "center" },
|
||||
{
|
||||
title: "商品名称",
|
||||
|
@ -177,23 +211,27 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
init() { // 初始化数据
|
||||
init() {
|
||||
// 初始化数据
|
||||
this.getDataList();
|
||||
this.getPintuanMsg();
|
||||
},
|
||||
|
||||
changePage(v) { // 分页 改变页数
|
||||
changePage(v) {
|
||||
// 分页 改变页数
|
||||
this.searchForm.pageNumber = v - 1;
|
||||
this.getDataList();
|
||||
this.clearSelectAll();
|
||||
},
|
||||
|
||||
changePageSize(v) { // 分页 改变每页数
|
||||
changePageSize(v) {
|
||||
// 分页 改变每页数
|
||||
this.searchForm.pageSize = v;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
handleSearch() { // 搜索
|
||||
handleSearch() {
|
||||
// 搜索
|
||||
this.searchForm.pageNumber = 0;
|
||||
this.searchForm.pageSize = 10;
|
||||
this.getDataList();
|
||||
|
@ -207,7 +245,8 @@ export default {
|
|||
this.getDataList();
|
||||
},
|
||||
|
||||
clearSelectAll() { // 清空所有已选项
|
||||
clearSelectAll() {
|
||||
// 清空所有已选项
|
||||
this.$refs.table.selectAll(false);
|
||||
},
|
||||
changeSelect(e) {
|
||||
|
@ -216,7 +255,8 @@ export default {
|
|||
this.selectCount = e.length;
|
||||
},
|
||||
|
||||
getDataList() { // 获取商品列表
|
||||
getDataList() {
|
||||
// 获取商品列表
|
||||
this.loading = true;
|
||||
this.searchForm.pintuanId = this.$route.query.id;
|
||||
|
||||
|
@ -228,15 +268,18 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getPintuanMsg() { // 获取拼团详情
|
||||
getPintuanMsg() {
|
||||
// 获取拼团详情
|
||||
getPintuanDetail(this.$route.query.id).then((res) => {
|
||||
if (res.success) this.data.push(res.result);
|
||||
});
|
||||
},
|
||||
delGoods(index) { // 删除商品
|
||||
delGoods(index) {
|
||||
// 删除商品
|
||||
this.goodsData.splice(index, 1);
|
||||
},
|
||||
delAll() { // 批量删除商品
|
||||
delAll() {
|
||||
// 批量删除商品
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要删除的数据");
|
||||
return;
|
||||
|
@ -255,34 +298,38 @@ export default {
|
|||
},
|
||||
});
|
||||
},
|
||||
selectedGoodsData(item) { // 选择商品
|
||||
selectedGoodsData(item) {
|
||||
// 选择商品
|
||||
console.log(item);
|
||||
let list = [];
|
||||
item.forEach((e) => {
|
||||
list.push({
|
||||
goodsName: e.goodsName,
|
||||
price: e.price,
|
||||
originalPrice: e.price,
|
||||
quantity: e.quantity,
|
||||
storeId: e.storeId,
|
||||
sellerName: e.sellerName,
|
||||
thumbnail: e.thumbnail,
|
||||
skuId: e.id,
|
||||
categoryPath: e.categoryPath,
|
||||
});
|
||||
list.push({
|
||||
goodsName: e.goodsName,
|
||||
price: e.price,
|
||||
originalPrice: e.price,
|
||||
quantity: e.quantity,
|
||||
storeId: e.storeId,
|
||||
sellerName: e.sellerName,
|
||||
thumbnail: e.thumbnail,
|
||||
skuId: e.id,
|
||||
categoryPath: e.categoryPath,
|
||||
goodsId: e.goodsId,
|
||||
goodsType: e.goodsType,
|
||||
});
|
||||
});
|
||||
this.goodsData = list;
|
||||
},
|
||||
openSkuList() { // 显示商品选择器
|
||||
openSkuList() {
|
||||
// 显示商品选择器
|
||||
this.$refs.skuSelect.open("goods");
|
||||
let data = JSON.parse(JSON.stringify(this.goodsData))
|
||||
data.forEach(e => {
|
||||
e.id = e.skuId
|
||||
})
|
||||
let data = JSON.parse(JSON.stringify(this.goodsData));
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
};
|
||||
|
@ -294,8 +341,8 @@ export default {
|
|||
.act-goods {
|
||||
margin: 20px 0;
|
||||
font-size: 15px;
|
||||
&::before{
|
||||
content: '|';
|
||||
&::before {
|
||||
content: "|";
|
||||
color: $theme_color;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
|
@ -2,7 +2,13 @@
|
|||
<div class="pintuan">
|
||||
<Card>
|
||||
<Row>
|
||||
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||
<Form
|
||||
ref="searchForm"
|
||||
:model="searchForm"
|
||||
inline
|
||||
:label-width="70"
|
||||
class="search-form"
|
||||
>
|
||||
<Form-item label="活动名称" prop="promotionName">
|
||||
<Input
|
||||
type="text"
|
||||
|
@ -34,66 +40,64 @@
|
|||
style="width: 200px"
|
||||
></DatePicker>
|
||||
</Form-item>
|
||||
<Button @click="handleSearch" type="primary" class="search-btn " icon="ios-search">搜索</Button>
|
||||
<Button
|
||||
@click="handleSearch"
|
||||
type="primary"
|
||||
class="search-btn"
|
||||
icon="ios-search"
|
||||
>搜索</Button
|
||||
>
|
||||
<Button @click="handleReset" class="search-btn">重置</Button>
|
||||
</Form>
|
||||
</Row>
|
||||
<Row class="operation padding-row">
|
||||
<Button @click="newAct" type="primary">添加</Button>
|
||||
</Row>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
ref="table"
|
||||
>
|
||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table">
|
||||
<template slot-scope="{ row }" slot="action">
|
||||
<div class="row">
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'manager')"
|
||||
>管理</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus !== 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'view')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus != 'START'"
|
||||
@click="remove(row)"
|
||||
>删除</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="
|
||||
row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'
|
||||
"
|
||||
size="small"
|
||||
@click="open(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="warning"
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
size="small"
|
||||
@click="close(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
<div class="row">
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
@click="edit(row)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus == 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'manager')"
|
||||
>管理</Button
|
||||
>
|
||||
<Button
|
||||
type="info"
|
||||
v-if="row.promotionStatus !== 'NEW'"
|
||||
size="small"
|
||||
@click="manage(row, 'view')"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="error"
|
||||
size="small"
|
||||
v-if="row.promotionStatus != 'START'"
|
||||
@click="remove(row)"
|
||||
>删除</Button
|
||||
>
|
||||
<Button
|
||||
type="success"
|
||||
v-if="row.promotionStatus == 'NEW' || row.promotionStatus == 'CLOSE'"
|
||||
size="small"
|
||||
@click="open(row)"
|
||||
>开启</Button
|
||||
>
|
||||
<Button
|
||||
type="warning"
|
||||
v-if="row.promotionStatus == 'START'"
|
||||
size="small"
|
||||
@click="close(row)"
|
||||
>关闭</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</Table>
|
||||
|
@ -116,12 +120,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPintuanList,
|
||||
deletePintuan,
|
||||
openPintuan,
|
||||
closePintuan,
|
||||
} from "@/api/promotion";
|
||||
import { getPintuanList, deletePintuan, editPintuanStatus } from "@/api/promotion";
|
||||
export default {
|
||||
name: "pintuan",
|
||||
data() {
|
||||
|
@ -139,7 +138,7 @@ export default {
|
|||
{
|
||||
title: "活动名称",
|
||||
key: "promotionName",
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
|
@ -206,8 +205,8 @@ export default {
|
|||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.searchForm = {}
|
||||
this.selectDate = ''
|
||||
this.searchForm = {};
|
||||
this.selectDate = "";
|
||||
this.searchForm.pageNumber = 0;
|
||||
this.searchForm.pageSize = 10;
|
||||
this.getDataList();
|
||||
|
@ -239,11 +238,11 @@ export default {
|
|||
},
|
||||
// 新建拼团
|
||||
newAct() {
|
||||
this.$router.push({ name: "new-pintuan" });
|
||||
this.$router.push({ name: "pintuan-edit" });
|
||||
},
|
||||
// 编辑拼团
|
||||
edit(v) {
|
||||
this.$router.push({ name: "new-pintuan", query: { id: v.id } });
|
||||
this.$router.push({ name: "pintuan-edit", query: { id: v.id } });
|
||||
},
|
||||
// 管理拼团商品
|
||||
manage(v, status) {
|
||||
|
@ -251,15 +250,20 @@ export default {
|
|||
},
|
||||
// 手动开启拼团活动
|
||||
open(v) {
|
||||
let sTime = new Date();
|
||||
sTime.setMinutes(sTime.getMinutes() + 10);
|
||||
let eTime = new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
|
||||
this.openStartTime = sTime.getTime();
|
||||
this.openEndTime = eTime.getTime();
|
||||
this.$Modal.confirm({
|
||||
title: "确认开启",
|
||||
title: "确认开启(默认为当前时间的十分钟之后)",
|
||||
content: "您确认要开启此拼团活动?",
|
||||
onOk: () => {
|
||||
let params = {
|
||||
startTime: this.openStartTime,
|
||||
endTime: this.openEndTime,
|
||||
};
|
||||
openPintuan(v.id, params).then((res) => {
|
||||
editPintuanStatus(v.id, params).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("开启活动成功");
|
||||
|
@ -273,6 +277,7 @@ export default {
|
|||
props: {
|
||||
type: "datetimerange",
|
||||
placeholder: "请选择开始时间和结束时间",
|
||||
value: [sTime, eTime],
|
||||
},
|
||||
style: {
|
||||
width: "350px",
|
||||
|
@ -299,7 +304,7 @@ export default {
|
|||
content: "您确认要关闭此拼团活动?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
closePintuan(v.id).then((res) => {
|
||||
editPintuanStatus(v.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("关闭活动成功");
|
||||
|
@ -333,9 +338,9 @@ export default {
|
|||
},
|
||||
// 页面缓存处理,从该页面离开时,修改KeepAlive为false,保证进入该页面是刷新
|
||||
beforeRouteLeave(to, from, next) {
|
||||
from.meta.keepAlive = false
|
||||
next()
|
||||
}
|
||||
from.meta.keepAlive = false;
|
||||
next();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
|
|
@ -18,45 +18,90 @@
|
|||
</Row>
|
||||
<Row class="operation">
|
||||
<Tabs type="card" v-model="tabCurrent">
|
||||
<TabPane v-for="(tab, tabIndex) in goodsList" :key="tabIndex" :label="tab.hour" :name="tabIndex + ''">
|
||||
<Table :loading="loading" border :columns="goodsColumns" v-if="tabIndex == tabCurrent" :data="tab.list" :ref="'table' + tabIndex"
|
||||
@on-selection-change="changeSelect">
|
||||
<TabPane
|
||||
v-for="(tab, tabIndex) in goodsList"
|
||||
:key="tabIndex"
|
||||
:label="tab.hour"
|
||||
:name="tabIndex + ''"
|
||||
>
|
||||
<Table
|
||||
:loading="loading"
|
||||
border
|
||||
:columns="goodsColumns"
|
||||
v-if="tabIndex == tabCurrent"
|
||||
:data="tab.list"
|
||||
:ref="'table' + tabIndex"
|
||||
@on-selection-change="changeSelect"
|
||||
>
|
||||
<template slot-scope="{ row }" slot="originalPrice">
|
||||
|
||||
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="quantity">
|
||||
<InputNumber :min="0" v-model="row.quantity" :disabled="row.promotionApplyStatus == 'PASS'" @input="
|
||||
goodsList[tabIndex].list[index].quantity = row.quantity
|
||||
" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
v-model="row.quantity"
|
||||
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].quantity = row.quantity"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row, index }" slot="price">
|
||||
<InputNumber :min="0" style="width:100%;" v-model="row.price" :disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].price = row.price" />
|
||||
<InputNumber
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
v-model="row.price"
|
||||
:disabled="row.promotionApplyStatus == 'PASS'"
|
||||
@input="goodsList[tabIndex].list[index].price = row.price"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row }" slot="promotionApplyStatus">
|
||||
<Badge status="success" v-if="row.promotionApplyStatus == 'PASS'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge status="blue" v-if="row.promotionApplyStatus == 'APPLY'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge status="error" v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<span v-if="row.promotionApplyStatus == 'REFUSE'" @click="showReason(row.failReason)"
|
||||
class="reason">(拒绝原因)</span>
|
||||
<Badge status="error" v-if="row.promotionApplyStatus == ''"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)" />
|
||||
<Badge
|
||||
status="success"
|
||||
v-if="row.promotionApplyStatus == 'PASS'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="blue"
|
||||
v-if="row.promotionApplyStatus == 'APPLY'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<Badge
|
||||
status="error"
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
<span
|
||||
v-if="row.promotionApplyStatus == 'REFUSE'"
|
||||
@click="showReason(row.failReason)"
|
||||
class="reason"
|
||||
>(拒绝原因)</span
|
||||
>
|
||||
<Badge
|
||||
status="error"
|
||||
v-if="row.promotionApplyStatus == ''"
|
||||
:text="promotionApplyStatus(row.promotionApplyStatus)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template slot-scope="{ row }" slot="QRCode">
|
||||
<img v-if="row.QRCode" :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px"
|
||||
alt="" />
|
||||
<img
|
||||
v-if="row.QRCode"
|
||||
:src="row.QRCode || '../../../assets/lili.png'"
|
||||
width="50px"
|
||||
height="50px"
|
||||
alt=""
|
||||
/>
|
||||
</template>
|
||||
<template slot-scope="{ row, index }" slot="action">
|
||||
<Button type="error" v-if="promotionStatus === 'NEW'" size="small" ghost
|
||||
@click="delGoods(index, row)">删除
|
||||
<Button
|
||||
type="error"
|
||||
v-if="promotionStatus === 'NEW'"
|
||||
size="small"
|
||||
ghost
|
||||
@click="delGoods(index, row)"
|
||||
>删除
|
||||
</Button>
|
||||
</template>
|
||||
</Table>
|
||||
|
@ -66,7 +111,12 @@
|
|||
|
||||
<Row class="operation">
|
||||
<Button @click="closeCurrentPage">返回</Button>
|
||||
<Button type="primary" :loading="submitLoading" v-if="promotionStatus === 'NEW'" @click="save">提交
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="submitLoading"
|
||||
v-if="promotionStatus === 'NEW'"
|
||||
@click="save"
|
||||
>提交
|
||||
</Button>
|
||||
</Row>
|
||||
</Card>
|
||||
|
@ -87,14 +137,14 @@ export default {
|
|||
components: {
|
||||
skuSelect,
|
||||
},
|
||||
watch:{
|
||||
tabCurrent(val){
|
||||
this.tabIndex = val
|
||||
}
|
||||
watch: {
|
||||
tabCurrent(val) {
|
||||
this.tabIndex = val;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabCurrent:0,
|
||||
tabCurrent: 0,
|
||||
promotionStatus: "", // 活动状态
|
||||
loading: false, // 表单加载状态
|
||||
searchForm: {
|
||||
|
@ -292,10 +342,9 @@ export default {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
this.$set(this.goodsList[this.tabIndex], "list", [
|
||||
...way,
|
||||
...this.defaultGoodsList,
|
||||
// ...this.defaultGoodsList,
|
||||
]);
|
||||
// this.$nextTick(() => {
|
||||
// this.$forceUpdate();
|
||||
|
@ -305,14 +354,11 @@ export default {
|
|||
// 显示商品选择器
|
||||
|
||||
this.$refs.skuSelect.open("goods");
|
||||
this.$refs.skuSelect.selectedWay = [];
|
||||
console.warn(this.goodsList[this.tabIndex].list);
|
||||
let data = this.goodsList[this.tabIndex].list;
|
||||
data.forEach((e) => {
|
||||
e.id = e.skuId;
|
||||
});
|
||||
this.$refs.skuSelect.selectedWay = data;
|
||||
console.log(this.$refs.skuSelect.selectedWay);
|
||||
this.$refs.skuSelect.goodsData = data;
|
||||
},
|
||||
unixDate(time) {
|
||||
// 处理报名截止时间
|
|
@ -6,13 +6,13 @@
|
|||
<TabPane label="基本信息" name="INFO">
|
||||
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
|
||||
<FormItem label="店铺名称">
|
||||
<Input v-model="storeName" disabled clearable style="width: 20%" />
|
||||
<Input v-model="storeName" disabled clearable style="width: 20%"/>
|
||||
</FormItem>
|
||||
<FormItem label="店铺地址" prop="address">
|
||||
<Input v-model="form.address" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 20%" />
|
||||
<Input v-model="form.address" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 20%"/>
|
||||
</FormItem>
|
||||
<FormItem label="详细地址" prop="shopAddressDetail">
|
||||
<Input v-model="form.storeAddressDetail" clearable style="width: 20%" maxlength="50" />
|
||||
<Input v-model="form.storeAddressDetail" clearable style="width: 20%" maxlength="50"/>
|
||||
</FormItem>
|
||||
<FormItem label="店铺LOGO:">
|
||||
<upload-pic-thumb v-model="form.storeLogo" :multiple="false"></upload-pic-thumb>
|
||||
|
@ -29,19 +29,20 @@
|
|||
<TabPane label="退货地址" name="REFUND_GOODS_ADDRESS">
|
||||
<Form ref="addressForm" :model="addressForm" :label-width="100" :rules="afterFormValidate">
|
||||
<FormItem label="收货人" prop="salesConsigneeName">
|
||||
<Input v-model="addressForm.salesConsigneeName" maxlength="11" clearable style="width: 20%" />
|
||||
<Input v-model="addressForm.salesConsigneeName" maxlength="11" clearable style="width: 20%"/>
|
||||
</FormItem>
|
||||
<FormItem label="收货人电话" prop="salesConsigneeMobile">
|
||||
<Input v-model="addressForm.salesConsigneeMobile" maxlength="11" style="width: 20%" />
|
||||
<Input v-model="addressForm.salesConsigneeMobile" maxlength="11" style="width: 20%"/>
|
||||
</FormItem>
|
||||
<FormItem label="售后地址">
|
||||
<Input v-model="region" disabled style="width: 20%" v-if="showRegion == false" />
|
||||
<Button v-if="showRegion == false" @click="regionClick" :loading="submitLoading" type="primary" style="margin-left:8px">修改
|
||||
<Input v-model="region" disabled style="width: 20%" v-if="showRegion == false"/>
|
||||
<Button v-if="showRegion == false" @click="regionClick" :loading="submitLoading" type="primary"
|
||||
style="margin-left:8px">修改
|
||||
</Button>
|
||||
<regionMap style="width: 20%" @selected="selectedRegion" v-if="showRegion == true" />
|
||||
<regionMap style="width: 20%" @selected="selectedRegion" v-if="showRegion == true"/>
|
||||
</FormItem>
|
||||
<FormItem label="详细地址" prop="salesConsigneeDetail">
|
||||
<Input v-model="addressForm.salesConsigneeDetail" clearable style="width: 20%" maxlength="50" />
|
||||
<Input v-model="addressForm.salesConsigneeDetail" clearable style="width: 20%" maxlength="50"/>
|
||||
</FormItem>
|
||||
|
||||
<Form-item>
|
||||
|
@ -54,10 +55,24 @@
|
|||
|
||||
<Form ref="stockWarningForm" :model="stockWarningForm" :label-width="100" :rules="stockWarningFormValidate">
|
||||
<FormItem label="预警数" prop="stockWarning">
|
||||
<Input v-model="stockWarningForm.stockWarning" type="number" maxlength="6" clearable style="width: 20%" />
|
||||
<Input v-model="stockWarningForm.stockWarning" type="number" maxlength="6" clearable style="width: 20%"/>
|
||||
</FormItem>
|
||||
<Form-item>
|
||||
<Button @click="stockWarningHandleSubmit" :loading="submitLoading" type="primary" style="margin-right:5px">修改
|
||||
<Button @click="stockWarningHandleSubmit" :loading="submitLoading" type="primary"
|
||||
style="margin-right:5px">修改
|
||||
</Button>
|
||||
</Form-item>
|
||||
</Form>
|
||||
</TabPane>
|
||||
<TabPane label="客服设置" name="UDESK">
|
||||
|
||||
<Form ref="udeskForm" :model="udeskForm" :label-width="100" :rules="udeskFormValidate">
|
||||
<FormItem label="坐席id" prop="merchantEuid">
|
||||
<Input v-model="udeskForm.merchantEuid" maxlength="30" clearable style="width: 20%"/>
|
||||
</FormItem>
|
||||
<Form-item>
|
||||
<Button @click="merchantSubmit" :loading="submitLoading" type="primary"
|
||||
style="margin-right:5px">修改
|
||||
</Button>
|
||||
</Form-item>
|
||||
</Form>
|
||||
|
@ -71,12 +86,13 @@
|
|||
|
||||
<script>
|
||||
import * as API_Shop from "@/api/shops";
|
||||
import { validateMobile } from "@/libs/validate";
|
||||
import {validateMobile} from "@/libs/validate";
|
||||
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
|
||||
import liliMap from "@/views/my-components/map/index";
|
||||
import regionMap from "@/views/lili-components/region";
|
||||
import * as RegExp from "@/libs/RegExp.js";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: "shopSetting",
|
||||
components: {
|
||||
|
@ -103,14 +119,23 @@ export default {
|
|||
stockWarningForm: {
|
||||
stockWarning: "", // 库存预警数量
|
||||
},
|
||||
//im form
|
||||
udeskForm: {
|
||||
merchantEuid: ""
|
||||
},
|
||||
stockWarningFormValidate: {
|
||||
stockWarning: [
|
||||
{ required: true, message: "请输入库存预警数", trigger: "blur" },
|
||||
{required: true, message: "请输入库存预警数", trigger: "blur"},
|
||||
],
|
||||
},
|
||||
udeskFormValidate: {
|
||||
merchantEuid: [
|
||||
{required: true, message: "请输入店铺坐席ID", trigger: "blur"},
|
||||
],
|
||||
},
|
||||
afterFormValidate: {
|
||||
salesConsigneeMobile: [
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{required: true, message: "手机号不能为空", trigger: "blur"},
|
||||
{
|
||||
pattern: RegExp.mobile,
|
||||
trigger: "blur",
|
||||
|
@ -118,10 +143,10 @@ export default {
|
|||
},
|
||||
],
|
||||
salesConsigneeName: [
|
||||
{ required: true, message: "请输入收货人", trigger: "blur" },
|
||||
{required: true, message: "请输入收货人", trigger: "blur"},
|
||||
],
|
||||
salesConsigneeDetail: [
|
||||
{ required: true, message: "请输入详细地址", trigger: "blur" },
|
||||
{required: true, message: "请输入详细地址", trigger: "blur"},
|
||||
],
|
||||
},
|
||||
form: {
|
||||
|
@ -197,10 +222,13 @@ export default {
|
|||
this.form.storeCenter = res.result.storeCenter;
|
||||
Cookies.set("userInfoSeller", JSON.stringify(res.result));
|
||||
//库存预警数赋值
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.stockWarningForm.stockWarning = res.result.stockWarning + "";
|
||||
});
|
||||
if (res.result.merchantEuid) {
|
||||
//赋予坐席id
|
||||
this.udeskForm.merchantEuid = res.result.merchantEuid;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -243,6 +271,21 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
merchantSubmit() {
|
||||
|
||||
this.$refs.udeskForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.submitLoading = true;
|
||||
API_Shop.updatEmerchantId(this.udeskForm).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("修改成功");
|
||||
this.getShopInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 选中的地址
|
||||
selectedRegion(val) {
|
||||
this.region = val[1];
|
||||
|
@ -296,7 +339,7 @@ export default {
|
|||
this.$set(this.form, "address", item.addr);
|
||||
this.form.storeAddressPath = item.addr;
|
||||
this.form.storeAddressIdPath = item.addrId;
|
||||
this.form.storeCenter = item.position.lng + "," + item.position.lat
|
||||
this.form.storeCenter = item.position.lng + "," + item.position.lat
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
Loading…
Reference in New Issue