imageAIVerifyErr.vue 14 KB

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