member-record.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="container clearfix">
  3. <view class="cm-member-top">
  4. <view class="cm-member-head">
  5. <view class="cm-member-text" v-if="isRequest">
  6. <view class="cm-member-h1">
  7. <text v-if="userVip.vipFlag == 1">已开通采美·超级会员</text>
  8. <text v-if="userVip.vipFlag == -1">采美·超级会员已过期</text>
  9. </view>
  10. <view class="cm-member-p">
  11. <text>有效期至:{{ userVip.endTime }}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="cm-member-main">
  17. <view class="record-list" v-for="(pay, index) in payList" :key="index">
  18. <view class="record-list-type">
  19. <view class="list-type-h1">{{ pay.packageId>0 ? '超级会员套餐' : '系统赠送' }}-{{ pay.duration }}个月 </view>
  20. <view class="list-type-p"> {{ pay.payTime }} </view>
  21. </view>
  22. <view class="record-list-text">
  23. <text v-if="pay.payWay == 4">{{ pay.userBeans }}采美豆</text>
  24. <text v-else>¥{{ pay.price | NumFormat }}</text>
  25. </view>
  26. </view>
  27. <!--加载loadding-->
  28. <tui-loadmore :visible="loadding" :index="3" type="black" />
  29. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText" />
  30. <!--加载loadding-->
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import { mapState, mapMutations } from 'vuex'
  36. export default {
  37. components: {},
  38. data() {
  39. return {
  40. StaticUrl: this.$Static,
  41. memberType: 0,
  42. tabCurrent: 0,
  43. listQuery: {
  44. userId: 0,
  45. pageNum: 1,
  46. pageSize: 10
  47. },
  48. userVip: {},
  49. payList: [],
  50. payAmount: 4800,
  51. payBeans: 480000,
  52. nomoreText: '上拉显示更多',
  53. hasNextPage: false,
  54. loadding: false,
  55. pullUpOn: true,
  56. pullFlag: true,
  57. isRequest: false
  58. }
  59. },
  60. onLoad() {
  61. this.initGetStotage()
  62. },
  63. filters: {
  64. MonthFormat(value) {
  65. switch (value) {
  66. case 1:
  67. return '12个月'
  68. break
  69. case 2:
  70. return '3个月'
  71. break
  72. case 3:
  73. return '1个月'
  74. break
  75. }
  76. },
  77. NumFormat: function(text) {
  78. //处理金额
  79. return Number(text).toFixed(2)
  80. }
  81. },
  82. computed: {
  83. },
  84. methods: {
  85. async initGetStotage() {
  86. const userInfo = await this.$api.getStorage()
  87. this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
  88. this.getUserSuperCenter()
  89. this.getUserSuperHistory()
  90. },
  91. getUserSuperCenter() {
  92. // 获取会员中心数据
  93. this.UserService.getUserSuperCenter({ userId: this.listQuery.userId })
  94. .then(response => {
  95. let data = response.data
  96. this.userVip = data.vip
  97. })
  98. .catch(error => {
  99. this.$util.msg(error.msg, 2000)
  100. })
  101. },
  102. getUserSuperHistory() {
  103. // 获取会员购买记录列表
  104. this.coupinList = []
  105. this.listQuery.pageNum = 1
  106. this.UserService.getUserSuperHistory(this.listQuery)
  107. .then(response => {
  108. let data = response.data
  109. if (data.list && data.list.length > 0) {
  110. this.showEmpty = false
  111. this.hasNextPage = data.hasNextPage
  112. this.payList = data.list
  113. this.pullFlag = false
  114. setTimeout(() => {
  115. this.pullFlag = true
  116. }, 500)
  117. if (this.hasNextPage) {
  118. this.pullUpOn = false
  119. this.nomoreText = '上拉显示更多'
  120. } else {
  121. if (this.coupinList.length < 8) {
  122. this.pullUpOn = true
  123. } else {
  124. this.pullUpOn = false
  125. this.loadding = false
  126. this.nomoreText = '已至底部'
  127. }
  128. }
  129. } else {
  130. this.showEmpty = true
  131. }
  132. this.isRequest = true
  133. })
  134. .catch(error => {
  135. this.$util.msg(error.msg, 2000)
  136. })
  137. },
  138. getOnReachBottomData() {
  139. // 上滑加载分页
  140. this.listQuery.pageNum += 1
  141. this.UserService.getUserSuperHistory(this.listQuery)
  142. .then(response => {
  143. let data = response.data
  144. if (data.list && data.list.length > 0) {
  145. this.hasNextPage = data.hasNextPage
  146. this.payList = this.payList.concat(data.list)
  147. this.pullFlag = false // 防上拉暴滑
  148. setTimeout(() => {
  149. this.pullFlag = true
  150. }, 500)
  151. if (this.hasNextPage) {
  152. this.pullUpOn = false
  153. this.nomoreText = '上拉显示更多'
  154. } else {
  155. this.pullUpOn = false
  156. this.loadding = false
  157. this.nomoreText = '已至底部'
  158. }
  159. }
  160. })
  161. .catch(error => {
  162. this.$util.msg(error.msg, 2000)
  163. })
  164. }
  165. },
  166. onPullDownRefresh() {
  167. setTimeout(() => {
  168. this.getUserSuperHistory()
  169. uni.stopPullDownRefresh()
  170. }, 200)
  171. },
  172. onReachBottom() {
  173. if (this.hasNextPage) {
  174. this.loadding = true
  175. this.pullUpOn = true
  176. this.getOnReachBottomData()
  177. }
  178. },
  179. onShow() {
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. .container {
  185. width: 100%;
  186. height: auto;
  187. }
  188. .cm-member-top {
  189. width: 100%;
  190. height: 242rpx;
  191. box-sizing: border-box;
  192. padding: 0 24rpx;
  193. background: url(https://static.caimei365.com/app/img/icon/icon-member-bg01@2x.png) no-repeat;
  194. background-size: cover;
  195. position: relative;
  196. .cm-member-head {
  197. width: 702rpx;
  198. height: 132rpx;
  199. box-sizing: border-box;
  200. padding: 30rpx 32rpx 0 109rpx;
  201. background: url(https://static.caimei365.com/app/img/icon/icon-member-bg02@2x.png) no-repeat;
  202. background-size: cover;
  203. position: absolute;
  204. bottom: 0;
  205. left: 24rpx;
  206. border-radius: 16rpx 16rpx 0 0;
  207. .cm-member-text {
  208. float: left;
  209. .cm-member-h1 {
  210. line-height: 42rpx;
  211. font-size: $font-size-30;
  212. color: #55331d;
  213. text-align: left;
  214. margin-bottom: 12rpx;
  215. font-weight: bold;
  216. }
  217. .cm-member-p {
  218. line-height: 30rpx;
  219. font-size: $font-size-22;
  220. color: #55331d;
  221. text-align: left;
  222. }
  223. }
  224. }
  225. }
  226. .cm-member-main {
  227. width: 100%;
  228. box-sizing: border-box;
  229. padding: 40rpx 24rpx;
  230. background-color: #ffffff;
  231. margin-bottom: 20rpx;
  232. .record-list {
  233. width: 100%;
  234. height: 135rpx;
  235. border-bottom: 1px solid #f0f0f0;
  236. box-sizing: border-box;
  237. padding: 24rpx 0;
  238. .record-list-type {
  239. float: left;
  240. height: 100%;
  241. .list-type-h1 {
  242. line-height: 37rpx;
  243. font-size: $font-size-26;
  244. color: #333333;
  245. text-align: left;
  246. margin-bottom: 16rpx;
  247. }
  248. .list-type-p {
  249. line-height: 33rpx;
  250. font-size: $font-size-24;
  251. color: #999999;
  252. text-align: left;
  253. }
  254. }
  255. .record-list-text {
  256. float: right;
  257. line-height: 86rpx;
  258. font-size: $font-size-34;
  259. color: #ff2a2a;
  260. text-align: right;
  261. }
  262. }
  263. }
  264. </style>