withdmoenys.vue 5.5 KB

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