withdraw.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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" class="bank" v-else hover-class="none">
  12. <view class="left center">
  13. <image :src="bank.bankCode?'/static/bank/'+bank.bankCode+'.png':''" mode=""></image>
  14. <view class="content">
  15. <text>{{bank.bankName}}</text>
  16. <text>{{dealAccountNo(bank.accountNo)}}</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. <u-modal :mask-close-able="true" confirm-text="确定提现" @confirm="doWithdraw" v-model="passwordShow" title="提示">
  79. <view class="slot-content" style="padding: 20rpx;">
  80. <u-input v-model="withdrawPassword" placeholder="请填写提现密码" type="password" />
  81. </view>
  82. </u-modal>
  83. <toast ref="toast"></toast>
  84. </view>
  85. </template>
  86. <script>
  87. import md5Libs from "uview-ui/libs/function/md5";
  88. import amountInput from '@/components/amountInput/amountInput.vue';
  89. export default {
  90. components: {
  91. amountInput
  92. },
  93. data() {
  94. return {
  95. rateShow: false,
  96. bank: {},
  97. //可提现
  98. canWithDraw: '',
  99. //提现金额
  100. withdrawAmount: 0,
  101. //提现密码
  102. withdrawPassword: '',
  103. passwordShow: false,
  104. };
  105. },
  106. onLoad() {
  107. this.fetchCardList()
  108. this.fetchShopDetail()
  109. },
  110. onShow() {
  111. if (this.canReset) {
  112. this.bank = this.$util.getBackParams('bank')
  113. if (this.$isEmpty(this.bank)) {
  114. this.fetchCardList()
  115. }
  116. }
  117. this.canReset = true
  118. },
  119. computed: {
  120. dealAccountNo() {
  121. return data => {
  122. return this.$util.dealAccountNo(data)
  123. }
  124. },
  125. dealBankCodeType() {
  126. return data => {
  127. return this.$getBankCodeType(data)
  128. }
  129. }
  130. },
  131. methods: {
  132. async fetchShopDetail() {
  133. let params = {
  134. id: this.vuex_shopId
  135. }
  136. let data = (await this.$api.shop.detail(params)).data
  137. this.canWithDraw = data.balance
  138. },
  139. fetchCardList() {
  140. let params = {
  141. merchantNo: this.vuex_merchantNo
  142. }
  143. this.$api.yeepay.withdrawCardQuery(params).then(res => {
  144. let result = JSON.parse(res.data.result)
  145. this.bank = result.bankCardAccountList[0]
  146. })
  147. },
  148. change(e) {
  149. if (!e) {
  150. this.withdrawAmount = 0
  151. } else {
  152. this.withdrawAmount = e
  153. }
  154. },
  155. show() {
  156. this.$refs.amountInput.show()
  157. },
  158. //全部提现
  159. allWithdraw() {
  160. this.withdrawAmount = this.canWithDraw
  161. this.$refs.amountInput.initialMoney(this.withdrawAmount)
  162. },
  163. withdrawConfirm() {
  164. if (this.$isEmpty(this.bank)) {
  165. this.$u.toast('请选择银行')
  166. return
  167. }
  168. this.$refs.toast.warn('业务暂未开通')
  169. },
  170. doWithdraw() {
  171. if (this.$isEmpty(this.withdrawPassword)) {
  172. this.$u.toast('请输入提现密码')
  173. this.passwordShow = true
  174. return
  175. }
  176. console.log(md5Libs.md5(this.withdrawPassword));
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss" scoped>
  182. .bank {
  183. border-radius: 20rpx;
  184. background-color: #FFFFFF;
  185. padding: 44rpx;
  186. display: flex;
  187. justify-content: space-between;
  188. .left {
  189. display: flex;
  190. image {
  191. width: 90rpx;
  192. height: 90rpx;
  193. margin-right: 20rpx;
  194. }
  195. .content {
  196. display: flex;
  197. flex-direction: column;
  198. text:first-child {
  199. color: #252525;
  200. font-weight: 800;
  201. font-size: 34rpx;
  202. }
  203. text:last-child {
  204. margin-top: 15rpx;
  205. color: #888888;
  206. font-size: 26rpx;
  207. }
  208. }
  209. }
  210. }
  211. .card_add {
  212. border-radius: 20rpx;
  213. padding: 40rpx 0;
  214. background-color: #FFFFFF;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. flex-direction: column;
  219. }
  220. .btn-withdraw {
  221. position: absolute;
  222. right: -30rpx;
  223. top: 26rpx;
  224. .btn {
  225. padding: 16rpx 38rpx;
  226. background-color: #FFE6CD;
  227. color: #EF9944;
  228. }
  229. }
  230. .card {
  231. overflow: hidden;
  232. position: relative;
  233. border-radius: 20rpx;
  234. margin-top: 30rpx;
  235. padding: 40rpx;
  236. background-color: #FFFFFF;
  237. display: flex;
  238. flex-direction: column;
  239. .title {
  240. font-size: 36rpx;
  241. font-weight: 800;
  242. margin-bottom: 30rpx;
  243. }
  244. .input {
  245. display: flex;
  246. border-bottom: 1rpx solid #DFDFDF;
  247. .withdraw-btn {
  248. background-color: #FFFFFF;
  249. color: #EE9230;
  250. border: 1rpx solid #EE9230;
  251. height: 54rpx;
  252. width: 180rpx;
  253. font-size: 28rpx;
  254. line-height: 54rpx;
  255. }
  256. }
  257. .canWithdraw {
  258. margin-top: 24rpx;
  259. color: #252525;
  260. }
  261. .rate {
  262. margin-top: 40rpx;
  263. .item {
  264. margin-bottom: 20rpx;
  265. display: flex;
  266. justify-content: space-between;
  267. text:first-child {
  268. color: #252525;
  269. }
  270. text:last-child {
  271. color: #999999;
  272. }
  273. }
  274. }
  275. }
  276. .submit-btn {
  277. background-color: #EE9230;
  278. color: #FFFFFF;
  279. border-radius: 10rpx;
  280. }
  281. .popup-content {
  282. height: 100%;
  283. padding: 50rpx 60rpx;
  284. display: flex;
  285. flex-direction: column;
  286. justify-content: space-between;
  287. .popup-title {
  288. font-size: 38rpx;
  289. font-weight: 800;
  290. }
  291. .popup-desc {
  292. margin-top: 50rpx;
  293. color: #666666;
  294. display: flex;
  295. flex-direction: column;
  296. text {
  297. line-height: 40rpx;
  298. margin-bottom: 10rpx;
  299. }
  300. }
  301. }
  302. .cusor {
  303. margin-left: 10rpx;
  304. width: 6rpx;
  305. border-radius: 20rpx;
  306. height: 60%;
  307. background-color: #ff9900;
  308. animation: blink 1200ms infinite ease-in-out;
  309. }
  310. @keyframes blink {
  311. from {
  312. opacity: 0;
  313. }
  314. }
  315. </style>