Commit 1f06a1d1 by 张立顺

Merge branch 'SAAS+V5.8.0' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into SAAS+V5.8.0
2 parents 7d4b1609 25c65923
Showing 87 changed files with 3926 additions and 317 deletions
# 所有环境默认
# 页面 title 前缀
VUE_APP_TITLE=D+
# 静态资源基础路径
VUE_APP_PUBLIC_PATH = '/dj-carlife-web/'
# cdn图片加速地址
VUE_APP_PUBLIC_IMGPATH = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/web/'
# 仓库地址
VUE_APP_REPO = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
# 国际化配置
VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_STORAGE_PREFIX=d+
\ No newline at end of file
# 所有环境默认
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config
# 页面 title 前缀
VUE_APP_TITLE=D+
# 静态资源基础路径
VUE_APP_PUBLIC_PATH = '/dj-carlife-web/'
# cdn图片加速地址
VUE_APP_PUBLIC_IMGPATH = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/web/'
# 仓库地址
VUE_APP_REPO = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
# 国际化配置
VUE_APP_I18N_LOCALE=zh-chs
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_STORAGE_PREFIX=d+
......@@ -2,4 +2,6 @@
# 网络请求开发地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
\ No newline at end of file
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config
......@@ -8,7 +8,6 @@ node_modules
.cursor
.trae
# 本地环境文件不上传
.env.local
.env.*.local
......@@ -25,4 +24,3 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
src/main.js
......@@ -11,7 +11,6 @@
"explorer.compactFolders": false,
"scm.compactFolders": false,
"problems.decorations.enabled": false,
"eslint.format.enable": true,
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": true,
......
......@@ -29,6 +29,9 @@ export default antfu({
"array-bracket-spacing": ["error", "always"],
},
rules: {
"vue/no-deprecated-model-definition": "off",
"jsdoc/check-types": "off",
"no-useless-catch": "off",
"vue/no-unused-refs": "warn",
"unused-imports/no-unused-imports": "warn",
......
import request from "./request"
import request from "./request";
const path = "dj.api."
const path2 = "dj.smartcarlife.api."
const path = "dj.api.";
const path2 = "dj.smartcarlife.api.";
export function getList(data) {
data.method = `${path}basegoods.page`
return request(data)
data.method = `${path}basegoods.page`;
return request(data);
}
// 分页查找园区店
export function commodityAddSeviceMerchant(data) {
// data.method = `${path}servicemerchantref.page`
data.method = `${path}servicemerchantref.pageRef`
return request(data)
// data.method = `${path}servicemerchantref.page`
data.method = `${path}servicemerchantref.pageRef`;
return request(data);
}
// 根据基础商品Id查询商品
export function getGoodsInfoById(data) {
data.method = `${path}basegoods.get.byId`
return request(data)
data.method = `${path}basegoods.get.byId`;
return request(data);
}
// 根据基础商品id获取分配门店列表 - 查看门店
export function getMerchantList(data) {
data.method = "dj.basegoodsmerchantref.list.byBaseGoodsId"
return request(data)
data.method = "dj.basegoodsmerchantref.list.byBaseGoodsId";
return request(data);
}
// 查询产品列表
export function getGoodsList(data) {
data.method = `${path}goodsinfo.list`
return request(data)
data.method = `${path}goodsinfo.list`;
return request(data);
}
// 新增商品
export function baseGoodsAdd(data) {
data.method = `${path}basegoods.add`
return request(data, "post")
data.method = `${path}basegoods.add`;
return request(data, "post");
}
// 修改商品
export function baseGoodsUpdate(data) {
data.method = `${path}basegoods.update`
return request(data, "post")
data.method = `${path}basegoods.update`;
return request(data, "post");
}
// 下架商品
export function baseGoodsUpOrDown(data) {
// data.method = `${path2}basegoods.changeShelfStatus`
data.method = `${path2}basegoods.shelfStatus.update`
return request(data, "post")
// data.method = `${path2}basegoods.changeShelfStatus`
data.method = `${path2}basegoods.shelfStatus.update`;
return request(data, "post");
}
// 删除商品
export function baseGoodsDelete(data) {
data.method = `${path2}basegoods.delete`
return request(data, "post", [], { useResponseMessage: true })
data.method = `${path2}basegoods.delete`;
return request(data, "post", [], { useResponseMessage: true });
}
// 导出
export function exportBaseList(data) {
data.method = `${path}basegoods.export`
return request(data, "post")
data.method = `${path}basegoods.export`;
return request(data, "post");
}
// 下架子商品
export function baseGoodsUpOrDownForChild(data) {
data.method = `${path2}upgradedGoods.shelfStatus.update`
return request(data, "post")
data.method = `${path2}upgradedGoods.shelfStatus.update`;
return request(data, "post");
}
// 提交商品审核结果
export function submitReviewResult(data) {
data.method = `${path2}upgradedGoods.submitReviewResult`
return request(data, "post")
data.method = `${path2}upgradedGoods.submitReviewResult`;
return request(data, "post");
}
// 新增编辑商品
export function addOrEditBaseGoods(data) {
data.method = `${path}basegoods.insertOrUpdate`
return request(data, "post")
data.method = `${path}basegoods.insertOrUpdate`;
return request(data, "post");
}
// 获取商品列表
export function getBaseGoodsList(data) {
data.method = `${path}basegoods.page`
return request(data, "post")
data.method = `${path}basegoods.page`;
return request(data, "post");
}
// 获取按规格分配 门店维度数据转为规格维度展示
export function getSpecDataByMerchent(data) {
data.method = `dj.basegoodsmerchantref.specification.getByBaseGoodsId`
return request(data, "post")
data.method = `dj.basegoodsmerchantref.specification.getByBaseGoodsId`;
return request(data, "post");
}
// 按规格分配保存
export function saveAssignBySpec(data) {
data.method = "dj.basegoodsmerchantref.specification.insertOrUpdate"
return request(data, "post")
data.method = "dj.basegoodsmerchantref.specification.insertOrUpdate";
return request(data, "post");
}
// 分配门店 统一分配保存
export function saveAssignByMerchant(data) {
data.method = "dj.basegoodsmerchantref.stores.insertOrUpdate"
return request(data, "post")
data.method = "dj.basegoodsmerchantref.stores.insertOrUpdate";
return request(data, "post");
}
// 获取场景关联门店/园区店列表
export function getMerchantListByScene(data) {
data.method = `${path}servicemerchantref.listShopWithScene`
return request(data, "post")
data.method = `${path}servicemerchantref.listShopWithScene`;
return request(data, "post");
}
// 获取场景-类目-素材三级数据列表
export function getThiredMaterialList(data) {
data.method = `${path}goods.type.querySceneCategoryGoods`
return request(data, "post")
data.method = `${path}goods.type.querySceneCategoryGoods`;
return request(data, "post");
}
// 保存商品
export function saveTempGoods(data) {
data.method = `${path}basegoods.saveTemp`
return request(data, "post")
data.method = `${path}basegoods.saveTemp`;
return request(data, "post");
}
// 查询升级商品别名列表
export function getUpgradeGoodsAliasList(data) {
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.listByMerchantGoodsRef`
return request(data)
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.listByMerchantGoodsRef`;
return request(data);
}
// 升级商品别名保存
export function saveUpgradeGoodsAlias(data) {
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.save`
return request(data)
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.save`;
return request(data);
}
// 获取车品牌列表
export function getCarBrandList(data) {
data.method = `dj.api.car.getCarBrandList`
return request(data)
data.method = `dj.api.car.getCarBrandList`;
return request(data);
}
// 分页查询 商户列表-带关联关系
export function getMerchantListApi(data) {
data.method = "dj.api.scenemerchantref.findAllMerchantPage";
return request(data, "post");
}
......@@ -433,5 +433,14 @@ export function getReconciliationGoodsTypeListApi(data = {}) {
return request(data, RequestMethods.POST);
}
/**
* 获取轻改门店列表数据
*/
export function getMerchantList(data) {
data.method = "dj.api.servicemerchantref.pageServiceMerchantRef";
return request(data, RequestMethods.POST);
}
......@@ -7,7 +7,7 @@
import axios from "axios";
// Mock 基础配置
const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7475619-7210332-default/";
const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7490654-7226095-default/";
/**
* 创建 Mock Axios 实例
*/
......
......@@ -419,7 +419,7 @@ export function limitPrice(
pointDigit,
minValue,
maxValue,
regRule,
regRule
) {
let reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line
......@@ -427,8 +427,8 @@ export function limitPrice(
};
regRule = regRule || "priceReg";
if (
newValue
&& ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
newValue &&
((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
) {
return oldValue || "";
}
......@@ -437,18 +437,18 @@ export function limitPrice(
newValue = newValue + "";
let interger = newValue.split(".")[0];
let point = newValue.split(".")[1];
let intergerNum
= interger.length > intergerDigit
let intergerNum =
interger.length > intergerDigit
? oldValue.split(".")[0]
: interger;
let pointNum
= point.length > pointDigit ? point.slice(0, pointDigit) : point;
let pointNum =
point.length > pointDigit ? point.slice(0, pointDigit) : point;
newValue = pointDigit
? intergerNum + "." + pointNum
: newValue.split(".")[0];
} else {
newValue
= newValue.length > intergerDigit
newValue =
newValue.length > intergerDigit
? oldValue.slice(0, intergerDigit)
: newValue;
}
......@@ -481,13 +481,11 @@ export const appointDays = 35;
export const afterTodayOptions = {
disabledDate(date) {
if (
date < new Date(new Date().toLocaleDateString())
|| date
> new Date(
new Date().setDate(
new Date().getDate() + (appointDays - 1),
),
)
date < new Date(new Date().toLocaleDateString()) ||
date >
new Date(
new Date().setDate(new Date().getDate() + (appointDays - 1))
)
) {
return true;
}
......@@ -1111,9 +1109,9 @@ export const businessOptShowText = {
};
// 预警管理 所属业务 显示文字
export const orderBusinessType = {
"0": "轻改",
"1": "权益",
"2": "延保",
0: "轻改",
1: "权益",
2: "延保",
"-1": "其他",
};
......@@ -1683,14 +1681,14 @@ export const evaluationSourceOpt = [
{ confId: 4, confValue: "车况生成" },
];
export const evaluationStatusOptMap = {
"10": "#FDB757",
"20": "#2CCA74",
"30": "#2CCA74",
"31": "#2CCA74",
"32": "#2CCA74",
"40": "#2CCA74",
"50": "#2CCA74",
"100": "#8C8C8C",
10: "#FDB757",
20: "#2CCA74",
30: "#2CCA74",
31: "#2CCA74",
32: "#2CCA74",
40: "#2CCA74",
50: "#2CCA74",
100: "#8C8C8C",
"-1": "#EB4E4E",
};
// 合同类型
......@@ -1968,6 +1966,10 @@ export const djOrderTypeList = [
confId: "1",
confLabel: "正常订单",
},
{
confId: "6",
confLabel: "内部结算",
},
];
export const goodsAuditStatusList = [
......
......@@ -3,25 +3,29 @@
* 优先使用接口同步后的映射(见 syncStaffSceneLabelList);未加载前使用 LEGACY 兜底。
*/
/** @type {Record<number, number>} 冷启动 / 接口未返回前兜底 */
/** baseSceneCode → sceneType,冷启动 / 接口未返回前兜底(一码一型,避免「sceneType 多条共码」反转丢失) */
const LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE = {
100101: 1,
100102: 2,
110101: 2,
110201: 2,
110202: 2,
100103: 3,
120101: 7,
};
/**
* sceneType → 默认 baseSceneCode(与历史 getBaseSceneCodeBySceneType 行为一致:同类型多码时取约定主码)
* 注意:0 与 2 历史上均曾落到 110101,仅作路由/入参默认,细粒度以 baseSceneCode 为准。
*/
const LEGACY_SCENE_TYPE_TO_BASE_SCENE_CODE = {
0: 110101,
1: 100101,
2: 100102,
2: 110202,
2: 110201,
2: 110101,
3: 100103,
7: 120101,
};
/** baseSceneCode → scene_type,与 LEGACY 互逆 */
const LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE = Object.fromEntries(
Object.entries(LEGACY_SCENE_TYPE_TO_BASE_SCENE_CODE).map(
([sceneType, code]) => [String(code), Number(sceneType)]
)
);
/** @type {Map<number, number>} sceneType → baseSceneCode(数字),仅 status===1 的接口数据 */
let dynamicSceneTypeToBaseSceneCode = new Map();
......@@ -86,7 +90,10 @@ export function getSceneTypeByBaseSceneCode(baseSceneCode) {
return dynamicBaseSceneCodeToSceneType.get(key);
}
const hit = LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE[key];
const legacyKey = Number.isNaN(n) ? key : n;
const hit =
LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE[legacyKey] ??
LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE[key];
return hit !== undefined ? hit : NaN;
}
......
......@@ -312,7 +312,7 @@ export default {
background-color: #fff;
}
.el-input__inner {
.d2-search .el-input__inner {
line-height: 1px !important;
}
</style>
......@@ -296,7 +296,7 @@
</template>
<el-table-column v-if="tableParams.tableOption"
:align="tableParams.tableOption.align || 'center'"
fixed="right"
:fixed="tableParams.tableOption.fixed || 'right'"
label="操作"
:width="tableParams.tableOption.width || 'auto'">
<template #default="scope">
......
......@@ -90,7 +90,6 @@ export default {
props: {
fetchApi: {
required: true,
type: Function,
},
immediate: {
default: false,
......@@ -175,6 +174,10 @@ export default {
}
},
async getApi(loadMore = false, isImmediate = false) {
if (!isFunction(this.fetchApi)) {
console.log("不是个函数?", this.fetchApi);
return;
}
this.loading = true;
try {
const { list, query } = await this.fetchApi({
......
<template>
<el-button v-bind="$attrs"
:loading="loading"
v-on="$listeners">
<slot v-if="!loading"></slot>
</el-button>
</template>
<script>
export default {
name: "Btn",
props: {
loading: {
type: Boolean,
default: false,
},
},
};
</script>
export function readFileAsDataURL(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (event) => {
resolve(event);
};
reader.onerror = (error) => {
reject(error);
};
});
}
/**
* 轮询接口函数
* 使用递归 setTimeout 代替 setInterval,避免接口响应慢导致请求堆积的问题
*
* @param {Function} requestFn - 需要轮询的异步请求函数 (需返回 Promise)
* @param {Number} interval - 轮询间隔时间 (毫秒),默认 3000ms
* @param {Function} stopCondition - 停止轮询的条件函数,接收 requestFn 的结果作为参数,返回 true 则停止轮询
* @returns {Function} 返回一个可以手动停止轮询的函数 (cancel)
*/
export function startPolling(requestFn, interval = 3000, stopCondition = () => false) {
let timer = null;
let isStopped = false;
const loop = async () => {
if (isStopped)
return;
try {
// 执行请求
const result = await requestFn();
const condition = await stopCondition(result);
// 判断是否满足停止条件
if (condition) {
isStopped = true;
return;
}
} catch (error) {
console.error("轮询请求发生错误:", error);
// 发生错误时默认继续轮询,如果需要错误时停止,可以在 stopCondition 中处理,或者在这里加配置
if (timer) {
clearTimeout(timer);
}
}
// 安排下一次执行
if (!isStopped) {
timer = setTimeout(loop, interval);
}
};
// 立即执行第一次
loop();
// 返回手动停止轮询的函数
return () => {
isStopped = true;
if (timer) {
clearTimeout(timer);
timer = null;
}
};
}
export function isZeroOrNumber(val) {
const valid = (val === 0 || !Number.isNaN(val)) && val !== undefined && val !== null && val !== "";
return valid ? val : "-";
return val ?? "-";
}
/**
* 传入 存放 options的数组, 把所有 第一项 不是 "" 的, 添加第一项, 然后设置 label为 全部
* @param {*} list 存放 options的数组
*/
export function setAllOptions(list) {
list.forEach((item, index) => {
if (item.type === "select") {
if (item.optionList[0][item.optionLabel] !== "全部") {
item.optionList.unshift({
[item.optionId]: "",
[item.optionLabel]: "全部",
});
}
}
});
return list;
}
/**
* 异步睡眠函数
* @param {number} ms - 睡眠时长(毫秒)
* @returns {Promise<void>}
*/
export function syncTime(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
......@@ -34,41 +34,40 @@ Vue.use(VueLazyload, {
attempt: 3, // 尝试加载次数
});
// 实例化
process.env.NODE_ENV === "production" &&
Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// 与 vue.config 中 SentryWebpackPlugin.release 一致,sourcemap 才能正确解析栈
release: process.env.VUE_APP_VERSION,
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException =
event.exception.values[0].value.startsWith(
"Non-Error exception captured"
) ||
hint.originalException.message.startsWith(
"Non-Error exception captured"
);
if (isNonErrorException) {
// We want to ignore those kind of errors
return null;
}
return event;
},
// "send-default-pii": true
});
process.env.NODE_ENV === "production" && Sentry.init({
Vue,
dsn: "https://39bc80d3bb0a419a8d7d9bf5a39678e3@sentry.glsx.com.cn/24",
// 与 vue.config 中 SentryWebpackPlugin.release 一致,sourcemap 才能正确解析栈
release: process.env.VUE_APP_VERSION,
// dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ["localhost", "my-site-url.com", /^\//],
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true,
// 解决火狐浏览器 无法捕获错误的问题
beforeSend(event, hint) {
const isNonErrorException
= event.exception.values[0].value.startsWith(
"Non-Error exception captured",
)
|| hint.originalException.message.startsWith(
"Non-Error exception captured",
);
if (isNonErrorException) {
// We want to ignore those kind of errors
return null;
}
return event;
},
// "send-default-pii": true
});
// d2Admin 已导入
// import ElementUI from 'element-ui'
......@@ -109,64 +108,76 @@ Vue.directive("preventReClick", {
event && event.stopImmediatePropagation();
}
},
true
true,
);
},
});
let baseConfig = config;
// 如果要改地址, 优先去 .env.development 中配置
// 如果要创建自己的配置 可以 创建.env.development.local 文件. 该文件已被 git忽略, 不会上传, 优先级比.env.development更高, 满足本地开发的需求.
// 生产环境和测试环境用的都是 .env文件里面的内容. 不会串
// 这样配置, 不会再出现 改了地址 , 上传到git 甚至 上到测试环境 的情况
// 唯一需要注意的是, 改了 .env.development.local 文件的内容, 需要重新 npm run serve
/**
* 另: 在本地开发时,优先级是 .env.development.local > .env.development > .env.production > .env
* 以 VUE_APP_A 这个变量为例
* 如果 .env.development.local 文件没有, 就会取 .env.development 中的, 以此类推直到.env, 都没有 则返回 undefined
* 如果 所有 文件都有这个变量, 优先取 .env.development.local的
* 在生产环境中:
* 只取 .env.production .env 两个文件中的.
*/
const configCenterUrl = process.env.VUE_APP_CONFIG_CENTER_URL || "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config";
console.log("configCenterUrl", configCenterUrl);
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config"
)
.then(
(response) => {
// 处理http响应
return response.json();
},
(error) => {
// 处理错误
console.log(error);
}
)
.then((response) => {
const { code, data } = response;
console.log("response", code, response);
if (code == "200") {
console.log(data);
baseConfig = data;
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response;
window.$fetchConfig = response;
console.log(response);
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: (_) => util.cookies.get("token"),
fetch(configCenterUrl).then(
(response) => {
// 处理http响应
return response.json();
},
(error) => {
// 处理错误
console.log(error);
},
).then((response) => {
const { code, data } = response;
console.log("response", code, response);
if (code == "200") {
console.log(data);
baseConfig = data;
// console.log("baseConfig", baseConfig)
// window.$fetchConfig = data
} else {
baseConfig = response;
window.$fetchConfig = response;
console.log(response);
window.$gscApi = new Request({
...response.gsc,
// baseURL:'http://192.168.3.145:9898/gsc-vcp-web-facade',
// baseURL: 'http://gsc.test.glsx.com.cn/gsc-vcp-web-facade',
session: {
requiresSession: true,
sessionId: _ => util.cookies.get("token"),
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg);
},
events: {
error: (error, config) => {
Vue.prototype.$message.error(error.msg);
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear");
util.cookies.remove("token");
router.replace("/login");
Vue.prototype.$message.error("登录超时,请重新登录");
},
logout: (response, config) => {
store.dispatch("d2admin/user/clear");
util.cookies.remove("token");
router.replace("/login");
Vue.prototype.$message.error("登录超时,请重新登录");
},
});
console.log(window.$gscApi, "========");
}
})
.finally(() => {
init();
});
},
});
console.log(window.$gscApi, "========");
}
}).finally(() => {
init();
});
function init() {
new Vue({
router,
......
......@@ -20,17 +20,38 @@
:value="item.confId" />
</el-select>
</el-form-item>
<el-form-item label="业务场景:" prop="baseSceneCodeList">
<el-select v-model="infoForm.baseSceneCodeList"
<!-- 权益类:多选 +「全部」;:key 避免切换业务线时 el-select 复用导致单选/多选展示层叠 -->
<el-form-item v-if="!isLightBusinessLine"
:key="`biz-scene-equity-${infoForm.sceneType}`"
label="业务场景:"
prop="baseSceneCodeList"
required>
<el-select :key="`biz-scene-select-equity-${infoForm.sceneType}`"
v-model="infoForm.baseSceneCodeList"
multiple
collapse-tags
style="width:400px"
@change="handleSceneTypeChange">
<el-option v-for="item in sceneTypeOptionList"
@change="handleEquitySceneChange">
<el-option v-for="item in equitySceneSelectOptions"
:key="item.confId"
:label="item.confLabel"
:value="item.confId" />
</el-select>
</el-form-item>
<!-- 轻改类:单选、无「全部」,默认第一项 -->
<el-form-item v-else
:key="`biz-scene-light-${infoForm.sceneType}`"
label="业务场景:"
prop="baseSceneCodeList"
required>
<el-select :key="`biz-scene-select-light-${infoForm.sceneType}`"
v-model="lightSceneSelectModel"
style="width:400px"
@change="handleLightSceneChange">
<el-option v-for="item in lightSceneSelectOptions"
:key="item.confId"
:label="item.confLabel"
:value="item.confId" />
</el-select>
</el-form-item>
<el-form-item label="商户类型:" prop="merchantType">
......@@ -203,7 +224,10 @@ export default {
return {
loading: false,
multipleLimit: 10,
sceneTypeList: [],
/** 权益类业务场景选项(接口原始列表,不含「全部」) */
equitySceneOptionList: [],
/** 轻改类业务场景选项(接口原始列表,无「全部」) */
lightSceneOptionList: [],
// 判断是否是模版模式
isTmpl: false,
localTmplList: deepClone(localTmplList),
......@@ -269,7 +293,27 @@ export default {
formRules: {
sceneType: [{ required: true, message: "请选择业务线", trigger: "change" }],
baseSceneCodeList: [{ required: true, message: "请选择业务场景", trigger: "change" }],
baseSceneCodeList: [
{
validator: (rule, value, callback) => {
if (!Array.isArray(value) || !value.length) {
callback(new Error("请选择业务场景"));
return;
}
if (String(this.infoForm.sceneType) === "1") {
const v = value[0];
if (v === undefined || v === null || `${v}` === "") {
callback(new Error("请选择业务场景"));
return;
}
callback();
return;
}
callback();
},
trigger: "change",
},
],
merchantType: [{ required: true, message: "请选择商户类型", trigger: "change" }],
merchant: [
{ required: true, message: "请选择对账商户", trigger: "change" },
......@@ -336,20 +380,45 @@ export default {
...mapState({
dowloadList: state => state.d2admin.user.dowloadList,
}),
sceneTypeOptionList() {
// 选项 = 全部 + 当前业务线动态获取的场景列表
const inputList = Array.isArray(this.sceneTypeList) ? this.sceneTypeList : [];
const filteredList = inputList
.map((item) => {
const confId = item?.confId ?? item?.id;
const confLabel = item?.confLabel ?? item?.name;
return { confId, confLabel };
})
.filter(item => item.confId !== undefined && item.confId !== null && item.confId !== "");
return [
{ confId: "", confLabel: "全部" },
...filteredList,
];
isLightBusinessLine() {
return String(this.infoForm.sceneType) === "1";
},
/** 轻改类单选:控件绑定标量,与接口统一的 baseSceneCodeList 为单元素数组 */
lightSceneSelectModel: {
get() {
if (!this.isLightBusinessLine) {
return "";
}
const arr = this.infoForm.baseSceneCodeList;
if (Array.isArray(arr) && arr.length) {
const v = arr[0];
if (v !== undefined && v !== null && `${v}` !== "") {
return v;
}
}
return "";
},
set(val) {
if (!this.isLightBusinessLine) {
return;
}
if (val === undefined || val === null || `${val}` === "") {
this.infoForm.baseSceneCodeList = [""];
} else {
this.infoForm.baseSceneCodeList = [val];
}
},
},
equitySceneSelectOptions() {
const rows = Array.isArray(this.equitySceneOptionList)
? this.equitySceneOptionList
: [];
return [{ confId: "", confLabel: "全部" }, ...rows];
},
lightSceneSelectOptions() {
return Array.isArray(this.lightSceneOptionList)
? this.lightSceneOptionList
: [];
},
},
......@@ -366,7 +435,6 @@ export default {
},
"infoForm.sceneType": {
handler() {
// 切换业务线时,业务场景默认回到“全部”
this.infoForm.baseSceneCodeList = [""];
this.syncSceneTypeList();
},
......@@ -396,7 +464,8 @@ export default {
syncSceneTypeList() {
const sceneType = Number(this.infoForm?.sceneType);
if (this.infoForm?.sceneType === "" || this.infoForm?.sceneType === null || this.infoForm?.sceneType === undefined || Number.isNaN(sceneType)) {
this.sceneTypeList = [];
this.equitySceneOptionList = [];
this.lightSceneOptionList = [];
return;
}
getScenesByParams({ bizTypeCode: sceneType === 0 ? 2 : 1 }).then((res) => {
......@@ -409,12 +478,44 @@ export default {
confLabel: item?.name,
}))
.filter(item => item.confId !== undefined && item.confId !== null && item.confId !== "");
this.sceneTypeList = normalized;
if (sceneType === 0) {
this.equitySceneOptionList = normalized;
} else if (sceneType === 1) {
this.lightSceneOptionList = normalized;
}
this.applyDefaultBusinessScene();
this.clearBusinessSceneValidate();
}).catch(() => {
this.sceneTypeList = [];
if (sceneType === 0) {
this.equitySceneOptionList = [];
} else if (sceneType === 1) {
this.lightSceneOptionList = [];
}
this.applyDefaultBusinessScene();
this.clearBusinessSceneValidate();
});
},
applyDefaultBusinessScene() {
if (String(this.infoForm.sceneType) === "1") {
const first = this.lightSceneOptionList[0]?.confId;
if (first !== undefined && first !== null && `${first}` !== "") {
this.infoForm.baseSceneCodeList = [first];
} else {
this.infoForm.baseSceneCodeList = [""];
}
return;
}
this.infoForm.baseSceneCodeList = [""];
},
clearBusinessSceneValidate() {
this.$nextTick(() => {
const form = this.$refs.accountForm;
if (form) {
form.clearValidate(["baseSceneCodeList"]);
}
});
},
handleSceneTypeChange(value) {
handleEquitySceneChange(value) {
if (!Array.isArray(value)) {
return;
}
......@@ -423,12 +524,16 @@ export default {
return;
}
if (value.includes("") && value.length > 1) {
// 多选时,“全部”与具体值互斥;以最后一次选择为准
this.infoForm.baseSceneCodeList = value[value.length - 1] === ""
? [""]
: value.filter(v => v !== "");
}
},
handleLightSceneChange() {
this.$nextTick(() => {
this.$refs.accountForm?.validateField("baseSceneCodeList");
});
},
selectMerchant() {
let params = {};
this.loading = true;
......
......@@ -191,7 +191,8 @@
<auth-button :show-btn-ids="['9050101']" category="Button" />
<!-- </span> -->
</d2-table-header>
<el-table :data="tableData"
<el-table v-loading="tableLoading"
:data="tableData"
row-key="uniqueKey"
:tree-props="{ children: 'subOrderProfitAllocations' }">
<!-- <el-table-column v-if="!userInfo.beSuper"
......@@ -234,8 +235,7 @@
<span>{{ scope.row.customerName || "-" }}</span>
</template>
</el-table-column>
<el-table-column v-if="sellerName_visible"
prop="sellerName"
<el-table-column prop="sellerName"
label="转化员"
align="center">
<template #default="scope">
......@@ -694,6 +694,7 @@ export default {
channelType: "",
subSceneType: [""],
baseSceneCodeList: [""],
baseSceneCode: "",
businessModel: "",
reconciliationFlag: "",
},
......@@ -749,6 +750,36 @@ export default {
},
},
{
label: "业务场景",
name: "baseSceneCode",
type: "select",
isHide: true,
isClear: false,
prependAllOption: false,
optionList: [],
optionId: "baseSceneCode",
optionLabel: "name",
optionsName: "subSceneTypeLightList",
placeholder: "请选择业务场景",
changeAttr: (value) => {
const ALL = "";
let next;
if (
value === undefined
|| value === null
|| value === ""
|| `${value}` === ""
) {
next = [ALL];
} else {
const s
= typeof value === "string" ? value : String(value);
next = [s];
}
this.searchForm.baseSceneCodeList = next;
},
},
{
label: "商户名称",
name: "merchantNameKeyWord",
type: "input",
......@@ -881,6 +912,7 @@ export default {
},
],
tableData: [],
tableLoading: false,
baseData: {
parkServiceList: [],
......@@ -893,6 +925,8 @@ export default {
PlatformMerchantList: [],
channelTypeList: [],
subSceneTypeList: [],
/** 轻改场景业务场景选项(无「全部」) */
subSceneTypeLightList: [],
reconciliationFlagList: [],
},
total: 0,
......@@ -962,7 +996,7 @@ export default {
this.getSummary();
},
"searchForm.sceneType": {
handler(val) {
async handler(val) {
if (val == 0 || val == 4) {
/**
1.0场景(暂无业务支撑)
......@@ -1005,8 +1039,15 @@ export default {
this.shopProfitType_visible = false;
this.yq_visible = true;
}
this.handleReset(val);
this.syncSubSceneTypeList();
const idxMulti = this.findFormIdx("subSceneType");
const idxSingle = this.findFormIdx("baseSceneCode");
if (idxMulti !== -1 && idxSingle !== -1) {
const lightTab = String(val) === "1";
this.showFormData[idxMulti].isHide = lightTab;
this.showFormData[idxSingle].isHide = !lightTab;
}
this.handleReset(val, true);
await this.syncSubSceneTypeList();
this.getList();
this.getTotal();
},
......@@ -1050,16 +1091,21 @@ export default {
const sceneType = Number(this.searchForm?.sceneType);
if (sceneType === "" || sceneType === null || sceneType === undefined) {
this.baseData.subSceneTypeList = [];
this.baseData.subSceneTypeLightList = [];
this.searchForm.baseSceneCode = "";
this.searchForm.baseSceneCodeList = [""];
this.getOptionsList();
return;
return Promise.resolve();
}
const subSceneAllOption = { baseSceneCode: "", name: "全部" };
const applySubSceneTypeList = (rows) => {
const rest = rows.filter(item => item.baseSceneCode !== "");
this.baseData.subSceneTypeList = [subSceneAllOption, ...rest];
this.baseData.subSceneTypeLightList = rest;
this.applyDefaultBaseSceneCodeForLightTab();
this.getOptionsList();
};
getScenesByParams({ bizTypeCode: sceneType === 0 ? 2 : 1 })
return getScenesByParams({ bizTypeCode: sceneType === 0 ? 2 : 1 })
.then((res) => {
const list = Array.isArray(res)
? res
......@@ -1077,6 +1123,32 @@ export default {
applySubSceneTypeList([]);
});
},
/** 1.1 轻量 Tab 单选业务场景:默认第一项;非该 Tab 清空 */
applyDefaultBaseSceneCodeForLightTab() {
const lightTab
= this.searchForm.sceneType == 1 || this.searchForm.sceneType === "1";
if (!lightTab) {
this.searchForm.baseSceneCode = "";
return;
}
const list = this.baseData.subSceneTypeLightList || [];
const first = list[0];
if (
first
&& first.baseSceneCode !== undefined
&& first.baseSceneCode !== null
&& `${first.baseSceneCode}` !== ""
) {
const code = first.baseSceneCode;
this.searchForm.baseSceneCode = code;
this.searchForm.baseSceneCodeList = [
typeof code === "string" ? code : String(code),
];
} else {
this.searchForm.baseSceneCode = "";
this.searchForm.baseSceneCodeList = [""];
}
},
handleAccountConfirm() {
this.fileVisible = true;
},
......@@ -1129,7 +1201,10 @@ export default {
this.financeChart.setOption(funnelOption);
});
},
handleReset(sceneType) {
/**
* @param fromSceneTabWatch Tab 切换时由 watcher 传入 true:场景列表将在 syncSubSceneTypeList 后统一设默认项,此处不再按旧列表回填
*/
handleReset(sceneType, fromSceneTabWatch = false) {
this.searchForm = {
time: "",
yqMerchantId: "",
......@@ -1141,6 +1216,7 @@ export default {
channelType: "",
subSceneType: [""],
baseSceneCodeList: [""],
baseSceneCode: "",
businessModel: "",
sceneType,
reconciliationFlag: "",
......@@ -1157,6 +1233,9 @@ export default {
};
// this.userInfo.beSuper && (this.baseData.storeIdList = [])
this.baseData.storeIdList = [];
if (!fromSceneTabWatch && (sceneType == 1 || sceneType === "1")) {
this.applyDefaultBaseSceneCodeForLightTab();
}
this.getOptionsList();
},
// 导出
......@@ -1209,8 +1288,10 @@ export default {
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === "select") {
const mayPrependAll = item.prependAllOption !== false;
if (
this.baseData[item.optionsName]?.length
mayPrependAll
&& this.baseData[item.optionsName]?.length
&& this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
......@@ -1223,7 +1304,7 @@ export default {
this.$set(
this.showFormData[index],
"optionList",
this.baseData[item.optionsName],
this.baseData[item.optionsName] || [],
);
}
});
......@@ -1254,47 +1335,51 @@ export default {
// const apiName = this.userInfo.beSuper ? 'getList' : 'getYqList'
// api[apiName](params).then(res => {
this.tableData = [];
api.getList(params).then((res) => {
if (params.sceneType == this.searchForm.sceneType) {
let temp = 1;
this.tableData = res.list.map((item, index) => {
this.isSubOrder = !item.hasOwnProperty("subOrderProfitAllocations");
item.uniqueKey = temp++;
if (
item.hasOwnProperty("subOrderProfitAllocations")
&& item.subOrderProfitAllocations
) {
item.goodsCost = "";
item.subOrderProfitAllocations.forEach((subItem) => {
// 有嘀加成本或第三方成本 商品成本显示-
if (
!this.filterEmpty(subItem.djCost)
|| !this.filterEmpty(subItem.thirdPartyCost)
) {
subItem.goodsCost = "";
}
subItem.uniqueKey = temp++;
// 主订单商品成本根据 是否有嘀加成本或商品成本累加计算
item.goodsCost
= this.subStr(item.goodsCost, Number(subItem.goodsCost)) > 0
? this.subStr(item.goodsCost, Number(subItem.goodsCost)) - 0
: "";
subItem = this.numAddPrefix(subItem);
subItem.positionStr
= this.positionTypeList?.filter(
val => val.position == subItem.goodsPosition,
)[0]?.confName || "-";
});
}
item = this.numAddPrefix(item);
return item;
});
this.page.currentPage = res.pageNum;
this.page.pageSize = res.pageSize;
this.total = res.total;
}
});
this.tableLoading = true;
api.getList(params)
.then((res) => {
if (params.sceneType == this.searchForm.sceneType) {
let temp = 1;
this.tableData = res.list.map((item, index) => {
this.isSubOrder = !item.hasOwnProperty("subOrderProfitAllocations");
item.uniqueKey = temp++;
if (
item.hasOwnProperty("subOrderProfitAllocations")
&& item.subOrderProfitAllocations
) {
item.goodsCost = "";
item.subOrderProfitAllocations.forEach((subItem) => {
// 有嘀加成本或第三方成本 商品成本显示-
if (
!this.filterEmpty(subItem.djCost)
|| !this.filterEmpty(subItem.thirdPartyCost)
) {
subItem.goodsCost = "";
}
subItem.uniqueKey = temp++;
// 主订单商品成本根据 是否有嘀加成本或商品成本累加计算
item.goodsCost
= this.subStr(item.goodsCost, Number(subItem.goodsCost)) > 0
? this.subStr(item.goodsCost, Number(subItem.goodsCost)) - 0
: "";
subItem = this.numAddPrefix(subItem);
subItem.positionStr
= this.positionTypeList?.filter(
val => val.position == subItem.goodsPosition,
)[0]?.confName || "-";
});
}
item = this.numAddPrefix(item);
return item;
});
this.page.currentPage = res.pageNum;
this.page.pageSize = res.pageSize;
this.total = res.total;
}
})
.finally(() => {
this.tableLoading = false;
});
},
// 价格计算精度丢失处理
subStr(num1, num2) {
......@@ -1409,9 +1494,12 @@ export default {
? this.searchForm.channelType.join(",")
: this.searchForm.channelType;
}
if (Array.isArray(this.searchForm.baseSceneCodeList) && this.searchForm.baseSceneCodeList.length) {
if (
Array.isArray(this.searchForm.baseSceneCodeList)
&& this.searchForm.baseSceneCodeList.length
) {
const selected = this.searchForm.baseSceneCodeList;
// “全部”= 不传;否则按后端需要解构成 baseSceneCodeList[0]=xxx
// “全部”= 不传;轻量 Tab 单选与完整 Tab 多选均走 baseSceneCodeList[n](数组序列化)
if (!selected.includes("")) {
selected.forEach((code, index) => {
params[`baseSceneCodeList[${index}]`] = code;
......
......@@ -22,12 +22,12 @@
<el-option v-if="includeAll"
:label="allLabel"
value="-1"
:disabled="hasOtherSelected" />
:disabled="allExclusive && hasOtherSelected" />
<template v-for="p in provinceOptions">
<el-option :key="`province_${p.code}`"
:value="getProvinceSelectValue(p.code)"
:label="p.name"
:disabled="hasAllSelected">
:disabled="allExclusive && hasAllSelected">
<div style="display: flex; align-items: center; justify-content: space-between;">
<span style="color: #000;font-weight: 500;">{{ p.name }}</span>
<span style="flex: 1;text-align: end;" @click.stop="toggleProvince(p.code)">
......@@ -39,7 +39,7 @@
:key="`city_${p.code}_${c.code}`"
:label="c.name"
:value="c.code"
:disabled="hasAllSelected">
:disabled="allExclusive && hasAllSelected">
<div style="padding-left: 18px">
{{ c.name }}
</div>
......@@ -84,6 +84,10 @@ export default {
type: Boolean,
default: true,
},
allExclusive: {
type: Boolean,
default: true,
},
allLabel: {
type: String,
default: "全国",
......@@ -179,17 +183,22 @@ export default {
});
});
const hasAll = details.some(d => `${d.cityCode}` === "-1" || `${d.cityCode}` === "ALL");
if (hasAll) {
if (hasAll && this.allExclusive) {
return [{ provinceCode: "-1", provinceName: this.allLabel, cityCode: "-1", cityName: this.allLabel }];
}
const seen = new Set();
return details.filter((d) => {
const unique = details.filter((d) => {
const code = `${d.cityCode ?? ""}`;
if (!code || seen.has(code))
return false;
seen.add(code);
return true;
});
if (!this.allExclusive && unique.some(d => `${d.cityCode}` === "-1" || `${d.cityCode}` === "ALL")) {
const allObj = { provinceCode: "-1", provinceName: this.allLabel, cityCode: "-1", cityName: this.allLabel };
return [allObj].concat(unique.filter(d => `${d.cityCode}` !== "-1" && `${d.cityCode}` !== "ALL"));
}
return unique;
},
selectedCityCodes() {
return this.selectedDetails.map(d => `${d.cityCode ?? ""}`).filter(Boolean);
......@@ -297,7 +306,7 @@ export default {
const prevDetails = Array.isArray(this.selectedDetails) ? this.selectedDetails.map(d => ({ ...d })) : [];
const values = Array.isArray(raw) ? raw : [];
const hasAll = values.includes("-1") || values.includes("ALL");
if (hasAll) {
if (hasAll && this.allExclusive) {
const allObj = { provinceCode: "-1", provinceName: this.allLabel, cityCode: "-1", cityName: this.allLabel };
this.$emit("before-change", { prev: prevDetails, next: [allObj], isOpen: this.isOpen });
this.$emit("input", [allObj]);
......@@ -306,7 +315,11 @@ export default {
return;
}
const citySet = new Set(values.filter(v => v && !this.isProvinceSelectValue(v)).map(v => String(v)));
const citySet = new Set(
values
.filter(v => v && !this.isProvinceSelectValue(v))
.map(v => String(v === "ALL" ? "-1" : v)),
);
const provinceTokens = values.filter(v => this.isProvinceSelectValue(v));
provinceTokens.forEach((token) => {
const pCode = this.getProvinceCodeFromSelectValue(token);
......@@ -329,6 +342,14 @@ export default {
return { ...meta };
return { provinceCode: k, provinceName: k, cityCode: k, cityName: k };
});
if (!this.allExclusive) {
const hasAllInNext = nextDetails.some(d => `${d.cityCode}` === "-1" || `${d.cityCode}` === "ALL");
if (hasAllInNext) {
const allObj = { provinceCode: "-1", provinceName: this.allLabel, cityCode: "-1", cityName: this.allLabel };
const rest = nextDetails.filter(d => `${d.cityCode}` !== "-1" && `${d.cityCode}` !== "ALL");
nextDetails.splice(0, nextDetails.length, allObj, ...rest);
}
}
const emit = () => {
this.$emit("before-change", { prev: prevDetails, next: nextDetails, isOpen: this.isOpen });
this.$emit("input", nextDetails);
......
......@@ -356,7 +356,6 @@ export default {
},
beforeSearchFn() {
return new Promise((resolve) => {
// 嘀加上架获取商品时 过滤 只 筛选出权益和延保类
if (this.filterParams.length > 0) {
this.searchForm[this.sceneType === 1 ? "excludeGoodsTypeList" : "goodsTypeList"] = this.filterParams;
}
......
......@@ -419,7 +419,7 @@
</el-button>
</el-form-item>
</el-form>
<!-- store-api (精品升级 次新车升配 售后众筹 查询嘀加的门店数据 getList)(售前会员权益升级 售后会员权益升级 售前延保 售后延保 二手车查询账户中心所有4s店 getAccountMerchantList -->
<!-- store-api (精品升级 次新车升配 售后众筹 查询嘀加的门店数据 getMerchantList 售后会员权益升级 售前延保 售后延保 二手车查询账户中心所有4s店 getAccountMerchantList -->
<RelateStoreDialog v-if="relateStoreVisible"
ref="formRelateStore"
:relate-store-visible="relateStoreVisible"
......@@ -427,7 +427,7 @@
:selected-scene-type="selectedSceneType"
:store-api="
filterBaseSceneCodeBySceneType([1, 2, 3]).includes(`${formData.baseSceneCode}`)
? getList
? getMerchantList
: getAccountMerchantList
"
:store-search-form="storeSearchForm"
......@@ -488,7 +488,7 @@
<script>
import GlOssApi from "glsk-oss-jssdk";
import { mapActions } from "vuex";
import { getAccountMerchantList, getList } from "@/api/merchant";
import { getAccountMerchantList, getMerchantList } from "@/api/merchant";
import { uploadImg, uploadPDF } from "@/api/sys.base";
import { limitPrice } from "@/common/format";
import { deepClone } from "@/common/util";
......@@ -571,7 +571,7 @@ export default {
},
data() {
return {
getList,
getMerchantList,
getAccountMerchantList,
equitySceneType: baseConfig.equitySceneType || [],
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
......
......@@ -340,14 +340,14 @@
</el-button>
</el-form-item>
</el-form>
<!-- store-api (精品升级 次新车升配 售后众筹 查询嘀加的门店数据 getList)(售前会员权益升级 售后会员权益升级 售前延保 售后延保 二手车 查询账户中心所有4s店 getAccountMerchantList -->
<!-- store-api (精品升级 次新车升配 售后众筹 查询嘀加的门店数据 getMerchantList 售后会员权益升级 售前延保 售后延保 二手车 查询账户中心所有4s店 getAccountMerchantList -->
<RelateStoreDialog v-if="relateStoreVisible"
ref="formRelateStore"
:is-hide="true"
:relate-store-visible="relateStoreVisible"
:selected-base-scene-code="formData.baseSceneCode"
:selected-scene-type="selectedSceneType"
:store-api="filterBaseSceneCodeBySceneType([1, 2, 3]).includes(formData.baseSceneCode) ? getList : getAccountMerchantList"
:store-api="filterBaseSceneCodeBySceneType([1, 2, 3]).includes(formData.baseSceneCode) ? getMerchantList : getAccountMerchantList"
:store-search-form="storeSearchForm"
:store-selected="storeSelected"
@handleRelateStoreClose="handleRelateStoreClose"
......@@ -405,7 +405,7 @@
<script>
import { mapActions } from "vuex";
import { getAccountMerchantList, getList } from "@/api/merchant";
import { getAccountMerchantList, getMerchantList } from "@/api/merchant";
import { uploadImg, uploadPDF } from "@/api/sys.base";
import { limitPrice } from "@/common/format";
import { deepClone } from "@/common/util";
......@@ -482,7 +482,7 @@ export default {
},
data() {
return {
getList,
getMerchantList,
getAccountMerchantList,
equitySceneType: baseConfig.equitySceneType || [],
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
......
......@@ -24,6 +24,7 @@
@selection-change="handleAreaSelectChange" /> -->
<ApplicableAreaQuerySelect v-model="applicableAreas"
:options="baseData.applicableAreaList"
:all-exclusive="false"
width="100%"
@change="val => handleAreaSelectChange(val)" />
</template>
......@@ -432,7 +433,7 @@ export default {
{
label: "供应商",
prop: "listShowProviderName",
width: "180"
width: "180",
},
{
label: "适用车型",
......@@ -1155,7 +1156,7 @@ export default {
handleUpdateClose() {
this.drawerUpdateVisible = false;
// 获取最新的供应商筛选项数据
this.getProviderList()
this.getProviderList();
this.$refs.productManageTable.refreshTable(); // 刷新列表
},
handleDelete(row) {
......
......@@ -56,8 +56,7 @@
:max="100"
:min="0"
placeholder="请输入销售占比"
:precision="2"
@change="handleSalesProportionPercentChange">
:precision="2">
</el-input-number>
<span class="fix-symbol">%</span>
</div>
......@@ -294,10 +293,6 @@ export default {
this.goodsList.splice(index, 1);
},
handleSalesProportionPercentChange(e) {
this.packageForm.oldesalesProportionPercent = e;
},
handleAppendProduct() {
this.goodsList?.unshift({
id: nanoid(),
......
......@@ -87,8 +87,7 @@
:max="100"
:min="0"
placeholder="请输入销售占比"
:precision="2"
@change="handleSalesProportionPercentChange">
:precision="2">
</el-input-number>
<span class="fix-symbol">%</span>
</div>
......@@ -399,9 +398,7 @@ export default {
}
this.handleSelectGoodsClose();
},
handleSalesProportionPercentChange(e) {
this.formData.oldesalesProportionPercent = e;
},
async validate() {
await this.$refs.formRef.validate();
// 如果校验不通过不会往下执行
......
import { defaults } from "lodash-es";
import { getMerchantListApi } from "@/api/commodity";
import { mockRequest } from "@/api/mock/request.mock.js";
import request from "@/api/request";
import RequestMethods from "@/api/request.methods";
// 表格页 审核通过
export function postShelfProductReviewApi(data = {}) {
data.method = "dj.api.goods.listing.approval.review";
return request(data, RequestMethods.POST);
}
// 表格页 审核拒绝
export function postShelfProductRejectApi(data = {}) {
data.method = "dj.api.goods.listing.approval.reject";
return request(data, RequestMethods.POST);
}
// 每次切换步骤都需要发送接口
export function putShelfProductUpdateStep(data = {}) {
data.method = "dj.api.goods.listing.approval.updateStep";
return request(data, RequestMethods.POST);
}
// 初始化获取当前步骤
export function getShelfProductUpdateStep(data = {}) {
data.method = "dj.api.goods.listing.approval.getConfirmStep";
return request(data, RequestMethods.POST);
}
// 最后一步 提交
export function postShelfProduct(data = {}) {
data.method = "dj.api.goods.listing.approval.submitReview";
return request(data, RequestMethods.POST);
}
// 获取数据 表格数据
export function getShelfProductPageApi(data = {}) {
data.method = "dj.api.goods.listing.approval.page";
return request(data, RequestMethods.POST);
}
// 获取基础信息
export function getShelfProductBaseInfoApi(data = {}) {
data.method = "dj.api.goods.listing.approval.getBaseInfo";
return request(data, RequestMethods.POST);
}
// 第一步 提交
export function postShelfProductBaseInfoApi(data = {}) {
data.method = "dj.api.goods.listing.approval.save";
return request(data, RequestMethods.POST, ["file"]);
}
// 第一步 通过上面的接口 得到uuid, 然后用这个uuid 轮训
export function postPollFileParseStatusApi(data = {}) {
data.method = `dj.api.common.importExcel.async.queryProcess`;
return request(data, "post");
}
export function getShelfProductBaseInfoByUUIDApi(data = {}) {
data.method = "dj.api.goods.listing.approval.getBaseInfoByUuid";
return request(data, RequestMethods.POST);
}
// 获取流量方列表
export function getTrafficSourceListApi(data = {}) {
data.method = "dj.api.create.business.approve.merchantPage";
return request(defaults(data, {
currentPage: 1,
pageSize: 9999,
}), RequestMethods.POST);
}
// 获取商品/套餐列表
export function getProductPackagesListApi(data = {}) {
data.method = "dj.api.goods.listing.product.page";
return request(data, RequestMethods.POST);
}
// 获取商品/套餐详情
export function getProductPackagesDetailApi(data = {}) {
data.method = "dj.api.goods.listing.product.getDetailById";
return request(data, RequestMethods.POST);
}
// 新增 商品 / 套餐
export function postProductPackagesApi(data = {}) {
data.method = "dj.api.goods.listing.product.insertOrUpdate";
return request(data, RequestMethods.POST);
}
export function delProductPackagesApi(data = {}) {
data.method = "dj.api.goods.listing.product.delete";
return request(data, RequestMethods.POST);
}
// 分页查询 商户列表-带关联关系
export async function getMerchantTrafficSideListApi(data = {}) {
const res = await getMerchantListApi(data);
res.list = res.list.map(item => ({
merchantId: item.merchantId,
merchantName: item.merchantName,
}));
return res;
}
// 分账配置 - 获取基础规则信息
export function getProfitSharingConfigBaseDetailApi(data = {}) {
data.method = "dj.api.goods.listing.divisionRule.getBaseRule";
return request(data, RequestMethods.POST);
}
// 分账配置 - 保存基础规则信息
export function postProfitSharingConfigBaseDetailApi(data = {}) {
data.method = "dj.api.goods.listing.divisionRule.saveBaseRule";
return request(data, RequestMethods.POST);
}
// 分账配置 - 所有品类列表
export function getProfitSharingConfigSpecialCategoryListApi(data = {}) {
data.method = "dj.api.goods.listing.divisionRule.listGoodsTypeGroup";
return request(data, RequestMethods.POST);
}
// 分账配置 - 品类详情
export function getProfitSharingConfigSpecialCategoryDetailApi(data = {}) {
data.method = "dj.api.goods.listing.divisionRule.getGoodsTypeGroupDetail";
return request(data, RequestMethods.POST);
}
// 获取不同场景的商品分类
export function getCategoryGoodsList(data = {}) {
data.method = "dj.api.goodsCategoryConfiguration.page.new";
return request(data);
}
// 获取其他品类已勾选的商品
export function getOtherGoodsItemApi(data) {
data.method = "dj.api.goods.listing.divisionRule.listOtherGoodsTypeItem";
return request(data, "post");
};
// 保存品类
export function postSpecialCategoryApi(data) {
data.method = "dj.api.goods.listing.divisionRule.saveGoodsTypeGroupRule";
return request(data, "post");
};
// 删除品类
export function delSpecialCategoryApi(data) {
data.method = "dj.api.goods.listing.divisionRule.deleteGoodsTypeGroupRule";
return request(data, "post");
};
// 分账品类 - 按具体商品 或 按 套餐 的下拉选择项
export function getSpecialCategoryProductApi(data) {
data.method = "dj.api.goods.listing.product.pageDetail";
return request(data, "post");
};
// 对账配置 - 获取基础规则信息
export function getReconciliationConfigBaseDetailApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.getBaseRule";
return request(data, RequestMethods.POST);
}
// 对账配置 - 保存基础规则信息
export function postReconciliationConfigBaseDetailApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.saveBaseRule";
return request(data, RequestMethods.POST);
}
// 对账配置 - 获取特殊品类列表
export function getReconciliationConfigSpecialCategoryListApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.listGoodsTypeGroup";
return request(data, RequestMethods.POST);
}
// 对账配置 - 删除特殊品类项
export function delReconciliationConfigSpecialCategoryApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.deleteGoodsTypeGroupRule";
return request(data, RequestMethods.POST);
}
// 对账配置 - 获取特殊品类详情
export function getReconciliationConfigSpecialCategoryDetailApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.getGoodsTypeGroupDetail";
return request(data, RequestMethods.POST);
}
// 对账配置 - 保存特殊品类详情
export function postReconciliationConfigSpecialCategoryDetailApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.saveGoodsTypeGroupRule";
return request(data, RequestMethods.POST);
}
// 对账配置 - 获取其他品类已勾选的商品
export function postReconciliationConfigOtherGoodsApi(data = {}) {
data.method = "dj.api.goods.listing.reconciliationRule.listOtherGoodsTypeItem";
return request(data, RequestMethods.POST);
}
<template>
<el-button v-bind="$attrs"
:loading="loading"
v-on="$listeners">
<slot v-if="!loading"></slot>
</el-button>
</template>
<script>
export default {
name: "Btn",
props: {
loading: {
type: Boolean,
default: false,
},
},
};
</script>
<template>
<div style="text-align: center; padding:20px 0">
<img style="width:360px" src="@/assets/empty-1.png" />
<div v-if="useTips" style="font-size: 14px;color: #5e6d82;">
<span>
暂无数据,请
</span>
<el-button type="primary"
size="small"
@click="handleCreate">
新增
</el-button>
</div>
</div>
</template>
<script>
export default {
name: "",
props: {
useTips: {
type: Boolean,
default: true,
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
handleCreate() {
this.$emit("create");
},
},
};
</script>
<style scoped lang="scss">
</style>
import { cloneDeep, get, isFunction } from "lodash-es";
import { nanoid } from "nanoid";
import { syncTime } from "@/libs/sleep";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant";
export default {
inject: {
formContext: {
default: null,
},
},
props: {
step: String,
order: Number,
},
data() {
return {
_id: `f_${nanoid()}`,
_loading: false,
_prefix: "create-",
editState: VIEW_MODE.VIEW,
/** 编辑缓存 */
editCache: null,
};
},
methods: {
/** 子组件实现 */
async validate() {},
/** 子组件实现 */
getData() {
return {};
},
isCreate(id) {
return String(id).startsWith(this.$data._prefix);
},
getEditState() {
return this.editState;
},
isEdit() {
return this.editState === VIEW_MODE.EDIT;
},
isView() {
return this.editState === VIEW_MODE.VIEW;
},
isSaving() {
return this.editState === VIEW_MODE.SAVING;
},
async startEdit(fn) {
if (this.editState !== VIEW_MODE.VIEW)
return;
// 缓存数据
console.log("得到数据 -> this.getData()", this.getData());
this.editCache = cloneDeep(this.getData());
if (isFunction(fn)) {
await fn();
}
await this.$nextTick();
this.editState = VIEW_MODE.EDIT;
},
async saveEdit() {
await this.validate();
if (this.editState !== VIEW_MODE.EDIT)
return;
this.editState = VIEW_MODE.SAVING;
try {
await this.withLoading(this.handleSave);
this.editState = VIEW_MODE.VIEW;
this.editCache = null;
} catch (e) {
this.editState = VIEW_MODE.EDIT;
throw e;
}
},
async handleCancelEdit(id, key = "id", listPath = "tabs.list") {
this.cancelEdit();
},
cancelEdit() {
if (this.editState !== VIEW_MODE.EDIT)
return;
this.setData(this.editCache);
this.editState = VIEW_MODE.VIEW;
this.editCache = null;
},
getCache() {
return this.editCache;
},
async withLoading(fn) {
if (!isFunction(fn)) {
return;
}
this.$data._loading = true;
try {
return await fn();
} finally {
await syncTime(500);
this.$data._loading = false;
}
},
_getLoading() {
return this.$data._loading;
},
_register() {
if (!this.formContext) {
return;
}
const stepName = this.$parent.name || this.step || "unknown";
const order = this.order || 1;
this.formContext.register(this.$data._id, {
validate: this.validate,
getData: this.getData,
getLoading: this._getLoading,
getEditState: this.getEditState,
group: stepName,
order,
});
},
},
mounted() {
console.log("this", this);
this._register();
},
beforeDestroy() {
if (!this.formContext) {
return;
}
this.formContext.unregister(this.$data._id);
},
};
<template>
<div v-if="isActive">
<slot />
</div>
</template>
<script>
export default {
name: "FormStep",
inject: ["formContext"],
props: {
name: {
type: String,
required: true,
},
useEdit: {
type: Boolean,
default: true,
},
// 每一步的接口
onSubmit: Function,
},
computed: {
isActive() {
if (!this.formContext.useEdit) {
return true;
}
return this.formContext.currentStepName === this.name;
},
},
mounted() {
this.formContext.registerStep({
name: this.name,
group: this.name,
onSubmit: this.onSubmit,
});
},
};
</script>
<template>
<div>
<slot :data="exposed" />
</div>
</template>
<script>
/**
* 编辑状态
* @typedef {'view' | 'editing' | 'saving'} EditState
*/
/**
* 表单项注册结构
* @typedef {object} FormItem
* @property {Function} [validate] 校验函数 (返回 Promise)
* @property {Function} [getData] 获取数据 () => Object
* @property {Function} [getLoading] 获取 loading 状态 () => boolean
* @property {string} group 所属 step
* @property {number} [order] 排序
*/
/**
* Step 配置
* @typedef {Object} FormStepConfig
* @property {string} name 步骤名称
* @property {(data: object, formData: object) => Promise<object>} [onSubmit] 提交函数 (返回 Promise)
*/
/**
* @typedef {Object.<string, FormItem>} Registry
* @typedef {Object.<string, any>} FormData
*/
/**
* 表单数据
* @typedef {Object.<string, any>} FormData 所有子项数据结构
*/
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js";
export default {
name: "FormProvider",
provide() {
return {
formContext: this,
};
},
model: {
prop: "currentStep",
event: "stepChange",
},
props: {
/**
* 当前步骤
* @type {number}
*/
currentStep: {
type: Number,
default: 0,
},
useEdit: {
type: Boolean,
default: true,
},
},
data() {
return {
/**
* 所有子项
* @type {Registry}
*/
registry: {},
/**
* 步骤配置
* @type {FormStepConfig[]}
*/
steps: [], //
/**
* 后端返回数据沉淀
* @type {FormData}
*/
formData: {},
// 专门存放每个 step 的 loading 状态
stepLoadingMap: {},
};
},
// 三层loading
// 第一层 由 formProvider控制的,点击下一步时会变更
// 这层只能由 formProvider这个最顶层的组件来控制
// 第二层 由 各个子组件中的 EditState 状态来进行控制的 - saving 时 && 第一层正在提交时 会为true
// 这层 由各个子组件的 editState 来控制
// 第三层 由 各个子组件中的 mixin中 _loading来控制的 - 主要由 mixin的 withLoading来控制. 用作初始化时的loading or submit的loading
// 由mixin的_loading 来控制
// 设置值的时候注意层次
computed: {
isEditing() {
return Object.values(this.registry).some((i) => {
return i.getEditState?.() === VIEW_MODE.EDIT;
});
},
/** 当前 step的provider 对应第一层 是否正在提交接口 */
currentProviderSubmitting() {
return this.stepLoadingMap[this.currentStepName] || false;
},
// 第一层
isProviderLoading() {
return this.stepLoadingMap[this.currentStepName] || false;
},
// 第二层 子组件中的editState是否正在 saving
isSaving() {
return Object.values(this.registry).some(i => i.getEditState?.() === VIEW_MODE.SAVING);
},
// 第三层 各个子组件的_loading
stepLoading() {
return this.getItems(this.currentStepName).some(i => i.getLoading?.());
},
// 所有loading
globalLoading() {
return this.isProviderLoading || this.isSaving || this.stepLoading;
},
// 聚合 第三层和提交
isStepLoading() {
return this.stepLoading || this.isSaving;
},
isSomeSubmitting() {
return Object.values(this.stepLoadingMap).some(Boolean);
},
/**
* @returns {string | undefined} 返回当前步骤名称
*/
currentStepName() {
return this.steps[this.currentStep]?.name;
},
/** 👇 对外暴露统一对象 */
exposed() {
return {
currentStep: this.currentStep,
isEditing: this.isEditing,
isSaving: this.isSaving,
globalLoading: this.globalLoading,
isProviderLoading: this.isProviderLoading,
stepLoading: this.stepLoading,
isStepLoading: this.isStepLoading,
getSomeItemStepLoading: this.getSomeItemStepLoading,
};
},
},
methods: {
/* ========= 注册 ========= */
/**
* @param {string} id
* @param {FormItem} config
*/
register(id, config) {
this.$set(this.registry, id, config);
},
/**
* @param {string} id
*/
unregister(id) {
this.$delete(this.registry, id);
},
/**
* @param {FormStepConfig} step
*/
registerStep(step) {
this.steps.push(step);
},
/* ========= 查询 ========= */
/**
* @param {string} group
* @returns {FormItem[]} 返回 这个 group的所有item
*/
getItems(group) {
return Object.values(this.registry)
.filter(i => i.group === group)
.sort((a, b) => (a.order || 0) - (b.order || 0));
},
// 获取指定子组件的第三层loading
getSomeItemStepLoading(group) {
return this.getItems(group).some(i => i.getLoading?.());
},
// /**
// * @param {string} stepName
// * @returns {boolean} 返回是否loading中
// */
// stepLoading(stepName) {
// return this.getItems(stepName).some(i => i.getLoading?.());
// },
/* ========= 校验 ========= */
async validate(group) {
if (this.isEditing) {
throw new Error("请先保存当前编辑项");
}
if (this.isSaving) {
throw new Error("正在保存,请稍后");
}
const items = this.getItems(group);
for (const item of items) {
if (item.validate) {
await item.validate();
}
}
},
/* ========= 收集数据 ========= */
/**
* @param {string} group
* @returns {Promise<object>} 返回收集到的数据
*/
async collect(group) {
const items = this.getItems(group);
const resList = await Promise.all(
items.map(i => i.getData?.()),
);
return Object.assign({}, ...resList);
},
/* ========= 提交(关键) ========= */
/**
* 提交某个 step
* @param {string} group
* @returns {Promise<any>} 返回提交结果
*/
async submitStep(group) {
const step = this.steps.find(s => s.name === group);
const payload = await this.collect(group);
if (!step?.onSubmit)
return payload;
// 1. 提交前:设置当前步骤 loading 为 true
this.$set(this.stepLoadingMap, group, true);
try {
const res = await step.onSubmit(payload, this.formData);
if (res && typeof res === "object") {
Object.assign(this.formData, res);
}
return res;
} finally {
this.$set(this.stepLoadingMap, group, false);
}
},
/* ========= 下一步(核心) ========= */
/**
* 下一步(校验 + 提交)
* @returns {Promise<void>}
*/
async next({ next = true } = {}) {
if (this.isEditing) {
throw new Error("请先保存当前编辑项");
}
if (this.isSaving) {
throw new Error("正在保存,请稍后");
}
const step = this.steps[this.currentStep];
await this.validate(step.name);
await this.submitStep(step.name);
if (next) {
this.$emit("stepChange", this.currentStep + 1);
}
},
/**
* 上一步
*/
prev() {
if (this.isEditing || this.isSaving) {
throw new Error("请先结束当前操作");
}
if (this.currentStep > 0) {
this.$emit("stepChange", this.currentStep - 1);
}
},
},
};
</script>
<template>
<div class="edit-page">
<div class="title">
<span>操作记录</span>
</div>
<div v-if="list && list.length > 0" style="padding: 20px">
<div v-for="(item, index) in list"
:key="index"
class="wrap">
<div class="type">
{{ item.operatorTypeText }}
</div>
<div class="operate"
style="width:300px"
:title="item.createdBy">
{{ item.operatorTypeText }}人:{{ item.createdBy }}
</div>
<div>{{ item.operatorTypeText }}时间:{{ item.createdDate }}</div>
<div v-if="item.operatorType === 2" class="reject-wrapper">
<span>驳回原因:</span>
<span>{{ item.remark || '-' }}</span>
</div>
</div>
</div>
<div v-else class="empty">
暂无记录
</div>
</div>
</template>
<script>
import FormProvideItemMixin from "../formProvider/formItemMixin.js";
export default {
name: "OperateList",
mixins: [FormProvideItemMixin],
props: {
logList: {
type: Array,
default: () => ([]),
},
},
data() {
// 这里存放数据
return {
types: { 1: "发起", 2: "驳回", 3: "审核" },
};
},
computed: {
list() {
return this.logList.map(item => ({
...item,
operatorTypeText: this.types[item.operatorType],
}));
},
},
};
</script>
<style lang="scss" scoped>
.edit-page {
margin: 0 0px 20px;
background: #ffffff;
.title {
height: 50px;
line-height: 50px;
padding: 0 20px;
border-bottom: 1px solid #e5e5e5;
font-size: 16px;
font-weight: 600;
color: #333333;
}
}
.wrap {
display: flex;
align-items: center;
color: #333333;
font-size: 14px;
margin-bottom: 20px;
.type {
font-weight: bold;
margin-right: 60px;
}
.operate {
min-width: 160px;
margin-right: 86px;
white-space: nowrap;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
}
.reject-wrapper {
margin-left: 86px;
}
}
.empty {
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
</style>
<template>
<div class="attribution-setting-wrapper">
<el-form-item :label="title" style="flex:1;">
<table cellpadding="0"
cellspacing="0"
class="table-block">
<tr class="table-header">
<th>分账对象/分账类目</th>
<!-- <td>平台方分账金额</td> -->
<th v-for="(item, index) in tableCols"
:key="index">
<span class="required-star">*</span>
{{ item.feeCategoryName || item.expenseCategoryName }}
</th>
</tr>
<tr v-for="(item, rowIndex) in tableRows"
:key="item.targetMerchantType"
class="table-body">
<td class="merchant-name-wrapper">
<span :title="getMerchantTypeName(item)">
{{ getMerchantTypeName(item) }}
</span>
</td>
<template v-for="(colItem, colIndex) in tableCols">
<td :key="`${colIndex}colList`" class="radio-wrapper">
<!-- 只在最后一行渲染 el-form-item 用于校验整列,避免每行都产生校验规则和报错 -->
<el-form-item v-if="rowIndex === tableRows.length - 1"
:prop="propPrefix ? `${propPrefix}_${colItem.expenseCategoryId}` : ''"
:rules="[{
required: true,
validator: validateCostAttributionSetting,
trigger: 'change',
colItem,
}]"
class="column-validator-item"
label-width="0">
<el-radio :value="value[colItem.expenseCategoryId]"
:label="item.targetMerchantType"
:disabled="disabled"
@input="val => handleRadioChange(colItem.expenseCategoryId, val)">
{{ "" }}
</el-radio>
</el-form-item>
<el-radio v-else
:value="value[colItem.expenseCategoryId]"
:label="item.targetMerchantType"
:disabled="disabled"
@input="val => handleRadioChange(colItem.expenseCategoryId, val)">
{{ "" }}
</el-radio>
</td>
</template>
</tr>
</table>
</el-form-item>
</div>
</template>
<script>
import { isBatchPublishMode } from "@/views/goods/shelfProduct/utils/status.js";
import { validateCostAttributionSetting } from "@/views/goods/shelfProduct/utils/validate.js";
export default {
name: "",
props: {
tableCols: {
type: Array,
default: () => ([]),
},
tableRows: {
type: Array,
default: () => ([]),
},
title: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
value: {
type: Object,
default: () => ({}),
},
propPrefix: {
type: String,
default: "",
},
shelfType: {
type: Number,
default: 2,
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
validateCostAttributionSetting,
handleRadioChange(expenseCategoryId, val) {
const newValue = { ...this.value, [expenseCategoryId]: val };
this.$emit("input", newValue);
// 手动触发该列的表单校验,以消除由于点击非第一行 radio 而未触发的校验错误
if (this.propPrefix) {
const propName = `${this.propPrefix}_${expenseCategoryId}`;
this.$nextTick(() => {
let parent = this.$parent;
while (parent && parent.$options.componentName !== "ElForm") {
parent = parent.$parent;
}
if (parent) {
parent.validateField(propName);
}
});
}
},
getMerchantTypeName(item) {
const name = {
1: "平台方",
2: "服务商",
3: "流量方",
4: "平台方",
5: "服务商2",
};
// 如果是 项目制批量上架 不显示name
if (isBatchPublishMode(this.shelfType)) {
return item.merchantName;
}
const type = item.targetMerchantType;
return `${name[type]}: ${item.merchantName}`;
},
},
};
</script>
<style scoped lang="scss">
.attribution-setting-wrapper {
display: flex;
> .label {
width: 150px;
text-align: right;
flex-shrink: 0;
vertical-align: middle;
font-size: 14px;
color: #606266;
line-height: 32px;
padding: 0 12px 0 0;
box-sizing: border-box;
}
.form-wrapper {
overflow-x: scroll;
flex-shrink: 0;
flex: 1;
}
::v-deep .table-block {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
th,
td {
border: 1px solid #e5e5e5;
}
.table-header {
padding: 14px 0;
th {
width: auto;
line-height: 20px;
color: #333333;
font-size: 14px;
&:first-child {
width: 150px;
}
.required-star {
color: #f56c6c;
margin-right: 4px;
}
}
}
.table-body {
td {
padding: 18px 0;
}
.merchant-name-wrapper {
line-height: 20px;
color: #666666;
font-size: 14px;
text-align: center;
}
.radio-wrapper {
text-align: center;
.el-form-item {
margin-bottom: 0 !important;
.el-form-item__content {
justify-content: center;
align-items: center;
.el-radio {
margin-right: 0;
}
.el-form-item__error {
width: 100%;
}
}
}
.column-validator-item {
::v-deep .el-form-item__error {
position: relative;
padding-top: 4px;
}
}
}
}
// th,
// td {
// font-size: 12px;
// font-weight: normal;
// padding: 0px 10px;
// border: 1px solid #e5e6e7;
// border-width: 0px 1px 1px 0px;
// border-spacing: 0;
// text-align: center;
// min-width: 100px;
// white-space: nowrap;
// &.merchant-name-wrapper {
// min-width: 150px;
// }
// }
// td {
// font-size: 14px !important;
// }
}
}
.pb-20 {
padding-bottom: 26px !important;
}
</style>
<template>
<div class="special-category-wrapper">
<Detail v-if="editState === VIEW_MODE.VIEW"
v-bind="$attrs"
:goods-list="options.productType"
:base-scene-code="baseSceneCode"
v-on="$listeners" />
<Modify v-if="editState === VIEW_MODE.EDIT"
ref="modifyRef"
v-bind="$attrs"
:goods-list="options.productType"
:base-scene-code="baseSceneCode" />
</div>
</template>
<script>
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js";
import Detail from "./specialCategoryDetail.vue";
import Modify from "./specialCategoryModify.vue";
export default {
name: "",
components: {
Detail,
Modify,
},
inheritAttrs: false,
props: {
editState: {
type: String,
default: VIEW_MODE.VIEW,
},
baseSceneCode: {
type: String,
required: true,
},
},
data() {
return {
VIEW_MODE,
options: {
category: {},
productType: [],
selectedGoodsType: [],
},
};
},
computed: {
},
mounted() {
},
methods: {
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<!-- 分账配置 - 特殊品类 - 编辑状态 -->
<div class="detail-wrapper ">
<Descriptions :schema="getSchema" :data="getSchemaData" />
<CostAttributionSetting :value="owningMerchantDistributionRulesMap"
prop-prefix="owningMerchantDistributionRulesMap"
title="费用归属设置"
disabled
:table-cols="tableCols"
:table-rows="tableRows" />
<CostAttributionSetting :value="merchantDistributionRulesMap"
prop-prefix="merchantDistributionRulesMap"
title="实际分账设置"
disabled
:table-cols="tableCols"
:table-rows="tableRows" />
</div>
</template>
<script>
import { pick } from "lodash-es";
import {
defaultSelectOptions,
otherSelectOptions,
severSelectOptions,
} from "@/common/constant/merchant";
import { isZeroOrNumber } from "@/libs/number.js";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import CostAttributionSetting from "@/views/goods/shelfProduct/components/profitSharingConfig/components/costAttributionSetting/index.vue";
import {
getTableCols,
getTableRows,
getTrafficExpenseCategoryRules,
rulesToMap,
} from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks";
import { categoryTypeOptions } from "@/views/goods/shelfProduct/constant/index.js";
export default {
name: "",
components: {
Descriptions,
CostAttributionSetting,
},
props: {
specialDetail: {
type: Object,
default: () => ({}),
},
baseSceneCode: {
type: String,
required: true,
},
realityShopMerchantId: {
type: Number,
default: 0,
},
realityShopMerchantName: {
type: String,
default: "",
},
realityPlatformMerchantId: {
type: Number,
default: 0,
},
realityPlatformMerchantName: {
type: String,
default: "",
},
partnerMerchantId: {
type: Number,
default: 0,
},
partnerMerchantName: {
type: String,
default: "",
},
partnerMerchantName2: {
type: String,
default: "",
},
partnerMerchantId2: {
type: Number,
default: 0,
},
realityShopLevel: {
type: Number,
default: 0,
},
shelfType: {
type: Number,
default: 0,
},
},
data() {
return {
};
},
computed: {
owningMerchantDistributionRulesMap() {
return rulesToMap(
this.specialDetail?.owningMerchantDistributionRules,
this.tableRows,
this.tableCols,
);
},
merchantDistributionRulesMap() {
return rulesToMap(
this.specialDetail?.merchantDistributionRules,
this.tableRows,
this.tableCols,
);
},
tableRows() {
return getTableRows(pick(this.$props, [
"realityShopMerchantId",
"realityShopMerchantName",
"realityPlatformMerchantId",
"realityPlatformMerchantName",
"partnerMerchantId",
"partnerMerchantName",
"partnerMerchantId2",
"partnerMerchantName2",
"realityShopLevel",
"shelfType",
]));
},
tableCols() {
return getTableCols(this.baseSceneCode, this.specialDetail?.expenseCategoryRuleList || [], this.specialDetail.goodsTypeGroupRelationList || []);
},
getSchemaData() {
const trafficSideExpenseCategoryRules = getTrafficExpenseCategoryRules(this.specialDetail?.expenseCategoryRuleList || []);
const data = trafficSideExpenseCategoryRules.reduce((acc, item) => {
const isAmount = [3, 10].includes(item.expenseCategoryCalculateType);
const unit = isAmount ? "元" : "%";
const value = isZeroOrNumber(item.expenseCategoryValue);
const calculateMode = item.calculateMode === 1 ? "按品类计算" : "按整单计算";
let typeLabel = "";
const options = this.getExpenseCategoryCalculateTypeOptions(item.applicationObjectType);
const opt = options.find(o => o.expenseCategoryCalculateType === item.expenseCategoryCalculateType);
if (opt) {
typeLabel = opt.label;
}
acc[item.expenseCategoryId] = {
calculateModeLabel: calculateMode,
text: `${value}${unit}`,
typeLabel,
};
return acc;
}, {});
// 不是全部的话
if (this.specialDetail.groupType !== 1) {
const categoryTypeOpt = categoryTypeOptions.find(o => o.value === this.specialDetail.categoryType);
data.categoryType = { text: categoryTypeOpt ? categoryTypeOpt.label : "-" };
let goodsStr = "-";
if (this.specialDetail.goodsTypeGroupRelationList && this.specialDetail.goodsTypeGroupRelationList.length) {
goodsStr = this.specialDetail.goodsTypeGroupRelationList.map((item) => {
if (this.specialDetail.categoryType === 1)
return item.goodsTypeName;
if (this.specialDetail.categoryType === 2)
return `${item.upgradeGoodsName}(${item.merchantGoodsCode})`;
if (this.specialDetail.categoryType === 3)
return `${item.packageName}(${item.packageCode})`;
return "-";
});
}
data.goodsTypeGroupRelations = { text: goodsStr };
}
return data;
},
getSchema() {
const trafficSideExpenseCategoryRules = getTrafficExpenseCategoryRules(this.specialDetail?.expenseCategoryRuleList || []);
const schema = trafficSideExpenseCategoryRules.map((item) => {
return {
descKey: item.expenseCategoryId,
label: item.expenseCategoryName || item.applicationObjectName,
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info)
return h("span", "-");
return h("span", info.typeLabel ? `${info.calculateModeLabel}:${info.typeLabel}:${info.text}` : info.text);
},
};
});
if (this.specialDetail.groupType !== 1) {
schema.unshift(
{
descKey: "categoryType",
label: "分账品类",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
return h("span", info ? info.text : "-");
},
},
{
descKey: "goodsTypeGroupRelations",
label: "商品",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info || info.text === "-") {
return h("span", "-");
}
if (Array.isArray(info.text)) {
return h("div", { class: "goods-relations-wrap" }, info.text.join(","));
}
return h("span", info.text);
},
},
);
}
return schema;
},
},
mounted() {
},
methods: {
getExpenseCategoryCalculateTypeOptions(targetType) {
if (targetType === 1) {
return [...defaultSelectOptions, ...otherSelectOptions];
}
if (targetType === 2) {
return severSelectOptions;
}
if (targetType === 3) {
return defaultSelectOptions;
}
return [];
},
},
};
</script>
<style scoped lang="scss">
::v-deep .goods-relations-wrap {
white-space: normal;
word-break: break-all;
overflow-wrap: anywhere;
}
</style>
<template>
<div class="">
<Descriptions :schema="getSchema" :data="getSchemaData" />
</div>
</template>
<script>
import {
defaultSelectOptions,
otherSelectOptions,
severSelectOptions,
} from "@/common/constant/merchant";
import { isZeroOrNumber } from "@/libs/number.js";
import { baseConfig } from "@/main";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { categoryTypeOptions } from "@/views/goods/shelfProduct/constant/index.js";
import { isEdit, isMemberRightsUpgrade, isQualityUpgrade, isSolarFilm, isView } from "@/views/goods/shelfProduct/utils/status.js";
export default {
name: "",
components: {
Descriptions,
},
props: {
specialDetail: {
type: Object,
required: true,
},
operationMode: {
type: Number,
require: true,
},
baseSceneCode: {
type: String,
required: true,
},
},
data() {
return {
};
},
computed: {
getGoodsTypeGroupRelationList() {
const shelfManageFinanceConfig = baseConfig.shelfManageFinanceConfig || [];
return this.specialDetail.expenseCategoryRuleList.filter(item => shelfManageFinanceConfig.includes(item.id));
},
getSchemaData() {
const data = {};
const categoryTypeOpt = categoryTypeOptions.find(o => o.value === this.specialDetail.categoryType);
data.categoryType = { text: categoryTypeOpt ? categoryTypeOpt.label : "-" };
// 处理商品关系
let goodsStr = "-";
if (this.specialDetail.goodsTypeGroupRelationList && this.specialDetail.goodsTypeGroupRelationList.length) {
goodsStr = this.specialDetail.goodsTypeGroupRelationList.map((item) => {
if (this.specialDetail.categoryType === 1)
return item.goodsTypeName || item.goodsType;
if (this.specialDetail.categoryType === 2)
return `${item.upgradeGoodsName}(${item.merchantGoodsCode})`;
if (this.specialDetail.categoryType === 3)
return `${item.packageName}(${item.packageCode})`;
return "-";
});
}
data.goodsTypeGroupRelations = { text: goodsStr };
if (this.getGoodsTypeGroupRelationList && this.getGoodsTypeGroupRelationList.length) {
const expenseRules = this.specialDetail.expenseCategoryRuleList || [];
this.getGoodsTypeGroupRelationList.forEach((item) => {
// 在 expenseCategoryRules 中寻找对应的配置
const rule = expenseRules.find(r => r.expenseCategoryId === item.feeCategoryNameId);
if (rule) {
const isAmount = [3, 10].includes(rule.expenseCategoryCalculateType);
const unit = isAmount ? "元" : "%";
const value = isZeroOrNumber(rule.expenseCategoryValue);
let typeLabel = "";
const options = this.getExpenseCategoryCalculateTypeOptions(item.applicationObjectType || 3);
const opt = options.find(o => o.expenseCategoryCalculateType === rule.expenseCategoryCalculateType);
if (opt) {
typeLabel = opt.label;
}
data[item.feeCategoryNameId] = {
text: `${value}${unit}`,
typeLabel,
calculateModeText: rule.calculateMode === 1 ? "按品类计算" : "按整单计算",
};
}
});
}
return data;
},
getSchema() {
const schema = [];
if (this?.specialDetail?.groupType !== 1) {
schema.push({
descKey: "categoryType",
label: "分账品类",
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
return h("span", info ? info.text : "-");
},
}, {
descKey: "goodsTypeGroupRelations",
label: "商品",
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info || info.text === "-") {
return h("span", "-");
}
if (Array.isArray(info.text)) {
return h("div", { class: "goods-relations-wrap" }, info.text.join(","));
}
return h("span", info.text);
},
});
}
if (this.getGoodsTypeGroupRelationList && this.getGoodsTypeGroupRelationList.length) {
this.getGoodsTypeGroupRelationList.forEach((item) => {
// 会员权益升级下 - > 人力成本 只有 运营模式 = 1 的时候才展示
// 精品升级照常显示
if (isMemberRightsUpgrade(this.baseSceneCode)) {
if (item.feeCategoryNameId === 807) {
if (this.operationMode !== 1) {
return;
}
}
}
// const isSunshineIncentive = [809, 901].includes(item.feeCategoryNameId);
schema.push({
descKey: item.feeCategoryNameId,
label: item.feeCategoryName,
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info)
return h("span", "-");
return h("span", `${info.calculateModeText}:${info.typeLabel}:${info.text}`);
// if (isSunshineIncentive) {
// return h("span", `${info.calculateModeText}:${info.typeLabel}:${info.text}`);
// }
// return h("span", info.typeLabel ? `${info.typeLabel}:${info.text}` : info.text);
},
});
});
}
return schema;
},
},
mounted() {
},
methods: {
getExpenseCategoryCalculateTypeOptions(targetType) {
if (targetType === 1)
return [...defaultSelectOptions, ...otherSelectOptions];
if (targetType === 2)
return severSelectOptions;
if (targetType === 3)
return severSelectOptions; // reconciliation中的platformFeeList用的是severSelectOptions
return [];
},
},
};
</script>
<style scoped lang="scss">
</style>
import { getQueryFeeCategoryByTypeApi } from "@api/merchant";
import { sortBy } from "lodash-es";
import { getReconciliationConfigSpecialCategoryDetailApi, getReconciliationConfigSpecialCategoryListApi } from "@/views/goods/shelfProduct/api";
import { syncExpenseCategoryRulesToFeeCategoryType } from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks";
// 获取特殊品类 选择项
export async function getSpecialCategoryList({ businessCode }) {
const data = await getReconciliationConfigSpecialCategoryListApi({ businessCode });
// 设置名字
return sortBy(data.map((item, index) => ({
...item,
title: item.groupType === 1 ? "全部品类" : "特殊品类",
})), "id");
}
// 获取特殊品类 详情
export async function getSpecialCategoryDetail({ businessCode, goodsTypeGroupId, baseSceneCode }) {
const detail = await getReconciliationConfigSpecialCategoryDetailApi({ businessCode, goodsTypeGroupId });
detail.expenseCategoryRuleList = await syncExpenseCategoryRulesToFeeCategoryType(baseSceneCode, detail.expenseCategoryRuleList, 2);
return detail;
}
export async function initOptions() {
const { list } = await getQueryFeeCategoryByTypeApi({
feeCategoryType: 2,
pageSize: 10000,
});
const flow = [];
const server = [];
const platform = [];
list?.forEach((item) => {
if (item.applicationObjectType === 1) {
flow.push(item);
} else if (item.applicationObjectType === 2) {
server.push(item);
} else if (item.applicationObjectType === 3) {
platform.push(item);
}
});
return { flow, server, platform };
}
<!-- 驳回 -->
<template>
<VenusDialog :visible="visible"
title="驳回"
width="480px"
height="196px"
@change="handleVisibleChange"
@close="handleClose"
@confirm="handleAddConfirm">
<div class="reject-dialog">
<div class="title-wrapper">
请填写驳回原因
</div>
<glsx-combi-form ref="formRef"
class="edit-form-container"
default-width="100%"
:form-data="formSchema"
:form-obj="infoForm"
form-ref="formRef"
:form-rules="formRules"
label-width="90px">
</glsx-combi-form>
</div>
</VenusDialog>
</template>
<script>
import VenusDialog from "@/components/venusDialog/index.vue";
import { postShelfProductRejectApi } from "@/views/goods/shelfProduct/api/index.js";
export default {
name: "RejectDialog",
components: {
VenusDialog,
},
model: {
prop: "show",
event: "update:show",
},
props: {
show: {
type: Boolean,
default: false,
},
businessCode: {
type: String,
required: true,
},
},
data() {
return {
infoForm: {
rejectedReason: "",
},
formRules: {
rejectedReason: [
{ required: true, message: "请输入驳回原因", trigger: "blur" },
],
},
formSchema: [
{
label: "驳回原因",
name: "rejectedReason",
type: "input",
maxlength: 50,
inputType: "textarea",
showLimit: true,
rows: 4,
},
],
};
},
computed: {
visible: {
get() {
return this.show;
},
set(val) {
this.$emit("update:show", val);
},
},
},
mounted() {
},
methods: {
handleClose(val) {
console.log(val);
},
handleVisibleChange(val) {
this.$emit("update:show", val);
},
async handleAddConfirm() {
const valid = await this.$refs.formRef.validate();
if (valid) {
await postShelfProductRejectApi({
rejectedReason: this.infoForm.rejectedReason,
businessCode: this.businessCode,
});
this.$emit("confirmSuccess");
this.visible = false;
}
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
overflow: hidden !important;
}
.reject-dialog {
> .title-wrapper {
line-height: 40px;
padding: 10px;
text-align: center;
background-color: #fafafa;
font-weight: 400;
font-size: 14px;
line-height: 16px;
margin-bottom: 20px;
}
::v-deep {
.el-form-item {
width: 100%;
display: flex;
overflow: hidden;
margin-right: 0 !important;
box-sizing: border-box;
.el-form-item__content {
flex: 1;
.el-textarea {
display: flex;
overflow: hidden;
.el-textarea__inner {
flex: 1;
flex-shrink: 0;
width: auto;
min-height: 96px;
}
.el-input__count {
display: block;
position: relative;
margin-top: auto;
flex-shrink: 0;
right: auto;
bottom: auto;
left: auto;
top: auto;
line-height: 1;
margin-left: 8px;
}
}
}
}
}
.tips {
color: #999999;
}
}
</style>
<template>
<div class="detail-wrapper">
<Descriptions :data="packageData" :schema="packagesSchema" />
<el-divider class="divider"></el-divider>
<div v-for="productData in productList"
:key="productData.id"
class="product-detail-wrapper">
<Product :product="productData"
:edit-state="VIEW_MODE.VIEW"
:base-scene-code="baseSceneCode"
:show-business-line="false"
:show-sales-proportion-percent="false"
:show-settlement-type="false"
:show-gift-cost="false"
:show-penetration-rate="false"
use-parent-mode />
<el-divider class="divider"></el-divider>
</div>
</div>
</template>
<script>
import { cloneDeep } from "lodash-es";
import Descriptions from "@/components/descriptions/index.vue";
import { getPackagesDetailDescriptionSchema } from "@/views/goods/shelfProduct/components/shelfProductConfirm/shelfProductConfirm.data";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import Product from "../../../product/index.vue";
export default {
components: {
Descriptions,
Product,
},
props: {
packages: {
type: Object,
default: () => ({ }),
},
baseSceneCode: {
type: String,
required: true,
},
},
data() {
return {
VIEW_MODE,
packageData: {},
packagesSchema: [],
};
},
computed: {
productList() {
return this.packageData.detailList.map(item => ({
upgradeGoodsId: item.upgradeGoodsId,
detailList: [item],
}));
},
},
watch: {
packages: {
handler(val) {
this.$set(this, "packageData", cloneDeep(val));
},
immediate: true,
deep: true,
},
},
async mounted() {
this.packagesSchema = await getPackagesDetailDescriptionSchema();
},
methods: {
},
};
</script>
<style lang="scss" scoped>
.detail-wrapper {
padding: 20px;
.product-detail-wrapper {
padding-top: 16px;
}
}
.divider {
margin: 0px 16px 0;
width: calc(100% - 32px);
}
</style>
<template>
<div class="content">
<div class="tabs-wrapper">
<Detail v-show="editState === VIEW_MODE.VIEW"
v-bind="$attrs"
:edit-state="editState"
v-on="$listeners" />
<Modify v-show="editState === VIEW_MODE.EDIT"
ref="modifyRef"
v-bind="$attrs"
:edit-state="editState"
v-on="$listeners" />
</div>
</div>
</template>
<script>
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue";
export default {
name: "",
components: {
Modify,
Detail,
},
inheritAttrs: false,
props: {
editState: {
type: String,
default: VIEW_MODE.VIEW,
},
},
data() {
return {
VIEW_MODE,
};
},
methods: {
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<div class="detail-wrapper">
<Descriptions :data="product" :schema="filterSchema">
<template #upgradeGoodsId-value>
<div class="sub-desc-wrapper">
<Descriptions :data="product" :schema="subFormItems" />
</div>
</template>
</Descriptions>
</div>
</template>
<script>
import Descriptions from "@/components/descriptions/index.vue";
import { getProductDetailDescriptionSchema, getProductDetailUpgradeGoodsDescriptionSchema } from "@/views/goods/shelfProduct/components/shelfProductConfirm/shelfProductConfirm.data.js";
export default {
name: "",
components: {
Descriptions,
},
props: {
product: {
type: Object,
required: true,
},
// 当套餐加载这个组件的时候 不需要结算方式
showSettlementType: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要销售占比
showSalesProportionPercent: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要赠送成本
showGiftCost: {
type: Boolean,
default: true,
},
},
data() {
return {
subFormItems: [],
schema: [],
};
},
computed: {
filterSchema() {
return this.schema.filter((item) => {
if (item.name === "settlementType") {
return this.showSettlementType;
}
if (item.name === "salesProportionPercent") {
return this.showSalesProportionPercent;
}
if (item.name === "detailList.0.giftCost") {
return this.showGiftCost;
}
return true;
});
},
},
async mounted() {
this.schema = await getProductDetailDescriptionSchema();
this.subFormItems = await getProductDetailUpgradeGoodsDescriptionSchema();
},
};
</script>
<style scoped lang="scss">
.sub-desc-wrapper {
background: #f2f4f7;
padding: 16px 8px 0;
::v-deep .el-col {
> .form-item {
margin-bottom: 16px;
line-height: 22px;
}
}
// border-bottom: 1px solid #eee;
}
.detail-wrapper {
padding: 20px 20px 0;
}
</style>
<template>
<div class="">
<Detail v-show="editState === VIEW_MODE.VIEW"
v-bind="$attrs"
v-on="$listeners" />
<Modify v-show="editState === VIEW_MODE.EDIT"
v-bind="$attrs"
ref="modifyRef"
v-on="$listeners" />
</div>
</template>
<script>
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue";
export default {
components: {
Detail,
Modify,
},
inheritAttrs: false,
props: {
editState: {
type: String,
required: true,
},
},
data() {
return {
VIEW_MODE,
};
},
computed: {
},
watch: {
},
methods: {
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
},
};
</script>
export const productFromRules = {
upgradeGoodsId: [
{ required: true, message: "请选择上架商品", trigger: "change" },
],
position: [
{ required: true, message: "请选择上架部位", trigger: "change" },
],
businessLine: [
{ required: true, message: "请选择业务线", trigger: "change" },
],
settlementType: [
{ required: true, message: "请选择结算方式", trigger: "change" },
],
salesProportionPercent: [
{ required: true, message: "请输入销售占比", trigger: "change" },
],
penetrationRate: [
{ required: true, message: "请输入渗透率要求", trigger: "change" },
],
sellPrice: [
{ required: true, message: "请输入售价", trigger: "change" },
],
minSellPrice: [
{ required: true, message: "请输入最低售价", trigger: "change" },
],
thirdPartyCost: [
{ required: true, message: "请输入第三方成本", trigger: "change" },
],
upgradeProductCost: [
{ required: true, message: "请输入升级成本", trigger: "change" },
],
};
export const packageFormRules = {
productName: [
{ required: true, message: "请输入套餐名称", trigger: "change" },
],
settlementType: [
{ required: true, message: "请选择结算方式", trigger: "change" },
],
salesProportionPercent: [
{ required: true, message: "请输入销售占比", trigger: "blur" },
],
penetrationRate: [
{ required: true, message: "请输入渗透率要求", trigger: "change" },
],
};
<template>
<VenusDialog v-model="showDialog"
title="选择商品"
width="70%"
draggable
destroy-on-close
:close-on-click-modal="false"
:confirm-loading="dialog.confirmLoading"
@confirm="handleSelectGoodsConfirm">
<div v-if="showDialog"
v-loading="loading"
class="selected-product-wrapper">
<d2-search class="show-search"
:form-data="table.formSchema"
label-width="100px"
:search-form="table.form">
<template #commodityCode>
<el-input v-model.trim="table.form.commodityCode"
:clearable="true"
:maxlength="50"
placeholder="请输入商品ID"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'commodityCode')" />
</template>
<template #type>
<el-input v-model.trim="table.form.type"
:style="{ width: '100%' }"
placeholder="请输入商品编码"
:clearable="true"
:maxlength="50" />
</template>
<template #thirdPartyCode>
<el-input v-model.trim="table.form.thirdPartyCode"
:clearable="true"
:maxlength="50"
placeholder="请输入第三方编码"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'thirdPartyCode')" />
</template>
<template #baseGoodsCommodityCode>
<el-input v-model.trim="table.form.baseGoodsCommodityCode"
:clearable="true"
:maxlength="50"
placeholder="请输入系列ID"
:style="{ width: '100%' }"
@input="event => searchInput(event, 'baseGoodsCommodityCode')" />
</template>
<template #goodsCascader>
<el-cascader v-model="table.form.tempGoodsType"
clearable
filterable
:options="options.productTypeList"
placeholder="请选择"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
style="width: 100%;"
@change="handleGoodsCascaderChange($event)">
</el-cascader>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="table.props.btnId"
size="small"
type="primary">
查询
</el-button>
</div>
<d2-table ref="tableRef"
:before-search-fn="beforeSearchFn"
:get-list-api="table.api"
:has-num="false"
:search-form="table.form"
:table-params="table.props"
@setTableFinishFun="setTableFinishFun">
<template #single-button="scope">
<el-radio v-model="selectedId"
:disabled="getExpandIds.includes(scope.scope.commodityCode)"
:label="scope.scope.commodityCode"
@change="handleSelectedRow(scope.scope)">
{{ '' }}
</el-radio>
</template>
<template #carName="scope">
<el-tooltip v-if="scope.scope.carTypeConfigList && scope.scope.carTypeConfigList.length" placement="top">
<template #content>
<div class="car-type-list">
<div v-for="(item, index) in scope.scope.carTypeConfigList" :key="index">
{{ item.seriesName }}
</div>
</div>
</template>
<div>{{ formatCar(scope.scope.carTypeConfigList) }}</div>
</el-tooltip>
<div v-else>
-
</div>
</template>
</d2-table>
</div>
</VenusDialog>
<!-- <d2-dialog :append-to-body="appendToBody"
btn-ok-label="确定"
class="select-goods-wrapper"
:is-visible.sync="selectGoodsVisible"
width="70%"
@closeDialog="handleSelectGoodsClose"
@confirmDialog="handleSelectGoodsConfirm">
</d2-dialog> -->
</template>
<script>
import { getAllCategory } from "@api/product";
import { getUpgradeProductList } from "@api/productManage";
import VenusDialog from "@/components/venusDialog/index.vue";
import { setAllOptions } from "@/libs/select";
import { baseConfig } from "@/main";
import { getSelectGoodsTableFilterSchema, selectGoodsTableSchema } from "@/views/goods/shelfProduct/components/shelfProductConfirm/shelfProductConfirm.data";
import { formatCar } from "@/views/goods/shelfProduct/utils/format.js";
import { isQualityUpgrade } from "@/views/goods/shelfProduct/utils/status";
export default {
name: "SelectGoodsDialog",
components: {
VenusDialog,
},
props: {
title: {
type: String,
default: "选择商品",
},
// 已选的activeId
activeId: {
type: [Number, String],
default: undefined,
},
// 同套餐下, 其他的ids
expandIds: {
type: Array,
default: () => ([]),
},
// 业务场景
baseSceneCode: {
type: String,
required: true,
},
show: {
type: Boolean,
default: false,
},
},
data() {
return {
table: {
formSchema: [],
form: {
upgradeGoodsName: "",
commodityCode: "",
specificationData: "",
type: "",
thirdPartyCode: "",
carTypeSearch: "",
goodsName: "",
baseGoodsCommodityCode: "",
tempGoodsType: [],
},
props: selectGoodsTableSchema,
api: getUpgradeProductList,
},
loading: false,
dialog: {
confirmLoading: false,
},
selectedRow: undefined,
selectedId: undefined,
options: {
productTypeList: [],
},
};
},
computed: {
// 排除 active Id
getExpandIds() {
if (!this.expandIds) {
return [];
}
return this.expandIds.filter(item => item !== this.activeId);
},
showDialog: {
get() {
return this.show;
},
set(val) {
this.$emit("update:show", val);
},
},
},
async mounted() {
this.loading = true;
try {
this.selectedId = this.activeId;
await this.getSelectedRow();
// this.keyDowmGetList 不知道在哪里设置的全局变量. 原有组件中需要传入
this.table.formSchema = getSelectGoodsTableFilterSchema(this.keyDowmGetList);
await this.getOptionsList();
} finally {
this.loading = false;
}
},
methods: {
formatCar,
handleSelectedRow(row) {
this.$set(this, "selectedRow", row);
this.selectedId = row.commodityCode;
},
// 初始化 通过id 获取详情
async getSelectedRow() {
if (!this.activeId) {
return;
}
const { list } = await getUpgradeProductList({
commodityCode: this.activeId,
pageSize: 1,
currentPage: 1,
});
if (list && list.length) {
this.$set(this, "selectedRow", list[0]);
}
},
searchInput(e, key) {
if (!/^[a-z0-9]*$/i.test(e)) {
this.table.form[key] = e.replace(/[^a-z0-9]/gi, "");
}
},
async getOptionsList() {
// 获取全部类目 屏蔽服务商自建类目
const res = await getAllCategory({ categoryTypeList: baseConfig.selfBuildGoodsType, pageSize: 9999, currentPage: 1 });
this.options.productTypeList = res?.list || [];
setAllOptions(this.table.formSchema);
},
setTableFinishFun(data) {
this.tableData = data;
},
handleGoodsCascaderChange(value) {
this.table.form.goodsType = value?.[0];
this.table.form.secondaryGoodsType = value?.[1];
this.table.form.thirdLevelGoodsType = value?.[2];
},
async beforeSearchFn() {
const filterParams = baseConfig.equitySceneType.concat(baseConfig.extendedPosiType) || [];
// 精品升级 excludeGoodsTypeList
// 会员权益 goodsTypeList
const searchKey = isQualityUpgrade(this.baseSceneCode) ? "excludeGoodsTypeList" : "goodsTypeList";
this.table.form[searchKey] = filterParams;
},
handleSelectGoodsConfirm() {
if (!this.selectedId) {
return this.$message.warning("请选择商品");
}
this.$emit("confirm", this.selectedRow);
},
handleReset() {
this.table.form = {
upgradeGoodsName: "",
commodityCode: "",
specificationData: "",
type: "",
thirdPartyCode: "",
carTypeSearch: "",
goodsName: "",
baseGoodsCommodityCode: "",
tempGoodsType: [],
};
// 重新查询
this.$refs.tableRef.refreshTable(true, true);
},
},
};
</script>
<style lang="scss" scoped>
.car-type-list {
max-height: 300px;
overflow-y: scroll;
}
.show-search {
::v-deep .d2-search-block {
padding: 0;
}
}
</style>
<template>
<div v-loading="loading" class="detail-wrapper">
<Descriptions :data="data" :schema="schema" />
</div>
</template>
<script>
import Descriptions from "@/components/descriptions/index.vue";
import { syncTime } from "@/libs/sleep";
import { getShelfProductBaseInfoApi } from "@/views/goods/shelfProduct/api/index.js";
import { getShelfProductImportSchema } from "@/views/goods/shelfProduct/components/shelfProductImport/shelfProductImport.data";
export default {
name: "",
components: {
Descriptions,
},
props: {
data: {
type: Object,
required: true,
},
},
data() {
return {
schema: [],
loading: false,
};
},
async created() {
this.loading = true;
},
async mounted() {
try {
this.schema = await getShelfProductImportSchema();
} finally {
await syncTime(500);
this.loading = false;
}
},
};
</script>
<style scoped lang="scss">
.detail-wrapper {
background-color: white;
}
</style>
<template>
<div class="import-progress-wrapper">
<transition name="fade" mode="out-in">
<div v-if="status === 'starting'"
key="starting"
class="starting-wrapper">
<el-progress stroke-linecap="square"
type="circle"
:width="80"
color="#2A58AD"
:percentage="percentage">
</el-progress>
<div class="progress-tips">
正在处理中
</div>
<div class="tips" style="width:317px">
说明:系统正在加急导入中,请耐心等待;导入过程中,请不要退出当前操作,否则将导致本次提交无效。
</div>
</div>
<div v-if="status === 'failed'"
key="failed"
class="failed-wrapper">
<div class="el-icon el-icon-warning"></div>
<span class="failed-tips">处理失败。可点击</span>
<el-button class="download-btn"
type="text"
size="small"
@click="handleDownloadFile">
下载失败模板
</el-button>
<span>查看失败原因。</span>
</div>
<div v-if="status === 'success'"
key="success"
class="success-wrapper">
<div class="el-icon el-icon-success"></div>
<span class="tips">处理成功,可返回列表查看。</span>
</div>
</transition>
</div>
</template>
<script>
import { downLoadFile as downloadFile } from "@/common/util";
export default {
name: "",
props: {
percentage: {
type: Number,
default: 25,
},
failUrl: {
type: String,
required: true,
},
status: {
type: String,
default: "unknown",
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
handleDownloadFile() {
if (!this.failUrl) {
return;
}
downloadFile(this.failUrl);
},
},
};
</script>
<style scoped lang="scss">
.import-progress-wrapper {
.starting-wrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.tips {
font-weight: 400;
font-size: 12px;
text-align: center;
color: #999;
}
.progress-tips {
font-weight: 400;
font-size: 14px;
text-align: center;
color: #333;
margin: 8px 0;
}
::v-deep .el-progress {
.el-progress__text {
font-weight: 400;
font-size: 14px !important;
color: #333;
top: 54%;
}
}
}
.el-icon {
font-size: 20px;
}
.failed-wrapper {
font-weight: 400;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
.el-icon-warning {
color: #f59619;
font-size: 20px;
}
.failed-tips {
margin-left: 10px;
}
.download-btn {
margin: 0 4px;
font-weight: 400;
font-size: 14px;
padding: 0;
}
}
.success-wrapper {
font-weight: 400;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
.el-icon-success {
color: #2cca74;
}
.tips {
margin-left: 10px;
}
}
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
<template>
<div class="shelf-product-import-modify-wrapper">
<glsx-combi-form ref="formRef"
:form-data="form.schema"
:form-obj="form.data"
:form-rules="form.rules"
is-block
default-width="530px"
size="mini"
label-width="150px">
<template #goodsCreateExcel>
<el-upload :auto-upload="false"
:limit="1"
action="1"
accept=".xls,.xlsx"
:on-change="handleGoodsCreateExcelChange"
:on-exceed="handleExceed"
:file-list="form.fileList">
<template #trigger>
<el-button size="small">
+ 添加附件
</el-button>
</template>
<el-button type="text"
style="margin-left:8px"
size="small"
@click="handleDownloadTemplate">
下载模板
</el-button>
<template #tip>
<div class="el-upload__tip">
注:用于商品上架信息获取,请务必按照模版准确填写并上传。
</div>
</template>
</el-upload>
</template>
</glsx-combi-form>
</div>
</template>
<script>
import { cloneDeep, defaults, last } from "lodash-es";
import { mapActions, mapState } from "vuex";
import { shelfProductImportModifyFormSchema } from "../../shelfProductImport.data.js";
export default {
name: "ShelfProductImportModify",
props: {
// businessCode: "",
// goodsCreateExcel: "",
// logList: [],
// merchantNames: "",
// shelfType: 1,
// }
formData: {
type: Object,
required: true,
},
},
data() {
return {
form: {
schema: [],
rules: {
baseSceneCode: [{ required: true, message: "请选择业务场景", trigger: "change" }],
shelfType: [{ required: true, message: "请选择上架类型", trigger: "change" }],
merchantId: [{ required: true, message: "请选择流量方信息", trigger: "change" }],
goodsCreateExcel: [{ required: true, message: "请上传商品上架表", trigger: "change" }],
},
data: { },
// 临时用
fileList: [],
},
};
},
computed: {
...mapState({
dowloadList: state => state.d2admin.user.dowloadList,
updateList: state => state.d2admin.user.updateList,
}),
},
watch: {
formData: {
immediate: true,
deep: true,
handler(val) {
// 默认数据
const formData = defaults(cloneDeep(val), {
shelfType: 1,
baseSceneCode: "100101",
});
this.$set(this.form, "data", formData);
},
},
},
async mounted() {
this.form.schema = shelfProductImportModifyFormSchema;
},
methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]),
handleExceed(files, fileList) {
const file = files[0];
if (file.size / 1024 / 1024 > 20) {
this.$message.error("上传文件大小不能超过 20MB!");
return;
}
this.form.fileList = [file];
this.form.data.goodsCreateExcel = file;
},
handleGoodsCreateExcelChange(_file, fileList) {
if (_file.status === "ready" && _file.size / 1024 / 1024 > 20) {
this.$message.error("上传文件大小不能超过 20MB!");
fileList.pop();
return;
}
const file = last(fileList);
if (file) {
this.form.fileList = [file];
this.form.data.goodsCreateExcel = file.raw;
} else {
this.form.fileList = [];
this.form.data.goodsCreateExcel = null;
}
},
handleDownloadTemplate() {
const { shelfType, baseSceneCode } = this.form.data;
if (!shelfType || !baseSceneCode) {
this.$message.error("请选择上架类型和业务场景");
return;
}
const params = { baseSceneCode, shelfType, method: "dj.api.create.business.approve.template.export" };
const list = [
...this.dowloadList,
{
name: "商品上架表模板",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime(),
},
];
this.actionSetDownloadList({ list, type: "dowloadList" });
},
async validate() {
await this.$refs.formRef.validate();
return this.form.data;
},
},
};
</script>
<style scoped lang="scss">
.el-upload__tip {
line-height: 20px;
margin-top: 4px;
font-weight: 400;
}
::v-deep .el-upload-list__item {
margin-top: 2px;
}
</style>
<template>
<div v-loading="_getLoading()" class="shelf-product-import-wrapper">
<div class="title-wrapper">
<span class="title">商品上架表</span>
</div>
<div class="content-wrapper">
<!-- 这里没有编辑和保存 直接用if -->
<Detail v-if="!useEdit"
v-bind="$attrs"
:data="form"
v-on="$listeners" />
<Modify v-else
ref="modifyRef"
v-bind="$attrs"
:form-data="form"
v-on="$listeners" />
</div>
<VenusDialog v-model="dialog.importProgress.show"
title="提示"
width="480"
draggable
:show-cancel="false"
:show-close="false"
:close-on-click-modal="false"
:confirm-loading="false"
v-bind="dialog.importProgress[dialog.importProgress.status]"
@confirm="handleConfirm">
<ImportProgress :fail-url="dialog.importProgress.failed.url"
:status="dialog.importProgress.status"
:percentage="dialog.importProgress.percentage" />
</VenusDialog>
</div>
</template>
<script>
import VenusDialog from "@/components/venusDialog/index.vue";
import { getShelfProductBaseInfoApi } from "@/views/goods/shelfProduct/api";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js";
import FormProvideItemMixin from "../formProvider/formItemMixin.js";
import Detail from "./components/detail/index.vue";
import ImportProgress from "./components/importProgress/index.vue";
import Modify from "./components/modify/index.vue";
export default {
name: "ShelfProductImport",
components: {
Detail,
Modify,
VenusDialog,
ImportProgress,
},
mixins: [FormProvideItemMixin],
props: {
useEdit: {
type: Boolean,
default: true,
},
baseSceneCode: {
type: String,
default: undefined,
},
businessCode: {
type: String,
default: undefined,
},
shelfType: {
type: Number,
default: undefined,
},
},
data() {
return {
formData: {
baseSceneCode: undefined,
businessCode: "",
goodsCreateExcel: undefined,
logList: [],
merchantId: "",
merchantName: undefined,
shelfType: 1,
},
dialog: {
// starting
// failed
// success
importProgress: {
show: false,
status: "starting",
percentage: 0,
starting: {
height: "192px",
showFooter: false,
},
failed: {
height: "60px",
showFooter: true,
url: "",
},
success: {
height: "60px",
showFooter: true,
confirmText: "继续下一步",
},
},
},
};
},
computed: {
form: {
get() {
return this.formData;
},
set(val) {
this.$set(this, "formData", val);
},
},
},
async mounted() {
await this.withLoading(this.init());
},
methods: {
async init() {
if (this.businessCode) {
const res = await getShelfProductBaseInfoApi({
businessCode: this.businessCode,
});
this.$set(this, "form", {
...res,
merchantName: res.merchantNames,
});
}
},
getData() {
return this.form;
},
setImportProgressFailUrl(url) {
this.dialog.importProgress.failed.url = url;
},
setImportProgressState(status) {
this.dialog.importProgress.status = status;
},
setProgress(progress) {
this.dialog.importProgress.percentage = progress;
},
// 覆盖mixin
getEditState() {
return VIEW_MODE.VIEW;
},
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
throw new Error("组件尚未初始化");
}
const formData = await modifyRef.validate();
Object.assign(this.formData, formData);
},
handleConfirm() {
if (this.dialog.importProgress.status === "success") {
this.$emit("handleNext");
}
if (this.dialog.importProgress.status === "failed") {
this.dialog.importProgress.show = false;
}
},
async showImportProgress(status) {
this.dialog.importProgress.status = status;
await this.$nextTick();
this.dialog.importProgress.show = true;
},
},
};
</script>
<style scoped lang="scss">
.shelf-product-import-wrapper {
padding: 0 20px 0;
background-color: white;
> .title-wrapper {
display: flex;
align-items: center;
padding-right: 20px;
border-bottom: 1px solid #e5e5e5;
height: 50px;
line-height: 50px;
margin-bottom: 20px;
> .title {
border-bottom: 0;
font-size: 16px;
font-weight: 600;
color: #333333;
}
}
}
</style>
import { last } from "lodash-es";
import { getMerchantTrafficSideListApi } from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions, shelfTypeOptions } from "@/views/goods/shelfProduct/constant/index";
export const shelfProductImportModifyFormSchema = [
{
label: "业务场景",
name: "baseSceneCode",
type: "select",
optionList: sceneTypeOptions,
optionId: "value",
optionLabel: "label",
changeAttr(value, currentSchema, formModel, schema) {
formModel.merchantId = undefined;
formModel.merchantName = undefined;
},
},
{
label: "上架类型",
name: "shelfType",
type: "radio",
optionList: shelfTypeOptions,
optionId: "value",
optionLabel: "label",
},
{
label: "流量方信息",
name: "merchantId",
type: "remote-select",
placeholder: "请选择流量方信息",
attrs: ({ formModel }) => {
return {
key: formModel.baseSceneCode,
immediate: true,
popperAppendToBody: false,
multiple: false,
collapseTags: false,
placeholder: "请输入相关名称以搜索流量方",
fieldName: {
label: "merchantName",
value: "merchantId",
},
fetchApi: async ({ pageQuery, isImmediate }) => {
const { list, pages } = await getMerchantTrafficSideListApi({
...pageQuery,
baseSceneCode: formModel.baseSceneCode,
keyWord: pageQuery.searchValue,
});
pageQuery.pages = pages;
return {
list,
query: pageQuery,
};
},
};
},
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionSync: {
useSync: true,
syncField: "merchantName",
},
isDisabled({ formModel }) {
return formModel.shelfType === 2 || !formModel.baseSceneCode;
},
isHide({ formModel }) {
return formModel.shelfType === 2 || !formModel.baseSceneCode;
},
},
{
label: "商品上架表",
name: "goodsCreateExcel",
addHtml: "goodsCreateExcel",
},
];
export async function getShelfProductImportSchema() {
return [
{
name: "baseSceneCode",
label: "业务场景",
col: 24,
render(h, { data }) {
const label = sceneTypeOptions.find(item => item.value === data?.baseSceneCode)?.label;
return h(
"div",
{
attrs: {
title: label,
},
class: "text-hide",
},
label,
);
},
},
{
name: "shelfType",
label: "上架类型",
col: 24,
render(h, { data }) {
const label = shelfTypeOptions.find(item => item.value === data?.shelfType)?.label;
return h(
"div",
{
attrs: {
title: label,
},
class: "text-hide",
},
label,
);
},
},
{
name: "merchantName",
label: "流量方信息",
col: 24,
isHide({ formModel }) {
return formModel.shelfType === 2;
},
},
{
name: "goodsCreateExcel",
label: "商品上架表",
col: 24,
render(h, { data }) {
const fileName = last(data?.goodsCreateExcel?.split("/"));
return h(
"div",
{
attrs: {
title: fileName,
},
style: {
display: "flex",
},
},
[
h(
"span",
{
class: "text-hide",
style: {
"max-width": "400px",
"display": "inline-block",
},
},
fileName,
),
h(
"el-link",
{
props: { type: "text", href: data?.goodsCreateExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
),
],
);
},
},
];
}
export const statusOptions = [
{ value: 0, label: "草稿" },
{ value: 1, label: "待审核" },
{ value: 2, label: "已审核" },
{ value: 3, label: "驳回" },
];
// 商品上架 业务场景 第0位必须是 精品升级
export const sceneTypeOptions = [
{ value: "100101", label: "1.1 精品升级售前" },
{ value: "110101", label: "2.1.1 售前会员权益升级" },
{ value: "110102", label: "2.1.2 售后会员权益升级" },
{ value: "110201", label: "2.3.1 售前延保" },
{ value: "110202", label: "2.3.2 售后延保" },
];
export const VIEW_MODE = {
EDIT: "edit",
VIEW: "view",
SAVING: "saving",
};
// 商品上架 上架类型
export const shelfTypeOptions = [
{ value: 1, label: "单店模式" },
{ value: 2, label: "项目制批量上架" },
];
export const inventoryTypeOption = [
{ value: 1, label: "虚拟管控" },
{ value: 2, label: "实物管控" },
];
// 批量模式的 流量方 分账方
export const realityShopLevelOptions = [
{ realityShopLevel: 1, realityShopLevelName: "流量方" },
{ realityShopLevel: 2, realityShopLevelName: "上级流量方" },
];
// 运营周期
export const settleTimeOptions = [
{ value: 1, label: "1" },
{ value: 2, label: "2" },
];
// 分账品类
export const categoryTypeOptions = [
{ label: "按商品分类", value: 1 },
{ label: "按具体商品", value: 2 },
{ label: "按具体套餐", value: 3 },
];
// 开启与关闭
export const sunshineOnlineOptions = [
{ value: "Y", label: "开启" },
{ value: "N", label: "关闭" },
];
import {
getAllGoodsListPage as getAllGoodsListApi,
merchantPackageGoodsInfoPage as getMerchantPackageGoodsInfoApi,
} from "@api/grounding";
import { getCategoryGoodsList, getProductPackagesListApi, getSpecialCategoryProductApi } from "@/views/goods/shelfProduct/api";
export async function fetchGoodsListHook({ selectedGoodsTypeOptions, pageQuery }) {
const { list, pages } = await getCategoryGoodsList(pageQuery);
pageQuery.pages = pages;
return {
list: list.map(({ categoryType, categoryName }) => ({
goodsType: categoryType,
goodsTypeName: categoryName,
disabled: selectedGoodsTypeOptions.includes(categoryType),
})),
query: pageQuery,
};
}
export async function fetchUpgradeGoodsListHook({ businessCode, selectedUpgradeGoods, pageQuery }) {
const { list, pages } = await getSpecialCategoryProductApi({
...pageQuery,
businessCode,
productName: pageQuery.searchValue,
});
pageQuery.pages = pages;
return {
list: list.map(item => ({
upgradeGoodsId: item.upgradeGoodsId,
upgradeGoodsName: item.upgradeGoodsName,
merchantGoodsCode: item.merchantGoodsCode,
disabled: selectedUpgradeGoods.includes(item.upgradeGoodsId),
upgradeCommodityCode: item.upgradeCommodityCode,
})),
query: pageQuery,
};
}
// 获取商品套餐
export async function fetchPackagesGoodsListHook({ businessCode, selectedPackageGoods, pageQuery }) {
const res = await getProductPackagesListApi({
...pageQuery,
businessCode,
productType: 2,
needDetail: false,
productName: pageQuery.searchValue,
});
pageQuery.pages = res.pages;
// const arr = options.concat(resArr);
return {
list: res.list.map(item => ({
packageCode: item.packageCode,
disabled: selectedPackageGoods.includes(item.packageCode),
packageName: item.productName,
})),
query: pageQuery,
};
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!