deliveryFrom.vue 15 KB

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