yjzz.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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">收款人UID</view>
  14. <view class="row"><input class="input" type="number" v-model="phone" placeholder="请输入收款人UID"
  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.phone == '') {
  107. return obj.$api.msg('请输入用户UID')
  108. }
  109. let data = {
  110. uid: obj.phone, //编号
  111. price: obj.withdrawal ,//金额
  112. // type: obj.type
  113. };
  114. if(obj.type == 'yj') {
  115. jfzz(data)
  116. .then(e => {
  117. // 允许按钮点击
  118. obj.loding = false;
  119. // 初始化提现金额
  120. obj.withdrawal = '';
  121. uni.showToast({
  122. title: '转账成功',
  123. duration: 2000,
  124. position: 'top'
  125. });
  126. obj.dataUp();
  127. obj.cancel()
  128. })
  129. .catch(e => {
  130. obj.$api.msg(e.msg);
  131. obj.loding = false;
  132. console.log();
  133. });
  134. }
  135. if(obj.type == 'yue') {
  136. yuezz(data)
  137. .then(e => {
  138. // 允许按钮点击
  139. obj.loding = false;
  140. // 初始化提现金额
  141. obj.withdrawal = '';
  142. uni.showToast({
  143. title: '转账成功',
  144. duration: 2000,
  145. position: 'top'
  146. });
  147. obj.dataUp();
  148. obj.cancel()
  149. })
  150. .catch(e => {
  151. obj.$api.msg(e.msg);
  152. obj.loding = false;
  153. console.log();
  154. });
  155. }
  156. },
  157. boblack() {
  158. uni.navigateBack({
  159. fail() {
  160. uni.switchTab({
  161. url: '/pages/index/index'
  162. })
  163. }
  164. })
  165. },
  166. }
  167. };
  168. </script>
  169. <style lang="scss">
  170. page {
  171. height: 100%;
  172. }
  173. .content-money {
  174. padding: 30rpx 0;
  175. background: #ffffff;
  176. }
  177. .item {
  178. padding: 0 $page-row-spacing;
  179. background-color: #ffffff;
  180. }
  181. .flex {
  182. background-color: #ffffff;
  183. text-align: center;
  184. margin: 0 30rpx;
  185. border-radius: $border-radius-sm;
  186. justify-content: center;
  187. .buttom {
  188. font-size: $font-lg;
  189. width: 50%;
  190. }
  191. .interval {
  192. width: 2px;
  193. height: 60rpx;
  194. background-color: #eeeeee;
  195. }
  196. .icon {
  197. background-size: 100%;
  198. font-size: 42rpx;
  199. color: $font-color-dark;
  200. font-weight: bold;
  201. background-repeat: no-repeat;
  202. background-position: center;
  203. }
  204. .text {
  205. color: $font-color-light;
  206. }
  207. }
  208. .row-box {
  209. margin-top: 30rpx;
  210. padding: 20rpx 30rpx;
  211. background: #fff;
  212. .title {
  213. font-size: $font-base + 2rpx;
  214. color: $font-color-dark;
  215. }
  216. .row {
  217. display: flex;
  218. align-items: center;
  219. position: relative;
  220. height: 80rpx;
  221. .tit {
  222. flex-shrink: 0;
  223. width: 40rpx;
  224. font-size: 30rpx;
  225. color: $font-color-dark;
  226. }
  227. .input {
  228. flex: 1;
  229. font-size: 30rpx;
  230. color: $font-color-dark;
  231. }
  232. .iconlocation {
  233. font-size: 36rpx;
  234. color: $font-color-light;
  235. }
  236. .buttom {
  237. color: #f21f5d;
  238. font-size: $font-base;
  239. }
  240. }
  241. }
  242. .add-btn {
  243. width: 520rpx;
  244. height: 80rpx;
  245. border-radius: 20rpx;
  246. margin: 140rpx auto 0;
  247. font-size: 36rpx;
  248. font-weight: bold;
  249. color: #fff;
  250. background-color: #ff4c4c;
  251. }
  252. .back-btn {
  253. width: 520rpx;
  254. height: 80rpx;
  255. border-radius: 20rpx;
  256. margin: 40rpx auto;
  257. font-size: 36rpx;
  258. font-weight: bold;
  259. color: #303030;
  260. background-color: #F8DABA;
  261. }
  262. .name {
  263. background: #fff;
  264. padding: 30rpx;
  265. }
  266. .list {
  267. padding-left: 30rpx;
  268. margin-top: 30rpx;
  269. background-color: #ffffff;
  270. .box {
  271. display: flex;
  272. align-items: center;
  273. width: 100%;
  274. height: 120rpx;
  275. border-bottom: 1px solid $border-color-light;
  276. .icon {
  277. font-size: 48rpx;
  278. padding-right: 20rpx;
  279. .icon-img {
  280. height: 50rpx;
  281. width: 50rpx;
  282. }
  283. }
  284. .iconweixin1 {
  285. color: #18bf16;
  286. }
  287. .iconzhifubao {
  288. color: #08aaec;
  289. }
  290. .title-box {
  291. flex-grow: 1;
  292. text-align: left;
  293. .title {
  294. font-size: $font-base + 2rpx;
  295. color: $font-color-base;
  296. }
  297. .node {
  298. font-size: $font-sm;
  299. color: $font-color-light;
  300. }
  301. }
  302. }
  303. }
  304. .tip {
  305. padding: 20rpx;
  306. color: #ff0000;
  307. }
  308. /deep/ .uni-radio-input {
  309. width: 45rpx;
  310. height: 45rpx;
  311. }
  312. .psw-wrapper {
  313. width: 548rpx;
  314. height: 344rpx;
  315. background-color: #FFFFFF;
  316. border-radius: 15rpx 15rpx;
  317. .psw-title {
  318. width: 100%;
  319. font-size: 35rpx;
  320. padding: 43rpx 0 49rpx;
  321. text-align: center;
  322. font-weight: 800;
  323. }
  324. .psw-ipt {
  325. display: block;
  326. background-color: #dce3ed;
  327. height: 90rpx;
  328. width: 464rpx;
  329. padding-left: 30rpx;
  330. margin: 0 auto;
  331. font-size: 80rpx;
  332. }
  333. .psw-btn text {
  334. display: inline-block;
  335. text-align: center;
  336. width: 50%;
  337. padding-top: 29rpx;
  338. font-size: 35rpx;
  339. }
  340. .psw-qd {
  341. color: #5771DF;
  342. }
  343. }
  344. </style>