index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. this.tabList[this.pickTabIndex].list = res.list
  136. isEnd = this.tabList[this.pickTabIndex].list >= res.count
  137. uni.hideLoading()
  138. })
  139. .catch(() => {
  140. uni.hideLoading()
  141. })
  142. },
  143. changeChartsTab(index) {
  144. this.pickTabIndex = index
  145. this.getFirstList()
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .tab-title {
  152. position: fixed;
  153. z-index: 99;
  154. width: 100%;
  155. padding: 10rpx;
  156. // display: flex;
  157. // justify-content: space-between;
  158. height: $tab-height;
  159. line-height: $tab-height;
  160. background-color: #ffffff;
  161. border-bottom: 1px solid #f2f2f2;
  162. // box-sizing: border-box;
  163. white-space: nowrap;
  164. overflow: auto hidden;
  165. display: flex;
  166. &::-webkit-scrollbar {
  167. /*滚动条整体样式*/
  168. width: 10px;
  169. /*高宽分别对应横竖滚动条的尺寸*/
  170. height: 1px;
  171. }
  172. &::-webkit-scrollbar-thumb {
  173. /*滚动条里面小方块*/
  174. border-radius: 10px;
  175. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  176. background: #535353;
  177. }
  178. &::-webkit-scrollbar-track {
  179. /*滚动条里面轨道*/
  180. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  181. border-radius: 10px;
  182. background: #ededed;
  183. }
  184. .tab-item {
  185. flex: 1;
  186. text-align: center;
  187. display: inline-block;
  188. font-size: 32rpx;
  189. color: $uni-text-color-grey;
  190. }
  191. .tab-item.active {
  192. color: $j-primary-border-green;
  193. border-bottom: 1px solid $j-primary-border-green;
  194. }
  195. .title-num {
  196. font-size: 26rpx;
  197. }
  198. .title-red {
  199. display: inline-block;
  200. font-size: 22rpx;
  201. padding: 0 10rpx;
  202. border-radius: 50rpx;
  203. color: #ffffff;
  204. background: red;
  205. line-height: 38rpx;
  206. position: absolute;
  207. top: 10rpx;
  208. min-width: 18rpx;
  209. }
  210. }
  211. </style>