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

  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}}
  119. </view>
  120. </view>
  121. </view>
  122. </u-modal>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. agentAccountInfo,
  128. agentFillAlipayAccount,
  129. agentWithdraw,
  130. publicSysConfig
  131. } from '../../common/api.js'
  132. export default {
  133. data() {
  134. return {
  135. accountInfo: {},
  136. isInputForm: false,
  137. inputAlipayAccount: '',
  138. inputAlipayName: '',
  139. isWithdrawForm: false,
  140. inputAmount: '',
  141. sysConfig: {}
  142. }
  143. },
  144. computed: {
  145. calcFee() {
  146. if (!this.inputAmount || isNaN(this.inputAmount)) {
  147. return '--';
  148. }
  149. if (!this.sysConfig.withdraw_fee_rate) {
  150. return '--';
  151. }
  152. let fee = (this.inputAmount * this.sysConfig.withdraw_fee_rate / 100).toFixed(2);
  153. return fee;
  154. },
  155. calcReceiveAmount() {
  156. if (!this.inputAmount || isNaN(this.inputAmount)) {
  157. return '--';
  158. }
  159. if (!this.sysConfig.withdraw_fee_rate) {
  160. return '--';
  161. }
  162. let fee = this.calcFee;
  163. let receiveAmount = (this.inputAmount - parseFloat(fee)).toFixed(2);
  164. return receiveAmount;
  165. }
  166. },
  167. onLoad() {
  168. this.getAccountInfo();
  169. this.getSysConfig();
  170. },
  171. methods: {
  172. getAccountInfo() {
  173. agentAccountInfo().then(data => this.accountInfo = data)
  174. },
  175. saveAlipayAccount() {
  176. agentFillAlipayAccount({
  177. alipay_account: this.inputAlipayAccount,
  178. alipay_name: this.inputAlipayName,
  179. }).then(() => {
  180. this.getAccountInfo()
  181. this.isInputForm = false
  182. })
  183. },
  184. showInputForm(flag) {
  185. this.isInputForm = true
  186. if (flag == 2) {
  187. this.inputAlipayAccount = this.accountInfo.alipay_account
  188. this.inputAlipayName = this.accountInfo.alipay_name
  189. }
  190. // uni.navigateTo({
  191. // url: '/pages/account-opened/account-opened'
  192. // });
  193. },
  194. showWithdrawForm() {
  195. this.isWithdrawForm = true
  196. this.inputAmount = this.accountInfo.wallet_balance
  197. },
  198. confirmWithdraw() {
  199. agentWithdraw({
  200. amount: this.inputAmount
  201. }).then(() => {
  202. this.getAccountInfo()
  203. this.isWithdrawForm = false
  204. })
  205. },
  206. cashManager() {
  207. uni.navigateTo({
  208. url: '/pages/history/history'
  209. });
  210. },
  211. getSysConfig() {
  212. publicSysConfig().then(data => this.sysConfig = data)
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. .uni-page-body {
  219. background: #f7f7f7;
  220. }
  221. .agent-content {
  222. position: relative;
  223. width: 100%;
  224. height: 1400rpx;
  225. background: url(../../static/page/withdrawal-management-bg.png) no-repeat top center;
  226. background-size: 100% 414rpx;
  227. box-sizing: border-box;
  228. .ag-sign {
  229. position: absolute;
  230. right: 0;
  231. top: 0;
  232. width: 150rpx;
  233. height: 60rpx;
  234. line-height: 60rpx;
  235. padding-left: 40rpx;
  236. border-top-left-radius: 30rpx;
  237. border-bottom-left-radius: 30rpx;
  238. color: #fff;
  239. font-size: 12px;
  240. background: #FCC565;
  241. box-sizing: border-box;
  242. cursor: pointer;
  243. }
  244. .agent-top {
  245. text-align: center;
  246. padding-top: 40rpx;
  247. .ag-num {
  248. display: flex;
  249. justify-content: center;
  250. padding-top: 20rpx;
  251. color: #fff;
  252. .au-font {
  253. margin-top: 40rpx;
  254. font-size: 14px;
  255. margin-right: 10rpx;
  256. line-height: 1.5;
  257. }
  258. .au-num {
  259. font-size: 30px;
  260. font-weight: bold;
  261. }
  262. }
  263. .age-font {
  264. margin-top: 10rpx;
  265. font-size: 16px;
  266. line-height: 1.5;
  267. color: #fff;
  268. }
  269. .age-line {
  270. margin: 20rpx auto 0;
  271. width: 200rpx;
  272. height: 2rpx;
  273. img {
  274. display: block;
  275. margin: 0 auto;
  276. }
  277. }
  278. .age-wait {
  279. margin-top: 20rpx;
  280. color: #fff;
  281. font-size: 14px;
  282. }
  283. .age-linemore {}
  284. .age-mnum {
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. margin-top: 20rpx;
  289. .mtext {
  290. color: #fff;
  291. font-size: 14px;
  292. margin: 0 20rpx;
  293. line-height: 1.5;
  294. }
  295. .mline {
  296. height: 28rpx;
  297. width: 2rpx;
  298. background: #5da8ff;
  299. }
  300. }
  301. }
  302. .ag-paylist {
  303. padding-left: 30rpx;
  304. padding-right: 30rpx;
  305. margin-top: 36rpx;
  306. background: #fff;
  307. .agp-item {
  308. display: flex;
  309. justify-content: space-between;
  310. height: 100rpx;
  311. .agp-title {
  312. .zhifubao {
  313. padding-left: 55rpx;
  314. height: 100rpx;
  315. line-height: 100rpx;
  316. color: #454545;
  317. font-size: 14px;
  318. font-weight: bold;
  319. background: url(../../static/page/payment-icon.png) no-repeat left center;
  320. background-size: 40rpx 40rpx;
  321. }
  322. }
  323. .agp-detail {
  324. .agp-make {
  325. padding-right: 30rpx;
  326. height: 100rpx;
  327. line-height: 100rpx;
  328. color: #999;
  329. font-size: 12px;
  330. background: url(../../static/page/open-icon.png) no-repeat right center;
  331. background-size: 14rpx 24rpx;
  332. cursor: pointer;
  333. }
  334. }
  335. }
  336. }
  337. .apt-main {
  338. padding: 10rpx 0;
  339. .apm-cell {
  340. display: flex;
  341. justify-content: space-between;
  342. .am-title {
  343. height: 70rpx;
  344. line-height: 70rpx;
  345. color: 454545;
  346. font-size: 12px;
  347. }
  348. .am-value {
  349. display: flex;
  350. justify-content: flex-end;
  351. height: 70rpx;
  352. line-height: 70rpx;
  353. .mphone {
  354. margin-right: 20rpx;
  355. font-size: 12px;
  356. color: #454545;
  357. }
  358. .mlink {
  359. font-size: 12px;
  360. color: #32A2FC;
  361. }
  362. .mnum {
  363. font-size: 14px;
  364. color: 454545;
  365. font-weight: bold;
  366. }
  367. }
  368. }
  369. }
  370. .u-border-bottom,
  371. .u-border-top {
  372. border-color: #eee !important;
  373. }
  374. .apt-btn {
  375. display: flex;
  376. justify-content: flex-end;
  377. padding: 30rpx 0;
  378. .cashbtn {
  379. width: 110rpx;
  380. height: 48rpx;
  381. text-align: center;
  382. line-height: 48rpx;
  383. color: #fff;
  384. font-size: 12px;
  385. background: #1783FF;
  386. border-radius: 100rpx;
  387. }
  388. .savebtn {
  389. width: 110rpx;
  390. height: 48rpx;
  391. text-align: center;
  392. line-height: 48rpx;
  393. color: #fff;
  394. font-size: 12px;
  395. background: #00aaff;
  396. border-radius: 100rpx;
  397. }
  398. }
  399. }
  400. .withdraw-form {
  401. font-size: 28rpx;
  402. .tips {
  403. margin-top: 20rpx;
  404. .tips-item {
  405. margin-top: 6rpx;
  406. }
  407. }
  408. }
  409. </style>