index.vue 5.4 KB

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