dmWithDrawal.vue 5.5 KB

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