Преглед изворни кода

Merge branch 'feature_20260420_陈列任务识别排面数修改' into uat(dev)

# Conflicts:
#	src/api/index.js
zhujindu пре 1 дан
родитељ
комит
ea9cbe984a
2 измењених фајлова са 168 додато и 22 уклоњено
  1. 15 6
      src/api/index.js
  2. 153 16
      src/views/historicalVisit/perfectStoreTask.vue

+ 15 - 6
src/api/index.js

@@ -1170,19 +1170,19 @@ export function shareReportMobile(data) {
   });
 }
 
-// 获取服务商档案信息接口
-export function getServiceProviderArchives(query) {
+// 查询用户距离拜访门店得距离
+export function selectUserDistanceTheStore(query) {
   return request({
-    url: 'mobile/store/getServiceProviderArchives',
+    url: 'mobile/storeGroup/selectUserDistanceTheStore',
     method: 'get',
     params: query,
   });
 }
 
-// 查询用户距离拜访门店得距离
-export function selectUserDistanceTheStore(query) {
+// 获取服务商档案信息接口
+export function getServiceProviderArchives(query) {
   return request({
-    url: 'mobile/storeGroup/selectUserDistanceTheStore',
+    url: 'mobile/store/getServiceProviderArchives',
     method: 'get',
     params: query,
   });
@@ -1205,3 +1205,12 @@ export function getCljlaToDBLabel(query) {
     params: query,
   });
 }
+
+//修改陈列奖励案牌面数
+export function updateDisplayRewardCaseSkuCount(data) {
+  return request({
+    url: '/mobile/storeGroup/updateDisplayRewardCaseSkuCount',
+    method: 'post',
+    data,
+  });
+}

+ 153 - 16
src/views/historicalVisit/perfectStoreTask.vue

@@ -68,12 +68,33 @@
         </van-form>
       </div>
       <div class="skuDeatil">
-        <div class="headline" style="margin-top: 10px">
-          <span class="headlineIcon"></span>
-          <span class="headlineTitle">SKU图像识别结果</span>
+        <div class="headline" style="margin-top: 10px; justify-content: space-between">
+          <div
+            class="skuDeatilHeaderLeft"
+            style="
+              font-weight: 600;
+              font-size: 16px;
+              position: relative;
+              display: flex;
+              align-items: center;
+            ">
+            <span class="headlineIcon"></span>
+            <span class="headlineTitle">SKU图像识别结果</span>
+          </div>
+          <div
+            class="skuDeatilHeaderRight"
+            v-if="!formData.displayRewardTaskEditable"
+            style="margin-right: 72px">
+            <van-button plain type="primary" @click="editTable" v-if="!editTableFlag"
+              >编辑</van-button
+            >
+            <van-button type="primary" @click="saveTable" v-if="editTableFlag">保存</van-button>
+            <!-- <span style="color: #07c160" @click="editTable" v-if="!editTableFlag">编辑</span>
+            <span style="color: red" @click="saveTable" v-if="editTableFlag">保存</span> -->
+          </div>
         </div>
         <el-table
-          :data="formData.taskPhotoRecognitionResult"
+          :data="taskPhotoRecognitionResult"
           :span-method="taskObjectSpanMethod"
           border
           class="table-headermd1"
@@ -89,11 +110,18 @@
               <span class="tipTitle">{{ scope.row.skuProductName }}</span>
             </template>
           </el-table-column>
-          <el-table-column
-            label="排面数"
-            prop="identifyTheNumberOfCards"
-            align="center"
-            width="50"></el-table-column>
+          <el-table-column label="排面数" prop="identifyTheNumberOfCards" align="center" width="80">
+            <template slot-scope="scope">
+              <span v-if="!editTableFlag">{{ scope.row.identifyTheNumberOfCards }}</span>
+              <van-field
+                v-else
+                v-model="scope.row.identifyTheNumberOfCards"
+                placeholder="请输入排面数"
+                type="digit"
+                @input="onPositiveIntegerInput(scope.row, $event)"
+                @blur="inputbluwl(scope.row)" />
+            </template>
+          </el-table-column>
           <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
             <template slot-scope="scope">
               <span
@@ -138,13 +166,10 @@
       @close="vanPopup == false"
       custom-class="identifyResultdialog">
       <!-- 识别结果 -->
-      <div
-        class="identifyResult"
-        v-if="formData.taskPhotoRecognitionResult"
-        style="padding: 0 10px">
+      <div class="identifyResult" v-if="taskPhotoRecognitionResult" style="padding: 0 10px">
         <div class="resultContent">
           <el-table
-            :data="formData.taskPhotoRecognitionResult"
+            :data="taskPhotoRecognitionResult"
             :span-method="taskObjectSpanMethod"
             border
             class="table-headermd1"
@@ -175,6 +200,7 @@ import {
   addCollectionAnswerBatch,
   getVisitsDetailPerfectStore,
   getVisitsDetailPerfectStoreByTaskId,
+  updateDisplayRewardCaseSkuCount,
 } from '@/api/index';
 import taskTips from '@/views/deviceWithin/taskTips';
 import deleteUploadImg from '@/components/deleteUploadImgTaskPhoto';
@@ -195,6 +221,8 @@ export default {
       vanPopup: false,
       taskPhotoRecognitionResult: null,
       spanArr: [],
+      editTableFlag: false,
+      editCountArr: [],
     };
   },
   activated() {
@@ -204,6 +232,7 @@ export default {
     this.objectType = this.$route.query.photoType || '';
     this.insert = this.$route.query.insert;
     this.formData = null;
+    this.editCountArr = [];
     this.getVisitsDetailFun();
   },
   methods: {
@@ -247,8 +276,9 @@ export default {
         this.toastLoading().clear();
         if (res.code == 200 && res.data && res.data.length > 0) {
           this.formData = res.data[0];
-          console.log(this.formData.taskPhotoRecognitionResult);
-          this.getSpanArr(this.formData.taskPhotoRecognitionResult);
+          this.taskPhotoRecognitionResult =
+            JSON.parse(JSON.stringify(this.formData.taskPhotoRecognitionResult)) || [];
+          this.getSpanArr(this.taskPhotoRecognitionResult);
           console.log(this.formData);
         } else {
           this.formData = null;
@@ -289,6 +319,85 @@ export default {
         startPosition: index,
       });
     },
+    inputbluwl(row) {
+      let filteredResults = this.formData.taskPhotoRecognitionResult.filter(
+        (val) => val.skuProductCode == row.skuProductCode,
+      );
+      if (row.identifyTheNumberOfCards != null && row.identifyTheNumberOfCards !== '') {
+        const original = Number(filteredResults[0]?.identifyTheNumberOfCards || '0');
+        const current = Number(row.identifyTheNumberOfCards);
+        if (current < original) {
+          this.$toast('排面数不能小于原始值');
+          row.identifyTheNumberOfCards = String(original);
+          const existingIndex = this.editCountArr.findIndex(
+            (item) => item.skuProductCode === row.skuProductCode,
+          );
+          if (existingIndex >= 0) {
+            this.editCountArr.splice(existingIndex, 1);
+          }
+        } else {
+          const editCount = current - original;
+          if (editCount > 0) {
+            const existingIndex = this.editCountArr.findIndex(
+              (item) => item.skuProductCode === row.skuProductCode,
+            );
+            if (existingIndex >= 0) {
+              this.editCountArr[existingIndex].editCount = editCount;
+            } else {
+              this.editCountArr.push({
+                taskId: row.taskId, //	Long	任务id
+                visitId: row.visitId, //	Long	拜访id
+                skuProductCode: row.skuProductCode, //	String	产品code
+                editCount,
+              });
+            }
+          } else if (editCount === 0) {
+            const existingIndex = this.editCountArr.findIndex(
+              (item) => item.skuProductCode === row.skuProductCode,
+            );
+            if (existingIndex >= 0) {
+              this.editCountArr.splice(existingIndex, 1);
+            }
+          }
+        }
+      } else {
+        this.$toast('排面数不能为空');
+        row.identifyTheNumberOfCards = filteredResults[0]?.identifyTheNumberOfCards;
+      }
+    },
+    onPositiveIntegerInput(row, value) {
+      if (value == null) {
+        row.identifyTheNumberOfCards = '';
+        return;
+      }
+      let sanitized = String(value).replace(/[^\d]/g, '');
+      if (sanitized !== '') {
+        sanitized = sanitized.replace(/^0+/, '');
+        if (sanitized === '') {
+          sanitized = '0';
+        }
+      }
+      row.identifyTheNumberOfCards = sanitized;
+    },
+    editTable() {
+      this.editTableFlag = true;
+    },
+    saveTable() {
+      console.log(this.editCountArr);
+      if (this.editCountArr.length == 0) {
+        // this.$toast('请至少修改一项排面数');
+      } else {
+        updateDisplayRewardCaseSkuCount(this.editCountArr).then((res) => {
+          if (res.code == 200) {
+            this.$toast('修改成功');
+            this.getVisitsDetailFun();
+          } else {
+            this.$toast(res.message || '修改失败');
+          }
+        });
+      }
+      this.editTableFlag = false;
+    },
     onClickLeft() {
       this.$router.go(-1);
     },
@@ -448,6 +557,18 @@ export default {
     background-color: #ee0a24 !important;
     border: 1px solid #ee0a24 !important;
   }
+  .table-headermd1 {
+    .el-table__cell {
+      height: 50px !important;
+      .van-field {
+        padding: 0 !important;
+      }
+      .van-field__control {
+        height: 32px;
+        text-align: center;
+      }
+    }
+  }
 }
 .identifyResultdialog {
   width: vw(690) !important;
@@ -526,4 +647,20 @@ export default {
 .el-table::before {
   height: 0;
 }
+.skuDeatilHeaderRight {
+  button {
+    // width: 120px;
+    height: 36px;
+    border-radius: 18px;
+  }
+  .van-button--primary {
+    background-color: #2b73cf;
+    border-color: #2b73cf;
+  }
+  .van-button--primary.van-button--plain {
+    color: #3875c6;
+    border-color: #dcdfe6;
+    background-color: rgba(217, 233, 255, 1);
+  }
+}
 </style>