代码冲突合并

main
鹿和sa0ChunLuyu 2 years ago
parent f21d2ee1ea
commit 9f9f370ca3

@ -72,16 +72,15 @@ class ChatController extends Controller
public function GetWorkOrderList(){ public function GetWorkOrderList(){
Login::user(); Login::user();
$UserId=Login::$info->id; $UserId=Login::$info->id;
// $query=DB::table('chat_workorders')->where( //查看是否有未完结工单
// 'userid','=',$UserId )->where('status','<>',0) $IncompleteCount=DB::table('chat_workorders')->where('userid',$UserId)->whereIn('status',[1,2])->count();
// ->where( 'del','=',2)->get();
$query=DB::select("SELECT a.title,a.status,a.created_at ,b.content,a.id FROM $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 ( SELECT * FROM chat_workorders WHERE userid = ? AND STATUS <> 0 AND del = 2 ) AS a
LEFT JOIN ( LEFT JOIN (
select * from( select * from chat_lists where userid = ? AND msg_type = 0 ) as aa INNER 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 (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] ); 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获取工单列表 //admin获取工单列表
public function GetAdminWorkOrderList(){ 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'=>'操作失败']);
}
}
} }

@ -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/InsertMsg'] = `${url_}/api/Mp/Chat/InsertMsg`; //留言插入
url_array['Chat/GetSelfMsgList'] = `${url_}/api/Mp/Chat/GetSelfMsgList`;//获取留言列表(聊天记录) url_array['Chat/GetSelfMsgList'] = `${url_}/api/Mp/Chat/GetSelfMsgList`;//获取留言列表(聊天记录)
url_array['Chat/GetWorkOrderList'] = `${url_}/api/Mp/Chat/GetWorkOrderList`;//获取工单列表 url_array['Chat/GetWorkOrderList'] = `${url_}/api/Mp/Chat/GetWorkOrderList`;//获取工单列表
url_array['Chat/UserChangeWorkOrder'] = `${url_}/api/Mp/Chat/UserChangeWorkOrder`;//更改工单状态
url_array['YO'] = `${url_}/api/yo`; url_array['YO'] = `${url_}/api/yo`;
const api = (mark) => { const api = (mark) => {
if (mark === '') return url_; if (mark === '') return url_;

@ -52,6 +52,14 @@ export const ChatGetWorkOrderListAction = async (data) => await $post({
url: 'Chat/GetWorkOrderList', url: 'Chat/GetWorkOrderList',
data data
}) })
//更改工单状态
export const ChatChangeWorkOrderAction = async (data) => await $post({
url: 'Chat/UserChangeWorkOrder',
data
})
export const $image = (path) => { export const $image = (path) => {
return `${url_}${path}` return `${url_}${path}`
} }
@ -65,4 +73,4 @@ export const $response = (response, then, error = () => {}) => {
} }
then() then()
} }
} }

@ -27,15 +27,24 @@
<view class="ding"></view> <view class="ding"></view>
</view> </view>
<view class="end"> <view class="end">
<view class="msg_k"> <view v-if="workOrderstatus.status==1 || workOrderstatus.status==2 " >
<switch :checked="switchchecked" color="#ff7c2e" @change="CloseWorkOrderChange" style="transform:scale(0.7); margin-bottom: 10rpx;"/><span style="color:#808080; font-size: 22rpx;">关闭此工单</span>
</view>
<view class="msg_k">
<view class="msg_k_left"> <view class="msg_k_left">
<uni-easyinput :disabled="workOrderstatus.status!=3?false:true" type="textarea" v-model="msgContent" placeholder="请输入留言信息" /> <uni-easyinput :disabled="workOrderstatus.status!=3?false:true" type="textarea" v-model="msgContent" placeholder="请输入留言信息" />
</view> </view>
<view class="msg_k_right"><button type="primary" size="mini" plain="true" @click="send"></button></view> <view class="msg_k_right"><button type="primary" size="mini" plain="true" @click="send"></button></view>
</view> </view>
</view> </view>
<view>
<!-- 提示窗示例 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog cancelText="取消" confirmText="确定" title="提示" content="确定关闭此工单吗?" @confirm="dialogConfirm"
@close="dialogClose"></uni-popup-dialog>
</uni-popup>
</view>
</view> </view>
</template> </template>
@ -47,13 +56,55 @@
import { import {
ChatInsertMsgAction, ChatInsertMsgAction,
ChatGetSelfMsgListAction, ChatGetSelfMsgListAction,
$response ChatChangeWorkOrderAction,
$response
} from '@/api' } 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)=>{ onLoad((option)=>{
workOrderId.value=option.workorder 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 chatList=ref([]) //
let workOrderstatus=ref('')// let workOrderstatus=ref('')//
const send= async ()=>{ const send= async ()=>{
@ -92,7 +143,7 @@
uni.hideLoading(); uni.hideLoading();
$response(response, () => { $response(response, () => {
console.log(response) console.log(response)
chatList.value=response.data.list.reverse() chatList.value=response.data.list.reverse()
workOrderstatus.value=response.data.workorder_status workOrderstatus.value=response.data.workorder_status
toBottom() toBottom()
}) })
@ -102,10 +153,10 @@
const toBottom=()=>{ const toBottom=()=>{
nextTick(() => { nextTick(() => {
const container = document.getElementById('container'); // ID const container = document.getElementById('container'); // ID
container.scrollIntoView(false); container.scrollIntoView(false);
}) })
} }
onMounted(()=>{ onMounted(()=>{
getList() getList()
@ -115,12 +166,12 @@
<style scoped> <style scoped>
.chatk{ .chatk{
height: 100vh; height: 100vh;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.msg_list{ .msg_list{
padding: 20rpx; padding: 20rpx;
} }
.end{ .end{
background-color: #fff; background-color: #fff;
@ -131,7 +182,7 @@
} }
.msg_k { .msg_k {
display: flex; display: flex;
} }
.msg_k_left { .msg_k_left {
@ -142,7 +193,7 @@
} }
.msg_k_right { .msg_k_right {
margin-left: 20rpx; margin-left: 20rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -190,14 +241,14 @@
} }
.tishi{ .tishi{
text-align: center; text-align: center;
font-size: 20rpx; font-size: 20rpx;
color: #ccc; color: #ccc;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.user_img{ .user_img{
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
background-color: #eeeeee; background-color: #eeeeee;
border-radius: 50%; border-radius: 50%;
} }
.username{ .username{
@ -205,4 +256,4 @@
color: #ccc; color: #ccc;
text-align: center; text-align: center;
} }
</style> </style>

@ -6,7 +6,7 @@
<uni-easyinput maxlength="100" type="textarea" style="width: 600rpx;" v-model="title" placeholder="请简单描述您遇到的问题(100字以内)"></uni-easyinput> <uni-easyinput maxlength="100" type="textarea" style="width: 600rpx;" v-model="title" placeholder="请简单描述您遇到的问题(100字以内)"></uni-easyinput>
<button class="nextButton" @click="creatNew()"></button> <button class="nextButton" @click="creatNew()"></button>
</uni-section> </uni-section>
</uni-popup> </uni-popup>
<view class="top"> <view class="top">
<button size="mini" plain="true" class="addbutton" @click="creatClick()"></button> <button size="mini" plain="true" class="addbutton" @click="creatClick()"></button>
@ -31,7 +31,7 @@
<view v-else class="tishi" style="padding-top: 40rpx;"> <view v-else class="tishi" style="padding-top: 40rpx;">
欢迎使用工单 欢迎使用工单
</view> </view>
</view> </view>
</template> </template>
@ -60,9 +60,18 @@ watch(
let title=ref('') let title=ref('')
// //
const creatClick=()=>{ const creatClick=()=>{
title.value='' if(IncompleteCount.value==0){
titleInputDialog.value.open() title.value=''
} titleInputDialog.value.open()
}else{
uni.showToast({
title: "存在未关闭工单,请先关闭,再创建新工单",
duration: 2000,
icon:'none'
});
return false
}
}
const creatNew = async () => { const creatNew = async () => {
if(title.value==''){ if(title.value==''){
@ -72,7 +81,7 @@ watch(
icon:'none' icon:'none'
}); });
return false return false
} }
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
@ -89,7 +98,8 @@ watch(
} }
}) })
} }
let orderList = ref([]) let IncompleteCount=ref(0)
let orderList = ref([])
const getlist = async () => { const getlist = async () => {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
@ -100,19 +110,20 @@ watch(
console.log('---------------------') console.log('---------------------')
if (response.data.status) { if (response.data.status) {
orderList.value = response.data.list orderList.value = response.data.list
} IncompleteCount.value=response.data.incompleteCount
}
}) })
} }
onMounted(() => { onMounted(() => {
getlist() getlist()
}) })
console.log(55555555) console.log(55555555)
</script> </script>
<style scoped> <style scoped>
@ -129,7 +140,7 @@ watch(
.top{ .top{
width: 100%; width: 100%;
text-align: right; text-align: right;
padding-top: 20rpx; padding-top: 20rpx;
} }
.addbutton{ .addbutton{
margin-right: 20rpx; margin-right: 20rpx;
@ -151,4 +162,4 @@ watch(
font-size: 24rpx; font-size: 24rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
</style> </style>

Loading…
Cancel
Save