withdraw.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="withdraw">
  3. <div class="tabBankCard">
  4. <div class="left">提现到</div>
  5. <div class="right" @click="onJumpToBankSetting">
  6. <div class="word">{{
  7. bankInfo.card_number_format ? `银行卡尾号(${bankInfo.card_number_format})` : '设置银行卡'
  8. }}</div>
  9. <div class="iconRight"></div>
  10. </div>
  11. </div>
  12. <div class="setAmount">
  13. <div class="stitle">提现金额</div>
  14. <div class="amountArea">
  15. <div class="left">
  16. <div class="pre">¥</div>
  17. <input class="nums" v-model="vCoins" placeholder="最少提现10元,每日上限3万元" type="number" />
  18. </div>
  19. <div class="rightClose" @click="vCoins=''"></div>
  20. </div>
  21. <div class="line"></div>
  22. <div class="amountBottom">
  23. <div class="leftMoney">余额 <span>¥{{accountInfo.incomeTaxBalance || 0}}</span></div>
  24. <div class="rightBtn" @click="onSetAllMoney">全部提现</div>
  25. </div>
  26. </div>
  27. <div class="taxScheme">
  28. <div class="stitle">选择缴税方案</div>
  29. <div class="sdesc">已默认为您选择最低费率缴税方案</div>
  30. <div class="schemeList">
  31. <div class="cell" v-for="item in list" :key="item.id">
  32. <div class="leftChoose" :class="{ok: item.id === selectedId}" @click="changeSelected(item)"></div>
  33. <div class="rightContent">
  34. <div class="taxTop">
  35. <div class="topLeft">{{item.config_key}}</div>
  36. <div class="topRight" v-if="item.is_auto != 1">选则扣税方式即表示您同意
  37. <a :href="`/otherpage/proto/money?id=${item.id}`">《{{item.config_key}}服务协议》</a></div>
  38. <div class="topRight" v-else>
  39. <span @click="onJumpToUpload">{{!fpUrl ? '去上传电子发票' : '已上传电子发票'}}</span>
  40. </div>
  41. </div>
  42. <div class="taxContent">代缴综合费率{{item.kaifabao_rate}}%, 预计到账¥{{calcOkMoney(item)}}元</div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="submitBtn" @click="submitCommit">
  48. <p>确认提现</p>
  49. </div>
  50. <div class="wTips">
  51. 预计3-5个工作日到账
  52. </div>
  53. <div class="intro">
  54. <div class="stitle">提现说明</div>
  55. <div class="sdesc">1.自行提供发票,只支持上传电子发票</div>
  56. <div class="sdesc">2.请确认银行卡账号和实名认证信息保持一致,如需修改银 行卡账号,请前往 <a href="">设置银行卡信息</a></div>
  57. <div class="sdesc">3.提现成功后,会在3-5个工作日内到账,节假日可能会稍有 延时,请耐心等待,如长时间未到账( 超过5个工作日),可联系 <a href="">在线客服</a></div>
  58. </div>
  59. <div ref="testArea" class="testArea">
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. export default {
  65. name: "Withdraw",
  66. showCommonFooter: false,
  67. head() {
  68. let obj = {
  69. title: "领薪宝",
  70. meta: [{
  71. name: 'viewport',
  72. content: 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover'
  73. }]
  74. }
  75. return obj
  76. },
  77. async asyncData({ app }) {
  78. return {
  79. mobile: app.$deviceType.isMobile()
  80. }
  81. },
  82. data() {
  83. return {
  84. accountInfo: {},
  85. bankInfo: {},
  86. list: [],
  87. vCoins: '',
  88. fpUrl: '',
  89. selectedId: -1
  90. }
  91. },
  92. computed: {
  93. selectedItem() {
  94. return this.list.filter(v=>v.id === this.selectedId)[0] || {}
  95. }
  96. },
  97. watch: {
  98. vCoins: {
  99. immediate: true,
  100. handler(newVal) {
  101. this.vCoins = Math.min(newVal, 30000)
  102. this.vCoins = Math.floor(this.vCoins * 100) / 100
  103. }
  104. }
  105. },
  106. created() {
  107. const {vCoins='', fpUrl=''} = this.$route.query || {}
  108. this.vCoins = vCoins
  109. this.fpUrl = fpUrl
  110. this.getAccountBalanceInfo()
  111. this.getAccountBankAccountInfo()
  112. this.getWithdrawType()
  113. },
  114. mounted() {
  115. console.log("testArea", this.$refs.testArea)
  116. },
  117. methods: {
  118. calcOkMoney(item) {
  119. return Math.floor(this.vCoins * (100 - item.kaifabao_rate)) / 100
  120. },
  121. getWithdrawType() {
  122. this.$axios.post('/api/kaifabao/getBuckleConfigList').then(res => {
  123. if (Number(res.data.status) === 1) {
  124. let data = res.data.data
  125. this.list = data.list
  126. }
  127. }).catch(e => {
  128. console.log(e)
  129. })
  130. },
  131. getAccountBalanceInfo() {
  132. this.$axios.post('/api/account/getBalance').then(res => {
  133. if (Number(res.data.status) === 1) {
  134. let data = res.data.data
  135. this.accountInfo = data
  136. }
  137. }).catch(e => {
  138. console.log(e)
  139. })
  140. },
  141. getAccountBankAccountInfo() {
  142. this.$axios.post('/api/account/get_bank_account_info').then(res => {
  143. if (Number(res.data.status) === 1) {
  144. let data = res.data.data
  145. if (data.exist_info) {
  146. data.info.card_number_format = data.info.card_number.slice(-4)
  147. this.bankInfo = data.info
  148. console.log(data.info)
  149. }
  150. }
  151. }).catch(e => {
  152. console.log(e)
  153. })
  154. },
  155. onSetAllMoney() {
  156. this.vCoins = this.accountInfo.incomeTaxBalance
  157. },
  158. changeSelected(item) {
  159. const {id, is_auto} = item
  160. if (Number(is_auto) === 1 && !this.fpUrl) {
  161. this._toast('请先点击右侧,上传发票')
  162. return
  163. }
  164. this.selectedId = id
  165. },
  166. onJumpToUpload() {
  167. const {vCoins, fpUrl} = this
  168. location.href = `/otherpage/money/uploadInvoice?vCoins=${vCoins || ''}&fpUrl=${fpUrl || ''}`
  169. },
  170. onJumpToBankSetting() {
  171. location.href = 'proginn://edit_bankcard_info'
  172. },
  173. submitCommit() {
  174. const {is_auto, id} = this.selectedItem
  175. if (this.selectedId === -1) {
  176. this._toast('请选择缴税方案')
  177. return
  178. }
  179. if (!this.vCoins || this.vCoins < 10) {
  180. this._toast('提现金额不得低于10元')
  181. return
  182. }
  183. if (this.vCoins > 30000) {
  184. this._toast('单日提现总额度不得超过30000元')
  185. return
  186. }
  187. if (!this.bankInfo.card_number) {
  188. this._toast('请先完善银行卡信息')
  189. return
  190. }
  191. //自行提供发票
  192. if (Number(is_auto) === 1) {
  193. this.$axios.post('/api/kaifabao/addInvoiceWithdrawalApply', {
  194. coins: this.vCoins,
  195. invoice_url: this.fpUrl
  196. }).then(res=>{
  197. if (Number(res.data.status) === 1) {
  198. this._toast('提交成功')
  199. location.href = '/otherpage/money/'
  200. }
  201. })
  202. } else {
  203. this.$axios.post('/api/account/takeSalary', {
  204. coins: this.vCoins,
  205. payment_id: id
  206. }).then(res=>{
  207. if (Number(res.data.status) === 1) {
  208. this._toast('提交成功')
  209. location.href = '/otherpage/money/'
  210. }
  211. })
  212. }
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .testArea {
  219. width: 1vw;
  220. height: 1vh;
  221. }
  222. @import "../../../assets/css/otherpage/money/withdraw";
  223. </style>