order.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="盘点执行"
  8. @clickLeft="back"
  9. ></uni-nav-bar>
  10. <view class="tab-title">
  11. <view
  12. v-for="(item, index) in tabList"
  13. :key="index"
  14. class="tab-item"
  15. v-text="item"
  16. :class="index === pickTabIndex ? 'active' : ''"
  17. @click="changeChartsTab(index)"
  18. ></view>
  19. </view>
  20. <OrderTask :list="worksheetList1" :type="1"></OrderTask>
  21. </view>
  22. </template>
  23. <script>
  24. import OrderTask from './OrderTask.vue'
  25. import { post } from '@/utils/api.js'
  26. export default {
  27. components: {
  28. OrderTask
  29. },
  30. data () {
  31. return {
  32. tabList: ['待执行', '已执行'],
  33. pickTabIndex: 0,
  34. worksheetList: [],
  35. worksheetList1: [],
  36. worksheetList2: []
  37. }
  38. },
  39. onLoad () {
  40. this.getList()
  41. },
  42. methods: {
  43. getList () {
  44. uni.showLoading({
  45. title: '加载中'
  46. })
  47. let status = this.pickTabIndex == 0 ? '2' : '99'
  48. //2 - 99 [已完成]
  49. post(this.apiUrl + '/maintain/worksheet/list?status=' + status)
  50. .then(res => {
  51. console.log(res)
  52. if (status == '2') {
  53. this.worksheetList1 = res.data.items
  54. } else {
  55. this.worksheetList2 = res.data.items
  56. }
  57. })
  58. .then(() => {
  59. uni.hideLoading()
  60. })
  61. },
  62. changeChartsTab (index) {
  63. this.pickTabIndex = index
  64. this.getList()
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .tab-title {
  71. padding: 0 140rpx;
  72. display: flex;
  73. justify-content: space-between;
  74. height: 82rpx;
  75. line-height: 82rpx;
  76. background-color: #ffffff;
  77. border-bottom: 1px solid #f2f2f2;
  78. .tab-item {
  79. width: 30%;
  80. text-align: center;
  81. font-size: 32rpx;
  82. color: $uni-text-color-grey;
  83. }
  84. .tab-item.active {
  85. color: $j-primary-border-green;
  86. border-bottom: 1px solid $j-primary-border-green;
  87. }
  88. }
  89. </style>