order.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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="item.orderStatus">{{getOptionName(orderStatusList,item.orderStatus)}}</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. orderStatusList: []
  42. }
  43. },
  44. onLoad() {
  45. this.getList()
  46. this.orderStatusList = this.$store.state.vuex_payStatus
  47. },
  48. methods: {
  49. getOptionName (list,val) {
  50. let p = list.find((item) => {
  51. return item.code == val
  52. })
  53. return p ? p.dispName : '-'
  54. },
  55. // 获取订单列表
  56. getList() {
  57. this.status = "loading"
  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.payType = item.payType ? this.getOptionName(payTypeList,item.payType) : ''
  69. })
  70. this.list = this.list.concat(list)
  71. this.count = res.data.count
  72. } else {
  73. this.list = []
  74. this.count = 0
  75. this.noDataText = res.message
  76. }
  77. })
  78. },
  79. // 查看详情
  80. goView(item){
  81. uni.navigateTo({
  82. url:"/pages/order/orderDetail?id="+item.id
  83. })
  84. },
  85. // 滚动到底部自动加载下页
  86. reachBottom() {
  87. if(this.list.length < this.count){
  88. this.pageNo += 1
  89. this.getList()
  90. }else{
  91. this.status = "nomore"
  92. }
  93. }
  94. },
  95. }
  96. </script>
  97. <style lang="scss">
  98. page{
  99. height: 100%;
  100. }
  101. .order-pages{
  102. width: 100%;
  103. height: 100%;
  104. .scroll-Y {
  105. width: 100%;
  106. height: 100%;
  107. .order-list{
  108. padding: 25rpx;
  109. .order-list-item{
  110. box-shadow: 1rpx 1rpx 5rpx #eee;
  111. border: 1px solid #eee;
  112. border-radius: 10rpx;
  113. margin: 30rpx 0;
  114. > view{
  115. padding:20rpx 30rpx;
  116. display: flex;
  117. align-items: center;
  118. border-bottom: 1px dashed #eee;
  119. &:last-child{
  120. border: 0;
  121. }
  122. >view{
  123. &:first-child{
  124. flex-grow: 1;
  125. }
  126. &:last-child{
  127. padding-left: 15rpx;
  128. }
  129. }
  130. .FINISHED{
  131. color: #00aa00;
  132. }
  133. .UN_PAY{
  134. color: #ff0000;
  135. }
  136. .CANCELED{
  137. color: #7e7b88;
  138. }
  139. .PAID{
  140. color: #00aaff;
  141. }
  142. .REFUNDING{
  143. color: #00557f;
  144. }
  145. .REFUNDED{
  146. color: #005500;
  147. }
  148. .order-carNo{
  149. font-size: 32rpx;
  150. }
  151. .order-price{
  152. text{
  153. margin-right: 20rpx;
  154. color: #666;
  155. &:first-child{
  156. color: red;
  157. font-size: 32rpx;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. .u-empty.data-v-6938e513{
  165. height: 90%;
  166. }
  167. }
  168. }
  169. </style>