Commit 372082b0 by zhangxw

营销活动联调

1 parent e0298cc2
import request from "./request";
// 获取营销活动列表数据
export function getMarketingActivityList(data) {
data.method = `dj.api.smarcarlife.purchaseOrder.page`;
data.method = `dj.api.marketing.activity.page`;
return request(data);
}
// 获取营销活动详情
// 获取营销活动详情(基础信息)
export function getMarketingActivityDetail(data) {
data.method = ``;
data.method = `dj.api.marketing.activity.detail`;
return request(data);
}
// 创建编辑营销活动
export function addOrEditMarketingActivity(data) {
data.method = ``;
// 获取营销活动详情(适用门店)
export function getMarketingActivityStores(data) {
data.method = `dj.api.marketing.activity.stores`;
return request(data);
}
// 获取营销活动详情(适用车系)
export function getMarketingActivityCarSeries(data) {
data.method = `dj.api.marketing.activity.carSeries`;
return request(data);
}
// 获取营销活动详情(商品/套餐)
export function getMarketingActivityProducts(data) {
data.method = `dj.api.marketing.activity.products`;
return request(data);
}
// 获取营销活动详情(操作日志)
export function getMarketingActivityLogs(data) {
data.method = `dj.api.marketing.activity.logs`;
return request(data);
}
// 创建营销活动
export function addMarketingActivity(data) {
data.method = `dj.api.marketing.activity.create`;
return request(data);
}
// 编辑营销活动
export function editMarketingActivity(data) {
data.method = `dj.api.marketing.activity.update`;
return request(data);
}
// 获取活动标签列表数据
export function getActivityTagList(data) {
data.method = ``;
data.method = `dj.api.marketing.tag.list`;
return request(data);
}
// 新增活动标签数据
export function addActivityTag(data) {
data.method = `dj.api.marketing.tag.create`;
return request(data);
}
// 新增编辑活动标签数据
export function addOrEditActivityTag(data) {
data.method = ``;
// 重命名活动标签
export function updateActivityTag(data) {
data.method = "dj.api.marketing.tag.rename";
return request(data);
}
// 删除活动标签数据
export function deleteActivityTag(data) {
data.method = ``;
data.method = `dj.api.marketing.tag.delete`;
return request(data);
}
// 根据门店列表获取车系数据
......@@ -36,31 +67,46 @@ export function getCarDataByMerchant(data) {
}
// 根据门店列表获取套餐数据
export function getPackageListByMerchant(data) {
data.method = ``;
data.method = `dj.api.marketing.package.page`;
return request(data);
}
// 根据套餐获取套餐内子商品数据
export function getGoodsDataByPackage(data) {
data.method = `dj.api.marketing.package.items`;
return request(data);
}
// 根据门店列表获取商品数据
export function getGoodsListByMerchant(data) {
data.method = ``;
data.method = `dj.api.marketing.goods.page`;
return request(data);
}
// 根据商品/套餐查询适用门店数据
export function getMerchantByGoodsOrPackage(data) {
data.method = `dj.api.marketing.goods.stores`;
return request(data);
}
// 删除营销活动
export function deleteMarketingActivity(data) {
data.method = `dj.api.smartcarlife.`;
data.method = `dj.api.marketing.activity.delete`;
return request(data);
}
// 暂停营销活动
export function pauseMarketingActivity(data) {
data.method = `dj.api.marketing.activity.pause`;
return request(data);
}
// 暂停恢复营销活动
export function pauseOrResumeMarketingActivity(data) {
data.method = ``;
// 恢复营销活动
export function resumeMarketingActivity(data) {
data.method = `dj.api.marketing.activity.resume`;
return request(data);
}
// 延期营销活动
export function extendMarketingActivity(data) {
data.method = ``;
data.method = `dj.api.marketing.activity.extend`;
return request(data);
}
// 下线营销活动
export function offlineMarketingActivity(data) {
data.method = ``;
data.method = `dj.api.marketing.activity.cease`;
return request(data);
}
......@@ -47,6 +47,8 @@ function request(
} else if (params.method.includes("merchants.api.open.createMerchantWithPermissions")) {
/** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */
apiName = "oaapproval";
} else if (params.method.includes("dj.api.marketing")) {
apiName = "strategy";
} else {
// console.log(params.method.split(".api"))
apiName = params.method.split(".api")[0];
......
......@@ -125,6 +125,8 @@ export const routerName = {
{
authId: "9220109",
parentId: "92203",
category: "Button",
type: "primary",
label: "再次创建",
handle: "handleRecreate",
},
......
......@@ -33,26 +33,39 @@
</div>
<!-- 门店列表表格 -->
<el-table ref="selectingTable"
height="360"
border
:data="selectingData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<el-table-column align="center"
label="门店名称"
prop="merchantName" />
<el-table-column align="center"
label="门店商户号"
prop="merchantId" />
<el-table-column align="center"
label="门店地址"
prop="merchantAddress"
show-overflow-tooltip />
</el-table>
<div v-loading="tableLoading" class="table-wrapper">
<el-table ref="selectingTable"
height="360"
border
:data="selectingData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<el-table-column align="center"
label="门店名称"
min-width="200">
<template #default="scope">
{{ scope.row.merchantName != null && scope.row.merchantName !== "" ? scope.row.merchantName : "-" }}
</template>
</el-table-column>
<el-table-column align="center"
label="门店商户号"
width="150">
<template #default="scope">
{{ scope.row.merchantId != null && scope.row.merchantId !== "" ? scope.row.merchantId : "-" }}
</template>
</el-table-column>
<el-table-column align="center"
label="门店地址"
min-width="200">
<template #default="scope">
{{ scope.row.merchantAddress != null && scope.row.merchantAddress !== "" ? scope.row.merchantAddress : "-" }}
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<el-pagination layout="prev, pager, next"
......@@ -109,6 +122,7 @@
</el-button>
</div>
</template>
</div>
</el-dialog>
</template>
......@@ -140,6 +154,8 @@ export default {
total: 0,
currentPage: 1,
pageSize: 10,
// 表格加载状态
tableLoading: false,
};
},
......@@ -175,13 +191,19 @@ export default {
merchantId: this.searchForm.merchantId || undefined,
queryAbsoluteEnable: 1,
};
this.tableLoading = true;
getMerchantListByScene(params).then((res) => {
res?.list?.forEach((val) => {
val.merchantAddress = val.merchantAddress || "-";
});
const list = res.list || [];
this.selectingData = list;
this.total = res.total || 0;
this.$nextTick(() => {
this.recoverySelection();
});
}).finally(() => {
this.tableLoading = false;
});
},
......@@ -307,6 +329,11 @@ export default {
flex: 1;
}
.table-wrapper {
flex: 1;
min-height: 0;
}
.el-pagination {
margin-top: 12px;
text-align: right;
......
......@@ -4,20 +4,20 @@
<div class="table-header">
<span class="th th-expand"></span>
<span class="th th-index">排序</span>
<span class="th th-name">
<span class="th th-name" style="display: flex;flex-flow: row;align-items: center !important;">
选项卡名称
<el-tooltip content="在展业助手App中对外展示的套餐或商品名称" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-desc">
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低限价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
......@@ -43,72 +43,74 @@
<!-- 数据行 -->
<div v-for="(item, index) in list"
:key="item.id || index"
:key="index"
class="table-item">
<!-- 主行 -->
<div class="table-row"
:class="{ 'is-expanded': expandedRows.includes(item.id || index) }">
:class="{ 'is-expanded': expandedRows.includes(index) }">
<span class="td td-expand">
<i v-if="item.type === 'package' && item.products && item.products.length"
<i v-if="item.productType == 0 && item.packageItems && item.packageItems.length"
class="expand-icon"
:class="[expandedRows.includes(item.id || index) ? 'el-icon-arrow-down' : 'el-icon-arrow-right']"
@click="toggleExpand(item.id || index)" />
:class="[expandedRows.includes(index) ? 'el-icon-arrow-down' : 'el-icon-arrow-right']"
@click="toggleExpand(index)" />
</span>
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.packageName || item.upgradeGoodsName || item.name }}</span>
<div class="sub-text">{{ item.packageCode || item.merchantGoodsCode || item.code }}</div>
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.packageCode }}</div>
</span>
<span class="td td-desc">{{ item.desc || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.sellPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minSellPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountTotal) }}</span>
<span class="td td-incentive">{{ priceFilter(item.incentive) }}</span>
<span class="td td-main">{{ item.isMain ? '是' : '否' }}</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImage"
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImage]"
:src="item.mainImage" />
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImage"
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImage]"
:src="item.thumbImage" />
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImage"
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImage]"
:src="item.detailImage" />
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
<!-- 子商品展开区(仅套餐类型) -->
<div v-if="(item.type === 'package') && (item.products && item.products.length) && expandedRows.includes(item.id || index)"
<div v-if="(item.productType == 0) && (item.packageItems && item.packageItems.length) && expandedRows.includes(index)"
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">产品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低限价</span>
<span class="sh-col sh-col-min">最低售价</span>
<span class="sh-col sh-col-discount">优惠价</span>
</div>
<div v-for="(sub, subIdx) in item.products"
<div v-for="(sub, subIdx) in item.packageItems"
:key="subIdx"
class="sub-table-row">
<span class="sc sc-name">{{ sub.upgradeGoodsName || '-' }}</span>
<span class="sc sc-id">{{ sub.goodsInfo ? sub.goodsInfo.goodsCode : '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.sellPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minSellPrice) }}</span>
<span class="sc sc-name">{{ sub.goodsName || '-' }}</span>
<span class="sc sc-name">{{ sub.goodsAlias || '-' }}</span>
<span class="sc sc-id">{{ sub.goodsCode || '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.currentPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minimumPrice) }}</span>
<span class="sc sc-discount">{{ priceFilter(sub.discountPrice) }}</span>
</div>
</div>
......@@ -239,8 +241,8 @@ export default {
align-items: flex-start !important;
}
.th-desc,
.td-desc {
.th-tabDescription,
.td-tabDescription {
min-width: 160px;
flex: 1.5;
}
......
......@@ -10,14 +10,14 @@
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-desc">
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低限价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
......@@ -50,65 +50,67 @@
<div class="table-row"
:class="{ 'is-expanded': expandedRows.includes(item.id || index) }">
<span class="td td-expand">
<i v-if="item.products && item.products.length"
<i v-if="item.packageItems && item.packageItems.length"
class="expand-icon"
:class="[expandedRows.includes(item.id || index) ? 'el-icon-arrow-down' : 'el-icon-arrow-right']"
@click="toggleExpand(item.id || index)" />
</span>
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.packageName || item.name }}</span>
<div class="sub-text">{{ item.packageCode || item.code }}</div>
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.packageCode }}</div>
</span>
<span class="td td-desc">{{ item.desc || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.sellPrice || item.price) }}</span>
<span class="td td-min">{{ priceFilter(item.minSellPrice || item.minPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountTotal || item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.incentive) }}</span>
<span class="td td-main">{{ item.isMain ? '是' : '否' }}</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImage"
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImage]"
:src="item.mainImage" />
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImage"
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImage]"
:src="item.thumbImage" />
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImage"
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImage]"
:src="item.detailImage" />
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
<!-- 子商品展开区 -->
<div v-if="(item.products && item.products.length) && expandedRows.includes(item.id || index)"
<div v-if="(item.packageItems && item.packageItems.length) && expandedRows.includes(item.id || index)"
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">产品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低限价</span>
<span class="sh-col sh-col-min">最低售价</span>
<span class="sh-col sh-col-discount">优惠价</span>
</div>
<div v-for="(sub, subIdx) in item.products"
<div v-for="(sub, subIdx) in item.packageItems"
:key="subIdx"
class="sub-table-row">
<span class="sc sc-name">{{ sub.upgradeGoodsName || '-' }}</span>
<span class="sc sc-id">{{ sub.goodsInfo ? sub.goodsInfo.goodsCode : '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.sellPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minSellPrice) }}</span>
<span class="sc sc-name">{{ sub.goodsName || '-' }}</span>
<span class="sc sc-name">{{ sub.goodsAlias || '-' }}</span>
<span class="sc sc-id">{{ sub.goodsCode || '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.currentPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minimumPrice) }}</span>
<span class="sc sc-discount">{{ priceFilter(sub.discountPrice) }}</span>
</div>
</div>
......@@ -238,8 +240,8 @@ export default {
flex-flow: column;
}
.th-desc,
.td-desc {
.th-tabDescription,
.td-tabDescription {
min-width: 160px;
flex: 1.5;
}
......
......@@ -9,14 +9,14 @@
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-desc">
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低限价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
......@@ -46,37 +46,37 @@
class="table-row">
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.upgradeGoodsName || item.name }}</span>
<div class="sub-text">{{ item.merchantGoodsCode || item.code }}</div>
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.goodsCode }}</div>
</span>
<span class="td td-desc">{{ item.desc || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.price) }}</span>
<span class="td td-min">{{ priceFilter(item.minPrice) }}</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.incentive) }}</span>
<span class="td td-main">{{ item.isMain ? '是' : '否' }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImage"
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImage]"
:src="item.mainImage" />
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImage"
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImage]"
:src="item.thumbImage" />
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImage"
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImage]"
:src="item.detailImage" />
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
......@@ -178,8 +178,8 @@ export default {
flex-flow: column;
}
.th-desc,
.td-desc {
.th-tabDescription,
.td-tabDescription {
min-width: 160px;
flex: 1.5;
}
......
......@@ -71,7 +71,7 @@
@tab-remove="handleRemoveSeries">
<el-tab-pane v-for="series in seriesList"
:key="series.id"
:name="series.id">
:name="`${series.id}`">
<template #label>
<span>{{ series.name }}</span>
</template>
......@@ -99,7 +99,7 @@
@look-img="handleImgLook"
@oss-upload="handleChildOssUpload"
@remove-direct-package="index => handleRemovePackage(series.id, index)"
@sort-change="(newList) => handleSeriesSort(series.id, 'package', newList)"
@sort-change="(newList) => handleSeriesSort(series.id, '0', newList)"
@view-sale-stores="$emit('view-sale-stores', $event)" />
</el-tab-pane>
......@@ -113,7 +113,7 @@
@look-img="handleImgLook"
@oss-upload="handleChildOssUpload"
@remove-direct-product="index => handleRemovePackage(series.id, index)"
@sort-change="(newList) => handleSeriesSort(series.id, 'product', newList)"
@sort-change="(newList) => handleSeriesSort(series.id, '1', newList)"
@view-sale-stores="$emit('view-sale-stores', $event)" />
</el-tab-pane>
</el-tabs>
......@@ -127,7 +127,7 @@
@look-img="handleImgLook"
@oss-upload="handleChildOssUpload"
@remove-direct-package="index => handleRemovePackage(series.id, index)"
@sort-change="(newList) => handleSeriesSort(series.id, 'package', newList)"
@sort-change="(newList) => handleSeriesSort(series.id, '0', newList)"
@view-sale-stores="$emit('view-sale-stores', $event)" />
<GoodsList v-else-if="seriesSplitMap[series.id] && seriesSplitMap[series.id].products.length"
ref="packageTable"
......@@ -135,7 +135,7 @@
@look-img="handleImgLook"
@oss-upload="handleChildOssUpload"
@remove-direct-product="index => handleRemovePackage(series.id, index)"
@sort-change="(newList) => handleSeriesSort(series.id, 'product', newList)"
@sort-change="(newList) => handleSeriesSort(series.id, '1', newList)"
@view-sale-stores="$emit('view-sale-stores', $event)" />
</template>
</div>
......@@ -213,11 +213,11 @@ export default {
computed: {
// 直接模式:套餐列表(缓存过滤结果)
directPackageList() {
return this.directPackages.filter(p => p.type === "package");
return this.directPackages.filter(p => p.productType === 0);
},
// 直接模式:商品列表
directProductList() {
return this.directPackages.filter(p => p.type === "product");
return this.directPackages.filter(p => p.productType === 1);
},
// 各车系的套餐/商品缓存 { seriesId: { packages: [], products: [] } }
seriesSplitMap() {
......@@ -225,8 +225,8 @@ export default {
Object.keys(this.seriesPackages).forEach((seriesId) => {
const list = this.seriesPackages[seriesId] || [];
map[seriesId] = {
packages: list.filter(p => p.type === "package"),
products: list.filter(p => p.type === "product"),
packages: list.filter(p => p.productType === 0),
products: list.filter(p => p.productType === 1),
};
});
return map;
......@@ -259,10 +259,10 @@ export default {
seriesList: {
handler(val) {
if (val.length && !this.activeSeriesId) {
this.activeSeriesId = val[0].id;
this.activeSeriesId = `${val[0].id}`;
}
if (val.length && !val.find(s => s.id === this.activeSeriesId)) {
this.activeSeriesId = val[0].id;
this.activeSeriesId = `${val[0].id}`;
}
},
immediate: true,
......@@ -317,7 +317,7 @@ export default {
this.$set(row, "discountPrice", value);
},
// 优惠价失焦校验:必须 >= 最低限价 且 <= 现售价
// 优惠价失焦校验:必须 >= 最低售价 且 <= 现售价
handleDiscountPriceBlur(row) {
const discountPrice = Number.parseFloat(row.discountPrice);
const minPrice = Number.parseFloat(row.minPrice);
......@@ -325,7 +325,7 @@ export default {
if (row.discountPrice !== "" && row.discountPrice != null && !isNaN(discountPrice)) {
if (!isNaN(minPrice) && discountPrice < minPrice) {
this.$message.error(`优惠价不能低于最低限价¥${minPrice}`);
this.$message.error(`优惠价不能低于最低售价¥${minPrice}`);
this.$set(row, "discountPriceError", true);
return;
}
......@@ -384,6 +384,18 @@ export default {
errorDirectTabs.push("direct_product");
}
}
// 直接模式:只有套餐或只有商品时,组件用的是 ref="directTable"
const directTable = this.$refs.directTable;
if (directTable) {
const tableRefs = Array.isArray(directTable) ? directTable : [directTable];
tableRefs.forEach((ref) => {
if (ref && ref.validate) {
const ok = ref.validate();
if (!ok)
isValid = false;
}
});
}
// 2. 车系模式:遍历所有子组件实例调用 validate
if (this.$refs.packageTable) {
......@@ -404,10 +416,10 @@ export default {
const subErrors = [];
list.forEach((pkg) => {
const itemError = pkg.nameError || pkg.descError || pkg.discountPriceError || pkg.incentiveError || pkg.mainImageError || pkg.thumbImageError || pkg.detailImageError;
const itemError = pkg.tabNameError || pkg.tabDescriptionError || pkg.discountPriceError || pkg.salesIncentiveError || pkg.mainImageUrlError || pkg.thumbImageUrlError || pkg.detailImageUrlError;
if (itemError) {
hasError = true;
subErrors.push(pkg.type);
subErrors.push(pkg.productType);
}
});
......@@ -421,7 +433,7 @@ export default {
if (!isValid && !this.seriesList.length) {
this.$message.error("请检查已选商品/套餐的必填项");
} else if (errorSeriesIds.size) {
this.$message.error("部分车系的套餐/商品信息填写不完整,请检查标红项");
this.$message.error("部分车系的套餐/商品信息填写不完整");
}
return isValid;
......@@ -434,7 +446,7 @@ export default {
// 外部调用:设置激活的 tab
setActiveTab(seriesId) {
this.activeSeriesId = seriesId;
this.activeSeriesId = `${seriesId}`;
},
// 删除车系
......@@ -445,7 +457,7 @@ export default {
type: "warning",
})
.then(() => {
const series = this.seriesList.find(s => s.id === seriesId);
const series = this.seriesList.find(s => s.id == seriesId);
this.$emit("remove-series", series);
})
.catch(() => {});
......@@ -487,7 +499,7 @@ export default {
handleDirectProductSort(newList) {
if (!newList || !newList.length || !Array.isArray(this.directPackages))
return;
const packages = (this.directPackages || []).filter(p => p && p.type === "package");
const packages = (this.directPackages || []).filter(p => p && p.productType === 0);
const validNewList = newList.filter(item => item != null);
this.directPackages.splice(0, this.directPackages.length, ...packages, ...validNewList);
......@@ -498,20 +510,20 @@ export default {
handleDirectPackageSort(newList) {
if (!newList || !newList.length || !Array.isArray(this.directPackages))
return;
const products = (this.directPackages || []).filter(p => p && p.type === "product");
const products = (this.directPackages || []).filter(p => p && p.productType === 1);
const validNewList = newList.filter(item => item != null);
this.directPackages.splice(0, this.directPackages.length, ...validNewList, ...products);
},
// 车系模式:套餐/商品列表拖拽排序
handleSeriesSort(seriesId, type, newList) {
handleSeriesSort(seriesId, productType, newList) {
const list = this.seriesPackages[seriesId];
if (!list || !newList || !newList.length || !Array.isArray(list))
return;
const otherType = type === "package" ? "product" : "package";
const others = list.filter(p => p && p.type === otherType);
const otherType = productType === 0 ? 1 : 0;
const others = list.filter(p => p && p.productType === otherType);
const validNewList = newList.filter(item => item != null);
if (type === "package") {
if (productType === 0) {
list.splice(0, list.length, ...validNewList, ...others);
} else {
list.splice(0, list.length, ...others, ...validNewList);
......
......@@ -6,50 +6,52 @@
:close-on-click-modal="false"
:visible.sync="dialogVisible"
@close="handleClose">
<el-form ref="formRef"
label-width="80px"
size="small"
:model="form"
:rules="rules">
<el-form-item label="品牌" prop="brandId">
<el-select v-model="form.brandId"
placeholder="请选择品牌"
style="width: 100%"
@change="handleBrandChange">
<el-option v-for="item in brandList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="子品牌" prop="subBrandId">
<el-select v-model="form.subBrandId"
placeholder="请选择子品牌"
style="width: 100%"
:disabled="!form.brandId"
@change="handleSubBrandChange">
<el-option v-for="item in subBrandList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="车系" prop="seriesId">
<el-select v-model="form.seriesId"
placeholder="请选择车系"
style="width: 100%"
:disabled="!form.subBrandId">
<el-option v-for="item in seriesList"
:key="item.id"
:disabled="item.disabled"
:label="item.name"
:value="item.id">
<span>{{ item.name }}</span>
<span v-if="item.disabled" style="color: #c0c4cc; margin-left: 8px">(已添加)</span>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div v-loading="formLoading" class="form-wrapper">
<el-form ref="formRef"
label-width="80px"
size="small"
:model="form"
:rules="rules">
<el-form-item label="品牌" prop="brandId">
<el-select v-model="form.brandId"
placeholder="请选择品牌"
style="width: 100%"
@change="handleBrandChange">
<el-option v-for="item in brandList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="子品牌" prop="subBrandId">
<el-select v-model="form.subBrandId"
placeholder="请选择子品牌"
style="width: 100%"
:disabled="!form.brandId"
@change="handleSubBrandChange">
<el-option v-for="item in subBrandList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="车系" prop="seriesId">
<el-select v-model="form.seriesId"
placeholder="请选择车系"
style="width: 100%"
:disabled="!form.subBrandId">
<el-option v-for="item in seriesList"
:key="item.id"
:disabled="item.disabled"
:label="item.name"
:value="item.id">
<span>{{ item.name }}</span>
<span v-if="item.disabled" style="color: #c0c4cc; margin-left: 8px">(已添加)</span>
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
......@@ -63,6 +65,7 @@
</el-button>
</div>
</template>
</div>
</el-dialog>
</template>
......@@ -101,90 +104,12 @@ export default {
seriesId: [{ required: true, message: "请选择车系", trigger: "change" }],
},
// 模拟树形结构数据(后续替换为接口请求)
treeData: [
{
brandId: 1,
brandName: "奥迪",
childList: [
{
childId: 101,
childName: "一汽奥迪",
seriesList: [
{ seriesId: 1001, seriesName: "奥迪A4L" },
{ seriesId: 1002, seriesName: "奥迪A6L" },
{ seriesId: 1003, seriesName: "奥迪Q5L" },
{ seriesId: 1004, seriesName: "奥迪Q8" },
],
},
{
childId: 102,
childName: "上汽奥迪",
seriesList: [
{ seriesId: 1005, seriesName: "奥迪A7L" },
{ seriesId: 1006, seriesName: "奥迪Q6" },
],
},
{
childId: 103,
childName: "奥迪进口",
seriesList: [
{ seriesId: 1007, seriesName: "奥迪RS6 Avant" },
{ seriesId: 1008, seriesName: "奥迪RS7" },
],
},
],
},
{
brandId: 2,
brandName: "宝马",
childList: [
{
childId: 201,
childName: "华晨宝马",
seriesList: [
{ seriesId: 2001, seriesName: "宝马3系" },
{ seriesId: 2002, seriesName: "宝马5系" },
{ seriesId: 2003, seriesName: "宝马X3" },
],
},
{
childId: 202,
childName: "进口宝马",
seriesList: [
{ seriesId: 2004, seriesName: "宝马7系" },
{ seriesId: 2005, seriesName: "宝马X5" },
{ seriesId: 2006, seriesName: "宝马X7" },
],
},
],
},
{
brandId: 3,
brandName: "奔驰",
childList: [
{
childId: 301,
childName: "北京奔驰",
seriesList: [
{ seriesId: 3001, seriesName: "奔驰C级" },
{ seriesId: 3002, seriesName: "奔驰E级" },
{ seriesId: 3003, seriesName: "奔驰GLC" },
],
},
{
childId: 302,
childName: "奔驰进口",
seriesList: [
{ seriesId: 3004, seriesName: "奔驰S级" },
{ seriesId: 3005, seriesName: "奔驰GLE" },
],
},
],
},
],
treeData: [],
brandList: [],
subBrandList: [],
seriesList: [],
// 表单加载状态
formLoading: false,
};
},
......@@ -211,15 +136,15 @@ export default {
methods: {
// 加载品牌列表
loadBrandList() {
// TODO: 替换为接口请求
// getCarDataByMerchant({ merchantList: this.merchantList?.map((val) => {
// return val.merchantId;
// }) }).then((res) => {
// console.log("2222");
// this.brandList = res?.map(item => ({ id: item.brandId, name: item.brandName })) || [];
// });
// getBrandTree().then(res => { this.treeData = res.data })
this.brandList = this.treeData.map(item => ({ id: item.brandId, name: item.brandName }));
this.formLoading = true;
getCarDataByMerchant({ merchantIdList: this.merchantList?.map((val) => {
return val.merchantId;
}) }).then((res) => {
this.brandList = res?.map(item => ({ id: item.brandId, name: item.brandName })) || [];
this.treeData = res || [];
}).finally(() => {
this.formLoading = false;
});
},
// 品牌切换
......@@ -228,7 +153,7 @@ export default {
this.form.seriesId = "";
this.subBrandList = [];
this.seriesList = [];
console.log(this.treeData);
const brand = this.treeData.find(item => item.brandId === brandId);
if (brand && brand.childList) {
this.subBrandList = brand.childList.map(item => ({ id: item.childId, name: item.childName }));
......@@ -317,6 +242,10 @@ export default {
padding: 20px;
}
.form-wrapper {
min-height: 120px;
}
::v-deep .el-form-item__label {
font-weight: 500;
color: #303133;
......
......@@ -19,7 +19,7 @@
width="120" />
<el-table-column label="门店地址"
min-width="200"
prop="address"
prop="merchantAddress"
show-overflow-tooltip />
</el-table>
</div>
......@@ -34,6 +34,8 @@
</template>
<script>
import { getMerchantByGoodsOrPackage } from "@/api/marketingActivity";
export default {
name: "StoreListDialog",
......@@ -42,13 +44,20 @@ export default {
type: Boolean,
default: false,
},
storeList: {
storeRow: {
type: Object,
default: () => {},
},
merchantList: {
type: Array,
default: () => [],
},
},
data() {
return {};
return {
storeList: [],
};
},
computed: {
......@@ -62,7 +71,27 @@ export default {
},
},
watch: {
visible(val) {
if (val) {
this.getMerchantData();
}
},
},
methods: {
getMerchantData() {
const params = {
goodsCode: this.storeRow.goodsCode,
packageCode: this.storeRow.packageId,
merchantIds: this.merchantList?.map((val) => {
return val.merchantId;
}),
};
getMerchantByGoodsOrPackage(params).then((res) => {
this.storeList = res || [];
});
},
handleClose() {
this.dialogVisible = false;
},
......
......@@ -12,11 +12,11 @@
<el-table-column label="标签名称" prop="label">
<template #default="scope">
<el-input v-if="scope.row.editing"
v-model="scope.row.editLabel"
v-model.trim="scope.row.editLabel"
maxlength="10"
size="mini"
@keyup.enter.native="confirmEdit(scope.row)" />
<span v-else>{{ scope.row.label }}</span>
<span v-else>{{ scope.row.tagName }}</span>
</template>
</el-table-column>
<el-table-column align="center"
......@@ -64,7 +64,7 @@
<!-- 新增标签输入行 -->
<div v-if="showAddInput" class="tag-add-row">
<el-input v-model="newTagName"
<el-input v-model.trim="newTagName"
maxlength="10"
placeholder="请输入标签名称"
size="small"
......@@ -83,7 +83,7 @@
</template>
<script>
import { addOrEditActivityTag, deleteActivityTag, getActivityTagList } from "@/api/marketingActivity";
import { addActivityTag, deleteActivityTag, getActivityTagList, updateActivityTag } from "@/api/marketingActivity";
export default {
name: "TagManageDialog",
......@@ -125,6 +125,11 @@ export default {
this.initTableData();
}
},
tagList(val) {
if (val) {
this.initTableData();
}
},
},
methods: {
......@@ -132,19 +137,17 @@ export default {
initTableData() {
this.showAddInput = false;
this.newTagName = "";
// 假数据开始
this.tagTableData = this.tagList.map(item => ({
...item,
editing: false,
editLabel: "",
}));
// 假数据结束
},
// 开始编辑
startEdit(row) {
row.editing = true;
row.editLabel = row.label;
row.editLabel = row.tagName;
},
// 确认编辑
......@@ -153,24 +156,12 @@ export default {
this.$message.warning("标签名称不能为空");
return;
}
// 检查是否重复
// const isDuplicate = this.tagTableData.some(item => item.label === row.editLabel.trim() && item.value !== row.value);
// if (isDuplicate) {
// this.$message.warning("标签名称已存在");
// return;
// }
// addOrEditActivityTag({}).then(() => {
// row.label = row.editLabel.trim();
// row.editing = false;
// this.$message.success("修改成功");
// this.emitChange();
// });
// 假数据开始
row.label = row.editLabel.trim();
row.editing = false;
this.$message.success("修改成功");
this.emitChange();
// 假数据结束
updateActivityTag({ tagId: row.tagId, tagName: row.editLabel }).then(() => {
row.label = row.editLabel.trim();
row.editing = false;
this.$message.success("修改成功");
this.emitChange();
});
},
// 取消编辑
......@@ -181,15 +172,10 @@ export default {
// 删除标签
handleDeleteTag(row) {
// deleteActivityTag({}).then((res) => {
// this.$message.success("删除成功");
// this.emitChange();
// });
// 假数据开始
this.tagTableData = this.tagTableData.filter(item => item.value !== row.value);
this.$message.success("删除成功");
this.emitChange();
// 假数据结束
deleteActivityTag({ tagId: row.tagId }).then((res) => {
this.$message.success("删除成功");
this.emitChange();
});
},
// 新增标签
......@@ -198,32 +184,12 @@ export default {
this.$message.warning("请输入标签名称");
return;
}
// 检查是否重复
// if (this.tagTableData.some(item => item.label === this.newTagName.trim())) {
// this.$message.warning("标签名称已存在");
// return;
// }
// 假数据开始
const newId = String(Date.now());
this.tagTableData.push({
label: this.newTagName.trim(),
value: newId,
editing: false,
editLabel: "",
addActivityTag({ tagName: this.newTagName }).then((res) => {
this.newTagName = "";
this.showAddInput = false;
this.$message.success("添加成功");
this.emitChange();
});
// 假数据结束
// addOrEditActivityTag({}).then((res) => {
// this.newTagName = "";
// this.showAddInput = false;
// this.$message.success("添加成功");
// this.emitChange();
// });
// 假数据开始
this.newTagName = "";
this.showAddInput = false;
this.$message.success("添加成功");
this.emitChange();
// 假数据结束
},
// 取消新增
......@@ -235,19 +201,12 @@ export default {
// 触发变更事件
emitChange() {
// 获取列表
// getActivityTagList({}).then((res) => {
// this.$emit(
// "change",
// res || [],
// );
// });
this.$emit(
"change",
this.tagTableData.map(item => ({
label: item.label,
value: item.value,
})),
);
getActivityTagList({}).then((res) => {
this.$emit(
"change",
res || [],
);
});
},
},
};
......
......@@ -38,33 +38,12 @@
:table-data="tableData"
:table-params="tableParams">
<template #marketingStage="scope">
<span :class="scope.scope.marketingStage == 1 ? 'pre-sales' : 'after-sales'">{{ scope.scope.marketingStage == 1 ? '售前' : '售后' }}</span>
<span :class="scope.scope.marketingStage == 0 ? 'pre-sales' : 'after-sales'">{{ scope.scope.marketingStage == 0 ? '售前' : '售后' }}</span>
</template>
<template #applicableStoreCount="scope">
<div v-if="scope.scope.merchantGoodsRefList && scope.scope.merchantGoodsRefList.length > 0">
<el-popover placement="top"
trigger="hover"
width="200">
<div class="merchant-name-box">
<div class="title">
适用门店
</div>
<div v-for="(subItem, subIndex) in scope.scope.merchantGoodsRefList"
:key="subIndex"
class="merchant-item">
{{ subItem.merchantName }}
</div>
</div>
<template #reference>
<div>
<img src="../../goods/grounding/images/merchant_icon.png" style="width: 14px; height: 13px; margin-right: 5px" />
<span>x {{ scope.scope.merchantGoodsRefList.length }}</span>
</div>
</template>
</el-popover>
</div>
<div v-else>
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">{{ '-' }}</span>
<div>
<img src="../../goods/grounding/images/merchant_icon.png" style="width: 14px; height: 13px; margin-right: 5px" />
<span>x {{ scope.scope.storeCount }}</span>
</div>
</template>
<template #auth-button="scope">
......@@ -78,16 +57,17 @@
<script>
import { mapActions } from "vuex";
import { getMarketingActivityList } from "@/api/marketingActivity.js";
import { deepClone } from "@/common/util";
// import reportTrackPageMixin from '@/mixins/reportTrackPageMixin'
import { deepClone, Util } from "@/common/util";
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin";
export default {
name: "MarketingActivity",
// mixins: [reportTrackPageMixin],
mixins: [reportTrackPageMixin],
data() {
return {
searchForm: {
activityName: "",
activityStatus: "",
status: "",
marketingStage: "",
activityTimeStr: [],
},
......@@ -102,7 +82,7 @@ export default {
},
{
label: "活动状态",
name: "activityStatus",
name: "status",
type: "select",
optionList: [],
optionId: "value",
......@@ -126,19 +106,19 @@ export default {
},
],
// 活动状态选项
activityStatusOptions: [
statusOptions: [
{ value: "", label: "全部" },
{ value: 0, label: "未开始" },
{ value: 1, label: "进行中" },
{ value: 2, label: "已暂停" },
{ value: 3, label: "已结束" },
{ value: 4, label: "已下线" },
{ value: 4, label: "已结束" },
{ value: 3, label: "已下线" },
],
// 营销阶段选项
marketingStageOptions: [
{ value: "", label: "全部" },
{ value: 1, label: "售前" },
{ value: 2, label: "售后" },
{ value: 0, label: "售前" },
{ value: 1, label: "售后" },
],
getListApi: getMarketingActivityList,
// 表格参数
......@@ -171,23 +151,23 @@ export default {
},
{
label: "活动状态",
prop: "activityStatus",
prop: "status",
className: (cellValue) => {
return {
0: "yellowSpot",
1: "redSpot",
2: "greenSpot",
3: "ashSpot",
1: "greenSpot",
2: "redSpot",
4: "ashSpot",
3: "ashSpot",
}[cellValue.status];
},
formatter: (cellValue) => {
return {
0: "未开始",
1: "已暂停",
2: "进行中",
3: "已结束",
4: "已下线",
1: "进行中",
2: "已暂停",
4: "已结束",
3: "已下线",
}[cellValue.status];
},
},
......@@ -199,7 +179,7 @@ export default {
mounted() {
this.initOptions();
// this.onPageShow()
this.onPageShow();
},
methods: {
......@@ -210,8 +190,8 @@ export default {
// 初始化下拉选项
initOptions() {
this.showFormData.forEach((item, index) => {
if (item.name === "activityStatus") {
this.$set(this.showFormData[index], "optionList", deepClone(this.activityStatusOptions));
if (item.name === "status") {
this.$set(this.showFormData[index], "optionList", deepClone(this.statusOptions));
}
if (item.name === "marketingStage") {
this.$set(this.showFormData[index], "optionList", deepClone(this.marketingStageOptions));
......@@ -228,9 +208,13 @@ export default {
filterSearchTime() {
this.tableSearchForm = deepClone(this.searchForm);
this.$refs.activityTable.page.pageNum = this.$refs.activityTable.page.currentPage;
if (this.tableSearchForm.activityTimeStr && this.tableSearchForm.activityTimeStr.length === 2) {
this.tableSearchForm.startTime = this.tableSearchForm.activityTimeStr[0];
this.tableSearchForm.endTime = this.tableSearchForm.activityTimeStr[1];
this.tableSearchForm.startTime = Util.dateFormate(
this.tableSearchForm.activityTimeStr[0],
"YYYY-MM-DD HH:mm:ss",
);
this.tableSearchForm.endTime = Util.dateFormate(this.tableSearchForm.activityTimeStr[1], "YYYY-MM-DD") + " 23:59:59";
}
delete this.tableSearchForm.activityTimeStr;
},
......@@ -256,13 +240,12 @@ export default {
// 查看详情
handleDetail(row) {
console.log("查看详情", row);
this.close({ tagName: "/viewMarketingActivity" });
// 埋点 查看活动详情
// this.setReportTrackData(0, "marketing-activity-detail", {activityId: row.id});
this.setReportTrackData(0, "marketing-activity-detail", { activityId: row.activityId });
this.$router.push({
name: "viewMarketingActivity",
query: { id: row.id },
query: { activityId: row.activityId },
});
},
},
......@@ -295,6 +278,7 @@ export default {
border-radius: 4px;
border-color: #f59619;
color: #f59619;
border: 1px solid #f59619;
}
.after-sales {
display: inline-block;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!