- 新增 back-white.svg 和 home.svg 图标文件 - 重构 YjyfNavBar 组件,默认主题改为橙色,使用 SVG 图标 - 统一各页面导航栏为自定义组件,替换原生导航栏 - 调整所有页面背景色为 #F5F6F8,统一视觉风格 - 优化渐变背景为 135deg 线性渐变,消除分层断层 - 更新 pages.json 配置,所有页面使用自定义导航样式
193 行
8.4 KiB
Vue
193 行
8.4 KiB
Vue
<template>
|
||
<view class="page">
|
||
<!-- 头部一体化沉浸大卡(单一大背景贯穿,彻底消除分层断层) -->
|
||
<view class="hero">
|
||
<YjyfNavBar theme="transparent" title="师傅入驻" :fixed="false" />
|
||
<view class="hero-body">
|
||
<text class="hero-t">师傅入驻</text>
|
||
<text class="hero-s">实名认证 + 技能认证,审核通过即可接单</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="status" v-if="info">
|
||
<text class="st-t">当前状态:{{ statusText }}</text>
|
||
<text class="st-m" v-if="info.master.audit_msg">审核意见:{{ info.master.audit_msg }}</text>
|
||
</view>
|
||
|
||
<view class="card" v-if="canEdit">
|
||
<view class="fi"><text class="fk">真实姓名</text><input class="fv" v-model="form.realname" placeholder="与身份证一致" /></view>
|
||
<view class="fi"><text class="fk">手机号</text><input class="fv" v-model="form.mobile" type="number" maxlength="11" placeholder="接单联系电话" /></view>
|
||
<view class="fi"><text class="fk">身份证号</text><input class="fv" v-model="form.idcard_no" maxlength="18" placeholder="18 位身份证号" /></view>
|
||
<view class="fi"><text class="fk">服务城市</text><input class="fv" v-model="form.city" placeholder="如:遵义市" /></view>
|
||
|
||
<view class="block-title">选择服务类目(可多选)</view>
|
||
<view class="cats">
|
||
<view v-for="c in cats" :key="c.id" class="cat" :class="{ on: skills.indexOf(c.id) > -1 }" @tap="toggleSkill(c.id)">
|
||
<text class="cat-txt">{{ c.name }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="block-title">身份证照片(加速审核)</view>
|
||
<view class="cert-grid">
|
||
<view class="cert-box clickable-hover" @tap="uploadCert('front')">
|
||
<image v-if="form.idcard_front" class="cert-img" :src="form.idcard_front" mode="aspectFill" />
|
||
<view v-else class="cert-ph">
|
||
<text class="cert-ph-t">人像面</text>
|
||
<text class="cert-ph-s">点击上传</text>
|
||
</view>
|
||
</view>
|
||
<view class="cert-box clickable-hover" @tap="uploadCert('back')">
|
||
<image v-if="form.idcard_back" class="cert-img" :src="form.idcard_back" mode="aspectFill" />
|
||
<view v-else class="cert-ph">
|
||
<text class="cert-ph-t">国徽面</text>
|
||
<text class="cert-ph-s">点击上传</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="submit" :class="{ disabled: submitting }" @tap="submit">{{ submitting ? '提交中...' : '提交审核' }}</view>
|
||
</view>
|
||
|
||
<view class="card" v-else>
|
||
<view class="li"><text class="k">真实姓名</text><text class="v">{{ info.master.realname }}</text></view>
|
||
<view class="li"><text class="k">服务城市</text><text class="v">{{ info.master.city }}</text></view>
|
||
<view class="li"><text class="k">综合评分</text><text class="v">{{ info.master.score }}</text></view>
|
||
<view class="li"><text class="k">累计订单</text><text class="v">{{ info.master.order_count }}</text></view>
|
||
<view class="go" @tap="goHall">进入订单大厅 ›</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, reactive, computed } from 'vue';
|
||
import { onShow } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
import { isLogin, toLogin, getUser } from '@/utils/request.js';
|
||
|
||
const info = ref(null);
|
||
const cats = ref([]);
|
||
const skills = ref([]);
|
||
const submitting = ref(false);
|
||
const form = reactive({ realname: '', mobile: '', idcard_no: '', city: '遵义市', idcard_front: '', idcard_back: '' });
|
||
|
||
const statusText = computed(() => {
|
||
if (!info.value || !info.value.master) return '未入驻';
|
||
const m = info.value.master;
|
||
return { pending: '待审核', pass: '已通过', reject: '未通过' }[m.verify_status] || m.verify_status;
|
||
});
|
||
const canEdit = computed(() => !info.value || !info.value.applied || info.value.master.verify_status === 'reject');
|
||
|
||
function toggleSkill(id) {
|
||
const i = skills.value.indexOf(id);
|
||
if (i > -1) skills.value.splice(i, 1);
|
||
else skills.value.push(id);
|
||
}
|
||
function goHall() { uni.redirectTo({ url: '/pages/master/hall' }); }
|
||
|
||
function uploadCert(side) {
|
||
uni.chooseImage({
|
||
count: 1,
|
||
success: async (res) => {
|
||
const temp = res.tempFilePaths[0];
|
||
uni.showLoading({ title: '证件上传中...' });
|
||
try {
|
||
const up = await api.upload(temp, 'cert');
|
||
const imgUrl = up.fullurl || up.url;
|
||
if (side === 'front') form.idcard_front = imgUrl;
|
||
else form.idcard_back = imgUrl;
|
||
} catch (e) {
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
async function load() {
|
||
if (!isLogin()) { toLogin(); return; }
|
||
const res = await api.masterInfo();
|
||
info.value = res.applied ? res : null;
|
||
if (res.applied) {
|
||
form.realname = res.master.realname;
|
||
form.mobile = res.master.mobile;
|
||
form.city = res.master.city;
|
||
form.idcard_no = res.master.idcard_no || '';
|
||
form.idcard_front = res.master.idcard_front || '';
|
||
form.idcard_back = res.master.idcard_back || '';
|
||
skills.value = (res.skills || []).map(s => s.cat_id);
|
||
} else {
|
||
const u = getUser();
|
||
if (u) form.mobile = u.mobile || '';
|
||
}
|
||
}
|
||
|
||
async function submit() {
|
||
if (submitting.value) return;
|
||
if (!form.realname || !form.mobile || !form.idcard_no) {
|
||
uni.showToast({ title: '请填写完整实名信息', icon: 'none' });
|
||
return;
|
||
}
|
||
if (!skills.value.length) {
|
||
uni.showToast({ title: '请至少选择一个服务类目', icon: 'none' });
|
||
return;
|
||
}
|
||
submitting.value = true;
|
||
try {
|
||
const payload = {
|
||
realname: form.realname,
|
||
mobile: form.mobile,
|
||
idcard_no: form.idcard_no,
|
||
city: form.city,
|
||
idcard_front: form.idcard_front,
|
||
idcard_back: form.idcard_back
|
||
};
|
||
skills.value.forEach((id, i) => { payload['skills[' + i + ']'] = id; });
|
||
await api.masterApply(payload);
|
||
uni.showToast({ title: '已提交,等待审核' });
|
||
load();
|
||
} catch (e) {
|
||
} finally {
|
||
submitting.value = false;
|
||
}
|
||
}
|
||
|
||
onShow(async () => {
|
||
await load();
|
||
const res = await api.cats();
|
||
cats.value = res.list || [];
|
||
});
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 60rpx; }
|
||
.hero { padding-bottom: 36rpx; background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%); }
|
||
.hero-body { padding: 10rpx 36rpx 0; }
|
||
.hero-t { display: block; font-size: 40rpx; font-weight: 700; color: #fff; }
|
||
.hero-s { display: block; margin-top: 10rpx; font-size: 24rpx; color: rgba(255,255,255,0.9); }
|
||
.status { margin: 22rpx 28rpx 0; padding: 20rpx 24rpx; background: #FFF7F0; border-radius: 16rpx; display: flex; flex-direction: column; }
|
||
.st-t { font-size: 26rpx; color: #C4580A; font-weight: 600; }
|
||
.st-m { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||
.card { margin: 22rpx 28rpx 0; padding: 22rpx 24rpx; background: #fff; border-radius: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
|
||
.fi { display: flex; align-items: center; min-height: 88rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||
.fk { width: 160rpx; font-size: 26rpx; color: #666; }
|
||
.fv { flex: 1; height: 88rpx; font-size: 28rpx; color: #222; }
|
||
.block-title { margin-top: 20rpx; font-size: 26rpx; font-weight: 700; color: #1F1F1F; }
|
||
.cats { display: flex; flex-wrap: wrap; padding-top: 12rpx; }
|
||
.cat { padding: 0 20rpx; line-height: 56rpx; margin: 0 12rpx 12rpx 0; border-radius: 28rpx; background: #F5F5F5; }
|
||
.cat.on { background: #FFF3E6; }
|
||
.cat-txt { font-size: 24rpx; color: #666; }
|
||
.cat.on .cat-txt { color: #E36B0C; font-weight: 600; }
|
||
.cert-grid { display: flex; gap: 20rpx; margin-top: 16rpx; }
|
||
.cert-box { flex: 1; height: 160rpx; border: 2rpx dashed #E0E0E0; border-radius: 16rpx; display: flex; align-items: center; justify-content: center; background: #FAFAFA; overflow: hidden; }
|
||
.cert-img { width: 100%; height: 100%; }
|
||
.cert-ph { display: flex; flex-direction: column; align-items: center; }
|
||
.cert-ph-t { font-size: 24rpx; font-weight: 600; color: #666; }
|
||
.cert-ph-s { font-size: 20rpx; color: #999; margin-top: 4rpx; }
|
||
.submit { height: 92rpx; margin-top: 26rpx; display: flex; align-items: center; justify-content: center; border-radius: 46rpx; color: #fff; font-size: 30rpx; font-weight: 600; background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%); }
|
||
.submit.disabled { opacity: 0.7; }
|
||
.li { display: flex; justify-content: space-between; padding: 14rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.k { font-size: 26rpx; color: #666; }
|
||
.v { font-size: 26rpx; color: #333; }
|
||
.go { margin-top: 24rpx; height: 84rpx; display: flex; align-items: center; justify-content: center; border-radius: 42rpx; background: #FFF3E6; color: #E36B0C; font-size: 28rpx; font-weight: 600; }
|
||
</style>
|