myorder.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="container">
  3. <view class="swiper-box">
  4. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  5. <view class="list_box" v-for="(item, index) in list" :key="index">
  6. <view class="list_center">
  7. <view class="list_left">
  8. <view class="list_name mar-b" v-if="userInfo.type == 1">{{ item.doctor_name }}</view>
  9. <view class="list_name mar-b" v-if="userInfo.type == 2 && item.type == 1 || item.type == 2">{{item.patient_name}}</view>
  10. <view class="list_name mar-b" v-if="userInfo.type == 2 && item.type == 3">{{item.organ_name}}</view>
  11. <view class="list_name mar-b" v-if="userInfo.type == 3">{{ item.doctor_name }}</view>
  12. <view class="list_address mar-b">医院: {{ item.hospital_name }}</view>
  13. <view class="list_address mar-b">预约方式: {{ item.type == 1 ? '咨询' : item.type == 2 ? '预约' : '多点执业'}}</view>
  14. <!-- <view class="list_address mar-b">支付金额: {{ item.pay_price }}</view>
  15. <view class="list_address mar-b">支付方式: {{ item.pay_type == 1 ? '微信' : '余额' }}</view> -->
  16. </view>
  17. <view class="list_right" v-if="item.refund == 0">
  18. {{
  19. item.status == 0
  20. ? '未支付'
  21. : item.status == 1
  22. ? '已支付'
  23. : item.status == 2
  24. ? '已预约'
  25. : item.status == 3
  26. ? '待确认'
  27. : item.status == 4
  28. ? '已确认'
  29. : item.status == 5
  30. ? '已完成'
  31. : '已评价'
  32. }}
  33. </view>
  34. <view class="list_right" v-if="item.refund != 0">{{ item.refund == 1 ? '退款中' : item.status == 2 ? '退款完成' : '退款失败' }}</view>
  35. </view>
  36. </view>
  37. <uni-load-more :status="loadingType"></uni-load-more>
  38. </scroll-view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import { mapState } from 'vuex';
  44. import { orderList } from '@/api/patient.js';
  45. export default {
  46. data() {
  47. return {
  48. limit: 10, //每次加载数据条数
  49. page: 1, //当前页数
  50. loadingType: 'more', //加载更多状态
  51. loading: 0, //判断是否为点击搜索按钮跳转加载
  52. list: []
  53. };
  54. },
  55. onLoad() {
  56. this.loadData();
  57. },
  58. onPullDownRefresh() {
  59. this.page = 1;
  60. this.commission('refresh');
  61. },
  62. computed: {
  63. ...mapState(['userInfo'])
  64. },
  65. onShow() {
  66. console.log(this.userInfo)
  67. },
  68. methods: {
  69. //获取订单列表
  70. loadData(type) {
  71. let obj = this;
  72. console.log(obj.loadingType)
  73. //这里是将订单挂载到tab列表下
  74. if (type !== 'refresh') {
  75. //没有更多数据直接跳出方法
  76. if (obj.loadingType === 'nomore') {
  77. return;
  78. } else {
  79. // 设置当前为数据载入中
  80. obj.loadingType = 'loading';
  81. }
  82. } else {
  83. //当重新加载数据时更新状态为可继续添加数据
  84. obj.loadingType = 'more';
  85. }
  86. orderList({
  87. state: 0,
  88. keyword: '',
  89. page: obj.page,
  90. limit: obj.limit
  91. })
  92. .then(({ data }) => {
  93. if (type === 'refresh') {
  94. obj.list = [];
  95. }
  96. obj.list = obj.list.concat(data.list);
  97. //判断是否还有下一页,有是more 没有是nomore
  98. if (obj.limit == data.list.length) {
  99. obj.page++;
  100. obj.loadingType = 'more';
  101. } else {
  102. obj.loadingType = 'nomore';
  103. }
  104. console.log(obj.page)
  105. // 判断是否为刷新数据
  106. if (type === 'refresh') {
  107. // 判断是否为点击搜索按钮跳转加载
  108. if (obj.loading == 1) {
  109. uni.hideLoading();
  110. } else {
  111. uni.stopPullDownRefresh();
  112. }
  113. }
  114. })
  115. .catch(e => {
  116. console.log(e);
  117. });
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss">
  123. .mar-b {
  124. margin-bottom: 10rpx;
  125. }
  126. .container {
  127. padding: 20rpx 20rpx 0;
  128. .swiper-box{
  129. height: 90vh;
  130. .list-scroll-content{
  131. height: 100%;
  132. }
  133. }
  134. }
  135. .list_box {
  136. background-color: #ffffff;
  137. margin-bottom: 20rpx;
  138. padding: 30rpx 55rpx 45rpx 45rpx;
  139. display: flex;
  140. flex-direction: column;
  141. background: rgba(255, 255, 255, 1);
  142. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  143. border-radius: 10rpx;
  144. .list_name {
  145. font-size: 32rpx;
  146. font-weight: 500;
  147. color: rgb(0, 0, 0);
  148. line-height: 36rpx;
  149. margin-bottom: 25rpx;
  150. }
  151. .list_center {
  152. display: flex;
  153. justify-content: space-between;
  154. .list_address {
  155. font-size: 24rpx;
  156. font-weight: 500;
  157. color: rgba(102, 102, 102, 1);
  158. line-height: 36rpx;
  159. }
  160. .list_right {
  161. display: flex;
  162. align-items: center;
  163. font-size: 28rpx;
  164. font-weight: bold;
  165. color: $base-color;
  166. }
  167. }
  168. }
  169. </style>