order.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view class="header-tabs">
  5. <view @click="checkType(0)" :class="tabType==0?'tab-item active':'tab-item'">全部</view>
  6. <view @click="checkType(1)" :class="tabType==1?'tab-item active':'tab-item'">已核销</view>
  7. <view @click="checkType(2)" :class="tabType==2?'tab-item active':'tab-item'">预约中</view>
  8. <view @click="checkType(3)" :class="tabType==3?'tab-item active':'tab-item'">已撤销</view>
  9. <view @click="checkType(4)" :class="tabType==4?'tab-item active':'tab-item'">已完成</view>
  10. </view>
  11. </view>
  12. <view class="order-body">
  13. <z-paging ref="paging" show-refresher-update-time v-model="dataList" @query="queryList" :fixed="false">
  14. <view class="order-item" v-for="(item,indx) in dataList" :key="indx">
  15. <view class="item-header" @click="toDetail(item.order_sn)">
  16. <view class="order-status" v-if="item.status == 1">已核销</view>
  17. <view class="order-status success" v-if="item.status == 2">预约中</view>
  18. <view class="order-status" v-if="item.status == 3">已撤销</view>
  19. <view class="order-status" v-if="item.status == 4">已完成</view>
  20. <view class="order-time">订单号 :{{ item.order_id }}</view>
  21. </view>
  22. <view class="order-goods" @click="toDetail(item.order_sn)">
  23. <view class="goods-img"><image :src="item.goods.product_img"></image></view>
  24. <view class="goods-info">
  25. <view class="name">{{ item.goods.product_name }}</view>
  26. <view class="desc">
  27. <view class="time" v-if="item.end_at">有效期至:{{ item.end_at }} </view>
  28. <view class="num">x {{ item.number?item.number:1 }}</view>
  29. </view>
  30. <view class="total">合计:¥ {{ item.goods.product_price }}</view>
  31. </view>
  32. </view>
  33. <view class="order-footer">
  34. <view class="footer-l">{{item.create_at}}</view>
  35. <view class="footer-r">
  36. <view class="btn blue" v-if="item.status == 2" @click="toDetail(item.order_sn)">取消预约</view>
  37. <view class="btn danger" v-else @click="toDetail(item.order_sn)">详情</view>
  38. </view>
  39. </view>
  40. </view>
  41. </z-paging>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. var app;
  47. import * as Api from "@/static/api/order.js";
  48. export default {
  49. data() {
  50. return {
  51. formData:{},
  52. tabType:0,
  53. dataList:[]
  54. }
  55. },
  56. onLoad() {
  57. app = this;
  58. },
  59. methods: {
  60. toDetail(order){
  61. uni.navigateTo({
  62. url:"/pages/order/info?order="+order
  63. })
  64. },
  65. checkType(type){
  66. app.tabType = type;
  67. app.queryList(1,10);
  68. },
  69. queryList(pageNo, pageSize){
  70. var formData = {};
  71. formData.page = pageNo;
  72. formData.size = pageSize;
  73. formData.status = app.tabType;
  74. Api.order(formData).then((res)=>{
  75. uni.hideLoading();
  76. if (res.code !== 1) {
  77. this.$refs.paging.complete(false);
  78. return false;
  79. }
  80. this.$refs.paging.complete(res.data.rows);
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. page{
  88. background-color: #f8f8f8;
  89. }
  90. .order-body{
  91. height: calc(100vh - 100upx);
  92. }
  93. .empty-data{
  94. display: flex;
  95. height: 100%;
  96. align-items: center;
  97. justify-content: center;
  98. flex-direction: column;
  99. font-size: 28upx;
  100. color: #666;
  101. image{
  102. width: 50%;
  103. }
  104. }
  105. .header{
  106. background-color: #fff;
  107. padding: 20upx 20upx 0 20upx;
  108. .header-tabs{
  109. display: flex;
  110. align-items: center;
  111. height: 80upx;
  112. line-height: 80upx;
  113. .tab-item{
  114. width: 33.333%;
  115. text-align: center;
  116. font-size: 30upx;
  117. color: #333;
  118. position: relative;
  119. &.active{
  120. color: #005BAC;
  121. font-weight: bold;
  122. &::after{
  123. content: "";
  124. position: absolute;
  125. width: 40%;
  126. height: 8upx;
  127. border-radius: 4upx;
  128. left: 30%;
  129. bottom: 0;
  130. background-color: #005BAC;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. .order-footer{display: flex;text-align: right;padding: 20upx 0;border-top: 2upx solid #f8f8f8;align-items: center;}
  137. .order-footer .footer-l{font-size: 28upx;color: #666;}
  138. .order-footer .footer-r{display: flex;margin-left: auto;margin-right: 0;flex: 1;justify-content: end;gap: 20upx;}
  139. .order-footer .btn{width: 160upx;height: 60upx;line-height: 60upx;text-align: center;border: 2upx solid #ccc;color: #333;font-size: 28upx;border-radius: 10upx;}
  140. .order-footer .btn.danger{border:2upx solid #f00;color: #f00;}
  141. .order-footer .btn.blue{border:2upx solid #007aff;color: #007aff;}
  142. .order-item{background-color: #fff;padding: 0 20upx;border-radius: 10upx;margin-top: 20upx;}
  143. .order-item .item-header{display: flex;align-items: center;height: 80upx;line-height: 80upx;border-bottom: 2upx solid #f8f8f8;}
  144. .order-item .item-header .order-status{font-size: 28upx;color: #f00;}
  145. .order-item .item-header .order-status.success{color: #007aff;}
  146. .order-item .item-header .order-time{font-size: 24upx;color: #999;margin-left: auto;margin-right: 0;}
  147. .order-item .order-goods{display: flex;align-items: center;}
  148. .order-item .order-goods image{width: 140upx;height: 140upx;}
  149. .order-item .goods-info{margin-left: 20upx;font-size: 28upx;flex: 1;padding: 20upx 0;}
  150. .order-item .goods-info .name{font-size: 30upx;color: #333;}
  151. .order-item .goods-info .desc{font-size: 24upx;color: #999;display: flex;align-items: center;justify-content: space-between;margin: 20upx 0;}
  152. .order-item .goods-info .total{font-size: 30upx;color: #333;text-align: right;font-weight: bold;}
  153. </style>