<template>
  <BasePage>
    <div class="merchant">
      <div class="shopinfo">
        <img class="tx" :src="$file(data.MerchantAvatar)">
        <div class="info">
          <b>{{ data.MerchantName }}</b>
          <p>账号：{{ data.MerchantPhone }}</p>
        </div>

        <div class="service-box" @click="$navigate('Service')">
          <img class="icon" src="/img/service-icon.png" alt="">
          专属顾问
        </div>
      </div>

      <div class="wallet">
        <b>
          我的钱包
        </b>
        <div class="cc">
          <div class="ll" @click="$navigate('MerchantIncome')">
            <span>
              当前营业收入<van-icon name="arrow"></van-icon>
            </span>
            <b>{{ data.Income?.toFixed(2) }}</b>
          </div>
          <div class="ll" @click="$navigate('Voucher?type=merchant')">
            <span>
              消费券累计<van-icon name="arrow"></van-icon>
            </span>
            <b>{{ data.Point?.toFixed(2) }}</b>
          </div>
        </div>
      </div>

      <div class="block">
        <!-- <div class="d1" @click="$navigate('MerchantTrade')">
          <b>订单记录</b>
          <p>查看订单记录</p>
          <van-badge :content="expiring ? expiring : ''" :offset="[60, -40]">
            <button>立即查看</button>
          </van-badge>
          <img src="/img/bbb1.png">
        </div> -->
        <div class="_r">
          <div class="d2" @click="$navigate('MerchantTrade')">
            <b>订单记录</b>
            <p>查看订单记录</p>
            <button>立即查看</button>
            <img src="/img/bbb2.png">
          </div>
          <div class="d3" @click="$navigate('MerchantProduct')">
            <b>产品列表</b>
            <p>查看我的产品</p>
            <button>立即查看</button>
            <img src="/img/bbb3.png">
          </div>
        </div>

      </div>

      <div class="countbox">
        <div class="title">
          <b>经营数据</b>
        </div>
        <div class="box line">
          <span>截止{{ data.endTimes }}</span>
          <p class="refresh" @click="init">刷新</p>
          <p class="cou r" @click="$navigate('Statistics')">统计<van-icon name="arrow"></van-icon></p>
        </div>

        <div class="list">
          <div class="item">
            <span>
              今日营业额（元）
            </span>
            <b>{{ data.TodayAmount?.toFixed(2) }}</b>
            <p>昨日<span>{{ data.YesterdayAmount?.toFixed(2) }}</span></p>
          </div>

          <div class="item">
            <span>
              今日抵扣积分
            </span>
            <b>{{ data.TodayDeduct?.toFixed(2) }}</b>
            <p>昨日<span>{{ data.YesterdayDeduct?.toFixed(2) }}</span></p>
          </div>

          <div class="item">
            <span>
              今日订单数
            </span>
            <b>{{ data.TodayQty }}</b>
            <p>昨日<span>{{ data.YesterdayQty }}</span></p>
          </div>

          <div class="item">
            <span>
              本月收入（元）
            </span>
            <b>{{ data.MonthIncome?.toFixed(2) }}</b>
            <p>上月<span>{{ data.PrevMonthIncome?.toFixed(2) }}</span></p>
          </div>
        </div>
      </div>

      <button class="back" @click="$showManagerPopup()">
        返回个人中心
      </button>


    </div>
  </BasePage>

</template>

<script>
export default {
  name: 'Merchant',
  mounted() {
    this.init();
  },
  data() {
    return {
      showInfo: false,
      data: {
        id: 'merchant_001',
        MerchantAvatar: '/img/co-1.png',
        MerchantName: '泰古润直营店',
        MerchantPhone: '13800138000',
        Income: 12868.50,
        Point: 5680.00,
        TodayAmount: 5680.00,
        YesterdayAmount: 4200.00,
        TodayDeduct: 1280.00,
        YesterdayDeduct: 980.00,
        TodayQty: 45,
        YesterdayQty: 38,
        MonthIncome: 45600.00,
        PrevMonthIncome: 38500.00,
        endTimes: '2024-04-18 10:30'
      },
      States: 0,
      expiring: 3,
    }
  },
  methods: {
    init() {
    },
  }
}
</script>
