withdmoenys.vue 7.9 KB

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