123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <template>
- <a-modal
- centered
- class="dealerPromotions-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- title="详情"
- v-model="isShow"
- @cancel="isShow=false"
- width="80%">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="dealerPromotions-basicInfo-form"
- ref="ruleForm"
- :model="form"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol" >
- <a-form-model-item label="规则简称" v-if="form.description">
- <a-input
- size="small"
- disabled="true"
- v-model.trim="form.description"></a-input>
- </a-form-model-item>
- <a-form-model-item label="规则门槛" v-if="form.gateFlag">
- <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" disabled="true">
- <a-radio-button value="1">
- 有
- </a-radio-button>
- <a-radio-button value="0">
- 无
- </a-radio-button>
- </a-radio-group>
- <div v-if="form.gateFlag==='1'">
- <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额{{ form.gateAmount*100 }}%作为配额 </span>
- <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额{{ form.gateAmount }}元,不限制配额。</span>
- <span v-if="form.gateType==='FIXED_AMOUNT'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的{{ form.promotionRuleType!='PROMO_PROD'?'正价':'特价' }}商品(配额算销售额)</span>
- </div>
- </a-form-model-item>
- <!-- 买产品送产品 -->
- <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.regularAmount }}元正价产品,送{{ form.giveAmount }}元({{ perCentNum }}%促销品采购额)
- </a-form-model-item>
- <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
- <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small" disabled="true">
- <a-radio-button value="1">
- 是
- </a-radio-button>
- <a-radio-button value="0">
- 否
- </a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- <a-form-model-item label="金额叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'&&form.accrualFlag">
- <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small" disabled="true">
- <a-radio-button value="1">
- 是
- </a-radio-button>
- <a-radio-button value="0">
- 否
- </a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- <a-form-model-item prop="minOrderFlag" label="订单起订金额">
- <a-select v-model="form.minOrderFlag" style="width: 160px" size="small" disabled="true">
- <a-select-option value="0">
- 不限
- </a-select-option>
- <a-select-option value="1">
- 限制
- </a-select-option>
- </a-select>
- <a-input-number
- disabled="true"
- v-if="form.minOrderAmount"
- size="small"
- style="margin-left:10px;width:100px;"
- v-model="form.minOrderAmount"/>
- {{ form.minOrderAmount?'元':'' }}
- </a-form-model-item>
- <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
- <a-select v-model="form.minOrderFlag" style="width: 160px" size="small" disabled="true">
- <a-select-option value="0">
- 不限
- </a-select-option>
- <a-select-option value="1">
- 限制
- </a-select-option>
- </a-select>
- <a-input-number
- disabled="true"
- v-if="form.upperLimitAmount"
- size="small"
- style="margin-left:10px;width:100px;"
- v-model="form.upperLimitAmount"/>
- {{ form.upperLimitAmount?'元':'' }}
- </a-form-model-item>
- <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">
- <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" disabled="true">
- <a-radio-button value="1">
- 是
- </a-radio-button>
- <a-radio-button value="0">
- 否
- </a-radio-button>
- </a-radio-group>
- </a-form-model-item>
- <a-form-model-item label="采购额适用范围" v-if="form.scopeFlag" prop="scopeFlag" >
- <a-radio-group v-model="form.scopeFlag" button-style="solid" size="small" disabled="true">
- <a-radio-button value="0">
- 部分产品
- </a-radio-button>
- <a-radio-button value="1">
- 全部产品
- </a-radio-button>
- </a-radio-group>
- </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" v-show="form.gateFlag==='1'">
- 门槛产品
- </a-radio-button>
- <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
- 正价产品
- </a-radio-button>
- <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>
- <!-- 列表 -->
- <div v-show="chooseVal!='d'">
- <a-table
- class="sTable"
- style="margin-top:10px;max-height:340px;"
- ref="table"
- size="small"
- :rowKey="(record) => record.productScopeSn"
- :columns="columns"
- :data-source="chooseVal==='a'?form.gateProductList:chooseVal==='b'?form.regularProductList:form.giftProductList"
- :scroll="{ y: 330 }"
- :pagination="false"
- bordered
- >
- <!-- 产品分类 -->
- <template slot="productType" slot-scope="text, record">
- <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
- <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
- </div>
- </template>
- <!-- 品牌 -->
- <template slot="productBrand" slot-scope="text, record">
- <div class="tabBox" 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 class="tabBox" 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">
- <a-tag style="width:60%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
- <a-tag style="width:60%;margin-right:0;">{{ record.unitQty }}</a-tag>
- </template>
- </a-table>
- </div>
- <!-- 特价产品 -->
- <div v-show="chooseVal=='d'">
- <a-table
- class="sTable"
- style="margin-top:10px;max-height:340px;"
- ref="table"
- size="small"
- :rowKey="(record) => record.productScopeSn"
- :columns="specialColumns"
- :data-source="form.specialProductList"
- :scroll="{ y: 330 }"
- :pagination="false"
- bordered
- >
- <!-- 产品分类 -->
- <template slot="productType" slot-scope="text, record">
- <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
- <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
- </div>
- </template>
- <!-- 品牌 -->
- <template slot="productBrand" slot-scope="text, record">
- <div class="tabBox" 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 class="tabBox" 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">
- <a-tag style="width:90%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
- <a-tag style="width:90%;margin-right:0;">{{ record.unitQty }}</a-tag>
- </template>
- </a-table>
- </div>
- </a-card>
- <div class="btn-cont">
- <a-button id="dealerPromotions-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable } from '@/components'
- import { getRuleDetail } from '@/api/promotion'
- export default {
- name: 'DetailModal',
- mixins: [commonMixin],
- components: { STable },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemSn: {
- type: String,
- default: ''
- }
- },
- data () {
- const _this = this
- return {
- isShow: this.openModal, // 是否打开弹框
- spinning: false,
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 20 }
- },
- 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,
- productTypeArr: [],
- productTypeList: [],
- productBrandArr: [],
- productBrandList: [],
- productThisList: []
- },
- chooseVal: 'a',
- specialColumns: [
- { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
- { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
- { title: '产品', scopedSlots: { customRender: 'product' }, width: '11%', 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: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
- ]
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { 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: {
- // 重置
- 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
- }
- },
- // 获取列表详情
- getDetail () {
- getRuleDetail({ sn: this.itemSn }).then(res => {
- if (res.status == 200) {
- const resultObj = res.data
- this.chooseVal = resultObj.gateFlag == '1' ? 'a' : resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
- this.form = { ...this.form, ...resultObj }
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.resetSearchForm()
- } else {
- this.getDetail()
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .dealerPromotions-basicInfo-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .dealerPromotions-basicInfo-con{
- margin-top:10px;
- }
- .ant-form-item{
- margin-bottom:0 !important;
- }
- .buyerBox{
- border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- .tabBox{
- max-height:100px;
- overflow-y:scroll;
- }
- .tabBox::-webkit-scrollbar {
- width: 0px;
- }
- // .ant-form-item-control .ant-input[disabled]{
- // color:#333333;
- // background:#ffffff;
- // }
- }
- </style>
|