index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div class="page">
  3. <div
  4. v-if="!loading && !account"
  5. class="go-bind"
  6. @click="jump('/pages/wallet/bind')"
  7. >
  8. 您还未绑定账号,请先绑定绑定账号
  9. </div>
  10. <block v-if="!loading && account">
  11. <!-- <block> -->
  12. <div class="info card">
  13. <h1 class="tit">账号信息</h1>
  14. <ul class="info-list">
  15. <li class="item">
  16. <div class="key">姓名:</div>
  17. <div class="value">{{ account.name }}</div>
  18. </li>
  19. <li class="item">
  20. <div class="key">微信号:</div>
  21. <div class="value">{{ account.wechat }}</div>
  22. </li>
  23. <li class="item">
  24. <div class="key">银行:</div>
  25. <div class="value">{{ account.bank }}</div>
  26. </li>
  27. <li class="item">
  28. <div class="key">开户行:</div>
  29. <div class="value">{{ account.bankBranch }}</div>
  30. </li>
  31. <li class="item">
  32. <div class="key">卡号:</div>
  33. <div class="value">{{ account.bankAccount }}</div>
  34. </li>
  35. </ul>
  36. </div>
  37. <div class="money card">
  38. <h1 class="tit">可提现金额</h1>
  39. <div class="money-num">
  40. <div class="num">¥{{ balance / 100 }}</div>
  41. <div class="view" @click="jump('/pages/wallet/bill')">
  42. 查看账单
  43. </div>
  44. </div>
  45. <p class="tip">最低提现2元,单日上线20000元</p>
  46. <div class="input">
  47. <input type="digit" v-model="formVal" placeholder="¥0" />
  48. </div>
  49. <p class="tip tip-color">提现金额超出总金额,请重新填写</p>
  50. <button type="button" class="btn" @click="withdrawal">
  51. 申请提现
  52. </button>
  53. </div>
  54. <div class="card record">
  55. <h1 class="tit">提现记录</h1>
  56. <ul class="table">
  57. <li class="row">
  58. <div class="item">申请时间</div>
  59. <div class="item">备注</div>
  60. <div class="item">金额</div>
  61. <div class="item">状态</div>
  62. </li>
  63. <li
  64. class="row"
  65. v-for="item of withdrawalList"
  66. :key="item.id"
  67. >
  68. <div class="item">
  69. {{ item.applyTime | dateFormat("yyyy/MM/dd") }}
  70. </div>
  71. <div class="item">
  72. {{ item.remark }}
  73. </div>
  74. <div class="item">
  75. {{ item.amount / 100 }}
  76. </div>
  77. <div class="item">
  78. {{ item.status | status }}
  79. </div>
  80. </li>
  81. </ul>
  82. </div>
  83. </block>
  84. <uni-popup ref="popup" type="dialog">
  85. <uni-popup-dialog
  86. mode="input"
  87. :title="'提现备注'"
  88. :content="false"
  89. :inputType="'text'"
  90. placeholder="请输入备注"
  91. @confirm="popupConfirm"
  92. ></uni-popup-dialog>
  93. </uni-popup>
  94. </div>
  95. </template>
  96. <script>
  97. import MyImage from "../../components/image/index";
  98. import uniPopupDialog from "../../components/uni-popup/uni-popup-dialog";
  99. import uniPopup from "../../components/uni-popup/uni-popup";
  100. export default {
  101. name: "",
  102. components: { MyImage, uniPopupDialog, uniPopup },
  103. // 数据
  104. data() {
  105. return {
  106. formVal: "",
  107. withdrawalPageIndex: 1,
  108. withdrawalList: [],
  109. withdrawalTotal: "",
  110. account: null,
  111. balance: 0,
  112. loading: false,
  113. };
  114. },
  115. filters: {
  116. status(v) {
  117. let obj = {
  118. 0: "审核中",
  119. 1: "待打款",
  120. 2: "已完成",
  121. 3: "未通过",
  122. 4: "打款失败",
  123. };
  124. let str = obj[v];
  125. return str || "";
  126. },
  127. },
  128. onLoad() {},
  129. async onShow() {
  130. this.getWithdrawalInfo();
  131. },
  132. // onPullDownRefresh() {
  133. // this.getList();
  134. // },
  135. // 函数
  136. methods: {
  137. getWithdrawalInfo() {
  138. uni.showLoading({
  139. title: "加载中...",
  140. });
  141. this.loading = true;
  142. this.api.get("/User/GetWithdrawalInfo").then((res) => {
  143. uni.hideLoading();
  144. this.loading = false;
  145. if (!res.data.account) {
  146. // this.router.push('/pages/wallet/bind');
  147. // return;
  148. }
  149. this.account = res.data.account;
  150. this.balance = res.data.balance;
  151. this.withdrawalList = res.data.withdrawalList.data;
  152. });
  153. },
  154. withdrawal() {
  155. if (!this.formVal) {
  156. return this.fn.showToast("请输入提现金额");
  157. }
  158. if (this.formVal * 100 > this.balance) {
  159. return this.fn.showToast(
  160. "提现金额不能大于" + this.balance / 100 + "元"
  161. );
  162. }
  163. this.$refs.popup.open({
  164. type: "dialog",
  165. });
  166. },
  167. popupConfirm(done, value) {
  168. if (!value) {
  169. return this.fn.showToast("请输入提现备注");
  170. }
  171. console.log(this.formVal, value);
  172. uni.showLoading({
  173. title: "提交中...",
  174. });
  175. let data = {
  176. amount: this.formVal * 100,
  177. remark: value,
  178. };
  179. this.api
  180. .post("/User/Withdrawal", data, { pass: true })
  181. .then((res) => {
  182. this.submitLoading = false;
  183. uni.hideLoading();
  184. if (res.success) {
  185. // 刷新页面数据
  186. this.formVal = "";
  187. this.getWithdrawalInfo();
  188. this.fn.showToast("提现成功");
  189. } else {
  190. this.fn.showModal({
  191. content: "错误信息:" + res.message,
  192. showCancel: false,
  193. });
  194. }
  195. });
  196. done();
  197. },
  198. },
  199. // 数据计算
  200. computed: {
  201. user() {
  202. return this.$store.state.user.user;
  203. },
  204. },
  205. // 数据监听
  206. watch: {},
  207. };
  208. </script>
  209. <style lang="scss" scoped>
  210. .card {
  211. margin: px(40) px(40);
  212. border: 1px solid #efefef;
  213. padding: px(40);
  214. background-color: #fff;
  215. .tit {
  216. font-size: px(44);
  217. font-weight: bold;
  218. padding-bottom: px(20);
  219. }
  220. }
  221. .info {
  222. .item {
  223. margin-top: px(20);
  224. font-size: px(44);
  225. display: flex;
  226. align-items: start;
  227. line-height: px(60);
  228. .key {
  229. margin-right: px(20);
  230. flex-shrink: 0;
  231. color: #666;
  232. }
  233. }
  234. }
  235. .money {
  236. .money-num {
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. padding: px(20) 0;
  241. .num {
  242. font-size: px(56);
  243. color: red;
  244. }
  245. .view {
  246. width: px(340);
  247. height: px(88);
  248. border: 1px solid rgb(0, 188, 38);
  249. color: rgb(0, 188, 38);
  250. font-size: px(44);
  251. text-align: center;
  252. line-height: px(88);
  253. border-radius: px(10);
  254. }
  255. }
  256. .input {
  257. margin: px(30) 0;
  258. input {
  259. height: px(100);
  260. padding: 0 px(20);
  261. border: 1px solid #ededed;
  262. }
  263. }
  264. .tip {
  265. font-size: px(40);
  266. color: #999;
  267. &.top-color {
  268. color: rgb(255, 173, 129);
  269. }
  270. }
  271. .btn {
  272. margin-top: px(40);
  273. background-color: rgb(0, 188, 38);
  274. color: #fff;
  275. border: none;
  276. }
  277. }
  278. .record {
  279. .table {
  280. margin-top: px(30);
  281. .row {
  282. display: flex;
  283. border-right: 1px solid #efefef;
  284. border-bottom: 1px solid #efefef;
  285. }
  286. .item {
  287. border-left: 1px solid #efefef;
  288. border-top: 1px solid #efefef;
  289. width: 25%;
  290. flex-shrink: 0;
  291. font-size: px(42);
  292. // text-align: center;
  293. padding: px(20);
  294. @include omits(4);
  295. &:nth-child(1){
  296. width: 30%;
  297. }
  298. &:nth-child(2){
  299. width: 30%;
  300. }
  301. &:nth-child(3){
  302. width: 20%;
  303. }
  304. &:nth-child(4){
  305. width: 20%;
  306. }
  307. }
  308. }
  309. }
  310. .go-bind {
  311. margin: px(40);
  312. border: 1px solid #f1f1f1;
  313. border-radius: px(10);
  314. display: flex;
  315. align-items: center;
  316. justify-content: center;
  317. background-color: #fff;
  318. min-height: px(300);
  319. font-size: px(46);
  320. }
  321. </style>