imageAIVerifyErr copy.vue 13 KB

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