anticipate_gift.vue 7.4 KB

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