const $$ = require('../../utils/util'); const app = getApp(); // 获取当事人人员数据 function getPartyApi(submitData) { return $$.request({ url: 'paCaseInfo/selectCaseUserName?caseId=' + submitData, type: 'get', service: 'mediate' }); } //调解视窗 function getCaseViewApi(submitData) { return $$.request({ url: 'guide/windowCaseGuideByMilvus?caseId=' + submitData, v1: true, type: 'get', service: 'mediate' }); } // 评价 function rateApi(submitData) { return $$.request({ url: 'guideRatings/saveGuideRatings', submitData, type: 'post', v1: true, service: 'mediate' }); } //相似度 function checkCaseSimilarityApi(submitData) { return $$.request({ url: 'guide/checkCaseSimilarity', submitData, type: 'get', v1: true, service: 'mediate' }); } Component({ /** * 组件的属性列表 * pageType: string 页面来源 '1':我的调解; '2':我的司法确认on * data: 数据 * active: 是否选中卡片 */ properties: { pageType: { type: String, value: '1', }, data: { type: Object, value: {}, }, active: { type: Boolean, value: false, }, caseindex: Number, // 当前案件的下标便于操作返回后更新对应的案件 caseId: '', }, /** * 组件的初始数据 * card: string 卡片类型; '1':待受理 '2_1':待调解(司法确认:待开始)未预约 '2_2':待调解(司法确认:待开始)有预约 '3_1':调解中(司法确认:进行中)未预约 '3_2':调解中(司法确认:进行中)有预约 '4_1':调解结束(司法确认:已结束)调解成功(司法确认:已达成) '4_2':调解结束(司法确认:已结束)调解失败(司法确认:未达成) '5':调解 - 退回 '6':调解 - 不予受理 '7': 调解 - 申请人撤回 */ card: '1', data: { imgUrl: $$.url.img, color: '', // 颜色 rate: '', baseContent: [{ title: '申请时间', value: 'applyTime' }, { title: '申请人', value: 'plaintiffs' }, { title: '被申请人', value: 'defendants' }, ], showAdditionalContent: false, showCaseProvision: false, showLegalList: false, showModal: false, hasEvaluated: false, guideInfoList: [], legalInfoList:[], newGuideInfoList: [], // 假设这是你的 NewLegalInfoList 数组 NewLegalInfoList: [], showTip: false, // 主要内容 content: [], // 额外说明区 explain: { visible: false, }, // 额外操作区 simple: { visible: false, button: [], }, // 底部操作区是否可见 bottomAction: false, // 底部文件展示区 bottomText: { visible: false, }, action: [{ title: '补充材料', icon: `${$$.url.img}buchongcailiao.png`, type: '1', dot: false, }, // { // title: '在线沟通', // icon: `${$$.url.img}zaixiangoutong.png`, // type: '2', // dot: false, // }, { title: '预约确认', icon: `${$$.url.img}yuyuequeren.png`, type: '3', dot: false, }, // { // title: '在线签名', // icon: `${$$.url.img}zaixianqianming.png`, // type: '4', // dot: false, // }, ], // 案件数据 cardData: {}, }, lifetimes: { // 在组件实例刚刚被创建时执行 created: function () {}, // 在组件实例进入页面节点树时执行 attached: function () { this._searchCase(); }, // 在组件实例被从页面节点树移除时执行 detached: function () {}, }, observers: { // 用于加载不同的卡片 'data.process,data.perType': function () { this._defaultData(); const data = this.data.data; data.meetInfo = data.meetInfo || {}; const pageType = this.data.pageType; const card = this._cardType(data); // 待受理 if (card === '1') { // 只有是登记人才可以修改案件 if (data.whetherInput === '1') { this.data.simple = { visible: true, button: [{ title: '撤销申请', type: 'cancelCase' }], }; } this.data.color = 'color-black'; } // 退回 or 不予受理 if (['5', '6'].indexOf(card) !== -1) { this.data.content = [{ title: pageType === '1' ? '审查组织' : '审查法院', value: 'errorObjName' }, { title: '审查时间', value: 'errorTime' }, ]; // 只有是登记人才可以修改案件 let data = {} this.data.simple = { visible: card === '5' && data.whetherInput === '1' ? true : false, button: [{ buttonType: 'primary', title: '修改申请', type: 'changeCase' }, { title: '撤销申请', type: 'cancelCase' }, ], }; this.data.explain = { visible: true, title: '原因说明', content: data.errorContent || '-', }; this.data.color = card === '5' ? 'color-tui' : 'color-fail'; } // 待调解 or 调解中 or 调解结束 的共同显示 if (['1', '5', '6', '7'].indexOf(card) === -1) { this.data.content = pageType === '1' ? [{ title: '调解组织', value: 'mediateUnitName' }, { title: '调解员', value: 'mediator' }, ] : [{ title: '受理法院', value: 'courtName' }, { title: '承办法官', value: 'judgeName' }, ]; } // 待调解 or 调解中 if (['2_1', '2_2', '3_1', '3_2'].indexOf(card) !== -1) { if (['2_2', '3_2'].indexOf(card) !== -1) { this.data.explain = { visible: true, title: '预约信息', order: true, }; if (!data.meetInfo.fixStatus || data.meetInfo.fixStatus === '1') { this.data.action[2].dot = true; // 显示图标红点提示 } let arr = !!data.meetInfo.orderStartTime ? [{ title: pageType === '1' ? '线上调解房间号' : '线上司法确认房间号', type: 'copy' }] : []; this.data.simple = { visible: true, button: [{ buttonType: 'primary', title: data.meetInfo.signStatus === '2' || !data.meetInfo.signStatus ? (pageType === '1' ? '进入调解室' : '进入司法确认') : '签到', type: data.meetInfo.signStatus === '2' || !data.meetInfo.signStatus ? 'goToRoom' : 'signIn', }, ...arr, ], }; } this.data.bottomAction = data.whetherInput === '1' ? true : false; this.data.color = card === '2_1' || card === '2_2' ? 'color-dai' : 'color-ing'; } // 调解结束 if (['4_1', '4_2'].indexOf(card) !== -1) { this.data.simple = { visible: true, button: [{ buttonType: 'primary', title: pageType === '1' ? '调解历程' : '司法确认历程', type: 'history' }], }; this.data.bottomText = { visible: true, content: [{ title: pageType === '1' ? '调解结果' : '司法确认结果', value: pageType === '1' ? 'mediResultName' : 'judicResultName', color: data.mediResult === '22_00025-1' || data.judicResult === '22_00028-1' ? '#07c160' : '#ee0a24', }, { title: pageType === '1' ? '调解时间' : '司法确认时间', value: pageType === '1' ? ['mediStartTime', 'mediEndTime'] : ['judicStartTime', 'judicEndTime'], type: 'time', }, ], }; this.data.color = 'color-end'; } // 申请人撤回 if (card === '7') { this.data.color = 'color-tui'; } this.setData({ color: this.data.color, content: this.data.content, explain: this.data.explain, simple: this.data.simple, bottomAction: this.data.bottomAction, bottomText: this.data.bottomText, action: this.data.action, }); this._formatTime(card); }, }, /** * 组件的方法列表 */ methods: { onRateChange(event) { console.log('event', event.detail); this.setData({ rate: event.detail }) }, async _searchCase() { let type = false; try { if (this.data.simple.visible && (this.data.simple.button[0].type === 'signIn' || this.data.simple.button[0].type === 'goToRoom')) { $$.showLoading(); const guideTitleRes = await getCaseViewApi(this.data.data.id); $$.hideLoading(); if (guideTitleRes.type) { // 操作成功,设定 type 为 true type = true; const guideInfoList = guideTitleRes.data.find((i) => i.guideName === '类案推荐')?.guideInfoList; const legalInfoList = guideTitleRes.data.find((i) => i.guideName === '法条推荐')?.guideInfoList.map(item => ({ ...item, showDetails: false // 默认设定为关闭状态 })); this.setData({ guideInfoList, legalInfoList, newGuideInfoList: guideInfoList, NewLegalInfoList: legalInfoList }); const tip = await checkCaseSimilarityApi({ caseId: this.data.data.id }); if (tip.data === true) { this.setData({ showTip: true }) } } } return { type }; } catch (error) { console.error('刷新失败:', error); return { type: false }; } }, // 恢复默认数据 _defaultData() { this.data.color = ''; // 主要内容 this.data.content = []; // 额外说明区 this.data.explain = { visible: false }; // 额外操作区 this.data.simple = { visible: false, button: [] }; // 底部操作区是否可见 this.data.bottomAction = false; // 底部文件展示区 this.data.bottomText = { visible: false }; this.data.action = [{ title: '预约确认', icon: `${$$.url.img}yuyuequeren.png`, type: '3', dot: false, }, { title: '补充材料', icon: `${$$.url.img}buchongcailiao.png`, type: '1', dot: false, }, { title: '...', type: '10', dot: false, }, // { // title: '在线沟通', // icon: `${$$.url.img}zaixiangoutong.png`, // type: '2', // dot: false, // }, // { // title: '在线签名', // icon: `${$$.url.img}zaixianqianming.png`, // type: '4', // dot: false, // }, ]; }, // 查看文件 _handleOpenFiles(e) { let item = e.currentTarget.dataset.item; let url = $$.baseUrl + $$.url.fileShowUrl + item.id; $$.openFiles(item.cat, url, [url]); }, //补充材料页面 goToOtherPage() { // 跳转到其他页面的逻辑 wx.navigateTo({ url: '../../pages/materialShow/index?caseId=' + this.data.data.id + '&editVisible=true', }); }, _q() { let that = this; $$.showModal({ title: '推荐内容评价', content: '推荐内容对您有帮助吗?', cancelText: '我再想想', confirmText: '评价完成', success: (res) => { if (res.confirm) { that.submitCase(); } }, }); }, async submitCase() { $$.showLoading(); const res = await rateApi({ serviceId: id, rating: rate, }); $$.hideLoading(); if (res.type) { $$.showToast({ icon: 'success', title: '感谢您的评价' }); } }, _m(event) { const index = event.currentTarget.dataset.key; // 获取点击的法条索引 const currentLegal = this.data.NewLegalInfoList[index]; // 获取当前点击的法条对象 currentLegal.showDetails = !currentLegal.showDetails; // 更新当前法条的展开状态 // 更新数据,只修改当前点击的法条对象,而不是整体更新 NewLegalInfoList 状态 this.setData({ ['NewLegalInfoList[' + index + ']']: currentLegal }); }, //打开弹窗 openPopup() { // 点击评价按钮时触发的操作 if (this.data.hasEvaluated) { // 如果用户已经评价过,显示提示消息 $$.showToast({ title: "不可重复评价" }); } else { // 如果用户未评价,则打开弹出框供用户评价 this.setData({ showModal: !this.data.showModal // 显示弹出框 }); } }, _r() { // 用户完成评价后触发的操作 this.setData({ showModal: false, // 关闭弹出框 hasEvaluated: true // 标记用户已经评价过 }); $$.showToast({ title: "评价完成" }); // 显示评价完成的提示消息 }, // 底部操作区操作 _handleBottomAction(e) { let type = e.currentTarget.dataset.type; if (type === '1') { // 补充材料 // 获取人员数据保存至全局变量中,方便附件上传页面获取有多少人员 this._goToMaterial(this.data.data.id); } else if (type === '2') { $$.showToast({ title: '功能暂未开放,敬请期待' }); } else if (type === '3') { if (this.card === '2_1' || this.card === '3_1') { $$.showToast({ title: '抱歉!该案件暂无预约信息' }); return false; } // 预约确认 app.globalData.caseMsg = this.data.data; app.globalData.caseMsg.caseIndex = this.data.caseindex; wx.navigateTo({ url: '../../pages/orderConfirm/index?meetUserId=' + this.data.data.meetInfo.meetUserId + '&pageType=' + this.data.pageType, }); } // else if (type === '4') { // // 在线签名 // wx.navigateTo({ // url: '../../pages/autograph/index', // }); // } else if (type === '10') { // ... this.setData({ showAdditionalContent: !this.data.showAdditionalContent }); // 当点击 type 为 10 的时候显示额外内容 } }, // 额外的操作 async _handleSimpleButton(e) { let type = e.currentTarget.dataset.type; if (type === 'changeCase') { // 修改申请 app.globalData.caseMsg = this.data.data; app.globalData.caseMsg.caseIndex = this.data.caseindex; wx.navigateTo({ url: '../../pages/register/index?caseId=' + this.data.data.id + '&change=true', }); } else if (type === 'cancelCase') { // 撤销申请 $$.showModal({ content: '确定撤销申请吗?', success: (res) => { if (res.confirm) { this.triggerEvent('onCancelCase', this.data.data.id); } }, }); } else if (type === 'signIn') { // 进入签到 if (this.data.data.meetInfo.orderStartTime) { let visible = false; let diff_minute = $$.moment(this.data.data.meetInfo.orderStartTime).diff($$.moment(new Date()), 'minute'); if (diff_minute > 60) { $$.showModal({ title: '签到失败提醒', content: '正式调解开始前1小时内开放签到操作,请稍后再试', showCancel: 'false', confirmText: '我知道了', }); visible = true; } if (visible) { return false; } } app.globalData.caseMsg = this.data.data; app.globalData.caseMsg.caseIndex = this.data.caseindex; wx.navigateTo({ url: '../../pages/signIn/index?meetUserId=' + this.data.data.meetInfo.meetUserId, }); } else if (type === 'goToRoom') { // 进入调解室 if (!this.data.data.meetInfo.roomNo) { $$.showModal({ title: '进入调解失败提醒', content: '房间号尚未创建,请联系调解员进行确认', showCancel: 'false', confirmText: '我知道了', }); return false; } let that = this; wx.setClipboardData({ data: that.data.data.meetInfo.roomNo, success: function (res) { wx.getClipboardData({ success: function (res) { $$.showToast({ icon: 'success', title: '会议号复制成功' }); }, }); }, }); $$.sleep(); // 跳转到小鱼视频小程序 wx.navigateToMiniProgram({ appId: 'wx5a161b9b42305c0a', path: 'pages/index/main', success(res) {}, }); } else if (type === 'history') { // 进入调解历程 or 司法历程 app.globalData.caseMsg = this.data.data; wx.navigateTo({ url: '../../pages/course/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, }); } else if (type === 'copy') { // 复制房间号 if (!this.data.data.meetInfo.roomNo) { $$.showToast({ title: '抱歉,无房间号' }); return false; } this.triggerEvent('onOpenBottomPopup', { data: this.data.data.meetInfo.roomNo, type: 'roomNo' }); } }, async _v() { let a = []; let b = []; if (this.data.newGuideInfoList?.length > 3) { a = this.data.newGuideInfoList.filter((i, idx) => idx > 2); } else { a = this.data.guideInfoList || []; } if (this.data.NewLegalInfoList?.length > 3) { b = this.data.NewLegalInfoList.filter((i, idx) => idx > 2); } else { b = this.data.legalInfoList || []; } this.setData({ newGuideInfoList: a, NewLegalInfoList: b }); }, //类案推荐详情 async _classicCase(e) { const index = e.currentTarget.dataset.index; // 获取点击的元素索引 const selectedItem = this.data.newGuideInfoList[index]; // 根据索引获取对应的数据 const guideInfoId = selectedItem.guideInfoId; const guideId = selectedItem.id; // 跳转到 classicCase 页面,并传递相应的参数 wx.navigateTo({ url: `../../pages/classicCase/index?guideInfoId=${guideInfoId}&guideId=${guideId}` }); }, async _handleNewSimpleButton(e) { let type = e.currentTarget.dataset.type; if (type === 'changeCase') { // 修改申请 app.globalData.caseMsg = this.data.data; app.globalData.caseMsg.caseIndex = this.data.caseindex; wx.navigateTo({ url: '../../pages/register/index?caseId=' + this.data.data.id + '&change=true', }); } else if (type === 'signIn') { // 进入签到 if (this.data.data.meetInfo.orderStartTime) { let visible = false; let diff_minute = $$.moment(this.data.data.meetInfo.orderStartTime).diff($$.moment(new Date()), 'minute'); if (diff_minute > 60) { $$.showModal({ title: '签到失败提醒', content: '正式调解开始前1小时内开放签到操作,请稍后再试', showCancel: 'false', confirmText: '我知道了', }); visible = true; } if (visible) { return false; } } app.globalData.caseMsg = this.data.data; app.globalData.caseMsg.caseIndex = this.data.caseindex; wx.navigateTo({ url: '../../pages/signIn/index?meetUserId=' + this.data.data.meetInfo.meetUserId, }); } else if (type === 'goToRoom') { // 进入调解室 if (!this.data.data.meetInfo.roomNo) { $$.showModal({ title: '进入调解失败提醒', content: '房间号尚未创建,请联系调解员进行确认', showCancel: 'false', confirmText: '我知道了', }); return false; } let that = this; wx.setClipboardData({ data: that.data.data.meetInfo.roomNo, success: function (res) { wx.getClipboardData({ success: function (res) { $$.showToast({ icon: 'success', title: '会议号复制成功' }); }, }); }, }); $$.sleep(); // 跳转到小鱼视频小程序 wx.navigateToMiniProgram({ appId: 'wx5a161b9b42305c0a', path: 'pages/index/main', success(res) {}, }); } else if (type === 'history') { // 进入调解历程 or 司法历程 app.globalData.caseMsg = this.data.data; wx.navigateTo({ url: '../../pages/course/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, }); } else if (type === 'copy') { // 复制房间号 if (!this.data.data.meetInfo.roomNo) { $$.showToast({ title: '抱歉,无房间号' }); return false; } this.triggerEvent('onOpenBottomPopup', { data: this.data.data.meetInfo.roomNo, type: 'roomNo' }); } }, // 判断我的调解 和 我的司法确认的卡片类型便于组件使用 _cardType(value) { let result = '1'; if (value.process) { if (value.process === '1') { result = '1'; } else if (value.process === '2' || value.process === '3') { if (!value.meetInfo.orderStartTime) { result = '_1'; } else { result = '_2'; } result = value.process + result; } else if (value.process === '4') { result = value.mediResult === '22_00025-1' || value.judicResult === '22_00028-1' ? '4_1' : '4_2'; } else { result = value.process; } } this.card = result; return result; }, // 格式化时间 _formatTime(card) { let arr = ['applyTime', 'mediStartTime', 'mediEndTime', 'errorTime', 'judicStartTime', 'judicEndTime'], arr2 = ['orderStartTime', 'orderEndTime']; let data = this.data.data; arr.forEach((x) => { if (data[x]) { data[x] = $$.timeFormat(data[x]); } }); arr2.forEach((x) => { if (data.meetInfo[x]) { data.meetInfo[x] = $$.timeFormat(data.meetInfo[x]); } }); data.cardTypeName = data.processName || '-'; this.setData({ cardData: { ...data } }); }, // 跳转至案件详情 _handleGetCaseDetail() { wx.navigateTo({ url: '../../pages/mediateDetail/index?id=' + this.data.data.id + '&pageType=' + this.data.pageType, }); }, // 跳转至补充材料 async _goToMaterial(id) { $$.showLoading(); const res = await getPartyApi(id); $$.hideLoading(); if (res.type) { app.globalData.material.person = res.data || []; wx.navigateTo({ url: '../../pages/materialShow/index?caseId=' + this.data.data.id + '&editVisible=true', }); } }, // 打开文件 _handleOpenFiles(e) { let item = e.currentTarget.dataset.item; let url = $$.baseUrl + $$.url.fileShowUrl + item.id; $$.openFiles(item.cat, url, [url]); }, }, });