qdwallet.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.integral | getMoneyStyle }}</view>
  7. <text class="text">可用趣豆</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">收款人id</view>
  13. <view class="row"><input class="input" type="number" v-model="card" placeholder="请输入收款人id"
  14. placeholder-class="placeholder" /></view>
  15. </view>
  16. <view class="row-box">
  17. <view class="title">交易密码</view>
  18. <view class="row"><input class="input" type="password" v-model="password" placeholder="请输入交易密码"
  19. placeholder-class="placeholder" /></view>
  20. </view>
  21. <view class="row-box">
  22. <view class="title">转账金额</view>
  23. <view class="row">
  24. <!-- <text class="tit">¥</text> -->
  25. <input class="input" type="number" v-model="withdrawal" placeholder="转入金额"
  26. placeholder-class="placeholder" />
  27. <!-- <view class="buttom" @click="withdrawal = userInfo.integral">全部转账</view> -->
  28. </view>
  29. </view>
  30. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">提交</button>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. getMoneyStyle
  36. } from '@/utils/rocessor.js';
  37. import {
  38. getUserInfo,
  39. admintrade,
  40. trade
  41. } from '@/api/user.js';
  42. import {
  43. mapMutations,
  44. mapState
  45. } from 'vuex';
  46. export default {
  47. filters: {
  48. getMoneyStyle
  49. },
  50. data() {
  51. return {
  52. money: '0.00', //可提现金额
  53. withdrawal: '', //提现金额
  54. password: '', //支付密码
  55. card: '', //转账卡号
  56. name: '',
  57. // #ifdef H5
  58. weichatBsrowser: false,
  59. // #endif
  60. loding: false,
  61. type: '1'
  62. };
  63. },
  64. onLoad(options) {
  65. // #ifdef H5
  66. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  67. // #endif
  68. // this.dataUp();
  69. if (options.type) {
  70. this.type = options.type;
  71. console.log(this.type);
  72. }
  73. },
  74. computed: {
  75. ...mapState('user', ['userInfo'])
  76. },
  77. methods: {
  78. ...mapMutations('user', ['setUserInfo', 'login']),
  79. // 更新数据
  80. dataUp() {
  81. let obj = this;
  82. getUserInfo({})
  83. .then(e => {
  84. obj.login();
  85. // 保存返回用户数据
  86. obj.setUserInfo(e.data);
  87. })
  88. .catch(e => {
  89. console.log(e);
  90. });
  91. },
  92. // 切换选中对象
  93. tabRadio(e) {
  94. this.type = e.detail.value;
  95. },
  96. // 提交
  97. confirm() {
  98. let obj = this;
  99. obj.loding = true;
  100. // if (obj.withdrawal < 10) {
  101. // obj.loding = false;
  102. // uni.showModal({
  103. // title: '提示',
  104. // content: '转账金额最低为10'
  105. // });
  106. // return;
  107. // }
  108. if (obj.password == '') {
  109. obj.loding = false;
  110. uni.showModal({
  111. title: '提示',
  112. content: '请输入交易密码'
  113. });
  114. return;
  115. }
  116. // if (obj.withdrawal % 10 != 0) {
  117. // obj.loding = false;
  118. // uni.showModal({
  119. // title: '提示',
  120. // content: '转账金额请输入10的倍数'
  121. // });
  122. // return;
  123. // } else {
  124. let data = {
  125. uid: obj.card, //编号
  126. num: obj.withdrawal, //金额
  127. payment: obj.password
  128. };
  129. if (obj.type == '1') {
  130. trade(data)
  131. .then(e => {
  132. // 允许按钮点击
  133. obj.loding = false;
  134. // 初始化提现金额
  135. obj.withdrawal = '';
  136. uni.showToast({
  137. title: '转账成功',
  138. duration: 2000,
  139. position: 'top'
  140. });
  141. obj.dataUp();
  142. })
  143. .catch(e => {
  144. obj.$api.msg(e.msg);
  145. obj.loding = false;
  146. console.log();
  147. });
  148. }
  149. if (obj.type == '2') {
  150. admintrade(data)
  151. .then(e => {
  152. // 允许按钮点击
  153. obj.loding = false;
  154. // 初始化提现金额
  155. obj.withdrawal = '';
  156. uni.showToast({
  157. title: '转账成功',
  158. duration: 2000,
  159. position: 'top'
  160. });
  161. obj.dataUp();
  162. })
  163. .catch(e => {
  164. obj.$api.msg(e.msg);
  165. obj.loding = false;
  166. console.log();
  167. });
  168. }
  169. // }
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss">
  175. page {
  176. height: 100%;
  177. }
  178. .content-money {
  179. padding: 30rpx 0;
  180. background: #ffffff;
  181. }
  182. .item {
  183. padding: 0 $page-row-spacing;
  184. background-color: #ffffff;
  185. }
  186. .flex {
  187. background-color: #ffffff;
  188. text-align: center;
  189. margin: 0 30rpx;
  190. border-radius: $border-radius-sm;
  191. justify-content: center;
  192. .buttom {
  193. font-size: $font-lg;
  194. width: 50%;
  195. }
  196. .interval {
  197. width: 2px;
  198. height: 60rpx;
  199. background-color: #eeeeee;
  200. }
  201. .icon {
  202. background-size: 100%;
  203. font-size: 42rpx;
  204. color: $font-color-dark;
  205. font-weight: bold;
  206. background-repeat: no-repeat;
  207. background-position: center;
  208. }
  209. .text {
  210. color: $font-color-light;
  211. }
  212. }
  213. .row-box {
  214. margin-top: 30rpx;
  215. padding: 20rpx 30rpx;
  216. background: #fff;
  217. .title {
  218. font-size: $font-base + 2rpx;
  219. color: $font-color-dark;
  220. }
  221. .row {
  222. display: flex;
  223. align-items: center;
  224. position: relative;
  225. height: 80rpx;
  226. .tit {
  227. flex-shrink: 0;
  228. width: 40rpx;
  229. font-size: 30rpx;
  230. color: $font-color-dark;
  231. }
  232. .input {
  233. flex: 1;
  234. font-size: 30rpx;
  235. color: $font-color-dark;
  236. }
  237. .iconlocation {
  238. font-size: 36rpx;
  239. color: $font-color-light;
  240. }
  241. .buttom {
  242. color: #f21f5d;
  243. font-size: $font-base;
  244. }
  245. }
  246. }
  247. .add-btn {
  248. width: 520rpx;
  249. height: 80rpx;
  250. border: 2rpx solid #f21f5d;
  251. border-radius: 40rpx;
  252. margin: 140rpx auto;
  253. font-family: PingFang SC;
  254. font-weight: bold;
  255. color: #f21f5d;
  256. }
  257. .name {
  258. background: #fff;
  259. padding: 30rpx;
  260. }
  261. .list {
  262. padding-left: 30rpx;
  263. margin-top: 30rpx;
  264. background-color: #ffffff;
  265. .box {
  266. display: flex;
  267. align-items: center;
  268. width: 100%;
  269. height: 120rpx;
  270. border-bottom: 1px solid $border-color-light;
  271. .icon {
  272. font-size: 48rpx;
  273. padding-right: 20rpx;
  274. .icon-img {
  275. height: 50rpx;
  276. width: 50rpx;
  277. }
  278. }
  279. .iconweixin1 {
  280. color: #18bf16;
  281. }
  282. .iconzhifubao {
  283. color: #08aaec;
  284. }
  285. .title-box {
  286. flex-grow: 1;
  287. text-align: left;
  288. .title {
  289. font-size: $font-base + 2rpx;
  290. color: $font-color-base;
  291. }
  292. .node {
  293. font-size: $font-sm;
  294. color: $font-color-light;
  295. }
  296. }
  297. }
  298. }
  299. .tip {
  300. padding: 20rpx;
  301. color: #ff0000;
  302. }
  303. /deep/ .uni-radio-input {
  304. width: 45rpx;
  305. height: 45rpx;
  306. }
  307. </style>