order.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. if(this.list.length < this.count){
  90. this.pageNo += 1
  91. this.getList()
  92. }else{
  93. this.status = "nomore"
  94. }
  95. }
  96. },
  97. }
  98. </script>
  99. <style lang="scss">
  100. page{
  101. height: 100%;
  102. }
  103. .order-pages{
  104. width: 100%;
  105. height: 100%;
  106. .scroll-Y {
  107. width: 100%;
  108. height: 100%;
  109. .order-list{
  110. padding: 25rpx;
  111. .order-list-item{
  112. box-shadow: 1rpx 1rpx 5rpx #eee;
  113. border: 1px solid #eee;
  114. border-radius: 10rpx;
  115. margin: 30rpx 0;
  116. > view{
  117. padding:20rpx 30rpx;
  118. display: flex;
  119. align-items: center;
  120. border-bottom: 1px dashed #eee;
  121. &:last-child{
  122. border: 0;
  123. }
  124. >view{
  125. &:first-child{
  126. flex-grow: 1;
  127. }
  128. &:last-child{
  129. padding-left: 15rpx;
  130. }
  131. }
  132. .order-finish{
  133. color: #00aa00;
  134. }
  135. .order-unPay{
  136. color: #ff0000;
  137. }
  138. .order-cansel{
  139. color: #7e7b88;
  140. }
  141. .order-carNo{
  142. font-size: 32rpx;
  143. }
  144. .order-price{
  145. text{
  146. margin-right: 20rpx;
  147. color: #666;
  148. &:first-child{
  149. color: red;
  150. font-size: 32rpx;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>