dmWithDrawal.vue 5.9 KB

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