index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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="title-center" >
  15. {{item.orderName}}
  16. </view>
  17. <view class="bottom-text">
  18. <view class="item-text flex-box">
  19. <view class="item-text-left">订单编号:</view>
  20. <view class="item-text-right">{{item.orderNum}}</view>
  21. </view>
  22. <view class="item-text flex-box">
  23. <view class="item-text-left">订单数量:</view>
  24. <view class="item-text-right">{{item.number}}</view>
  25. </view>
  26. <view class="item-text flex-box">
  27. <view class="item-text-left">订单生产时间:</view>
  28. <view class="item-text-right">{{item.startTime}}</view>
  29. </view>
  30. <view class="positioning-type">
  31. {{item.status}}
  32. <!-- <text v-if="item.orderStatus == ite.dictValue"
  33. v-for="ite of clientOrderTypeData" :key="ite.id">{{ite.dictLabel}}</text> -->
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <empty v-else text="暂无数据"></empty>
  39. <view v-if="total !== 0 && dataList.length != 0" style="height: 60rpx;">
  40. <u-loadmore :status="status" />
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. // 请求传递的参数
  49. form:{
  50. pageNum:1,
  51. pageSize:10,
  52. },
  53. // 列表数据
  54. dataList:[],
  55. total:0,
  56. status: 'loadmore',
  57. clientOrderTypeData:[],
  58. }
  59. },
  60. onLoad(e) {
  61. this.form.status = e.status
  62. // this.clientOrderTypefun()
  63. },
  64. onShow() {
  65. this.dataList = []
  66. this.orderListfun()
  67. },
  68. onReachBottom() {
  69. this.status = 'loading'
  70. if (this.dataList.length < this.total) {
  71. this.form.pageNum++
  72. this.orderListfun()
  73. } else {
  74. this.status = 'nomore'
  75. }
  76. },
  77. methods: {
  78. // 跳转方法
  79. Jumpfun(item){
  80. uni.navigateTo({
  81. url: '/subPackages/orderforGoods/details?id=' + item.id + '&url=' + encodeURIComponent(item.url)
  82. });
  83. },
  84. // 搜索事件
  85. searchforfun(){
  86. this.form.pageNum = 1
  87. this.dataList = []
  88. this.productOrderlistfun()
  89. },
  90. // 搜索清空
  91. clearforfun(){
  92. delete this.form.taskName
  93. this.form.pageNum = 1
  94. this.dataList = []
  95. this.productOrderlistfun()
  96. },
  97. // 获取字典数据
  98. clientOrderTypefun(){
  99. this.$api.clientOrderType().then(res=>{
  100. this.clientOrderTypeData = res.data
  101. })
  102. },
  103. // 获取列表接口
  104. orderListfun(){
  105. uni.showLoading({
  106. title: '加载中',
  107. mask: true
  108. });
  109. this.$api.orderList(this.form).then(res=>{
  110. this.dataList = this.dataList.concat(res.rows)
  111. this.total = res.total
  112. if (this.dataList.length == res.total) {
  113. this.status = 'nomore'
  114. }
  115. uni.hideLoading();
  116. })
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .mould-page {
  123. .white-card {
  124. background-color: $uni-bg-color;
  125. padding: 20rpx;
  126. }
  127. .list-box {
  128. padding: 0 20rpx;
  129. color: $uni-text-color-list; // #666
  130. .list-item {
  131. background-color: $uni-bg-color; // #ffffff
  132. border-radius: 20rpx;
  133. margin-top: 28rpx;
  134. font-size: 28rpx;
  135. .title-center {
  136. text-align: center;
  137. border-bottom: 1rpx solid #bababa;
  138. padding: 15rpx 0;
  139. }
  140. .bottom-text {
  141. padding: 20rpx;
  142. position: relative;
  143. .item-text {
  144. margin: 5rpx 0;
  145. }
  146. .positioning-type {
  147. position: absolute;
  148. top: 20rpx;
  149. right: 30rpx;
  150. }
  151. }
  152. }
  153. }
  154. .flex-box {
  155. display: flex;
  156. align-items: center;
  157. }
  158. }
  159. </style>