index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="mould-page">
  3. <navigation title="工单管理"></navigation>
  4. <!-- 搜索框 -->
  5. <view class="white-card">
  6. <!-- 搜索框 -->
  7. <!-- <uni-search-bar :focus="true" ></uni-search-bar> -->
  8. <u-search placeholder="请输入工单名称,工单编号" v-model="form.taskName"
  9. @search="searchforfun" @custom="searchforfun" @clear="clearforfun">
  10. </u-search>
  11. </view>
  12. <view class="list-box" v-if="dataList.length>0">
  13. <view class="list-item" v-for="(item, index) in dataList" :key="index" @click="Jumpfun(item)">
  14. <view class="item-text flex-box">
  15. <view class="item-text-left">订单名称:</view>
  16. <view class="item-text-right">{{item.taskName}}</view>
  17. </view>
  18. <view class="item-text flex-box">
  19. <view class="item-text-left">订单编号:</view>
  20. <view class="item-text-right">{{item.taskNum}}</view>
  21. </view>
  22. <view class="item-text flex-box">
  23. <view class="item-text-left">工单编号:</view>
  24. <view class="item-text-right">{{item.orderNum}}</view>
  25. </view>
  26. <view class="item-text flex-box">
  27. <view class="item-text-left">工单数量:</view>
  28. <view class="item-text-right">{{item.orderAmounts || 0}}</view>
  29. </view>
  30. <view class="item-text flex-box">
  31. <view class="item-text-left">已完成数量:</view>
  32. <view class="item-text-right">{{item.orderFinishNum || 0}}</view>
  33. </view>
  34. <view class="item-text flex-box">
  35. <view class="item-text-left">工单状态:</view>
  36. <view class="item-text-right" v-if="item.orderStatus == 0">创建</view>
  37. <view class="item-text-right" v-if="item.orderStatus == 1">执行</view>
  38. <view class="item-text-right" v-if="item.orderStatus == 2">完成</view>
  39. </view>
  40. </view>
  41. </view>
  42. <empty v-else text="暂无数据"></empty>
  43. <view v-if="total !== 0 && dataList.length != 0" style="height: 60rpx;">
  44. <u-loadmore :status="status" />
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. // 请求传递的参数
  53. form:{
  54. current:1,
  55. size:10,
  56. orderStatus:1
  57. },
  58. // 列表数据
  59. dataList:[],
  60. total:0,
  61. status: 'loadmore',
  62. }
  63. },
  64. onShow() {
  65. this.dataList = []
  66. this.productOrderlistfun()
  67. },
  68. onReachBottom() {
  69. this.status = 'loading'
  70. if (this.dataList.length < this.total) {
  71. this.page.current++
  72. this.productOrderlistfun()
  73. } else {
  74. this.status = 'nomore'
  75. }
  76. },
  77. methods: {
  78. // 跳转方法
  79. Jumpfun(item){
  80. uni.navigateTo({
  81. url: '/subPackages/workorder/details?orderId=' + item.id
  82. });
  83. },
  84. // 搜索事件
  85. searchforfun(){
  86. this.form.current = 1
  87. this.dataList = []
  88. this.productOrderlistfun()
  89. },
  90. // 搜索清空
  91. clearforfun(){
  92. delete this.form.taskName
  93. this.form.current = 1
  94. this.dataList = []
  95. this.productOrderlistfun()
  96. },
  97. // 获取列表接口
  98. productOrderlistfun(){
  99. uni.showLoading({
  100. title: '加载中',
  101. mask: true
  102. });
  103. this.$api.productOrderlist(this.form).then(res=>{
  104. this.dataList = this.dataList.concat(res.rows)
  105. this.total = res.total
  106. if (this.dataList.length == res.total) {
  107. this.status = 'nomore'
  108. }
  109. uni.hideLoading();
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .mould-page {
  117. .white-card {
  118. background-color: $uni-bg-color;
  119. padding: 20rpx;
  120. }
  121. .list-box {
  122. padding: 0 20rpx;
  123. color: $uni-text-color-list; // #666
  124. .list-item {
  125. background-color: $uni-bg-color; // #ffffff
  126. padding: 20rpx;
  127. border-radius: 20rpx;
  128. margin-top: 28rpx;
  129. .item-text {
  130. margin-top: 10rpx;
  131. font-size: 30rpx;
  132. padding: 10rpx 0;
  133. border-bottom: 1rpx solid rgba(0, 0, 0, .1);
  134. &:last-child {
  135. border: 0;
  136. }
  137. .item-text-left {
  138. // width: 180rpx;
  139. text-align: right;
  140. }
  141. .item-text-right {
  142. // font-size: 30rpx;
  143. }
  144. }
  145. }
  146. }
  147. .flex-box {
  148. display: flex;
  149. align-items: center;
  150. justify-content: space-between;
  151. }
  152. }
  153. </style>