imageAIVerifyErr.vue 15 KB

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