redTarget.vue 10 KB

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