123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- <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">
- {{ form.description }}
- </a-form-model-item>
- <a-form-model-item label="规则叠加" v-if="form.stackFlag&&form.promotionRuleType !='PROMO_PROD'">
- {{ form.stackFlag==='1'?'是':'否' }}
- </a-form-model-item>
- <a-form-model-item label="规则门槛" v-if="form.gateFlag">
- {{ form.gateFlag==='1'?'有':'无' }}
- <div v-if="form.gateFlag==='1'">
- <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateValue?(form.gateValue*100).toFixed(2):'0.00' }}% 作为配额 </span>
- <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ toThousands(form.gateValue) }} 元,不限制配额。</span>
- <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType !='PROMO_PROD'">购买满 {{ toThousands(form.gateValue) }} 元门槛产品,可使用 {{ toThousands(form.quotaAmount) }} 元配额,采购规则中的正价商品(配额算销售额)</span>
- <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType ==='PROMO_PROD'">购买每满 {{ form.gateUnit==='YUAN'?toThousands(form.gateValue):form.gateValue }} {{ form.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购 {{ form.quotaAmount }} 个特价产品(配额算销售额)</span>
- </div>
- </a-form-model-item>
- <!-- 买产品送产品 -->
- <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
- <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
- <div v-for="item in form.giveRuleList" :key="item.scopeLevel">{{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }} {{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送 {{ item.promotionValue }} 个促销产品</div>
- <div v-if="form.restrictFlag&&form.restrictFlag==1">限制正价产品{{ form.restrictCategory }}款 </div>
- <div v-if="form.convertExpenseFlag&&form.convertExpenseFlag==1">可转费用报销单</div>
- </div>
- <span v-else>--</span>
- </a-form-model-item>
- <!-- 买产品送采购额 -->
- <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
- <div>{{ form.giveRuleType==='SUM_MONEY'?'金额叠加':'按比例' }}</div>
- <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
- <div v-if="form.giveRuleType==='SUM_MONEY'">购买满{{ form.giveRuleList[0].regularUnit==='YUAN'?toThousands(form.giveRuleList[0].regularValue):form.giveRuleList[0].regularValue }}{{ form.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ toThousands(form.giveRuleList[0].promotionValue) }}元<span>({{ form.giveRuleList[0].regularUnit==='YUAN'?perCentNum+'%':'' }}促销品采购额)</span></div>
- <div v-if="form.giveRuleType==='RATIO' &&form.giveRuleList && form.giveRuleList.length>0 ">
- <div v-for="item in form.giveRuleList" :key="item.scopeLevel">
- {{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}产品购买满{{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送正价产品总金额的{{ item.promotionValue?item.promotionValue.toFixed(2):'0.00' }}%为促销品采购额
- </div>
- </div>
- </div>
- </a-form-model-item>
- <a-form-model-item label="产品累计" v-if="form.borrowTimeLimtType">
- {{ form.borrowTimeLimtTypeDictValue }}{{ form.borrowedShowFlag==='1'?',加盟商显示“转促”标签':'' }}
- </a-form-model-item>
- <!-- 特价产品 -->
- <a-form-model-item label="特价规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='PROMO_PROD'">
- {{ form.discountType==='0'?'手动输入特价':form.discountType==='1'?'各级别价打折':'各级别价直降' }}
- <a-table
- v-show="form.discountType!=0"
- class="sTable"
- ref="setTable"
- size="small"
- :rowKey="(record) => record.regularValue"
- rowKeyName="regularValue"
- :columns="setColumns"
- :data-source="setTableData"
- :pagination="false"
- style="width:60%;"
- bordered>
- </a-table>
- </a-form-model-item>
- <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
- {{ form.accrualFlag==='1'?'是':'否' }}
- </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-item label="规则叠加" v-if="form.stackFlag&&form.promotionRuleType==='PROMO_PROD'&&form.discountType!='0'">
- {{ form.stackFlag==='1'?'是':'否' }}
- </a-form-model-item>
- </a-form-model>
- <a-card size="small" :bordered="false" class="pages-wrap">
- <div class="flex">
- <a-radio-group v-model="chooseVal" button-style="solid" id="dealerPromotions-basicInfo-radio" @change="onChange">
- <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')&&form.promotionRuleType!='BUY_PROD_GIVE_PROD'">
- 促销产品
- </a-radio-button>
- <a-radio-button :value="'c'+i" v-for="(item,i) in form.giveRuleList" :key="i" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType=='BUY_PROD_GIVE_PROD'&&form.giveRuleList">
- {{ form.giveRuleList.length>1? '促销产品'+'(阶梯'+(i*1+1) +')' :'促销产品' }}
- </a-radio-button>
- <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
- 特价产品
- </a-radio-button>
- </a-radio-group>
- <a-button type="link" v-show="isShowPreview" class="button-info" id="dealerPromotions-basicInfo-preview" @click="handlePreview">预览</a-button>
- </div>
- <!-- 列表 -->
- <div v-show="chooseVal==='a'||chooseVal==='b'||chooseVal==='c'">
- <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-if="form.giftProductMap && form.giveRuleList&& form.giveRuleList.length>0">
- <div v-for="(con,k) in form.giveRuleList" :key="k" v-show="chooseVal==('c'+k)">
- <a-table
- class="sTable"
- style="margin-top:10px;max-height:340px;"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data-source="form.giftProductMap['GIFT'+(k*1+1)]"
- :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>
- <!-- 特价产品 -->
- <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-back" @click="isShow = false">关闭</a-button>
- </div>
- </a-spin>
- <!-- 预览弹窗 -->
- <productPreviewModal ref="previewModal" :openModal="openProductModal" :dataList="previewList" @close="closeProductModal"></productPreviewModal>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- // 组件
- import productPreviewModal from './productPreviewModal'
- // 接口
- import { getRuleDetail } from '@/api/promotion'
- export default {
- name: 'DetailModal',
- mixins: [commonMixin],
- components: { productPreviewModal },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemSn: {
- type: String,
- default: ''
- },
- pageType: {
- type: String,
- default: 'promotionsPage'
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- // form表单 label布局
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 20 }
- },
- // 提交参数
- form: {
- promotionRuleType: undefined, // 规则类型 BUY_PROD_GIVE_PROD 买产品送产品 BUY_PROD_GIVE_MONEY 买产品送采购额 PROMO_PROD特价产品
- gateFlag: undefined, // 是否有门槛产品
- gateValue: 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, // 促销品是否与正品一致 1是 0否
- productTypeArr: [], // 所选产品分类(渲染)
- productTypeList: [], // 所选产品分类(后台所需数据)
- productBrandArr: [], // 所选产品品牌(渲染)
- productBrandList: [], // 所选产品品牌(后台所需数据)
- productThisList: []// 所选产品
- },
- chooseVal: 'a', // tab所选列表值
- columns: [
- { 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' }
- ],
- isShowPreview: false, // 是否显示预览按钮
- openProductModal: false, // 预览弹窗
- previewList: []// 预览值
- }
- },
- computed: {
- // 计算满赠规则 配额比例
- perCentNum () {
- const val = (this.form.giveRuleList[0].regularValue && this.form.giveRuleList[0].regularValue != 0) ? ((this.form.giveRuleList[0].promotionValue / this.form.giveRuleList[0].regularValue) * 100).toFixed(2) : '0.00'
- return val
- },
- // 特价产品 判断不同折扣类型显示不同表头
- setColumns () {
- const _this = this
- var arr = []
- if (_this.form.discountType === '1') {
- arr = [
- { title: '省价折扣', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
- { title: '市价折扣', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
- { title: '特约折扣', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } }
- ]
- } else if (_this.form.discountType === '2') {
- arr = [
- { title: '省价直降', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
- { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
- { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } }
- ]
- }
- return arr
- },
- // 特加产品表格表头
- specialColumns () {
- const _this = this
- const arr = [
- { 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' }
- ]
- if (_this.form.discountType == '0' || _this.form.discountType == '1') {
- arr.splice(5, 0, { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
- arr.splice(8, 0, { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
- arr.splice(11, 0, { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
- } else {
- arr.splice(5, 0, { title: '省价直降金额', dataIndex: 'provinceSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
- arr.splice(8, 0, { title: '市价直降金额', dataIndex: 'citySubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
- arr.splice(11, 0, { title: '特约直降金额', dataIndex: 'specialSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 重置
- resetSearchForm () {
- this.form = {
- promotionRuleType: undefined,
- gateFlag: undefined, // 门槛
- gateValue: 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 () {
- this.spinning = true
- getRuleDetail({ sn: this.itemSn }).then(res => {
- this.spinning = false
- if (res.status == 200) {
- const resultObj = res.data
- if (resultObj.gateFlag == '1') {
- this.chooseVal = 'a'
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.gateProductList)
- } else {
- if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_PROD') {
- this.chooseVal = 'b'
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
- } else if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_MONEY') {
- this.chooseVal = 'b'
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
- } else {
- this.chooseVal = 'd'
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.specialProductList)
- }
- }
- this.form = { ...this.form, ...resultObj }
- this.setTableData = [{
- provinceValue: this.form.provinceValue,
- cityValue: this.form.cityValue,
- specialValue: this.form.specialValue
- }]
- }
- })
- },
- // 判断预览按钮是否显示
- judgeBtnShow (conData) {
- const hasData = conData.some(item => item.productThisList)
- return hasData
- },
- // 获取预览数据
- getPreviewList (dataList) {
- let newList = []
- dataList.forEach(con => {
- if (con.productThisList) {
- con.productThisList.forEach((item, i) => {
- item.unitTypeInfo = con.unitTypeDictValue + con.unitQty
- item.productTypeInfo = con.promotionProductType
- })
- newList = [ ...newList, ...con.productThisList ]
- }
- })
- return newList
- },
- // 预览
- handlePreview () {
- const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
- const titName = this.chooseVal === 'a' ? '门槛产品' : this.chooseVal === 'b' ? '正价产品' : this.chooseVal === 'd' ? '特价产品' : '促销产品'
- if (dataName != 'giftGroup') {
- const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
- if (newPreviewList && newPreviewList.length > 0) {
- this.previewList = newPreviewList
- const resuleObj = {
- tit: titName,
- promotionRuleSn: this.itemSn,
- promotionProductType: newPreviewList[0].productTypeInfo
- }
- this.$refs.previewModal.pageInit(resuleObj)
- }
- } else {
- // 阶梯数据处理
- const stepIndex = this.chooseVal.split('')[1]
- if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
- const stepPreviewList = this.getPreviewList(this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)])
- this.previewList = stepPreviewList
- const resuleObj = {
- tit: '促销产品(阶梯' + (stepIndex * 1 + 1) + ')',
- promotionRuleSn: this.itemSn,
- promotionProductType: stepPreviewList[0].productTypeInfo,
- scopeLevel: (stepIndex * 1 + 1)
- }
- this.$refs.previewModal.pageInit(resuleObj)
- }
- }
- this.openProductModal = true
- },
- // 关闭产品弹窗
- closeProductModal () {
- this.previewList = []
- this.openProductModal = false
- },
- // 处理阶梯显示数据
- onChange () {
- const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
- if (dataName != 'giftGroup') {
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form[dataName + 'ProductList'])
- } else {
- // 阶梯数据处理
- const pos = this.chooseVal.split('')[1]
- if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
- this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form.giftProductMap['GIFT' + (pos * 1 + 1)])
- }
- }
- }
- },
- 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;
- }
- .tabBox::-webkit-scrollbar-track {
- background: transparent;
- }
- .tabBox::-webkit-scrollbar-thumb {
- background: transparent;
- }
- .tabBox::-webkit-scrollbar-button {
- display: none;
- }
- // 设置input 禁用颜色
- .ant-form-item-control .ant-input[disabled]{
- color:#333333;
- background:#ffffff;
- }
- .ant-radio-button-wrapper-disabled{
- color:#333333;
- padding:0 16px;
- }
- .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked{
- background-color: #ed1c24 !important;
- color:#ffffff;
- padding:0 16px;
- }
- /deep/.ant-select-disabled .ant-select-selection, .ant-cascader-picker-disabled{
- color:#333 !important;
- background:#fff;
- }
- .flex{
- display:flex;
- align-items:center;
- justify-content:space-between;
- }
- }
- </style>
|