integral_chu.vue 6.8 KB

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