imageAIVerifyErr.vue 14 KB

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