Commit 23fba8d9 by chenwq

联调和自测

1 parent 80ec209c
...@@ -48,6 +48,32 @@ const getMerchantInfo = params => { ...@@ -48,6 +48,32 @@ const getMerchantInfo = params => {
}) })
} }
// 新增客户
const createMerchant = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = 'dj.api.smartcarlife.merchantCustomer.create.merchant'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 编辑客户
const updateMerchant = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = 'dj.api.smartcarlife.merchantCustomer.update'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 根据场景查询产品 // 根据场景查询产品
const findProByScene = params => { const findProByScene = params => {
params.method = `scrm.api.busassistant.activity.productByscene` params.method = `scrm.api.busassistant.activity.productByscene`
...@@ -92,4 +118,4 @@ const getInviteCode = params => { ...@@ -92,4 +118,4 @@ const getInviteCode = params => {
sign: true sign: true
}) })
} }
export default { getList, getServiceCenterList, getReviewList, getMerchantInfo, findProByScene, getSceneProStatus, getStaffList, getInviteCode } export default { getList, getServiceCenterList, getReviewList, getMerchantInfo, createMerchant, updateMerchant, findProByScene, getSceneProStatus, getStaffList, getInviteCode }
...@@ -17,6 +17,10 @@ html { ...@@ -17,6 +17,10 @@ html {
padding: 20px; padding: 20px;
} }
.shop .edit-form-container {
margin-top: 20px;
}
.shop.edit-box .container.all-page { .shop.edit-box .container.all-page {
min-height: calc(100vh - 204px); min-height: calc(100vh - 204px);
} }
...@@ -39,6 +43,10 @@ html { ...@@ -39,6 +43,10 @@ html {
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
} }
.shop .m-t-20 {
margin-top: 20px;
}
.shop .m-b-20 { .shop .m-b-20 {
margin-bottom: 20px; margin-bottom: 20px;
} }
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<Province ref="provinceForm" :subdistrict="subdistrict" :provinceLabel="item.labelName" :inline="item.inline" @selectProvince="selectProvince" @selectCity="selectCity" @selectAddressByMap="selectAddressByMap" :detailAddressLabel="detailAddressLabel"></Province> <Province ref="provinceForm" :subdistrict="subdistrict" :provinceLabel="item.labelName" :inline="item.inline" @selectProvince="selectProvince" @selectCity="selectCity" @selectAddressByMap="selectAddressByMap" :detailAddressLabel="detailAddressLabel"></Province>
</div> </div>
<div v-else-if="item.type == 'brand'"> <div v-else-if="item.type == 'brand'">
<select-brand :brandListTree="brandListTree" @clickBrand="clickBrand" ref="brandListTree"></select-brand> <select-brand :brandListTree="brandListTree" @clickBrand="clickBrand" @brandChange="brandChange" ref="brandListTree"></select-brand>
</div> </div>
</el-form-item> </el-form-item>
</template> </template>
...@@ -182,6 +182,10 @@ export default { ...@@ -182,6 +182,10 @@ export default {
searchSelectObj: { searchSelectObj: {
type: Object, type: Object,
default: () => { } default: () => { }
},
isWatch: {
type: Boolean,
default: false
} }
}, },
...@@ -193,6 +197,17 @@ export default { ...@@ -193,6 +197,17 @@ export default {
SelectBrand SelectBrand
}, },
watch: {
formObj: {
handler: function (newVal, oldVal) {
if (this.isWatch) {
this.brandList()
}
},
deep: true
}
},
mounted() { mounted() {
this.brandList() this.brandList()
}, },
...@@ -285,7 +300,11 @@ export default { ...@@ -285,7 +300,11 @@ export default {
}) })
}) })
this.brandListTree = brandListTree this.brandListTree = brandListTree
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain) console.log(this.formObj, '0000')
if (this.formObj?.merchantBrandIds) {
console.log(this.$refs.brandListTree, 'this.$refs.brandListTree---')
this.$refs.brandListTree[0].getCheckList(this.formObj.merchantBrandIds)
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.brandListTree.loading = false this.$refs.brandListTree.loading = false
}) })
...@@ -296,6 +315,9 @@ export default { ...@@ -296,6 +315,9 @@ export default {
this.isFirstBrand = true this.isFirstBrand = true
} }
}, },
brandChange(val) {
this.formObj.merchantBrandList = val
},
// 获取富文本框内容 // 获取富文本框内容
// handleTextBoxChange(val, targetItem) { // handleTextBoxChange(val, targetItem) {
// this.formObj[targetItem.name] = val // this.formObj[targetItem.name] = val
...@@ -374,31 +396,32 @@ export default { ...@@ -374,31 +396,32 @@ export default {
// }, // },
// 获取省 // 获取省
selectProvince(val) { selectProvince(val) {
this.infoForm.merchantAddress = '' this.formObj.merchantAddress = ''
this.infoForm.cityName = '' this.formObj.cityName = ''
this.infoForm.provinceName = val.name this.formObj.provinceName = val.name
this.infoForm.provinceCode = val.adcode this.formObj.provinceCode = val.adcode
}, },
// 获取市 // 获取市
selectCity(val) { selectCity(val) {
if (val.name) { if (val.name) {
this.infoForm.cityName = val.name this.formObj.cityName = val.name
this.infoForm.cityCode = val.adcode this.formObj.cityCode = val.adcode
} else { } else {
this.infoForm.cityName = '' this.formObj.cityName = ''
this.infoForm.cityCode = '' this.formObj.cityCode = ''
} }
this.infoForm.merchantAddress = '' this.formObj.merchantAddress = ''
}, },
// 通过地图选择省市和详细地址 // 通过地图选择省市和详细地址
selectAddressByMap(val) { selectAddressByMap(val) {
console.log(val) const { provinceName, provinceCode, cityName, cityCode, fullAddress, lat, lng } = val
const { provinceName, cityName, fullAddress, lat, lng } = val this.formObj.merchantAddress = fullAddress
this.infoForm.merchantAddress = fullAddress this.formObj.provinceName = provinceName
this.infoForm.provinceName = provinceName provinceCode && (this.formObj.provinceCode = provinceCode)
this.infoForm.cityName = cityName this.formObj.cityName = cityName
this.infoForm.lat = lat cityCode && (this.formObj.cityCode = cityCode)
this.infoForm.lng = lng this.formObj.latitude = lat
this.formObj.longitude = lng
} }
} }
} }
...@@ -568,7 +591,7 @@ export default { ...@@ -568,7 +591,7 @@ export default {
} }
/* 图片上传 */ /* 图片上传 */
.glsx-combi-form .el-tag.el-tag--info .el-tag__close { /* .glsx-combi-form .el-tag.el-tag--info .el-tag__close {
color: #e8e8ea; color: #e8e8ea;
background-color: #5850ff !important; background-color: #5850ff !important;
} }
...@@ -580,7 +603,8 @@ export default { ...@@ -580,7 +603,8 @@ export default {
} }
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover { .glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea; background-color: #e8e8ea;
} } */
.glsx-combi-form .province-sty { .glsx-combi-form .province-sty {
display: flex; display: flex;
} }
......
<template> <template>
<div v-if="provinceView"> <div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" :inline="inline" class="province" label-width="154px"> <el-form ref="provinceForm" :model="provinceForm" :inline="inline" class="province" label-width="154px">
<el-form-item :label="provinceLabel"> <el-form-item :label="provinceLabel" class="input-box">
<el-select size="small" v-model="provinceForm.provinceName" clearable placeholder="选择省份" @clear="selectProvince" class="select-padding" :style="{ width: subdistrict == 2 ? '52%' : '33.33%' }"> <el-select size="small" v-model="provinceForm.provinceName" clearable placeholder="选择省份" @clear="selectProvince" class="select-padding" :style="{ width: subdistrict == 2 ? '20%' : '33.33%' }">
<el-option v-for="(item, index) in AllData" :key="'province' + index" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option> <el-option v-for="(item, index) in AllData" :key="'province' + index" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select> </el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable placeholder="选择市" @clear="selectCity" class="select-padding" :style="{ width: subdistrict == 2 ? '52%' : '33.33%' }"> <el-select size="small" v-model="provinceForm.cityName" clearable placeholder="选择市" @clear="selectCity" class="select-padding" :style="{ width: subdistrict == 2 ? '20%' : '33.33%' }">
<el-option v-for="(item, index) in cityList" :key="'city' + index" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option> <el-option v-for="(item, index) in cityList" :key="'city' + index" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select> </el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable placeholder="选择区" @clear="selectTown" class="select-padding" :style="{ width: subdistrict == 2 ? '52%' : '33.33%' }"> <el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable placeholder="选择区" @clear="selectTown" class="select-padding" :style="{ width: subdistrict == 2 ? '20%' : '33.33%' }">
<el-option v-for="(item, index) in townList" :key="'town' + index" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option> <el-option v-for="(item, index) in townList" :key="'town' + index" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -166,28 +166,28 @@ export default { ...@@ -166,28 +166,28 @@ export default {
}, },
// 省市回显 // 省市回显
init(provinceData) { init(provinceData) {
const { province, city, townName, fullAddress, lng, lat } = provinceData // const { provinceName, cityName, townName, merchantAddress, longitude, latitude } = provinceData
this.provinceForm.provinceName = province this.provinceForm.provinceName = provinceData.provinceName
this.provinceForm.cityName = city this.provinceForm.cityName = provinceData.cityName
this.provinceForm.townName = townName this.provinceForm.townName = provinceData.townName || ''
this.provinceForm.fullAddress = fullAddress this.provinceForm.fullAddress = provinceData.merchantAddress
this.provinceForm.lng = lng this.provinceForm.lng = provinceData.longitude
this.provinceForm.lat = lat this.provinceForm.lat = provinceData.latitude
if (province) { if (provinceData.provinceName) {
this.AllData.map(item => { this.AllData.map(item => {
if (item.name.indexOf(province) != -1) { if (item.name.indexOf(provinceData.provinceName) != -1) {
this.provinceForm.provinceName = item.name this.provinceForm.provinceName = item.name
this.cityList = item.districts this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode this.provinceForm.provinceCode = item.adcode
if (city) { if (provinceData.cityName) {
this.cityList.map(itm => { this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) { if (itm.name.indexOf(provinceData.cityName) != -1) {
this.provinceForm.cityCode = itm.adcode this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name this.provinceForm.cityName = itm.name
this.townList = itm.districts this.townList = itm.districts
if (townName) { if (provinceData.townName) {
this.townList.map(itmx => { this.townList.map(itmx => {
if (itmx.name.indexOf(townName) != -1) { if (itmx.name.indexOf(provinceData.townName) != -1) {
this.provinceForm.townCode = itmx.adcode this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name this.provinceForm.townName = itmx.name
} }
......
...@@ -82,20 +82,30 @@ export default { ...@@ -82,20 +82,30 @@ export default {
} }
}, },
methods: { methods: {
brandChange() {
const brandList = this.getMerchantBrandList()
this.$emit('brandChange', brandList)
},
getMerchantBrandList() { getMerchantBrandList() {
let getCheckedNodes = this.$refs.tree.getCheckedNodes() let getCheckedNodes = this.$refs.tree.getCheckedNodes()
const getCheckedKeys = this.$refs.tree.getCheckedKeys() const getCheckedKeys = this.$refs.tree.getCheckedKeys()
const getHalfCheckedNodes = this.$refs.tree.getHalfCheckedNodes() const getHalfCheckedNodes = this.$refs.tree.getHalfCheckedNodes()
let merchantBrandList = getHalfCheckedNodes.map(car => { let merchantBrandList = getHalfCheckedNodes.map(car => {
let merchantBrandId = [] let merchantSecondBrandDetailList = []
car.children.forEach(item => { car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) { if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id) merchantSecondBrandDetailList.push({
id: item.id,
name: item.label
})
} }
}) })
return { return {
cars: car.id, merchantFirstBrandDetail: {
merchantBrandId id: car.id,
name: car.label
},
merchantSecondBrandDetailList
} }
}) })
let checkNodes = getCheckedNodes.filter(item => item.children) let checkNodes = getCheckedNodes.filter(item => item.children)
...@@ -103,19 +113,28 @@ export default { ...@@ -103,19 +113,28 @@ export default {
.filter(item => item.children === null) .filter(item => item.children === null)
.map(i => { .map(i => {
return { return {
cars: i.id merchantFirstBrandDetail: {
id: i.id,
name: i.label
}
} }
}) })
let merchantBrandList2 = checkNodes.map(car => { let merchantBrandList2 = checkNodes.map(car => {
let merchantBrandId = [] let merchantSecondBrandDetailList = []
car.children.forEach(item => { car.children.forEach(item => {
if (getCheckedKeys.includes(item.id)) { if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id) merchantSecondBrandDetailList.push({
id: item.id,
name: item.label
})
} }
}) })
return { return {
cars: car.id, merchantFirstBrandDetail: {
merchantBrandId id: car.id,
name: car.label
},
merchantSecondBrandDetailList
} }
}) })
return merchantBrandList.concat(merchantBrandList2).concat(noCheckNodes) return merchantBrandList.concat(merchantBrandList2).concat(noCheckNodes)
...@@ -129,9 +148,11 @@ export default { ...@@ -129,9 +148,11 @@ export default {
if (this.$refs.tree.getCheckedKeys().length == this.treeArr.length) { if (this.$refs.tree.getCheckedKeys().length == this.treeArr.length) {
this.checkedAll = true this.checkedAll = true
} }
this.brandChange()
}, },
getCheckList(checkArr = []) { getCheckList(checkArr = []) {
checkArr.forEach(item => (item = parseInt(item))) checkArr.forEach(item => (item = parseInt(item)))
console.log(checkArr, 'checkArr')
this.$refs.tree.setCheckedKeys(checkArr) this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => { this.$nextTick(() => {
this.handleCheck() this.handleCheck()
...@@ -165,6 +186,7 @@ export default { ...@@ -165,6 +186,7 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false
this.brandChange()
}, 1000) }, 1000)
}, },
//重置 //重置
...@@ -172,6 +194,7 @@ export default { ...@@ -172,6 +194,7 @@ export default {
this.treeArr = [] this.treeArr = []
this.checkedAll = false this.checkedAll = false
this.$refs.tree.setCheckedKeys([]) this.$refs.tree.setCheckedKeys([])
this.brandChange()
}, },
//删除 //删除
removeItem(checkItem, index) { removeItem(checkItem, index) {
...@@ -193,6 +216,7 @@ export default { ...@@ -193,6 +216,7 @@ export default {
} }
this.$nextTick(() => { this.$nextTick(() => {
this.loading = false this.loading = false
this.brandChange()
}) })
}, },
//过滤 //过滤
...@@ -211,7 +235,7 @@ export default { ...@@ -211,7 +235,7 @@ export default {
<style lang="scss"> <style lang="scss">
.brand.select-input-box { .brand.select-input-box {
width: 100%; width: 432px;
height: 38px; height: 38px;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
...@@ -244,6 +268,8 @@ export default { ...@@ -244,6 +268,8 @@ export default {
} }
} }
.tree-box { .tree-box {
box-sizing: border-box;
width: 432px;
margin-top: 10px; margin-top: 10px;
padding: 15px 15px 0px; padding: 15px 15px 0px;
background: #ffffff; background: #ffffff;
...@@ -251,6 +277,7 @@ export default { ...@@ -251,6 +277,7 @@ export default {
border-radius: 4px; border-radius: 4px;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
.tree-input { .tree-input {
width: 400px !important;
margin-bottom: 10px; margin-bottom: 10px;
} }
.filter-tree { .filter-tree {
......
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
}, },
{ {
label: '所属服务中心', label: '所属服务中心',
prop: 'partnerMerchantName' prop: 'yqMerchantName'
}, },
{ {
label: '申请时间', label: '申请时间',
......
...@@ -52,8 +52,7 @@ export default { ...@@ -52,8 +52,7 @@ export default {
SC003: 2, SC003: 2,
SC004: 3 SC004: 3
} }
this.inviteInfo.sceneList = ['SC001'] this.inviteInfo.sceneCodeList && this.inviteInfo.sceneCodeList.forEach(item => {
this.inviteInfo.sceneList.forEach(item => {
sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item]) sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item])
}) })
let params = { let params = {
......
<template>
<div class="map-box" :style="{ height: mapHeight + 'px' }">
<div id="container" style="width: 100%; height: 100%"></div>
<div class="map-address">{{ address }}</div>
<div id="myPageTop" style="position: absolute; top: 10px; width: 50%; left: 25%">
<el-input placeholder="请输入关键字" v-model="input" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="searchAddress"></el-button>
</el-input>
</div>
</div>
</template>
<script>
let map, marker, placeSearch
export default {
name: 'map',
props: {
mapHeight: {
type: Number,
default: 300
}
},
data() {
return {
input: '',
address: '',
lnglat: [],
geocoderAddress: {}
}
},
methods: {
mapInit() {
map = new AMap.Map('container', {
resizeEnable: true,
zoom: 20
})
AMap.plugin(['AMap.PlaceSearch'], function() {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
pageSize: 8, // 单页显示结果条数
pageIndex: 1, // 页码
citylimit: false, //是否强制限制在设置的城市内搜索
// panel: "panel", // 结果列表将在此容器中进行展示。
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: 'default'
})
})
// 添加列表点选监听事件
map.on('click', this.getAddress)
},
searchAddress() {
let _this = this
placeSearch.search(this.input, function(status, result) {
if (status === 'complete' && result.poiList.pois.length) {
let lnglat = result.poiList.pois[0].location
_this.getAddress(lnglat)
}
})
},
addMarker(lnglat) {
let position
if (lnglat.lng) {
position = [lnglat.lng, lnglat.lat]
} else {
position = lnglat
}
marker = new AMap.Marker({
icon: new AMap.Icon({
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
size: new AMap.Size(27, 34), //图标大小
imageSize: new AMap.Size(27, 34)
}),
position: position,
offset: new AMap.Pixel(-10, -10)
})
map.add(marker)
map.setFitView()
},
getAddress(e) {
let self = this
let lnglat
if (e.type == 'click') {
lnglat = e.lnglat
} else {
let { lng, lat } = e
lnglat = [lng, lat]
}
if (marker) {
marker.setMap(null)
marker = null
}
self.addMarker(lnglat)
AMap.plugin('AMap.Geocoder', () => {
const geocoder = new AMap.Geocoder()
geocoder.getAddress(lnglat, (status, result) => {
self.lnglat = lnglat
self.address = result.regeocode.formattedAddress
geocoder.getLocation(self.address, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
this.geocoderAddress = result.geocodes[0]
}
})
})
})
},
selectAddress(e) {
//这里获得点选地点的经纬度
this.getAddress()
}
},
mounted() {
this.mapInit()
}
}
</script>
<style scoped lang="scss">
.map-box {
position: relative;
width: 100%;
}
#container {
position: absolute;
height: 100%;
}
#panel {
position: absolute;
max-height: 90%;
overflow-y: auto;
top: 80px;
right: 10px;
width: 280px;
}
.map-address {
position: absolute;
line-height: 20px;
bottom: -30px;
}
</style>
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
methods: { methods: {
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
this.searchForm.merchantNoList = [this.detailInfo.yqMerchantId] this.searchForm.merchantNoList = [this.detailInfo.shopMerchantId]
resolve() resolve()
}) })
}, },
......
...@@ -3,9 +3,13 @@ ...@@ -3,9 +3,13 @@
<div class="edit-zone shop edit-box"> <div class="edit-zone shop edit-box">
<div class="container edit-container all-page"> <div class="container edit-container all-page">
<p class="page-title">基础信息</p> <p class="page-title">基础信息</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :isWatch="isWatch" :labelWidth="defaultLabelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="map" slot-scope="scope" class="flex">
<span class="province-icon">*</span>
<Province ref="provinceForm" :subdistrict="subdistrict" :provinceLabel="scope.scope.labelName" :inline="scope.scope.inline" @selectProvince="selectProvince" @selectCity="selectCity" @selectAddressByMap="selectAddressByMap" :detailAddressLabel="detailAddressLabel"></Province>
</div>
<div slot="business" slot-scope="scope"> <div slot="business" slot-scope="scope">
<el-select v-model="editForm[scope.name]" multiple filterable placeholder="请选择"> <el-select v-model="editForm[scope.scope.name]" multiple filterable placeholder="请选择">
<el-option-group v-for="group in baseData.sceneList" :key="group.sceneCode" :label="group.name"> <el-option-group v-for="group in baseData.sceneList" :key="group.sceneCode" :label="group.name">
<el-option v-for="item in group.productList" :key="item.productCode" :label="item.productName" :value="item.productCode"></el-option> <el-option v-for="item in group.productList" :key="item.productCode" :label="item.productName" :value="item.productCode"></el-option>
</el-option-group> </el-option-group>
...@@ -13,7 +17,7 @@ ...@@ -13,7 +17,7 @@
</div> </div>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
<GLFooter> <GLFooter class="m-t-20">
<el-button @click="handleCancel" size="medium">取消</el-button> <el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">提交</el-button> <el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">提交</el-button>
</GLFooter> </GLFooter>
...@@ -21,8 +25,12 @@ ...@@ -21,8 +25,12 @@
</template> </template>
<script> <script>
import Province from './components/province-city/index.vue'
export default { export default {
name: 'editCustomer', name: 'editCustomer',
components: {
Province
},
data() { data() {
return { return {
size: 'small', size: 'small',
...@@ -37,14 +45,27 @@ export default { ...@@ -37,14 +45,27 @@ export default {
merchantName: '', merchantName: '',
contactName: '', contactName: '',
phone: '', phone: '',
merchantBrandList: [],
productCodeList: []
}, },
editRule: { editRule: {
yqMerchantId: [{ required: true, message: '请选择所属服务中心', trigger: 'change' }], yqMerchantId: [{ required: true, message: '请选择所属服务中心', trigger: 'change' }],
merchantName: [{ required: true, message: '请输入客户名称', trigger: 'change' }], merchantName: [{ required: true, message: '请输入客户名称', trigger: 'change' }],
contactName: [{ required: true, message: '请输入联系人', trigger: 'change' }], contactName: [{ required: true, message: '请输入联系人', trigger: 'change' }],
phone: [{ required: true, message: '请输入联系电话', trigger: 'change' }], phone: [
{ required: true, message: '请输入联系电话', trigger: 'change' },
{
validator: (rule, value, callback) => {
let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的联系电话'))
},
trigger: 'blur'
}
],
productCodeList: [{ required: true, message: '请选择开通的业务', trigger: 'change' }]
}, },
isEdit: true, isEdit: true,
isWatch: false,
editFormData: [ editFormData: [
{ {
label: '所属服务中心', label: '所属服务中心',
...@@ -77,12 +98,13 @@ export default { ...@@ -77,12 +98,13 @@ export default {
// label: '', // label: '',
labelName: '地址:', labelName: '地址:',
name: '', name: '',
type: 'map', addHtml: 'map',
// type: 'map',
inline: true inline: true
}, },
{ {
label: '主营品牌', label: '主营品牌',
name: '', name: 'merchantBrandList',
type: 'brand' type: 'brand'
}, },
{ {
...@@ -94,7 +116,7 @@ export default { ...@@ -94,7 +116,7 @@ export default {
// 基本数据 // 基本数据
baseData: { baseData: {
merchantList: [] merchantList: []
} },
} }
}, },
...@@ -111,6 +133,7 @@ export default { ...@@ -111,6 +133,7 @@ export default {
this.routeInfo = this.$route.query this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : '' this.routeInfo.editType != 'add' ? this.getInfo() : ''
this.userInfo = this.$globalState.session this.userInfo = this.$globalState.session
this.isWatch = this.routeInfo.editType != 'add'
this.getServiceCenterList() this.getServiceCenterList()
this.findProByScene() this.findProByScene()
}, },
...@@ -135,9 +158,22 @@ export default { ...@@ -135,9 +158,22 @@ export default {
}, },
// 获取开通状态 // 获取开通状态
getSceneProStatus() { getSceneProStatus() {
const params = { merchant4sId: this.routeInfo.merchantInfo.yqMerchantId } const params = { merchant4sId: this.routeInfo.merchantInfo.shopMerchantId }
this.$apis.customer.getSceneProStatus(params).then(res => { this.$apis.customer.getSceneProStatus(params).then(res => {
console.log(res, '开通状态----') console.log(res, '开通状态----')
let productCodeList = []
res.forEach(item => {
item.productList.forEach(k => {
if (k.productStatus == 2) {
productCodeList.push(k.productCode)
}
})
})
this.$set(this.editForm, 'productCodeList', productCodeList)
console.log(this.editForm.productCodeList)
this.$nextTick(() => {
this.editStatus = false
})
}) })
}, },
getInfo() { getInfo() {
...@@ -147,31 +183,75 @@ export default { ...@@ -147,31 +183,75 @@ export default {
oldPhone: this.routeInfo.merchantInfo?.phone, oldPhone: this.routeInfo.merchantInfo?.phone,
oldMerchantName: this.routeInfo.merchantInfo.shopMerchantName || '' oldMerchantName: this.routeInfo.merchantInfo.shopMerchantName || ''
} }
this.$apis.customer.getMerchantInfo({ merchantId: this.routeInfo.merchantInfo.yqMerchantId }).then(res => { this.$apis.customer.getMerchantInfo({ merchantId: this.routeInfo.merchantInfo.shopMerchantId }).then(res => {
console.log(res, 'res----') console.log(res, 'res----')
console.log(this.editForm) this.editForm.provinceCode = res.provinceCode
this.editForm.provinceName = res.provinceName
this.editForm.cityCode = res.cityCode
this.editForm.cityName = res.cityName
this.editForm.latitude = res.lat
this.editForm.longitude = res.lng
this.editForm.merchantAddress = res.merchantAddress
const merchantBrandList = res.brandTreeList
this.editForm.merchantBrandList = []
this.editForm.merchantBrandIds = ''
merchantBrandList.forEach(item => {
this.editForm.merchantBrandList.push({
merchantFirstBrandDetail: {
id: item.id,
name: item.name
},
merchantSecondBrandDetailList: item.subList
})
this.editForm.merchantBrandIds = this.editForm.merchantBrandIds + item.subList.map(k => k.id).join(',')
})
this.editForm.merchantBrandIds = this.editForm.merchantBrandIds.split(',')
console.log(this.editForm, '--------------')
this.$refs.provinceForm && this.$refs.provinceForm.init(this.editForm)
this.$nextTick(() => { this.$nextTick(() => {
this.editStatus = false this.editStatus = false
}) })
}) })
}, },
hasDuplicate(arr1, arr2) {
const set1 = new Set(arr1)
for (const num of arr2) {
if (set1.has(num)) {
return true
}
}
return false
},
handleConfirm() { handleConfirm() {
console.log(this.editForm, 'this.editForm-------------')
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.$common.utils.deepClone(this.editForm) var params = this.$common.utils.deepClone(this.editForm)
// 商户类型 1-服务中心 2-客户
params.merchantType = 2
if (this.routeInfo.editType == 'edit') { if (this.routeInfo.editType == 'edit') {
params.id = this.routeInfo.id params.merchantNo = this.editForm.merchantNo
params.serviceCenterMerchantId = this.editForm.yqMerchantId
} }
params.merchantList = [] if (!this.editForm.merchantBrandList?.length) {
this.editForm.merchantList.forEach(item => { this.loading = false
params.merchantList.push({ this.$message({
merchantId: item.merchantNo, message: '请选择主营品牌',
merchantName: item.merchantName, type: 'error'
merchantAccountLevel: item.merchantAccountLevel
}) })
return
}
params.sceneList = []
this.baseData.sceneList.forEach(item => {
const productCodeIds = item.productList.map(k => k.productCode)
if (this.hasDuplicate(productCodeIds, this.editForm.productCodeList)) {
params.sceneList.push(item.sceneCode)
}
}) })
// console.log(params) console.log(params)
this.$apis.zoneList.insertZoneApi(params).then(res => { const apiName = this.routeInfo.editType == 'edit' ? 'updateMerchant' : 'createMerchant'
this.$apis.customer[apiName](params).then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : '操作失败', message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
...@@ -202,6 +282,36 @@ export default { ...@@ -202,6 +282,36 @@ export default {
} else { } else {
this.cancelJump() this.cancelJump()
} }
},
// 获取省
selectProvince(val) {
this.editForm.merchantAddress = ''
this.editForm.cityName = ''
this.editForm.provinceName = val.name
this.editForm.provinceCode = val.adcode
},
// 获取市
selectCity(val) {
if (val.name) {
this.editForm.cityName = val.name
this.editForm.cityCode = val.adcode
} else {
this.editForm.cityName = ''
this.editForm.cityCode = ''
}
this.editForm.merchantAddress = ''
},
// 通过地图选择省市和详细地址
selectAddressByMap(val) {
const { provinceName, provinceCode, cityName, cityCode, fullAddress, lat, lng } = val
this.editForm.merchantAddress = fullAddress
this.editForm.provinceName = provinceName
provinceCode && (this.editForm.provinceCode = provinceCode)
this.editForm.cityName = cityName
cityCode && (this.editForm.cityCode = cityCode)
this.editForm.latitude = lat
this.editForm.longitude = lng
} }
} }
} }
...@@ -211,4 +321,11 @@ export default { ...@@ -211,4 +321,11 @@ export default {
/* width: calc(98% - 140px); */ /* width: calc(98% - 140px); */
width: 98%; width: 98%;
} }
.province-icon {
color: #f56c6c;
position: absolute;
margin-left: 100px;
margin-top: 0px;
}
</style> </style>
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<div class="container"> <div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header"> <div class="table-header">
<h2>积分核销列表</h2> <h2>客户管理列表</h2>
<div> <div>
<el-button size="small" @click="handleEditCustomer('add')" type="primary" plain>新增客户</el-button> <el-button size="small" @click="handleEditCustomer('add')" type="primary" plain>新增客户</el-button>
<el-button size="small" @click="handleApply" type="primary">我的开店申请</el-button> <el-button size="small" @click="handleApply">我的开店申请</el-button>
</div> </div>
</div> </div>
...@@ -123,7 +123,7 @@ export default { ...@@ -123,7 +123,7 @@ export default {
{ {
label: '联系电话', label: '联系电话',
prop: 'phone', prop: 'phone',
width: '120px' width: '130px'
}, },
{ {
label: '所属服务中心', label: '所属服务中心',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!