Commit 4ff8630b by zhangxw

商品改版 场景入口配置联调

1 parent e894ded3
......@@ -72,3 +72,15 @@ export function serviceMerchantRelateQrcode(data) {
data.method = `dj.api.smartcarlife.serviceMerchant.relate.qrcode`
return request(data, 'post')
}
// 获取园区店配置的场景入口
export function getYqMerchantSceneConfigAPI(data) {
data.method = `dj.api.smartcarlife.select.openScene.info`
return request(data, 'post')
}
// 配置园区店场景入口
export function settingYqMerchantSceneAPI(data) {
data.method = `dj.api.smartcarlife.update.openScene.info`
return request(data, 'post')
}
......@@ -90,3 +90,9 @@ export function queryFeeCategoryByType(data) {
data.method = `${path}smartcarlife.feeCategory.queryFeeCategoryByType`
return request(data, RequestMethods.POST)
}
// 2.0场景 素材可选的服务项目
export function getProductServiceItems(data) {
data.method = `dj.api.smartcarlife.vd.item.list.single`
return request(data)
}
......@@ -11,7 +11,8 @@ export const TYPE_NAME = "confType"
*/
export const BaseData = {
channelType: "channelType",
productType: "productType"
productType: "productType",
productServiceItemList: "productServiceItemList"
}
/**
......
......@@ -5,7 +5,7 @@
* @Last Modified time: 2020-11-15 10:22:06
*/
import { getChannelType, getProductType } from "@/api/sys.base"
import { getChannelType, getProductType, getProductServiceItems } from "@/api/sys.base"
// import {
// BaseData
// } from '@/common/constants'
......@@ -19,7 +19,9 @@ export default {
// 渠道类型
channelType: [],
// 产品分类
productType: []
productType: [],
// 2.0场景素材可选服务项目
productServiceItemList: []
},
actions: {
/**
......@@ -29,10 +31,19 @@ export default {
*/
init({ state, dispatch, commit }) {
return new Promise(async (resolve) => {
Promise.all([getChannelType({}), getProductType({})]).then(
async ([channelType, productType]) => {
Promise.all([getChannelType({}), getProductType({}), getProductServiceItems({})]).then(
async ([channelType, productType, productServiceItemList]) => {
// 处理服务项目数据
let arr = []
productServiceItemList.forEach(val => {
arr.push({
serviceCode: val.serviceCode,
serviceName: val.serviceName
})
})
state.channelType = channelType
state.productType = productType
state.productServiceItemList = arr
// console.log(productType, "productType")
await dispatch("save2db", {
name: "",
......@@ -49,6 +60,7 @@ export default {
return new Promise(async (resolve) => {
state.channelType = []
state.productType = []
state.productServiceItemList = []
await dispatch("save2db", {
name: "",
value: state
......@@ -101,8 +113,8 @@ export default {
state =
(await dispatch("getFromdb", "base")) || (await dispatch("init"))
}
const { channelType, productType } = state
resolve({ channelType, productType })
const { channelType, productType, productServiceItemList } = state
resolve({ channelType, productType, productServiceItemList })
})
},
/**
......
......@@ -33,7 +33,8 @@ export default {
copyGoodsCode: '',
shoppingMallFlag: '0',
goodsSpecificationSingleList: [],
specificationSingleDetailList: []
specificationSingleDetailList: [],
selectedSceneCode: ''
}
},
mutations: {
......
......@@ -8,13 +8,15 @@
<el-tabs v-model="searchForm.sceneType">
<!-- <el-tab-pane label="1.0新车车损升级"
name="0" /> -->
<el-tab-pane label="1.1次新车精品升级"
<el-tab-pane :label="sceneList['1']"
name="1" />
<!-- <el-tab-pane label="1.2次新车膨胀金活动"
name="2" /> -->
<el-tab-pane v-if="!specialAccout"
label="1.3售后直播众筹活动"
:label="sceneList['3']"
name="3" />
<el-tab-pane :label="sceneList['0']"
name="0" />
</el-tabs>
<el-card class="finance_list_summary"
:body-style="{ padding: 0 }"
......@@ -517,7 +519,6 @@
<auth-button :data="scope" />
</template>
</el-table-column>
</el-table-column>
</el-table>
<el-pagination background
@size-change="handleSizeChange"
......@@ -549,6 +550,7 @@ import funnelOption from '../index/funnelOption'
import { getServiceStore, getParkStore } from '@api/editCustomer'
import { mapActions, mapState } from 'vuex'
import { baseConfig } from "@/main"
import { sceneList } from "@/common/constants"
import {
divisionTypeList,
payTypeList,
......@@ -774,8 +776,9 @@ export default {
sunmmaryVisible: true, // 顶部统计模块
sellerName_visible: true, // 列表字段:转化员
shopProfitType_visible: true, // 列表字段:流量方比例
yq_visible: true// 列表字段:园区店
yq_visible: true, // 列表字段:园区店
/** 根据场景控制页面显示隐藏end */
sceneList: sceneList
}
},
......@@ -1038,6 +1041,7 @@ export default {
// console.log(params)
// api[apiName](params).then(res => {
this.tableData = []
api.getList(params).then(res => {
let temp = 1
this.tableData = res.list.map((item, index) => {
......
......@@ -228,6 +228,24 @@
</el-form-item>
</div>
</div>
<!-- 2.0场景 服务项目字段 -->
<div v-if="formData['sceneType'] === 0">
<el-form-item prop="serviceItems"
label="包含服务项目"
id="serviceItems"
:label-width="'120px'"
class="dis-in-block"
:style="{'margin-bottom': '22px'}">
<div v-for="(subItem, subIndex) in productServiceItemList" :key="subIndex">
<el-input
v-model.trim="subItem.serviceName"
placeholder="服务项目"
style="width: 432px;margin-bottom: 15px;"
disabled>
</el-input>
</div>
</el-form-item>
</div>
</div>
<div>
<div v-for="(item, index) in i.formBlock" :key="index" style="position: relative;">
......@@ -416,7 +434,8 @@ import { uploadImg, uploadVideo } from '@/api/sys.base'
import { positionTypeList, applicableModelTypeList } from '@/common/constants'
import { limitPrice } from '@/common/format'
const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-info`
import { membraneTypeList } from '@/common/constants.js'
import { membraneTypeList, BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default {
name: 'productForm',
data() {
......@@ -468,7 +487,8 @@ export default {
priceReg: /^\d[\d\.]*$/
},
selectedPositionIds: [],
membraneTypeList: membraneTypeList
membraneTypeList: membraneTypeList,
productServiceItemList: []
}
},
......@@ -555,9 +575,16 @@ export default {
} else if (this.formData.goodsType == 12 || this.formData.goodsType == 14 || this.formData.goodsType == 4 || this.formData.goodsType == 6) {
this.membranesFormBlock = [copyMembranesFormBlock[1]]
}
this.getProductServiceItemList()
},
methods: {
...mapActions({
get: 'd2admin/base/get'
}),
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
selectBlur() {
this.editOptionIndex = -1
this.showOptionInput = false
......@@ -666,7 +693,8 @@ export default {
// 全选
selectAll(value, targetItem) {
if (targetItem.name == 'positionIds') {
if (this.formData.positionIds.length < deepClone(positionTypeList).length) {
// (deepClone(positionTypeList).length + 1) 会有个全选选项 需处理
if (this.formData.positionIds.length < (deepClone(positionTypeList).length + 1)) {
this.formData.positionIds = deepClone(positionTypeList).map(item=>{
return item.position
})
......@@ -780,6 +808,7 @@ export default {
deductionStandard: item.deductionStandard
})
}
if (this.formData.sceneType === 0) this.formData.productServiceItemList = this.productServiceItemList
this.formData.goodsPositionList = arr
this.$emit('handleAddConfirm', this.formData)
} else {
......
......@@ -47,15 +47,21 @@
:key="indx"
:src="val.content ? val.content : val">
<div style="width: 100%;">
<span class="message-item-span">
<span class="label">场景:</span>
{{ goodsInfoData.sceneName || '--' }}
</span>
<span class="message-item-span">
<span class="label">品牌:</span>
{{ goodsInfoData.brandMerchantName || '--' }}
</span>
<span class="message-item-span" v-if="goodsInfoData.goodsType == 1">
<div class="line-block">
<span class="message-item-span">
<span class="label">场景:</span>
{{ goodsInfoData.sceneName || '--' }}
</span>
<span class="message-item-span">
<span class="label">品牌:</span>
{{ goodsInfoData.brandMerchantName || '--' }}
</span>
<span class="message-item-span">
<span class="label">供应方:</span>
{{ goodsInfoData.supplierName || '--' }}
</span>
</div>
<span class="message-item-block" v-if="goodsInfoData.goodsType == 1">
<span class="label">适用车型:</span>
{{ goodsInfoData.applicableModelNames || '--' }}
</span>
......@@ -63,6 +69,10 @@
<span class="label">部位:</span>
{{ goodsInfoData.positionNames || '--' }}
</span>
<span class="message-item-block" v-if="goodsInfoData.selectedSceneCode == 0">
<span class="label">包含服务项目:</span>
<span>{{ goodsInfoData.serviceItems || '--' }}</span>
</span>
</div>
</div>
</el-form-item>
......@@ -75,8 +85,8 @@
<script>
import { deepClone } from '@/common/util'
import { getProductInfo } from '@/api/product'
import { positionTypeList, applicableModelTypeList } from '@/common/constants'
import { mapMutations, mapGetters } from 'vuex'
import { positionTypeList, applicableModelTypeList, BaseData } from '@/common/constants'
import { mapMutations, mapGetters, mapActions } from 'vuex'
export default {
name: 'sourceMaterial',
data() {
......@@ -95,8 +105,17 @@ export default {
computed: {
...mapGetters('goodsInfoData', { goodsInfoData: 'getGoodsInfoData' })
},
mounted() {
this.getProductServiceItemList()
},
methods: {
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
...mapActions({
get: 'd2admin/base/get'
}),
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
changeSelect(value) {
// 获取素材详情数据
getProductInfo({
......@@ -119,7 +138,8 @@ export default {
status: this.goodsInfoData.status,
linkMerchants: [],
speciLinkMerchants: [],
selectedSceneCode: tempVal.sceneType
selectedSceneCode: tempVal.sceneType,
serviceItems: this.productServiceItemList.map(v => {return v.serviceName})?.join(',') // 暂时不可配置 拿所有服务项目
}
this.setUpdateGoodsInfo(ObjData)
})
......@@ -143,20 +163,23 @@ export default {
display: flex;
padding: 16px;
background: #F9F9F9;
span{
display: inline-block;
}
.message-item-span{
width: 33%;
.label{
color: #666666;
width: 154px;
text-align: right;
.line-block{
display: flex;
.message-item-span{
flex: 1;
.label{
flex-shrink: 0;
display: inline-block;
color: #666666;
width: 154px;
text-align: right;
}
}
}
.message-item-block{
width: 100%;
display: flex;
.label{
flex-shrink: 0;
color: #666666;
width: 154px;
text-align: right;
......
......@@ -16,8 +16,8 @@
<span>规格明细</span>
<el-button type="text" @click="saveShopConfirm" v-if="goodsInfoData.status != 1 && goodsInfoData.status != 2">保存</el-button>
</div>
<singleSpecificationForm v-if="goodsInfoData.specificationType == '1'" @handleAddConfirm="handleAddConfirm"></singleSpecificationForm>
<multipleSpecificationForm ref="multipleSpecificationFormRef" v-else @handleAddConfirm="handleAddConfirm"></multipleSpecificationForm>
<singleSpecificationForm v-if="goodsInfoData.specificationType == '1'" @handleAddConfirm="handleAddConfirm" :productServiceItemList="productServiceItemList"></singleSpecificationForm>
<multipleSpecificationForm ref="multipleSpecificationFormRef" v-else @handleAddConfirm="handleAddConfirm" :productServiceItemList="productServiceItemList"></multipleSpecificationForm>
</div>
<div class="sync_type_class">
<span>同步至采购商城:</span>
......@@ -33,7 +33,8 @@ import { deepClone } from '@/common/util'
import multipleSpecificationForm from './multipleSpecificationForm.vue'
import singleSpecificationForm from './singleSpecificationForm.vue'
import { addOrEditBaseGoods, saveTempGoods } from '@/api/commodity'
import { mapGetters, mapMutations } from 'vuex'
import { mapGetters, mapMutations, mapActions } from 'vuex'
import { BaseData } from '@/common/constants.js'
export default {
name: 'specifications',
components: {
......@@ -43,7 +44,8 @@ export default {
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
productPositionTypeList: []
productPositionTypeList: [],
productServiceItemList: []
}
},
computed: {
......@@ -54,8 +56,15 @@ export default {
// 多规格
this.goodsInfoData.specificationType = '2'
}
this.getProductServiceItemList()
},
methods: {
...mapActions({
get: 'd2admin/base/get'
}),
async getProductServiceItemList() {
this.productServiceItemList = await this.get(BaseData.productServiceItemList)
},
...mapMutations('goodsInfoData', ['setUpdateGoodsInfo']),
handleSpecsEdit(num) {
if (!this.goodsInfoData.goodsId.length) {
......@@ -149,7 +158,9 @@ export default {
type: item.type,
stock: 999999,
purchasePrice: item.purchasePrice,
warningValue: item.warningValue
warningValue: item.warningValue,
upgradeGoodsServiceItemsList: deepClone(this.productServiceItemList).filter(v => item.serviceItemArr.includes(v.serviceCode)),
serviceYears: item.serviceYears
})
})
goodsSpecificationList = arr
......@@ -189,7 +200,9 @@ export default {
type: item.type,
stock: 999999,
purchasePrice: item.purchasePrice,
warningValue: item.warningValue
warningValue: item.warningValue,
upgradeGoodsServiceItemsList: deepClone(this.productServiceItemList).filter(v => item.serviceItemArr.includes(v.serviceCode)),
serviceYears: item.serviceYears,
})
})
}
......@@ -225,7 +238,9 @@ export default {
upgradePrice: val.upgradePrice,
warningValue: val.warningValue,
warrantyPeriod: val.warrantyPeriod,
editGoodNameInput: false
editGoodNameInput: false,
serviceItemArr: val.upgradeGoodsServiceItemsList?.map(v => { return v.serviceCode }) || [],
serviceYears: val.serviceYears
}
})
let specificationDetailList = []
......
......@@ -91,7 +91,8 @@ export default {
copyGoodsCode: '',
shoppingMallFlag: '0',
goodsSpecificationSingleList: [],
specificationSingleDetailList: []
specificationSingleDetailList: [],
selectedSceneCode: ''
},
editGoodsData: false
}
......@@ -174,7 +175,9 @@ export default {
upgradePrice: val.upgradePrice,
warningValue: val.warningValue,
warrantyPeriod: val.warrantyPeriod,
editGoodNameInput: false
editGoodNameInput: false,
serviceItemArr: val.upgradeGoodsServiceItemsList?.map(v => { return v.serviceCode }) || [],
serviceYears: val.serviceYears
}
})
res.goodsSpecificationNameList && res.goodsSpecificationNameList.forEach(val => {
......@@ -287,7 +290,7 @@ export default {
})
},
filterEmpty(data) {
return (data ?? '') === ''
return data instanceof Array ? data.length <= 0 : (data ?? '') === ''
},
checkGoodsInfo(num, callback) {
// 根据规格类型赋值进行校验判断
......@@ -322,13 +325,23 @@ export default {
item.purchasePriceEmpty = true
item.specificationDataEmpty = true
if (this.goodsInfoData.goodsType == 1) item.positionEmpty = true
if (this.goodsInfoData.selectedSceneCode === 0) {
item.serviceYearsEmpty = true
item.serviceItemArrEmpty = true
}
return item
})
this.goodsInfoData.goodsSpecificationList = arr
this.goodsInfoData.goodsSpecificationSingleList = arr
let specialList = []
if (this.goodsInfoData.goodsType == 1) specialList = ['position']
let requiredList = ['specificationData', 'shopPrice', ...specialList, 'shopMinPrice', 'purchasePrice', 'upgradePrice', 'warrantyPeriod']
if (this.goodsInfoData.goodsType == 1) { // 膜类 位置 质保 采购价 必填
specialList = ['position', 'purchasePrice', 'warrantyPeriod']
} else if (this.goodsInfoData.selectedSceneCode === 0) { // 2.0 场景 服务项目 服务时间必填
specialList = ['serviceItemArr', 'serviceYears']
} else { // 其余商品类型 采购价 质保必填
specialList = ['purchasePrice', 'warrantyPeriod']
}
let requiredList = ['specificationData', 'shopPrice', ...specialList, 'shopMinPrice', 'upgradePrice']
for (var i = 0; i < confirmShopData.length; i++) {
const item = confirmShopData[i]
if (this.goodsInfoData.specificationType == '2') item.specificationData = item.specsValueList.join(';~;')
......@@ -341,7 +354,7 @@ export default {
} catch (error) {
return document.getElementById('specificationDetailList').scrollIntoView()
}
if ((Number(item.shopPrice) > Number(item.shopMinPrice)) || Number(item.shopPrice) > Number(item.upgradePrice)) {
if (this.formatPrice(i)) {
return document.getElementById('specificationDetailList').scrollIntoView()
}
}
......@@ -354,13 +367,16 @@ export default {
item.warrantyPeriod = item.warrantyPeriod && parseFloat(item.warrantyPeriod)
item.purchasePrice = item.purchasePrice && parseFloat(item.purchasePrice)
item.warningValue = item.warningValue && parseFloat(item.warningValue)
item.serviceYears = item.serviceYears && parseFloat(item.serviceYears)
delete item.shopPriceEmpty
delete item.shopMinPriceEmpty
delete item.upgradePriceEmpty
delete item.warrantyPeriodEmpty
delete item.purchasePriceEmpty
delete item.positionEmpty
delete item.specificationDataEmpty
delete item.specificationDataEmpty
delete item.serviceYearsEmpty
delete item.serviceItemArrEmpty
}
// 对比商品数据 下架/草稿商品是否有变化 提交/关联门店
if (![1, 2].includes(this.goodsInfoData.status) && num && JSON.stringify(confirmShopData) !== JSON.stringify(this.copyUpgradeGoodsList)) {
......@@ -383,6 +399,13 @@ export default {
}
callback()
},
// 校验零售价成本价最低价关系
formatPrice(index) {
let item = this.goodsInfoData.goodsSpecificationSingleList[index]
return (!this.filterEmpty(item.shopPrice) && !this.filterEmpty(item.shopMinPrice) && Number(item.shopPrice) > Number(item.shopMinPrice))
|| (!this.filterEmpty(item.upgradePrice) && !this.filterEmpty(item.shopPrice) && Number(item.shopPrice) > Number(item.upgradePrice))
|| (!this.filterEmpty(item.shopMinPrice) && !this.filterEmpty(item.upgradePrice) && Number(item.shopMinPrice) > Number(item.upgradePrice))
},
saveAssignByMerchantEvent(data, isDelete) {
let flag = this.goodsInfoData.distributionType == '1'
// flag true按规格保存
......
......@@ -261,7 +261,8 @@ export default {
goodsDescList: data.goodsDescList,
goodsPositionList: data.goodsPositionList || [],
carTypeList: data.carTypeList,
convertedValue: data.convertedValue
convertedValue: data.convertedValue,
productServiceItemList: data.productServiceItemList
}
params.goodsImgList.forEach(i => {
delete i.createdDate
......
......@@ -130,7 +130,7 @@ export default {
methods: {
changeScene(value) {
if (value == 1) {
if (value == 1 || value == 0) {
this.yqStoreVisible = true
} else if (value == 3) {
this.yqStoreVisible = false
......
......@@ -35,7 +35,7 @@
<el-button type="text" />
<div slot="auth-button"
slot-scope="scope"
v-if="scope.scope.scene"
v-if="!filterEmpty(scope.scope.scene)"
class="btnClass">
<!-- <auth-button slot="auth-button"
:data="scope.scope" /> -->
......@@ -449,7 +449,7 @@ export default {
label: "业务场景",
prop: "scene",
formatter: (cellValue) => {
if (!cellValue.scene) return ''
if (this.filterEmpty(cellValue.scene)) return ''
return sceneList[cellValue.scene]
}
},
......@@ -701,6 +701,10 @@ export default {
}
})
},
// 校验是否有值
filterEmpty(data) {
return (data ?? '') === ''
},
filterNode(value, data, node) {
if (!value) return true
let parentNode = node.parent
......
......@@ -49,7 +49,8 @@
<scene-entry-dialog :scene-entry-visible="sceneEntryVisible"
:info="recordInfo"
v-if="sceneEntryVisible"
@dialogClose="sceneDialogClose" />
@dialogClose="sceneDialogClose"
@keyDowmGetList="keyDowmGetList" />
</d2-container>
</template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!