order.vue 3.7 KB

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