detail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <view class="headCard">
  4. <image class="avatar" :src="detail.avatar" mode="aspectFit" ></image>
  5. <view class="itemCard">
  6. <text>会员名称</text>
  7. <text>{{detail.nickName || '暂无'}}</text>
  8. </view>
  9. <view class="itemCard">
  10. <text>手机号码</text>
  11. <text>{{detail.phone || '暂无'}}</text>
  12. </view>
  13. </view>
  14. <view class="cell">
  15. <text class="cell-item" style="font-weight: bold;font-size: 28rpx;">消费记录</text>
  16. <!-- <text class="cell-item" style="color: #D18C42;font-size: 22rpx;">消费总额¥{{detail.payTotal}}</text> -->
  17. </view>
  18. <view class="card">
  19. <view class="u-flex">
  20. <view class="area1 area-padding " style="padding-left: 40rpx;">
  21. <text>交易日期</text>
  22. </view>
  23. <view class="area2 area-padding">
  24. <!-- <image style="width: 35rpx;height: 35rpx;margin-right: 10rpx;margin-bottom: -10rpx;"
  25. src="@/static/icon/points-value.png"></image> -->
  26. <text>折扣</text>
  27. </view>
  28. <view class="area3 area-padding u-text-right u-p-r-20">
  29. <text>消费金额</text>
  30. </view>
  31. </view>
  32. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  33. :down="downOption" :up="upOption">
  34. <view class="item" v-for="(item,index) in list" :key="index">
  35. <view class="area1">
  36. <view class="item-padding">
  37. <text>{{item.createTime}}</text>
  38. </view>
  39. </view>
  40. <view class="area2 text-area" style="width: 15%;">
  41. <view class="center">
  42. <text style="font-size: 26rpx;color: #666;margin-left: -10rpx;">{{item.discount==-1 || item.discount==0?'无折扣':item.discount +'折'}}</text>
  43. </view>
  44. </view>
  45. <view class="area3 text-area u-p-r-20" style="width: 30%;">
  46. <view class="item-padding price text-base" style="flex:1;text-align: right;font-size: 34rpx;">{{item.cost}}</view>
  47. </view>
  48. </view>
  49. </mescroll-body>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  55. export default{
  56. mixins: [MescrollMixin],
  57. data(){
  58. return{
  59. id:'',
  60. userId:'',
  61. detail:null,
  62. downOption: {
  63. auto: false,
  64. height:'',
  65. },
  66. list:[]
  67. }
  68. },
  69. onReady() {
  70. this.getElInfo()
  71. },
  72. onLoad(options) {
  73. if(options.userId){
  74. this.userId = options.userId
  75. }
  76. if (options.id) {
  77. this.id=options.id
  78. }
  79. this.fetchDetail()
  80. },
  81. methods:{
  82. async getElInfo() {
  83. let rectInfo = await this.$u.getRect('.card');
  84. this.height=this.$u.sys().windowHeight - rectInfo.top + 'px'
  85. },
  86. fetchDetail(){
  87. this.$api.member.detail({id:this.id}).then(res=>{
  88. this.detail=res.data
  89. })
  90. },
  91. upCallback(mescroll) {
  92. if (!this.vuex_shopId) {
  93. return
  94. }
  95. let params = {
  96. payId:this.userId,
  97. receiveId: this.vuex_shopId,
  98. payStatus:this.$global.PAY_STATUS.SUCCESS,
  99. current: mescroll.num,
  100. size: mescroll.size,
  101. }
  102. try {
  103. this.$api.bills.list(params).then(res => {
  104. let data = res.data.records
  105. let total = res.data.total
  106. mescroll.endBySize(data.length, total);
  107. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  108. this.list = this.list.concat(data); //追加新数据
  109. })
  110. } catch (e) {
  111. this.mescroll.endErr()
  112. }
  113. },
  114. downCallback() {
  115. setTimeout(() => {
  116. this.mescroll.resetUpScroll();
  117. }, 200)
  118. },
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .headCard {
  124. margin-top: 100rpx;
  125. padding: 70rpx 30rpx 30rpx;
  126. background-color: #FFFFFF;
  127. position: relative;
  128. .avatar{
  129. position: absolute;
  130. margin: 0 auto;
  131. transform: translateY(-50%);
  132. width: 120rpx;
  133. height: 120rpx;
  134. border-radius: 50%;
  135. left: 0;
  136. right: 0;
  137. top: 0;
  138. }
  139. .itemCard{
  140. padding: 20rpx 0;
  141. font-size: 28rpx;
  142. color: #888888;
  143. margin: 0 20rpx;
  144. display: flex;
  145. justify-content: space-between;
  146. }
  147. }
  148. .cell{
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: flex-end;
  152. height: 60rpx;
  153. padding: 30rpx 30rpx;
  154. box-sizing: content-box;
  155. }
  156. .card {
  157. background-color: #FFFFFF;
  158. .area-padding {
  159. padding: 40rpx 0 20rpx;
  160. }
  161. .text-area {
  162. display: flex;
  163. justify-content: flex-start;
  164. align-items: center;
  165. }
  166. .area1 {
  167. padding-left: 30rpx;
  168. width: 55%;
  169. view:first-child {
  170. display: flex;
  171. image {
  172. width: 80rpx;
  173. height: 80rpx
  174. }
  175. view {
  176. padding-left: 15rpx;
  177. padding-bottom: 5rpx;
  178. display: flex;
  179. flex-direction: column;
  180. text:first-child {
  181. font-size: 32rpx;
  182. padding-bottom: 10rpx;
  183. color: #000;
  184. }
  185. text:last-child {
  186. font-size: 22rpx;
  187. color: #888888;
  188. }
  189. }
  190. }
  191. }
  192. .area2 {
  193. width: 25%;
  194. }
  195. .area3 {
  196. width: 20%;
  197. }
  198. .item-padding {
  199. padding: 20rpx 0;
  200. }
  201. .item {
  202. padding: 5rpx;
  203. display: flex;
  204. border-bottom: 1rpx solid #DDDDDD;
  205. }
  206. .item:last-child {
  207. border: none;
  208. }
  209. }
  210. </style>