withdrawalJF.vue 8.2 KB

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