|
@@ -16,65 +16,134 @@
|
|
|
:rules="rules"
|
|
|
:label-col="formItemLayout.labelCol"
|
|
|
:wrapper-col="formItemLayout.wrapperCol" >
|
|
|
- <a-form-model-item label="规则门槛" prop="supplierSn">是</a-form-model-item>
|
|
|
- <a-form-model-item label="满赠规则" prop="supplierSn">
|
|
|
- <div>购买满10000元门槛产品,可使用200 元配额,采购规则中的正价商品(配额算销售额)</div>
|
|
|
- <div>同款产品购买满10个正价产品,送2个促销产品,限制正价产品款数40</div>
|
|
|
+ <a-form-model-item label="规则门槛" prop="gateFlag" v-if="form.gateFlag">
|
|
|
+ <div>{{ form.gateFlag=== '0'?'无':'有' }}</div>
|
|
|
+ <div v-if="gateFlag==='1'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的正价商品(配额算销售额)</div>
|
|
|
</a-form-model-item>
|
|
|
- <a-form-model-item label="数量叠加" prop="supplierSn">是</a-form-model-item>
|
|
|
- <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
|
|
|
+ <!-- 买产品送产品 -->
|
|
|
+ <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
|
|
|
+ <span>{{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularQty }}个正价产品,送{{ form.promotionQty }}个促销产品</span>
|
|
|
+ <span v-if="form.restrictFlag&&form.restrictFlag==1">,限制正价产品款数{{ form.restrictCategory }}</span>
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
|
|
|
+ {{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularAmount }}元正价产品,送{{ form.giveAmount }}元{{ perCentNum }}促销品采购额
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.accrualFlag">{{ form.accrualFlag==='1'?'是':'否' }}</a-form-model-item>
|
|
|
+ <a-form-model-item prop="minOrderFlag">
|
|
|
<span slot="label">
|
|
|
<a-tooltip title="What do you want others to call you?">
|
|
|
<a-icon type="info-circle" />
|
|
|
</a-tooltip>
|
|
|
订单起订金额
|
|
|
</span>
|
|
|
+ {{ form.minOrderFlag === '1'?'限制':'不限制' }}{{ form.minOrderAmount }}元
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item prop="upperLimitFlag">
|
|
|
+ <span slot="label">
|
|
|
+ <a-tooltip title="What do you want others to call you?">
|
|
|
+ <a-icon type="info-circle" />
|
|
|
+ </a-tooltip>
|
|
|
+ 活动经费上限
|
|
|
+ </span>
|
|
|
+ {{ form.upperLimitFlag === '1'?'限制':'不限制' }}{{ form.upperLimitAmount }}元
|
|
|
</a-form-model-item>
|
|
|
- <a-form-model-item label="活动经费上限" prop="supplierSn">限制 20000元</a-form-model-item>
|
|
|
- <a-form-model-item label="促销品是否与正品一致" prop="supplierSn">否</a-form-model-item>
|
|
|
+ <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">{{ form.regularPromotionSameFlag==='1'?'是':'否' }}</a-form-model-item>
|
|
|
+ <a-form-model-item label="采购额使用范围" v-if="form.scopeFlag" prop="scopeFlag">{{ form.scopeFlag==='1'?'全部产品':'部分产品' }}</a-form-model-item>
|
|
|
</a-form-model>
|
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
<a-radio-group v-model="chooseVal" button-style="solid">
|
|
|
- <a-radio-button value="a">
|
|
|
+ <a-radio-button value="a" v-show="form.gateFlag==='1'">
|
|
|
门槛产品
|
|
|
</a-radio-button>
|
|
|
- <a-radio-button value="b">
|
|
|
+ <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
|
|
|
正价产品
|
|
|
</a-radio-button>
|
|
|
- <a-radio-button value="c">
|
|
|
+ <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'||form.scopeFlag==='0'">
|
|
|
促销产品
|
|
|
</a-radio-button>
|
|
|
+ <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
|
|
|
+ 特价产品
|
|
|
+ </a-radio-button>
|
|
|
</a-radio-group>
|
|
|
<!-- 列表 -->
|
|
|
- <s-table
|
|
|
- class="sTable"
|
|
|
- style="margin-top:10px;max-height:280px;"
|
|
|
- ref="table"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
- :columns="columns"
|
|
|
- :data="loadData"
|
|
|
- :scroll="{ y: 500 }"
|
|
|
- :defaultLoadData="false"
|
|
|
- bordered>
|
|
|
- <!-- 产品分类 -->
|
|
|
- <template slot="productType" slot-scope="text, record">
|
|
|
- <a-tag>产品分类</a-tag>
|
|
|
- </template>
|
|
|
- <!-- 品牌 -->
|
|
|
- <template slot="productBrand" slot-scope="text, record">
|
|
|
- <a-tag>品牌</a-tag>
|
|
|
- </template>
|
|
|
- <!-- 产品 -->
|
|
|
- <template slot="product" slot-scope="text, record">
|
|
|
- <a-tag>产品</a-tag>
|
|
|
- </template>
|
|
|
- <!-- 设置起订量 -->
|
|
|
- <template slot="setNum" slot-scope="text, record">
|
|
|
- <span style="margin-right:10px;">按数量设置</span>
|
|
|
- <span>1</span>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
+ <div v-show="chooseVal!='d'">
|
|
|
+ <a-table
|
|
|
+ class="sTable"
|
|
|
+ style="margin-top:10px;max-height:280px;"
|
|
|
+ ref="table"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.productScopeSn"
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="chooseVal==='a'?form.gateProductList:chooseVal==='b'?form.regularProductList:form.giftProductList"
|
|
|
+ :scroll="{ y: 500 }"
|
|
|
+ :pagination="false"
|
|
|
+ bordered
|
|
|
+ >
|
|
|
+ <!-- 产品分类 -->
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName1 }}{{ item.productTypeName2?'/'+item.productTypeName2 :'' }}{{ item.productTypeName3?'/'+item.productTypeName3:'' }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 品牌 -->
|
|
|
+ <template slot="productBrand" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 产品 -->
|
|
|
+ <template slot="product" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 设置起订量 -->
|
|
|
+ <template slot="setNum" slot-scope="text, record">
|
|
|
+ <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
|
|
|
+ <span>{{ record.unitQty }}</span>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ <!-- 特价产品 -->
|
|
|
+ <div v-show="chooseVal=='d'">
|
|
|
+ <a-table
|
|
|
+ class="sTable"
|
|
|
+ style="margin-top:10px;max-height:280px;"
|
|
|
+ ref="table"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.productScopeSn"
|
|
|
+ :columns="specialColumns"
|
|
|
+ :data-source="form.specialProductList"
|
|
|
+ :scroll="{ y: 500 }"
|
|
|
+ :pagination="false"
|
|
|
+ bordered
|
|
|
+ >
|
|
|
+ <!-- 产品分类 -->
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName1 }}{{ item.productTypeName2?'/'+item.productTypeName2 :'' }}{{ item.productTypeName3?'/'+item.productTypeName3:'' }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 品牌 -->
|
|
|
+ <template slot="productBrand" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 产品 -->
|
|
|
+ <template slot="product" slot-scope="text, record">
|
|
|
+ <div style="max-height:100px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
|
|
|
+ <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
|
|
|
+ </div>
|
|
|
+ <span v-else>--</span>
|
|
|
+ </template>
|
|
|
+ <!-- 设置起订量 -->
|
|
|
+ <template slot="setNum" slot-scope="text, record">
|
|
|
+ <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
|
|
|
+ <span>{{ record.unitQty }}</span>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
</a-card>
|
|
|
<div class="btn-cont">
|
|
|
<a-button id="dealerPromotions-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
|
|
@@ -86,7 +155,7 @@
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable } from '@/components'
|
|
|
-import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
|
|
|
+import { getRuleDetail } from '@/api/promotion'
|
|
|
export default {
|
|
|
name: 'DetailModal',
|
|
|
mixins: [commonMixin],
|
|
@@ -97,11 +166,12 @@ export default {
|
|
|
default: false
|
|
|
},
|
|
|
itemSn: {
|
|
|
- type: [Number, String],
|
|
|
+ type: String,
|
|
|
default: ''
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
+ const _this = this
|
|
|
return {
|
|
|
isShow: this.openModal, // 是否打开弹框
|
|
|
spinning: false,
|
|
@@ -110,115 +180,97 @@ export default {
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
form: {
|
|
|
- promotionName: '',
|
|
|
- activeDate: undefined,
|
|
|
- supplierSn: undefined, // 供应商
|
|
|
- returnReason: '', // 退货原因
|
|
|
- explainInfo: '', // 补充说明
|
|
|
- warehouseSn: undefined,
|
|
|
- attachmentList: ''
|
|
|
+ promotionRuleType: undefined,
|
|
|
+ gateFlag: undefined, // 门槛
|
|
|
+ gateAmount: undefined,
|
|
|
+ quotaAmount: undefined,
|
|
|
+ regularSameFlag: undefined, // 满赠规则 不同款商品
|
|
|
+ regularQty: undefined,
|
|
|
+ promotionQty: undefined,
|
|
|
+ regularAmount: undefined,
|
|
|
+ giveAmount: undefined,
|
|
|
+ restrictFlag: undefined, // 限制正价产品款数
|
|
|
+ restrictCategory: undefined,
|
|
|
+ accrualFlag: undefined, // 数量叠加
|
|
|
+ minOrderFlag: undefined, // 起订金额
|
|
|
+ minOrderAmount: undefined,
|
|
|
+ upperLimitFlag: undefined, // 活动经费上限
|
|
|
+ upperLimitAmount: undefined,
|
|
|
+ regularPromotionSameFlag: undefined,
|
|
|
+ productTypeArr: [],
|
|
|
+ productTypeList: [],
|
|
|
+ productBrandArr: [],
|
|
|
+ productBrandList: [],
|
|
|
+ productThisList: []
|
|
|
},
|
|
|
- rules: {
|
|
|
- supplierSn: [
|
|
|
- { required: true, message: '请选择供应商名称', trigger: 'change' }
|
|
|
- ]
|
|
|
- },
|
|
|
- chooseVal: 'a'
|
|
|
+ chooseVal: 'a',
|
|
|
+ specialColumns: [
|
|
|
+ { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
|
|
|
+ { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
|
|
|
+ { title: '产品', scopedSlots: { customRender: 'product' }, width: '8%', align: 'center' },
|
|
|
+ { title: '省价原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '省价特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '省价折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
|
|
|
+ { title: '市价原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '市价特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '市价折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
|
|
|
+ { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
|
|
|
+ { title: '设置起订量', width: '12%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
columns () {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
|
- { title: '产品分类', width: '20%', scopedSlots: { customRender: 'productType' }, align: 'center' },
|
|
|
- { title: '品牌', width: '40%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
|
|
|
- { title: '产品', width: '40%', scopedSlots: { customRender: 'product' }, align: 'center' },
|
|
|
+ { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
|
|
|
+ { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
|
|
|
+ { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
|
|
|
{ title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
|
|
|
]
|
|
|
if (_this.chooseVal == 'c') {
|
|
|
arr.pop()
|
|
|
}
|
|
|
return arr
|
|
|
+ },
|
|
|
+ perCentNum () {
|
|
|
+ return Math.floor(((this.form.giveAmount / this.form.regularAmount) * 100).toFixed(2)) + '%'
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 选择参与客户
|
|
|
- handleDealerModal () {
|
|
|
- this.openDealerModal = true
|
|
|
- const _this = this
|
|
|
- if (_this.chooseDealerList.length == 0) {
|
|
|
- _this.form.promoBuyerList = []
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.form = {
|
|
|
+ promotionRuleType: undefined,
|
|
|
+ gateFlag: undefined, // 门槛
|
|
|
+ gateAmount: undefined,
|
|
|
+ quotaAmount: undefined,
|
|
|
+ regularSameFlag: undefined, // 满赠规则 不同款商品
|
|
|
+ regularQty: undefined,
|
|
|
+ promotionQty: undefined,
|
|
|
+ regularAmount: undefined,
|
|
|
+ giveAmount: undefined,
|
|
|
+ restrictFlag: undefined, // 限制正价产品款数
|
|
|
+ restrictCategory: undefined,
|
|
|
+ accrualFlag: undefined, // 数量叠加
|
|
|
+ minOrderFlag: undefined, // 起订金额
|
|
|
+ minOrderAmount: undefined,
|
|
|
+ upperLimitFlag: undefined, // 活动经费上限
|
|
|
+ upperLimitAmount: undefined,
|
|
|
+ regularPromotionSameFlag: undefined
|
|
|
}
|
|
|
- const arr = _this.chooseDealerList.map(item => {
|
|
|
- return item.buyerSn
|
|
|
- })
|
|
|
- // 选择经销商回显
|
|
|
- _this.$nextTick(() => {
|
|
|
- _this.$refs.dealerChoose.pageInit(arr)
|
|
|
- })
|
|
|
- },
|
|
|
- // 添加经销商
|
|
|
- handleAddDealer (list) {
|
|
|
- this.chooseDealerList = list.map(con => {
|
|
|
- return {
|
|
|
- buyerSn: con.dealerSn,
|
|
|
- buyerName: con.dealerName
|
|
|
- }
|
|
|
- })
|
|
|
- this.openDealerModal = false
|
|
|
- // 移除表单必填项
|
|
|
- this.$refs.ruleForm.clearValidate('promoBuyerList')
|
|
|
},
|
|
|
- // 保存
|
|
|
- handleSave () {
|
|
|
- const _this = this
|
|
|
- this.$refs.ruleForm.validate(valid => {
|
|
|
- if (valid) {
|
|
|
- const form = JSON.parse(JSON.stringify(_this.form))
|
|
|
- form.attachmentList = _this.attachList
|
|
|
- _this.spinning = true
|
|
|
- sparePartsReturnSave(form).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- setTimeout(() => {
|
|
|
- _this.isShow = false
|
|
|
- _this.$emit('ok', res.data)
|
|
|
- _this.spinning = false
|
|
|
- }, 1000)
|
|
|
- } else {
|
|
|
- _this.spinning = false
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取编辑详情
|
|
|
+ // 获取列表详情
|
|
|
getDetail () {
|
|
|
- sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
|
|
|
+ getRuleDetail({ sn: this.itemSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
const resultObj = res.data
|
|
|
- this.attachList = resultObj.attachmentList
|
|
|
- const obj = {
|
|
|
- supplierSn: resultObj.supplierSn,
|
|
|
- returnReason: resultObj.returnReason, // 退货原因
|
|
|
- explainInfo: resultObj.explainInfo, // 补充说明
|
|
|
- warehouseSn: resultObj.warehouseSn,
|
|
|
- sparePartsReturnSn: this.itemSn
|
|
|
- }
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.attachList.setFileList(this.attachList)
|
|
|
- })
|
|
|
- this.form = { ...this.form, ...obj }
|
|
|
- } else {
|
|
|
- this.detailsData = null
|
|
|
+ this.chooseVal = resultObj.gateFlag == '1' ? 'a' : 'b'
|
|
|
+ this.form = { ...this.form, ...resultObj }
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
- // 不可选日期
|
|
|
- disabledDate (date, dateStrings) {
|
|
|
- return date && date.valueOf('day') < moment().subtract(1, 'day') // 今天以后,包含今天
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -230,19 +282,9 @@ export default {
|
|
|
isShow (newValue, oldValue) {
|
|
|
if (!newValue) {
|
|
|
this.$emit('close')
|
|
|
- this.attachList = []
|
|
|
- this.supplierName = null
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.attachList.setFileList('')
|
|
|
- this.$refs.ruleForm.resetFields()
|
|
|
- })
|
|
|
+ this.resetSearchForm()
|
|
|
} else {
|
|
|
- if (this.itemSn) {
|
|
|
- this.getDetail()
|
|
|
- } else {
|
|
|
- // 默认仓库
|
|
|
- this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
|
|
|
- }
|
|
|
+ this.getDetail()
|
|
|
}
|
|
|
}
|
|
|
}
|