From cb41d8035828a2b5200d271db9a59b88d5857abd Mon Sep 17 00:00:00 2001 From: 396316021 <396316021@qq.com> Date: Thu, 26 Oct 2023 16:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/chat.js | 15 + pages/ChatDetail/index.vue | 42 +- pages/FeedLog/index.vue | 2 +- pages/Index/components/ChatPage/index.vue | 5 +- pages/Index/components/OrderPage/index.vue | 10 +- pages/OrderConfirm/end.vue | 1804 ++++++++++---------- pages/OrderDetail/components/fomItem.vue | 1 + pages/OrderDetail/index.vue | 117 +- 8 files changed, 1067 insertions(+), 929 deletions(-) diff --git a/api/chat.js b/api/chat.js index d4b8355..ae76a01 100644 --- a/api/chat.js +++ b/api/chat.js @@ -33,4 +33,19 @@ export function getToken(order_service_id, user_sign){ type:user_sign } }) +} + +/** + * 获取客服聊天token + * @param chat_id 订单ID + * @returns {Promise | Promise} + */ +export function waitToken(chat_id ){ + return request({ + url:'/user/regionChat-token', + method:"post", + data:{ + chat_id :chat_id , + } + }) } \ No newline at end of file diff --git a/pages/ChatDetail/index.vue b/pages/ChatDetail/index.vue index e78af03..41ff14f 100644 --- a/pages/ChatDetail/index.vue +++ b/pages/ChatDetail/index.vue @@ -9,17 +9,17 @@ - - + {{item.user_name}} {{ item.create_time }} {{ item.info }} - + @@ -62,6 +62,7 @@ import HeaderNav from '../../components/HeaderNav/Index.vue'; import MzButton from '../../components/MzButton/Index.vue'; import {getToken} from "@/api/chat"; import log from "@/utils/log"; +import {waitToken} from "../../api/chat"; export default { components: { @@ -93,7 +94,16 @@ export default { title:"在线咨询" }, onLoad(options) { - this.getToken(options.id, options.type ?? 1); + + if(this.$store.state.userInfo.is_waitstaff !== 1 ){ + this.getToken(options.id, options.type ?? 1); + }else{ + if(options.type ==='2'){ + this.getToken(options.id, options.type ?? 1); + }else{ + this.getWaitToken(options.id) + } + } }, @@ -137,6 +147,30 @@ export default { }) }) }, + getWaitToken(order_id) { + waitToken(order_id).then(data => { + this.chat_id = data.data.chat_id; + this.type = data.data.type; + this.user_id = data.data.user_id; + uni.connectSocket({ + url: data.data.chat_url + }); + + uni.onSocketOpen((res) => { + this.ableChat = true; + console.log('WebSocket连接已打开!'); + }); + + uni.onSocketClose((res) => { + this.ableChat = false; + console.log('WebSocket 已关闭!'); + }); + + uni.onSocketMessage((res) => { + this.newMessage(res); + }) + }) + }, newMessage(messages) { log(messages); messages = JSON.parse(messages.data); diff --git a/pages/FeedLog/index.vue b/pages/FeedLog/index.vue index 5057bfd..d71f0bd 100644 --- a/pages/FeedLog/index.vue +++ b/pages/FeedLog/index.vue @@ -389,7 +389,7 @@ let result = []; try{ data.forEach(item => { - result.push({url:item.url}) + result.push({url:item.url,type:item.type}) }) }catch (e){ this.images[fileName] = []; diff --git a/pages/Index/components/ChatPage/index.vue b/pages/Index/components/ChatPage/index.vue index b7d1e0d..58cd484 100644 --- a/pages/Index/components/ChatPage/index.vue +++ b/pages/Index/components/ChatPage/index.vue @@ -94,8 +94,9 @@ } }, chatDetail(item){ + let url = (this.$store.state.userInfo.is_waitstaff === 1)?'/pages/ChatDetail/index?id='+item.chat_id:'/pages/ChatDetail/index?id='+item.order_service_id; uni.navigateTo({ - url:'/pages/ChatDetail/index?id='+item.order_service_id + url:url }); }, getChatList(clear = false){ @@ -108,7 +109,7 @@ return false; } this.status = 'loading'; - chatList(this.page, this.$store.state.userInfo.store_id > 0).then(res => { + chatList(this.page, this.$store.state.userInfo.is_waitstaff === 1 ? 2:(this.$store.state.userInfo.store_id > 0?1:0)).then(res => { this.chatList.push.apply(this.chatList,res.data); if(res.data.length === 0){ this.status = 'nomore'; diff --git a/pages/Index/components/OrderPage/index.vue b/pages/Index/components/OrderPage/index.vue index bff2093..47178c7 100644 --- a/pages/Index/components/OrderPage/index.vue +++ b/pages/Index/components/OrderPage/index.vue @@ -68,7 +68,7 @@ - + + + + - - - + + + + + + + + + + + + + + + + 门窗、灯、空调、水电等情况 + + + + + + + + + + + + + + + + + + + + + + + 入户前萌宠家居情况 + + + + + + + + + + + + + + + + + + + + + + + 萌宠生活区情况 + + + + + + + + + + + + + + + + + + + 萌宠食物剩余情况 + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + 是否有萌宠呕吐物 + + + + + + + + + + + + + + + + + + + + + + + + + + 萌宠排泄物情况 + + + + + + + + + + + + + + + + + + + + + + + + + + + 其他情况反馈 + + + + + + + + + + + + + + + + + + @@ -35,45 +402,42 @@ - 门窗、灯、空调、水电等情况 + 食盆清洗并擦干水渍 - + + + + - - - - @@ -83,46 +447,43 @@ - 入户前萌宠家居情况 + 水盆清理 - + + + + - - - - @@ -131,34 +492,42 @@ - 萌宠生活区情况 + 萌宠主食 - + + + + + + @@ -173,59 +542,57 @@ - 萌宠食物剩余情况 + 萌宠饮用水 - + - + - - - - - - + + + + - + - - - - - - + + + + + + @@ -240,46 +607,54 @@ - 是否有萌宠呕吐物 + 零食、药品及其他 - + - - + + + + - - - - + @@ -294,48 +669,42 @@ - 萌宠排泄物情况 + 窝窝整理 - + - - - + - - - - @@ -350,794 +719,444 @@ - 其他情况反馈 + 笼笼清理 - + + + + + + - - - - - - - - - + + + + + - - - 食盆清洗并擦干水渍 - - - - - - - - - - - --> + + 周边毛发 + + + + + + + + + + + + + - - - - - - - + > + + + + + + + - - - 水盆清理 - - - - - - - - - - - --> + + 屋内排泄物清理 + + + + + + + + + + + + + - - - - - - - - - - - 萌宠主食 - - - - - - - - - - - - - - - - - - - - - - - - 萌宠饮用水 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 零食、药品及其他 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 窝窝整理 - - - - - - - - - - - - - - - - - - - - - - - - 笼笼清理 - - - - - - - - - - - - - - - - - - - - - - - - 周边毛发 - - - - - - - - - - - - - - - - - - - - - - - - 屋内排泄物清理 - - - - - - - - - - - - - - - - - - - - + > + + + + + + + - - - 屋内呕吐物清理 - - - - - - - - - - - - - --> + + 屋内呕吐物清理 + + + + + + + + + + + + + - - - - - - - + > + + + + + + + - - - 猫砂盆整理及猫砂更换 - - - - - - - - - - - - - - - - --> + + 猫砂盆整理及猫砂更换 + + + + + + + + + + + + + + + + - - - - - - - + > + + + + + + + - - - 其他需求反馈 - - - - - - - - --> + + 其他需求反馈 + + + + + + + + - - - - - - - - - - + > + + + + - - - 基础检查 - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + 基础检查 + + + + + + + + + + + + + + + + + + + + - - - - - - - + > + + + + + + + - - - 健康情况 - - - - - - - - - - - - - - - - - + + + 健康情况 + + + + + + + + + + + + + + + + + - - - 其他 - - - - - - - - --> + + 其他 + + + + + + + + - - - + > + + + + + - + + + + + - - + + - + + + + + - - + + - + + + + + - - + + + - - - + @@ -1778,6 +1804,7 @@ import api from '@/utils/functions.js'; import HeaderNav from "@/components/HeaderNav/Index.vue"; import MzButton from "@/components/MzButton/Index.vue"; import {orderDone, orderEnd} from "@/api/order"; +import {orderServiceInfo} from "../../api/order"; export default { components: { @@ -1817,7 +1844,7 @@ export default { cat_litter: {option: '', remark: '', upload: []}, other_info: {option: '', remark: '', upload: []}, foundation: {option: '', remark: '', upload: []}, - health: {option: '健康活泼', remark: '', upload: []}, + health: '', health_other: {option: '', remark: '', upload: []}, pet_clean: {option: '', remark: '', upload: []}, before_facial: {option: '', remark: '', upload: []}, @@ -1890,6 +1917,9 @@ export default { onLoad(option) { this.model.order_service_id = option.id; this.model.leave = uni.$u.timeFormat(null, 'yyyy-mm-dd hh:MM'); + if(option.type === 'edit'){ + this.getServiceTable(option.id); + } }, computed: { api() { @@ -1897,6 +1927,60 @@ export default { }, }, methods: { + changeCollapse(name){ + if(this.collapseChecked === name){ + this.collapseChecked = ''; + }else{ + this.collapseChecked = name; + } + }, + getServiceTable(id){ + let that = this; + let images = [ + 'appliance', + 'before_status', + 'pet_status', + 'food_status', + 'sick', + 'excrement', + 'other', + 'food_bowl', + 'basin', + 'staple_food', + 'water', + 'snacks', + 'wowo', + 'cage', + 'hair', + 'pet_sick', + 'pet_excrement', + 'cat_litter', + 'other_info', + 'foundation', + // 'health', + 'health_other', + 'pet_clean', + 'before_facial', + 'pet_facial', + 'end_facial', + 'home_play', + 'out_play', + 'trash', + 'appliance_info', + 'pet_secure', + 'close', + 'close_mima', + 'key', + ]; + orderServiceInfo(id).then(data => { + let id = this.model.order_service_id; + this.model = data.data.endservice; + this.model.order_service_id = id; + images.forEach((item) => { + that.uploadShow(data.data.endservice[item].upload,item); + }); + }) + }, timeConfirm(e) { this.model.leave = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM'); }, @@ -1969,7 +2053,7 @@ export default { 'cat_litter', 'other_info', 'foundation', - 'health', + // 'health', 'health_other', 'pet_clean', 'before_facial', diff --git a/pages/OrderDetail/components/fomItem.vue b/pages/OrderDetail/components/fomItem.vue index 6645352..431b5ac 100644 --- a/pages/OrderDetail/components/fomItem.vue +++ b/pages/OrderDetail/components/fomItem.vue @@ -41,6 +41,7 @@ export default { } }, getShowStatus(){ + console.log(this.name) if(!this.isShow){ if(this.type === 'media' || this.type === 'text'){ return (Object.keys(this.data).length>0); diff --git a/pages/OrderDetail/index.vue b/pages/OrderDetail/index.vue index 9f16ed6..9d20165 100644 --- a/pages/OrderDetail/index.vue +++ b/pages/OrderDetail/index.vue @@ -184,8 +184,8 @@ + - @@ -194,19 +194,19 @@ 开始订单 - - - - - - - + + + + + + + - + @@ -215,62 +215,62 @@ 完成订单 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + @@ -292,7 +292,6 @@ import FooterNav from '@/components/FooterNav/Index.vue'; import RightNav from '@/components/RightNav/Index.vue'; import MzButton from '@/components/MzButton/Index.vue'; - import FromItem from './components/fomItem.vue'; import api from '@/utils/functions.js'; import {delPet, getDetail} from "@/api/pet"; import log from "@/utils/log"; @@ -306,7 +305,6 @@ FooterNav, RightNav, MzButton, - FromItem }, data() { return { @@ -360,8 +358,8 @@ ], detail:{}, service:{ - start:{}, - end:{}, + startservice:{}, + endservice:{}, }, id:0, } @@ -370,7 +368,6 @@ log(option); this.id = option.id; this.getDetail(option.id); - }, onShareAppMessage() { return { @@ -406,17 +403,15 @@ getDetail(id){ orderDetail(id).then(data => { this.detail = data.data; - log(data); - log(this.detail) if(this.detail.status>0){ - this.getOrderServiceInfo(this.id); + this.getOrderServiceInfo(id); } }) }, getOrderServiceInfo(id){ - orderServiceInfo(id).then(data => { - this.service.start = data.data.startservice; - this.service.end = data.data.endservice; + orderServiceInfo(id).then(res => { + this.service.startservice =res.data.startservice; + this.service.endservice =res.data.endservice; }) } },