mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
增加二级分销相关设置以及页面
This commit is contained in:
@@ -3,7 +3,7 @@ var BASE = {
|
||||
* @description api请求基础路径
|
||||
*/
|
||||
API_DEV: {
|
||||
seller: "https://admin-api.pickmall.cn",
|
||||
seller: "http://127.0.0.1:8887",
|
||||
},
|
||||
API_PROD: {
|
||||
seller: "https://admin-api.pickmall.cn",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// 统一请求路径前缀在libs/axios.js中修改
|
||||
import {getRequest, postRequest, putRequest, deleteRequest, importRequest, getRequestWithNoToken} from '@/libs/axios';
|
||||
import {getRequest, postRequest, postRequestWithNoForm, putRequest, deleteRequest, importRequest, getRequestWithNoToken} from '@/libs/axios';
|
||||
|
||||
|
||||
//获取分销商品列表
|
||||
@@ -18,22 +18,32 @@ export const distributionGoodsCheck = (id,param) => {
|
||||
return putRequest(`/distribution/goods/checked/${id}`,param)
|
||||
}
|
||||
|
||||
// 批量选择分销商品
|
||||
export const distributionGoodsBatchCheck = (items) => {
|
||||
return postRequestWithNoForm('/distribution/goods/checked/batch', { items })
|
||||
}
|
||||
|
||||
//查询分销商
|
||||
// 修改分销商品佣金
|
||||
export const updateDistributionGoodsCommission = (id, params) => {
|
||||
return putRequest(`/distribution/goods/${id}/commission`, params)
|
||||
}
|
||||
|
||||
|
||||
//查询分销员
|
||||
export const getDistributionListData = (params) => {
|
||||
return getRequest('/distribution/getByPage', params)
|
||||
}
|
||||
//审核分销商
|
||||
//审核分销员
|
||||
export const auditDistribution = (id, params) => {
|
||||
return putRequest(`/distribution/audit/${id}`, params)
|
||||
}
|
||||
|
||||
// 清退分销商
|
||||
// 清退分销员
|
||||
export const retreatDistribution = (id, params) => {
|
||||
return putRequest(`/distribution/retreat/${id}`, params)
|
||||
}
|
||||
|
||||
// 恢复分销商
|
||||
// 恢复分销员
|
||||
export const resumeDistribution = (id, params) => {
|
||||
return putRequest(`/distribution/resume/${id}`, params)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 分销商状态列表
|
||||
// 分销员状态列表
|
||||
export const distributionStatusList= [
|
||||
{
|
||||
value:'APPLY',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="search">
|
||||
<el-card>
|
||||
<el-form
|
||||
ref="searchForm"
|
||||
@@ -17,13 +17,59 @@
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌" prop="brandId">
|
||||
<el-select
|
||||
v-model="searchForm.brandId"
|
||||
placeholder="请选择商品品牌"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
>
|
||||
<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="storeCategoryPath">
|
||||
<el-cascader
|
||||
v-model="searchForm.storeCategoryPath"
|
||||
:options="shopCategoryList"
|
||||
:props="shopCategoryProps"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择店铺分类"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品类型" prop="goodsType">
|
||||
<el-select
|
||||
v-model="searchForm.goodsType"
|
||||
placeholder="请选择商品类型"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option label="实物商品" value="PHYSICAL_GOODS" />
|
||||
<el-option label="虚拟商品" value="VIRTUAL_GOODS" />
|
||||
<el-option label="电子卡券" value="E_COUPON" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="search-btn" @click="handleSearch">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-card class="list-card">
|
||||
<el-tabs v-model="currentAuthStatus" class="auth-tabs" @tab-change="onAuthStatusChange">
|
||||
<el-tab-pane label="全部" name="ALL" />
|
||||
<el-tab-pane label="待审核" name="TOBEAUDITED" />
|
||||
<el-tab-pane label="已审核" name="PASS" />
|
||||
<el-tab-pane label="审核未通过" name="REFUSE" />
|
||||
</el-tabs>
|
||||
|
||||
<div class="operation">
|
||||
<el-button type="primary" @click="add">添加</el-button>
|
||||
</div>
|
||||
@@ -36,43 +82,33 @@
|
||||
class="mt_10"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column label="商品名称" min-width="250">
|
||||
<el-table-column prop="skuId" label="ID" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="商品图片" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row" class="goods-msg">
|
||||
<img :src="row.thumbnail" width="60" height="60" alt="" />
|
||||
<div>
|
||||
<div class="div-zoom">
|
||||
<a class="link-text" @click="linkTo(row.goodsId, row.skuId)">{{ row.goodsName }}</a>
|
||||
</div>
|
||||
<el-popover trigger="hover" title="扫码在手机中查看" placement="top" width="180">
|
||||
<template #reference>
|
||||
<img
|
||||
src="../../assets/qrcode.svg"
|
||||
class="hover-pointer"
|
||||
width="20"
|
||||
height="20"
|
||||
alt="qrcode"
|
||||
/>
|
||||
</template>
|
||||
<vue-qr
|
||||
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||
:margin="0"
|
||||
color-dark="#000"
|
||||
color-light="#fff"
|
||||
:size="150"
|
||||
/>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
<img v-if="row?.thumbnail" :src="row.thumbnail" class="goods-thumb" alt="" />
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" min-width="110">
|
||||
<el-table-column label="商品名称" min-width="180" class-name="goods-name-column">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" class="goods-name-text">{{ row.goodsName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row?.specs || "-" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品类型" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row">{{ goodsTypeText(row.goodsType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品金额" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" :style="{ color: $mainColor }">{{ $filters.unitPrice(row.price, "¥") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="库存" min-width="80" />
|
||||
<el-table-column prop="createTime" label="添加时间" min-width="160" />
|
||||
<el-table-column label="佣金金额" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" :style="{ color: $mainColor }">
|
||||
@@ -80,9 +116,20 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="100" align="center" fixed="right">
|
||||
<el-table-column prop="quantity" label="库存" min-width="80" align="center" />
|
||||
<el-table-column label="审核状态" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<a v-if="row" class="link-text" @click="remove(row)">删除</a>
|
||||
<span v-if="row">{{ authStatusText(row.authStatus) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="添加时间" min-width="160" />
|
||||
<el-table-column label="操作" min-width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row">
|
||||
<a class="link-text" @click="edit(row)">编辑</a>
|
||||
<span class="op-split">|</span>
|
||||
<a class="link-text" @click="remove(row)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -91,7 +138,7 @@
|
||||
<el-pagination
|
||||
v-model:current-page="searchForm.pageNumber"
|
||||
v-model:page-size="searchForm.pageSize"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
:page-sizes="[20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
size="small"
|
||||
@@ -106,20 +153,88 @@
|
||||
<el-dialog
|
||||
v-model="modalVisible"
|
||||
:title="modalTitle"
|
||||
width="500px"
|
||||
width="900px"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
class="add-distribution-goods-dialog"
|
||||
>
|
||||
<el-form ref="form" :model="form" label-width="100px" :rules="formValidate">
|
||||
<el-form-item label="分销佣金" prop="commission">
|
||||
<el-input v-model="form.commission" clearable placeholder="请输入分销佣金" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="selectedGoodsList" border max-height="420">
|
||||
<el-table-column label="商品图片" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<img v-if="row?.thumbnail" :src="row.thumbnail" class="goods-thumb" alt="" />
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="160" class-name="goods-name-column">
|
||||
<template #default="{ row }">
|
||||
<span class="goods-name-text">{{ row.goodsName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.specs || "-" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<span :style="{ color: $mainColor }">{{ $filters.unitPrice(row.price, "¥") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分销佣金" width="160" align="center">
|
||||
<template #default="{ row, $index }">
|
||||
<el-input
|
||||
v-model="row.commission"
|
||||
clearable
|
||||
placeholder="请输入佣金"
|
||||
:class="{ 'commission-input-error': row.commissionError }"
|
||||
@blur="validateRowCommission(row, $index)"
|
||||
@input="row.commissionError = false"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<template #default="{ $index }">
|
||||
<a
|
||||
v-if="selectedGoodsList.length > 1"
|
||||
class="link-text"
|
||||
@click="removeSelectedGoods($index)"
|
||||
>移除</a>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="modalVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="editVisible"
|
||||
title="编辑分销商品"
|
||||
width="480px"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
>
|
||||
<el-form ref="editFormRef" :model="editForm" label-width="100px">
|
||||
<el-form-item label="商品名称">
|
||||
<span>{{ editForm.goodsName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="分销佣金" prop="commission">
|
||||
<el-input
|
||||
v-model="editForm.commission"
|
||||
clearable
|
||||
placeholder="请输入分销佣金"
|
||||
:class="{ 'commission-input-error': editForm.commissionError }"
|
||||
@input="editForm.commissionError = false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="editVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="editLoading" @click="handleEditSubmit">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -127,75 +242,166 @@
|
||||
import {
|
||||
getDistributionGoods,
|
||||
distributionGoodsCancel,
|
||||
distributionGoodsCheck,
|
||||
distributionGoodsBatchCheck,
|
||||
updateDistributionGoodsCommission,
|
||||
} from "@/api/distribution";
|
||||
import { getBrandListData, getShopGoodsLabelListSeller } from "@/api/goods";
|
||||
import liliDialog from "@/views/lili-dialog";
|
||||
import vueQr from "vue-qr";
|
||||
|
||||
export default {
|
||||
name: "distributionGoods",
|
||||
components: { liliDialog, vueQr },
|
||||
components: { liliDialog },
|
||||
data() {
|
||||
return {
|
||||
modalVisible: false,
|
||||
modalTitle: "添加分销商品",
|
||||
editVisible: false,
|
||||
editLoading: false,
|
||||
submitLoading: false,
|
||||
loading: true,
|
||||
currentAuthStatus: "ALL",
|
||||
searchForm: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
sort: "createTime",
|
||||
order: "desc",
|
||||
goodsName: "",
|
||||
brandId: "",
|
||||
storeCategoryPath: "",
|
||||
goodsType: "",
|
||||
authStatus: "",
|
||||
},
|
||||
form: {
|
||||
commission: 1,
|
||||
brandList: [],
|
||||
shopCategoryList: [],
|
||||
shopCategoryProps: {
|
||||
value: "value",
|
||||
label: "label",
|
||||
children: "children",
|
||||
checkStrictly: true,
|
||||
emitPath: false,
|
||||
},
|
||||
skuId: 0,
|
||||
formValidate: {
|
||||
commission: [
|
||||
{ required: true, message: "请输入大于1小于9999的合法佣金金额", trigger: "blur" },
|
||||
{
|
||||
pattern: /^[1-9]\d{0,3}(\.\d{1,2})?$/,
|
||||
message: "请输入大于1小于9999的合法佣金金额",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
selectedGoodsList: [],
|
||||
editForm: {
|
||||
id: "",
|
||||
goodsName: "",
|
||||
commission: "",
|
||||
commissionError: false,
|
||||
},
|
||||
commissionPattern: /^[1-9]\d{0,3}(\.\d{1,2})?$/,
|
||||
data: [],
|
||||
total: 0,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.loadFilterOptions();
|
||||
this.getDataList();
|
||||
},
|
||||
loadFilterOptions() {
|
||||
getBrandListData().then((res) => {
|
||||
this.brandList = Array.isArray(res) ? res : res?.result || [];
|
||||
});
|
||||
getShopGoodsLabelListSeller().then((res) => {
|
||||
if (res?.success) {
|
||||
this.shopCategoryList = this.formatShopCategory(res.result || []);
|
||||
}
|
||||
});
|
||||
},
|
||||
formatShopCategory(list) {
|
||||
return (list || []).map((item) => ({
|
||||
value: item.id,
|
||||
label: item.labelName,
|
||||
children:
|
||||
item.children && item.children.length
|
||||
? this.formatShopCategory(item.children)
|
||||
: undefined,
|
||||
}));
|
||||
},
|
||||
goodsTypeText(value) {
|
||||
if (value === "PHYSICAL_GOODS") return "实物商品";
|
||||
if (value === "VIRTUAL_GOODS") return "虚拟商品";
|
||||
if (value === "E_COUPON") return "电子卡券";
|
||||
return "-";
|
||||
},
|
||||
authStatusText(value) {
|
||||
if (value === "TOBEAUDITED") return "待审核";
|
||||
if (value === "REFUSE") return "审核未通过";
|
||||
return "已审核";
|
||||
},
|
||||
onAuthStatusChange(name) {
|
||||
this.searchForm.authStatus = name === "ALL" ? "" : name;
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
add() {
|
||||
this.$refs.liliDialog.goodsData = [];
|
||||
this.$refs.liliDialog.open("goods", "single");
|
||||
this.$refs.liliDialog.open("goods");
|
||||
},
|
||||
selectedGoodsData(selected) {
|
||||
if (!selected?.length) return;
|
||||
this.selectedGoodsList = selected.map((item) => ({
|
||||
skuId: item.id,
|
||||
goodsId: item.goodsId,
|
||||
thumbnail: item.thumbnail,
|
||||
goodsName: item.goodsName,
|
||||
specs: item.simpleSpecs || "-",
|
||||
price: item.price,
|
||||
commission: "1",
|
||||
commissionError: false,
|
||||
}));
|
||||
this.modalVisible = true;
|
||||
this.form.commission = 1;
|
||||
this.modalTitle = "添加分销商品";
|
||||
this.skuId = selected[0].id;
|
||||
this.modalTitle = `添加分销商品(已选${this.selectedGoodsList.length}项)`;
|
||||
},
|
||||
validateRowCommission(row) {
|
||||
const valid = this.commissionPattern.test(String(row.commission || "").trim());
|
||||
row.commissionError = !valid;
|
||||
return valid;
|
||||
},
|
||||
validateAllCommission() {
|
||||
let valid = true;
|
||||
this.selectedGoodsList.forEach((row) => {
|
||||
if (!this.validateRowCommission(row)) {
|
||||
valid = false;
|
||||
}
|
||||
});
|
||||
return valid;
|
||||
},
|
||||
removeSelectedGoods(index) {
|
||||
this.selectedGoodsList.splice(index, 1);
|
||||
if (!this.selectedGoodsList.length) {
|
||||
this.modalVisible = false;
|
||||
return;
|
||||
}
|
||||
this.modalTitle = `添加分销商品(已选${this.selectedGoodsList.length}项)`;
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) return;
|
||||
this.submitLoading = true;
|
||||
distributionGoodsCheck(this.skuId, this.form)
|
||||
.then((res) => {
|
||||
if (res?.success || res?.message === "success") {
|
||||
this.$Message.success("添加成功");
|
||||
if (!this.selectedGoodsList.length) return;
|
||||
if (!this.validateAllCommission()) {
|
||||
this.$Message.error("请为所有商品填写大于1且小于9999的合法佣金金额");
|
||||
return;
|
||||
}
|
||||
this.submitLoading = true;
|
||||
const items = this.selectedGoodsList.map((item) => ({
|
||||
skuId: item.skuId,
|
||||
commission: Number(item.commission),
|
||||
}));
|
||||
distributionGoodsBatchCheck(items)
|
||||
.then((res) => {
|
||||
if (res?.success || res?.message === "success") {
|
||||
const addedCount = Array.isArray(res?.result) ? res.result.length : 0;
|
||||
if (addedCount > 0) {
|
||||
this.$Message.success(`成功添加${addedCount}个分销商品`);
|
||||
} else {
|
||||
this.$Message.info("所选商品均已是分销商品,已跳过");
|
||||
}
|
||||
this.modalVisible = false;
|
||||
this.getDataList();
|
||||
})
|
||||
.finally(() => {
|
||||
this.submitLoading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
this.modalVisible = false;
|
||||
this.selectedGoodsList = [];
|
||||
this.getDataList();
|
||||
})
|
||||
.finally(() => {
|
||||
this.submitLoading = false;
|
||||
});
|
||||
},
|
||||
changePage(v) {
|
||||
this.searchForm.pageNumber = v;
|
||||
@@ -243,6 +449,37 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
edit(row) {
|
||||
this.editForm = {
|
||||
id: row.id,
|
||||
goodsName: row.goodsName,
|
||||
commission: row.commission != null ? String(row.commission) : "1",
|
||||
commissionError: false,
|
||||
};
|
||||
this.editVisible = true;
|
||||
},
|
||||
handleEditSubmit() {
|
||||
const valid = this.commissionPattern.test(String(this.editForm.commission || "").trim());
|
||||
this.editForm.commissionError = !valid;
|
||||
if (!valid) {
|
||||
this.$Message.error("请输入大于1且小于9999的合法佣金金额");
|
||||
return;
|
||||
}
|
||||
this.editLoading = true;
|
||||
updateDistributionGoodsCommission(this.editForm.id, {
|
||||
commission: Number(this.editForm.commission),
|
||||
})
|
||||
.then((res) => {
|
||||
if (res?.success || res?.message === "success") {
|
||||
this.$Message.success("修改成功");
|
||||
this.editVisible = false;
|
||||
this.getDataList();
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.editLoading = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
@@ -255,15 +492,11 @@ export default {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.goods-msg {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 13px;
|
||||
padding: 5px 0;
|
||||
|
||||
img {
|
||||
object-fit: contain;
|
||||
}
|
||||
.goods-thumb {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
object-fit: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.link-text {
|
||||
@@ -272,19 +505,46 @@ export default {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.div-zoom {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 4px;
|
||||
.op-split {
|
||||
margin: 0 6px;
|
||||
color: #dcdfe6;
|
||||
}
|
||||
|
||||
.hover-pointer {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
.goods-name-text {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
:deep(.goods-name-column .cell) {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.mt_10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.auth-tabs {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.commission-input-error {
|
||||
:deep(.el-input__wrapper) {
|
||||
box-shadow: 0 0 0 1px #f56c6c inset;
|
||||
}
|
||||
}
|
||||
|
||||
.add-distribution-goods-dialog {
|
||||
:deep(.goods-name-column .cell) {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分销商" prop="distributionName">
|
||||
<el-form-item label="分销员" prop="distributionName">
|
||||
<el-input
|
||||
v-model="searchForm.distributionName"
|
||||
placeholder="请输入分销商名称"
|
||||
placeholder="请输入分销员名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
/>
|
||||
@@ -89,7 +89,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="distributionName" label="分销商" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="distributionName" label="分销员" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="状态" min-width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row" :type="filterStatusTagType(row.distributionOrderStatus)">
|
||||
@@ -100,7 +100,7 @@
|
||||
<el-table-column label="佣金金额" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" :style="{ color: $mainColor }">
|
||||
{{ $filters.unitPrice(row.rebate, "¥") }}</span>
|
||||
{{ $filters.unitPrice(row.directCommission ?? row.rebate, "¥") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="160" fixed="right" />
|
||||
|
||||
@@ -111,18 +111,22 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="200" show-overflow-tooltip>
|
||||
<el-table-column label="商品名称" min-width="220" class-name="goods-name-column">
|
||||
<template #default="{ row }">
|
||||
<a class="link-text" @click="linkTo(row.id, row.skuId)">{{ row.goodsName }}</a>
|
||||
<a
|
||||
v-if="row"
|
||||
class="link-text goods-name-text"
|
||||
@click="linkTo(row.id, row.skuId)"
|
||||
>{{ row.goodsName }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格" width="200">
|
||||
<el-table-column label="价格" width="120">
|
||||
<template #default="{ row }">
|
||||
<span :style="{ color: $mainColor }">{{ $filters.unitPrice(row.price, '¥') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="buyCount" label="销量" width="150" />
|
||||
<el-table-column prop="quantity" label="库存" width="150" />
|
||||
<el-table-column prop="buyCount" label="销量" width="90" />
|
||||
<el-table-column prop="quantity" label="库存" width="90" />
|
||||
<el-table-column label="销售模式" width="150">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row">{{ salesModelText(row.salesModel) }}</span>
|
||||
@@ -465,4 +469,19 @@ export default {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.goods-name-text {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
display: inline-block;
|
||||
}
|
||||
:deep(.goods-name-column .cell) {
|
||||
white-space: normal;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.link-text {
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,78 +1,217 @@
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="wap-content">
|
||||
<div class="query-wrapper">
|
||||
<div class="query-item">
|
||||
<div>搜索范围</div>
|
||||
<el-input
|
||||
v-model="goodsParams.goodsName"
|
||||
placeholder="商品名称"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
@clear="onSearchGoods"
|
||||
@keyup.enter="onSearchGoods"
|
||||
/>
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<el-cascader
|
||||
v-model="category"
|
||||
:options="skuList"
|
||||
placeholder="请选择商品分类"
|
||||
popper-class="goods-dialog-cascader-popper"
|
||||
style="width: 250px"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<el-button type="primary" @click="onSearchGoods">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="wap-content-list">
|
||||
<div
|
||||
class="wap-content-item"
|
||||
:class="{ active: item.selected }"
|
||||
@click="checkedGoods(item, index)"
|
||||
v-for="(item, index) in goodsData"
|
||||
:key="index"
|
||||
>
|
||||
<div>
|
||||
<img :src="item.thumbnail" alt="" />
|
||||
<div class="goods-filter-panel">
|
||||
<el-form :model="filterForm" inline label-width="72px" class="goods-filter-form" @keyup.enter="onSearchGoods">
|
||||
<el-form-item label-width="0" class="filter-row-item">
|
||||
<div class="filter-row">
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">商品名称</span>
|
||||
<el-input
|
||||
v-model="filterForm.goodsName"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
class="filter-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="wap-content-desc">
|
||||
<div class="wap-content-desc-title">{{ item.goodsName }}</div>
|
||||
<div class="wap-sku">
|
||||
{{ item.goodsUnit }}
|
||||
<el-tag
|
||||
style="margin-left: 10px"
|
||||
:type="item.salesModel === 'RETAIL' ? 'info' : 'primary'"
|
||||
>
|
||||
{{ item.salesModel === "RETAIL" ? "零售型" : "批发型" }}
|
||||
</el-tag>
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">商品ID</span>
|
||||
<el-input
|
||||
v-model="filterForm.goodsId"
|
||||
placeholder="请输入商品ID"
|
||||
clearable
|
||||
class="filter-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">商品类型</span>
|
||||
<el-select v-model="filterForm.goodsType" placeholder="请选择" clearable class="filter-control">
|
||||
<el-option label="实物商品" value="PHYSICAL_GOODS" />
|
||||
<el-option label="虚拟商品" value="VIRTUAL_GOODS" />
|
||||
<el-option label="电子卡券" value="E_COUPON" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="0" class="filter-row-item">
|
||||
<div class="filter-row">
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">品牌</span>
|
||||
<el-select
|
||||
v-model="filterForm.brandId"
|
||||
placeholder="请选择品牌"
|
||||
clearable
|
||||
filterable
|
||||
class="filter-control"
|
||||
>
|
||||
<el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">店铺分类</span>
|
||||
<el-cascader
|
||||
v-model="filterForm.storeCategoryPath"
|
||||
:options="shopCategoryList"
|
||||
:props="shopCategoryProps"
|
||||
placeholder="请选择店铺分类"
|
||||
clearable
|
||||
filterable
|
||||
class="filter-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="filter-row-field">
|
||||
<span class="filter-row-label">平台类目</span>
|
||||
<el-cascader
|
||||
v-model="filterForm.categoryPath"
|
||||
:options="platformCategoryList"
|
||||
:props="platformCategoryProps"
|
||||
placeholder="请选择平台类目"
|
||||
popper-class="goods-dialog-cascader-popper"
|
||||
clearable
|
||||
filterable
|
||||
class="filter-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="0" class="range-form-item range-filter-row-item">
|
||||
<div class="range-filter-row">
|
||||
<div class="range-group">
|
||||
<span class="filter-row-label">价格</span>
|
||||
<div class="range-group-inputs">
|
||||
<el-input v-model="filterForm.priceMin" placeholder="≥" clearable />
|
||||
<span class="range-sep">~</span>
|
||||
<el-input v-model="filterForm.priceMax" placeholder="≤" clearable />
|
||||
</div>
|
||||
<div class="wap-content-desc-bottom">
|
||||
<div>¥{{ $filters.unitPrice(item.price) }}</div>
|
||||
</div>
|
||||
<div class="range-group">
|
||||
<span class="filter-row-label">销量</span>
|
||||
<div class="range-group-inputs">
|
||||
<el-input v-model="filterForm.salesMin" placeholder="≥" clearable />
|
||||
<span class="range-sep">~</span>
|
||||
<el-input v-model="filterForm.salesMax" placeholder="≤" clearable />
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-group">
|
||||
<span class="filter-row-label">库存</span>
|
||||
<div class="range-group-inputs">
|
||||
<el-input v-model="filterForm.stockMin" placeholder="≥" clearable />
|
||||
<span class="range-sep">~</span>
|
||||
<el-input v-model="filterForm.stockMax" placeholder="≤" clearable />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loading" v-loading="loading" class="loading-mask" />
|
||||
<div v-if="empty" class="empty">暂无商品信息</div>
|
||||
</div>
|
||||
<el-pagination
|
||||
v-model:current-page="goodsParams.pageNumber"
|
||||
class="pageration"
|
||||
:total="total"
|
||||
:page-size="goodsParams.pageSize"
|
||||
layout="total, prev, pager, next"
|
||||
size="small"
|
||||
@current-change="changePageSize"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSearchGoods">搜索</el-button>
|
||||
<el-button @click="resetFilter">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div ref="tableWrap" class="goods-table-wrap">
|
||||
<el-table
|
||||
ref="goodsTable"
|
||||
v-loading="loading"
|
||||
:data="goodsData"
|
||||
border
|
||||
:height="tableHeight"
|
||||
:highlight-current-row="type !== 'multiple'"
|
||||
class="goods-sku-table"
|
||||
row-key="id"
|
||||
@row-click="handleRowClick"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
v-if="type === 'multiple'"
|
||||
type="selection"
|
||||
width="48"
|
||||
align="center"
|
||||
:reserve-selection="true"
|
||||
/>
|
||||
<el-table-column prop="id" label="ID" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="商品图片" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<img v-if="row" :src="row.thumbnail" class="goods-thumb" alt="" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="160" class-name="goods-name-column">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" class="goods-name-text">{{ row.goodsName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row?.simpleSpecs || "-" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品类型" width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ goodsTypeText(row?.goodsType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺分类" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ storeCategoryText(row?.storeCategoryPath) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台类目" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ platformCategoryText(row?.categoryPath) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ brandText(row?.brandId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格" width="100" align="right">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" class="goods-price">{{ $filters.unitPrice(row.price, "¥") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销量" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row?.buyCount ?? 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="库存" width="80" align="center" />
|
||||
<template #empty>
|
||||
<div class="empty">{{ loading ? "" : "暂无商品信息" }}</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<el-pagination
|
||||
v-model:current-page="goodsParams.pageNumber"
|
||||
class="pageration"
|
||||
:total="total"
|
||||
:page-size="goodsParams.pageSize"
|
||||
layout="total, prev, pager, next"
|
||||
size="small"
|
||||
@current-change="changePageSize"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import * as API_Goods from "@/api/goods";
|
||||
|
||||
const defaultFilterForm = () => ({
|
||||
goodsName: "",
|
||||
goodsId: "",
|
||||
storeCategoryPath: "",
|
||||
categoryPath: "",
|
||||
goodsType: "",
|
||||
brandId: "",
|
||||
priceMin: "",
|
||||
priceMax: "",
|
||||
salesMin: "",
|
||||
salesMax: "",
|
||||
stockMin: "",
|
||||
stockMax: "",
|
||||
});
|
||||
|
||||
export default {
|
||||
props: {
|
||||
selectedWay: {
|
||||
@@ -84,29 +223,39 @@ export default {
|
||||
return {
|
||||
type: "multiple",
|
||||
selectedList: [],
|
||||
skuList: [],
|
||||
platformCategoryList: [],
|
||||
shopCategoryList: [],
|
||||
brandList: [],
|
||||
platformCategoryProps: {
|
||||
value: "id",
|
||||
label: "name",
|
||||
children: "children",
|
||||
checkStrictly: true,
|
||||
emitPath: false,
|
||||
},
|
||||
shopCategoryProps: {
|
||||
value: "value",
|
||||
label: "label",
|
||||
children: "children",
|
||||
checkStrictly: true,
|
||||
emitPath: false,
|
||||
},
|
||||
filterForm: defaultFilterForm(),
|
||||
total: 0,
|
||||
goodsParams: {
|
||||
pageNumber: 1,
|
||||
pageSize: 15,
|
||||
pageSize: 20,
|
||||
order: "desc",
|
||||
goodsName: "",
|
||||
sn: "",
|
||||
categoryPath: "",
|
||||
marketEnable: "UPPER",
|
||||
authFlag: "PASS",
|
||||
sort: "createTime",
|
||||
},
|
||||
category: [],
|
||||
goodsData: [],
|
||||
empty: false,
|
||||
loading: false,
|
||||
tableHeight: 400,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
category(val) {
|
||||
this.goodsParams.categoryPath = val && val.length ? val.join(",") : "";
|
||||
},
|
||||
selectedWay: {
|
||||
handler(val) {
|
||||
this.selectedList = Array.isArray(val) ? val.slice() : [];
|
||||
@@ -114,157 +263,366 @@ export default {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
"goodsParams.categoryPath": {
|
||||
handler() {
|
||||
this.goodsData = [];
|
||||
this.goodsParams.pageNumber = 1;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
this.$nextTick(this.calcTableHeight);
|
||||
window.addEventListener("resize", this.calcTableHeight);
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener("resize", this.calcTableHeight);
|
||||
},
|
||||
methods: {
|
||||
calcTableHeight() {
|
||||
this.$nextTick(() => {
|
||||
const wrap = this.$refs.tableWrap;
|
||||
if (wrap) {
|
||||
this.tableHeight = Math.max(wrap.clientHeight, 320);
|
||||
}
|
||||
});
|
||||
},
|
||||
onSearchGoods() {
|
||||
this.goodsData = [];
|
||||
this.goodsParams.pageNumber = 1;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.filterForm = defaultFilterForm();
|
||||
this.onSearchGoods();
|
||||
},
|
||||
changePageSize(v) {
|
||||
this.goodsParams.pageNumber = v;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
buildQueryParams() {
|
||||
const params = {
|
||||
...this.goodsParams,
|
||||
goodsName: this.filterForm.goodsName || undefined,
|
||||
goodsId: this.filterForm.goodsId || undefined,
|
||||
goodsType: this.filterForm.goodsType || undefined,
|
||||
brandId: this.filterForm.brandId || undefined,
|
||||
storeCategoryPath: this.filterForm.storeCategoryPath || undefined,
|
||||
categoryPath: this.filterForm.categoryPath || undefined,
|
||||
geQuantity: undefined,
|
||||
leQuantity: undefined,
|
||||
geBuyCount: undefined,
|
||||
leBuyCount: undefined,
|
||||
price: undefined,
|
||||
};
|
||||
|
||||
const { priceMin, priceMax, salesMin, salesMax, stockMin, stockMax } = this.filterForm;
|
||||
if (priceMin !== "" && priceMax !== "") {
|
||||
params.price = `${priceMin}_${priceMax}`;
|
||||
} else if (priceMin !== "") {
|
||||
params.price = String(priceMin);
|
||||
} else if (priceMax !== "") {
|
||||
params.price = `0_${priceMax}`;
|
||||
}
|
||||
|
||||
if (stockMin !== "" && stockMin != null) params.geQuantity = Number(stockMin);
|
||||
if (stockMax !== "" && stockMax != null) params.leQuantity = Number(stockMax);
|
||||
if (salesMin !== "" && salesMin != null) params.geBuyCount = Number(salesMin);
|
||||
if (salesMax !== "" && salesMax != null) params.leBuyCount = Number(salesMax);
|
||||
|
||||
return params;
|
||||
},
|
||||
getQueryGoodsList() {
|
||||
this.loading = true;
|
||||
API_Goods.getGoodsSkuData(this.goodsParams)
|
||||
API_Goods.getGoodsSkuData(this.buildQueryParams())
|
||||
.then((res) => {
|
||||
this.initGoods(res);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
this.calcTableHeight();
|
||||
});
|
||||
},
|
||||
initGoods(res) {
|
||||
const records = res?.result?.records || [];
|
||||
if (records.length) {
|
||||
records.forEach((item) => {
|
||||
item.selected = false;
|
||||
item.___type = "goods";
|
||||
this.selectedList.forEach((e) => {
|
||||
if (e.id && e.id === item.id) {
|
||||
item.selected = true;
|
||||
this.total = res?.result?.total || 0;
|
||||
records.forEach((item) => {
|
||||
item.selected = false;
|
||||
item.___type = "goods";
|
||||
this.selectedList.forEach((e) => {
|
||||
if (e.id && e.id === item.id) {
|
||||
item.selected = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.goodsData = records;
|
||||
this.syncTableSelection();
|
||||
},
|
||||
syncTableSelection() {
|
||||
this.$nextTick(() => {
|
||||
const table = this.$refs.goodsTable;
|
||||
if (!table) return;
|
||||
if (this.type === "multiple") {
|
||||
table.clearSelection();
|
||||
this.goodsData.forEach((row) => {
|
||||
if (row.selected) {
|
||||
table.toggleRowSelection(row, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.total = res.result.total || 0;
|
||||
this.goodsData = records;
|
||||
this.empty = false;
|
||||
} else {
|
||||
this.goodsData = [];
|
||||
this.empty = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const selected = this.goodsData.find((item) => item.selected);
|
||||
table.setCurrentRow(selected || null);
|
||||
});
|
||||
},
|
||||
emitSelected(list) {
|
||||
this.selectedList = list;
|
||||
this.$emit("selected", this.selectedList);
|
||||
},
|
||||
handleRowClick(row) {
|
||||
if (this.type === "multiple") return;
|
||||
this.goodsData.forEach((item) => {
|
||||
item.selected = false;
|
||||
});
|
||||
row.selected = true;
|
||||
this.emitSelected([row]);
|
||||
this.$refs.goodsTable?.setCurrentRow(row);
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
if (this.type !== "multiple") return;
|
||||
const selectedIds = new Set(selection.map((item) => item.id));
|
||||
this.goodsData.forEach((item) => {
|
||||
item.selected = selectedIds.has(item.id);
|
||||
});
|
||||
const currentPageIds = new Set(this.goodsData.map((item) => item.id));
|
||||
const otherPages = this.selectedList.filter((item) => !currentPageIds.has(item.id));
|
||||
this.emitSelected([...otherPages, ...selection]);
|
||||
},
|
||||
formatShopCategory(list) {
|
||||
return (list || []).map((item) => ({
|
||||
value: item.id,
|
||||
label: item.labelName,
|
||||
children:
|
||||
item.children && item.children.length ? this.formatShopCategory(item.children) : undefined,
|
||||
}));
|
||||
},
|
||||
goodsTypeText(value) {
|
||||
if (value === "PHYSICAL_GOODS") return "实物商品";
|
||||
if (value === "VIRTUAL_GOODS") return "虚拟商品";
|
||||
if (value === "E_COUPON") return "电子卡券";
|
||||
return "-";
|
||||
},
|
||||
brandText(brandId) {
|
||||
if (!brandId) return "-";
|
||||
const brand = this.brandList.find((item) => String(item.id) === String(brandId));
|
||||
return brand?.name || "-";
|
||||
},
|
||||
findTreeNodeLabel(tree, targetId, valueKey, labelKey) {
|
||||
for (const node of tree || []) {
|
||||
if (String(node[valueKey]) === String(targetId)) {
|
||||
return node[labelKey];
|
||||
}
|
||||
const childLabel = this.findTreeNodeLabel(node.children, targetId, valueKey, labelKey);
|
||||
if (childLabel) return childLabel;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
categoryPathText(path, tree, valueKey, labelKey) {
|
||||
if (!path) return "-";
|
||||
const ids = String(path).split(",").filter(Boolean);
|
||||
if (!ids.length) return "-";
|
||||
const labels = ids
|
||||
.map((id) => this.findTreeNodeLabel(tree, id, valueKey, labelKey))
|
||||
.filter(Boolean);
|
||||
return labels.length ? labels.join(" / ") : "-";
|
||||
},
|
||||
storeCategoryText(path) {
|
||||
return this.categoryPathText(path, this.shopCategoryList, "value", "label");
|
||||
},
|
||||
platformCategoryText(path) {
|
||||
if (!path) return "-";
|
||||
const ids = String(path).split(",").filter(Boolean);
|
||||
if (!ids.length) return "-";
|
||||
const targetId = ids.length >= 3 ? ids[2] : ids[ids.length - 1];
|
||||
const label = this.findTreeNodeLabel(this.platformCategoryList, targetId, "id", "name");
|
||||
return label || "-";
|
||||
},
|
||||
init() {
|
||||
API_Goods.getGoodsSkuData(this.goodsParams).then((res) => {
|
||||
this.initGoods(res);
|
||||
});
|
||||
API_Goods.getGoodsCategoryAll(0).then((res) => {
|
||||
if (res.result) {
|
||||
this.deepGroup(res.result);
|
||||
this.getQueryGoodsList();
|
||||
API_Goods.getCategoryTree().then((res) => {
|
||||
if (res?.success) {
|
||||
this.platformCategoryList = res.result || [];
|
||||
}
|
||||
});
|
||||
},
|
||||
deepGroup(val) {
|
||||
val.forEach((item) => {
|
||||
let childWay = [];
|
||||
if (item.children) {
|
||||
item.children.forEach((child) => {
|
||||
if (child.children) {
|
||||
child.children.forEach((grandson, index, arr) => {
|
||||
arr[index] = {
|
||||
value: grandson.id,
|
||||
label: grandson.name,
|
||||
};
|
||||
});
|
||||
}
|
||||
childWay.push({
|
||||
value: child.id,
|
||||
label: child.name,
|
||||
children: child.children,
|
||||
});
|
||||
});
|
||||
API_Goods.getShopGoodsLabelListSeller().then((res) => {
|
||||
if (res?.success) {
|
||||
this.shopCategoryList = this.formatShopCategory(res.result || []);
|
||||
}
|
||||
this.skuList.push({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
children: childWay,
|
||||
});
|
||||
});
|
||||
},
|
||||
checkedGoods(val) {
|
||||
if (this.type !== "multiple") {
|
||||
this.goodsData.forEach((item) => {
|
||||
item.selected = false;
|
||||
});
|
||||
val.selected = true;
|
||||
this.emitSelected([val]);
|
||||
return;
|
||||
}
|
||||
if (!val.selected) {
|
||||
val.selected = true;
|
||||
this.emitSelected([...this.selectedList, val]);
|
||||
} else {
|
||||
val.selected = false;
|
||||
this.emitSelected(this.selectedList.filter((item) => item.id !== val.id));
|
||||
}
|
||||
API_Goods.getBrandListData().then((res) => {
|
||||
this.brandList = Array.isArray(res) ? res : res?.result || [];
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@import "./style.scss";
|
||||
|
||||
.wrapper {
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.wap-content {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.goods-table-wrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.goods-filter-panel {
|
||||
background: #f5f7fa;
|
||||
padding: 12px 16px 4px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.goods-filter-form {
|
||||
margin-bottom: 0;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-right: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.range-form-item {
|
||||
:deep(.el-form-item__content) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.range-filter-row-item {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-row-item {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
width: 100%;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.filter-row-field {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 244px;
|
||||
min-width: 244px;
|
||||
}
|
||||
|
||||
.filter-control {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.filter-row-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex: 0 0 72px;
|
||||
padding-right: 12px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.range-filter-row {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.range-group {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 244px;
|
||||
min-width: 244px;
|
||||
}
|
||||
|
||||
.range-group-inputs {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
:deep(.el-input) {
|
||||
width: 72px;
|
||||
}
|
||||
}
|
||||
|
||||
.range-sep {
|
||||
margin: 0 4px;
|
||||
color: #909399;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.goods-sku-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.goods-name-text {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
:deep(.goods-name-column .cell) {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.goods-thumb {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
object-fit: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.goods-price {
|
||||
color: $theme_color;
|
||||
}
|
||||
|
||||
.empty {
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
width: 100%;
|
||||
}
|
||||
.wap-content {
|
||||
flex: 1;
|
||||
padding: 0;
|
||||
}
|
||||
.wap-content-list {
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
height: 340px;
|
||||
}
|
||||
.wap-content-item {
|
||||
width: 210px;
|
||||
margin: 10px 7px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
.active {
|
||||
background: url("../../assets/selected.png") no-repeat;
|
||||
background-position: right;
|
||||
background-size: 10%;
|
||||
}
|
||||
.loading-mask {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
padding: 24px 0;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.pageration {
|
||||
margin-top: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
:deep(.el-table__body tr) {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.goods-dialog-cascader-popper {
|
||||
|
||||
@@ -1,6 +1,33 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="goodsVisible"
|
||||
title="选择商品"
|
||||
direction="rtl"
|
||||
size="85%"
|
||||
:z-index="10000"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
class="lili-goods-drawer"
|
||||
>
|
||||
<goodsDialog
|
||||
v-if="goodsVisible"
|
||||
ref="goodsDialog"
|
||||
:selectedWay="goodsData"
|
||||
@selected="
|
||||
(val) => {
|
||||
goodsData = val;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="clickClose">取消</el-button>
|
||||
<el-button type="primary" @click="clickOK">确定</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
|
||||
<el-dialog
|
||||
v-model="flag"
|
||||
v-model="linkVisible"
|
||||
width="1160px"
|
||||
top="120px"
|
||||
:z-index="10000"
|
||||
@@ -9,27 +36,15 @@
|
||||
destroy-on-close
|
||||
@close="clickClose"
|
||||
>
|
||||
<template v-if="flag">
|
||||
<goodsDialog
|
||||
@selected="
|
||||
(val) => {
|
||||
goodsData = val;
|
||||
}
|
||||
"
|
||||
v-if="goodsFlag"
|
||||
ref="goodsDialog"
|
||||
:selectedWay="goodsData"
|
||||
/>
|
||||
<linkDialog
|
||||
@selectedLink="
|
||||
(val) => {
|
||||
linkData = val;
|
||||
}
|
||||
"
|
||||
v-else
|
||||
class="linkDialog"
|
||||
/>
|
||||
</template>
|
||||
<linkDialog
|
||||
v-if="linkVisible"
|
||||
class="linkDialog"
|
||||
@selectedLink="
|
||||
(val) => {
|
||||
linkData = val;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="clickClose">取消</el-button>
|
||||
<el-button type="primary" @click="clickOK">确定</el-button>
|
||||
@@ -46,23 +61,44 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
goodsVisible: false,
|
||||
linkVisible: false,
|
||||
goodsFlag: false,
|
||||
goodsData: [],
|
||||
linkData: "",
|
||||
flag: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
flag: {
|
||||
get() {
|
||||
return this.goodsVisible || this.linkVisible;
|
||||
},
|
||||
set(val) {
|
||||
if (val) {
|
||||
if (this.goodsFlag) {
|
||||
this.goodsVisible = true;
|
||||
} else {
|
||||
this.linkVisible = true;
|
||||
}
|
||||
} else {
|
||||
this.goodsVisible = false;
|
||||
this.linkVisible = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clearGoodsSelected() {
|
||||
this.goodsData = [];
|
||||
},
|
||||
clickClose() {
|
||||
this.flag = false;
|
||||
this.goodsVisible = false;
|
||||
this.linkVisible = false;
|
||||
this.goodsFlag = false;
|
||||
this.$emit("closeFlag", false);
|
||||
},
|
||||
singleGoods() {
|
||||
var timer = setInterval(() => {
|
||||
const timer = setInterval(() => {
|
||||
if (this.$refs.goodsDialog) {
|
||||
this.$refs.goodsDialog.type = "single";
|
||||
clearInterval(timer);
|
||||
@@ -70,34 +106,50 @@ export default {
|
||||
}, 100);
|
||||
},
|
||||
clickOK() {
|
||||
if (this.goodsFlag) {
|
||||
if (this.goodsVisible) {
|
||||
this.$emit("selectedGoodsData", this.goodsData);
|
||||
} else {
|
||||
} else if (this.linkVisible) {
|
||||
this.$emit("selectedLink", this.linkData);
|
||||
}
|
||||
this.clickClose();
|
||||
},
|
||||
open(type, mutiple) {
|
||||
this.flag = true;
|
||||
if (type == "goods") {
|
||||
this.goodsFlag = true;
|
||||
this.goodsVisible = true;
|
||||
if (mutiple) {
|
||||
this.singleGoods();
|
||||
}
|
||||
} else {
|
||||
this.goodsFlag = false;
|
||||
this.linkVisible = true;
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.flag = false;
|
||||
this.clickClose();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.lili-goods-drawer {
|
||||
:deep(.el-drawer__body) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 12px 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__footer) {
|
||||
border-top: 1px solid #ebeef5;
|
||||
padding: 12px 20px;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-dialog__body) {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
height: 640px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user