RechargeCardList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="充值卡明细" class="common-header" left-icon="back" @clickLeft="goBack">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  15. <view
  16. class="div list-wrapper pb-30"
  17. v-if="predeposit_list && predeposit_list.length"
  18. >
  19. <view
  20. class="div container"
  21. v-for="(item, index) in predeposit_list"
  22. :key="item.rcblog_id"
  23. >
  24. <label
  25. class="title"
  26. v-bind:class="item.available_amount > 0 ? 'income' : 'expend'"
  27. >{{ item.available_amount }}</label
  28. >
  29. <label class="subtitle">{{ item.rcblog_description }}</label>
  30. <label class="date">{{ item.add_time_text }}</label>
  31. </view>
  32. </view>
  33. <empty-record v-else-if="predeposit_list && !predeposit_list.length"></empty-record>
  34. </scroll-view>
  35. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="addRecharge">充值</view></view>
  36. </view>
  37. </view>
  38. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  39. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  40. </uni-popup>
  41. </member-base>
  42. </template>
  43. <script>
  44. import {getFontSize} from '@/util/common'
  45. import TitleHeader from '../../TitleHeader'
  46. import MemberBase from '../MemberBase'
  47. import { getRechargeCardList,addRechargeCard } from '../../../api/memberPredeposit'
  48. import EmptyRecord from '../../EmptyRecord'
  49. export default {
  50. name: 'BalanceHistory',
  51. components:{
  52. TitleHeader,
  53. MemberBase,
  54. EmptyRecord
  55. },
  56. computed:{
  57. fontSize(){
  58. return getFontSize()
  59. },
  60. },
  61. data(){
  62. return {
  63. navHeight: 0,
  64. dialog:{},
  65. wrapperHeight: 0,
  66. params: { 'page': 0, 'per_page': 10 },
  67. loading: false, // 是否加载更多
  68. isMore: true, // 是否有更多
  69. predeposit_list: false,
  70. rc_sn:'',
  71. }
  72. },
  73. created () {
  74. this.loadMore()
  75. },
  76. mounted(){
  77. // #ifdef MP-WEIXIN
  78. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  79. // #endif
  80. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 130
  81. },
  82. methods:{
  83. closeDialog(){
  84. },
  85. confirmDialog(value){
  86. if (value) {
  87. addRechargeCard(value).then(res => {
  88. uni.showToast({icon:'none',title: res.message})
  89. this.params={ 'page': 0, 'per_page': 10 }
  90. this.loading=false
  91. this.isMore= true
  92. this.predeposit_list=false
  93. this.loadMore()
  94. }).catch(function (error) {
  95. uni.showToast({icon:'none',title: error.message})
  96. })
  97. }
  98. },
  99. addRecharge(){
  100. this.dialog={mode:'input',content:'充值卡号'}
  101. this.$refs.confirm.open()
  102. },
  103. loadMore () {
  104. this.loading = true
  105. this.params.page = ++this.params.page
  106. if (this.isMore) {
  107. this.loading = false
  108. this.getRechargeCardList(true)
  109. }
  110. },
  111. goBack () {
  112. uni.navigateBack({delta:1})
  113. },
  114. getRechargeCardList () {
  115. uni.showLoading({ title: '加载中' })
  116. getRechargeCardList(this.params).then(res => {
  117. uni.hideLoading()
  118. if (res.result.hasmore) {
  119. this.isMore = true
  120. } else {
  121. this.isMore = false
  122. }
  123. let temp = res.result.log_list
  124. if (temp) {
  125. if (!this.predeposit_list) {
  126. this.predeposit_list = temp
  127. } else {
  128. this.predeposit_list = this.predeposit_list.concat(temp)
  129. }
  130. }
  131. }).catch(function (error) {
  132. uni.hideLoading()
  133. uni.showToast({icon:'none',title: error.message})
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style scoped lang="scss">
  140. .scroll-view-wrapper{display: flex;flex-direction: column;}
  141. .scroll-view{flex:1}
  142. .common-header{
  143. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  144. }
  145. .container {
  146. height: 100%;
  147. display: flex;
  148. position: relative;
  149. flex-direction: column;
  150. justify-content: flex-start;
  151. align-items: stretch;
  152. }
  153. .header {
  154. border-bottom: 1px solid #e8eaed;
  155. }
  156. .list-wrapper {
  157. .container {
  158. display: flex;
  159. position: relative;
  160. flex-direction: column;
  161. justify-content: flex-start;
  162. align-items: stretch;
  163. background-color: #fff;
  164. border-bottom: 1px solid #e8eaed;
  165. }
  166. .title {
  167. font-size:$h1;
  168. margin-left: 0.7rem;
  169. margin-top: 0.7rem;
  170. }
  171. .income {
  172. color: $primaryColor;
  173. }
  174. .expend {
  175. color: #666666;
  176. }
  177. .subtitle {
  178. font-size:$fontSize;
  179. color: #999999;
  180. margin-left: 0.7rem;
  181. margin-top: 0.4rem;
  182. margin-bottom: 0.5rem;
  183. }
  184. .date {
  185. color: #999999;
  186. font-size:$subFontSize;
  187. position: absolute;
  188. top: 0.9rem;
  189. right: 0.7rem;
  190. }
  191. }
  192. </style>