anticipate_gift.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view>
  3. <uni-nav-bar :border="false" statusBar left-icon="left" @clickLeft="utils.navigateBack()" @clickRight="tapOpenLog" fixed title="易趣卷转账">
  4. <view style="color: #ef4034;" slot="right">
  5. 转账记录
  6. </view>
  7. </uni-nav-bar>
  8. <view style="height: 10px;"></view>
  9. <view class="topinfo fx-h fx-bc fx-ac">
  10. <view class="count">{{ user.anticipate || 0 }}</view>
  11. <view class="text">当前可用(易趣卷)</view>
  12. </view>
  13. <view style="height: 10px;"></view>
  14. <view class="info-line">
  15. <view class="il-top">
  16. <text>转账类型</text>
  17. </view>
  18. <view class="il-bot fx-r fx-bc fx-ac">
  19. <u-radio-group v-model="type">
  20. <u-radio activeColor="red" name="id" label="收款ID"></u-radio>
  21. <view style="width: 40px;"></view>
  22. <u-radio activeColor="red" name="phone" label="收款手机号"></u-radio>
  23. </u-radio-group>
  24. </view>
  25. </view>
  26. <view class="info-line" v-if="type == 'id'">
  27. <view class="il-top">
  28. <text>收款人id</text>
  29. </view>
  30. <view class="il-bot">
  31. <input placeholder="收款人id" @input="tapGetId" type="number" v-model="uid" />
  32. <view class="name">{{ sendname }}</view>
  33. </view>
  34. </view>
  35. <view class="info-line" v-if="type == 'phone'">
  36. <view class="il-top">
  37. <text>手机号码</text>
  38. </view>
  39. <view class="il-bot">
  40. <input placeholder="转账手机号码" @input="tapGetMobile" type="number" v-model="new_mobile" />
  41. <view class="name">{{ sendname }}</view>
  42. </view>
  43. </view>
  44. <view class="info-line">
  45. <view class="il-top">
  46. <text>转账金额</text>
  47. </view>
  48. <view class="il-code">
  49. <view class="etb-left">
  50. <input placeholder="请输入转账金额" @blur="tapBlur" placeholder-class="placeholder-class" v-model="num" />
  51. </view>
  52. <!-- <view class="etb-right" @click="num = allMoney()">
  53. <text>全部</text>
  54. </view> -->
  55. </view>
  56. </view>
  57. <u-alert title="温馨提示" type = "warning" description = "转账金额必须100倍数!"></u-alert>
  58. <view class="info-line">
  59. <view class="update-btn" @click="tapSubmit">
  60. <text>确认转账</text>
  61. </view>
  62. <view style="height: 10px;"></view>
  63. </view>
  64. <PayDialog ref="payDialog" @getPassword="getPassword"></PayDialog>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapState,
  70. mapMutations
  71. } from 'vuex';
  72. import PayDialog from "@/components/ui-pay/payDialog.vue";
  73. export default {
  74. computed: mapState(['user','sysData']),
  75. components:{
  76. PayDialog
  77. },
  78. data() {
  79. return {
  80. num:"",
  81. type : "id",
  82. new_mobile : "",
  83. sendname : "",
  84. uid : "",
  85. data : {
  86. lv : 0
  87. }
  88. }
  89. },
  90. onLoad(options) {
  91. this.checkUserLogin({page:this,isLogion:false});
  92. },
  93. methods: {
  94. ...mapMutations(['checkUserLogin']),
  95. tapGetMobile:function(ev){
  96. let mobile = ev.detail.value;
  97. if(!this.utils.isPoneAvailable(mobile)) {
  98. this.sendname = '';
  99. return;
  100. }
  101. this
  102. .request
  103. .post("userCkUserName",{mobile : mobile,type : 1})
  104. .then(res => {
  105. if(res.code == 200) {
  106. this.sendname = res.data.name;
  107. } else {
  108. this.utils.Tip(res.msg);
  109. }
  110. });
  111. },
  112. tapGetId:function(ev){
  113. let id = ev.detail.value;
  114. if(id == "") {
  115. this.sendname = '';
  116. return;
  117. }
  118. this
  119. .request
  120. .post("userCkUserName",{uid : id,type : 1})
  121. .then(res => {
  122. if(res.code == 200) {
  123. this.sendname = res.data.name;
  124. } else {
  125. this.sendname = "";
  126. }
  127. });
  128. },
  129. tapOpenLog:function(){
  130. uni.navigateTo({ url:"anticipate_gift_log"});
  131. },
  132. /**
  133. * 预计扣除
  134. */
  135. getKc:function(){
  136. if(isNaN(this.num)) return "0.00";
  137. let val = this.utils.returnFloat(this.num * (this.data.lv / 100));
  138. return val;
  139. },
  140. /**
  141. * 全部
  142. */
  143. allMoney:function(){
  144. if(this.user.anticipate <= 0) return 0;
  145. let val = this.utils.returnFloat(this.user.anticipate * (this.data.lv / 100));
  146. let value = this.user.anticipate - parseFloat(val);
  147. return parseInt(value / 100) * 100;
  148. },
  149. tapBlur:function(ev){
  150. var value = ev.detail.value;
  151. if(isNaN(value)){
  152. this.num = 0;
  153. return;
  154. }
  155. this.num = parseInt(value / 100) * 100;
  156. },
  157. /**
  158. * 提交数据
  159. */
  160. tapSubmit:function(){
  161. if(this.new_mobile == '' && this.type == 'phone'){
  162. this.utils.Tip("请输入转账号码");
  163. return;
  164. }
  165. if(this.uid == '' && this.type == 'id'){
  166. this.utils.Tip("请输入转账id");
  167. return;
  168. }
  169. if(this.num <= 0 || this.num == ''){
  170. this.utils.Tip("请输入正确转账金额!");
  171. return;
  172. }
  173. if(parseFloat(this.num) > this.allMoney()){
  174. this.utils.Tip("转账金额超过剩余金额");
  175. return;
  176. }
  177. this.$refs['payDialog'].show();
  178. },
  179. getPassword : function(val){
  180. var password = val.password;
  181. this.utils.loadIng("提交中..");
  182. this
  183. .request
  184. .post("anticipateGive",{
  185. new_password : password,
  186. new_mobile : this.new_mobile,
  187. num : this.num,
  188. uid : this.uid,
  189. type : this.type
  190. })
  191. .then(res=>{
  192. uni.hideLoading();
  193. if(res.code == 200) {
  194. this.utils.Tip(res.msg);
  195. setTimeout(function(){ uni.navigateBack();},1000);
  196. }else{
  197. this.utils.Tip(res.msg);
  198. this.$refs['payDialog'].cleanNum();
  199. }
  200. }).catch(function(){
  201. uni.hideLoading();
  202. this.utils.Tip("网络错误,请稍后尝试");
  203. });
  204. }
  205. },
  206. }
  207. </script>
  208. <style>
  209. page {
  210. background: #F5F5F5;
  211. }
  212. #box {
  213. padding-top: 90px;
  214. z-index: -1;
  215. }
  216. .topinfo{
  217. background: #fff;
  218. padding: 40rpx 0;
  219. .count{
  220. background-size: 100%;
  221. font-size: 24px;
  222. color: #303133;
  223. font-weight: 700;
  224. background-repeat: no-repeat;
  225. background-position: 50%;
  226. }
  227. .text{
  228. color: #909399;
  229. font-size: 18px;
  230. }
  231. }
  232. .info-line {
  233. min-height: 80px;
  234. padding: 0 15px;
  235. background-color: #fff;
  236. border-top: 1px #f5f5f5 solid;
  237. }
  238. .il-top {
  239. color: #ef4034;
  240. font-size: 14px;
  241. margin-top: 10px;
  242. }
  243. .il-bot {
  244. margin-top: 10px;
  245. position: relative;
  246. }
  247. .il-bot input {
  248. width: 100%;
  249. height: 100%;
  250. }
  251. .il-bot .name{position: absolute;right: 10px;top: 0px;}
  252. .update-btn {
  253. width: 90%;
  254. height: 40px;
  255. text-align: center;
  256. line-height: 40px;
  257. margin: 30px auto;
  258. background: #ef4034;
  259. color: #fff;
  260. border-radius: 100px;
  261. font-size: 16px;
  262. }
  263. .il-code {
  264. display: flex;
  265. align-items: center;
  266. margin-top: 10px;
  267. }
  268. .il-code input {
  269. width: 50%;
  270. height: 100%;
  271. font-size: 13px;
  272. }
  273. .ilc-btn {
  274. width: 90px;
  275. height: 30px;
  276. text-align: center;
  277. line-height: 30px;
  278. margin-left: auto;
  279. font-size: 12px;
  280. background: #ef4034;
  281. color: #fff;
  282. border-radius: 100px;
  283. }
  284. .ilc-no-show {
  285. width: 90px;
  286. height: 30px;
  287. text-align: center;
  288. line-height: 30px;
  289. margin-left: auto;
  290. font-size: 12px;
  291. background: #eee;
  292. color: #999;
  293. border-radius: 100px;
  294. }
  295. .etb-left{width:80%;height:100%}
  296. .placeholder-class{color:#7e7e7e;font-size:13px;font-weight:400}
  297. .etb-left input{width:100%;height:100%;color:#484747;font-size:22px;font-weight:600}
  298. .etb-right{margin-left:auto;color:#2d2438;font-size:13px}
  299. .tip{font-size: 14px;padding: 10px 0;color: #ef4034;}
  300. .tip-info{padding: 5px 0;}
  301. .tip-info .label{color: #000;font-weight: bold;}
  302. .tip-info .money{color: orangered;}
  303. </style>