소스 검색

feat:添加报价单聊天

wangsisi 3 일 전
부모
커밋
287821568f

+ 21 - 6
src/components/chatWindow.vue

@@ -49,9 +49,15 @@
                         </div>
 
                          <!-- 对话样式消息 -->
-                         <div v-if="msg.messageType === 'card'" class="card-message" @click="handleCardClick(msg)">
-                            <div class="card-title">{{ msg.title || msg.content.title }}</div>
-                            <img :src="base_img_url2 + (msg.coverUrl || msg.content.coverUrl) + resize" alt="" />
+                        <div v-if="msg.messageType === 'card'" class="card-message" @click="handleCardClick(msg)">
+                            <template v-if="(msg.cardType || msg.content.cardType) === 'quotation'">
+                                <div class="card-title">向您发送了一张 服务报价单</div>
+                                <img src="https://birdseye-img.sysuimars.com/temp/price.png" alt="" />
+                            </template>
+                            <template v-else>
+                                <div class="card-title">{{ msg.title || msg.content.title }}</div>
+                                <img :src="base_img_url2 + (msg.coverUrl || msg.content.coverUrl) + resize" alt="" />
+                            </template>
                         </div>
 
                         <!-- <div class="time">{{ msg.time }}</div> -->
@@ -95,8 +101,14 @@
 
                         <!-- 对话样式消息 -->
                         <div v-if="msg.messageType === 'card'" class="card-message" @click="handleCardClick(msg)">
-                            <div class="card-title">{{ msg.title || msg.content.title }}</div>
-                            <img :src="base_img_url2 + (msg.coverUrl || msg.content.coverUrl) + resize" alt="" />
+                            <template v-if="(msg.cardType || msg.content.cardType) === 'quotation'">
+                                <div class="card-title">向您发送了一张 服务报价单</div>
+                                <img src="https://birdseye-img.sysuimars.com/temp/price.png" alt="" />
+                            </template>
+                            <template v-else>
+                                <div class="card-title">{{ msg.title || msg.content.title }}</div>
+                                <img :src="base_img_url2 + (msg.coverUrl || msg.content.coverUrl) + resize" alt="" />
+                            </template>
                         </div>
 
                         <!-- <div class="time">{{ msg.time }}</div> -->
@@ -306,7 +318,6 @@ watch(
                 if(route.query.pageParams) {
                     const params = JSON.parse(route.query.pageParams);
                     const imgArr = JSON.parse(params.executeEvidence);
-
                     const message = {
                         sender: "sent",
                         messageType: "card",
@@ -317,6 +328,10 @@ watch(
                         linkUrl:`/completed_work?json=${JSON.stringify({id:params.id})}`,
                         time: getCurrentTime(),
                     };
+                    if(params.type === 'quotation') {
+                        message.cardType = 'quotation';
+                    }
+                    
                     sendMessage(message)
                 }
                 if (props.text) {

+ 23 - 10
src/views/old_mini/modify_work/completedWork.vue

@@ -317,7 +317,7 @@
 
 <script setup>
 import customHeader from "@/components/customHeader.vue";
-import { onMounted, ref, computed } from "vue";
+import { ref, computed, onMounted } from "vue";
 // import NewFarmMap from "./newFarmMap";
 import { useStore } from "vuex";
 import { Popup } from "vant";
@@ -328,6 +328,7 @@ import priceTable from "../agri_work/components/priceTable.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import uploadExecute from "@/views/old_mini/task_condition/components/uploadExecute.vue";
 import { base_img_url2 } from "@/api/config";
+import { ElMessage } from "element-plus";
 
 const router = useRouter();
 const store = useStore();
@@ -431,17 +432,25 @@ const handleConfirmComplete = () => {
 
 const handleForward = () => {
     onlyShare.value = true;
-    setTimeout(() => {
-        uploadExecuteRef.value.showPopup(parmasPage.value,'share-sheet');
-    }, 10);
+    if(parmasPage.value.farmMiniUserId){
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup({...parmasPage.value, type:'quotation'});
+        }, 10);
+    }else{
+        ElMessage.warning('尚未绑定用户,暂时无法分享')
+    }
 }
 
 const onlyShare = ref(false);
 const handleShare = () => {
     onlyShare.value = true;
-    setTimeout(() => {
-        uploadExecuteRef.value.showPopup(parmasPage.value);
-    }, 10);
+    if(parmasPage.value.farmMiniUserId){
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup(parmasPage.value);
+        }, 10);
+    }else{
+        ElMessage.warning('尚未绑定用户,暂时无法分享')
+    }
 };
 const showUploadExecutePopup = () => {
     if (detailData.value?.executeEvidence.length) {
@@ -449,9 +458,13 @@ const showUploadExecutePopup = () => {
     } else {
         onlyShare.value = false;
     }
-    setTimeout(() => {
-        uploadExecuteRef.value.showPopup(parmasPage.value);
-    }, 10);
+    if(parmasPage.value.farmMiniUserId){
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup(parmasPage.value);
+        }, 10);
+    }else{
+        ElMessage.warning('尚未绑定用户,暂时无法分享')
+    }
 };
 // 地图
 // const areaRef = ref(null);

+ 22 - 9
src/views/old_mini/task_condition/components/task.vue

@@ -101,6 +101,7 @@ import { useRouter } from "vue-router";
 import uploadExecute from "./uploadExecute.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import wx from "weixin-js-sdk";
+import { ElMessage } from "element-plus";
 
 const store = useStore();
 const router = useRouter();
@@ -247,9 +248,13 @@ function toPage(item) {
         } else {
             onlyShare.value = false;
         }
-        setTimeout(() => {
-            uploadExecuteRef.value.showPopup(item,'share-sheet');
-        }, 10);
+        if(item.farmMiniUserId){
+            setTimeout(() => {
+                uploadExecuteRef.value.showPopup(item,'share-sheet');
+            }, 10);
+        }else{
+            ElMessage.warning('尚未绑定用户,暂时无法分享')
+        }
     } else {
         // 下发农事请求
         const data = {
@@ -297,9 +302,13 @@ function handleAction(item) {
         currentTask.value = item;
     }else{
         onlyShare.value = true;
-        setTimeout(() => {
-            uploadExecuteRef.value.showPopup(item,'share-sheet');
-        }, 10);
+        if(item.farmMiniUserId){
+            setTimeout(() => {
+                uploadExecuteRef.value.showPopup(item,'share-sheet');
+            }, 10);
+        }else{
+            ElMessage.warning('尚未绑定用户,暂时无法分享')
+        }
     }
 }
 
@@ -315,9 +324,13 @@ function handlePopupBtn() {
 
 function handleForward(item) {
     onlyShare.value = true;
-    setTimeout(() => {
-        uploadExecuteRef.value.showPopup(item,'share-sheet');
-    }, 10);
+    if(item.farmMiniUserId){
+        setTimeout(() => {
+            uploadExecuteRef.value.showPopup({...item, type:'quotation'},'share-sheet');
+        }, 10);
+    }else{
+        ElMessage.warning('尚未绑定用户,暂时无法分享')
+    }
 }
 
 </script>

+ 0 - 1
src/views/old_mini/task_condition/components/uploadExecute.vue

@@ -74,7 +74,6 @@ const onSelect = ({type}) => {
     if(type === 'birdseye') {
         router.push(`/chat_frame?userId=${farmData.value.farmMiniUserId}&name=${farmData.value.farmMiniUserName}&farmId=${farmData.value.farmId}&pageParams=${JSON.stringify(farmData.value)}`);
     }
-    console.log(type);
 };
 
 defineExpose({