<!-- @desc:新手指导  @auth:付斌  @time:2024/07/01 09:15 -->
<template>
  <div class="main-div">
    <!--  卡片区  -->
    <div class="index-card">
      <div style="display: flex;justify-content: space-between">
        <div style="width: 90%">
          <Steps :current="current" style="margin: 20px 0px 20px 0px">
            <Step title="录入资料" content="录入商品信息是进行店铺管理的第一步，店铺信息的完善是精细化运营的必经之路"></Step>
            <Step title="开单记账" content="记录单据让每笔交易有迹可循，告别手工记录，数字化管理店铺"></Step>
            <Step title="分析报表" content="系统自动生成数据报表，数据辅助决策，助力生意增长"></Step>
          </Steps>
          <Button type="primary" style="margin: 0px 10px 20px 0px" @click="last">上一步</Button>
          <Button type="primary" style="margin: 0px 0px 20px 0px" @click="next">下一步</Button>
          <!--  表格部分  -->
          <DkTable slot="top" :id="'table-'+$options.name"
                   ref="table-select" name="table" :data="tableData" primaryKey="project"
                   :page-flag="false"
                   :height="this.tableHeight  - 200">
            <DkTableColumn field="project"/>
            <DkTableColumn field="summary"/>
            <DkTableColumn field="operate" :type="'link'" @on-link="linkPage"/>
          </DkTable>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

import {indexMixin} from '@/mixins'

export default {
  name: 'beginners-guide',
  mixins: [indexMixin],
  data() {
    let self = this
    return {
      current: 0,
      tableData: [],
    }
  },

  methods: {
    /**
     * @desc   : 上一步
     * @author : 付斌
     * @date   : 2024-07-01 9:48
     */
    last() {
      if (this.current == 0) {
        this.current = 2;
      } else {
        this.current -= 1;
      }
      this.setTableData();
    },
    /**
     * @desc   : 下一步
     * @author : 付斌
     * @date   : 2024-07-01 9:48
     */
    next() {
      if (this.current == 2) {
        this.current = 0;
      } else {
        this.current += 1;
      }
      this.setTableData();
    },
    /**
     * @desc   : 设置数据源
     * @author : 付斌
     * @date   : 2024-07-01 9:48
     */
    setTableData() {
      if (this.current == 0) {
        this.tableData = [
          {"project": "添加商品", "summary": "管理你的商品信息", "operate": "演示教程"},
          {"project": "添加客户", "summary": "维护你的客户资料", "operate": "演示教程"},
          {"project": "添加供应商", "summary": "管理你的供应商", "operate": "演示教程"},
          {"project": "添加员工", "summary": "多人看店不忙碌", "operate": "演示教程"},
        ]
      } else if (this.current == 1) {
        this.tableData = [
          {"project": "销售单", "summary": "卖一笔记一笔", "operate": "演示教程"},
          {"project": "进货单", "summary": "记录每次进货", "operate": "演示教程"},
          {"project": "收款单", "summary": "不忘每笔收款", "operate": "演示教程"},
          {"project": "付款单", "summary": "记录每单应付款", "operate": "演示教程"},
        ]
      } else if (this.current == 2) {
        this.tableData = [
          {"project": "利润统计", "summary": "查看店铺利润情况", "operate": "演示教程"},
          {"project": "销售统计", "summary": "掌握商品销售排名", "operate": "演示教程"},
          {"project": "库存统计", "summary": "库存清晰不错乱", "operate": "演示教程"},
        ]
      }
    },
    /**
     * @desc   : 进入页面
     * @author : 付斌
     * @date   : 2024-07-01 10:10
     */
    linkPage(row) {
      console.log("row", row)
      switch (row.project) {
        case '添加商品':
          this.$router.push('/mst/goods/add/')
          break;
        case '添加客户':
          this.$router.push('/mst/customer/add/')
          break;
        case '添加供应商':
          this.$router.push('/mst/supplier/index/')
          break;
        case '添加员工':
          this.$router.push('/mst/staff/index/')
          break;
        case '销售单':
          this.$router.push('/sale/order/add/')
          break;
        case '进货单':
          this.$router.push('/pur/pur-order/add/')
          break;
        case '收款单':
          this.$router.push('/fin/receipt/add/')
          break;
        case '付款单':
          this.$router.push('/fin/payment/add/')
          break;
        case '利润统计':
          this.$router.push('/fin/profit-report/index/')
          break;
        case '销售统计':
          this.$router.push('/report/detail-report/index/order-detail-report')
          break;
        case '库存统计':
          this.$router.push('/report/detail-report/index/ivt-detail-report')
          break;
      }
    },
  },
  /**
   * @desc   : 在实例创建完成后被立即同步调用
   * @author : 付斌
   * @date   : 2024-07-01 10:10
   */
  created() {
    this.routeObjName = 'beginnersGuide'  // 设置路由名称
    this.setTableData()
  },
}
</script>

