withdmoenys.vue 7.2 KB

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