shot.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281
  1. <template>
  2. <headerBar
  3. title="拍摄商品"
  4. showUser
  5. :menu="menu"
  6. />
  7. <hardware-check/>
  8. <div class="photography-page flex-col">
  9. <div class="main-container">
  10. <div class="content-wrapper flex-row">
  11. <!-- <img class="camera-image" referrerpolicy="no-referrer" src="@/assets/images/Photography/camera-icon.png" />-->
  12. <div class="step-number flex-col"><span class="text_22">1</span></div>
  13. <div class="step-one flex-col justify-between">
  14. <div class="step-header flex-row">
  15. <span class="step-title">第一步:获取商品货号</span>
  16. <img class="step-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/step1-icon.png" />
  17. <img class="step-divider" referrerpolicy="no-referrer"
  18. src="@/assets/images/Photography/step-divider-line.png" />
  19. </div>
  20. <div class="step-content flex-row justify-between">
  21. <div class="method-container flex-col">
  22. <div class="input-container flex-row">
  23. <el-input class="input-item" v-model="goods_art_no" placeholder="请输入货号"> </el-input>
  24. </div>
  25. <div class="auto-method flex-row justify-between">
  26. <div class="text-method-tag flex-col"><span class="text_4">自动获取</span></div>
  27. <span class="method-description">用遥控器扫描商品资料二维码</span>
  28. </div>
  29. <div class="scan-method flex-row justify-between">
  30. <div class="remote-control flex-col">
  31. </div>
  32. <!-- <span class="scan-label">遥控器扫描键</span>-->
  33. </div>
  34. </div>
  35. <img class="remote-image" referrerpolicy="no-referrer"
  36. src="@/assets/images/Photography/remote-control.png" />
  37. </div>
  38. </div>
  39. <div class="step-number flex-col"><span class="text_22">2</span></div>
  40. <div class="step-two flex-col justify-between">
  41. <span class="step-title">第二步:启动拍摄(根据按遥控器左右键启动)</span>
  42. <div class="shooting-container flex-col">
  43. <div class="shooting-tips flex-row justify-between">
  44. <img class="info-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/info-icon.png" />
  45. <span class="tips-text">遥控左右按键可启动拍摄,中间按钮可在拍摄5张主图后解锁,用于拍摄自定义图</span>
  46. </div>
  47. <div class="wifi mar-top-20">
  48. <img referrerpolicy="no-referrer"
  49. src="@/assets/images/Photography/wifi.png" style="width: 60px" />
  50. </div>
  51. <div class="remote-control-wrap">
  52. <RemoteControl
  53. @onRemoteControl="onRemoteControl"
  54. />
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="last-photo" v-show="showlastPhoto" v-key="lastPhoto.image_path">
  60. <div>{{lastPhtotoName[lastPhoto.image_index] || ''}}</div>
  61. <el-image :src="getFilePath(lastPhoto.image_path)" fit="contain" ></el-image>
  62. </div>
  63. <div class="history-section flex-col">
  64. <span class="history-title flex between">
  65. <div>拍摄记录</div>
  66. <div class="c-666 fs-12" v-if="goodsList.length">
  67. <el-button @click="delAll" class="input-button" type="primary" size="mini">一键删除</el-button>
  68. </div>
  69. </span>
  70. <img class="divider-line" referrerpolicy="no-referrer" src="@/assets/images/Photography/divider-line.png" />
  71. <div class="history-warp">
  72. <div v-if="!goodsList.length" class="fs-14 c-666 mar-top-50">
  73. {{ loading ? '数据正在加载中,请稍候...' : '暂无数据,请先进行拍摄'}}
  74. </div>
  75. <div v-else class="history-item clearfix" v-for="item,index in goodsList" style="padding:10px;">
  76. <div class="flex between flex-item c-333">
  77. <div class="chaochu flex-item flex left">货号:{{ item.goods_art_no }}</div>
  78. <div>
  79. <el-button size="small" type="primary" @click="reTakePictureNos(item.goods_art_no,item)" plain>重拍</el-button>
  80. <el-button size="small" @click="delGoods({goods_art_nos:[item.goods_art_no]})">删除</el-button>
  81. </div>
  82. </div>
  83. <div class="flex between flex-item c-333">
  84. <div class="c-999 fs-12">{{ getTime(item.action_time) }}</div>
  85. </div>
  86. <div class="mar-top-10 clearfix history-item_image_wrap" style="width: 100%" >
  87. <component class="history-item_image"
  88. v-loading="!image.image_path && runAction.goods_art_no == item.goods_art_no"
  89. v-for="image in item.items"
  90. :is="image.image_path ? 'div' : 'p'"
  91. >
  92. <el-popover
  93. popper-class="shot-image-popper"
  94. placement="left"
  95. :hide-after="0"
  96. v-if="image.image_path"
  97. >
  98. <template #reference>
  99. <div class="flex el-image_view">
  100. <el-image :src="getFilePath(image.image_path)" fit="contain" >
  101. <template #error>
  102. <div class="image-slot"></div>
  103. </template>
  104. </el-image>
  105. <div class="reset-button" @click="reTakePicture(image)">重拍</div>
  106. </div>
  107. </template>
  108. <el-image :src="getFilePath(image.image_path)" fit="contain" >
  109. <template #error>
  110. <div class="image-slot"></div>
  111. </template>
  112. </el-image>
  113. </el-popover>
  114. <el-image :src="getFilePath(image.image_path)" fit="contain" v-else>
  115. <template #error>
  116. <div class="image-slot"></div>
  117. </template>
  118. </el-image>
  119. </component>
  120. </div>
  121. </div>
  122. </div>
  123. <!-- 无数据 -->
  124. <!-- <div class="empty-state flex-col justify-between">
  125. <img
  126. class="empty-icon"
  127. referrerpolicy="no-referrer"
  128. src="@/assets/images/Photography/empty-state-icon.png"
  129. />
  130. <span class="empty-text">暂无数据</span>
  131. </div>-->
  132. <div v-if="goodsList.length" class="next-step button--primary1 flex-col" @click="openPhotographyDetail"><span
  133. class="next-step-text">拍摄完毕,进入下一步处理</span></div>
  134. </div>
  135. </div>
  136. </div>
  137. </template>
  138. <script setup lang="ts">
  139. import headerBar from '@/components/header-bar/index.vue'
  140. import { ref, reactive, onMounted, onBeforeUnmount,watchEffect, computed} from 'vue'
  141. import icpList from '@/utils/ipc'
  142. import client from "@/stores/modules/client";
  143. import socket from "@/stores/modules/socket";
  144. import { ElMessage ,ElMessageBox } from 'element-plus'
  145. import { getFilePath,getRouterUrl } from '@/utils/appfun'
  146. import {useRouter} from "vue-router";
  147. import HardwareCheck from '@/components/check/index.vue'
  148. import checkInfo from "@/stores/modules/check";
  149. import RemoteControl from '@/views/RemoteControl/index'
  150. const loading = ref(false)
  151. const runLoading = ref(false)
  152. const takePictureLoading = ref(false)
  153. import useUserInfo from "@/stores/modules/user";
  154. const useUserInfoStore = useUserInfo();
  155. const menu = computed(()=>{
  156. if(useUserInfoStore.userInfo.brand_company_code === '1300'){
  157. return [
  158. {
  159. type:'setting'
  160. },
  161. {
  162. type:'developer'
  163. }
  164. ]
  165. }
  166. return [
  167. {
  168. type:'setting'
  169. },
  170. ]
  171. })
  172. const clientStore = client();
  173. const Router = useRouter()
  174. /*const goodsList = ref([
  175. {
  176. "goods_art_no": "123456789",
  177. "items": [
  178. {
  179. "record_id":1,
  180. "image_deal_mode":0,
  181. "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0001.jpg",
  182. },
  183. {
  184. "record_id":2,
  185. "image_deal_mode":0,
  186. "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0002.jpg",
  187. },
  188. {
  189. "record_id":3,
  190. "image_deal_mode":0,
  191. "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0003.jpg",
  192. },
  193. {
  194. "record_id":4,
  195. "image_deal_mode":0,
  196. "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0004.jpg",
  197. },
  198. {
  199. "record_id":5,
  200. "image_deal_mode":0,
  201. "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0005.jpg",
  202. }
  203. ]
  204. }
  205. ])*/
  206. const goodsList = ref([])
  207. const goods_art_no_tpl = ref('')
  208. const goods_art_no = ref('')
  209. const runAction = ref({
  210. "action": "",
  211. "goods_art_no": ""
  212. })
  213. // 初始化 WebSocket 状态管理
  214. const socketStore = socket()
  215. /**
  216. * 保存货号模板到货号变量中。
  217. */
  218. function saveGoodsArtNo(){
  219. if(goods_art_no_tpl.value){
  220. goods_art_no.value = goods_art_no_tpl.value
  221. ElMessage.success('商品货号'+goods_art_no.value+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
  222. }
  223. }
  224. /**
  225. * 获取拍照记录。
  226. * @param params - 可选参数,用于分页或其他筛选条件。
  227. */
  228. async function getPhotoRecords(params?:{}) {
  229. clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
  230. loading.true = true;
  231. clientStore.ipc.send(icpList.takePhoto.getPhotoRecords,{
  232. ...params,
  233. page:1,
  234. size:100,
  235. });
  236. clientStore.ipc.on(icpList.takePhoto.getPhotoRecords, (event, result) => {
  237. loading.true = false;
  238. clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
  239. if(result.code === 0){
  240. console.log('======================');
  241. console.log(runAction.value);
  242. goodsList.value = result.data.list
  243. if(isDelGoodsGetList.value){
  244. isDelGoodsGetList.value = false;
  245. return;
  246. }
  247. getLastPhotoRecord()
  248. }else if(result.msg) {
  249. ElMessage.error(result.msg)
  250. }
  251. });
  252. }
  253. /**
  254. * 执行拍照操作。
  255. * @param data - 包含拍摄所需的数据对象。
  256. */
  257. async function runGoods(data) {
  258. if(runLoading.value || takePictureLoading.value){
  259. ElMessage.error('拍摄程序正在运行,请稍候')
  260. return
  261. }
  262. await socketStore.connectSocket();
  263. socketStore.sendMessage({
  264. type: 'run_mcu',
  265. data,
  266. })
  267. ElMessage.success('开始拍摄,请稍后')
  268. runLoading.value = true;
  269. runAction.value.action = data.action
  270. runAction.value.goods_art_no = data.goods_art_no
  271. goods_art_no.value = ''
  272. goods_art_no_tpl.value = ''
  273. reNosObj.value.goods_art_no = null;
  274. reNosObj.value.action = null;
  275. clientStore.ipc.on(icpList.socket.message + '_run_mcu', (event, result) => {
  276. clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
  277. console.log('_run_mcu');
  278. console.log(result);
  279. if(result.code !== 0 && result.msg){
  280. ElMessage.error(result.msg)
  281. // runLoading.value = false
  282. return;
  283. }
  284. })
  285. }
  286. /**
  287. * 格式化时间字符串。
  288. * @param time - 原始时间字符串。
  289. * @returns 格式化后的时间字符串,若输入为空则返回 null。
  290. */
  291. const getTime = function(time){
  292. if(!time) return null
  293. return time.replace('T',' ').substr(5,11)
  294. }
  295. /**
  296. * 删除所有商品货号的历史记录。
  297. */
  298. async function delAll(){
  299. let params = goodsList.value.map(item=>item.goods_art_no)
  300. await ElMessageBox.confirm('确定要删除当下的历史记录吗?', '提示', {
  301. confirmButtonText: '确定',
  302. cancelButtonText: '取消',
  303. })
  304. del({goods_art_nos:params})
  305. }
  306. /**
  307. * 删除指定的商品货号。
  308. * @param params - 包含需要删除的货号列表的对象。
  309. */
  310. const delGoods = async function(params){
  311. await ElMessageBox.confirm('确定要删除货号:'+params.goods_art_nos[0]+'的拍摄数据吗?', '提示', {
  312. confirmButtonText: '确定',
  313. cancelButtonText: '取消',
  314. })
  315. del(params)
  316. }
  317. /**
  318. * 删除指定的商品货号。
  319. * @param params - 包含需要删除的货号列表的对象。
  320. */
  321. const isDelGoodsGetList = ref(false)
  322. const del = async function(params){
  323. clientStore.ipc.removeAllListeners(icpList.takePhoto.delectGoodsArts);
  324. clientStore.ipc.send(icpList.takePhoto.delectGoodsArts,params);
  325. clientStore.ipc.on(icpList.takePhoto.delectGoodsArts, (event, result) => {
  326. clientStore.ipc.removeAllListeners(icpList.takePhoto.delectGoodsArts);
  327. if(result.code === 0){
  328. isDelGoodsGetList.value =true
  329. ElMessage.info('货号删除成功')
  330. getPhotoRecords()
  331. if(reNosObj.value.goods_art_no){
  332. runGoods(reNosObj.value)
  333. }
  334. }else if(result.msg) {
  335. ElMessage.error(result.msg)
  336. }
  337. });
  338. }
  339. //单个重拍
  340. const reTakePicture = async (img)=>{
  341. if(!img.id) return;
  342. await ElMessageBox.confirm('此操作会先删除此数据,需要继续吗?', '提示', {
  343. confirmButtonText: '确定',
  344. cancelButtonText: '取消',
  345. })
  346. socketStore.sendMessage({
  347. type: 're_take_picture',
  348. "data":{"record_id":img.id},
  349. })
  350. clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
  351. clientStore.ipc.on(icpList.socket.message + '_re_take_picture', (event, result) => {
  352. console.log('_re_take_picture')
  353. console.log(result)
  354. if(result.code === 0){
  355. getPhotoRecords()
  356. setTimeout(()=>{
  357. showlastPhoto.value = false
  358. },6000)
  359. }else if(result.msg) {
  360. ElMessage.error(result.msg)
  361. }
  362. clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
  363. })
  364. }
  365. const reNosObj = ref({
  366. goods_art_no:null,
  367. action:null,
  368. })
  369. //货号重拍
  370. const reTakePictureNos = async (goods_art_no,item)=>{
  371. await ElMessageBox.confirm('此操作会先删除删除货号:'+goods_art_no+'的拍摄数据吗,需要继续吗?', '提示', {
  372. confirmButtonText: '确定',
  373. cancelButtonText: '取消',
  374. })
  375. reNosObj.value.goods_art_no = goods_art_no
  376. reNosObj.value.action = '执行左脚程序'
  377. if(item.items && typeof item.items === 'object' && item.items[0].image_deal_mode){
  378. reNosObj.value.action = '执行右脚程序'
  379. }
  380. del({goods_art_nos:[goods_art_no]})
  381. }
  382. /**
  383. * 检查是否可以进入下一步操作。
  384. */
  385. const next = async function(){
  386. if(runLoading.value){
  387. ElMessage.error('正在拍摄中,请稍候')
  388. return;
  389. }
  390. if(goodsList.length){
  391. ElMessage.error('请先拍摄商品。')
  392. return;
  393. }
  394. }
  395. /**
  396. * 页面挂载时初始化事件监听器并获取初始数据。
  397. */
  398. onMounted(async () => {
  399. // 监听蓝牙扫描事件
  400. clientStore.ipc.on(icpList.socket.message + '_blue_tooth_scan', (event, result) => {
  401. console.log('_blue_tooth_scan')
  402. if (result.code === 0 && result.data?.data) {
  403. console.log(goods_art_no.value);
  404. if(!goods_art_no.value){
  405. ElMessage.error('请先扫描货号或者手动输入货号!')
  406. return;
  407. }
  408. runGoods({
  409. ...result.data?.data,
  410. goods_art_no: goods_art_no.value
  411. })
  412. }
  413. });
  414. /* window.addEventListener('storage', handleStorageEvent);*/
  415. await getPhotoRecords();
  416. // 监听图片处理完成事件
  417. clientStore.ipc.on(icpList.socket.message + '_image_process', (event, result) => {
  418. console.log('_image_process')
  419. console.log(result)
  420. getPhotoRecords()
  421. // 延迟两秒再获取一遍数据
  422. setTimeout(()=>{
  423. getPhotoRecords()
  424. },3000)
  425. })
  426. // 监听拍照完成事件
  427. clientStore.ipc.on(icpList.socket.message + '_photo_take', (event, result) => {
  428. console.log('_photo_take')
  429. console.log(result)
  430. if(result.status === 2 && result.msg.includes('执行完成')){
  431. getPhotoRecords()
  432. // 延迟两秒再获取一遍数据
  433. setTimeout(()=>{
  434. getPhotoRecords()
  435. },3000)
  436. takePictureLoading.value = false;
  437. }
  438. })
  439. // 监听拍照完成后的最终状态事件
  440. clientStore.ipc.on(icpList.socket.message + '_photo_take_finish', (event, result) => {
  441. console.log('_photo_take_finish')
  442. console.log(result)
  443. if(result.code === 0) {
  444. runLoading.value = false;
  445. runAction.value.goods_art_no = '';
  446. runAction.value.action = '';
  447. setTimeout(()=>{
  448. showlastPhoto.value = false
  449. },5000)
  450. }
  451. })
  452. // 监听手动触发拍照事件
  453. clientStore.ipc.on(icpList.socket.message + '_handler_take_picture', async (event, result) => {
  454. console.log('_handler_take_picture')
  455. console.log(result)
  456. if(result.code === 0){
  457. if(runLoading.value || takePictureLoading.value){
  458. ElMessage.error('拍摄程序正在运行,请稍候')
  459. return
  460. }
  461. ElMessage.success('正在拍摄中,请稍候')
  462. await socketStore.connectSocket();
  463. socketStore.sendMessage(result.data)
  464. takePictureLoading.value = true;
  465. getPhotoRecords()
  466. // 延迟两秒再获取一遍数据
  467. setTimeout(()=>{
  468. getPhotoRecords()
  469. },3000)
  470. }
  471. })
  472. })
  473. const onRemoteControl = (type)=>{
  474. if(type == 'take_picture'){
  475. if(runLoading.value || takePictureLoading.value){
  476. ElMessage.error('拍摄程序正在运行,请稍候')
  477. return
  478. }
  479. ElMessage.success('正在拍摄中,请稍候')
  480. socketStore.sendMessage({
  481. type: 'handler_take_picture',
  482. })
  483. return;
  484. }
  485. if(!goods_art_no.value){
  486. ElMessage.error('请先扫描货号或者手动输入货号!')
  487. return;
  488. }
  489. let action = '执行左脚程序'
  490. if(type === 'right') action = '执行右脚程序'
  491. runGoods({
  492. "action": action,
  493. "goods_art_no": goods_art_no.value,
  494. })
  495. }
  496. /*const handleStorageEvent = (e) => {
  497. if(e.key === 'run_mcu' && e.newValue){
  498. if(!goods_art_no.value){
  499. ElMessage.error('请先扫描货号或者手动输入货号!')
  500. localStorage.setItem('run_mcu','')
  501. return;
  502. }
  503. let action = '执行左脚程序'
  504. if(e.newValue === 'right') action = '执行右脚程序'
  505. runGoods({
  506. "action": action,
  507. "goods_art_no": goods_art_no.value,
  508. })
  509. localStorage.setItem('run_mcu','')
  510. }
  511. };*/
  512. const checkInfoStore = checkInfo()
  513. checkInfoStore.set_blue_tooth_scan_NO('')
  514. watchEffect(async ()=>{
  515. if(checkInfoStore.blue_tooth_scan_NO){
  516. ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
  517. goods_art_no.value = checkInfoStore.blue_tooth_scan_NO
  518. checkInfoStore.set_blue_tooth_scan_NO('')
  519. }
  520. })
  521. /**
  522. * 页面卸载时移除所有事件监听器。
  523. */
  524. onBeforeUnmount(() => {
  525. clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
  526. clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
  527. clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
  528. clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
  529. clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take_finish');
  530. /* window.removeEventListener('storage', handleStorageEvent);*/
  531. })
  532. /*
  533. * 打开最近一张拍摄图
  534. * */
  535. const lastPhoto = ref({})
  536. const showlastPhoto = ref(false)
  537. const lastPhtotoName = ref({
  538. 0:"俯视图",
  539. 1:"侧视图",
  540. 2:"后视图",
  541. 3:"鞋底",
  542. 4:"内里",
  543. })
  544. const getLastPhotoRecord = async ()=>{
  545. if(goodsList.value && goodsList.value.length === 0) return;
  546. clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
  547. clientStore.ipc.send(icpList.takePhoto.getLastPhotoRecord,);
  548. clientStore.ipc.on(icpList.takePhoto.getLastPhotoRecord, (event, result) => {
  549. console.log('getLastPhotoRecord')
  550. console.log(result)
  551. console.log(runAction.value)
  552. clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
  553. if(result.code === 0){
  554. if(lastPhoto.value.image_path){
  555. if( lastPhoto.value.image_path == result.data.image_path) return;
  556. if(runAction.value.goods_art_no === result.data.goods_art_no){
  557. showlastPhoto.value = true
  558. }
  559. }
  560. lastPhoto.value = result.data
  561. }else if(result.msg) {
  562. ElMessage.error(result.msg)
  563. }
  564. });
  565. }
  566. /**
  567. * 打开主图详情页面。
  568. */
  569. function openPhotographyDetail() {
  570. if(takePictureLoading.value){
  571. ElMessage.error('正在拍摄中,请稍候')
  572. return;
  573. }
  574. const { href } = Router.resolve({
  575. name: 'PhotographyDetail',
  576. query:{
  577. goods_art_nos:goodsList.value.map(item=>item.goods_art_no),
  578. }
  579. })
  580. clientStore.ipc.removeAllListeners(icpList.utils.openMain);
  581. let params = {
  582. title: '主图与详情生成',
  583. width: 1000,
  584. height: 630,
  585. frame: true,
  586. id: "PhotographyDetail",
  587. url: getRouterUrl(href)
  588. }
  589. clientStore.ipc.send(icpList.utils.openMain, params);
  590. }
  591. </script>
  592. <style lang="scss">
  593. .shot-image-popper {
  594. width: calc(100vw - 370px) !important;
  595. left: 20px !important;
  596. top: 50px !important;
  597. height: calc(100vh - 70px) !important;
  598. transform: translate(0px, 0px) !important;
  599. .el-image {
  600. width: 100%;
  601. height:100%;
  602. display: block;
  603. .el-image__inner {
  604. width: 100%;
  605. height:100%;
  606. display: block;
  607. }
  608. }
  609. }
  610. </style>
  611. <style scoped lang="scss">
  612. .photography-page {
  613. background-color: rgba(255, 255, 255, 1);
  614. position: relative;
  615. .main-container {
  616. position: relative;
  617. display: flex;
  618. .content-wrapper {
  619. flex-grow: 1 ;
  620. position: relative;
  621. top: 0;
  622. left: 0;
  623. right: 0;
  624. bottom: 0;
  625. margin: auto;
  626. justify-content: center;
  627. .step-number {
  628. background-color: rgba(22, 119, 255, 1);
  629. border-radius: 50%;
  630. height: 32px;
  631. margin-top: 51px;
  632. width: 32px;
  633. .text_22 {
  634. width: 6px;
  635. height: 22px;
  636. overflow-wrap: break-word;
  637. color: rgba(255, 255, 255, 1);
  638. font-size: 14px;
  639. font-weight: NaN;
  640. text-align: right;
  641. white-space: nowrap;
  642. line-height: 22px;
  643. margin: 5px 0 0 13px;
  644. }
  645. }
  646. .step-one {
  647. width: 426px;
  648. height: 521px;
  649. margin: 55px 0 0 5px;
  650. .step-header {
  651. width: 391px;
  652. height: 24px;
  653. margin-left: 3px;
  654. .step-title {
  655. width: 160px;
  656. height: 24px;
  657. overflow-wrap: break-word;
  658. color: rgba(0, 0, 0, 0.85);
  659. font-size: 16px;
  660. font-family: PingFangSC-Medium;
  661. font-weight: 500;
  662. text-align: left;
  663. white-space: nowrap;
  664. line-height: 24px;
  665. }
  666. .step-icon {
  667. width: 32px;
  668. height: 20px;
  669. margin-top: 4px;
  670. }
  671. .step-divider {
  672. width: 191px;
  673. height: 1px;
  674. margin: 13px 0 0 8px;
  675. }
  676. }
  677. .step-content {
  678. width: 426px;
  679. height: 469px;
  680. margin-top: 28px;
  681. .method-container {
  682. background-color: rgba(247, 247, 247, 1);
  683. height: 484px;
  684. width: 353px;
  685. .auto-method {
  686. width: 253px;
  687. height: 24px;
  688. margin: 28px 0 0 14px;
  689. .text-method-tag {
  690. background-color: rgba(0, 174, 30, 1);
  691. height: 24px;
  692. width: 65px;
  693. .text_4 {
  694. width: 56px;
  695. height: 20px;
  696. overflow-wrap: break-word;
  697. color: rgba(255, 255, 255, 1);
  698. font-size: 14px;
  699. font-family: PingFangSC-Semibold;
  700. font-weight: 600;
  701. text-align: left;
  702. white-space: nowrap;
  703. line-height: 20px;
  704. margin: 2px 0 0 4px;
  705. }
  706. }
  707. .method-description {
  708. width: 182px;
  709. height: 20px;
  710. overflow-wrap: break-word;
  711. color: rgba(71, 71, 71, 1);
  712. font-size: 14px;
  713. font-family: PingFangSC-Semibold;
  714. font-weight: 600;
  715. text-align: left;
  716. white-space: nowrap;
  717. line-height: 20px;
  718. margin-top: 2px;
  719. }
  720. }
  721. .scan-method {
  722. width: 350px;
  723. height: 350px;
  724. margin: 10px;
  725. .remote-control {
  726. width: 350px;
  727. height: 350px;
  728. background: url(@/assets/images/Photography/left.png) 0px 0px no-repeat;
  729. background-size: 300px 300px;
  730. position: relative;
  731. .scan-button {
  732. background-color: rgba(0, 174, 30, 1);
  733. border-radius: 50%;
  734. width: 27px;
  735. height: 27px;
  736. margin: 27px 0 0 34px;
  737. }
  738. .scan-line {
  739. position: absolute;
  740. left: 52px;
  741. top: 40px;
  742. width: 112px;
  743. height: 1px;
  744. }
  745. }
  746. .scan-label {
  747. width: 96px;
  748. height: 22px;
  749. overflow-wrap: break-word;
  750. color: rgba(0, 174, 30, 1);
  751. font-size: 16px;
  752. font-family: PingFangSC-Semibold;
  753. font-weight: 600;
  754. text-align: left;
  755. white-space: nowrap;
  756. line-height: 22px;
  757. margin-top: 30px;
  758. }
  759. }
  760. .manual-method {
  761. width: 155px;
  762. height: 24px;
  763. margin: 53px 0 0 14px;
  764. .method-tag {
  765. background-color: rgba(0, 148, 174, 1);
  766. height: 24px;
  767. width: 65px;
  768. .text_7 {
  769. width: 56px;
  770. height: 20px;
  771. overflow-wrap: break-word;
  772. color: rgba(255, 255, 255, 1);
  773. font-size: 14px;
  774. font-family: PingFangSC-Semibold;
  775. font-weight: 600;
  776. text-align: left;
  777. white-space: nowrap;
  778. line-height: 20px;
  779. margin: 2px 0 0 4px;
  780. }
  781. }
  782. .method-description {
  783. width: 84px;
  784. height: 20px;
  785. overflow-wrap: break-word;
  786. color: rgba(71, 71, 71, 1);
  787. font-size: 14px;
  788. font-family: PingFangSC-Semibold;
  789. font-weight: 600;
  790. text-align: left;
  791. white-space: nowrap;
  792. line-height: 20px;
  793. margin-top: 2px;
  794. }
  795. }
  796. .input-container {
  797. width: calc(100% - 20px );
  798. height: 36px;
  799. margin: 20px 10px 0;
  800. .input-item {
  801. :deep(.el-input__inner){
  802. height: 36px;
  803. line-height: 36px;
  804. }
  805. }
  806. }
  807. }
  808. .remote-image {
  809. width: 61px;
  810. height: 38px;
  811. margin-top: 216px;
  812. }
  813. }
  814. }
  815. .step-two {
  816. width: 384px;
  817. height: 521px;
  818. margin: 55px 0 0 7px;
  819. .step-title {
  820. width: 384px;
  821. height: 24px;
  822. overflow-wrap: break-word;
  823. color: rgba(0, 0, 0, 0.85);
  824. font-size: 16px;
  825. font-family: PingFangSC-Medium;
  826. font-weight: 500;
  827. text-align: left;
  828. white-space: nowrap;
  829. line-height: 24px;
  830. }
  831. .shooting-container {
  832. background-color: rgba(247, 247, 247, 1);
  833. width: 353px;
  834. height: 484px;
  835. margin: 28px 0 0 2px;
  836. .remote-control-wrap {
  837. width: 353px;
  838. height: 300px;
  839. }
  840. .shooting-tips {
  841. width: 325px;
  842. height: 40px;
  843. margin: 12px 0 0 15px;
  844. .info-icon {
  845. width: 16px;
  846. height: 16px;
  847. margin-top: 2px;
  848. }
  849. .tips-text {
  850. width: 302px;
  851. height: 40px;
  852. overflow-wrap: break-word;
  853. color: rgba(255, 76, 0, 1);
  854. font-size: 14px;
  855. font-weight: NaN;
  856. text-align: left;
  857. line-height: 20px;
  858. }
  859. }
  860. .left-foot-text {
  861. width: 240px;
  862. height: 22px;
  863. overflow-wrap: break-word;
  864. color: rgba(0, 174, 30, 1);
  865. font-size: 16px;
  866. font-family: PingFangSC-Semibold;
  867. font-weight: 600;
  868. text-align: left;
  869. white-space: nowrap;
  870. line-height: 22px;
  871. margin: 36px 0 0 9px;
  872. }
  873. .remote-control-container {
  874. position: relative;
  875. width: 280px;
  876. height: 298px;
  877. margin: 9px 0 0 35px;
  878. .remote-buttons {
  879. width: 206px;
  880. height: 233px;
  881. background: url(@/assets/images/Photography/right-button.png) 100% no-repeat;
  882. background-size: 100% 100%;
  883. margin: 30px 0 0 37px;
  884. .left-button {
  885. background-color: rgba(0, 174, 30, 1);
  886. border-radius: 50%;
  887. width: 55px;
  888. height: 55px;
  889. margin: 91px 0 0 1px;
  890. }
  891. .right-button {
  892. background-color: rgba(0, 148, 174, 1);
  893. border-radius: 50%;
  894. width: 55px;
  895. height: 55px;
  896. margin: 91px 2px 0 93px;
  897. }
  898. }
  899. .left-button-image {
  900. width: 40px;
  901. height: 148px;
  902. margin: 150px 0 0 -3px;
  903. }
  904. .right-button-image {
  905. position: absolute;
  906. left: 0;
  907. top: 0;
  908. width: 40px;
  909. height: 148px;
  910. }
  911. }
  912. .right-foot-text {
  913. width: 240px;
  914. height: 22px;
  915. overflow-wrap: break-word;
  916. color: rgba(0, 148, 174, 1);
  917. font-size: 16px;
  918. font-family: PingFangSC-Semibold;
  919. font-weight: 600;
  920. text-align: left;
  921. white-space: nowrap;
  922. line-height: 22px;
  923. margin: 12px 0 18px 98px;
  924. }
  925. }
  926. }
  927. }
  928. .camera-image {
  929. position: absolute;
  930. left: 620px;
  931. top: 220px;
  932. width: 111px;
  933. height: 111px;
  934. }
  935. .step-number-two {
  936. background-color: rgba(22, 119, 255, 1);
  937. border-radius: 50%;
  938. height: 32px;
  939. width: 32px;
  940. position: absolute;
  941. left: 450px;
  942. top: 51px;
  943. .step-text {
  944. width: 9px;
  945. height: 22px;
  946. overflow-wrap: break-word;
  947. color: rgba(255, 255, 255, 1);
  948. font-size: 14px;
  949. font-weight: NaN;
  950. text-align: right;
  951. white-space: nowrap;
  952. line-height: 22px;
  953. margin: 5px 0 0 12px;
  954. }
  955. }
  956. }
  957. }
  958. .history-section {
  959. background-color: rgba(234, 236, 237, 1);
  960. width: 332px;
  961. height: calc(100vh - 30px);
  962. .history-title {
  963. width: calc(100% - 20px);
  964. height: 22px;
  965. overflow-wrap: break-word;
  966. color: rgba(51, 51, 51, 1);
  967. font-size: 16px;
  968. font-family: PingFangSC-Semibold;
  969. font-weight: 600;
  970. text-align: center;
  971. white-space: nowrap;
  972. line-height: 22px;
  973. margin: 9px 0 0 10px;
  974. }
  975. .divider-line {
  976. width: 100%;
  977. height: 1px;
  978. margin-top: 9px;
  979. }
  980. .history-warp {
  981. flex-grow: 1;
  982. overflow: auto;
  983. height: calc(100% - 125px);
  984. .history-item {
  985. .history-item_image_wrap {
  986. padding-bottom: 20px;
  987. border-bottom: 1px solid #CCCCCC;
  988. }
  989. .history-item_image {
  990. &::before{
  991. color: #bbb;
  992. position: absolute;
  993. left: 0;
  994. right: 0;
  995. top:50%;
  996. margin-top: -15px;
  997. line-height: 30px;
  998. }
  999. &:nth-child(1)::before{
  1000. content:"俯视图";
  1001. }
  1002. &:nth-child(2)::before{
  1003. content:"侧视图";
  1004. }
  1005. &:nth-child(3)::before{
  1006. content:"后视图";
  1007. }
  1008. &:nth-child(4)::before{
  1009. content:"鞋底";
  1010. }
  1011. &:nth-child(5)::before{
  1012. content:"内里";
  1013. }
  1014. position: relative;
  1015. width: 70px;
  1016. height: 70px;
  1017. float: left;
  1018. margin: 6px 0 0 6px;
  1019. background: #F7F7F7;
  1020. .el-image {
  1021. display: block;
  1022. width:100%;
  1023. height: 100%;
  1024. }
  1025. &:first-child {
  1026. width: 146px;
  1027. height: 146px;
  1028. }
  1029. &.el-loading-parent--relative{
  1030. ::v-deep {
  1031. .el-loading-mask { display: none}
  1032. }
  1033. }
  1034. }
  1035. .el-image_view {
  1036. display: flex;
  1037. width: 100%;
  1038. height: 100%;
  1039. .reset-button {
  1040. width: 40px;
  1041. text-align: center;
  1042. height: 20px;
  1043. position: absolute;
  1044. left:50%;
  1045. top:50%;
  1046. margin-left:-20px;
  1047. margin-top:-10px;
  1048. color: #ffffff;
  1049. font-size: 14px;
  1050. background: rgba(0,0,0,0.6);
  1051. border-radius: 12px;
  1052. display: none;
  1053. cursor: pointer;
  1054. }
  1055. &:hover {
  1056. .reset-button {
  1057. display: block;
  1058. }
  1059. }
  1060. }
  1061. p:first-of-type {
  1062. ::v-deep {
  1063. .el-loading-mask { display: block !important;}
  1064. }
  1065. }
  1066. }
  1067. }
  1068. .empty-state {
  1069. width: 56px;
  1070. height: 48px;
  1071. .empty-icon {
  1072. width: 32px;
  1073. height: 18px;
  1074. margin-left: 12px;
  1075. }
  1076. .empty-text {
  1077. width: 56px;
  1078. height: 20px;
  1079. overflow-wrap: break-word;
  1080. color: rgba(153, 153, 153, 1);
  1081. font-size: 14px;
  1082. font-weight: NaN;
  1083. text-align: left;
  1084. white-space: nowrap;
  1085. line-height: 20px;
  1086. margin-top: 10px;
  1087. }
  1088. }
  1089. .next-step {
  1090. height: 50px;
  1091. background-size: 100% 100%;
  1092. width: 100%;
  1093. line-height: 50px;
  1094. .next-step-text {
  1095. width: 100%;
  1096. overflow-wrap: break-word;
  1097. color: rgba(255, 255, 255, 1);
  1098. font-weight: NaN;
  1099. text-align: center;
  1100. white-space: nowrap;
  1101. }
  1102. }
  1103. }
  1104. .last-photo{
  1105. position: fixed;
  1106. left: 20px;
  1107. top: 50px;
  1108. bottom: 20px;
  1109. right: 350px;
  1110. z-index: 10;
  1111. }
  1112. </style>