|
|
@ -8,10 +8,10 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<van-search v-model="searchKey" placeholder="请输入品种" background="#ffffff" shape="round" /> |
|
|
|
<van-search @search="goToSearch(searchKey)" v-model="searchKey" placeholder="请输入品种" background="#ffffff" shape="round" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="collect m-bot10"> |
|
|
|
<!-- <div class="collect m-bot10"> |
|
|
|
<div class="title flex flex-center2 "> |
|
|
|
<img src="@/assets/images/icons/collect.png" alt=""> |
|
|
|
<span>收藏品种</span> |
|
|
@ -23,11 +23,11 @@ |
|
|
|
v-for="(item, index) in collectList" :key="index" @close="handelClickClose(item)">{{ item |
|
|
|
}}</van-tag> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
<div class="card m-top10 list"> |
|
|
|
<div class="title"> |
|
|
|
<span class=""><img src="@/assets/images/icons/date-blue.png" alt="" |
|
|
|
class="img-15 m-right4">2024-01-11</span> |
|
|
|
class="img-15 m-right4">{{currentDate?currentDate:times }}</span> |
|
|
|
<span>(单位:元/公斤)</span> |
|
|
|
</div> |
|
|
|
<div class="scroll-box m-top18"> |
|
|
@ -39,10 +39,14 @@ |
|
|
|
<section style="overflow: hidden;"> |
|
|
|
<div class="scroll-content"> |
|
|
|
<div class="flex flex-mean item" v-for="(item, index) in priceList" :key="'price' + index"> |
|
|
|
<div class="flex1 van-ellipsis" style="color: #333;">{{ item.name }} </div> |
|
|
|
<div class="flex1 van-ellipsis" style="color: #333;">{{ item.Name }} </div> |
|
|
|
<div class="flex1 van-ellipsis font-bold">{{ item.price }} </div> |
|
|
|
<div class="vegetable-item-row2 flex1 van-ellipsis">{{ item.old }} <img |
|
|
|
src="@/assets/up.png" alt="" style="width: 11px;height: 15px;"></div> |
|
|
|
<div class="vegetable-item-row2 flex1 van-ellipsis">{{ item.jzrPrice }} |
|
|
|
<img v-if="item.jzrPrice > 0 && item.jzrPrice != '暂无'" src="@/assets/up.png" alt="" |
|
|
|
style="width: 11px;height: 15px;"> |
|
|
|
<img v-if="item.jzrPrice < 0 && item.jzrPrice != '暂无'" src="@/assets/down.png" alt="" |
|
|
|
style="width: 11px;height: 15px;"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
@ -53,15 +57,31 @@ |
|
|
|
type="date" title="选择年月日" /> |
|
|
|
</van-popup> |
|
|
|
<van-popup v-model="showAdd" position="bottom" :style="{ height: '40%' }"> |
|
|
|
<van-checkbox v-model="checked" shape="square" v-for="(item,index) in collectList" :key="index">{{item}}</van-checkbox> |
|
|
|
<van-checkbox v-model="checked" shape="square" v-for="(item, index) in collectList" :key="index">{{ item |
|
|
|
}}</van-checkbox> |
|
|
|
</van-popup> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { prcCollectionListForGov, seedNewsScreenList } from '@/api/test' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
params: { |
|
|
|
Country: 0, |
|
|
|
FEndDate: this.$moment().format('yyyy-MM-DD'), |
|
|
|
FParentPartyID: 1, |
|
|
|
FPartyName: '青岛移风蔬菜批发市场有限公司', |
|
|
|
FPartyType: 1010, |
|
|
|
FStartDate: this.$moment().format('yyyy-MM-DD'), |
|
|
|
FStoreId: 1, |
|
|
|
Name: '全部', |
|
|
|
page: 1, |
|
|
|
pageSize: 10, |
|
|
|
singletype: 0, |
|
|
|
sort: '' |
|
|
|
}, |
|
|
|
searchKey: null, |
|
|
|
showDate: false, |
|
|
|
currentDate: null, |
|
|
@ -126,13 +146,99 @@ export default { |
|
|
|
collectList: ['白菜', '白菜', '白菜', '白菜', '白菜', '白菜', '豆角', '西红柿', '西红柿', '黄瓜', '茄子', '洋葱', '彩椒'], |
|
|
|
closeable: false, |
|
|
|
showAdd: false, |
|
|
|
checked:[] |
|
|
|
checked: [], |
|
|
|
dayList: [], |
|
|
|
tDayList: [], |
|
|
|
times: this.$moment().subtract(1, 'days').format('yyyy-MM-DD') |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
// this.onLoad() |
|
|
|
this.getDayScData() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
goToSearch(data){ |
|
|
|
console.log(data); |
|
|
|
this.getDayScData({name:data, FEndDate: this.currentDate, |
|
|
|
FStartDate: this.currentDate}) |
|
|
|
|
|
|
|
}, |
|
|
|
getDayScData(data) { |
|
|
|
prcCollectionListForGov({ ...this.params, ...data }).then((res) => { |
|
|
|
console.log(res, "XIAOWANG"); |
|
|
|
if (res.data.priceslist.length > 0) { |
|
|
|
this.dayList = res.data.priceslist |
|
|
|
console.log("day"); |
|
|
|
console.log(this.dayList, "day"); |
|
|
|
this.getDayScTData() |
|
|
|
} else { |
|
|
|
console.log("11"); |
|
|
|
this.times = this.$moment(this.times) |
|
|
|
.subtract(1, 'days') |
|
|
|
.format('yyyy-MM-DD') |
|
|
|
console.log(this.times); |
|
|
|
this.getDayScData({ |
|
|
|
FEndDate: this.$moment(this.times) |
|
|
|
.subtract(1, 'days') |
|
|
|
.format('yyyy-MM-DD'), |
|
|
|
|
|
|
|
FStartDate: this.$moment(this.times) |
|
|
|
.subtract(1, 'days') |
|
|
|
.format('yyyy-MM-DD') |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
getDayScTData() { |
|
|
|
console.log(this.times); |
|
|
|
prcCollectionListForGov({ |
|
|
|
...this.params, |
|
|
|
FEndDate: this.times, |
|
|
|
FStartDate: this.times |
|
|
|
}).then((res1) => { |
|
|
|
console.log(res1.data, "15216516516"); |
|
|
|
if (res1.data.priceslist.length > 0) { |
|
|
|
this.priceList = this.getScData(this.dayList, res1.data.priceslist) |
|
|
|
console.log(this.priceList); |
|
|
|
} else { |
|
|
|
this.times = this.$moment(this.times) |
|
|
|
.subtract(1, 'days') |
|
|
|
.format('yyyy-MM-DD') |
|
|
|
this.getDayScTData() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
deduplicationJs(arr) { |
|
|
|
const data = [] |
|
|
|
arr.forEach((item, index) => { |
|
|
|
if ((index + 1) % 2 === 0) { |
|
|
|
const num = (arr[index - 1].AvgPrice + item.AvgPrice) / 2 |
|
|
|
data.push({ ...item, price: num }) |
|
|
|
} |
|
|
|
}) |
|
|
|
return data |
|
|
|
}, |
|
|
|
getScData(arr, arr1) { |
|
|
|
const dataD = this.deduplicationJs(arr) |
|
|
|
const dataTd = this.deduplicationJs(arr1) |
|
|
|
return dataD.map((item, index) => { |
|
|
|
const priceTd = dataTd.filter((item1) => item.Name === item1.Name) |
|
|
|
// [0].price |
|
|
|
if (priceTd.length > 0) { |
|
|
|
const jzrPrice = (item.price - priceTd[0].price).toFixed(2) |
|
|
|
return { |
|
|
|
...item, |
|
|
|
jzrPrice |
|
|
|
} |
|
|
|
} else { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
jzrPrice: '暂无' |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
setTimeout(() => { |
|
|
|
// if (this.refreshing) { |
|
|
@ -156,7 +262,12 @@ export default { |
|
|
|
}, |
|
|
|
handelCLickConfirmDate(val) { |
|
|
|
this.currentDate = this.$dayjs(val).format('YYYY-MM-DD'); |
|
|
|
this.getDayScData({name:this.searchKey, FEndDate: this.currentDate, |
|
|
|
FStartDate: this.currentDate}) |
|
|
|
|
|
|
|
this.showDate = false; |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
handelClickClose(val) { |
|
|
|
console.log(val); |
|
|
|