|
@@ -0,0 +1,304 @@
|
|
|
|
+<template>
|
|
|
|
+ <a-card size="small" :bordered="false" class="subsidizedProducts-wrap searchBoxNormal">
|
|
|
|
+ <!-- 搜索条件 -->
|
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
|
+ <a-form layout="inline" id="subsidizedProducts-form" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
|
+ <a-row :gutter="15">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="产品名称">
|
|
|
|
+ <a-input id="subsidizedProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="产品编码/原厂编码">
|
|
|
|
+ <a-input id="subsidizedProducts-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码/原厂编码"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="产品品牌">
|
|
|
|
+ <productBrand id="subsidizedProducts-productBrandSn" v-model="queryParam.productBrandSn"></productBrand>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <template v-if="advanced">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="产品分类">
|
|
|
|
+ <productType id="subsidizedProducts-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></productType>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="商城类目">
|
|
|
|
+ <mallCategory id="subsidizedProducts-category" @change="changeProductsCategory" v-model="category"></mallCategory>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="subsidizedProducts-refresh">查询</a-button>
|
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="subsidizedProducts-reset">重置</a-button>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 操作按钮 -->
|
|
|
|
+ <div class="table-operator-nobor">
|
|
|
|
+ <a-button id="subsidizedProducts-add" type="primary" class="button-error" @click="openAddModal=true">新增</a-button>
|
|
|
|
+ <a-button id="subsidizedProducts-edit" type="primary" class="button-info" @click="handleAdd">批量编辑</a-button>
|
|
|
|
+ <a-button id="subsidizedProducts-del" type="primary" class="button-error" ghost @click="handleAdd">批量删除</a-button>
|
|
|
|
+ <a-button id="subsidizedProducts-import" style="margin-left:5px;" @click="handleAdd">导入</a-button>
|
|
|
|
+ </div>
|
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <s-table
|
|
|
|
+ class="sTable fixPagination"
|
|
|
|
+ ref="table"
|
|
|
|
+ :style="{ height: tableHeight+70+'px' }"
|
|
|
|
+ size="small"
|
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="loadData"
|
|
|
|
+ :pageSize="20"
|
|
|
|
+ :scroll="{ y: tableHeight - 10 }"
|
|
|
|
+ :defaultLoadData="false"
|
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
|
+ bordered>
|
|
|
|
+ <!-- 产品分类 -->
|
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 促销时间 -->
|
|
|
|
+ <template slot="promoTime" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.promoStartDate">{{ record.promoStartDate }} 至 {{ record.promoEndDate }}</span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 商城类目 -->
|
|
|
|
+ <template slot="categoryName" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.indName || record.dirName">{{ record.indName }} {{ (record.indName&&record.dirName) ? '>' : '' }} {{ record.dirName }}</span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 操作 -->
|
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
|
+ <a-button
|
|
|
|
+ size="small"
|
|
|
|
+ v-if="$hasPermissions('B_product_dealerProduct_edit')"
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-primary"
|
|
|
|
+ @click="handleEdit(record)"
|
|
|
|
+ :id="'productInfoList-edit-'+record.productSn"
|
|
|
|
+ >
|
|
|
|
+ 编辑
|
|
|
|
+ </a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ v-if="$hasPermissions('B_product_dealerProduct_detail')"
|
|
|
|
+ size="small"
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-error"
|
|
|
|
+ @click="handleDel(record)"
|
|
|
|
+ :id="'productInfoList-detail-'+record.productSn"
|
|
|
|
+ >
|
|
|
|
+ 删除
|
|
|
|
+ </a-button>
|
|
|
|
+ <span v-if="!$hasPermissions('B_product_dealerProduct_edit') && !$hasPermissions('B_product_dealerProduct_detail')">--</span>
|
|
|
|
+ </template>
|
|
|
|
+ </s-table>
|
|
|
|
+ </a-spin>
|
|
|
|
+ <!-- 新增 -->
|
|
|
|
+ <subsidyAddModal ref="partQuery" :openModal="openAddModal" @close="openAddModal=false"></subsidyAddModal>
|
|
|
|
+ <!-- 编辑 -->
|
|
|
|
+ <subsidy-edit-modal :openModal="openEditModal" @ok="$refs.table.refresh(true)" @close="openEditModal=false" />
|
|
|
|
+ <!-- 导入产品 -->
|
|
|
|
+ <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="hanldeImprotOk" />
|
|
|
|
+ </a-card>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
|
+// 组件
|
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
|
+import productType from '@/views/common/productType.js'
|
|
|
|
+import productBrand from '@/views/common/productBrand.js'
|
|
|
|
+import mallCategory from '@/views/common/mallCategory.js'
|
|
|
|
+import subsidyAddModal from './subsidyAddModal.vue'
|
|
|
|
+import subsidyEditModal from './editModal.vue'
|
|
|
|
+import importGuideModal from './importGuideModal.vue'
|
|
|
|
+// 接口
|
|
|
|
+import { shopPromoProductList } from '@/api/shopPromoProduct'
|
|
|
|
+export default {
|
|
|
|
+ name: 'SubsidizedProductsList',
|
|
|
|
+ mixins: [commonMixin],
|
|
|
|
+ components: { STable, VSelect, productType, productBrand, mallCategory, subsidyAddModal, subsidyEditModal, importGuideModal },
|
|
|
|
+ data () {
|
|
|
|
+ const _this = this
|
|
|
|
+ return {
|
|
|
|
+ spinning: false,
|
|
|
|
+ advanced: true, // 高级搜索 展开/关闭
|
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
|
+ tableHeight: 0, // 表格高度
|
|
|
|
+ // form表单label布局
|
|
|
|
+ formItemLayout: {
|
|
|
|
+ labelCol: { span: 6 },
|
|
|
|
+ wrapperCol: { span: 16 }
|
|
|
|
+ },
|
|
|
|
+ productType: [], // 产品分类
|
|
|
|
+ category: [], // 商城类目
|
|
|
|
+ // 查询条件
|
|
|
|
+ queryParam: {
|
|
|
|
+ productName: '', // 产品名称
|
|
|
|
+ productCode: '', // 产品编码/原厂编码
|
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
|
+ categorySn: undefined // 商城类目sn
|
|
|
|
+ },
|
|
|
|
+ openAddModal: false, // 打开新增弹窗
|
|
|
|
+ openEditModal: false, // 打开编辑弹窗
|
|
|
|
+ rowSelectionInfo: null, // 批量编辑、删除 选择数据
|
|
|
|
+ openGuideModal: false, // 导入弹窗
|
|
|
|
+ columns: [
|
|
|
|
+ { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
|
|
|
|
+ { title: '创建时间', dataIndex: 'createTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrandName', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '产品分类', align: 'center', width: '15%', scopedSlots: { customRender: 'productType' } },
|
|
|
|
+ { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '13%', align: 'center' },
|
|
|
|
+ { title: '原售价', dataIndex: 'promoName', width: '11%', align: 'right', customRender: text => { return (text || text == 0) ? _this.toThousands(text) : '--' } },
|
|
|
|
+ { title: '补贴金额', dataIndex: 'promoStartDate', align: 'center', width: '11%', scopedSlots: { customRender: 'promoTime' } },
|
|
|
|
+ { title: '补贴后售价', dataIndex: 'promoTypeDictValue', align: 'center', width: '11%', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
|
|
|
|
+ ],
|
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
|
+ loadData: parameter => {
|
|
|
|
+ this.disabled = true
|
|
|
|
+ this.spinning = true
|
|
|
|
+ const params = Object.assign(parameter, this.queryParam)
|
|
|
|
+ return shopPromoProductList(params).then(res => {
|
|
|
|
+ let data
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ data = res.data
|
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
|
+ }
|
|
|
|
+ this.disabled = false
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ return data
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 表格选中项
|
|
|
|
+ rowSelectionFun (obj) {
|
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
|
+ },
|
|
|
|
+ // 新增
|
|
|
|
+ handleAdd () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 确定导入产品
|
|
|
|
+ hanldeImprotOk (obj) {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ salesDetailInsertImport(obj).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
|
+ this.getOrderDetail(false)
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 编辑
|
|
|
|
+ handleEdit () {
|
|
|
|
+ this.openEditModal = true
|
|
|
|
+ },
|
|
|
|
+ // 删除
|
|
|
|
+ handleDel (row) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '确定删除产品吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ jxsorgRelationDel({ sn: row.orgSn }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$refs.table.refresh()
|
|
|
|
+ }
|
|
|
|
+ _this.spinning = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 重置
|
|
|
|
+ resetSearchForm () {
|
|
|
|
+ this.queryParam.productName = ''
|
|
|
|
+ this.queryParam.productCode = ''
|
|
|
|
+ this.queryParam.productBrandSn = undefined
|
|
|
|
+ this.queryParam.productTypeSn1 = ''
|
|
|
|
+ this.queryParam.productTypeSn2 = ''
|
|
|
|
+ this.queryParam.productTypeSn3 = ''
|
|
|
|
+ this.queryParam.categorySn = undefined
|
|
|
|
+ this.productType = []
|
|
|
|
+ this.category = []
|
|
|
|
+ this.$refs.table.refresh()
|
|
|
|
+ },
|
|
|
|
+ // 产品分类 change
|
|
|
|
+ changeProductType (val, opt) {
|
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
|
+ },
|
|
|
|
+ // 商城类目
|
|
|
|
+ changeProductsCategory (val) {
|
|
|
|
+ this.queryParam.categorySn = (val[0] && val[1]) ? val[1] : (val[0] && !val[1]) ? val[0] : undefined
|
|
|
|
+ },
|
|
|
|
+ // 初始化
|
|
|
|
+ pageInit () {
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.getCategoryList()
|
|
|
|
+ _this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.setTableH()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 计算表格高度
|
|
|
|
+ setTableH () {
|
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 225
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ // 展开关闭 监听表格高度变化
|
|
|
|
+ advanced (newValue, oldValue) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.setTableH()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ '$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.pageInit()
|
|
|
|
+ this.resetSearchForm()
|
|
|
|
+ }
|
|
|
|
+ // 仅刷新列表,不重置页面
|
|
|
|
+ if (this.$store.state.app.updateList) {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|