yjzz.vue 7.3 KB

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