withdraw.vue 7.1 KB

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