withdrawal.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="buttom">
  5. <text class="text">可提现金额</text>
  6. <view class="icon"><text>¥</text>{{ money }}</view>
  7. </view>
  8. <view class="interval"></view>
  9. <view class="buttom">
  10. <text class="text">申请提现金额</text>
  11. <view class=" icon"><input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" /></view>
  12. </view>
  13. <view class="interval"></view>
  14. <view class="tip">
  15. <text class="tip-text">申请提现金额</text>
  16. <view class=" tip-icon" @click="all()">全部提现</view>
  17. </view>
  18. </view>
  19. <!-- #ifndef MP-WEIXIN -->
  20. <view class="list" v-if="!weichatBsrowser">
  21. <radio-group @change="tabRadio">
  22. <label>
  23. <view class="box">
  24. <view class="icon iconfont iconweixin1"></view>
  25. <view class="title-box">
  26. <view class="title"><text>提现至微信</text></view>
  27. </view>
  28. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  29. </view>
  30. </label>
  31. <label>
  32. <view class="box">
  33. <view class="icon iconfont iconzhifubao"></view>
  34. <view class="title-box">
  35. <view class="title">
  36. <text v-if="aliData.fullname">提现至支付宝</text>
  37. <text v-else>请创建支付宝账号</text>
  38. </view>
  39. <view class="node">
  40. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  41. </view>
  42. </view>
  43. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  44. </view>
  45. </label>
  46. <label>
  47. <view class="box">
  48. <view class="icon iconfont"><image class="icon-img" src="../../static/icon/i8.png" mode="aspectFit"></image></view>
  49. <view class="title-box">
  50. <view class="title">
  51. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  52. <text v-else>请创建银行账号</text>
  53. </view>
  54. <view class="node">
  55. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  56. </view>
  57. </view>
  58. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  59. </view>
  60. </label>
  61. </radio-group>
  62. </view>
  63. <!-- #endif -->
  64. <button class="add-btn up" @click="confirm">提交申请</button>
  65. <button class="add-btn modified" v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button>
  66. </view>
  67. </template>
  68. <script>
  69. import { getMoneyStyle } from '@/utils/rocessor.js';
  70. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  71. export default {
  72. data() {
  73. return {
  74. type: 'weixin', //提现方式
  75. money: 10, //可提现金额
  76. withdrawal: '', //提现金额
  77. minPrice: '', //最少提现金额
  78. aliData: {},
  79. bankData: {},
  80. // #ifdef H5
  81. weichatBsrowser: false
  82. // #endif
  83. };
  84. },
  85. onLoad(options) {
  86. // #ifdef H5
  87. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  88. // #endif
  89. //加载提现信息
  90. this.loadData();
  91. // 加载提款账号信息
  92. this.loadAli();
  93. this.loadBank();
  94. },
  95. methods: {
  96. // 更新数据
  97. dataUp() {
  98. this.loadAli();
  99. this.loadBank();
  100. },
  101. //加载数据
  102. async loadAli(source) {
  103. aliInfo({}).then(e => {
  104. this.aliData = e.data;
  105. });
  106. },
  107. // 加载银行卡信息
  108. async loadBank() {
  109. bankInfo({}).then(e => {
  110. this.bankData = e.data;
  111. });
  112. },
  113. // 加载余额信息
  114. async loadData() {
  115. extractBank({}).then(({ data }) => {
  116. // this.money = data.moneyCount; //可提现余额
  117. this.minPrice = data.minPrice; //最小提现
  118. this.freeze = data.inmoneyCount; //提现中的余额
  119. });
  120. },
  121. // 跳转
  122. navTo(url) {
  123. uni.navigateTo({
  124. url: url
  125. });
  126. },
  127. all(){
  128. this.withdrawal = this.money
  129. },
  130. // 切换选中对象
  131. tabRadio(e) {
  132. this.type = e.detail.value;
  133. },
  134. // 提交
  135. confirm() {
  136. let data = {
  137. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  138. money: this.withdrawal, //金额
  139. money_type: 1 //0佣金1余额
  140. };
  141. if (this.type == 'alipay') {
  142. data.name = this.aliData.fullname;
  143. data.alipay_code = this.aliData.alino;
  144. }
  145. if (this.type == 'bank') {
  146. data.name = this.bankData.fullname;
  147. data.bankname = this.bankData.bank;
  148. data.cardnum = this.bankData.bankno;
  149. }
  150. extractCash(data)
  151. .then(e => {
  152. uni.showToast({
  153. title: '提交成功',
  154. duration: 2000,
  155. position: 'top'
  156. });
  157. })
  158. .catch(e => {
  159. console.log();
  160. });
  161. }
  162. }
  163. };
  164. </script>
  165. <style lang="scss">
  166. page {
  167. height: 100%;
  168. }
  169. .content-money {
  170. padding: 0 20rpx;
  171. background-color: #ffffff;
  172. .buttom {
  173. display: flex;
  174. justify-content: space-between;
  175. align-items: center;
  176. height: 110rpx;
  177. }
  178. .interval {
  179. width: 100%;
  180. height: 1px;
  181. background: #E6E6E6;
  182. }
  183. .icon {
  184. font-size: 48rpx;
  185. font-family: SourceHanSansCN;
  186. font-weight: 500;
  187. color: #333333;
  188. text{
  189. font-size: 32rpx;
  190. }
  191. .input {
  192. text-align: right;
  193. flex: 1;
  194. font-size: 30rpx;
  195. color: $font-color-dark;
  196. }
  197. .iconlocation {
  198. text-align: right;
  199. font-size: 36rpx;
  200. color: $font-color-light;
  201. }
  202. }
  203. .text {
  204. font-size: 32rpx;
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. color: #333333;
  208. }
  209. .tip {
  210. height: 74rpx;
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. .tip-text {
  215. font-size: 24rpx;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. color: #999999;
  219. }
  220. .tip-icon {
  221. font-size: 26rpx;
  222. font-family: SourceHanSansCN;
  223. font-weight: 400;
  224. color: #438BED;
  225. }
  226. }
  227. }
  228. .add-btn {
  229. &.modified {
  230. color: $base-color;
  231. }
  232. &.up {
  233. background-color: $base-color;
  234. color: #fff;
  235. }
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. width: 690rpx;
  240. height: 80rpx;
  241. margin: 0 auto;
  242. margin-top: 30rpx;
  243. font-size: $font-lg;
  244. border-radius: 10rpx;
  245. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  246. }
  247. .list {
  248. padding-left: 30rpx;
  249. margin-top: 30rpx;
  250. background-color: #ffffff;
  251. .box {
  252. display: flex;
  253. align-items: center;
  254. width: 100%;
  255. height: 120rpx;
  256. border-bottom: 1px solid $border-color-light;
  257. .icon {
  258. font-size: 48rpx;
  259. padding-right: 20rpx;
  260. .icon-img {
  261. height: 50rpx;
  262. width: 50rpx;
  263. }
  264. }
  265. .iconweixin1 {
  266. color: #18bf16;
  267. }
  268. .iconzhifubao {
  269. color: #08aaec;
  270. }
  271. .title-box {
  272. flex-grow: 1;
  273. text-align: left;
  274. .title {
  275. font-size: $font-base + 2rpx;
  276. color: $font-color-base;
  277. }
  278. .node {
  279. font-size: $font-sm;
  280. color: $font-color-light;
  281. }
  282. }
  283. }
  284. }
  285. /deep/ .uni-radio-input {
  286. width: 45rpx;
  287. height: 45rpx;
  288. }
  289. </style>