Commit 372082b0 by zhangxw

营销活动联调

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