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.business_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">收款人ID</view>
  25. <view class="row"><input class="input" type="number" v-model="card" placeholder="请输入收款人ID" 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.business_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, yueXhg } 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. console.log(obj.type, 'type');
  121. if (obj.type == 'xl') {
  122. yueXhg({
  123. phone: obj.card, //编号
  124. money: obj.withdrawal, //金额
  125. type: 2
  126. })
  127. .then(e => {
  128. console.log('输入了');
  129. // 允许按钮点击
  130. obj.loding = false;
  131. // 初始化提现金额
  132. obj.withdrawal = '';
  133. uni.showToast({
  134. title: '提交成功',
  135. duration: 2000,
  136. position: 'top'
  137. });
  138. obj.dataUp();
  139. })
  140. .catch(e => {
  141. obj.$api.msg(e.msg);
  142. obj.loding = false;
  143. console.log();
  144. });
  145. }
  146. if (obj.type == 'yue') {
  147. yueXhg({
  148. phone: obj.card, //编号
  149. money: obj.withdrawal, //金额
  150. type: 1
  151. })
  152. .then(e => {
  153. console.log('输入了');
  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>