Browse Source

修改问题

master
396316021 1 year ago
parent
commit
cb41d80358
  1. 15
      api/chat.js
  2. 42
      pages/ChatDetail/index.vue
  3. 2
      pages/FeedLog/index.vue
  4. 5
      pages/Index/components/ChatPage/index.vue
  5. 10
      pages/Index/components/OrderPage/index.vue
  6. 1804
      pages/OrderConfirm/end.vue
  7. 1
      pages/OrderDetail/components/fomItem.vue
  8. 117
      pages/OrderDetail/index.vue

15
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<unknown>}
*/
export function waitToken(chat_id ){
return request({
url:'/user/regionChat-token',
method:"post",
data:{
chat_id :chat_id ,
}
})
}

42
pages/ChatDetail/index.vue

@ -9,17 +9,17 @@
<scroll-view class="detail-content" :scroll-y="true" :scroll-top="scrollTop"
style="padding-bottom: 90px;box-sizing: border-box;" :style="{height:windowHeihgt-40+'px'}">
<view id="scroll-view-content">
<view :class="item.send_user_id === user_id && type === item.type ? 'chat-item my-chat row' : 'chat-item other-chat row'"
<view :class="item.send_user_id === user_id ? 'chat-item my-chat row' : 'chat-item other-chat row'"
v-for="(item, index) in messageList">
<view class="chat-item-content row">
<view class="chat-avator " v-if="item.send_user_id !== user_id || type !== item.type">
<view class="chat-avator " v-if="item.send_user_id !== user_id">
<image mode="aspectFill" class="img" :src="item.avatar ? item.avatar : user.avatar"/>
</view>
<view class="chat-content-container " style="max-width: calc(100% - 50px);">
<view class="chat-time">{{item.user_name}} {{ item.create_time }}</view>
<view class="chat-content" style="word-break: break-all;">{{ item.info }}</view>
</view>
<view class="chat-avator " v-if="item.send_user_id === user_id && type === item.type">
<view class="chat-avator " v-if="item.send_user_id === user_id">
<image mode="aspectFill" class="img" :src="item.avatar ? item.avatar : user.avatar"/>
</view>
</view>
@ -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);

2
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] = [];

5
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';

10
pages/Index/components/OrderPage/index.vue

@ -68,7 +68,7 @@
<u-text :text="item.create_time" size="28" color="#767676" :lines="1"></u-text>
</view>
</view>
<view class="order-card-bottom col-12 row" :class="{showDone:(item.status === 0 || item.status === 1)}">
<view class="order-card-bottom col-12 row" :class="{showDone:(item.status === 0 || item.status === 1 || item.status === 2)}">
<view class="card-button" @click="navTo(`/pages/ChatDetail/index?id=${item.id}&type=2`)">
<MzButton
title="立即沟通"
@ -90,6 +90,14 @@
button-color="#D6FFF6"
button-width="100%"></MzButton>
</view>
<view v-if="item.status === 2" class="card-button" @click="navTo('/pages/OrderConfirm/end?type=edit&id=' + item.id)">
<MzButton
title="修改完成表单"
font-size="24rpx"
font-color="#4DC3B8"
button-color="#D6FFF6"
button-width="100%"></MzButton>
</view>
<view v-if="item.status === 0" class="card-button" @click="navTo('/pages/OrderConfirm/start?id=' + item.id)">
<MzButton
title="开始服务"

1804
pages/OrderConfirm/end.vue

File diff suppressed because it is too large Load Diff

1
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);

117
pages/OrderDetail/index.vue

@ -184,8 +184,8 @@
<view class="pet-detail-background"></view>
</view>
</view>
<view v-if="service?.startservice && Object.keys(service.startservice).length > 0 " class="pet-detail-bottom-container">
<view v-if="Object.keys(service.start).length > 0" class="pet-detail-bottom-container">
<view class="pet-detail-container">
<view class="pet-detail-gun col">
<image class="img" mode="heightFix" :src="staticImage.petGun"/>
@ -194,19 +194,19 @@
<view class="pet-detail-content">
<view class="content-item"><view>开始订单</view></view>
<FromItem :data="service.start.arrival_time" name="到达时间" type="text"></FromItem>
<FromItem :data="service.start.worker_confirm" name="宠物师确认" type="media"></FromItem>
<FromItem :data="service.start.hand_disinfect" name="手部消毒" type="default"></FromItem>
<FromItem :data="service.start.body_disinfect" name="全身消毒" type="default"></FromItem>
<FromItem :data="service.start.key" name="钥匙开启/收取" type="default"></FromItem>
<FromItem :data="service.start.key" name="钥匙描述" type="default"></FromItem>
<FromItem :data="service.start.service_tools" name="服务工具" type="text"></FromItem>
<FomItem :data="service.startservice.arrival_time" name="到达时间" type="text"></FomItem>
<FomItem :data="service.startservice.worker_confirm" name="宠物师确认" type="media"></FomItem>
<FomItem :data="service.startservice.hand_disinfect" name="手部消毒" type="default"></FomItem>
<FomItem :data="service.startservice.body_disinfect" name="全身消毒" type="default"></FomItem>
<FomItem :data="service.startservice.key" name="钥匙开启/收取" type="default"></FomItem>
<FomItem :data="service.startservice.key" name="钥匙描述" type="default"></FomItem>
<FomItem :data="service.startservice.service_tools" name="服务工具" type="text"></FomItem>
</view>
<view class="pet-detail-background"></view>
</view>
</view>
<view v-if="Object.keys(service.end).length > 0" class="pet-detail-bottom-container">
<view v-if="service.endservice && Object.keys(service.endservice).length > 0" class="pet-detail-bottom-container">
<view class="pet-detail-container">
<view class="pet-detail-gun col">
<image class="img" mode="heightFix" :src="staticImage.petGun"/>
@ -215,62 +215,62 @@
<view class="pet-detail-content">
<view class="content-item"><view>完成订单</view></view>
<FomItem type="default" :data="service.end.appliance" name="水电等情况"></FomItem>
<FomItem type="default" :data="service.end.before_status" name="入户前萌宠家居情况"></FomItem>
<FomItem type="default" :data="service.end.pet_status" name="萌宠生活区情况"></FomItem>
<FomItem type="default" :data="service.end.food_status" name="萌宠粮剩余情况"></FomItem>
<FomItem type="default" :data="service.end.sick" name="是否有萌宠呕吐物"></FomItem>
<FomItem type="default" :data="service.end.excrement" name="萌宠排泄物情况"></FomItem>
<FomItem type="default" :data="service.end.other" name="其他情况反馈"></FomItem>
<FomItem type="default" :data="service.end.food_bowl" name="食盆清洗并擦干水渍" option-name="value"></FomItem>
<FomItem type="default" :data="service.end.basin" name="水盆清理" option-name="value"></FomItem>
<FomItem type="default" :data="service.end.staple_food" name="萌宠主食"></FomItem>
<FomItem type="default" :data="service.end.water" name="萌宠饮用水"></FomItem>
<FomItem type="default" :data="service.end.snacks" name="零食、药品及其他"></FomItem>
<FomItem type="default" :data="service.end.wowo" name="窝窝整理"></FomItem>
<FomItem type="default" :data="service.end.cage" name="笼笼清理"></FomItem>
<FomItem type="default" :data="service.end.hair" name="周边毛发"></FomItem>
<FomItem type="default" :data="service.end.pet_sick" name="屋内排泄物清理"></FomItem>
<FomItem type="default" :data="service.end.pet_excrement" name="屋内呕吐物清理"></FomItem>
<FomItem type="default" :data="service.end.cat_litter" name="猫砂盆整理及猫砂更换"></FomItem>
<FomItem type="default" :data="service.end.other_info" name="其他需求反馈"></FomItem>
<FomItem type="default" :data="service.end.foundation" name="基础检查"></FomItem>
<FomItem type="default" :data="service.end.health" name="健康情况"></FomItem>
<FomItem type="default" :data="service.end.health_other" name="其他"></FomItem>
<FomItem type="default" :data="service.end.pet_clean" name="萌宠清洁"></FomItem>
<FomItem type="default" :data="service.end.before_facial" name="洗护前原始状态"></FomItem>
<FomItem type="default" :data="service.end.pet_facial" name="使用产品"></FomItem>
<FomItem type="default" :data="service.end.end_facial" name="洗护后状态"></FomItem>
<FomItem type="default" :data="service.end.home_play" name="在家互动"></FomItem>
<FomItem type="default" :data="service.end.out_play" name="外出遛弯">
<FomItem type="default" :data="service.endservice.appliance" name="水电等情况"></FomItem>
<FomItem type="default" :data="service.endservice.before_status" name="入户前萌宠家居情况"></FomItem>
<FomItem type="default" :data="service.endservice.pet_status" name="萌宠生活区情况"></FomItem>
<FomItem type="default" :data="service.endservice.food_status" name="萌宠粮剩余情况"></FomItem>
<FomItem type="default" :data="service.endservice.sick" name="是否有萌宠呕吐物"></FomItem>
<FomItem type="default" :data="service.endservice.excrement" name="萌宠排泄物情况"></FomItem>
<FomItem type="default" :data="service.endservice.other" name="其他情况反馈"></FomItem>
<FomItem type="default" :data="service.endservice.food_bowl" name="食盆清洗并擦干水渍" option-name="value"></FomItem>
<FomItem type="default" :data="service.endservice.basin" name="水盆清理" option-name="value"></FomItem>
<FomItem type="default" :data="service.endservice.staple_food" name="萌宠主食"></FomItem>
<FomItem type="default" :data="service.endservice.water" name="萌宠饮用水"></FomItem>
<FomItem type="default" :data="service.endservice.snacks" name="零食、药品及其他"></FomItem>
<FomItem type="default" :data="service.endservice.wowo" name="窝窝整理"></FomItem>
<FomItem type="default" :data="service.endservice.cage" name="笼笼清理"></FomItem>
<FomItem type="default" :data="service.endservice.hair" name="周边毛发"></FomItem>
<FomItem type="default" :data="service.endservice.pet_sick" name="屋内排泄物清理"></FomItem>
<FomItem type="default" :data="service.endservice.pet_excrement" name="屋内呕吐物清理"></FomItem>
<FomItem type="default" :data="service.endservice.cat_litter" name="猫砂盆整理及猫砂更换"></FomItem>
<FomItem type="default" :data="service.endservice.other_info" name="其他需求反馈"></FomItem>
<FomItem type="default" :data="service.endservice.foundation" name="基础检查"></FomItem>
<FomItem type="text" :data="service.endservice.health" name="健康情况"></FomItem>
<FomItem type="default" :data="service.endservice.health_other" name="其他"></FomItem>
<FomItem type="default" :data="service.endservice.pet_clean" name="萌宠清洁"></FomItem>
<FomItem type="default" :data="service.endservice.before_facial" name="洗护前原始状态"></FomItem>
<FomItem type="default" :data="service.endservice.pet_facial" name="使用产品"></FomItem>
<FomItem type="default" :data="service.endservice.end_facial" name="洗护后状态"></FomItem>
<FomItem type="default" :data="service.endservice.home_play" name="在家互动"></FomItem>
<FomItem type="default" :data="service.endservice.out_play" name="外出遛弯">
<template #option>
<view v-if="service.end.out_play.number_option.length>0">
<view v-if="service.endservice?.out_play.number_option.length>0">
<view class="">
<u-text text="排便情况" color="#999" size="28"></u-text>
</view>
<view class="">{{getString(service.end.out_play.number_option)}}</view>
<view class="">{{getString(service.endservice.out_play.number_option)}}</view>
</view>
<view v-if="service.end.out_play.feces_option.length>0">
<view v-if="service.endservice.out_play.feces_option.length>0">
<view class="">
<u-text text="便便情况" color="#999" size="28"></u-text>
</view>
<view class="">{{getString(service.end.out_play.feces_option)}}</view>
<view class="">{{getString(service.endservice.out_play.feces_option)}}</view>
</view>
<view v-if="service.end.out_play.in_home_option.length>0">
<view v-if="service.endservice.out_play.in_home_option.length>0">
<view class="">
<u-text text="入门前清洁" color="#999" size="28"></u-text>
</view>
<view class="">{{getString(service.end.out_play.in_home_option)}}</view>
<view class="">{{getString(service.endservice.out_play.in_home_option)}}</view>
</view>
</template>
</FomItem>
<FomItem type="default" :data="service.end.trash" name="垃圾携带"></FomItem>
<FomItem type="default" :data="service.end.pet_secure" name="空调"></FomItem>
<FomItem type="default" :data="service.end.pet_secure" name="离开时萌宠安全确认"></FomItem>
<FomItem type="default" :data="service.end.close" name="普通锁"></FomItem>
<FomItem type="default" :data="service.end.close_mima" name="密码锁"></FomItem>
<FomItem type="default" :data="service.end.key" name="房门钥匙"></FomItem>
<FomItem type="text" :data="service.end.leave" name="离开时间"></FomItem>
<FomItem type="default" :data="service.endservice.trash" name="垃圾携带"></FomItem>
<FomItem type="default" :data="service.endservice.pet_secure" name="空调"></FomItem>
<FomItem type="default" :data="service.endservice.pet_secure" name="离开时萌宠安全确认"></FomItem>
<FomItem type="default" :data="service.endservice.close" name="普通锁"></FomItem>
<FomItem type="default" :data="service.endservice.close_mima" name="密码锁"></FomItem>
<FomItem type="default" :data="service.endservice.key" name="房门钥匙"></FomItem>
<FomItem type="text" :data="service.endservice.leave" name="离开时间"></FomItem>
</view>
<view class="pet-detail-background"></view>
@ -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;
})
}
},

Loading…
Cancel
Save