yjzye.vue 6.4 KB

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