mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 01:18:54 +08:00
- 新增品牌头部与自定义步骤条,已完成步骤支持点击回跳修改 - 审核状态页改用 el-result 图标结果页(审核中/已通过/已拒绝/已关闭) - 分区标题改为主题色竖线样式,表单加宽,地址选择改为输入框样式 - 上传组件改为虚线卡片,补充上传失败与业务失败的错误提示 - 第2、3步补齐 sessionStorage 草稿保存,表单校验失败自动滚动到错误项 - 地址选择弹窗去除横向滚动,超长名称省略并支持悬停显示 - 注册 ElResult 组件;公司电话/营业执照号/法人证件号放宽为仅必填
156 lines
3.4 KiB
Vue
156 lines
3.4 KiB
Vue
<template>
|
||
<el-dialog width="800" v-model="enableMap">
|
||
<el-radio-group v-if="aMapSwitch" @change="changeMap" v-model="mapDefault">
|
||
<el-radio label="select">地区选择</el-radio>
|
||
<el-radio label="map">高德地图</el-radio>
|
||
</el-radio-group>
|
||
<div>
|
||
<div v-if="mapDefault === 'select'">
|
||
<div class="selector">
|
||
<div class="selector-item" v-for="(plant, plantIndex) in Object.keys(data)" :key="plantIndex">
|
||
<div :class="{ 'active': chiosend[plantIndex].id == item.id }" v-for="(item, index) in data[plant]"
|
||
:key="index" :title="item.name"
|
||
@click="init(item, plantIndex != Object.keys(data).length - 1 ? Object.keys(data)[plantIndex + 1] : 0, plantIndex)"
|
||
class="map-item">
|
||
{{ item.name }}
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="footer">
|
||
<el-button type="primary" @click="finished">确定</el-button>
|
||
</div>
|
||
</div>
|
||
<mapping v-if="mapDefault === 'map'" ref="map" @getAddress="getAddress" />
|
||
|
||
</div></el-dialog>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { onMounted, reactive, ref } from "vue";
|
||
import { Message } from "@/utils/message";
|
||
import { aMapSwitch } from '@/config/index'
|
||
import mapping from "@/components/map/index.vue";
|
||
import * as API_Setup from "@/api/common.js";
|
||
|
||
const emit = defineEmits(['callback'])
|
||
|
||
const enableMap = ref(false)
|
||
const mapDefault = ref("select")
|
||
const data = reactive({
|
||
province: [], //省
|
||
city: [], //市
|
||
area: [], //区
|
||
street: [], //街道
|
||
})
|
||
const chiosend = ref([])
|
||
|
||
onMounted(() => {
|
||
chiosend.value = new Array(4).fill("");
|
||
})
|
||
|
||
function open() {
|
||
enableMap.value = true
|
||
init({ id: 0 }, 'province');
|
||
}
|
||
|
||
defineExpose({ open })
|
||
|
||
function changeMap(val) {
|
||
mapDefault.value = val
|
||
}
|
||
|
||
function init(val, level = 'province', index) {
|
||
if (level == 0) {
|
||
// 说明选择到了街道,将街道id存入数组
|
||
chiosend.value.splice(3, 1, val);
|
||
}
|
||
else {
|
||
API_Setup.getRegion(val.id).then((res) => {
|
||
if (res.result.length && val.id !== 0) {
|
||
chiosend.value[index] = val
|
||
}
|
||
else if (!res.result.length) {
|
||
chiosend.value[index] = val
|
||
}
|
||
data[level] = res.result;
|
||
if (level == 'city') {
|
||
data.area = []
|
||
data.street = []
|
||
chiosend.value.splice(1, 3, "", "", "");
|
||
}
|
||
if (level == 'area') {
|
||
data.street = []
|
||
chiosend.value.splice(2, 2, "", "");
|
||
}
|
||
if (level == 'street') {
|
||
chiosend.value.splice(3, 1, "");
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
function getAddress(center) {
|
||
emit('callback', {
|
||
type: mapDefault.value,
|
||
data: center
|
||
})
|
||
enableMap.value = false;
|
||
}
|
||
|
||
// 选择完成
|
||
function finished() {
|
||
if (!chiosend.value[0]) {
|
||
Message.error("请选择地址")
|
||
return
|
||
}
|
||
const params = chiosend.value.filter((item) => item !== "" && item.value !== "");
|
||
enableMap.value = false;
|
||
emit('callback', {
|
||
type: mapDefault.value,
|
||
data: params
|
||
})
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.selector {
|
||
|
||
|
||
height: 400px;
|
||
padding: 10px 0;
|
||
display: flex;
|
||
}
|
||
|
||
.selector-item {
|
||
width: 100%;
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
overflow-x: hidden;
|
||
}
|
||
|
||
.map-item {
|
||
width: 100%;
|
||
padding: 10px;
|
||
border-bottom: 1px solid #eee;
|
||
cursor: pointer;
|
||
box-sizing: border-box;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
&:hover {
|
||
background: #eee;
|
||
}
|
||
}
|
||
|
||
.active {
|
||
background: #eee;
|
||
}
|
||
|
||
.footer {
|
||
text-align: right;
|
||
margin: 10px 0;
|
||
}
|
||
</style>
|