index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="order-content">
  3. <view class="total">
  4. 总计:12000.00kg,222.00元
  5. </view>
  6. <scroll-view scroll-y class="list" @scrolltolower="onreachBottom">
  7. <view class="list-item" @click="intoDetail()">
  8. <view class="cont title flex align_center justify_between">
  9. <text>2020-12-30 15:29:16</text>
  10. <view class="flex align_center">
  11. <text>查看详情</text>
  12. <u-icon class="arrow-right" name="arrow-right" color="#999999" size="32"></u-icon>
  13. </view>
  14. </view>
  15. <view class="cont">
  16. <view class="cont-top flex align_center justify_between">
  17. <text>百果园(贞观路店)</text>
  18. <text>¥260.00</text>
  19. </view>
  20. <view class="cont-bot flex align_center justify_between">
  21. <view class="flex align_center">
  22. <view class="t-icon phone t-icon-icon_phone"></view>
  23. <text>18092252287</text>
  24. </view>
  25. <text>线下支付</text>
  26. </view>
  27. </view>
  28. </view>
  29. <u-empty style="padding-top: 10vh;height: auto;" src="/static/img/def_result.png" :text="noDataText" img-width="252" img-height="176" v-if="list.length==0 && status!='loading'"
  30. mode="list"></u-empty>
  31. <view v-if="index==current" style="padding: 20upx;">
  32. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  33. </view>
  34. </scroll-view>
  35. <view class="list">
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. }
  44. },
  45. onLoad() {
  46. // this.pageInit()
  47. // 开启分享
  48. uni.showShareMenu({
  49. withShareTicket: true,
  50. menus: ['shareAppMessage', 'shareTimeline']
  51. })
  52. },
  53. methods: {
  54. // 进入详情
  55. intoDetail() {
  56. uni.navigateTo({
  57. url: '/pages/historyOrder/hisOrderDetail'
  58. })
  59. },
  60. // scroll-view到底部加载更多
  61. onreachBottom() {
  62. this.action = 'onreachBottom'
  63. if (this.list.length < this.total) {
  64. this.pageNo += 1
  65. this.getRow()
  66. } else {
  67. if(this.list.length) {
  68. uni.showToast({
  69. title: '已经到底了',
  70. icon: 'none'
  71. });
  72. }
  73. this.status = "nomore"
  74. }
  75. },
  76. // 查询列表
  77. getRow(pageNo) {
  78. this.status = "loadmore"
  79. if (pageNo) {
  80. this.pageNo = pageNo
  81. }
  82. let params = {
  83. pageNo: this.pageNo,
  84. pageSize: this.pageSize,
  85. orderStateList: this.tabList[this.current].queryLabel, // tab分类
  86. }
  87. this.noDataText = '暂无数据'
  88. this.status = "loading"
  89. getOrderList(params).then(res => {
  90. if (res.status == 200) {
  91. if (this.pageNo > 1) {
  92. this.list = this.list.concat(res.data.list || [])
  93. } else {
  94. this.list = res.data.list || []
  95. }
  96. const date1 = moment().toArray() // 当前时间 数组形式
  97. this.list.map(item=>{
  98. const date2 = moment(item.orderTime).toDate() // 下单时间 日期格式
  99. const date3 = moment(date2).toArray() // 下单时间 数组形式
  100. const tt = 1800 - moment(date1).diff(moment(date3), 'seconds')// 距离30分钟支付 当前剩余秒数 = 1800秒 - 计算相差的秒数(当前时间-支付时间)
  101. item.leftTimeT = tt > 0 ? tt : 0
  102. })
  103. this.total = res.data.count || 0
  104. } else {
  105. this.list = []
  106. this.total = 0
  107. this.noDataText = res.message
  108. }
  109. this.status = "loadmore"
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. page{
  117. height: 100%;
  118. width: 100%;
  119. }
  120. .order-content{
  121. width: 100%;
  122. height: 100%;
  123. background-color: #F5F5F5;
  124. display: flex;
  125. flex-direction: column;
  126. .total{
  127. width: 100%;
  128. height: 80rpx;
  129. background: rgba(255, 209, 0, 0.4);
  130. opacity: 1;
  131. padding-left: 32rpx;
  132. line-height: 80rpx;
  133. font-size: 30rpx;
  134. color: #191919;
  135. }
  136. .list{
  137. flex: 1;
  138. width: 100%;
  139. overflow: auto;
  140. padding: 0 26rpx;
  141. box-sizing: border-box;
  142. .list-item{
  143. width: 100%;
  144. border-radius: 24rpx;
  145. margin-top: 20rpx;
  146. background-color: #fff;
  147. .cont{
  148. padding: 24rpx 32rpx;
  149. }
  150. .title{
  151. text{
  152. color: #666E75;
  153. font-size: 28rpx;
  154. }
  155. view{
  156. color: #999999;
  157. font-size: 32rpx;
  158. .arrow-right{
  159. margin-left: 10rpx;
  160. }
  161. }
  162. }
  163. .cont-top{
  164. text:first-child{
  165. font-size: 36rpx;
  166. color: #222222;
  167. font-weight: 600;
  168. }
  169. text:last-child{
  170. font-size: 32rpx;
  171. color: #222222;
  172. }
  173. }
  174. .cont-bot{
  175. font-size: 28rpx;
  176. color: #4C4C4C;
  177. margin-top: 20rpx;
  178. .phone{
  179. width: 28rpx;
  180. height: 28rpx;
  181. margin-right: 10rpx;
  182. }
  183. text:last-child{
  184. font-size: 24rpx;
  185. color: #666E75;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. </style>