123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535 |
- <template>
- <view class="content">
- <view class="content1">
- <view class="row1">
- <u-subsection :list="btnList" mode="subsection" :current="curNow" @change="sectionChange">
- </u-subsection>
- </view>
- <view class="row2" v-if="curNow!=2">
- <text>{{type}}</text>
- </view>
- <view class="row3" v-if="curNow==0">
- <u-tabs :list="list1" @click="click" keyName="typeId" :current='current' @change='tabChange'></u-tabs>
- </view>
- </view>
- <view class="content2" v-if="curNow==0&&isSHowOther">
- <view class="title">
- 价格趋势图
- </view>
- <qiun-data-charts type="line" :opts="opts" :chartData="chartData" :ontouch="true" />
- </view>
- <view class="content3" v-if="curNow==0&&isSHowOther">
- <view class="title">
- 价格历史记录
- </view>
- <mescroll-body v-if="curNow==0" ref="mescrollRef" @init="mescrollInit" @up="upCallback1" :down="downOption"
- :up="upOption">
- <view class="price-list">
- <view class="row-style" style="display: flex;justify-content: space-between;">
- <view class="">
- 最新价格
- </view>
- <view class="">
- 单位(万元)
- </view>
- </view>
- <view class="row-style" style="display: flex;justify-content: space-between;"
- v-for="item in priceList">
- <view class="">
- {{new Date(item.collection).toLocaleDateString() }}
- </view>
- <view class="">
- {{item.price}}
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- <mescroll-body v-if="curNow==1&&isSHowOther" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
- :down="downOption" :up="upOption">
- <view class="jyjl">
- 以下为近期成交数据
- </view>
- <view v-for="data in dataList" class="row">
- <view class="left">
- <image :src="data.urlPath" mode="widthFix" class="price-img" @click="fdImg(data.urlPath)"></image>
- <u-popup :show="show" @close="close" @open="open" mode="center">
- <image :src="selectSrc" mode="widthFix"></image>
- </u-popup>
- </view>
- <view class="right">
- <view class="right-row" style="color:#fca87d;font-size:20px;font-weight:700">
- ¥{{data.price}}万元
- </view>
- <view class="right-row">
- 名称:{{data.grade}}
- </view>
- <view class="right-row">
- 编号:{{data.number}}
- </view>
- <view class="right-row">
- 状态:{{data.status}}
- </view>
- <view class="right-row">
- 交易日期:
- <text
- style="color:#fca87d;font-size:12px">{{new Date(data.collection).toLocaleDateString() }}</text>
- </view>
- </view>
- </view>
- </mescroll-body>
- <view class="bz" v-if="curNow==2">
- <view class="title">
- 存量/增量
- </view>
- <view class="row">
- <view class="left">
- 系列
- </view>
- <view class="right">
- {{nowItem.series}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 品名
- </view>
- <view class="right">
- {{nowItem.product}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 官网编号
- </view>
- <view class="right">
- {{nowItem.number}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 年份
- </view>
- <view class="right">
- {{nowItem.year}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 面值
- </view>
- <view class="right">
- {{nowItem.face}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 版别
- </view>
- <view class="right">
- {{nowItem.edition}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 地区
- </view>
- <view class="right">
- {{nowItem.region}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 分值/等级
- </view>
- <view class="right">
- {{nowItem.grade}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 同分数量/增量
- </view>
- <view class="right">
- {{nowItem.tongFen}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 高分数量
- </view>
- <view class="right">
- {{nowItem.highScores}}
- </view>
- </view>
- <view class="row">
- <view class="left">
- 收集时间
- </view>
- <view class="right">
- {{nowItem.collection}}
- </view>
- </view>
- <view class="detail-view">
- <view class="title">
- 详细介绍
- </view>
- <view class="">
- {{nowItem.introduction}}
- </view>
- <view class="imgList">
- <!-- <image :src="item" mode="widthFix" v-for="item in nowItem.urlPath.split(',')" style="width: 50%;">
- </image> -->
- </view>
- </view>
- </view>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- onLoad() {
- this.info = uni.getStorageSync("selectInfo")
- // this.list1 = this.info.children
- // if (this.info.children.length != 0) {
- this.nowItem = this.info
- // this.type1 = this.info.series
- // this.type2 = this.info.secondName
- // this.type3 = this.info.children[1].typeId
- // // for (let i = 0; i < this.info.children.length; i++) {
- // // }
- // }
- this.$request.baseRequest('admin.gubi.gubiTypeThree', 'list', {
- page: 1,
- limit: 1000,
- secondId: this.info.id
- },
- failres => {
- console.log('res+++++', failres.errmsg)
- this.$refs.uToast.show({
- type: 'error',
- message: failres.errmsg,
- })
- uni.hideLoading()
- }).then(res => {
- uni.hideLoading()
- console.log(11)
- console.log(res.data.items)
- this.list1 = res.data.items
- for (let i = 0; i < this.list1.length; i++) {
- if (this.list1[i].typeId == '45') {
- this.type = this.list1[i].strFlag
- this.orderId = this.list1[i].id
- this.isSHowOther = true
- }
- }
- // this.typeTwoData = res.data.items
- })
- },
- data() {
- return {
- current: 1,
- isSHowOther: false,
- type: '',
- selectSrc: '',
- show: false,
- x: [],
- y: [],
- type1: '',
- type2: '',
- type3: '',
- orderId: '',
- info: {},
- downOption: {},
- upOption: {
- page: {
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- tip: '暂无相关数据'
- }
- },
- downOption1: {},
- upOption1: {
- page: {
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- tip: '暂无相关数据'
- }
- },
- dataList: [{
- img1: "",
- img2: '',
- price: '0.19',
- number: '8777',
- fVal: '35',
- status: '酱彩',
- }],
- priceList: [{
- date: '2022-10-31',
- price: '0.27'
- },
- {
- date: '2022-10-31',
- price: '0.27'
- },
- ],
- chartData: {},
- opts: {
- color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
- "#ea7ccc"
- ],
- padding: [15, 10, 0, 15],
- enableScroll: true,
- legend: {},
- xAxis: {
- disableGrid: true,
- scrollShow: true,
- itemCount: 4
- },
- yAxis: {
- gridType: "dash",
- dashLength: 2
- },
- extra: {
- line: {
- type: "straight",
- width: 2
- }
- }
- },
- btnList: ['价格概况', '交易记录', '币种介绍'],
- curNow: 0,
- list1: []
- }
- },
- methods: {
- close() {
- this.show = false
- // console.log('close');
- },
- fdImg(src) {
- this.selectSrc = src
- this.show = true
- },
- sectionChange(index) {
- this.curNow = index;
- },
- tabChange(val) {
- console.log(111)
- this.current = val.index;
- console.log(val.index)
- },
- click(item) {
- this.orderId = item.id
- for (let i = 0; i < this.list1.length; i++) {
- if (this.list1[i].typeId == item.typeId) {
- this.type = this.list1[i].strFlag
- }
- }
- this.mescroll.resetUpScroll()
- },
- makeData(val) {
- for (let i = 0; i < val.length; i++) {
- if (val[i].children) {
- for (let j = 0; j < val[i].children.length; j++) {
- let _obj = val[i].children[j]
- _obj.typeName = val[i].children[j].secondName
- val[i].children[j] = _obj
- if (val[i].children[j].children) {
- for (let k = 0; k < val[i].children[j].children.length; k++) {
- let _obj1 = val[i].children[j].children[k]
- _obj1.typeName = val[i].children[j].children[k].typeId
- val[i].children[j].children[k] = _obj1
- }
- }
- }
- }
- }
- this.listData = val
- // console.log(this.data)
- },
- upCallback1(page) {
- this.x = []
- this.y = []
- this.$request.baseRequest('admin.gubi.gubiPriceHis', 'list', {
- pageNum: page.num,
- pageSize: page.size,
- orderId: this.orderId
- }, failres => {
- console.log('res+++++', failres.errmsg)
- this.$refs.uToast.show({
- type: 'error',
- message: failres.errmsg,
- })
- uni.hideLoading()
- }).then(res => {
- // if (res.errno == 200) {
- uni.hideLoading()
- let curPageData = res.data.items;
- let totalPage = res.data.total;
- let curPageLen = curPageData.length;
- this.mescroll.endByPage(curPageLen, totalPage);
- // this.makeData(res.data)
- if (page.num == 1) this.priceList = []; //如果是第一页需手动置空列表
- this.priceList = this.priceList.concat(curPageData); //追加新数据
- for (let i = 0; i < this.priceList.length; i++) {
- console.log(new Date(this.priceList[i].collection).toLocaleDateString())
- this.x.push(new Date(this.priceList[i].collection).toLocaleDateString());
- this.y.push(this.priceList[i].price)
- }
- let _data = {
- categories: this.x,
- series: [{
- name: "价格",
- data: this.y
- }]
- };
- console.log("x", this.x)
- console.log("y", this.y)
- this.chartData = JSON.parse(JSON.stringify(_data));
- // }
- })
- },
- upCallback(page) {
- this.$request.baseRequest('admin.gubi.gubiTransaction', 'list', {
- pageNum: page.num,
- pageSize: page.size,
- orderId: this.orderId
- }, failres => {
- console.log('res+++++', failres.errmsg)
- this.$refs.uToast.show({
- type: 'error',
- message: failres.errmsg,
- })
- uni.hideLoading()
- }).then(res => {
- // if (res.errno == 200) {
- uni.hideLoading()
- console.log(11)
- let curPageData = res.data.items;
- let totalPage = res.data.total;
- let curPageLen = curPageData.length;
- this.mescroll.endByPage(curPageLen, totalPage);
- console.log(res.data)
- // this.makeData(res.data)
- if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
- this.dataList = this.dataList.concat(curPageData); //追加新数据
- for (let i = 0; i < this.dataList.length; i++) {
- // this.dataList[i].urlPath = this.dataList[i].urlPath.split(",")
- }
- // }
- })
- // // 此处可以继续请求其他接口
- // // if(page.num == 1){
- // // // 请求其他接口...
- // // }
- // // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
- // // if(!this.isInitxx){
- // // apiGetxx().then(res=>{
- // // this.isInitxx = true
- // // this.mescroll.resetUpScroll() // 重新触发upCallback
- // // }).catch(()=>{
- // // this.mescroll.endErr()
- // // })
- // // return // 此处return,先获取xx
- // // }
- // let pageNum = page.num; // 页码, 默认从1开始
- // let pageSize = page.size; // 页长, 默认每页10条
- // uni.request({
- // url: 'xxxx?pageNum=' + pageNum + '&pageSize=' + pageSize,
- // success: (data) => {
- // // 接口返回的当前页数据列表 (数组)
- // // let curPageData = data.xxx;
- // // // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
- // // let curPageLen = curPageData.length;
- // // // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
- // // let totalPage = data.xxx;
- // // // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
- // // let totalSize = data.xxx;
- // // // 接口返回的是否有下一页 (true/false)
- // // let hasNext = data.xxx;
- // //设置列表数据
- // if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
- // this.dataList = this.dataList.concat(curPageData); //追加新数据
- // // 请求成功,隐藏加载状态
- // //方法一(推荐): 后台接口有返回列表的总页数 totalPage
- // // this.mescroll.endByPage(curPageLen, totalPage);
- // this.mescroll.endByPage(0, 0);
- // setTimeout(() => {
- // // this.mescroll.endSuccess(curPageLen)
- // this.mescroll.endSuccess(0)
- // }, 20)
- // },
- // fail: () => {
- // // 请求失败,隐藏加载状态
- // this.mescroll.endErr()
- // }
- // })
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- padding: 20rpx;
- }
- .row2 {
- margin: 20rpx 0;
- }
- .title {
- margin: 20rpx 0;
- font-weight: 700;
- }
- .row-style,
- .row {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #ebebeb;
- padding: 20rpx;
- }
- // .imgList {
- // display: flex;
- // }
- .jyjl {
- color: rgb(60, 156, 255);
- border: 1px solid rgb(60, 156, 255);
- width: 300rpx;
- padding: 10rpx;
- border-radius: 10rpx;
- }
- .price-img {
- width: 340rpx;
- }
- .right-row {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- </style>
|