RechargeList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 pb-30" 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 class="div list-wrapper" v-if="recharge_list && recharge_list.length">
  16. <view
  17. class="div container"
  18. v-for="(item, index) in recharge_list"
  19. :key="item.pdr_id"
  20. @click="goToPay(item.pdr_payment_state,item.pdr_sn)"
  21. >
  22. <view class="div top-wrapper">
  23. <view class="div left-wrapper">
  24. <label class="status">{{item.pdr_payment_state_text}}</label>
  25. <label class="title">充值单号:{{ item.pdr_sn }}</label>
  26. </view>
  27. <view class="div right-wrapper">
  28. <label class="price">¥{{ item.pdr_amount }}</label>
  29. <label class="subtitle">充值金额</label>
  30. </view>
  31. <view class="div top-line"></view>
  32. </view>
  33. <view class="div center-wrapper">
  34. <label class="desc">创建时间:{{ item.pdr_addtime_text }}</label>
  35. </view>
  36. </view>
  37. </view>
  38. <empty-record v-else-if="recharge_list && !recharge_list.length"></empty-record>
  39. </scroll-view>
  40. </view>
  41. <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">充值</view></view>
  42. </view>
  43. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  44. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  45. </uni-popup>
  46. </member-base>
  47. </template>
  48. <script>
  49. import {getFontSize} from '@/util/common'
  50. import TitleHeader from '../../TitleHeader'
  51. import { urlencode } from '@/util/common'
  52. import MemberBase from '../MemberBase'
  53. import { getRechargeList, addRecharge } from '../../../api/memberRecharge'
  54. import EmptyRecord from '../../EmptyRecord'
  55. export default {
  56. name: 'BalanceHistory',
  57. components:{
  58. TitleHeader,
  59. MemberBase,
  60. EmptyRecord
  61. },
  62. computed:{
  63. fontSize(){
  64. return getFontSize()
  65. },
  66. },
  67. data(){
  68. return {
  69. if_pay:0,
  70. navHeight: 0,
  71. dialog:{},
  72. params: { 'page': 0, 'per_page': 10 },
  73. loading: false, // 是否加载更多
  74. isMore: true, // 是否有更多
  75. wrapperHeight: 0,
  76. recharge_list: false
  77. }
  78. },
  79. onLoad (option) {
  80. this.if_pay=option.if_pay
  81. this.loadMore()
  82. },
  83. mounted(){
  84. // #ifdef MP-WEIXIN
  85. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  86. // #endif
  87. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 130
  88. },
  89. methods:{
  90. closeDialog(){
  91. },
  92. confirmDialog(value){
  93. addRecharge(value).then(res => {
  94. this.goToPay(0, res.result.pay_sn)
  95. }).catch(function (error) {
  96. uni.showToast({icon:'none',title: error.message})
  97. })
  98. },
  99. goAdd () {
  100. this.dialog={mode:'input',content:'请输入充值金额'}
  101. this.$refs.confirm.open()
  102. },
  103. goBack () {
  104. if(this.if_pay){
  105. uni.reLaunch({
  106. url:'/pages/member/index/Index'
  107. })
  108. }else{
  109. uni.navigateBack({delta:1})
  110. }
  111. },
  112. goToPay (state, paySn) {
  113. if (state == 0) {
  114. uni.navigateTo({ url: '/pages/member/buy/pay'+'?'+urlencode( { pay_sn: paySn, pay_type: 'pd_pay' } )})
  115. }
  116. },
  117. loadMore () {
  118. this.loading = true
  119. this.params.page = ++this.params.page
  120. if (this.isMore) {
  121. this.loading = false
  122. this.getRechargeList(true)
  123. }
  124. },
  125. getRechargeList () {
  126. uni.showLoading({ title: '加载中' })
  127. getRechargeList(this.params).then(res => {
  128. uni.hideLoading()
  129. if (res.result.hasmore) {
  130. this.isMore = true
  131. } else {
  132. this.isMore = false
  133. }
  134. let temp = res.result.list
  135. if (temp) {
  136. if (!this.recharge_list) {
  137. this.recharge_list = temp
  138. } else {
  139. this.recharge_list = this.recharge_list.concat(temp)
  140. }
  141. }
  142. }).catch(function (error) {
  143. uni.hideLoading()
  144. uni.showToast({icon:'none',title: error.message})
  145. })
  146. }
  147. }
  148. }
  149. </script>
  150. <style scoped lang="scss">
  151. .scroll-view-wrapper{display: flex;flex-direction: column;}
  152. .scroll-view{flex:1}
  153. .common-header{
  154. .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
  155. }
  156. .container {
  157. height: 100%;
  158. display: flex;
  159. position: relative;
  160. flex-direction: column;
  161. justify-content: flex-start;
  162. align-items: stretch;
  163. }
  164. .header {
  165. border-bottom: 1px solid #e8eaed;
  166. }
  167. .list-wrapper {
  168. .container {
  169. display: flex;
  170. flex-direction: column;
  171. justify-content: flex-start;
  172. align-items: stretch;
  173. background-color: #fff;
  174. }
  175. .top-wrapper {
  176. position: relative;
  177. display: flex;
  178. flex-direction: row;
  179. justify-content: flex-start;
  180. align-items: stretch;
  181. }
  182. .left-wrapper {
  183. flex: 1;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: flex-start;
  187. align-items: stretch;
  188. }
  189. .right-wrapper {
  190. display: flex;
  191. flex-direction: column;
  192. justify-content: flex-start;
  193. align-items: stretch;
  194. }
  195. .status {
  196. font-size:$subFontSize;
  197. color: #5296db;
  198. margin-left: 0.75rem;
  199. margin-top: 0.65rem;
  200. }
  201. .title {
  202. font-size:$fontSize;
  203. color: #666666;
  204. margin-left: 0.75rem;
  205. margin-top:0.25rem;
  206. margin-right: 0.5rem;
  207. margin-bottom: 0.2rem;
  208. }
  209. .price {
  210. font-size:$h1;
  211. color: $primaryColor;
  212. margin-right: 0.75rem;
  213. margin-top: 0.5rem;
  214. text-align: right;
  215. }
  216. .subtitle {
  217. // width: 4rem;
  218. font-size:$fontSize;
  219. color: #999999;
  220. margin-right: 0.75rem;
  221. margin-top:0.25rem;
  222. margin-bottom: 0.5rem;
  223. text-align: right;
  224. }
  225. .top-line {
  226. position: absolute;
  227. left: 0.75rem;
  228. bottom: 0;
  229. right: 0;
  230. height: 1px;
  231. background-color: #e8eaed;
  232. }
  233. .desc {
  234. color: #999999;
  235. font-size:$fontSize;
  236. margin-left: 0.75rem;
  237. margin-top:0.25rem;
  238. }
  239. .center-wrapper {
  240. display: flex;
  241. flex-direction: column;
  242. justify-content: flex-start;
  243. align-items: stretch;
  244. border-bottom: 1px solid #e8eaed;
  245. padding-bottom:0.25rem;
  246. }
  247. }
  248. </style>