| <template> | 
|   <TableLayout :permissions="['business:pricingparam:query']"> | 
|     <!-- 搜索表单 --> | 
|     <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> | 
|        | 
|       <el-form-item label="方案名称" prop="name"> | 
|         <el-input v-model="searchForm.name" placeholder="请输入方案名称" @keypress.enter.native="search"></el-input> | 
|       </el-form-item> | 
|        | 
|       <section> | 
|         <el-button type="primary" @click="search">搜索</el-button> | 
|         <el-button @click="reset">重置</el-button> | 
|       </section> | 
|     </el-form> | 
|     <!-- 表格和分页 --> | 
|     <template v-slot:table-wrap> | 
|       <ul class="toolbar" v-permissions="['business:pricingparam:create']"> | 
|         <li><el-button type="primary" @click="$refs.operaPricingParamWindow.open('新建定价方案配置')" icon="el-icon-plus" v-permissions="['business:pricingparam:create']">新建</el-button></li> | 
|       </ul> | 
|       <el-table | 
|         v-loading="isWorking.search" | 
|         :data="tableData.list" | 
|         stripe | 
|         border | 
|       > | 
|         <el-table-column prop="name" label="方案名称" min-width="100px" align="center"></el-table-column> | 
|         <el-table-column prop="startDate" label="开始时间" min-width="100px" align="center"></el-table-column> | 
|         <el-table-column prop="endDate" label="结束时间" min-width="100px" align="center"></el-table-column> | 
|          | 
|         <el-table-column prop="sortnum" label="优先级(升序)" min-width="100px" align="center"></el-table-column> | 
|         <el-table-column prop="status" label="状态" min-width="100px" align="center"> | 
|           <template slot-scope="{row}"> | 
|             <!--  0启用 1禁用 --> | 
|             <el-switch v-model="row.status" :active-value="0" :inactive-value="1" active-color="#13ce66" @change="changeStatus(row)"></el-switch> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="createDate" label="创建时间" min-width="100px" align="center"></el-table-column> | 
|         <el-table-column | 
|           v-if="containPermissions(['business:pricingparam:update', 'business:pricingparam:delete'])" | 
|           label="操作" | 
|           min-width="120" | 
|           align="center" | 
|           fixed="right" | 
|         > | 
|           <template slot-scope="{row}"> | 
|             <el-button type="text" @click="$refs.priceConfiguration.open(`${row.name}定价方案`, row)">配置费率</el-button> | 
|             <el-button type="text" @click="$refs.operaPricingParamWindow.open('编辑定价方案配置', row)" v-permissions="['business:pricingparam:update']">编辑</el-button> | 
|             <el-button type="text" @click="deleteById(row)" v-permissions="['business:pricingparam:delete']">删除</el-button> | 
|           </template> | 
|         </el-table-column> | 
|       </el-table> | 
|       <pagination | 
|         @size-change="handleSizeChange" | 
|         @current-change="handlePageChange" | 
|         :pagination="tableData.pagination" | 
|       > | 
|       </pagination> | 
|     </template> | 
|     <!-- 新建/修改 --> | 
|     <OperaPricingParamWindow ref="operaPricingParamWindow" @success="handlePageChange"/> | 
|     <PriceConfiguration ref="priceConfiguration" @success="handlePageChange"/> | 
|   </TableLayout> | 
| </template> | 
|   | 
| <script> | 
| import BaseTable from '@/components/base/BaseTable' | 
| import TableLayout from '@/layouts/TableLayout' | 
| import Pagination from '@/components/common/Pagination' | 
| import OperaPricingParamWindow from '@/components/business/OperaPricingParamWindow' | 
| import PriceConfiguration from '@/components/business/priceConfiguration' | 
| import { updateById } from '@/api/business/pricingParam' | 
| export default { | 
|   name: 'PricingParam', | 
|   extends: BaseTable, | 
|   components: { TableLayout, Pagination, OperaPricingParamWindow, PriceConfiguration }, | 
|   data () { | 
|     return { | 
|       // 搜索 | 
|       searchForm: { | 
|         id: '', | 
|         createDate: '', | 
|         creator: '', | 
|         editDate: '', | 
|         editor: '', | 
|         isdeleted: '', | 
|         name: '', | 
|         startDate: '', | 
|         endDate: '', | 
|         sortnum: '', | 
|         status: '', | 
|         info: '' | 
|       } | 
|     } | 
|   }, | 
|   created () { | 
|     this.config({ | 
|       module: '定价方案配置', | 
|       api: '/business/pricingParam', | 
|       'field.id': 'id', | 
|       'field.main': 'id' | 
|     }) | 
|     this.search() | 
|   }, | 
|   methods: { | 
|     changeStatus(row) { | 
|       updateById(row) | 
|         .then(() => { | 
|           this.$tip.apiSuccess('成功') | 
|         }) | 
|         .catch(e => { | 
|           this.$tip.apiFailed(e) | 
|         }) | 
|         .finally(() => { | 
|           this.handlePageChange() | 
|         }) | 
|     } | 
|   }, | 
| } | 
| </script> |