|
@@ -0,0 +1,260 @@
|
|
|
+<template>
|
|
|
+ <a-card size="small" :bordered="false" class="easyPassShopping-wrap">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button type="primary" icon="unlock" :loading="iconLoading" @click="enterIconLoading">
|
|
|
+ 打开商城
|
|
|
+ </a-button>
|
|
|
+ <a-button type="primary" class="button-info" icon="poweroff" :loading="iconLoading" @click="enterIconLoading">
|
|
|
+ 关闭商城
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品名称"><a-input id="productInfoList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称" /></a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品编码/原厂编码"><a-input id="productInfoList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码" /></a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品牌">
|
|
|
+ <productBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></productBrand>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品分类">
|
|
|
+ <productType id="productInfoList-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="productType"></productType>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="商城类目">
|
|
|
+ <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择商城类目"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品商城状态">
|
|
|
+ <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="easyPassShopping-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="easyPassShopping-reset">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height: tableHeight+84.5+'px' }"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <!-- 模板名称 -->
|
|
|
+ <template slot="templateName" slot-scope="text, record">
|
|
|
+ <span class="table-td-link" id="easyPassShopping-links" @click="handleDetail(record)">{{ record.templateName }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ id="easyPassShopping-edit"
|
|
|
+ size="small"
|
|
|
+ v-if="record.sysFlag==0"
|
|
|
+ type="link"
|
|
|
+ class="button-primary"
|
|
|
+ @click="addTemp(record)">更改名称</a-button>
|
|
|
+ <a-button
|
|
|
+ v-if="orgData.length<20"
|
|
|
+ id="easyPassShopping-copy"
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-primary"
|
|
|
+ @click="handleCopy(record)">复制</a-button>
|
|
|
+ <a-button
|
|
|
+ id="easyPassShopping-del"
|
|
|
+ size="small"
|
|
|
+ v-if="record.sysFlag==0"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ @click="handleCancel(record)">删除</a-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+ <!-- 基础设置弹框 -->
|
|
|
+ <basic-info-modal :openModal="openModal" :nowData="nowData" @ok="saveOk" @close="openModal=false" />
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import commonModal from '@/views/common/commonModal.vue'
|
|
|
+import productType from '@/views/common/productType.js'
|
|
|
+import productBrand from '@/views/common/productBrand.js'
|
|
|
+import { shelfTemplateList, shelfTemplateCopy, shelfTemplateDel } from '@/api/shelfTemplate'
|
|
|
+export default {
|
|
|
+ name: 'ShelfProductTemplList',
|
|
|
+ components: { STable, VSelect, commonModal, productType, productBrand },
|
|
|
+ mixins: [commonMixin],
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ tableHeight: 0,
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ queryParam: {
|
|
|
+ templateName: '', // 模板名称
|
|
|
+ sysFlag: undefined // 模板类型
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '13%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '原厂编码', dataIndex: 'origCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '9%', align: 'center' },
|
|
|
+ { title: '商城类目', dataIndex: 'productBrandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '自定义终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '商城价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '车主价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '售价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '售价类型', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品商城状态', dataIndex: 'status', width: '7%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ return shelfTemplateList(Object.assign(parameter, this.queryParam)).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
|
|
|
+ this.orgData = data.list
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ orgData: [], // 原始列表数据
|
|
|
+ openModal: false, // 打开新增编辑弹框
|
|
|
+ nowData: null // 当前操作数据
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 新增/修改模板
|
|
|
+ addTemp (row) {
|
|
|
+ this.nowData = row || {}
|
|
|
+ this.openModal = true
|
|
|
+ },
|
|
|
+ // 模板详情设置
|
|
|
+ handleDetail (data) {
|
|
|
+ this.$router.push({ name: 'shelfProductTemplSetting', params: { sn: data.templateSn } })
|
|
|
+ },
|
|
|
+ // 复制模板 确认开启吗,开启后修理厂可在易码通查看商城
|
|
|
+ handleCopy (record) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '关闭商城',
|
|
|
+ content: '确认关闭吗,关闭后修理厂在易码通无法查看商城',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ shelfTemplateCopy({
|
|
|
+ templateSn: record.templateSn
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.resetSearchForm()
|
|
|
+ }
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除模板
|
|
|
+ handleCancel (record) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '删除模板后,模板信息将全部清除,是否确认删除?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ shelfTemplateDel({
|
|
|
+ templateSn: record.templateSn
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 保存成功
|
|
|
+ saveOk () {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ this.openModal = false
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam.templateName = ''
|
|
|
+ this.queryParam.sysFlag = undefined
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 表格高度
|
|
|
+ setTableH () {
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 240
|
|
|
+ },
|
|
|
+ // 初始化页面
|
|
|
+ pageInit () {
|
|
|
+ const _this = this
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ _this.setTableH()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
+ this.pageInit()
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
+ this.setTableH()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
+ this.pageInit()
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ // 仅刷新列表,不重置页面
|
|
|
+ if (this.$store.state.app.updateList) {
|
|
|
+ this.pageInit()
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|