officialAccount/pages/addjigou/where.vue

685 lines
15 KiB
Vue
Raw Normal View History

2025-06-09 17:33:50 +08:00
<template>
<div class="container">
<u-modal v-model="show" :content="content"></u-modal>
2025-06-13 13:42:14 +08:00
<u-popup v-model="popupshow" mode="bottom" border-radius="20" height="600px">
<view class="popup-father">
2025-06-09 17:33:50 +08:00
2025-06-13 13:42:14 +08:00
<view class="popup-title">
2025-06-23 17:31:43 +08:00
<view
style="display: flex; justify-content: center;align-items: center;height: 100rpx;width: 100%;position: relative;">
2025-06-13 13:42:14 +08:00
<view class="title-font">
请选择所在地区
</view>
2025-06-23 17:31:43 +08:00
<image class="title-imge" src="https://www.focusnu.com/media/directive/index/workjoin/x.png"
@click="popupshow=false" />
2025-06-13 13:42:14 +08:00
</view>
2025-06-23 17:31:43 +08:00
<view
style="height: 80rpx;width: 100%;display: flex; align-items: center;justify-content: space-between;position: relative;"
v-for="(item,index) in address">
2025-06-13 13:42:14 +08:00
<view style="margin-left: 60rpx;">
{{item.name}}
</view>
2025-06-23 17:31:43 +08:00
<image class="title-imge" style="width: 25rpx;height: 25rpx;"
src="https://www.focusnu.com/media/directive/index/workjoin/x.png"
@click="deleteUP(index)" />
2025-06-13 13:42:14 +08:00
</view>
</view>
<view style="height: 100rpx;width: 100%;">
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
</view>
<view style="height: 80rpx;width: 100%;" v-for="(item) in address">
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
</view>
<view class="other-title">
选择地区
</view>
<view v-for="(item,index) in list" :key="index" @click="clickcard(item)">
<view class="cards">
<view class="zimu">
{{item.firstLetter}}
</view>
<view class="font">
{{item.name}}
</view>
</view>
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
</view>
</view>
</u-popup>
2025-06-23 17:31:43 +08:00
<view class="title-back">
<view class="left-father" @click="goBack">
<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
<view style="font-size: 30rpx;">企业加盟</view>
</view>
</view>
2025-06-09 17:33:50 +08:00
<view class="white-content">
2025-06-23 17:31:43 +08:00
<view class="content-title">
<view class="shu"></view>
<view class="content-weight">机构信息</view>
</view>
2025-06-09 17:33:50 +08:00
<view class="white-message">
2025-06-13 13:42:14 +08:00
<view @click="openpopupshow">
2025-06-23 17:31:43 +08:00
<view class="one" style="position: relative;">
2025-06-09 17:33:50 +08:00
<view class="one-left">机构位置</view>
2025-06-13 13:42:14 +08:00
<input disabled style="cursor: not-allowed;pointer-events: none;" class="one-right" type="text"
placeholder="请选择机构位置" v-model="form.address" />
2025-06-23 17:31:43 +08:00
<image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" />
2025-06-13 13:42:14 +08:00
</view>
</view>
<view>
2025-06-23 17:31:43 +08:00
<view class="one" style="overflow: hidden;">
2025-06-13 13:42:14 +08:00
<view class="one-left">详细地址</view>
2025-06-23 17:31:43 +08:00
<input class="one-right" placeholder="请输入详细地址" v-model="form.orgAddress" />
2025-06-09 17:33:50 +08:00
</view>
</view>
<view>
<view class="one">
<view class="one-left">机构负责人</view>
<input class="one-right" type="text" placeholder="请输入机构负责人姓名" v-model="form.orgLeader" />
</view>
</view>
<view>
<view class="one">
<view class="one-left">机构负责人电话</view>
2025-06-23 17:31:43 +08:00
<input class="one-right" type="number" maxlength="11" placeholder="请输入机构负责人电话"
v-model="form.orgLeaderPhone" />
2025-06-09 17:33:50 +08:00
</view>
</view>
2025-06-23 17:31:43 +08:00
2025-06-09 17:33:50 +08:00
<view>
2025-06-23 17:31:43 +08:00
<view class="one" style="position: relative;" @click="showselect = true">
2025-06-09 17:33:50 +08:00
<view class="one-left">房屋性质</view>
2025-06-23 17:31:43 +08:00
<!-- <input class="one-right-select" type="select" placeholder="请输入房屋性质" v-model="form.orgPropertyType"
@click="showselect=true" /> -->
<input disabled style="cursor: not-allowed;pointer-events: none;" class="one-right" type="text"
placeholder="请输入房屋性质" v-model="form.orgPropertyType" />
<image class="triangle-down" src="https://www.focusnu.com/media/directive/login/xia.png" />
2025-06-09 17:33:50 +08:00
</view>
</view>
2025-06-23 17:31:43 +08:00
<u-select v-model="showselect" :list="showlist" @confirm="onSelect1"></u-select>
2025-06-09 17:33:50 +08:00
<view style="margin-bottom: 20rpx;">
<view class="one" style="position: relative;">
<view class="one-left">建筑面积</view>
2025-06-23 17:31:43 +08:00
<input class="one-right" type="digit" placeholder="请输入建筑面积(平方米)"
v-model="form.orgBuildingArea" />
<view class="triangle-down-mi">
</view>
2025-06-09 17:33:50 +08:00
</view>
</view>
</view>
</view>
2025-06-13 13:42:14 +08:00
2025-06-23 17:31:43 +08:00
<view style="display: flex;width: 100%;margin-top: 10rpx;padding: 0 20rpx;">
<view class="back-button" @click="goBack">
返回上一步
2025-06-11 17:33:34 +08:00
</view>
<view class="finish-button" @click="next">
确认并提交
</view>
2025-06-09 17:33:50 +08:00
</view>
</div>
</template>
<script setup>
import {
ref,
2025-06-11 17:33:34 +08:00
reactive,
2025-06-09 17:33:50 +08:00
} from 'vue'
import {
2025-06-11 17:33:34 +08:00
onLoad,
onShow
2025-06-09 17:33:50 +08:00
} from '@dcloudio/uni-app';
2025-06-11 17:33:34 +08:00
2025-06-09 17:33:50 +08:00
import {
base_url
} from '@/request/index.js'
2025-06-11 17:33:34 +08:00
import {
2025-06-13 13:42:14 +08:00
changemessage,
getdate
2025-06-11 17:33:34 +08:00
} from './api/addjigou.js'
2025-06-13 13:42:14 +08:00
const address = ref([])
2025-06-09 17:33:50 +08:00
const show = ref(false);
const content = ref("");
2025-06-11 17:33:34 +08:00
const jigouweizhi = ref("");
2025-06-13 13:42:14 +08:00
const popupshow = ref(false);
const list = ref([]);
2025-06-23 17:31:43 +08:00
const showselect = ref(false);
const showlist = reactive(
// [{
// value: `租赁`,
// },
// {
// value: `自由产权`,
// },
// {
// value: `合作使用`,
// } ,{
// value: `其它`,
// }
// ]
[{
value: 1,
label: '租赁'
},
{
value: 2,
label: '自由产权'
},
{
value: 3,
label: '合作使用'
},
{
value: 4,
label: '其它'
}
]
2025-06-13 13:42:14 +08:00
2025-06-23 17:31:43 +08:00
)
function onSelect1(arr) {
form.orgPropertyType = arr[0].label
}
2025-06-09 17:33:50 +08:00
const form = reactive({
2025-06-11 17:33:34 +08:00
orgLeader: "",
orgLeaderPhone: "",
2025-06-13 13:42:14 +08:00
orgAddress: "",
2025-06-11 17:33:34 +08:00
orgPropertyType: "",
orgBuildingArea: "",
2025-06-23 17:31:43 +08:00
// orgAddress: "",
2025-06-11 17:33:34 +08:00
orgCoordinateLo: "",
orgCoordinateLa: "",
id: uni.getStorageSync('specicalid') || "",
tel: uni.getStorageSync('tel'),
2025-06-23 17:31:43 +08:00
status: "1"
2025-06-09 17:33:50 +08:00
})
// 本地保存的临时文件路径
const tempImagePath = ref('')
const headImge = ref("");
const backImge = ref("");
const openLook = (res) => {
if (res) {
content.value = res;
show.value = true
}
}
2025-06-13 13:42:14 +08:00
//配置删除逻辑
function takeFirst(arr, num) {
2025-06-23 17:31:43 +08:00
// 1. 安全裁剪:确保 num 在 [0, arr.length] 范围内
const count = Math.max(0, Math.min(num, arr.length));
// 2. slice(0, count) 会返回前 count 项count=0 时即返回 []
return arr.slice(0, count);
2025-06-13 13:42:14 +08:00
}
const deleteUP = (index) => {
2025-06-23 17:31:43 +08:00
address.value = takeFirst(address.value, index);
if (index) {
clickcard(list.value[index - 1])
} else {
list.value = [];
getdate(`xzqhdm`).then(res => {
list.value = dedupeFirstLetter(res.result)
})
}
console.log("删除了", index)
2025-06-13 13:42:14 +08:00
}
2025-06-09 17:33:50 +08:00
const next = () => {
2025-06-13 13:42:14 +08:00
const allNonEmpty = form.orgLeader && form.orgLeaderPhone && form.orgAddress && form.orgPropertyType &&
form.orgBuildingArea
2025-06-11 17:33:34 +08:00
if (allNonEmpty) {
changemessage(form).then(res => {
if (res.success) {
if (res.message == `保存成功!`) {
uni.setStorageSync('specicalid', "");
uni.reLaunch({
2025-06-20 17:32:20 +08:00
url: `/pages/login/threeselectone`
2025-06-11 17:33:34 +08:00
});
} else {
uni.setStorageSync('specicalid', res.result.id);
uni.reLaunch({
2025-06-20 17:32:20 +08:00
url: `/pages/login/threeselectone`
2025-06-11 17:33:34 +08:00
});
}
} else {
uni.showToast({
title: res.message,
icon: 'error'
})
}
})
} else {
uni.showToast({
title: '请完善信息',
icon: 'error'
})
}
2025-06-09 17:33:50 +08:00
}
const goBack = () => {
2025-06-23 17:31:43 +08:00
if (form.address) {
let data = uni.getStorageSync('backhuancun')
// form.address = data.address
data.address = form.address
data.orgProvince = form.orgProvince
data.orgCity = form.orgCity
data.orgDistrict = form.orgDistrict
data.orgAddress = form.orgAddress
data.orgLeader = form.orgLeader
data.orgLeaderPhone = form.orgLeaderPhone
data.orgPropertyType = form.orgPropertyType
data.orgBuildingArea = form.orgBuildingArea
uni.setStorageSync("backhuancun", data)
}
2025-06-09 17:33:50 +08:00
uni.navigateBack()
}
const jumpToMap = () => {
uni.navigateTo({
url: "/pages/map/index"
});
}
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
const clickcard = (element) => {
2025-06-23 17:31:43 +08:00
if (address.value.length < 3) {
2025-06-13 13:42:14 +08:00
list.value = [];
address.value.push(element)
getdate(element.id).then(res => {
2025-06-23 17:31:43 +08:00
if (res.result.length) {
2025-06-13 13:42:14 +08:00
list.value = dedupeFirstLetter(res.result)
2025-06-23 17:31:43 +08:00
} else {
2025-06-13 13:42:14 +08:00
popupshow.value = false;
form.address = "";
2025-06-23 17:31:43 +08:00
address.value.forEach(res => {
2025-06-13 13:42:14 +08:00
form.address += res.name
})
const keys = ['orgProvince', 'orgCity', 'orgDistrict'];
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
keys.forEach((key, idx) => {
2025-06-23 17:31:43 +08:00
// 如果 address.value[idx] 存在就取它的 id否则用空字符串
form[key] = address.value[idx]?.id ? address.value[idx]?.id : "";
2025-06-13 13:42:14 +08:00
});
address.value = [];
list.value = [];
getdate(`xzqhdm`).then(res => {
list.value = dedupeFirstLetter(res.result)
})
}
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
})
}
2025-06-23 17:31:43 +08:00
2025-06-13 13:42:14 +08:00
}
2025-06-23 17:31:43 +08:00
const openpopupshow = () => {
popupshow.value = true;
2025-06-13 13:42:14 +08:00
}
2025-06-11 17:33:34 +08:00
onShow(() => {
// 读取并立即清除,避免下次重复拿到
const data = uni.getStorageSync('dingwei')
if (data) {
console.log("data", data)
jigouweizhi.value = data.name
form.orgAddress = data.name
form.orgCoordinateLo = data.lng
form.orgCoordinateLa = data.lat
uni.removeStorageSync('dingwei')
}
})
2025-06-13 13:42:14 +08:00
//处理首字母
function dedupeFirstLetter(arr) {
2025-06-23 17:31:43 +08:00
const seen = new Set();
return arr.map(item => {
const letter = item.firstLetter;
if (!letter || seen.has(letter)) {
// 如果没 letter 或者已经出现过,则清空
return {
...item,
firstLetter: ''
};
} else {
// 第一次出现,保留并记录
seen.add(letter);
return item;
}
});
2025-06-13 13:42:14 +08:00
}
onLoad(() => {
getdate(`xzqhdm`).then(res => {
list.value = dedupeFirstLetter(res.result)
})
2025-06-23 17:31:43 +08:00
// form.orgAddress
if (uni.getStorageSync('backhuancun').address) {
let data = uni.getStorageSync('backhuancun');
// if (data.orgProvince_dictText) {
form.address = data.address
// }
form.orgProvince = data.orgProvince;
form.orgCity = data.orgCity;
form.orgDistrict = data.orgDistrict;
form.orgAddress = data.orgAddress;
form.orgLeader = data.orgLeader;
form.orgLeaderPhone = data.orgLeaderPhone;
form.orgPropertyType = data.orgPropertyType;
form.orgBuildingArea = data.orgBuildingArea;
} else if (uni.getStorageSync('baddata')) {
2025-06-13 13:42:14 +08:00
let data = uni.getStorageSync('baddata');
2025-06-23 17:31:43 +08:00
if (data.orgProvince_dictText) {
form.address = data.orgProvince_dictText + data.orgCity_dictText + data.orgDistrict_dictText;
2025-06-13 13:42:14 +08:00
}
form.orgProvince = data.orgProvince;
form.orgCity = data.orgCity;
form.orgDistrict = data.orgDistrict;
form.orgAddress = data.orgAddress;
form.orgLeader = data.orgLeader;
form.orgLeaderPhone = data.orgLeaderPhone;
form.orgPropertyType = data.orgPropertyType;
2025-06-23 17:31:43 +08:00
form.orgBuildingArea = data.orgBuildingArea;
2025-06-13 13:42:14 +08:00
}
})
2025-06-09 17:33:50 +08:00
</script>
<style lang="scss" scoped>
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
width: 100%;
2025-06-23 17:31:43 +08:00
background-color: #F7F7F7;
2025-06-09 17:33:50 +08:00
position: relative;
2025-06-23 17:31:43 +08:00
// box-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.1);
2025-06-09 17:33:50 +08:00
.white-content {
2025-06-23 17:31:43 +08:00
width: 100%;
// margin-left: 5%;
margin-top: 20rpx;
2025-06-09 17:33:50 +08:00
// height: 1200rpx;
border-radius: 35rpx;
2025-06-23 17:31:43 +08:00
// background-color: rgb(245, 251, 254);
2025-06-09 17:33:50 +08:00
.content-title {
display: flex;
2025-06-23 17:31:43 +08:00
align-items: center;
height: 70rpx;
2025-06-09 17:33:50 +08:00
position: relative;
.content-weight {
2025-06-23 17:31:43 +08:00
font-size: 32rpx;
2025-06-09 17:33:50 +08:00
font-weight: 600;
2025-06-23 17:31:43 +08:00
margin-left: 20rpx;
// margin-top: 20rpx;
2025-06-09 17:33:50 +08:00
}
.content-img {
position: absolute;
right: 0;
top: 0;
width: 400rpx;
height: 100%;
}
}
}
.white-photo {
width: 90%;
margin-left: 5%;
// margin-top: 30rpx;
height: 300rpx;
border-radius: 35rpx;
background-color: #fff;
2025-06-23 17:31:43 +08:00
// box-shadow: 4rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
2025-06-09 17:33:50 +08:00
justify-content: space-around;
align-items: center;
display: flex;
.photo {
width: 300rpx;
height: 200rpx;
}
}
.white-message {
width: 90%;
margin-left: 5%;
2025-06-23 17:31:43 +08:00
margin-top: 10rpx;
2025-06-09 17:33:50 +08:00
margin-bottom: 30rpx;
2025-06-23 17:31:43 +08:00
padding: 30rpx 0;
2025-06-09 17:33:50 +08:00
// height: 800rpx;
border-radius: 35rpx;
background-color: #fff;
2025-06-23 17:31:43 +08:00
// box-shadow: 4rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
2025-06-09 17:33:50 +08:00
justify-content: space-around;
// align-items: center;
display: flex;
flex-direction: column;
.message-title {
width: 100%;
height: 100rpx;
align-items: center;
display: flex;
2025-06-23 17:31:43 +08:00
2025-06-09 17:33:50 +08:00
.message-weight {
font-size: 30rpx;
// font-weight: 600;
}
}
.one {
width: 90%;
margin-left: 5%;
2025-06-23 17:31:43 +08:00
// border-bottom: 1rpx solid #F7F7F7;
height: 100rpx;
2025-06-09 17:33:50 +08:00
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
.one-left {
margin-left: 10rpx;
2025-06-23 17:31:43 +08:00
font-size: 30rpx;
2025-06-09 17:33:50 +08:00
}
2025-06-23 17:31:43 +08:00
2025-06-09 17:33:50 +08:00
.one-right {
2025-06-23 17:31:43 +08:00
font-size: 30rpx;
height: 100%;
2025-06-09 17:33:50 +08:00
color: #999999;
overflow: hidden;
/* 隐藏超出内容 */
white-space: nowrap;
/* 不换行 */
font-size: 25rpx;
text-overflow: ellipsis;
2025-06-23 17:31:43 +08:00
width: 350rpx;
2025-06-09 17:33:50 +08:00
display: flex;
}
2025-06-23 17:31:43 +08:00
2025-06-09 17:33:50 +08:00
}
}
}
.photo-left {
.photo-weight {
font-size: 26rpx;
font-weight: 600;
}
.photo-font {
font-size: 23rpx;
margin-top: 10rpx;
}
}
.finish-button {
display: flex;
justify-content: center;
align-items: center;
width: 45%;
2025-06-23 17:31:43 +08:00
height: 90rpx;
2025-06-09 17:33:50 +08:00
margin: 0rpx auto;
margin-bottom: 80rpx;
color: #fff;
background: linear-gradient(to right, #00C9FF, #0076FF);
border-radius: 50rpx;
font-size: 35rpx;
}
2025-06-11 17:33:34 +08:00
.one-img {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 10rpx;
2025-06-09 17:33:50 +08:00
width: 60rpx;
height: 50rpx;
2025-06-11 17:33:34 +08:00
// margin-right: 10rpx;
// margin-left: 35rpx;
2025-06-09 17:33:50 +08:00
}
2025-06-11 17:33:34 +08:00
.pingfangmi {
2025-06-09 17:33:50 +08:00
position: absolute;
top: 50%;
right: 5rpx;
transform: translateY(-50%);
}
2025-06-11 17:33:34 +08:00
.special {
display: flex;
align-items: center;
width: 280rpx;
position: relative;
}
2025-06-13 13:42:14 +08:00
.popup-father {
width: 100%;
// height: 100%;
position: relative;
.popup-title {
position: fixed;
top: 0;
left: 0;
// background-color: red;
display: flex;
flex-direction: column;
width: 100%;
.title-font {
font-size: 35rpx;
font-weight: 600;
}
.title-imge {
width: 35rpx;
height: 35rpx;
position: absolute;
top: 50%;
right: 40rpx;
transform: translateY(-50%);
}
background-color: #fff;
z-index: 1;
}
.other-title {
font-size: 32rpx;
font-weight: 600;
margin-left: 30rpx;
margin-top: 50rpx;
}
}
2025-06-23 17:31:43 +08:00
.cards {
2025-06-13 13:42:14 +08:00
width: 100%;
display: flex;
// justify-content: center;
align-items: center;
height: 100rpx;
2025-06-23 17:31:43 +08:00
.zimu {
2025-06-13 13:42:14 +08:00
margin: 0 30rpx;
color: #d7d7d7;
width: 28rpx;
}
2025-06-23 17:31:43 +08:00
.font {
2025-06-13 13:42:14 +08:00
font-size: 30rpx;
}
}
2025-06-23 17:31:43 +08:00
.title-back {
margin-top: 100rpx;
width: 100%;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
.left-father {
display: flex;
align-items: center;
.back-img {
width: 40rpx;
height: 40rpx;
margin-left: 40rpx;
margin-right: 15rpx;
}
}
}
.back-button {
display: flex;
justify-content: center;
align-items: center;
width: 44%;
height: 90rpx;
margin: 0rpx auto;
margin-bottom: 80rpx;
border: 2rpx solid #c3cacd;
background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
border-radius: 50rpx;
font-size: 35rpx;
}
.shu {
width: 14rpx;
height: 36rpx;
background-color: #0097FF;
border-radius: 10rpx;
margin: 3rpx 5rpx 0 60rpx;
}
.triangle-down {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 26rpx;
width: 20rpx;
height: 20rpx;
}
.triangle-down-mi{
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 26rpx;
font-size: 30rpx;
}
2025-06-13 13:42:14 +08:00
</style>
<style>
.uni-scroll-view {
height: auto;
}
2025-06-09 17:33:50 +08:00
</style>