diff --git a/pages.json b/pages.json index 28e5211..8fc687b 100644 --- a/pages.json +++ b/pages.json @@ -150,7 +150,13 @@ } }, { - "path": "pages/add/add", + "path": "pages/notice/notice_list", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/notice/detail", "style": { "navigationStyle": "custom" } @@ -584,6 +590,24 @@ "navigationStyle": "custom" } }, + { + "path": "pages/shop/verify/verify-order", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/shop/verify/manual-verify", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/shop/verify/verify-order-detail", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/shop/photoAlbum/photoManage", "style": { diff --git a/pages/home/home.vue b/pages/home/home.vue index 11a7fac..28f631d 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -18,7 +18,7 @@ - + {{ item.name }} @@ -29,7 +29,7 @@ 接单管理 更新时间:{{ orderBasic.updateTime }} - + 更多数据 @@ -54,7 +54,7 @@ 当日实时数据 更新时间:{{ orderDetail.updateTime }} - + @@ -173,41 +173,32 @@ export default { userInfo: {}, // 用户信息数据源 syrId: null, - isOpenStore: false, // true为营业中(圆点在右),false为休息中(圆点在左)。由后续逻辑决定初始化状态。 displayScore: 0, animationTimer: null, - // 通知公告数据:预留接口,支持最新6条轮播 + // 通知公告数据 noticeList: [ - { id: 1, title: '商家券更新了!品牌专区上新了!', url: '/pages/...' }, - { id: 2, title: '系统维护通知:今晚凌晨将进行升级', url: '/pages/...' }, - { id: 3, title: '平台新政策发布,请及时查看', url: '/pages/...' } + { id: 0, title: '暂无最新公告', url: '' } ], quickActions: [ - { name: '扫码验券', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/b128e423-e4b5-4ad6-bdf5-522de7a9bc68.png' }, - { name: '服务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/a90f02a2-9d39-440a-ad20-a4337bcd1b38.png' }, - { name: '工位管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4c503603-6c2f-4a7a-9329-5e54b8ca769e.png' }, - { name: '财务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/728c659e-e395-4473-b83e-7e04539f7ec6.png' } + { name: '扫码验券', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/b128e423-e4b5-4ad6-bdf5-522de7a9bc68.png' , path: '/pages/shop/verify/verify-order'}, + { name: '服务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/a90f02a2-9d39-440a-ad20-a4337bcd1b38.png' , path: '/pages/artisan/service-list'}, + { name: '工位管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4c503603-6c2f-4a7a-9329-5e54b8ca769e.png' , path: '/pages/shop/workSpace/list'}, + { name: '财务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/728c659e-e395-4473-b83e-7e04539f7ec6.png' , path: '/pages/wallet/wallet'} ], - orderBasic: { updateTime: '15:30', waitStart: 23, waitFinish: 43, finished: 234 }, - orderDetail: { updateTime: '15:30', score: '82.2', visitors: 0, yVisitors: 100, orders: 234, yOrders: 1000, amount: '1.34', yAmount: '1.4' }, + orderBasic: { updateTime: '--:--', waitStart: 0, waitFinish: 0, finished: 0 }, + orderDetail: { updateTime: '--:--', score: '0.0', visitors: 0, yVisitors: 0, orders: 0, yOrders: 0, amount: '0.00', yAmount: '0.00' }, - brands: [ - { name: '蜜丝卡伦美甲美睫', bgSrc: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d02b2d8b-0e01-4c6d-bbee-c60dccf4867c.jpg', avatar: 'https://dummyimage.com/100x100/ccc/fff.png&text=Avatar', tagKeys: ['franchise', 'recruit'] }, - { name: 'ALNL 清莲爱丽', bgSrc: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d02b2d8b-0e01-4c6d-bbee-c60dccf4867c.jpg', avatar: 'https://dummyimage.com/100x100/ccc/fff.png&text=Avatar', tagKeys: ['recruit'] }, - { name: 'IL COLPO依宝美容', bgSrc: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d02b2d8b-0e01-4c6d-bbee-c60dccf4867c.jpg', avatar: 'https://dummyimage.com/100x100/ccc/fff.png&text=Avatar', tagKeys: ['franchise'] }, - { name: '蜜丝卡伦美甲美睫', bgSrc: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d02b2d8b-0e01-4c6d-bbee-c60dccf4867c.jpg', avatar: 'https://dummyimage.com/100x100/ccc/fff.png&text=Avatar', tagKeys: ['more'] } - ], - skills: [ - { title: '穿戴甲的操作视频扫码验券操作123564798', type: '平台课程', views: '83.6万', time: '7小时前', coverSrc: 'https://dummyimage.com/200x150/ccc/fff.png&text=Video' }, - { title: '脸部按摩操作步骤详情', type: '脸缘品牌', views: '8334', time: '1天前', coverSrc: 'https://dummyimage.com/200x150/ccc/fff.png&text=Video' }, - { title: '全身SPA的操作视频操作教程', type: '平台课程', views: '2344', time: '3天前', coverSrc: 'https://dummyimage.com/200x150/ccc/fff.png&text=Video' }, - { title: '穿戴甲的操作视频扫码验券操作...', type: '平台课程', views: '836', time: '4月26日', coverSrc: 'https://dummyimage.com/200x150/ccc/fff.png&text=Video' } - ] + brands: [], + skills: [] }; }, computed: { + // 营业状态:true(营业中) / false(休息中) + isOpenStore() { + return this.userInfo.order_taking === 1; + }, // 状态管理判定 // 是否已入驻 (0: 未入驻, -1: 入驻第一步, >0: 已认证) 只要不等于0,说明已经开启了入驻流程 isSettled() { @@ -256,13 +247,13 @@ export default { if (this.isLogin) { this.getUserInfo(); } + // 通知、品牌、技能 这三个接口不强依赖登录,无论登没登录都获取 + this.fetchNoticeList(); + this.fetchBrandList(); + this.fetchSkillList(); }, onLoad() { uni.hideTabBar(); - this.getNoticeList(); // 获取最新通知 - }, - mounted() { - this.animateScore(); }, watch: { 'orderDetail.score'() { @@ -270,34 +261,154 @@ export default { } }, methods: { + // 处理金刚区点击事件 (包含扫码验券核心逻辑) + handleQuickAction(item) { + if (item.name === '扫码验券') { + console.log('准备跳转到自定义扫码页...'); + + uni.navigateTo({ + url: '/pages/shop/verify/verify-order', + fail: (err) => { + console.error('跳转失败:', err); + } + }); + return; + } // 2. 通用跳转逻辑 + else if (item.path) { + uni.navigateTo({ + url: item.path, + fail: () => { + uni.showToast({ title: '页面开发中...', icon: 'none' }); + } + }); + } + }, + + // 格式化时间 (提取 HH:mm) + formatTime(dateTimeStr) { + if (!dateTimeStr) return '--:--'; + const arr = dateTimeStr.split(' '); + if (arr.length > 1) { + return arr[1].substring(0, 5); // 截取 HH:mm + } + return dateTimeStr; + }, + getUserInfo() { request.post("/sj/user/getUser").then((result) => { - this.userInfo = result.data; - uni.setStorageSync("syrId", result.data.id); - this.syrId = result.data.id; + if(result.code === 200 && result.data) { + this.userInfo = result.data; + uni.setStorageSync("syrId", result.data.id); + this.syrId = result.data.id; - // 获取完用户信息后,初始化营业开关的状态 - this.initStoreStatus(); + // 获取完用户信息后,初始化营业开关的状态 + this.initStoreStatus(); + + // 如果已入驻,才获取接单管理和实时数据 + if (this.isSettled) { + this.fetchOrderNum(); + this.fetchRealTimeData(); + } + } }); }, - // 接口预留:获取通知公告(仅拉取当前角色关联的最新6条) - getNoticeList() { - // request.post('/api/notice/getLatest', { role: 'merchant', limit: 6 }).then(res => { - // this.noticeList = res.data; - // }) + // 获取:接单管理不同状态订单数量 + fetchOrderNum() { + request.post("/sj/poster/orderNum").then(res => { + if(res.code === 200 && res.data) { + this.orderBasic = { + updateTime: this.formatTime(res.data.now_date), + waitStart: res.data.dfw || 0, + waitFinish: res.data.dwc || 0, + finished: res.data.yqx || 0 // 备注:接口返回只有dfw, dwc, yqx(已取消)。暂时将第三个坑位放为yqx,或你后期让后端加字段 + }; + } + }); + }, + + // 获取:首页实时数据 + fetchRealTimeData() { + request.post("/sj/poster/realTimeData").then(res => { + if(res.code === 200 && res.data) { + const today = res.data.today || {}; + const yesterday = res.data.yesterday || {}; + + this.orderDetail = { + updateTime: this.formatTime(res.data.now_date), + score: today.rating_num || 0, + visitors: today.visitor_num || 0, + yVisitors: yesterday.visitor_num || 0, + orders: today.place_order || 0, + yOrders: yesterday.place_order || 0, + amount: today.deal_money || 0, + yAmount: yesterday.deal_money || 0 + }; + } + }); + }, + + // 获取:通知公告列表 + fetchNoticeList() { + request.post('/sj/notice/list', { page: 1, limit: 6 }).then(res => { + if(res.code === 200 && res.data && res.data.list.length > 0) { + this.noticeList = res.data.list; + } + }); + }, + + // 获取:品牌列表 + fetchBrandList() { + // 假设首页只拉取推荐的前4条 + request.post('/sj/brand/list', { page: 1, limit: 4 }).then(res => { + if(res.code === 200 && res.data && res.data.list) { + this.brands = res.data.list.map(item => { + let tags = []; + // 根据接口字段动态生成标签映射 + if (item.franchise_state === 1) tags.push('franchise'); + if (item.student_state === 1) tags.push('recruit'); + if (tags.length === 0) tags.push('more'); + + return { + id: item.id, + name: item.name, + bgSrc: item.cover_img || 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/d02b2d8b-0e01-4c6d-bbee-c60dccf4867c.jpg', + avatar: item.logo_img || 'https://dummyimage.com/100x100/ccc/fff.png&text=Avatar', + tagKeys: tags + }; + }); + } + }); + }, + + // 获取:技能集市列表 + fetchSkillList() { + request.post('/sj/skill/list', { page: 1, limit: 4 }).then(res => { + if(res.code === 200 && res.data && res.data.list) { + this.skills = res.data.list.map(item => { + return { + id: item.id, + title: item.name, + type: item.link_name || '平台课程', + views: item.browse_num || 0, + time: item.create_time ? item.create_time.split(' ')[0] : '', // 只取日期 + coverSrc: item.cover_img || 'https://dummyimage.com/200x150/ccc/fff.png&text=Video' + }; + }); + } + }); }, // 跳转:通知详情页 goToNotice(msg) { - if(msg.url) { - uni.navigateTo({ url: msg.url }); + if(msg.id) { + uni.navigateTo({ url: `/pages/notice/detail?id=${msg.id}` }); } }, // 跳转:公告列表页 goToNoticeList() { - // uni.navigateTo({ url: '/pages/notice/list' }); + uni.navigateTo({ url: '/pages/notice/notice_list' }); }, // 跳转:去入驻 @@ -318,36 +429,26 @@ export default { // 营业中 / 休息中 按钮逻辑判断 toggleStatus() { - // 1、入驻未认证 (id_type == -1),弹窗提示未完善项,引导完善 + // 校验逻辑保留你之前的认证状态检查 if (!this.isCertified) { - uni.showModal({ - title: '提示', - content: '请先完善认证信息', - confirmText: '去完善', - success: (res) => { - if (res.confirm) { - // uni.navigateTo({ url: '/pages/artisan/syr-info-change' }); - } - } - }); + uni.showModal({ title: '提示', content: '请先完善认证信息', confirmText: '去完善' }); return; } - - // 2、入驻认证通过,未配置营业时间,默认休息中,跳转至营业时间管理 if (this.isCertified && !this.hasBusinessTime) { uni.showToast({ title: '请先配置营业时间', icon: 'none' }); - setTimeout(() => { - // uni.navigateTo({ url: '/pages/shop/business-time' }); - }, 800); return; } - // 3、认证通过并配置时间,仅作为开关,不跳转页面 - if (this.isCertified && this.hasBusinessTime) { - this.isOpenStore = !this.isOpenStore; - // 预留接口:发送请求同步给后端当前状态 - // request.post('/api/store/toggleStatus', { status: this.isOpenStore ? 1 : 0 }); - } + // 真正的请求逻辑 + let newStatus = this.userInfo.order_taking == 1 ? 2 : 1; + request.post("/sj/sjordertaking", { + order_taking: newStatus, + sjid: this.syrId // 使用你在 getUserInfo 存入的 sjId/syrId + }).then((res) => { + // 成功后重新拉取最新信息以更新 UI + this.getUserInfo(); + uni.showToast({ title: newStatus == 1 ? '已开启营业' : '已休息', icon: 'none' }); + }); }, animateScore() { @@ -591,7 +692,7 @@ export default { .guide-btn { width: 534rpx; height: 70rpx; - border-radius: 55rpx; + border-radius: 35rpx; border: 1rpx solid #FF4767; color: #FF4767; diff --git a/pages/notice/detail.vue b/pages/notice/detail.vue new file mode 100644 index 0000000..ac75361 --- /dev/null +++ b/pages/notice/detail.vue @@ -0,0 +1,359 @@ + + + + + \ No newline at end of file diff --git a/pages/notice/notice_list.vue b/pages/notice/notice_list.vue new file mode 100644 index 0000000..b2441e5 --- /dev/null +++ b/pages/notice/notice_list.vue @@ -0,0 +1,298 @@ + + + + + \ No newline at end of file diff --git a/pages/shop/verify/manual-verify.vue b/pages/shop/verify/manual-verify.vue new file mode 100644 index 0000000..3f3a5b3 --- /dev/null +++ b/pages/shop/verify/manual-verify.vue @@ -0,0 +1,153 @@ + + + + + \ No newline at end of file diff --git a/pages/shop/verify/verify-order.nvue b/pages/shop/verify/verify-order.nvue new file mode 100644 index 0000000..911dc25 --- /dev/null +++ b/pages/shop/verify/verify-order.nvue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file