scanCodeList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <view class="mainBox">
  3. <view class="main">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" right-icon="scan" title="扫码列表"
  5. @clickLeft="backAdd" @clickRight="HandlScanCode"></uni-nav-bar>
  6. <view class="wrapper">
  7. <u-list class="listContent">
  8. <checkbox-group v-for="(item, index) in listData" :key="index"
  9. @change.stop="e => selectVal(e, item, index)">
  10. <label>
  11. <view class="listBox">
  12. <view class="listBox-sel">
  13. <uni-icons type="trash" size="20" color="red" @click="getDelete(index)"></uni-icons>
  14. <!-- <checkbox :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" /> -->
  15. </view>
  16. <view class="listBox-con">
  17. <view class="listBox-top">
  18. <view class="listBox-name">
  19. {{ item.name }}
  20. </view>
  21. </view>
  22. <view class="listBox-top">
  23. <view class="listBox-code">
  24. {{ item.code }}
  25. </view>
  26. </view>
  27. <view class="listBox-bottom">
  28. <view>牌号:{{ item.brandNum }}</view>
  29. <view>型号:{{ item.modelType }}</view>
  30. <view>规格:{{ item.specification }}</view>
  31. <view>批次号:{{ item.batchNo }}</view>
  32. <view>计量数量:{{ item.measureQuantity }}({{ item.measuringUnit }})</view>
  33. <view class="w100">包装编码:{{ item.packageNo }}</view>
  34. <view>包装数量:{{ item.packingQuantity }}({{ item.packingUnit }})</view>
  35. <!-- <view>重量:{{ item.weight }}({{ item.weightUnit }})</view>
  36. <view>发货条码:{{ item.barcodes }}</view>
  37. <view>物料代号:{{ item.materielDesignation }}</view>
  38. <view>客户代号:{{ item.clientCode }}</view>
  39. <view>刻码:{{ item.engrave }}</view>
  40. <view class="w100">仓库:{{ item.warehouseName }}</view>
  41. <view class="w100">区域:{{ getLocation(item) }}</view> -->
  42. </view>
  43. </view>
  44. </view>
  45. </label>
  46. </checkbox-group>
  47. <u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
  48. </u-list>
  49. </view>
  50. <view class="footer">
  51. <view class="bottom">
  52. <!-- <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  53. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  54. </checkbox> -->
  55. </view>
  56. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  57. <view class="selBtn">确定</view>
  58. </u-button>
  59. <!-- <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  60. <view class="selBtn">选择( {{ checkListLen }} )</view>
  61. </u-button> -->
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. getDetailsByCode
  69. } from '@/api/warehouseManagement'
  70. import {
  71. sceneState,
  72. outputSceneState
  73. } from '../../common'
  74. export default {
  75. data() {
  76. return {
  77. type: null,
  78. statusOpt: ['待处理', '已处理', '已撤销'],
  79. curItem: null, //当前选中项
  80. page: 1,
  81. size: 20,
  82. sceneState,
  83. seletedAll: false, //全选状态
  84. outputSceneState,
  85. isEnd: true,
  86. searchVal: '',
  87. listData: [] //列表数据
  88. }
  89. },
  90. //选择的列表长度
  91. computed: {
  92. checkListLen() {
  93. return this.listData.filter(el => el.checked).length
  94. }
  95. },
  96. onLoad({
  97. type
  98. }) {
  99. this.type = type
  100. },
  101. onShow() {
  102. // this.getList()
  103. },
  104. methods: {
  105. getLocation(item) {
  106. if (item.areaName && item.goodsShelfName && item.goodsAllocationName) {
  107. return item.areaName + '/' + item.goodsShelfName + '/' + item.goodsAllocationName
  108. } else if (item.areaName && item.goodsShelfName) {
  109. return item.areaName + '/' + item.goodsShelfName
  110. } else if (item.areaName) {
  111. return item.areaName
  112. } else {
  113. return ''
  114. }
  115. },
  116. // 相机扫码
  117. HandlScanCode() {
  118. uni.scanCode({
  119. success: res => {
  120. console.log('res------------------------')
  121. let arr = res.result.split('/')
  122. console.log('arr------------------------', arr)
  123. if (this.listData.find(item => item.packageNo == arr[0])) {
  124. uni.showToast({
  125. title: '请勿重复扫码!',
  126. icon: 'none'
  127. })
  128. return
  129. }
  130. getDetailsByCode(arr[1]).then(res => {
  131. console.log('res-------------', res)
  132. console.log(res)
  133. res.packageNo = arr[0]
  134. res.packingQuantity = arr[2]
  135. res.measureQuantity = arr[3]
  136. res.batchNo = arr[3]
  137. this.listData = this.listData.concat(res)
  138. })
  139. }
  140. })
  141. },
  142. // //勾选
  143. // selectVal(e, val, index) {
  144. // this.$set(this.listData[index], 'checked', !this.listData[index].checked)
  145. // this.seletedAll = !this.listData.some(item => !item.checked)
  146. // },
  147. // //全选按钮
  148. // _seletedAll() {
  149. // if (!this.seletedAll) {
  150. // this.seletedAll = true
  151. // this.listData.map(item => {
  152. // this.$set(item, 'checked', true)
  153. // })
  154. // } else {
  155. // this.seletedAll = false
  156. // //this.checkListLen = 0;
  157. // this.listData.map(item => {
  158. // this.$set(item, 'checked', false)
  159. // })
  160. // }
  161. // },
  162. //跳转回添加页面
  163. async jumpAdd() {
  164. // uni.$emit(
  165. // 'setSelectList',
  166. // this.listData.filter(item => item.checked)
  167. // )
  168. uni.$emit(
  169. 'setSelectList',
  170. this.listData
  171. )
  172. uni.navigateBack()
  173. },
  174. //返回添加页
  175. backAdd() {
  176. uni.navigateBack()
  177. },
  178. getDelete(index) {
  179. uni.showModal({
  180. title: '提示',
  181. content: '是否删除当前数据',
  182. success: res => {
  183. if (res.confirm) {
  184. this.listData.splice(index, 1)
  185. }
  186. }
  187. })
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .mainBox {
  194. height: 100vh;
  195. .main {
  196. height: 100%;
  197. display: flex;
  198. flex-direction: column;
  199. }
  200. .wrapper {
  201. flex: 1;
  202. overflow: hidden;
  203. }
  204. .searchBox {
  205. padding: 10rpx 0;
  206. box-sizing: border-box;
  207. background-color: #dedede;
  208. height: 90rpx;
  209. width: 100%;
  210. line-height: 90rpx;
  211. display: flex;
  212. justify-content: space-around;
  213. align-items: center;
  214. input {
  215. height: 78rpx;
  216. width: 65%;
  217. background: #f9f9f9 !important;
  218. margin: 0 10rpx;
  219. padding: 0 10rpx;
  220. box-sizing: border-box;
  221. border-radius: 5rpx;
  222. }
  223. .searchBtn {
  224. height: 80rpx;
  225. background: #f9f9f9 !important;
  226. color: #676767;
  227. font-size: 28rpx;
  228. padding: 0 42rpx;
  229. box-sizing: border-box;
  230. outline: none;
  231. border: none;
  232. width: 260rpx;
  233. .icon-sousuo {
  234. font-size: 22px;
  235. }
  236. .text {
  237. font-size: 16px;
  238. margin-left: 10px;
  239. }
  240. }
  241. .search-icon {
  242. display: flex;
  243. align-items: center;
  244. justify-content: space-around;
  245. font-size: 28rpx;
  246. white-space: nowrap;
  247. margin-left: 10rpx;
  248. image {
  249. width: 30rpx;
  250. height: 30rpx;
  251. }
  252. }
  253. }
  254. .tab-title {
  255. position: fixed;
  256. top: 190rpx;
  257. z-index: 99;
  258. width: 100%;
  259. display: flex;
  260. justify-content: space-between;
  261. align-items: center;
  262. height: $tab-height;
  263. line-height: $tab-height;
  264. background-color: #ffffff;
  265. border-bottom: 2rpx solid #f2f2f2;
  266. box-sizing: border-box;
  267. .tab-item {
  268. width: 25%;
  269. text-align: center;
  270. font-size: 32rpx;
  271. color: $uni-text-color-grey;
  272. }
  273. .tab-item.active {
  274. color: $j-primary-border-green;
  275. border-bottom: 1px solid $j-primary-border-green;
  276. font-weight: bold;
  277. }
  278. .tab-item.filter {
  279. flex: 1;
  280. padding: 0px 30rpx;
  281. .uni-icons {
  282. display: flex;
  283. padding-top: 5px;
  284. }
  285. }
  286. .screenIcon {
  287. display: flex;
  288. width: 80px;
  289. justify-content: center;
  290. .screenText {
  291. font-size: 32rpx;
  292. color: $uni-text-color-grey;
  293. }
  294. }
  295. }
  296. .listContent {
  297. height: 100% !important;
  298. .listBox {
  299. display: flex;
  300. // height: 180rpx;
  301. padding: 20rpx 0;
  302. border-bottom: 2rpx solid #e5e5e5;
  303. .listBox-sel {
  304. height: 90rpx;
  305. width: 80rpx;
  306. // line-height: 90rpx;
  307. text-align: center;
  308. checkbox {
  309. transform: scale(1.2);
  310. }
  311. }
  312. .listBox-con {
  313. width: 100%;
  314. // display: flex;
  315. // flex-wrap: wrap;
  316. // justify-content: space-between;
  317. align-items: center;
  318. padding: 0 18rpx 0 0;
  319. .listBox-top {
  320. width: 100%;
  321. display: flex;
  322. justify-content: space-between;
  323. padding-bottom: 10rpx;
  324. .listBox-name,
  325. .listBox-code {
  326. display: inline-block;
  327. font-size: $uni-font-size-sm;
  328. font-weight: bold;
  329. }
  330. }
  331. .listBox-bottom {
  332. width: 100%;
  333. display: flex;
  334. justify-content: space-between;
  335. font-size: $uni-font-size-sm;
  336. flex-wrap: wrap;
  337. >view {
  338. width: 50%;
  339. overflow: hidden;
  340. white-space: nowrap;
  341. text-overflow: ellipsis;
  342. }
  343. .input_view {
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. .u-input {
  348. height: 36rpx;
  349. padding: 0 !important;
  350. margin-right: 10rpx;
  351. border: 1px solid #ddd;
  352. }
  353. }
  354. .w100 {
  355. width: 100%;
  356. }
  357. }
  358. }
  359. }
  360. .noDate {
  361. height: 100%;
  362. }
  363. }
  364. //底部按钮
  365. .footer {
  366. height: 90rpx;
  367. position: relative;
  368. display: flex;
  369. justify-content: space-between;
  370. align-items: center;
  371. bottom: 0;
  372. width: 100%;
  373. height: 100rpx;
  374. border-top: 1rpx solid #eeecec;
  375. background-color: #ffffff;
  376. z-index: 999;
  377. .bottom {
  378. margin-left: 10rpx;
  379. }
  380. .u-reset-button {
  381. position: absolute;
  382. right: 10rpx;
  383. top: 20rpx;
  384. width: 150rpx;
  385. }
  386. }
  387. .search-container {
  388. width: 70vw;
  389. padding: 30rpx 36rpx;
  390. .footer {
  391. position: absolute;
  392. bottom: 0;
  393. left: 0;
  394. width: 100%;
  395. display: flex;
  396. box-shadow: 0 10rpx 30rpx 0 #000;
  397. .btn {
  398. width: 50%;
  399. height: 80rpx;
  400. border-radius: 0 !important;
  401. flex: 1;
  402. display: flex;
  403. justify-content: center;
  404. align-items: center;
  405. &.reset {
  406. color: $j-primary-border-green;
  407. }
  408. }
  409. }
  410. }
  411. .title {
  412. font-weight: bold;
  413. font-size: 30rpx;
  414. }
  415. .status-wrapper {
  416. display: flex;
  417. align-items: center;
  418. justify-content: space-between;
  419. view {
  420. background-color: rgba(242, 242, 242, 1);
  421. height: 60rpx;
  422. border-radius: 30rpx;
  423. line-height: 60rpx;
  424. text-align: center;
  425. width: 160rpx;
  426. border: 1rpx solid rgba(242, 242, 242, 1);
  427. &.active {
  428. color: #157a2c;
  429. border-color: rgba(21, 122, 44, 1);
  430. }
  431. }
  432. }
  433. /deep/.uni-date {
  434. .uni-icons {
  435. display: none;
  436. }
  437. .uni-date-x {
  438. padding: 0;
  439. view {
  440. margin: 0 20rpx;
  441. }
  442. }
  443. }
  444. /deep/.uni-date__x-input,
  445. /deep/.uni-easyinput__content-input {
  446. height: 60rpx;
  447. border-radius: 30rpx;
  448. overflow: hidden;
  449. background-color: rgba(242, 242, 242, 1);
  450. }
  451. }
  452. </style>