index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. label: '待接收',
  41. list: [],
  42. number: 0
  43. },
  44. {
  45. value: 1,
  46. label: '执行中',
  47. list: [],
  48. number: 0
  49. },
  50. {
  51. value: 2,
  52. label: '已完成',
  53. list: [],
  54. number: 0
  55. }
  56. ],
  57. pickTabIndex: 0,
  58. qrContent: null,
  59. barType: 0,
  60. userInfo: {},
  61. dictList: {
  62. logistic_delivery_type: []
  63. },
  64. }
  65. },
  66. onShow() {
  67. this.getFirstList()
  68. this.getStatus()
  69. },
  70. onReachBottom: function() {
  71. if (isEnd) {
  72. return
  73. }
  74. // 显示加载图标
  75. uni.showLoading({
  76. title: '数据加载中'
  77. })
  78. this.getMoreLists()
  79. },
  80. async created() {
  81. this.dictList.logistic_delivery_type = await getByCode('logistic_delivery_type')
  82. this.dictList.logistic_list_cost_type = await getByCode('logistic_list_cost_type')
  83. this.userInfo = uni.getStorageSync('userInfo')
  84. },
  85. methods: {
  86. getStatus() {
  87. logistictraklistnotePageListAPI({
  88. status: 0,
  89. pageNum: 1,
  90. size: 1,
  91. // userId: this.userInfo.userId
  92. }).then(res => {
  93. this.tabList[0].number = res.count
  94. })
  95. logistictraklistnotePageListAPI({
  96. status: 1,
  97. pageNum: 1,
  98. size: 1,
  99. // userId: this.userInfo.userId
  100. }).then(res => {
  101. this.tabList[1].number = res.count
  102. })
  103. logistictraklistnotePageListAPI({
  104. status: 2,
  105. pageNum: 1,
  106. size: 1,
  107. // userId: this.userInfo.userId
  108. }).then(res => {
  109. this.tabList[2].number = res.count
  110. })
  111. },
  112. getFirstList: function() {
  113. page = 1
  114. isEnd = true
  115. this.getList()
  116. },
  117. getMoreLists: function() {
  118. //获取更多数据
  119. page++
  120. this.getList()
  121. },
  122. getList() {
  123. console.log(this.userInfo.userId)
  124. uni.showLoading({
  125. title: '数据加载中'
  126. })
  127. let params = {
  128. status: [this.tabList[this.pickTabIndex].value],
  129. pageNum: page,
  130. size,
  131. // userId: this.userInfo.userId
  132. }
  133. logistictraklistnotePageListAPI(params)
  134. .then(res => {
  135. if (page === 1) {
  136. this.tabList[this.pickTabIndex].list = res.list
  137. } else {
  138. this.tabList[this.pickTabIndex].list = [...this.tabList[this.pickTabIndex].list, ...res.list]
  139. }
  140. isEnd = this.tabList[this.pickTabIndex].list.length >= res.count
  141. uni.hideLoading()
  142. })
  143. .catch(() => {
  144. uni.hideLoading()
  145. })
  146. },
  147. changeChartsTab(index) {
  148. this.pickTabIndex = index
  149. this.getFirstList()
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .tab-title {
  156. position: fixed;
  157. z-index: 99;
  158. width: 100%;
  159. padding: 10rpx;
  160. // display: flex;
  161. // justify-content: space-between;
  162. height: $tab-height;
  163. line-height: $tab-height;
  164. background-color: #ffffff;
  165. border-bottom: 1px solid #f2f2f2;
  166. // box-sizing: border-box;
  167. white-space: nowrap;
  168. overflow: auto hidden;
  169. display: flex;
  170. &::-webkit-scrollbar {
  171. /*滚动条整体样式*/
  172. width: 10px;
  173. /*高宽分别对应横竖滚动条的尺寸*/
  174. height: 1px;
  175. }
  176. &::-webkit-scrollbar-thumb {
  177. /*滚动条里面小方块*/
  178. border-radius: 10px;
  179. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  180. background: #535353;
  181. }
  182. &::-webkit-scrollbar-track {
  183. /*滚动条里面轨道*/
  184. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  185. border-radius: 10px;
  186. background: #ededed;
  187. }
  188. .tab-item {
  189. flex: 1;
  190. text-align: center;
  191. display: inline-block;
  192. font-size: 32rpx;
  193. color: $uni-text-color-grey;
  194. }
  195. .tab-item.active {
  196. color: $j-primary-border-green;
  197. border-bottom: 1px solid $j-primary-border-green;
  198. }
  199. .title-num {
  200. font-size: 26rpx;
  201. }
  202. .title-red {
  203. display: inline-block;
  204. font-size: 22rpx;
  205. padding: 0 10rpx;
  206. border-radius: 50rpx;
  207. color: #ffffff;
  208. background: red;
  209. line-height: 38rpx;
  210. position: absolute;
  211. top: 10rpx;
  212. min-width: 18rpx;
  213. }
  214. }
  215. </style>