yjzye.vue 6.4 KB

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