details.vue 8.7 KB

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