wechat.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view class="content">
  3. <view class="row-box">
  4. <view class="title">转出金额</view>
  5. <view class="row">
  6. <text class="tit">¥</text>
  7. <input class="input" type="number" v-model="money" placeholder="请输入充值金额" placeholder-class="placeholder" />
  8. </view>
  9. </view>
  10. <button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? confirm() : ''">转出</button>
  11. </view>
  12. </template>
  13. <script>
  14. import { getMoneyStyle } from '@/utils/rocessor.js';
  15. // #ifdef APP-PLUS
  16. import { rechargeRoutine } from '@/api/wallet.js';
  17. // #endif
  18. // #ifdef H5
  19. import { rechargeWechat } from '@/api/wallet.js';
  20. // #endif
  21. // #ifdef MP
  22. import { rechargeRoutine } from '@/api/wallet.js';
  23. // #endif
  24. import { mapState } from 'vuex';
  25. export default {
  26. filters: {
  27. getMoneyStyle
  28. },
  29. data() {
  30. return {
  31. type: 'weixin',
  32. money: '', //充值金额
  33. payLoding: false //是否加载中
  34. };
  35. },
  36. onLoad(options) {},
  37. computed: {
  38. // #ifdef H5
  39. ...mapState(['weichatObj'])
  40. // #endif
  41. },
  42. methods: {
  43. // 跳转
  44. navTo(url) {
  45. uni.navigateTo({
  46. url: url
  47. });
  48. },
  49. // 切换选中对象
  50. tabRadio(e) {
  51. this.type = e;
  52. console.log(this.type,'this.type')
  53. },
  54. // 提交
  55. confirm() {
  56. let obj = this;
  57. obj.payLoding = true;
  58. console.log(obj.money);
  59. if ( obj.money == '') {
  60. this.$api.msg('金额不能为空');
  61. obj.payLoding = false;
  62. return
  63. }
  64. // #ifdef APP-PLUS
  65. rechargeRoutine({
  66. price: this.money,
  67. from: this.type,
  68. type: 1,
  69. }).then(e => {
  70. this.$api.msg('转入余额成功');
  71. })
  72. .catch(e => {
  73. obj.payLoding = false;
  74. });
  75. // #endif
  76. // #ifdef H5
  77. rechargeWechat({
  78. price: this.money,
  79. from: this.type,
  80. type: 1,
  81. }).then(e => {
  82. this.$api.msg('转入余额成功');
  83. })
  84. .catch(e => {
  85. obj.payLoding = false;
  86. });
  87. // #endif
  88. // #ifdef MP
  89. rechargeRoutine({
  90. price: this.money,
  91. from: this.type,
  92. type: 1,
  93. }).then(e => {
  94. this.$api.msg('转入余额成功');
  95. })
  96. .catch(e => {
  97. obj.payLoding = false;
  98. });
  99. // #endif
  100. }
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. page {
  106. height: 100%;
  107. }
  108. .add-btn {
  109. &.modified {
  110. color: $base-color;
  111. }
  112. &.up {
  113. background:$base-color;
  114. color: #fff;
  115. }
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. width: 560rpx;
  120. height: 80rpx;
  121. margin: 0 auto;
  122. margin-top: 60rpx;
  123. font-size: $font-lg;
  124. border-radius: 40rpx;
  125. }
  126. .row-box {
  127. border-top: 1px solid #EEEEEE;
  128. padding: 20rpx 30rpx;
  129. background: #fff;
  130. .title {
  131. font-size: $font-base + 2rpx;
  132. color: $font-color-dark;
  133. }
  134. .row {
  135. display: flex;
  136. align-items: center;
  137. position: relative;
  138. height: 80rpx;
  139. .tit {
  140. flex-shrink: 0;
  141. width: 40rpx;
  142. font-size: 30rpx;
  143. color: $font-color-dark;
  144. }
  145. .input {
  146. flex: 1;
  147. font-size: 30rpx;
  148. color: $font-color-dark;
  149. }
  150. .iconlocation {
  151. font-size: 36rpx;
  152. color: $font-color-light;
  153. }
  154. .buttom {
  155. color: $font-color;
  156. font-size: $font-base;
  157. }
  158. }
  159. }
  160. .list {
  161. padding:0 30rpx;
  162. margin-top: 20rpx;
  163. background-color: #ffffff;
  164. .box {
  165. display: flex;
  166. align-items: center;
  167. width: 100%;
  168. height: 100rpx;
  169. border-bottom: 1px solid $border-color-light;
  170. }
  171. .box1{
  172. display: flex;
  173. align-items: center;
  174. width: 100%;
  175. height: 100rpx;
  176. }
  177. .icon {
  178. font-size: 48rpx;
  179. padding-right: 20rpx;
  180. }
  181. .iconweixin1 {
  182. color: #18bf16;
  183. }
  184. .iconzhifubao {
  185. color: #08aaec;
  186. }
  187. .title-box {
  188. flex-grow: 1;
  189. text-align: left;
  190. .title {
  191. font-size: $font-base + 2rpx;
  192. color: #333333;
  193. }
  194. /* .node {
  195. font-size: $font-base;
  196. color: #333333;
  197. } */
  198. }
  199. image {
  200. width: 25rpx;
  201. height: 25rpx;
  202. }
  203. }
  204. /deep/ .uni-radio-input {
  205. width: 45rpx;
  206. height: 45rpx;
  207. }
  208. .active-bg {
  209. background-color: $color-gray !important;
  210. }
  211. </style>