withdmoenys.vue 6.9 KB

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