web/manager/src/views/promotions/full-discount/full-discount-detail.vue

311 lines
9.5 KiB
Vue
Raw Normal View History

2021-05-13 10:56:04 +08:00
<template>
<div>
<Card>
2021-05-17 08:58:35 +08:00
<Form ref="form" :model="form" :label-width="120">
2021-05-13 10:56:04 +08:00
<div class="base-info-item">
<h4>基本信息</h4>
<div class="form-item-view">
<FormItem label="活动名称" prop="promotionName">
<Input
type="text"
v-model="form.promotionName"
disabled
placeholder="活动名称"
clearable
style="width: 260px"
/>
</FormItem>
<FormItem label="活动时间" prop="rangeTime">
<DatePicker
type="datetimerange"
v-model="form.rangeTime"
disabled
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
:options="options"
style="width: 320px"
>
</DatePicker>
</FormItem>
<FormItem label="活动描述" prop="description">
<Input
v-model="form.description"
disabled
type="textarea"
:rows="4"
clearable
style="width: 260px"
/>
</FormItem>
</div>
<h4>优惠设置</h4>
<div class="form-item-view">
<FormItem label="优惠门槛" prop="fullMoney">
<Input
type="text"
v-model="form.fullMoney"
disabled
placeholder="优惠门槛"
clearable
style="width: 260px"
/>
<span class="describe">消费达到当前金额可以参与优惠</span>
</FormItem>
<FormItem label="优惠方式">
2021-05-17 18:07:19 +08:00
<RadioGroup type="button" button-style="solid" v-model="form.discountType">
2021-12-21 18:59:45 +08:00
<Radio label="fullMinusFlag" disabled>减现金</Radio>
<Radio label="fullRateFlag" disabled>打折</Radio>
2021-05-13 10:56:04 +08:00
</RadioGroup>
</FormItem>
<FormItem
2021-12-21 18:59:45 +08:00
v-if="form.discountType == 'fullMinusFlag'"
2021-05-13 10:56:04 +08:00
label="优惠金额"
prop="fullMinus"
>
<Input
type="text"
disabled
v-model="form.fullMinus"
placeholder="优惠金额"
clearable
style="width: 260px"
/>
</FormItem>
<FormItem
2021-12-21 18:59:45 +08:00
v-if="form.discountType == 'fullRateFlag'"
2021-05-13 10:56:04 +08:00
label="优惠折扣"
prop="fullRate"
>
<Input
type="text"
v-model="form.fullRate"
placeholder="优惠折扣"
disabled
clearable
style="width: 260px"
/>
<span class="describe">优惠折扣为0-10之间数字可有一位小数</span>
</FormItem>
<FormItem label="额外赠送">
2021-12-21 18:59:45 +08:00
<Checkbox v-model="form.freeFreightFlag" disabled>免邮费</Checkbox>&nbsp;
<Checkbox v-model="form.couponFlag" disabled>送优惠券</Checkbox>&nbsp;
<Checkbox v-model="form.giftFlag" disabled>送赠品</Checkbox>&nbsp;
<Checkbox v-model="form.pointFlag" disabled>送积分</Checkbox>
2021-05-13 10:56:04 +08:00
</FormItem>
2021-12-21 18:59:45 +08:00
<FormItem v-if="form.couponFlag" label="赠送优惠券" prop="couponId">
2021-05-13 10:56:04 +08:00
<Select
v-model="form.couponId"
filterable
:remote-method="getCouponList"
placeholder="输入优惠券名称搜索"
disabled
:loading="couponLoading"
style="width: 260px"
>
2021-12-11 13:50:58 +08:00
<Option v-for="item in couponList" :value="item.id" :key="item.id">{{
item.couponName
}}</Option>
2021-05-13 10:56:04 +08:00
</Select>
</FormItem>
2021-12-21 18:59:45 +08:00
<FormItem v-if="form.giftFlag" label="赠品" prop="giftId">
2021-05-13 10:56:04 +08:00
<Select
v-model="form.giftId"
filterable
:remote-method="getGiftList"
placeholder="输入赠品名称搜索"
disabled
:loading="giftLoading"
style="width: 260px"
>
2021-12-11 13:50:58 +08:00
<Option v-for="item in giftList" :value="item.id" :key="item.id">{{
item.goodsName
}}</Option>
2021-05-13 10:56:04 +08:00
</Select>
</FormItem>
2021-12-21 18:59:45 +08:00
<FormItem v-if="form.pointFlag" label="赠积分" prop="point">
2021-12-11 13:50:58 +08:00
<Input v-model="form.point" type="number" disabled style="width: 260px" />
2021-05-13 10:56:04 +08:00
</FormItem>
<FormItem label="使用范围" prop="scopeType">
2021-05-17 18:07:19 +08:00
<RadioGroup type="button" button-style="solid" v-model="form.scopeType">
2021-05-13 10:56:04 +08:00
<Radio label="ALL" disabled>全品类</Radio>
<Radio label="PORTION_GOODS" disabled>指定商品</Radio>
</RadioGroup>
</FormItem>
2021-12-11 13:50:58 +08:00
<FormItem style="width: 100%" v-if="form.scopeType == 'PORTION_GOODS'">
<Table border :columns="columns" :data="form.promotionGoodsList">
2021-05-19 18:22:17 +08:00
<template slot-scope="{ row }" slot="goodsName">
<div>
2021-12-11 13:50:58 +08:00
<a class="mr_10" @click="linkTo(row.goodsId, row.skuId)">{{
row.goodsName
}}</a>
2021-05-19 18:22:17 +08:00
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
<div slot="content">
2021-12-11 13:50:58 +08:00
<vue-qr
:text="wapLinkTo(row.goodsId, row.skuId)"
:margin="0"
colorDark="#000"
colorLight="#fff"
:size="150"
></vue-qr>
2021-05-19 18:22:17 +08:00
</div>
2021-12-11 13:50:58 +08:00
<img
src="../../../assets/qrcode.svg"
style="vertical-align: middle"
class="hover-pointer"
width="20"
height="20"
alt=""
/>
2021-05-19 18:22:17 +08:00
</Poptip>
</div>
2021-05-13 10:56:04 +08:00
</template>
</Table>
</FormItem>
<div>
2021-12-23 17:11:30 +08:00
<Button @click="$router.push({ name: 'full-discount' })">返回</Button>
2021-05-13 10:56:04 +08:00
</div>
</div>
</div>
</Form>
</Card>
</div>
</template>
<script>
import { getPlatformCouponList, getFullDiscountById } from "@/api/promotion";
import { getGoodsSkuData } from "@/api/goods";
2021-12-11 13:50:58 +08:00
import vueQr from "vue-qr";
2021-05-13 10:56:04 +08:00
export default {
2021-12-11 13:50:58 +08:00
name: "add-full-discount",
components: {
2021-12-11 13:50:58 +08:00
"vue-qr": vueQr,
},
2021-05-13 10:56:04 +08:00
data() {
return {
2021-12-11 13:50:58 +08:00
form: {
// 表单
2021-12-21 18:59:45 +08:00
discountType: "fullMinusFlag",
2021-05-13 10:56:04 +08:00
scopeType: "ALL",
promotionGoodsList: [],
},
2021-05-13 18:09:36 +08:00
id: this.$route.query.id, // 活动id
couponList: [], // 优惠券列表
giftList: [], // 赠品列表
giftLoading: false, // 赠品加载状态
2021-05-13 10:56:04 +08:00
columns: [
{
type: "selection",
width: 60,
align: "center",
},
{
title: "商品名称",
2021-05-19 18:22:17 +08:00
slot: "goodsName",
2021-05-13 10:56:04 +08:00
minWidth: 120,
},
{
title: "商品价格",
key: "price",
minWidth: 40,
render: (h, params) => {
2021-12-11 13:50:58 +08:00
return h("div", this.$options.filters.unitPrice(params.row.price, "¥"));
2021-05-13 10:56:04 +08:00
},
},
{
2021-05-17 08:58:35 +08:00
title: "库存",
key: "quantity",
minWidth: 40,
2021-12-11 13:50:58 +08:00
},
2021-05-13 10:56:04 +08:00
],
options: {
disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000;
},
},
};
},
async mounted() {
if (this.id) {
this.getDetail();
}
this.getCouponList();
this.getGiftList();
},
methods: {
getDetail() {
// 获取活动详情
getFullDiscountById(this.id).then((res) => {
let data = res.result;
2021-12-11 13:50:58 +08:00
if (!data.scopeType === "ALL") {
2021-05-13 10:56:04 +08:00
data.promotionGoodsList = [];
}
2021-12-21 18:59:45 +08:00
if (data.fullMinusFlag) {
data.discountType = "fullMinusFlag";
delete data.fullMinusFlag;
2021-05-13 10:56:04 +08:00
} else {
2021-12-21 18:59:45 +08:00
data.discountType = "fullMinusFlag";
delete data.fullRateFlag;
2021-05-13 10:56:04 +08:00
}
data.rangeTime = [];
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
this.form = data;
});
},
getCouponList(query) {
// 优惠券列表
let params = {
pageSize: 10,
pageNumber: 0,
couponName: query,
2021-12-11 13:50:58 +08:00
promotionStatus: "START",
2021-05-13 10:56:04 +08:00
};
this.couponLoading = true;
getPlatformCouponList(params).then((res) => {
this.couponLoading = false;
if (res.success) {
this.couponList = res.result.records;
}
});
},
getGiftList(query) {
// 赠品列表
let params = {
pageSize: 10,
pageNumber: 1,
goodsName: query,
};
this.giftLoading = true;
getGoodsSkuData(params).then((res) => {
this.giftLoading = false;
if (res.success) {
this.giftList = res.result.records;
}
});
},
},
};
</script>
<style lang="scss" scoped>
h4 {
margin-bottom: 10px;
padding: 0 10px;
border: 1px solid #ddd;
background-color: #f8f8f8;
font-weight: bold;
color: #333;
font-size: 14px;
line-height: 40px;
text-align: left;
}
.describe {
font-size: 12px;
margin-left: 10px;
color: #999;
}
</style>