integral_gift.vue 7.0 KB

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