xfjfzz.vue 7.0 KB

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