diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php
index e9e65bd..578960d 100644
--- a/app/Http/Controllers/ChatController.php
+++ b/app/Http/Controllers/ChatController.php
@@ -72,16 +72,15 @@ class ChatController extends Controller
public function GetWorkOrderList(){
Login::user();
$UserId=Login::$info->id;
-// $query=DB::table('chat_workorders')->where(
-// 'userid','=',$UserId )->where('status','<>',0)
-// ->where( 'del','=',2)->get();
+ //查看是否有未完结工单
+ $IncompleteCount=DB::table('chat_workorders')->where('userid',$UserId)->whereIn('status',[1,2])->count();
$query=DB::select("SELECT a.title,a.status,a.created_at ,b.content,a.id FROM
( SELECT * FROM chat_workorders WHERE userid = ? AND STATUS <> 0 AND del = 2 ) AS a
LEFT JOIN (
select * from( select * from chat_lists where userid = ? AND msg_type = 0 ) as aa INNER JOIN
(SELECT max(id) as bid, work_order_id as w_id FROM chat_lists WHERE userid = ? AND msg_type = 0 GROUP BY work_order_id) as bb
on aa.id=bb.bid) AS b ON a.id = b.work_order_id order by a.id desc",[$UserId,$UserId,$UserId] );
- return Yo::echo(['status' => true,'list'=>$query]);
+ return Yo::echo(['status' => true,'list'=>$query,'incompleteCount'=>$IncompleteCount]);
}
//admin获取工单列表
public function GetAdminWorkOrderList(){
@@ -147,5 +146,20 @@ class ChatController extends Controller
}
}
+ //H5用户自己关闭工单
+ public function UserChangeWorkOrder(){
+ $WorkOrderId=request('WorkOrder');
+ Login::user();
+ $UserId=Login::$info->id;
+
+ $u=DB::table('chat_workorders')->where(['id'=>$WorkOrderId,'userid'=>$UserId])->update([
+ 'status'=>3
+ ]);
+ if($u){
+ return Yo::echo(['status' => true,'msg'=>'操作完成']);
+ }else{
+ return Yo::echo(['status' => false,'msg'=>'操作失败']);
+ }
+ }
}
diff --git a/思信体检平台H5/api/api.js b/思信体检平台H5/api/api.js
index 2e0d286..231a8a1 100644
--- a/思信体检平台H5/api/api.js
+++ b/思信体检平台H5/api/api.js
@@ -16,7 +16,7 @@ url_array['Chat/creatNew'] = `${url_}/api/Mp/Chat/creatNew`;//新建对话
url_array['Chat/InsertMsg'] = `${url_}/api/Mp/Chat/InsertMsg`; //留言插入
url_array['Chat/GetSelfMsgList'] = `${url_}/api/Mp/Chat/GetSelfMsgList`;//获取留言列表(聊天记录)
url_array['Chat/GetWorkOrderList'] = `${url_}/api/Mp/Chat/GetWorkOrderList`;//获取工单列表
-
+url_array['Chat/UserChangeWorkOrder'] = `${url_}/api/Mp/Chat/UserChangeWorkOrder`;//更改工单状态
url_array['YO'] = `${url_}/api/yo`;
const api = (mark) => {
if (mark === '') return url_;
diff --git a/思信体检平台H5/api/index.js b/思信体检平台H5/api/index.js
index bedd31f..804f746 100644
--- a/思信体检平台H5/api/index.js
+++ b/思信体检平台H5/api/index.js
@@ -52,6 +52,14 @@ export const ChatGetWorkOrderListAction = async (data) => await $post({
url: 'Chat/GetWorkOrderList',
data
})
+
+//更改工单状态
+export const ChatChangeWorkOrderAction = async (data) => await $post({
+ url: 'Chat/UserChangeWorkOrder',
+ data
+})
+
+
export const $image = (path) => {
return `${url_}${path}`
}
@@ -65,4 +73,4 @@ export const $response = (response, then, error = () => {}) => {
}
then()
}
-}
\ No newline at end of file
+}
diff --git a/思信体检平台H5/pages/chat/chat.vue b/思信体检平台H5/pages/chat/chat.vue
index 668838a..f9a53ee 100644
--- a/思信体检平台H5/pages/chat/chat.vue
+++ b/思信体检平台H5/pages/chat/chat.vue
@@ -27,15 +27,24 @@
-
+
+ 关闭此工单
+
+
-
+
-
+
+
+
+
+
+
@@ -47,13 +56,55 @@
import {
ChatInsertMsgAction,
ChatGetSelfMsgListAction,
- $response
+ ChatChangeWorkOrderAction,
+ $response
} from '@/api'
- let workOrderId=ref('')
+ let switchchecked=ref(true);
+ let alertDialog=ref(null)
+ const dialogClose=()=>{
+
+ switchchecked.value=true
+ }
+
+ //关闭工单
+ const CloseWorkOrderChange=(e)=>{
+ if(e.detail.value==false){
+ alertDialog.value.open()
+ switchchecked.value=false
+ }
+
+ }
+
+ let workOrderId=ref('')
onLoad((option)=>{
workOrderId.value=option.workorder
- })
- let msgContent = ref("")
+ })
+ //更改工单状态
+ const dialogConfirm=async ()=>{
+ let data={
+ WorkOrder:workOrderId.value
+ }
+ const response = await ChatChangeWorkOrderAction(data)
+ $response(response, () => {
+ console.log(response)
+ if(response.data.status){
+ uni.showToast({
+ title: "工单成功关闭",
+ duration: 2000,
+ icon:'none'
+ });
+ getList()
+ }else{
+ uni.showToast({
+ title: response.data.msg,
+ duration: 2000,
+ icon:'none'
+ });
+ }
+ })
+ }
+
+ let msgContent = ref("")
let chatList=ref([]) //聊天记录
let workOrderstatus=ref('')//工单状态
const send= async ()=>{
@@ -92,7 +143,7 @@
uni.hideLoading();
$response(response, () => {
console.log(response)
- chatList.value=response.data.list.reverse()
+ chatList.value=response.data.list.reverse()
workOrderstatus.value=response.data.workorder_status
toBottom()
})
@@ -102,10 +153,10 @@
const toBottom=()=>{
nextTick(() => {
const container = document.getElementById('container'); // 替换为你的容器元素ID
-
+
container.scrollIntoView(false);
})
-
+
}
onMounted(()=>{
getList()
@@ -115,12 +166,12 @@
\ No newline at end of file
+
diff --git a/思信体检平台H5/pages/chat/orderList.vue b/思信体检平台H5/pages/chat/orderList.vue
index 8bfd2d9..fb0ade5 100644
--- a/思信体检平台H5/pages/chat/orderList.vue
+++ b/思信体检平台H5/pages/chat/orderList.vue
@@ -6,7 +6,7 @@
-
+
@@ -31,7 +31,7 @@
欢迎使用工单
-
+
@@ -60,9 +60,18 @@ watch(
let title=ref('')
//点击右上角新建按钮
const creatClick=()=>{
- title.value=''
- titleInputDialog.value.open()
- }
+ if(IncompleteCount.value==0){
+ title.value=''
+ titleInputDialog.value.open()
+ }else{
+ uni.showToast({
+ title: "存在未关闭工单,请先关闭,再创建新工单",
+ duration: 2000,
+ icon:'none'
+ });
+ return false
+ }
+ }
const creatNew = async () => {
if(title.value==''){
@@ -72,7 +81,7 @@ watch(
icon:'none'
});
return false
- }
+ }
uni.showLoading({
title: '加载中'
});
@@ -89,7 +98,8 @@ watch(
}
})
}
- let orderList = ref([])
+ let IncompleteCount=ref(0)
+ let orderList = ref([])
const getlist = async () => {
uni.showLoading({
title: '加载中'
@@ -100,19 +110,20 @@ watch(
console.log('---------------------')
if (response.data.status) {
orderList.value = response.data.list
- }
+ IncompleteCount.value=response.data.incompleteCount
+ }
})
-
+
}
-
-
+
+
onMounted(() => {
getlist()
-
+
})
console.log(55555555)
-
-
+
+
\ No newline at end of file
+