Integral-transferred.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="usable-integrate">
  5. <text class="usable-title">可用积分</text>
  6. <text class="usable-nums">{{ $addDecimals(integral_able , 8) }}</text>
  7. </view>
  8. <view class="box">
  9. <view class="usable-hint">
  10. <text>转赠积分</text>
  11. <service-charge title="转赠积分手续费为"></service-charge>
  12. </view>
  13. <view class="usable-input">
  14. <text class="iconfont usable-hint-icon">¥</text>
  15. <u-input v-model="value" placeholder="请输入转赠额度" @blur="getPointGiveAwayComputer" />
  16. </view>
  17. <mobilemapname ref="mobilemapname"></mobilemapname>
  18. <view class="usable-hint-info">
  19. <view class="usable-hint-item">
  20. <text class="usable-hint-title">手续费(销毁):</text>
  21. <text class="usable-hint-val">{{ result.handling_fee }}</text>
  22. </view>
  23. <view class="usable-hint-item">
  24. <text class="usable-hint-title">实际转赠积分:</text>
  25. <text class="usable-hint-val">{{ result.face_point }}</text>
  26. </view>
  27. <!-- <view class="usable-hint-item usable-hint-error">
  28. *积分数量不足,请重新输入
  29. </view> -->
  30. <view class="usable-btn" @click.stop="openHintPopup()">
  31. 确认转赠
  32. </view>
  33. </view>
  34. </view>
  35. <exchange-hint :params="pointGiveAwayApi" ref="exchangeHint" :type="1" :useNums="value"
  36. :resultNum="`手机号为“${receiveUser.phone}”的用户`"></exchange-hint>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. pointGiveAwayComputer,
  42. pointGiveAway
  43. } from "@/api/personal-center.js"
  44. export default {
  45. data() {
  46. return {
  47. pointGiveAwayApi: {
  48. url: pointGiveAway,
  49. mode: 'post',
  50. data: {
  51. value: '',
  52. user_obj_id: ''
  53. }
  54. },
  55. integral_able: 0,
  56. value: '', // 需要转赠的积分
  57. receiveUser: {
  58. phone: '',
  59. name: '',
  60. user_obj_id: ''
  61. },
  62. config: {
  63. back: true, //false是tolbar页面 是则不写
  64. title: '积分转赠',
  65. color: '#1A1A1A',
  66. // autoBack:true,
  67. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  68. backgroundColor: [1, "#fff"],
  69. statusBarFontColor: '#1A1A1A'
  70. },
  71. // 手续费 / 实际转赠
  72. result: {
  73. face_point: 0,
  74. handling_fee: 0
  75. }
  76. };
  77. },
  78. onShow() {
  79. this.getUserInfo()
  80. },
  81. methods: {
  82. //获取个人信息
  83. getUserInfo() {
  84. let personal = uni.getStorageSync('personal');
  85. this.integral_able = personal ? personal.integral_able : '';
  86. },
  87. // 积分转赠计算
  88. getPointGiveAwayComputer(e) {
  89. if(!this.value){
  90. return false
  91. }
  92. this.$http.post(pointGiveAwayComputer, {
  93. value: this.value
  94. }).then((res) => {
  95. if (res && res.code == 200) {
  96. this.result.face_point = res.data.face_point
  97. this.result.handling_fee = res.data.handling_fee
  98. }
  99. });
  100. },
  101. openHintPopup() {
  102. this.$refs.mobilemapname.getObjUserId().then(res => {
  103. this.receiveUser = res;
  104. this.pointGiveAwayApi.data = {
  105. value: this.value,
  106. user_obj_id: res.user_obj_id
  107. }
  108. this.$refs.exchangeHint.open()
  109. })
  110. // this.$refs.exchangeHint.open()
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. @import "~./common.scss";
  117. </style>