yjzye.vue 5.9 KB

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