小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

256 lines
8.1 KiB

<template>
<view class="v-pages" style="padding-bottom: 32rpx;">
<!-- 页面 筛选 -->
<view class="v-index-top">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/dc90422d0baa14d670d73949c111d5fd2384732f2d69a9473670817104ae8bb4.png">
</image>
<view class="row v-index-top-base">
<view class="text"><text class="iconfont icon-farm"></text>{{ BaseInfo.baseName }}</view>
<view class="text"><text class="iconfont icon-leader"></text>负责人{{ BaseInfo.baseLeader }}</view>
</view>
<view class="v-index-top-nav v-container">
<view class="v-index-top-nav-box row">
<view class="v-index-top-nav-item col-8">
<view class="info"><text class="number">{{BaseInfo.baseArea}}</text><text class="unit"></text>
</view>
<view class="title"><text class="iconfont icon-base-area m-r-mini"></text>基地总面积</view>
</view>
<view class="v-index-top-nav-item col-8">
<view class="info"><text class="number">{{ BaseInfo.plotTotalArea }}</text><text
class="unit"></text></view>
<view class="title"><text class="iconfont icon-plant-area m-r-mini"></text>地块总面积</view>
</view>
<view class="v-index-top-nav-item col-8">
<view class="info"><text class="number">{{ BaseInfo.currentPlantingArea }}</text><text
class="unit"></text></view>
<view class="title"><text class="iconfont icon-crop m-r-mini"></text>当前种植面积</view>
</view>
</view>
</view>
</view>
<!-- 首页 导航 -->
<view class="v-index-nav v-container row m-t-small">
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/addCrops/addCrops">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/1d1c59ba8721e4ed64637dc54ceea85453ff907a2a8668e2ae43927e28e89540.png">
</image>
</view>
<view class="text">开始种植</view>
</navigator>
</view>
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/addNoteJob/addNoteJob">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/64c3e31ec9526832f18c22cf2657448c4e2075a7b991a5605e15a670034dee40.png">
</image>
</view>
<view class="text">农事操作</view>
</navigator>
</view>
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/traceability-product/machining/index">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/f7735fc972de7a1e73fd315e38639b054b79a969830f0aa6c42e974f54579fed.png">
</image>
</view>
<view class="text">产品加工</view>
</navigator>
</view>
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/traceability-product/delivery/index">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/80bb27e0cedca02c88d3b226b169a5b57fe1b6c2505743ceda40ae328e161287.png">
</image>
</view>
<view class="text">配送记录</view>
</navigator>
</view>
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/traceability-product/sales/index">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/42746f3ff8e9bda732e8821fa80b791e21b725053eb95de95a595b91b737594d.png">
</image>
</view>
<view class="text">销售记录</view>
</navigator>
</view>
<view class="v-index-nav-item col-8">
<navigator url="/sunPages/traceability-product/loss/index">
<view class="icon">
<image class="v-index-bg"
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/5cc5e5c663df1f7bb8acf73219a60bc9b14ed13482f8df294349acc503163f1b.png">
</image>
</view>
<view class="text">报损记录</view>
</navigator>
</view>
</view>
<!-- 首页 导航 -->
<view class="v-index-nav v-container row m-t-regular">
<view class="col-12">
<navigator url="/sunPages/traceability-product/index">
<view class="v-index-nav-box product">
<view class="text">溯源产品</view>
<view class="icon">
<image
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/01aabbe2fe12bb43f4cba06db577b569e68025904f8cb3c1d098ff80cb998275.png">
</image>
</view>
</view>
</navigator>
</view>
<view class="col-12">
<navigator url="/sunPages/traceability-code/sales">
<view class="v-index-nav-box sales">
<view class="text">销售溯源码</view>
<view class="icon">
<image
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/ca955f39c3c39415c6c343ffd17e11c9987e7641b21f790fd5f480dddf627f38.png">
</image>
</view>
</view>
</navigator>
<navigator url="/sunPages/traceability-code/inventory">
<view class="v-index-nav-box inventory">
<view class="text">库存溯源码</view>
<view class="icon">
<image
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/8b1ec5ed342291c406b9a8cd60a23b599138f564304bc30129b8973856134823.png">
</image>
</view>
</view>
</navigator>
</view>
</view>
<view class="v-index-data v-container m-t-regular">
<view class="v-card">
<view class="v-card-title">溯源产品扫码分析Top5</view>
<view class="v-index-product-list">
<view class="v-list-item" v-for="(item,index) in ProductCode" :key="index">
<view class="row">
<view class="name col">{{item.name}}</view>
<view class="number">{{item.value}}</view>
</view>
<view class="bar">
<view class="bar-inner" :style="{width:item.percentage}"></view>
</view>
</view>
</view>
</view>
</view>
<view class="v-index-data v-container m-t-regular">
<view class="v-card">
<view class="v-card-title">溯源关注地区排行Top5</view>
<view class="v-index-product-list">
<view class="v-list-item" v-for="(item,index) in ProductData" :key="index">
<view class="row">
<view class="name col">{{item.name}}</view>
<view class="number">{{item.value}}</view>
</view>
<view class="bar">
<view class="bar-inner" :style="{width:item.percentage}"></view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import * as indexApi from '@/api/traceability/index'
export default {
data() {
return {
baseId: this.$store.state.user.baseId,
BaseInfo: null,
ProductData: null,
ProductCode: null
}
},
watch: {
"$store.state.user.baseId"(newValue, oldVal) {
console.log("AAAA",newValue)
this.baseId=newValue
this.getBaseData()
}
},
onLoad: function() {
this.getBaseData()
this.getProductData()
this.getProductCode()
},
methods: {
// 获取基地数据
async getBaseData() {
try {
let params = {
id: this.baseId
}
const res = await indexApi.getAllBaseInfo(params)
this.BaseInfo = res.data
} finally {}
},
// 获取溯源产品扫码分析
async getProductCode() {
try {
const res = await indexApi.getTraceableProductCodeScanningAnalysis()
const newData = res.data.seriesData
let total = 0
newData.forEach((item) => {
total += Number(item.value);
})
this.ProductCode = newData.map((item) => {
return {
name: item.name,
value: item.value,
percentage: (Number(item.value) / total).toFixed(2) * 100 + '%'
}
})
} finally {}
},
// 获取溯源关注地区排行
async getProductData() {
try {
const res = await indexApi.getTraceabilityFocusRegionalRankings()
const newData = res.data.seriesData
let total = 0
newData.forEach((item) => {
total += Number(item.value);
})
this.ProductData = newData.map((item) => {
return {
name: item.name,
value: item.value,
percentage: (Number(item.value) / total).toFixed(2) * 100 + '%'
}
})
} finally {}
}
}
}
</script>
<style>
page {
background-color: #fff;
}
</style>