imageAIVerifyErr.vue 15 KB

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