myOrder.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view>
  3. <ujp-navbar title="订单列表"></ujp-navbar>
  4. <view class="tabs" v-if="false">
  5. <u-tabs active-color="#00B962" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  6. </view>
  7. <view class="card" v-for="(item,i) in list[current].list" :key="i" >
  8. <view class="state">
  9. <view class="time">
  10. 订单生成时间:{{item.createTime}}
  11. </view>
  12. <view class="payment-state">
  13. {{item.status=='1'?'已付款':''}}
  14. {{item.status=='0'?'未付款':''}}
  15. </view>
  16. </view>
  17. <view class="card-infos">
  18. <view class="picture">
  19. <img :src="item.monthlyRentCard.image" alt="">
  20. </view>
  21. <view class="infos">
  22. <view class="name">
  23. {{item.monthlyRentName}}
  24. </view>
  25. <view class="usable" v-if="item.monthlyRentCard.classify==2">
  26. 可用{{item.monthlyRentCard.chargeDegreeLimit}}度(有效期{{item.monthlyRentCard.periodOfValidity}}天)
  27. </view>
  28. <view class="price">
  29. {{item.monthlyRentCard.price}}元
  30. </view>
  31. </view>
  32. <view class="amount">
  33. x1
  34. </view>
  35. </view>
  36. <view class="order-amount">
  37. <view class="title">
  38. 订单金额
  39. </view>
  40. <view class="value">
  41. {{item.monthlyRentCard.price}}元
  42. </view>
  43. </view>
  44. </view>
  45. <u-divider bg-color="#F2F4F4" v-if="list[current].list.length&&list[current].list.length == list[current].recordsTotal" >已经到底了</u-divider>
  46. <view class="carNone" v-if="list[current].list.length == 0">
  47. <img src="static/img/暂无数据-缺省页.png" alt="">
  48. <p class="oldTextjp2" oldstyle="font-size: 18px;">暂无记录</p>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import * as API from '@/apis/order.js'
  54. export default {
  55. data() {
  56. return {
  57. list: [{
  58. name: '全部',
  59. pageIndex: 1,
  60. pageSize: 20,
  61. recordsTotal: 1,
  62. status: "",
  63. list: []
  64. }, {
  65. name: '未付款',
  66. pageIndex: 1,
  67. pageSize: 20,
  68. recordsTotal: 1,
  69. status: "0",
  70. list: []
  71. }, {
  72. name: '已付款',
  73. pageIndex: 1,
  74. pageSize: 20,
  75. recordsTotal: 1,
  76. status: "1",
  77. list: []
  78. }],
  79. current: 2
  80. }
  81. },
  82. onLoad(op) {
  83. if (op.c) {
  84. this.current = op.c
  85. }
  86. this.getList();
  87. },
  88. onReachBottom() {
  89. var obj = this.list[this.current]
  90. if (obj.list.length < obj.recordsTotal) {
  91. this.myLoadmore();
  92. }
  93. },
  94. methods: {
  95. getList() {
  96. uni.showLoading({
  97. title: "加载中",
  98. mask: true,
  99. })
  100. var list = this.list[this.current].list
  101. var obj = this.list[this.current]
  102. var listForm = {
  103. ...obj
  104. }
  105. delete listForm.list
  106. API.buyCardList(listForm).then((res) => {
  107. if (listForm.pageIndex == 1) {
  108. list = res.data.data;
  109. } else {
  110. list = [
  111. ...list,
  112. ...res.data.data
  113. ];
  114. }
  115. this.list[this.current].list = list
  116. this.list[this.current].recordsTotal = res.data.recordsTotal;
  117. uni.hideLoading();
  118. }).catch(error => {
  119. uni.showToast({
  120. icon: 'none',
  121. title: error,
  122. icon: "none"
  123. })
  124. })
  125. },
  126. myLoadmore() {
  127. this.list[this.current].pageIndex += 1;
  128. this.getList();
  129. },
  130. change(index) {
  131. this.current = index;
  132. var list = this.list[this.current].list
  133. this.list[this.current].pageIndex = 1;
  134. this.list[this.current].list = [];
  135. this.getList();
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .carNone{
  142. display: flex;
  143. flex-direction: column;
  144. justify-content: center;
  145. align-items: center;
  146. img{
  147. width: 100%;
  148. height: 100%;
  149. }
  150. p{
  151. margin-top: -60px;
  152. }
  153. }
  154. .tabs{
  155. padding: 0 80rpx;
  156. background-color: #fff;
  157. }
  158. .card{
  159. margin: 24rpx;
  160. padding: 24rpx;
  161. background-color: #fff;
  162. border-radius: 16rpx;
  163. .state{
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-between;
  167. .time{
  168. color: rgba(119, 119, 119, 1);
  169. }
  170. .payment-state{
  171. color: rgba(51, 51, 51, 1);
  172. }
  173. }
  174. .card-infos{
  175. margin: 32rpx 0 40rpx ;
  176. display: flex;
  177. align-items: center;
  178. .picture{
  179. width: 152rpx;
  180. height: 152rpx;
  181. border-radius: 4px;
  182. img{
  183. width: 100%;
  184. }
  185. }
  186. .infos{
  187. margin-left: 26rpx;
  188. .name{
  189. color: rgba(51, 51, 51, 1);
  190. font-size: 32rpx;
  191. font-weight: bold;
  192. }
  193. .usable{
  194. color: rgba(119, 119, 119, 1);
  195. font-size: 24rpx;
  196. margin-top: 8rpx;
  197. }
  198. .price{
  199. color: rgba(16, 16, 16, 1);
  200. font-size: 32rpx;
  201. margin-top: 24rpx;
  202. }
  203. }
  204. .amount{
  205. margin-left: auto;
  206. color: rgba(51, 51, 51, 1);
  207. font-size: 32rpx;
  208. }
  209. }
  210. .order-amount{
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. color: rgba(51, 51, 51, 1);
  215. .value{
  216. font-size: 32rpx;
  217. }
  218. }
  219. }
  220. </style>