withdraw.vue 7.3 KB

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