|
@@ -1,21 +1,9 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-dialog
|
|
|
- :title="dialogtitle"
|
|
|
- width="1200px"
|
|
|
- class="icon-dialog"
|
|
|
- :visible.sync="show"
|
|
|
- :before-close="closeForm"
|
|
|
- append-to-body
|
|
|
- @open="open"
|
|
|
- >
|
|
|
- <el-form
|
|
|
- ref="form"
|
|
|
- :size="size"
|
|
|
- :model="form"
|
|
|
- :rules="rules"
|
|
|
- :label-width="$store.getters.device !== 'mobile'?'16%':'90px'"
|
|
|
- >
|
|
|
+ <el-dialog :title="dialogtitle" width="1200px" class="icon-dialog" :visible.sync="show" :before-close="closeForm"
|
|
|
+ append-to-body @open="open">
|
|
|
+ <el-form ref="form" :size="size" :model="form" :rules="rules"
|
|
|
+ :label-width="$store.getters.device !== 'mobile'?'16%':'90px'">
|
|
|
<el-tabs v-model="activeName">
|
|
|
<el-tab-pane style="padding-top:10px" label="基本信息" name="基本信息">
|
|
|
<el-row>
|
|
@@ -35,15 +23,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="分类" prop="cat_id">
|
|
|
- <Treeselect
|
|
|
- v-model="form.cat_id"
|
|
|
- :default-expand-level="1"
|
|
|
- :options="cidarray"
|
|
|
- :normalizer="normalizer"
|
|
|
- :show-count="true"
|
|
|
- z-index="999999"
|
|
|
- placeholder="请选择所分类"
|
|
|
- />
|
|
|
+ <Treeselect v-model="form.cat_id" :default-expand-level="1" :options="cidarray"
|
|
|
+ :normalizer="normalizer" :show-count="true" z-index="999999" placeholder="请选择所分类" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -80,13 +61,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="单位">
|
|
|
- <el-select
|
|
|
- v-model="form.quantity_unit"
|
|
|
- style="width:160px;"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- placeholder="请选择单位"
|
|
|
- >
|
|
|
+ <el-select v-model="form.quantity_unit" style="width:160px;" filterable clearable
|
|
|
+ placeholder="请选择单位">
|
|
|
<el-option v-for="(item,i) in unitarray" :key="i" :label="item.key" :value="item.val" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -95,45 +71,24 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="库存" prop="quantity">
|
|
|
- <el-input-number
|
|
|
- v-model="form.quantity"
|
|
|
- controls-position="right"
|
|
|
- style="width:200px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="请输入库存"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.quantity" controls-position="right" style="width:200px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="请输入库存" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="'兑换所需'+lang.points">
|
|
|
- <el-input-number
|
|
|
- v-model="form.pay_points"
|
|
|
- controls-position="right"
|
|
|
- style="width:200px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- :placeholder="'兑换所需'+lang.points"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.pay_points" controls-position="right" style="width:200px;"
|
|
|
+ auto-complete="off" clearable :min="0" :placeholder="'兑换所需'+lang.points" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row v-if="form.is_points_goods!=1">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="能抵扣的金额">
|
|
|
- <el-input-number
|
|
|
- v-model="form.points_price"
|
|
|
- controls-position="right"
|
|
|
- style="width:200px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="能抵扣的金额"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.points_price" controls-position="right" style="width:200px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="能抵扣的金额" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -141,10 +96,10 @@
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="'购买得'+lang.points">
|
|
|
<el-input v-model="form.points" style="width:500px;" auto-complete="off" clearable placeholder="请输入">
|
|
|
- <template slot="append"><span v-if="!form.points_method">%</span><span v-else>{{ lang.points }}</span>
|
|
|
+ <template slot="append"><span v-if="!form.points_method">%</span><span v-else>{{lang.points}}</span>
|
|
|
<el-radio-group v-model="form.points_method" style="padding-left: 10px;">
|
|
|
<el-radio :label="0">金额百分比</el-radio>
|
|
|
- <el-radio :label="1">固定{{ lang.points }}</el-radio>
|
|
|
+ <el-radio :label="1">固定{{lang.points}}</el-radio>
|
|
|
</el-radio-group></template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
@@ -160,15 +115,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="排序">
|
|
|
- <el-input-number
|
|
|
- v-model="form.sort"
|
|
|
- controls-position="right"
|
|
|
- style="width:200px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="排序"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.sort" controls-position="right" style="width:200px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="排序" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -201,23 +149,17 @@
|
|
|
</el-row>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane style="padding-top:10px" label="规格/选项" name="规格/选项">
|
|
|
- <el-row>
|
|
|
+ <!--<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="多规格同时下单">
|
|
|
<el-switch v-model="form.is_skumore" :active-value="1" :inactive-value="0" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
+ </el-row>-->
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <SkuForm
|
|
|
- :show="show"
|
|
|
- :source-attribute="form.sourceAttribute"
|
|
|
- :structure="structure"
|
|
|
- :attribute.sync="form.attribute"
|
|
|
- :sku.sync="form.sku"
|
|
|
- :theme="theme"
|
|
|
- >
|
|
|
+ <SkuForm :show="show" :source-attribute="form.sourceAttribute" :structure="structure"
|
|
|
+ :attribute.sync="form.attribute" :sku.sync="form.sku" :theme="theme">
|
|
|
<template #image="slotProps">
|
|
|
<div class="image-upload-container">
|
|
|
<ImagesUpload size="small" file-type="image" :image.sync="slotProps.row.image" />
|
|
@@ -253,13 +195,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="独立佣金">
|
|
|
- <el-input
|
|
|
- v-model="form.commission_price"
|
|
|
- style="width:500px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- >
|
|
|
+ <el-input v-model="form.commission_price" style="width:500px;" auto-complete="off" clearable
|
|
|
+ placeholder="请输入">
|
|
|
<template v-if="form.commission_method==0" slot="append">%</template>
|
|
|
<template v-if="form.commission_method==1" slot="append">元</template>
|
|
|
</el-input>
|
|
@@ -291,12 +228,8 @@
|
|
|
<el-row v-for="(item,i) in form.MemberGroup" :key="i">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="item.title">
|
|
|
- <el-select
|
|
|
- v-if="form.member_discount_method==1"
|
|
|
- v-model="item.addsubtract"
|
|
|
- style="width:60px;margin-right: 8px;"
|
|
|
- placeholder="加"
|
|
|
- >
|
|
|
+ <el-select v-if="form.member_discount_method==1" v-model="item.addsubtract"
|
|
|
+ style="width:60px;margin-right: 8px;" placeholder="加">
|
|
|
<el-option label="加" :value="0" />
|
|
|
<el-option label="减" :value="1" />
|
|
|
</el-select>
|
|
@@ -322,13 +255,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="重量">
|
|
|
- <el-input
|
|
|
- v-model="form.weight"
|
|
|
- style="width:500px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- placeholder="请输入重量"
|
|
|
- >
|
|
|
+ <el-input v-model="form.weight" style="width:500px;" auto-complete="off" clearable
|
|
|
+ placeholder="请输入重量">
|
|
|
<template slot="append">千克(KG)</template>
|
|
|
</el-input>
|
|
|
<div class="help-block">重量跟物流费挂勾</div>
|
|
@@ -338,30 +266,16 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="销量基数">
|
|
|
- <el-input-number
|
|
|
- v-model="form.sale_count_base"
|
|
|
- controls-position="right"
|
|
|
- style="width:300px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="请输入销量基数"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.sale_count_base" controls-position="right" style="width:300px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="请输入销量基数" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="点击量基数">
|
|
|
- <el-input-number
|
|
|
- v-model="form.viewed_base"
|
|
|
- controls-position="right"
|
|
|
- style="width:300px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="请输入点击量基数"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.viewed_base" controls-position="right" style="width:300px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="请输入点击量基数" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -383,15 +297,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="最小起订数目">
|
|
|
- <el-input-number
|
|
|
- v-model="form.minimum"
|
|
|
- controls-position="right"
|
|
|
- style="width:300px;"
|
|
|
- auto-complete="off"
|
|
|
- clearable
|
|
|
- :min="0"
|
|
|
- placeholder="请输入最小起订数目"
|
|
|
- />
|
|
|
+ <el-input-number v-model="form.minimum" controls-position="right" style="width:300px;"
|
|
|
+ auto-complete="off" clearable :min="0" placeholder="请输入最小起订数目" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -409,142 +316,142 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import Treeselect from '@riophae/vue-treeselect'
|
|
|
-import Tag from '@/components/common/Tag.vue'
|
|
|
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
-import ImagesUpload from '@/components/common/ImagesUpload.vue'
|
|
|
-import WangEditor from '@/components/common/WangEditor.vue'
|
|
|
-import SkuForm from '@/components/common/SkuForm.vue'
|
|
|
-export default {
|
|
|
- name: 'Goodsupdate',
|
|
|
- components: {
|
|
|
- Treeselect,
|
|
|
- WangEditor,
|
|
|
- ImagesUpload,
|
|
|
- SkuForm,
|
|
|
- Tag
|
|
|
- },
|
|
|
- props: {
|
|
|
- show: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
- opentype: {
|
|
|
- type: String,
|
|
|
- default: 'add'
|
|
|
- },
|
|
|
- size: {
|
|
|
- type: String,
|
|
|
- default: 'small'
|
|
|
+ import Treeselect from '@riophae/vue-treeselect'
|
|
|
+ import Tag from '@/components/common/Tag.vue'
|
|
|
+ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
+ import ImagesUpload from '@/components/common/ImagesUpload.vue'
|
|
|
+ import WangEditor from '@/components/common/WangEditor.vue'
|
|
|
+ import SkuForm from '@/components/common/SkuForm.vue'
|
|
|
+ export default {
|
|
|
+ name: 'Goodsupdate',
|
|
|
+ components: {
|
|
|
+ Treeselect,
|
|
|
+ WangEditor,
|
|
|
+ ImagesUpload,
|
|
|
+ SkuForm,
|
|
|
+ Tag
|
|
|
},
|
|
|
- info: {
|
|
|
- type: Object
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- lang: {},
|
|
|
- Config: {},
|
|
|
- dialogtitle: '',
|
|
|
- form: {
|
|
|
- title: '',
|
|
|
- sourceAttribute: [],
|
|
|
- attribute: [],
|
|
|
- sku: [],
|
|
|
- keyword: [],
|
|
|
- status: 1
|
|
|
+ props: {
|
|
|
+ show: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
},
|
|
|
- cidarray: [],
|
|
|
- unitarray: [],
|
|
|
- loading: false,
|
|
|
- rules: {
|
|
|
- title: [{
|
|
|
- required: true,
|
|
|
- message: '显示文字不能为空',
|
|
|
- trigger: 'blur'
|
|
|
- }]
|
|
|
+ opentype: {
|
|
|
+ type: String,
|
|
|
+ default: 'add'
|
|
|
},
|
|
|
- theme: 2,
|
|
|
- structure: [{
|
|
|
- name: 'image',
|
|
|
- type: 'slot',
|
|
|
- label: '图片'
|
|
|
- }, {
|
|
|
- name: 'price',
|
|
|
- type: 'input',
|
|
|
- label: '价格'
|
|
|
- }, {
|
|
|
- name: 'quantity',
|
|
|
- type: 'input',
|
|
|
- label: '库存'
|
|
|
- }],
|
|
|
- activeName: '基本信息'
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- show(val) {
|
|
|
- if (val) {
|
|
|
- this.$api.post('/goods/getField', {
|
|
|
- ptype: 1
|
|
|
- }).then(res => {
|
|
|
- this.cidarray = res.data.cidarray
|
|
|
- this.unitarray = res.data.unitarray
|
|
|
- })
|
|
|
+ size: {
|
|
|
+ type: String,
|
|
|
+ default: 'small'
|
|
|
+ },
|
|
|
+ info: {
|
|
|
+ type: Object
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.$api.post('/Config/getInfo').then(res => {
|
|
|
- this.Config = res.data
|
|
|
- })
|
|
|
- this.$api.post('/Lang/getlang').then(res => {
|
|
|
- this.lang = res.data
|
|
|
- })
|
|
|
- },
|
|
|
- methods: {
|
|
|
- open() {
|
|
|
- this.activeName = '基本信息'
|
|
|
- if (this.opentype == 'update') {
|
|
|
- this.dialogtitle = '修改'
|
|
|
- } else {
|
|
|
- this.dialogtitle = '添加'
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ lang: {},
|
|
|
+ Config: {},
|
|
|
+ dialogtitle: '',
|
|
|
+ form: {
|
|
|
+ title: '',
|
|
|
+ sourceAttribute: [],
|
|
|
+ attribute: [],
|
|
|
+ sku: [],
|
|
|
+ keyword: [],
|
|
|
+ status: 1
|
|
|
+ },
|
|
|
+ cidarray: [],
|
|
|
+ unitarray:[],
|
|
|
+ loading: false,
|
|
|
+ rules: {
|
|
|
+ title: [{
|
|
|
+ required: true,
|
|
|
+ message: '显示文字不能为空',
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ theme: 2,
|
|
|
+ structure: [{
|
|
|
+ name: 'image',
|
|
|
+ type: 'slot',
|
|
|
+ label: '图片'
|
|
|
+ }, {
|
|
|
+ name: 'price',
|
|
|
+ type: 'input',
|
|
|
+ label: '价格'
|
|
|
+ }, {
|
|
|
+ name: 'quantity',
|
|
|
+ type: 'input',
|
|
|
+ label: '库存'
|
|
|
+ }],
|
|
|
+ activeName: '基本信息'
|
|
|
}
|
|
|
- this.form = this.info
|
|
|
},
|
|
|
- submit() {
|
|
|
- this.$refs['form'].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.loading = true
|
|
|
- this.$api.post('/goods/update', this.form).then(res => {
|
|
|
- this.$message({
|
|
|
- message: res.msg,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.$emit('refesh_list')
|
|
|
- this.closeForm()
|
|
|
- }).catch(() => {
|
|
|
- this.loading = false
|
|
|
+ watch: {
|
|
|
+ show(val) {
|
|
|
+ if (val) {
|
|
|
+ this.$api.post('/goods/getField', {
|
|
|
+ ptype: 1
|
|
|
+ }).then(res => {
|
|
|
+ this.cidarray = res.data.cidarray
|
|
|
+ this.unitarray = res.data.unitarray
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- closeForm() {
|
|
|
- this.$emit('update:show', false)
|
|
|
- this.loading = false
|
|
|
- if (this.$refs['form'] !== undefined) {
|
|
|
- this.$refs['form'].resetFields()
|
|
|
}
|
|
|
},
|
|
|
- normalizer(data) {
|
|
|
- if (data.children && !data.children.length) {
|
|
|
- delete data.children
|
|
|
- }
|
|
|
- return {
|
|
|
- id: data.val,
|
|
|
- label: data.key,
|
|
|
- children: data.children
|
|
|
+ mounted() {
|
|
|
+ this.$api.post('/Config/getInfo').then(res => {
|
|
|
+ this.Config = res.data
|
|
|
+ })
|
|
|
+ this.$api.post('/Lang/getlang').then(res => {
|
|
|
+ this.lang = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open() {
|
|
|
+ this.activeName = '基本信息'
|
|
|
+ if (this.opentype == 'update') {
|
|
|
+ this.dialogtitle = '修改'
|
|
|
+ } else {
|
|
|
+ this.dialogtitle = '添加'
|
|
|
+ }
|
|
|
+ this.form = this.info
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.$refs['form'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true
|
|
|
+ this.$api.post('/goods/update', this.form).then(res => {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.$emit('refesh_list')
|
|
|
+ this.closeForm()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ closeForm() {
|
|
|
+ this.$emit('update:show', false)
|
|
|
+ this.loading = false
|
|
|
+ if (this.$refs['form'] !== undefined) {
|
|
|
+ this.$refs['form'].resetFields()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ normalizer(data) {
|
|
|
+ if (data.children && !data.children.length) {
|
|
|
+ delete data.children
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: data.val,
|
|
|
+ label: data.key,
|
|
|
+ children: data.children
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</script>
|