yjzye.vue 6.5 KB

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