You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

450 lines
9.4 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <view class="app-container" style="background-color: #f7f7f7;">
  3. <view class="agent-content">
  4. <view class="ag-sign" @click="cashManager">
  5. 提现历史
  6. </view>
  7. <view class="agent-top">
  8. <view class="ag-num">
  9. <view class="au-font">
  10. </view>
  11. <view class="au-num">
  12. {{accountInfo.wallet_balance}}
  13. </view>
  14. </view>
  15. <view class="age-font">
  16. 可提现
  17. </view>
  18. <view class="age-line">
  19. <img src="../../static/page/line-style.png" style="width: 200rpx;height: 2rpx;" alt="" srcset="" />
  20. </view>
  21. <view class="age-wait">
  22. 总提现{{accountInfo.withdraw_total}}
  23. </view>
  24. <view class="age-linemore">
  25. <img src="../../static/page/divider-style.png" style="width: 690rpx;height: 2rpx;" alt="" srcset="" />
  26. </view>
  27. <div class="age-mnum">
  28. <view class="mtext">
  29. 待入账{{accountInfo.waiting_amount}}
  30. </view>
  31. <view class="mline">
  32. </view>
  33. <view class="mtext">
  34. 提现中{{accountInfo.withdrawing_amount}}
  35. </view>
  36. </div>
  37. </view>
  38. <view class="ag-paylist">
  39. <view class="agp-item">
  40. <view class="agp-title">
  41. <view class="zhifubao">
  42. 支付宝账户
  43. </view>
  44. </view>
  45. <view class="agp-detail" v-if="!accountInfo.alipay_account">
  46. <view class="agp-make" @click="showInputForm(1)">
  47. 去开通
  48. </view>
  49. </view>
  50. </view>
  51. <template v-if="isInputForm">
  52. <view class="apt-main u-border-top u-border-bottom" v-if="isInputForm">
  53. <view class="apm-cell">
  54. <view class="am-title">
  55. 支付宝账号
  56. </view>
  57. <view class="am-value" style="width:70%;">
  58. <u--input placeholder="绑定的手机号或邮箱" border="surround" v-model="inputAlipayAccount"></u--input>
  59. </view>
  60. </view>
  61. <view class="apm-cell">
  62. <view class="am-title">
  63. 支付宝姓名
  64. </view>
  65. <view class="am-value" style="width:70%;">
  66. <u--input placeholder="账号真实姓名" border="surround" v-model="inputAlipayName"></u--input>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="apt-btn">
  71. <view class="savebtn" @click="saveAlipayAccount">
  72. 保存
  73. </view>
  74. </view>
  75. </template>
  76. <template v-if="accountInfo.alipay_account && !isInputForm">
  77. <view class="apt-main u-border-top u-border-bottom">
  78. <view class="apm-cell">
  79. <view class="am-title">
  80. 提现账户
  81. </view>
  82. <view class="am-value">
  83. <view class="mphone">
  84. {{accountInfo.alipay_account}}
  85. </view>
  86. <view class="mlink" @click="showInputForm(2)">
  87. 修改
  88. </view>
  89. </view>
  90. </view>
  91. <view class="apm-cell">
  92. <view class="am-title">
  93. 可提现金额
  94. </view>
  95. <view class="am-value">
  96. <view class="mnum">
  97. {{accountInfo.wallet_balance}}
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="apt-btn">
  103. <view class="cashbtn" @click="showWithdrawForm">
  104. 提现
  105. </view>
  106. </view>
  107. </template>
  108. </view>
  109. </view>
  110. <u-modal title="确认提现金额" :show="isWithdrawForm" :showCancelButton="true" @confirm="confirmWithdraw"
  111. @cancel="isWithdrawForm=false">
  112. <view class="withdraw-form">
  113. <u--input prefixIcon="¥" placeholder="提现金额" border="surround" v-model="inputAmount"></u--input>
  114. <view class="fee-desc">
  115. 扣手续费{{calcFee}}实际到账{{calcReceiveAmount}}
  116. </view>
  117. <view class="tips">
  118. <view class="tips-item" v-for="(line,index) in sysConfig.withdraw_tips.split('\n')" :key="index">{{line}}</view>
  119. </view>
  120. </view>
  121. </u-modal>
  122. </view>
  123. </template>
  124. <script>
  125. import {
  126. userAccountInfo,
  127. userFillAlipayAccount,
  128. userWithdraw,
  129. publicSysConfig
  130. } from '../../common/api.js'
  131. export default {
  132. data() {
  133. return {
  134. accountInfo: {},
  135. isInputForm: false,
  136. inputAlipayAccount: '',
  137. inputAlipayName: '',
  138. isWithdrawForm: false,
  139. inputAmount: '',
  140. sysConfig: {}
  141. }
  142. },
  143. computed: {
  144. calcFee() {
  145. if (!this.inputAmount || isNaN(this.inputAmount)) {
  146. return '--';
  147. }
  148. if (!this.sysConfig.withdraw_fee_rate) {
  149. return '--';
  150. }
  151. let fee = (this.inputAmount * this.sysConfig.withdraw_fee_rate / 100).toFixed(2);
  152. return fee;
  153. },
  154. calcReceiveAmount() {
  155. if (!this.inputAmount || isNaN(this.inputAmount)) {
  156. return '--';
  157. }
  158. if (!this.sysConfig.withdraw_fee_rate) {
  159. return '--';
  160. }
  161. let fee = this.calcFee;
  162. let receiveAmount = (this.inputAmount - parseFloat(fee)).toFixed(2);
  163. return receiveAmount;
  164. }
  165. },
  166. onLoad() {
  167. this.getAccountInfo();
  168. this.getSysConfig();
  169. },
  170. methods: {
  171. getAccountInfo() {
  172. userAccountInfo().then(data => this.accountInfo = data)
  173. },
  174. saveAlipayAccount() {
  175. userFillAlipayAccount({
  176. alipay_account: this.inputAlipayAccount,
  177. alipay_name: this.inputAlipayName,
  178. }).then(() => {
  179. this.getAccountInfo()
  180. this.isInputForm = false
  181. })
  182. },
  183. showInputForm(flag) {
  184. this.isInputForm = true
  185. if (flag == 2) {
  186. this.inputAlipayAccount = this.accountInfo.alipay_account
  187. this.inputAlipayName = this.accountInfo.alipay_name
  188. }
  189. // uni.navigateTo({
  190. // url: '/pages/account-opened/account-opened'
  191. // });
  192. },
  193. showWithdrawForm() {
  194. this.isWithdrawForm = true
  195. this.inputAmount = this.accountInfo.wallet_balance
  196. },
  197. confirmWithdraw() {
  198. userWithdraw({
  199. amount: this.inputAmount
  200. }).then(() => {
  201. this.getAccountInfo()
  202. this.isWithdrawForm = false
  203. })
  204. },
  205. cashManager() {
  206. uni.navigateTo({
  207. url: '/pages/withdrawal-history/withdrawal-history'
  208. });
  209. },
  210. getSysConfig() {
  211. publicSysConfig().then(data => this.sysConfig = data)
  212. },
  213. }
  214. }
  215. </script>
  216. <style lang="scss">
  217. .uni-page-body {
  218. background: #f7f7f7;
  219. }
  220. .agent-content {
  221. position: relative;
  222. width: 100%;
  223. height: 1400rpx;
  224. background: url(../../static/page/merchant-account-opening-bg.png) no-repeat top center;
  225. background-size: 100% 414rpx;
  226. box-sizing: border-box;
  227. .ag-sign {
  228. position: absolute;
  229. right: 0;
  230. top: 0;
  231. width: 150rpx;
  232. height: 60rpx;
  233. line-height: 60rpx;
  234. padding-left: 40rpx;
  235. border-top-left-radius: 30rpx;
  236. border-bottom-left-radius: 30rpx;
  237. color: #fff;
  238. font-size: 12px;
  239. background: #FCC565;
  240. box-sizing: border-box;
  241. cursor: pointer;
  242. }
  243. .agent-top {
  244. text-align: center;
  245. padding-top: 40rpx;
  246. .ag-num {
  247. display: flex;
  248. justify-content: center;
  249. padding-top: 20rpx;
  250. color: #fff;
  251. .au-font {
  252. margin-top: 40rpx;
  253. font-size: 14px;
  254. margin-right: 10rpx;
  255. line-height: 1.5;
  256. }
  257. .au-num {
  258. font-size: 30px;
  259. font-weight: bold;
  260. }
  261. }
  262. .age-font {
  263. margin-top: 10rpx;
  264. font-size: 16px;
  265. line-height: 1.5;
  266. color: #fff;
  267. }
  268. .age-line {
  269. margin: 20rpx auto 0;
  270. width: 200rpx;
  271. height: 2rpx;
  272. img {
  273. display: block;
  274. margin: 0 auto;
  275. }
  276. }
  277. .age-wait {
  278. margin-top: 20rpx;
  279. color: #fff;
  280. font-size: 14px;
  281. }
  282. .age-linemore {}
  283. .age-mnum {
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. margin-top: 20rpx;
  288. .mtext {
  289. color: #fff;
  290. font-size: 14px;
  291. margin: 0 20rpx;
  292. line-height: 1.5;
  293. }
  294. .mline {
  295. height: 28rpx;
  296. width: 2rpx;
  297. background: #F86E78;
  298. }
  299. }
  300. }
  301. .ag-paylist {
  302. padding-left: 30rpx;
  303. padding-right: 30rpx;
  304. margin-top: 36rpx;
  305. background: #fff;
  306. .agp-item {
  307. display: flex;
  308. justify-content: space-between;
  309. height: 100rpx;
  310. .agp-title {
  311. .zhifubao {
  312. padding-left: 55rpx;
  313. height: 100rpx;
  314. line-height: 100rpx;
  315. color: #454545;
  316. font-size: 14px;
  317. font-weight: bold;
  318. background: url(../../static/page/payment-icon.png) no-repeat left center;
  319. background-size: 40rpx 40rpx;
  320. }
  321. }
  322. .agp-detail {
  323. .agp-make {
  324. padding-right: 30rpx;
  325. height: 100rpx;
  326. line-height: 100rpx;
  327. color: #999;
  328. font-size: 12px;
  329. background: url(../../static/page/open-icon.png) no-repeat right center;
  330. background-size: 14rpx 24rpx;
  331. cursor: pointer;
  332. }
  333. }
  334. }
  335. }
  336. .apt-main {
  337. padding: 10rpx 0;
  338. .apm-cell {
  339. display: flex;
  340. justify-content: space-between;
  341. .am-title {
  342. height: 70rpx;
  343. line-height: 70rpx;
  344. color: 454545;
  345. font-size: 12px;
  346. }
  347. .am-value {
  348. display: flex;
  349. justify-content: flex-end;
  350. height: 70rpx;
  351. line-height: 70rpx;
  352. .mphone {
  353. margin-right: 20rpx;
  354. font-size: 12px;
  355. color: #454545;
  356. }
  357. .mlink {
  358. font-size: 12px;
  359. color: #32A2FC;
  360. }
  361. .mnum {
  362. font-size: 14px;
  363. color: 454545;
  364. font-weight: bold;
  365. }
  366. }
  367. }
  368. }
  369. .u-border-bottom,
  370. .u-border-top {
  371. border-color: #eee !important;
  372. }
  373. .apt-btn {
  374. display: flex;
  375. justify-content: flex-end;
  376. padding: 30rpx 0;
  377. .cashbtn {
  378. width: 110rpx;
  379. height: 48rpx;
  380. text-align: center;
  381. line-height: 48rpx;
  382. color: #fff;
  383. font-size: 12px;
  384. background: #F52F3E;
  385. border-radius: 100rpx;
  386. }
  387. .savebtn {
  388. width: 110rpx;
  389. height: 48rpx;
  390. text-align: center;
  391. line-height: 48rpx;
  392. color: #fff;
  393. font-size: 12px;
  394. background: #00aaff;
  395. border-radius: 100rpx;
  396. }
  397. }
  398. }
  399. .withdraw-form {
  400. font-size: 28rpx;
  401. .tips {
  402. margin-top: 20rpx;
  403. .tips-item {
  404. margin-top: 6rpx;
  405. }
  406. }
  407. }
  408. </style>