integral.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="orderItem" v-for="(item, index) in list" :key="index">
  5. <image class="goodImg" :src="item.pimage" ></image>
  6. <view class="orderInfo">
  7. <view class="info1">
  8. <view>{{ item.pname }}</view>
  9. <view :class="true?'color1':''">{{ item.score >0?'+'+item.score:item.score}}积分</view>
  10. </view>
  11. <view class="info2">
  12. <view>实付:¥{{ item.order_price }}</view>
  13. </view>
  14. <view class="info2">
  15. <!-- <view>{{ parse.filterTime(item.create) }}</view> -->
  16. <view class="">
  17. {{ parse.filterTime(item.createtime) }}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view v-if="!list.length" style='color:#999;text-align:center;margin:150rpx 0;font-size:30rpx'>暂无数据</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script module="parse" lang="wxs">
  27. module.exports = {
  28. filterTime: function(time) {
  29. console.log(time)
  30. var nowDate = getDate(time * 1000);
  31. var year = nowDate.getFullYear();
  32. var month = nowDate.getMonth() + 1;
  33. var date = nowDate.getDate();
  34. var hours = nowDate.getHours();
  35. var minutes = nowDate.getMinutes();
  36. var seconds = nowDate.getSeconds();
  37. month = month > 9 ? month : '0' + month;
  38. date = date > 9 ? date : '0' + date;
  39. hours = hours > 9 ? hours : '0' + hours;
  40. minutes = minutes > 9 ? minutes : '0' + minutes;
  41. seconds=seconds>9?seconds:'0'+seconds;
  42. return year + '-' + month + '-' + date + " " + hours + ":" + minutes+ ":" + seconds;
  43. }
  44. }
  45. </script>
  46. <script>
  47. // pages/backstage/index/index.js
  48. var app = getApp();
  49. // import { request } from '../../../utils/request.js';
  50. export default {
  51. data() {
  52. return {
  53. page: 1,
  54. list: [
  55. ],
  56. loaded: false,
  57. };
  58. }
  59. /**
  60. * 生命周期函数--监听页面加载
  61. */,
  62. onLoad: function (options) {
  63. this.getlist();
  64. },
  65. /**
  66. * 生命周期函数--监听页面初次渲染完成
  67. */
  68. onReady: function () {},
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow: function () {},
  73. /**
  74. * 生命周期函数--监听页面隐藏
  75. */
  76. onHide: function () {},
  77. /**
  78. * 生命周期函数--监听页面卸载
  79. */
  80. onUnload: function () {},
  81. /**
  82. * 页面相关事件处理函数--监听用户下拉动作
  83. */
  84. onPullDownRefresh: function () {
  85. this.init();
  86. this.getlist();
  87. uni.stopPullDownRefresh();
  88. },
  89. /**
  90. * 页面上拉触底事件的处理函数
  91. */
  92. onReachBottom: function () {
  93. this.loaded || this.getlist();
  94. },
  95. /**
  96. * 用户点击右上角分享
  97. */
  98. onShareAppMessage: function () {},
  99. methods: {
  100. async getlist() {
  101. var that = this;
  102. let res = await this.$api.request('/wallet/score_log', 'GET', {
  103. page: this.page,
  104. limit: 10
  105. });
  106. console.log(res)
  107. if (res) {
  108. if (res.data.length > 0) {
  109. this.list = this.list.concat(res.data);
  110. this.page++;
  111. } else {
  112. this.loaded = true
  113. this.$api.msg('没有更多数据');
  114. }
  115. }
  116. },
  117. init() {
  118. this.page = 1
  119. this.loaded = false
  120. this.list = []
  121. }
  122. }
  123. };
  124. </script>
  125. <style>
  126. page {
  127. background: #f4f5f9;
  128. }
  129. .content {
  130. margin: 26rpx;
  131. background: #fff;
  132. border-radius: 20rpx;
  133. }
  134. .orderItem {
  135. display: flex;
  136. align-items: center;
  137. padding: 30rpx 20rpx;
  138. border-bottom: 1px solid #e4e5ee;
  139. box-sizing: border-box;
  140. }
  141. .orderItem > image {
  142. width: 116rpx;
  143. height: 116rpx;
  144. border-radius: 12rpx;
  145. }
  146. .orderInfo {
  147. display: flex;
  148. flex-direction: column;
  149. flex: 1;
  150. justify-content: space-between;
  151. margin-left: 18rpx;
  152. }
  153. .info1 {
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. }
  158. .info1 > view:nth-child(1) {
  159. font-size: 28rpx;
  160. width: 300rpx;
  161. overflow: hidden;
  162. text-overflow: ellipsis;
  163. white-space: nowrap;
  164. color: #010101;
  165. }
  166. .info1 > view:nth-child(2) {
  167. font-size: 28rpx;
  168. }
  169. .info2 {
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. margin-top: 6rpx;
  174. }
  175. .info2 > view:nth-child(1) {
  176. color: #9194a6;
  177. }
  178. .color1 {
  179. color: #EC8E02 !important;
  180. }
  181. view{
  182. font-size: 24rpx;
  183. }
  184. .goodImg{
  185. width: 100rpx;
  186. height: 100rpx;
  187. border-radius: 12rpx;
  188. }
  189. </style>