index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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.activityCover || item.goodsModelList[0].goodsInfo.goodsPath" width="164rpx" height="164rpx"></zs-img>
  34. <view class="info">
  35. <view class="title">
  36. {{item.goodsModelList[0].goodsInfo.activityName||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. if(item.goodsModelList[0].goodsInfo.activityName){
  99. uni.navigateTo({
  100. url: '/my/order/signUp/signUpDetail?id='+item.orderNo
  101. })
  102. }else{
  103. uni.navigateTo({
  104. url: './detail?id='+item.orderNo
  105. })
  106. }
  107. },
  108. getOrderList(){
  109. this.status = 'loading'
  110. getOrderList(this.query).then(res=>{
  111. if(res.state == 'Success'){
  112. this.total = res.content.totalElements
  113. this.list = this.list.concat(res.content.content)
  114. this.list.length>=this.total?this.status = 'noMore':this.status = 'more'
  115. this.query.page++
  116. uni.stopPullDownRefresh()
  117. }
  118. })
  119. }
  120. },
  121. onPullDownRefresh() {
  122. this.query.page = 0
  123. this.list = []
  124. this.status = 'more'
  125. this.getOrderList()
  126. },
  127. onLoad(option) {
  128. this.query.orderType = option.type || null
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .order {
  134. background: #efefef;
  135. padding: 90rpx 30rpx 0;
  136. min-height: 100vh;
  137. .tab-box{
  138. display: flex;
  139. position: fixed;
  140. width: 750rpx;
  141. height: 70rpx;
  142. left: 0%;
  143. top: 0%;
  144. z-index: 9;
  145. background: #fff;
  146. .tab{
  147. flex: 1;
  148. text-align: center;
  149. padding: 15rpx 0;
  150. font-size: 28rpx;
  151. color: #999999;
  152. }
  153. .tab.active{
  154. font-size: 32rpx;
  155. color: #222222;
  156. position: relative;
  157. &::after{
  158. content: '';
  159. width: 40rpx;
  160. height: 8rpx;
  161. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255,255,255,0.16);
  162. border-radius: 46rpx 46rpx 46rpx 46rpx;
  163. background: $uni-color-primary;
  164. position: absolute;
  165. bottom: 0%;
  166. left: 50%;
  167. transform: translateX(-50%);
  168. }
  169. }
  170. }
  171. .zs-list {
  172. .order-item {
  173. background-color: #fff;
  174. border-radius: 8px;
  175. margin-bottom: 20rpx;
  176. .top-box{
  177. display: flex;
  178. justify-content: space-between;
  179. align-items: center;
  180. padding: 20rpx;
  181. border-bottom:2rpx solid #F3F3F3;
  182. .label{
  183. font-weight: bold;
  184. color: #222222;
  185. font-size: 32rpx;
  186. width: 500rpx;
  187. white-space: nowrap;
  188. overflow: hidden;
  189. text-overflow: ellipsis;
  190. }
  191. .status{
  192. font-size: 28rpx;
  193. color: #999999;
  194. }
  195. }
  196. .order-box {
  197. padding: 25rpx;
  198. display: flex;
  199. .icon {
  200. width: 164rpx;
  201. height: 164rpx;
  202. border-radius: 16rpx;
  203. background-color: #999;
  204. }
  205. .info {
  206. margin-left: 25rpx;
  207. display: flex;
  208. flex-direction: column;
  209. justify-content: space-between;
  210. .title {
  211. color: #0F0F0F;
  212. font-size: 28rpx;
  213. }
  214. .time {
  215. font-size: 26rpx;
  216. color: #999999;
  217. }
  218. .price{
  219. font-weight: bold;
  220. color: #181818;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </style>