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.

307 lines
6.6 KiB

8 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: rgba(176, 199, 59, .8);
  158. margin: 20rpx auto 30rpx auto;
  159. border: 4rpx solid #D3EA5E;
  160. padding: 60rpx 0rpx;
  161. font-size: 36rpx;
  162. .title,
  163. .money {
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. height: 60rpx;
  168. .money-unit {
  169. margin-right: 15rpx;
  170. font-size: 28rpx;
  171. font-weight: bold;
  172. }
  173. .money-detail{
  174. font-size: 50rpx;
  175. font-weight: bold;
  176. }
  177. }
  178. }
  179. .withdraw-amount{
  180. color: #D3EA5E;
  181. .withdraw-title{
  182. font-size: 28rpx;
  183. font-weight: bold;
  184. margin-bottom: 20rpx;
  185. }
  186. .withdraw-content{
  187. color: white;
  188. font-size: 24rpx;
  189. }
  190. }
  191. .inputs{
  192. .input-item{
  193. margin-top: 35rpx;
  194. .input-top{
  195. display: flex;
  196. justify-content: space-between;
  197. .title{
  198. font-size: 28rpx;
  199. font-weight: bold;
  200. color: #D3EA5E;
  201. }
  202. .all{
  203. background: #D3EA5E;
  204. padding: 5rpx 10rpx;
  205. border-radius: 10rpx;
  206. font-size: 20rpx;
  207. }
  208. }
  209. input{
  210. border: 1px solid #B0C73B;
  211. height: 80rpx;
  212. margin-top: 20rpx;
  213. text-indent: 1em;
  214. color: #B0C73B;
  215. border-radius: 10rpx;
  216. }
  217. }
  218. }
  219. .submit{
  220. height: 90rpx;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. background: #B0C73B;
  225. border-radius: 10rpx;
  226. font-size: 40rpx;
  227. font-weight: bold;
  228. margin-top: 30rpx;
  229. }
  230. .modal{
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. position: fixed;
  235. left: 0;
  236. top: 0;
  237. width: 750rpx;
  238. height: 100vh;
  239. .modal-main{
  240. width: 600rpx;
  241. background: black;
  242. border-radius: 10rpx;
  243. color: #ccc;
  244. border: 1px solid #ccc;
  245. .title{
  246. text-align: center;
  247. font-size: 36rpx;
  248. color: #afc638;
  249. font-weight: bold;
  250. padding: 20rpx 0rpx;
  251. }
  252. .tip{
  253. box-sizing: border-box;
  254. padding: 0rpx 20rpx;
  255. margin-bottom: 20rpx;
  256. }
  257. .ok{
  258. height: 90rpx;
  259. display: flex;
  260. align-items: center;
  261. justify-content: center;
  262. background: black;
  263. border-radius: 10rpx;
  264. font-size: 40rpx;
  265. font-weight: bold;
  266. border-top: 1px solid #ffffff80;
  267. }
  268. }
  269. }
  270. }
  271. </style>