yjzye.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.money | getMoneyStyle }}</view>
  7. <text class="text">可转换消费积分</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">转换消费积分</view>
  13. <view class="row">
  14. <!-- <text class="tit">¥</text> -->
  15. <input class="input" type="number" v-model="withdrawal" placeholder="转换金额"
  16. placeholder-class="placeholder" />
  17. <view class="buttom" @click="withdrawal = userInfo.money*1">全部转换</view>
  18. <!-- <view class="buttom" @click="withdrawal = userInfo.dynamic_integral" v-if="type== 2">全部转账</view> -->
  19. </view>
  20. </view>
  21. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">转换</button>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getMoneyStyle
  27. } from '@/utils/rocessor.js';
  28. import {
  29. getUserInfo,
  30. } from '@/api/user.js';
  31. import {
  32. rechargeWechat
  33. } from '@/api/wallet.js'
  34. import {
  35. mapMutations,
  36. mapState
  37. } from 'vuex';
  38. export default {
  39. filters: {
  40. getMoneyStyle
  41. },
  42. data() {
  43. return {
  44. phone: '',
  45. money: '0.00', //可提现金额
  46. withdrawal: '', //提现金额
  47. password: '', //支付密码
  48. card: '', //转账卡号
  49. name: '',
  50. // #ifdef H5
  51. weichatBsrowser: false,
  52. // #endif
  53. loding: false,
  54. type: 0
  55. };
  56. },
  57. onLoad(options) {
  58. // #ifdef H5
  59. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  60. // #endif
  61. this.dataUp();
  62. if (options.type) {
  63. this.type = options.type;
  64. }
  65. },
  66. computed: {
  67. ...mapState('user', ['userInfo'])
  68. },
  69. methods: {
  70. ...mapMutations('user', ['setUserInfo', 'login']),
  71. // 更新数据
  72. dataUp() {
  73. let obj = this;
  74. getUserInfo({})
  75. .then(e => {
  76. obj.login();
  77. // 保存返回用户数据
  78. obj.setUserInfo(e.data);
  79. })
  80. .catch(e => {
  81. console.log(e);
  82. });
  83. },
  84. // 切换选中对象
  85. tabRadio(e) {
  86. this.type = e.detail.value;
  87. },
  88. // 提交
  89. confirm() {
  90. let obj = this;
  91. obj.loding = true;
  92. if (obj.withdrawal == 0) {
  93. obj.loding = false;
  94. uni.showModal({
  95. title: '提示',
  96. content: '转换金额不要为0'
  97. });
  98. return;
  99. }
  100. let data = {
  101. from: 'weixinh5', //
  102. price: obj.withdrawal, //金额
  103. type: 1 //0佣金1余额
  104. };
  105. rechargeWechat(data)
  106. .then(e => {
  107. // 允许按钮点击
  108. obj.loding = false;
  109. // 初始化提现金额
  110. obj.withdrawal = '';
  111. uni.showToast({
  112. title: '转换成功',
  113. duration: 2000,
  114. position: 'top'
  115. });
  116. obj.dataUp();
  117. })
  118. .catch(e => {
  119. obj.$api.msg(e.msg);
  120. obj.loding = false;
  121. console.log();
  122. });
  123. },
  124. }
  125. };
  126. </script>
  127. <style lang="scss">
  128. page {
  129. height: 100%;
  130. }
  131. .content-money {
  132. padding: 30rpx 0;
  133. background: #ffffff;
  134. }
  135. .item {
  136. padding: 0 $page-row-spacing;
  137. background-color: #ffffff;
  138. }
  139. .flex {
  140. background-color: #ffffff;
  141. text-align: center;
  142. margin: 0 30rpx;
  143. border-radius: $border-radius-sm;
  144. justify-content: center;
  145. .buttom {
  146. font-size: $font-lg;
  147. width: 50%;
  148. }
  149. .interval {
  150. width: 2px;
  151. height: 60rpx;
  152. background-color: #eeeeee;
  153. }
  154. .icon {
  155. background-size: 100%;
  156. font-size: 42rpx;
  157. color: $font-color-dark;
  158. font-weight: bold;
  159. background-repeat: no-repeat;
  160. background-position: center;
  161. }
  162. .text {
  163. color: $font-color-light;
  164. }
  165. }
  166. .row-box {
  167. margin-top: 30rpx;
  168. padding: 20rpx 30rpx;
  169. background: #fff;
  170. .title {
  171. font-size: $font-base + 2rpx;
  172. color: $font-color-dark;
  173. }
  174. .row {
  175. display: flex;
  176. align-items: center;
  177. position: relative;
  178. height: 80rpx;
  179. .tit {
  180. flex-shrink: 0;
  181. width: 40rpx;
  182. font-size: 30rpx;
  183. color: $font-color-dark;
  184. }
  185. .input {
  186. flex: 1;
  187. font-size: 30rpx;
  188. color: $font-color-dark;
  189. }
  190. .iconlocation {
  191. font-size: 36rpx;
  192. color: $font-color-light;
  193. }
  194. .buttom {
  195. color: #f21f5d;
  196. font-size: $font-base;
  197. }
  198. }
  199. }
  200. .add-btn {
  201. width: 520rpx;
  202. height: 80rpx;
  203. border-radius: 20rpx;
  204. margin: 140rpx auto 0;
  205. font-size: 36rpx;
  206. font-weight: bold;
  207. color: #fff;
  208. background: linear-gradient(90deg, #CA57DC, #65B2E9);
  209. }
  210. .back-btn {
  211. width: 520rpx;
  212. height: 80rpx;
  213. border-radius: 20rpx;
  214. margin: 40rpx auto;
  215. font-size: 36rpx;
  216. font-weight: bold;
  217. color: #303030;
  218. background-color: #F8DABA;
  219. }
  220. .name {
  221. background: #fff;
  222. padding: 30rpx;
  223. }
  224. .list {
  225. padding-left: 30rpx;
  226. margin-top: 30rpx;
  227. background-color: #ffffff;
  228. .box {
  229. display: flex;
  230. align-items: center;
  231. width: 100%;
  232. height: 120rpx;
  233. border-bottom: 1px solid $border-color-light;
  234. .icon {
  235. font-size: 48rpx;
  236. padding-right: 20rpx;
  237. .icon-img {
  238. height: 50rpx;
  239. width: 50rpx;
  240. }
  241. }
  242. .iconweixin1 {
  243. color: #18bf16;
  244. }
  245. .iconzhifubao {
  246. color: #08aaec;
  247. }
  248. .title-box {
  249. flex-grow: 1;
  250. text-align: left;
  251. .title {
  252. font-size: $font-base + 2rpx;
  253. color: $font-color-base;
  254. }
  255. .node {
  256. font-size: $font-sm;
  257. color: $font-color-light;
  258. }
  259. }
  260. }
  261. }
  262. .tip {
  263. padding: 20rpx;
  264. color: #ff0000;
  265. }
  266. /deep/ .uni-radio-input {
  267. width: 45rpx;
  268. height: 45rpx;
  269. }
  270. .psw-wrapper {
  271. width: 548rpx;
  272. height: 344rpx;
  273. background-color: #FFFFFF;
  274. border-radius: 15rpx 15rpx;
  275. .psw-title {
  276. width: 100%;
  277. font-size: 35rpx;
  278. padding: 43rpx 0 49rpx;
  279. text-align: center;
  280. font-weight: 800;
  281. }
  282. .psw-ipt {
  283. display: block;
  284. background-color: #dce3ed;
  285. height: 90rpx;
  286. width: 464rpx;
  287. padding-left: 30rpx;
  288. margin: 0 auto;
  289. font-size: 80rpx;
  290. }
  291. .psw-btn text {
  292. display: inline-block;
  293. text-align: center;
  294. width: 50%;
  295. padding-top: 29rpx;
  296. font-size: 35rpx;
  297. }
  298. .psw-qd {
  299. color: #5771DF;
  300. }
  301. }
  302. </style>