Commit a41f417e by Jaxon

style: 格式调整

1 parent 64d41875
...@@ -115,7 +115,7 @@ let baseConfig = config; ...@@ -115,7 +115,7 @@ let baseConfig = config;
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取 // 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch( fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config", "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config-sj",
) )
.then( .then(
(response) => { (response) => {
......
<!-- 表单 --> <!-- 表单 -->
<template> <template>
<div class="grounding-form" v-if="show"> <div v-if="show" class="grounding-form">
<el-form :model="formData" :rules="rules" :ref="formRef + 'd2FormRuleForm'"> <el-form :ref="`${formRef}d2FormRuleForm`"
:model="formData"
:rules="rules">
<slot name="title" /> <slot name="title" />
<div v-for="(i, idx) in formList" :key="idx" class="grounding-form-block"> <div v-for="(i, idx) in formList"
:key="idx"
class="grounding-form-block">
<p v-show="i.title" class="title"> <p v-show="i.title" class="title">
{{ i.title }} {{ i.title }}
</p> </p>
...@@ -11,226 +15,200 @@ ...@@ -11,226 +15,200 @@
<div v-for="(item, index) in i.formBlock" :key="index"> <div v-for="(item, index) in i.formBlock" :key="index">
<!-- 单选 --> <!-- 单选 -->
<!-- 太阳膜类商品 上架部位 --> <!-- 太阳膜类商品 上架部位 -->
<div <div v-if="
v-if=" item.type === 'radio'
item.type === 'radio' && && formData.goodsType == 1
formData['goodsType'] == 1 && && !item.index
!item.index ">
" <el-form-item :id="item.name"
>
<el-form-item
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
>
<el-radio-group v-model="formData[item.name]"> <el-radio-group v-model="formData[item.name]">
<el-radio <el-radio v-for="(subItem, subIndex) in item.radioGroupList"
v-for="(subItem, subIndex) in item.radioGroupList"
:key="subIndex" :key="subIndex"
:label="subItem.confId" :label="subItem.confId">
>{{ subItem.confName }}</el-radio {{ subItem.confName }}
> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</div> </div>
<!-- 1.3场景显示升级/产品供货模式 --> <!-- 1.3场景显示升级/产品供货模式 -->
<div <div v-if="
v-if=" item.type === 'radio'
item.type === 'radio' && && item.index
item.index && && ((formData.productType
((formData['productType'] && && formData.productType.includes(item.index)))
formData['productType'].includes(item.index))) ">
" <el-form-item :id="item.name"
>
<el-form-item
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
>
<el-radio-group v-model="formData[item.name]"> <el-radio-group v-model="formData[item.name]">
<el-radio <el-radio v-for="(subItem, subIndex) in item.radioGroupList"
v-for="(subItem, subIndex) in item.radioGroupList"
:key="subIndex" :key="subIndex"
:label="subItem.confId" :label="subItem.confId">
>{{ subItem.confName }}</el-radio {{ subItem.confName }}
> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</div> </div>
<!-- 商品附带信息 --> <!-- 商品附带信息 -->
<div v-if="formData['upgradeGoodsId'] && item.type === 'incidBox'"> <div v-if="formData.upgradeGoodsId && item.type === 'incidBox'">
<div class="incid_box"> <div class="incid_box">
<div <div v-for="(subItem, subIndex) in item.detailInfo"
class="item"
v-for="(subItem, subIndex) in item.detailInfo"
:key="subIndex" :key="subIndex"
> class="item">
<div class="label"> <div class="label">
{{ {{
subItem.unit subItem.unit
? membraneTypeList.includes(formData[item.key]) ? membraneTypeList.includes(formData[item.key])
? subItem.label + ? `${subItem.label
`(元)/${ }(元)/${
subItem.value == "purchasePrice" ? "卷" : "车" subItem.value == "purchasePrice" ? "卷" : "车"
}` }`
: subItem.label + "(元)/件" : `${subItem.label}(元)/件`
: subItem.label : subItem.label
}}: }}:
</div> </div>
<div class="value"> <div class="value">
<ellipsis-popover <EllipsisPopover :content="
:content="
subItem.unit subItem.unit
? priceFilter(formData.upgradeGoods[subItem.value]) ? priceFilter(formData.upgradeGoods[subItem.value])
: formData.upgradeGoods[subItem.value] || '' : formData.upgradeGoods[subItem.value] || ''
" ">
></ellipsis-popover> </EllipsisPopover>
</div> </div>
</div> </div>
<!-- 权益/延保非第三方展示 --> <!-- 权益/延保非第三方展示 -->
<div <div v-if="
class="item" (equitySceneType.includes(formData[item.key])
v-if=" || extendedPosiType.includes(formData[item.key]))
(equitySceneType.includes(formData[item.key]) || && !baseConfig.supplierCode.includes(
extendedPosiType.includes(formData[item.key])) && `${formData.supplierCode}`,
!baseConfig.supplierCode.includes(
`${formData.supplierCode}`
) )
" "
> class="item">
<div class="label">嘀加成本元/件:</div> <div class="label">
嘀加成本元/件:
</div>
<div class="value"> <div class="value">
<ellipsis-popover <EllipsisPopover :content="
:content=" priceFilter(formData.upgradeGoods.djCost) || '-'
priceFilter(formData.upgradeGoods['djCost']) || '-' ">
" </EllipsisPopover>
></ellipsis-popover>
</div> </div>
</div> </div>
<!-- 商品分类 1太阳膜/延保类 --> <!-- 商品分类 1太阳膜/延保类 -->
<div class="item" v-if="formData[item.key] == 1"> <div v-if="formData[item.key] == 1" class="item">
<div class="label">部位:</div> <div class="label">
部位:
</div>
<div class="value"> <div class="value">
<ellipsis-popover <EllipsisPopover :content="formData.upgradeGoods.positionNames || ''">
:content="formData.upgradeGoods['positionNames'] || ''" </EllipsisPopover>
></ellipsis-popover>
</div> </div>
</div> </div>
<!-- 商品分类 权益类(供应方为非第三方) --> <!-- 商品分类 权益类(供应方为非第三方) -->
<div <div v-if="
class="item" equitySceneType.includes(formData[item.key])
v-if=" && !baseConfig.supplierCode.includes(
equitySceneType.includes(formData[item.key]) && `${formData.supplierCode}`,
!baseConfig.supplierCode.includes(
`${formData.supplierCode}`
) )
" "
> class="item">
<div class="label">服务项目:</div> <div class="label">
服务项目:
</div>
<div class="value"> <div class="value">
<ellipsis-popover <EllipsisPopover :content="formData.upgradeGoods.serviceItemNames || ''">
:content="formData.upgradeGoods['serviceItemNames'] || ''" </EllipsisPopover>
></ellipsis-popover>
</div> </div>
</div> </div>
<!-- 商品分类 权益升级 --> <!-- 商品分类 权益升级 -->
<div <div v-if="equitySceneType.includes(formData[item.key])"
class="item" class="item">
v-if="equitySceneType.includes(formData[item.key])" <div class="label">
> 实体卡:
<div class="label">实体卡:</div> </div>
<div class="value"> <div class="value">
{{ {{
formData.upgradeGoods["entityCardFlag"] == "Y" formData.upgradeGoods.entityCardFlag == "Y"
? "是" ? "是"
: "否" : "否"
}} }}
</div> </div>
</div> </div>
<!-- 质保年限 膜类展示--> <!-- 质保年限 膜类展示 -->
<div <div v-if="membraneTypeList.includes(formData[item.key])"
class="item" class="item">
v-if="membraneTypeList.includes(formData[item.key])" <div class="label">
> 质保年限/年:
<div class="label">质保年限/年:</div> </div>
<div class="value"> <div class="value">
<ellipsis-popover <EllipsisPopover :content="
:content=" `${formData.upgradeGoods.warrantyPeriod}年` || ''
`${formData.upgradeGoods['warrantyPeriod']}年` || '' ">
" </EllipsisPopover>
></ellipsis-popover>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- 下拉框/输入框 --> <!-- 下拉框/输入框 -->
<div <div v-if="
v-if=" item.type === 'input'
item.type === 'input' || || item.type === 'select'
item.type === 'select' || || item.type === 'searchSelect'
item.type === 'searchSelect' ">
" <el-form-item :id="item.name"
>
<el-form-item
:prop="item.name" :prop="item.name"
:label=" :label="
item.label item.label
? (item.unit ? `${item.unit
? membraneTypeList.includes(formData['goodsType']) ? membraneTypeList.includes(formData.goodsType)
? item.label + `(元)/车` ? `${item.label}(元)/车`
: item.label + '(元)/件' : `${item.label}(元)/件`
: item.label) + ':' : item.label}:`
: '' : ''
" "
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
>
<template v-if="item.type === 'input'"> <template v-if="item.type === 'input'">
<el-input <el-input v-model.trim="formData[item.name]"
v-model.trim="formData[item.name]"
:placeholder="item.label" :placeholder="item.label"
:maxlength="item.maxlength" :maxlength="item.maxlength"
:style="{ width: item.width || formItemWidth }" :style="{ width: item.width || formItemWidth }"
:disabled="item.isDisabled" :disabled="item.isDisabled"
clearable clearable
@input="input($event, item)" @input="input($event, item)"
@blur="blur(item)" @blur="blur(item)">
>
</el-input> </el-input>
<template v-if="item.name == 'minSellPrice'"> <template v-if="item.name == 'minSellPrice'">
<el-checkbox <el-checkbox v-model="formData.validMinSellPriceFlag"
@change="changeCheckMinprice"
v-model="formData['validMinSellPriceFlag']"
class="check-min-price" class="check-min-price"
></el-checkbox> @change="changeCheckMinprice">
</el-checkbox>
<span class="tips-text">勾选时提单校验最低价</span> <span class="tips-text">勾选时提单校验最低价</span>
</template> </template>
</template> </template>
<!-- 选择框 --> <!-- 选择框 -->
<el-select <el-select v-else-if="item.type === 'select'"
v-else-if="item.type === 'select'" :ref="`selectRefs_${item.name}`"
v-model="formData[item.name]" v-model="formData[item.name]"
:clearable="item.isClear" :clearable="item.isClear"
:ref="'selectRefs_' + item.name" :placeholder="`请选择${item.label}`"
:placeholder="'请选择' + item.label"
@change="selectAddAttr($event, item)"
:style="{ width: item.width || formItemWidth }" :style="{ width: item.width || formItemWidth }"
filterable filterable
> @change="selectAddAttr($event, item)">
<el-option <el-option v-for="subItem in item.optionList"
v-for="subItem in item.optionList"
:key="subItem[item.optionId]" :key="subItem[item.optionId]"
:label="subItem[item.optionLabel]" :label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" :value="subItem[item.optionId]" />
/>
</el-select> </el-select>
<!-- <el-select v-else-if="item.type === 'searchSelect'" v-model="formData[item.name]" <!-- <el-select v-else-if="item.type === 'searchSelect'" v-model="formData[item.name]"
:clearable="item.isClear" :placeholder="'请选择' + item.label" @change="selectAddAttr($event, item)" :clearable="item.isClear" :placeholder="'请选择' + item.label" @change="selectAddAttr($event, item)"
...@@ -243,37 +221,34 @@ ...@@ -243,37 +221,34 @@
<span class="typeName">{{ subItem[item.optionTypeNameLabel] }}</span> <span class="typeName">{{ subItem[item.optionTypeNameLabel] }}</span>
</el-option> </el-option>
</el-select> --> </el-select> -->
<el-button <el-button v-else-if="item.type === 'searchSelect'"
v-else-if="item.type === 'searchSelect'"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleSelectGoods" @click="handleSelectGoods">
>选择商品</el-button 选择商品
> </el-button>
</el-form-item> </el-form-item>
</div> </div>
<!-- 财务规则校验 --> <!-- 财务规则校验 -->
<div v-if="item.type === 'flagRadio'"> <div v-if="item.type === 'flagRadio'">
<el-form-item <el-form-item :id="item.name"
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
>
<el-radio-group v-model="formData[item.name]"> <el-radio-group v-model="formData[item.name]">
<el-radio <el-radio v-for="(subItem, subIndex) in item.radioGroupList"
v-for="(subItem, subIndex) in item.radioGroupList"
:key="subIndex" :key="subIndex"
:label="subItem.value" :label="subItem.value">
>{{ subItem.label }}</el-radio {{ subItem.label }}
> </el-radio>
</el-radio-group> </el-radio-group>
<el-tooltip class="item" effect="dark" placement="top"> <el-tooltip class="item"
<template slot="content"> effect="dark"
placement="top">
<template #content>
<p style="width: 260px"> <p style="width: 260px">
<i class="el-icon-info"></i <i class="el-icon-info"></i>开启财务规则校验,该商品的清分及对账规则只能应用具体商品规则,若不满足所在订单自动挂单,需进行手动发起清分及对账计算
>开启财务规则校验,该商品的清分及对账规则只能应用具体商品规则,若不满足所在订单自动挂单,需进行手动发起清分及对账计算
</p> </p>
</template> </template>
<i class="el-icon-info" style="margin-left: 20px"></i> <i class="el-icon-info" style="margin-left: 20px"></i>
...@@ -282,40 +257,38 @@ ...@@ -282,40 +257,38 @@
</div> </div>
<!-- 按钮 --> <!-- 按钮 -->
<div v-if="item.type === 'button'"> <div v-if="item.type === 'button'">
<el-form-item <el-form-item :id="item.name"
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
> <el-button icon="el-icon-plus"
<el-button icon="el-icon-plus" @click="handleClick" @click="handleClick">
>选择上架门店</el-button 选择上架门店
> </el-button>
<relateStoreTable <RelateStoreTable v-if="$$(formData.merchantGoodsRefList, 'length')"
v-if="$$(formData['merchantGoodsRefList'], 'length')" :merchant-goods-ref-list="formData.merchantGoodsRefList"
:merchant-goods-ref-list="formData['merchantGoodsRefList']" @handleDelete="handleDelete">
@handleDelete="handleDelete" </RelateStoreTable>
>
</relateStoreTable>
</el-form-item> </el-form-item>
</div> </div>
<!-- 多选 --> <!-- 多选 -->
<div v-if="item.type === 'check'"> <div v-if="item.type === 'check'">
<el-form-item <el-form-item :id="item.name"
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
class="dis-in-block" class="dis-in-block"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
> <template #label>
<span slot="label"> <span>
{{ item.label }} {{ item.label }}
<!-- content="Top Left 提示文字" --> <!-- content="Top Left 提示文字" -->
<el-tooltip class="item" effect="dark" placement="top-start"> <el-tooltip class="item"
<template slot="content"> effect="dark"
placement="top-start">
<template #content>
<p> <p>
说明:基础产品应用于客户战败(不升级)订单中,升级产品应用于客户升级订单中 说明:基础产品应用于客户战败(不升级)订单中,升级产品应用于客户升级订单中
</p> </p>
...@@ -324,12 +297,11 @@ ...@@ -324,12 +297,11 @@
</el-tooltip> </el-tooltip>
: :
</span> </span>
</template>
<el-checkbox-group v-model="formData[item.name]"> <el-checkbox-group v-model="formData[item.name]">
<el-checkbox <el-checkbox v-for="(subItem, subIndex) in item.checkGroupList"
v-for="(subItem, subIndex) in item.checkGroupList"
:key="subIndex" :key="subIndex"
:label="subItem.confId" :label="subItem.confId">
>
{{ subItem.confName }} {{ subItem.confName }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
...@@ -337,17 +309,14 @@ ...@@ -337,17 +309,14 @@
</div> </div>
<!-- 上传凭证 --> <!-- 上传凭证 -->
<div v-if="item.type === 'upload'" class="upload-box"> <div v-if="item.type === 'upload'" class="upload-box">
<el-form-item <el-form-item :id="item.name"
:prop="item.name" :prop="item.name"
:label="item.label ? item.label + ':' : ''" :label="item.label ? `${item.label}:` : ''"
:id="item.name"
class="dis-in-block" class="dis-in-block"
:label-width="item.label ? '180px' : '0px'" :label-width="item.label ? '180px' : '0px'"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }" :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
>
<template> <template>
<el-upload <el-upload action=""
action=""
accept=".jpg,.png,.pdf" accept=".jpg,.png,.pdf"
class="upload-file" class="upload-file"
drag drag
...@@ -357,53 +326,49 @@ ...@@ -357,53 +326,49 @@
:auto-upload="false" :auto-upload="false"
:on-change="(e) => handleFileChange(e, item)" :on-change="(e) => handleFileChange(e, item)"
:on-exceed="hanldeOnExceed" :on-exceed="hanldeOnExceed"
multiple multiple>
>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
点击或将文件拖拽到此区域上传 点击或将文件拖拽到此区域上传
</div> </div>
<div class="item-tips text-tips">{{ item.topTips }}</div> <div class="item-tips text-tips">
<div class="item-tips">{{ item.tips }}</div> {{ item.topTips }}
</div>
<div class="item-tips">
{{ item.tips }}
</div>
</el-upload> </el-upload>
<!-- 文件列表区域 --> <!-- 文件列表区域 -->
<div class="file-box"> <div class="file-box">
<div <div v-for="(subItem, subIndex) in formData[item.name]"
v-for="(subItem, subIndex) in formData[item.name]" :key="subIndex">
:key="subIndex" <div v-if="
> !filterEmpty(subItem.uploadProgress)
<div || subItem.voucherFileUrl
class="file-item"
v-if="
!filterEmpty(subItem.uploadProgress) ||
subItem.voucherFileUrl
" "
> class="file-item">
<div <div class="file-content"
class="file-content" @click="handleFileView(subItem)">
@click="handleFileView(subItem)" <el-progress define-back-color="#F5F7FA"
>
<el-progress
define-back-color="#F5F7FA"
:text-inside="true" :text-inside="true"
text-color="#333333" text-color="#333333"
:show-text="false" :show-text="false"
:stroke-width="26" :stroke-width="26"
stroke-linecap="butt" stroke-linecap="butt"
:percentage="subItem.uploadProgress" :percentage="subItem.uploadProgress">
></el-progress> </el-progress>
<div class="file-name">{{ subItem.fileName }}</div> <div class="file-name">
{{ subItem.fileName }}
</div>
</div> </div>
<i <i v-if="!subItem.voucherFileUrl"
v-if="!subItem.voucherFileUrl"
class="el-icon-close del-icon" class="el-icon-close del-icon"
@click="doCancel(item, subIndex)" @click="doCancel(item, subIndex)">
></i> </i>
<i <i v-if="subItem.voucherFileUrl"
v-if="subItem.voucherFileUrl"
class="el-icon-delete" class="el-icon-delete"
@click="handleFileDelete(item, subIndex)" @click="handleFileDelete(item, subIndex)">
></i> </i>
</div> </div>
</div> </div>
</div> </div>
...@@ -414,30 +379,24 @@ ...@@ -414,30 +379,24 @@
</div> </div>
</div> </div>
<el-form-item style="margin-top: 40px; text-align: center"> <el-form-item style="margin-top: 40px; text-align: center">
<el-button <el-button type="primary"
type="primary"
@click="handleUp(1)"
:disabled="$store.state.d2admin.loading.value" :disabled="$store.state.d2admin.loading.value"
> @click="handleUp(1)">
保存并上架 保存并上架
</el-button> </el-button>
<!-- 草稿状态/已下架/新增显示 --> <!-- 草稿状态/已下架/新增显示 -->
<el-button <el-button v-if="filterEmpty(formData.status) || formData.status == 3"
type="primary" type="primary"
plain plain
class="width_100" class="width_100"
@click="handleUp(2)"
:disabled="$store.state.d2admin.loading.value" :disabled="$store.state.d2admin.loading.value"
v-if="filterEmpty(formData.status) || formData.status == 3" @click="handleUp(2)">
>
存草稿 存草稿
</el-button> </el-button>
<el-button <el-button v-if="addOrEdit == 'add'"
type="primary" type="primary"
v-if="addOrEdit == 'add'"
@click="handleUp(3)"
:disabled="$store.state.d2admin.loading.value" :disabled="$store.state.d2admin.loading.value"
> @click="handleUp(3)">
保存并继续新增 保存并继续新增
</el-button> </el-button>
<el-button class="width_100 cancel-btn" @click="handleClose"> <el-button class="width_100 cancel-btn" @click="handleClose">
...@@ -446,8 +405,7 @@ ...@@ -446,8 +405,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- store-api (1精品升级 2次新车转化 3售后众筹 查询嘀加的门店数据 getList)(0会员/权益升级 4积分商城 查询账户中心所有4s店 getAccountMerchantList --> <!-- store-api (1精品升级 2次新车转化 3售后众筹 查询嘀加的门店数据 getList)(0会员/权益升级 4积分商城 查询账户中心所有4s店 getAccountMerchantList -->
<relate-store-dialog <RelateStoreDialog v-if="relateStoreVisible"
v-if="relateStoreVisible"
ref="formRelateStore" ref="formRelateStore"
:relate-store-visible="relateStoreVisible" :relate-store-visible="relateStoreVisible"
:store-api=" :store-api="
...@@ -459,89 +417,136 @@ ...@@ -459,89 +417,136 @@
:store-selected="storeSelected" :store-selected="storeSelected"
:selected-scene="formData.sceneType" :selected-scene="formData.sceneType"
@handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose" @handleRelateStoreClose="handleRelateStoreClose">
> <template #default>
<el-row slot> <el-row>
<el-form :model="storeSearchForm" ref="relate" :inline="true"> <el-form ref="relate"
:model="storeSearchForm"
:inline="true">
<el-form-item label="门店名称:"> <el-form-item label="门店名称:">
<el-input <el-input v-model.trim="storeSearchForm.merchantName"
v-model.trim="storeSearchForm.merchantName"
placeholder="门店名称" placeholder="门店名称"
@keydown.native="handleStoreInput"
clearable clearable
/> @keydown.native="handleStoreInput" />
</el-form-item> </el-form-item>
<el-form-item label="门店商户号:"> <el-form-item label="门店商户号:">
<el-input <el-input v-model.trim="storeSearchForm.merchantId"
v-model.trim="storeSearchForm.merchantId"
placeholder="门店商户号" placeholder="门店商户号"
@keydown.native="handleStoreInput"
clearable clearable
/> @keydown.native="handleStoreInput" />
</el-form-item> </el-form-item>
<el-form-item label="服务对接:"> <el-form-item label="服务对接:">
<el-input <el-input v-model.trim="storeSearchForm.yqMerchantName"
v-model.trim="storeSearchForm.yqMerchantName"
placeholder="服务对接" placeholder="服务对接"
@keydown.native="handleStoreInput"
clearable clearable
/> @keydown.native="handleStoreInput" />
</el-form-item> </el-form-item>
<el-form-item label="服务对接商户号:"> <el-form-item label="服务对接商户号:">
<el-input <el-input v-model.trim="storeSearchForm.yqMerchantId"
v-model.trim="storeSearchForm.yqMerchantId"
placeholder="服务对接商户号" placeholder="服务对接商户号"
@keydown.native="handleStoreInput"
clearable clearable
/> @keydown.native="handleStoreInput" />
</el-form-item> </el-form-item>
<el-button type="primary" @click="handleSearchStore">搜索</el-button> <el-button type="primary" @click="handleSearchStore">
搜索
</el-button>
</el-form> </el-form>
</el-row> </el-row>
</relate-store-dialog> </template>
<el-image-viewer </RelateStoreDialog>
v-if="imgViewerVisible" <ElImageViewer v-if="imgViewerVisible"
:on-close="closeImgViewer" :on-close="closeImgViewer"
:url-list="imageFileArr" :url-list="imageFileArr"
:initial-index="initialIndex" :initial-index="initialIndex" />
/> <SelectGoodsDialog v-if="selectGoodsVisible"
<select-goods-dialog
v-if="selectGoodsVisible"
:select-goods-visible="selectGoodsVisible" :select-goods-visible="selectGoodsVisible"
@handleSelectGoodsConfirm="handleSelectGoodsConfirm"
@handleSelectGoodsClose="handleSelectGoodsClose"
:upgrade-goods-id="formData.upgradeGoodsId" :upgrade-goods-id="formData.upgradeGoodsId"
></select-goods-dialog> @handleSelectGoodsConfirm="handleSelectGoodsConfirm"
@handleSelectGoodsClose="handleSelectGoodsClose">
</SelectGoodsDialog>
</div> </div>
</template> </template>
<script> <script>
import { deepClone } from "@/common/util" import GlOssApi from "glsk-oss-jssdk";
import { limitPrice } from "@/common/format" import { mapActions } from "vuex";
import { mapActions } from "vuex" import { getAccountMerchantList, getList } from "@/api/merchant";
import { uploadImg, uploadPDF } from "@/api/sys.base" import { uploadImg, uploadPDF } from "@/api/sys.base";
import { limitPrice } from "@/common/format";
import { deepClone } from "@/common/util";
import { baseConfig } from "@/main";
import ellipsisPopover from "../../components/ellipsisPopover.vue";
import selectGoodsDialog from "../../components/selectGoodsDialog.vue";
import { convertYuanToWan, filterSpecsStr } from "../../filterOption";
// import { getSceneTypeListByMerchantId } from '@api/grounding' // import { getSceneTypeListByMerchantId } from '@api/grounding'
import { import {
crowdUpgradeSupplyModeList,
upgradeSupplyModeList, upgradeSupplyModeList,
crowdUpgradeSupplyModeList } from "../constants/data";
} from "../constants/data" import relateStoreDialog from "./relateStoreDialog.vue";
import { baseConfig } from "@/main" import relateStoreTable from "./relateStoreTable.vue";
import GlOssApi from "glsk-oss-jssdk"
import relateStoreDialog from "./relateStoreDialog.vue"
import relateStoreTable from "./relateStoreTable.vue"
import { getList, getAccountMerchantList } from "@/api/merchant"
import selectGoodsDialog from "../../components/selectGoodsDialog.vue"
import ellipsisPopover from "../../components/ellipsisPopover.vue"
import { filterSpecsStr, convertYuanToWan } from "../../filterOption"
export default { export default {
name: "GroundingForm", name: "GroundingForm",
components: { components: {
relateStoreDialog, RelateStoreDialog: relateStoreDialog,
relateStoreTable, RelateStoreTable: relateStoreTable,
"el-image-viewer": () => ElImageViewer: () =>
import("element-ui/packages/image/src/image-viewer"), import("element-ui/packages/image/src/image-viewer"),
selectGoodsDialog, SelectGoodsDialog: selectGoodsDialog,
ellipsisPopover EllipsisPopover: ellipsisPopover,
},
directives: {
"el-select-loadmore": {
bind(el, binding) {
const SELECTWRAP_DOM = el.querySelector(
".el-select-dropdown .el-select-dropdown__wrap",
);
SELECTWRAP_DOM.addEventListener("scroll", function () {
const condition
= this.scrollHeight - this.scrollTop <= this.clientHeight;
if (condition) {
binding.value();
}
});
},
},
},
props: {
// add - 新增;edit - 编辑
addOrEdit: {
type: String,
default: "add",
},
formItemWidth: {
type: String,
default: "100%",
},
formRef: {
type: String,
default: "",
},
originData: {
type: Object,
default: () => {
return {};
},
},
formList: {
type: Array,
default: () => {},
},
secondGoodsList: {
type: Array,
default: () => {},
},
positionTypeList: {
// 太阳膜商品部位
type: Array,
default: () => [],
},
}, },
data() { data() {
return { return {
...@@ -553,46 +558,46 @@ export default { ...@@ -553,46 +558,46 @@ export default {
formData: {}, formData: {},
reg: { reg: {
numReg: /^[1-9]\d*$/, numReg: /^[1-9]\d*$/,
priceReg: /^\d[\d\.]*$/ priceReg: /^\d[\d.]*$/,
}, },
show: false, show: false,
rules: { rules: {
merchantGoodsRefList: [ merchantGoodsRefList: [
{ required: true, message: "请选择上架门店", trigger: "change" } { required: true, message: "请选择上架门店", trigger: "change" },
], ],
sceneType: [ sceneType: [
{ required: true, message: "请选择业务场景", trigger: "change" } { required: true, message: "请选择业务场景", trigger: "change" },
], ],
upgradeGoodsId: [ upgradeGoodsId: [
{ required: true, message: "请选择上架商品", trigger: "change" } { required: true, message: "请选择上架商品", trigger: "change" },
], ],
position: [ position: [
{ required: true, message: "请选择上架部位", trigger: "change" } { required: true, message: "请选择上架部位", trigger: "change" },
], ],
productType: [ productType: [
{ required: true, message: "请选择产品类型", trigger: "change" } { required: true, message: "请选择产品类型", trigger: "change" },
], ],
baseSupplyMode: [ baseSupplyMode: [
{ {
required: true, required: true,
message: "请选择基础产品供货模式", message: "请选择基础产品供货模式",
trigger: "change" trigger: "change",
} },
], ],
upgradeSupplyMode: [ upgradeSupplyMode: [
{ {
required: true, required: true,
message: "请选择升级/产品供货模式", message: "请选择升级/产品供货模式",
trigger: "change" trigger: "change",
} },
], ],
sellPrice: [ sellPrice: [
{ required: true, message: "请输入售价", trigger: "blur" }, { required: true, message: "请输入售价", trigger: "blur" },
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
;+value <= 0 ? callback(new Error("售价需大于0")) : callback() ;+value <= 0 ? callback(new Error("售价需大于0")) : callback();
} },
} },
], ],
minSellPrice: [ minSellPrice: [
{ required: true, message: "请输入最低售价", trigger: "blur" }, { required: true, message: "请输入最低售价", trigger: "blur" },
...@@ -602,12 +607,12 @@ export default { ...@@ -602,12 +607,12 @@ export default {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
;+value > +this.formData.sellPrice ;+value > +this.formData.sellPrice
? callback(new Error("最低售价不能大于售价")) ? callback(new Error("最低售价不能大于售价"))
: callback() : callback();
} },
} },
], ],
upgradeProductCost: [ upgradeProductCost: [
{ required: true, message: "请输入产品、升级成本", trigger: "blur" } { required: true, message: "请输入产品、升级成本", trigger: "blur" },
// { // {
// validator: (rule, value, callback) => { // validator: (rule, value, callback) => {
// (+value <= 0) ? callback(new Error('产品、升级成本需大于0')) : callback() // (+value <= 0) ? callback(new Error('产品、升级成本需大于0')) : callback()
...@@ -615,30 +620,30 @@ export default { ...@@ -615,30 +620,30 @@ export default {
// } // }
], ],
giftCost: [ giftCost: [
{ required: true, message: "请输入赠送成本", trigger: "blur" } { required: true, message: "请输入赠送成本", trigger: "blur" },
], ],
recoveryCost: [ recoveryCost: [
{ required: true, message: "请输入回收成本", trigger: "blur" } { required: true, message: "请输入回收成本", trigger: "blur" },
], ],
virtualAccountCost: [ virtualAccountCost: [
{ required: true, message: "请输入虚拟对账成本", trigger: "blur" } { required: true, message: "请输入虚拟对账成本", trigger: "blur" },
], ],
warrantyType: [ warrantyType: [
{ required: true, message: "请选择质保卡类型", trigger: "change" } { required: true, message: "请选择质保卡类型", trigger: "change" },
], ],
djCost: [ djCost: [
{ required: true, message: "请输入嘀加成本", trigger: "blur" } { required: true, message: "请输入嘀加成本", trigger: "blur" },
], ],
thirdPartyCost: [ thirdPartyCost: [
{ required: true, message: "请输入第三方成本", trigger: "blur" } { required: true, message: "请输入第三方成本", trigger: "blur" },
], ],
financeCheckFlag: [ financeCheckFlag: [
{ {
required: true, required: true,
message: "请选择是否开启财务规则校验", message: "请选择是否开启财务规则校验",
trigger: "change" trigger: "change",
} },
] ],
}, },
storeSelected: [], storeSelected: [],
relateStoreVisible: false, relateStoreVisible: false,
...@@ -646,7 +651,7 @@ export default { ...@@ -646,7 +651,7 @@ export default {
merchantName: "", merchantName: "",
merchantId: "", merchantId: "",
yqMerchantName: "", yqMerchantName: "",
yqMerchantId: "" yqMerchantId: "",
}, },
selectDisabled: false, selectDisabled: false,
dialogObj: {}, dialogObj: {},
...@@ -655,61 +660,26 @@ export default { ...@@ -655,61 +660,26 @@ export default {
imgViewerVisible: false, imgViewerVisible: false,
initialIndex: 0, initialIndex: 0,
selectGoodsVisible: false, selectGoodsVisible: false,
filterSpecsStr filterSpecsStr,
} };
},
props: {
// add - 新增;edit - 编辑
addOrEdit: {
type: String,
default: "add"
},
formItemWidth: {
type: String,
default: "100%"
},
formRef: {
type: String,
default: ""
},
originData: {
type: Object,
default: () => {
return {}
}
},
formList: {
type: Array,
default: () => {}
},
secondGoodsList: {
type: Array,
default: () => {}
},
positionTypeList: {
// 太阳膜商品部位
type: Array,
default: () => []
}
}, },
watch: { watch: {
originData: { "originData": {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
this.formData = deepClone(this.originData) this.formData = deepClone(this.originData);
} }
}, },
deep: true deep: true,
}, },
formData: { "formData": {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
this.filterEditForm() this.filterEditForm();
} }
}, },
deep: true deep: true,
}, },
// 'formData.merchantId': { // 'formData.merchantId': {
// handler(newValue, oldValue) { // handler(newValue, oldValue) {
...@@ -719,74 +689,57 @@ export default { ...@@ -719,74 +689,57 @@ export default {
// }, // },
"formData.sceneType": { "formData.sceneType": {
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.oldSceneType = oldVal || newVal this.oldSceneType = oldVal || newVal;
} },
}, },
"formData.voucherList": { "formData.voucherList": {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
this.uploadFileList = newVal.filter( this.uploadFileList = newVal.filter(
(v) => !this.filterEmpty(v.uploadProgress) || v.voucherFileUrl v => !this.filterEmpty(v.uploadProgress) || v.voucherFileUrl,
) // 文件列表 ); // 文件列表
const imageFileArr = newVal.filter( const imageFileArr = newVal.filter(
(v) => v =>
v.voucherFileUrl && v.voucherFileUrl
(v.voucherFileUrl.includes(".png") || && (v.voucherFileUrl.includes(".png")
v.voucherFileUrl.includes("jpg")) || v.voucherFileUrl.includes("jpg")),
) );
this.imageFileArr = imageFileArr.map((item) => { this.imageFileArr = imageFileArr.map((item) => {
return item.voucherFileUrl return item.voucherFileUrl;
}) });
} }
}, },
deep: true deep: true,
}
}, },
directives: {
"el-select-loadmore": {
bind(el, binding) {
const SELECTWRAP_DOM = el.querySelector(
".el-select-dropdown .el-select-dropdown__wrap"
)
SELECTWRAP_DOM.addEventListener("scroll", function () {
const condition =
this.scrollHeight - this.scrollTop <= this.clientHeight
if (condition) {
binding.value()
}
})
}
}
}, },
mounted() { mounted() {
this.GlOssApi = new GlOssApi({ this.GlOssApi = new GlOssApi({
baseConfig baseConfig,
}) });
this.formData = deepClone(this.originData) this.formData = deepClone(this.originData);
this.copyFormList = deepClone(this.formList) this.copyFormList = deepClone(this.formList);
this.filterEditForm() this.filterEditForm();
}, },
methods: { methods: {
...mapActions({ ...mapActions({
get: "d2admin/base/get" get: "d2admin/base/get",
}), }),
handleFileChange(e, targetItem) { handleFileChange(e, targetItem) {
setTimeout(() => { setTimeout(() => {
// var reader = new FileReader() // var reader = new FileReader()
const fileInfo = e.raw const fileInfo = e.raw;
const fileName = fileInfo.name const fileName = fileInfo.name;
if ( if (
!fileInfo.name.includes(".pdf") && !fileInfo.name.includes(".pdf")
!fileInfo.name.includes(".png") && && !fileInfo.name.includes(".png")
!fileInfo.name.includes(".jpg") && !fileInfo.name.includes(".jpg")
) { ) {
return this.$message({ return this.$message({
message: "文件格式不支持上传", message: "文件格式不支持上传",
type: "warning" type: "warning",
}) });
} }
// reader.readAsDataURL(fileInfo) // reader.readAsDataURL(fileInfo)
// reader.onload = (e) => { // reader.onload = (e) => {
...@@ -815,90 +768,92 @@ export default { ...@@ -815,90 +768,92 @@ export default {
// this.clearItem(targetItem, index) // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标 // this.clearItem(targetItem, index) // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
// }) // })
// } // }
const _formData = this.formData const _formData = this.formData;
_formData[targetItem.name].push({ _formData[targetItem.name].push({
voucherFileUrl: "", voucherFileUrl: "",
uploadProgress: 0, uploadProgress: 0,
fileName: fileInfo.name?.substring(0, 128), fileName: fileInfo.name?.substring(0, 128),
fileSize: fileInfo.size, fileSize: fileInfo.size,
cancelAxios: {} cancelAxios: {},
}) });
const index = _formData[targetItem.name].length - 1 const index = _formData[targetItem.name].length - 1;
const success = (res) => { const success = (res) => {
_formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress // 文件地址 _formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress; // 文件地址
} };
const fail = (err) => { const fail = (err) => {
this.clearItem(targetItem, index) // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标 this.clearItem(targetItem, index); // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
} };
this.handleOssUpload(fileInfo, fileName, success, fail) this.handleOssUpload(fileInfo, fileName, success, fail);
}, 50) }, 50);
}, },
handleOssUpload(file, fileName, success, fail) { handleOssUpload(file, fileName, success, fail) {
const bucketName = "jinrong-huidan-test" // 桶名 const bucketName = "jinrong-huidan-test"; // 桶名
const fileType = fileName.substr(fileName.lastIndexOf(".") + 1) const fileType = fileName.substr(fileName.lastIndexOf(".") + 1);
this.GlOssApi.multipartUpload(file, success, fail, bucketName, fileType) this.GlOssApi.multipartUpload(file, success, fail, bucketName, fileType);
}, },
hanldeOnExceed() { hanldeOnExceed() {
this.$message({ this.$message({
message: "最多可上传30个文件", message: "最多可上传30个文件",
type: "warning" type: "warning",
}) });
}, },
setProgressText(item) { setProgressText(item) {
return () => { return () => {
return item.name return item.name;
} };
}, },
// 删除文件 // 删除文件
handleFileDelete(targetItem, subIndex) { handleFileDelete(targetItem, subIndex) {
this.clearItem(targetItem, subIndex) this.clearItem(targetItem, subIndex);
}, },
// 预览文件 // 预览文件
handleFileView(item) { handleFileView(item) {
if (!item.voucherFileUrl) return if (!item.voucherFileUrl)
return;
if (item?.voucherFileUrl.includes(".pdf")) { if (item?.voucherFileUrl.includes(".pdf")) {
// pdf文件直接打开新窗口预览 // pdf文件直接打开新窗口预览
window.open(item.voucherFileUrl) window.open(item.voucherFileUrl);
} else { } else {
this.imgViewerVisible = true this.imgViewerVisible = true;
this.imageFileArr.forEach((val, index) => { this.imageFileArr.forEach((val, index) => {
if (val == item.voucherFileUrl) this.initialIndex = index if (val == item.voucherFileUrl)
}) this.initialIndex = index;
});
} }
}, },
closeImgViewer() { closeImgViewer() {
this.imgViewerVisible = false this.imgViewerVisible = false;
}, },
// 取消上传 // 取消上传
doCancel(targetItem, subIndex) { doCancel(targetItem, subIndex) {
const _formData = this.formData const _formData = this.formData;
const cancelUploadObj = _formData[targetItem.name][subIndex].cancelAxios const cancelUploadObj = _formData[targetItem.name][subIndex].cancelAxios;
cancelUploadObj && cancelUploadObj.cancel && cancelUploadObj.cancel() cancelUploadObj && cancelUploadObj.cancel && cancelUploadObj.cancel();
this.clearItem(targetItem, subIndex) this.clearItem(targetItem, subIndex);
}, },
filterEmpty(data) { filterEmpty(data) {
return (data ?? "") === "" return (data ?? "") === "";
}, },
// 清空上传文件数组项内容 // 清空上传文件数组项内容
clearItem(targetItem, subIndex) { clearItem(targetItem, subIndex) {
this.$set(this.formData[targetItem.name][subIndex], "voucherFileUrl", "") this.$set(this.formData[targetItem.name][subIndex], "voucherFileUrl", "");
this.$set(this.formData[targetItem.name][subIndex], "uploadProgress", "") this.$set(this.formData[targetItem.name][subIndex], "uploadProgress", "");
}, },
// 过滤form表单显示内容 // 过滤form表单显示内容
filterEditForm() { filterEditForm() {
const { copyFormList, formData } = this const { copyFormList, formData } = this;
// 1 太阳膜 2 (1.3场景商品) // 1 太阳膜 2 (1.3场景商品)
const shopType = const shopType
formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : "" = formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : "";
const shopForm = deepClone(copyFormList[0].formBlock) const shopForm = deepClone(copyFormList[0].formBlock);
const spliceForm = const spliceForm
shopType == "1" = shopType == "1"
? [ ? [
"giftCost", "giftCost",
"recoveryCost", "recoveryCost",
"virtualAccountCost", "virtualAccountCost",
"djCost", "djCost",
"thirdPartyCost" "thirdPartyCost",
] ]
: shopType == "2" : shopType == "2"
? [ ? [
...@@ -908,18 +863,18 @@ export default { ...@@ -908,18 +863,18 @@ export default {
"recoveryCost", "recoveryCost",
"virtualAccountCost", "virtualAccountCost",
"djCost", "djCost",
"thirdPartyCost" "thirdPartyCost",
] ]
: // 权益/延保类 无升级成本 新增嘀加成本和第三方成本 : // 权益/延保类 无升级成本 新增嘀加成本和第三方成本
this.equitySceneType.includes(formData?.goodsType) || this.equitySceneType.includes(formData?.goodsType)
this.extendedPosiType.includes(formData?.goodsType) || this.extendedPosiType.includes(formData?.goodsType)
? [ ? [
"upgradeSupplyMode", "upgradeSupplyMode",
"warrantyType", "warrantyType",
"giftCost", "giftCost",
"recoveryCost", "recoveryCost",
"virtualAccountCost", "virtualAccountCost",
"upgradeProductCost" "upgradeProductCost",
] ]
: [ : [
"upgradeSupplyMode", "upgradeSupplyMode",
...@@ -928,134 +883,140 @@ export default { ...@@ -928,134 +883,140 @@ export default {
"recoveryCost", "recoveryCost",
"virtualAccountCost", "virtualAccountCost",
"djCost", "djCost",
"thirdPartyCost" "thirdPartyCost",
] ];
// 未勾选基础商品类型 // 未勾选基础商品类型
if (!formData.productType?.includes(1)) spliceForm.push("baseSupplyMode") if (!formData.productType?.includes(1))
spliceForm.push("baseSupplyMode");
// 赠送成本:仅产品类型选择“基础产品”时展示 // 赠送成本:仅产品类型选择“基础产品”时展示
if (formData.productType?.includes(1)) if (formData.productType?.includes(1)) {
spliceForm.indexOf("giftCost") > -1 && spliceForm.includes("giftCost")
spliceForm.splice(spliceForm.indexOf("giftCost"), 1) && spliceForm.splice(spliceForm.indexOf("giftCost"), 1);
}
// 回收成本:仅产品类型选择“升级产品”且升级/产品供货模式选择“门店回收原厂+嘀加”时展示 // 回收成本:仅产品类型选择“升级产品”且升级/产品供货模式选择“门店回收原厂+嘀加”时展示
if ( if (
formData.productType?.includes(2) && formData.productType?.includes(2)
formData.upgradeSupplyMode == 4 && formData.upgradeSupplyMode == 4
) { ) {
spliceForm.indexOf("recoveryCost") > -1 && spliceForm.includes("recoveryCost")
spliceForm.splice(spliceForm.indexOf("recoveryCost"), 1) && spliceForm.splice(spliceForm.indexOf("recoveryCost"), 1);
} }
// 虚拟对账成本:仅产品类型选择“升级产品”且升级/产品供货模式选择“门店套码+嘀加”“ 服务商自采+嘀加”时展示 // 虚拟对账成本:仅产品类型选择“升级产品”且升级/产品供货模式选择“门店套码+嘀加”“ 服务商自采+嘀加”时展示
if ( if (
(formData.productType?.includes(2) && (formData.productType?.includes(2)
formData.upgradeSupplyMode == 3) || && formData.upgradeSupplyMode == 3)
(formData.productType?.includes(2) && formData.upgradeSupplyMode == 5) || (formData.productType?.includes(2) && formData.upgradeSupplyMode == 5)
) { ) {
spliceForm.indexOf("virtualAccountCost") > -1 && spliceForm.includes("virtualAccountCost")
spliceForm.splice(spliceForm.indexOf("virtualAccountCost"), 1) && spliceForm.splice(spliceForm.indexOf("virtualAccountCost"), 1);
} }
// 仅选中基础产品类型 不展示 售价字段 嘀加成本/第三方成本 // 仅选中基础产品类型 不展示 售价字段 嘀加成本/第三方成本
if ( if (
formData.productType?.length == 1 && formData.productType?.length == 1
formData.productType?.includes(1) && formData.productType?.includes(1)
) ) {
spliceForm.push( spliceForm.push(
"sellPrice", "sellPrice",
"minSellPrice", "minSellPrice",
"upgradeProductCost", "upgradeProductCost",
"upgradeSupplyMode", "upgradeSupplyMode",
"djCost", "djCost",
"thirdPartyCost" "thirdPartyCost",
) );
if (!formData.upgradeGoodsId) spliceForm.push('productType') }
const newForm = shopForm.filter((v) => !spliceForm?.includes(v.name)) if (!formData.upgradeGoodsId)
this.$set(this.formList[0], "formBlock", newForm) spliceForm.push("productType");
const newForm = shopForm.filter(v => !spliceForm?.includes(v.name));
this.$set(this.formList[0], "formBlock", newForm);
this.$nextTick(() => { this.$nextTick(() => {
// 1.3场景 升级产品供货模式 // 1.3场景 升级产品供货模式
const formIndex = this.formList[0].formBlock.findIndex( const formIndex = this.formList[0].formBlock.findIndex(
(subItem) => subItem.name == "upgradeSupplyMode" subItem => subItem.name == "upgradeSupplyMode",
) );
if (formData.sceneType == 3) { if (formData.sceneType == 3) {
if (formIndex >= 0) if (formIndex >= 0) {
this.$set( this.$set(
this.formList[0].formBlock[formIndex], this.formList[0].formBlock[formIndex],
"radioGroupList", "radioGroupList",
crowdUpgradeSupplyModeList crowdUpgradeSupplyModeList,
) );
}
} }
// 太阳膜类 升级产品供货模式(优先级高) // 太阳膜类 升级产品供货模式(优先级高)
if (shopType == 1) { if (shopType == 1) {
// 由1.3场景 切换到太阳膜 已选升级供货模式为2 的清除掉 太阳膜供货模式没有2 // 由1.3场景 切换到太阳膜 已选升级供货模式为2 的清除掉 太阳膜供货模式没有2
if (formData.upgradeSupplyMode == 2) if (formData.upgradeSupplyMode == 2)
this.formData.upgradeSupplyMode = "" this.formData.upgradeSupplyMode = "";
if (formIndex > -1) if (formIndex > -1) {
this.$set( this.$set(
this.formList[0].formBlock[formIndex], this.formList[0].formBlock[formIndex],
"radioGroupList", "radioGroupList",
upgradeSupplyModeList upgradeSupplyModeList,
) );
}
// 上架部位 // 上架部位
this.formData?.positionNamesArr?.forEach((val) => { this.formData?.positionNamesArr?.forEach((val) => {
val.confId = val.position val.confId = val.position;
}) });
this.$set( this.$set(
this.formList[0].formBlock[ this.formList[0].formBlock[
this.formList[0].formBlock.findIndex( this.formList[0].formBlock.findIndex(
(subItem) => subItem.name == "position" subItem => subItem.name == "position",
) )
], ],
"radioGroupList", "radioGroupList",
this.formData?.positionNamesArr || [] this.formData?.positionNamesArr || [],
) );
} }
// 延保类 // 延保类
if (this.extendedPosiType.includes(formData?.goodsType)) { if (this.extendedPosiType.includes(formData?.goodsType)) {
this.formData?.positionNamesArr?.forEach((val) => { this.formData?.positionNamesArr?.forEach((val) => {
val.confId = val.position val.confId = val.position;
}) });
this.$set( this.$set(
this.formList[0].formBlock[ this.formList[0].formBlock[
this.formList[0].formBlock.findIndex( this.formList[0].formBlock.findIndex(
(subItem) => subItem.name == "position" subItem => subItem.name == "position",
) )
], ],
"radioGroupList", "radioGroupList",
this.formData?.positionNamesArr || [] this.formData?.positionNamesArr || [],
) );
} }
// 当商品信息自带嘀加成本时,将输入框置灰 // 当商品信息自带嘀加成本时,将输入框置灰
if ( if (
!this.filterEmpty(formData?.upgradeGoods?.djCost) && !this.filterEmpty(formData?.upgradeGoods?.djCost)
this.formList[0].formBlock?.find((v) => v.name == "djCost") && this.formList[0].formBlock?.find(v => v.name == "djCost")
) { ) {
this.$set( this.$set(
this.formList[0].formBlock?.find((v) => v.name == "djCost"), this.formList[0].formBlock?.find(v => v.name == "djCost"),
"isDisabled", "isDisabled",
true true,
) );
} }
this.show = true this.show = true;
this.$refs[this.formRef + "d2FormRuleForm"] && this.$refs[this.formRef + "d2FormRuleForm"]
this.$refs[this.formRef + "d2FormRuleForm"].clearValidate() && this.$refs[this.formRef + "d2FormRuleForm"].clearValidate();
}) });
}, },
handleSelectGoods() { handleSelectGoods() {
this.selectGoodsVisible = true this.selectGoodsVisible = true;
}, },
handleSelectGoodsConfirm(selectedData) { handleSelectGoodsConfirm(selectedData) {
const _formData = this.formData const _formData = this.formData;
const _valueObj = selectedData const _valueObj = selectedData;
const _positionNamesArr = const _positionNamesArr
deepClone(this.positionTypeList).filter((val) => = deepClone(this.positionTypeList).filter(val =>
_valueObj?.position?.split(",")?.includes(val.position + "") _valueObj?.position?.split(",")?.includes(val.position + ""),
) || [] ) || [];
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName }
_valueObj?.goodsInfo || {} = _valueObj?.goodsInfo || {};
const types = [ const types = [
goodsTypeName, goodsTypeName,
secondaryGoodsTypeName, secondaryGoodsTypeName,
thirdLevelGoodsTypeName thirdLevelGoodsTypeName,
] ];
const result = types.filter((type) => type).join("-") const result = types.filter(type => type).join("-");
_formData.upgradeGoods = { _formData.upgradeGoods = {
..._valueObj, ..._valueObj,
goodsName: _valueObj.goodsInfo.goodsName, goodsName: _valueObj.goodsInfo.goodsName,
...@@ -1067,180 +1028,182 @@ export default { ...@@ -1067,180 +1028,182 @@ export default {
}${ }${
item.serviceItemId item.serviceItemId
? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan( ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(
item.maxPrice item.maxPrice,
)}万` )}万`
: "" : ""
}` }`;
}) })
?.join(","), // 服务项目 ?.join(","), // 服务项目
positionNames: _positionNamesArr.length positionNames: _positionNamesArr.length
? _positionNamesArr ? _positionNamesArr
.map((subItem) => { .map((subItem) => {
return subItem?.confName return subItem?.confName;
}) })
.join("/") .join("/")
: "", : "",
specificationData: this.filterSpecsStr(_valueObj), specificationData: this.filterSpecsStr(_valueObj),
djCost: _valueObj?.djCost, djCost: _valueObj?.djCost,
carTypeConfigName: _valueObj?.carTypeConfigList carTypeConfigName: _valueObj?.carTypeConfigList
?.map((item) => item.seriesName) ?.map(item => item.seriesName)
.join("/"), .join("/"),
upgradeCommodityCode: _valueObj?.commodityCode upgradeCommodityCode: _valueObj?.commodityCode,
} }
;(_formData.goodsType = _valueObj?.goodsInfo?.goodsType), ;(_formData.goodsType = _valueObj?.goodsInfo?.goodsType),
(_formData.upgradeGoodsId = _valueObj.id) (_formData.upgradeGoodsId = _valueObj.id);
_formData.positionNamesArr = _positionNamesArr _formData.positionNamesArr = _positionNamesArr;
_formData.productType = [] // 切换上架商品 将服务类型清空 _formData.productType = []; // 切换上架商品 将服务类型清空
_formData.baseSupplyMode = "" // 切换上架商品 将基础供货模式清空 _formData.baseSupplyMode = ""; // 切换上架商品 将基础供货模式清空
_formData.upgradeSupplyMode = "" // 切换上架商品 将升级/产品供货模式清空 _formData.upgradeSupplyMode = ""; // 切换上架商品 将升级/产品供货模式清空
_formData.supplierCode = _valueObj?.goodsInfo?.supplierCode // 供应方 判断是否需要走审核流程 _formData.supplierCode = _valueObj?.goodsInfo?.supplierCode; // 供应方 判断是否需要走审核流程
_formData.validMinSellPriceFlag = true // 切换上架商品 默认勾选校验最低价 _formData.validMinSellPriceFlag = true; // 切换上架商品 默认勾选校验最低价
_formData.validMinSellPrice = 'Y' // 切换上架商品 默认勾选校验最低价 _formData.validMinSellPrice = "Y"; // 切换上架商品 默认勾选校验最低价
if (!this.filterEmpty(_valueObj?.djCost)) if (!this.filterEmpty(_valueObj?.djCost))
_formData.djCost = _valueObj?.djCost // 嘀加成本 商品信息自带数据 _formData.djCost = _valueObj?.djCost; // 嘀加成本 商品信息自带数据
this.handleSelectGoodsClose() this.handleSelectGoodsClose();
}, },
handleSelectGoodsClose() { handleSelectGoodsClose() {
this.selectGoodsVisible = false this.selectGoodsVisible = false;
}, },
// 选择上架门店 // 选择上架门店
handleClick() { handleClick() {
const _this = this const _this = this;
if (_this.filterEmpty(_this.formData.sceneType)) { if (_this.filterEmpty(_this.formData.sceneType)) {
return this.$message.warning("请选择业务场景") return this.$message.warning("请选择业务场景");
} }
_this.storeSelected = deepClone(_this.formData.merchantGoodsRefList) _this.storeSelected = deepClone(_this.formData.merchantGoodsRefList);
_this.relateStoreVisible = true _this.relateStoreVisible = true;
}, },
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) { if (!selectedData.length) {
this.$message({ this.$message({
message: "请选择关联门店", message: "请选择关联门店",
type: "warning", type: "warning",
showClose: true showClose: true,
}) });
return true return true;
} }
this.formData.merchantGoodsRefList = selectedData this.formData.merchantGoodsRefList = selectedData;
this.relateStoreVisible = false this.relateStoreVisible = false;
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
this.relateStoreVisible = false this.relateStoreVisible = false;
}, },
handleStoreInput(e) { handleStoreInput(e) {
e.keyCode === 13 && this.handleSearchStore() e.keyCode === 13 && this.handleSearchStore();
}, },
// 门店搜索 // 门店搜索
handleSearchStore() { handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1) this.$refs.formRelateStore.handleCurrentChange(1);
}, },
// 删除上架门店 // 删除上架门店
handleDelete(item) { handleDelete(item) {
const filterArr = this.formData.merchantGoodsRefList.filter( const filterArr = this.formData.merchantGoodsRefList.filter(
(i) => i.merchantId !== item.merchantId i => i.merchantId !== item.merchantId,
) );
this.$set(this.formData, "merchantGoodsRefList", filterArr) this.$set(this.formData, "merchantGoodsRefList", filterArr);
}, },
// 下拉加载更多 下拉框显示隐藏触发 // 下拉加载更多 下拉框显示隐藏触发
visibleChange(data) { visibleChange(data) {
this.$emit("visibleChange", data) this.$emit("visibleChange", data);
}, },
interestsLoadmore() { interestsLoadmore() {
this.$emit("interestsLoadmore") this.$emit("interestsLoadmore");
}, },
remoteMethod(query) { remoteMethod(query) {
this.$emit("remoteMethod", query) this.$emit("remoteMethod", query);
}, },
// 修复直接调用可以会因为没有对应方法报错的问题 // 修复直接调用可以会因为没有对应方法报错的问题
input(event, item) { input(event, item) {
item.handleInput && this.handleInput(event, item) item.handleInput && this.handleInput(event, item);
}, },
blur(item) { blur(item) {
item.handleBlur && item.handleBlur() item.handleBlur && item.handleBlur();
}, },
// 价格过滤 // 价格过滤
handleInput(e, item) { handleInput(e, item) {
e = e.replace(/[^\d.]/g, "") e = e.replace(/[^\d.]/g, "");
let oldValue = `${this.formData["old" + item.name]}` let oldValue = `${this.formData["old" + item.name]}`;
this.$set(this.formData, `${item.name}`, limitPrice(e, oldValue, 6, 2, 0)) this.$set(this.formData, `${item.name}`, limitPrice(e, oldValue, 6, 2, 0));
this.$set(this.formData, `old${item.name}`, this.formData[item.name]) this.$set(this.formData, `old${item.name}`, this.formData[item.name]);
}, },
// 选择框-添加其他属性 // 选择框-添加其他属性
selectAddAttr(value, targetItem) { selectAddAttr(value, targetItem) {
const _formData = this.formData const _formData = this.formData;
if (targetItem.name == "merchantId") { if (targetItem.name == "merchantId") {
var _tempVal = targetItem.optionList.find( let _tempVal = targetItem.optionList.find(
(item) => item.merchantId === value item => item.merchantId === value,
) );
_formData.merchantName = _tempVal.merchantName _formData.merchantName = _tempVal.merchantName;
} }
// 切换业务场景 将选中的上架门店清空 // 切换业务场景 将选中的上架门店清空
if (targetItem.name === "sceneType") { if (targetItem.name === "sceneType") {
const _formData = this.formData const _formData = this.formData;
if (!this.filterEmpty(this.oldSceneType)) { if (!this.filterEmpty(this.oldSceneType)) {
// 清空门店弹窗搜索条件 // 清空门店弹窗搜索条件
this.storeSearchForm = { this.storeSearchForm = {
merchantName: "", merchantName: "",
merchantId: "", merchantId: "",
yqMerchantName: "", yqMerchantName: "",
yqMerchantId: "" yqMerchantId: "",
} };
if (_formData.merchantGoodsRefList?.length) { if (_formData.merchantGoodsRefList?.length) {
this.$confirm("切换业务场景,将清空上架门店,是否继续", "提示", { this.$confirm("切换业务场景,将清空上架门店,是否继续", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "warning" type: "warning",
}) })
.then(() => { .then(() => {
_formData.sceneType = value _formData.sceneType = value;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectRefs_sceneType[0].blur() this.$refs.selectRefs_sceneType[0].blur();
_formData.merchantGoodsRefList = [] _formData.merchantGoodsRefList = [];
this.$forceUpdate() this.$forceUpdate();
}) });
}) })
.catch(() => { .catch(() => {
_formData.sceneType = this.oldSceneType _formData.sceneType = this.oldSceneType;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectRefs_sceneType[0].blur() this.$refs.selectRefs_sceneType[0].blur();
}) });
}) });
} }
} }
} }
}, },
handleClose() { handleClose() {
this.$emit("handleClose") this.$emit("handleClose");
}, },
jumpScroll(idName) { jumpScroll(idName) {
document.getElementById(idName).scrollIntoView() document.getElementById(idName).scrollIntoView();
}, },
filterEmpty(data) { filterEmpty(data) {
return (data ?? "") === "" return (data ?? "") === "";
}, },
// 处理金额补零 // 处理金额补零
priceFilter(num) { priceFilter(num) {
var pow = Math.pow(10, 2) let pow = 10 ** 2;
if (this.filterEmpty(num)) return "-" if (this.filterEmpty(num))
return `${(Math.round(num * pow) / pow).toFixed(2)}元` return "-";
return `${(Math.round(num * pow) / pow).toFixed(2)}元`;
}, },
// 商品是否校验最低价 // 商品是否校验最低价
changeCheckMinprice(e) { changeCheckMinprice(e) {
this.formData.validMinSellPrice = e ? "Y" : "N" this.formData.validMinSellPrice = e ? "Y" : "N";
}, },
handleUp(e) { handleUp(e) {
this.$refs[this.formRef + "d2FormRuleForm"].validate((valid, options) => { this.$refs[this.formRef + "d2FormRuleForm"].validate((valid, options) => {
if (valid) { if (valid) {
this.$emit("handleAddConfirm", { ...this.formData, num: e }) this.$emit("handleAddConfirm", { ...this.formData, num: e });
} else { } else {
var needRuleList = Object.keys(options) let needRuleList = Object.keys(options);
this.jumpScroll(needRuleList[0]) this.jumpScroll(needRuleList[0]);
return true return true;
}
})
} }
} });
} },
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.grounding-form { .grounding-form {
.grounding-form-block { .grounding-form-block {
...@@ -1433,9 +1396,7 @@ export default { ...@@ -1433,9 +1396,7 @@ export default {
display: none !important; display: none !important;
} }
::v-deep ::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
.el-radio__inner {
box-shadow: none !important; box-shadow: none !important;
} }
</style> </style>
<!-- 上架编辑 --> <!-- 上架编辑 -->
<template> <template>
<d2-container class="edit-commodity" v-loading="!show"> <d2-container v-loading="!show" class="edit-commodity">
<div class="" v-if="show"> <div v-if="show" class="">
<grounding-form ref="d2GroundingForm" :add-or-edit="addOrEdit" :form-ref="proFormRef" :origin-data="editData" <GroundingForm ref="d2GroundingForm"
:form-list="editForm" :second-goods-list="secondGoodsList" @handleAddConfirm="handleAddConfirm" :add-or-edit="addOrEdit"
@handleClose="handleAddClose" :position-type-list="positionTypeList"></grounding-form> :form-ref="proFormRef"
:origin-data="editData"
:form-list="editForm"
:second-goods-list="secondGoodsList"
:position-type-list="positionTypeList"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose">
</GroundingForm>
</div> </div>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { productList, baseSupplyModeList, upgradeSupplyModeList } from "./constants/data" import { addOrUpdateAPI, checkGroundingLog, getMerchantGoodsInfo } from "@api/grounding";
import { getMerchantGoodsInfo, addOrUpdateAPI, checkGroundingLog } from '@api/grounding' import { mapActions } from "vuex";
import groundingForm from "./components/groundingForm.vue" import { BaseData, sceneCodeList } from "@/common/constants.js";
import { BaseData, sceneCodeList } from '@/common/constants.js' import { deepClone } from "@/common/util";
import { mapActions } from 'vuex' import { baseConfig } from "@/main";
import { deepClone } from '@/common/util' import { convertYuanToWan, filterSpecsStr } from "../filterOption";
import { baseConfig } from '@/main' import groundingForm from "./components/groundingForm.vue";
import { filterSpecsStr, convertYuanToWan } from "../filterOption" import { baseSupplyModeList, productList, upgradeSupplyModeList } from "./constants/data";
export default { export default {
name: 'EditGrounding', name: "EditGrounding",
components: { components: {
groundingForm GroundingForm: groundingForm,
}, },
data() { data() {
return { return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类 extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
show: false, show: false,
addOrEdit: 'add', addOrEdit: "add",
proFormRef: 'pro', proFormRef: "pro",
editForm: [{ editForm: [{
title: '商品信息', title: "商品信息",
formBlock: [{ formBlock: [
name: 'upgradeGoodsId', {
label: '上架商品', name: "upgradeGoodsId",
label: "上架商品",
isRequired: true, isRequired: true,
type: 'searchSelect', type: "searchSelect",
optionList: [], optionList: [],
isClear: false, isClear: false,
optionId: 'confId', optionId: "confId",
optionNameLabel: 'confNameValue', optionNameLabel: "confNameValue",
optionTypeNameLabel: 'confTypeNameValue', optionTypeNameLabel: "confTypeNameValue",
width: '432px' width: "432px",
}, { },
type: 'incidBox', {
key: 'goodsType', type: "incidBox",
detailInfo: [{ key: "goodsType",
label: '商品名称', detailInfo: [
value: 'upgradeGoodsName' {
}, { label: "商品名称",
label: '规格', value: "upgradeGoodsName",
value: 'specificationData' },
}, { {
label: '商品编码', label: "规格",
value: 'type' value: "specificationData",
}, { },
label: '第三方编码', {
value: 'thirdPartyCode' label: "商品编码",
}, { value: "type",
label: '采购价', },
value: 'purchasePrice', {
unit: true label: "第三方编码",
}, { value: "thirdPartyCode",
label: '参考售价', },
value: 'upgradePrice', {
unit: true label: "采购价",
}, { value: "purchasePrice",
label: '适用车型', unit: true,
value: 'carTypeConfigName' },
}, { {
label: '所属系列', label: "参考售价",
value: 'goodsName' value: "upgradePrice",
}, { unit: true,
label: '所属分类', },
value: 'tempGoodsTypeName' {
}, { label: "适用车型",
label: '商品ID', value: "carTypeConfigName",
value: 'upgradeCommodityCode' },
}] {
}, { label: "所属系列",
name: 'position', value: "goodsName",
label: '上架部位', },
type: 'radio', {
radioGroupList: [] label: "所属分类",
}, { value: "tempGoodsTypeName",
name: 'goodsAlias', },
label: '商品别名', {
type: 'input', label: "商品ID",
value: "upgradeCommodityCode",
},
],
},
{
name: "position",
label: "上架部位",
type: "radio",
radioGroupList: [],
},
{
name: "goodsAlias",
label: "商品别名",
type: "input",
maxlength: 50, maxlength: 50,
width: '432px' width: "432px",
}, { },
name: 'warrantyType', {
label: '质保卡类型', name: "warrantyType",
type: 'select', label: "质保卡类型",
type: "select",
isClear: false, isClear: false,
optionList: [{ optionList: [{
confId: 0, confId: 0,
confName: '质保卡' confName: "质保卡",
}, { }, {
confId: 1, confId: 1,
confName: '质保权益卡' confName: "质保权益卡",
}], }],
optionId: 'confId', optionId: "confId",
optionLabel: 'confName', optionLabel: "confName",
width: '432px' width: "432px",
}, { },
name: 'productType', {
label: '产品类型', name: "productType",
type: 'check', label: "产品类型",
checkGroupList: [] type: "check",
}, { checkGroupList: [],
name: 'baseSupplyMode', },
label: '基础产品供货模式', {
type: 'radio', name: "baseSupplyMode",
label: "基础产品供货模式",
type: "radio",
index: 1, index: 1,
radioGroupList: [] radioGroupList: [],
}, { },
name: 'upgradeSupplyMode', {
label: '升级/产品供货模式', name: "upgradeSupplyMode",
type: 'radio', label: "升级/产品供货模式",
type: "radio",
index: 2, index: 2,
radioGroupList: [] radioGroupList: [],
}, { },
name: 'sellPrice', {
label: '售价', name: "sellPrice",
type: 'input', label: "售价",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'minSellPrice', {
label: '最低售价', name: "minSellPrice",
type: 'input', label: "最低售价",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'upgradeProductCost', {
label: '产品、升级成本', name: "upgradeProductCost",
type: 'input', label: "产品、升级成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'giftCost', {
label: '赠送成本', name: "giftCost",
type: 'input', label: "赠送成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'recoveryCost', {
label: '回收成本', name: "recoveryCost",
type: 'input', label: "回收成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'virtualAccountCost', {
label: '虚拟对账成本', name: "virtualAccountCost",
type: 'input', label: "虚拟对账成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'djCost', {
label: '嘀加成本', name: "djCost",
type: 'input', label: "嘀加成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
isDisabled: false, isDisabled: false,
handleInput: true handleInput: true,
}, { },
name: 'thirdPartyCost', {
label: '第三方成本', name: "thirdPartyCost",
type: 'input', label: "第三方成本",
width: '432px', type: "input",
width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { },
name: 'financeCheckFlag', {
label: '财务规则校验', name: "financeCheckFlag",
type: 'flagRadio', label: "财务规则校验",
type: "flagRadio",
radioGroupList: [{ radioGroupList: [{
label: '关闭', label: "关闭",
value: 'N' value: "N",
}, { }, {
label: '开启', label: "开启",
value: 'Y' value: "Y",
}] }],
}] },
],
}, { }, {
title: '门店信息', title: "门店信息",
formBlock: [{ formBlock: [{
name: 'sceneType', name: "sceneType",
label: '业务场景', label: "业务场景",
isRequired: true, isRequired: true,
type: 'select', type: "select",
isClear: false, isClear: false,
optionList: [], optionList: [],
optionId: 'confId', optionId: "confId",
optionLabel: 'confValue', optionLabel: "confValue",
width: '432px' width: "432px",
}, { }, {
name: 'merchantGoodsRefList', name: "merchantGoodsRefList",
label: '上架门店', label: "上架门店",
isRequired: true, isRequired: true,
type: 'button' type: "button",
}, { }, {
name: 'voucherList', name: "voucherList",
label: '上架凭证', label: "上架凭证",
type: 'upload', type: "upload",
topTips: '支持扩展名:.pdf .jpg .png', topTips: "支持扩展名:.pdf .jpg .png",
tips: '注:最多可上传30个文件', tips: "注:最多可上传30个文件",
maxPhotoNum: 30 maxPhotoNum: 30,
}] }],
}], }],
editData: { editData: {
merchantGoodsRefList: [], merchantGoodsRefList: [],
sceneCode: '', sceneCode: "",
upgradeGoodsId: '', upgradeGoodsId: "",
goodsCode: '', goodsCode: "",
positionNames: '', positionNames: "",
goodsType: '', goodsType: "",
productType: [], productType: [],
sceneCode: '', sceneCode: "",
baseSupplyMode: '', baseSupplyMode: "",
upgradeSupplyMode: '', upgradeSupplyMode: "",
sellPrice: '', sellPrice: "",
minSellPrice: '', minSellPrice: "",
giveCostPrice: '', giveCostPrice: "",
recoveryCostPrice: '', recoveryCostPrice: "",
reconcilyCostPrice: '', reconcilyCostPrice: "",
voucherList: [], voucherList: [],
validMinSellPriceFlag: true, validMinSellPriceFlag: true,
validMinSellPrice: 'Y', validMinSellPrice: "Y",
financeCheckFlag: 'N' financeCheckFlag: "N",
}, },
secondGoodsList: [], secondGoodsList: [],
goodsNameKeyword: '', goodsNameKeyword: "",
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
positionTypeList: [], // 太阳膜类商品部位 positionTypeList: [], // 太阳膜类商品部位
filterSpecsStr filterSpecsStr,
} };
}, },
mounted() { mounted() {
this.getBaseData() this.getBaseData();
const id = this.$route.query.id const id = this.$route.query.id;
if (!id) { if (!id) {
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true;
}) });
} else { } else {
this.addOrEdit = 'edit' this.addOrEdit = "edit";
// 获取商品详情 // 获取商品详情
this.getDetailInfo(id) this.getDetailInfo(id);
} }
}, },
methods: { methods: {
...mapActions({ ...mapActions({
get: 'd2admin/base/get', get: "d2admin/base/get",
close: 'd2admin/page/close' close: "d2admin/page/close",
}), }),
async getBaseData() { async getBaseData() {
this.editForm.forEach(item => { this.editForm.forEach((item) => {
item.formBlock && item.formBlock.forEach(v => { item.formBlock && item.formBlock.forEach((v) => {
if (v.type == 'check') { if (v.type == "check") {
v.checkGroupList = productList // 产品类型 v.checkGroupList = productList; // 产品类型
} else if (v.type == 'radio') { } else if (v.type == "radio") {
if (v.index == 1) { if (v.index == 1) {
v.radioGroupList = baseSupplyModeList // 基础供货模式 v.radioGroupList = baseSupplyModeList; // 基础供货模式
} else if (v.index == 2) { } else if (v.index == 2) {
v.radioGroupList = upgradeSupplyModeList // 升级供货模式 v.radioGroupList = upgradeSupplyModeList; // 升级供货模式
} else { } else {
v.radioGroupList = [] v.radioGroupList = [];
} }
} }
if (v.name == 'sceneType') { // 业务场景 if (v.name == "sceneType") { // 业务场景
v.optionList = sceneCodeList v.optionList = sceneCodeList;
} }
}) });
}) });
this.positionTypeList = await this.get(BaseData.positionTypeList) this.positionTypeList = await this.get(BaseData.positionTypeList);
}, },
getDetailInfo(id) { getDetailInfo(id) {
getMerchantGoodsInfo({ id }).then(res => { getMerchantGoodsInfo({ id }).then((res) => {
const productType = [] const productType = [];
const positionNamesArr = deepClone(this.positionTypeList)?.filter(val => (res?.upgradeGoods.position?.split(','))?.includes(val.position + '')) || [] const positionNamesArr = deepClone(this.positionTypeList)?.filter(val => (res?.upgradeGoods.position?.split(","))?.includes(val.position + "")) || [];
if (res?.upgradeProductFlag == 'Y') productType.push(2) if (res?.upgradeProductFlag == "Y")
if (res?.baseProductFlag == 'Y') productType.push(1) productType.push(2);
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = res.goodsInfo || {} if (res?.baseProductFlag == "Y")
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName] productType.push(1);
const result = types.filter(type => type).join('-') const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = res.goodsInfo || {};
res.productType = productType // 产品类型 const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName];
res.positionNamesArr = positionNamesArr const result = types.filter(type => type).join("-");
res.supplierCode = res?.goodsInfo?.supplierCode // 供应方code res.productType = productType; // 产品类型
res.validMinSellPriceFlag = res?.validMinSellPrice == 'Y' // 是否校验最低价 res.positionNamesArr = positionNamesArr;
res.supplierCode = res?.goodsInfo?.supplierCode res.supplierCode = res?.goodsInfo?.supplierCode; // 供应方code
res.financeCheckFlag = res.financeCheckFlag res.validMinSellPriceFlag = res?.validMinSellPrice == "Y"; // 是否校验最低价
res.voucherList.forEach(val => { // 处理上传进度 默认进度100% res.supplierCode = res?.goodsInfo?.supplierCode;
if (val.voucherFileUrl) val.uploadProgress = 100 res.financeCheckFlag = res.financeCheckFlag;
}) res.voucherList.forEach((val) => { // 处理上传进度 默认进度100%
res.merchantGoodsRefList = res.merchantGoodsRefList || [] // 上架门店 if (val.voucherFileUrl)
res.voucherList = res.voucherList || [] // 上架凭证 val.uploadProgress = 100;
});
res.merchantGoodsRefList = res.merchantGoodsRefList || []; // 上架门店
res.voucherList = res.voucherList || []; // 上架凭证
res.upgradeGoods = { res.upgradeGoods = {
...res?.upgradeGoods, ...res?.upgradeGoods,
goodsName: res.goodsInfo.goodsName, goodsName: res.goodsInfo.goodsName,
tempGoodsTypeName: result, tempGoodsTypeName: result,
serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { serviceItemNames: res?.upgradeGoods?.upgradeGoodsServiceItemsList?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ''}` return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${(item.serviceItemId) ? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万` : ""}`;
})?.join(','), // 服务项目 })?.join(","), // 服务项目
positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '', positionNames: positionNamesArr.length
? positionNamesArr.map((subItem) => {
return subItem?.confName;
}).join("/")
: "",
specificationData: this.filterSpecsStr(res?.upgradeGoods), specificationData: this.filterSpecsStr(res?.upgradeGoods),
carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'), carTypeConfigName: res?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join("/"),
upgradeCommodityCode: res?.upgradeGoods?.commodityCode upgradeCommodityCode: res?.upgradeGoods?.commodityCode,
} };
this.editData = res || {} this.editData = res || {};
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true;
}) });
}) });
}, },
filterEmpty(data) { filterEmpty(data) {
return (data ?? '') === '' return (data ?? "") === "";
}, },
handleAddClose() { handleAddClose() {
this.close({ tagName: '/grounding' }) this.close({ tagName: "/grounding" });
this.$router.push({ name: 'grounding' }) this.$router.push({ name: "grounding" });
this.close({ tagName: '/editGrounding' }) this.close({ tagName: "/editGrounding" });
}, },
handleAddConfirm(data) { handleAddConfirm(data) {
const { num } = data const { num } = data;
this.confirm(num, data) this.confirm(num, data);
}, },
confirm(num, data, existCheck = true) { confirm(num, data, existCheck = true) {
// 1保存并上架 2存草稿 // 1保存并上架 2存草稿
const formObj = {} const formObj = {};
this.editForm.forEach(val => { this.editForm.forEach((val) => {
val.formBlock.forEach(v => { val.formBlock.forEach((v) => {
if (v.name) formObj[v.name] = data[v.name] if (v.name)
if (v.name == 'productType') { formObj[v.name] = data[v.name];
formObj.baseProductFlag = data[v.name].includes(1) ? 'Y' : 'N' if (v.name == "productType") {
formObj.upgradeProductFlag = data[v.name].includes(2) ? 'Y' : 'N' formObj.baseProductFlag = data[v.name].includes(1) ? "Y" : "N";
formObj.upgradeProductFlag = data[v.name].includes(2) ? "Y" : "N";
} }
}) });
}) });
const arr = [] const arr = [];
data?.merchantGoodsRefList?.forEach(val => { // 上架门店组合数据 防止请求参数过长 data?.merchantGoodsRefList?.forEach((val) => { // 上架门店组合数据 防止请求参数过长
arr.push({ arr.push({
merchantId: val.merchantId, merchantId: val.merchantId,
merchantName: val.merchantName merchantName: val.merchantName,
}) });
}) });
const fileArr = [] const fileArr = [];
data?.voucherList?.forEach(val => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空 data?.voucherList?.forEach((val) => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空
if (val.voucherFileUrl) { if (val.voucherFileUrl) {
fileArr.push({ fileArr.push({
voucherFileUrl: val.voucherFileUrl, voucherFileUrl: val.voucherFileUrl,
fileSize: val.fileSize, fileSize: val.fileSize,
fileName: val.fileName fileName: val.fileName,
}) });
} }
}) });
// 整理上传凭证数据 // 整理上传凭证数据
delete formObj?.productType delete formObj?.productType;
const params = { const params = {
saveDraft: num === 2, // 是否存草稿 saveDraft: num === 2, // 是否存草稿
id: data.id, id: data.id,
...@@ -371,108 +417,114 @@ export default { ...@@ -371,108 +417,114 @@ export default {
merchantGoodsRefList: arr, merchantGoodsRefList: arr,
voucherList: fileArr, voucherList: fileArr,
existCheck, existCheck,
validMinSellPrice: data?.validMinSellPrice validMinSellPrice: data?.validMinSellPrice,
} };
if (data?.goodsType == 1 && data?.sceneType != 1) return this.$message.warning('太阳膜类商品仅支持上架至精品升级场景') if (data?.goodsType == 1 && data?.sceneType != 1)
if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0) return this.$message.warning('延保类商品仅支持上架至会员/权益升级场景') return this.$message.warning("太阳膜类商品仅支持上架至精品升级场景");
this.editData = data if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0)
return this.$message.warning("延保类商品仅支持上架至会员/权益升级场景");
this.editData = data;
const checkParams = { const checkParams = {
id: data.id || '', id: data.id || "",
upgradeGoodsId: formObj.upgradeGoodsId, upgradeGoodsId: formObj.upgradeGoodsId,
position: formObj.position || '', position: formObj.position || "",
sceneType: formObj.sceneType, sceneType: formObj.sceneType,
merchantIdList: arr?.map(val => { return val.merchantId }) merchantIdList: arr?.map((val) => {
} return val.merchantId;
}),
};
if ((num == 1 || num == 3) && !baseConfig.supplierCode.includes(data.supplierCode)) { // 第三方商品无需走审核流程不用提示 if ((num == 1 || num == 3) && !baseConfig.supplierCode.includes(data.supplierCode)) { // 第三方商品无需走审核流程不用提示
this.$confirm('<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?', '提示', { this.$confirm("<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
// 校验上架记录中是否已存在 // 校验上架记录中是否已存在
this.checkEvent(checkParams, params, num) this.checkEvent(checkParams, params, num);
}).catch(err => { }).catch((err) => {
console.log(err) console.log(err);
}) });
} else { } else {
// 校验上架记录中是否已存在 // 校验上架记录中是否已存在
this.checkEvent(checkParams, params, num) this.checkEvent(checkParams, params, num);
} }
}, },
checkEvent(checkParams, params, num) { checkEvent(checkParams, params, num) {
checkGroundingLog(this.dealObjectValue(checkParams)).then(res => { checkGroundingLog(this.dealObjectValue(checkParams)).then((res) => {
if (res >= 1) { if (res >= 1) {
this.$confirm('当前商品在对应门店已存在上架记录,是否确定保存?', '提示', { this.$confirm("当前商品在对应门店已存在上架记录,是否确定保存?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
this.confirmEvent(params, num) this.confirmEvent(params, num);
}) });
} else { } else {
this.confirmEvent(params, num) this.confirmEvent(params, num);
} }
}) });
}, },
confirmEvent(params, num) { confirmEvent(params, num) {
const obj = { // 商品信息 const obj = { // 商品信息
position: '', position: "",
goodsAlias: '', goodsAlias: "",
warrantyType: '', warrantyType: "",
productType: [], productType: [],
baseSupplyMode: '', baseSupplyMode: "",
upgradeSupplyMode: '', upgradeSupplyMode: "",
sellPrice: '', sellPrice: "",
minSellPrice: '', minSellPrice: "",
upgradeProductCost: '', upgradeProductCost: "",
giftCost: '', giftCost: "",
recoveryCost: '', recoveryCost: "",
virtualAccountCost: '', virtualAccountCost: "",
validMinSellPrice: 'Y', validMinSellPrice: "Y",
djCost: '', djCost: "",
thirdPartyCost: '' thirdPartyCost: "",
} };
addOrUpdateAPI(this.dealObjectValue(params)).then(res => { addOrUpdateAPI(this.dealObjectValue(params)).then((res) => {
this.notice.okTips() this.notice.okTips();
if (num == 3) { if (num == 3) {
// 保留 上架商品和上架门店上架凭证数据 // 保留 上架商品和上架门店上架凭证数据
this.editData = { this.editData = {
...this.editData, ...this.editData,
...obj ...obj,
} };
} else { // 保存后跳转列表页 } else { // 保存后跳转列表页
this.handleClose(true) this.handleClose(true);
} }
}) });
}, },
dealObjectValue(obj) { dealObjectValue(obj) {
var param = {} let param = {};
if (obj === null || obj === undefined || obj === "") return param if (obj === null || obj === undefined || obj === "")
for (var key in obj) { return param;
for (let key in obj) {
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") { if (obj[key] !== null && obj[key] !== undefined && obj[key] !== "") {
param[key] = obj[key] param[key] = obj[key];
} }
} }
return param return param;
}, },
handleClose(isRefresh = false) { handleClose(isRefresh = false) {
if (isRefresh) { if (isRefresh) {
this.close({ tagName: '/grounding' }) this.close({ tagName: "/grounding" });
this.$router.push({ name: 'grounding' }) this.$router.push({ name: "grounding" });
this.close({ tagName: '/grounding' }) this.close({ tagName: "/grounding" });
} else { } else {
this.$confirm('内容未保存,是否返回?', '提示', { this.$confirm("内容未保存,是否返回?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
this.close({ tagName: '/grounding' }) this.close({ tagName: "/grounding" });
this.$router.push({ name: 'grounding' }) this.$router.push({ name: "grounding" });
this.close({ tagName: '/grounding' }) this.close({ tagName: "/grounding" });
}).catch(err => { }).catch((err) => {
console.log(err) console.log(err);
}) });
} }
} },
} },
} };
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="品牌:"> <el-form-item label="品牌:">
<el-radio-group v-model="businessType" @change="handleChangeBusinessType"> <el-radio-group v-model="brandId" @change="handleChangeBrand">
<el-radio v-for="(item, index) in brandMerchant" <el-radio v-for="(item) in brandMerchant"
:key="`${item.businessType}${index}`" :key="item.id"
:label="item.businessType"> :label="item.id">
{{ item.childBrandNames }} {{ item.childBrandNames }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
...@@ -37,34 +37,36 @@ export default { ...@@ -37,34 +37,36 @@ export default {
data() { data() {
return { return {
businessType: undefined, businessType: undefined,
brandId: undefined,
}; };
}, },
computed: { computed: {
businessTypes() { businessTypes() {
return this.brandMerchant.map(item => item.businessType); return this.brandMerchant.map(item => item.businessType);
}, },
brandList() {
return this.brandMerchant.map(item => item.childBrandNames);
},
}, },
mounted() { mounted() {
}, },
methods: { methods: {
async handleSetDefaultType() { async handleSetDefaultType() {
console.log("执行");
if (this.brandMerchant[0]?.businessType !== undefined && this.brandMerchant[0].businessType !== null) { if (this.brandMerchant[0]?.businessType !== undefined && this.brandMerchant[0].businessType !== null) {
console.log("?", this.brandMerchant);
this.businessType = this.brandMerchant[0].businessType; this.businessType = this.brandMerchant[0].businessType;
console.log(this.businessType); this.brandId = this.brandMerchant[0].id;
this.handleChangeBusinessType(this.businessType); this.handleChangeBusinessType(this.businessType);
} }
}, },
handleChangeBusinessType(businessType) {
handleChangeBusinessType(e) { const item = this.brandMerchant.find(item => item.businessType === businessType);
console.log("handleChangeBusinessType", e); console.log("item", item);
console.log("this.brandMerchant", this.brandMerchant); if (item) {
const item = this.brandMerchant.find(item => item.businessType === e); this.brandId = item.id;
this.$emit("changeBusiness", item);
}
},
handleChangeBrand(brandId) {
const item = this.brandMerchant.find(item => item.id === brandId);
if (item) { if (item) {
this.businessType = item.businessType;
this.$emit("changeBusiness", item); this.$emit("changeBusiness", item);
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!