123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <template>
- <a-modal
- centered
- class="promotion-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- title="详情"
- v-model="isShow"
- @cancel="isShow=false"
- width="70%">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="detailModal-con">
- <a-form-model
- id="promotion-basicInfo-form"
- ref="ruleForm"
- :model="form"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol" >
- <a-row>
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="促销名称" prop="promoName" required :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.promoName }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="促销时间" prop="promoName" required :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.promoStartDate }}~{{ form.promoEndDate }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="排序" prop="sort" :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.sort||form.sort==0?form.sort:'--' }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="参与经销商" required prop="allDealerFlag" :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.allDealerFlag=='1'?'全部经销商':'部分经销商' }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="封面图片" required prop="imageUrl">
- <img
- :src="form.imageUrl"
- alt="图片走丢了"
- width="750px"
- height="300px"
- style="margin-right:10px;object-fit: cover;"/>
- <div class="upload-desc">说明:单张大小小于10Mb;建议尺寸:宽(750px)*高(300px)</div>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="促销描述" prop="description" required>
- {{ form.description||'--' }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="加盟商开关权限:" prop="dealerOpenFlag" required>
- {{ form.dealerOpenFlag?form.dealerOpenFlag==='1'?'是':'否':'--' }}
- </a-form-model-item>
- </a-col>
- <div v-if="form.promoType==='BUY_PROD_GIVE_VALID'">
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="券名称" prop="validName" required :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.validName }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="12" :sm="12">
- <a-form-model-item label="券副标题" :label-col="{span:8}" :wrapper-col="{span:14}">
- {{ form.validTitle ||'--' }}
- </a-form-model-item>
- </a-col>
- <!-- <a-col :xs="24" :sm="24">
- <a-form-model-item label="生成方式" prop="validBaseType">
- {{ form.validBaseTypeDictValue||'--' }}
- </a-form-model-item>
- </a-col> -->
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="券有效期" prop="validType" required>
- <span>{{ form.validType==='FIXED'?'固定日期':'领取后,立即生效' }}</span>
- <span style="margin-left:10px;" v-if="form.validType==='FIXED'">{{ form.validStartDate }}~{{ form.validEndDate }}</span>
- <span style="margin-left:10px;" v-else>有效期{{ form.validDays }}天</span>
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="券适用范围" prop="validScope" required>
- {{ form.validScope=='1'?'全部产品':'--' }}
- </a-form-model-item>
- </a-col>
- <a-col :xs="24" :sm="24">
- <a-form-model-item label="使用说明">
- {{ form.validInfo||'--' }}
- </a-form-model-item>
- </a-col>
- </div>
- <a-col :xs="24" :sm="24">
- <a-form-model-item required :label="form.promoType==='BUY_PROD_GIVE_PROD'?'满赠规则': form.promoType==='PROMO_PROD'?'优惠方式':'返券产品'" prop="promoName" >
- <div class="productTable">
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- :style="{ maxHeight: 300+'px' }"
- :scroll="{ y:230 }"
- bordered>
- </s-table>
- </div>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- <div class="btn-cont">
- <a-button id="promotion-basicInfo-modal-close" @click="isShow = false">关闭</a-button>
- </div>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- // 组件
- import { STable } from '@/components'
- // 接口
- import { shopPromoDetail, chooseProductList } from '@/api/shopPromo'
- export default {
- name: 'DetailModal',
- mixins: [commonMixin],
- components: { STable },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemSn: {// 活动sn
- type: String,
- default: ''
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- spinning: false,
- // form表单label布局
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 18 }
- },
- productTypeList: [], // 产品范围数据
- productRangeList: [], // 已选产品范围
- form: {
- promoType: undefined, // 促销类型
- promoName: '', // '促销名称'
- time: [], // 促销时间
- promoStartDate: undefined, // 促销时间-开始
- promoEndDate: undefined, // 促销时间-结束
- sort: undefined, // 排序
- allDealerFlag: '1', // 全部经销商 1 部分经销商0'
- imageUrl: undefined, // 促销封面图
- description: '', // '促销描述'
- dealerEditFlag: '0', // 加盟商编辑 0否 1是
- dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
- rangeList: [], // 选择产品列表
- discountType: 'STRAIGHT_DOWN', // 特价产品 - 优惠方式'
- validName: '', // 券名称
- validTitle: '', // 券副标题
- validBaseType: undefined, // 券生成方式
- validType: undefined, // 券有效期类型
- validStartDate: undefined, // 券生效时间
- validEndDate: undefined, // 券失效时间
- validDays: undefined, // 券有效期天数
- validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
- validInfo: '' // 使用说明
- },
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- const params = Object.assign(parameter, this.queryParam)
- params.promoSn = this.itemSn
- // 获取详情 已选参与活动产品数据
- return chooseProductList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- // 计算表格序号
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- }
- this.spinning = false
- return data
- })
- }
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productName', width: '28%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '商城售价', dataIndex: 'shopProductPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ]
- if (_this.form.promoType === 'BUY_PROD_GIVE_PROD') {
- arr.splice(4, 0, { title: '买', dataIndex: 'conditionValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
- arr.splice(5, 0, { title: '赠', dataIndex: 'resultValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
- } else if (_this.form.promoType === 'PROMO_PROD') {
- arr.splice(5, 0, { title: '特价价格', dataIndex: 'conditionValue', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
- } else {
- arr.splice(5, 0, { title: '返券金额', dataIndex: 'resultValue', width: '10%', align: 'center', customRender: text => { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
- }
- return arr
- }
- },
- methods: {
- // 重置
- resetSearchForm () {
- this.form = {
- promoType: undefined, // 促销类型
- promoName: '', // '促销名称'
- time: [], // 促销时间
- promoStartDate: undefined, // 促销时间-开始
- promoEndDate: undefined, // 促销时间-结束
- sort: undefined, // 排序
- allDealerFlag: '1', // 全部经销商 1 部分经销商0'
- imageUrl: undefined, // 促销封面图
- description: '', // '促销描述'
- dealerEditFlag: '0', // 加盟商编辑 0否 1是
- dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
- rangeList: [], // 选择产品列表
- discountType: 'STRAIGHT_DOWN', // 特价产品 - 优惠方式'
- validName: '', // 券名称
- validTitle: '', // 券副标题
- validBaseType: undefined, // 券生成方式
- validType: undefined, // 券有效期类型
- validStartDate: undefined, // 券生效时间
- validEndDate: undefined, // 券失效时间
- validDays: undefined, // 券有效期天数
- validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
- validInfo: '' // 使用说明
- }
- },
- // 获取列表详情
- getDetail () {
- shopPromoDetail({ sn: this.itemSn }).then(res => {
- if (res.status == 200) {
- this.form = res.data
- this.$nextTick(() => {
- this.$refs.table.refresh(true)
- })
- }
- })
- }
- },
- 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>
- .promotion-basicInfo-modal{
- .detailModal-con{
- max-height: 600px;
- overflow-y: scroll;
- }
- .timeBox{
- color:#ed1c24;
- opacity: .7;
- }
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .promotion-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;
- }
- .productTable{
- width:100%;
- }
- /deep/.ant-select-disabled .ant-select-selection--multiple .ant-select-selection__choice{
- color:#333;
- }
- }
- </style>
|