index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="order">
  3. <view class="tab-box">
  4. <view class="tab" :class="[query.orderType == null?'active':'']" @click="handleTab(null)">
  5. 全部
  6. </view>
  7. <!-- <view class="tab" :class="[query.orderType == 'USED'?'active':'']" @click="handleTab('USED')">
  8. 已使用
  9. </view> -->
  10. <view class="tab" :class="[query.orderType == 'WAIT_PAYMENT'?'active':'']" @click="handleTab('WAIT_PAYMENT')">
  11. 待付款
  12. </view>
  13. <view class="tab" :class="[query.orderType == 'WAIT_USE'?'active':'']" @click="handleTab('WAIT_USE')">
  14. 待使用
  15. </view>
  16. <view class="tab" :class="[query.orderType == 'APPLY_REFUND'?'active':'']" @click="handleTab('APPLY_REFUND')">
  17. 退款
  18. </view>
  19. </view>
  20. <u-empty v-if="!list.length && status == 'noMore'" mode="order" iconSize="200rpx" textSize="28rpx">
  21. </u-empty>
  22. <zs-list mt="0" @load="loadMore" :status="status">
  23. <view class="order-item" v-for="(item,index) in list" :key="index" @click="jump(item)">
  24. <view class="top-box">
  25. <view class="label">
  26. {{item.shopInfo.shopName}}
  27. </view>
  28. <view class="status">
  29. {{item.goodsModelList[0].goodsState |filterType}}
  30. </view>
  31. </view>
  32. <view class="order-box">
  33. <zs-img radius="full" :src="item.goodsModelList[0].goodsInfo.goodsPath" width="164rpx" height="164rpx"></zs-img>
  34. <view class="info">
  35. <view class="title">
  36. {{item.goodsModelList[0].goodsInfo.goodsName}}
  37. </view>
  38. <view class="time">
  39. {{$u.timeFormat(item.createTime,'yyyy-mm-dd hh:MM:ss')}}
  40. </view>
  41. <view class="price">
  42. ¥{{item.payAmount}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </zs-list>
  48. </view>
  49. </template>
  50. <script>
  51. import {getOrderList} from '@/api/order.js'
  52. export default {
  53. data() {
  54. return {
  55. status: 'more',
  56. loading: false,
  57. query:{
  58. orderType:null,
  59. page:0,
  60. size:10,
  61. userId:JSON.parse(uni.getStorageSync('userInfo')).userId
  62. },
  63. total:0,
  64. list: []
  65. }
  66. },
  67. filters: {
  68. filterType: function(val) {
  69. if(val == 'APPLY_REFUND'){
  70. return '申请退款'
  71. }else if(val == 'CLOSE'){
  72. return '关闭订单'
  73. }else if(val == 'REFUNDED'){
  74. return '已退款'
  75. }else if(val == 'REFUSAL_REFUND'){
  76. return '拒绝退款'
  77. }else if(val == 'USED'){
  78. return '已使用'
  79. }else if(val == 'WAIT_PAYMENT'){
  80. return '待付款'
  81. }else if(val == 'WAIT_USE'){
  82. return '待使用'
  83. }
  84. }
  85. },
  86. methods: {
  87. handleTab(val){
  88. this.query.orderType = val
  89. this.query.page = 0
  90. this.list = []
  91. this.getOrderList()
  92. },
  93. loadMore() {
  94. this.getOrderList()
  95. },
  96. jump(item) {
  97. uni.setStorageSync('order',JSON.stringify(item))
  98. uni.navigateTo({
  99. url: './detail?id='+item.orderNo
  100. })
  101. },
  102. getOrderList(){
  103. this.status = 'loading'
  104. getOrderList(this.query).then(res=>{
  105. if(res.state == 'Success'){
  106. this.total = res.content.totalElements
  107. this.list = this.list.concat(res.content.content)
  108. this.list.length>=this.total?this.status = 'noMore':this.status = 'more'
  109. this.query.page++
  110. uni.stopPullDownRefresh()
  111. }
  112. })
  113. }
  114. },
  115. onPullDownRefresh() {
  116. this.query.page = 0
  117. this.list = []
  118. this.status = 'more'
  119. this.getOrderList()
  120. },
  121. onLoad(option) {
  122. this.query.orderType = option.type || null
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .order {
  128. background: #efefef;
  129. padding: 90rpx 30rpx 0;
  130. min-height: 100vh;
  131. .tab-box{
  132. display: flex;
  133. position: fixed;
  134. width: 750rpx;
  135. height: 70rpx;
  136. left: 0%;
  137. top: 0%;
  138. z-index: 9;
  139. background: #fff;
  140. .tab{
  141. flex: 1;
  142. text-align: center;
  143. padding: 15rpx 0;
  144. font-size: 28rpx;
  145. color: #999999;
  146. }
  147. .tab.active{
  148. font-size: 32rpx;
  149. color: #222222;
  150. position: relative;
  151. &::after{
  152. content: '';
  153. width: 40rpx;
  154. height: 8rpx;
  155. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
  156. border-radius: 46rpx 46rpx 46rpx 46rpx;
  157. background: $uni-color-primary;
  158. position: absolute;
  159. bottom: 0%;
  160. left: 50%;
  161. transform: translateX(-50%);
  162. }
  163. }
  164. }
  165. .zs-list {
  166. .order-item {
  167. background-color: #fff;
  168. border-radius: 8px;
  169. margin-bottom: 20rpx;
  170. .top-box{
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. padding: 20rpx;
  175. border-bottom:2rpx solid #F3F3F3;
  176. .label{
  177. font-weight: bold;
  178. color: #222222;
  179. font-size: 32rpx;
  180. width: 500rpx;
  181. white-space: nowrap;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. }
  185. .status{
  186. font-size: 28rpx;
  187. color: #999999;
  188. }
  189. }
  190. .order-box {
  191. padding: 25rpx;
  192. display: flex;
  193. .icon {
  194. width: 164rpx;
  195. height: 164rpx;
  196. border-radius: 16rpx;
  197. background-color: #999;
  198. }
  199. .info {
  200. margin-left: 25rpx;
  201. display: flex;
  202. flex-direction: column;
  203. justify-content: space-between;
  204. .title {
  205. color: #0F0F0F;
  206. font-size: 28rpx;
  207. }
  208. .time {
  209. font-size: 26rpx;
  210. color: #999999;
  211. }
  212. .price{
  213. font-weight: bold;
  214. color: #181818;
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. </style>