Commit 8b283b40 by Jaxon

Merge branch 'feature/584/jaxon' into 'SAAS+V5.8.4'

Feature/584/jaxon

See merge request !868
2 parents b2868a94 9b0352c6
Showing 24 changed files with 609 additions and 203 deletions
......@@ -109,7 +109,6 @@ export default {
},
value: {
required: true,
type: [Array, String, Number],
},
fieldName: {
type: Object,
......@@ -236,7 +235,7 @@ export default {
});
}
},
handleSelectChange(e) {
handleSelectChange(e, d) {
this.$emit("input", e);
if (isFunction(this.$listeners?.change)) {
this.$listeners.change(e);
......
......@@ -9,13 +9,13 @@ import store from "@/store";
axios.defaults.withCredentials = true;
// const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误
export function errorCreate (msg) {
export function errorCreate(msg) {
const error = new Error(msg);
errorLog(error);
throw error;
}
// 记录和显示错误
function errorLog (error) {
function errorLog(error) {
console.log("error", error.toString(), error);
// 添加到日志
store.dispatch("d2admin/log/push", {
......@@ -148,7 +148,9 @@ service.interceptors.response.use(
return errorCreate("登录超时,请重新登录");
// return Promise.reject(new Error(response.message || 'Error'))
}
if (returnAll) return dataAxios;
if (returnAll) {
return dataAxios;
}
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode;
switch (+codeValue) {
case ruleResult.code_success_value:
......@@ -224,8 +226,9 @@ service.interceptors.response.use(
if (!error.config?.skipGlobalLoading) {
store.commit("d2admin/loading/set", false);
}
if (!error.__CANCEL__)
errorLog(error); // 取消请求 不做错误提示
if (!error.__CANCEL__) {
errorLog(error);
} // 取消请求 不做错误提示
return Promise.reject(error);
},
);
......
......@@ -748,6 +748,11 @@ export const routerName = {
parentId: "9031803",
name: "商品查看",
},
{
authId: "90318102",
parentId: "9031803",
name: "常规商品详情",
},
],
},
{
......@@ -761,6 +766,11 @@ export const routerName = {
name: "商品编辑",
parentId: "90318",
},
{
authId: "90318101",
parentId: "9031803",
name: "常规上架",
},
],
},
{
......@@ -780,7 +790,7 @@ export const routerName = {
90318101: {
path: "/goods-shelf/normal-modify",
name: "goodsShelfNormalCreate",
name: "goodsShelfNormalModify",
meta: {
title: "常规上架",
authId: "90318101",
......@@ -790,6 +800,19 @@ export const routerName = {
},
component: _import("goods/shelfProduct/view/normalModify/index"),
},
// 常规商品详情
90318102: {
path: "/goods-shelf/normal-detail",
name: "goodsShelfNormalDetail",
meta: {
title: "常规上架详情",
authId: "90318102",
parentId: "90318",
sideHidden: true,
activePath: "/goods-shelf",
},
component: _import("goods/shelfProduct/view/normalDetail/index"),
},
9031802: {
path: "/goods-shelf/modify",
......@@ -803,6 +826,7 @@ export const routerName = {
},
component: _import("goods/shelfProduct/view/modify/index"),
},
// 特殊商品详情
9031805: {
path: "/goods-shelf/detail",
name: "goodsShelfDetail",
......
......@@ -189,15 +189,27 @@ export function postReconciliationConfigOtherGoodsApi(data = {}) {
return request(data, RequestMethods.POST);
}
// 获取 product 的 原上架id用的列表
// 获取 product 的 原上架id用的列表 - 商品
export function postProductOldMerchantGoodsCodeList(data = {}) {
data.method = "dj.api.marketing.goods.page";
return request(data, RequestMethods.POST);
}
// 获取 product 的 原上架id用的列表 - 套餐
export function postComboOldMerchantGoodsCodeList(data = {}) {
data.method = "dj.api.marketing.package.page";
return request(data, RequestMethods.POST);
}
// 获取 服务项目
export function postProductServiceList(data = {}) {
// 只要膜类
data.categoryId = 1;
return getServiceItem(data);
}
// 获取 服务项目
export function postProductCostCalculateApi(data = {}) {
data.method = "dj.api.smartcarlife.merchantGoodsInfo.productCost.calculate";
return request(data, RequestMethods.POST);
}
......@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类"
prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType"
style="width:414px"
disabled
@change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType"
:key="item.value"
......@@ -17,12 +19,14 @@
label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList"
required>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品"
style="width:390px"
value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList"
:field-name="{
value: 'merchantGoodsCode',
......@@ -37,6 +41,7 @@
}"
:options.sync="options.upgradeGoods">
</RemoteSelect>
<!-- 5.8.4 禁止修改 -->
<RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType"
ref="packageGoods"
......@@ -44,6 +49,7 @@
placeholder="请选择套餐"
style="width:390px"
value-key="packageCode"
disabled
:fetch-api="getPackagesGoodsList"
:field-name="{
value: 'packageCode',
......
......@@ -135,23 +135,24 @@
<span class="label">
{{ item.title }}
</span>
<span v-if="(item.groupType !== 1) && useEdit && isView(editState)"
<!-- 5.8.4 取消删除 -->
<!-- <span v-if="(item.groupType !== 1) && useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)">
</span>
</span> -->
</div>
</el-option>
</el-select>
</div>
<span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper">
<!-- 5.8.4 取消新增 -->
<!-- <span v-if="useEdit && editState === VIEW_MODE.VIEW" class="actions-wrapper">
<el-button icon="el-icon-plus"
size="small"
plain
@click="handleAppendSpecialCategory">
新增
</el-button>
</span>
</span> -->
</div>
<div v-if="tabsActive" class="public-container">
......
......@@ -3,8 +3,10 @@
<div v-if="form.groupType !== 1" style="display: flex">
<el-form-item label="分账品类"
prop="specialDetail.categoryType">
<!-- 5.8.4 禁止修改 -->
<el-select v-model="form.categoryType"
style="width:414px"
disabled
@change="handleCategoryTypeChange">
<el-option v-for="item in options.categoryType"
:key="item.value"
......@@ -18,13 +20,14 @@
label-width="12px"
prop="specialDetail.goodsTypeGroupRelationList"
required>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 2"
:key="form.categoryType"
v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品"
style="width:390px"
value-key="merchantGoodsCode"
disabled
:fetch-api="fetchUpgradeGoodsList"
:field-name="{
value: 'merchantGoodsCode',
......@@ -39,6 +42,7 @@
}"
:options.sync="options.upgradeGoods">
</RemoteSelect>
<!-- 5.8.4 取消修改 -->
<RemoteSelect v-if="form.categoryType === 3"
:key="form.categoryType"
ref="packageGoods"
......@@ -46,6 +50,7 @@
placeholder="请选择套餐商品"
style="width:390px"
value-key="packageCode"
disabled
:fetch-api="fetchPackagesGoodsList"
:field-name="{
value: 'packageCode',
......
......@@ -102,23 +102,26 @@
<span class="label">
{{ item.title }}
</span>
<span v-if="useEdit && isView(editState) && item.groupType !== 1"
<!-- 5.8.4 取消删除功能 -->
<!-- <span v-if="useEdit && isView(editState) && item.groupType !== 1"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(item)">
</span>
</span> -->
</div>
</el-option>
</el-select>
</div>
<span v-if="useEdit && isView(editState)" class="actions-wrapper">
<!-- 5.8.4 取消删除新增 -->
<!-- <span v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-button icon="el-icon-plus"
size="small"
plain
@click="handleAppendSpecialCategory">
新增
</el-button>
</span>
</span> -->
</div>
<div v-if="tabsActive" class="public-container">
......@@ -232,6 +235,8 @@ export default {
form: {
firstLineSunshineOnlinePointsFlag: "N",
firstLineSunshine2OnlinePointsFlag: "N",
managementMarketingFeesPrerequisite: "N",
firstLineSunshinePrerequisite: "N",
operationMode: undefined,
specialDetail: {
categoryType: undefined,
......@@ -241,17 +246,20 @@ export default {
},
},
rules: {
// 一线阳光是否开启线上积分
"firstLineSunshineOnlinePointsFlag": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光是否开启线上积分", trigger: "change" },
],
"firstLineSunshine2OnlinePointsFlag": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光2是否开启线上积分", trigger: "change" },
],
// 管理层市场费是否前置
"managementMarketingFeesPrerequisite": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择管理层市场费是否前置", trigger: "change" },
],
// 请选择一线阳光是否前置
"firstLineSunshinePrerequisite": [
{ required: true, trigger: "change" },
{ required: true, message: "请选择一线阳光是否前置", trigger: "change" },
],
"specialDetail.categoryType": [
{ required: true, message: "请选择分账品类", trigger: "change" },
......
......@@ -11,7 +11,6 @@
:merchant-id-list="merchantIdList"
:product="productData"
:shelf-type="shelfType"
:show-business-line="false"
:show-gift-cost="false"
:show-old-merchant-goods-code="false"
......@@ -19,7 +18,6 @@
:show-sales-proportion-percent="false"
:show-settlement-type="false"
:show-shelf-style="false"
@update:upgradeGoods="handleUpdateProduct($event, index)" />
<el-divider class="divider"></el-divider>
</div>
......
......@@ -39,20 +39,23 @@
</el-radio-group>
</el-form-item>
</el-col>
<!-- TODO: 且上架类型的值 为 修改 才显示 -->
<!-- 单店模式 且 类型 为修改 -->
<el-col v-if="isSingleShopMode(shelfType) && isShelfStyleEdit(packageForm.shelfStyle)" :span="12">
<el-form-item label="原上架ID:"
prop="oldMerchantGoodsCode"
:rules="[{ required: true, message: '请选择原上架ID', trigger: 'change' }]">
<el-select v-model="packageForm.oldMerchantGoodsCode"
placeholder="请选择">
<el-option v-for="item in options.serviceList"
:key="item.id"
:label="item.serviceItemsName"
:value="item.id">
</el-option>
</el-select>
<RemoteSelect v-model="packageForm.oldMerchantGoodsCode"
placeholder="原上架ID"
:fetch-api="fetchMerchantGoodsCode"
:field-name="{
value: 'packageId',
label: 'packageId',
}"
:immediate="true"
:multiple="false"
:options.sync="options.oldMerchantGoodsCode">
</RemoteSelect>
</el-form-item>
</el-col>
......@@ -68,20 +71,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售占比:" prop="salesProportionPercent">
<div class="form-item-append-fix">
<VenusNumberInput v-model="packageForm.salesProportionPercent"
placeholder="请输入销售占比"
:controls="false"
:max="100"
:min="0"
:precision="2">
</VenusNumberInput>
<span class="fix-symbol">%</span>
</div>
</el-form-item>
</el-col>
<el-col title="按子商品的售价进行累计,实时计算" :span="12">
<el-form-item label="售价/件:" prop="sellPrice">
......@@ -146,21 +135,6 @@
</div>
</el-form-item>
</el-col>
<el-col v-if="isQualityUpgrade(baseSceneCode)"
title="按子商品的回收成本进行累计,实时计算"
:span="12">
<el-form-item label="回收成本:" prop="recoveryCost">
<div class="form-item-append-fix">
<VenusNumberInput disabled
:controls="false"
:min="0"
:precision="2"
:value="getSumValue.totalRecoveryCost">
</VenusNumberInput>
<span class="fix-symbol">元</span>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
......@@ -180,6 +154,7 @@
:base-scene-code="baseSceneCode"
:disabled-positions="getProductDisabledPositions(goodsForm.upgradeGoodsId, goodsForm.merchantGoodsCode)"
:edit-state="VIEW_MODE.EDIT"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:product.sync="goodsForm"
:shelf-type="shelfType"
......@@ -202,8 +177,10 @@
import { cloneDeep, isFunction, pick, reduce } from "lodash-es";
import { nanoid } from "nanoid";
import { settlementTypeOpt } from "@/common/constants.js";
import RemoteSelect from "@/components/remoteSearchSelect/index.vue";
import VenusNumberInput from "@/components/venusNumberInput/index.vue";
import { baseConfig } from "@/main";
import { postComboOldMerchantGoodsCodeList } from "@/views/goods/shelfProduct/api";
import { shelfStyleOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import { isMemberRightsUpgrade, isQualityUpgrade, isShelfStyleEdit, isSingleShopMode, isSolarFilm, isUpgradeProductCostStyleCustom, isUpgradeProductCostStyleDefault } from "@/views/goods/shelfProduct/utils/status.js";
import Product from "../../../product/index.vue";
......@@ -213,12 +190,17 @@ export default {
components: {
Product,
VenusNumberInput,
RemoteSelect,
},
props: {
merchantIdList: {
type: Array,
required: true,
},
merchantId: {
type: [Number, Array],
required: true,
},
baseSceneCode: {
type: String,
required: true,
......@@ -241,6 +223,7 @@ export default {
options: {
settlementType: settlementTypeOpt,
shelfStyleOptions,
oldMerchantGoodsCode: [],
},
dialog: {
selectGoods: {
......@@ -272,7 +255,7 @@ export default {
res[2] += (item.upgradeGoods.djCost ?? 0) * 100;
res[3] += (item.thirdPartyCost ?? 0) * 100;
res[4] += (item.upgradeProductCost ?? 0) * 100;
res[5] += (item.recoveryCost ?? 0) * 100;
// res[5] += (item.recoveryCost ?? 0) * 100;
return res;
}, [0, 0, 0, 0, 0, 0]);
return {
......@@ -281,7 +264,7 @@ export default {
totalDjCost: sum[2] / 100,
totalThirdPartyCost: sum[3] / 100,
totalUpgradeProductCost: sum[4] / 100,
totalRecoveryCost: sum[5] / 100,
// totalRecoveryCost: sum[5] / 100,
};
},
......@@ -308,6 +291,21 @@ export default {
isQualityUpgrade,
isSolarFilm,
isSingleShopMode,
async fetchMerchantGoodsCode({ pageQuery }) {
const res = await postComboOldMerchantGoodsCodeList({
...pageQuery,
merchantIds: Array.isArray(this.merchantId) ? this.merchantId : [this.merchantId],
baseSceneCode: this.baseSceneCode,
productName: pageQuery.searchValue,
});
return {
list: res.list,
query: {
pages: res.pages,
total: res.total,
},
};
},
getProductDisabledPositions(upgradeGoodsId, excludeMerchantGoodsCode) {
return this.productList.filter(item => item.upgradeGoodsId === upgradeGoodsId && item.merchantGoodsCode !== excludeMerchantGoodsCode).map(item => item.detailList?.[0]?.position);
},
......@@ -324,7 +322,6 @@ export default {
upgradeCommodityCode: upgradeGoods.commodityCode,
upgradeGoodsId: upgradeGoods.id,
upgradeGoodsName: upgradeGoods.upgradeGoodsName,
});
}
},
......
......@@ -68,18 +68,23 @@ export default {
computed: {
filterSchema() {
return this.schema.filter((item) => {
// 结算方式
if (item.name === "settlementType") {
return this.showSettlementType;
}
// 销售占比
if (item.name === "salesProportionPercent") {
return this.showSalesProportionPercent;
}
// 上架类型
if (item.name === "shelfStyle") {
return this.showShelfStyle;
}
// 原上架id
if (item.name === "oldMerchantGoodsCode") {
return this.showOldMerchantGoodsCode;
}
// 赠送成本
if (item.name === "detailList.0.giftCost") {
return this.showGiftCost;
}
......
......@@ -62,6 +62,7 @@ export default {
if (!commodityCode) {
return;
}
// 查询运营成本
const { operationCost } = await getOperationCost({
commodityCode,
merchantIdList: this.merchantIdList,
......@@ -75,7 +76,6 @@ export default {
},
// product.detailList[0].upgradeGoods.commodityCode
async validate() {
console.log("进得来?");
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
......
......@@ -11,7 +11,8 @@
<div v-if="showDialog"
v-loading="loading"
class="selected-product-wrapper">
<d2-search class="show-search"
<d2-search v-if="table.formSchema.length"
class="show-search"
label-width="100px"
:form-data="table.formSchema"
:search-form="table.form">
......@@ -57,6 +58,9 @@
@change="handleGoodsCascaderChange($event)">
</el-cascader>
</template>
<template #supplierCode>
<remote-select v-model="table.form.supplierCode"></remote-select>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="table.props.btnId"
......@@ -181,6 +185,7 @@ export default {
goodsName: "",
baseGoodsCommodityCode: "",
tempGoodsType: [],
supplierCode: "",
},
props: selectGoodsTableSchema,
api: getUpgradeProductList,
......@@ -215,7 +220,7 @@ export default {
this.selectedId = this.activeId;
await this.getSelectedRow();
// this.keyDowmGetList 不知道在哪里设置的全局变量. 原有组件中需要传入
this.table.formSchema = getSelectGoodsTableFilterSchema(this.keyDowmGetList);
this.table.formSchema = await getSelectGoodsTableFilterSchema(this.keyDowmGetList);
await this.getOptionsList();
} finally {
this.loading = false;
......@@ -262,6 +267,9 @@ export default {
this.table.form[key] = e.replace(/[^a-z0-9]/gi, "");
}
},
keyDowmGetList() {
this.$refs?.tableRef?.refreshTable();
},
async getOptionsList() {
// 获取全部类目 屏蔽服务商自建类目
const res = await getAllCategory({ categoryTypeList: baseConfig.selfBuildGoodsType, pageSize: 9999, currentPage: 1 });
......
......@@ -22,15 +22,17 @@
<span class="label">
{{ row.productName }}
</span>
<span v-if="useEdit && isView(editState)"
<!-- 5.8.4 不允许删除 -->
<!-- <span v-if="useEdit && isView(editState)"
class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)">
</span>
</span> -->
</div>
</template>
</RemoteSelect>
</div>
<div v-if="useEdit && isView(editState)" class="actions-wrapper">
<!-- 5.8.4 取消新增功能 -->
<!-- <div v-if="useEdit && isView(editState)" class="actions-wrapper">
<el-dropdown @command="handleAppendProductPackages">
<el-button size="small" plain>
新增
......@@ -47,7 +49,7 @@
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div> -->
</div>
<div class="content-wrapper">
......@@ -84,6 +86,7 @@
ref="productRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:product="productDetail || { detailList: [] }"
:shelf-type="shelfType"
......@@ -93,6 +96,7 @@
ref="packageRefs"
:base-scene-code="baseSceneCode"
:edit-state="editState"
:merchant-id="merchantId"
:merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }"
:prefix="$data._prefix"
......@@ -151,6 +155,10 @@ export default {
type: String,
required: true,
},
merchantId: {
type: [Number, Array],
required: true,
},
shelfType: {
type: Number,
required: true,
......@@ -246,10 +254,27 @@ export default {
// 获取 某个商品/套餐 详情
async getProductPackageDetail(id) {
const detail = await getProductPackagesDetailApi({ id });
// 如果是商品
if (detail.productType === 1) {
// 商品在这个层级依赖
detail.upgradeGoodsId = detail.detailList[0].upgradeGoodsId;
// 若无嘀加成本则默认=0
if (detail?.detailList?.[0]?.upgradeGoods) {
if (!detail?.detailList?.[0]?.upgradeGoods?.djCost) {
detail.detailList[0].upgradeGoods.djCost = 0;
}
}
// 5.8.6 若产品供应方=广联直营,则第三方成本默认=0且不可编辑
if (detail?.detailList?.[0]?.supplyFlag === 1) {
// 第三方成本
detail.detailList[0].thirdPartyCost = 0;
}
// ●赠送成本(仅精品升级场景存在)
// ○根据根据“商品上架表”,即上架商品匹配行中取对应的“是否作为赠送产品”
// TODO 5.8.6 ○若是则自动带入对应的产品、升级成本,成本的获取方式与产品、升级成本一致;
// TODO 5.8.6 ○若否则默认为空
}
detail.shelfType = this.shelfType;
detail.baseSceneCode = this.baseSceneCode;
return detail;
......
import { getBrandSupplyMerchant } from "@api/product";
import { get } from "lodash-es";
import { nanoid } from "nanoid";
import { BaseData, settlementTypeOpt } from "@/common/constants";
......@@ -64,7 +65,6 @@ export async function getProductDetailDescriptionSchema(shelfType) {
},
isHide({ formModel }) {
const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType;
// 不是太阳膜类型的 隐藏
return !(isSolarFilm(goodsType));
},
......@@ -82,7 +82,7 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
isHide({ formModel }) {
// 单店模式才存在;
// 单店模式存在
return !(isSingleShopMode(shelfType));
},
},
......@@ -92,16 +92,15 @@ export async function getProductDetailDescriptionSchema(shelfType) {
label: "原上架ID",
col: 12,
render(h, { data, schemaItem }) {
// const value = get(data, schemaItem.name);
// const item = value && shelfStyleOptions.find(item => item.value === value);
const value = get(data, schemaItem.name);
return h(
"span",
"动态获取" || "-",
value || "-",
);
},
isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle));
return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
},
},
......@@ -123,6 +122,31 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
},
{
name: "detailList.0.serviceItem",
label: "服务项目",
col: 12,
render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name);
return h(
"div",
{
attrs: {
title: value,
},
class: "text-hide",
},
value || "-",
);
},
isHide({ formModel }) {
const goodsType = getUpgradeGoods(formModel)?.goodsInfo?.goodsType;
// 不是太阳膜类型的 隐藏
return !(isSolarFilm(goodsType));
},
},
// 套餐加载时不显示
{
name: "settlementType",
......@@ -150,19 +174,6 @@ export async function getProductDetailDescriptionSchema(shelfType) {
);
},
},
// 套餐加载时不显示
{
name: "salesProportionPercent",
label: "销售占比",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}%`,
);
},
},
{
name: "detailList.0.sellPrice",
label: "售价/件",
......@@ -239,23 +250,23 @@ export async function getProductDetailDescriptionSchema(shelfType) {
},
},
{
name: "detailList.0.recoveryCost",
label: "回收成本",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}元`,
// priceFilter(data.recoveryCost),
);
},
isHide({ formModel }) {
// 仅精品升级场景存在
return !(isQualityUpgrade(formModel.baseSceneCode));
},
},
// {
// name: "detailList.0.recoveryCost",
// label: "回收成本",
// col: 12,
// render(h, { data, schemaItem }) {
// const value = isZeroOrNumber(get(data, schemaItem.name));
// return h(
// "span",
// value === "-" ? value : `${value}元`,
// // priceFilter(data.recoveryCost),
// );
// },
// isHide({ formModel }) {
// // 仅精品升级场景存在
// return !(isQualityUpgrade(formModel.baseSceneCode));
// },
// },
// 套餐加载时不展示
{
......@@ -551,6 +562,18 @@ export async function getProductDetailUpgradeGoodsDescriptionSchema() {
);
},
},
{
name: "detailList.0.upgradeGoods.purchaseCost",
label: "采购成本/元",
col: 8,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : `${value}元`,
);
},
},
];
}
......@@ -615,16 +638,16 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
label: "原上架ID",
col: 12,
render(h, { data, schemaItem }) {
// const value = get(data, schemaItem.name);
const value = get(data, schemaItem.name);
// const item = value && shelfStyleOptions.find(item => item.value === value);
return h(
"span",
"动态获取" || "-",
value || "-",
);
},
isHide({ formModel }) {
// 单店模式 且 shelfStyle === 修改才存在
return !(isSingleShopMode(shelfType) && !isShelfStyleEdit(formModel.shelfStyle));
return !(isSingleShopMode(shelfType) && isShelfStyleEdit(formModel.shelfStyle));
},
},
{
......@@ -640,18 +663,18 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
);
},
},
{
name: "salesProportionPercent",
label: "销售占比",
col: 12,
render(h, { data, schemaItem }) {
const value = isZeroOrNumber(get(data, schemaItem.name));
return h(
"span",
value === "-" ? value : value + "%",
);
},
},
// {
// name: "salesProportionPercent",
// label: "销售占比",
// col: 12,
// render(h, { data, schemaItem }) {
// const value = isZeroOrNumber(get(data, schemaItem.name));
// return h(
// "span",
// value === "-" ? value : value + "%",
// );
// },
// },
{
name: "sellPrice",
label: "售价/件",
......@@ -701,19 +724,19 @@ export async function getPackagesDetailDescriptionSchema(shelfType) {
return h("span", value);
},
},
{
name: "recoveryCost",
label: "回收成本",
col: 12,
isHide({ formModel }) {
// 仅精品升级场景存在;
return !(isQualityUpgrade(formModel.baseSceneCode));
},
render(h, { data, schemaItem }) {
const value = schemaSumBy(data.detailList, schemaItem.name);
return h("span", value);
},
},
// {
// name: "recoveryCost",
// label: "回收成本",
// col: 12,
// isHide({ formModel }) {
// // 仅精品升级场景存在;
// return !(isQualityUpgrade(formModel.baseSceneCode));
// },
// render(h, { data, schemaItem }) {
// const value = schemaSumBy(data.detailList, schemaItem.name);
// return h("span", value);
// },
// },
];
}
......@@ -777,6 +800,15 @@ export const selectGoodsTableSchema = {
},
},
{
label: "采购成本/元",
prop: "purchaseCost",
width: 100,
formatter: (row) => {
const value = isZeroOrNumber(row.purchaseCost);
return value === "-" ? value : `${value}元`;
},
},
{
label: "适用区域",
prop: "upgradeGoodsAreaList",
width: 180,
......@@ -834,7 +866,10 @@ export const selectGoodsTableSchema = {
};
// 选择商品表格筛选项
export function getSelectGoodsTableFilterSchema(keyDownGetList) {
export async function getSelectGoodsTableFilterSchema(keyDownGetList) {
// 获取品牌方 / 供应方数据 1 - 品牌商 ; 2 - 供应方
const supplierCodeList = await getBrandSupplyMerchant({ partitionFlag: 2 });
console.log("supplierCodeList", supplierCodeList);
return [
{
label: "产品名称",
......@@ -893,5 +928,13 @@ export function getSelectGoodsTableFilterSchema(keyDownGetList) {
name: "goodsType",
addHtml: "goodsCascader",
},
{
label: "供应商",
name: "supplierCode",
type: "select",
optionList: supplierCodeList,
optionId: "id",
optionLabel: "relatedPartyName",
},
];
}
......@@ -140,36 +140,91 @@ export async function getShelfProductImportSchema() {
col: 24,
render(h, { data }) {
const fileName = last(data?.goodsCreateExcel?.split("/"));
// 利润率测算表
const onShelvesExcel = last(data?.onShelvesExcel?.split("/"));
return h(
"div",
{
attrs: {
title: fileName,
},
style: {
display: "flex",
"display": "flex",
"flex-direction": "column",
"align-items": "flex-start",
},
},
[
// 商品上架表
h(
"span",
"div",
{
class: "text-hide",
attrs: {
title: fileName,
},
style: {
"max-width": "400px",
"display": "inline-block",
"display": "flex",
"align-items": "center",
},
},
fileName,
),
h(
"el-link",
{
props: { type: "text", href: data?.goodsCreateExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
[
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 },
},
"下载",
),
],
),
// 利润率测算表
onShelvesExcel
? h(
"div",
{
attrs: {
title: onShelvesExcel,
},
style: {
"display": "flex",
"align-items": "center",
"margin-top": "4px",
},
},
[
h(
"span",
{
class: "text-hide",
style: {
"max-width": "400px",
"display": "inline-block",
},
},
onShelvesExcel,
),
h(
"el-link",
{
props: { type: "text", href: data?.onShelvesExcel, target: "_blank" },
style: { "marginLeft": "8px", "line-height": 1 },
},
"下载",
),
],
)
: null,
],
);
},
......
export const statusOptions = [
{ value: 0, label: "草稿" },
{ value: 1, label: "待审核" },
{ value: 2, label: "已审核" },
{ value: 1, label: "商务审核" },
{ value: 2, label: "已完成" },
{ value: 3, label: "驳回" },
{ value: 5, label: "审核提交中" },
{ value: 6, label: "审核提交失败" },
{ value: 5, label: "数据处理中" },
{ value: 6, label: "数据处理失败" },
];
// 商品上架 业务场景 第0位必须是 精品升级
export const sceneTypeOptions = [
......@@ -15,6 +15,12 @@ export const sceneTypeOptions = [
{ value: "110202", label: "2.3.2 售后延保" },
];
// 商品上架 商品成本带入方式
export const productCostStyleOpt = [
{ value: 2, label: "默认带入产品成本" },
{ value: 1, label: "自定义成本" },
];
export const VIEW_MODE = {
EDIT: "edit",
VIEW: "view",
......@@ -40,7 +46,7 @@ export const realityShopLevelOptions = [
// 上架模式
export const shelfModelOptions = [
{ value: 1, label: "特殊商品上架" },
{ value: 2, label: "常规商品上架" },
{ value: 2, label: "常规上架" },
];
// 上架类型
......
......@@ -92,11 +92,20 @@ export function getTableFilterIds(baseSceneCode) {
return sceneTypeFilter[sceneType] || [];
}
// "产品成本获取方式 1-自定义成本 2-默认带入产品成本" -->
/**
* "产品成本获取方式 1-自定义成本 -->
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleCustom(upgradeProductCostStyle) {
return upgradeProductCostStyle === 1;
}
/**
* 产品成本获取方式 2-默认带入产品成本"
* @param {*} upgradeProductCostStyle
* @returns
*/
export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
return upgradeProductCostStyle === 2;
}
......@@ -104,7 +113,7 @@ export function isUpgradeProductCostStyleDefault(upgradeProductCostStyle) {
/**
* 是否直营
* 权益、延保 且 供应方=广联直营 0-否 1-是
* @returns Boolean
* @returns
*/
export function isDirectOperation(supplyFlag) {
return supplyFlag === 1;
......
......@@ -34,6 +34,7 @@
style="margin-top:20px">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantIdList"
:shelf-type="shelfType"
:use-edit="false" />
</FormStep>
......@@ -118,12 +119,14 @@ export default {
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantIdList: undefined,
logList: [],
};
},
computed: {
isReadyForNextStep() {
return this.baseSceneCode && this.businessCode && this.shelfType;
return this.baseSceneCode && this.businessCode && this.shelfType && this.merchantIdList;
},
},
async created() {
......
......@@ -46,6 +46,7 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" />
</FormStep>
<FormStep v-loading="data.isStepLoading" name="ProfitSharingConfig">
......@@ -139,6 +140,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据
/**
* 特殊上架
*/
const shelfModel = 1;
export default {
name: "ShelfProductModify",
components: {
......@@ -218,9 +223,10 @@ export default {
});
},
async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({
const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode,
});
this.merchantId = merchantId;
return confirmStep - 1;
},
async beforeChangeStepBefore(isNext) {
......@@ -315,6 +321,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = {
...stepFormData,
// 特殊上架
shelfModel,
file: last(fileExt) + "@" + arrBase64,
};
if (!reqData.businessCode) {
......
<template>
<d2-container v-loading="!isReadyForNextStep" class="detail-wrapper">
<FormProvider v-if="isReadyForNextStep"
class="form-provide-wrapper"
:use-edit="false">
<template #default="{ data }">
<FormStep name="ProductImport">
<ShelfProductImport ref="shelfProductImportRef"
:business-code="businessCode"
:use-edit="false" />
</FormStep>
<FormStep v-loading="data.getSomeItemStepLoading('ProductConfirm')"
name="ProductConfirm"
style="margin-top:20px">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantIdList"
:shelf-type="shelfType"
:use-edit="false" />
</FormStep>
<!-- 5.8.4 批量模式没有这个 -->
<FormStep v-if="isSingleShopMode(shelfType)"
v-loading="data.getSomeItemStepLoading('ProfitMarginTable')"
name="ProfitMarginTable"
style="height:100%;margin-top:20px">
<ProfitMarginTable style="height:680px;overflow:hidden"
:business-code="businessCode"
:use-edit="false" />
</FormStep>
<FormStep v-loading="data.getSomeItemStepLoading('OperateOperateList')"
name="OperateList"
style="margin-top:20px">
<OperateList :log-list="logList" />
</FormStep>
<div style="text-align:center">
<el-button size="small"
style="width:60px"
type="info"
@click="handleBack">
返回
</el-button>
</div>
</template>
</FormProvider>
</d2-container>
</template>
<script>
import {
getShelfProductBaseInfoApi,
} from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions } from "@/views/goods/shelfProduct/constant/index";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade, isSingleShopMode } from "@/views/goods/shelfProduct/utils/status";
import FormStep from "../../components/formProvider/formStep.vue";
import FormProvider from "../../components/formProvider/index.vue";
import OperateList from "../../components/operateList/index.vue";
import ProfitMarginTable from "../../components/profitMarginTable/index.vue";
import ProfitSharingConfig from "../../components/profitSharingConfig/index.vue";
import ReconciliationConfig from "../../components/reconciliationConfig/index.vue";
import ShelfProductConfirm from "../../components/shelfProductConfirm/index.vue";
import ShelfProductImport from "../../components/shelfProductImport/index.vue";
export default {
name: "",
components: {
OperateList,
ShelfProductImport,
ShelfProductConfirm,
ProfitMarginTable,
FormProvider,
FormStep,
},
props: {
},
data() {
return {
sceneTypeOptions,
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantIdList: undefined,
logList: [],
};
},
computed: {
isReadyForNextStep() {
return this.baseSceneCode && this.businessCode && this.shelfType && this.merchantIdList;
},
},
async created() {
this.baseSceneCode = this.$route.query.baseSceneCode;
this.businessCode = this.$route.query.businessCode;
this.shelfType = Number(this.$route.query.shelfType);
await this.$nextTick();
await this.getStep(this.businessCode);
},
mounted() {
},
methods: {
isSingleShopMode,
getMemberRightsUpgradeValue,
isMemberRightsUpgrade,
isQualityUpgrade,
async getStep(businessCode) {
const res = await getShelfProductBaseInfoApi({ businessCode });
if (!res.logList) {
res.logList = [];
}
Object.assign(this.$data, res);
},
handleBack() {
this.$router.back();
},
},
};
</script>
<style scoped lang="scss">
.detail-wrapper {
}
</style>
......@@ -33,7 +33,7 @@
<el-steps finish-status="success" :active="step.confirmStep">
<el-step title="1、商品上架表导入"></el-step>
<el-step title="2、上架商品确认"></el-step>
<el-step title="3、利润率测算"></el-step>
<el-step v-if="isSingleShopMode(shelfType)" title="3、利润率测算"></el-step>
</el-steps>
</div>
<div v-loading="data.isProviderLoading" class="wrapper">
......@@ -44,9 +44,9 @@
<FormStep v-loading="data.isStepLoading" name="ProductConfirm">
<ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode"
:merchant-id="merchantId"
:shelf-type="shelfType" />
</FormStep>
<FormStep v-loading="data.isStepLoading"
name="ProfitMarginTable"
style="height:100%">
......@@ -63,7 +63,7 @@
@click="handlePreviousSteps">
上一步
</VenusButton>
<VenusButton v-if="step.confirmStep < 2"
<VenusButton v-if="step.confirmStep < (isSingleShopMode(shelfType) ? 2 : 1)"
size="small"
type="primary"
:disabled="data.isEditing || data.isSaving"
......@@ -107,7 +107,7 @@ import {
} from "@/views/goods/shelfProduct/api";
import { sceneTypeOptions, VIEW_MODE } from "@/views/goods/shelfProduct/constant/index";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade } from "@/views/goods/shelfProduct/utils/status";
import { getMemberRightsUpgradeValue, isMemberRightsUpgrade, isQualityUpgrade, isSingleShopMode } from "@/views/goods/shelfProduct/utils/status";
import VenusButton from "../../components/btn/index.vue";
import FormStep from "../../components/formProvider/formStep.vue";
import FormProvider from "../../components/formProvider/index.vue";
......@@ -124,6 +124,10 @@ import ShelfProductImport from "../../components/shelfProductImport/index.vue";
// 业务层(FormStep + 各种组件)
// └── 只负责:输入 / 校验 / 数据
/**
* 常规上架
*/
const shelfModel = 2;
export default {
name: "ShelfProductModify",
components: {
......@@ -152,6 +156,7 @@ export default {
baseSceneCode: undefined,
businessCode: undefined,
shelfType: undefined,
merchantId: undefined,
};
},
......@@ -169,6 +174,7 @@ export default {
async created() {
this.setShelfProductInfo(this.$route.query);
await this.$nextTick();
// 如果是编辑
if (this.isReadyForNextStep) {
await this.init();
}
......@@ -182,6 +188,7 @@ export default {
getMemberRightsUpgradeValue,
isMemberRightsUpgrade,
isQualityUpgrade,
isSingleShopMode,
async withLoading(fn) {
if (!isFunction(fn)) {
return;
......@@ -200,18 +207,25 @@ export default {
});
},
async getStep() {
const { confirmStep } = await getShelfProductUpdateStep({
const { confirmStep, merchantId } = await getShelfProductUpdateStep({
businessCode: this.businessCode,
});
this.merchantId = merchantId;
// 常规上架特殊处理
if ((confirmStep - 1) > 2) {
return 2;
}
return confirmStep - 1;
},
async beforeChangeStepBefore(isNext) {
this.btnLoading = true;
try {
// 常规上架特殊处理
const confirmStep = this.step.confirmStep + 1;
await putShelfProductUpdateStep({
businessCode: this.businessCode,
nextStep: isNext,
confirmStep: this.step.confirmStep + 1,
confirmStep: confirmStep === 3 ? 5 : confirmStep,
});
} finally {
this.btnLoading = false;
......@@ -273,6 +287,8 @@ export default {
const fileExt = stepFormData.goodsCreateExcel.name.split(".");
const reqData = {
...stepFormData,
// 常规上架
shelfModel,
file: last(fileExt) + "@" + arrBase64,
};
if (!reqData.businessCode) {
......@@ -293,6 +309,7 @@ export default {
componentsRef.setImportProgressState("starting");
const that = this;
async function stopCondition([result]) {
console.log("stopCondition", result.progress);
// 更新数据
// 失败
componentsRef.setProgress(result.progress);
......@@ -301,11 +318,15 @@ export default {
await syncTime(500);
}
if (isSuccess(result.progress, result.failNum)) {
console.log("成功?");
componentsRef.setImportProgressState("success");
console.log("1?");
const res = await getShelfProductBaseInfoByUUIDApi({ uuid: result.uuid });
console.log("isSuccess", res);
console.log("isSuccess", that.baseSceneCode);
console.log("2?", res);
that.setShelfProductInfo(pick(res, "baseSceneCode", "businessCode", "shelfType"));
console.log("3?");
that.merchantId = res.merchantId;
return true;
}
if (isFail(result.progress, result.failNum)) {
......
......@@ -23,13 +23,13 @@
<div class="d2-container-content">
<d2-table-header>
<span style=" display:flex; gap:8px; ">
<!-- 常规上架 handleModify -->
<!-- 常规上架 handleNormalModify -->
<auth-button category="Button"
:data="{ operate: 'create' }"
:data="{ operate: 'create', record: { shelfModel: 2 } }"
:show-btn-ids="['9031810']" />
<!-- 特殊商品上架 handleModify -->
<auth-button category="Button"
:data="{ operate: 'create' }"
:data="{ operate: 'create', record: { shelfModel: 1 } }"
:show-btn-ids="['9031801']" />
</span>
</d2-table-header>
......@@ -51,19 +51,23 @@
<template #auth-button="{ scope }">
<div style="padding:21px 0">
<!-- 查看 handleDetail -->
<!-- 全部状态的单据均可操作 -->
<span style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031803']" />
</span>
<!-- 编辑 handleModify 仅草稿出现 -->
<!-- 仅状态=“草稿”的记录可操作 -->
<span v-if="scope.systemStatus === 0" style="margin-right: 10px">
<auth-button :data="{ operate: 'edit', record: scope }" :show-btn-ids="['9031806']" />
</span>
<!-- 驳回 handleReject 待审核才出现 -->
<!-- 仅状态=“商务审核” -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope"
:show-btn-ids="['9031808']" />
</span>
<!-- 审核 handleApprove 待审核才出现 -->
<!-- 仅状态=“商务审核”的记录可操作 -->
<span v-if="scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope" :show-btn-ids="['9031809']" />
</span>
......@@ -94,6 +98,7 @@ export default {
},
data() {
return {
isCacheLoaded: false,
table: {
formSchema: cloneDeep(shelfProductTableFormSchema),
getListApi: getShelfProductPageApi,
......@@ -124,11 +129,13 @@ export default {
};
},
async mounted() {
console.log("mounted");
await this.getBaseData();
},
activated() {
this.$refs?.tableRef?.refreshTable();
if (this.isCacheLoaded) {
this.$refs?.tableRef?.refreshTable();
}
this.isCacheLoaded = true;
},
methods: {
......@@ -168,12 +175,9 @@ export default {
},
// 常规上架
handleNormalModify({ operate, record }) {
console.log("????");
if (operate === "create") {
this.$router.push({
name: "goodsShelfNormalCreate",
});
}
this.$router.push({
name: "goodsShelfNormalModify",
});
},
handleRefreshTable() {
this.$refs.tableRef.refreshTable();
......@@ -185,34 +189,74 @@ export default {
},
// 查看
handleDetail(row) {
this.$router.push({
name: "goodsShelfDetail",
query: {
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
},
});
},
// 新增 或 修改
handleModify({ operate, record }) {
if (operate === "create") {
if (row.shelfModel === 1) {
// 特殊上架详情
this.$router.push({
name: "goodsShelfCreate",
name: "goodsShelfDetail",
query: {
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
},
});
}
if (operate === "edit") {
if (row.shelfModel === 2) {
// 常规上架详情
this.$router.push({
name: "goodsShelfModify",
name: "goodsShelfNormalDetail",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
baseSceneCode: row.baseSceneCode,
businessCode: row.businessCode,
shelfType: row.shelfType,
shelfModel: row.shelfModel,
},
});
}
},
// 新增 或 修改
handleModify({ operate, record }) {
console.log(record);
// 特殊上架编辑
if (record?.shelfModel === 1) {
if (operate === "create") {
this.$router.push({
name: "goodsShelfCreate",
});
}
if (operate === "edit") {
this.$router.push({
name: "goodsShelfModify",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
},
});
}
}
if (record?.shelfModel === 2) {
if (operate === "create") {
this.$router.push({
name: "goodsShelfNormalModify",
});
}
if (operate === "edit") {
this.$router.push({
name: "goodsShelfNormalModify",
query: {
baseSceneCode: record.baseSceneCode,
businessCode: record.businessCode,
shelfType: record.shelfType,
shelfModel: record.shelfModel,
},
});
}
}
},
},
};
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!