Commit a7c31d9a by 前端

Merge branch 'yangm_dev_v2.0.0' into 'v2.0.0'

Yangm dev v2.0.0

See merge request !13
2 parents ec219301 3a11b89f
......@@ -6,7 +6,7 @@
* @param {*} params
* @returns
*/
import { http_config,http_car } from '@/main'
import { http_config,http } from '@/main'
const getMerchantTree = params => {
params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list'
return http_config({
......@@ -44,9 +44,9 @@ const merchantInfo = params => {
})
}
const brandList = params => {
params.method = 'dj.api.get.car.brandList'
return http_car({
url: '/rop-dj-car-boutique/router',
params.method = 'merchants.api.merchantCommon.getCarbrandTree'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
......
......@@ -299,9 +299,8 @@ export default {
if (params.businessType) {
params.businessType = params.businessType.join(',')
}
const getCheckedArr = this.$refs.baseInfoForm.$refs.brandListTree.getCheckedArr
const merchantBrandMain = getCheckedArr.map(item => item.id)
params.merchantBrandMain = merchantBrandMain.join(',')
const merchantBrandList = this.$refs.baseInfoForm.$refs.brandListTree.getMerchantBrandList()
params.merchantBrandListJson = JSON.stringify(merchantBrandList)
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0)
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel
params.status = 1
......
......@@ -200,13 +200,14 @@ export default {
}
},
methods: {
checkBrandList(merchantBrandMain) {
checkBrandList(chant) {
let merchantBrandMain = chant.filter(item=>item)
this.$set(this.accountAddForm, 'merchantBrandMain', merchantBrandMain)
console.log(this.accountAddForm.merchantBrandMain)
if (!this.accountAddForm.merchantBrandMain) {
this.accountAddForm.merchantBrandMain = []
} else {
this.accountAddForm.merchantBrandMain = this.accountAddForm.merchantBrandMain.split(',')
}
console.log(this.accountAddForm.merchantBrandMain)
this.$refs.brandListTree.getCheckList(this.accountAddForm.merchantBrandMain)
},
checkBusinessType(type) {
......@@ -224,11 +225,12 @@ export default {
async brandList() {
this.$refs.brandListTree.loading = true
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
const brandListTree = await this.$apis.baseInfo.brandList({ needCarSeries: true })
const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => {
let child = item.childs
let child = item.children
if(!child) return
child.forEach(k => {
delete k.childs
delete k.children
})
})
this.brandListTree = brandListTree
......
......@@ -314,9 +314,8 @@ export default {
let businessScopeCustomize = this.businessScopeCustomize.map(item => item.name)
params.businessScopeCustomize = businessScopeCustomize.join(',')
params.merchantFiles = JSON.stringify(params.merchantFiles)
const getCheckedArr = this.$refs.baseInfoForm.$refs.brandListTree.getCheckedArr
const merchantBrandMain = getCheckedArr.map(item => item.id)
params.merchantBrandMain = merchantBrandMain.join(',')
const merchantBrandList = this.$refs.baseInfoForm.$refs.brandListTree.getMerchantBrandList()
params.merchantBrandListJson = JSON.stringify(merchantBrandList)
Promise.all([pm1, pm2]).then(() => {
this.$apis.store.updateMerchant(params).then(res => {
if (res) {
......@@ -424,6 +423,7 @@ export default {
accounttypeId: accountType,
merchantBrandMain
})
merchantBrandMain = merchantBrandMain.replaceAll(';', ',').split(',')
this.$refs.baseInfoForm.checkBrandList(merchantBrandMain)
this.$refs.baseInfoForm.checkBusinessType(businessType)
this.$nextTick(() => {
......
......@@ -95,11 +95,13 @@ export default {
console.log(this.infoForm.businessType)
}
console.log(this.infoForm.businessType)
const brandListTree = await this.$apis.baseInfo.brandList({ needCarSeries: true })
const brandListTree = await this.$apis.baseInfo.brandList({})
console.log(brandListTree)
brandListTree.forEach(item => {
let child = item.childs
let child = item.children
if(!child) return
child.forEach(k => {
delete k.childs
delete k.children
})
})
this.brandListTree = brandListTree
......@@ -107,7 +109,7 @@ export default {
if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = []
} else {
this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.split(',')
this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.replaceAll(';',',').split(',')
}
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain)
this.$nextTick(() => {
......@@ -147,9 +149,8 @@ export default {
delete params.stores
params.businessType = params.businessType.join(',')
//merchantBrandMain 品牌id
const getCheckedArr = this.$refs.brandListTree.getCheckedArr
const merchantBrandMain = getCheckedArr.map(item => item.id)
params.merchantBrandMain = merchantBrandMain.join(',')
const merchantBrandList = this.$refs.brandListTree.getMerchantBrandList()
params.merchantBrandListJson = JSON.stringify(merchantBrandList)
this.$apis.store.updateMerchant(params).then(res => {
if (res) {
this.$router.push({ path: '/baseInfo/index' })
......
......@@ -11,13 +11,13 @@
<div class="select-input-box">
<template v-for="(item, idx) in getCheckedArr">
<el-tag effect="plain" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)" v-if="idx < 3">
{{ item.name }}
{{ item.label }}
</el-tag>
</template>
<el-popover placement="top" width="600" trigger="hover" class="select-popover">
<div class="select-popover-box">
<el-tag effect="plain" class="popover-item" v-for="(item, idx) in getCheckedArr" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)">
{{ item.name }}
{{ item.label }}
</el-tag>
</div>
<el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag>
......@@ -47,8 +47,8 @@ export default {
treeArr: [],
getCheckedArr: [],
defaultProps: {
children: 'childs',
label: 'name'
children: 'children',
label: 'label'
}
}
},
......@@ -65,7 +65,7 @@ export default {
handler() {
const getCheckedNodes = this.$refs.tree.getCheckedNodes()
this.getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs') && cur.childs.length > 0) {
if (Object.keys(cur).includes('children') && cur.children.length > 0) {
return prev
}
return prev.concat(cur)
......@@ -75,6 +75,37 @@ export default {
}
},
methods: {
getMerchantBrandList() {
let getCheckedNodes = this.$refs.tree.getCheckedNodes()
const getCheckedKeys = this.$refs.tree.getCheckedKeys()
const getHalfCheckedNodes = this.$refs.tree.getHalfCheckedNodes()
let merchantBrandList = getHalfCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
let merchantBrandList2 = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId
}
})
return merchantBrandList.concat(merchantBrandList2)
},
//勾选
handleCheck() {
this.treeArr = this.getTreeArray()
......@@ -86,6 +117,8 @@ export default {
}
},
getCheckList(checkArr = []) {
checkArr.forEach(item=>item = parseInt(item));
console.log(checkArr)
this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => {
this.handleCheck()
......@@ -95,7 +128,7 @@ export default {
getTreeArray() {
let tree_arr = []
this.brandListTree.forEach(k => {
let child = k.childs
let child = k.children
if (child && child.length > 0) {
child.forEach(j => {
tree_arr.push(j.id)
......@@ -133,7 +166,7 @@ export default {
this.getCheckedArr.splice(index, 1)
const getCheckedNodes = this.$refs.tree.getCheckedNodes()
let getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs')) {
if (Object.keys(cur).includes('children')) {
return prev
}
return prev.concat(cur)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!