money.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <view :style="colorStyle">
  3. <!-- #ifdef MP -->
  4. <view class="accountTitle">
  5. <view :style="{height:getHeight.barTop+'px'}"></view>
  6. <view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
  7. <view>账户充值</view>
  8. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  9. </view>
  10. </view>
  11. <view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
  12. <!-- #endif -->
  13. <form @submit="submitSub">
  14. <view class="paymentCon">
  15. <view class="payment-top">
  16. <span class="name">我的余额</span>
  17. <view class="money">{{ userinfo.now_money || 0 }}</view>
  18. <view class="pictrue">
  19. <image src="../static/chongzhi.png"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="payment">
  24. <view class="tip">
  25. <view class="title">转到佣金</view>
  26. <view class='input acea-row row-middle'><text>¥</text><input @input='inputNum'
  27. :maxlength="moneyMaxLeng" placeholder="请输入转到佣金金额" type='digit'
  28. placeholder-class='placeholder' v-model="number" name="number"></input></view>
  29. </view>
  30. <button class='but bg-color' formType="submit">立即转佣金</button>
  31. </view>
  32. </form>
  33. <!-- 确认框 -->
  34. <tuiModal :show="showModal" title="温馨提示" content="确认是否转到佣金?" :maskClosable="false" @click="handleClick">
  35. </tuiModal>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. getUserInfo,
  41. brokerageImport,
  42. getRechargeApi,
  43. memberCardCreate
  44. } from '@/api/user.js';
  45. import tuiModal from "@/components/tui-modal/index.vue"
  46. import {
  47. toLogin
  48. } from '@/libs/login.js';
  49. import {
  50. orderOfflinePayType
  51. } from '@/api/order.js';
  52. import {
  53. mapGetters
  54. } from "vuex";
  55. import colors from "@/mixins/color";
  56. import {
  57. openPaySubscribe
  58. } from '@/utils/SubscribeMessage.js';
  59. export default {
  60. components: {
  61. tuiModal
  62. },
  63. mixins: [colors],
  64. data() {
  65. let that = this;
  66. return {
  67. // #ifdef MP
  68. getHeight: this.$util.getWXStatusHeight(),
  69. // #endif
  70. now_money: 0,
  71. navRecharge: ['账户充值', '佣金转入'],
  72. active: 0,
  73. number: '',
  74. userinfo: {},
  75. placeholder: "0.00",
  76. from: '',
  77. isAuto: false, //没有授权的不会自动授权
  78. isShowAuth: false, //是否隐藏授权
  79. picList: [],
  80. activePic: 0,
  81. money: "",
  82. numberPic: '',
  83. rechar_id: 0,
  84. password: '',
  85. goodsList: [],
  86. pay_order_id: '',
  87. payType: '',
  88. totalPrice: '0',
  89. formContent: '',
  90. // #ifdef H5
  91. isWeixin: this.$wechat.isWeixin(),
  92. // #endif
  93. type: '',
  94. rechargeAttention: [],
  95. moneyMaxLeng: 8,
  96. showModal: false,
  97. balanceStatus: 0
  98. };
  99. },
  100. computed: mapGetters(['isLogin']),
  101. watch: {
  102. isLogin: {
  103. handler: function(newV, oldV) {
  104. if (newV) {
  105. //#ifndef MP
  106. this.getUserInfo();
  107. this.getRecharge();
  108. //#endif
  109. }
  110. },
  111. deep: true
  112. }
  113. },
  114. onLoad(options) {
  115. if (this.isLogin) {
  116. this.getUserInfo();
  117. this.getRecharge();
  118. } else {
  119. toLogin();
  120. }
  121. },
  122. onShow() {
  123. uni.removeStorageSync('form_type_cart');
  124. },
  125. methods: {
  126. allChange() {
  127. this.number = this.userinfo.commissionCount;
  128. },
  129. goarrow() {
  130. let pages = getCurrentPages();
  131. let prevPage = pages[pages.length - 2];
  132. if (prevPage) {
  133. uni.navigateBack()
  134. } else {
  135. uni.reLaunch({
  136. url: '/pages/index/index'
  137. })
  138. }
  139. },
  140. inputNum: function(e) {
  141. let val = e.detail.value;
  142. let dot = val.indexOf('.');
  143. if (dot > -1) {
  144. this.moneyMaxLeng = dot + 3;
  145. } else {
  146. this.moneyMaxLeng = 8
  147. }
  148. },
  149. /**
  150. * 选择金额
  151. */
  152. picCharge(idx, item) {
  153. this.activePic = idx;
  154. if (item === undefined) {
  155. this.rechar_id = 0;
  156. this.numberPic = "";
  157. } else {
  158. this.money = "";
  159. this.rechar_id = item.id;
  160. this.numberPic = item.price;
  161. }
  162. },
  163. /**
  164. * 充值额度选择
  165. */
  166. getRecharge() {
  167. getRechargeApi().then(res => {
  168. this.picList = res.data.recharge_quota;
  169. if (this.picList[0]) {
  170. this.rechar_id = this.picList[0].id;
  171. this.numberPic = this.picList[0].price;
  172. }
  173. this.rechargeAttention = res.data.recharge_attention || [];
  174. this.balanceStatus = res.data.user_extract_balance_status;
  175. }).catch(res => {
  176. this.$util.Tips({
  177. title: res
  178. })
  179. });
  180. },
  181. navRecharges: function(index) {
  182. this.active = index;
  183. },
  184. getUserInfo: function() {
  185. let that = this;
  186. getUserInfo().then(res => {
  187. that.$set(that, 'userinfo', res.data);
  188. })
  189. },
  190. handleClick(e) {
  191. let data = {
  192. money: this.number,
  193. };
  194. brokerageImport(data).then(res => {
  195. this.$util.Tips({
  196. title: res.msg
  197. }, {
  198. url: "/pages/users/user_money/index"
  199. })
  200. }).catch(err => {
  201. return this.$util.Tips({
  202. title: err
  203. })
  204. });
  205. this.showModal = false;
  206. },
  207. submitSub: function(e) {
  208. let that = this
  209. let value = e.detail.value.number;
  210. // 转入余额
  211. if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == "") {
  212. return that.$util.Tips({
  213. title: '请输入金额'
  214. });
  215. }
  216. this.showModal = true;
  217. }
  218. }
  219. }
  220. </script>
  221. <style lang="scss">
  222. .bgcolor {
  223. background-color: var(--view-theme)
  224. }
  225. .accountTitle {
  226. background-color: var(--view-minorColorT);
  227. position: fixed;
  228. left: 0;
  229. top: 0;
  230. width: 100%;
  231. z-index: 99;
  232. .sysTitle {
  233. width: 100%;
  234. position: relative;
  235. font-weight: 500;
  236. color: #333333;
  237. font-size: 30rpx;
  238. .iconfont {
  239. position: absolute;
  240. font-size: 36rpx;
  241. left: 11rpx;
  242. width: 60rpx;
  243. }
  244. }
  245. }
  246. .payment {
  247. position: relative;
  248. width: 710rpx;
  249. background-color: #fff;
  250. border-radius: 32rpx;
  251. margin: -176rpx auto 0 auto;
  252. padding-bottom: 64rpx;
  253. }
  254. .payment .nav {
  255. height: 96rpx;
  256. line-height: 96rpx;
  257. background-color: #f5f5f5;
  258. border-radius: 32rpx 32rpx 0 0;
  259. }
  260. .payment .nav .item {
  261. font-size: 30rpx;
  262. color: #333;
  263. width: 280rpx;
  264. text-align: center;
  265. padding-right: 40rpx;
  266. position: relative;
  267. &.on1 {
  268. padding-right: 62rpx;
  269. background-image: url('../static/titleLeft.png');
  270. &::after {
  271. margin-left: 150rpx;
  272. }
  273. }
  274. &.on2 {
  275. padding-left: 62rpx;
  276. background-image: url('../static/titleRight.png');
  277. &::after {
  278. margin-left: 192rpx;
  279. }
  280. }
  281. &.on3 {
  282. padding-left: 62rpx;
  283. }
  284. }
  285. .payment .nav .item.on {
  286. font-weight: bold;
  287. width: 407rpx;
  288. height: 96rpx;
  289. background-repeat: no-repeat;
  290. background-size: 100% 100%;
  291. text-align: center;
  292. &::after {
  293. width: 38rpx;
  294. height: 30rpx;
  295. border: 2px solid var(--view-theme);
  296. border-left: 2px solid transparent !important;
  297. border-top: 2px solid transparent !important;
  298. border-right: 2px solid transparent !important;
  299. border-radius: 50%;
  300. position: absolute;
  301. content: ' ';
  302. left: 0;
  303. bottom: 10rpx;
  304. }
  305. }
  306. .payment .input {
  307. margin: 32rpx auto 0 auto;
  308. font-size: 56rpx;
  309. color: #333333;
  310. background: #F5F5F5;
  311. border-radius: 16rpx;
  312. height: 114rpx;
  313. }
  314. .payment .input text {
  315. padding-left: 26rpx;
  316. font-weight: 600;
  317. }
  318. .payment .input input {
  319. width: 520rpx;
  320. height: 94rpx;
  321. font-size: 60rpx;
  322. margin-left: 24rpx;
  323. font-family: 'SemiBold';
  324. }
  325. .payment .input .placeholder {
  326. font-weight: 400;
  327. color: #DDDDDD;
  328. height: 100%;
  329. line-height: 94rpx;
  330. font-size: 32rpx;
  331. }
  332. .payment .tip {
  333. font-size: 26rpx;
  334. color: #888888;
  335. padding: 30rpx 33rpx 0 33rpx;
  336. .title {
  337. font-weight: 400;
  338. color: #333333;
  339. font-size: 28rpx;
  340. }
  341. }
  342. .payment .but {
  343. color: #fff;
  344. font-size: 28rpx;
  345. width: 646rpx;
  346. height: 88rpx;
  347. border-radius: 50rpx;
  348. margin: 50rpx auto 0 auto;
  349. line-height: 88rpx;
  350. font-weight: 500;
  351. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  352. }
  353. .paymentCon {
  354. background: linear-gradient(180deg, var(--view-minorColorT) 0%, #f5f5f5 100%);
  355. padding-top: 32rpx;
  356. }
  357. .payment-top {
  358. width: 710rpx;
  359. height: 396rpx;
  360. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  361. margin: 0 auto;
  362. border-radius: 32rpx 32rpx 0 0;
  363. padding: 56rpx 60rpx;
  364. box-sizing: border-box;
  365. position: relative;
  366. .name {
  367. font-size: 28rpx;
  368. color: rgba(255, 255, 255, 0.8);
  369. }
  370. .money {
  371. font-size: 68rpx;
  372. color: #fff;
  373. font-family: 'SemiBold';
  374. margin-top: 16rpx;
  375. }
  376. .pictrue {
  377. width: 186rpx;
  378. height: 186rpx;
  379. position: absolute;
  380. right: 60rpx;
  381. top: 66rpx;
  382. image {
  383. width: 100%;
  384. height: 100%;
  385. }
  386. }
  387. }
  388. .picList {
  389. display: flex;
  390. flex-wrap: wrap;
  391. .pic-box {
  392. width: 204rpx;
  393. height: 144rpx;
  394. border-radius: 20rpx;
  395. padding: 28rpx 0 26rpx 0;
  396. margin: 16rpx 16rpx 0 0;
  397. box-sizing: border-box;
  398. position: relative;
  399. &:nth-child(3n) {
  400. margin-right: 0;
  401. }
  402. .label {
  403. position: absolute;
  404. left: -2rpx;
  405. top: -18rpx;
  406. width: 118rpx;
  407. height: 40rpx;
  408. background: linear-gradient(270deg, #FAAD14 0%, #FF7D00 100%);
  409. border-radius: 16rpx 0 16rpx 0;
  410. color: #fff;
  411. font-size: 22rpx;
  412. text-align: center;
  413. line-height: 40rpx;
  414. }
  415. }
  416. .pic-box-color {
  417. background-color: #F5F5F5;
  418. color: #333;
  419. border: 1px solid #F5F5F5;
  420. }
  421. .pic-number {
  422. font-size: 24rpx;
  423. font-weight: 400;
  424. color: #999999;
  425. margin-top: 6rpx;
  426. }
  427. .pic-number-pic {
  428. font-size: 36rpx;
  429. font-weight: 500;
  430. width: 100%;
  431. text-align: center;
  432. .money {
  433. margin-left: 10rpx;
  434. }
  435. }
  436. .pic-box-money {
  437. height: 70rpx;
  438. font-size: 32rpx;
  439. text-align: center;
  440. font-weight: 500;
  441. line-height: 70rpx;
  442. }
  443. .placeholders {
  444. color: #333333;
  445. }
  446. .pic-box-color-active {
  447. background-color: var(--view-minorColorT) !important;
  448. color: var(--view-theme) !important;
  449. border: 1px solid var(--view-theme);
  450. .pic-number,
  451. .placeholders {
  452. color: var(--view-theme) !important;
  453. }
  454. }
  455. }
  456. .tips-box {
  457. margin-top: 48rpx;
  458. width: 100%;
  459. padding: 0 32rpx;
  460. box-sizing: border-box;
  461. .tips {
  462. font-size: 32rpx;
  463. color: #333333;
  464. font-weight: 600;
  465. margin-bottom: 24rpx;
  466. }
  467. .tips-samll {
  468. font-size: 24rpx;
  469. color: #999;
  470. margin-bottom: 20rpx;
  471. .drop {
  472. width: 10rpx;
  473. height: 10rpx;
  474. background-color: var(--view-theme);
  475. border-radius: 50%;
  476. margin-top: 12rpx;
  477. }
  478. .info {
  479. width: 620rpx;
  480. }
  481. }
  482. .tip-box {
  483. margin-top: 30rpx;
  484. }
  485. }
  486. .tips-title {
  487. margin-top: 32rpx;
  488. font-size: 26rpx;
  489. color: #333;
  490. }
  491. </style>