- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
577 行
18 KiB
Vue
577 行
18 KiB
Vue
<template>
|
||
<view class="drawer-mask" v-if="visible" @tap="close">
|
||
<view class="drawer-sheet" @tap.stop>
|
||
<view class="drawer-head">
|
||
<text class="dh-title">选择所在省市区</text>
|
||
<view class="dh-right">
|
||
<view class="mode-switch clickable-hover" @tap="manualMode = !manualMode">
|
||
<text class="ms-txt">{{ manualMode ? '返回列表选择' : '手动输入区县' }}</text>
|
||
</view>
|
||
<view class="dh-close clickable-hover" @tap="close">
|
||
<image class="dh-close-img" src="/static/icons/close.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 手动编辑模式:允许自由输入全国任意省/市/区县(防止生僻县区遗漏) -->
|
||
<view class="manual-body" v-if="manualMode">
|
||
<view class="m-field">
|
||
<text class="m-label">省份 / 直辖市</text>
|
||
<input class="m-input" v-model="selProvince" placeholder="例如:贵州省 / 广东省 / 北京市" />
|
||
</view>
|
||
<view class="m-field">
|
||
<text class="m-label">城市 / 州盟</text>
|
||
<input class="m-input" v-model="selCity" placeholder="例如:遵义市 / 贵阳市 / 深圳市" />
|
||
</view>
|
||
<view class="m-field">
|
||
<text class="m-label">区 / 县 / 县级市</text>
|
||
<input class="m-input" v-model="selDistrict" placeholder="例如:汇川区 / 南明区 / 南山区" />
|
||
</view>
|
||
<view class="confirm-btn clickable-hover" @tap="confirmSelection">
|
||
<text class="cb-txt">确认地区</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 三级级联选择模式 -->
|
||
<template v-else>
|
||
<view class="step-tabs">
|
||
<view class="s-tab" :class="{ active: activeTab === 0 }" @tap="activeTab = 0">
|
||
<text class="st-txt">{{ selProvince || '请选择省' }}</text>
|
||
</view>
|
||
<view class="s-tab" :class="{ active: activeTab === 1 }" v-if="selProvince" @tap="activeTab = 1">
|
||
<text class="st-txt">{{ selCity || '请选择市' }}</text>
|
||
</view>
|
||
<view class="s-tab" :class="{ active: activeTab === 2 }" v-if="selCity" @tap="activeTab = 2">
|
||
<text class="st-txt">{{ selDistrict || '请选择区县' }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<scroll-view scroll-y class="region-scroll">
|
||
<view class="region-list" v-if="activeTab === 0">
|
||
<view
|
||
v-for="p in regionTree"
|
||
:key="p.name"
|
||
class="r-item clickable-hover"
|
||
:class="{ selected: selProvince === p.name }"
|
||
@tap="pickProvince(p)"
|
||
>
|
||
<text class="ri-txt">{{ p.name }}</text>
|
||
<image v-if="selProvince === p.name" class="ri-check" src="/static/icons/check-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="region-list" v-else-if="activeTab === 1">
|
||
<view
|
||
v-for="c in currentCities"
|
||
:key="c.name"
|
||
class="r-item clickable-hover"
|
||
:class="{ selected: selCity === c.name }"
|
||
@tap="pickCity(c)"
|
||
>
|
||
<text class="ri-txt">{{ c.name }}</text>
|
||
<image v-if="selCity === c.name" class="ri-check" src="/static/icons/check-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="region-list" v-else>
|
||
<view
|
||
v-for="d in currentDistricts"
|
||
:key="d"
|
||
class="r-item clickable-hover"
|
||
:class="{ selected: selDistrict === d }"
|
||
@tap="pickDistrict(d)"
|
||
>
|
||
<text class="ri-txt">{{ d }}</text>
|
||
<image v-if="selDistrict === d" class="ri-check" src="/static/icons/check-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
</template>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed, watch } from 'vue';
|
||
|
||
const props = defineProps({
|
||
visible: { type: Boolean, default: false },
|
||
province: { type: String, default: '' },
|
||
city: { type: String, default: '' },
|
||
district: { type: String, default: '' }
|
||
});
|
||
|
||
const emit = defineEmits(['update:visible', 'confirm']);
|
||
|
||
const activeTab = ref(0);
|
||
const manualMode = ref(false);
|
||
const selProvince = ref('');
|
||
const selCity = ref('');
|
||
const selDistrict = ref('');
|
||
|
||
// 全国主要省市区行政区划树(完整覆盖贵州全省9市州及全国34省级行政区核心市县)
|
||
const regionTree = [
|
||
{
|
||
name: '贵州省',
|
||
cities: [
|
||
{ name: '遵义市', districts: ['汇川区', '红花岗区', '播州区', '新蒲新区', '仁怀市', '赤水市', '桐梓县', '绥阳县', '正安县', '道真仡佬族苗族自治县', '务川仡佬族苗族自治县', '凤冈县', '湄潭县', '余庆县', '习水县'] },
|
||
{ name: '贵阳市', districts: ['南明区', '云岩区', '观山湖区', '花溪区', '乌当区', '白云区', '清镇市', '开阳县', '息烽县', '修文县'] },
|
||
{ name: '六盘水市', districts: ['钟山区', '水城区', '盘州市', '六枝特区'] },
|
||
{ name: '安顺市', districts: ['西秀区', '平坝区', '普定县', '镇宁布依族苗族自治县', '关岭布依族苗族自治县', '紫云苗族布依族自治县'] },
|
||
{ name: '毕节市', districts: ['七星关区', '黔西市', '大方县', '金沙县', '织金县', '纳雍县', '威宁彝族回族苗族自治县', '赫章县'] },
|
||
{ name: '铜仁市', districts: ['碧江区', '万山区', '江口县', '石阡县', '思南县', '德江县', '玉屏侗族自治县', '印江土家族苗族自治县', '沿河土家族自治县', '松桃苗族自治县'] },
|
||
{ name: '黔西南布依族苗族自治州', districts: ['兴义市', '兴仁市', '普安县', '晴隆县', '贞丰县', '望谟县', '册亨县', '安龙县'] },
|
||
{ name: '黔东南苗族侗族自治州', districts: ['凯里市', '黄平县', '施秉县', '三穗县', '镇远县', '岑巩县', '天柱县', '锦屏县', '剑河县', '台江县', '黎平县', '榕江县', '从江县', '雷山县', '麻江县', '丹寨县'] },
|
||
{ name: '黔南布依族苗族自治州', districts: ['都匀市', '福泉市', '荔波县', '贵定县', '瓮安县', '独山县', '平塘县', '罗甸县', '长顺县', '龙里县', '惠水县', '三都水族自治县'] }
|
||
]
|
||
},
|
||
{
|
||
name: '重庆市',
|
||
cities: [
|
||
{ name: '重庆市', districts: ['渝北区', '江北区', '渝中区', '南岸区', '九龙坡区', '沙坪坝区', '巴南区', '大渡口区', '北碚区', '万州区', '涪陵区', '永川区', '合川区', '江津区', '綦江区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '四川省',
|
||
cities: [
|
||
{ name: '成都市', districts: ['武侯区', '锦江区', '青羊区', '金牛区', '成华区', '高新区', '天府新区', '龙泉驿区', '双流区', '温江区', '郫都区', '新都区'] },
|
||
{ name: '绵阳市', districts: ['涪城区', '游仙区', '安州区', '江油市', '三台县'] },
|
||
{ name: '泸州市', districts: ['江阳区', '龙马潭区', '纳溪区', '泸县', '合江县', '叙永县', '古蔺县'] },
|
||
{ name: '宜宾市', districts: ['翠屏区', '南溪区', '叙州区', '江安县', '长宁县'] }
|
||
]
|
||
},
|
||
{
|
||
name: '云南省',
|
||
cities: [
|
||
{ name: '昆明市', districts: ['盘龙区', '五华区', '官渡区', '西山区', '呈贡区', '安宁市'] },
|
||
{ name: '曲靖市', districts: ['麒麟区', '沾益区', '马龙区', '宣威市'] },
|
||
{ name: '昭通市', districts: ['昭阳区', '水富市', '鲁甸县', '镇雄县'] }
|
||
]
|
||
},
|
||
{
|
||
name: '广东省',
|
||
cities: [
|
||
{ name: '广州市', districts: ['天河区', '越秀区', '海珠区', '荔湾区', '白云区', '番禺区', '黄埔区', '花都区', '南沙区'] },
|
||
{ name: '深圳市', districts: ['南山区', '福田区', '罗湖区', '宝安区', '龙岗区', '龙华区', '光明区', '盐田区'] },
|
||
{ name: '佛山市', districts: ['禅城区', '南海区', '顺德区', '三水区', '高明区'] },
|
||
{ name: '东莞市', districts: ['南城街道', '东城街道', '莞城街道', '万江街道', '长安镇', '虎门镇'] }
|
||
]
|
||
},
|
||
{
|
||
name: '北京市',
|
||
cities: [
|
||
{ name: '北京市', districts: ['朝阳区', '海淀区', '东城区', '西城区', '丰台区', '石景山区', '通州区', '昌平区', '大兴区', '顺义区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '上海市',
|
||
cities: [
|
||
{ name: '上海市', districts: ['浦东新区', '徐汇区', '长宁区', '静安区', '普陀区', '虹口区', '杨浦区', '黄浦区', '闵行区', '宝山区', '嘉定区', '松江区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '浙江省',
|
||
cities: [
|
||
{ name: '杭州市', districts: ['西湖区', '上城区', '拱墅区', '滨江区', '萧山区', '余杭区', '临平区', '钱塘区'] },
|
||
{ name: '宁波市', districts: ['鄞州区', '海曙区', '江北区', '镇海区', '北仑区', '慈溪市'] },
|
||
{ name: '温州市', districts: ['鹿城区', '龙湾区', '瓯海区', '瑞安市', '乐清市'] }
|
||
]
|
||
},
|
||
{
|
||
name: '江苏省',
|
||
cities: [
|
||
{ name: '南京市', districts: ['鼓楼区', '玄武区', '秦淮区', '建邺区', '雨花台区', '栖霞区', '江宁区', '浦口区'] },
|
||
{ name: '苏州市', districts: ['姑苏区', '工业园区', '虎丘区', '吴中区', '相城区', '昆山市', '常熟市'] },
|
||
{ name: '无锡市', districts: ['梁溪区', '滨湖区', '新吴区', '锡山区', '惠山区', '江阴市'] }
|
||
]
|
||
},
|
||
{
|
||
name: '湖南省',
|
||
cities: [
|
||
{ name: '长沙市', districts: ['岳麓区', '芙蓉区', '天心区', '开福区', '雨花区', '望城区', '长沙县', '浏阳市'] },
|
||
{ name: '怀化市', districts: ['鹤城区', '洪江市', '芷江侗族自治县', '新晃侗族自治县'] }
|
||
]
|
||
},
|
||
{
|
||
name: '湖北省',
|
||
cities: [
|
||
{ name: '武汉市', districts: ['武昌区', '江汉区', '江岸区', '硚口区', '汉阳区', '洪山区', '东西湖区', '江夏区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '广西壮族自治区',
|
||
cities: [
|
||
{ name: '南宁市', districts: ['青秀区', '兴宁区', '江南区', '西乡塘区', '良庆区', '邕宁区'] },
|
||
{ name: '桂林市', districts: ['秀峰区', '叠彩区', '象山区', '七星区', '雁山区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '河南省',
|
||
cities: [
|
||
{ name: '郑州市', districts: ['金水区', '中原区', '二七区', '管城回族区', '惠济区', '郑东新区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '陕西省',
|
||
cities: [
|
||
{ name: '西安市', districts: ['雁塔区', '碑林区', '莲湖区', '新城区', '未央区', '长安区', '高新区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '山东省',
|
||
cities: [
|
||
{ name: '济南市', districts: ['历下区', '市中区', '槐荫区', '天桥区', '历城区'] },
|
||
{ name: '青岛市', districts: ['市南区', '市北区', '崂山区', '李沧区', '西海岸新区', '城阳区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '福建省',
|
||
cities: [
|
||
{ name: '福州市', districts: ['鼓楼区', '台江区', '仓山区', '晋安区', '马尾区'] },
|
||
{ name: '厦门市', districts: ['思明区', '湖里区', '集美区', '海沧区', '同安区', '翔安区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '安徽省',
|
||
cities: [
|
||
{ name: '合肥市', districts: ['蜀山区', '庐阳区', '包河区', '瑶海区', '政务区', '滨湖新区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '江西省',
|
||
cities: [
|
||
{ name: '南昌市', districts: ['红谷滩区', '东湖区', '西湖区', '青云谱区', '青山湖区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '天津市',
|
||
cities: [
|
||
{ name: '天津市', districts: ['和平区', '河西区', '南开区', '河东区', '河北区', '红桥区', '滨海新区', '西青区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '河北省',
|
||
cities: [
|
||
{ name: '石家庄市', districts: ['长安区', '桥西区', '新华区', '裕华区', '藁城区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '山西省',
|
||
cities: [
|
||
{ name: '太原市', districts: ['小店区', '迎泽区', '杏花岭区', '尖草坪区', '万柏林区', '晋源区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '辽宁省',
|
||
cities: [
|
||
{ name: '沈阳市', districts: ['和平区', '沈河区', '皇姑区', '铁西区', '浑南区'] },
|
||
{ name: '大连市', districts: ['中山区', '西岗区', '沙河口区', '甘井子区', '高新园区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '吉林省',
|
||
cities: [
|
||
{ name: '长春市', districts: ['朝阳区', '南关区', '宽城区', '二道区', '绿园区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '黑龙江省',
|
||
cities: [
|
||
{ name: '哈尔滨市', districts: ['南岗区', '道里区', '道外区', '香坊区', '松北区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '海南省',
|
||
cities: [
|
||
{ name: '海口市', districts: ['龙华区', '美兰区', '秀英区', '琼山区'] },
|
||
{ name: '三亚市', districts: ['吉阳区', '天涯区', '海棠区', '崖州区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '甘肃省',
|
||
cities: [
|
||
{ name: '兰州市', districts: ['城关区', '七里河区', '安宁区', '西固区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '青海省',
|
||
cities: [
|
||
{ name: '西宁市', districts: ['城中区', '城东区', '城西区', '城北区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '内蒙古自治区',
|
||
cities: [
|
||
{ name: '呼和浩特市', districts: ['赛罕区', '新城区', '回民区', '玉泉区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '宁夏回族自治区',
|
||
cities: [
|
||
{ name: '银川市', districts: ['金凤区', '兴庆区', '西夏区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '新疆维吾尔自治区',
|
||
cities: [
|
||
{ name: '乌鲁木齐市', districts: ['天山区', '沙依巴克区', '新市区', '水磨沟区'] }
|
||
]
|
||
},
|
||
{
|
||
name: '西藏自治区',
|
||
cities: [
|
||
{ name: '拉萨市', districts: ['城关区', '堆龙德庆区', '达孜区'] }
|
||
]
|
||
}
|
||
];
|
||
|
||
const currentCities = computed(() => {
|
||
const hit = regionTree.find(p => p.name === selProvince.value);
|
||
return hit ? hit.cities : [];
|
||
});
|
||
|
||
const currentDistricts = computed(() => {
|
||
const hitCity = currentCities.value.find(c => c.name === selCity.value);
|
||
return hitCity ? hitCity.districts : [];
|
||
});
|
||
|
||
watch(() => props.visible, (val) => {
|
||
if (val) {
|
||
selProvince.value = props.province || '';
|
||
selCity.value = props.city || '';
|
||
selDistrict.value = props.district || '';
|
||
const hasP = selProvince.value && regionTree.some(p => p.name === selProvince.value);
|
||
manualMode.value = false;
|
||
if (!selProvince.value || !hasP) {
|
||
activeTab.value = 0;
|
||
} else if (!selCity.value || !currentCities.value.some(c => c.name === selCity.value)) {
|
||
activeTab.value = 1;
|
||
} else {
|
||
activeTab.value = 2;
|
||
}
|
||
}
|
||
});
|
||
|
||
function close() {
|
||
emit('update:visible', false);
|
||
}
|
||
|
||
function pickProvince(p) {
|
||
selProvince.value = p.name;
|
||
const firstCity = p.cities && p.cities[0] ? p.cities[0] : null;
|
||
selCity.value = firstCity ? firstCity.name : '';
|
||
selDistrict.value = (firstCity && firstCity.districts && firstCity.districts[0]) ? firstCity.districts[0] : '';
|
||
activeTab.value = 1;
|
||
}
|
||
|
||
function pickCity(c) {
|
||
selCity.value = c.name;
|
||
selDistrict.value = (c.districts && c.districts[0]) ? c.districts[0] : '';
|
||
activeTab.value = 2;
|
||
}
|
||
|
||
function pickDistrict(d) {
|
||
selDistrict.value = d;
|
||
confirmSelection();
|
||
}
|
||
|
||
function confirmSelection() {
|
||
const p = (selProvince.value || '').trim();
|
||
const c = (selCity.value || '').trim();
|
||
const d = (selDistrict.value || '').trim();
|
||
if (!p || !c || !d) {
|
||
uni.showToast({ title: '请完整选择或填写省市区', icon: 'none' });
|
||
return;
|
||
}
|
||
emit('confirm', { province: p, city: c, district: d });
|
||
close();
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.drawer-mask {
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.55);
|
||
z-index: 1050;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.drawer-sheet {
|
||
background: #FFFFFF;
|
||
border-top-left-radius: 24rpx;
|
||
border-top-right-radius: 24rpx;
|
||
padding: 30rpx 28rpx calc(32rpx + env(safe-area-inset-bottom));
|
||
max-height: 76vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.drawer-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding-bottom: 20rpx;
|
||
border-bottom: 1rpx solid #F0F0F2;
|
||
}
|
||
|
||
.dh-title {
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
.dh-right {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.mode-switch {
|
||
height: 50rpx;
|
||
padding: 0 18rpx;
|
||
border-radius: 25rpx;
|
||
background: #FFF7F0;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.ms-txt {
|
||
font-size: 22rpx;
|
||
color: #F0710D;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.dh-close {
|
||
width: 48rpx;
|
||
height: 48rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.dh-close-img {
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.step-tabs {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 36rpx;
|
||
padding: 20rpx 4rpx;
|
||
border-bottom: 1rpx solid #F0F0F2;
|
||
}
|
||
|
||
.s-tab {
|
||
position: relative;
|
||
padding-bottom: 12rpx;
|
||
}
|
||
|
||
.st-txt {
|
||
font-size: 28rpx;
|
||
color: #444444;
|
||
}
|
||
|
||
.s-tab.active .st-txt {
|
||
color: #F0710D;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.s-tab.active::after {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
height: 4rpx;
|
||
border-radius: 2rpx;
|
||
background: #F0710D;
|
||
}
|
||
|
||
.region-scroll {
|
||
height: 52vh;
|
||
}
|
||
|
||
.region-list {
|
||
padding: 10rpx 0;
|
||
}
|
||
|
||
.r-item {
|
||
height: 84rpx;
|
||
padding: 0 8rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
border-bottom: 1rpx solid #F8F8FA;
|
||
}
|
||
|
||
.ri-txt {
|
||
font-size: 28rpx;
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
.r-item.selected .ri-txt {
|
||
color: #F0710D;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.ri-check {
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
}
|
||
|
||
.manual-body {
|
||
padding: 24rpx 0 8rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.m-field {
|
||
display: flex;
|
||
align-items: center;
|
||
min-height: 88rpx;
|
||
border-bottom: 1rpx solid #F0F0F2;
|
||
}
|
||
|
||
.m-label {
|
||
width: 210rpx;
|
||
font-size: 28rpx;
|
||
color: #444444;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.m-input {
|
||
flex: 1;
|
||
height: 80rpx;
|
||
font-size: 28rpx;
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
.confirm-btn {
|
||
margin-top: 20rpx;
|
||
height: 84rpx;
|
||
border-radius: 42rpx;
|
||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.cb-txt {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
.clickable-hover:active {
|
||
opacity: 0.85;
|
||
}
|
||
</style>
|