|
|
|
|
@ -1,98 +1,93 @@
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-drawer
|
|
|
|
|
:title="$route.meta.title"
|
|
|
|
|
direction="rtl"
|
|
|
|
|
size="68%"
|
|
|
|
|
:visible.sync="visible"
|
|
|
|
|
append-to-body
|
|
|
|
|
@close="$emit('update:isShow',false)">
|
|
|
|
|
<section class="drawer-container">
|
|
|
|
|
<el-descriptions class="drawer-container__desc" size="small" border ref="elDesc" :column="2" direction="vertical" :labelStyle="{ 'font-weight': '500', 'font-size': '15px' }">
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品名称">
|
|
|
|
|
{{ form['name'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品价格">
|
|
|
|
|
{{ typeof form['price'] === 'number' ? form['price'].toFixed(2) : form['price'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="封面图片" prop="image_id">
|
|
|
|
|
<el-upload
|
|
|
|
|
:file-list="form['image_id']"
|
|
|
|
|
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="内容" span="2">
|
|
|
|
|
{{ form['content'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="商品轮播图" prop="product_images">
|
|
|
|
|
<el-upload
|
|
|
|
|
:file-list="form['product_images']"
|
|
|
|
|
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品">
|
|
|
|
|
{{ form['product_skus'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="排序">
|
|
|
|
|
{{ typeof form['sort'] === 'number' ? form['sort'].toFixed(2) : form['sort'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</section>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-drawer
|
|
|
|
|
:title="$route.meta.title"
|
|
|
|
|
direction="rtl"
|
|
|
|
|
size="68%"
|
|
|
|
|
:visible.sync="visible"
|
|
|
|
|
append-to-body
|
|
|
|
|
@close="$emit('update:isShow',false)"
|
|
|
|
|
>
|
|
|
|
|
<section class="drawer-container">
|
|
|
|
|
<el-descriptions ref="elDesc" class="drawer-container__desc" size="small" border :column="2" direction="vertical" :label-style="{ 'font-weight': '500', 'font-size': '15px' }">
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品名称">
|
|
|
|
|
{{ form['name'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品价格">
|
|
|
|
|
{{ typeof form['price'] === 'number' ? form['price'].toFixed(2) : form['price'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="封面图片">
|
|
|
|
|
<el-image
|
|
|
|
|
style="width: 100px;"
|
|
|
|
|
fit="contain"
|
|
|
|
|
:src="form['image']['url']"
|
|
|
|
|
:preview-src-list="[form['image']['url']]"
|
|
|
|
|
/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="内容" span="2">
|
|
|
|
|
<div v-html="form['content']" />
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="商品轮播图" prop="product_images">
|
|
|
|
|
<el-upload
|
|
|
|
|
:file-list="form['product_images']"
|
|
|
|
|
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="商品">
|
|
|
|
|
{{ form['product_skus'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
<el-descriptions-item label="排序">
|
|
|
|
|
{{ typeof form['sort'] === 'number' ? form['sort'].toFixed(2) : form['sort'] }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</section>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { show } from "@/api/product/product";
|
|
|
|
|
import { show } from '@/api/product/product'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'ProductShow',
|
|
|
|
|
props: {
|
|
|
|
|
isShow: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
productCategory: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "ProductShow",
|
|
|
|
|
props: {
|
|
|
|
|
isShow: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
productCategory : {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => []
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
loading: false,
|
|
|
|
|
visible: false,
|
|
|
|
|
form: {
|
|
|
|
|
|
|
|
|
|
product_category_id: '',
|
|
|
|
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
|
|
|
|
price: '',
|
|
|
|
|
|
|
|
|
|
image_id: [],
|
|
|
|
|
|
|
|
|
|
content: '',
|
|
|
|
|
|
|
|
|
|
product_images: [],
|
|
|
|
|
|
|
|
|
|
product_skus: [],
|
|
|
|
|
|
|
|
|
|
sort: '',
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
product_category_id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
price: '',
|
|
|
|
|
image_id: [],
|
|
|
|
|
image: {},
|
|
|
|
|
content: '',
|
|
|
|
|
product_images: [],
|
|
|
|
|
product_skus: [],
|
|
|
|
|
sort: ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
isShow(newVal) {
|
|
|
|
|
@ -100,15 +95,16 @@
|
|
|
|
|
},
|
|
|
|
|
visible(newVal) {
|
|
|
|
|
this.$emit('update:isShow', newVal)
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getDetail(id) {
|
|
|
|
|
try {
|
|
|
|
|
const detail = await show({
|
|
|
|
|
id
|
|
|
|
|
id,
|
|
|
|
|
show_relation: ['image']
|
|
|
|
|
})
|
|
|
|
|
for (let key in this.form) {
|
|
|
|
|
for (const key in this.form) {
|
|
|
|
|
if (detail.hasOwnProperty(key)) {
|
|
|
|
|
this.form[key] = detail[key]
|
|
|
|
|
}
|
|
|
|
|
|