yjzye.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.brokerage_price | getMoneyStyle }}</view>
  7. <text class="text">可转换余额</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">转换金额</view>
  13. <view class="row">
  14. <input class="input" type="number" v-model="withdrawal" placeholder="转换金额"
  15. placeholder-class="placeholder" />
  16. <view class="buttom" @click="withdrawal = userInfo.brokerage_price*1">全部转换</view>
  17. </view>
  18. </view>
  19. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">转换</button>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. getMoneyStyle
  25. } from '@/utils/rocessor.js';
  26. import {
  27. getUserInfo,
  28. jfzz,
  29. yjzye
  30. } from '@/api/user.js';
  31. import {
  32. mapMutations,
  33. mapState
  34. } from 'vuex';
  35. export default {
  36. filters: {
  37. getMoneyStyle
  38. },
  39. data() {
  40. return {
  41. phone: '',
  42. money: '0.00', //可提现金额
  43. withdrawal: '', //提现金额
  44. password: '', //支付密码
  45. card: '', //转账卡号
  46. name: '',
  47. // #ifdef H5
  48. weichatBsrowser: false,
  49. // #endif
  50. loding: false,
  51. type: 0
  52. };
  53. },
  54. onLoad(options) {
  55. // #ifdef H5
  56. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  57. // #endif
  58. this.dataUp();
  59. if (options.type) {
  60. this.type = options.type;
  61. }
  62. },
  63. computed: {
  64. ...mapState('user', ['userInfo'])
  65. },
  66. methods: {
  67. ...mapMutations('user', ['setUserInfo', 'login']),
  68. // 更新数据
  69. dataUp() {
  70. let obj = this;
  71. getUserInfo({})
  72. .then(e => {
  73. obj.login();
  74. // 保存返回用户数据
  75. obj.setUserInfo(e.data);
  76. })
  77. .catch(e => {
  78. console.log(e);
  79. });
  80. },
  81. // 切换选中对象
  82. tabRadio(e) {
  83. this.type = e.detail.value;
  84. },
  85. // 提交
  86. confirm() {
  87. let obj = this;
  88. obj.loding = true;
  89. if (obj.withdrawal == 0) {
  90. obj.loding = false;
  91. uni.showModal({
  92. title: '提示',
  93. content: '转换金额不要为0'
  94. });
  95. return;
  96. }
  97. let data = {
  98. // phone: obj.phone, //编号
  99. price: obj.withdrawal, //金额
  100. // type: obj.type
  101. };
  102. yjzye(data)
  103. .then(e => {
  104. // 允许按钮点击
  105. obj.loding = false;
  106. // 初始化提现金额
  107. obj.withdrawal = '';
  108. uni.showToast({
  109. title: '转换成功',
  110. duration: 2000,
  111. position: 'top'
  112. });
  113. obj.dataUp();
  114. obj.cancel()
  115. })
  116. .catch(e => {
  117. obj.$api.msg(e.msg);
  118. obj.loding = false;
  119. console.log();
  120. });
  121. },
  122. boblack() {
  123. uni.navigateBack({
  124. fail() {
  125. uni.switchTab({
  126. url: '/pages/index/index'
  127. })
  128. }
  129. })
  130. },
  131. }
  132. };
  133. </script>
  134. <style lang="scss">
  135. page {
  136. height: 100%;
  137. }
  138. .content-money {
  139. padding: 30rpx 0;
  140. background: #ffffff;
  141. }
  142. .item {
  143. padding: 0 $page-row-spacing;
  144. background-color: #ffffff;
  145. }
  146. .flex {
  147. background-color: #ffffff;
  148. text-align: center;
  149. margin: 0 30rpx;
  150. border-radius: $border-radius-sm;
  151. justify-content: center;
  152. .buttom {
  153. font-size: $font-lg;
  154. width: 50%;
  155. }
  156. .interval {
  157. width: 2px;
  158. height: 60rpx;
  159. background-color: #eeeeee;
  160. }
  161. .icon {
  162. background-size: 100%;
  163. font-size: 42rpx;
  164. color: $font-color-dark;
  165. font-weight: bold;
  166. background-repeat: no-repeat;
  167. background-position: center;
  168. }
  169. .text {
  170. color: $font-color-light;
  171. }
  172. }
  173. .row-box {
  174. margin-top: 30rpx;
  175. padding: 20rpx 30rpx;
  176. background: #fff;
  177. .title {
  178. font-size: $font-base + 2rpx;
  179. color: $font-color-dark;
  180. }
  181. .row {
  182. display: flex;
  183. align-items: center;
  184. position: relative;
  185. height: 80rpx;
  186. .tit {
  187. flex-shrink: 0;
  188. width: 40rpx;
  189. font-size: 30rpx;
  190. color: $font-color-dark;
  191. }
  192. .input {
  193. flex: 1;
  194. font-size: 30rpx;
  195. color: $font-color-dark;
  196. }
  197. .iconlocation {
  198. font-size: 36rpx;
  199. color: $font-color-light;
  200. }
  201. .buttom {
  202. color: #f21f5d;
  203. font-size: $font-base;
  204. }
  205. }
  206. }
  207. .add-btn {
  208. width: 520rpx;
  209. height: 80rpx;
  210. border-radius: 20rpx;
  211. margin: 140rpx auto 0;
  212. font-size: 36rpx;
  213. font-weight: bold;
  214. color: #fff;
  215. background-color: #ff4c4c;
  216. }
  217. .back-btn {
  218. width: 520rpx;
  219. height: 80rpx;
  220. border-radius: 20rpx;
  221. margin: 40rpx auto;
  222. font-size: 36rpx;
  223. font-weight: bold;
  224. color: #303030;
  225. background-color: #F8DABA;
  226. }
  227. .name {
  228. background: #fff;
  229. padding: 30rpx;
  230. }
  231. .list {
  232. padding-left: 30rpx;
  233. margin-top: 30rpx;
  234. background-color: #ffffff;
  235. .box {
  236. display: flex;
  237. align-items: center;
  238. width: 100%;
  239. height: 120rpx;
  240. border-bottom: 1px solid $border-color-light;
  241. .icon {
  242. font-size: 48rpx;
  243. padding-right: 20rpx;
  244. .icon-img {
  245. height: 50rpx;
  246. width: 50rpx;
  247. }
  248. }
  249. .iconweixin1 {
  250. color: #18bf16;
  251. }
  252. .iconzhifubao {
  253. color: #08aaec;
  254. }
  255. .title-box {
  256. flex-grow: 1;
  257. text-align: left;
  258. .title {
  259. font-size: $font-base + 2rpx;
  260. color: $font-color-base;
  261. }
  262. .node {
  263. font-size: $font-sm;
  264. color: $font-color-light;
  265. }
  266. }
  267. }
  268. }
  269. .tip {
  270. padding: 20rpx;
  271. color: #ff0000;
  272. }
  273. /deep/ .uni-radio-input {
  274. width: 45rpx;
  275. height: 45rpx;
  276. }
  277. .psw-wrapper {
  278. width: 548rpx;
  279. height: 344rpx;
  280. background-color: #FFFFFF;
  281. border-radius: 15rpx 15rpx;
  282. .psw-title {
  283. width: 100%;
  284. font-size: 35rpx;
  285. padding: 43rpx 0 49rpx;
  286. text-align: center;
  287. font-weight: 800;
  288. }
  289. .psw-ipt {
  290. display: block;
  291. background-color: #dce3ed;
  292. height: 90rpx;
  293. width: 464rpx;
  294. padding-left: 30rpx;
  295. margin: 0 auto;
  296. font-size: 80rpx;
  297. }
  298. .psw-btn text {
  299. display: inline-block;
  300. text-align: center;
  301. width: 50%;
  302. padding-top: 29rpx;
  303. font-size: 35rpx;
  304. }
  305. .psw-qd {
  306. color: #5771DF;
  307. }
  308. }
  309. </style>