details.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="container">
  3. <view class="logo"><image :src="moneyData.logo"></image></view>
  4. <view class="select-box flex_item">
  5. <view @tap="handleTap('picker')">{{ title }}</view>
  6. <lb-picker
  7. ref="picker"
  8. v-model="value"
  9. mode="selector"
  10. :list="typeList"
  11. :dataset="{ name: 'type' }"
  12. @change="handleChange"
  13. @confirm="handleConfirm"
  14. @cancel="handleCancel"
  15. ></lb-picker>
  16. <image src="../../static/img/xiaj.png"></image>
  17. </view>
  18. <view class="list" v-show="list.length > 0">
  19. <view class="list-box" v-for="(ls, index) in list" :key="index" @click="nav(index)">
  20. <view class="flex">
  21. <view class="list-tpl flex_item">
  22. <image src="../../static/img/qian.png"></image>
  23. <view class="tpl-name">{{ ls.title }}</view>
  24. </view>
  25. <view class="num clamp" v-if="ls.pm === 0">- {{ ls.number }}</view>
  26. <view class="num clamp" v-else>+ {{ ls.number }}</view>
  27. </view>
  28. <view class="tpl-time" v-if="ls.status == 1">{{ ls.add_time }}</view>
  29. <view class="tpl-time" v-if="ls.status == 0">待发放</view>
  30. </view>
  31. </view>
  32. <u-loadmore :status="loadType"></u-loadmore>
  33. <view class="empty-box" v-show="list.length == 0"><u-empty></u-empty></view>
  34. <view class="flex submit-box">
  35. <view class="submit" @click="recharge" v-if="moneyData.isTi">充币</view>
  36. <view class="tip" v-if="moneyData.type==1"></view>
  37. <view class="submit" @click="withdraw" v-if="moneyData.type==1">提币</view>
  38. </view>
  39. <uni-popup ref="mation" type="center">
  40. <view class="popup">
  41. <view class="cancel flex" @click="close2"><view class="tip">x</view></view>
  42. <view class="list-boxs">
  43. <view class="textBox flex">
  44. <view class="font">交易前:</view>
  45. <view class="number">{{ before * 1 }} {{ moneyData.code }}</view>
  46. </view>
  47. <view class="xian"></view>
  48. <view class="textBox flex">
  49. <view class="font">交易额:</view>
  50. <view class="number">{{ pm }}{{ number * 1 }} {{ moneyData.code }}</view>
  51. </view>
  52. <view class="xian"></view>
  53. <view class="textBox flex">
  54. <view class="font">交易后:</view>
  55. <view class="number">{{ balance * 1 }} {{ moneyData.code }}</view>
  56. </view>
  57. <view class="xian"></view>
  58. <scroll-view scroll-y="true" class="textBox">
  59. <view class="font">流水详情:</view>
  60. <view class="text">{{ text }}</view>
  61. </scroll-view>
  62. </view>
  63. </view>
  64. </uni-popup>
  65. </view>
  66. </template>
  67. <script>
  68. import { moneyLog, recharge, wallet } from '@/api/finance.js';
  69. import LbPicker from '@/components/lb-picker';
  70. export default {
  71. components: {
  72. LbPicker
  73. },
  74. data() {
  75. return {
  76. title: '筛选',
  77. type: '',//当前筛选的类型查询用
  78. value: '',//当前选中的类型名称
  79. typeList: [],//记录列表
  80. list: [],//历史记录列表
  81. // num: '',//充值金额
  82. moneyTypeList: [],
  83. text: '',//当前选中的流水详情
  84. balance: '',//当前选中的流水金额
  85. before: '',//交易前金额
  86. number: '',//当前选中的弹窗交易金额
  87. pm: '',
  88. less: '',
  89. page: 1,
  90. limit: 10,
  91. loadType:'loadmore',
  92. isLast: true,
  93. name: '', //币名称
  94. moneyData: {
  95. code: '',
  96. money: '',
  97. name: '',
  98. logo: '',
  99. type:'',
  100. }
  101. };
  102. },
  103. onReachBottom(){
  104. this.getdata();
  105. },
  106. onLoad(option) {
  107. this.name = option.name;
  108. this.moneyType();
  109. this.loadData();
  110. },
  111. onShow() {},
  112. methods: {
  113. async loadData() {
  114. let obj = this;
  115. uni.showLoading({
  116. title: '加载中'
  117. });
  118. this.getdata()
  119. },
  120. getdata(){
  121. let obj = this;
  122. if(obj.loadType == 'nomore'){
  123. return
  124. }
  125. if(obj.loadType == "loading"){
  126. return
  127. }
  128. obj.loadType = "loading"
  129. moneyLog(
  130. {
  131. page: obj.page,
  132. limit: obj.limit,
  133. type: obj.type
  134. },
  135. obj.name
  136. ).then(({ data }) => {
  137. obj.typeList = data.type_list;
  138. obj.typeList.unshift({
  139. title:'全部',
  140. type:''
  141. })
  142. obj.list = obj.list.concat(data.list);
  143. console.log(obj.list);
  144. if(data.list.length == obj.limit){
  145. obj.loadType = 'loadmore';
  146. obj.page++
  147. }else {
  148. obj.loadType = 'nomore'
  149. }
  150. uni.hideLoading();
  151. });
  152. },
  153. // 所有币种
  154. async moneyType() {
  155. let obj = this;
  156. wallet({}).then(({ data }) => {
  157. const dat = data.back[this.name];
  158. obj.moneyData.logo = dat.LOGO;
  159. obj.moneyData.name = dat.name;
  160. obj.moneyData.code = dat.code;
  161. obj.moneyData.money = dat.money.money;
  162. obj.moneyData.type = +dat.can_cash
  163. if(dat.money.address){
  164. obj.moneyData.isTi = true
  165. }else {
  166. obj.moneyData.isTi = false
  167. }
  168. console.log(obj.moneyData)
  169. });
  170. },
  171. selectOne(options) {
  172. this.name = options.name;
  173. this.moneyData.code = options.code;
  174. },
  175. useOutClickSide() {
  176. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  177. },
  178. handleTap(name) {
  179. this.$refs[name].show();
  180. },
  181. handleChange(e) {
  182. // this.title = e.item.title;
  183. // this.type = e.item.type;
  184. },
  185. handleConfirm(e) {
  186. this.title = e.item.title;
  187. this.type = e.item.type;
  188. this.loadData();
  189. },
  190. handleCancel(e) {},
  191. // 充币按钮跳转页面
  192. recharge() {
  193. uni.navigateTo({
  194. url:'/pages/assets/recharge'
  195. })
  196. },
  197. withdraw() {
  198. uni.navigateTo({
  199. url:'/pages/assets/withdraw?name=' + this.name
  200. })
  201. },
  202. close() {
  203. this.$refs.popup.close();
  204. },
  205. navTo(url) {
  206. uni.navigateTo({
  207. url
  208. });
  209. },
  210. nav(index) {
  211. const obj = this;
  212. obj.text = obj.list[index].mark;
  213. obj.balance = obj.list[index].balance;
  214. obj.number = obj.list[index].number;
  215. if (obj.list[index].pm == 1) {
  216. obj.pm = '+';
  217. obj.before = obj.subNum(obj.balance, obj.number);
  218. } else {
  219. obj.pm = '-';
  220. obj.before = this.addNum(obj.balance, obj.number);
  221. }
  222. this.$refs.mation.open();
  223. },
  224. addNum(num1, num2) {
  225. let sq1, sq2, multiple;
  226. try {
  227. sq1 = num1.toString().split('.')[1].length;
  228. } catch (e) {
  229. sq1 = 0;
  230. }
  231. try {
  232. sq2 = num2.toString().split('.')[1].length;
  233. } catch (e) {
  234. sq2 = 0;
  235. }
  236. multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
  237. return (num1 * multiple + num2 * multiple) / multiple;
  238. },
  239. close2() {
  240. this.$refs.mation.close();
  241. },
  242. subNum(num1, num2) {
  243. let sq1, sq2, multiple;
  244. try {
  245. sq1 = num1.toString().split('.')[1].length;
  246. } catch (e) {
  247. sq1 = 0;
  248. }
  249. try {
  250. sq2 = num2.toString().split('.')[1].length;
  251. } catch (e) {
  252. sq2 = 0;
  253. }
  254. multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
  255. return (num1 * multiple - num2 * multiple) / multiple;
  256. }
  257. }
  258. };
  259. </script>
  260. <style lang="scss">
  261. page {
  262. min-height: 100%;
  263. background-color: #ffffff;
  264. .container {
  265. width: 100%;
  266. padding: 60rpx 30rpx 120rpx 30rpx;
  267. }
  268. }
  269. .logo {
  270. text-align: center;
  271. image {
  272. width: 119rpx;
  273. height: 119rpx;
  274. }
  275. }
  276. .select-box {
  277. position: absolute;
  278. right: 0;
  279. padding: 30rpx 30rpx;
  280. font-size: 32rpx;
  281. font-weight: 500;
  282. color: #333333;
  283. image {
  284. width: 21rpx;
  285. height: 11rpx;
  286. margin-left: 15rpx;
  287. }
  288. .select-name {
  289. padding-right: 15rpx;
  290. }
  291. }
  292. .list {
  293. margin-top: 120rpx;
  294. }
  295. .list-box {
  296. padding: 60rpx 0rpx 30rpx 0rpx;
  297. font-size: 30rpx;
  298. font-weight: 400;
  299. color: #333333;
  300. .tpl-time {
  301. font-size: 24rpx;
  302. font-weight: 400;
  303. color: #999999;
  304. width: 100%;
  305. text-align: right;
  306. padding-top: 25rpx;
  307. }
  308. .list-tpl {
  309. image {
  310. width: 39rpx;
  311. height: 43rpx;
  312. }
  313. .tpl-name {
  314. padding: 0rpx 15rpx 0rpx 30rpx;
  315. }
  316. }
  317. .num {
  318. font-size: 36rpx;
  319. font-weight: 400;
  320. color: #fb3a2f;
  321. width: 50%;
  322. text-align: right;
  323. }
  324. }
  325. .empty-box {
  326. width: 100%;
  327. height: 500rpx;
  328. padding-top: 200rpx;
  329. }
  330. .submit-box {
  331. position: fixed;
  332. bottom: 0;
  333. left: 0;
  334. width: 100%;
  335. background: linear-gradient(90deg, #60BAB0, #45969B);
  336. color: #ffffff;
  337. text-align: center;
  338. .submit {
  339. padding: 20rpx 20%;
  340. flex-grow: 1;
  341. }
  342. .tip {
  343. width: 2rpx;
  344. height: 37rpx;
  345. background: #ffffff;
  346. }
  347. }
  348. //弹窗
  349. .popup {
  350. background-color: #ffffff;
  351. border-radius: 25rpx;
  352. font-size: 30rpx;
  353. .cancel {
  354. text-align: center;
  355. width: 100%;
  356. line-height: 60rpx;
  357. .tip {
  358. background-color: #5771df;
  359. color: #ffffff;
  360. width: 70rpx;
  361. height: 70rpx;
  362. border-top-right-radius: 25rpx;
  363. }
  364. }
  365. .list-boxs {
  366. padding: 0rpx 80rpx;
  367. .password {
  368. padding: 50rpx 0rpx;
  369. width: 100%;
  370. input {
  371. width: 70%;
  372. height: 80rpx;
  373. border: 2rpx solid #999999;
  374. padding-left: 25rpx;
  375. box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
  376. border-radius: 11rpx;
  377. }
  378. }
  379. .confirm-btn {
  380. padding-bottom: 120rpx;
  381. padding-top: 30rpx;
  382. text {
  383. background-color: #5771df;
  384. color: #ffffff;
  385. width: 70%;
  386. text-align: center;
  387. padding: 25rpx 90rpx;
  388. border-radius: 15rpx;
  389. }
  390. }
  391. }
  392. }
  393. .popup {
  394. height: 618rpx;
  395. background: #ffffff;
  396. box-shadow: 3rpx 3rpx 6rpx 0rpx rgba(31, 31, 31, 0.17);
  397. border-radius: 40rpx;
  398. width: 700rpx;
  399. .cancel {
  400. text-align: center;
  401. width: 100%;
  402. line-height: 60rpx;
  403. position: relative;
  404. .tip {
  405. color: #000000;
  406. width: 70rpx;
  407. height: 70rpx;
  408. position: absolute;
  409. top: 0;
  410. right: 0;
  411. background-color: #fff;
  412. }
  413. }
  414. .list-boxs {
  415. width: 90%;
  416. margin: 0 auto;
  417. margin-top: 100rpx;
  418. .textBox {
  419. padding: 24rpx 18rpx;
  420. .font {
  421. font-size: 28rpx;
  422. font-family: PingFang SC;
  423. font-weight: bold;
  424. color: #4f4f4f;
  425. }
  426. .number {
  427. font-size: 28rpx;
  428. font-family: PingFang SC;
  429. font-weight: bold;
  430. color: #fb3a2f;
  431. }
  432. .text {
  433. text-indent: 2em;
  434. font-size: 28rpx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. color: #4f4f4f;
  438. }
  439. }
  440. .xian {
  441. width: 100%;
  442. height: 1px;
  443. background: #e7dfe8;
  444. }
  445. }
  446. }
  447. </style>