yjzz.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar v-if="trade_commission" single="true" :text="'转账手续费:' + trade_commission + '%'"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex">
  6. <view class="buttom">
  7. <view class="icon" v-if="type == 0">{{ userInfo.brokerage_price || 0}}</view>
  8. <view class="icon" v-if="type == 1">{{ userInfo.now_money || 0}}</view>
  9. <text class="text">可转账余额</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="row-box">
  14. <view class="title" v-if="!spread_server">收款人UID</view>
  15. <view class="title" v-else>服务站UID</view>
  16. <view class="row"><input class="input" type="number" v-model="phone" placeholder="请输入收款人UID"
  17. placeholder-class="placeholder" /></view>
  18. </view>
  19. <view class="row-box">
  20. <view class="title">转账金额</view>
  21. <view class="row">
  22. <input class="input" type="number" v-model="withdrawal" placeholder="请输入转账金额"
  23. placeholder-class="placeholder" />
  24. <view class="buttom" @click="getAll" >全部转账</view>
  25. </view>
  26. </view>
  27. <button class="add-btn up" @click="!loding ? confirm('zz') : ''">转账</button>
  28. </view>
  29. </template>
  30. <script>
  31. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  32. import {
  33. getUserInfo,
  34. } from '@/api/user.js';
  35. import { passUser,createGs } from '@/api/zero.js'
  36. import {
  37. mapMutations,
  38. mapState
  39. } from 'vuex';
  40. import {trade, extractBank,trades } from '@/api/wallet.js'
  41. export default {
  42. components: {
  43. uniNoticeBar
  44. },
  45. data() {
  46. return {
  47. spread_server: '',
  48. extract_commission: '',
  49. trade_commission: '',
  50. phone: '',
  51. money: '0.00', //可提现金额
  52. withdrawal: '', //提现金额
  53. password: '', //支付密码
  54. card: '', //转账卡号
  55. name: '',
  56. // #ifdef H5
  57. weichatBsrowser: false,
  58. // #endif
  59. loding: true,
  60. type: 0,
  61. pUser: {}
  62. };
  63. },
  64. onLoad(options) {
  65. this.loadData()
  66. // #ifdef H5
  67. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  68. // #endif
  69. this.dataUp();
  70. if (options.type) {
  71. this.type = options.type;
  72. if(this.type == 1) {
  73. uni.setNavigationBarTitle({
  74. title:'余额转账'
  75. })
  76. }
  77. }
  78. if(options.uid) {
  79. this.phone = options.uid
  80. this.spread_server = options.spread_server
  81. }
  82. },
  83. computed: {
  84. ...mapState('user', ['userInfo'])
  85. },
  86. methods: {
  87. ...mapMutations('user', ['setUserInfo']),
  88. loadData() {
  89. extractBank({}).then(({
  90. data
  91. }) => {
  92. this.extract_commission = data.extract_commission
  93. this.trade_commission = data.trade_commission
  94. });
  95. },
  96. getAll() {
  97. if(this.type == 0) {
  98. this.withdrawal = this.userInfo.brokerage_price
  99. }else if(this.type == 2){
  100. this.withdrawal = this.userInfo.now_money
  101. }else if(this.type == 3) {
  102. this.withdrawal = this.pUser.points
  103. }
  104. },
  105. // 更新数据
  106. dataUp() {
  107. let obj = this;
  108. getUserInfo({})
  109. .then(e => {
  110. obj.loding = false;
  111. // 保存返回用户数据
  112. obj.setUserInfo(e.data);
  113. // this.passUser()
  114. })
  115. .catch(e => {
  116. console.log(e);
  117. });
  118. },
  119. // 切换选中对象
  120. tabRadio(e) {
  121. this.type = e.detail.value;
  122. },
  123. // 提交
  124. confirm(tit) {
  125. let obj = this;
  126. obj.loding = true;
  127. if(obj.phone == '') {
  128. return obj.$api.msg('请输入用户UID');
  129. }
  130. if ( !obj.withdrawal || obj.withdrawal<=0 ) {
  131. obj.loding = false;
  132. obj.$api.msg('转账金额须大于0');
  133. return;
  134. }
  135. let data = {
  136. uid: obj.phone, //编号
  137. money: obj.withdrawal ,//金额
  138. // type: obj.type
  139. };
  140. if(obj.type == 1) {
  141. trades(data)
  142. .then(e => {
  143. obj.withdrawal = '';
  144. uni.showToast({
  145. title: '转账成功',
  146. duration: 2000,
  147. position: 'top'
  148. });
  149. obj.dataUp();
  150. })
  151. .catch(e => {
  152. obj.$api.msg(e.msg);
  153. obj.loding = false;
  154. });
  155. }else {
  156. trade(data)
  157. .then(e => {
  158. // 初始化提现金额
  159. obj.withdrawal = '';
  160. uni.showToast({
  161. title: '转账成功',
  162. duration: 2000,
  163. position: 'top'
  164. });
  165. obj.dataUp();
  166. })
  167. .catch(e => {
  168. obj.$api.msg(e.msg);
  169. obj.loding = false;
  170. });
  171. }
  172. },
  173. boblack() {
  174. uni.navigateBack({
  175. fail() {
  176. uni.switchTab({
  177. url: '/pages/index/index'
  178. })
  179. }
  180. })
  181. },
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. page {
  187. height: 100%;
  188. }
  189. .content-money {
  190. padding: 30rpx 0;
  191. background: #ffffff;
  192. }
  193. .item {
  194. padding: 0 $page-row-spacing;
  195. background-color: #ffffff;
  196. }
  197. .flex {
  198. background-color: #ffffff;
  199. text-align: center;
  200. margin: 0 30rpx;
  201. border-radius: $border-radius-sm;
  202. justify-content: center;
  203. .buttom {
  204. font-size: $font-lg;
  205. width: 50%;
  206. }
  207. .interval {
  208. width: 2px;
  209. height: 60rpx;
  210. background-color: #eeeeee;
  211. }
  212. .icon {
  213. background-size: 100%;
  214. font-size: 42rpx;
  215. color: $font-color-dark;
  216. font-weight: bold;
  217. background-repeat: no-repeat;
  218. background-position: center;
  219. }
  220. .text {
  221. color: $font-color-light;
  222. }
  223. }
  224. .row-box {
  225. margin-top: 30rpx;
  226. padding: 20rpx 30rpx;
  227. background: #fff;
  228. .title {
  229. font-size: $font-base + 2rpx;
  230. color: $font-color-dark;
  231. }
  232. .row {
  233. display: flex;
  234. align-items: center;
  235. position: relative;
  236. height: 80rpx;
  237. .tit {
  238. flex-shrink: 0;
  239. width: 40rpx;
  240. font-size: 30rpx;
  241. color: $font-color-dark;
  242. }
  243. .input {
  244. flex: 1;
  245. font-size: 30rpx;
  246. color: $font-color-dark;
  247. }
  248. .iconlocation {
  249. font-size: 36rpx;
  250. color: $font-color-light;
  251. }
  252. .buttom {
  253. color: $base-color;
  254. font-size: $font-base;
  255. }
  256. }
  257. }
  258. .add-btn {
  259. width: 520rpx;
  260. height: 80rpx;
  261. border-radius: 20rpx;
  262. margin: 140rpx auto 0;
  263. font-size: 36rpx;
  264. font-weight: bold;
  265. color: #fff;
  266. background-color:$base-color;
  267. }
  268. .back-btn {
  269. width: 520rpx;
  270. height: 80rpx;
  271. border-radius: 20rpx;
  272. margin: 40rpx auto;
  273. font-size: 36rpx;
  274. font-weight: bold;
  275. color: #303030;
  276. background-color: #F8DABA;
  277. }
  278. .name {
  279. background: #fff;
  280. padding: 30rpx;
  281. }
  282. .list {
  283. padding-left: 30rpx;
  284. margin-top: 30rpx;
  285. background-color: #ffffff;
  286. .box {
  287. display: flex;
  288. align-items: center;
  289. width: 100%;
  290. height: 120rpx;
  291. border-bottom: 1px solid $border-color-light;
  292. .icon {
  293. font-size: 48rpx;
  294. padding-right: 20rpx;
  295. .icon-img {
  296. height: 50rpx;
  297. width: 50rpx;
  298. }
  299. }
  300. .iconweixin1 {
  301. color: #18bf16;
  302. }
  303. .iconzhifubao {
  304. color: #08aaec;
  305. }
  306. .title-box {
  307. flex-grow: 1;
  308. text-align: left;
  309. .title {
  310. font-size: $font-base + 2rpx;
  311. color: $font-color-base;
  312. }
  313. .node {
  314. font-size: $font-sm;
  315. color: $font-color-light;
  316. }
  317. }
  318. }
  319. }
  320. .tip {
  321. padding: 20rpx;
  322. color: #ff0000;
  323. }
  324. /deep/ .uni-radio-input {
  325. width: 45rpx;
  326. height: 45rpx;
  327. }
  328. .psw-wrapper {
  329. width: 548rpx;
  330. height: 344rpx;
  331. background-color: #FFFFFF;
  332. border-radius: 15rpx 15rpx;
  333. .psw-title {
  334. width: 100%;
  335. font-size: 35rpx;
  336. padding: 43rpx 0 49rpx;
  337. text-align: center;
  338. font-weight: 800;
  339. }
  340. .psw-ipt {
  341. display: block;
  342. background-color: #dce3ed;
  343. height: 90rpx;
  344. width: 464rpx;
  345. padding-left: 30rpx;
  346. margin: 0 auto;
  347. font-size: 80rpx;
  348. }
  349. .psw-btn text {
  350. display: inline-block;
  351. text-align: center;
  352. width: 50%;
  353. padding-top: 29rpx;
  354. font-size: 35rpx;
  355. }
  356. .psw-qd {
  357. color: #5771DF;
  358. }
  359. }
  360. .jy {
  361. background-color: $base-color;
  362. color: #fff;
  363. margin-top: 30rpx;
  364. }
  365. </style>