You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

309 lines
6.8 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <!-- 提现页面 -->
  2. <template>
  3. <view class="withdraw bx">
  4. <navbar :leftClick="leftClick" :title="$t('page.withdraw.title')"></navbar>
  5. <!-- 用户余额信息 -->
  6. <view class="user-money content">
  7. <view class="title">{{ $t('page.purse.account') }}</view>
  8. <view class="money">
  9. <view class="money-unit">{{ $t('page.withdraw.unit') }}</view>
  10. <view class="money-detail">{{ money }}</view>
  11. </view>
  12. </view>
  13. <view class="withdraw-amount content">
  14. <view class="withdraw-title">{{ $t('page.withdraw.withdraw-amount')}}</view>
  15. <view class="withdraw-content">{{ $t('page.withdraw.withdraw-descript')}}</view>
  16. </view>
  17. <!-- 输入框组 -->
  18. <view class="inputs content">
  19. <view class="input-item">
  20. <view class="input-top">
  21. <view class="title">{{ $t('page.withdraw.withdraw-amount') }}</view>
  22. <view @click="withdrawAll" class="all">{{ $t('page.withdraw.withdrawal-all') }}</view>
  23. </view>
  24. <input v-model="form.money" type="number" :placeholder="$t('page.withdraw.deposit-now')"/>
  25. </view>
  26. <view class="input-item">
  27. <view class="input-top">
  28. <view class="title">{{ $t('page.withdraw.pin') }}</view>
  29. </view>
  30. <input v-model="form.payPass" type="text"/>
  31. </view>
  32. </view>
  33. <!-- 提交按钮 -->
  34. <view @click="withdraw" class="submit content">{{ $t('page.withdraw.submit') }}</view>
  35. <!-- 超出最大提现金额提示 -->
  36. <view v-if="showModal" class="modal">
  37. <view class="modal-main">
  38. <view class="title">{{ $t('page.withdraw.warn') }}</view>
  39. <view class="tip">{{ $t('page.withdraw.warn-detail') }}</view>
  40. <view @click="showModal = false;$play()" class="ok">{{ $t('page.withdraw.ok') }}</view>
  41. </view>
  42. </view>
  43. <!-- 客服列表 -->
  44. <serviceList :show="showService" :serverList="serverList" @close="closeServiceList"></serviceList>
  45. </view>
  46. </template>
  47. <script>
  48. import navbar from '@/components/base/m-navbar.vue'
  49. import serviceList from '@/components/serviceList/serviceList.vue';
  50. export default {
  51. components: {
  52. navbar
  53. },
  54. data() {
  55. return {
  56. money : '',
  57. form : {
  58. money : '', //提现金额
  59. payPass : ''
  60. },
  61. vipInfo : {},
  62. showModal : false, //是否显示超出最大提现金额提示
  63. serverList : [],
  64. showService : false
  65. }
  66. },
  67. onShow() {
  68. this.getUserInfo()
  69. this.forgetPass()
  70. },
  71. methods: {
  72. leftClick() {
  73. uni.navigateTo({
  74. url: '/pages/home/home'
  75. })
  76. },
  77. //获取用户信息
  78. getUserInfo(){
  79. this.request('userInfo').then(res => {
  80. if(res.code == 200){
  81. this.money = res.result.userInfo.money
  82. this.vipInfo = res.result.vip
  83. }
  84. })
  85. },
  86. //点击提现全部按钮
  87. withdrawAll(){
  88. this.$play()
  89. if(!this.money){
  90. return uni.$u.toast(this.$t('page.withdraw.noBalance'))
  91. }
  92. this.form.money = this.money
  93. },
  94. //提现
  95. withdraw(){
  96. this.$play()
  97. let { money , payPass } = this.form;
  98. if(money <= 0){
  99. return uni.$u.toast(this.$t('page.withdraw.creditLimit'))
  100. }
  101. // if(money > this.vipInfo.maxPrice){ //提现金额大于当前vip等级最大提现金额(后端给了提示,使用toast展示去了)
  102. // return this.showModal = true
  103. // }
  104. if(money > this.money){ //用户提现金额大于用户余额
  105. return uni.$u.toast(this.$t('page.withdraw.insufficientBalance'))
  106. }
  107. if(payPass.trim() == ''){
  108. return uni.$u.toast(this.$t('page.withdraw.payPassEmpty'))
  109. }
  110. this.request('withdrawal',{},this.form).then(res => {
  111. if(res.code == 200){
  112. uni.$u.toast(this.$t('page.withdraw.successfulWithdrawal'))
  113. this.cleanForm()
  114. this.revealServiceList()
  115. this.getUserInfo() //刷新用户信息(更新用户余额)
  116. }
  117. })
  118. },
  119. //显示客服列表
  120. revealServiceList(){
  121. this.$play()
  122. this.showService = true;
  123. },
  124. //关闭客服列表
  125. closeServiceList(){
  126. this.showService = false;
  127. },
  128. //忘记密码(获取客服列表)
  129. forgetPass(){
  130. this.request('forgetPass').then(res => {
  131. if(res.code == 200){
  132. this.serverList = res.result
  133. }
  134. })
  135. },
  136. //清空表单数据
  137. cleanForm(){
  138. this.form = {}
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .withdraw {
  145. width: 750rpx;
  146. min-height: 100vh;
  147. // background-color: black;
  148. margin: 0 auto;
  149. // background-image: url('@/static/withdraw/bg.png');
  150. background-size: 100%;
  151. background-repeat: no-repeat;
  152. .content {
  153. width: 96%;
  154. margin: 0 auto;
  155. }
  156. .user-money {
  157. background: $uni-bg-color-app;
  158. color: $uni-text-color-inverse;
  159. margin: 20rpx auto 30rpx auto;
  160. // border: 4rpx solid #D3EA5E;
  161. padding: 60rpx 0rpx;
  162. font-size: 36rpx;
  163. .title,
  164. .money {
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. height: 60rpx;
  169. .money-unit {
  170. margin-right: 15rpx;
  171. font-size: 28rpx;
  172. font-weight: bold;
  173. }
  174. .money-detail{
  175. font-size: 50rpx;
  176. font-weight: bold;
  177. }
  178. }
  179. }
  180. .withdraw-amount{
  181. color: $uni-text-color;
  182. .withdraw-title{
  183. font-size: 28rpx;
  184. font-weight: bold;
  185. margin-bottom: 20rpx;
  186. }
  187. .withdraw-content{
  188. color: white;
  189. font-size: 24rpx;
  190. }
  191. }
  192. .inputs{
  193. .input-item{
  194. margin-top: 35rpx;
  195. .input-top{
  196. display: flex;
  197. justify-content: space-between;
  198. .title{
  199. font-size: 28rpx;
  200. font-weight: bold;
  201. color: $uni-text-color;
  202. }
  203. .all{
  204. background: $uni-bg-color-app;
  205. padding: 5rpx 10rpx;
  206. border-radius: 10rpx;
  207. font-size: 20rpx;
  208. color: $uni-text-color-inverse;
  209. }
  210. }
  211. input{
  212. border: 1px solid $uni-bg-color-app;
  213. height: 80rpx;
  214. margin-top: 20rpx;
  215. text-indent: 1em;
  216. border-radius: 10rpx;
  217. }
  218. }
  219. }
  220. .submit{
  221. height: 90rpx;
  222. display: flex;
  223. align-items: center;
  224. justify-content: center;
  225. background: $uni-bg-color-app;
  226. border-radius: 10rpx;
  227. font-size: 40rpx;
  228. font-weight: bold;
  229. margin-top: 30rpx;
  230. color: $uni-text-color-inverse;
  231. }
  232. .modal{
  233. display: flex;
  234. align-items: center;
  235. justify-content: center;
  236. position: fixed;
  237. left: 0;
  238. top: 0;
  239. width: 750rpx;
  240. height: 100vh;
  241. .modal-main{
  242. width: 600rpx;
  243. background: black;
  244. border-radius: 10rpx;
  245. color: #ccc;
  246. border: 1px solid #ccc;
  247. .title{
  248. text-align: center;
  249. font-size: 36rpx;
  250. color: #afc638;
  251. font-weight: bold;
  252. padding: 20rpx 0rpx;
  253. }
  254. .tip{
  255. box-sizing: border-box;
  256. padding: 0rpx 20rpx;
  257. margin-bottom: 20rpx;
  258. }
  259. .ok{
  260. height: 90rpx;
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. background: black;
  265. border-radius: 10rpx;
  266. font-size: 40rpx;
  267. font-weight: bold;
  268. border-top: 1px solid #ffffff80;
  269. }
  270. }
  271. }
  272. }
  273. </style>