123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <template>
- <div class="permissionSetting-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="permissionSetting-cont">
-
- <template slot="subTitle">
- <a id="permissionSetting-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- <span style="margin-left: 20px;color: #666;">经销商:{{ $route.params.name }}</span>
- </template>
- </a-page-header>
- <a-card size="small" :bordered="false" class="permissionSetting-main">
-
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form-model
- id="permissionSetting-form"
- ref="ruleForm"
- class="form-model-con"
- layout="inline"
- :model="queryParam">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="品牌" prop="productBrandSn">
- <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="产品分类" prop="productType">
- <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="chooseProducts-productType"></productTypeAll>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="价格级别" prop="priceLevel">
- <v-select code="PRICE_LEVEL" id="productLevelEdit-priceLevel" v-model="queryParam.priceLevel" allowClear placeholder="请选择价格级别"></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="getData" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="permissionSetting-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
-
- <div class="table-operator">
- <a-button type="primary" class="button-error" @click="chooseTModal">选择品类</a-button>
- <span v-if="!showEmpty">
- <a-button type="primary" v-if="$route.params.dealerLevel != 'SPECIAL'" class="button-info" @click="handleEdit()">批量编辑</a-button>
- <a-button type="primary" ghost class="button-error" @click="handleDel()">批量删除</a-button>
- </span>
- </div>
-
- <div :style="{height:tableHeight+'px'}">
- <ve-table
- border-y
- v-show="!showEmpty"
- :scroll-width="0"
- :max-height="(tableHeight)"
- :show-header="showTableHead"
- :row-style-option="{clickHighlight: true}"
- :cellSelectionOption="{enable: false}"
- :virtual-scroll-option="{enable: true}"
- :columns="columns"
- :table-data="dataSource"
- row-key-field-name="dealerScopeSn"
- :checkbox-option="checkboxOption"
- />
- <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
- </div>
- </a-card>
- </a-spin>
-
- <chooseTypeModal ref="chooseType" :openModal="openTypeModal" @close="openTypeModal=false" @ok="getData" />
-
- <editPriceLevelModal :priceLevelVal="itemPriceLevel" :openModal="openPriceLevelModal" @close="closePriceLevelModal" @ok="handlePriceLevelOk" />
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import ChooseTypeModal from './chooseTypeModal.vue'
- import editPriceLevelModal from './priceLevelModal.vue'
- import productTypeAll from '@/views/common/productTypeAll.js'
- import ProductBrand from '@/views/common/productBrand.js'
- import { Empty } from 'ant-design-vue'
- import { dealerScopeModifyPriceLevel, dealerScopeDelete, dealerScopeQueryList } from '@/api/dealerScope'
- export default {
- name: 'MerchantInfoManagementSet',
- mixins: [commonMixin],
- components: { STable, VSelect, ChooseTypeModal, productTypeAll, ProductBrand, editPriceLevelModal },
- data () {
- return {
- spinning: false,
- tableHeight: 0,
- queryParam: {
- productBrandSn: undefined,
- productTypeSn1: '',
- productTypeSn2: '',
- productTypeSn3: '',
- priceLevel: undefined
- },
- productType: [],
- disabled: false,
- openTypeModal: false,
- openPriceLevelModal: false,
- itemPriceLevel: '',
- simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
- dataSource: [],
- showEmpty: false,
- showTableHead: true,
- selectedRowKeys: []
- }
- },
- computed: {
- columns () {
- const _this = this
-
- const actionFormat = function (record, data) {
- if (_this.$route.params.dealerLevel != 'SPECIAL') {
- return (
- <div>
- <a-button size="small" type="link" class="button-info" onClick={() => _this.handleEdit(record)}>编辑</a-button>
- <a-button size="small" type="link" class="button-error" onClick={() => _this.handleDel(record)}>删除</a-button>
- </div>
- )
- } else {
- return (
- <div>
- <a-button
- size="small"
- type="link"
- class="button-info"
- onClick={() => _this.handleDel(record)}
- >删除</a-button>
- </div>
- )
- }
- }
- const arr = [
- { title: '', field: '', key: 'acheck', width: 60, type: 'checkbox', align: 'center' },
- { title: '品牌', field: 'productBrandName', key: 'a', align: 'center', width: 160, operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '全品类' } },
- { title: '一级分类', field: 'productTypeName1', key: 'b', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
- { title: '二级分类', field: 'productTypeName2', key: 'c', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
- { title: '三级分类', field: 'productTypeName3', key: 'd', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
- { title: '价格级别', field: 'priceLevelDictValue', key: 'd', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
- { title: '操作', field: 'action', width: 100, key: 'e', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column }) => { return actionFormat(row, row[column.field]) } }
- ]
- return arr
- },
- checkboxOption () {
- const _this = this
- return {
- selectedRowKeys: _this.selectedRowKeys,
-
- selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
- _this.selectedRowKeys = selectedRowKeys
- },
-
- selectedAllChange: ({ isSelected, selectedRowKeys }) => {
- _this.selectedRowKeys = selectedRowKeys
- }
- }
- }
- },
- methods: {
- getData () {
- const _this = this
- _this.disabled = true
- _this.spinning = true
- _this.queryParam.dealerSn = _this.$route.params.sn
- dealerScopeQueryList(_this.queryParam).then(res => {
- if (res.status == 200) {
- _this.dataSource = res.data
- }
- _this.showEmpty = _this.dataSource.length <= 0
- _this.disabled = false
- _this.spinning = false
- })
- },
-
- chooseTModal () {
- if (this.dataSource.length === 1 && this.dataSource[0] && !this.dataSource[0].productBrandSn) {
- this.$message.warning('选择全品类后,不能再添加其他品类!')
- return
- }
- this.selectedRowKeys = []
- this.openTypeModal = true
- this.$nextTick(() => {
- this.$refs.chooseType.getDisabledList()
- })
- },
-
- handleEdit (row) {
- if (row) {
- this.selectedRowKeys = []
- this.selectedRowKeys.push(row.dealerScopeSn)
- this.itemPriceLevel = row.priceLevel
- } else {
- this.itemPriceLevel = ''
- if (this.selectedRowKeys && this.selectedRowKeys.length === 0) {
- this.$message.warning('请选择一条数据')
- return
- }
- }
- this.$nextTick(() => {
- this.openPriceLevelModal = true
- })
- },
-
- handlePriceLevelOk (val) {
- const _this = this
- dealerScopeModifyPriceLevel({
- snList: this.selectedRowKeys,
- priceLevel: val
- }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.resetSearchForm()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- },
- closePriceLevelModal () {
- this.itemPriceLevel = ''
- this.openPriceLevelModal = false
- },
-
- changeProductType (val, opt) {
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
- },
-
- handleDel (row) {
- const _this = this
- if (!row && this.selectedRowKeys && this.selectedRowKeys.length === 0) {
- this.$message.warning('请选择一条数据')
- return
- }
- const newSnList = row ? [row.dealerScopeSn] : _this.selectedRowKeys
- this.$confirm({
- title: '提示',
- content: '经销权删除后,该商户的差价设置将同步解除,确定删除吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- dealerScopeDelete({ snList: newSnList }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.resetSearchForm()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
-
- resetSearchForm () {
- this.queryParam.productBrandSn = undefined
- this.queryParam.productTypeSn1 = ''
- this.queryParam.productTypeSn2 = ''
- this.queryParam.productTypeSn3 = ''
- this.queryParam.priceLevel = undefined
- this.productType = []
- this.getData()
- },
-
- handleBack () {
- this.selectedRowKeys = []
- this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list', query: { closeLastOldTab: true } })
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => {
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 205
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) {
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
-
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less" scoped>
- .permissionSetting-wrap{
- .permissionSetting-cont{
- margin-bottom: 6px;
- }
- .empty-data{
- padding-top:100px;
- }
- }
- /deep/.ve-checkbox .ve-checkbox-checked .ve-checkbox-inner {
- background-color: #ed1c24 !important;
- border-color: #ed1c24 !important;
- }
- /deep/.ve-checkbox .ve-checkbox-indeterminate .ve-checkbox-inner::after{
- background-color: #ed1c24 !important;
- }
- </style>
|