dmWithDrawal.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. }
  88. let param = {
  89. "amount": this.money
  90. }
  91. const res = await this.$myRequest({
  92. url: '/cash/apply',
  93. data:param,
  94. });
  95. if (res && res.data.success) {
  96. uni.showToast({
  97. icon:"none",
  98. title:"提现成功"
  99. })
  100. }else{
  101. uni.showToast({
  102. icon:"none",
  103. title:res.data.message
  104. })
  105. }
  106. }
  107. },
  108. mounted() {
  109. },
  110. components:{
  111. dmDialog
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .content{
  117. width: 100%;
  118. height: 490rpx;
  119. padding-left: 40rpx;
  120. padding-right: 40rpx;
  121. box-sizing: border-box;
  122. }
  123. .report_title{
  124. display: flex;
  125. align-items: center;
  126. margin-top: 52rpx;
  127. margin-bottom: 40rpx;
  128. .report_title_{
  129. font-size: 28rpx;
  130. font-family: Verdana, Verdana-Regular;
  131. font-weight: 400;
  132. text-align: left;
  133. color: #262626;
  134. }
  135. .icon_weichart {
  136. width: 34rpx;
  137. height: 28rpx;
  138. margin-right: 8rpx;
  139. }
  140. .report_title_money{
  141. font-size: 28rpx;
  142. font-family: Verdana, Verdana-Regular;
  143. font-weight: 400;
  144. text-align: left;
  145. color: #262626;
  146. }
  147. }
  148. .withDrawal_content{
  149. display: flex;
  150. align-items: center;
  151. .report_title_{
  152. font-size: 28rpx;
  153. font-family: Verdana, Verdana-Regular;
  154. font-weight: 400;
  155. text-align: left;
  156. color: #262626;
  157. }
  158. .report_title_desc{
  159. font-size: 28rpx;
  160. font-family: Verdana, Verdana-Regular;
  161. font-weight: 400;
  162. text-align: left;
  163. color: #b1b1b1;
  164. }
  165. }
  166. .input_money{
  167. margin-top: 12rpx;
  168. margin-bottom: 19rpx;
  169. display: flex;
  170. align-items: center;
  171. .money_bz{
  172. font-size: 52rpx;
  173. font-family: DIN Alternate, DIN Alternate-Bold;
  174. font-weight: 700;
  175. text-align: left;
  176. color: #262626;
  177. }
  178. .money{
  179. font-size: 52rpx;
  180. font-family: DIN Alternate, DIN Alternate-Bold;
  181. font-weight: 700;
  182. text-align: left;
  183. color: #262626;
  184. padding-right: 10rpx;
  185. }
  186. .icon_close{
  187. width: 40rpx;
  188. height: 40rpx;
  189. min-width: 40rpx;
  190. }
  191. }
  192. .line{
  193. height: 1px;
  194. background: rgba(127,127,127,0.1);
  195. }
  196. .notice{
  197. font-size: 28rpx;
  198. font-family: Verdana, Verdana-Regular;
  199. font-weight: 400;
  200. text-align: left;
  201. color: #b1b1b1;
  202. margin-top: 15rpx;
  203. }
  204. .notice_red{
  205. font-size: 28rpx;
  206. font-family: Verdana, Verdana-Regular;
  207. font-weight: 400;
  208. text-align: left;
  209. color: rgba(206,21,21,0.8);
  210. }
  211. .btn{
  212. display: flex;
  213. align-items: center;
  214. justify-content: space-between;
  215. margin-top: 40rpx;
  216. .btn_cancel{
  217. width: 250rpx;
  218. height: 80rpx;
  219. line-height: 80rpx;
  220. background: #ffffff;
  221. border: 2rpx solid #f07423;
  222. border-radius: 42rpx;
  223. text-align: center;
  224. font-size: 28rpx;
  225. font-family: Verdana, Verdana-Bold;
  226. font-weight: 700;
  227. color: #f07423;
  228. }
  229. .btn_confirm{
  230. width: 250rpx;
  231. height: 80rpx;
  232. line-height: 80rpx;
  233. background: #f07423;
  234. border-radius: 40rpx;
  235. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(240,116,35,0.37);
  236. text-align: center;
  237. font-size: 28rpx;
  238. font-family: Verdana, Verdana-Bold;
  239. font-weight: 700;
  240. color: #ffffff;
  241. }
  242. }
  243. </style>