indexss.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="payment-top acea-row row-column row-center-wrapper">
  4. <span class="name">{{$t(`我的余额`)}}</span>
  5. <view class="pic">
  6. <span class="pic-font"><span class="num"> {{$t(`¥`)}}</span>{{ userInfo.now_money || 0 }}</span>
  7. </view>
  8. </view>
  9. <view class='cash-withdrawal'>
  10. <view class='wrapper'>
  11. <view class='list'>
  12. <form @submit="subCash">
  13. <view class='item acea-row row-between-wrapper'>
  14. <view class='name' style="font-size: 36rpx;"><text class='red'>*</text> {{$t(`接收人ID`)}}</view>
  15. <view class='input'><input type="number" :placeholder='$t(`请输入接收人ID`)' placeholder-class='placeholder'
  16. name="to_uid" style="font-size: 60rpx;"></input></view>
  17. </view>
  18. <view class='item acea-row row-between-wrapper'>
  19. <view class='name' style="font-size: 36rpx;"><text class='red'>*</text> {{$t(`金额`)}}</view>
  20. <view class='input'><input type='digit' :placeholder='$t(`请输入转账金额`)' placeholder-class='placeholder'
  21. name="num" style="font-size: 60rpx;"></input></view>
  22. </view>
  23. <view class='item acea-row row-between-wrapper'>
  24. <view class='name' style="font-size: 36rpx;"><text class='red'>*</text> {{$t(`交易密码`)}}</view>
  25. <view class='input' ><input :placeholder='$t(`请填写交易密码`)'
  26. placeholder-class='placeholder' name="trade" type='password' style="font-size: 60rpx;"></input></view>
  27. </view>
  28. <button formType="submit" class='bnt bg-color'>{{$t(`提现`)}}</button>
  29. </form>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- #ifdef MP -->
  34. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  35. <!-- #endif -->
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. extractCash,
  41. extractBank,
  42. getUserInfo,
  43. recharge,
  44. tradeMoney
  45. } from '@/api/user.js';
  46. import {
  47. toLogin
  48. } from '@/libs/login.js';
  49. import {
  50. mapGetters
  51. } from "vuex";
  52. // #ifdef MP
  53. import authorize from '@/components/Authorize';
  54. import {
  55. openRevenueSubscribe
  56. } from '@/utils/SubscribeMessage.js';
  57. // #endif
  58. import colors from '@/mixins/color.js';
  59. export default {
  60. components: {
  61. // #ifdef MP
  62. authorize
  63. // #endif
  64. },
  65. mixins: [colors],
  66. data() {
  67. return {
  68. navList: [],
  69. currentTab: 0,
  70. index: 0,
  71. array: [], //提现银行
  72. minPrice: 0.00, //最低提现金额
  73. userInfo: [],
  74. isClone: false,
  75. isAuto: false, //没有授权的不会自动授权
  76. isShowAuth: false, //是否隐藏授权
  77. qrcodeUrlW: "",
  78. qrcodeUrlZ: "",
  79. prevent: false, //避免重复提交成功多次
  80. weixinExtractType: 0, // 佣金到账方式
  81. alipayExtractType: 0, // 佣金到账方式
  82. withdrawal_fee: 0, //提现手续费
  83. true_money: 0
  84. };
  85. },
  86. computed: mapGetters(['isLogin']),
  87. watch: {
  88. isLogin: {
  89. handler: function(newV, oldV) {
  90. if (newV) {
  91. this.getUserInfo();
  92. }
  93. },
  94. deep: true
  95. }
  96. },
  97. onLoad() {
  98. if (this.isLogin) {
  99. this.getUserInfo();
  100. } else {
  101. toLogin();
  102. }
  103. },
  104. methods: {
  105. inputNum: function(e) {
  106. let val = e.detail.value;
  107. let dot = val.indexOf('.');
  108. if (dot > -1) {
  109. this.moneyMaxLeng = dot + 3;
  110. } else {
  111. this.moneyMaxLeng = 8
  112. }
  113. this.true_money = Math.floor((this.$util.$h.Mul(val, this.$util.$h.Div(this.$util.$h.Sub(100, this
  114. .withdrawal_fee), 100))) * 100) / 100 || 0;
  115. },
  116. // uploadpicW(){
  117. // this.uploadpic(this.qrcodeUrlW);
  118. // },
  119. // uploadpicZ(){
  120. // this.uploadpic(this.qrcodeUrlZ);
  121. // },
  122. /**
  123. * 上传文件
  124. *
  125. */
  126. uploadpic: function(type) {
  127. let that = this;
  128. that.$util.uploadImageOne('upload/image', function(res) {
  129. if (type === 'W') {
  130. that.qrcodeUrlW = res.data.url;
  131. } else {
  132. that.qrcodeUrlZ = res.data.url;
  133. }
  134. });
  135. },
  136. /**
  137. * 删除图片
  138. *
  139. */
  140. DelPicW: function() {
  141. this.qrcodeUrlW = "";
  142. },
  143. DelPicZ: function() {
  144. this.qrcodeUrlZ = "";
  145. },
  146. onLoadFun: function() {
  147. this.getUserInfo();
  148. this.getUserExtractBank();
  149. },
  150. // 授权关闭
  151. authColse: function(e) {
  152. this.isShowAuth = e
  153. },
  154. getUserExtractBank: function() {
  155. let that = this;
  156. extractBank().then(res => {
  157. let array = res.data.extractBank;
  158. array.unshift('请选择银行');
  159. array.forEach((v, i) => {
  160. array.splice(i, 1, that.$t(v))
  161. })
  162. that.$set(that, 'array', array);
  163. that.minPrice = res.data.minPrice;
  164. that.withdrawal_fee = res.data.withdrawal_fee;
  165. that.alipayExtractType = res.data.alipayExtractType ? parseInt(res.data.alipayExtractType) : 0;
  166. that.weixinExtractType = res.data.weixinExtractType ? parseInt(res.data.weixinExtractType) : 0;
  167. });
  168. },
  169. /**
  170. * 获取个人用户信息
  171. */
  172. getUserInfo: function() {
  173. let that = this;
  174. getUserInfo().then(res => {
  175. that.userInfo = res.data;
  176. });
  177. },
  178. swichNav: function(current) {
  179. this.currentTab = current;
  180. },
  181. bindPickerChange: function(e) {
  182. this.index = e.detail.value;
  183. },
  184. subCash(e) {
  185. let that = this,
  186. value = e.detail.value;
  187. if (this.prevent) return
  188. if (!value.to_uid) return this.$util.Tips({
  189. title: this.$t(`请填写接受人ID`)
  190. });
  191. if (!value.num) return this.$util.Tips({
  192. title: this.$t(`请填写转账金额`)
  193. });
  194. if (value.num *1 < 0) return this.$util.Tips({
  195. title: this.$t(`转账金额不能为负数`)
  196. });
  197. if (value.num *1 > that.userInfo.now_money * 1) return this.$util.Tips({
  198. title: this.$t(`您当前余额不足`)
  199. });
  200. if(!value.trade) return this.$util.Tips({
  201. title: this.$t(`请填写交易密码`)
  202. });
  203. this.prevent = true
  204. tradeMoney(value).then(res => {
  205. that.getUserInfo();
  206. return this.$util.Tips({
  207. title: res.msg,
  208. icon: 'success'
  209. }, {
  210. url: '/pages/users/user_money/index',
  211. tab: 2
  212. });
  213. setTimeout(e => {
  214. this.prevent = false
  215. }, 1000)
  216. }).catch(err => {
  217. setTimeout(e => {
  218. this.prevent = false
  219. }, 1000)
  220. return this.$util.Tips({
  221. title: err
  222. });
  223. });
  224. },
  225. }
  226. }
  227. </script>
  228. <style lang="scss">
  229. page {
  230. background-color: #fff !important;
  231. }
  232. .fontcolor {
  233. color: var(--view-theme) !important;
  234. }
  235. .cash-withdrawal .nav {
  236. height: 130rpx;
  237. box-shadow: 0 10rpx 10rpx #f8f8f8;
  238. }
  239. .cash-withdrawal .nav .item {
  240. font-size: 26rpx;
  241. flex: 1;
  242. text-align: center;
  243. }
  244. .cash-withdrawal .nav .item~.item {
  245. border-left: 1px solid #f0f0f0;
  246. }
  247. .cash-withdrawal .nav .item .iconfont {
  248. width: 40rpx;
  249. height: 40rpx;
  250. border-radius: 50%;
  251. border: 2rpx solid var(--view-theme);
  252. text-align: center;
  253. line-height: 37rpx;
  254. margin: 0 auto 6rpx auto;
  255. font-size: 22rpx;
  256. box-sizing: border-box;
  257. }
  258. .cash-withdrawal .nav .item .iconfont.on {
  259. background-color: var(--view-theme);
  260. color: #fff;
  261. border-color: var(--view-theme);
  262. }
  263. .cash-withdrawal .nav .item .line {
  264. width: 2rpx;
  265. height: 20rpx;
  266. margin: 0 auto;
  267. transition: height 0.3s;
  268. }
  269. .cash-withdrawal .nav .item .line.on {
  270. height: 39rpx;
  271. }
  272. .cash-withdrawal .wrapper .list {
  273. padding: 0 30rpx;
  274. }
  275. .cash-withdrawal .wrapper .list .item {
  276. border-bottom: 1rpx solid #eee;
  277. min-height: 28rpx;
  278. font-size: 30rpx;
  279. color: #333;
  280. padding: 39rpx 0;
  281. }
  282. .cash-withdrawal .wrapper .list .item .name {
  283. width: 180rpx;
  284. }
  285. .cash-withdrawal .wrapper .list .item .input {
  286. width: 505rpx;
  287. }
  288. .cash-withdrawal .wrapper .list .item .input .placeholder {
  289. color: #bbb;
  290. }
  291. .cash-withdrawal .wrapper .list .item .picEwm,
  292. .cash-withdrawal .wrapper .list .item .pictrue {
  293. width: 140rpx;
  294. height: 140rpx;
  295. border-radius: 3rpx;
  296. position: relative;
  297. margin-right: 23rpx;
  298. }
  299. .cash-withdrawal .wrapper .list .item .picEwm image {
  300. width: 100%;
  301. height: 100%;
  302. border-radius: 3rpx;
  303. }
  304. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1 {
  305. position: absolute;
  306. right: -14rpx;
  307. top: -16rpx;
  308. font-size: 40rpx;
  309. }
  310. .cash-withdrawal .wrapper .list .item .pictrue {
  311. border: 1px solid rgba(221, 221, 221, 1);
  312. font-size: 22rpx;
  313. color: #BBBBBB;
  314. }
  315. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201 {
  316. font-size: 47rpx;
  317. color: #DDDDDD;
  318. margin-bottom: 3px;
  319. }
  320. .cash-withdrawal .wrapper .list .tip {
  321. font-size: 26rpx;
  322. color: #999;
  323. margin-top: 25rpx;
  324. }
  325. .cash-withdrawal .wrapper .list .bnt {
  326. font-size: 32rpx;
  327. color: #fff;
  328. width: 690rpx;
  329. height: 90rpx;
  330. text-align: center;
  331. border-radius: 50rpx;
  332. line-height: 90rpx;
  333. margin: 64rpx auto;
  334. }
  335. .cash-withdrawal .wrapper .list .tip2 {
  336. font-size: 26rpx;
  337. color: #999;
  338. text-align: center;
  339. margin: 44rpx 0 20rpx 0;
  340. }
  341. .cash-withdrawal .wrapper .list .value {
  342. height: 135rpx;
  343. line-height: 135rpx;
  344. border-bottom: 1rpx solid #eee;
  345. width: 690rpx;
  346. margin: 0 auto;
  347. }
  348. .cash-withdrawal .wrapper .list .value input {
  349. font-size: 80rpx;
  350. color: #282828;
  351. height: 135rpx;
  352. text-align: center;
  353. }
  354. .cash-withdrawal .wrapper .list .value .placeholder2 {
  355. color: #bbb;
  356. }
  357. .price {
  358. color: var(--view-priceColor);
  359. }
  360. .pos{
  361. padding-left: 26rpx;
  362. }
  363. .red{
  364. padding-right: 10rpx;
  365. color: var(--view-theme) !important;
  366. }
  367. .payment-top {
  368. width: 100%;
  369. height: 350rpx;
  370. background-color: var(--view-theme);
  371. .name {
  372. font-size: 26rpx;
  373. color: rgba(255, 255, 255, 0.8);
  374. margin-top: -38rpx;
  375. margin-bottom: 30rpx;
  376. }
  377. .pic {
  378. font-size: 32rpx;
  379. color: #fff;
  380. .num {
  381. font-size: 56rpx;
  382. }
  383. }
  384. .pic-font {
  385. font-size: 78rpx;
  386. color: #fff;
  387. }
  388. }
  389. </style>