|
@@ -4,8 +4,13 @@
|
|
|
<text style="margin-right:20rpx">{{num}}品种</text>
|
|
|
<text>{{time}}</text>
|
|
|
</view>
|
|
|
+ <view style="display: flex;align-items:center;padding:40rpx 34rpx">
|
|
|
+ <van-switch active-color="#E3B377" size="20px" :checked="isHistory" @change="onChange" />
|
|
|
+ <text style="margin:-8rpx 0 0 10rpx">历史合约</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view class="list-wrap">
|
|
|
- <view class="flex item" v-for="item in list" :key="item.classify_name">
|
|
|
+ <view class="flex item" v-for="item in clist" :key="item.classify_name">
|
|
|
<view class="label">{{item.classify_name}}</view>
|
|
|
<view style="flex:1">
|
|
|
<view
|
|
@@ -17,7 +22,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="empty-box" v-if="!list||list.length===0">
|
|
|
+ <view class="empty-box" v-if="!clist||clist.length===0">
|
|
|
<image
|
|
|
:src="globalImgUrls.chartEmpty"
|
|
|
mode="widthFix"
|
|
@@ -47,7 +52,48 @@ export default {
|
|
|
default:''
|
|
|
}
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ clist(){
|
|
|
+ if(this.isHistory){
|
|
|
+ console.log('看历史');
|
|
|
+ return this.list
|
|
|
+ }
|
|
|
+
|
|
|
+ const now=dayjs().format('YYMM')//当前时间
|
|
|
+ const arr=this.list?JSON.parse(JSON.stringify(this.list)):[]
|
|
|
+ let resArr=[]
|
|
|
+ if(this.exchange!='郑商所'){
|
|
|
+ resArr=arr.map(item=>{
|
|
|
+ item.items=item.items.filter(_item=>{
|
|
|
+ const t=_item.classify_type.substr(-4)
|
|
|
+ return Number(t)>=now
|
|
|
+ })
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ resArr=arr.map(item=>{
|
|
|
+ item.items=item.items.filter(_item=>{
|
|
|
+ // 如果合约编号没有含日期 肯定是少于4位的 因为至少为一个字母加三位数的日期
|
|
|
+ if(_item.classify_type.length<4) return true
|
|
|
+ const t=2+_item.classify_type.substr(-3)
|
|
|
+ return Number(t)>=now
|
|
|
+ })
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return resArr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isHistory:false
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ onChange(e){
|
|
|
+ console.log(e);
|
|
|
+ this.isHistory=e.detail
|
|
|
+ },
|
|
|
goDetail(_item,item){
|
|
|
const queryObj={
|
|
|
classify_name:item.classify_name,
|