order.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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>2020-07-25 16:20:33</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: 'loadmore',
  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. this.toashMsg(res.message)
  78. }
  79. })
  80. },
  81. // 查看详情
  82. goView(item){
  83. uni.navigateTo({
  84. url:"/pages/order/orderDetail?id="+item.id
  85. })
  86. },
  87. // 滚动到底部自动加载下页
  88. reachBottom() {
  89. console.log(22)
  90. if(this.list.length < this.count){
  91. this.pageNo += 1
  92. this.getList()
  93. }else{
  94. this.status = "nomore"
  95. }
  96. }
  97. },
  98. }
  99. </script>
  100. <style lang="scss">
  101. page{
  102. height: 100%;
  103. }
  104. .order-pages{
  105. width: 100%;
  106. height: 100%;
  107. .scroll-Y {
  108. width: 100%;
  109. height: 100%;
  110. .order-list{
  111. padding: 25rpx;
  112. .order-list-item{
  113. box-shadow: 1rpx 1rpx 5rpx #eee;
  114. border: 1px solid #eee;
  115. border-radius: 10rpx;
  116. margin: 30rpx 0;
  117. > view{
  118. padding:20rpx 30rpx;
  119. display: flex;
  120. align-items: center;
  121. border-bottom: 1px dashed #eee;
  122. &:last-child{
  123. border: 0;
  124. }
  125. >view{
  126. &:first-child{
  127. flex-grow: 1;
  128. }
  129. &:last-child{
  130. padding-left: 15rpx;
  131. }
  132. }
  133. .order-finish{
  134. color: #00aa00;
  135. }
  136. .order-unPay{
  137. color: #ff0000;
  138. }
  139. .order-cansel{
  140. color: #7e7b88;
  141. }
  142. .order-carNo{
  143. font-size: 32rpx;
  144. }
  145. .order-price{
  146. text{
  147. margin-right: 20rpx;
  148. color: #666;
  149. &:first-child{
  150. color: red;
  151. font-size: 32rpx;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. }
  160. </style>