yjzye.vue 6.5 KB

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