withdrawalJF.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="buttom">
  5. <text class="text">可提现{{money_type}}</text>
  6. <view class="icon">
  7. {{ money }}
  8. </view>
  9. </view>
  10. <view class="interval"></view>
  11. <view class="buttom">
  12. <text class="text">申请提现{{money_type}}</text>
  13. <view class=" icon"><input class="input" type="number" v-model="withdrawal" placeholder="请输入提现金额" placeholder-class="placeholder" /></view>
  14. </view>
  15. <view class="interval"></view>
  16. <view class="buttom">
  17. <text class="text">支付密码</text>
  18. <view class=" icon"><input class="input" type="password" v-model="pwd" placeholder="请输入支付密码" placeholder-class="placeholder" /></view>
  19. </view>
  20. <view class="interval"></view>
  21. <view class="buttom" v-if="type == 'address'">
  22. <text class="text">提现地址</text>
  23. <view class=" icon"><input class="input" type="text" v-model="address" placeholder="请输入提现地址" placeholder-class="placeholder" /></view>
  24. </view>
  25. <view class="interval"></view>
  26. <view class="tip">
  27. <view class="tip-text" v-show="showText == false"></view>
  28. <view class="tip-text" v-show="showText == true">提先数量最低为{{ minPrice }},手续费为{{ data.service*1 }}{{ data._money_type }}</view>
  29. <view class=" tip-icon" @click="all()">全部提现</view>
  30. </view>
  31. </view>
  32. <!-- #ifndef MP-WEIXIN -->
  33. <view class="list">
  34. <radio-group @change="tabRadio">
  35. <!-- <label>
  36. <view class="box">
  37. <view class="icon iconfont iconweixin1"></view>
  38. <view class="title-box">
  39. <view class="title"><text>提现至微信</text></view>
  40. </view>
  41. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  42. </view>
  43. </label> -->
  44. <label>
  45. <view class="box">
  46. <view class="icon iconfont"><image class="icon-img" src="../../static/img/qianbao.png" mode=""></image></view>
  47. <view class="title-box">
  48. <view class="title">
  49. <text>提现至钱包</text>
  50. </view>
  51. </view>
  52. <view class="right"><radio value="address" color="#5dbc7c" :checked="type == 'address'" /></view>
  53. </view>
  54. </label>
  55. <label>
  56. <view class="box">
  57. <view class="icon iconfont iconzhifubao"></view>
  58. <view class="title-box">
  59. <view class="title">
  60. <text v-if="aliData.fullname != null">提现至支付宝</text>
  61. <text v-else>请创建支付宝账号</text>
  62. </view>
  63. <view class="node">
  64. <text v-if="aliData.fullname != null">真实姓名({{ aliData.fullname }})</text>
  65. </view>
  66. </view>
  67. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  68. </view>
  69. </label>
  70. <label>
  71. <view class="box">
  72. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  73. <view class="title-box">
  74. <view class="title">
  75. <text v-if="bankData.bankno != null">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  76. <text v-else>请创建银行账号</text>
  77. </view>
  78. <view class="node">
  79. <text v-if="bankData.fullname != null">真实姓名({{ bankData.fullname }})</text>
  80. </view>
  81. </view>
  82. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  83. </view>
  84. </label>
  85. </radio-group>
  86. </view>
  87. <!-- #endif -->
  88. <button class="add-btn up" @click="confirm">提交申请</button>
  89. <button class="add-btn modified" @click="navTo('/pages/collection/collection')">账号管理</button>
  90. </view>
  91. </template>
  92. <script>
  93. import { cashmoney_type, calculator, wallet, cash } from '@/api/finance.js';
  94. import { extractCash } from '@/api/wallet.js';
  95. import { mapState, mapMutations } from 'vuex';
  96. export default {
  97. data() {
  98. return {
  99. type: 'alipay', //提现方式
  100. moneyType:'',
  101. money: '', //可提现金额
  102. money_type:'',//提现单位
  103. withdrawal: '', //提现金额
  104. minPrice: '', //最少提现金额
  105. coldMoney: '', //冻结中的金额
  106. pwd:'',//交易密码
  107. data:'',
  108. address:'',//提币地址
  109. showText: false,
  110. aliData: { fullname: '', alino: '' },
  111. bankData: { fullname: '', bank: '', bankno: '' },
  112. // #ifdef H5
  113. weichatBsrowser: false
  114. // #endif
  115. };
  116. },
  117. computed: {
  118. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  119. },
  120. onLoad(option) {
  121. this.moneyType = option.type;
  122. },
  123. onShow() {
  124. // #ifdef H5
  125. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  126. // #endif
  127. //加载提现信息
  128. this.loadData();
  129. // 加载提款账号信息
  130. this.aliData.fullname = this.userInfo.alipay_name;
  131. console.log(this.aliData.fullname);
  132. this.aliData.alino = this.userInfo.alipay_code;
  133. this.bankData.fullname = this.userInfo.bank_user_name;
  134. this.bankData.bank = this.userInfo.bank_name;
  135. this.bankData.bankno = this.userInfo.bank_code;
  136. },
  137. watch: {
  138. withdrawal(newVal, oldVal) {
  139. this.calculator();
  140. }
  141. },
  142. methods: {
  143. // 加载余额信息
  144. async loadData() {
  145. wallet({}).then(({ data }) => {
  146. const obj = this
  147. const arr = Object.keys(data.back);
  148. console.log(arr);
  149. let ar = [];
  150. arr.forEach(e => {
  151. console.log(e,'11111')
  152. if(e == obj.moneyType){
  153. obj.money = data.back[e].money.money*1;
  154. obj.minPrice = data.back[e].less;
  155. obj.money_type = data.back[e].name;
  156. }
  157. });
  158. });
  159. },
  160. // 跳转
  161. navTo(url) {
  162. uni.navigateTo({
  163. url: url
  164. });
  165. },
  166. all() {
  167. this.withdrawal = this.money;
  168. },
  169. // 切换选中对象
  170. tabRadio(e) {
  171. this.type = e.detail.value;
  172. },
  173. calculator() {
  174. let obj = this;
  175. calculator({
  176. money_type: obj.moneyType,
  177. money: obj.withdrawal
  178. }).then(({ data }) => {
  179. console.log(data);
  180. obj.data = data;
  181. obj.showText = true;
  182. });
  183. },
  184. // 提交
  185. confirm() {
  186. const obj = this
  187. console.log(this.withdrawal);
  188. if (this.withdrawal === '') {
  189. this.$api.msg('请填写需要提现的金额');
  190. return;
  191. }
  192. if (this.withdrawal == 0) {
  193. this.$api.msg('提现金额不能为0');
  194. return;
  195. }
  196. if (this.withdrawal < this.minPrice) {
  197. this.$api.msg('提现金额不能低于最小金额');
  198. return;
  199. }
  200. if(this.type == 'address'){
  201. cash({
  202. money_type: obj.moneyType,
  203. money: obj.withdrawal,
  204. address: obj.address,
  205. password: obj.password
  206. }).then(data => {
  207. uni.navigateTo({
  208. url: '/pages/money/success?type=1'
  209. });
  210. });
  211. }else {
  212. let data = {
  213. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信 地址address
  214. password: this.pwd,
  215. money: this.withdrawal, //金额
  216. money_type: this.moneyType
  217. };
  218. if (this.type == 'alipay') {
  219. data.name = this.aliData.fullname;
  220. data.alipay_code = this.aliData.alino;
  221. }
  222. if (this.type == 'bank') {
  223. data.name = this.bankData.fullname;
  224. data.bankname = this.bankData.bank;
  225. data.cardnum = this.bankData.bankno;
  226. }
  227. extractCash(data)
  228. .then(e => {
  229. uni.navigateTo({
  230. url: '/pages/money/success?type=1'
  231. });
  232. // uni.showToast({
  233. // title: '提交成功',
  234. // duration: 2000,
  235. // position: 'top'
  236. // });
  237. })
  238. .catch(e => {
  239. console.log();
  240. });
  241. }
  242. }
  243. }
  244. };
  245. </script>
  246. <style lang="scss">
  247. page {
  248. height: 100%;
  249. }
  250. .content-money {
  251. padding: 0 20rpx;
  252. background-color: #ffffff;
  253. .buttom {
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. height: 110rpx;
  258. }
  259. .interval {
  260. width: 100%;
  261. height: 1px;
  262. background: #e6e6e6;
  263. }
  264. .icon {
  265. font-size: 48rpx;
  266. font-family: SourceHanSansCN;
  267. font-weight: 500;
  268. color: #333333;
  269. .input {
  270. text-align: right;
  271. flex: 1;
  272. font-size: 30rpx;
  273. color: $font-color-dark;
  274. }
  275. .iconlocation {
  276. text-align: right;
  277. font-size: 36rpx;
  278. color: $font-color-light;
  279. }
  280. }
  281. .text {
  282. font-size: 32rpx;
  283. font-family: PingFang SC;
  284. font-weight: 500;
  285. color: #333333;
  286. }
  287. .tip {
  288. height: 74rpx;
  289. display: flex;
  290. justify-content: space-between;
  291. align-items: center;
  292. .tip-text {
  293. font-size: 24rpx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #999999;
  297. }
  298. .tip-icon {
  299. font-size: 26rpx;
  300. font-family: SourceHanSansCN;
  301. font-weight: 400;
  302. color: #438bed;
  303. }
  304. }
  305. }
  306. .add-btn {
  307. &.modified {
  308. color: $base-color;
  309. }
  310. &.up {
  311. background-color: $base-color;
  312. color: #fff;
  313. }
  314. display: flex;
  315. align-items: center;
  316. justify-content: center;
  317. width: 690rpx;
  318. height: 80rpx;
  319. margin: 0 auto;
  320. margin-top: 30rpx;
  321. font-size: $font-lg;
  322. border-radius: 10rpx;
  323. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  324. }
  325. .list {
  326. padding-left: 30rpx;
  327. margin-top: 30rpx;
  328. background-color: #ffffff;
  329. .box {
  330. display: flex;
  331. align-items: center;
  332. width: 100%;
  333. height: 120rpx;
  334. border-bottom: 1px solid $border-color-light;
  335. .icon {
  336. font-size: 48rpx;
  337. padding-right: 20rpx;
  338. .icon-img {
  339. height: 50rpx;
  340. width: 50rpx;
  341. }
  342. }
  343. .iconweixin1 {
  344. color: #18bf16;
  345. }
  346. .iconzhifubao {
  347. color: #08aaec;
  348. }
  349. .title-box {
  350. flex-grow: 1;
  351. text-align: left;
  352. .title {
  353. font-size: $font-base + 2rpx;
  354. color: $font-color-base;
  355. }
  356. .node {
  357. font-size: $font-sm;
  358. color: $font-color-light;
  359. }
  360. }
  361. }
  362. }
  363. /deep/ .uni-radio-input {
  364. width: 45rpx;
  365. height: 45rpx;
  366. }
  367. </style>