imageAIVerifyErr.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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
  196. ? this.npkpiData.colorantDispenserInfo.deliveryCode
  197. : ''; //AI识别投放编号
  198. // 先判断照片作弊情况,然后是否合格,然后是否和历史照片一致
  199. // 作弊和不合格记录识别次数,超过两次弹框提醒
  200. if (this.npkpiData.checkInfo) {
  201. // 作弊
  202. if (this.npkpiData.checkInfo.cheatState == 1) {
  203. // 增加识别次数
  204. store.dispatch('setShotsNum', this.shotsNum + 1);
  205. // 作弊原因
  206. this.contentMessage = this.contentMessage + this.npkpiData.checkInfo.cheatType;
  207. return;
  208. }
  209. // 不合格
  210. if (this.npkpiData.checkInfo.qualifiedState == 0) {
  211. // 增加识别次数
  212. store.dispatch('setShotsNum', this.shotsNum + 1);
  213. // 不合格原因
  214. this.contentMessage = this.contentMessage + this.npkpiData.checkInfo.unqualifiedReason;
  215. return;
  216. }
  217. // recognizeType 识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别)
  218. if (this.npkpiData.recognizeType == 1) {
  219. this.comparisonImage();
  220. } else {
  221. this.confirmUpload();
  222. }
  223. }
  224. },
  225. // 照片和历史照片是否一致
  226. comparisonImage() {
  227. this.shopSignChange = this.npkpiData.shopSignChange;
  228. if (this.npkpiData.shopSignChange == 1) {
  229. this.contentMessage = '与历史照片不一致,请确认店招是否更换?';
  230. return false;
  231. } else {
  232. this.confirmUpDataImage();
  233. }
  234. },
  235. // 重新拍照
  236. uploadImg(flag) {
  237. // flag: true,识别与历史照片不一致状态下,点击重新拍照,照片识别次数需要加1
  238. if (flag) {
  239. // 增加识别次数
  240. store.dispatch('setShotsNum', this.shotsNum + 1);
  241. }
  242. this.$emit('close');
  243. this.$emit('uploadImgFun');
  244. },
  245. // 照片是否入库,1.照片识别三次不通过仍要上传,2.照片识别通过
  246. // isUpdate:是否更新店招照片,只有门店店招需要更新
  247. confirmUpload() {
  248. // 拜访店招 不合格或作弊三次先提示是否仍要上传,确认后在判断是否与历史照片一致
  249. if (this.npkpiData.recognizeType == 1 && this.shotsNum >= this.maxNum) {
  250. this.comparisonImage();
  251. } else {
  252. this.$emit('close');
  253. this.$emit('confirmUpload', {
  254. data: this.imageAIVerifyData,
  255. feedbackMessage: this.feedbackMessage,
  256. });
  257. }
  258. },
  259. confirmUpDataImage() {
  260. this.$emit('close');
  261. this.$emit('confirmUpload', {
  262. data: this.imageAIVerifyData,
  263. isUpdate: 'true',
  264. feedbackMessage: this.feedbackMessage,
  265. });
  266. },
  267. close() {
  268. this.$emit('close');
  269. },
  270. openTips() {
  271. this.$dialog
  272. .confirm({
  273. title: '提示',
  274. message: '不规范的照片上传后会更换本店标准店招,未来每次拜访时校验。',
  275. showCancelButton: false,
  276. className: 'openTips',
  277. overlayClass: 'openTipsMask',
  278. })
  279. .then(() => {});
  280. },
  281. previewsImg(url) {
  282. ImagePreview({
  283. images: [url],
  284. className: 'AIImageItem',
  285. getContainer: 'el-dialog__wrapper',
  286. });
  287. },
  288. },
  289. };
  290. </script>
  291. <style lang="scss">
  292. .el-dialog__wrapper {
  293. z-index: 3333 !important;
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. background: rgba(0, 0, 0, 0.5) !important;
  298. .el-dialog__body {
  299. padding: 0px !important;
  300. }
  301. .el-dialog__header {
  302. text-align: center;
  303. }
  304. .AIVerifyErrdialog {
  305. width: vw(690) !important;
  306. margin-top: 1vh !important;
  307. border-radius: 8px !important;
  308. font-size: vw(32) !important;
  309. .el-dialog__headerbtn {
  310. width: vw(44);
  311. height: vw(44);
  312. background-color: #e1e1e1;
  313. border-radius: 50%;
  314. margin-top: -3px;
  315. }
  316. }
  317. .AIVerifyErrMask {
  318. width: 100%;
  319. padding: vw(30) vw(30) 0 vw(30);
  320. overflow: hidden;
  321. /* min-height: 180px; */
  322. .errorImg {
  323. width: 100%;
  324. display: flex;
  325. align-items: center;
  326. justify-content: center;
  327. min-height: vw(303);
  328. img {
  329. width: vw(235);
  330. height: vw(303);
  331. border-radius: vw(10);
  332. }
  333. }
  334. .AIVerify {
  335. font-size: vw(32);
  336. margin-top: vw(45);
  337. display: flex;
  338. justify-content: center;
  339. span {
  340. color: #9e0202;
  341. display: block;
  342. max-width: 70%;
  343. }
  344. }
  345. .tsjErrorMsg {
  346. font-size: vw(32);
  347. margin-top: vw(30);
  348. display: flex;
  349. justify-content: center;
  350. span {
  351. display: block;
  352. max-width: 90%;
  353. }
  354. }
  355. }
  356. .van-popup {
  357. width: 90%;
  358. padding: 8px;
  359. border-radius: 8px;
  360. overflow: hidden;
  361. }
  362. .van-f-red-AIVerify {
  363. color: red;
  364. width: 8px;
  365. display: inline-block;
  366. line-height: 26px;
  367. }
  368. .photoAIVerify {
  369. /*margin-top: 9px;*/
  370. float: right;
  371. }
  372. .title {
  373. font-size: 16px;
  374. font-weight: 600;
  375. text-align: center;
  376. padding: 5px;
  377. }
  378. .contentAIVerify {
  379. .uploadImgAIVerify {
  380. display: flex;
  381. align-items: center;
  382. justify-content: space-between;
  383. padding: 8px 0;
  384. border-top: 1px solid #cfcfcf;
  385. .labelAIVerify {
  386. font-size: 14px;
  387. }
  388. }
  389. }
  390. .tipsAIVerify {
  391. padding: vw(30) 0 vw(40) 0;
  392. font-size: vw(22);
  393. color: #999999;
  394. }
  395. .coveringPosition {
  396. height: vw(60);
  397. }
  398. .uploadBtnAIVerify {
  399. display: flex;
  400. align-items: center;
  401. margin-top: vw(30);
  402. div {
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. font-size: vw(28);
  407. color: #fff;
  408. border-radius: 10px;
  409. /* margin: 0 6px; */
  410. width: vw(298);
  411. height: vw(68);
  412. background-blend-mode: normal, normal;
  413. }
  414. .confirmUploadAIVerify {
  415. background-image: linear-gradient(180deg, #ffa1a1 0%, #f6695f 35%, #ed301d 100%),
  416. linear-gradient(#aed0f9, #aed0f9);
  417. box-shadow: 0px 3px 6px 0px rgba(183, 30, 14, 0.35);
  418. margin-right: 6px;
  419. }
  420. .changeImageAIVerify {
  421. background-image: linear-gradient(180deg, #3b89e6 0%, #1e6acb 35%, #014baf 100%),
  422. linear-gradient(#0356b9, #0356b9);
  423. box-shadow: 0px 3px 6px 0px rgba(6, 60, 131, 0.35);
  424. margin-left: 6px;
  425. }
  426. .stillUploadAIVerify {
  427. background-image: linear-gradient(180deg, #3b89e6 0%, #1e6acb 35%, #014baf 100%),
  428. linear-gradient(#0356b9, #0356b9);
  429. box-shadow: 0px 3px 6px 0px rgba(6, 60, 131, 0.35);
  430. margin-left: 6px;
  431. }
  432. }
  433. .historyImageAIVerify {
  434. display: flex;
  435. justify-content: space-around;
  436. padding: 5px 0;
  437. .imageItemAIVerify {
  438. width: 30%;
  439. display: flex;
  440. flex-direction: column;
  441. align-items: center;
  442. justify-content: center;
  443. span {
  444. font-size: 12px;
  445. padding-top: 3px;
  446. }
  447. img {
  448. width: vw(196);
  449. height: vw(228);
  450. border-radius: vw(10);
  451. }
  452. }
  453. }
  454. .tipsRemarkAIVerify {
  455. padding: vw(28) 0;
  456. div {
  457. font-size: vw(22);
  458. color: #999999;
  459. position: relative;
  460. padding-left: 17px;
  461. }
  462. .van-icon {
  463. position: absolute;
  464. left: 0;
  465. }
  466. }
  467. .feedbackMessage {
  468. margin-top: vw(45);
  469. .label {
  470. font-size: vw(26);
  471. line-height: vw(50);
  472. }
  473. .value {
  474. .van-cell {
  475. padding: 0;
  476. }
  477. }
  478. .van-field__body {
  479. border-radius: vw(10);
  480. border: solid 1px #aaaaaa;
  481. padding-left: vw(10);
  482. background-color: #e7e7e7;
  483. .van-field__control {
  484. }
  485. }
  486. }
  487. }
  488. .openTipsMask,
  489. .openTips {
  490. z-index: 3334 !important;
  491. }
  492. .van-overlay {
  493. /* z-index: 3334 !important; */
  494. }
  495. .van-image-preview {
  496. z-index: 3335 !important;
  497. background: rgba(0, 0, 0, 0.8) !important;
  498. }
  499. </style>