<template>
  <div class="recondsInfo">
    <!-- <Row :gutter="8">
      <Col span="4">
        <Input v-model="typesearchFilter.cattleBreed" placeholder="请输入牛只品种" clearable/>
      </Col>
      <Col span="4">
        <Button type="primary" @click="getData">查询信息</Button>
      </Col>
    </Row> -->

    <el-table :data="tabData.data" style="width: 100%;" border>
      <el-table-column label="序号" type="index" width="70" align="center"></el-table-column>
      <el-table-column prop="remarks" label="记录名称" align="center"> </el-table-column>
      <el-table-column prop="cattleBreed" label="牛只品种" align="center"> </el-table-column>
      <el-table-column label="牛只类型" align="center">
        <template #default="scope">
          {{scope.row.cattleType||'无'}}
        </template>
      </el-table-column>
      <el-table-column prop="cattleNum" label="牛只数量" align="center"> </el-table-column>
      <el-table-column label="测算时间" align="center">
        <template #default="scope">
          {{ moment(scope.row.addTime).format('yyyy-MM-DD hh:mm:ss')}}
        </template>
      </el-table-column>
      <el-table-column prop="userName" label="用户名" align="center"> </el-table-column>
      <el-table-column label="操作" width="200"  fixed="right">
        <template  #default="scope">
          <el-button size="small" type="primary" @click="lookDetail(scope.row)">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="page_style">
      <Page :total="tabData.total" :model-value="currentPage" show-elevator show-total @on-change="changePage" />
    </div>
    <!-- 查看详情 -->
    <Modal v-model="contentTypeModel" title="查看详情" ok-text="确定" width="50%">
      <el-divider content-position="center">牛只采购</el-divider>
      <Row>
        <Col span="5">
          <span>牛只品种：{{info.cattleBreed}}</span>
        </Col>
        <Col span="5">
          <span>牛只类型：{{info.cattleType}}</span>
        </Col>
        <Col span="5">
          <span>牛只数量：{{info.cattleNum|| 0}}头</span>
        </Col>
        <Col span="5">
          <span>采购重量：{{info.purchaseWeight|| 0}}公斤/头</span>
        </Col>
        <Col span="4">
          <span>采购单价：{{info.purchasePrice|| 0}}元/公斤</span>
        </Col>
      </Row>
      <el-table :data="arrOne" style="width: 100%;margin:10px 0" border stripe>
        <el-table-column prop="cattleBreed" label="牛只品种" align="center"> </el-table-column>
        <el-table-column prop="cattleType" label="牛只类型" align="center"> </el-table-column>
        <el-table-column prop="weight" label="活牛重(公斤)" align="center"> </el-table-column>
        <el-table-column prop="purchasePrice" label="单价(元/公斤)" align="center"> </el-table-column>
        <el-table-column prop="totalMoney" label="采购投资(万元)" align="center"> </el-table-column>
      </el-table>
      <el-divider content-position="center">牛只育肥</el-divider>
      <Row>
        <Col span="5">
          <span>是否育肥：{{info.isYf == 1?'是':'否'}}</span>
        </Col>
        <Col span="5" v-if="info.isYf == 1">
          <span>育肥周期：{{info.growCycle|| 0}}天</span>
        </Col>
        <Col span="5" v-if="info.isYf == 1">
          <span>出栏重量：{{info.targetWeight|| 0}}公斤/头</span>
        </Col>
        <Col span="5" v-if="info.isYf == 1">
          <span>育肥运输：{{info.growTransport|| 0}}元/头</span>
        </Col>
        <Col span="4" v-if="info.isYf == 1">
          <span>饲草费用：{{info.grassFee|| 0}}元/头/天</span>
        </Col>
        <Col span="5" v-if="info.isYf == 1" style="margin-top:10px;">
          <span>人工费用：{{info.laborFee|| 0}}元/头/天</span>
        </Col>
        <Col span="5" v-if="info.isYf == 1" style="margin-top:10px;">
          <span>场地费用：{{info.spaceFee|| 0}}元/头/天</span>
        </Col>
      </Row>
      <el-table :data="arrOne" style="width: 100%;margin:10px 0" border stripe v-if="info.isYf == 1">
        <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
          <template #default="scope">
            <span>{{scope.row.transporFee.toFixed(2)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="dailyGain" label="日增重(公斤/天)" align="center">
          <template #default="scope">
            <span>{{scope.row.dailyGain.toFixed(2)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="cost" label="育肥成本(元/公斤)" align="center">
          <template #default="scope">
            <span>{{scope.row.cost.toFixed(2)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="invest" label="育肥投资(万元)" align="center">
          <template #default="scope">
            <span>{{scope.row.invest.toFixed(2)}}</span>
          </template>
        </el-table-column>
      </el-table>
      <el-divider content-position="center">牛只销售</el-divider>
      <el-tabs type="border-card">
        <el-tab-pane label="活牛销售">
          <Row>
            <Col span="5">
              <span>销售运输：{{info.saleCattleTransport || 0}}元/头</span>
            </Col>
            <Col span="5">
              <span>销售重量：{{info.saleCattleWeight|| 0}}公斤/头</span>
            </Col>
            <Col span="5">
              <span>销售单价：{{info.saleCattlePrice|| 0}}元/公斤</span>
            </Col>
            <Col span="5">
              <span>采销差价：{{info.priceDifference|| 0}}元/公斤</span>
            </Col>
          </Row>
          <el-table :data="arrTwo" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="活牛重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.price.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.income.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.salesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.rate<0?'color:red':''">{{scope.row.rate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>胴体销售预估数据：</div>
          <el-table :data="arrTwo" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="胴体重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.dtRate<0?'color:red':''">{{scope.row.dtRate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>牛肉销售预估数据：</div>
          <el-table :data="arrTwo" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="净肉重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.beefRate<0?'color:red':''">{{scope.row.beefRate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="胴体销售">
          <Row>
            <Col span="5">
              <span>销售重量：{{info.saleCattleWeight|| 0}}公斤/头</span>
            </Col>
            <Col span="5">
              <span>平均胴体率：{{info.carcassPercentAvg|| 0}}%</span>
            </Col>
            <Col span="5">
              <span>胴体单价：{{info.saleCarcassPrice|| 0}}元/公斤</span>
            </Col>
            <Col span="5">
              <span>加工费：{{info.saleCarcassCutPrice|| 0}}元/头</span>
            </Col>
          </Row>
          <el-table :data="arrThree" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="屠宰费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.butcherFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="胴体重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.price.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.income.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.salesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.rate<0?'color:red':''">{{scope.row.rate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>活牛销售预估数据：</div>
          <el-table :data="arrThree" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="活牛重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.cowrate<0?'color:red':''">{{scope.row.cowrate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>牛肉销售预估数据：</div>
          <el-table :data="arrThree" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="净肉重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.beefRate<0?'color:red':''">{{scope.row.beefRate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="牛肉销售">
           <Row>
            <Col span="5">
              <span>销售重量：{{info.saleCattleWeight|| 0}}公斤/头</span>
            </Col>
            <Col span="5">
              <span>平均净肉率：{{info.meatPercentAvg || 0}}%</span>
            </Col>
            <Col span="5">
              <span>牛肉单价：{{info.saleBeefPrice|| 0}}元/公斤</span>
            </Col>
            <Col span="5">
              <span>加工费：{{info.saleBeefCutPrice|| 0}}元/头</span>
            </Col>
          </Row>
          <el-table :data="arrFour" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="屠宰费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.butcherFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="净肉重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.beefsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.beefRate<0?'color:red':''">{{scope.row.beefRate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>活牛销售预估数据：</div>
          <el-table :data="arrFour" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="活牛重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.cowsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.cowrate<0?'color:red':''">{{scope.row.cowrate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div>胴体销售预估数据：</div>
          <el-table :data="arrFour" style="width: 100%;margin:10px 0" border stripe>
            <el-table-column prop="transporFee" label="运输费用(万元)" align="center"> 
              <template #default="scope">
                <span>{{scope.row.transporFee.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cowWeight" label="胴体重(公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtWeight.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="cost" label="单价(元/公斤)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtprice.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="收入(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtincome.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="销售毛利(万元)" align="center">
              <template #default="scope">
                <span>{{scope.row.dtsalesProfit.toFixed(2)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="invest" label="毛利率(%)" align="center">
              <template #default="scope">
                <span :style="scope.row.dtRate<0?'color:red':''">{{scope.row.dtRate.toFixed(2)}}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="牛副">
          <Row style="font-weight: 600;" class="rowStyle">
            <Col span="4">序号</Col>
            <Col span="5">部位</Col>
            <Col span="5">牛副占比</Col>
            <Col span="5">价格(元/公斤)</Col>
            <Col span="5">价值(元)</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">1</Col>
            <Col span="5">牛皮</Col>
            <Col span="5">{{infoOne.viceCowhide}}</Col>
            <Col span="5">{{info.viceCowhidePrice}}</Col>
            <Col span="5">{{infoVice.viceCowhideMoney?infoVice.viceCowhideMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">2</Col>
            <Col span="5">杂油</Col>
            <Col span="5">{{infoOne.viceOil}}</Col>
            <Col span="5">{{info.viceOilPrice}}</Col>
            <Col span="5">{{infoVice.viceOilMoney?infoVice.viceOilMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">3</Col>
            <Col span="5">牛头</Col>
            <Col span="5">{{infoOne.viceHead}}</Col>
            <Col span="5">{{info.viceHeadPrice}}</Col>
            <Col span="5">{{infoVice.viceHeadMoney?infoVice.viceHeadMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">4</Col>
            <Col span="5">牛蹄</Col>
            <Col span="5">{{infoOne.viceHoof}}</Col>
            <Col span="5">{{info.viceHoofPrice}}</Col>
            <Col span="5">{{infoVice.viceOilMoney?infoVice.viceOilMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">5</Col>
            <Col span="5">毛肚</Col>
            <Col span="5">{{infoOne.viceOmasum}}</Col>
            <Col span="5">{{info.viceOmasumPrice}}</Col>
            <Col span="5">{{infoVice.viceOmasumMoney?infoVice.viceOmasumMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">6</Col>
            <Col span="5">牛肝</Col>
            <Col span="5">{{infoOne.viceLiver}}</Col>
            <Col span="5">{{info.viceLiverPrice}}</Col>
            <Col span="5">{{infoVice.viceLiverMoney?infoVice.viceLiverMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">7</Col>
            <Col span="5">牛肠</Col>
            <Col span="5">{{infoOne.viceIntestine}}</Col>
            <Col span="5">{{info.viceIntestinePrice}}</Col>
            <Col span="5">{{infoVice.viceIntestineMoney?infoVice.viceIntestineMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">8</Col>
            <Col span="5">牛肺</Col>
            <Col span="5">{{infoOne.viceLung}}</Col>
            <Col span="5">{{info.viceLungPrice}}</Col>
            <Col span="5">{{infoVice.viceLungMoney?infoVice.viceLungMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">9</Col>
            <Col span="5">牛百叶</Col>
            <Col span="5">{{infoOne.viceTripe}}</Col>
            <Col span="5">{{info.viceTripePrice}}</Col>
            <Col span="5">{{infoVice.viceTripeMoney?infoVice.viceTripeMoney.toFixed(2):0}}</Col>
          </Row>
          <Row class="rowStyle">
            <Col span="4">10</Col>
            <Col span="5">牛心</Col>
            <Col span="5">{{infoOne.viceHeart}}</Col>
            <Col span="5">{{info.viceHeratPrice}}</Col>
            <Col span="5">{{infoVice.viceHeratMoney?infoVice.viceHeratMoney.toFixed(2):0}}</Col>
          </Row>
          <Row style="font-weight: 600;" class="rowStyle">
            <Col span="4">合计</Col>
            <Col span="5"></Col>
            <Col span="5">{{infoVice.totalWeight?infoVice.totalWeight.toFixed(2):0}}</Col>
            <Col span="5"></Col>
            <Col span="5">{{infoVice.totalMoney?infoVice.totalMoney.toFixed(2):0}}</Col>
          </Row>
        </el-tab-pane>
      </el-tabs>
      <template #footer>
        <div style="text-align:center;">
          <el-button @click="contentTypeModel = false">关闭</el-button>
        </div>
      </template>
    </Modal> 
  </div>
</template>

<script>
import { defineComponent,ref,reactive,onMounted } from 'vue'
import {item} from '@/request/api'
import { ElMessage } from 'element-plus'
import moment from 'moment'
export default defineComponent({
  components:{
    
  },
  setup() {
    let tabData = ref({})
    let typesearchFilter = reactive({limit:10,offset:0,cattleBreed:''})
    //获取列表内容
    async function getData(){
      await item.getCattleDealValuePage(typesearchFilter).then(res =>{
        if (res.code == 101) {
          tabData.value = res || {}
        }
      })
    }

    let currentPage = ref(1)
    //更改页码
    function changePage (page) {
      if(tabData.value.limit){
        typesearchFilter.offset = (page -1) *  tabData.value.limit  //更新偏移量
        currentPage = page  //切换当前页码
        getData()//获取广告数据
      }
    }
    let contentTypeModel = ref(false)
    let info = ref({})
    let arrOne = ref([])
    let arrTwo = ref([])
    let arrThree = ref([])
    let arrFour = ref([])
    let infoVice = ref({})
    //查看详情
    async function lookDetail(data){
      info.value = {}
      info.value = data
      if(data.targetWeight){
        info.value.isYf = 1
      }else{
        info.value.isYf = 0
      }
      info.value.priceDifference = (Number(data.saleCattlePrice)-Number(data.purchasePrice)).toFixed(2)
      await getcattleData(data.cattleBreed,data.cattleType)
      await calculateAll(info.value)
      contentTypeModel.value = true
    }
    //计算育肥，销售，牛副信息
    function calculateAll(data){
      arrOne.value = []
      arrTwo.value = []
      arrThree.value = []
      arrFour.value = []
      infoVice.value = {}
      // 计算牛只采购，牛只育肥
      let newobj = {}
      newobj.cattleBreed = data.cattleBreed
      newobj.cattleType = data.cattleType
      newobj.purchasePrice = data.purchasePrice
      if(data.cattleNum && data.cattleNum!= '' && data.purchaseWeight && data.purchaseWeight !=''){
        newobj.weight = Number(data.cattleNum)*Number(data.purchaseWeight)
      }else{
        newobj.weight = 0
      }
      if(data.cattleNum && data.cattleNum!= '' && data.purchaseWeight && data.purchaseWeight !='' && data.purchasePrice && data.purchasePrice !=''){
        newobj.totalMoney = (Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000
      }else{
        newobj.totalMoney = 0
      }
      if(data.cattleNum && data.cattleNum != '' && data.growTransport && data.growTransport !=''){
        newobj.transporFee = (Number(data.cattleNum)*Number(data.growTransport))/10000  //运输费用
      }else{
        newobj.transporFee = 0
      }
      if(data.targetWeight && data.targetWeight != '' && data.purchaseWeight && data.purchaseWeight!= '' &&data.growCycle && data.growCycle!=''){
        newobj.dailyGain = (Number(data.targetWeight)-Number(data.purchaseWeight))/Number(data.growCycle) //日增重
      }else{
        newobj.dailyGain = 0
      }
      if(data.grassFee && data.grassFee !='' && data.laborFee && data.laborFee!='' && data.spaceFee && data.spaceFee!='' && data.growCycle && data.growCycle!=''){
        newobj.invest = (((Number(data.grassFee)+Number(data.laborFee)+Number(data.spaceFee))*Number(data.growCycle)*Number(data.cattleNum))/10000)+newobj.transporFee  //育肥投资
      }else{
        newobj.invest = 0
      }
      if(newobj.invest != ''){
        newobj.cost = (newobj.invest * 10000)/((Number(data.targetWeight)-Number(data.purchaseWeight))*Number(data.cattleNum))
      }else{
        newobj.cost = 0
      }
      arrOne.value.push(newobj)
      // 计算牛只销售--活牛销售
      let infoXs = {dtRate:0,beefRate:0,cowWeight:0,price:0,income:0,rate:0,priceDifference:0}
      if(data.saleCattleTransport && data.saleCattleTransport != ''){
        infoXs.transporFee = (Number(data.cattleNum)*Number(data.saleCattleTransport))/10000 //运输费用
      }else{
        infoXs.transporFee = 0
      }
      if(data.saleCattlePrice != '' && data.saleCattleWeight !=''){
        infoXs.cowWeight = Number(data.cattleNum)*Number(data.saleCattleWeight)
        infoXs.price = Number(data.saleCattlePrice)  //销售单价
        infoXs.income = (infoXs.cowWeight*Number(data.saleCattlePrice))/10000   //收入万元
        infoXs.salesProfit = infoXs.income-((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)-newobj.invest-infoXs.transporFee//销售毛利(万元)
        infoXs.rate = (infoXs.salesProfit/infoXs.income)*100  //毛利率
        infoXs.priceDifference = (Number(data.saleCattlePrice)-Number(data.purchasePrice)).toFixed(2)
      }
      // 实际平均胴体率,实际平均净肉率
      if(data.saleCattleWeight && data.saleCattleWeight != ''){
        if(data.saleCattleWeight >= 800){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne + 2
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne + 2
        }else if(data.saleCattleWeight >= 750 && data.saleCattleWeight < 800){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne + 1.5
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne + 1.5
        }else if(data.saleCattleWeight >= 700 && data.saleCattleWeight < 750){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne + 1
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne + 1
        }else if(data.saleCattleWeight >= 650 && data.saleCattleWeight < 700){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne + 0.5
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne + 0.5
        }else if(data.saleCattleWeight >= 600 && data.saleCattleWeight < 650){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne 
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne
        }else if(data.saleCattleWeight >= 550 && data.saleCattleWeight < 600){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne -1
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne -1
        }else if(data.saleCattleWeight >= 500 && data.saleCattleWeight < 550){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne -3
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne -3
        }else if(data.saleCattleWeight >= 400 && data.saleCattleWeight < 500){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne -4.5
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne -4.5
        }else if(data.saleCattleWeight < 400){
          data.carcassPercentAvg  = infoOne.value.carcassPercentAvgOne -5
          data.meatPercentAvg  = infoOne.value.meatPercentAvgOne -5
        }
      }
      if(infoXs.cowWeight != ''){
        infoXs.dtWeight = infoXs.cowWeight * (Number(data.carcassPercentAvg)/100)//胴体重
        infoXs.beefWeight = infoXs.cowWeight * (Number(data.meatPercentAvg)/100)//净肉重
      }
      if(infoXs.dtRate == 0){
        infoXs.dtincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoXs.transporFee
        infoXs.dtsalesProfit = 0
      }else{
        infoXs.dtincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoXs.transporFee)*(1+infoXs.dtRate/100)
        infoXs.dtsalesProfit = infoXs.dtincome * infoXs.dtRate/100
      }
      infoXs.dtprice = (infoXs.dtincome*10000)/infoXs.dtWeight
      if(infoXs.beefRate == 0){
        infoXs.beefincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoXs.transporFee
        infoXs.beefsalesProfit = 0
      }else{
        infoXs.beefincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoXs.transporFee)*(1+infoXs.beefRate/100)
        infoXs.beefsalesProfit = infoXs.beefincome * infoXs.beefRate/100
      }
      infoXs.beefprice = (infoXs.beefincome*10000)/infoXs.beefWeight
      arrTwo.value.push(infoXs)
      // 计算牛只销售--胴体销售
      let infoDt = {cowrate:0,beefRate:0,price:0,income:0,salesProfit:0,rate:0}
      infoDt.transporFee = infoXs.transporFee
      if(data.saleCarcassCutPrice && data.saleCarcassCutPrice != ''){
        infoDt.butcherFee = (Number(data.saleCarcassCutPrice) * Number(data.cattleNum))/10000
      }else{
        infoDt.butcherFee = 0
      }
      infoDt.dtWeight = infoXs.dtWeight
      if(data.saleCarcassPrice && data.saleCarcassPrice != ''){
        infoDt.price = Number(data.saleCarcassPrice)  //销售单价
        infoDt.income = (infoDt.dtWeight * infoDt.price)/10000
        //销售毛利(万元)
        infoDt.salesProfit = infoDt.income-((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)-newobj.invest-infoDt.transporFee-infoDt.butcherFee
        infoDt.rate = (infoDt.salesProfit/infoDt.income)*100  //毛利率
      }
      //活牛重
      if(data.saleCattleWeight != ''){
        infoDt.cowWeight = Number(data.cattleNum)*Number(data.saleCattleWeight)
      }
      if(infoDt.cowrate == 0){
        infoDt.cowincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoDt.transporFee
        infoDt.cowsalesProfit = 0
      }else{
        infoDt.cowincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoDt.transporFee)*(1+infoDt.dtRate/100)
        infoDt.cowsalesProfit = infoDt.dtincome * infoDt.dtRate/100
      }
      infoDt.cowprice = (infoDt.cowincome*10000)/infoDt.cowWeight
      //净肉重
      infoDt.beefWeight = infoXs.beefWeight
      if(infoDt.beefRate == 0){
        infoDt.beefincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoDt.transporFee
        infoDt.beefsalesProfit = 0
      }else{
        infoDt.beefincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoDt.transporFee)*(1+infoDt.beefRate/100)
        infoDt.beefsalesProfit = infoDt.beefincome * infoDt.beefRate/100
      }
      infoDt.beefprice = (infoDt.beefincome*10000)/infoDt.beefWeight
      arrThree.value.push(infoDt)
      // 计算牛只销售--牛肉销售
      let infoBeef = {cowrate:0,dtRate:0,beefprice:0,beefincome:0,beefsalesProfit:0,beefRate:0}
      infoBeef.transporFee = infoXs.transporFee
      if(data.saleBeefCutPrice && data.saleBeefCutPrice != ''){
        infoBeef.butcherFee = (Number(data.saleBeefCutPrice) * Number(data.cattleNum))/10000
      }else{
        infoBeef.butcherFee = 0
      }
      infoBeef.beefWeight = infoXs.beefWeight
      if(data.saleBeefPrice && data.saleBeefPrice !=''){
        infoBeef.beefprice = Number(data.saleBeefPrice)  //销售单价
        infoBeef.beefincome = (infoBeef.beefWeight * infoBeef.beefprice)/10000
        infoBeef.beefsalesProfit = infoBeef.beefincome-((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)-newobj.invest-infoBeef.transporFee-infoBeef.butcherFee//销售毛利(万元)
        infoBeef.beefRate = (infoBeef.beefsalesProfit/infoBeef.beefincome)*100  //毛利率
      }
      //活牛重
      if(data.saleCattleWeight != ''){
        infoBeef.cowWeight = Number(data.cattleNum)*Number(data.saleCattleWeight)
      }
      if(infoBeef.cowrate == 0){
        infoBeef.cowincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoBeef.transporFee
        infoBeef.cowsalesProfit = 0
      }else{
        infoBeef.cowincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoBeef.transporFee)*(1+infoBeef.cowrate/100)
        infoBeef.cowsalesProfit = infoBeef.dtincome * infoBeef.cowrate/100
      }
      infoBeef.cowprice = (infoBeef.cowincome*10000)/infoBeef.cowWeight
      //胴体重
      infoBeef.dtWeight = infoXs.dtWeight
      if(infoBeef.dtRate == 0){
        infoBeef.dtincome = ((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoBeef.transporFee
        infoBeef.dtsalesProfit = 0
      }else{
        infoBeef.dtincome = (((Number(data.cattleNum)*Number(data.purchaseWeight)*Number(data.purchasePrice))/10000)+newobj.invest+infoBeef.transporFee)*(1+infoBeef.dtRate/100)
        infoBeef.dtsalesProfit = infoBeef.dtincome * infoBeef.dtRate/100
      }
      infoBeef.dtprice = (infoBeef.dtincome*10000)/infoBeef.dtWeight
      arrFour.value.push(infoBeef)
      //计算牛副
      if(data.viceCowhidePrice && data.viceCowhidePrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceCowhideMoney = data.saleCattleWeight * (Number(infoOne.value.viceCowhide)/100) * Number(data.viceCowhidePrice)
      }
      if(data.viceOilPrice && data.viceOilPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceOilMoney = data.saleCattleWeight * (Number(infoOne.value.viceOil)/100) * Number(data.viceOilPrice)
      }
      if(data.viceHeadPrice && data.viceHeadPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceHeadMoney = data.saleCattleWeight * (Number(infoOne.value.viceHead)/100) * Number(data.viceHeadPrice)
      }
      if(data.viceHoofPrice && data.viceHoofPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceHoofMoney = data.saleCattleWeight * (Number(infoOne.value.viceHoof)/100) * Number(data.viceHoofPrice)
      }
      if(data.viceOmasumPrice && data.viceOmasumPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceOmasumMoney = data.saleCattleWeight * (Number(infoOne.value.viceOmasum)/100) * Number(data.viceOmasumPrice)
      }
      if(data.viceLiverPrice && data.viceLiverPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceLiverMoney = data.saleCattleWeight * (Number(infoOne.value.viceLiver)/100) * Number(data.viceLiverPrice)
      }
      if(data.viceIntestinePrice && data.viceIntestinePrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceIntestineMoney = data.saleCattleWeight * (Number(infoOne.value.viceIntestine)/100) * Number(data.viceIntestinePrice)
      }
      if(data.viceLungPrice && data.viceLungPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceLungMoney = data.saleCattleWeight * (Number(infoOne.value.viceLung)/100) * Number(data.viceLungPrice)
      }
      if(data.viceTripePrice && data.viceTripePrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceTripeMoney = data.saleCattleWeight * (Number(infoOne.value.viceTripe)/100) * Number(data.viceTripePrice)
      }
      if(data.viceHeratPrice && data.viceHeratPrice != '' && data.saleCattleWeight != ''){
        infoVice.value.viceHeratMoney = data.saleCattleWeight * (Number(infoOne.value.viceHeart)/100) * Number(data.viceHeratPrice)
      }
      infoVice.value.totalWeight = Number(infoOne.value.viceCowhide) + Number(infoOne.value.viceOil) + Number(infoOne.value.viceHead) + Number(infoOne.value.viceHoof)+Number(infoOne.value.viceOmasum)+
                              Number(infoOne.value.viceLiver)+Number(infoOne.value.viceIntestine)+Number(infoOne.value.viceLung)+Number(infoOne.value.viceTripe)+Number(infoOne.value.viceHeart)
      infoVice.value.totalMoney = infoVice.value.viceCowhideMoney+infoVice.value.viceOilMoney+infoVice.value.viceHeadMoney+
                                  infoVice.value.viceHoofMoney+infoVice.value.viceOmasumMoney+
                                  infoVice.value.viceLiverMoney +infoVice.value.viceIntestineMoney+infoVice.value.viceLungMoney+
                                  infoVice.value.viceTripeMoney+infoVice.value.viceHeratMoney
    }
    
    let infoOne = ref({})
    //获取当前牛种信息
    async function getcattleData(cattleBreed,cattleType){
      await item.getCattleParamOne({cattleBreed:cattleBreed,cattleType:cattleType}).then(res =>{
        if (res.code == 101) {
          infoOne.value.carcassPercentAvgOne = res.data && res.data.carcassPercentAvg?res.data.carcassPercentAvg:0
          infoOne.value.meatPercentAvgOne = res.data && res.data.meatPercentAvg?res.data.meatPercentAvg:0
          infoOne.value.viceCowhide = res.data && res.data.viceCowhide?res.data.viceCowhide:0
          infoOne.value.viceHead = res.data && res.data.viceHead?res.data.viceHead:0
          infoOne.value.viceHeart = res.data && res.data.viceHeart?res.data.viceHeart:0
          infoOne.value.viceHoof = res.data && res.data.viceHoof?res.data.viceHoof:0
          infoOne.value.viceIntestine = res.data && res.data.viceIntestine?res.data.viceIntestine:0
          infoOne.value.viceLiver = res.data && res.data.viceLiver?res.data.viceLiver:0
          infoOne.value.viceLung = res.data && res.data.viceLung?res.data.viceLung:0
          infoOne.value.viceOil = res.data && res.data.viceOil?res.data.viceOil:0
          infoOne.value.viceOmasum = res.data && res.data.viceOmasum?res.data.viceOmasum:0
          infoOne.value.viceTripe = res.data && res.data.viceTripe?res.data.viceTripe:0
        }
      })
    }
    onMounted(()=>{
      getData() 
    })

    return {
      typesearchFilter,getData,tabData,changePage,currentPage,moment,lookDetail,info,contentTypeModel,arrOne,arrTwo,arrThree,arrFour,infoOne,infoVice
    }
  },
  methods:{
    
  }
})
</script>

<style lang="scss">
.recondsInfo{
  padding: 1em;
  .page_style{
    text-align: right; margin-top: 1em;
    background-color: var(--system-container-background);
  }
}
.el-divider__text.is-center{
  color: #409EFF !important;
}
.rowStyle{
  height: 30px;
  text-align: center;
  line-height: 30px;
}
</style>