order.vue 5.4 KB

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