detail.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="container flex_column_start_start">
  3. <view class="top flex_column_start_center">
  4. <view class="member_info flex_row_center_center">
  5. <view class="avatar" :style="{backgroundImage: 'url('+userCenterData.memberAvatar+')'}" />
  6. <text class="name">{{rechargeDetail.memberName}}</text>
  7. </view>
  8. <view :class="{amount:true,success:rechargeDetail.rechargeState==2,flex_row_center_center:true}">
  9. <text class="flag">+</text>
  10. <text>{{rechargeDetail.payAmount}}</text>
  11. </view>
  12. <view class="tip">{{$L('交易金额')}}</view>
  13. </view>
  14. <view v-for="(item,key,index) in detail" :key='index' class="detail_item flex_row_between_center">
  15. <text class="left">{{item.name}}</text>
  16. <text class="right">{{item.value}}</text>
  17. </view>
  18. <view v-if='rechargeDetail.payState==1' class="recharge_btn flex_row_center_center" @click="confirmRecharge">{{$L('继续充值')}}</view>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. mapState
  24. } from 'vuex';
  25. export default {
  26. data() {
  27. return {
  28. rechargeDetail: {}, //充值数据
  29. detail: [],
  30. rechargeId:'', //充值id
  31. };
  32. },
  33. onLoad(options) {
  34. if(options.rechargeId){
  35. this.rechargeId = options.rechargeId;
  36. this.getDetail(options.rechargeId);
  37. }
  38. },
  39. computed: {
  40. ...mapState(['userInfo', 'userCenterData'])
  41. },
  42. mounted() {
  43. },
  44. methods: {
  45. //获取充值详情
  46. getDetail(id) {
  47. this.$request({
  48. url: 'v3/member/front/balanceRecharge/detail',
  49. data: {
  50. key: this.userInfo.access_token,
  51. rechargeId: id,
  52. },
  53. }).then(res => {
  54. if (res.state == 200) {
  55. this.rechargeDetail = res.data;
  56. if (res.data.rechargeState == 2) {
  57. this.detail.push({
  58. name: '交易状态',
  59. value: res.data.payStateValue
  60. });
  61. this.detail.push({
  62. name: '交易方式',
  63. value: res.data.rechargeName
  64. });
  65. this.detail.push({
  66. name: '交易时间',
  67. value: res.data.createTime
  68. });
  69. this.detail.push({
  70. name: '交易单号',
  71. value: res.data.rechargeSn
  72. });
  73. this.detail.push({
  74. name: '交易流水号',
  75. value: res.data.tradeSn
  76. });
  77. } else {
  78. this.detail.push({
  79. name: '交易状态',
  80. value: res.data.payStateValue
  81. });
  82. this.detail.push({
  83. name: '交易时间',
  84. value: res.data.createTime
  85. });
  86. }
  87. } else {
  88. this.$api.msg(res.msg);
  89. }
  90. }).catch((e) => {
  91. //异常处理
  92. })
  93. },
  94. //继续充值
  95. confirmRecharge() {
  96. uni.navigateTo({
  97. url: '/pages/recharge/recharge?rechargeSn=' + this.rechargeDetail.rechargeSn + '&payMethodType=rechargeDetail' + '&rechargeId=' + this.rechargeId,
  98. })
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang='scss'>
  104. /* 高度自适应 $height为设计图上的高度*/
  105. @function calcAdaptHeight($height) {
  106. @return $height/1334*100*1vh;
  107. }
  108. page {
  109. background: #ffffff;
  110. width: 750rpx;
  111. margin: 0 auto;
  112. .container {
  113. margin-top: 20rpx;
  114. flex: 1;
  115. background: #fff;
  116. .top {
  117. width: 100%;
  118. height: calcAdaptHeight(354);
  119. border-bottom: 1rpx solid rgba(0, 0, 0, .1);
  120. .member_info {
  121. margin-top: calcAdaptHeight(95);
  122. .avatar {
  123. background-size: contain;
  124. background-position: center center;
  125. background-repeat: no-repeat;
  126. width: 51rpx;
  127. height: 51rpx;
  128. overflow: hidden;
  129. background-color: #F8F6F7;
  130. border-radius: 50%;
  131. }
  132. .name {
  133. color: $main-font-color;
  134. font-size: 32rpx;
  135. margin-left: 10rpx;
  136. }
  137. }
  138. .amount {
  139. color: $main-third-color;
  140. font-size: 48rpx;
  141. font-weight: bold;
  142. margin-top: calcAdaptHeight(40);
  143. &.success {
  144. color: #FF2121;
  145. }
  146. .flag {
  147. margin-top: -5rpx;
  148. margin-right: 3rpx;
  149. }
  150. }
  151. .tip {
  152. color: $main-third-color;
  153. font-size: 28rpx;
  154. margin-top: calcAdaptHeight(12);
  155. }
  156. }
  157. .detail_item {
  158. width: 100%;
  159. padding: calcAdaptHeight(50) 40rpx 0;
  160. .left {
  161. color: $main-font-color;
  162. font-size: 28rpx;
  163. }
  164. .right {
  165. color: $main-third-color;
  166. font-size: 26rpx;
  167. }
  168. }
  169. .recharge_btn {
  170. position: absolute;
  171. left: 50%;
  172. transform: translateX(-375rpx);
  173. bottom: 40rpx;
  174. width: 670rpx;
  175. margin: 0 40rpx;
  176. height: 88rpx;
  177. background: linear-gradient(-90deg, rgba(252, 29, 28, 1) 0%, rgba(255, 122, 24, 1) 100%);
  178. box-shadow: 0px 3rpx 20rpx 0px rgba(252, 31, 28, 0.26);
  179. border-radius: 44rpx;
  180. color: #fff;
  181. font-size: 36rpx;
  182. }
  183. }
  184. }
  185. uni-page-body {
  186. display: flex;
  187. height: 100%;
  188. }
  189. </style>