order.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="ezy-order-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="handleBack" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">订单</text>
  6. </view>
  7. <view class="ezy-page-body order-body">
  8. <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="onScrolltolower"
  9. class="order-scroll-view" :refresher-triggered="data.loading" :refresher-threshold="50"
  10. refresher-background="transparent" @refresherrefresh="onRefresh">
  11. <view class="order-card-box" v-for="(item,index) in data.list" :key="index">
  12. <view class="card-head-box">
  13. <view class="head-name">鹅状元自营课程</view>
  14. <view class="head-status">{{item.status}}</view>
  15. </view>
  16. <view class="card-body-box">
  17. <!-- 封面 -->
  18. <image :src="item.chanpinCover" class="order-img"></image>
  19. <view class="body-right-box">
  20. <!-- 名称 -->
  21. <view class="body-title">{{item.chanpinName}}</view>
  22. <!-- 简介 -->
  23. <view class="taocan-text">{{item.taocanName}}</view>
  24. <view class="tip-text">不支持7天无理由</view>
  25. <!-- 共计 -->
  26. <view class="money-text">¥{{item.money}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <uni-load-more :status="data.state" @click="getMore"
  31. :contentText="data.contentText">
  32. </uni-load-more>
  33. </scroll-view>
  34. <!-- <view @click="bangdingPhone">绑定手机号</view> -->
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. import { reactive, ref } from "vue";
  40. import {orderList} from '@/api/shop.js'
  41. import { onLoad, onShow } from "@dcloudio/uni-app"
  42. import {
  43. getUserIsYouke
  44. } from "@/utils/common.js"
  45. const data = reactive({
  46. page: 0,
  47. list: [],
  48. loading: false,
  49. state: 'more',
  50. contentText: {
  51. contentdown: '查看更多',
  52. contentrefresh: '加载中',
  53. contentnomore: '没有更多'
  54. }
  55. })
  56. function handleBack() {
  57. uni.switchTab({
  58. url: '/pages/chanpinMy/my'
  59. })
  60. }
  61. function onScrolltolower() {
  62. getMore()
  63. }
  64. function getMore(code) {
  65. const opt = {
  66. page: 1,
  67. size: 10,
  68. }
  69. if (data.state == 'no-more') return;
  70. // 数学
  71. data.state = 'loading';
  72. data.page++;
  73. opt.page = data.page;
  74. orderList(opt).then(res => {
  75. data.list = data.list.concat(res.data.data);
  76. data.loading = false;
  77. if (res.data.total > data.list.length) {
  78. data.state = 'more';
  79. data.loading = false;
  80. } else {
  81. data.state = 'no-more';
  82. data.loading = false;
  83. }
  84. }).catch(err => {
  85. data.state = 'more';
  86. data.loading = false;
  87. })
  88. }
  89. function onRefresh(){
  90. data.page = 0;
  91. data.list = [];
  92. data.loading = true;
  93. refreshData(data.current);
  94. }
  95. function refreshData(code) {
  96. const opt = {
  97. page: 1,
  98. size: 10, // 固定查询10条
  99. }
  100. data.list = [];
  101. data.state = 'loading';
  102. data.page++;
  103. opt.page = data.page;
  104. orderList(opt).then(res => {
  105. data.list = data.list.concat(res.data.data);
  106. data.loading = false;
  107. if (res.data.total > data.list.length) {
  108. data.state = 'more';
  109. data.loading = false;
  110. } else {
  111. data.state = 'no-more';
  112. data.loading = false;
  113. }
  114. }).catch(err => {
  115. data.state = 'more';
  116. data.loading = false;
  117. })
  118. }
  119. onLoad((options) => {
  120. getMore();
  121. // 判断游客 如果是弹出弹窗,忽略和绑定, 忽略删除缓存,绑定更新用户userName 删除缓存
  122. // 此时支付成功+游客模式支付进来的情况
  123. if(options.zhifu &&getUserIsYouke()){
  124. // 弹出绑定手机号弹窗
  125. }
  126. })
  127. </script>
  128. <style>
  129. </style>