yjzye.vue 6.5 KB

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