|
@@ -4,51 +4,54 @@
|
|
|
class="choosePosPriceProducts-modal"
|
|
|
:footer="null"
|
|
|
:maskClosable="false"
|
|
|
- title="选择正价产品"
|
|
|
+ title="选择产品"
|
|
|
v-model="isShow"
|
|
|
@cancle="isShow=false"
|
|
|
width="80%">
|
|
|
<div class="table-operator">
|
|
|
- <a-button id="choosePosPriceProducts-brand" type="primary" class="button-error" @click="choosePModal('brand')">选择产品品牌</a-button>
|
|
|
- <a-button id="choosePosPriceProducts-type" type="primary" class="button-info" @click="choosePModal('type')">选择产品分类</a-button>
|
|
|
+ <a-button v-if="!(ruleType=='PROMO_PROD') && !((ruleType=='ADD_PRICE_PURCH') && (goodsType == 'promo'))" id="choosePosPriceProducts-brand" type="primary" class="button-error" @click="choosePModal('brand')">选择产品品牌</a-button>
|
|
|
+ <a-button v-if="!(ruleType=='PROMO_PROD') && !((ruleType=='ADD_PRICE_PURCH') && (goodsType == 'promo'))" id="choosePosPriceProducts-type" type="primary" class="button-info" @click="choosePModal('type')">选择产品分类</a-button>
|
|
|
<a-button id="choosePosPriceProducts-product" type="primary" class="button-success" @click="choosePModal('product')">选择产品</a-button>
|
|
|
</div>
|
|
|
<!-- 参与产品 -->
|
|
|
<div class="products-con">
|
|
|
<!-- 标题栏 -->
|
|
|
<div class="products-header">
|
|
|
- <div class="products-tit">
|
|
|
- 参与产品:<a-button id="choosePosPriceProducts-import" type="primary" class="button-info" @click="openGuideModal=true">导入产品</a-button>
|
|
|
- </div>
|
|
|
- <div class="products-operation">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="9">
|
|
|
- <v-select
|
|
|
- code="ORDER_GOODS_UNIT"
|
|
|
- id="choosePosPriceProducts-orderGoodsUnit"
|
|
|
- v-model="orderGoodsUnit"
|
|
|
- allowClear
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%;"
|
|
|
- ></v-select>
|
|
|
- </a-col>
|
|
|
- <a-col :span="10">
|
|
|
- <a-input-number
|
|
|
- v-if="orderGoodsUnit=='PROD_UNIT'"
|
|
|
- id="choosePosPriceProducts-orderGoodsQty"
|
|
|
- v-model="orderGoodsQty"
|
|
|
- :min="1"
|
|
|
- :max="999999"
|
|
|
- :precision="0"
|
|
|
- style="width: 85%;margin-right: 5px;"
|
|
|
- placeholder="请输入限制数量(1~999999)"
|
|
|
- allowClear />
|
|
|
- </a-col>
|
|
|
- <a-col :span="5">
|
|
|
- <a-button id="choosePosPriceProducts-import" type="primary" class="button-info" @click="handlerBulkCopy">批量复制</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ <div class="header-con">
|
|
|
+ <div class="products-tit">
|
|
|
+ 参与产品:<a-button id="choosePosPriceProducts-import" type="primary" class="button-info" @click="openGuideModal=true">导入产品</a-button>
|
|
|
+ </div>
|
|
|
+ <div class="products-operation" v-if="goodsType=='normal'">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :span="9">
|
|
|
+ <v-select
|
|
|
+ code="ORDER_GOODS_UNIT"
|
|
|
+ id="choosePosPriceProducts-orderGoodsUnit"
|
|
|
+ v-model="orderGoodsUnit"
|
|
|
+ allowClear
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></v-select>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="10">
|
|
|
+ <a-input-number
|
|
|
+ v-if="orderGoodsUnit=='PROD_UNIT'"
|
|
|
+ id="choosePosPriceProducts-orderGoodsQty"
|
|
|
+ v-model="orderGoodsQty"
|
|
|
+ :min="1"
|
|
|
+ :max="999999"
|
|
|
+ :precision="0"
|
|
|
+ style="width: 85%;margin-right: 5px;"
|
|
|
+ placeholder="请输入限制数量(1~999999)"
|
|
|
+ allowClear />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="5">
|
|
|
+ <a-button id="choosePosPriceProducts-import" type="primary" class="button-info" @click="handlerBulkCopy">批量复制</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <p><a-icon type="exclamation-circle" style="color: #f90;margin-right: 5px;" />提示:导入时会清空下方已选内容,只展示导出成功的产品,请谨慎使用。</p>
|
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
|
<a-table
|
|
@@ -56,9 +59,9 @@
|
|
|
ref="table"
|
|
|
size="small"
|
|
|
:rowKey="(record, index) => index"
|
|
|
- :columns="columns"
|
|
|
+ :columns="nowColumns"
|
|
|
:dataSource="loadData"
|
|
|
- :scroll="{ x: 1380, y: 500 }"
|
|
|
+ :scroll="{ x: goodsType == 'normal' ? 1380 : null, y: 500 }"
|
|
|
:pagination="false"
|
|
|
bordered>
|
|
|
<!-- 序号 -->
|
|
@@ -85,6 +88,17 @@
|
|
|
placeholder="请输入限制数量(1~999999)"
|
|
|
style="width: 50%;margin-left: 5px;" />
|
|
|
</template>
|
|
|
+ <!-- 特惠单价 / 换购单价 -->
|
|
|
+ <template slot="goodsPrice" slot-scope="text, record">
|
|
|
+ <a-input-number
|
|
|
+ id="choosePosPriceProducts-goodsPrice"
|
|
|
+ v-model="record.goodsPrice"
|
|
|
+ :precision="2"
|
|
|
+ :min="0.1"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入限制数量(0.1~999999)"
|
|
|
+ style="width: 100%;" />
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record, index">
|
|
|
<a-button size="small" type="primary" class="button-error" @click="handleDel(record, index)" id="choosePosPriceProducts-del-btn">删除</a-button>
|
|
@@ -153,15 +167,30 @@ export default {
|
|
|
orderGoodsUnit: undefined, // 起订量限制 批量
|
|
|
orderGoodsQty: '', // 限制数量
|
|
|
// 表头
|
|
|
- columns: [
|
|
|
+ columns: [ // 正品
|
|
|
{ title: '序号', scopedSlots: { customRender: 'no' }, width: 80, align: 'center' },
|
|
|
{ title: '类型', dataIndex: 'goodsTypeName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '类型名称', dataIndex: 'typeName', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '产品编码', dataIndex: 'code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'goodsCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '起订量限制', scopedSlots: { customRender: 'orderGoodsUnit' }, width: 400, align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
+ promoColumns: [ // 促销品
|
|
|
+ { title: '序号', scopedSlots: { customRender: 'no' }, width: 80, align: 'center' },
|
|
|
+ { title: '类型', dataIndex: 'goodsTypeName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '类型名称', dataIndex: 'typeName', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'goodsCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
+ ],
|
|
|
+ promoSpecialColumns: [ // 特价产品/加价促销品
|
|
|
+ { title: '序号', scopedSlots: { customRender: 'no' }, width: 80, align: 'center' },
|
|
|
+ { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'goodsCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: this.ruleType == 'PROMO_PROD' ? '特惠单价(¥)' : '换购单价(¥)', scopedSlots: { customRender: 'goodsPrice' }, width: 200, align: 'center' },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
+ ],
|
|
|
loadData: [],
|
|
|
openBrandModal: false, // 选择产品品牌
|
|
|
openTypeModal: false, // 选择产品分类
|
|
@@ -172,6 +201,29 @@ export default {
|
|
|
chooseType: [] // 所选分类
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ nowColumns () {
|
|
|
+ let columns = this.columns
|
|
|
+ if ((this.ruleType == 'BUY_PROD_GIVE_PROD') || (this.ruleType == 'BUY_PROD_GIVE_MONEY')) { // 买产品送产品/买产品送采购额
|
|
|
+ if (this.goodsType == 'normal') { // 正品
|
|
|
+ columns = this.columns
|
|
|
+ } else if (this.goodsType == 'promo') { // 促销
|
|
|
+ columns = this.promoColumns
|
|
|
+ }
|
|
|
+ } else if (this.ruleType == 'PROMO_PROD') { // 特价产品
|
|
|
+ if (this.goodsType == 'promo') { // 促销
|
|
|
+ columns = this.promoSpecialColumns
|
|
|
+ }
|
|
|
+ } else if (this.ruleType == 'ADD_PRICE_PURCH') { // 加价换购
|
|
|
+ if (this.goodsType == 'normal') { // 正品
|
|
|
+ columns = this.columns
|
|
|
+ } else if (this.goodsType == 'promo') { // 促销
|
|
|
+ columns = this.promoSpecialColumns
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return columns
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 选择产品
|
|
|
choosePModal (type) {
|
|
@@ -200,19 +252,16 @@ export default {
|
|
|
},
|
|
|
// 品牌
|
|
|
handleBrandOk (obj) {
|
|
|
- console.log('接收----品牌----', obj)
|
|
|
this.chooseBrand = obj
|
|
|
this.changeData()
|
|
|
},
|
|
|
// 产品
|
|
|
handleProductsOk (obj) {
|
|
|
- console.log('接收----产品----', obj)
|
|
|
this.chooseProducts = obj
|
|
|
this.changeData()
|
|
|
},
|
|
|
// 分类
|
|
|
handleTypeOk (obj) {
|
|
|
- console.log('接收----分类----', obj)
|
|
|
this.chooseType = obj
|
|
|
this.changeData()
|
|
|
},
|
|
@@ -220,16 +269,30 @@ export default {
|
|
|
handleSave () {
|
|
|
const _this = this
|
|
|
const arr = []
|
|
|
- _this.loadData.map((item, index) => {
|
|
|
- if ((item.orderGoodsUnit == 'PROD_UNIT') && (!item.orderGoodsQty)) {
|
|
|
- arr.push(index)
|
|
|
+ if (this.goodsType == 'normal') { // 正品
|
|
|
+ _this.loadData.map((item, index) => {
|
|
|
+ if ((item.orderGoodsUnit == 'PROD_UNIT') && (!item.orderGoodsQty)) {
|
|
|
+ arr.push(index)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (arr.length > 0) {
|
|
|
+ this.$message.warning('请完善起订量限制后再保存!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if (this.goodsType == 'promo') { // 促销
|
|
|
+ let num = 0
|
|
|
+ if ((this.ruleType == 'PROMO_PROD') || (this.ruleType == 'ADD_PRICE_PURCH')) { // 特价产品 / 加价换购
|
|
|
+ _this.loadData.map((item, index) => {
|
|
|
+ if (!item.goodsPrice) {
|
|
|
+ num++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (num > 0) {
|
|
|
+ this.$message.warning('存在未填写的内容,请填写完整后再提交!')
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
- if (arr.length > 0) {
|
|
|
- this.$message.warning('请完善起订量限制后再保存!')
|
|
|
- return
|
|
|
}
|
|
|
- console.log('liebiao', this.loadData)
|
|
|
this.$emit('ok', this.loadData)
|
|
|
this.isShow = false
|
|
|
},
|
|
@@ -238,40 +301,46 @@ export default {
|
|
|
_this.loadData = []
|
|
|
if (_this.chooseBrand.length > 0) {
|
|
|
_this.chooseBrand.map(item => {
|
|
|
- _this.loadData.push({
|
|
|
+ const obj = {
|
|
|
goodsType: 'brand',
|
|
|
goodsTypeName: '品牌',
|
|
|
typeName: item.brandName,
|
|
|
goodsSn: item.brandSn,
|
|
|
orderGoodsUnit: undefined,
|
|
|
orderGoodsQty: ''
|
|
|
- })
|
|
|
+ }
|
|
|
+ delete item.id
|
|
|
+ _this.loadData.push(Object.assign(obj, item))
|
|
|
})
|
|
|
}
|
|
|
if (_this.chooseType.length > 0) {
|
|
|
_this.chooseType.map(item => {
|
|
|
- _this.loadData.push({
|
|
|
- goodsType: 'type',
|
|
|
+ const obj = {
|
|
|
+ goodsType: 'type_' + item.productTypeLevel,
|
|
|
goodsTypeName: (item.productTypeLevel == 1 ? '一级' : item.productTypeLevel == 2 ? '二级' : item.productTypeLevel == 3 ? '三级' : '') + '分类',
|
|
|
typeName: item.productTypeName,
|
|
|
goodsSn: item.productTypeSn,
|
|
|
orderGoodsUnit: undefined,
|
|
|
orderGoodsQty: ''
|
|
|
- })
|
|
|
+ }
|
|
|
+ delete item.id
|
|
|
+ _this.loadData.push(Object.assign(obj, item))
|
|
|
})
|
|
|
}
|
|
|
if (_this.chooseProducts.length > 0) {
|
|
|
_this.chooseProducts.map(item => {
|
|
|
- _this.loadData.push({
|
|
|
+ const obj = {
|
|
|
goodsType: 'product',
|
|
|
goodsTypeName: '产品',
|
|
|
typeName: item.name,
|
|
|
name: item.name,
|
|
|
- code: item.code,
|
|
|
+ goodsCode: item.code,
|
|
|
goodsSn: item.productSn,
|
|
|
orderGoodsUnit: undefined,
|
|
|
orderGoodsQty: ''
|
|
|
- })
|
|
|
+ }
|
|
|
+ delete item.id
|
|
|
+ _this.loadData.push(Object.assign(obj, item))
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -282,6 +351,10 @@ export default {
|
|
|
this.$message.warning('请选择需要批量复制的选项值后再操作!')
|
|
|
return
|
|
|
}
|
|
|
+ if (this.loadData.length == 0) {
|
|
|
+ this.$message.warning('请先添加产品后再批量复制起订限制规则!')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '批量复制会覆盖原单独设置的规则,确定要批量复制吗?',
|
|
@@ -310,6 +383,8 @@ export default {
|
|
|
this.chooseBrand = []
|
|
|
this.chooseProducts = []
|
|
|
this.chooseType = []
|
|
|
+ this.orderGoodsUnit = undefined // 起订量限制 批量
|
|
|
+ this.orderGoodsQty = '' // 限制数量
|
|
|
this.$emit('close')
|
|
|
}
|
|
|
},
|
|
@@ -335,10 +410,17 @@ export default {
|
|
|
background-color: #fafafa;
|
|
|
border-radius: 6px;
|
|
|
margin: 10px 0;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- .products-operation{
|
|
|
- width: 50%;
|
|
|
+ .header-con{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .products-operation{
|
|
|
+ width: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p{
|
|
|
+ margin: 8px 0 0;
|
|
|
+ color: #909399;
|
|
|
+ font-size: 12px;
|
|
|
}
|
|
|
}
|
|
|
.btn-con{
|