yjzz.vue 7.1 KB

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