Browse Source

feature_20250704_陈列SKU图片识别

zhujindu 4 months ago
parent
commit
f601a571c3

+ 19 - 0
src/api/historicalVisit.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request';
+
+// sku识别信息查询接口
+export function photoSkuImgSummary(query) {
+  return request({
+    url: '/mobile/photoSkuImgSummary/list',
+    method: 'get',
+    params: query,
+  });
+}
+
+// 反馈接口
+export function photoSkuFeedback(data) {
+  return request({
+    url: 'mobile/photoSkuFeedback',
+    method: 'post',
+    data,
+  });
+}

+ 1 - 1
src/views/historicalVisit/historicalDetails.vue

@@ -94,7 +94,7 @@
         </van-collapse-item>
       </van-collapse>
       <div style="padding: 10px 16px; font-size: 16px; font-weight: bold">SKU图像识别结果</div>
-      <div class="card" v-if="list.visitSource != 2">
+      <div class="card" v-if="list.isSku == '是'">
         <div class="info" @click="toSkuRecognize">
           <p
             style="

+ 75 - 33
src/views/historicalVisit/skuRecognize.vue

@@ -2,44 +2,59 @@
   <div class="skuRecognize">
     <van-nav-bar class="navBar" title="拜访任务详情" left-arrow @click-left="onClickLeft">
       <template #right>
-        <div class="feedback" @click="feedbackShow = true">识别异常反馈</div>
+        <div
+          v-if="detail && detail.skuPhotoIdentifyId"
+          class="feedback"
+          @click="feedbackShow = true">
+          识别异常反馈
+        </div>
       </template>
     </van-nav-bar>
     <div class="content" v-if="detail">
       <div class="title">产品陈列照</div>
-      <div class="tipsTitle">目前仅识别</div>
-      <deleteUploadImg :imgs="detail.fileInfoList"></deleteUploadImg>
-      <div class="skuDeatil" v-if="detail.skuDeatil">
-        <div class="tableTitle">SKU识别:{{ detail.skuDeatil.length }}个</div>
+      <div class="tipsTitle">{{ detail.skuDescribe }}</div>
+      <div>
+        <van-row gutter="10">
+          <van-col span="4" v-for="(urls, index) in detail.fileUrlList" :key="index">
+            <div class="img-box">
+              <img :src="urls" @click="previewsImg(index)" />
+            </div>
+          </van-col>
+        </van-row>
+      </div>
+      <div class="skuDeatil" v-if="detail.skuList">
+        <div class="tableTitle">SKU识别:{{ detail.skuTotal }}个</div>
         <el-table
-          :data="detail.skuDeatil"
+          :data="detail.skuList"
           style="width: 100%; border-radius: 10px"
           border
           class="table-headermd">
-          <el-table-column label="SKU名称" prop="name" width="180" align="center">
+          <el-table-column label="序号" type="index" align="center"> </el-table-column>
+          <el-table-column label="品类" prop="skuProductType" align="center"></el-table-column>
+          <el-table-column label="SKU名称" prop="name" align="center">
             <template slot-scope="scope">
               <span class="tipTitle">{{ scope.row.name }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="数" prop="count" align="center"></el-table-column>
+          <el-table-column label="排面数" prop="count" align="center" width="60"></el-table-column>
         </el-table>
       </div>
       <!-- 返回历史 -->
-      <div class="feedbackHistorical" v-if="historicalData.length">
+      <div class="feedbackHistorical" v-if="detail.feedbackList.length">
         <div class="tableTitle">识别异常反馈</div>
         <div class="historicalContent">
-          <div class="rejectMsgItem" v-for="(item, index) in historicalData" :key="index">
+          <div class="rejectMsgItem" v-for="(item, index) in detail.feedbackList" :key="index">
             <div class="item approver">
               <span class="label">反馈人:</span>
-              <span class="value">{{ item.approvalUserName }}</span>
+              <span class="value">{{ item.nickName }}</span>
             </div>
             <div class="item approvalTime">
               <span class="label">反馈时间:</span>
-              <span class="value">{{ item.approvalTime }}</span>
+              <span class="value">{{ item.createTime }}</span>
             </div>
             <div class="item rejectCause">
               <span class="label">反馈内容:</span>
-              <span class="value">{{ item.approvalDesc }}</span>
+              <span class="value">{{ item.feedbackContent }}</span>
             </div>
           </div>
         </div>
@@ -66,6 +81,8 @@
 
 <script>
 import deleteUploadImg from '@/components/deleteUploadImg';
+import { photoSkuImgSummary, photoSkuFeedback } from '@/api/historicalVisit.js';
+import { ImagePreview } from 'vant';
 export default {
   name: 'skuRecognize',
   components: { deleteUploadImg },
@@ -75,16 +92,31 @@ export default {
       detail: null,
       feedbackShow: false,
       feedbackMessage: '', //反馈内容
-      historicalData: [],
     };
   },
   activated() {
-    this.visitsId = this.$route.query.visitsId;
+    this.visitsId = this.$route.query.visitId || '';
     this.getDetail();
   },
   methods: {
     getDetail() {
-      this.detail = {};
+      this.toastLoading(0, '加载中...', true);
+      photoSkuImgSummary({ visitsId: this.visitsId })
+        .then((res) => {
+          this.toastLoading().clear();
+          if (res.code == 200) {
+            this.detail = res.data;
+          } else {
+            this.$dialog.alert({
+              message: res.msg,
+            });
+          }
+        })
+        .catch((err) => {
+          this.$dialog.alert({
+            message: err.msg,
+          });
+        });
     },
     // 提交反馈
     feedbackSubmit() {
@@ -92,6 +124,19 @@ export default {
         this.$toast('请输入反馈意见!');
         return;
       }
+      photoSkuFeedback({
+        photoIdentifyId: this.detail.skuPhotoIdentifyId, //long	sku识别信息id
+        feedbackContent: this.feedbackMessage, //string	内容
+      }).then((res) => {
+        this.feedbackShow = false;
+        this.getDetail();
+      });
+    },
+    previewsImg(index) {
+      ImagePreview({
+        images: this.detail.fileUrlList,
+        startPosition: index,
+      });
     },
     onClickLeft() {
       this.$router.go(-1);
@@ -150,6 +195,8 @@ export default {
         overflow-y: auto;
         .rejectMsgItem {
           margin-bottom: 20px;
+          border: 1px solid #ccc;
+          padding: 10px;
           .item {
             padding: 5px 0;
             span {
@@ -167,6 +214,18 @@ export default {
         }
       }
     }
+    .img-box {
+      width: 100%;
+      height: 50px;
+      position: relative;
+      display: inline-block;
+      border-radius: 6px;
+      overflow: hidden;
+      img {
+        width: 100%;
+        height: 100%;
+      }
+    }
   }
   .feedbackMsgBox {
     min-height: 30%;
@@ -184,23 +243,6 @@ export default {
     .feedbackContent {
       flex: 1;
       overflow-y: auto;
-      .rejectMsgItem {
-        margin-bottom: 20px;
-        .item {
-          padding: 5px 0;
-          span {
-            display: inline-block;
-          }
-        }
-        .label {
-          width: 80px;
-          font-size: 14px;
-          font-weight: 600;
-        }
-        .value {
-          font-size: 14px;
-        }
-      }
     }
     .btnBox {
       height: 44px;