apply_withdrawal.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="box">
  3. <div class="null-page" v-show="yes"></div>
  4. <el-card class="box-card">
  5. <div slot="header" class="clearfix">
  6. <el-breadcrumb separator="/">
  7. <el-breadcrumb-item :to="{ path: '/member/account' }">账户余额</el-breadcrumb-item>
  8. <el-breadcrumb-item>提现申请</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. </div>
  11. <div class="apply-withdrawal" v-loading="loading">
  12. <div class="apply-wrap">
  13. <div class="apply-account" v-if="bankAccountInfo.withdraw_type" @click="goAccount()">
  14. <span class="ns-width">提现到:</span>
  15. <div class="apply-account-info">
  16. <!-- <span v-if="bankAccountInfo.withdraw_type == 'wechatpay'">{{ bankAccountInfo.mobile }}</span> -->
  17. <span v-if="bankAccountInfo.withdraw_type == 'wechatpay'">暂不支持微信提现,请选择支付宝</span>
  18. <span v-else>{{ bankAccountInfo.bank_account }}</span>
  19. <el-image v-if="bankAccountInfo.withdraw_type == 'alipay'" :src="$img('public/uniapp/member/apply_withdrawal/alipay.png')" fit="contain"></el-image>
  20. <el-image v-else-if="bankAccountInfo.withdraw_type == 'bank'" :src="$img('public/uniapp/member/apply_withdrawal/bank.png')" fit="contain"></el-image>
  21. <!-- <el-image v-else-if="bankAccountInfo.withdraw_type == 'wechatpay'" :src="$img('public/uniapp/member/apply_withdrawal/wechatpay.png')" fit="contain"></el-image> -->
  22. <i class="iconfont iconarrow-right"></i>
  23. </div>
  24. </div>
  25. <div class="apply-account" v-else @click="goAccount()">
  26. <span class="ns-width">提现账户:</span>
  27. <div class="apply-account-info">
  28. <span class="ns-text-color">请选择提现账户</span>
  29. </div>
  30. </div>
  31. <div class="apply-account-money demo-input-suffix">
  32. <span class="ns-width">提现金额:</span>
  33. <el-input type="number" placeholder="0" v-model="withdrawMoney" :disabled="bankAccountInfo.withdraw_type == 'wechatpay'">
  34. <template slot="prepend">¥</template>
  35. </el-input>
  36. </div>
  37. <div class="apply-account-desc">
  38. <p><span class="ns-width"></span><span>可提现余额为</span><span class="balance">¥{{ withdrawInfo.member_info.balance_money | moneyFormat }}</span><span @click="allTx">全部提现</span></p>
  39. <p><span class="ns-width"></span>最小提现金额为¥{{ withdrawInfo.config.min | moneyFormat }},手续费为{{ withdrawInfo.config.rate + '%' }}</p>
  40. </div>
  41. <div class="apply-account-btn">
  42. <span class="ns-width"></span>
  43. <el-button type="primary" size="medium" @click="withdraw" :class="{ disabled: withdrawMoney == '' || withdrawMoney == 0 }" :disabled="bankAccountInfo.withdraw_type == 'wechatpay'">提现</el-button>
  44. <!-- <router-link to="/member/withdrawal">提现记录</router-link> -->
  45. </div>
  46. </div>
  47. </div>
  48. </el-card>
  49. </div>
  50. </template>
  51. <script>
  52. import { withdrawInfo, accountInfo, withdraw } from "@/api/member/account"
  53. export default {
  54. name: "apply_withdrawal",
  55. layout: "member",
  56. components: {},
  57. data: () => {
  58. return {
  59. withdrawInfo: {
  60. config: {
  61. is_use: 0,
  62. min: 1,
  63. rate: 0
  64. },
  65. member_info: {
  66. balance_money: 0,
  67. balance_withdraw: 0,
  68. balance_withdraw_apply: 0
  69. }
  70. },
  71. bankAccountInfo: {},
  72. withdrawMoney: '',
  73. isSub: false,
  74. loading: true,
  75. yes: true
  76. }
  77. },
  78. filters: {
  79. /**
  80. * 金额格式化输出
  81. * @param {Object} money
  82. */
  83. moneyFormat(money) {
  84. return parseFloat(money).toFixed(2);
  85. }
  86. },
  87. created() {
  88. this.getWithdrawInfo();
  89. this.getBankAccountInfo();
  90. },
  91. mounted() {
  92. let self = this;
  93. setTimeout(function() {
  94. self.yes = false
  95. }, 300)
  96. },
  97. methods: {
  98. /**
  99. * 获取提现信息
  100. */
  101. getWithdrawInfo() {
  102. withdrawInfo().then(res => {
  103. if (res.code >= 0 && res.data) {
  104. this.withdrawInfo = res.data;
  105. if (this.withdrawInfo.config.is_use == 0) {
  106. this.$router.push('/member');
  107. }
  108. }
  109. this.loading = false
  110. }).catch(err => {
  111. this.loading = false
  112. })
  113. },
  114. /**
  115. * 银行账号信息
  116. */
  117. getBankAccountInfo() {
  118. accountInfo().then(res => {
  119. if (res.code >= 0 && res.data) {
  120. this.bankAccountInfo = res.data;
  121. }
  122. }).catch(err => {})
  123. },
  124. /**
  125. * 全部提现
  126. */
  127. allTx() {
  128. this.withdrawMoney = this.withdrawInfo.member_info.balance_money;
  129. },
  130. /**
  131. * 账户列表
  132. */
  133. goAccount() {
  134. let back = "/member/apply_withdrawal"
  135. this.$router.push({path: "/member/account_list", query: {back: back}})
  136. },
  137. withdraw() {
  138. if (!this.bankAccountInfo.withdraw_type) {
  139. this.$message({
  140. message: "请先添加提现方式",
  141. type: "warning"
  142. })
  143. return;
  144. }
  145. if (this.withdrawMoney == '' || this.withdrawMoney == 0 || isNaN(parseFloat(this.withdrawMoney))) {
  146. this.$message({
  147. message: '请输入提现金额',
  148. type: "warning"
  149. });
  150. return false;
  151. }
  152. if (parseFloat(this.withdrawMoney) > parseFloat(this.withdrawInfo.member_info.balance_money)) {
  153. this.$message({
  154. message: '提现金额超出可提现金额',
  155. type: "warning"
  156. });
  157. return false;
  158. }
  159. if (parseFloat(this.withdrawMoney) < parseFloat(this.withdrawInfo.config.min)) {
  160. this.$message({
  161. message: '提现金额小于最低提现金额',
  162. type: "warning"
  163. });
  164. return false;
  165. }
  166. if (this.isSub) return;
  167. this.isSub = true;
  168. withdraw({
  169. apply_money: this.withdrawMoney,
  170. transfer_type: this.bankAccountInfo.withdraw_type, //转账提现类型
  171. realname: this.bankAccountInfo.realname,
  172. mobile: this.bankAccountInfo.mobile,
  173. bank_name: this.bankAccountInfo.branch_bank_name,
  174. account_number: this.bankAccountInfo.bank_account
  175. }).then(res => {
  176. if (res.code >= 0) {
  177. this.$message({
  178. message: '提现申请成功!',
  179. type: 'success',
  180. duration: 2000,
  181. onClose: () => {
  182. this.$router.push('/member/withdrawal');
  183. }
  184. });
  185. } else {
  186. this.isSub = false;
  187. this.$message({
  188. message: res.message,
  189. type: "warning"
  190. });
  191. }
  192. }).catch(err => {
  193. this.isSub = false;
  194. this.$message({
  195. message: err.message,
  196. type: "warning"
  197. });
  198. })
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .box {
  205. width: 100%;
  206. position: relative;
  207. }
  208. .null-page {
  209. width: 100%;
  210. height: 730px;
  211. background-color: #FFFFFF;
  212. position: absolute;
  213. top: 0;
  214. left: 0;
  215. z-index: 9;
  216. }
  217. .apply-withdrawal {
  218. width: 100%;
  219. background-color: #FFFFFF;
  220. .apply-wrap {
  221. display: inline-block;
  222. width: 500px;
  223. box-sizing: border-box;
  224. .apply-account {
  225. display: flex;
  226. align-items: center;
  227. cursor: pointer;
  228. .apply-account-info {
  229. display: flex;
  230. align-items: center;
  231. span {
  232. margin-right: 5px;
  233. }
  234. .el-image {
  235. width: 20px;
  236. height: 20px;
  237. margin-right: 10px;
  238. }
  239. }
  240. }
  241. .apply-account-money {
  242. display: flex;
  243. align-items: center;
  244. margin-top: 30px;
  245. span {
  246. flex-shrink: 0;
  247. }
  248. }
  249. .apply-account-desc {
  250. margin-top: 30px;
  251. text-align: left;
  252. p:first-child {
  253. span.balance {
  254. margin-right: 10px;
  255. }
  256. span:nth-child(4) {
  257. color: $base-color;
  258. cursor: pointer;
  259. }
  260. }
  261. p:nth-child(2) {
  262. color: #999999;
  263. }
  264. }
  265. .apply-account-btn {
  266. margin-top: 30px;
  267. .el-button {
  268. margin-right: 20px;
  269. }
  270. }
  271. }
  272. .ns-width {
  273. display: inline-block;
  274. width: 115px;
  275. text-align: right;
  276. }
  277. }
  278. </style>