scanCodeList.vue 10 KB

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