order.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="order-pages">
  3. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="reachBottom">
  4. <view class="order-list">
  5. <view v-for="item in list" :key="item.id" class="order-list-item" @click="goView(item)">
  6. <view>
  7. <view>{{item.storeName}}</view>
  8. <view class="order-finish">{{item.payStatus}}</view>
  9. </view>
  10. <view>
  11. <view class="order-carNo">{{item.customerMobile}}</view>
  12. <u-icon name="arrow-right" color="#666" size="28"></u-icon>
  13. </view>
  14. <view>
  15. <view class="order-price">
  16. <text>¥{{item.paymentAmount}}</text>
  17. <text>{{item.payType}}</text>
  18. </view>
  19. <view>{{item.orderTime}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <u-empty :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  24. <view style="padding: 20upx;">
  25. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  26. </view>
  27. </scroll-view>
  28. </view>
  29. </template>
  30. <script>
  31. import {getOrderList, orderDetail} from '@/api/order.js'
  32. export default {
  33. data() {
  34. return {
  35. noDataText: '暂无数据',
  36. status: 'loading',
  37. list:[],
  38. pageNo:1,
  39. pageSize:15,
  40. count:0,
  41. };
  42. },
  43. onLoad() {
  44. this.getList()
  45. console.log(this.orderStatusList,'1111')
  46. },
  47. methods: {
  48. getOptionName (list,val) {
  49. let p = list.find((item) => {
  50. return item.code == val
  51. })
  52. return p ? p.dispName : '-'
  53. },
  54. // 获取订单列表
  55. getList() {
  56. this.status = "loading"
  57. let orderStatusList = this.$store.state.vuex_payStatus
  58. let payTypeList = this.$store.state.vuex_payType
  59. let params = {
  60. pageNo: this.pageNo,
  61. pageSize: this.pageSize
  62. }
  63. getOrderList(params).then(res=>{
  64. this.status = "loadmore"
  65. if(res.status == 200) {
  66. let list = res.data.list
  67. list.map(item => {
  68. item.payStatus = this.getOptionName(orderStatusList,item.payStatus)
  69. item.payType = item.payType ? this.getOptionName(payTypeList,item.payType) : ''
  70. })
  71. this.list = this.list.concat(list)
  72. this.count = res.data.count
  73. } else {
  74. this.list = []
  75. this.count = 0
  76. this.noDataText = res.message
  77. }
  78. })
  79. },
  80. // 查看详情
  81. goView(item){
  82. uni.navigateTo({
  83. url:"/pages/order/orderDetail?id="+item.id
  84. })
  85. },
  86. // 滚动到底部自动加载下页
  87. reachBottom() {
  88. if(this.list.length < this.count){
  89. this.pageNo += 1
  90. this.getList()
  91. }else{
  92. this.status = "nomore"
  93. }
  94. }
  95. },
  96. }
  97. </script>
  98. <style lang="scss">
  99. page{
  100. height: 100%;
  101. }
  102. .order-pages{
  103. width: 100%;
  104. height: 100%;
  105. .scroll-Y {
  106. width: 100%;
  107. height: 100%;
  108. .order-list{
  109. padding: 25rpx;
  110. .order-list-item{
  111. box-shadow: 1rpx 1rpx 5rpx #eee;
  112. border: 1px solid #eee;
  113. border-radius: 10rpx;
  114. margin: 30rpx 0;
  115. > view{
  116. padding:20rpx 30rpx;
  117. display: flex;
  118. align-items: center;
  119. border-bottom: 1px dashed #eee;
  120. &:last-child{
  121. border: 0;
  122. }
  123. >view{
  124. &:first-child{
  125. flex-grow: 1;
  126. }
  127. &:last-child{
  128. padding-left: 15rpx;
  129. }
  130. }
  131. .order-finish{
  132. color: #00aa00;
  133. }
  134. .order-unPay{
  135. color: #ff0000;
  136. }
  137. .order-cansel{
  138. color: #7e7b88;
  139. }
  140. .order-carNo{
  141. font-size: 32rpx;
  142. }
  143. .order-price{
  144. text{
  145. margin-right: 20rpx;
  146. color: #666;
  147. &:first-child{
  148. color: red;
  149. font-size: 32rpx;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .u-empty.data-v-6938e513{
  157. height: 90%;
  158. }
  159. }
  160. }
  161. </style>