dmWithDrawal.vue 5.9 KB

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