withdraw.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="margin-30">
  3. <navigator v-if="$isEmpty(bank)" url="/pages/userBank/add" class="card_add" hover-class="none">
  4. <view class="margin-bottom-10">
  5. <u-icon name="plus-circle-fill" color="#F5A85B" size="70"></u-icon>
  6. </view>
  7. <view class="" style="color: #666666;">
  8. 添加银行卡
  9. </view>
  10. </navigator>
  11. <navigator :url="'select-bank?id='+bank.id" class="bank" v-else hover-class="none">
  12. <view class="left center">
  13. <image :src="bank.bankType?'/static/bank/'+bank.bankType+'.png':''" mode=""></image>
  14. <view class="content">
  15. <text>{{bank.bankTypeLabel}}</text>
  16. <text>{{bank.cardNo}}</text>
  17. </view>
  18. </view>
  19. <view class="center">
  20. <text class="cuIcon-right" style="font-size: 36rpx;color: #888888;"></text>
  21. </view>
  22. </navigator>
  23. <view class="card">
  24. <text class="title">提现金额</text>
  25. <view class="input">
  26. <text class="text-price center text-bold" style="font-size: 60rpx;"></text>
  27. <view @click="show" class="margin-left-20 center"
  28. style="width: 60%;justify-content: flex-start;color: #ff9900;">
  29. <text class="text-xl" v-text="withdrawAmount"></text>
  30. <view class="cusor"></view>
  31. </view>
  32. <view @click="allWithdraw" class="center margin-bottom-10 margin-left-20">
  33. <view class="cu-btn withdraw-btn sm round center">
  34. <text>全部提现</text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="canWithdraw">
  39. 可提现金额
  40. <text class="text-price margin-left-20" style="font-size: 34rpx;">{{canWithDraw}}</text>
  41. </view>
  42. <view class="rate">
  43. <view class="item">
  44. <text>服务费</text>
  45. <text class="text-price">0.10</text>
  46. </view>
  47. <view class="item">
  48. <view class="">
  49. <text>费率</text>
  50. <text @click="rateShow=true" class="cuIcon-question margin-left-10 text-lg"></text>
  51. </view>
  52. <text class="">0.05%</text>
  53. </view>
  54. </view>
  55. </view>
  56. <u-popup v-model="rateShow" :mask-close-able="false" mode="center" height="40%" width="76%" borderRadius="20"
  57. negative-top="100">
  58. <view class="popup-content" style="height: 98%;">
  59. <view class="">
  60. <text class="popup-title">费率说明</text>
  61. <view class="popup-desc">
  62. <text>累计营收0-1000元,费率为0.5%;</text>
  63. <text>1001-10000元,费率为0.38%;</text>
  64. <text>10000-100000元,费率0.3%;</text>
  65. <text>100000元起申请更低费率。</text>
  66. </view>
  67. </view>
  68. <view class="center">
  69. <view class="cu-btn btn-bg-color round" style="height: 80rpx;font-size: 30rpx;width: 80%;"
  70. @click="rateShow=false">
  71. 确认
  72. </view>
  73. </view>
  74. </view>
  75. </u-popup>
  76. <amountInput :maxNumber="canWithDraw" ref="amountInput" confirmText="确认提现" btnColor="#ff9900" @change="change"
  77. @confirm="withdrawConfirm"></amountInput>
  78. </view>
  79. </template>
  80. <script>
  81. import amountInput from '@/components/amountInput/amountInput.vue';
  82. export default {
  83. components: {
  84. amountInput
  85. },
  86. data() {
  87. return {
  88. rateShow: false,
  89. bank: {},
  90. //可提现
  91. canWithDraw: '',
  92. //提现金额
  93. withdrawAmount: 0,
  94. };
  95. },
  96. onLoad() {
  97. this.fetchShopDetail()
  98. },
  99. onShow() {
  100. let bank=this.$util.getBackParams('bank')
  101. if (!this.$isEmpty(bank)) {
  102. this.bank=bank
  103. }else{
  104. this.fetchCardList()
  105. }
  106. },
  107. methods: {
  108. async fetchShopDetail() {
  109. let params = {
  110. id: this.vuex_shopId
  111. }
  112. let data = (await this.$api.shop.detail(params)).data
  113. let originalData = this.$digital.floatSub(data.withdrawTotalPrice, data.totalPointValue)
  114. this.canWithDraw = this.$digital.keepTwoDecimal(originalData)
  115. },
  116. fetchCardList() {
  117. let params = {
  118. userId: this.vuex_shopId,
  119. size: 10
  120. }
  121. this.$api.userBank.appList(params).then(res => {
  122. this.bank = res.data.records[0]
  123. })
  124. },
  125. change(e) {
  126. if (!e) {
  127. this.withdrawAmount = 0
  128. } else {
  129. this.withdrawAmount = e
  130. }
  131. },
  132. show() {
  133. this.$refs.amountInput.show()
  134. },
  135. //全部提现
  136. allWithdraw(){
  137. this.withdrawAmount=this.canWithDraw
  138. this.$refs.amountInput.initialMoney(this.withdrawAmount)
  139. },
  140. async withdrawConfirm(){
  141. if (this.$isEmpty(this.bank)) {
  142. this.$u.toast('请选择银行')
  143. return
  144. }
  145. let params={
  146. shopId:this.vuex_shopId,
  147. amount:parseFloat(this.withdrawAmount),
  148. bankId:this.bank.id
  149. }
  150. let orderId=(await this.$api.withdraw.submit(params)).data
  151. if (this.$isEmpty(orderId)) {
  152. this.$u.toast('提现失败')
  153. return
  154. }
  155. let data={
  156. orderId,
  157. orderType:"USER_WITHDRAW"
  158. }
  159. let res=await this.$api.withdraw.yeeWithdraw(data)
  160. if (res.data.status=="SUCCESS") {
  161. this.$dialog.showModal('银行处理中').then(()=>{
  162. this.$back()
  163. })
  164. return
  165. }
  166. if (res.data.returnMsg=='账户余额不足') {
  167. this.$dialog.showModalAndBack('提现失败,平台账户余额不足')
  168. return
  169. }
  170. this.$dialog.showModalAndBack(res.data.returnMsg)
  171. }
  172. }
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. .bank {
  177. border-radius: 20rpx;
  178. background-color: #FFFFFF;
  179. padding: 44rpx;
  180. display: flex;
  181. justify-content: space-between;
  182. .left {
  183. display: flex;
  184. image {
  185. width: 90rpx;
  186. height: 90rpx;
  187. margin-right: 20rpx;
  188. }
  189. .content {
  190. display: flex;
  191. flex-direction: column;
  192. text:first-child {
  193. color: #252525;
  194. font-weight: 800;
  195. font-size: 34rpx;
  196. }
  197. text:last-child {
  198. margin-top: 15rpx;
  199. color: #888888;
  200. font-size: 26rpx;
  201. }
  202. }
  203. }
  204. }
  205. .card_add {
  206. border-radius: 20rpx;
  207. padding: 40rpx 0;
  208. background-color: #FFFFFF;
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. flex-direction: column;
  213. }
  214. .card {
  215. border-radius: 20rpx;
  216. margin-top: 30rpx;
  217. padding: 40rpx;
  218. background-color: #FFFFFF;
  219. display: flex;
  220. flex-direction: column;
  221. .title {
  222. font-size: 36rpx;
  223. font-weight: 800;
  224. margin-bottom: 30rpx;
  225. }
  226. .input {
  227. display: flex;
  228. border-bottom: 1rpx solid #DFDFDF;
  229. .withdraw-btn {
  230. background-color: #FFFFFF;
  231. color: #EE9230;
  232. border: 1rpx solid #EE9230;
  233. height: 54rpx;
  234. width: 180rpx;
  235. font-size: 28rpx;
  236. line-height: 54rpx;
  237. }
  238. }
  239. .canWithdraw {
  240. margin-top: 24rpx;
  241. color: #252525;
  242. }
  243. .rate {
  244. margin-top: 40rpx;
  245. .item {
  246. margin-bottom: 20rpx;
  247. display: flex;
  248. justify-content: space-between;
  249. text:first-child {
  250. color: #252525;
  251. }
  252. text:last-child {
  253. color: #999999;
  254. }
  255. }
  256. }
  257. }
  258. .submit-btn {
  259. background-color: #EE9230;
  260. color: #FFFFFF;
  261. border-radius: 10rpx;
  262. }
  263. .popup-content {
  264. height: 100%;
  265. padding: 50rpx 60rpx;
  266. display: flex;
  267. flex-direction: column;
  268. justify-content: space-between;
  269. .popup-title {
  270. font-size: 38rpx;
  271. font-weight: 800;
  272. }
  273. .popup-desc {
  274. margin-top: 50rpx;
  275. color: #666666;
  276. display: flex;
  277. flex-direction: column;
  278. text {
  279. line-height: 40rpx;
  280. margin-bottom: 10rpx;
  281. }
  282. }
  283. }
  284. .cusor {
  285. margin-left: 10rpx;
  286. width: 6rpx;
  287. border-radius: 20rpx;
  288. height: 60%;
  289. background-color: #ff9900;
  290. animation: blink 1200ms infinite ease-in-out;
  291. }
  292. @keyframes blink {
  293. from {
  294. opacity: 0;
  295. }
  296. }
  297. </style>