deliveryFrom.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <view >
  3. <u-navbar title="申请归还">
  4. <view class="details" slot="bottom">
  5. <view class="list">
  6. <view class="list-head" style="margin-bottom: 3px;">
  7. <view class="title">
  8. 出库设备清单
  9. </view>
  10. <view class="amount" @click="gotoscan('')">
  11. <u-icon name="scan" color="#0051ff" ></u-icon>扫码识别
  12. </view>
  13. </view>
  14. <view class="list-head">
  15. <view class="title">
  16. 所属项目<span style="color: red;">*</span>
  17. </view>
  18. <view class="amount" >
  19. <u-input style="border-bottom: 1px solid;"
  20. v-model="form.projectName" placeholder="请输入所属项目" type="text" />
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 出库单详情 -->
  25. </view>
  26. </u-navbar>
  27. <u-popup v-model="showpopup" class="" mode="bottom"
  28. border-radius="14"
  29. :closeable="true" >
  30. <view class="scantitle">连续扫码</view>
  31. <view class="list">
  32. <view class=" list-infos" :style="nowscan.healthStatus&&nowscan.healthStatus!=1?'background-color:#FFC107':''">
  33. <view class="infos-head" @click="gotoInfo(nowscan.id)">
  34. <view class="name">
  35. {{nowscan.title?nowscan.title:'扫码后出当前结果'}}
  36. </view>
  37. <view class="name">
  38. 编号:{{nowscan.code}}
  39. </view>
  40. <view class="name" :style="nowscan.id?'color:blue;':'color:#fff;'">
  41. 点击查看
  42. </view>
  43. </view>
  44. <view class="infos-head infos-head2" style="margin-bottom: 12rpx;">
  45. <view class="name" v-html="descriptionKey(nowscan)">
  46. </view>
  47. </view>
  48. <view class="infos">
  49. <view class="infos-2">
  50. <view class="infos-item">
  51. <view class="item-name">
  52. 规格:
  53. </view>
  54. <view class="item-value">
  55. {{nowscan.specifications}}
  56. </view>
  57. </view>
  58. <view class="infos-item">
  59. <view class="item-name">
  60. 型号:
  61. </view>
  62. <view class="item-value">
  63. {{nowscan.model}}
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- #ifdef MP-WEIXIN -->
  71. <camera mode="scanCode" resolution='medium'
  72. @scancode="takeCode" v-if="showpopup"
  73. device-position="back" flash="off" @error="error"
  74. style="width: 100%; height: 300px;"></camera>
  75. <!-- #endif -->
  76. </u-popup>
  77. <!-- 出库设备清单 -->
  78. <view class="list container" style="padding-bottom: 60px;" v-show="scanList.length" >
  79. <view class="list-view">
  80. <!-- 清单信息 -->
  81. <view class="list-infos" v-for="(item,i) in scanList" :key="i" >
  82. <view class="infos-head">
  83. <view class="name">
  84. {{item.title}}
  85. </view>
  86. <view class="state" @click="delOutListMethod(i)">
  87. <u-icon name="trash-fill" color="#777777" ></u-icon>
  88. </view>
  89. </view>
  90. <view class="infos">
  91. <view class="infos-1">
  92. <view class="infos-item">
  93. <view class="item-name">
  94. 编号:
  95. </view>
  96. <view class="item-value">
  97. {{item.code}}
  98. </view>
  99. </view>
  100. <view class="infos-item">
  101. <view class="item-name">
  102. 单位:
  103. </view>
  104. <view class="item-value">
  105. {{item.unit}}
  106. </view>
  107. </view>
  108. </view>
  109. <view class="infos-2">
  110. <view class="infos-item">
  111. <view class="item-name">
  112. 规格:
  113. </view>
  114. <view class="item-value">
  115. {{item.specifications}}
  116. </view>
  117. </view>
  118. <view class="infos-item">
  119. <view class="item-name">
  120. 型号:
  121. </view>
  122. <view class="item-value">
  123. {{item.model}}
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <u-divider :isnone="scanList.length==0"
  131. nonetext="点击'扫码'进行归还" nonetop="110" border-color="#CFD2D5">已经到底了</u-divider>
  132. </view>
  133. <u-divider :isnone="scanList.length==0" v-show="scanList.length==0"
  134. nonetext="点击'扫码'进行归还" nonetop="110" border-color="#CFD2D5">已经到底了</u-divider>
  135. <!-- 确认出库 -->
  136. <view class="bottom" >
  137. <u-button type="primary" @click="gotoOut()" >确认归还</u-button>
  138. </view>
  139. </view>
  140. </template>
  141. <script>
  142. import * as API from '@/apis/pagejs/projectDepartment.js'
  143. export default {
  144. data() {
  145. return {
  146. scanFunctionIsUseable:true,
  147. nowscan:{
  148. "title": "",
  149. "specifications": "",
  150. "experimentLastTime":"",
  151. "manufactor": "",
  152. "unit": "",
  153. "model": "",
  154. "code": "",
  155. },
  156. address:"",
  157. showpopup:false,
  158. deviceposition:"back",
  159. form:{
  160. projectName:"",
  161. addressId:"",
  162. recordId:"",
  163. deviceIds:"",
  164. },
  165. scanList:[],
  166. }
  167. },
  168. methods: {
  169. delOutListMethod(c) {
  170. if (c > -1) {
  171. this.scanList.splice(c, 1)
  172. uni.showToast({
  173. title: "删除成功",
  174. icon: "none"
  175. })
  176. }
  177. },
  178. gotoOut() {
  179. if(!this.form.projectName){
  180. uni.showToast({
  181. title: "请输入项目名称",
  182. icon: "none"
  183. })
  184. return
  185. }
  186. if(this.scanList.length==0){
  187. uni.showToast({
  188. title: "请扫码添加出库设备",
  189. icon: "none"
  190. })
  191. return
  192. }
  193. var _this=this;
  194. uni.showModal({
  195. title: '提示',
  196. content:"确认清单无误",
  197. //content: '这是一个模态弹窗',
  198. success: function(res) {
  199. if (res.confirm) {
  200. _this.gotoOutMethod(res.content)
  201. } else if (res.cancel) {
  202. console.log('用户点击取消');
  203. }
  204. }
  205. });
  206. },
  207. gotoOutMethod() {
  208. //recordData
  209. uni.showLoading({
  210. title: "加载中",
  211. mask: true,
  212. })
  213. var list=this.scanList.map(item=>{
  214. return item.id
  215. });
  216. this.form.deviceIds=list.join()
  217. API.saveInRecord(this.form).then((res) => {
  218. uni.hideLoading();
  219. const eventChannel = this.getOpenerEventChannel();
  220. eventChannel.emit('refreshData');
  221. uni.hideLoading()
  222. uni.showModal({
  223. title: '提示',
  224. content: '操作成功',
  225. showCancel:false,
  226. success: function (res) {
  227. if (res.confirm) {
  228. uni.navigateBack()
  229. } else if (res.cancel) {
  230. console.log('用户点击取消');
  231. }
  232. }
  233. });
  234. }).catch(error => {
  235. uni.showToast({
  236. title: error,
  237. icon: "none"
  238. })
  239. })
  240. },
  241. getscan(val) {
  242. this.showpopup=true;
  243. var c = this.scanList.find(item => {
  244. return item.code == val
  245. })
  246. if (c) {
  247. return
  248. }
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. })
  253. API.queryDeviceByCode({
  254. code: val,
  255. }).then((res) => {
  256. uni.hideLoading();
  257. if (res.data.deviceInfo) {
  258. console.log(res.data.deviceInfo)
  259. this.nowscan=res.data.deviceInfo;
  260. var c = this.scanList.find(item => {
  261. return item.id == res.data.deviceInfo.id
  262. })
  263. if (c) {
  264. uni.showToast({
  265. title: "已存在,添加失败",
  266. icon: "none"
  267. })
  268. } else {
  269. this.scanList.push(res.data.deviceInfo)
  270. uni.showToast({
  271. title: "添加成功",
  272. icon: "none"
  273. })
  274. }
  275. } else {
  276. uni.showToast({
  277. title: "二维码无效",
  278. icon: "none"
  279. })
  280. this.nowscan={}
  281. }
  282. }).catch(error => {
  283. uni.showToast({
  284. title: error,
  285. icon: "none"
  286. })
  287. })
  288. },
  289. error(e) {
  290. console.log(e);
  291. },
  292. gotoscan(val) {
  293. // #ifdef H5
  294. this.gotoscanH5(val)
  295. // #endif
  296. // #ifdef MP-WEIXIN
  297. this.gotoscanMP(val)
  298. // #endif
  299. },
  300. takeCode(e){
  301. console.log(e);
  302. if(this.scanFunctionIsUseable) {
  303. this.scanFunctionIsUseable = false;
  304. // 对扫码结果进行处理
  305. console.log(e.detail.result);
  306. this.getscan(this.takeCodeJp(e.detail.result))
  307. // 扫码间隔两秒
  308. setTimeout(() => {
  309. this.scanFunctionIsUseable = true;
  310. }, 1000)
  311. }
  312. },
  313. gotoscanMP(val){
  314. this.showpopup=true;
  315. // const ctx = uni.createCameraContext();
  316. // ctx.takePhoto({
  317. // quality: 'high',
  318. // success: (res) => {
  319. // this.src = res.tempImagePath
  320. // }
  321. // });
  322. },
  323. gotoscanH5(val) {
  324. console.log('111')
  325. var _this = this;
  326. uni.showModal({
  327. title: '提示',
  328. editable: true,
  329. //content: '这是一个模态弹窗',
  330. success: function(res) {
  331. if (res.confirm) {
  332. _this.getscan(res.content)
  333. } else if (res.cancel) {
  334. console.log('用户点击取消');
  335. }
  336. }
  337. });
  338. },
  339. }
  340. }
  341. </script>
  342. <style scoped lang="scss">
  343. .scantitle{
  344. text-align: center;
  345. font-size: 44rpx;
  346. padding-top: 20px;
  347. }
  348. page {
  349. padding-bottom: 200rpx;
  350. }
  351. // 出库单状态
  352. .head {
  353. background-color: #fff;
  354. padding: 24rpx 32rpx;
  355. display: flex;
  356. align-items: center;
  357. color: #101010;
  358. font-size: 32rpx;
  359. .photo {
  360. width: 84rpx;
  361. height: 84rpx;
  362. border-radius: 100rpx;
  363. img {
  364. width: 100%;
  365. height: 100%;
  366. overflow: hidden;
  367. }
  368. }
  369. .name {
  370. color: #101010;
  371. font-size: 32rpx;
  372. margin-right: 8rpx;
  373. margin-left: 24rpx;
  374. max-width: 200rpx;
  375. overflow: hidden;
  376. text-overflow: ellipsis;
  377. white-space: nowrap
  378. }
  379. .submit {
  380. text {
  381. color: #3385FF;
  382. }
  383. }
  384. .state {
  385. line-height: 48rpx;
  386. padding: 0 24rpx;
  387. border-radius: 50px;
  388. background-color: rgba(255, 255, 255, 1);
  389. color: rgba(51, 133, 255, 1);
  390. font-size: 12px;
  391. text-align: center;
  392. font-family: Arial;
  393. border: 1px solid rgba(51, 133, 255, 1);
  394. margin-left: auto;
  395. }
  396. }
  397. .container{
  398. margin-top: 80px;
  399. }
  400. // 出库单详情
  401. .details {
  402. background-color: #fff;
  403. margin-top: 24rpx;
  404. padding: 16rpx 32rpx;
  405. .item {
  406. display: flex;
  407. justify-content: space-between;
  408. padding: 12rpx 0;
  409. //border-bottom: 1px solid rgba(244, 244, 244, 1);
  410. .name {
  411. line-height: 30px;
  412. color: #333333;
  413. font-size: 32rpx
  414. }
  415. .value {
  416. color: #101010;
  417. }
  418. }
  419. }
  420. // 出库单列表
  421. .list {
  422. //margin-top: 24rpx;
  423. .list-view{
  424. padding: 16rpx 32rpx;
  425. background-color: #fff;
  426. }
  427. .list-head {
  428. display: flex;
  429. justify-content: space-between;
  430. align-items: center;
  431. .title {
  432. color: #333333;
  433. font-size: 32rpx
  434. }
  435. .amount {
  436. color: #777777;
  437. font-size: 24rpx;
  438. text {
  439. color: #3385FF;
  440. }
  441. /deep/.u-icon--right {
  442. margin-left: 8rpx;
  443. }
  444. }
  445. }
  446. // 清单信息
  447. .list-infos {
  448. border-radius: 8px;
  449. background-color: #F5F6F9;
  450. margin-top: 24rpx;
  451. padding: 24rpx;
  452. .infos-head {
  453. display: flex;
  454. justify-content: space-between;
  455. align-items: center;
  456. margin-bottom: 24rpx;
  457. .name {
  458. color: rgba(51, 51, 51, 1);
  459. font-size: 32rpx;
  460. }
  461. .state {
  462. color: rgba(0, 81, 255, 1);
  463. }
  464. }
  465. .infos {
  466. margin-top: 16rpx;
  467. display: flex;
  468. color: #777777;
  469. font-size: 24rpx;
  470. .infos-1 {
  471. margin-right: 68rpx;
  472. }
  473. .infos-item {
  474. display: flex;
  475. margin-bottom: 8rpx;
  476. }
  477. }
  478. }
  479. }
  480. // 流程
  481. .process {
  482. background-color: #fff;
  483. margin-top: 24rpx;
  484. padding: 24rpx 32rpx;
  485. .title {
  486. color: rgba(51, 51, 51, 1);
  487. font-size: 32rpx;
  488. }
  489. .u-time-axis-item{
  490. //margin-bottom: 76rpx;
  491. }
  492. .u-time-axis {
  493. //padding: 18rpx 40rpx;
  494. }
  495. .u-node {
  496. width: 18rpx;
  497. height: 18rpx;
  498. border-radius: 100rpx !important;
  499. display: flex;
  500. justify-content: center;
  501. align-items: center;
  502. background: #d0d0d0;
  503. }
  504. .u-order{
  505. margin-bottom: 32rpx;
  506. }
  507. .u-order-title {
  508. color: #333333;
  509. font-weight: bold;
  510. font-size: 32rpx;
  511. }
  512. .u-order-desc {
  513. margin-bottom: 16rpx;
  514. display: flex;
  515. justify-content: space-between;
  516. align-items: center;
  517. .level {
  518. color: #333333;
  519. font-size: 32rpx;
  520. font-weight: bold;
  521. }
  522. .date {
  523. color: rgba(119, 119, 119, 1);
  524. }
  525. .state {
  526. color: rgba(255, 121, 0, 1);
  527. }
  528. }
  529. .u-order-time {
  530. width: 90rpx;
  531. color: #777777;
  532. font-size: 28rpx;
  533. margin-top: 16rpx;
  534. display: flex;
  535. flex-direction: column;
  536. align-items: center;
  537. .photo {
  538. width: 56rpx;
  539. height: 56rpx;
  540. border-radius: 100px;
  541. margin-bottom: 4rpx;
  542. img {
  543. width: 100%;
  544. height: 100%;
  545. overflow: hidden;
  546. position: relative;
  547. }
  548. }
  549. .confirm {
  550. position: absolute;
  551. top: 46rpx;
  552. left: 56rpx;
  553. }
  554. .name {
  555. color: rgba(51, 51, 51, 1);
  556. font-size: 24rpx;
  557. }
  558. }
  559. }
  560. // .u-time-axis{
  561. // .u-time-axis-item:last-of-type{
  562. // margin-bottom: 0;
  563. // }
  564. // }
  565. // 确认出库
  566. .bottom{
  567. background-color: #fff;
  568. margin-top: 44rpx;
  569. padding: 16rpx 32rpx;
  570. z-index: 999;
  571. position: fixed;
  572. left: 0;
  573. right: 0;
  574. bottom: 0;
  575. uni-button{
  576. border-radius: 8px;
  577. background: linear-gradient(180deg, rgba(22,119,255,1) 0%,rgba(16,98,213,1) 100%);
  578. color: rgba(255, 255, 255, 1);
  579. font-size: 32rpx;
  580. line-height: 88rpx;
  581. }
  582. }
  583. </style>