<!--
 * @Author: wenjie 1454560336@qq.com
 * @Date: 2024-12-19 10:23:48
 * @LastEditors: wenjie 1454560336@qq.com
 * @LastEditTime: 2024-12-23 14:17:07
 * @FilePath: \mall4vs-bbc\src\views\modules\shop\shopCoverage.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <div class="mod-coverage">

    <avue-crud ref="crud"
               :page="page"
               :data="dataList"
               :table-loading="dataListLoading"
               :option="tableOption"
               @search-change="searchChange"
               @on-load="getDataList"
               @refresh-change="refreshChange"
               >

      <template slot-scope="scope"
                slot="menu">
        <el-button type="primary"
                   size="small"
                   icon="el-icon-edit"
                   @click="addOrUpdateHandle(scope.row)">设置配送范围</el-button>
      </template>

    </avue-crud>
  </div>
</template>

<script>
import { tableOption } from '@/crud/shop/shopCoverage'
export default {
  data () {
    return {
      dataForm: {

      },
      dataList: [],
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 10 // 每页显示多少条
      },
      searchForm: {},
      dataListLoading: false,
      dataListSelections: [],
      tableOption: tableOption
    }
  },
  components: {
    
  },
  methods: {
    // 获取数据列表
    getDataList (page) {
      this.dataListLoading = true
      this.$http({
        url: this.$http.adornUrl('/shop/transport2/shopPage'),
        method: 'get',
        params: this.$http.adornParams(Object.assign({
          current: page ? page.currentPage : 1,
          size: page ? page.pageSize : 20
        }, this.searchForm))
      }).then(({ data }) => {
        this.page.total = data.total
        this.page.pageSize = data.size
        this.page.currentPage = data.current
        this.dataList = [data]
        this.dataListLoading = false
      })
    },
    addOrUpdateHandle(row){
      this.$router.push({
        path: '/coverage',
        query:{
          id:row.shopId
        }
      })
    },

    // 点击查询
    searchChange (params) {
      this.searchForm = params
      this.page.currentPage = 1
      this.page.pageSize = 10
      this.getDataList(this.page)
    },
    // 刷新回调用
    refreshChange () {
      this.page = this.$refs.crud.$refs.tablePage.defaultPage
      this.getDataList(this.page)
    }
  }
}
</script>
