123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <a-modal
- centered
- class="productBrandDetail-modal"
- :footer="null"
- :maskClosable="false"
- title="产品详情"
- v-model="isShow"
- @cancel="isShow=false"
- :width="960">
- <div class="modalContext">
- <a-descriptions bordered size="small" :column="1">
- <a-descriptions-item label="品牌名称:">{{ detailsData&&detailsData.brandName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="品牌分类:">{{ detailsData&&detailsData.brandTypeDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="排序字母:">{{ detailsData&&detailsData.sortChar || '--' }}</a-descriptions-item>
- <a-descriptions-item label="品牌图片:">
- <img v-if="detailsData&&detailsData.imageUrl" :src="detailsData.imageUrl" title="点击查看大图" class="productPic" @click="getPreview(detailsData.imageUrl)" />
- <span v-else>--</span>
- </a-descriptions-item>
- <a-descriptions-item label="品牌介绍:">
- <div v-if="detailsData&&detailsData.brandIntroduce" v-html="detailsData.brandIntroduce"></div>
- <span v-else>--</span>
- </a-descriptions-item>
- </a-descriptions>
- </div>
- <div class="btn-cont"><a-button id="productBrandDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
- <a-modal :visible="previewVisible" :footer="null" centered :maskClosable="false" @cancel="previewVisible=false">
- <img alt="example" style="width: 100%;" :src="previewImage" />
- </a-modal>
- </a-modal>
- </template>
- <script>
- import { productBrandSnDetail } from '@/api/productBrand'
- export default {
- name: 'ProductBrandDetailModal',
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemSn: {
- type: [Number, String],
- default: ''
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- detailsData: null, // 详情数据
- previewVisible: false,
- previewImage: ''
- }
- },
- methods: {
- // 获取详情
- getDetail () {
- productBrandSnDetail({ sn: this.itemSn }).then(res => {
- if (res.status == 200) {
- this.detailsData = res.data
- } else {
- this.detailsData = null
- }
- })
- },
- // 查看大图
- getPreview (url) {
- this.previewImage = url
- this.previewVisible = true
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.detailsData = null
- }
- },
- itemSn (newValue, oldValue) {
- if (this.isShow && newValue) {
- this.getDetail()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .productBrandDetail-modal{
- .productPic{
- cursor: pointer;
- max-width: 100px;
- max-height: 100px;
- margin-right: 10px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- .ant-descriptions-item-label.ant-descriptions-item-colon{
- width: 120px;
- }
- .modalContext{
- padding: 0 40px;
- max-height:630px;
- overflow-y: scroll;
- }
- }
- </style>
|