member-center.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view>
  3. <view class="empty-page" v-if="!isOpenMember">
  4. <image src="../../static/icon/vip.png" mode=""></image>
  5. <text>没有会员中心信息</text>
  6. <view class="cu-btn btn-bg-color round" style="width: 48%;height: 80rpx;position: fixed;bottom: 20%;">
  7. <u-icon name="plus-circle" size="40"></u-icon>
  8. <text class="margin-left-10 text-lg">创建会员中心</text>
  9. </view>
  10. </view>
  11. <block v-else>
  12. <view class="top-menu">
  13. <view class="">
  14. <text>{{detail.memberCount}}</text>
  15. <text>会员数量</text>
  16. </view>
  17. <view class="">
  18. <text>{{detail.totalPointValue}}</text>
  19. <text>积分总价值</text>
  20. </view>
  21. </view>
  22. <view class="padding-20 text-bold text-xl">
  23. <text>会员列表</text>
  24. </view>
  25. <view class="card">
  26. <view class="flex">
  27. <view class="area1 title">
  28. 会员名称
  29. </view>
  30. <view class="area2 title">
  31. 积分数
  32. </view>
  33. <view class="area3 title">
  34. 价值
  35. </view>
  36. </view>
  37. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  38. :down="downOption" :up="upOption">
  39. <view class="item" v-for="(item,index) in dataList" :key="index">
  40. <view class="area1 flex text-bold">
  41. <image class="img-avatar" :src="item.avatar">
  42. </image>
  43. <view class="center padding-left-10">
  44. <text>{{item.nickName}}</text>
  45. </view>
  46. </view>
  47. <view class="area2 center text-bold text-lg"
  48. style="justify-content: flex-start;margin-left: 10rpx;color: #F37A1E;">
  49. <image class="img-points" src="../../static/icon/points-value.png"></image>
  50. <text class="margin-left-10">{{item.pointTotal | numFilter}}</text>
  51. </view>
  52. <view class="area3 center text-lg">
  53. <text class="text-price text-bold">{{item.pointValue | numFilter}}</text>
  54. </view>
  55. </view>
  56. </mescroll-body>
  57. </view>
  58. </block>
  59. </view>
  60. </template>
  61. <script>
  62. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  63. export default {
  64. mixins: [MescrollMixin],
  65. data() {
  66. return {
  67. isOpenMember: false,
  68. detail: {},
  69. dataList: [],
  70. downOption: {
  71. use: false,
  72. auto: false // 不自动加载
  73. },
  74. upOption: {
  75. use: false,
  76. auto: false // 不自动加载
  77. },
  78. }
  79. },
  80. onLoad() {
  81. this.fetchShopDetail()
  82. },
  83. filters: {
  84. numFilter(value) {
  85. let realVal = "";
  86. if (!isNaN(value) && value !== "") {
  87. // 截取当前数据到小数点后两位,改变toFixed的值即可截取你想要的数值
  88. realVal = parseFloat(value).toFixed(2);
  89. } else {
  90. realVal = "--";
  91. }
  92. return realVal;
  93. },
  94. },
  95. methods: {
  96. fetchShopDetail() {
  97. let params = {
  98. id: this.vuex_mallId
  99. }
  100. this.$api.mall.detail(params).then(res => {
  101. if (res.data.isOpenMember == 1) {
  102. this.isOpenMember = true
  103. this.detail = res.data
  104. //加载会员中心
  105. this.useOption()
  106. }
  107. })
  108. },
  109. downCallback() {
  110. setTimeout(() => {
  111. this.mescroll.resetUpScroll();
  112. }, 800)
  113. },
  114. useOption() {
  115. this.downOption = {
  116. use: true,
  117. auto: true
  118. }
  119. this.upOption = {
  120. use: true,
  121. auto: true
  122. }
  123. },
  124. upCallback(mescroll) {
  125. let params = {
  126. mallId: this.vuex_mallId,
  127. current: mescroll.num,
  128. size: mescroll.size,
  129. }
  130. try {
  131. this.$api.memberCenter.list(params).then(res => {
  132. let data = res.data.records
  133. let total = res.data.total
  134. mescroll.endBySize(data.length, total);
  135. if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
  136. this.dataList = this.dataList.concat(data); //追加新数据
  137. })
  138. } catch (e) {
  139. this.mescroll.endErr()
  140. }
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .btn-bg-color {
  147. background-color: #EE9230;
  148. color: #FFFFFF;
  149. }
  150. .empty-page {
  151. height: 50vh;
  152. display: flex;
  153. justify-content: center;
  154. flex-direction: column;
  155. align-items: center;
  156. color: #CCCCCC;
  157. image {
  158. width: 120rpx;
  159. height: 120rpx;
  160. margin-bottom: 20rpx;
  161. }
  162. }
  163. .top-menu {
  164. border-radius: 20rpx;
  165. margin: 30rpx 20rpx;
  166. padding: 50rpx;
  167. display: flex;
  168. justify-content: space-around;
  169. background-image: linear-gradient(to right, #272A46, #30355D);
  170. view {
  171. display: flex;
  172. flex-direction: column;
  173. text-align: center;
  174. text:first-child {
  175. margin-bottom: 10rpx;
  176. color: #FFFFFF;
  177. font-weight: 800;
  178. font-size: 40rpx;
  179. }
  180. text:last-child {
  181. font-size: 26rpx;
  182. color: #D0D4EE;
  183. }
  184. }
  185. }
  186. .card {
  187. width: 100%;
  188. background-color: #FFFFFF;
  189. padding: 30rpx;
  190. font-size: 26rpx;
  191. .text-area {
  192. display: flex;
  193. justify-content: flex-start;
  194. align-items: center;
  195. }
  196. .title {
  197. padding-left: 20rpx;
  198. color: #666666;
  199. }
  200. .area1 {
  201. width: 50%;
  202. }
  203. .area2 {
  204. width: 30%;
  205. }
  206. .area3 {
  207. width: 20%;
  208. }
  209. .item {
  210. padding: 30rpx 20rpx;
  211. display: flex;
  212. border-bottom: 1rpx solid #DDDDDD;
  213. .img-avatar {
  214. width: 70rpx;
  215. height: 70rpx;
  216. border-radius: 50%;
  217. }
  218. .img-points {
  219. width: 35rpx;
  220. height: 35rpx;
  221. }
  222. }
  223. }
  224. </style>