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.

291 lines
6.1 KiB

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