yjzye.vue 6.2 KB

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