yjzye.vue 6.2 KB

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