price.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view class="content">
  3. <view class="content1">
  4. <view class="row1">
  5. <u-subsection :list="btnList" mode="subsection" :current="curNow" @change="sectionChange">
  6. </u-subsection>
  7. </view>
  8. <view class="row2" v-if="curNow!=2">
  9. <text>{{type}}</text>
  10. </view>
  11. <view class="row3" v-if="curNow==0">
  12. <u-tabs :list="list1" @click="click" keyName="typeId" :current='current' @change='tabChange'></u-tabs>
  13. </view>
  14. </view>
  15. <view class="content2" v-if="curNow==0&&isSHowOther">
  16. <view class="title">
  17. 价格趋势图
  18. </view>
  19. <qiun-data-charts type="line" :opts="opts" :chartData="chartData" :ontouch="true" />
  20. </view>
  21. <view class="content3" v-if="curNow==0&&isSHowOther">
  22. <view class="title">
  23. 价格历史记录
  24. </view>
  25. <mescroll-body v-if="curNow==0" ref="mescrollRef" @init="mescrollInit" @up="upCallback1" :down="downOption"
  26. :up="upOption">
  27. <view class="price-list">
  28. <view class="row-style" style="display: flex;justify-content: space-between;">
  29. <view class="">
  30. 最新价格
  31. </view>
  32. <view class="">
  33. 单位(万元)
  34. </view>
  35. </view>
  36. <view class="row-style" style="display: flex;justify-content: space-between;"
  37. v-for="item in priceList">
  38. <view class="">
  39. {{new Date(item.collection).toLocaleDateString() }}
  40. </view>
  41. <view class="">
  42. {{item.price}}
  43. </view>
  44. </view>
  45. </view>
  46. </mescroll-body>
  47. </view>
  48. <mescroll-body v-if="curNow==1&&isSHowOther" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
  49. :down="downOption" :up="upOption">
  50. <view class="jyjl">
  51. 以下为近期成交数据
  52. </view>
  53. <view v-for="data in dataList" class="row">
  54. <view class="left">
  55. <image :src="data.urlPath" mode="widthFix" class="price-img" @click="fdImg(data.urlPath)"></image>
  56. <u-popup :show="show" @close="close" @open="open" mode="center">
  57. <image :src="selectSrc" mode="widthFix"></image>
  58. </u-popup>
  59. </view>
  60. <view class="right">
  61. <view class="right-row" style="color:#fca87d;font-size:20px;font-weight:700">
  62. ¥{{data.price}}万元
  63. </view>
  64. <view class="right-row">
  65. 名称:{{data.grade}}
  66. </view>
  67. <view class="right-row">
  68. 编号:{{data.number}}
  69. </view>
  70. <view class="right-row">
  71. 状态:{{data.status}}
  72. </view>
  73. <view class="right-row">
  74. 交易日期:
  75. <text
  76. style="color:#fca87d;font-size:12px">{{new Date(data.collection).toLocaleDateString() }}</text>
  77. </view>
  78. </view>
  79. </view>
  80. </mescroll-body>
  81. <view class="bz" v-if="curNow==2">
  82. <view class="title">
  83. 存量/增量
  84. </view>
  85. <view class="row">
  86. <view class="left">
  87. 系列
  88. </view>
  89. <view class="right">
  90. {{nowItem.series}}
  91. </view>
  92. </view>
  93. <view class="row">
  94. <view class="left">
  95. 品名
  96. </view>
  97. <view class="right">
  98. {{nowItem.product}}
  99. </view>
  100. </view>
  101. <view class="row">
  102. <view class="left">
  103. 官网编号
  104. </view>
  105. <view class="right">
  106. {{nowItem.number}}
  107. </view>
  108. </view>
  109. <view class="row">
  110. <view class="left">
  111. 年份
  112. </view>
  113. <view class="right">
  114. {{nowItem.year}}
  115. </view>
  116. </view>
  117. <view class="row">
  118. <view class="left">
  119. 面值
  120. </view>
  121. <view class="right">
  122. {{nowItem.face}}
  123. </view>
  124. </view>
  125. <view class="row">
  126. <view class="left">
  127. 版别
  128. </view>
  129. <view class="right">
  130. {{nowItem.edition}}
  131. </view>
  132. </view>
  133. <view class="row">
  134. <view class="left">
  135. 地区
  136. </view>
  137. <view class="right">
  138. {{nowItem.region}}
  139. </view>
  140. </view>
  141. <view class="row">
  142. <view class="left">
  143. 分值/等级
  144. </view>
  145. <view class="right">
  146. {{nowItem.grade}}
  147. </view>
  148. </view>
  149. <view class="row">
  150. <view class="left">
  151. 同分数量/增量
  152. </view>
  153. <view class="right">
  154. {{nowItem.tongFen}}
  155. </view>
  156. </view>
  157. <view class="row">
  158. <view class="left">
  159. 高分数量
  160. </view>
  161. <view class="right">
  162. {{nowItem.highScores}}
  163. </view>
  164. </view>
  165. <view class="row">
  166. <view class="left">
  167. 收集时间
  168. </view>
  169. <view class="right">
  170. {{nowItem.collection}}
  171. </view>
  172. </view>
  173. <view class="detail-view">
  174. <view class="title">
  175. 详细介绍
  176. </view>
  177. <view class="">
  178. {{nowItem.introduction}}
  179. </view>
  180. <view class="imgList">
  181. <!-- <image :src="item" mode="widthFix" v-for="item in nowItem.urlPath.split(',')" style="width: 50%;">
  182. </image> -->
  183. </view>
  184. </view>
  185. </view>
  186. <u-toast ref="uToast"></u-toast>
  187. </view>
  188. </template>
  189. <script>
  190. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  191. export default {
  192. mixins: [MescrollMixin], // 使用mixin
  193. onLoad() {
  194. this.info = uni.getStorageSync("selectInfo")
  195. // this.list1 = this.info.children
  196. // if (this.info.children.length != 0) {
  197. this.nowItem = this.info
  198. // this.type1 = this.info.series
  199. // this.type2 = this.info.secondName
  200. // this.type3 = this.info.children[1].typeId
  201. // // for (let i = 0; i < this.info.children.length; i++) {
  202. // // }
  203. // }
  204. this.$request.baseRequest('admin.gubi.gubiTypeThree', 'list', {
  205. page: 1,
  206. limit: 1000,
  207. secondId: this.info.id
  208. },
  209. failres => {
  210. console.log('res+++++', failres.errmsg)
  211. this.$refs.uToast.show({
  212. type: 'error',
  213. message: failres.errmsg,
  214. })
  215. uni.hideLoading()
  216. }).then(res => {
  217. uni.hideLoading()
  218. console.log(11)
  219. console.log(res.data.items)
  220. this.list1 = res.data.items
  221. for (let i = 0; i < this.list1.length; i++) {
  222. if (this.list1[i].typeId == '45') {
  223. this.type = this.list1[i].strFlag
  224. this.orderId = this.list1[i].id
  225. this.isSHowOther = true
  226. }
  227. }
  228. // this.typeTwoData = res.data.items
  229. })
  230. },
  231. data() {
  232. return {
  233. current: 1,
  234. isSHowOther: false,
  235. type: '',
  236. selectSrc: '',
  237. show: false,
  238. x: [],
  239. y: [],
  240. type1: '',
  241. type2: '',
  242. type3: '',
  243. orderId: '',
  244. info: {},
  245. downOption: {},
  246. upOption: {
  247. page: {
  248. size: 10 // 每页数据的数量,默认10
  249. },
  250. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  251. empty: {
  252. tip: '暂无相关数据'
  253. }
  254. },
  255. downOption1: {},
  256. upOption1: {
  257. page: {
  258. size: 10 // 每页数据的数量,默认10
  259. },
  260. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  261. empty: {
  262. tip: '暂无相关数据'
  263. }
  264. },
  265. dataList: [{
  266. img1: "",
  267. img2: '',
  268. price: '0.19',
  269. number: '8777',
  270. fVal: '35',
  271. status: '酱彩',
  272. }],
  273. priceList: [{
  274. date: '2022-10-31',
  275. price: '0.27'
  276. },
  277. {
  278. date: '2022-10-31',
  279. price: '0.27'
  280. },
  281. ],
  282. chartData: {},
  283. opts: {
  284. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  285. "#ea7ccc"
  286. ],
  287. padding: [15, 10, 0, 15],
  288. enableScroll: true,
  289. legend: {},
  290. xAxis: {
  291. disableGrid: true,
  292. scrollShow: true,
  293. itemCount: 4
  294. },
  295. yAxis: {
  296. gridType: "dash",
  297. dashLength: 2
  298. },
  299. extra: {
  300. line: {
  301. type: "straight",
  302. width: 2
  303. }
  304. }
  305. },
  306. btnList: ['价格概况', '交易记录', '币种介绍'],
  307. curNow: 0,
  308. list1: []
  309. }
  310. },
  311. methods: {
  312. close() {
  313. this.show = false
  314. // console.log('close');
  315. },
  316. fdImg(src) {
  317. this.selectSrc = src
  318. this.show = true
  319. },
  320. sectionChange(index) {
  321. this.curNow = index;
  322. },
  323. tabChange(val) {
  324. console.log(111)
  325. this.current = val.index;
  326. console.log(val.index)
  327. },
  328. click(item) {
  329. this.orderId = item.id
  330. for (let i = 0; i < this.list1.length; i++) {
  331. if (this.list1[i].typeId == item.typeId) {
  332. this.type = this.list1[i].strFlag
  333. }
  334. }
  335. this.mescroll.resetUpScroll()
  336. },
  337. makeData(val) {
  338. for (let i = 0; i < val.length; i++) {
  339. if (val[i].children) {
  340. for (let j = 0; j < val[i].children.length; j++) {
  341. let _obj = val[i].children[j]
  342. _obj.typeName = val[i].children[j].secondName
  343. val[i].children[j] = _obj
  344. if (val[i].children[j].children) {
  345. for (let k = 0; k < val[i].children[j].children.length; k++) {
  346. let _obj1 = val[i].children[j].children[k]
  347. _obj1.typeName = val[i].children[j].children[k].typeId
  348. val[i].children[j].children[k] = _obj1
  349. }
  350. }
  351. }
  352. }
  353. }
  354. this.listData = val
  355. // console.log(this.data)
  356. },
  357. upCallback1(page) {
  358. this.x = []
  359. this.y = []
  360. this.$request.baseRequest('admin.gubi.gubiPriceHis', 'list', {
  361. pageNum: page.num,
  362. pageSize: page.size,
  363. orderId: this.orderId
  364. }, failres => {
  365. console.log('res+++++', failres.errmsg)
  366. this.$refs.uToast.show({
  367. type: 'error',
  368. message: failres.errmsg,
  369. })
  370. uni.hideLoading()
  371. }).then(res => {
  372. // if (res.errno == 200) {
  373. uni.hideLoading()
  374. let curPageData = res.data.items;
  375. let totalPage = res.data.total;
  376. let curPageLen = curPageData.length;
  377. this.mescroll.endByPage(curPageLen, totalPage);
  378. // this.makeData(res.data)
  379. if (page.num == 1) this.priceList = []; //如果是第一页需手动置空列表
  380. this.priceList = this.priceList.concat(curPageData); //追加新数据
  381. for (let i = 0; i < this.priceList.length; i++) {
  382. console.log(new Date(this.priceList[i].collection).toLocaleDateString())
  383. this.x.push(new Date(this.priceList[i].collection).toLocaleDateString());
  384. this.y.push(this.priceList[i].price)
  385. }
  386. let _data = {
  387. categories: this.x,
  388. series: [{
  389. name: "价格",
  390. data: this.y
  391. }]
  392. };
  393. console.log("x", this.x)
  394. console.log("y", this.y)
  395. this.chartData = JSON.parse(JSON.stringify(_data));
  396. // }
  397. })
  398. },
  399. upCallback(page) {
  400. this.$request.baseRequest('admin.gubi.gubiTransaction', 'list', {
  401. pageNum: page.num,
  402. pageSize: page.size,
  403. orderId: this.orderId
  404. }, failres => {
  405. console.log('res+++++', failres.errmsg)
  406. this.$refs.uToast.show({
  407. type: 'error',
  408. message: failres.errmsg,
  409. })
  410. uni.hideLoading()
  411. }).then(res => {
  412. // if (res.errno == 200) {
  413. uni.hideLoading()
  414. console.log(11)
  415. let curPageData = res.data.items;
  416. let totalPage = res.data.total;
  417. let curPageLen = curPageData.length;
  418. this.mescroll.endByPage(curPageLen, totalPage);
  419. console.log(res.data)
  420. // this.makeData(res.data)
  421. if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
  422. this.dataList = this.dataList.concat(curPageData); //追加新数据
  423. for (let i = 0; i < this.dataList.length; i++) {
  424. // this.dataList[i].urlPath = this.dataList[i].urlPath.split(",")
  425. }
  426. // }
  427. })
  428. // // 此处可以继续请求其他接口
  429. // // if(page.num == 1){
  430. // // // 请求其他接口...
  431. // // }
  432. // // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
  433. // // if(!this.isInitxx){
  434. // // apiGetxx().then(res=>{
  435. // // this.isInitxx = true
  436. // // this.mescroll.resetUpScroll() // 重新触发upCallback
  437. // // }).catch(()=>{
  438. // // this.mescroll.endErr()
  439. // // })
  440. // // return // 此处return,先获取xx
  441. // // }
  442. // let pageNum = page.num; // 页码, 默认从1开始
  443. // let pageSize = page.size; // 页长, 默认每页10条
  444. // uni.request({
  445. // url: 'xxxx?pageNum=' + pageNum + '&pageSize=' + pageSize,
  446. // success: (data) => {
  447. // // 接口返回的当前页数据列表 (数组)
  448. // // let curPageData = data.xxx;
  449. // // // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
  450. // // let curPageLen = curPageData.length;
  451. // // // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
  452. // // let totalPage = data.xxx;
  453. // // // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
  454. // // let totalSize = data.xxx;
  455. // // // 接口返回的是否有下一页 (true/false)
  456. // // let hasNext = data.xxx;
  457. // //设置列表数据
  458. // if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
  459. // this.dataList = this.dataList.concat(curPageData); //追加新数据
  460. // // 请求成功,隐藏加载状态
  461. // //方法一(推荐): 后台接口有返回列表的总页数 totalPage
  462. // // this.mescroll.endByPage(curPageLen, totalPage);
  463. // this.mescroll.endByPage(0, 0);
  464. // setTimeout(() => {
  465. // // this.mescroll.endSuccess(curPageLen)
  466. // this.mescroll.endSuccess(0)
  467. // }, 20)
  468. // },
  469. // fail: () => {
  470. // // 请求失败,隐藏加载状态
  471. // this.mescroll.endErr()
  472. // }
  473. // })
  474. },
  475. }
  476. }
  477. </script>
  478. <style lang="scss">
  479. .content {
  480. padding: 20rpx;
  481. }
  482. .row2 {
  483. margin: 20rpx 0;
  484. }
  485. .title {
  486. margin: 20rpx 0;
  487. font-weight: 700;
  488. }
  489. .row-style,
  490. .row {
  491. display: flex;
  492. justify-content: space-between;
  493. border-bottom: 1px solid #ebebeb;
  494. padding: 20rpx;
  495. }
  496. // .imgList {
  497. // display: flex;
  498. // }
  499. .jyjl {
  500. color: rgb(60, 156, 255);
  501. border: 1px solid rgb(60, 156, 255);
  502. width: 300rpx;
  503. padding: 10rpx;
  504. border-radius: 10rpx;
  505. }
  506. .price-img {
  507. width: 340rpx;
  508. }
  509. .right-row {
  510. display: flex;
  511. justify-content: flex-end;
  512. align-items: center;
  513. }
  514. </style>