trade.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex " style="width: 750rpx;justify-content: space-around;margin-left: 0;">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.award_range | getMoneyStyle }}</view>
  7. <text class="text">可提现现金</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">转账额度</view>
  13. <view class="row">
  14. <text class="tit">¥</text>
  15. <input class="input" type="number" v-model="withdrawal" placeholder="请输入转账额度" placeholder-class="placeholder" />
  16. <view class="buttom" @click="withdrawal = userInfo.award_range">全部转账</view>
  17. </view>
  18. </view>
  19. <view class="row-box">
  20. <view class="title">转入用户UID</view>
  21. <view class="row">
  22. <input class="input" type="number" v-model="userid" placeholder="请输入转入用户UID" placeholder-class="placeholder" />
  23. </view>
  24. </view>
  25. <button class="add-btn up" @click="confirm">提交申请</button>
  26. </view>
  27. </template>
  28. <script>
  29. import { getMoneyStyle } from '@/utils/rocessor.js';
  30. import { trade } from '@/api/wallet.js';
  31. import { getUserInfo } from '@/api/user.js';
  32. import { mapState, mapMutations } from 'vuex';
  33. export default {
  34. filters: {
  35. getMoneyStyle
  36. },
  37. computed: {
  38. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  39. },
  40. data() {
  41. return {
  42. money: '0.00', //可提现金额
  43. withdrawal: '', //提现金额
  44. userid:''
  45. };
  46. },
  47. onLoad(options) {
  48. },
  49. methods: {
  50. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  51. // 跳转
  52. navTo(url) {
  53. uni.navigateTo({
  54. url: url
  55. });
  56. },
  57. // 提交
  58. confirm() {
  59. if(!this.userid){
  60. uni.showToast({
  61. title: '请输入UID',
  62. icon:'error'
  63. });
  64. return
  65. }
  66. if(!this.withdrawal){
  67. uni.showToast({
  68. title: '请输入转账额度',
  69. icon:'error'
  70. });
  71. return
  72. }
  73. let data = {
  74. num: this.withdrawal, //金额
  75. uid: this.userid //0佣金1余额
  76. };
  77. trade(data)
  78. .then(e => {
  79. getUserInfo({})
  80. .then(({ data }) => {
  81. this.setUserInfo(data);
  82. })
  83. .catch(e => {
  84. console.log(e);
  85. });
  86. uni.showToast({
  87. title: '提交成功',
  88. duration: 2000,
  89. position: 'top'
  90. });
  91. })
  92. .catch(e => {
  93. console.log();
  94. });
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. page {
  101. height: 100%;
  102. }
  103. .content-money {
  104. padding: 30rpx 0;
  105. background: #ffffff;
  106. }
  107. .flex {
  108. background-color: #ffffff;
  109. text-align: center;
  110. margin: 0 30rpx;
  111. border-radius: $border-radius-sm;
  112. .buttom {
  113. font-size: $font-lg;
  114. width: 50%;
  115. }
  116. .interval {
  117. width: 2px;
  118. height: 60rpx;
  119. background-color: #eeeeee;
  120. }
  121. .icon {
  122. background-size: 100%;
  123. font-size: 42rpx;
  124. color: $font-color-dark;
  125. font-weight: bold;
  126. background-repeat: no-repeat;
  127. background-position: center;
  128. }
  129. .text {
  130. color: $font-color-light;
  131. }
  132. }
  133. .row-box {
  134. margin-top: 30rpx;
  135. padding: 20rpx 30rpx;
  136. background: #fff;
  137. .title {
  138. font-size: $font-base + 2rpx;
  139. color: $font-color-dark;
  140. }
  141. .row {
  142. display: flex;
  143. align-items: center;
  144. position: relative;
  145. height: 80rpx;
  146. .tit {
  147. flex-shrink: 0;
  148. width: 40rpx;
  149. font-size: 30rpx;
  150. color: $font-color-dark;
  151. }
  152. .input {
  153. flex: 1;
  154. font-size: 30rpx;
  155. color: $font-color-dark;
  156. }
  157. .iconlocation {
  158. font-size: 36rpx;
  159. color: $font-color-light;
  160. }
  161. .buttom {
  162. color: $font-color-spec;
  163. font-size: $font-base;
  164. }
  165. }
  166. }
  167. .add-btn {
  168. &.modified {
  169. color: #ffffff;
  170. }
  171. &.up {
  172. background: linear-gradient(90deg, #bb9159, #e6c79d);
  173. color: #fff;
  174. }
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. width: 690rpx;
  179. height: 80rpx;
  180. margin: 0 auto;
  181. margin-top: 30rpx;
  182. font-size: $font-lg;
  183. border-radius: 10rpx;
  184. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  185. }
  186. .list {
  187. padding-left: 30rpx;
  188. margin-top: 30rpx;
  189. background-color: #ffffff;
  190. .box {
  191. display: flex;
  192. align-items: center;
  193. width: 100%;
  194. height: 120rpx;
  195. border-bottom: 1px solid $border-color-light;
  196. .icon {
  197. font-size: 48rpx;
  198. padding-right: 20rpx;
  199. .icon-img {
  200. height: 50rpx;
  201. width: 50rpx;
  202. }
  203. }
  204. .iconweixin1 {
  205. color: #18bf16;
  206. }
  207. .iconzhifubao {
  208. color: #08aaec;
  209. }
  210. .title-box {
  211. flex-grow: 1;
  212. text-align: left;
  213. .title {
  214. font-size: $font-base + 2rpx;
  215. color: $font-color-base;
  216. }
  217. .node {
  218. font-size: $font-sm;
  219. color: $font-color-light;
  220. }
  221. }
  222. }
  223. }
  224. /deep/ .uni-radio-input {
  225. width: 45rpx;
  226. height: 45rpx;
  227. }
  228. .row {
  229. display: flex;
  230. align-items: center;
  231. position: relative;
  232. padding: 0 30upx;
  233. height: 110upx;
  234. background: #fff;
  235. .tit {
  236. flex-shrink: 0;
  237. width: 250upx;
  238. font-size: 30upx;
  239. color: $font-color-dark;
  240. }
  241. .input {
  242. flex: 1;
  243. font-size: 30upx;
  244. color: $font-color-dark;
  245. }
  246. .iconlocation {
  247. font-size: 36upx;
  248. color: $font-color-light;
  249. }
  250. }
  251. .tip {
  252. padding: 20rpx;
  253. color: #fd3b39;
  254. }
  255. </style>