|
@@ -76,23 +76,26 @@
|
|
|
</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')&&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>
|
|
|
+ <div class="flex">
|
|
|
+ <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')&&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="primary" v-show="isShowPreview" class="button-info" @click="handlePreview">预览</a-button>
|
|
|
+ </div>
|
|
|
<!-- 列表 -->
|
|
|
<div v-show="chooseVal==='a'||chooseVal==='b'||chooseVal==='c'">
|
|
|
<a-table
|
|
@@ -218,15 +221,19 @@
|
|
|
<a-button id="dealerPromotions-basicInfo-modal-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 { getRuleDetail } from '@/api/promotion'
|
|
|
+import productPreviewModal from './productPreviewModal'
|
|
|
export default {
|
|
|
name: 'DetailModal',
|
|
|
mixins: [commonMixin],
|
|
|
+ components: { productPreviewModal },
|
|
|
props: {
|
|
|
openModal: { // 弹框显示状态
|
|
|
type: Boolean,
|
|
@@ -269,13 +276,16 @@ export default {
|
|
|
productBrandList: [],
|
|
|
productThisList: []
|
|
|
},
|
|
|
+ isShowPreview: false,
|
|
|
chooseVal: 'a',
|
|
|
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' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ previewList: [],
|
|
|
+ openProductModal: false // 产品预览弹窗
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -360,19 +370,18 @@ export default {
|
|
|
const resultObj = res.data
|
|
|
if (resultObj.gateFlag == '1') {
|
|
|
this.chooseVal = 'a'
|
|
|
+ this.isShowPreview = this.judgeBtnShow(res.data.gateProductList)
|
|
|
} else {
|
|
|
if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_PROD') {
|
|
|
this.chooseVal = 'b'
|
|
|
+ this.isShowPreview = this.judgeBtnShow(res.data.regularProductList)
|
|
|
} else if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_MONEY') {
|
|
|
this.chooseVal = 'b'
|
|
|
+ this.isShowPreview = this.judgeBtnShow(res.data.regularProductList)
|
|
|
} else {
|
|
|
this.chooseVal = 'd'
|
|
|
+ // this.isShowPreview = this.judgeBtnShow(res.data.giftProductList)
|
|
|
}
|
|
|
- // if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
|
|
|
- // this.chooseVal = 'c0'
|
|
|
- // } else {
|
|
|
- // this.chooseVal = resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
|
|
|
- // }
|
|
|
}
|
|
|
this.form = { ...this.form, ...resultObj }
|
|
|
this.setTableData = [{
|
|
@@ -382,6 +391,59 @@ export default {
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 判断预览按钮是否显示
|
|
|
+ judgeBtnShow (conData) {
|
|
|
+ const hasData = conData.some(item => item.productTypeList)
|
|
|
+ return hasData
|
|
|
+ },
|
|
|
+ getPreviewList (dataList) {
|
|
|
+ let newList = []
|
|
|
+ dataList.forEach(con => {
|
|
|
+ if (con.productThisList) {
|
|
|
+ con.productThisList.forEach((item, i) => {
|
|
|
+ item.unitTypeInfo = con.unitTypeDictValue + con.unitQty
|
|
|
+ item.no = i * 1 + 1
|
|
|
+ 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'
|
|
|
+ if (dataName != 'giftGroup') {
|
|
|
+ const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
|
|
|
+ if (newPreviewList && newPreviewList.length > 0) {
|
|
|
+ this.previewList = newPreviewList
|
|
|
+ const resuleObj = {
|
|
|
+ tit: '门槛产品',
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ this.$refs.previewModal.pageInit(resuleObj)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.openProductModal = true
|
|
|
+ },
|
|
|
+ closeProductModal () {
|
|
|
+ this.previewList = []
|
|
|
+ this.openProductModal = false
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -431,11 +493,11 @@ export default {
|
|
|
.tabBox::-webkit-scrollbar-track {
|
|
|
background: transparent;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.tabBox::-webkit-scrollbar-thumb {
|
|
|
background: transparent;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.tabBox::-webkit-scrollbar-button {
|
|
|
display: none;
|
|
|
}
|
|
@@ -457,6 +519,11 @@ export default {
|
|
|
color:#333 !important;
|
|
|
background:#fff;
|
|
|
}
|
|
|
+ .flex{
|
|
|
+ display:flex;
|
|
|
+ align-items:center;
|
|
|
+ justify-content:space-between;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</style>
|