xfjfzz.vue 7.1 KB

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