Commit 99d24539 by chenwq

新增/编辑联动,联调

1 parent 385ab76d
......@@ -30,6 +30,29 @@ const getGoodsSeries = params => {
})
}
// 自建商品类列表
const getGoodsCategory = params => {
params.method = 'scrm.api.partner.goods.goodsCategoryConfiguration.page'
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取商品部位
const getGoodsPosList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = 'dj.api.smartcarlife.goodsPosition.list'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
const updateGoods = params => {
params.method = 'scrm.api.partner.goods.insertOrUpdate'
return http({
......@@ -73,4 +96,4 @@ const exportGoods = params => {
})
}
export default { getListApi, getSimpleMerchantList, getGoodsSeries, updateGoods, getGoodsDetail, deleteGoods, exportGoods }
export default { getListApi, getSimpleMerchantList, getGoodsSeries, getGoodsCategory, getGoodsPosList, updateGoods, getGoodsDetail, deleteGoods, exportGoods }
......@@ -7,13 +7,12 @@
<el-form label-width="120px" :inline="true" class="context-wrap">
<el-row v-for="(item, index) in detailFormDataRow" :key="index">
<span v-for="(subItem, subIndex) in item.rowList" :key="subIndex">
<template v-if="detailForm[subItem.name] != '-'">
<el-form-item :label="subItem.label + ':'" class="row-item">
<span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : subItem.isNum ? '0' + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</template>
<template v-if="detailForm[subItem.name] != '-'">
<el-form-item :label="subItem.label + ':'" class="row-item">
<span class="detail-txt ellipsis-1" :title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : subItem.isNum ? '0' + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</template>
</span>
</el-row>
</el-form>
</div>
......@@ -54,8 +53,8 @@ export default {
name: 'type'
},
{
label: '所属系列',
name: 'goodsCodeName'
label: '所属分类',
name: 'goodsTypeName'
},
{
label: '品牌方',
......@@ -66,13 +65,21 @@ export default {
name: 'supplierName'
},
{
label: '适用部位',
name: 'posTxt'
},
{
label: '比例换算',
name: 'convertedValue'
},
{
label: '扣减标准',
name: 'deductionStandard'
},
{
label: '产品类型',
name: 'typeTxt'
},
// {
// label: '所属系列',
// name: 'goodsCode'
// },
{
label: '售价/元',
name: 'sellPrice',
......@@ -94,6 +101,11 @@ export default {
isNum: true
},
{
label: '质保年限/年',
name: 'warrantyPeriod',
isNum: true
},
{
label: '库存下限预警',
name: 'warningValue',
isNum: true
......@@ -102,11 +114,6 @@ export default {
label: '库存预警上限',
name: 'warningValueMax',
isNum: true
},
{
label: '质保年限',
name: 'warrantyPeriod',
isNum: true
}
],
// 门店表格
......@@ -152,6 +159,13 @@ export default {
}
console.log(this.detailFormDataRow, 'detailFormDataRow---')
},
getGoodsPosList() {
this.$apis.commodity.getGoodsPosList({}).then(res => {
this.goodsPosList = res
let obj = this.detailForm.posList.find(item => item.positionValue == this.detailForm.position)
this.detailForm.posTxt = obj ? obj.positionName : '-'
})
},
getInfo() {
this.$apis.commodity.getGoodsDetail({ upgradeGoodsId: this.routeInfo.info.upgradeGoodsId }).then(res => {
this.detailForm = res
......@@ -170,6 +184,7 @@ export default {
} else {
this.detailForm.warrantyPeriod = (this.detailForm.warrantyPeriod || 0) + '年'
}
this.getGoodsPosList()
})
},
handleCancel() {
......
......@@ -29,6 +29,15 @@ const commodityObj = {
maxlength: 20
},
{
label: '产品类型',
name: 'proType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'typeList'
},
{
label: '使用门店',
name: 'merchantIdList',
type: 'select',
......@@ -38,29 +47,24 @@ const commodityObj = {
optionsName: 'merchantList'
},
{
label: '所属系列',
name: 'goodsCode',
type: 'select',
optionList: [],
optionId: 'goodsCode',
optionLabel: 'goodsName',
optionsName: 'goodsSeriesList'
},
{
label: '产品类型',
label: '所属分类',
name: 'goodsType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'typeList'
optionId: 'categoryType',
optionLabel: 'categoryName',
optionsName: 'goodsCategoryList'
}
]
}
const editCommodityObj = {
editRule: {
goodsName: [{ required: true, message: '请输入商品名称', trigger: 'change' }],
goodsCode: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
// goodsCode: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
goodsType: [{ required: true, message: '请选择所属分类', trigger: 'change' }],
position: [{ required: true, message: '请选择适用部位', trigger: 'change' }],
convertedValue: [{ required: true, message: '请输入比例换算', trigger: 'change' }],
deductionStandard: [{ required: true, message: '请输入扣减标准', trigger: 'change' }],
sellPrice: [{ required: true, message: '请输入售价', trigger: 'change' }],
minSellPrice: [{ required: true, message: '请输入最低售价', trigger: 'change' }],
giftCost: [{ required: true, message: '请输入赠送成本', trigger: 'change' }],
......@@ -84,23 +88,30 @@ const editCommodityObj = {
maxlength: 50
},
{
label: '所属系列',
name: 'goodsCode',
label: '所属分类',
name: 'goodsType',
type: 'select',
optionList: [],
optionId: 'goodsCode',
optionLabel: 'goodsName',
optionsName: 'goodsSeriesList',
optionId: 'categoryType',
optionLabel: 'categoryName',
optionsName: 'goodsCategoryList',
changeAttr: function(val, targetItem, that) {
let labeList = ['产品类型', '质保年限']
let txt = targetItem.optionList.find(k => k.goodsCode == val)?.goodsName || ''
that.changeFormAttr('editFormData', 'isHide', labeList, txt != '太阳膜')
if (val != '1') {
that.editForm.baseProductFlag = 'N'
that.editForm.upgradeProductFlag = 'Y'
that.handleCheckChange('Y', 'upgradeProductFlag')
that.handleCheckChange('N', 'baseProductFlag')
let labelList = ['适用部位', '扣减标准', '产品类型', '质保年限']
let jpLabelList = ['比例换算']
let baseLabelList = ['售价', '最低售价', '产品成本']
let unitLabelList = ['库存下限预警', '库存上限预警']
let txt = targetItem.optionList.find(k => k.categoryType == val)?.categoryName || ''
that.changeFormAttr('editFormData', 'isHide', labelList, txt != '自建商品-太阳膜')
that.changeFormAttr('editFormData', 'isHide', jpLabelList, txt == '自建商品-精品')
that.changeFormAttr('editFormData', 'append', baseLabelList, txt == '自建商品-精品' ? '元/件' : '元/车')
that.changeFormAttr('editFormData', 'append', unitLabelList, txt == '自建商品-精品' ? '件' : '米')
if (txt != '自建商品-太阳膜') {
that.changeFormAttr('editFormData', 'isHide', baseLabelList, !(txt != '自建商品-太阳膜'))
}
that.editForm.baseProductFlag = 'N'
that.editForm.upgradeProductFlag = 'Y'
that.handleCheckChange('Y', 'upgradeProductFlag')
that.handleCheckChange('N', 'baseProductFlag')
}
},
{
......@@ -116,6 +127,31 @@ const editCommodityObj = {
maxlength: 20
},
{
label: '适用部位',
name: 'position',
type: 'select',
isHide: true,
optionList: [],
optionId: 'positionValue',
optionLabel: 'positionName',
optionsName: 'goodsPosList'
},
{
label: '比例换算',
name: 'convertedValue',
type: 'slot',
addHtml: 'convertedValue',
isHide: true
},
{
label: '扣减标准',
name: 'deductionStandard',
type: 'slot',
addHtml: 'deductionStandard',
placeholder: '请输入米数',
isHide: true
},
{
label: '产品类型',
name: '',
type: 'slot',
......@@ -124,38 +160,44 @@ const editCommodityObj = {
tips: '说明:基础产品应用于客户战败(不升级)订单中,升级产品应用于客户升级订单中'
},
{
label: '售价/元',
label: '售价',
name: 'sellPrice',
type: 'input',
isHide: true
isHide: true,
append: '元/件'
},
{
label: '最低售价/元',
label: '最低售价',
name: 'minSellPrice',
type: 'input',
isHide: true
isHide: true,
append: '元/件'
},
{
label: '赠送成本/元',
label: '赠送成本',
name: 'giftCost',
type: 'input',
isHide: true
isHide: true,
append: '元/车'
},
{
label: '产品成本/元',
label: '产品成本',
name: 'productCost',
type: 'input',
isHide: true
isHide: true,
append: '元/件'
},
{
label: '库存下限预警/件',
label: '库存下限预警',
name: 'warningValue',
type: 'input'
type: 'input',
append: '米'
},
{
label: '库存上限预警/件',
label: '库存上限预警',
name: 'warningValueMax',
type: 'input'
type: 'input',
append: '米'
},
{
label: '质保年限',
......
......@@ -4,6 +4,15 @@
<div class="container edit-container">
<p class="edit-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :pageThat="this" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="convertedValue" slot-scope="scope">
<span>一卷等于</span>
<el-input style="width: 136px; margin: 0 8px;" :placeholder="scope.scope.placeholder || '请输入' + scope.scope.label" v-bind="scope.scope.attrs ? scope.scope.attrs : {}" v-model.trim="editForm[scope.scope.name]" :maxlength="scope.scope.maxlength"></el-input>
<span>米</span>
</div>
<div slot="deductionStandard" slot-scope="scope">
<el-input style="width: 136px; margin-right: 8px;" :placeholder="scope.scope.placeholder || '请输入' + scope.scope.label" v-bind="scope.scope.attrs ? scope.scope.attrs : {}" v-model.trim="editForm[scope.scope.name]" :maxlength="scope.scope.maxlength"></el-input>
<span>米/车,1卷膜预估可适用{{ editForm.deductionStandard ? Math.floor(editForm.convertedValue / editForm.deductionStandard) : '--' }}车</span>
</div>
<div slot="productFlag">
<el-checkbox v-model="editForm.baseProductFlag" true-label="Y" false-label="N" label="基础产品" @change="val => handleCheckChange(val, 'baseProductFlag')"></el-checkbox>
<el-checkbox v-model="editForm.upgradeProductFlag" true-label="Y" false-label="N" label="升级产品" @change="val => handleCheckChange(val, 'upgradeProductFlag')"></el-checkbox>
......@@ -63,7 +72,8 @@ export default {
editForm: {
baseProductFlag: 'N',
upgradeProductFlag: 'N',
merchantList: []
merchantList: [],
goodsType: ''
},
isEdit: true,
editRule: constData.editCommodityObj.editRule,
......@@ -95,7 +105,9 @@ export default {
]
},
baseData: {
goodsSeriesList: []
goodsCategoryList: [],
goodsPosList: []
// goodsSeriesList: []
}
}
},
......@@ -142,13 +154,15 @@ export default {
this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : ''
this.$utils.getOptionsList(this, 'editFormData', false)
this.getGoodsSeries()
this.getGoodsCategory()
this.getGoodsPosList()
// this.getGoodsSeries()
// this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
},
methods: {
keyDown() {
document.onkeydown = function() {
document.onkeydown = function () {
var evt = window.event || arguments[0]
if (evt && evt.keyCode == 13) {
if (typeof evt.cancelBubble != 'undefined') evt.cancelBubble = true
......@@ -163,7 +177,7 @@ export default {
upgradeGoodsId: this.routeInfo.info.upgradeGoodsId
}
this.$apis.commodity.getGoodsDetail(params).then(res => {
let changeProduct = this.validateProduct(res.goodsCodeName)
let changeProduct = this.validateProduct(res.goodsTypeName)
if (changeProduct) {
this.handleCheckChange(res.baseProductFlag, 'baseProductFlag')
this.handleCheckChange(res.upgradeProductFlag, 'upgradeProductFlag')
......@@ -175,9 +189,11 @@ export default {
})
})
},
validateProduct(goodsCodeName) {
let isFlag = goodsCodeName != '太阳膜'
let AttrList = isFlag ? ['售价/元', '最低售价/元', '产品成本/元'] : ['产品类型', '质保年限']
validateProduct(goodsTypeName) {
let isFlag = goodsTypeName != '自建商品-太阳膜'
// let AttrList = isFlag ? ['售价/元', '最低售价/元', '产品成本/元'] : ['产品类型', '质保年限']
let AttrList = isFlag ? ['售价', '最低售价', '产品成本'] : ['适用部位', '比例换算', '扣减标准', '产品类型', '质保年限']
goodsTypeName != '自建商品-精品' && AttrList.push('比例换算')
this.changeFormAttr('editFormData', 'isHide', AttrList, false)
if (!isFlag)
return (val, attr) => {
......@@ -188,16 +204,28 @@ export default {
// seriesClear() {
// this.editForm
// },
getGoodsSeries() {
this.$apis.commodity.getGoodsSeries({}).then(res => {
this.baseData.goodsSeriesList = res
this.$utils.getOptionsList(this, 'editFormData', false, 'goodsCode')
// getGoodsSeries() {
// this.$apis.commodity.getGoodsSeries({}).then(res => {
// this.baseData.goodsSeriesList = res
// this.$utils.getOptionsList(this, 'editFormData', false, 'goodsCode')
// })
// },
getGoodsCategory() {
this.$apis.commodity.getGoodsCategory({}).then(res => {
this.baseData.goodsCategoryList = res
this.$utils.getOptionsList(this, 'editFormData', false, 'goodsType')
})
},
getGoodsPosList() {
this.$apis.commodity.getGoodsPosList({}).then(res => {
this.baseData.goodsPosList = res
this.$utils.getOptionsList(this, 'editFormData', false, 'position')
})
},
// 产品类型改变
handleCheckChange(val, attr) {
let baseAttrList = ['赠送成本/元']
let upAttrList = ['售价/元', '最低售价/元', '产品成本/元']
let baseAttrList = ['赠送成本']
let upAttrList = ['售价', '最低售价', '产品成本']
switch (attr) {
case 'baseProductFlag':
this.changeFormAttr('editFormData', 'isHide', baseAttrList, val != 'Y')
......@@ -261,10 +289,12 @@ export default {
var params = this.$common.utils.deepClone(this.editForm)
params.merchantIdList = []
params.merchantIdList = params.merchantList.map(item => item.merchantId)
params.goodsTypeName = this.baseData.goodsCategoryList.find(item => item.categoryType == params.goodsType).categoryName
delete params.merchantList
if (this.routeInfo.editType == 'edit') {
params.upgradeGoodsId = this.routeInfo.info.upgradeGoodsId
}
console.log(params, '00000')
this.$apis.commodity.updateGoods(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
......@@ -292,7 +322,7 @@ export default {
.then(() => {
this.cancelJump()
})
.catch(() => {})
.catch(() => { })
} else {
this.cancelJump()
}
......
......@@ -17,9 +17,8 @@
<div slot="content">
<div class="text-3 font-12 weight-6" style="line-height:24px">上家门店</div>
<div class="merchant-wrap">
<div class="text-6 font-12" style="line-height:24px" v-for="item in scope.scope.merchantList" :key="item">{{ item.merchantName }}</div>
<div class="text-6 font-12" style="line-height:24px" v-for="item in scope.scope.merchantList" :key="item">{{ item.merchantName }}</div>
</div>
</div>
<div class="use-store">
<img src="@/assets/store.png" />
......@@ -53,6 +52,7 @@ export default {
goodsCode: '',
merchantIdList: [],
type: '',
proType: '',
goodsType: ''
},
tableSearchForm: {},
......@@ -79,9 +79,9 @@ export default {
line: 1
},
{
label: '所属系列',
prop: 'goodsCodeName',
width: '100'
label: '所属分类',
prop: 'goodsTypeName',
width: '150'
},
{
label: '品牌方',
......@@ -189,7 +189,8 @@ export default {
merchantList: [],
brandList: [],
typeList: baseList.typeList,
goodsSeriesList: []
goodsSeriesList: [],
goodsCategoryList: []
},
imgVisible: false,
previewImgUrl: ''
......@@ -199,12 +200,13 @@ export default {
mounted() {
this.getGoodsSeries()
this.getMerchantList()
this.getGoodsCategory()
this.$utils.getOptionsList(this, 'searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
switch (params.goodsType) {
switch (params.proType) {
case 1:
params.baseProductFlag = 'Y'
break
......@@ -259,6 +261,12 @@ export default {
})
},
getGoodsCategory() {
this.$apis.commodity.getGoodsCategory({}).then(res => {
this.baseData.goodsCategoryList = res
this.$utils.getOptionsList(this, 'searchFormData', true, 'goodsType')
})
},
// 删除
handleDelete(info) {
this.$utils.secondConfirm(this, '删除提示', '删除后不可恢复,是否确定删除?', 'commodity', 'deleteGoods', { upgradeGoodsId: info.upgradeGoodsId })
......@@ -282,6 +290,7 @@ export default {
goodsCode: '',
merchantIdList: [],
type: '',
proType: '',
goodsType: ''
}
this.handleSearch()
......@@ -290,8 +299,8 @@ export default {
}
</script>
<style scoped lang="scss">
.container{
padding:20px;
.container {
padding: 20px;
}
.use-store {
display: flex;
......@@ -305,19 +314,19 @@ export default {
}
}
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
margin-top: 20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
margin-top: 20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
}
.merchant-wrap{
max-height:200px;
.merchant-wrap {
max-height: 200px;
overflow: scroll;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!