Commit 73a7a3a6 by chenwq

新增商户

1 parent 63aca36e
...@@ -52,3 +52,15 @@ export function getBusisDetailBasic(data) { ...@@ -52,3 +52,15 @@ export function getBusisDetailBasic(data) {
data.method = `dj.api.create.business.approve.detail.basic` data.method = `dj.api.create.business.approve.detail.basic`
return request(data) return request(data)
} }
// 新增商户 - 车品牌
export function brandList(data) {
data.method = `merchants.api.merchantCommon.getCarbrandTree`
return request(data, RequestMethods.POST)
}
// 新增商户 - 商户类型
export function getMerchantType(data) {
data.method = `merchants.api.menu.findAllDictData`
return request(data, RequestMethods.POST)
}
...@@ -3,15 +3,17 @@ ...@@ -3,15 +3,17 @@
<div class=""> <div class="">
<glsx-combi-form class="edit-form-container" ref="addFormRef" :isBlock="isBlock" label-width="150px" default-width="400px" :form-ref="editChildRef" :form-obj="editData" :form-data="editFormData" :form-rules="formRules"> <glsx-combi-form class="edit-form-container" ref="addFormRef" :isBlock="isBlock" label-width="150px" default-width="400px" :form-ref="editChildRef" :form-obj="editData" :form-data="editFormData" :form-rules="formRules">
<ProvinceCity slot="provinceCity" ref="provinceForm" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" :detailAddressLabel="detailAddressLabel" @selectAddressByMap="selectAddressByMap"></ProvinceCity> <ProvinceCity slot="provinceCity" ref="provinceForm" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" :detailAddressLabel="detailAddressLabel" @selectAddressByMap="selectAddressByMap"></ProvinceCity>
<select-brand slot="selectBrand" :brandListTree="brandListTree" @clickBrand="clickBrand" ref="brandListTree"></select-brand> <select-brand slot="selectBrand" ref="brandListTree" :brandListTree="brandListTree" @clickBrand="clickBrand"></select-brand>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import { deepClone } from '@/common/util'
import SelectBrand from '@/components/SelectBrand/index.vue' import SelectBrand from '@/components/SelectBrand/index.vue'
import ProvinceCity from '@/components/province-city/index.vue' import ProvinceCity from '@/components/province-city/index.vue'
import { brandList, getMerchantType } from "@api/shelfManage"
export default { export default {
name: 'AddMerchant', name: 'AddMerchant',
components: { components: {
...@@ -37,23 +39,21 @@ export default { ...@@ -37,23 +39,21 @@ export default {
formRules: {}, formRules: {},
editData: {}, editData: {},
editFormData: [{ editFormData: [{
name: '', name: 'accounttypeId',
label: '商户类型', label: '商户类型',
type: 'radio', type: 'radio',
optionId: 'confId', optionId: 'confId',
optionLabel: 'confLabel', optionLabel: 'confLabel',
optionsName: 'merchantList', optionsName: 'merchantTypeList',
optionList: [], optionList: [],
// isDisabled: false,
// style: { width: '520px' },
handleRadioChange: () => { } handleRadioChange: () => { }
}, { }, {
label: "账户等级", label: "账户等级",
name: '', name: 'merchantAccountLevel',
type: 'select', type: 'select',
optionList: [], optionList: [],
optionId: 'confId', optionId: 'dictValue',
optionLabel: 'confLabel', optionLabel: 'dictLabel',
optionsName: 'accountLevelList' optionsName: 'accountLevelList'
}, { }, {
label: "上级商户", label: "上级商户",
...@@ -65,12 +65,12 @@ export default { ...@@ -65,12 +65,12 @@ export default {
optionsName: 'parentMerchantList' optionsName: 'parentMerchantList'
}, { }, {
label: "渠道", label: "渠道",
name: '', name: 'channelId',
type: 'select', type: 'select',
optionList: [], optionList: [],
optionId: 'confId', optionId: 'dictValue',
optionLabel: 'confLabel', optionLabel: 'dictLabel',
optionsName: '' optionsName: 'channelList'
}, { }, {
label: "选择开通模式", label: "选择开通模式",
name: '', name: '',
...@@ -81,12 +81,12 @@ export default { ...@@ -81,12 +81,12 @@ export default {
optionsName: '' optionsName: ''
}, { }, {
label: '商户名称', label: '商户名称',
name: '', name: 'merchantName',
type: 'input', type: 'input',
maxlength: 50 maxlength: 50
}, { }, {
label: '联系电话', label: '联系电话',
name: '', name: 'merchantLegalPersonPhone',
type: 'input', type: 'input',
maxlength: 11 maxlength: 11
}, { }, {
...@@ -99,27 +99,92 @@ export default { ...@@ -99,27 +99,92 @@ export default {
addHtml: 'selectBrand' addHtml: 'selectBrand'
}, { }, {
label: '登录账号', label: '登录账号',
name: '', name: 'merchantLoginAccount',
type: 'input', type: 'input',
maxlength: 15 maxlength: 15
}, { }, {
label: '登录密码', label: '登录密码',
name: '', name: 'merchantLoginPassword',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}], }],
baseData: { baseData: {
merchantList: [], merchantTypeList: [],
accountLevelList: [], accountLevelList: [],
channelList: [],
parentMerchantList: [] parentMerchantList: []
} }
} }
}, },
mounted() {
setTimeout(() => {
this.brandList()
}, 200)
this.getMerchantType()
this.getAccountLevel()
this.getChannel()
},
//方法集合 //方法集合
methods: { methods: {
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleClose() { handleClose() {
this.$emit('handleClose') this.$emit('handleClose')
}, },
getMerchantType() {
const params = { dictType: 'account_type' }
getMerchantType(params).then(res => {
const list = ['4S店', '园区店', '服务商']
this.baseData.merchantTypeList = []
list.forEach((item) => {
let obj = res.find(k => k.dictLabel == item)
if(obj) {
this.baseData.merchantTypeList.push({
confId: obj.dictValue,
confLabel: obj.dictLabel
})
}
})
this.editFormData[0].optionList = this.baseData.merchantTypeList
})
},
getAccountLevel() {
const params = { dictType: 'account_level' }
getMerchantType(params).then(res => {
this.baseData.accountLevelList = res
this.getOptionsList('editFormData', false, 'merchantAccountLevel')
})
},
getChannel() {
const params = { dictType: 'channel' }
getMerchantType(params).then(res => {
this.baseData.channelList = res
this.getOptionsList('editFormData', false, 'channelId')
})
},
checkBrandList() { checkBrandList() {
// let merchantBrandMain = chant.filter(item => item) // let merchantBrandMain = chant.filter(item => item)
// this.$set(this.editData, 'merchantBrandMain', merchantBrandMain) // this.$set(this.editData, 'merchantBrandMain', merchantBrandMain)
...@@ -129,21 +194,25 @@ export default { ...@@ -129,21 +194,25 @@ export default {
this.brandList() this.brandList()
// this.$refs.brandListTree.getCheckList(this.editData.merchantBrandMain) // this.$refs.brandListTree.getCheckList(this.editData.merchantBrandMain)
}, },
async brandList() { brandList() {
this.$refs.brandListTree.loading = true this.$refs.brandListTree.loading = true
const brandListTree = await this.$apis.baseInfo.brandList({}) // const brandListTree = await brandList({})
brandListTree.forEach(item => { brandList({}).then(res => {
let child = item.children const brandListTree = res
if (!child) return brandListTree.forEach(item => {
child.forEach(k => { let child = item.children
delete k.children if (!child) return
child.forEach(k => {
delete k.children
})
})
this.brandListTree = brandListTree
this.$refs.brandListTree.getCheckList(this.editData.merchantBrandMain)
this.$nextTick(() => {
this.$refs.brandListTree.loading = false
}) })
}) })
this.brandListTree = brandListTree
this.$refs.brandListTree.getCheckList(this.editData.merchantBrandMain)
this.$nextTick(() => {
this.$refs.brandListTree.loading = false
})
}, },
// 点击主营品牌 // 点击主营品牌
clickBrand(val) { clickBrand(val) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- 流量方信息 --> <!-- 流量方信息 -->
<shop-merchant-info ref="shopMerchant" :editData="merchantEditData" @addMerchant="handleAddMerchant"></shop-merchant-info> <shop-merchant-info ref="shopMerchant" :editData="merchantEditData" @addMerchant="handleAddMerchant"></shop-merchant-info>
<!-- 流量方信息 - 新增 - 新增商户 --> <!-- 流量方信息 - 新增 - 新增商户 -->
<add-merchant :addMerVisible="addMerVisible" @handleClose="handleAddMerchant"></add-merchant> <add-merchant v-if="addMerVisible" :addMerVisible="addMerVisible" @handleClose="handleAddMerchant"></add-merchant>
<!-- 上架商品及测算 --> <!-- 上架商品及测算 -->
<goods-info></goods-info> <goods-info></goods-info>
<!-- 分账配置 --> <!-- 分账配置 -->
...@@ -72,8 +72,8 @@ export default { ...@@ -72,8 +72,8 @@ export default {
}, },
mounted() { mounted() {
this.routeObj = this.$route.params this.routeObj = this.$route.params
this.isLoad = true
this.getBasicDetail() this.getBasicDetail()
this.getDetail()
}, },
//方法集合 //方法集合
methods: { methods: {
...@@ -85,11 +85,10 @@ export default { ...@@ -85,11 +85,10 @@ export default {
console.log(res, 'res----') console.log(res, 'res----')
this.basicInfo = res.basicInfo || {} this.basicInfo = res.basicInfo || {}
this.merchantEditData = res.createBusinessApproveMerchant || {} this.merchantEditData = res.createBusinessApproveMerchant || {}
}).finally(() => {
this.isLoad = false
}) })
}, },
getDetail() {
this.isLoad = false
},
handleAddMerchant() { handleAddMerchant() {
console.log('新建---') console.log('新建---')
this.addMerVisible = !this.addMerVisible this.addMerVisible = !this.addMerVisible
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!