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.

333 lines
7.3 KiB

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