price.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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>{{type1}}</text><text>/</text><text>{{type2}}</text><text>/</text><text>{{type3}}</text>
  10. </view>
  11. <view class="row3" v-if="curNow==0">
  12. <u-tabs :list="list1" @click="click" keyName="typeName" current='1'></u-tabs>
  13. </view>
  14. </view>
  15. <view class="content2" v-if="curNow==0">
  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">
  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" ref="mescrollRef" @init="mescrollInit" @up="upCallback" :down="downOption"
  49. :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.orderId = this.info.children[1].id
  199. this.type1 = this.info.series
  200. this.type2 = this.info.secondName
  201. this.type3 = this.info.children[1].typeId
  202. // for (let i = 0; i < this.info.children.length; i++) {
  203. // }
  204. }
  205. },
  206. data() {
  207. return {
  208. selectSrc: '',
  209. show: false,
  210. x: [],
  211. y: [],
  212. type1: '',
  213. type2: '',
  214. type3: '',
  215. orderId: '',
  216. info: {},
  217. downOption: {},
  218. upOption: {
  219. page: {
  220. size: 10 // 每页数据的数量,默认10
  221. },
  222. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  223. empty: {
  224. tip: '暂无相关数据'
  225. }
  226. },
  227. downOption1: {},
  228. upOption1: {
  229. page: {
  230. size: 10 // 每页数据的数量,默认10
  231. },
  232. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  233. empty: {
  234. tip: '暂无相关数据'
  235. }
  236. },
  237. dataList: [{
  238. img1: "",
  239. img2: '',
  240. price: '0.19',
  241. number: '8777',
  242. fVal: '35',
  243. status: '酱彩',
  244. }],
  245. priceList: [{
  246. date: '2022-10-31',
  247. price: '0.27'
  248. },
  249. {
  250. date: '2022-10-31',
  251. price: '0.27'
  252. },
  253. ],
  254. chartData: {},
  255. opts: {
  256. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  257. "#ea7ccc"
  258. ],
  259. padding: [15, 10, 0, 15],
  260. enableScroll: true,
  261. legend: {},
  262. xAxis: {
  263. disableGrid: true,
  264. scrollShow: true,
  265. itemCount: 4
  266. },
  267. yAxis: {
  268. gridType: "dash",
  269. dashLength: 2
  270. },
  271. extra: {
  272. line: {
  273. type: "straight",
  274. width: 2
  275. }
  276. }
  277. },
  278. btnList: ['价格概况', '交易记录', '币种介绍'],
  279. curNow: 0,
  280. list1: []
  281. }
  282. },
  283. methods: {
  284. close() {
  285. this.show = false
  286. // console.log('close');
  287. },
  288. fdImg(src) {
  289. this.selectSrc = src
  290. this.show = true
  291. },
  292. sectionChange(index) {
  293. this.curNow = index;
  294. },
  295. click(item) {
  296. this.orderId = item.id
  297. this.type3 = item.typeId
  298. this.mescroll.resetUpScroll()
  299. },
  300. makeData(val) {
  301. for (let i = 0; i < val.length; i++) {
  302. if (val[i].children) {
  303. for (let j = 0; j < val[i].children.length; j++) {
  304. let _obj = val[i].children[j]
  305. _obj.typeName = val[i].children[j].secondName
  306. val[i].children[j] = _obj
  307. if (val[i].children[j].children) {
  308. for (let k = 0; k < val[i].children[j].children.length; k++) {
  309. let _obj1 = val[i].children[j].children[k]
  310. _obj1.typeName = val[i].children[j].children[k].typeId
  311. val[i].children[j].children[k] = _obj1
  312. }
  313. }
  314. }
  315. }
  316. }
  317. this.listData = val
  318. // console.log(this.data)
  319. },
  320. upCallback1(page) {
  321. this.x = []
  322. this.y = []
  323. this.$request.baseRequest('admin.gubi.gubiPriceHis', 'list', {
  324. pageNum: page.num,
  325. pageSize: page.size,
  326. orderId: this.orderId
  327. }, failres => {
  328. console.log('res+++++', failres.errmsg)
  329. this.$refs.uToast.show({
  330. type: 'error',
  331. message: failres.errmsg,
  332. })
  333. uni.hideLoading()
  334. }).then(res => {
  335. // if (res.errno == 200) {
  336. uni.hideLoading()
  337. let curPageData = res.data.items;
  338. let totalPage = res.data.total;
  339. let curPageLen = curPageData.length;
  340. this.mescroll.endByPage(curPageLen, totalPage);
  341. // this.makeData(res.data)
  342. if (page.num == 1) this.priceList = []; //如果是第一页需手动置空列表
  343. this.priceList = this.priceList.concat(curPageData); //追加新数据
  344. for (let i = 0; i < this.priceList.length; i++) {
  345. console.log(new Date(this.priceList[i].collection).toLocaleDateString())
  346. this.x.push(new Date(this.priceList[i].collection).toLocaleDateString());
  347. this.y.push(this.priceList[i].price)
  348. }
  349. let _data = {
  350. categories: this.x,
  351. series: [{
  352. name: "价格",
  353. data: this.y
  354. }]
  355. };
  356. console.log("x", this.x)
  357. console.log("y", this.y)
  358. this.chartData = JSON.parse(JSON.stringify(_data));
  359. // }
  360. })
  361. },
  362. upCallback(page) {
  363. this.$request.baseRequest('admin.gubi.gubiTransaction', 'list', {
  364. pageNum: page.num,
  365. pageSize: page.size,
  366. orderId: this.orderId
  367. }, failres => {
  368. console.log('res+++++', failres.errmsg)
  369. this.$refs.uToast.show({
  370. type: 'error',
  371. message: failres.errmsg,
  372. })
  373. uni.hideLoading()
  374. }).then(res => {
  375. // if (res.errno == 200) {
  376. uni.hideLoading()
  377. console.log(11)
  378. let curPageData = res.data.items;
  379. let totalPage = res.data.total;
  380. let curPageLen = curPageData.length;
  381. this.mescroll.endByPage(curPageLen, totalPage);
  382. console.log(res.data)
  383. // this.makeData(res.data)
  384. if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
  385. this.dataList = this.dataList.concat(curPageData); //追加新数据
  386. for (let i = 0; i < this.dataList.length; i++) {
  387. // this.dataList[i].urlPath = this.dataList[i].urlPath.split(",")
  388. }
  389. // }
  390. })
  391. // // 此处可以继续请求其他接口
  392. // // if(page.num == 1){
  393. // // // 请求其他接口...
  394. // // }
  395. // // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
  396. // // if(!this.isInitxx){
  397. // // apiGetxx().then(res=>{
  398. // // this.isInitxx = true
  399. // // this.mescroll.resetUpScroll() // 重新触发upCallback
  400. // // }).catch(()=>{
  401. // // this.mescroll.endErr()
  402. // // })
  403. // // return // 此处return,先获取xx
  404. // // }
  405. // let pageNum = page.num; // 页码, 默认从1开始
  406. // let pageSize = page.size; // 页长, 默认每页10条
  407. // uni.request({
  408. // url: 'xxxx?pageNum=' + pageNum + '&pageSize=' + pageSize,
  409. // success: (data) => {
  410. // // 接口返回的当前页数据列表 (数组)
  411. // // let curPageData = data.xxx;
  412. // // // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
  413. // // let curPageLen = curPageData.length;
  414. // // // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
  415. // // let totalPage = data.xxx;
  416. // // // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
  417. // // let totalSize = data.xxx;
  418. // // // 接口返回的是否有下一页 (true/false)
  419. // // let hasNext = data.xxx;
  420. // //设置列表数据
  421. // if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
  422. // this.dataList = this.dataList.concat(curPageData); //追加新数据
  423. // // 请求成功,隐藏加载状态
  424. // //方法一(推荐): 后台接口有返回列表的总页数 totalPage
  425. // // this.mescroll.endByPage(curPageLen, totalPage);
  426. // this.mescroll.endByPage(0, 0);
  427. // setTimeout(() => {
  428. // // this.mescroll.endSuccess(curPageLen)
  429. // this.mescroll.endSuccess(0)
  430. // }, 20)
  431. // },
  432. // fail: () => {
  433. // // 请求失败,隐藏加载状态
  434. // this.mescroll.endErr()
  435. // }
  436. // })
  437. },
  438. }
  439. }
  440. </script>
  441. <style lang="scss">
  442. .content {
  443. padding: 20rpx;
  444. }
  445. .row2 {
  446. margin: 20rpx 0;
  447. }
  448. .title {
  449. margin: 20rpx 0;
  450. font-weight: 700;
  451. }
  452. .row-style,
  453. .row {
  454. display: flex;
  455. justify-content: space-between;
  456. border-bottom: 1px solid #ebebeb;
  457. padding: 20rpx;
  458. }
  459. // .imgList {
  460. // display: flex;
  461. // }
  462. .jyjl {
  463. color: rgb(60, 156, 255);
  464. border: 1px solid rgb(60, 156, 255);
  465. width: 300rpx;
  466. padding: 10rpx;
  467. border-radius: 10rpx;
  468. }
  469. .price-img {
  470. width: 200rpx;
  471. }
  472. .right-row {
  473. display: flex;
  474. justify-content: flex-end;
  475. align-items: center;
  476. }
  477. </style>