InventoryDialog.vue 9.7 KB

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