myOrder.vue 5.0 KB

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