imageAIVerifyErr.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <div class="imageAIVerifyErr">
  3. <el-dialog
  4. title="图像识别结果"
  5. :visible.sync="vanPopup"
  6. width="80%"
  7. :append-to-body="true"
  8. :close-on-click-modal="false"
  9. @close="close"
  10. custom-class="AIVerifyErrdialog">
  11. <div class="AIVerifyErrMask" v-if="npkpiData">
  12. <!-- shopSignChange 与历史照片是否一致(是否要更换照片) 0一致(要更换),1不一致(不要更换) -->
  13. <template v-if="shopSignChange == 0">
  14. <div class="errorImg">
  15. <img v-if="url" :src="url" fit="contain" @click="previewsImg(url)" />
  16. <img v-else :src="imageEmpty" width="100%" height="300px" />
  17. </div>
  18. <div class="AIVerify">
  19. <span>{{ contentMessage }}</span>
  20. </div>
  21. <!-- 调色机识别异常反馈 -->
  22. <template v-if="npkpiData.recognizeType == 3 && tsjErrorMsg != ''">
  23. <div class="tsjErrorMsg">
  24. <span>{{ tsjErrorMsg }}</span>
  25. </div>
  26. </template>
  27. <template v-if="shotsNum >= maxNum">
  28. <div class="feedbackMessage">
  29. <!-- 调色机 -->
  30. <div class="label" v-if="npkpiData.recognizeType == 3">
  31. <template v-if="contentMessage == '投放号错误'">
  32. AI识别投放号为{{ deliveryCode }},如与实际投放号不一致,请在此反馈:
  33. </template>
  34. <template v-else-if="contentMessage == '投放号缺失'">
  35. AI未识别到调色机投放号,若AI识别错误,请在此反馈:
  36. </template>
  37. <template v-else>若认为AI识别错误,请在此反馈:</template>
  38. </div>
  39. <!-- 门店 -->
  40. <div class="label" v-else>若门店异常、或图像识别错误,可在此反馈:</div>
  41. <div class="value">
  42. <van-field
  43. v-model="feedbackMessage"
  44. rows="3"
  45. type="textarea"
  46. placeholder="请输原因" />
  47. </div>
  48. </div>
  49. </template>
  50. <div
  51. class="uploadBtnAIVerify"
  52. :style="{ 'justify-content': shotsNum >= maxNum ? 'space-between' : 'center' }">
  53. <div class="confirmUploadAIVerify" @click="uploadImg(false)">重新拍照</div>
  54. <div v-if="shotsNum >= maxNum" class="stillUploadAIVerify" @click="confirmUpload">
  55. 仍要上传
  56. </div>
  57. </div>
  58. <div class="tipsAIVerify">
  59. <template v-if="shotsNum >= maxNum && npkpiData.recognizeType == 1">
  60. <van-icon name="warning-o" />上传后作为本店标准店招,未来每次拜访时校验。
  61. </template>
  62. </div>
  63. </template>
  64. <!-- 店招识别,标准门店照对比 -->
  65. <template v-if="shopSignChange == 1">
  66. <div class="historyImageAIVerify">
  67. <!-- 有门店身份证时 只显示门店身份证和本地拜访照 -->
  68. <template v-if="storeIDCardUrl">
  69. <div class="storeIDCardUrl imageItemAIVerify">
  70. <img :src="storeIDCardUrl" @click="previewsImg(storeIDCardUrl)" />
  71. <span>门店标准店招</span>
  72. </div>
  73. </template>
  74. <template v-else>
  75. <div class="initImage imageItemAIVerify">
  76. <img
  77. v-if="createStoreUrl"
  78. :src="createStoreUrl"
  79. @click="previewsImg(createStoreUrl)" />
  80. <img v-else :src="imageEmpty" />
  81. <span>建店时门店照</span>
  82. </div>
  83. <div class="newestImage imageItemAIVerify">
  84. <img v-if="lastVisitUrl" :src="lastVisitUrl" @click="previewsImg(lastVisitUrl)" />
  85. <img v-else :src="imageEmpty" />
  86. <span>上次拜访店招</span>
  87. </div>
  88. </template>
  89. <div class="presentImage imageItemAIVerify">
  90. <img v-if="url" :src="url" @click="previewsImg(url)" />
  91. <img v-else :src="imageEmpty" />
  92. <span>本次拜访店招</span>
  93. </div>
  94. </div>
  95. <div class="AIVerify">
  96. <span>{{ contentMessage }}</span>
  97. </div>
  98. <div class="feedbackMessage">
  99. <div class="label">若门店异常、或图像识别错误,可在此反馈:</div>
  100. <div class="value">
  101. <van-field
  102. v-model="feedbackMessage"
  103. rows="2"
  104. autosize
  105. type="textarea"
  106. placeholder="请输入反馈意见" />
  107. </div>
  108. </div>
  109. <div class="uploadBtnAIVerify" style="justify-content: center">
  110. <div class="confirmUploadAIVerify" @click="uploadImg(true)">重新拍照</div>
  111. <div class="changeImageAIVerify" @click="confirmUpDataImage()">更新门店照</div>
  112. </div>
  113. <div class="tipsRemarkAIVerify">
  114. <!-- <div>若历史照片拍摄不规范,请选择<span style="color: #81b337">更新门店照</span></div> -->
  115. <div><van-icon name="warning-o" />若历史照片拍摄不规范,请选择更新门店照</div>
  116. <div>本次拜访店招会作为本店标准店招,未来每次拜访时校验</div>
  117. </div>
  118. </template>
  119. </div>
  120. </el-dialog>
  121. </div>
  122. </template>
  123. <script>
  124. import { ImagePreview } from 'vant';
  125. import store from '@/store';
  126. import { mapState } from 'vuex';
  127. import imageEmpty from '@/assets/imageEmpty.png';
  128. export default {
  129. props: {
  130. imageAIVerifyFlag: {
  131. type: Boolean,
  132. default: false,
  133. },
  134. imageAIVerifyData: {
  135. type: [Array, Object],
  136. },
  137. source: {
  138. // 新建店还是门店拜访 visit/newCreated
  139. type: String,
  140. },
  141. },
  142. computed: {
  143. ...mapState({
  144. shotsNum: (state) => state.otheStore.shotsNum,
  145. }),
  146. },
  147. watch: {
  148. imageAIVerifyFlag: {
  149. handler(val) {
  150. console.log('imageAIVerifyFlag=' + val);
  151. if (val) this.initData();
  152. },
  153. immediate: true,
  154. },
  155. },
  156. data() {
  157. return {
  158. imageEmpty: imageEmpty,
  159. contentMessage: '', //提示内容
  160. vanPopup: true,
  161. shopSignChange: 0,
  162. npkpiData: null,
  163. feedbackMessage: '', //反馈图像识别不正确原因
  164. url: '', // 本次图片路径
  165. createStoreUrl: '', // 建店时店招
  166. lastVisitUrl: '', // 上次拜访时店招
  167. storeIDCardUrl: '', // 门店身份证
  168. maxNum: 2,
  169. tsjErrorMsg: '',
  170. deliveryCode: '', //AI识别投放编号
  171. };
  172. },
  173. methods: {
  174. initData() {
  175. // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招)
  176. // shopSignChange 是否更换店招(0:未更换,1:更换) 1不一致,0一致
  177. // checkInfo 图片检查结果
  178. // cheatState 是否作弊(0:未作弊,1:作弊)
  179. // cheatType 作弊类型
  180. // qualifiedState 是否合格(0:不合格,1:合格)
  181. // unqualifiedReason 不合格原因
  182. this.feedbackMessage = '';
  183. this.shopSignChange = 0;
  184. this.npkpiData =
  185. this.source == 'visit'
  186. ? this.imageAIVerifyData.npkpiData
  187. : this.imageAIVerifyData[0].npkpiData;
  188. let imageAIVerifyData =
  189. this.source == 'visit' ? this.imageAIVerifyData : this.imageAIVerifyData[0];
  190. this.shopSignMatchList = this.npkpiData.shopSignMatchList;
  191. this.url = imageAIVerifyData.url || ''; // 图片路径
  192. this.createStoreUrl = imageAIVerifyData.createStoreUrl || ''; // 建店时店招
  193. this.lastVisitUrl = imageAIVerifyData.lastVisitUrl || ''; // 上次拜访时店招
  194. this.storeIDCardUrl = imageAIVerifyData.storeIDCardUrl || ''; // 门店身份证
  195. this.tsjErrorMsg = imageAIVerifyData.tsjErrorMsg || ''; // 调色机识别结果
  196. this.deliveryCode = this.npkpiData.colorantDispenserInfo
  197. ? this.npkpiData.colorantDispenserInfo.deliveryCode
  198. : ''; //AI识别投放编号
  199. // 先判断照片作弊情况,然后是否合格,然后是否和历史照片一致
  200. // 作弊和不合格记录识别次数,超过两次弹框提醒
  201. if (this.npkpiData.checkInfo) {
  202. // 作弊
  203. if (this.npkpiData.checkInfo.cheatState == 1) {
  204. // 增加识别次数
  205. store.dispatch('setShotsNum', this.shotsNum + 1);
  206. // 作弊原因
  207. this.contentMessage = this.contentMessage + this.npkpiData.checkInfo.cheatType;
  208. return;
  209. }
  210. // 不合格
  211. if (this.npkpiData.checkInfo.qualifiedState == 0) {
  212. // 增加识别次数
  213. store.dispatch('setShotsNum', this.shotsNum + 1);
  214. // 不合格原因
  215. this.contentMessage = this.contentMessage + this.npkpiData.checkInfo.unqualifiedReason;
  216. return;
  217. }
  218. // recognizeType 识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别)
  219. if (this.npkpiData.recognizeType == 1) {
  220. this.comparisonImage();
  221. } else {
  222. this.confirmUpload();
  223. }
  224. }
  225. },
  226. // 照片和历史照片是否一致
  227. comparisonImage() {
  228. this.shopSignChange = this.npkpiData.shopSignChange;
  229. if (this.npkpiData.shopSignChange == 1) {
  230. this.contentMessage = '与历史照片不一致,请确认店招是否更换?';
  231. return false;
  232. } else {
  233. this.confirmUpDataImage();
  234. }
  235. },
  236. // 重新拍照
  237. uploadImg(flag) {
  238. // flag: true,识别与历史照片不一致状态下,点击重新拍照,照片识别次数需要加1
  239. if (flag) {
  240. // 增加识别次数
  241. store.dispatch('setShotsNum', this.shotsNum + 1);
  242. }
  243. this.$emit('close');
  244. this.$emit('uploadImgFun');
  245. },
  246. // 照片是否入库,1.照片识别三次不通过仍要上传,2.照片识别通过
  247. // isUpdate:是否更新店招照片,只有门店店招需要更新
  248. confirmUpload() {
  249. // 拜访店招 不合格或作弊三次先提示是否仍要上传,确认后在判断是否与历史照片一致
  250. if (this.npkpiData.recognizeType == 1 && this.shotsNum >= this.maxNum) {
  251. this.comparisonImage();
  252. } else {
  253. this.$emit('close');
  254. this.$emit('confirmUpload', {
  255. data: this.imageAIVerifyData,
  256. feedbackMessage: this.feedbackMessage,
  257. });
  258. }
  259. },
  260. confirmUpDataImage() {
  261. this.$emit('close');
  262. this.$emit('confirmUpload', {
  263. data: this.imageAIVerifyData,
  264. isUpdate: 'true',
  265. feedbackMessage: this.feedbackMessage,
  266. });
  267. },
  268. close() {
  269. this.$emit('close');
  270. },
  271. openTips() {
  272. this.$dialog
  273. .confirm({
  274. title: '提示',
  275. message: '不规范的照片上传后会更换本店标准店招,未来每次拜访时校验。',
  276. showCancelButton: false,
  277. className: 'openTips',
  278. overlayClass: 'openTipsMask',
  279. })
  280. .then(() => {});
  281. },
  282. previewsImg(url) {
  283. ImagePreview({
  284. images: [url],
  285. className: 'AIImageItem',
  286. getContainer: 'el-dialog__wrapper',
  287. });
  288. },
  289. },
  290. };
  291. </script>
  292. <style lang="scss">
  293. .el-dialog__wrapper {
  294. z-index: 3333 !important;
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. background: rgba(0, 0, 0, 0.5) !important;
  299. .el-dialog__body {
  300. padding: 0px !important;
  301. }
  302. .el-dialog__header {
  303. text-align: center;
  304. }
  305. .AIVerifyErrdialog {
  306. width: vw(690) !important;
  307. margin-top: 1vh !important;
  308. border-radius: 8px !important;
  309. font-size: vw(32) !important;
  310. .el-dialog__headerbtn {
  311. width: vw(44);
  312. height: vw(44);
  313. background-color: #e1e1e1;
  314. border-radius: 50%;
  315. margin-top: -3px;
  316. }
  317. }
  318. .AIVerifyErrMask {
  319. width: 100%;
  320. padding: vw(30) vw(30) 0 vw(30);
  321. overflow: hidden;
  322. /* min-height: 180px; */
  323. .errorImg {
  324. width: 100%;
  325. display: flex;
  326. align-items: center;
  327. justify-content: center;
  328. min-height: vw(303);
  329. img {
  330. width: vw(235);
  331. height: vw(303);
  332. border-radius: vw(10);
  333. }
  334. }
  335. .AIVerify {
  336. font-size: vw(32);
  337. margin-top: vw(45);
  338. display: flex;
  339. justify-content: center;
  340. span {
  341. color: #9e0202;
  342. display: block;
  343. max-width: 70%;
  344. }
  345. }
  346. .tsjErrorMsg {
  347. font-size: vw(32);
  348. margin-top: vw(30);
  349. display: flex;
  350. justify-content: center;
  351. span {
  352. display: block;
  353. max-width: 90%;
  354. }
  355. }
  356. }
  357. .van-popup {
  358. width: 90%;
  359. padding: 8px;
  360. border-radius: 8px;
  361. overflow: hidden;
  362. }
  363. .van-f-red-AIVerify {
  364. color: red;
  365. width: 8px;
  366. display: inline-block;
  367. line-height: 26px;
  368. }
  369. .photoAIVerify {
  370. /*margin-top: 9px;*/
  371. float: right;
  372. }
  373. .title {
  374. font-size: 16px;
  375. font-weight: 600;
  376. text-align: center;
  377. padding: 5px;
  378. }
  379. .contentAIVerify {
  380. .uploadImgAIVerify {
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. padding: 8px 0;
  385. border-top: 1px solid #cfcfcf;
  386. .labelAIVerify {
  387. font-size: 14px;
  388. }
  389. }
  390. }
  391. .tipsAIVerify {
  392. padding: vw(30) 0 vw(40) 0;
  393. font-size: vw(22);
  394. color: #999999;
  395. }
  396. .coveringPosition {
  397. height: vw(60);
  398. }
  399. .uploadBtnAIVerify {
  400. display: flex;
  401. align-items: center;
  402. margin-top: vw(30);
  403. div {
  404. display: flex;
  405. justify-content: center;
  406. align-items: center;
  407. font-size: vw(28);
  408. color: #fff;
  409. border-radius: 10px;
  410. /* margin: 0 6px; */
  411. width: vw(298);
  412. height: vw(68);
  413. background-blend-mode: normal, normal;
  414. }
  415. .confirmUploadAIVerify {
  416. background-image: linear-gradient(180deg, #ffa1a1 0%, #f6695f 35%, #ed301d 100%),
  417. linear-gradient(#aed0f9, #aed0f9);
  418. box-shadow: 0px 3px 6px 0px rgba(183, 30, 14, 0.35);
  419. margin-right: 6px;
  420. }
  421. .changeImageAIVerify {
  422. background-image: linear-gradient(180deg, #3b89e6 0%, #1e6acb 35%, #014baf 100%),
  423. linear-gradient(#0356b9, #0356b9);
  424. box-shadow: 0px 3px 6px 0px rgba(6, 60, 131, 0.35);
  425. margin-left: 6px;
  426. }
  427. .stillUploadAIVerify {
  428. background-image: linear-gradient(180deg, #3b89e6 0%, #1e6acb 35%, #014baf 100%),
  429. linear-gradient(#0356b9, #0356b9);
  430. box-shadow: 0px 3px 6px 0px rgba(6, 60, 131, 0.35);
  431. margin-left: 6px;
  432. }
  433. }
  434. .historyImageAIVerify {
  435. display: flex;
  436. justify-content: space-around;
  437. padding: 5px 0;
  438. .imageItemAIVerify {
  439. width: 30%;
  440. display: flex;
  441. flex-direction: column;
  442. align-items: center;
  443. justify-content: center;
  444. span {
  445. font-size: 12px;
  446. padding-top: 3px;
  447. }
  448. img {
  449. width: vw(196);
  450. height: vw(228);
  451. border-radius: vw(10);
  452. }
  453. }
  454. }
  455. .tipsRemarkAIVerify {
  456. padding: vw(28) 0;
  457. div {
  458. font-size: vw(22);
  459. color: #999999;
  460. position: relative;
  461. padding-left: 17px;
  462. }
  463. .van-icon {
  464. position: absolute;
  465. left: 0;
  466. }
  467. }
  468. .feedbackMessage {
  469. margin-top: vw(45);
  470. .label {
  471. font-size: vw(26);
  472. line-height: vw(50);
  473. }
  474. .value {
  475. .van-cell {
  476. padding: 0;
  477. }
  478. }
  479. .van-field__body {
  480. border-radius: vw(10);
  481. border: solid 1px #aaaaaa;
  482. padding-left: vw(10);
  483. background-color: #e7e7e7;
  484. .van-field__control {
  485. }
  486. }
  487. }
  488. }
  489. .openTipsMask,
  490. .openTips {
  491. z-index: 3334 !important;
  492. }
  493. .van-overlay {
  494. /* z-index: 3334 !important; */
  495. }
  496. .van-image-preview {
  497. z-index: 3335 !important;
  498. background: rgba(0, 0, 0, 0.8) !important;
  499. }
  500. </style>