123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <a-modal
- centered
- class="productInfoDetail-modal"
- :footer="null"
- :maskClosable="false"
- title="产品详情"
- v-model="isShow"
- @cancel="isShow=false"
- :width="800">
- <!-- 产品详情 -->
- <div>
- <a-descriptions bordered :column="2" size="small">
- <a-descriptions-item label="产品名称:">{{ detailsData&&detailsData.name || '--' }}</a-descriptions-item>
- <a-descriptions-item label="产品编码:">{{ detailsData&&detailsData.code || '--' }}</a-descriptions-item>
- <a-descriptions-item label="原厂编码:">{{ detailsData&&detailsData.origCode || '--' }}</a-descriptions-item>
- <a-descriptions-item label="基本单位:">{{ detailsData&&detailsData.unit || '--' }}</a-descriptions-item>
- <a-descriptions-item label="产品品牌:">{{ detailsData&&detailsData.productBrandName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="产品分类:">{{ productTypeName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="经销批发价:">{{ detailsData&&(detailsData.specialPrice || detailsData.specialPrice==0) ? toThousands(detailsData.specialPrice,2) : '--' }}</a-descriptions-item>
- <a-descriptions-item label="终端价:">{{ detailsData&&(detailsData.terminalPrice || detailsData.terminalPrice==0) ? toThousands(detailsData.terminalPrice,2) : '--' }}</a-descriptions-item>
- <a-descriptions-item label="车主价:">{{ detailsData&&(detailsData.carOwnersPrice || detailsData.carOwnersPrice==0) ? toThousands(detailsData.carOwnersPrice,2) : '--' }}</a-descriptions-item>
- </a-descriptions>
- <div class="btn-cont"><a-button id="product-management-detail-modal-back" @click="isShow = false">返回列表</a-button></div>
- </div>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { dealerProductDetail } from '@/api/dealerProduct'
- export default {
- name: 'ProductInfoDetailModal',
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemId: {
- type: [Number, String],
- default: ''
- }
- },
- computed: {
- productTypeName () {
- const productTypeName1 = this.detailsData && this.detailsData.productTypeName1 ? this.detailsData.productTypeName1 : ''
- const productTypeName2 = this.detailsData && this.detailsData.productTypeName2 ? ' > ' + this.detailsData.productTypeName2 : ''
- const productTypeName3 = this.detailsData && this.detailsData.productTypeName3 ? ' > ' + this.detailsData.productTypeName3 : ''
- return productTypeName1 + productTypeName2 + productTypeName3
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- detailsData: null // 详情数据
- }
- },
- methods: {
- // 获取详情
- getDetail () {
- dealerProductDetail({ id: this.itemId }).then(res => {
- if (res.status == 200) {
- this.detailsData = res.data
- } else {
- this.detailsData = null
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.detailsData = null
- }
- },
- itemId (newValue, oldValue) {
- if (this.isShow && newValue) {
- this.getDetail()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .productInfoDetail-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .ant-descriptions-item-label.ant-descriptions-item-colon{
- width: 120px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|