Commit 73a7a3a6 by chenwq

新增商户

1 parent 63aca36e
......@@ -52,3 +52,15 @@ export function getBusisDetailBasic(data) {
data.method = `dj.api.create.business.approve.detail.basic`
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 @@
<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">
<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>
</div>
</el-drawer>
</template>
<script>
import { deepClone } from '@/common/util'
import SelectBrand from '@/components/SelectBrand/index.vue'
import ProvinceCity from '@/components/province-city/index.vue'
import { brandList, getMerchantType } from "@api/shelfManage"
export default {
name: 'AddMerchant',
components: {
......@@ -37,23 +39,21 @@ export default {
formRules: {},
editData: {},
editFormData: [{
name: '',
name: 'accounttypeId',
label: '商户类型',
type: 'radio',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'merchantList',
optionsName: 'merchantTypeList',
optionList: [],
// isDisabled: false,
// style: { width: '520px' },
handleRadioChange: () => { }
}, {
label: "账户等级",
name: '',
name: 'merchantAccountLevel',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'accountLevelList'
}, {
label: "上级商户",
......@@ -65,12 +65,12 @@ export default {
optionsName: 'parentMerchantList'
}, {
label: "渠道",
name: '',
name: 'channelId',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: ''
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'channelList'
}, {
label: "选择开通模式",
name: '',
......@@ -81,12 +81,12 @@ export default {
optionsName: ''
}, {
label: '商户名称',
name: '',
name: 'merchantName',
type: 'input',
maxlength: 50
}, {
label: '联系电话',
name: '',
name: 'merchantLegalPersonPhone',
type: 'input',
maxlength: 11
}, {
......@@ -99,27 +99,92 @@ export default {
addHtml: 'selectBrand'
}, {
label: '登录账号',
name: '',
name: 'merchantLoginAccount',
type: 'input',
maxlength: 15
}, {
label: '登录密码',
name: '',
name: 'merchantLoginPassword',
type: 'input',
maxlength: 20
}],
baseData: {
merchantList: [],
merchantTypeList: [],
accountLevelList: [],
channelList: [],
parentMerchantList: []
}
}
},
mounted() {
setTimeout(() => {
this.brandList()
}, 200)
this.getMerchantType()
this.getAccountLevel()
this.getChannel()
},
//方法集合
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() {
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() {
// let merchantBrandMain = chant.filter(item => item)
// this.$set(this.editData, 'merchantBrandMain', merchantBrandMain)
......@@ -129,21 +194,25 @@ export default {
this.brandList()
// this.$refs.brandListTree.getCheckList(this.editData.merchantBrandMain)
},
async brandList() {
brandList() {
this.$refs.brandListTree.loading = true
const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => {
let child = item.children
if (!child) return
child.forEach(k => {
delete k.children
// const brandListTree = await brandList({})
brandList({}).then(res => {
const brandListTree = res
brandListTree.forEach(item => {
let child = item.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) {
......
......@@ -14,7 +14,7 @@
<!-- 流量方信息 -->
<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>
<!-- 分账配置 -->
......@@ -72,8 +72,8 @@ export default {
},
mounted() {
this.routeObj = this.$route.params
this.isLoad = true
this.getBasicDetail()
this.getDetail()
},
//方法集合
methods: {
......@@ -85,11 +85,10 @@ export default {
console.log(res, 'res----')
this.basicInfo = res.basicInfo || {}
this.merchantEditData = res.createBusinessApproveMerchant || {}
}).finally(() => {
this.isLoad = false
})
},
getDetail() {
this.isLoad = false
},
handleAddMerchant() {
console.log('新建---')
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!