|
@@ -0,0 +1,212 @@
|
|
|
|
+<template>
|
|
|
|
+ <a-card size="small" :bordered="false" class="promotionRulesList-wrap">
|
|
|
|
+ <!-- 搜索条件 -->
|
|
|
|
+ <div 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-range-picker
|
|
|
|
+ style="width:100%"
|
|
|
|
+ id="promotionRulesList-createDate"
|
|
|
|
+ :disabledDate="disabledDate"
|
|
|
|
+ v-model="createDate"
|
|
|
|
+ :format="dateFormat"
|
|
|
|
+ :placeholder="['开始时间', '结束时间']" />
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="促销名称">
|
|
|
|
+ <a-input id="promotionRulesList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入促销名称"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="状态">
|
|
|
|
+ <v-select code="ENABLE_FLAG" id="promotionRulesList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
|
|
|
|
+ <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 操作按钮 -->
|
|
|
|
+ <div class="table-operator">
|
|
|
|
+ <a-button id="promotionRulesList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 总计 -->
|
|
|
|
+ <a-alert type="info" showIcon style="margin-bottom:15px">
|
|
|
|
+ <div slot="message">合计: <strong>222</strong>条</div>
|
|
|
|
+ </a-alert>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <s-table
|
|
|
|
+ class="sTable"
|
|
|
|
+ ref="table"
|
|
|
|
+ size="default"
|
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="loadData"
|
|
|
|
+ :scroll="{ x: 1350, y: tableHeight }"
|
|
|
|
+ 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="enabledFlag" slot-scope="text, record">
|
|
|
|
+ <a-switch
|
|
|
|
+ id="promotionRulesList-enable"
|
|
|
|
+ checkedChildren="启用"
|
|
|
|
+ unCheckedChildren="禁用"
|
|
|
|
+ v-if="$hasPermissions('B_product_dealerProduct_enable')"
|
|
|
|
+ @change="changeStatus(record)"
|
|
|
|
+ :checked="record.enabledFlag == 1 ? true : false" />
|
|
|
|
+ <span v-else :style="{color:(record.enabledFlag==1?'#00aa00':'#999')}"> {{ record.enabledFlag==1? '已启用': '已禁用' }} </span>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 操作 -->
|
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
|
+ <a-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-info"
|
|
|
|
+ @click="handleEdit(record)"
|
|
|
|
+ id="promotionRulesList-edit-btn">编辑</a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-success"
|
|
|
|
+ @click="handleDetail(record)"
|
|
|
|
+ id="promotionRulesList-detail-btn">详情</a-button>
|
|
|
|
+ </template>
|
|
|
|
+ </s-table>
|
|
|
|
+ </a-card>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import moment from 'moment'
|
|
|
|
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
|
+import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
|
|
+import { dealerProductList, dealerProductUpdate, dealerProductExport } from '@/api/dealerProduct'
|
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
|
+export default {
|
|
|
|
+ components: { STable, VSelect },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ createDate: [], // 创建时间
|
|
|
|
+ dateFormat: 'YYYY-MM-DD',
|
|
|
|
+ tableHeight: 0,
|
|
|
|
+ queryParam: { // 查询条件
|
|
|
|
+ code: '', // 产品编码
|
|
|
|
+ name: '', // 产品名称
|
|
|
|
+ origCode: '', // 原厂编码
|
|
|
|
+ sysFlag: '0',
|
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
|
+ enabledFlag: undefined // 状态
|
|
|
|
+ },
|
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
|
+ exportLoading: false, // 导出loading
|
|
|
|
+ columns: [
|
|
|
|
+ { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
|
+ { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
|
|
|
|
+ { title: '促销名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '促销时间', dataIndex: 'createsDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '参与客户', dataIndex: 'code', width: 220, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '备注', dataIndex: 'origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: 140, align: 'center', fixed: 'right' },
|
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
|
|
|
|
+ ],
|
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
|
+ loadData: parameter => {
|
|
|
|
+ this.disabled = true
|
|
|
|
+ if (this.tableHeight == 0) {
|
|
|
|
+ this.tableHeight = window.innerHeight - 502
|
|
|
|
+ }
|
|
|
|
+ return dealerProductList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
|
+ const 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
|
|
|
|
+ const productTypeName1 = data.list[i].productTypeName1 ? data.list[i].productTypeName1 : ''
|
|
|
|
+ const productTypeName2 = data.list[i].productTypeName2 ? ' > ' + data.list[i].productTypeName2 : ''
|
|
|
|
+ const productTypeName3 = data.list[i].productTypeName3 ? ' > ' + data.list[i].productTypeName3 : ''
|
|
|
|
+ data.list[i].productTypeName = productTypeName1 + productTypeName2 + productTypeName3
|
|
|
|
+ }
|
|
|
|
+ this.disabled = false
|
|
|
|
+ return data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ openModal: false, // 查看客户详情 弹框
|
|
|
|
+ itemId: '', // 当前产品id
|
|
|
|
+ productBrandList: [], // 品牌下拉数据
|
|
|
|
+ productTypeList: [] // 分类下拉数据
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 不可选日期
|
|
|
|
+ disabledDate (date, dateStrings) {
|
|
|
|
+ return date && date.valueOf() > Date.now()
|
|
|
|
+ },
|
|
|
|
+ // 重置
|
|
|
|
+ resetSearchForm () {
|
|
|
|
+ this.queryParam.name = ''
|
|
|
|
+ this.queryParam.enabledFlag = undefined
|
|
|
|
+ this.createDate = []
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
|
+ },
|
|
|
|
+ // 新增/编辑
|
|
|
|
+ handleEdit (row) {
|
|
|
|
+ if (row) { // 编辑
|
|
|
|
+ this.$router.push({ path: `/promotionRulesManagement/promotionRules/edit/${row.id}` })
|
|
|
|
+ } else { // 新增
|
|
|
|
+ this.$router.push({ path: '/promotionRulesManagement/promotionRules/add' })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 详情
|
|
|
|
+ handleDetail (row) {
|
|
|
|
+ this.itemId = row.id
|
|
|
|
+ this.openModal = true
|
|
|
|
+ },
|
|
|
|
+ // 启用 禁用
|
|
|
|
+ changeStatus (record) {
|
|
|
|
+ if (record.enabledFlag == '1') {
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '产品被禁用后,不能再销售,确定禁用吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk: () => {
|
|
|
|
+ this.setEnable(record)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.setEnable(record)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 启用 禁用
|
|
|
|
+ setEnable (record) {
|
|
|
|
+ const params = {
|
|
|
|
+ id: record.id,
|
|
|
|
+ enabledFlag: record.enabledFlag == 1 ? '0' : '1'
|
|
|
|
+ }
|
|
|
|
+ // dealerProductUpdate(params).then(res => {
|
|
|
|
+ // if (res.status == 200) {
|
|
|
|
+ // this.$message.success(res.message)
|
|
|
|
+ // this.$refs.table.refresh()
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$refs.table.refresh()
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
|
+ next(vm => {
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|