Commit 001e3ceb by zhangxw

权益 服务项目需求开发

1 parent 284a0e49
...@@ -18,3 +18,9 @@ export function UpdateProductManage(data) { ...@@ -18,3 +18,9 @@ export function UpdateProductManage(data) {
data.method = `${path}productManager.update` data.method = `${path}productManager.update`
return request(data, 'post') return request(data, 'post')
} }
// 获取权益/升级类目服务项目
export function getProductServiceItems(data) {
data.method = `${path}vd.item.queryServiceItemsGradeConfig`
return request(data, 'post')
}
\ No newline at end of file \ No newline at end of file
...@@ -90,9 +90,3 @@ export function queryFeeCategoryByType(data) { ...@@ -90,9 +90,3 @@ export function queryFeeCategoryByType(data) {
data.method = `${path}smartcarlife.feeCategory.queryFeeCategoryByType` data.method = `${path}smartcarlife.feeCategory.queryFeeCategoryByType`
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
// 2.0场景 素材可选的服务项目
export function getProductServiceItems(data) {
data.method = `dj.api.smartcarlife.vd.item.list.single`
return request(data)
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* @Last Modified time: 2020-11-15 10:22:06 * @Last Modified time: 2020-11-15 10:22:06
*/ */
import { getChannelType, getProductType, getProductServiceItems } from "@/api/sys.base" import { getChannelType, getProductType } from "@/api/sys.base"
// import { // import {
// BaseData // BaseData
// } from '@/common/constants' // } from '@/common/constants'
...@@ -19,9 +19,7 @@ export default { ...@@ -19,9 +19,7 @@ export default {
// 渠道类型 // 渠道类型
channelType: [], channelType: [],
// 产品分类 // 产品分类
productType: [], productType: []
// 2.0场景素材可选服务项目
productServiceItemList: []
}, },
actions: { actions: {
/** /**
...@@ -31,19 +29,10 @@ export default { ...@@ -31,19 +29,10 @@ export default {
*/ */
init({ state, dispatch, commit }) { init({ state, dispatch, commit }) {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
Promise.all([getChannelType({}), getProductType({}), getProductServiceItems({})]).then( Promise.all([getChannelType({}), getProductType({})]).then(
async ([channelType, productType, productServiceItemList]) => { async ([channelType, productType]) => {
// 处理服务项目数据
let arr = []
productServiceItemList.forEach(val => {
arr.push({
serviceCode: val.serviceCode,
serviceName: val.serviceName
})
})
state.channelType = channelType state.channelType = channelType
state.productType = productType state.productType = productType
state.productServiceItemList = arr
// console.log(productType, "productType") // console.log(productType, "productType")
await dispatch("save2db", { await dispatch("save2db", {
name: "", name: "",
...@@ -60,7 +49,6 @@ export default { ...@@ -60,7 +49,6 @@ export default {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
state.channelType = [] state.channelType = []
state.productType = [] state.productType = []
state.productServiceItemList = []
await dispatch("save2db", { await dispatch("save2db", {
name: "", name: "",
value: state value: state
...@@ -113,8 +101,8 @@ export default { ...@@ -113,8 +101,8 @@ export default {
state = state =
(await dispatch("getFromdb", "base")) || (await dispatch("init")) (await dispatch("getFromdb", "base")) || (await dispatch("init"))
} }
const { channelType, productType, productServiceItemList } = state const { channelType, productType } = state
resolve({ channelType, productType, productServiceItemList }) resolve({ channelType, productType })
}) })
}, },
/** /**
......
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
</div> </div>
<!-- 商品分类 权益升级 (线上126) --> <!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData[item.key])"> <div class="item" v-if="equitySceneType.includes(formData[item.key])">
<div class="label">实体卡:</div>
<div class="value">{{ formData['entityCardFlag'] == 'Y' ? '是' : '否' }}</div>
</div>
<!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData[item.key])">
<div class="label">服务项目:</div> <div class="label">服务项目:</div>
<div class="value">{{ formData['serviceItemNames'] }}</div> <div class="value">{{ formData['serviceItemNames'] }}</div>
</div> </div>
......
...@@ -56,6 +56,11 @@ ...@@ -56,6 +56,11 @@
</div> </div>
<!-- 商品分类 权益升级 (线上126) --> <!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData[item.key])"> <div class="item" v-if="equitySceneType.includes(formData[item.key])">
<div class="label">实体卡:</div>
<div class="value">{{ formData['entityCardFlag'] == 'Y' ? '是' : '否' }}</div>
</div>
<!-- 商品分类 权益升级 (线上126) -->
<div class="item" v-if="equitySceneType.includes(formData[item.key])">
<div class="label">服务项目:</div> <div class="label">服务项目:</div>
<div class="value">{{ formData['serviceItemNames'] }}</div> <div class="value">{{ formData['serviceItemNames'] }}</div>
</div> </div>
...@@ -509,6 +514,7 @@ export default { ...@@ -509,6 +514,7 @@ export default {
_formData.warrantyPeriod = _valueObj?.warrantyPeriod // 质保年限 _formData.warrantyPeriod = _valueObj?.warrantyPeriod // 质保年限
_formData.serviceYears = _valueObj?.serviceYears // 服务时间 _formData.serviceYears = _valueObj?.serviceYears // 服务时间
_formData.supplierCode = _valueObj?.supplierCode // 供应方 判断是否需要走审核流程 _formData.supplierCode = _valueObj?.supplierCode // 供应方 判断是否需要走审核流程
_formData.entityCardFlag = _valueObj?.entityCardFlag // 实体卡
} }
// 切换业务场景 将选中的上架门店清空 // 切换业务场景 将选中的上架门店清空
if (targetItem.name === 'sceneType') { if (targetItem.name === 'sceneType') {
......
...@@ -264,11 +264,12 @@ export default { ...@@ -264,11 +264,12 @@ export default {
thirdPartyCode: v?.thirdPartyCode, thirdPartyCode: v?.thirdPartyCode,
goodsType: val?.goodsInfo?.goodsType, goodsType: val?.goodsInfo?.goodsType,
position: v?.position, position: v?.position,
serviceItemNames: v?.upgradeGoodsServiceItemsList?.map(item => { return item.serviceName })?.join(','), serviceItemNames: v?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','),
upgradeCommodityCode: v?.commodityCode, upgradeCommodityCode: v?.commodityCode,
warrantyPeriod: v?.warrantyPeriod, warrantyPeriod: v?.warrantyPeriod,
serviceYears: v?.serviceYears, serviceYears: v?.serviceYears,
supplierCode:val?.goodsInfo?.supplierCode supplierCode: val?.goodsInfo?.supplierCode,
entityCardFlag: v?.entityCardFlag
} }
}) })
}) })
...@@ -327,7 +328,7 @@ export default { ...@@ -327,7 +328,7 @@ export default {
confNameValue: res?.upgradeGoodsName, confNameValue: res?.upgradeGoodsName,
confTypeNameValue: `(${res?.goodsTypeName} / ${res?.goodsName} / ${res?.upgradeCommodityCode})`, confTypeNameValue: `(${res?.goodsTypeName} / ${res?.goodsName} / ${res?.upgradeCommodityCode})`,
}] }]
res.serviceItemNames = res.upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => { return v.serviceName })?.join(',') // 服务项目 res.serviceItemNames = res.upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` })?.join(',') // 服务项目
res.merchantGoodsRefList = res.merchantGoodsRefList || [] // 上架门店 res.merchantGoodsRefList = res.merchantGoodsRefList || [] // 上架门店
this.editData = res || {} this.editData = res || {}
this.getSelectingList(defaultSelect) this.getSelectingList(defaultSelect)
......
...@@ -189,11 +189,12 @@ export default { ...@@ -189,11 +189,12 @@ export default {
res.purchasePrice = res.upgradeGoods?.purchasePrice res.purchasePrice = res.upgradeGoods?.purchasePrice
res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : '' res.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : ''
res.productType = productType res.productType = productType
res.serviceItemNames = res.upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => { return v.serviceName })?.join(',') res.serviceItemNames = res.upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` })?.join(',')
res.warrantyPeriod = res.upgradeGoods?.warrantyPeriod res.warrantyPeriod = res.upgradeGoods?.warrantyPeriod
res.serviceYears = res.upgradeGoods?.serviceYears res.serviceYears = res.upgradeGoods?.serviceYears
res.merchantGoodsRefList = res.merchantGoodsRefList || [] res.merchantGoodsRefList = res.merchantGoodsRefList || []
res.thirdPartyCode = res?.upgradeGoods?.thirdPartyCode || '' res.thirdPartyCode = res?.upgradeGoods?.thirdPartyCode || '',
res.entityCardFlag = res?.upgradeGoods?.entityCardFlag
this.editData = res || {} this.editData = res || {}
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<p class="car-sub-head"> <p class="car-sub-head">
商品{{ index + 1 }}-{{ item.upgradeGoodsName }} 商品{{ index + 1 }}-{{ item.upgradeGoodsName }}
</p> </p>
<div class="flex_box">
<el-form-item class="d2-drawer-item" <el-form-item class="d2-drawer-item"
label="编码:"> label="编码:">
<span>{{ item.type }}</span> <span>{{ item.type }}</span>
...@@ -71,15 +72,23 @@ ...@@ -71,15 +72,23 @@
<el-form-item <el-form-item
class="d2-drawer-item" class="d2-drawer-item"
v-if="equitySceneType.includes($$(commodityInfo.goodsInfo,'goodsType'))" v-if="equitySceneType.includes($$(commodityInfo.goodsInfo,'goodsType'))"
label="服务项目:"> label="服务时间:">
<span>{{ !filterEmpty(item.warrantyPeriod) ? (item.warrantyPeriod + '年') : '无' }}</span> <span>{{ !filterEmpty(item.serviceYears) ? (item.serviceYears + '年') : '无' }}</span>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="d2-drawer-item" class="d2-drawer-item"
v-if="equitySceneType.includes($$(commodityInfo.goodsInfo,'goodsType'))" v-if="equitySceneType.includes($$(commodityInfo.goodsInfo,'goodsType'))"
label="服务时间:"> label="实体卡:">
<span>{{ !filterEmpty(item.warrantyPeriod) ? (item.warrantyPeriod + '年') : '无' }}</span> <span>{{ item.entityCardFlag == 'Y' ? '是' : '否' }}</span>
</el-form-item> </el-form-item>
<el-form-item
class="d2-drawer-item"
v-if="equitySceneType.includes($$(commodityInfo.goodsInfo,'goodsType'))"
label="服务项目:">
<span>{{ !filterEmpty(item.serviceItemNames) ? item.serviceItemNames : '无' }}</span>
</el-form-item>
</div>
</el-form> </el-form>
</div> </div>
</div> </div>
...@@ -134,6 +143,7 @@ export default { ...@@ -134,6 +143,7 @@ export default {
res?.upgradeGoodsList?.forEach(item => { res?.upgradeGoodsList?.forEach(item => {
let positionNamesArr = item?.goodsInfo?.goodsType == 1 ? deepClone(positionTypeList).filter(val => item.position == val.position) : [] let positionNamesArr = item?.goodsInfo?.goodsType == 1 ? deepClone(positionTypeList).filter(val => item.position == val.position) : []
item.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : '' item.positionNames = positionNamesArr.length ? positionNamesArr[0]?.confName : ''
item.serviceItemNames = item?.upgradeGoodsServiceItemsList?.map(v => { return `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}` })?.join(',')
}) })
this.commodityInfo = res this.commodityInfo = res
}) })
...@@ -191,15 +201,25 @@ export default { ...@@ -191,15 +201,25 @@ export default {
padding: 16px 20px; padding: 16px 20px;
background: #F9F9F9; background: #F9F9F9;
margin: 0px 20px 16px; margin: 0px 20px 16px;
.flex_box{
display: flex;
flex-wrap: wrap;
.d2-drawer-item { .d2-drawer-item {
flex-shrink: 0;
width: 33%;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 14px; font-size: 14px;
display: flex;
color: #333333; color: #333333;
font-weight: 400; font-weight: 400;
width: 30%;
margin: 0 0 0 0; margin: 0 0 0 0;
.el-form-item__label{
flex-shrink: 0;
}
} }
} }
}
} }
} }
.child-drawer-block .child-drawer-block
......
...@@ -148,6 +148,11 @@ ...@@ -148,6 +148,11 @@
</el-popover> </el-popover>
</el-input> </el-input>
</td> </td>
<!-- 仅权益升级类目展示 -->
<td v-if="equitySceneType.includes(goodsInfoData.goodsType)">
<span class="color-red">*</span>
<span>实体卡</span>
</td>
<!-- 仅太阳膜 车衣 改色膜 展示 --> <!-- 仅太阳膜 车衣 改色膜 展示 -->
<td v-if="membraneTypeList.includes(goodsInfoData.goodsType)"> <td v-if="membraneTypeList.includes(goodsInfoData.goodsType)">
<span class="color-red">*</span> <span class="color-red">*</span>
...@@ -291,16 +296,19 @@ ...@@ -291,16 +296,19 @@
<el-select placeholder="服务项目" <el-select placeholder="服务项目"
size="small" size="small"
:class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty }" :class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty }"
style="width: 210px;" style="width: 100px;"
v-model="subItem.serviceItemArr" v-model="subItem.serviceItemArr"
multiple multiple
:ref="'serviceSelect' + subIndex"
collapse-tags collapse-tags
@change="changeServiceItems($event, subIndex)"> @focus="serviceSelectFocus($event, subIndex)"
<el-option label="全选" value="全选" @click.native='selectAll($event, subIndex)' v-if="productServiceItemList.length"></el-option> popper-class="service_select_class"
:popper-append-to-body="false">
<!-- <el-option label="全选" value="全选" @click.native='selectAll($event, subIndex)' v-if="productServiceItemList.length"></el-option>
<el-option v-for="childItem in productServiceItemList" <el-option v-for="childItem in productServiceItemList"
:key="childItem.serviceCode" :key="childItem.serviceCode"
:label="childItem.serviceName" :label="childItem.serviceName"
:value="childItem.serviceCode" /> :value="childItem.serviceCode" /> -->
<el-popover v-if="filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty" <el-popover v-if="filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty"
slot="suffix" slot="suffix"
placement="top" placement="top"
...@@ -334,6 +342,12 @@ ...@@ -334,6 +342,12 @@
</el-input> </el-input>
</div> </div>
</td> </td>
<!-- 仅权益升级类目展示 -->
<td v-if="equitySceneType.includes(goodsInfoData.goodsType)">
<el-switch
v-model="subItem.entityCardFlag">
</el-switch>
</td>
<td v-if="membraneTypeList.includes(goodsInfoData.goodsType)"> <td v-if="membraneTypeList.includes(goodsInfoData.goodsType)">
<div style="transform: translateX(6px);"> <div style="transform: translateX(6px);">
<el-input placeholder="质保年限/年" <el-input placeholder="质保年限/年"
...@@ -411,6 +425,38 @@ ...@@ -411,6 +425,38 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</d2-dialog> </d2-dialog>
<service-items-dialog v-if="serviceItemsVisible"
ref="formRelateService"
:relate-service-visible="serviceItemsVisible"
:service-api="getProductServiceItems"
:service-search-form="serviceItemsSearchForm"
:service-selected="serviceSelected"
:service-index="serviceSelectIndex"
@handleRelateServiceConfirm="handleRelateServiceConfirm"
@handleRelateServiceClose="handleRelateServiceClose">
<el-row slot>
<el-form
:model="serviceItemsSearchForm"
ref="relate"
:inline="true">
<el-form-item label="服务项目:">
<el-input
v-model.trim="serviceItemsSearchForm.serviceName"
placeholder="服务项目"
@keydown.native="handleServiceInput"
clearable />
</el-form-item>
<el-form-item label="等级:">
<el-input
v-model.trim="serviceItemsSearchForm.serviceGrade"
placeholder="等级"
@keydown.native="handleServiceInput"
clearable />
</el-form-item>
<el-button type="primary" @click="handleSearchService">搜索</el-button>
</el-form>
</el-row>
</service-items-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -419,8 +465,13 @@ import { deepClone } from '@/common/util' ...@@ -419,8 +465,13 @@ import { deepClone } from '@/common/util'
import { mapGetters, mapMutations } from 'vuex' import { mapGetters, mapMutations } from 'vuex'
import { positionTypeList, membraneTypeList } from '@/common/constants' import { positionTypeList, membraneTypeList } from '@/common/constants'
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import serviceItemsDialog from "./serviceItemsDialog.vue"
import { getProductServiceItems } from '@api/productManage'
export default { export default {
name: 'multipleSpecificationForm', name: 'multipleSpecificationForm',
components: {
serviceItemsDialog
},
data() { data() {
return { return {
equitySceneType: baseConfig.equitySceneType || [], equitySceneType: baseConfig.equitySceneType || [],
...@@ -465,6 +516,14 @@ export default { ...@@ -465,6 +516,14 @@ export default {
membraneTypeList, membraneTypeList,
tableWidth: 0, tableWidth: 0,
tableColNum: 0, tableColNum: 0,
serviceItemsVisible: false,
serviceItemsSearchForm: {
serviceName: '',
serviceGrade: ''
},
getProductServiceItems,
serviceSelected: [],
serviceSelectIndex: null
} }
}, },
props: { props: {
...@@ -475,8 +534,9 @@ export default { ...@@ -475,8 +534,9 @@ export default {
}, },
mounted() { mounted() {
const priceArr = [] const priceArr = []
this.goodsInfoData?.goodsSpecificationList.forEach(item => { this.goodsInfoData?.goodsSpecificationList.forEach((item, index) => {
if (item.upgradePrice) priceArr.push(Number(item.upgradePrice)) if (item.upgradePrice) priceArr.push(Number(item.upgradePrice))
this.filterService(item, index)
}) })
this.minPrice = priceArr.length ? Math.min(...priceArr) : 0 this.minPrice = priceArr.length ? Math.min(...priceArr) : 0
this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0 this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0
...@@ -486,8 +546,9 @@ export default { ...@@ -486,8 +546,9 @@ export default {
'goodsInfoData.goodsSpecificationList': { 'goodsInfoData.goodsSpecificationList': {
handler(newValue) { handler(newValue) {
const priceArr = [] const priceArr = []
newValue.forEach(item => { newValue.forEach((item, index) => {
if (item.upgradePrice) priceArr.push(Number(item.upgradePrice)) if (item.upgradePrice) priceArr.push(Number(item.upgradePrice))
this.filterService(item, index)
}) })
this.minPrice = priceArr.length ? Math.min(...priceArr) : 0 this.minPrice = priceArr.length ? Math.min(...priceArr) : 0
this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0 this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0
...@@ -537,6 +598,58 @@ export default { ...@@ -537,6 +598,58 @@ export default {
}, },
methods: { methods: {
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']), ...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
// 处理显示服务项目数量
filterService(item, index) {
this.$nextTick(() => {
let selectRefs = this.$refs['serviceSelect' + index] && this.$refs['serviceSelect' + index][0]
if (item?.serviceItemArr?.length) {
if (item?.serviceItemArr?.length > 1) {
let tagSpan = selectRefs?.$el.querySelector(
`.el-select__tags > span>span:nth-child(1)`
)
let numSpan = selectRefs?.$el.querySelector(
`.el-select__tags > span>span:nth-child(2)`
)
setTimeout(()=>{
if (tagSpan && numSpan) {
tagSpan.style.display = "none"
numSpan.style.display = 'inline-block'
numSpan.innerHTML = `+${item?.serviceItemArr?.length}`
}
},60)//延迟执行(否则获取不到dom)
} else {
let tagSpan = selectRefs?.$el?.querySelector(
`.el-select__tags > span>span:nth-child(1)`
)
setTimeout(()=>{
if(tagSpan) tagSpan.innerHTML = `+${item?.serviceItemArr?.length}`
},60)//延迟执行(否则获取不到dom)
}
}
})
},
serviceSelectFocus(e, index) {
this.serviceSelected = this.goodsInfoData.goodsSpecificationList[index]?.serviceItemArr
this.serviceSelectIndex = index
this.serviceItemsVisible = true
},
handleRelateServiceConfirm(data) {
let index = this.serviceSelectIndex
this.$set(this.goodsInfoData.goodsSpecificationList[index], 'serviceItemArr', data)
this.serviceSelectIndex = null
this.serviceSelected = []
this.serviceItemsVisible = false
},
handleRelateServiceClose() {
this.serviceItemsVisible = false
},
handleServiceInput(e) {
(e.keyCode === 13) && this.handleSearchStore()
},
// 门店搜索
handleSearchService() {
this.$refs.formRelateService.handleCurrentChange(1)
},
computedTableWidth(newVal, num) { computedTableWidth(newVal, num) {
let shoppingMallFlag = this.filterEmpty(num) ? num : this.goodsInfoData.shoppingMallFlag let shoppingMallFlag = this.filterEmpty(num) ? num : this.goodsInfoData.shoppingMallFlag
let tableColNum = this.tableColNum let tableColNum = this.tableColNum
...@@ -718,6 +831,7 @@ export default { ...@@ -718,6 +831,7 @@ export default {
editGoodNameInput: false, editGoodNameInput: false,
serviceItemArr: [], serviceItemArr: [],
serviceYears: '', serviceYears: '',
entityCardFlag: false
}) })
} else { } else {
var targetValLen = this.goodsInfoData.specificationDetailList[i]?.specificationValueList?.length var targetValLen = this.goodsInfoData.specificationDetailList[i]?.specificationValueList?.length
...@@ -767,6 +881,7 @@ export default { ...@@ -767,6 +881,7 @@ export default {
item.warrantyPeriod = temp.warrantyPeriod || '5' item.warrantyPeriod = temp.warrantyPeriod || '5'
item.serviceItemArr = temp.upgradeGoodsServiceItemsList?.map(v => { return v.serviceCode }), item.serviceItemArr = temp.upgradeGoodsServiceItemsList?.map(v => { return v.serviceCode }),
item.serviceYears = temp.serviceYears item.serviceYears = temp.serviceYears
item.entityCardFlag = temp.entityCardFlag
break break
} }
} }
...@@ -888,20 +1003,20 @@ export default { ...@@ -888,20 +1003,20 @@ export default {
} }
}, },
// 选择服务项目 // 选择服务项目
changeServiceItems(e, index) { // changeServiceItems(e, index) {
this.$set(this.goodsInfoData.goodsSpecificationList[index], 'serviceItemArr', e) // this.$set(this.goodsInfoData.goodsSpecificationList[index], 'serviceItemArr', e)
}, // },
// 全选服务项目 // 全选服务项目
selectAll(e, index) { // selectAll(e, index) {
if (this.goodsInfoData.goodsSpecificationList[index].serviceItemArr.length < (deepClone(this.productServiceItemList).length) + 1) { // if (this.goodsInfoData.goodsSpecificationList[index].serviceItemArr.length < (deepClone(this.productServiceItemList).length) + 1) {
this.goodsInfoData.goodsSpecificationList[index].serviceItemArr = deepClone(this.productServiceItemList).map(item=>{ // this.goodsInfoData.goodsSpecificationList[index].serviceItemArr = deepClone(this.productServiceItemList).map(item=>{
return item.serviceCode // return item.serviceCode
}) // })
} else { // } else {
this.goodsInfoData.goodsSpecificationList[index].serviceItemArr = [] // this.goodsInfoData.goodsSpecificationList[index].serviceItemArr = []
} // }
this.$emit('update:updateMultipleSelect', this.selectedArr) // this.$emit('update:updateMultipleSelect', this.selectedArr)
}, // },
// 选择部位 // 选择部位
changePosition(e, index) { changePosition(e, index) {
this.$set(this.goodsInfoData.goodsSpecificationList[index], 'position', e) this.$set(this.goodsInfoData.goodsSpecificationList[index], 'position', e)
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
</div> </div>
</div> </div>
<!-- 2.0场景 服务项目字段 --> <!-- 2.0场景 服务项目字段 -->
<div v-if="equitySceneType.includes(formData['goodsType'])"> <!-- <div v-if="equitySceneType.includes(formData['goodsType'])">
<el-form-item prop="serviceItems" <el-form-item prop="serviceItems"
label="包含服务项目" label="包含服务项目"
id="serviceItems" id="serviceItems"
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</el-input> </el-input>
</div> </div>
</el-form-item> </el-form-item>
</div> </div> -->
</div> </div>
<div> <div>
<div v-for="(item, index) in i.formBlock" :key="index" style="position: relative;"> <div v-for="(item, index) in i.formBlock" :key="index" style="position: relative;">
...@@ -499,7 +499,7 @@ export default { ...@@ -499,7 +499,7 @@ export default {
}, },
selectedPositionIds: [], selectedPositionIds: [],
membraneTypeList: membraneTypeList, membraneTypeList: membraneTypeList,
productServiceItemList: [] // productServiceItemList: []
} }
}, },
...@@ -587,7 +587,7 @@ export default { ...@@ -587,7 +587,7 @@ export default {
} else if (this.formData.goodsType == 12 || this.formData.goodsType == 14 || this.formData.goodsType == 4 || this.formData.goodsType == 6) { } else if (this.formData.goodsType == 12 || this.formData.goodsType == 14 || this.formData.goodsType == 4 || this.formData.goodsType == 6) {
this.membranesFormBlock = [copyMembranesFormBlock[1]] this.membranesFormBlock = [copyMembranesFormBlock[1]]
} }
this.getProductServiceItemList() // this.getProductServiceItemList()
}, },
methods: { methods: {
...@@ -595,9 +595,9 @@ export default { ...@@ -595,9 +595,9 @@ export default {
get: 'd2admin/base/get' get: 'd2admin/base/get'
}), }),
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']), ...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
async getProductServiceItemList() { // async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList) // this.productServiceItemList = await this.get(BaseData.productServiceItemList)
}, // },
selectBlur() { selectBlur() {
this.editOptionIndex = -1 this.editOptionIndex = -1
this.showOptionInput = false this.showOptionInput = false
...@@ -809,7 +809,7 @@ export default { ...@@ -809,7 +809,7 @@ export default {
this.$refs[this.formRef + 'd2FormRuleForm'].validate((valid, options) => { this.$refs[this.formRef + 'd2FormRuleForm'].validate((valid, options) => {
if (valid) { if (valid) {
// 会员权益 类目 // 会员权益 类目
if (this.equitySceneType.includes(this.formData.goodsType)) this.formData.productServiceItemList = this.productServiceItemList // if (this.equitySceneType.includes(this.formData.goodsType)) this.formData.productServiceItemList = this.productServiceItemList
this.formData.goodsPositionList = this.filterPosiotion() this.formData.goodsPositionList = this.filterPosiotion()
let brandOptionList = this.formList[0].formBlock[this.formList[0].formBlock.findIndex(val => val.name == 'brandMerchantCode')].optionList || [] let brandOptionList = this.formList[0].formBlock[this.formList[0].formBlock.findIndex(val => val.name == 'brandMerchantCode')].optionList || []
let supplierOptionList = this.formList[0].formBlock[this.formList[0].formBlock.findIndex(val => val.name == 'supplierCode')].optionList || [] let supplierOptionList = this.formList[0].formBlock[this.formList[0].formBlock.findIndex(val => val.name == 'supplierCode')].optionList || []
......
<!-- 关联门店弹窗 -->
<template>
<d2-dialog title="选择服务项目"
:is-visible.sync="relateServiceVisible"
width="70%"
btn-ok-label="确定"
@confirmDialog="handleRelateServiceConfirm"
@closeDialog="handleRelateServiceClose"
class="relateService">
<slot />
<el-row class="tableCon">
<div class="tableBox">
<el-table ref="seletingTable"
:data="selectingData"
height="464px"
class="table"
border
@select="handleChange">
<el-table-column type="selection"
:selectable="selectable"
width="55"
align="center" />
<el-table-column
width="55"
label="序号"
type="index"
align="center" />
<el-table-column
prop="serviceName"
label="服务项目"
:show-overflow-tooltip="true"
width="190"
align="center">
</el-table-column>
<el-table-column prop="serviceGrade"
label="等级"
align="center">
</el-table-column>
<el-table-column prop="servicePeriod"
label="年限"
align="center">
</el-table-column>
<el-table-column prop="standardSalesCost"
label="销售成本/元"
width="140"
align="center">
</el-table-column>
<el-table-column prop="serviceContent"
width="210"
:show-overflow-tooltip="true"
label="描述"
align="center">
</el-table-column>
</el-table>
<el-pagination small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total" />
</div>
<div class="selectedBox">
<div class="title">
<div class="title_txt">已选</div>
<div class="title_btn" @click="clearSelect">清空</div>
</div>
<div class="content">
<div class="item" v-for="(subItem, subIdx) in selectedData" :key="subIdx">
<div class="item_txt"><span>{{ subItem.uniqueValue }}</span></div>
<div class="del_item" @click="delItem(subItem)"><i class="el-icon-error"></i></div>
</div>
</div>
</div>
</el-row>
</d2-dialog>
</template>
<script>
import { deepClone } from '@/common/util'
export default {
name: 'RelateServiceDialog',
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
currentPage: 1,
pageSize: 20
}
},
props: {
relateServiceVisible: {
type: Boolean,
default: false
},
serviceApi: {
type: Function,
default: () => { }
},
serviceSelected: {
type: Array,
default: () => []
},
serviceSearchForm: {
type: Object,
default: () => { }
}
},
mounted() {
this.selectedData = deepClone(this.serviceSelected)
this.getSelectingList()
},
methods: {
selectable(row) {
let { selectedData } = this
// 每个服务项目code只能选中一个 按等级和年限区分
if (selectedData.filter(v => v.uniqueValue == row.uniqueValue).length) {
return true
} else if (selectedData.filter(v => v.serviceCode == row.serviceCode).length) {
return false
} else {
return true
}
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.uniqueValue)
this.selectingData.forEach(item => {
console.log(exitIds)
exitIds.includes(item.uniqueValue) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.serviceApi({
...this.serviceSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize,
}).then(res => {
res?.list?.forEach(val => {
val.uniqueValue = `${val.serviceName}-${val.serviceGrade}/${val.servicePeriod}`
})
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
console.log(row, selection)
var addOrDelete = !!selection.find(item => item.uniqueValue === row.uniqueValue)
console.log(addOrDelete)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(item => item.uniqueValue !== row.uniqueValue))
},
handleAll(selection) {
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.serviceCode === item.serviceCode)
if (selection.length && (isExit === -1)) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
clearSelect() {
this.selectedData = []
this.$refs.seletingTable.clearSelection()
},
delItem(row) {
this.selectedData = this.selectedData.filter(item => item.uniqueValue !== row.uniqueValue)
const obj = this.selectingData.find(v => v.uniqueValue == row.uniqueValue)
if (obj) this.$refs.seletingTable.toggleRowSelection(obj)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateServiceConfirm() {
this.$emit('handleRelateServiceConfirm', this.selectedData)
},
handleRelateServiceClose() {
this.$emit('handleRelateServiceClose')
}
}
}
</script>
<style lang="scss" scoped>
.relateService .table {
margin: 0 auto 20px !important;
width: 100%;
}
.relateService .tableCon {
margin-top: 20px;
display: flex;
.tableBox {
flex: 2;
}
.selectedBox{
flex: 1;
height: 462px;
border: 1px solid #E5E5E5;
margin-left: 10px;
.title{
height: 38px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 8px 0 16px;
border-bottom: 1px solid #E5E5E5;
.title_txt{
font-size: 16px;
font-weight: 600;
color: #333333;
}
.title_btn{
cursor: pointer;
font-size: 14px;
color: #185EFE;
}
}
.content{
padding: 16px 10px;
height: calc(100% - 75px);
overflow-y: scroll;
.item{
display: flex;
align-items: center;
justify-content: space-between;
height: 32px;
color: #666666;
padding: 0 8px;
.del_item{
cursor: pointer;
}
}
.item:hover{
background: #F6F9FF;
}
}
}
}
.service-service .relateService .el-table .cell,
.d2-form .relateService .el-table .cell {
line-height: 26px !important;
}
.service-service .relateService .el-table--medium td,
.d2-form .relateService .el-table--medium td {
padding: 6px 8px !important;
}
.relateService .red {
color: red;
}
.relateService .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
::v-deep .el-table__header-wrapper .has-gutter .el-checkbox{
display: none;
}
</style>
...@@ -50,6 +50,11 @@ ...@@ -50,6 +50,11 @@
<span class="color-red">*</span> <span class="color-red">*</span>
<span>服务时间/年</span> <span>服务时间/年</span>
</td> </td>
<!-- 仅权益升级类目展示 -->
<td v-if="equitySceneType.includes(goodsInfoData.goodsType)">
<span class="color-red">*</span>
<span>实体卡</span>
</td>
<!-- 仅太阳膜 车衣 改色膜 展示 --> <!-- 仅太阳膜 车衣 改色膜 展示 -->
<td v-if="membraneTypeList.includes(goodsInfoData.goodsType)"> <td v-if="membraneTypeList.includes(goodsInfoData.goodsType)">
<span class="color-red">*</span> <span class="color-red">*</span>
...@@ -188,17 +193,19 @@ ...@@ -188,17 +193,19 @@
<el-select placeholder="服务项目" <el-select placeholder="服务项目"
size="small" size="small"
:class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty }" :class="{ 'w-150-per': true, 'border-red': filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty }"
style="width: 210px;transform: translateX(0);" style="width: 100px;transform: translateX(0);"
v-model="subItem.serviceItemArr" v-model="subItem.serviceItemArr"
multiple multiple
ref="serviceSelect" :ref="'serviceSelect' + subIndex"
collapse-tags collapse-tags
@change="changeServiceItems($event, subIndex)"> @focus="serviceSelectFocus($event, subIndex)"
<el-option label="全选" value="全选" @click.native='selectAll($event, subIndex)' v-if="productServiceItemList.length"></el-option> popper-class="service_select_class"
:popper-append-to-body="false">
<!-- <el-option label="全选" value="全选" @click.native='selectAll($event, subIndex)' v-if="productServiceItemList.length"></el-option>
<el-option v-for="childItem in productServiceItemList" <el-option v-for="childItem in productServiceItemList"
:key="childItem.serviceCode" :key="childItem.serviceCode"
:label="childItem.serviceName" :label="childItem.serviceName"
:value="childItem.serviceCode" /> :value="childItem.serviceCode" /> -->
<el-popover v-if="filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty" <el-popover v-if="filterEmpty(subItem.serviceItemArr) && subItem.serviceItemArrEmpty"
slot="suffix" slot="suffix"
placement="top" placement="top"
...@@ -232,6 +239,12 @@ ...@@ -232,6 +239,12 @@
</el-input> </el-input>
</div> </div>
</td> </td>
<!-- 仅权益升级类目展示 -->
<td v-if="equitySceneType.includes(goodsInfoData.goodsType)">
<el-switch
v-model="subItem.entityCardFlag">
</el-switch>
</td>
<td v-if="membraneTypeList.includes(goodsInfoData.goodsType)"> <td v-if="membraneTypeList.includes(goodsInfoData.goodsType)">
<div style="transform: translateX(10px);"> <div style="transform: translateX(10px);">
<el-input <el-input
...@@ -267,6 +280,38 @@ ...@@ -267,6 +280,38 @@
class="tip-text">¥{{ minPrice }}~{{ maxPrice }}</span> class="tip-text">¥{{ minPrice }}~{{ maxPrice }}</span>
</div> </div>
</div> </div>
<service-items-dialog v-if="serviceItemsVisible"
ref="formRelateService"
:relate-service-visible="serviceItemsVisible"
:service-api="getProductServiceItems"
:service-search-form="serviceItemsSearchForm"
:service-selected="serviceSelected"
:service-index="serviceSelectIndex"
@handleRelateServiceConfirm="handleRelateServiceConfirm"
@handleRelateServiceClose="handleRelateServiceClose">
<el-row slot>
<el-form
:model="serviceItemsSearchForm"
ref="relate"
:inline="true">
<el-form-item label="服务项目:">
<el-input
v-model.trim="serviceItemsSearchForm.serviceName"
placeholder="服务项目"
@keydown.native="handleServiceInput"
clearable />
</el-form-item>
<el-form-item label="等级:">
<el-input
v-model.trim="serviceItemsSearchForm.serviceGrade"
placeholder="等级"
@keydown.native="handleServiceInput"
clearable />
</el-form-item>
<el-button type="primary" @click="handleSearchService">搜索</el-button>
</el-form>
</el-row>
</service-items-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -275,8 +320,13 @@ import { mapGetters, mapMutations } from 'vuex' ...@@ -275,8 +320,13 @@ import { mapGetters, mapMutations } from 'vuex'
import { positionTypeList, membraneTypeList } from '@/common/constants' import { positionTypeList, membraneTypeList } from '@/common/constants'
import { deepClone } from "@/common/util" import { deepClone } from "@/common/util"
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import serviceItemsDialog from "./serviceItemsDialog.vue"
import { getProductServiceItems } from '@api/productManage'
export default { export default {
name: 'singleSpecificationForm', name: 'singleSpecificationForm',
components: {
serviceItemsDialog
},
data() { data() {
return { return {
equitySceneType: baseConfig.equitySceneType || [], equitySceneType: baseConfig.equitySceneType || [],
...@@ -289,7 +339,15 @@ export default { ...@@ -289,7 +339,15 @@ export default {
productPositionTypeList: [], productPositionTypeList: [],
membraneTypeList, membraneTypeList,
tableColNum: 6, // 商品table默认展示列数(序号 操作栏除外) tableColNum: 6, // 商品table默认展示列数(序号 操作栏除外)
tableWidth: 1420 tableWidth: 1420,
serviceItemsVisible: false,
serviceItemsSearchForm: {
serviceName: '',
serviceGrade: ''
},
getProductServiceItems,
serviceSelected: [],
serviceSelectIndex: null
} }
}, },
props: { props: {
...@@ -302,8 +360,9 @@ export default { ...@@ -302,8 +360,9 @@ export default {
'goodsInfoData.goodsSpecificationSingleList': { 'goodsInfoData.goodsSpecificationSingleList': {
handler(newValue) { handler(newValue) {
const priceArr = [] const priceArr = []
newValue.forEach(item => { newValue.forEach((item, index) => {
if (item.upgradePrice) priceArr.push(Number(item.upgradePrice)) if (item.upgradePrice) priceArr.push(Number(item.upgradePrice))
this.filterService(item, index)
}) })
this.minPrice = priceArr.length ? Math.min(...priceArr) : 0 this.minPrice = priceArr.length ? Math.min(...priceArr) : 0
this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0 this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0
...@@ -335,14 +394,67 @@ export default { ...@@ -335,14 +394,67 @@ export default {
}, },
mounted() { mounted() {
const priceArr = [] const priceArr = []
this.goodsInfoData?.goodsSpecificationSingleList.forEach(item => { this.goodsInfoData?.goodsSpecificationSingleList.forEach((item, index) => {
if (item.upgradePrice) priceArr.push(Number(item.upgradePrice)) if (item.upgradePrice) priceArr.push(Number(item.upgradePrice))
this.filterService(item, index)
}) })
this.minPrice = priceArr.length ? Math.min(...priceArr) : 0 this.minPrice = priceArr.length ? Math.min(...priceArr) : 0
this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0 this.maxPrice = priceArr.length ? Math.max(...priceArr) : 0
}, },
methods: { methods: {
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']), ...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
// 处理显示服务项目数量
filterService(item, index) {
this.$nextTick(() => {
let selectRefs = this.$refs['serviceSelect' + index] && this.$refs['serviceSelect' + index][0]
if (item?.serviceItemArr?.length) {
if (item?.serviceItemArr?.length > 1) {
let tagSpan = selectRefs?.$el.querySelector(
`.el-select__tags > span>span:nth-child(1)`
)
let numSpan = selectRefs?.$el.querySelector(
`.el-select__tags > span>span:nth-child(2)`
)
setTimeout(()=>{
if (tagSpan && numSpan) {
tagSpan.style.display = "none"
numSpan.style.display = 'inline-block'
numSpan.innerHTML = `+${item?.serviceItemArr?.length}`
}
},60)//延迟执行(否则获取不到dom)
} else {
let tagSpan = selectRefs?.$el?.querySelector(
`.el-select__tags > span>span:nth-child(1)`
)
setTimeout(()=>{
if(tagSpan) tagSpan.innerHTML = `+${item?.serviceItemArr?.length}`
},60)//延迟执行(否则获取不到dom)
}
}
})
},
serviceSelectFocus(e, index) {
this.serviceSelected = this.goodsInfoData.goodsSpecificationSingleList[index]?.serviceItemArr
this.serviceSelectIndex = index
this.serviceItemsVisible = true
},
handleRelateServiceConfirm(data) {
let index = this.serviceSelectIndex
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceItemArr', data)
this.serviceSelectIndex = null
this.serviceSelected = []
this.serviceItemsVisible = false
},
handleRelateServiceClose() {
this.serviceItemsVisible = false
},
handleServiceInput(e) {
(e.keyCode === 13) && this.handleSearchStore()
},
// 门店搜索
handleSearchService() {
this.$refs.formRelateService.handleCurrentChange(1)
},
computedTableWidth(newVal, num) { computedTableWidth(newVal, num) {
let shoppingMallFlag = this.filterEmpty(num) ? num : this.goodsInfoData.shoppingMallFlag let shoppingMallFlag = this.filterEmpty(num) ? num : this.goodsInfoData.shoppingMallFlag
let tableColNum = this.tableColNum let tableColNum = this.tableColNum
...@@ -385,6 +497,7 @@ export default { ...@@ -385,6 +497,7 @@ export default {
serviceItemArr: [], serviceItemArr: [],
serviceYears: '', serviceYears: '',
warrantyPeriod: '5', warrantyPeriod: '5',
entityCardFlag: false,
editGoodNameInput: true editGoodNameInput: true
}) })
this.goodsInfoData.specificationSingleDetailList[0]?.specificationValueList.push({ this.goodsInfoData.specificationSingleDetailList[0]?.specificationValueList.push({
...@@ -435,20 +548,20 @@ export default { ...@@ -435,20 +548,20 @@ export default {
} }
}, },
// 选择服务项目 // 选择服务项目
changeServiceItems(e, index) { // changeServiceItems(e, index) {
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceItemArr', e) // this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'serviceItemArr', e)
}, // },
// 全选服务项目 // 全选服务项目
selectAll(e, index) { // selectAll(e, index) {
if (this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr.length < (deepClone(this.productServiceItemList).length) + 1) { // if (this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr.length < (deepClone(this.productServiceItemList).length) + 1) {
this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr = deepClone(this.productServiceItemList).map(item=>{ // this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr = deepClone(this.productServiceItemList).map(item=>{
return item.serviceCode // return item.serviceCode
}) // })
} else { // } else {
this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr = [] // this.goodsInfoData.goodsSpecificationSingleList[index].serviceItemArr = []
} // }
this.$emit('update:updateMultipleSelect', this.selectedArr) // this.$emit('update:updateMultipleSelect', this.selectedArr)
}, // },
// 选择部位 // 选择部位
changePosition(e, index) { changePosition(e, index) {
this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'position', e) this.$set(this.goodsInfoData.goodsSpecificationSingleList[index], 'position', e)
......
...@@ -100,7 +100,6 @@ export default { ...@@ -100,7 +100,6 @@ export default {
this.show = true this.show = true
}) })
} }
this.getProductServiceItemList()
}, },
computed: { computed: {
...mapGetters('goodsInfoData', { goodsInfoData: 'getGoodsInfoData' }) ...mapGetters('goodsInfoData', { goodsInfoData: 'getGoodsInfoData' })
...@@ -111,14 +110,14 @@ export default { ...@@ -111,14 +110,14 @@ export default {
}), }),
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']), ...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
...mapActions({ close: 'd2admin/page/close' }), ...mapActions({ close: 'd2admin/page/close' }),
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
getGoodsInfo(id) { getGoodsInfo(id) {
getGoodsInfoById({ id: id }).then(res => { getGoodsInfoById({ id: id }).then(res => {
let specificationDetailList = [] let specificationDetailList = []
let objData = {} let objData = {}
this.copyUpgradeGoodsList = deepClone(res.upgradeGoodsList).map(val => { this.copyUpgradeGoodsList = deepClone(res.upgradeGoodsList).map(val => {
val?.upgradeGoodsServiceItemsList?.forEach(v => {
v.uniqueValue = `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}`
})
return { return {
id: val.id, id: val.id,
position: val.position, position: val.position,
...@@ -132,8 +131,9 @@ export default { ...@@ -132,8 +131,9 @@ export default {
warningValueMax: val.warningValueMax, warningValueMax: val.warningValueMax,
warrantyPeriod: val.warrantyPeriod, warrantyPeriod: val.warrantyPeriod,
editGoodNameInput: false, editGoodNameInput: false,
serviceItemArr: val.upgradeGoodsServiceItemsList?.map(v => { return v.serviceCode }) || [], serviceItemArr: val.upgradeGoodsServiceItemsList || [],
serviceYears: val.serviceYears serviceYears: val.serviceYears,
entityCardFlag: val.entityCardFlag == 'Y'
} }
}) })
res.goodsInfo.goodsSource = 0 res.goodsInfo.goodsSource = 0
...@@ -214,6 +214,17 @@ export default { ...@@ -214,6 +214,17 @@ export default {
}) })
let arr = [] let arr = []
data.goodsSpecificationSingleList.forEach(item => { data.goodsSpecificationSingleList.forEach(item => {
let serviceArr = []
item.serviceItemArr.forEach(val => {
serviceArr.push({
gradeId: val.gradeId,
serviceCode: val.serviceCode,
serviceName: val.serviceName,
serviceGrade: val.serviceGrade,
servicePeriod: val.servicePeriod,
standardSalesCost: val.standardSalesCost
})
})
arr.push({ arr.push({
baseGoodsId: data.baseGoodsId, baseGoodsId: data.baseGoodsId,
goodsCode: data.goodsCode, goodsCode: data.goodsCode,
...@@ -228,8 +239,9 @@ export default { ...@@ -228,8 +239,9 @@ export default {
purchasePrice: data?.shoppingMallFlag == 1 ? item.purchasePrice : '', // 采购价 仅上架至采购商城 purchasePrice: data?.shoppingMallFlag == 1 ? item.purchasePrice : '', // 采购价 仅上架至采购商城
warningValue: item.warningValue, warningValue: item.warningValue,
warningValueMax: item.warningValueMax, warningValueMax: item.warningValueMax,
upgradeGoodsServiceItemsList: this.equitySceneType.includes(productFormData?.goodsType) ? deepClone(this.productServiceItemList).filter(v => item.serviceItemArr.includes(v.serviceCode)) : [], // 服务项目 仅权益类木 upgradeGoodsServiceItemsList: this.equitySceneType.includes(productFormData?.goodsType) ? serviceArr : [], // 服务项目 仅权益类木
serviceYears: this.equitySceneType.includes(productFormData?.goodsType) ? item.serviceYears : '' // 服务时间 仅权益类目 serviceYears: this.equitySceneType.includes(productFormData?.goodsType) ? item.serviceYears : '', // 服务时间 仅权益类目
entityCardFlag: this.equitySceneType.includes(productFormData?.goodsType) ? (item.entityCardFlag ? 'Y' : 'N') : '' // 是否实体卡
}) })
}) })
goodsSpecificationList = arr goodsSpecificationList = arr
...@@ -256,6 +268,17 @@ export default { ...@@ -256,6 +268,17 @@ export default {
} }
specificationData = specificationData + subItem specificationData = specificationData + subItem
}) })
let serviceArr = []
item.serviceItemArr.forEach(val => {
serviceArr.push({
gradeId: val.gradeId,
serviceCode: val.serviceCode,
serviceName: val.serviceName,
serviceGrade: val.serviceGrade,
servicePeriod: val.servicePeriod,
standardSalesCost: val.standardSalesCost
})
})
goodsSpecificationList.push({ goodsSpecificationList.push({
baseGoodsId: data.baseGoodsId, baseGoodsId: data.baseGoodsId,
goodsCode: data.goodsCode, goodsCode: data.goodsCode,
...@@ -269,8 +292,9 @@ export default { ...@@ -269,8 +292,9 @@ export default {
purchasePrice: data?.shoppingMallFlag == 1 ? item.purchasePrice : '', // 采购价 仅上架至采购商城 purchasePrice: data?.shoppingMallFlag == 1 ? item.purchasePrice : '', // 采购价 仅上架至采购商城
warningValue: item.warningValue, warningValue: item.warningValue,
warningValueMax: item.warningValueMax, warningValueMax: item.warningValueMax,
upgradeGoodsServiceItemsList: this.equitySceneType.includes(productFormData?.goodsType) ? deepClone(this.productServiceItemList).filter(v => item.serviceItemArr.includes(v.serviceCode)) : [], // 服务项目 仅权益类木 upgradeGoodsServiceItemsList: this.equitySceneType.includes(productFormData?.goodsType) ? serviceArr : [], // 服务项目 仅权益类木
serviceYears: this.equitySceneType.includes(productFormData?.goodsType) ? item.serviceYears : '' // 服务时间 仅权益类目 serviceYears: this.equitySceneType.includes(productFormData?.goodsType) ? item.serviceYears : '', // 服务时间 仅权益类目
entityCardFlag: this.equitySceneType.includes(productFormData?.goodsType) ? (item.entityCardFlag ? 'Y' : 'N') : '' // 是否实体卡
}) })
}) })
} }
...@@ -291,6 +315,7 @@ export default { ...@@ -291,6 +315,7 @@ export default {
}, },
saveDraft: flag !== 1 // flag 1提交 2存草稿 saveDraft: flag !== 1 // flag 1提交 2存草稿
} }
console.log(params)
if (params?.upgradeGoods?.goodsSpecificationList?.length > 75) { if (params?.upgradeGoods?.goodsSpecificationList?.length > 75) {
return this.$message({ return this.$message({
type: 'warning', type: 'warning',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!