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.

294 lines
6.2 KiB

8 months ago
  1. <template>
  2. <view class="withdraw">
  3. <mNavbar title="钱包提现" :leftClick="leftClick" />
  4. <view class="banner" />
  5. <view class="b-relative center font-m">
  6. <image src="/static/ms/w.png" />
  7. <view class="title" style="position: absolute; top: 40rpx; left: 40rpx">
  8. <view style="line-height: 40rpx; font-size: 28rpx">账号余额</view>
  9. <view style="line-height: 60rpx; font-size: 40rpx">{{ userInfo.price }}</view>
  10. </view>
  11. </view>
  12. <view class="from-body">
  13. <view>我要提现</view>
  14. <view class="money">
  15. <van-cell-group inset>
  16. <van-field type="number" v-model="form.price" placeholder="请输入提现金额"
  17. style="background-color: #F5F5F5; margin: 10rpx 0px; border-radius: 20px;" />
  18. <van-field v-model="form.bank" placeholder="请输入开户行"
  19. style="background-color: #F5F5F5; margin: 10rpx 0px; border-radius: 20px;" />
  20. <van-field v-model="form.card" placeholder="请输入卡号"
  21. style="background-color: #F5F5F5; margin: 10rpx 0px; border-radius: 20px;" />
  22. </van-cell-group>
  23. </view>
  24. <view v-html="withdrawalStatement" class="withdrawal-statement"></view>
  25. </view>
  26. <view class="recharge">
  27. <view @click="withdraw" class="btn">
  28. 立即提现
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import mNavbar from '@/components/base/m-navbar.vue'
  35. export default {
  36. components: {
  37. mNavbar
  38. },
  39. data() {
  40. return {
  41. withdrawalStatement: '', //充值说明
  42. form : {
  43. type: 1,
  44. price: undefined,
  45. bank: '',
  46. card: ''
  47. },
  48. userInfo: {},
  49. }
  50. },
  51. onShow() {
  52. this.getConfig()
  53. this.getUserInfo()
  54. this.getTenRealName()
  55. },
  56. methods: {
  57. leftClick() { //返回分销代理
  58. uni.navigateTo({
  59. url: '/pages/mine/distribution'
  60. })
  61. },
  62. getConfig() { //获取配置信息
  63. this.$api('getConfig', {}, res => {
  64. if (res.code == 200) {
  65. res.result.forEach(item => {
  66. if (item.keyValue === 'withdraw') {
  67. this.withdrawalStatement = item.content
  68. }
  69. })
  70. }
  71. })
  72. },
  73. withdraw() { //立即提现
  74. let isOk = this.parameterVerification();
  75. if(isOk && !isOk.auth){
  76. return uni.showToast({
  77. title : isOk.title,
  78. icon : 'none'
  79. })
  80. }
  81. this.$api('recharge', this.form, res => {
  82. if (res.code == 200) {
  83. uni.showToast({
  84. title: '提现成功',
  85. icon: 'none'
  86. })
  87. this.getUserInfo()
  88. }
  89. })
  90. },
  91. getUserInfo() { //获取用户信息
  92. this.$api('getUserInfo', {}, res => {
  93. if (res.code == 200) {
  94. this.userInfo = res.result;
  95. }
  96. })
  97. },
  98. getTenRealName(){ //获取技师实名认证
  99. this.$api('getTenRealName', {}, res => {
  100. if (res.code == 200) {
  101. let result = res.result;
  102. if(result && result.bank && result.card){
  103. this.form.bank = result.bank
  104. this.form.card = result.card
  105. }
  106. }
  107. })
  108. },
  109. parameterVerification(){ //验证用户参数合法性
  110. let { price , bank , card } = this.form
  111. if(!price){
  112. return { title : '请填写提现金额' , auth : false }
  113. }else if(price <= 0){
  114. return { title : '提现金额必须大于0' , auth : false }
  115. }else if(price > this.userInfo.price){
  116. return { title : '提现金额大于余额' , auth : false }
  117. }else if(bank.trim() == ''){
  118. return { title : '请填写开户行' , auth : false }
  119. }else if(card.trim() == ''){
  120. return { title : '请填写卡号' , auth : false }
  121. }
  122. return { title : '验证通过' , auth : true }
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .withdraw {
  129. .content {
  130. padding-bottom: 60px;
  131. }
  132. body {
  133. background-color: #fff;
  134. }
  135. .banner {
  136. width: 100vw;
  137. height: 256rpx;
  138. background: #cfece7;
  139. }
  140. .center {
  141. width: 710rpx;
  142. height: 316rpx;
  143. margin: -204rpx auto 0;
  144. }
  145. .center image {
  146. width: 710rpx;
  147. height: 316rpx;
  148. border-radius: 12rpx;
  149. }
  150. .font-m {
  151. font-family: PingFang SC, PingFang SC-Bold;
  152. font-weight: 700;
  153. text-align: left;
  154. color: #ffffff;
  155. text-shadow: 0 4rpx 6rpx 0 rgba(40, 170, 133, 0.81);
  156. }
  157. .item-line input {
  158. width: 456rpx;
  159. height: 60rpx;
  160. line-height: 60rpx;
  161. background: #f5f5f5;
  162. border-radius: 12rpx;
  163. font-size: 24rpx;
  164. font-family: PingFang SC, PingFang SC-Medium;
  165. font-weight: 500;
  166. text-align: left;
  167. color: #939393;
  168. padding: 0 20rpx;
  169. }
  170. .from-body {
  171. padding: 40rpx 20rpx;
  172. font-size: 28rpx;
  173. text-align: left;
  174. color: #333333;
  175. }
  176. .top-label {
  177. position: relative;
  178. width: 96%;
  179. margin-left: 2%;
  180. height: 200rpx;
  181. background-image: url(/static/ms/cz.png);
  182. background-repeat: no-repeat;
  183. background-size: 100% 100%;
  184. overflow: hidden;
  185. border-radius: 10px;
  186. margin-top: 20rpx;
  187. }
  188. .top-label-box {
  189. position: relative;
  190. height: 100%;
  191. padding-left: 35rpx;
  192. box-sizing: border-box;
  193. }
  194. .top-label-box .activeLabel {
  195. position: absolute;
  196. left: 0;
  197. top: 0;
  198. width: 100%;
  199. height: 100%;
  200. background: url('../../static/ms/select.png');
  201. background-repeat: no-repeat;
  202. background-size: 100% 100%;
  203. }
  204. .top-label-box-one {
  205. display: flex;
  206. align-items: center;
  207. }
  208. .top-label-box-two {
  209. margin-left: 18rpx;
  210. font-size: 12px;
  211. padding: 6rpx 8rpx;
  212. background-color: #EBCB85;
  213. border-bottom-left-radius: 10px;
  214. border-top-right-radius: 10px;
  215. }
  216. .top-label-box-tag {
  217. position: absolute;
  218. border: 1px solid;
  219. font-size: 12px;
  220. padding: 6rpx 10rpx;
  221. color: #fff;
  222. background-color: #24CC80;
  223. top: -1px;
  224. right: 0px;
  225. border-bottom-left-radius: 10px;
  226. }
  227. .money {
  228. margin: 20rpx 0rpx;
  229. }
  230. .money .van-cell-group--inset {
  231. margin: 0;
  232. }
  233. .money .van-field {
  234. padding: auto 0rpx;
  235. margin-bottom: 30rpx !important;
  236. }
  237. .recharge {
  238. position: fixed;
  239. display: flex;
  240. justify-content: center;
  241. align-items: center;
  242. left: 0;
  243. bottom: 0;
  244. width: 750rpx;
  245. height: 100rpx;
  246. background: white;
  247. }
  248. .recharge .btn {
  249. width: 85%;
  250. height: 80rpx;
  251. border-radius: 40rpx;
  252. color: white;
  253. text-align: center;
  254. line-height: 80rpx;
  255. font-size: 28rpx;
  256. background: linear-gradient(180deg, #6FDFBE, #5AC796);
  257. }
  258. @media all and (min-width: 961px) {
  259. .recharge {
  260. left: 50% !important;
  261. transform: translateX(-50%);
  262. }
  263. }
  264. }
  265. </style>