feat(ui): 登录起全链路页面接通 + 逐页面验证(47 项)+ 修复订单列表越权泄漏
前端: - utils/request.js 统一请求层(token/错误码/401 引导登录) - utils/api.js 接口清单(与后端控制器一一对应) - pages/login 登录(手机号+验证码+角色选择) - pages/service/list|detail 服务列表/详情 - pages/order/create 下单(地址/预约/急单/费用试算/自动支付) - pages/order/list|detail|review 订单列表/详情轨迹/评价 - pages/master/apply|hall|orders 师傅入驻/订单大厅/接单履约 - YJYF/YJYF 首页接 home/index 真实类目 + 路由跳转 后端 Bug 修复(严重): - TP5 中 count() 会重置查询条件,导致 Order::index / Master::hall / Master::orders 在 select 时丢失 where 条件 → 泄漏全部用户订单/跨用户数据 - 改为闭包重建查询,已验证修复
这个提交包含在:
137
pages/master/apply.vue
普通文件
137
pages/master/apply.vue
普通文件
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="hero">
|
||||
<text class="hero-t">师傅入驻</text>
|
||||
<text class="hero-s">实名认证 + 技能认证,审核通过即可接单</text>
|
||||
</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="hint">证件与技能证书照片上传将在正式版接入 chooseMedia</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: '遵义市' });
|
||||
|
||||
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' }); }
|
||||
|
||||
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;
|
||||
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 };
|
||||
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: 40rpx 36rpx; background: linear-gradient(160deg, #FFB85C 0%, #F98D25 60%, #ED6F0E 100%); }
|
||||
.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; }
|
||||
.hint { margin-top: 14rpx; font-size: 20rpx; color: #BDBDBD; line-height: 30rpx; }
|
||||
.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>
|
||||
|
||||
119
pages/master/hall.vue
普通文件
119
pages/master/hall.vue
普通文件
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="top">
|
||||
<view class="top-l">
|
||||
<text class="top-t">订单大厅</text>
|
||||
<text class="top-s">{{ info ? '评分 ' + info.score + ' · 完成 ' + info.order_count + ' 单' : '加载中' }}</text>
|
||||
</view>
|
||||
<view class="switch" :class="{ off: info && info.work_status === 'off' }" @tap="toggleWork">
|
||||
<text class="switch-t">{{ info && info.work_status === 'off' ? '已暂停接单' : '接单中' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view class="item" v-for="o in list" :key="o.id">
|
||||
<view class="hd">
|
||||
<text class="tag-urgent" v-if="Number(o.urgent)">急单</text>
|
||||
<text class="svc">{{ o.service_name }}</text>
|
||||
<text class="amt">¥{{ o.pay_amount }}</text>
|
||||
</view>
|
||||
<view class="bd">
|
||||
<text class="addr">{{ o.address }}</text>
|
||||
<text class="meta">楼层 {{ o.floor }} 层 · {{ Number(o.has_elevator) ? '有电梯' : '无电梯' }} · 预约 {{ o.appoint_text }}</text>
|
||||
<text class="meta" v-if="o.goods_model">型号:{{ o.goods_model }}</text>
|
||||
<text class="meta" v-if="o.remark">备注:{{ o.remark }}</text>
|
||||
</view>
|
||||
<view class="ft">
|
||||
<text class="phone">{{ o.mobile }}</text>
|
||||
<view class="grab" @tap="grab(o)">立即抢单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty" v-if="!loading && !list.length"><text>暂无待接订单,稍后刷新试试</text></view>
|
||||
<view class="refresh" @tap="load">刷新大厅</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
|
||||
const list = ref([]);
|
||||
const info = ref(null);
|
||||
const loading = ref(false);
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.masterHall({ limit: 20 });
|
||||
list.value = res.list || [];
|
||||
} catch (e) {
|
||||
}
|
||||
try {
|
||||
const me = await api.masterInfo();
|
||||
info.value = me.applied ? me.master : null;
|
||||
} catch (e) {}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function toggleWork() {
|
||||
if (!info.value) return;
|
||||
const next = info.value.work_status === 'off' ? 'on' : 'off';
|
||||
try {
|
||||
await api.masterToggle({ work_status: next });
|
||||
info.value.work_status = next;
|
||||
uni.showToast({ title: next === 'on' ? '已开启接单' : '已暂停接单', icon: 'none' });
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function grab(o) {
|
||||
uni.showModal({
|
||||
title: '确认抢单',
|
||||
content: '抢单后需在 2 小时内联系客户,否则订单将自动回流大厅',
|
||||
success: async (r) => {
|
||||
if (!r.confirm) return;
|
||||
try {
|
||||
await api.masterGrab({ order_id: o.id });
|
||||
uni.showToast({ title: '抢单成功' });
|
||||
setTimeout(() => uni.navigateTo({ url: '/pages/master/orders' }), 600);
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onShow(() => load());
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 60rpx; }
|
||||
.top {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 34rpx 30rpx;
|
||||
background: linear-gradient(160deg, #FFB85C 0%, #F98D25 60%, #ED6F0E 100%);
|
||||
}
|
||||
.top-l { display: flex; flex-direction: column; }
|
||||
.top-t { font-size: 38rpx; font-weight: 700; color: #fff; }
|
||||
.top-s { margin-top: 8rpx; font-size: 22rpx; color: rgba(255,255,255,0.9); }
|
||||
.switch { padding: 0 26rpx; line-height: 60rpx; border-radius: 30rpx; background: #fff; }
|
||||
.switch.off { background: rgba(255,255,255,0.35); }
|
||||
.switch-t { font-size: 24rpx; font-weight: 600; color: #E36B0C; }
|
||||
.switch.off .switch-t { color: #fff; }
|
||||
.list { padding: 22rpx 28rpx 0; }
|
||||
.item { background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 22rpx 24rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
|
||||
.hd { display: flex; align-items: center; padding-bottom: 14rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||||
.tag-urgent { padding: 0 12rpx; line-height: 34rpx; border-radius: 8rpx; background: #FDEEEB; color: #E8331B; font-size: 20rpx; margin-right: 10rpx; }
|
||||
.svc { flex: 1; font-size: 30rpx; font-weight: 700; color: #1F1F1F; }
|
||||
.amt { font-size: 32rpx; font-weight: 700; color: #F0710D; }
|
||||
.bd { display: flex; flex-direction: column; padding: 16rpx 0; }
|
||||
.addr { font-size: 26rpx; color: #333; line-height: 36rpx; }
|
||||
.meta { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||||
.ft { display: flex; align-items: center; justify-content: space-between; padding-top: 14rpx; border-top: 1rpx solid #F4F4F4; }
|
||||
.phone { font-size: 24rpx; color: #666; }
|
||||
.grab { padding: 0 34rpx; line-height: 68rpx; border-radius: 34rpx; color: #fff; font-size: 26rpx; font-weight: 600; background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%); box-shadow: 0 6rpx 16rpx rgba(240,113,13,0.28); }
|
||||
.empty { padding: 90rpx 0 30rpx; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||||
.refresh { margin: 10rpx 28rpx; height: 84rpx; display: flex; align-items: center; justify-content: center; border-radius: 42rpx; background: #fff; color: #F0710D; font-size: 26rpx; font-weight: 600; }
|
||||
</style>
|
||||
130
pages/master/orders.vue
普通文件
130
pages/master/orders.vue
普通文件
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="tabs">
|
||||
<view v-for="t in tabs" :key="t.key" class="tab" :class="{ on: cur === t.key }" @tap="switchTab(t.key)">
|
||||
<text class="tab-txt">{{ t.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view class="item" v-for="o in list" :key="o.id">
|
||||
<view class="hd">
|
||||
<text class="svc">{{ o.service_name }}</text>
|
||||
<text class="status" :class="'s' + o.status">{{ o.status_text }}</text>
|
||||
</view>
|
||||
<view class="bd">
|
||||
<text class="addr">{{ o.address }}</text>
|
||||
<text class="meta">预约 {{ o.appoint_text }} · 楼层 {{ o.floor }} 层 · {{ Number(o.has_elevator) ? '有电梯' : '无电梯' }}</text>
|
||||
<view class="row">
|
||||
<text class="phone">客户 {{ o.mobile }}</text>
|
||||
<text class="amt">¥{{ o.pay_amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ops">
|
||||
<view class="op" v-if="Number(o.status) === 3 && !o.contact_time" @tap="act('contact', o)">标记已联系</view>
|
||||
<view class="op" v-if="Number(o.status) === 3" @tap="act('schedule', o)">约定上门</view>
|
||||
<view class="op" v-if="Number(o.status) === 4" @tap="act('arrive', o)">到达打卡</view>
|
||||
<view class="op" v-if="Number(o.status) === 5" @tap="act('start', o)">开始服务</view>
|
||||
<view class="op primary" v-if="Number(o.status) === 6" @tap="act('finish', o)">完工提交</view>
|
||||
<view class="op" v-if="Number(o.status) === 3 || Number(o.status) === 4" @tap="call(o)">打电话</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty" v-if="!loading && !list.length"><text>暂无订单</text></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
|
||||
const tabs = [
|
||||
{ key: 'active', name: '待处理' },
|
||||
{ key: 'verify', name: '待验收' },
|
||||
{ key: 'completed', name: '已完成' }
|
||||
];
|
||||
const cur = ref('active');
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.masterOrders({ status: cur.value, limit: 20 });
|
||||
list.value = res.list || [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function switchTab(k) { cur.value = k; load(); }
|
||||
function call(o) { uni.makePhoneCall({ phoneNumber: o.mobile }); }
|
||||
|
||||
function act(type, o) {
|
||||
const id = o.id;
|
||||
if (type === 'contact') {
|
||||
api.masterContact({ order_id: id }).then(() => { uni.showToast({ title: '已记录联系' }); load(); }).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'arrive') {
|
||||
api.masterArrive({ order_id: id }).then(() => { uni.showToast({ title: '已到达' }); load(); }).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'start') {
|
||||
api.masterStart({ order_id: id }).then(() => { uni.showToast({ title: '已开工' }); load(); }).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'finish') {
|
||||
uni.showModal({
|
||||
title: '确认完工',
|
||||
content: '提交后进入待验收,需上传现场照片(联调使用示例图)',
|
||||
success: (r) => {
|
||||
if (!r.confirm) return;
|
||||
api.masterFinish({ order_id: id, 'images[0]': 'https://yjyf.gzyakj.com.cn/uploads/sample-finish.jpg' })
|
||||
.then((res) => {
|
||||
uni.showModal({ title: '已提交完工', content: '验收码:' + res.verify_code + '(告知客户)', showCancel: false });
|
||||
load();
|
||||
}).catch(() => {});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (type === 'schedule') {
|
||||
const ts = Math.floor(Date.now() / 1000) + 7200;
|
||||
api.masterSchedule({ order_id: id, appoint_time: ts }).then(() => { uni.showToast({ title: '已约定 2 小时后上门' }); load(); }).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => load());
|
||||
onPullDownRefresh(() => { load().then(() => uni.stopPullDownRefresh()); });
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 60rpx; }
|
||||
.tabs { display: flex; background: #fff; box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03); }
|
||||
.tab { flex: 1; text-align: center; padding: 26rpx 0; }
|
||||
.tab-txt { font-size: 28rpx; color: #666; }
|
||||
.tab.on .tab-txt { color: #F0710D; font-weight: 700; }
|
||||
.list { padding: 22rpx 28rpx; }
|
||||
.item { background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 22rpx 24rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
|
||||
.hd { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||||
.svc { font-size: 30rpx; font-weight: 700; color: #1F1F1F; }
|
||||
.status { font-size: 24rpx; font-weight: 600; color: #F0710D; }
|
||||
.status.s7 { color: #E8331B; }
|
||||
.status.s8 { color: #2FA84F; }
|
||||
.bd { display: flex; flex-direction: column; padding: 16rpx 0; }
|
||||
.addr { font-size: 26rpx; color: #333; line-height: 36rpx; }
|
||||
.meta { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||||
.row { display: flex; align-items: center; justify-content: space-between; margin-top: 10rpx; }
|
||||
.phone { font-size: 24rpx; color: #666; }
|
||||
.amt { font-size: 32rpx; font-weight: 700; color: #F0710D; }
|
||||
.ops { display: flex; flex-wrap: wrap; justify-content: flex-end; padding-top: 14rpx; border-top: 1rpx solid #F4F4F4; }
|
||||
.op { margin: 8rpx 0 0 14rpx; padding: 0 24rpx; line-height: 62rpx; border-radius: 31rpx; border: 2rpx solid #DDD; font-size: 24rpx; color: #666; }
|
||||
.op.primary { border-color: #F0710D; color: #fff; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
|
||||
.empty { padding: 120rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户