mrr.sj.front/pages/shop/sj-info-change.vue

1524 lines
38 KiB
Vue
Raw Normal View History

2026-03-24 11:45:13 +08:00
<template>
<view class="store-info-page">
<!-- 顶部导航栏 -->
<custom-navbar :title="navTitle" :showBack="true"></custom-navbar>
<!-- 变更提示 -->
<view class="change-tip" v-if="editable">
<text>请变更您需要变更的信息</text>
</view>
<!-- 页面内容容器 -->
<view class="page-content" :style="{ paddingBottom: buttonAreaHeight + 'px' }">
<!-- 门店信息标题 -->
<view class="section-title">
<view class="title-bar"></view>
<text>门店信息</text>
</view>
<!-- 店铺logo -->
<view class="form-item box-cont">
<view class="label-wrapper">
<text class="label required">店铺logo</text>
<image class="label-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/25bd7f38-1a3e-4282-84ea-190d7f820108"
mode="aspectFit" @click="showTipPopup('store_logo')"></image>
</view>
<view class="upload-box" @click="chooseImage('head_photo')">
<image v-if="displayData.head_photo" :src="displayData.head_photo" mode="aspectFill"
class="logo-image"></image>
<view class="upload-placeholder" v-else>
<image src="/static/images/upload-img.png" mode="aspectFit" class="upload-icon"></image>
</view>
</view>
</view>
<!-- 店铺名称 -->
<view class="form-item-one box-cont">
<view class="label-wrapper">
<text class="label required">店铺名称</text>
<image class="label-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/25bd7f38-1a3e-4282-84ea-190d7f820108"
mode="aspectFit" @click="showTipPopup('store_name')"></image>
</view>
<input type="text" v-model="displayData.name" placeholder="请输入营业执照的店铺名称" :disabled="!editable"
placeholder-class="placeholder" class="input" />
</view>
<!-- 门店所在地 -->
<view class="form-item-two box-cont" @click="editable ? showLocationPopup() : null">
<text class="label required">门店所在地</text>
<view class="picker-content">
<text :class="displayData.dependency ? 'picker-value' : 'placeholder'">
{{displayData.dependency || '请选择'}}
</text>
<image v-if="editable"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
class="arrow-right" mode="aspectFit"></image>
</view>
</view>
<!-- 门店详细地址 -->
<view class="form-item-two box-cont" @click="getAddressInfo">
<text class="label required">门店详细地址</text>
<view class="picker-content">
<text :class="displayData.address ? 'picker-value' : 'placeholder'">
{{displayData.address || '请选择'}}
</text>
<image v-if="editable"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
class="arrow-right" mode="aspectFit"></image>
</view>
</view>
<!-- 其他信息标题 -->
<view class="section-title">
<view class="title-bar"></view>
<text>其他信息</text>
</view>
<!-- 专业经验 -->
<view class="form-item-two box-cont" @click="editable ? openExperiencePicker() : null">
<text class="label required">专业经验</text>
<view class="picker-content">
<text :class="displayData.major ? 'picker-value' : 'placeholder'">
{{displayData.experienceText || '请选择'}}
</text>
<image v-if="editable"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
class="arrow-right" mode="aspectFit"></image>
</view>
</view>
</view>
<!-- 底部按钮区域 -->
<view class="bottom-actions" ref="buttonArea">
<!-- 驳回原因提示 -->
<view class="reject-reason" v-if="shouldShowRejectReason && auditStatus === 3 && backText">
<view class="reject-title">您的提交已驳回</view>
<view class="reject-detail">驳回原因{{ backText }}</view>
</view>
<!-- 审核中提示 -->
<view class="audit-tip" v-if="showAuditTip">
<text class="audit-text">您的提交变更正在审核中...</text>
</view>
<!-- 变更信息按钮 -->
<view class="action-btn change-info-btn" v-if="buttonType === 'change'" @click="startChange">
<text class="btn-text">变更信息</text>
</view>
<!-- 取消和提交按钮 -->
<view class="action-buttons-row" v-if="buttonType === 'edit'">
<view class="action-btn cancel-btn" @click="cancelChange">
<text class="btn-text cancel-text">取消</text>
</view>
<view class="action-btn submit-btn" @click="submitChange">
<text class="btn-text">提交</text>
</view>
</view>
<!-- 查看我的变更/返回按钮 -->
<view class="action-btn view-change-btn" v-if="buttonType === 'view'" @click="togglePendingData">
<text class="btn-text">{{ showPendingData ? '返回' : '查看我的变更' }}</text>
</view>
<!-- 重新提交按钮 -->
<view class="action-btn resubmit-btn" v-if="buttonType === 'reject'" @click="startChange">
<text class="btn-text">重新提交</text>
</view>
</view>
<!-- 所在地选择弹出框 -->
<view class="popup" :class="{ show: showLocationPopupFlag }">
<view class="popup-mask" @click="hideLocationPopup"></view>
<view class="popup-content">
<view class="popup-header">
<text class="popup-title">选择所在地</text>
<text class="popup-close" @click="hideLocationPopup">×</text>
</view>
<view class="region-body">
<picker-view @change="bindChangeLocation" class="picker-scroll" :indicator-style="indicatorStyle"
:value="locationValue">
<picker-view-column>
<view class="picker-item" v-for="(item,index) in ChinaCitys" :key="index">
{{item.province}}
</view>
</picker-view-column>
<picker-view-column>
<view class="picker-item" v-for="(item,index) in locatinCitys" :key="index">
{{item.city}}
</view>
</picker-view-column>
<picker-view-column>
<view class="picker-item" v-for="(item,index) in locationAreas" :key="index">
{{item.area}}
</view>
</picker-view-column>
</picker-view>
</view>
<view class="popup-footer">
<view class="popup-btn cancel" @click="hideLocationPopup">
<text class="btn-text">取消</text>
</view>
<view class="popup-btn confirm" @click="confirmLocationSelect">
<text class="btn-text">确定</text>
</view>
</view>
</view>
</view>
<!-- 提示信息弹窗 -->
<view class="tip-popup" :class="{ show: showTipPopupFlag }">
<view class="tip-popup-mask" @click="hideTipPopup"></view>
<view class="tip-popup-content">
<image class="tip-popup-bg"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/ab410a5d-5819-47f2-a0fc-3fd6b90d6770"
mode="aspectFit"></image>
<view class="tip-popup-body">
<view class="tip-title">{{ tipTitle }}</view>
<view class="tip-image-container">
<image class="tip-image" :class="currentTipType" :src="tipImage" mode="widthFix"></image>
</view>
<view class="tip-buttons">
<view class="tip-btn cancel" @click="hideTipPopup">
<text class="btn-text">取消</text>
</view>
<view class="tip-btn confirm" @click="hideTipPopup">
<text class="btn-text">我已了解</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request';
import ChinaCitys from '../../static/data/ChinaCitys.json';
import {
debounce
} from '@/utils/debounce.js';
import uploadImage from '../../utils/uploadImage';
export default {
data() {
return {
// 页面状态
editable: false,
buttonType: 'change', // change-变更信息, edit-取消/提交, view-查看我的变更, reject-重新提交
showAuditTip: false,
auditStatus: null, // 审核状态: null-无申请, 1-审核中, 2-审核通过, 3-审核驳回
applyId: null,
showPendingData: false, // 是否显示待审核数据
navTitle: '门店信息变更',
buttonAreaHeight: 120,
backText: '', // 驳回原因
hasResubmitted: false, // 新增:标记是否已经重新提交
// 数据管理
originalData: {}, // 老数据(当前生效的)
pendingData: {}, // 新数据(待审核的)
displayData: {}, // 当前显示的数据
// 门店信息字段
ChinaCitys: ChinaCitys,
locatinCitys: [],
locationAreas: [],
locationValue: [0, 0, 0],
showLocationPopupFlag: false,
showTipPopupFlag: false,
tipTitle: '',
tipImage: '',
currentTipType: '',
userId: null,
identity: 3,
applyType: 3,
// 选择器数据
hours: Array.from({
length: 24
}, (_, i) => i < 10 ? `0${i}` : `${i}`),
minutes: Array.from({
length: 60
}, (_, i) => i < 10 ? `0${i}` : `${i}`),
indicatorStyle: 'height: 68rpx;',
// 地址相关新增字段
fromAddressPage: false,
addressListener: null,
dependency_code: '', // 区code
dependency_province: '', // 省code
dependency_city: '', // 市code
longitude: '', // 经度
latitude: '', // 纬度
}
},
computed: {
shouldShowRejectReason() {
// 强制如果审核状态不是3直接返回false
if (this.auditStatus !== 3) {
console.log('审核状态不是3直接隐藏驳回原因');
return false;
}
// 双重强制如果驳回原因为空直接返回false
if (!this.backText) {
console.log('驳回原因为空,直接隐藏驳回原因');
return false;
}
// 三重强制如果显示待审核数据直接返回false
if (this.showPendingData) {
console.log('显示待审核数据,直接隐藏驳回原因');
return false;
}
const shouldShow = this.auditStatus === 3 && !this.showPendingData && this.backText;
console.log('shouldShowRejectReason计算:', {
auditStatus: this.auditStatus,
showPendingData: this.showPendingData,
backText: this.backText,
shouldShow: shouldShow
});
// 最终强制如果不是所有条件都满足返回false
if (!(this.auditStatus === 3 && !this.showPendingData && this.backText)) {
console.log('绝对强制不满足所有条件返回false');
return false;
}
return shouldShow;
}
},
onLoad() {
// 监听地址选择事件(参考代码的实现方式)
uni.$on('address-selected-for-sj', (addressData) => {
this.handleAddressSelected(addressData);
});
console.log('页面开始加载...');
this.identity = getApp().globalData.artisanType;
console.log('当前身份类型:', this.identity);
this.getUserInfo();
this.loadApplyDetails();
this.locatinCitys = this.ChinaCitys[0].citys;
this.locationAreas = this.locatinCitys[0].areas;
},
onUnload() {
// 移除事件监听
uni.$off('address-selected-for-sj');
},
onReady() {
this.getButtonAreaHeight();
},
onShow() {
console.log('页面显示,检查地址数据');
// 检查地址数据(参考代码的实现方式)
this.checkAddressData();
if (!this.editable) {
this.loadApplyDetails();
} else {
console.log('编辑模式下,跳过自动刷新,保持当前编辑状态');
}
if (this.auditStatus !== 3) {
this.backText = '';
this.hasResubmitted = false;
}
},
onHide() {
// 页面隐藏时清理
this.fromAddressPage = false;
},
methods: {
// 检查地址数据(参考代码的方法)
checkAddressData() {
try {
const sjAddress = uni.getStorageSync('sj_selected_address');
if (sjAddress) {
this.handleAddressSelected(sjAddress);
uni.removeStorageSync('sj_selected_address');
return;
}
} catch (e) {}
if (getApp().globalData && getApp().globalData.selectedAddress) {
this.handleAddressSelected(getApp().globalData.selectedAddress);
delete getApp().globalData.selectedAddress;
}
try {
const storedAddress = uni.getStorageSync('selectedAddress');
if (storedAddress) {
this.handleAddressSelected(storedAddress);
uni.removeStorageSync('selectedAddress');
}
} catch (e) {}
},
// 获取用户信息
getUserInfo() {
console.log('开始获取用户信息...');
const type = 3;
request.post('/user/getuser', {
type: type
}).then(result => {
console.log('接口返回完整数据:', result);
if (result.state === 1 && result.data) {
const userData = result.data;
console.log('用户数据详情:', userData);
this.userId = userData.id;
// 初始化数据(包含地址相关字段)
this.originalData = {
head_photo: userData.head_photo || '',
name: userData.name || '',
dependency: userData.dependency || '',
address: userData.address || '',
major: userData.major || '',
dependency_code: userData.dependency_code || '',
dependency_province: userData.dependency_province || '',
dependency_city: userData.dependency_city || '',
longitude: userData.longitude || '',
latitude: userData.latitude || '',
experienceText: this.getExperienceText(userData.major)
};
// 同步到地址字段
this.dependency_code = userData.dependency_code || '';
this.dependency_province = userData.dependency_province || '';
this.dependency_city = userData.dependency_city || '';
this.longitude = userData.longitude || '';
this.latitude = userData.latitude || '';
// 初始化pendingData和displayData
this.pendingData = {
...this.originalData
};
this.displayData = {
...this.originalData
};
console.log('数据初始化完成');
} else {
console.warn('接口返回state不是1或data为空');
}
}).catch(error => {
console.error('获取用户信息失败:', error);
});
},
// 智能判断申请状态
intelligentStatusCheck(detail) {
// 如果申请已审核通过,直接返回通过状态
if (detail.apply_state === 2) {
console.log('智能判断:申请已审核通过,忽略历史驳回原因');
return {
isValid: true,
status: 2,
backText: ''
};
}
// 如果申请时间很旧,且用户数据已经变更,认为申请已过期
if (detail.apply_time) {
const applyDate = new Date(detail.apply_time);
const now = new Date();
const daysDiff = (now - applyDate) / (1000 * 60 * 60 * 24);
// 申请超过7天且用户数据已更新认为是历史记录
if (daysDiff > 7 && this.originalData.name !== detail.name) {
console.log('智能判断:申请记录已过期,忽略历史记录');
return {
isValid: false,
status: null,
backText: ''
};
}
}
// 正常状态
return {
isValid: true,
status: detail.apply_state,
backText: detail.back_text || ''
};
},
// 加载申请详情
async loadApplyDetails() {
try {
console.log('开始加载申请详情...');
const res = await request.post('/sj/userSjAuth/details', {
apply_type: this.applyType
});
console.log('申请详情接口返回:', res);
if (res.code === 200 && res.data) {
const detail = res.data;
// 智能状态检查
const statusCheck = this.intelligentStatusCheck(detail);
if (!statusCheck.isValid) {
// 无效的历史记录
this.auditStatus = null;
this.backText = '';
this.applyId = null;
} else {
// 有效的当前记录
this.applyId = detail.id;
this.auditStatus = statusCheck.status;
this.backText = statusCheck.backText;
console.log('审核状态:', this.auditStatus);
console.log('驳回原因:', this.backText);
// 审核通过时强制重置驳回状态
if (this.auditStatus === 2) {
console.log('审核通过,强制清除驳回相关状态');
this.backText = '';
this.hasResubmitted = false;
}
// 更新pendingData
if (this.auditStatus === 1 || this.auditStatus === 3) {
this.pendingData = {
head_photo: detail.head_photo || this.originalData.head_photo,
name: detail.name || this.originalData.name,
dependency: detail.dependency || this.originalData.dependency,
address: detail.address || this.originalData.address,
major: detail.major || this.originalData.major,
dependency_code: detail.dependency_code || this.originalData.dependency_code,
dependency_province: detail.dependency_province || this.originalData.dependency_province,
dependency_city: detail.dependency_city || this.originalData.dependency_city,
longitude: detail.longitude || this.originalData.longitude,
latitude: detail.latitude || this.originalData.latitude,
experienceText: this.getExperienceText(detail.major || this.originalData.major)
};
}
// 审核通过时同步数据
if (this.auditStatus === 2) {
this.originalData = {
...this.pendingData
};
}
}
this.updatePageStatus();
} else {
console.log('申请详情返回数据为空或code不为200:', res);
this.backText = '';
this.updatePageStatus();
}
} catch (error) {
console.error('加载申请详情失败:', error);
this.backText = '';
this.updatePageStatus();
}
},
// 更新页面状态
updatePageStatus() {
console.log('更新页面状态,审核状态:', this.auditStatus);
if (this.auditStatus !== 3) {
this.backText = '';
console.log('非驳回状态,强制清除驳回原因');
}
if (this.hasResubmitted && this.auditStatus === 3) {
console.log('检测到已重新提交,强制设置为审核中状态');
this.auditStatus = 1;
this.backText = '';
}
if (this.auditStatus === 1) {
this.showAuditTip = true;
this.buttonType = 'view';
this.editable = false;
this.showPendingData = false;
this.displayData = {
...this.originalData
};
} else if (this.auditStatus === 3) {
this.showAuditTip = false;
this.buttonType = 'reject';
this.editable = false;
this.showPendingData = false;
this.displayData = {
...this.originalData
};
} else {
this.showAuditTip = false;
this.buttonType = 'change';
this.editable = false;
this.showPendingData = false;
this.displayData = {
...this.originalData
};
}
this.updateNavTitle();
},
// 更新导航栏标题
updateNavTitle() {
if (this.editable || this.showPendingData) {
this.navTitle = '门店信息变更';
} else {
this.navTitle = '门店信息';
}
},
// 获取专业经验文本
getExperienceText(major) {
const experiences = ['', '实习', '1-3年', '3-5年', '5-10年', '10年以上'];
return experiences[major] || '';
},
// 开始变更
startChange() {
this.editable = true;
this.buttonType = 'edit';
this.displayData = {
...this.pendingData
};
console.log('进入编辑模式,显示待审核数据:', this.displayData);
this.updateNavTitle();
},
// 取消变更
cancelChange() {
this.editable = false;
this.buttonType = 'change';
this.displayData = {
...this.originalData
};
this.updateNavTitle();
},
// 切换显示待审核数据
togglePendingData() {
this.showPendingData = !this.showPendingData;
if (this.showPendingData) {
this.displayData = {
...this.pendingData
};
} else {
this.displayData = {
...this.originalData
};
}
this.updateNavTitle();
},
// 提交变更
async submitChange() {
console.log('开始提交变更...');
console.log('提交前的displayData:', this.displayData);
if (!this.validateForm()) {
return;
}
try {
uni.showLoading({
title: '提交中...'
});
this.pendingData = {
...this.displayData
};
const submitData = {
apply_type: this.applyType,
head_photo: this.displayData.head_photo,
name: this.displayData.name,
dependency: this.displayData.dependency,
address: this.displayData.address,
longitude: this.displayData.longitude,
latitude: this.displayData.latitude,
dependency_code: this.displayData.dependency_code,
dependency_province: this.displayData.dependency_province,
dependency_city: this.displayData.dependency_city,
major: this.displayData.major
};
console.log('提交的数据:', submitData);
const res = await request.post('/sj/userSjAuth/apply', submitData);
uni.hideLoading();
if (res.code === 200) {
uni.showToast({
title: '提交成功',
icon: 'none'
});
this.backText = '';
this.auditStatus = 1;
this.hasResubmitted = true;
console.log('提交成功,重置所有状态');
this.pendingData = {
...this.displayData
};
this.editable = false;
this.buttonType = 'view';
this.showAuditTip = true;
this.showPendingData = false;
setTimeout(() => {
this.loadApplyDetails();
}, 1500);
} else {
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
});
}
} catch (error) {
uni.hideLoading();
console.error('提交失败:', error);
uni.showToast({
title: '网络错误,请重试',
icon: 'none'
});
}
},
// 表单验证
validateForm() {
if (!this.displayData.head_photo) {
uni.showToast({
title: '请上传店铺logo',
icon: 'none'
});
return false;
}
if (!this.displayData.name) {
uni.showToast({
title: '请输入店铺名称',
icon: 'none'
});
return false;
}
if (!this.displayData.dependency) {
uni.showToast({
title: '请选择门店所在地',
icon: 'none'
});
return false;
}
if (!this.displayData.address) {
uni.showToast({
title: '请选择门店详细地址',
icon: 'none'
});
return false;
}
if (!this.displayData.major) {
uni.showToast({
title: '请选择专业经验',
icon: 'none'
});
return false;
}
return true;
},
// 获取按钮区域高度
getButtonAreaHeight() {
setTimeout(() => {
const query = uni.createSelectorQuery().in(this);
query.select('.bottom-actions').boundingClientRect(data => {
if (data) {
this.buttonAreaHeight = data.height + 20;
}
}).exec();
}, 100);
},
// 显示提示弹窗
showTipPopup(field) {
const tipConfig = {
'store_logo': {
title: '如何查看店铺logo',
image: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/98ad5649-db6d-4453-a308-c592fe155ed9'
},
'store_name': {
title: '如何查看店铺名称',
image: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4a2dc8c2-98d4-4465-ae31-b2ea2d13aa23'
}
};
if (tipConfig[field]) {
this.currentTipType = field;
this.tipTitle = tipConfig[field].title;
this.tipImage = tipConfig[field].image;
this.showTipPopupFlag = true;
}
},
hideTipPopup() {
this.showTipPopupFlag = false;
},
// 选择图片
chooseImage(type) {
if (!this.editable) return;
this.openCamera(type);
},
async openCamera(type) {
try {
const chooseResult = await new Promise((resolve, reject) => {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: resolve,
fail: reject
});
});
if (!chooseResult.tempFilePaths || chooseResult.tempFilePaths.length === 0) {
return;
}
const tempFilePath = chooseResult.tempFilePaths[0];
const file = {
path: tempFilePath,
size: 0
};
const result = await this.directUpload(file, this.userId, this.identity + 1);
if (result) {
this.displayData.head_photo = result;
console.log('图片上传成功head_photo 更新为:', result);
}
} catch (err) {
console.log('上传图片错误:', err);
if (!err.errMsg || !err.errMsg.includes('cancel')) {
uni.showToast({
title: '上传失败',
icon: 'none'
});
}
}
},
// 直接上传方法
async directUpload(file, userId, type) {
try {
let date = new Date().getTime();
let artisan = type == 1 ? 'yh' : type == 2 ? 'syr' : type == 3 ? 'sj' : '';
let fileExtension = 'jpg';
if (file.path.includes('.')) {
let parts = file.path.split('.');
let ext = parts[parts.length - 1].toLowerCase();
if (ext && ext.length <= 4) {
fileExtension = ext;
}
}
let name = `${userId}_${artisan}_${date}.${fileExtension}`;
console.log('安全文件名:', name);
const ossConfig = await request.post('/user/getalioss', {
type: type,
kind: 1
});
return await new Promise((resolve, reject) => {
uni.uploadFile({
url: ossConfig.host,
filePath: file.path,
name: 'file',
formData: {
key: ossConfig.dir + name,
policy: ossConfig.policy,
OSSAccessKeyId: ossConfig.ossAccessKeyId,
success_action_status: '200',
signature: ossConfig.signature
},
success: (res) => {
if (res.statusCode === 200) {
const fileUrl = `${ossConfig.host}/${ossConfig.dir}${name}`;
resolve(fileUrl);
} else {
reject(new Error('上传失败'));
}
},
fail: reject
});
});
} catch (error) {
console.error('直接上传失败:', error);
throw error;
}
},
// 所在地选择相关方法
showLocationPopup() {
if (!this.editable) return;
this.showLocationPopupFlag = true;
},
hideLocationPopup() {
this.showLocationPopupFlag = false;
},
bindChangeLocation(e) {
this.locationValue = e.detail.value;
let index1 = e.detail.value[0] || 0;
let index2 = e.detail.value[1] || 0;
this.locatinCitys = this.ChinaCitys[index1].citys;
this.locationAreas = this.locatinCitys[index2].areas;
},
confirmLocationSelect() {
let valueArr = this.locationValue;
let index1 = valueArr[0] || 0;
let index2 = valueArr[1] || 0;
let index3 = valueArr[2] || 0;
let province = this.ChinaCitys[index1].province;
let city = this.locatinCitys[index2].city;
let area = this.locationAreas[index3].area;
this.displayData.dependency = province + '-' + city + '-' + area;
// 清空详细地址,因为所在地已经改变(参考代码的做法)
this.displayData.address = '';
this.displayData.longitude = '';
this.displayData.latitude = '';
if (this.ChinaCitys[index1] && this.ChinaCitys[index1].code) {
let provinceCode = this.ChinaCitys[index1].code.toString();
this.displayData.dependency_province = provinceCode.substring(0, 6);
}
if (this.locatinCitys[index2] && this.locatinCitys[index2].code) {
let cityCode = this.locatinCitys[index2].code.toString();
this.displayData.dependency_city = cityCode.substring(0, 6);
}
if (this.locationAreas[index3] && this.locationAreas[index3].code) {
let areaCode = this.locationAreas[index3].code.toString();
this.displayData.dependency_code = areaCode.substring(0, 6);
}
this.hideLocationPopup();
},
// 获取详细地址(参考代码的实现方式)
getAddressInfo() {
if (!this.editable) {
return;
}
console.log('=== 开始地址选择流程 ===');
// 构建URL参数参考代码的实现方式
let params = 'source=sj_info';
// 如果有门店所在地添加dependency参数
if (this.displayData.dependency) {
const locationStr = encodeURIComponent(this.displayData.dependency);
params += `&dependency=${locationStr}`;
if (this.displayData.dependency_code) {
params += `&dependency_code=${this.displayData.dependency_code}`;
}
console.log('传递的地区信息:', this.displayData.dependency);
console.log('编码后的地区信息:', locationStr);
}
// 如果有已选择的地址坐标,也传递过去作为初始位置
if (this.displayData.longitude && this.displayData.latitude) {
params += `&longitude=${this.displayData.longitude}&latitude=${this.displayData.latitude}`;
}
console.log('跳转URL参数:', params);
this.fromAddressPage = true;
uni.navigateTo({
url: `/pages/address/search?${params}`,
success: () => {
console.log('成功跳转到地址选择页面');
},
fail: (err) => {
console.error('跳转地址选择页面失败:', err);
}
});
},
// 处理地址选择结果(参考代码的实现方式)
handleAddressSelected(addressData) {
if (!addressData) return;
let address = '';
if (addressData.name) {
address = addressData.name;
} else if (addressData.address) {
address = addressData.address;
}
if (!address) return;
// 更新displayData
this.displayData.address = address;
// 更新pendingData
this.pendingData.address = address;
// 更新经纬度
if (addressData.location) {
const [longitude, latitude] = addressData.location.split(',');
this.displayData.longitude = longitude || '';
this.displayData.latitude = latitude || '';
this.pendingData.longitude = longitude || '';
this.pendingData.latitude = latitude || '';
}
// 更新省市区信息
if (addressData.pname || addressData.cityname || addressData.adname) {
const locationParts = [];
if (addressData.pname) locationParts.push(addressData.pname);
if (addressData.cityname) locationParts.push(addressData.cityname);
if (addressData.adname) locationParts.push(addressData.adname);
this.displayData.dependency = locationParts.join('-');
this.pendingData.dependency = locationParts.join('-');
}
console.log('地址更新完成:', {
address: this.displayData.address,
dependency: this.displayData.dependency,
longitude: this.displayData.longitude,
latitude: this.displayData.latitude
});
// 显示成功提示
// uni.showToast({
// title: '地址已选择',
// icon: 'none',
// duration: 2000
// });
// 强制视图更新
this.$forceUpdate();
},
// 打开专业经验选择器
openExperiencePicker() {
if (!this.editable) return;
uni.showActionSheet({
itemList: ['实习', '1-3年', '3-5年', '5-10年', '10年以上'],
success: (res) => {
const experiences = ['实习', '1-3年', '3-5年', '5-10年', '10年以上'];
this.displayData.major = res.tapIndex + 1;
this.displayData.experienceText = experiences[res.tapIndex];
console.log('选择专业经验:', this.displayData.major, this.displayData.experienceText);
}
});
}
}
}
</script>
<style scoped>
.store-info-page {
padding-bottom: 20rpx;
}
.page-content {
flex: 1;
overflow-y: auto;
box-sizing: border-box;
padding: 20rpx 20rpx;
}
.change-tip {
background: #FAE7EC;
padding: 20rpx;
text-align: center;
}
.change-tip text {
font-size: 28rpx;
color: #D4131F;
}
.audit-tip {
margin: 20rpx 24rpx 20rpx 24rpx;
border-radius: 12rpx;
}
.audit-text {
font-weight: 400;
font-size: 32rpx;
color: #333333;
text-align: center;
display: block;
}
.reject-reason {
background: transparent;
padding: 24rpx;
}
.reject-title {
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #333333;
line-height: 45rpx;
text-align: center;
font-style: normal;
}
.reject-detail {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #999999;
line-height: 40rpx;
text-align: center;
font-style: normal;
margin-top: 12rpx;
}
.section-title {
display: flex;
align-items: center;
margin-bottom: 30rpx;
}
.title-bar {
width: 6rpx;
height: 30rpx;
background-color: #E8101E;
margin-right: 7rpx;
border-radius: 5rpx;
}
.section-title text {
font-size: 36rpx;
color: #1D2129;
font-weight: 400;
}
.box-cont {
background: #ffffff;
border-radius: 20rpx;
margin-bottom: 24rpx;
margin-left: 8rpx;
margin-right: 8rpx;
box-shadow: none;
}
.form-item {
padding: 24rpx;
}
.label {
display: block;
font-size: 28rpx;
color: #333333;
font-weight: 500;
}
.required::before {
content: '*';
color: #FF0000;
margin-right: 4rpx;
}
.upload-box {
display: flex;
justify-content: center;
align-items: center;
height: 160rpx;
border-radius: 20rpx;
}
.upload-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.upload-icon {
width: 120rpx;
height: 120rpx;
}
.logo-image {
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
}
.form-item-one {
display: flex;
align-items: center;
padding: 24rpx;
}
.label-wrapper {
display: inline-flex;
align-items: center;
}
.label {
font-size: 28rpx;
color: #333333;
font-weight: 500;
line-height: 1;
}
.label-icon {
width: 26rpx;
height: 26rpx;
margin-left: 8rpx;
align-items: center;
}
.form-item-two {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx;
}
.input {
flex: 1;
font-size: 28rpx;
color: #333333;
text-align: right;
}
.placeholder {
color: #999999;
}
.picker-content {
display: flex;
align-items: center;
}
.picker-value {
font-size: 28rpx;
color: #333333;
}
.arrow-right {
width: 14rpx;
height: 26rpx;
margin-left: 16rpx;
}
.bottom-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 0rpx 24rpx 40rpx 24rpx;
background: #ffffff;
z-index: 100;
}
.action-btn {
height: 88rpx;
border-radius: 43rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
font-weight: 400;
margin-top: 20rpx;
}
.change-info-btn,
.view-change-btn,
.resubmit-btn {
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
}
.action-buttons-row {
display: flex;
justify-content: space-between;
margin: 0 30rpx;
}
.action-buttons-row .action-btn {
width: 270rpx;
}
.cancel-btn {
background: #E5E5E5;
border-radius: 43rpx;
padding: 0 15rpx;
}
.submit-btn {
background: linear-gradient(180deg, #F52540 0%, #E8101E 100%, #E8101E 100%);
border-radius: 43rpx;
padding: 0 15rpx;
}
.btn-text {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 36rpx;
color: #FFFFFF;
line-height: 50rpx;
text-align: left;
font-style: normal;
}
.cancel-text {
color: #666666;
}
.popup {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
visibility: hidden;
opacity: 0;
transition: all 0.3s ease;
}
.popup.show {
visibility: visible;
opacity: 1;
}
.popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.popup-content {
position: relative;
background-color: #FFFFFF;
border-radius: 24rpx 24rpx 0 0;
padding: 32rpx;
transform: translateY(100%);
transition: transform 0.3s ease;
}
.popup.show .popup-content {
transform: translateY(0);
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
.popup-title {
font-size: 32rpx;
color: #333333;
font-weight: 500;
}
.popup-close {
font-size: 40rpx;
color: #999999;
padding: 16rpx;
}
.region-body {
height: 400rpx;
}
.picker-scroll {
height: 400rpx;
}
.picker-item {
height: 68rpx;
line-height: 68rpx;
text-align: center;
}
.popup-footer {
display: flex;
margin-top: 32rpx;
}
.popup-btn {
flex: 1;
height: 88rpx;
border-radius: 44rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 0 16rpx;
}
.popup-btn.cancel {
background-color: #F5F5F5;
}
.popup-btn.confirm {
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
}
.popup-btn .btn-text {
font-size: 32rpx;
font-weight: 500;
}
.popup-btn.cancel .btn-text {
color: #666666;
}
.popup-btn.confirm .btn-text {
color: #FFFFFF;
}
.tip-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
visibility: hidden;
opacity: 0;
transition: all 0.3s ease;
}
.tip-popup.show {
visibility: visible;
opacity: 1;
}
.tip-popup-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.tip-popup-content {
position: relative;
width: 620rpx;
height: 810rpx;
}
.tip-popup-bg {
width: 620rpx;
height: 810rpx;
position: absolute;
top: 0;
left: 0;
}
.tip-popup-body {
position: relative;
flex-direction: column;
padding: 80rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.tip-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-top: 107rpx;
margin-bottom: 37rpx;
}
.tip-image-container {
align-items: center;
justify-content: center;
margin-bottom: 50rpx;
}
.tip-image.store_logo {
width: 582rpx;
height: 327rpx;
margin-right: 0;
margin-left: -15rpx;
}
.tip-image.store_name {
width: 627rpx;
height: 327rpx;
margin-left: 13rpx;
}
.tip-buttons {
display: flex;
justify-content: space-between;
padding: 0 28rpx;
}
.tip-btn {
width: 250rpx;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
font-weight: 500;
}
.tip-btn.cancel {
border: #E8101E 2rpx solid;
background-color: transparent;
color: #e8101e;
}
.tip-btn.confirm {
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
color: #FFFFFF;
}
.tip-btn .btn-text {
color: inherit;
}
</style>