dmWithDrawal.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <dmDialog ref='popView' :isShowTitle="true" title="提现" :isShowClose="true" :isShowConfirm="false" marginSize="60rpx">
  3. <view class="content">
  4. <view class="report_title">
  5. <text class="report_title_">提现到:</text>
  6. <image class="icon_weichart" src="../../static/icons/icon_weichat.png" mode=""></image>
  7. <text class="report_title_money">微信零钱</text>
  8. </view>
  9. <view class="withDrawal_content">
  10. <view class="report_title_">
  11. 提现金额
  12. </view>
  13. <view class="report_title_desc">
  14. (可提现金额¥{{canCashOut||'0.00'}})
  15. </view>
  16. </view>
  17. <view class="input_money">
  18. <text class="money_bz">¥</text>
  19. <input class="money" type="digit" v-model="money" @input="onKeyInput" :maxlength="moneyMaxLeng"/>
  20. <image class="icon_close" v-if="money" src="../../static/icons/icon_close_full.png" mode="" @click="clearMoney"></image>
  21. </view>
  22. <view class="line">
  23. </view>
  24. <text class="notice_red" v-if="Number(money)>Number(canCashOut)">输入金额超过可提现金额</text>
  25. <text class="notice" v-else>单笔限额200元</text>
  26. <view class="btn">
  27. <view class="btn_cancel" @click="cancel">
  28. 取消
  29. </view>
  30. <view class="btn_confirm" @click="confirmWithDrawal">
  31. 确认提现
  32. </view>
  33. </view>
  34. </view>
  35. </dmDialog>
  36. </template>
  37. <script>
  38. import dmDialog from "./dmDialog.vue"
  39. export default{
  40. props:{
  41. canCashOut:[String,Number],
  42. },
  43. data(){
  44. return {
  45. moneyMaxLeng:11,
  46. money:""
  47. }
  48. },
  49. methods:{
  50. show() {
  51. this.$refs.popView.show()
  52. },
  53. knowAction(){
  54. this.money = ""
  55. this.$refs.popView.hide()
  56. },
  57. onKeyInput(e){
  58. let val = e.target.value;
  59. val = val.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  60. val = val.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
  61. val = val.replace(/^0+\./g, '0.');
  62. val = val.match(/^0+[1-9]+/) ? val = val.replace(/^0+/g, '') : val
  63. val = (val.match(/^\d*(\.?\d{0,2})/g)[0]) || ''
  64. if (val.includes(".")) {
  65. let numDian = val.toString().split(".")[1].length;
  66. if (numDian === 2) {
  67. this.moneyMaxLeng = val.length;
  68. }
  69. } else {
  70. this.moneyMaxLeng = 8;
  71. }
  72. this.money = val
  73. },
  74. clearMoney(){
  75. this.money = ""
  76. },
  77. cancel(){
  78. this.money = ""
  79. this.$refs.popView.hide()
  80. },
  81. async confirmWithDrawal(){
  82. if(!this.money||this.money==0){
  83. uni.showToast({
  84. icon:"none",
  85. title:"请输入提现金额"
  86. })
  87. return
  88. }
  89. let param = {
  90. "amount": this.money
  91. }
  92. const res = await this.$myRequest({
  93. url: '/cash/apply',
  94. data:param,
  95. });
  96. if (res && res.data.success) {
  97. uni.showToast({
  98. icon:"none",
  99. title:"提现成功"
  100. })
  101. }else{
  102. uni.showToast({
  103. icon:"none",
  104. title:res.data.message
  105. })
  106. }
  107. }
  108. },
  109. mounted() {
  110. },
  111. components:{
  112. dmDialog
  113. }
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. .content{
  118. width: 100%;
  119. height: 490rpx;
  120. padding-left: 40rpx;
  121. padding-right: 40rpx;
  122. box-sizing: border-box;
  123. }
  124. .report_title{
  125. display: flex;
  126. align-items: center;
  127. margin-top: 52rpx;
  128. margin-bottom: 40rpx;
  129. .report_title_{
  130. font-size: 28rpx;
  131. font-family: Verdana, Verdana-Regular;
  132. font-weight: 400;
  133. text-align: left;
  134. color: #262626;
  135. }
  136. .icon_weichart {
  137. width: 34rpx;
  138. height: 28rpx;
  139. margin-right: 8rpx;
  140. }
  141. .report_title_money{
  142. font-size: 28rpx;
  143. font-family: Verdana, Verdana-Regular;
  144. font-weight: 400;
  145. text-align: left;
  146. color: #262626;
  147. }
  148. }
  149. .withDrawal_content{
  150. display: flex;
  151. align-items: center;
  152. .report_title_{
  153. font-size: 28rpx;
  154. font-family: Verdana, Verdana-Regular;
  155. font-weight: 400;
  156. text-align: left;
  157. color: #262626;
  158. }
  159. .report_title_desc{
  160. font-size: 28rpx;
  161. font-family: Verdana, Verdana-Regular;
  162. font-weight: 400;
  163. text-align: left;
  164. color: #b1b1b1;
  165. }
  166. }
  167. .input_money{
  168. margin-top: 12rpx;
  169. margin-bottom: 19rpx;
  170. display: flex;
  171. align-items: center;
  172. .money_bz{
  173. font-size: 52rpx;
  174. font-family: DIN Alternate, DIN Alternate-Bold;
  175. font-weight: 700;
  176. text-align: left;
  177. color: #262626;
  178. }
  179. .money{
  180. font-size: 52rpx;
  181. font-family: DIN Alternate, DIN Alternate-Bold;
  182. font-weight: 700;
  183. text-align: left;
  184. color: #262626;
  185. padding-right: 10rpx;
  186. }
  187. .icon_close{
  188. width: 40rpx;
  189. height: 40rpx;
  190. min-width: 40rpx;
  191. }
  192. }
  193. .line{
  194. height: 1px;
  195. background: rgba(127,127,127,0.1);
  196. }
  197. .notice{
  198. font-size: 28rpx;
  199. font-family: Verdana, Verdana-Regular;
  200. font-weight: 400;
  201. text-align: left;
  202. color: #b1b1b1;
  203. margin-top: 15rpx;
  204. }
  205. .notice_red{
  206. font-size: 28rpx;
  207. font-family: Verdana, Verdana-Regular;
  208. font-weight: 400;
  209. text-align: left;
  210. color: rgba(206,21,21,0.8);
  211. }
  212. .btn{
  213. display: flex;
  214. align-items: center;
  215. justify-content: space-between;
  216. margin-top: 40rpx;
  217. .btn_cancel{
  218. width: 250rpx;
  219. height: 80rpx;
  220. line-height: 80rpx;
  221. background: #ffffff;
  222. border: 2rpx solid #f07423;
  223. border-radius: 42rpx;
  224. text-align: center;
  225. font-size: 28rpx;
  226. font-family: Verdana, Verdana-Bold;
  227. font-weight: 700;
  228. color: #f07423;
  229. }
  230. .btn_confirm{
  231. width: 250rpx;
  232. height: 80rpx;
  233. line-height: 80rpx;
  234. background: #f07423;
  235. border-radius: 40rpx;
  236. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(240,116,35,0.37);
  237. text-align: center;
  238. font-size: 28rpx;
  239. font-family: Verdana, Verdana-Bold;
  240. font-weight: 700;
  241. color: #ffffff;
  242. }
  243. }
  244. </style>