index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="任务工单" @clickLeft="back"></uni-nav-bar>
  4. <template>
  5. <view class="tab-title">
  6. <view v-for="(item, index) in tabList" :key="index" class="tab-item"
  7. :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
  8. {{ item.label }}
  9. <text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
  10. </view>
  11. </view>
  12. <view class="tab-title__placeholder"></view>
  13. </template>
  14. <OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
  15. :type="tabList[index].value" :dictList='dictList'></OrderTask>
  16. </view>
  17. </template>
  18. <script>
  19. import OrderTask from './OrderTask.vue'
  20. import {
  21. logistictraklistnotePageListAPI
  22. } from '@/api/pda/dispatchManage/index.js'
  23. import {
  24. getByCode
  25. } from '@/api/pda/common.js'
  26. let [page, size, isEnd] = [1, 10, true]
  27. import {
  28. mapGetters
  29. } from 'vuex'
  30. export default {
  31. components: {
  32. OrderTask
  33. },
  34. computed: {
  35. },
  36. data() {
  37. return {
  38. tabList: [{
  39. value: 0,
  40. key: 0,
  41. label: '待接收',
  42. list: [],
  43. number: 0
  44. },
  45. {
  46. value: 1,
  47. key: 1,
  48. label: '执行中',
  49. list: [],
  50. number: 0
  51. },
  52. {
  53. value: 2,
  54. key: 2,
  55. label: '已完成',
  56. list: [],
  57. number: 0
  58. },
  59. {
  60. value: 4,
  61. key: 3,
  62. label: '已验收',
  63. list: [],
  64. number: 0
  65. }
  66. ],
  67. pickTabIndex: 0,
  68. qrContent: null,
  69. barType: 0,
  70. userInfo: {},
  71. dictList: {
  72. logistic_delivery_type: []
  73. },
  74. }
  75. },
  76. onShow() {
  77. this.getFirstList()
  78. this.getStatus()
  79. },
  80. onReachBottom: function() {
  81. if (isEnd) {
  82. return
  83. }
  84. // 显示加载图标
  85. uni.showLoading({
  86. title: '数据加载中'
  87. })
  88. this.getMoreLists()
  89. },
  90. async created() {
  91. this.dictList.logistic_delivery_type = await getByCode('logistic_delivery_type')
  92. this.dictList.logistic_list_cost_type = await getByCode('logistic_list_cost_type')
  93. this.userInfo = uni.getStorageSync('userInfo')
  94. },
  95. methods: {
  96. getStatus() {
  97. logistictraklistnotePageListAPI({
  98. status: 0,
  99. pageNum: 1,
  100. size: 1,
  101. // userId: this.userInfo.userId
  102. }).then(res => {
  103. this.tabList[0].number = res.count
  104. })
  105. logistictraklistnotePageListAPI({
  106. status: 1,
  107. pageNum: 1,
  108. size: 1,
  109. // userId: this.userInfo.userId
  110. }).then(res => {
  111. this.tabList[1].number = res.count
  112. })
  113. logistictraklistnotePageListAPI({
  114. status: 2,
  115. pageNum: 1,
  116. size: 1,
  117. // userId: this.userInfo.userId
  118. }).then(res => {
  119. this.tabList[2].number = res.count
  120. })
  121. logistictraklistnotePageListAPI({
  122. status: 4,
  123. pageNum: 1,
  124. size: 1,
  125. // userId: this.userInfo.userI
  126. }).then(res => {
  127. this.tabList[3].number = res.count
  128. })
  129. },
  130. getFirstList: function() {
  131. page = 1
  132. isEnd = true
  133. this.getList()
  134. },
  135. getMoreLists: function() {
  136. //获取更多数据
  137. page++
  138. this.getList()
  139. },
  140. getList() {
  141. console.log(this.userInfo.userId)
  142. uni.showLoading({
  143. title: '数据加载中'
  144. })
  145. let params = {
  146. status: [this.tabList[this.pickTabIndex].value],
  147. pageNum: page,
  148. size,
  149. // userId: this.userInfo.userId
  150. }
  151. logistictraklistnotePageListAPI(params)
  152. .then(res => {
  153. if (page === 1) {
  154. this.tabList[this.pickTabIndex].list = res.list
  155. } else {
  156. this.tabList[this.pickTabIndex].list = [...this.tabList[this.pickTabIndex].list, ...res.list]
  157. }
  158. isEnd = this.tabList[this.pickTabIndex].list.length >= res.count
  159. uni.hideLoading()
  160. })
  161. .catch(() => {
  162. uni.hideLoading()
  163. })
  164. },
  165. changeChartsTab(index) {
  166. this.pickTabIndex = index
  167. this.getFirstList()
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .tab-title {
  174. position: fixed;
  175. z-index: 99;
  176. width: 100%;
  177. padding: 10rpx;
  178. // display: flex;
  179. // justify-content: space-between;
  180. height: $tab-height;
  181. line-height: $tab-height;
  182. background-color: #ffffff;
  183. border-bottom: 1px solid #f2f2f2;
  184. // box-sizing: border-box;
  185. white-space: nowrap;
  186. overflow: auto hidden;
  187. display: flex;
  188. &::-webkit-scrollbar {
  189. /*滚动条整体样式*/
  190. width: 10px;
  191. /*高宽分别对应横竖滚动条的尺寸*/
  192. height: 1px;
  193. }
  194. &::-webkit-scrollbar-thumb {
  195. /*滚动条里面小方块*/
  196. border-radius: 10px;
  197. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  198. background: #535353;
  199. }
  200. &::-webkit-scrollbar-track {
  201. /*滚动条里面轨道*/
  202. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  203. border-radius: 10px;
  204. background: #ededed;
  205. }
  206. .tab-item {
  207. flex: 1;
  208. text-align: center;
  209. display: inline-block;
  210. font-size: 32rpx;
  211. color: $uni-text-color-grey;
  212. }
  213. .tab-item.active {
  214. color: $j-primary-border-green;
  215. border-bottom: 1px solid $j-primary-border-green;
  216. }
  217. .title-num {
  218. font-size: 26rpx;
  219. }
  220. .title-red {
  221. display: inline-block;
  222. font-size: 22rpx;
  223. padding: 0 10rpx;
  224. border-radius: 50rpx;
  225. color: #ffffff;
  226. background: red;
  227. line-height: 38rpx;
  228. position: absolute;
  229. top: 10rpx;
  230. min-width: 18rpx;
  231. }
  232. }
  233. </style>