index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="领料" background-color="#157A2C" color="#fff"
  4. @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <view class="tab_box rx-sc">
  8. <view class="tab_item" :class="{active: tabType == 1}" @click="handTab(1)">生产工单列表</view>
  9. <view class="tab_item" :class="{active: tabType == 2}" @click="handTab(2)">领料工单列表</view>
  10. </view>
  11. <view class="nav_box rx-sc" v-if='tabType == 1'>
  12. <view class="nav_item " :class="{active: pickStatus == 0}" @click="handNav(0)">未领料({{navObj.unclaimedQuantity}})</view>
  13. <view class="nav_item" :class="{active: pickStatus == 1}" @click="handNav(1)">已领料({{navObj.claimedQuantity}})</view>
  14. </view>
  15. </view>
  16. <view class="list_box">
  17. <u-list @scrolltolower="scrolltolower" v-if="tabType == 1">
  18. <pickCard v-if='dataList.length' :list="dataList"> </pickCard>
  19. <view v-else style='margin-top: 20vh;'>
  20. <u-empty iconSize='150' textSize='32' text='暂无工单'>
  21. </u-empty>
  22. </view>
  23. </u-list>
  24. </view>
  25. <view class="bottom-wrapper rx-bc" v-if='pickStatus == 0'>
  26. <view>
  27. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  28. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  29. </checkbox>
  30. </view>
  31. <view>
  32. <u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
  33. <view> 选择( {{ checkListLen }} ) </view>
  34. </u-button>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import pickCard from '../components/pickCard.vue'
  41. import {
  42. workorderPage
  43. } from '@/api/pda/workOrder.js'
  44. import { pickStatistics } from '@/api/pda/picking.js'
  45. let [isEnd] = [false]
  46. export default {
  47. components: {
  48. pickCard
  49. },
  50. data() {
  51. return {
  52. tabType: 1,
  53. pickStatus: 0,
  54. navObj: {
  55. unclaimedQuantity: 0,
  56. claimedQuantity: 0
  57. },
  58. page: 1,
  59. size: 5,
  60. dataList: [],
  61. seletedAll: false, //全选状态
  62. }
  63. },
  64. //选择的列表长度
  65. computed: {
  66. checkListLen() {
  67. let _fitArr = this.dataList.filter(f => f.checked)
  68. return _fitArr.length
  69. }
  70. },
  71. onLoad(option) {
  72. this.pickStatus = option.pickStatus || 0
  73. },
  74. onShow() {
  75. this.page = 1
  76. this.dataList = []
  77. this.getList()
  78. this.getpickTics()
  79. },
  80. methods: {
  81. async getList() {
  82. let params = {
  83. pageNum: this.page,
  84. size: this.size,
  85. pickStatus: this.pickStatus,
  86. }
  87. isEnd = false
  88. const res = await workorderPage(params)
  89. if (params.page === 1) {
  90. this.dataList = []
  91. }
  92. let _list = res.list.map(m => {
  93. return {
  94. checked: false,
  95. ...m
  96. }
  97. })
  98. this.dataList.push(..._list)
  99. isEnd = this.dataList.length >= res.count
  100. },
  101. getpickTics() {
  102. pickStatistics().then(res => {
  103. this.navObj = res
  104. })
  105. },
  106. handTab(type) {
  107. if (type != this.tabType) {
  108. this.tabType = type
  109. }
  110. },
  111. handNav(type) {
  112. if (type != this.pickStatus) {
  113. this.pickStatus = type
  114. this.page = 1
  115. this.dataList = []
  116. this.getList()
  117. }
  118. },
  119. scrolltolower() {
  120. if (isEnd) return
  121. this.page++
  122. this.getList()
  123. },
  124. _seletedAll() {
  125. if (!this.seletedAll) {
  126. this.seletedAll = true
  127. this.dataList.forEach(e => {
  128. e.checked = true
  129. })
  130. } else {
  131. this.seletedAll = false
  132. this.dataList.forEach(e => {
  133. e.checked = false
  134. })
  135. }
  136. },
  137. jumpAdd() {
  138. let url
  139. url = '/pages/pda/picking/details'
  140. let arr = []
  141. this.dataList.forEach(e => {
  142. if(e.checked) {
  143. arr.push(e.id)
  144. }
  145. })
  146. let _arr = JSON.stringify(arr)
  147. url += `?arr=${encodeURIComponent(_arr)}`
  148. uni.navigateTo({
  149. url
  150. })
  151. },
  152. // 相机扫码
  153. HandlScanCode() {
  154. let _this = this
  155. uni.scanCode({
  156. success: function(res) {
  157. console.log(res)
  158. }
  159. })
  160. //_this.Scancodedate('res')
  161. },
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .content-box {
  167. height: 100vh;
  168. overflow: hidden;
  169. display: flex;
  170. flex-direction: column;
  171. background-color: $page-bg;
  172. }
  173. .tab_box {
  174. width: 100%;
  175. height: 68rpx;
  176. background: #fff;
  177. .tab_item {
  178. height: 68rpx;
  179. line-height: 68rpx;
  180. padding: 0 20rpx;
  181. font-size: 32rpx;
  182. color: #979C9E;
  183. }
  184. .active {
  185. box-sizing: border-box;
  186. border-bottom: 6rpx solid $theme-color;
  187. color: $theme-color;
  188. }
  189. }
  190. .nav_box {
  191. padding: 6rpx 32rpx;
  192. .nav_item {
  193. font-size: 28rpx;
  194. font-weight: 400;
  195. color: $theme-color;
  196. background: #F0F8F2;
  197. margin-right: 16rpx;
  198. padding: 4rpx 16rpx;
  199. border-radius: 8rpx;
  200. border: 2rpx solid #ACD4B5;
  201. }
  202. .active {
  203. background: $theme-color;
  204. border: 2rpx solid $theme-color;
  205. color: #FFF;
  206. }
  207. }
  208. .list_box {
  209. flex: 1;
  210. overflow: hidden;
  211. padding: 4rpx 0;
  212. .u-list {
  213. height: 100% !important;
  214. }
  215. }
  216. .bottom-wrapper {
  217. height: 80rpx;
  218. background: #fff;
  219. padding: 0 32rpx;
  220. /deep/ .uni-checkbox-input-checked {
  221. background-color: $theme-color !important;
  222. border-color: $theme-color !important;
  223. }
  224. }
  225. </style>