Commit 20fc3cf8 by 胡悦
2 parents 1cb01107 3ad9672b
<template>
<div class="map-box" :style="{height: mapHeight+ 'px'}">
<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%">
......@@ -11,10 +11,9 @@
</template>
<script>
import AMap from "AMap";
let map,marker, placeSearch;
let map, marker, placeSearch
export default {
name: "map",
name: 'map',
props: {
mapHeight: {
type: Number,
......@@ -24,83 +23,95 @@ export default {
data() {
return {
input: "",
address: "",
lnglat: [],
};
input: '',
address: '',
lnglat: []
}
},
methods: {
mapInit() {
map = new AMap.Map("container", {
map = new AMap.Map('container', {
resizeEnable: true,
zoom: 15,
});
AMap.plugin(["AMap.PlaceSearch"], function () {
zoom: 20
})
AMap.plugin(['AMap.PlaceSearch'], function () {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
pageSize: 8, // 单页显示结果条数
pageIndex: 1, // 页码
citylimit: false, //是否强制限制在设置的城市内搜索
map: map, // 展现结果的地图实例
// panel: "panel", // 结果列表将在此容器中进行展示。
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: "default",
});
});
renderStyle: 'default'
})
})
// 添加列表点选监听事件
map.on("click", this.getAddress);
placeSearch.on("markerClick", this.getAddress);
map.on('click', this.getAddress)
},
searchAddress() {
let _this = this
placeSearch.search(this.input, function (status, result) {
console.log(result)
if (status === 'complete' && result.poiList.pois.length) {
let lnglat = result.poiList.pois[0].location
_this.getAddress(lnglat)
}
})
},
addMarker(lnglat) {
let position = [lnglat.lng,lnglat.lat]
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(-13, -30)
});
marker.setMap(map);
addMarker(lnglat) {
let position
if (lnglat.lng) {
position = [lnglat.lng, lnglat.lat]
} else {
position = lnglat
}
console.log(position)
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") {
console.log(e)
let self = this
let lnglat
if (e.type == 'click') {
lnglat = e.lnglat
} else {
let { lng, lat } = e.data.entr_location?e.data.entr_location:e.data.location;
lnglat = [lng, lat];
let { lng, lat } = e
lnglat = [lng, lat]
}
if (marker) {
marker.setMap(null)
marker = null
}
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;
});
});
},
searchAddress() {
placeSearch.search(this.input, function (status, result) {
if (status == "complete") {
// console.log(result.poiList.pois);
}
});
AMap.plugin('AMap.Geocoder', () => {
const geocoder = new AMap.Geocoder()
geocoder.getAddress(lnglat, (status, result) => {
self.lnglat = lnglat
self.address = result.regeocode.formattedAddress
})
})
},
selectAddress(e) {
//这里获得点选地点的经纬度
this.getAddress();
this.getAddress()
}
},
mounted() {
this.mapInit();
this.mapInit()
}
};
}
</script>
<style scoped lang="scss">
......
......@@ -12,16 +12,15 @@ import apis from './api'
import './public-path'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
// import VueAMap from "vue-amap";
import VueAMap from "vue-amap";
import filters from './utils/filters' //新增过滤器
// Vue.use(VueAMap);
// // 初始化vue-amap
// VueAMap.initAMapApiLoader({
// key: "bd290dc27d0945959280753215ddda71", // 这里写你申请的高德地图的key
// plugin: ["AMap.Autocomplete", "AMap.Geocoder", "AMap.Geolocation"],
// v: "1.4.15",
// uiVersion: "1.1"
// });
Vue.use(VueAMap);
// 初始化vue-amap
VueAMap.initAMapApiLoader({
key: "bd290dc27d0945959280753215ddda71", // 这里写你申请的高德地图的key
plugin: ["AMap.PlaceSearch", "AMap.Geocoder", "AMap.Geolocation"],
v: "1.4.15"
});
Vue.config.productionTip = false
Vue.prototype.$apis = apis
start()
......
......@@ -6,23 +6,11 @@
</div>
<div class="account-body scrm-box-f">
<div class="form-title">企业基本信息</div>
<base-info
ref="baseInfoForm"
:brandData="brandData"
:accountAddForm="accountAddForm"
:businessScopeCustomize="businessScopeCustomize"
:businessOption="businessOption"
></base-info>
<base-info ref="baseInfoForm" :brandData="brandData" :accountAddForm="accountAddForm" :businessScopeCustomize="businessScopeCustomize" :businessOption="businessOption"></base-info>
</div>
<div class="account-body scrm-box-f">
<div class="form-title">账户信息</div>
<el-form
ref="accountInfoForm"
:model="accountInfoForm"
class="account-body-form"
label-width="120px"
:rules="accountInfoRules"
>
<el-form ref="accountInfoForm" :model="accountInfoForm" class="account-body-form" label-width="120px" :rules="accountInfoRules">
<el-row>
<el-col :span="12">
<el-form-item label="上级商户">
......@@ -37,71 +25,37 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="账户等级" class="level-row">
<el-select
size="small"
:disabled="nextStatus"
v-model="accountDetail.merchantAccountLevel"
placeholder="请选择"
>
<el-option
v-for="item in accountLevel"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
></el-option>
<div class="el-form-item level-row is-required">
<label class="el-form-item__label" style="width: 120px">账户等级</label>
<div class="el-form-item__content" style="margin-left: 120px">
<el-select size="small" :disabled="nextStatus" v-model="accountDetail.merchantAccountLevel" placeholder="请选择">
<el-option v-for="item in accountLevel" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="登录账户名" prop="merchantLoginAccount">
<el-input
:disabled="nextStatus"
size="small"
maxlength="15"
v-model="accountInfoForm.merchantLoginAccount"
placeholder="请输入登录账户名"
></el-input>
<el-input :disabled="nextStatus" size="small" maxlength="15" v-model="accountInfoForm.merchantLoginAccount" placeholder="请输入登录账户名"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登录密码" prop="merchantLoginPassword">
<el-input
maxlength="15"
:disabled="nextStatus"
size="small"
type="password"
v-model="accountInfoForm.merchantLoginPassword"
placeholder="请输入登录密码"
></el-input>
<el-input maxlength="15" :disabled="nextStatus" size="small" type="password" v-model="accountInfoForm.merchantLoginPassword" placeholder="请输入登录密码"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<div data-v-995a4ff0="" class="el-form-item is-required">
<label
for="merchantLoginAccount"
class="el-form-item__label"
style="width: 120px"
>账户类型</label
>
<label for="merchantLoginAccount" class="el-form-item__label" style="width: 120px">账户类型</label>
<div class="el-form-item__content" style="margin-left: 120px">
<div data-v-995a4ff0="" class="el-input el-input--small">
<auto-button
v-for="(item, index) in accountDetail.accountTypes"
:key="index"
:btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId"
:stopClick="nextStatus"
@getBtnStatus="getBtnStatus"
></auto-button>
</div>
<div class="el-form-item__error" v-if="accountTypesRule">
请选择账户类型
<auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button>
</div>
<div class="el-form-item__error" v-if="accountTypesRule">请选择账户类型</div>
</div>
</div>
</el-col>
......@@ -109,22 +63,16 @@
</el-form>
</div>
</div>
<select-product
v-show="step == 2"
ref="productForm"
title="功能权限"
></select-product>
<select-product v-show="step == 2" ref="productForm" title="功能权限"></select-product>
<div
class="footer-panel"
:style="{
left: footerLeft + 'px',
width: footerWidth + 'px',
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleNext" v-show="step == 1">下一步</el-button>
<el-button type="primary" @click="handleSave(1)" v-show="step == 2"
>存草稿</el-button
>
<el-button type="primary" @click="handleSave(1)" v-show="step == 2">存草稿</el-button>
<el-button type="primary" @click="handlePrev" v-show="step == 2">上一步</el-button>
<el-button type="primary" @click="handleSave(2)" v-show="step == 2">确定</el-button>
<el-button type="primary" @click="handleCancel">取消</el-button>
......@@ -140,50 +88,50 @@
</template>
<script>
import util from "@/utils/util";
import mapView from "@/components/mapView/index";
import autoButton from "@/components/auto-button/index";
import selectProduct from "./components/selectProduct";
import baseInfo from "./components/baseInfo";
import util from '@/utils/util'
import mapView from '@/components/mapView/index'
import autoButton from '@/components/auto-button/index'
import selectProduct from './components/selectProduct'
import baseInfo from './components/baseInfo'
export default {
name: "index",
name: 'index',
components: {
mapView,
autoButton,
selectProduct,
baseInfo,
baseInfo
},
data() {
const validatePhone = (rule, value, callback) => {
if (!util.checkPhone(value)) {
callback(new Error("请输入正确的手机号"));
callback(new Error('请输入正确的手机号'))
} else {
callback();
callback()
}
};
}
return {
nextStatus: false,
accountTypesRule: false,
filterText: "",
filterText: '',
brandData: [],
defaultProps: {
children: "children",
label: "label",
children: 'children',
label: 'label'
},
parentId: "",
parentId: '',
step: 1,
mapHeight: 400,
typeStatus: false,
loadingImg: false,
dialogMapVisible: false,
businessScopeCustomize: [{ name: "" }],
businessScopeCustomize: [{ name: '' }],
accountAddForm: {
status: "",
status: '',
merchantFiles: [],
merchantType: 1,
businessScope: [],
parentId: "",
isloginName: false,
parentId: '',
isloginName: false
},
accounttypeId: [],
accountInfoForm: {},
......@@ -192,234 +140,225 @@ export default {
businessOption: [],
accountValidityPeriod: [],
baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }],
merchantName: [{ required: true, message: '请输入商户名称', trigger: 'blur' }],
merchantLegalPersonPhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
{ validator: validatePhone, trigger: "blur" },
],
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{ validator: validatePhone, trigger: 'blur' }
]
},
accountInfoRules: {
merchantLoginAccount: [
{ required: true, message: "请输入登录账户名", trigger: "blur" },
{ min: 3, max: 15, message: "长度在 3 到 15 个字符", trigger: "blur" },
{ required: true, message: '请输入登录账户名', trigger: 'blur' },
{ min: 3, max: 15, message: '长度在 3 到 15 个字符', trigger: 'blur' }
],
merchantLoginPassword: [
{ required: true, message: "请输入登录密码", trigger: "blur" },
{ min: 6, max: 15, message: "长度在 6 到 15 个字符", trigger: "blur" },
],
},
};
{ required: true, message: '请输入登录密码', trigger: 'blur' },
{ min: 6, max: 15, message: '长度在 6 到 15 个字符', trigger: 'blur' }
]
}
}
},
methods: {
getAddress() {
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
this.dialogMapVisible = false
this.accountAddForm.merchantAddress = this.$refs.mapForm.address
},
getBtnStatus(status, value) {
this.accountTypesRule = false;
this.accountTypesRule = false
if (status) {
this.accounttypeId.push(value);
this.accounttypeId.push(value)
} else {
let idx = this.accounttypeId.findIndex((item) => item == value);
this.accounttypeId.splice(idx, 1);
let idx = this.accounttypeId.findIndex(item => item == value)
this.accounttypeId.splice(idx, 1)
}
},
handleSave(status) {
let product = this.$refs.productForm.getSelectInfo();
if (status == 2 && product && product.every((item) => item.products.length == 0)) {
this.$message.error("请选择产品");
return;
let product = this.$refs.productForm.getSelectInfo()
if (status == 2 && product && product.every(item => item.products.length == 0)) {
this.$message.error('请选择产品')
return
}
let accountTypes = JSON.stringify(product);
let accountTypes = JSON.stringify(product)
let params = {
accountTypes,
status,
merchantId: this.parentId,
};
this.$apis.store.updatePermissions(params).then((res) => {
merchantId: this.parentId
}
this.$apis.store.updatePermissions(params).then(res => {
if (res) {
this.$router.push("/account/index");
this.$router.push('/account/index')
}
});
})
},
handleCancel() {
this.$router.push("/account/index");
this.$router.push('/account/index')
},
handlePrev() {
document.querySelector("#app").scrollTop = 0;
this.step = 1;
document.querySelector('#app').scrollTop = 0
this.step = 1
},
//下一步
handleNext() {
const pm1 = new Promise((resolve, reject) => {
this.$refs.baseInfoForm.$refs.baseForm.validate((valid) => {
if (valid) resolve();
this.$refs.baseInfoForm.$refs.baseForm.validate(valid => {
if (valid) resolve()
else {
setTimeout(() => {
var isError = document.getElementsByClassName("is-error");
isError[0].querySelector("input").focus();
}, 100);
reject();
var isError = document.getElementsByClassName('is-error')
isError[0].querySelector('input').focus()
}, 100)
reject()
}
});
});
})
})
const pm2 = new Promise((resolve, reject) => {
this.$refs.accountInfoForm.validate((valid) => {
if (valid) resolve();
this.$refs.accountInfoForm.validate(valid => {
if (valid) resolve()
else {
pm1.then(() => {
document.querySelector("#app").scrollTop = 1000;
});
document.querySelector('#app').scrollTop = 1000
})
setTimeout(() => {
var isError = document.getElementsByClassName("is-error");
isError[0].querySelector("input").focus();
}, 100);
var isError = document.getElementsByClassName('is-error')
isError[0].querySelector('input').focus()
}, 100)
}
});
});
})
})
if (this.accounttypeId.length == 0) {
this.accountTypesRule = true;
return;
this.accountTypesRule = true
return
}
if (
this.accountAddForm.merchantType == 1 &&
this.accountAddForm.merchantOrgcode &&
!util.checkIdCard(this.accountAddForm.merchantOrgcode)
) {
this.$message.error("请输入正确的身份证号码");
document.querySelector("#app").scrollTop = 0;
if (this.accountAddForm.merchantType == 1 && this.accountAddForm.merchantOrgcode && !util.checkIdCard(this.accountAddForm.merchantOrgcode)) {
this.$message.error('请输入正确的身份证号码')
document.querySelector('#app').scrollTop = 0
setTimeout(() => {
var isError = document.getElementsByClassName("card-input");
isError[0].querySelectorAll(".el-input__inner")[1].focus();
}, 100);
return;
var isError = document.getElementsByClassName('card-input')
isError[0].querySelectorAll('.el-input__inner')[1].focus()
}, 100)
return
}
if (
this.accountAddForm.residentPhone &&
!util.checkPhone(this.accountAddForm.residentPhone)
) {
this.$message.error("请输入正确的驻店电话");
document.querySelector("#app").scrollTop = 0;
if (this.accountAddForm.residentPhone && !util.checkPhone(this.accountAddForm.residentPhone)) {
this.$message.error('请输入正确的驻店电话')
document.querySelector('#app').scrollTop = 0
setTimeout(() => {
var isError = document.getElementsByClassName("phone-input");
isError[0].querySelector("input").focus();
}, 100);
return;
var isError = document.getElementsByClassName('phone-input')
isError[0].querySelector('input').focus()
}, 100)
return
}
let params = Object.assign({}, this.accountAddForm, this.accountInfoForm);
let params = Object.assign({}, this.accountAddForm, this.accountInfoForm)
if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0];
params.bussinessEndtime = params.bussinessTime[1];
params.bussinessBegintime = params.bussinessTime[0]
params.bussinessEndtime = params.bussinessTime[1]
}
if (params.businessScope) {
params.businessScope = params.businessScope.join(",");
params.businessScope = params.businessScope.join(',')
}
params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree
.getCheckedKeys()
.join(",");
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel;
params.status = 1;
params.channelId = this.accountDetail.channelId;
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.accounttypeId = this.accounttypeId.join(",");
params.merchantFiles = JSON.stringify(params.merchantFiles);
params.merchantModel = this.accountDetail.merchantModel;
let merchant;
params.merchantBrand = this.$refs.baseInfoForm.$refs.brandTree.getCheckedKeys().join(',')
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0)
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel
params.status = 1
params.channelId = this.accountDetail.channelId
let businessScopeCustomize = this.businessScopeCustomize.map(item => item.name)
params.businessScopeCustomize = businessScopeCustomize.join(',')
params.accounttypeId = this.accounttypeId.join(',')
params.merchantFiles = JSON.stringify(params.merchantFiles)
params.merchantModel = this.accountDetail.merchantModel
let merchant
if (this.nextStatus) {
merchant = "updateMerchant";
params.id = this.parentId;
merchant = 'updateMerchant'
params.id = this.parentId
} else {
merchant = "saveMerchant";
merchant = 'saveMerchant'
}
document.querySelector("#app").scrollTop = 0;
document.querySelector('#app').scrollTop = 0
Promise.all([pm1, pm2]).then(() => {
this.$apis.store[merchant](params).then((res) => {
this.$apis.store[merchant](params).then(res => {
if (res) {
this.step = 2;
this.nextStatus = true;
if (typeof res == "number") {
this.parentId = res;
this.step = 2
this.nextStatus = true
if (typeof res == 'number') {
this.parentId = res
let para = {
accountlevel: this.accountDetail.merchantAccountLevel,
id: this.parentId,
parentId: this.accountAddForm.parentId,
};
this.$refs.productForm.findMenuFunTreeByMerId(para, this.accounttypeId);
parentId: this.accountAddForm.parentId
}
this.$refs.productForm.findMenuFunTreeByMerId(para, this.accounttypeId)
}
this.twoMerchantDetail(this.parentId);
this.twoMerchantDetail(this.parentId)
}
});
});
})
})
},
findAllDictData(dictType) {
var params = {
dictType,
};
this.$apis.store.findAllDictData(params).then((res) => {
dictType
}
this.$apis.store.findAllDictData(params).then(res => {
if (res) {
if (dictType == "business_scope") {
this.businessOption = res;
if (dictType == 'business_scope') {
this.businessOption = res
}
}
});
})
},
addBusinessScope() {
this.businessScopeCustomize.push({ name: "" });
this.businessScopeCustomize.push({ name: '' })
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index, 1);
this.businessScopeCustomize.splice(index, 1)
},
async findMerchantDetail() {
this.accountDetail = await this.$apis.store.findMerchantDetail({
id: this.accountAddForm.parentId,
});
this.$apis.store.findAllDictData({ dictType: "account_level" }).then((res) => {
id: this.accountAddForm.parentId
})
this.$apis.store.findAllDictData({ dictType: 'account_level' }).then(res => {
if (this.accountDetail.merchantAccountLevel == 1) {
this.accountLevel = res.filter((item) => {
return item.dictValue != 1 && item.dictValue != 3;
});
this.accountDetail.merchantAccountLevel = 2;
this.accountLevel = res.filter(item => {
return item.dictValue != 1 && item.dictValue != 3
})
this.accountDetail.merchantAccountLevel = 2
} else if (this.accountDetail.merchantAccountLevel == 2) {
this.accountLevel = res.filter((item) => {
return item.dictValue != 1 && item.dictValue != 2;
});
this.accountDetail.merchantAccountLevel = 3;
this.accountLevel = res.filter(item => {
return item.dictValue != 1 && item.dictValue != 2
})
this.accountDetail.merchantAccountLevel = 3
} else {
this.accountLevel = res.filter((item) => {
return item.dictValue == 4;
});
this.accountDetail.merchantAccountLevel = 4;
this.accountLevel = res.filter(item => {
return item.dictValue == 4
})
this.accountDetail.merchantAccountLevel = 4
}
});
})
},
twoMerchantDetail(pid) {
this.$apis.store
.findMerchantDetail({
id: pid,
id: pid
})
.then(res => {
console.log(res)
})
.then((res) => {
console.log(res);
});
},
getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => {
this.brandData = res;
});
},
this.$apis.store.getCarbrandTree({}).then(res => {
this.brandData = res
})
}
},
mounted() {
document.querySelector("#app").scrollTop = 0;
this.footerLeft = document.querySelector(".base-container-right").offsetLeft;
this.footerWidth = document.documentElement.clientWidth - this.footerLeft;
this.accountAddForm.parentId = this.$route.params.id;
this.findMerchantDetail();
this.getCarbrandTree();
this.findAllDictData("business_scope");
},
};
document.querySelector('#app').scrollTop = 0
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.accountAddForm.parentId = this.$route.params.id
this.findMerchantDetail()
this.getCarbrandTree()
this.findAllDictData('business_scope')
}
}
</script>
<style scoped lang="scss">
......
<template>
<div class="base-info">
<el-form
ref="baseForm"
:model="accountAddForm"
class="account-body-form"
label-width="120px"
:rules="baseRules"
>
<el-form ref="baseForm" :model="accountAddForm" class="account-body-form" label-width="120px" :rules="baseRules">
<el-row>
<el-col :span="12">
<el-form-item label="商户名称" prop="merchantName">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户名称"
></el-input>
<el-input size="small" v-model="accountAddForm.merchantName" placeholder="请输入商户名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商户简称">
<el-input
size="small"
v-model="accountAddForm.merchantAbbreviation"
placeholder="请输入商户简称"
></el-input>
<el-input size="small" v-model="accountAddForm.merchantAbbreviation" placeholder="请输入商户简称"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item size="small" label="商户类型" class="merchant-row">
<el-input
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入组织机构号码"
v-if="accountAddForm.merchantType == 2"
maxlength="50"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-input v-model="accountAddForm.merchantOrgcode" placeholder="请输入组织机构号码" v-if="accountAddForm.merchantType == 2" maxlength="50">
<el-select v-model="accountAddForm.merchantType" slot="prepend" placeholder="请选择">
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
maxlength="18"
class="card-input"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入正确的身份证号"
v-if="accountAddForm.merchantType == 1"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-input size="small" maxlength="18" class="card-input" v-model="accountAddForm.merchantOrgcode" placeholder="请输入正确的身份证号" v-if="accountAddForm.merchantType == 1">
<el-select v-model="accountAddForm.merchantType" slot="prepend" placeholder="请选择">
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
......@@ -68,57 +34,33 @@
<el-row>
<el-col :span="24">
<el-form-item size="small" label="商户地址" class="form-row">
<el-input readonly v-model="accountAddForm.merchantAddress"> </el-input>
<el-button type="primary" class="form-btn" @click="dialogMapVisible = true"
>选择地址</el-button
>
<el-input readonly v-model="accountAddForm.merchantAddress"></el-input>
<el-button type="primary" class="form-btn" @click="hanleSelectMap">选择地址</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话"
></el-input>
<el-checkbox v-model="accountAddForm.isloginName"
>联系电话同时作为登录账户名</el-checkbox
>
<el-input maxlength="11" size="small" v-model="accountAddForm.merchantLegalPersonPhone" placeholder="请输入联系电话"></el-input>
<el-checkbox v-model="accountAddForm.isloginName">联系电话同时作为登录账户名</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPerson"
placeholder="请输入联系人"
></el-input>
<el-input size="small" v-model="accountAddForm.merchantLegalPerson" placeholder="请输入联系人"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="驻店联系人">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人"
></el-input>
<el-input maxlength="11" size="small" v-model="accountAddForm.residentContact" placeholder="请输入驻店联系人"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驻店电话">
<el-input
maxlength="11"
size="small"
class="phone-input"
v-model="accountAddForm.residentPhone"
placeholder="请输入驻店电话"
></el-input>
<el-input maxlength="11" size="small" class="phone-input" v-model="accountAddForm.residentPhone" placeholder="请输入驻店电话"></el-input>
</el-form-item>
</el-col>
</el-row>
......@@ -126,33 +68,12 @@
<el-col :span="12">
<el-form-item label="营业范围">
<el-checkbox-group v-model="accountAddForm.businessScope">
<el-checkbox
v-for="item in businessOption"
:label="item.dictValue"
:key="item"
>{{ item.dictLabel }}</el-checkbox
>
<el-checkbox v-for="item in businessOption" :label="item.dictValue" :key="item">{{ item.dictLabel }}</el-checkbox>
</el-checkbox-group>
<div
class="scrm-flex-center"
v-for="(item, index) in businessScopeCustomize"
:key="index"
>
<el-input
size="small"
v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个"
></el-input>
<i
class="el-icon-circle-plus el-icon-btn"
@click="addBusinessScope"
v-if="index == businessScopeCustomize.length - 1"
></i>
<i
class="el-icon-remove el-icon-btn"
@click="removeBusinessScope"
v-else
></i>
<div class="scrm-flex-center" v-for="(item, index) in businessScopeCustomize" :key="index">
<el-input size="small" v-model="businessScopeCustomize[index].name" placeholder="请自定义营业范围,建议不超过10个"></el-input>
<i class="el-icon-circle-plus el-icon-btn" @click="addBusinessScope" v-if="index == businessScopeCustomize.length - 1"></i>
<i class="el-icon-remove el-icon-btn" @click="removeBusinessScope" v-else></i>
</div>
</el-form-item>
</el-col>
......@@ -160,16 +81,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="营业时间" class="open-time">
<el-time-picker
size="small"
value-format="HH:mm:ss"
is-range
v-model="accountAddForm.bussinessTime"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
></el-time-picker>
<el-time-picker size="small" value-format="HH:mm:ss" is-range v-model="accountAddForm.bussinessTime" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
</el-form-item>
</el-col>
</el-row>
......@@ -178,50 +90,22 @@
<el-form-item label="主营品牌">
<el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree">
<el-tree
:data="brandData"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
@check="clickDeal"
>
</el-tree>
<el-tree :data="brandData" show-checkbox default-expand-all node-key="id" ref="brandTree" highlight-current :props="defaultProps" :filter-node-method="filterNode" @check="clickDeal"></el-tree>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="门店照片">
<div class="store-upload-list">
<template
v-if="
accountAddForm.merchantFiles && accountAddForm.merchantFiles.length > 0
"
>
<div
:key="index"
v-for="(item, index) in accountAddForm.merchantFiles"
class="store-border"
@mouseenter="imgIndex = index"
@mouseleave="imgIndex = ''"
>
<template v-if="accountAddForm.merchantFiles && accountAddForm.merchantFiles.length > 0">
<div :key="index" v-for="(item, index) in accountAddForm.merchantFiles" class="store-border" @mouseenter="imgIndex = index" @mouseleave="imgIndex = ''">
<img :src="item.fileUrl" />
<div class="uploader-del-icon" v-if="imgIndex === index">
<i class="el-icon-delete-solid" @click.stop="delImg(index)"></i>
</div>
</div>
</template>
<el-upload
action=""
class="image-uploader"
:show-file-list="false"
list-type="picture-card"
v-loading="loadingImg"
:before-upload="upLoadImg"
>
<el-upload action="" class="image-uploader" :show-file-list="false" list-type="picture-card" v-loading="loadingImg" :before-upload="upLoadImg">
<i class="el-icon-plus"></i>
</el-upload>
</div>
......@@ -242,131 +126,140 @@
</template>
<script>
import util from "@/utils/util";
import mapView from "@/components/mapView/index";
import util from '@/utils/util'
import mapView from '@/components/mapView/index'
export default {
name: "base",
name: 'base',
components: {
mapView,
mapView
},
props: {
accountAddForm: {
type: Object,
type: Object
},
businessOption: {
type: Array,
type: Array
},
brandData: {
type: Array,
type: Array
},
businessScopeCustomize: {
type: Array,
},
type: Array
}
},
data() {
const validatePhone = (rule, value, callback) => {
if (!util.checkPhone(value)) {
callback(new Error("请输入正确的手机号"));
callback(new Error('请输入正确的手机号'))
} else {
callback();
callback()
}
};
}
return {
imgIndex: '',
filterText: "",
filterText: '',
defaultProps: {
children: "children",
label: "label",
children: 'children',
label: 'label'
},
dialogMapVisible: false,
mapHeight: 380,
baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }],
merchantName: [{ required: true, message: '请输入商户名称', trigger: 'blur' }],
merchantLegalPersonPhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
{ validator: validatePhone, trigger: "blur" },
],
},
};
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{ validator: validatePhone, trigger: 'blur' }
]
}
}
},
watch: {
filterText(val) {
this.$refs.brandTree.filter(val);
},
this.$refs.brandTree.filter(val)
}
},
methods: {
hanleSelectMap() {
this.dialogMapVisible = true
this.$nextTick(() => {
if (this.accountAddForm.merchantAddress && !this.$refs.mapForm.address) {
this.$refs.mapForm.address = this.accountAddForm.merchantAddress
this.$refs.mapForm.addMarker([this.accountAddForm.lng, this.accountAddForm.lat])
}
})
},
clickDeal() {
this.$parent.editStatus = true;
this.$parent.editStatus = true
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
if (!value) return true
return data.label.indexOf(value) !== -1
},
getAddress() {
if (!this.$refs.mapForm.address) {
this.$message.error("请选择地址");
return;
this.$message.error('请选择地址')
return
}
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
let lnglat = this.$refs.mapForm.lnglat;
this.accountAddForm.lat = lnglat.lat;
this.accountAddForm.lng = lnglat.lng;
this.dialogMapVisible = false
this.accountAddForm.merchantAddress = this.$refs.mapForm.address
let lnglat = this.$refs.mapForm.lnglat
this.accountAddForm.lat = lnglat.lat
this.accountAddForm.lng = lnglat.lng
},
delImg(index) {
this.accountAddForm.merchantFiles.splice(index, 1);
this.accountAddForm.merchantFiles.splice(index, 1)
},
addBusinessScope() {
this.businessScopeCustomize.push({ name: "" });
this.businessScopeCustomize.push({ name: '' })
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index, 1);
this.businessScopeCustomize.splice(index, 1)
},
upLoadImg(file) {
let fileName = file.name;
if (file.name.lastIndexOf(".") === -1) {
this.$message.warning("路径不正确");
return false;
let fileName = file.name
if (file.name.lastIndexOf('.') === -1) {
this.$message.warning('路径不正确')
return false
}
let AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|.swf";
let extName = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
if (AllImgExt.indexOf(extName + "|") === -1) {
this.$message.warning("图片格式不正确");
return false;
let AllImgExt = '.jpg|.jpeg|.gif|.bmp|.png|.swf'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt.indexOf(extName + '|') === -1) {
this.$message.warning('图片格式不正确')
return false
}
if(this.accountAddForm.merchantFiles.length == 3) {
this.$message.warning("最多上传3张");
return false;
if (this.accountAddForm.merchantFiles.length == 3) {
this.$message.warning('最多上传3张')
return false
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader();
let self = this;
reader.readAsDataURL(file);
reader.onload = (img) => {
console.log(file);
let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1];
let reader = new FileReader()
let self = this
reader.readAsDataURL(file)
reader.onload = img => {
console.log(file)
let type = fileName.split('.')[1]
let imgUrl = img.target.result.split(',')[1]
// self.loadingImg = true;
self.$apis.common
.pictureUpload({
file: `${type}@${imgUrl}`,
file: `${type}@${imgUrl}`
})
.then((res) => {
.then(res => {
if (res) {
self.accountAddForm.merchantFiles.push({
fileUrl: res,
fileName: "",
});
fileName: ''
})
}
});
};
})
}
}
},
}
},
mounted() {},
};
mounted() {}
}
</script>
<style scoped lang="scss">
......
......@@ -98,6 +98,9 @@ export default {
// 设置全选
var arr = tabMenu.find(i => i.accounttypeId == tabName).products.find(j => j.productId == productTab).merchantProTreeResponses
this.$refs[`tree_${tabName}_${productTab}`] ? this.$refs[`tree_${tabName}_${productTab}`][0].setCheckedKeys(this.getAllId(arr)) : ''
this.$nextTick(() => {
this.addStyle()
})
},
productClick(productId) {
this.productTab = productId
......@@ -129,9 +132,6 @@ export default {
}
})
this.tabMenu_r = util.deepClone(tabMenu)
this.$nextTick(() => {
this.addStyle()
})
this.accountTypes = tabMenu.map(item => {
return {
products: null,
......@@ -184,6 +184,7 @@ export default {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.addStyle()
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.idList)
})
}
......@@ -207,6 +208,7 @@ export default {
if (i.productId == j.productId) {
itm.productsArr.push(j)
this.$nextTick(() => {
this.addStyle()
this.$refs[`tree_${itm.accounttypeId}_${j.productId}`] ? this.$refs[`tree_${itm.accounttypeId}_${j.productId}`][0].setCheckedKeys(i.menuIds) : ''
})
}
......
......@@ -18,10 +18,10 @@
<el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-input size="small" maxlength="20" show-word-limit style="width: 40%;padding-right:50px" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
<el-input size="small" maxlength="20" style="width: 40%;padding-right:50px" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色说明" prop="roleDesc">
<el-input size="small" maxlength="50" show-word-limit style="width: 40%;padding-right:50px" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
<el-input size="small" maxlength="50" style="width: 40%;padding-right:50px" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
</el-form-item>
<!-- <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element">
......
......@@ -14,7 +14,7 @@ const cdn = {
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`,
`${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`,
'http://webapi.amap.com/maps?v=2.0&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder'
// 'https://webapi.amap.com/maps?v=1.3&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder'
]
}
module.exports = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!