imageAIVerifyErr.vue 12 KB

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