|
@@ -48,12 +48,13 @@
|
|
|
v-model="queryParam.promoState"
|
|
|
ref="promoState"
|
|
|
id="promoProducts-promoState"
|
|
|
+ :notIn="['HAVE_DISCARD','IS_OVER']"
|
|
|
code="SHOP_PROMO_PROMO_STATE"
|
|
|
placeholder="请选择促销状态"
|
|
|
allowClear></v-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="6" :sm="24" v-if="!itemCategorySn">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
<a-form-item label="商城类目">
|
|
|
<a-cascader
|
|
|
id="promoProducts-category"
|
|
@@ -69,7 +70,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="商城状态">
|
|
|
- <v-select code="SHOP_PRODUCT_STATUS" id="promoProducts-status" v-model="queryParam.status" allowClear placeholder="请选择商城状态"></v-select>
|
|
|
+ <v-select code="SHOP_PRODUCT_STATUS" id="promoProducts-status" v-model="queryParam.shopProductStatus" allowClear placeholder="请选择商城状态"></v-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</template>
|
|
@@ -93,37 +94,47 @@
|
|
|
ref="table"
|
|
|
:style="{ height: tableHeight+70+'px' }"
|
|
|
size="small"
|
|
|
- :rowKey="(record) => record.shopProductSn"
|
|
|
- rowKeyName="shopProductSn"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
:pageSize="20"
|
|
|
- :scroll="{ y: tableHeight }"
|
|
|
+ :scroll="{ y: tableHeight - 20 }"
|
|
|
:defaultLoadData="false"
|
|
|
bordered>
|
|
|
<!-- 产品编码 -->
|
|
|
<template slot="productCode" slot-scope="text, record">
|
|
|
- <span style="padding-right: 6px;">{{ record.productCode }}</span>
|
|
|
- <a-badge v-if="record.hotFlag=='1'" count="热" :number-style="{ zoom:'80%' }"></a-badge>
|
|
|
+ {{ record.productCode }}
|
|
|
</template>
|
|
|
<!-- 产品分类 -->
|
|
|
<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="categoryName" slot-scope="text, record">
|
|
|
- <span v-if="record.categoryName1 || record.categoryName2">{{ record.categoryName1 }} {{ (record.categoryName1&&record.categoryName2) ? '>' : '' }} {{ record.categoryName2 }}</span>
|
|
|
+ <!-- 促销时间 -->
|
|
|
+ <template slot="promoTime" slot-scope="text, record">
|
|
|
+ <span v-if="record.promoStartDate">{{ record.promoStartDate }} 至 {{ record.promoEndDate }}</span>
|
|
|
<span v-else>--</span>
|
|
|
</template>
|
|
|
- <!-- 售价类型 -->
|
|
|
- <template slot="priceType" slot-scope="text, record">
|
|
|
- <span v-if="record.priceType">{{ record.priceType=='TERMINAL_PRICE'?'终端价':'自定义' }}</span>
|
|
|
+ <!-- 活动规则 -->
|
|
|
+ <template slot="promoRules" slot-scope="text, record">
|
|
|
+ <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.conditionValue&&record.resultValue">买{{ record.conditionValue }}赠{{ record.resultValue }}</span>
|
|
|
+ <div v-else-if="record.promoType==='PROMO_PROD'&&(record.shopProductPrice||record.shopProductPrice ==0)&&(record.conditionValue||record.conditionValue==0)">
|
|
|
+ <span v-if="record.shopProductPrice - record.conditionValue>0">优惠{{ (record.shopProductPrice - record.conditionValue).toFixed(2) }}元</span>
|
|
|
+ <span v-else style="color:#ED1C24;">优惠{{ (record.shopProductPrice - record.conditionValue).toFixed(2) }}元</span>
|
|
|
+ </div>
|
|
|
+ <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.resultValue">返{{ record.resultValue ? record.resultValue.toFixed(2):'--' }}元</span>
|
|
|
<span v-else>--</span>
|
|
|
</template>
|
|
|
- <!-- 是否是热销产品 -->
|
|
|
- <template slot="hotFlag" slot-scope="text, record">
|
|
|
- <span v-if="record.hotFlag">{{ record.hotFlag=='1'?'是':'否' }}</span>
|
|
|
+ <!-- 促销售价 -->
|
|
|
+ <template slot="promoPrice" slot-scope="text, record">
|
|
|
+ <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.shopProductPrice">{{ record.shopProductPrice ?record.shopProductPrice.toFixed(2):'--' }}</span>
|
|
|
+ <span v-else-if="record.promoType==='PROMO_PROD'&&record.conditionValue">{{ record.conditionValue?record.conditionValue.toFixed(2):'--' }}</span>
|
|
|
+ <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.shopProductPrice">{{ record.shopProductPrice?record.shopProductPrice.toFixed(2):'--' }}</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>
|
|
|
</s-table>
|
|
@@ -138,13 +149,13 @@ 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 chooseProduct from '@/views/easyPassManagement/shoppingManagement/chooseProductsModal'
|
|
|
// 接口
|
|
|
-import { shopProductList, queryExtList } from '@/api/shopProduct'
|
|
|
+import { shopPromoProductList } from '@/api/shopPromoProduct'
|
|
|
+import { queryExtList } from '@/api/shopProduct'
|
|
|
export default {
|
|
|
name: 'PromoProductsList',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect, productType, productBrand, chooseProduct },
|
|
|
+ components: { STable, VSelect, productType, productBrand },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -156,9 +167,7 @@ export default {
|
|
|
labelCol: { span: 6 },
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
- showProModal: false, // 打开添加产品弹窗
|
|
|
productType: [], // 产品分类
|
|
|
- chooseDataList: [], // 已选产品sn集合
|
|
|
// 查询条件
|
|
|
queryParam: {
|
|
|
productName: '', // 产品名称
|
|
@@ -167,24 +176,39 @@ export default {
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
productTypeSn3: '', // 产品三级分类
|
|
|
- hotFlag: undefined, // 是否是热销产品
|
|
|
- status: undefined, // 状态
|
|
|
- categorySn1: undefined, // 商城一级类目
|
|
|
- categorySn2: undefined// 商城二级类目
|
|
|
+ promoName: '', // 促销名称
|
|
|
+ promoType: undefined, // 促销状态
|
|
|
+ promoState: undefined, // 促销状态
|
|
|
+ categorySn: undefined, // 商城类目
|
|
|
+ shopProductStatus: undefined, // 商城状态
|
|
|
+ shopProductDelFlag: 0, // 促销产品标志
|
|
|
+ promoStateList: ['NOT_RELEASE', 'HAVE_RELEASE']// 促销列表只查询这两种状态
|
|
|
},
|
|
|
- productNum: null, // 列表数据总条数
|
|
|
categoryOptions: [], // 产品类目列表
|
|
|
fieldNames: { label: 'categoryName', value: 'categorySn', children: 'shopCategoryList' },
|
|
|
category: [], // 类目val
|
|
|
- rowSelectionInfo: null, // 已选数据
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', scopedSlots: { customRender: 'productCode' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '10%', 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: '促销名称', dataIndex: 'promoName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '促销时间', dataIndex: 'promoStartDate', align: 'center', width: '16%', scopedSlots: { customRender: 'promoTime' } },
|
|
|
+ { title: '促销类型', dataIndex: 'promoTypeDictValue', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '活动规则', align: 'center', width: '10%', scopedSlots: { customRender: 'promoRules' } },
|
|
|
+ { title: '促销状态', dataIndex: 'promoStateDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '促销售价', width: '8%', align: 'right', scopedSlots: { customRender: 'promoPrice' } },
|
|
|
+ { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '15%', align: 'center' },
|
|
|
+ { title: '商城状态', dataIndex: 'shopProductStatusDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } }
|
|
|
+ ],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
|
- if (this.itemCategorySn) {
|
|
|
- this.queryParam.categorySn = this.itemCategorySn
|
|
|
- }
|
|
|
- return shopProductList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const params = Object.assign(parameter, this.queryParam)
|
|
|
+ return shopPromoProductList(params).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
@@ -193,7 +217,6 @@ export default {
|
|
|
data.list[i].no = no + i + 1
|
|
|
}
|
|
|
this.disabled = false
|
|
|
- this.productNum = data.count
|
|
|
}
|
|
|
this.spinning = false
|
|
|
return data
|
|
@@ -201,28 +224,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- columns () {
|
|
|
- const _this = this
|
|
|
- const arr = [
|
|
|
- { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', scopedSlots: { customRender: 'productCode' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '10%', 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: '促销名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '促销时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '促销类型', dataIndex: 'priceType', scopedSlots: { customRender: 'priceType' }, align: 'center', width: '10%' },
|
|
|
- { title: '活动规则', dataIndex: 'hotSort', align: 'center', width: '7%', customRender: function (text) { return (text || text == 0) ? text : '--' } },
|
|
|
- { title: '促销状态', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '促销售价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
- { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '15%', align: 'center' },
|
|
|
- { title: '商城状态', dataIndex: 'statusDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } }
|
|
|
- ]
|
|
|
- return arr
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
// 获取产品类目列表
|
|
|
getCategoryList () {
|
|
@@ -243,10 +244,13 @@ export default {
|
|
|
this.queryParam.productTypeSn1 = ''
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
- this.queryParam.hotFlag = undefined
|
|
|
- this.queryParam.status = undefined
|
|
|
- this.queryParam.categorySn1 = undefined
|
|
|
- this.queryParam.categorySn2 = undefined
|
|
|
+ this.queryParam.promoName = ''
|
|
|
+ this.queryParam.promoType = undefined
|
|
|
+ this.queryParam.promoState = undefined
|
|
|
+ this.queryParam.shopProductStatus = undefined
|
|
|
+ this.queryParam.categorySn = undefined
|
|
|
+ this.queryParam.shopProductDelFlag = 0
|
|
|
+ this.queryParam.promoStateList = ['NOT_RELEASE', 'HAVE_RELEASE']
|
|
|
this.productType = []
|
|
|
this.category = []
|
|
|
this.$refs.table.refresh(true)
|
|
@@ -259,16 +263,12 @@ export default {
|
|
|
},
|
|
|
// 商城类目
|
|
|
changeProductsCategory (val) {
|
|
|
- this.queryParam.categorySn1 = val[0] ? val[0] : undefined
|
|
|
- this.queryParam.categorySn2 = val[1] ? val[1] : undefined
|
|
|
+ this.queryParam.categorySn = (val[0] && val[1]) ? val[1] : (val[0] && !val[1]) ? val[0] : undefined
|
|
|
},
|
|
|
// 初始化
|
|
|
pageInit () {
|
|
|
const _this = this
|
|
|
- if (!_this.itemCategorySn) {
|
|
|
- _this.getCategoryList()
|
|
|
- }
|
|
|
- _this.closeProductModal()
|
|
|
+ _this.getCategoryList()
|
|
|
_this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
_this.setTableH()
|
|
|
})
|