品牌、类别
This commit is contained in:
18
src/api/adminmallapi.js
Normal file
18
src/api/adminmallapi.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// 品牌列表
|
||||||
|
listAllBrand: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/adminapi/mall/listAllBrand',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 品牌列表
|
||||||
|
listAllCategory: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/adminapi/mall/listAllCategory',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,25 +62,27 @@
|
|||||||
},
|
},
|
||||||
name: '/pms',
|
name: '/pms',
|
||||||
path: '/pms',
|
path: '/pms',
|
||||||
children: [{
|
children: [
|
||||||
alwaysShow: true,
|
// {
|
||||||
component: 'product',
|
// alwaysShow: true,
|
||||||
meta: {
|
// component: 'product',
|
||||||
icon: 'el-icon-help',
|
// meta: {
|
||||||
title: '商品列表'
|
// icon: 'el-icon-help',
|
||||||
},
|
// title: '商品列表'
|
||||||
name: '/pms/product',
|
// },
|
||||||
path: '/pms/product'
|
// name: '/pms/product',
|
||||||
},
|
// path: '/pms/product'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// path: '/pms/addProduct',
|
||||||
|
// name: '/pms/addProduct',
|
||||||
|
// component: 'addProduct',
|
||||||
|
// meta: {
|
||||||
|
// title: '添加商品',
|
||||||
|
// icon: 'el-icon-help'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
path: '/pms/addProduct',
|
|
||||||
name: '/pms/addProduct',
|
|
||||||
component: 'addProduct',
|
|
||||||
meta: {
|
|
||||||
title: '添加商品',
|
|
||||||
icon: 'el-icon-help'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
alwaysShow: true,
|
alwaysShow: true,
|
||||||
component: 'brand',
|
component: 'brand',
|
||||||
meta: {
|
meta: {
|
||||||
@@ -98,16 +100,17 @@
|
|||||||
},
|
},
|
||||||
name: '/pms/productCate',
|
name: '/pms/productCate',
|
||||||
path: '/pms/productCate'
|
path: '/pms/productCate'
|
||||||
}, {
|
|
||||||
alwaysShow: true,
|
|
||||||
component: 'productAttr',
|
|
||||||
meta: {
|
|
||||||
icon: 'el-icon-help',
|
|
||||||
title: '商品类型'
|
|
||||||
},
|
|
||||||
name: '/pms/productAttr',
|
|
||||||
path: '/pms/productAttr'
|
|
||||||
}
|
}
|
||||||
|
// , {
|
||||||
|
// alwaysShow: true,
|
||||||
|
// component: 'productAttr',
|
||||||
|
// meta: {
|
||||||
|
// icon: 'el-icon-help',
|
||||||
|
// title: '商品类型'
|
||||||
|
// },
|
||||||
|
// name: '/pms/productAttr',
|
||||||
|
// path: '/pms/productAttr'
|
||||||
|
// }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,24 +16,61 @@
|
|||||||
<div class="listconadd">
|
<div class="listconadd">
|
||||||
|
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
|
<div class="item">
|
||||||
|
<span class="item_text">选择菜窖分类:</span>
|
||||||
|
<el-select v-model="formobj.brandId" placeholder="请选择菜窖分类" class="item_input" @change="selectBrandChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in brandList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<span class="item_text">选择商品分类:</span>
|
||||||
|
<el-select v-model="formobj.categoryId" placeholder="请选择商品分类" class="item_input" @change="selectCateChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in cateList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="item_text">名称:</span>
|
<span class="item_text">名称:</span>
|
||||||
<el-input v-model="formobj.name" placeholder="" class="item_input" clearable />
|
<el-input v-model="formobj.name" placeholder="" class="item_input" clearable />
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="item_text">编码:</span>
|
<span class="item_text">编码:</span>
|
||||||
<el-input v-model="formobj.code" placeholder="" class="item_input" clearable
|
<el-input
|
||||||
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" />
|
v-model="formobj.code"
|
||||||
|
placeholder=""
|
||||||
|
class="item_input"
|
||||||
|
clearable
|
||||||
|
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="item_text">条码:</span>
|
<span class="item_text">条码:</span>
|
||||||
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable
|
<el-input
|
||||||
oninput="value=value.replace(/[^0-9]/g,'')" />
|
v-model="formobj.barcode"
|
||||||
|
placeholder=""
|
||||||
|
class="item_input"
|
||||||
|
clearable
|
||||||
|
oninput="value=value.replace(/[^0-9]/g,'')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="item_text">价格 (元/斤):</span>
|
<span class="item_text">价格 (元/斤):</span>
|
||||||
<el-input v-model="formobj.price" placeholder="" class="item_input" clearable
|
<el-input
|
||||||
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
|
v-model="formobj.price"
|
||||||
|
placeholder=""
|
||||||
|
class="item_input"
|
||||||
|
clearable
|
||||||
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
@@ -59,14 +96,22 @@
|
|||||||
|
|
||||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
||||||
<span class="item_text">图片:</span>
|
<span class="item_text">图片:</span>
|
||||||
<upload style="margin-top: 20px;" class="item_input" ref="uploadImg2" v-model="imgList" :limit="1"
|
<upload
|
||||||
@change="backData" bucket="map" :class="{ hide: hideUploadBtn }"
|
ref="uploadImg2"
|
||||||
:upload-data="{ type: '0001' }"></upload>
|
v-model="imgList"
|
||||||
|
style="margin-top: 20px;"
|
||||||
|
class="item_input"
|
||||||
|
:limit="1"
|
||||||
|
bucket="map"
|
||||||
|
:class="{ hide: hideUploadBtn }"
|
||||||
|
:upload-data="{ type: '0001' }"
|
||||||
|
@change="backData"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span class="item_text">商品详情:</span>
|
<span class="item_text">商品详情:</span>
|
||||||
<editor :height="300" :minHeight="100" :value="formobj.appContent" @input="editinput"></editor>
|
<editor :height="300" :min-height="100" :value="formobj.appContent" @input="editinput" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -80,6 +125,7 @@
|
|||||||
import req from '@/api/commodity/commodity.js'
|
import req from '@/api/commodity/commodity.js'
|
||||||
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue'
|
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue'
|
||||||
import Editor from '@/components/Editor'
|
import Editor from '@/components/Editor'
|
||||||
|
import reqMall from '@/api/adminmallapi.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -90,39 +136,54 @@
|
|||||||
return {
|
return {
|
||||||
imgList: [
|
imgList: [
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
submitdisabled: false,
|
submitdisabled: false,
|
||||||
formobj: {
|
formobj: {
|
||||||
sid: "",
|
sid: '',
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
barcode: '',
|
barcode: '',
|
||||||
price: "",
|
price: '',
|
||||||
unitName: "份",
|
unitName: '份',
|
||||||
specificationUnit:"",
|
specificationUnit: '',
|
||||||
weight:"",
|
weight: '',
|
||||||
remarks: "",
|
remarks: '',
|
||||||
content: "",
|
content: '',
|
||||||
picUrl: "",
|
picUrl: '',
|
||||||
appContent: ''
|
brandId: null,
|
||||||
|
brandName: '',
|
||||||
|
categoryId: null,
|
||||||
|
categoryName: ''
|
||||||
},
|
},
|
||||||
hideUploadBtn: false,
|
brandList: [],
|
||||||
|
cateList: [],
|
||||||
|
hideUploadBtn: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initData() {
|
||||||
|
reqMall.listAllBrand().then(resp => {
|
||||||
|
this.brandList = resp.data
|
||||||
|
})
|
||||||
|
reqMall.listAllCategory().then(resp => {
|
||||||
|
this.cateList = resp.data
|
||||||
|
})
|
||||||
|
},
|
||||||
backData(value) {
|
backData(value) {
|
||||||
console.log("backData》》》》", value)
|
console.log('backData》》》》', value)
|
||||||
console.log("imgList", this.imgList)
|
console.log('imgList', this.imgList)
|
||||||
|
|
||||||
if (this.imgList.length > 0) {
|
if (this.imgList.length > 0) {
|
||||||
this.formobj.picUrl = this.imgList[0].url
|
this.formobj.picUrl = this.imgList[0].url
|
||||||
} else {
|
} else {
|
||||||
this.formobj.picUrl = ""
|
this.formobj.picUrl = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hideUploadBtn = this.imgList.length != 0;
|
this.hideUploadBtn = this.imgList.length != 0
|
||||||
console.log("this.hideUploadBtn", this.hideUploadBtn)
|
console.log('this.hideUploadBtn', this.hideUploadBtn)
|
||||||
},
|
},
|
||||||
|
|
||||||
saveOrUpdate() {
|
saveOrUpdate() {
|
||||||
@@ -146,22 +207,21 @@
|
|||||||
if (isreload === 'true') this.$emit('reloadlist')
|
if (isreload === 'true') this.$emit('reloadlist')
|
||||||
this.imgList = []
|
this.imgList = []
|
||||||
this.formobj = {
|
this.formobj = {
|
||||||
sid: "",
|
sid: '',
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
barcode: '',
|
barcode: '',
|
||||||
price: "",
|
price: '',
|
||||||
unitName: "份",
|
unitName: '份',
|
||||||
specificationUnit:"",
|
specificationUnit: '',
|
||||||
weight:"",
|
weight: '',
|
||||||
remarks: "",
|
remarks: '',
|
||||||
content: "",
|
content: '',
|
||||||
picUrl: "",
|
picUrl: '',
|
||||||
appContent: ''
|
appContent: ''
|
||||||
}
|
}
|
||||||
this.$emit('doback')
|
this.$emit('doback')
|
||||||
},
|
},
|
||||||
|
|
||||||
showAdd() {
|
showAdd() {
|
||||||
console.log(this.imgList, 88888888)
|
console.log(this.imgList, 88888888)
|
||||||
},
|
},
|
||||||
@@ -171,29 +231,47 @@
|
|||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
this.formobj = resp.data
|
this.formobj = resp.data
|
||||||
this.imgList = []
|
this.imgList = []
|
||||||
if (resp.data.picUrl != '')
|
if (resp.data.picUrl != '') {
|
||||||
this.imgList.push({
|
this.imgList.push({
|
||||||
url: resp.data.picUrl
|
url: resp.data.picUrl
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.hideUploadBtn = this.imgList.length != 0;
|
this.hideUploadBtn = this.imgList.length != 0
|
||||||
console.log("this.hideUploadBtn", this.hideUploadBtn)
|
console.log('this.hideUploadBtn', this.hideUploadBtn)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.formobj = row
|
this.formobj = row
|
||||||
this.imgList = []
|
this.imgList = []
|
||||||
if (resp.data.picUrl != '')
|
// if (resp.data.picUrl != '') {
|
||||||
this.imgList.push({
|
// this.imgList.push({
|
||||||
url: formobj.picUrl
|
// url: formobj.picUrl
|
||||||
})
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
this.hideUploadBtn = this.imgList.length != 0;
|
// this.hideUploadBtn = this.imgList.length != 0
|
||||||
console.log("this.hideUploadBtn", this.hideUploadBtn)
|
console.log('this.hideUploadBtn', this.hideUploadBtn)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
editinput(text) {
|
editinput(text) {
|
||||||
this.formobj.appContent = text
|
this.formobj.appContent = text
|
||||||
|
},
|
||||||
|
selectBrandChange(val) {
|
||||||
|
for (var i = 0; i < this.brandList.length; i++) {
|
||||||
|
if (val === this.brandList[i].id) {
|
||||||
|
this.formobj.brandName = this.brandList[i].name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectCateChange(val) {
|
||||||
|
for (var i = 0; i < this.cateList.length; i++) {
|
||||||
|
if (val === this.cateList[i].id) {
|
||||||
|
this.formobj.categoryName = this.cateList[i].name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@
|
|||||||
<el-radio :label="0">否</el-radio>
|
<el-radio :label="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="起始销售数量:">
|
||||||
|
<el-input v-model="brand.qssl" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="订购协议:">
|
||||||
|
<el-input v-model="brand.dgxy" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
|
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
|
||||||
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
|
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
|
||||||
@@ -55,7 +61,9 @@
|
|||||||
logo: '',
|
logo: '',
|
||||||
name: '',
|
name: '',
|
||||||
showStatus: 0,
|
showStatus: 0,
|
||||||
sort: 0
|
sort: 0,
|
||||||
|
qssl: 0,
|
||||||
|
dgxy: ''
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'BrandDetail',
|
name: 'BrandDetail',
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin-top: 50px">
|
<div style="margin-top: 50px">
|
||||||
<el-form :model="value" :rules="rules" ref="productInfoForm" label-width="120px" style="width: 600px" size="small">
|
<el-form ref="productInfoForm" :model="value" :rules="rules" label-width="120px" style="width: 600px" size="small">
|
||||||
<el-form-item label="商品分类:" prop="productCategoryId">
|
<el-form-item label="商品分类:" prop="productCategoryId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
change-on-select
|
|
||||||
v-model="selectProductCateValue"
|
v-model="selectProductCateValue"
|
||||||
:options="productCateOptions">
|
change-on-select
|
||||||
</el-cascader>
|
:options="productCateOptions"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品名称:" prop="name">
|
<el-form-item label="商品名称:" prop="name">
|
||||||
<el-input v-model="value.name"></el-input>
|
<el-input v-model="value.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="副标题:" prop="subTitle">
|
<el-form-item label="副标题:" prop="subTitle">
|
||||||
<el-input v-model="value.subTitle"></el-input>
|
<el-input v-model="value.subTitle" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品品牌:" prop="brandId">
|
<el-form-item label="商品品牌:" prop="brandId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="value.brandId"
|
v-model="value.brandId"
|
||||||
|
placeholder="请选择品牌"
|
||||||
@change="handleBrandChange"
|
@change="handleBrandChange"
|
||||||
placeholder="请选择品牌">
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in brandOptions"
|
v-for="item in brandOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"
|
||||||
</el-option>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="店内分类:" prop="storeClassId">
|
<!-- <el-form-item label="店内分类:" prop="storeClassId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="value.storeClassId"
|
v-model="value.storeClassId"
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
v-model="selectAreaValue"
|
v-model="selectAreaValue"
|
||||||
:options="areaOptions">
|
:options="areaOptions">
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</el-form-item> -->
|
</el-form-item>
|
||||||
<el-form-item label="标签" prop="tags">
|
<el-form-item label="标签" prop="tags">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="value.tagList"
|
v-model="value.tagList"
|
||||||
@@ -64,45 +65,47 @@
|
|||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="商品介绍:">
|
<el-form-item label="商品介绍:">
|
||||||
<el-input
|
<el-input
|
||||||
:autoSize="true"
|
|
||||||
v-model="value.description"
|
v-model="value.description"
|
||||||
|
:auto-size="true"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="请输入内容"></el-input>
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品货号:">
|
<el-form-item label="商品货号:">
|
||||||
<el-input v-model="value.productSn"></el-input>
|
<el-input v-model="value.productSn" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品售价:">
|
<el-form-item label="商品售价:">
|
||||||
<el-input v-model="value.price"></el-input>
|
<el-input v-model="value.price" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="惠农价:">
|
<el-form-item label="惠农价:">
|
||||||
<el-input v-model="value.originalPrice"></el-input>
|
<el-input v-model="value.originalPrice" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品库存:">
|
<el-form-item label="商品库存:">
|
||||||
<el-input v-model="value.stock"></el-input>
|
<el-input v-model="value.stock" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计量单位:">
|
<el-form-item label="计量单位:">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="value.unit"
|
v-model="value.unit"
|
||||||
|
|
||||||
placeholder="请选择计量单位">
|
placeholder="请选择计量单位"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in unitOptions"
|
v-for="item in unitOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.id"
|
:label="item.id"
|
||||||
:value="item.id">
|
:value="item.id"
|
||||||
</el-option>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品重量:">
|
<el-form-item label="商品重量:">
|
||||||
<el-input v-model="value.weight" style="width: 300px"></el-input>
|
<el-input v-model="value.weight" style="width: 300px" />
|
||||||
<span style="margin-left: 20px">千克</span>
|
<span style="margin-left: 20px">千克</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="固定运费:">
|
<!-- <el-form-item label="固定运费:">
|
||||||
<el-input v-model="value.transfee" style="width: 300px"></el-input>
|
<el-input v-model="value.transfee" style="width: 300px"></el-input>
|
||||||
<span style="margin-left: 20px">优先于运费模版</span>
|
<span style="margin-left: 20px">优先于运费模版</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -120,7 +123,7 @@
|
|||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
|
|
||||||
<el-form-item label="排序">
|
<el-form-item label="排序">
|
||||||
<el-input v-model="value.sort"></el-input>
|
<el-input v-model="value.sort" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="text-align: center">
|
<el-form-item style="text-align: center">
|
||||||
<el-button type="primary" size="medium" @click="handleNext('productInfoForm')">下一步</el-button>
|
<el-button type="primary" size="medium" @click="handleNext('productInfoForm')">下一步</el-button>
|
||||||
@@ -130,17 +133,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {fetchListWithChildren} from '@/api/productCate'
|
import { fetchListWithChildren } from '@/api/productCate'
|
||||||
import {fetchAreaListWithChildren,getArea} from '@/api/area'
|
import { fetchAreaListWithChildren, getArea } from '@/api/area'
|
||||||
import {fetchList as fetchTagList} from '@/api/ums/umsMemberTag'
|
import { fetchList as fetchTagList } from '@/api/ums/umsMemberTag'
|
||||||
import {fetchList as fetchBrandList} from '@/api/brand'
|
import { fetchList as fetchBrandList } from '@/api/brand'
|
||||||
import {fetchList as fetchStoreClassList} from '@/api/sys/sysStoreClass'
|
import { fetchList as fetchStoreClassList } from '@/api/sys/sysStoreClass'
|
||||||
|
|
||||||
import {fetchList as fetchFeightTemplateList} from '@/api/pms/feightTemplate';
|
import { fetchList as fetchFeightTemplateList } from '@/api/pms/feightTemplate'
|
||||||
import {getProduct} from '@/api/product';
|
import { getProduct } from '@/api/product'
|
||||||
let userRoles = []
|
let userRoles = []
|
||||||
export default {
|
export default {
|
||||||
name: "ProductInfoDetail",
|
name: 'ProductInfoDetail',
|
||||||
props: {
|
props: {
|
||||||
value: Object,
|
value: Object,
|
||||||
isEdit: {
|
isEdit: {
|
||||||
@@ -150,119 +153,116 @@ let userRoles = []
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
hasEditCreated:false,
|
hasEditCreated: false,
|
||||||
//选中商品分类的值
|
// 选中商品分类的值
|
||||||
selectProductCateValue: [],
|
selectProductCateValue: [],
|
||||||
productCateOptions: [],
|
productCateOptions: [],
|
||||||
//选中商品分类的值
|
// 选中商品分类的值
|
||||||
selectAreaValue: [],
|
selectAreaValue: [],
|
||||||
areaOptions: [],
|
areaOptions: [],
|
||||||
brandOptions: [],
|
brandOptions: [],
|
||||||
storeClassOptions:[],
|
storeClassOptions: [],
|
||||||
area:null,
|
area: null,
|
||||||
TagList:[],
|
TagList: [],
|
||||||
areaList:[],
|
areaList: [],
|
||||||
feightTemplateOptions:[],
|
feightTemplateOptions: [],
|
||||||
unitOptions:[{
|
unitOptions: [{
|
||||||
id: "个",
|
id: '个',
|
||||||
name: "个",
|
name: '个'
|
||||||
},{
|
}, {
|
||||||
id: "袋",
|
id: '袋',
|
||||||
name: "袋",
|
name: '袋'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "箱",
|
id: '箱',
|
||||||
name: "箱",
|
name: '箱'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "条",
|
id: '条',
|
||||||
name: "条",
|
name: '条'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "盒",
|
id: '盒',
|
||||||
name: "盒",
|
name: '盒'
|
||||||
},{
|
}, {
|
||||||
id: "包",
|
id: '包',
|
||||||
name: "包",
|
name: '包'
|
||||||
},{
|
}, {
|
||||||
id: "斤",
|
id: '斤',
|
||||||
name: "斤",
|
name: '斤'
|
||||||
},{
|
}, {
|
||||||
id: "两",
|
id: '两',
|
||||||
name: "两",
|
name: '两'
|
||||||
},{
|
}, {
|
||||||
id: "件",
|
id: '件',
|
||||||
name: "件",
|
name: '件'
|
||||||
},{
|
}, {
|
||||||
id: "瓶",
|
id: '瓶',
|
||||||
name: "瓶",
|
name: '瓶'
|
||||||
},{
|
}, {
|
||||||
id: "千克",
|
id: '千克',
|
||||||
name: "千克",
|
name: '千克'
|
||||||
}],
|
}],
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: '请输入商品名称', trigger: 'blur'},
|
{ required: true, message: '请输入商品名称', trigger: 'blur' },
|
||||||
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
{ min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
subTitle: [{required: true, message: '请输入商品副标题', trigger: 'blur'}],
|
subTitle: [{ required: true, message: '请输入商品副标题', trigger: 'blur' }],
|
||||||
productCategoryId: [{required: true, message: '请选择商品分类', trigger: 'blur'}],
|
productCategoryId: [{ required: true, message: '请选择商品分类', trigger: 'blur' }],
|
||||||
|
|
||||||
brandId: [{required: true, message: '请选择商品品牌', trigger: 'blur'}],
|
brandId: [{ required: true, message: '请选择商品品牌', trigger: 'blur' }],
|
||||||
description: [{required: true, message: '请输入商品介绍', trigger: 'blur'}],
|
description: [{ required: true, message: '请输入商品介绍', trigger: 'blur' }],
|
||||||
requiredProp: [{required: true, message: '该项为必填项', trigger: 'blur'}]
|
requiredProp: [{ required: true, message: '该项为必填项', trigger: 'blur' }]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
},
|
},
|
||||||
created() {
|
computed: {
|
||||||
this.getProductCateList();
|
// 商品的编号
|
||||||
this.getAreaList();
|
productId() {
|
||||||
this.getBrandList();
|
return this.value.id
|
||||||
this.getTagList();
|
|
||||||
this.getFeightTemplateList();
|
|
||||||
this.getStoreClassList();
|
|
||||||
|
|
||||||
},
|
|
||||||
computed:{
|
|
||||||
//商品的编号
|
|
||||||
productId(){
|
|
||||||
return this.value.id;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
productId:function(newValue){
|
productId: function(newValue) {
|
||||||
if(!this.isEdit)return;
|
if (!this.isEdit) return
|
||||||
if(this.hasEditCreated)return;
|
if (this.hasEditCreated) return
|
||||||
console.log(newValue)
|
console.log(newValue)
|
||||||
if(newValue===undefined||newValue==null||newValue===0)return;
|
if (newValue === undefined || newValue == null || newValue === 0) return
|
||||||
this.handleEditCreated();
|
this.handleEditCreated()
|
||||||
},
|
},
|
||||||
selectProductCateValue: function (newValue) {
|
selectProductCateValue: function(newValue) {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
this.value.productCategoryId = newValue[newValue.length-1 >0?newValue.length-1:0];
|
this.value.productCategoryId = newValue[newValue.length - 1 > 0 ? newValue.length - 1 : 0]
|
||||||
this.value.productCategoryName= this.getCateNameById(this.value.productCategoryId);
|
this.value.productCategoryName = this.getCateNameById(this.value.productCategoryId)
|
||||||
} else {
|
} else {
|
||||||
this.value.productCategoryId = null;
|
this.value.productCategoryId = null
|
||||||
this.value.productCategoryName=null;
|
this.value.productCategoryName = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectAreaValue: function (newValue) {
|
selectAreaValue: function(newValue) {
|
||||||
|
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
console.log(newValue)
|
console.log(newValue)
|
||||||
this.value.areaId = newValue[newValue.length-1 >0?newValue.length-1:0];
|
this.value.areaId = newValue[newValue.length - 1 > 0 ? newValue.length - 1 : 0]
|
||||||
getArea(this.value.areaId).then(response => {
|
getArea(this.value.areaId).then(response => {
|
||||||
this.value.areaName = response.data.name;
|
this.value.areaName = response.data.name
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
this.value.areaId = null;
|
this.value.areaId = null
|
||||||
this.value.areaName=null;
|
this.value.areaName = null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getProductCateList()
|
||||||
|
// this.getAreaList()
|
||||||
|
this.getBrandList()
|
||||||
|
// this.getTagList()
|
||||||
|
// this.getFeightTemplateList()
|
||||||
|
// this.getStoreClassList()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeRole(value) {
|
changeRole(value) {
|
||||||
userRoles = []
|
userRoles = []
|
||||||
@@ -286,25 +286,23 @@ let userRoles = []
|
|||||||
})
|
})
|
||||||
this.value.tagList = initRoles
|
this.value.tagList = initRoles
|
||||||
},
|
},
|
||||||
//处理编辑逻辑
|
// 处理编辑逻辑
|
||||||
handleEditCreated(){
|
handleEditCreated() {
|
||||||
|
|
||||||
console.log(this.value)
|
console.log(this.value)
|
||||||
|
|
||||||
if(this.value.productCategoryId!=null){
|
if (this.value.productCategoryId != null) {
|
||||||
let seleval = []
|
const seleval = []
|
||||||
seleval.push(this.value.cateParentId);
|
seleval.push(this.value.cateParentId)
|
||||||
seleval.push(this.value.productCategoryId);
|
seleval.push(this.value.productCategoryId)
|
||||||
this.selectProductCateValue = seleval
|
this.selectProductCateValue = seleval
|
||||||
// this.selectProductCateValue.push(this.value.cateParentId);
|
// this.selectProductCateValue.push(this.value.cateParentId);
|
||||||
// this.selectProductCateValue.push(this.value.productCategoryId);
|
// this.selectProductCateValue.push(this.value.productCategoryId);
|
||||||
}
|
}
|
||||||
if(this.value.areaId!=null){
|
if (this.value.areaId != null) {
|
||||||
getArea(this.value.areaId).then(response => {
|
getArea(this.value.areaId).then(response => {
|
||||||
this.selectAreaValue.push(response.data.pid);
|
this.selectAreaValue.push(response.data.pid)
|
||||||
this.selectAreaValue.push(this.value.areaId);
|
this.selectAreaValue.push(this.value.areaId)
|
||||||
});
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(this.selectAreaValue)
|
console.log(this.selectAreaValue)
|
||||||
userRoles = []
|
userRoles = []
|
||||||
@@ -317,114 +315,111 @@ let userRoles = []
|
|||||||
})
|
})
|
||||||
console.log(this.value.tagList)
|
console.log(this.value.tagList)
|
||||||
this.value.tagList = roles
|
this.value.tagList = roles
|
||||||
this.hasEditCreated=true;
|
this.hasEditCreated = true
|
||||||
},
|
},
|
||||||
|
|
||||||
getAreaList() {
|
getAreaList() {
|
||||||
|
|
||||||
fetchAreaListWithChildren().then(response => {
|
fetchAreaListWithChildren().then(response => {
|
||||||
let list = response.data;
|
const list = response.data
|
||||||
this.areaList=list;
|
this.areaList = list
|
||||||
this.areaOptions = [];
|
this.areaOptions = []
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
let children = [];
|
const children = []
|
||||||
if (list[i].children != null && list[i].children.length > 0) {
|
if (list[i].children != null && list[i].children.length > 0) {
|
||||||
for (let j = 0; j < list[i].children.length; j++) {
|
for (let j = 0; j < list[i].children.length; j++) {
|
||||||
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
|
children.push({ label: list[i].children[j].name, value: list[i].children[j].id })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.areaOptions.push({label: list[i].name, value: list[i].id, children: children});
|
this.areaOptions.push({ label: list[i].name, value: list[i].id, children: children })
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getCateNameById(id){
|
getCateNameById(id) {
|
||||||
let name=null;
|
let name = null
|
||||||
for(let i=0;i<this.productCateOptions.length;i++){
|
for (let i = 0; i < this.productCateOptions.length; i++) {
|
||||||
for(let j=0;j<this.productCateOptions[i].children.length;j++){
|
for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
|
||||||
if( this.productCateOptions[i].children[j].value && this.productCateOptions[i].children[j].value!=undefined && this.productCateOptions[i].children[j].value===id){
|
if (this.productCateOptions[i].children[j].value && this.productCateOptions[i].children[j].value != undefined && this.productCateOptions[i].children[j].value === id) {
|
||||||
name=this.productCateOptions[i].children[j].label;
|
name = this.productCateOptions[i].children[j].label
|
||||||
return name;
|
return name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name
|
||||||
},
|
},
|
||||||
getProductCateList() {
|
getProductCateList() {
|
||||||
fetchListWithChildren().then(response => {
|
fetchListWithChildren().then(response => {
|
||||||
let list = response.data;
|
const list = response.data
|
||||||
this.productCateOptions = [];
|
this.productCateOptions = []
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
let children = [];
|
const children = []
|
||||||
if (list[i].children != null && list[i].children.length > 0) {
|
if (list[i].children != null && list[i].children.length > 0) {
|
||||||
for (let j = 0; j < list[i].children.length; j++) {
|
for (let j = 0; j < list[i].children.length; j++) {
|
||||||
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
|
children.push({ label: list[i].children[j].name, value: list[i].children[j].id })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
|
this.productCateOptions.push({ label: list[i].name, value: list[i].id, children: children })
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getFeightTemplateList() {
|
getFeightTemplateList() {
|
||||||
fetchFeightTemplateList({pageNum: 1, pageSize: 100}).then(response => {
|
fetchFeightTemplateList({ pageNum: 1, pageSize: 100 }).then(response => {
|
||||||
this.feightTemplateOptions = [];
|
this.feightTemplateOptions = []
|
||||||
let feightTemplateList = response.data.records;
|
const feightTemplateList = response.data.records
|
||||||
for (let i = 0; i < feightTemplateList.length; i++) {
|
for (let i = 0; i < feightTemplateList.length; i++) {
|
||||||
this.feightTemplateOptions.push({label: feightTemplateList[i].name, value: feightTemplateList[i].id});
|
this.feightTemplateOptions.push({ label: feightTemplateList[i].name, value: feightTemplateList[i].id })
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getBrandList() {
|
getBrandList() {
|
||||||
fetchBrandList({pageNum: 1, pageSize: 100}).then(response => {
|
fetchBrandList({ pageNum: 1, pageSize: 100 }).then(response => {
|
||||||
this.brandOptions = [];
|
this.brandOptions = []
|
||||||
let brandList = response.data.records;
|
const brandList = response.data.records
|
||||||
for (let i = 0; i < brandList.length; i++) {
|
for (let i = 0; i < brandList.length; i++) {
|
||||||
this.brandOptions.push({label: brandList[i].name, value: brandList[i].id});
|
this.brandOptions.push({ label: brandList[i].name, value: brandList[i].id })
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getStoreClassList() {
|
getStoreClassList() {
|
||||||
fetchStoreClassList({pageNum: 1, pageSize: 100}).then(response => {
|
fetchStoreClassList({ pageNum: 1, pageSize: 100 }).then(response => {
|
||||||
this.storeClassOptions = [];
|
this.storeClassOptions = []
|
||||||
let brandList = response.data.records;
|
const brandList = response.data.records
|
||||||
for (let i = 0; i < brandList.length; i++) {
|
for (let i = 0; i < brandList.length; i++) {
|
||||||
this.storeClassOptions.push({label: brandList[i].name, value: brandList[i].id});
|
this.storeClassOptions.push({ label: brandList[i].name, value: brandList[i].id })
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getTagList() {
|
getTagList() {
|
||||||
fetchTagList({pageNum: 1, pageSize: 100,type:2,status:1}).then(response => {
|
fetchTagList({ pageNum: 1, pageSize: 100, type: 2, status: 1 }).then(response => {
|
||||||
this.TagList = response.data.records;
|
this.TagList = response.data.records
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleNext(formName) {
|
||||||
handleNext(formName){
|
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$emit('nextStep');
|
this.$emit('nextStep')
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '验证失败',
|
message: '验证失败',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
duration:1000
|
duration: 1000
|
||||||
});
|
})
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
handleBrandChange(val) {
|
handleBrandChange(val) {
|
||||||
let brandName = '';
|
let brandName = ''
|
||||||
for (let i = 0; i < this.brandOptions.length; i++) {
|
for (let i = 0; i < this.brandOptions.length; i++) {
|
||||||
if (this.brandOptions[i].value === val) {
|
if (this.brandOptions[i].value === val) {
|
||||||
brandName = this.brandOptions[i].label;
|
brandName = this.brandOptions[i].label
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.value.brandName = brandName;
|
this.value.brandName = brandName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin-top: 50px">
|
<div style="margin-top: 50px">
|
||||||
<el-form :model="value" ref="productSaleForm" label-width="120px" style="width: 600px" size="small">
|
<el-form ref="productSaleForm" :model="value" label-width="120px" style="width: 600px" size="small">
|
||||||
<!-- <el-form-item label="赠送积分:">
|
<!-- <el-form-item label="赠送积分:">
|
||||||
<el-input v-model="value.giftPoint"></el-input>
|
<el-input v-model="value.giftPoint"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="赠送成长值:">
|
<el-form-item label="赠送成长值:">
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
<el-switch
|
<el-switch
|
||||||
v-model="value.publishStatus"
|
v-model="value.publishStatus"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0">
|
:inactive-value="0"
|
||||||
</el-switch>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="分销商品:">
|
<!-- <el-form-item label="分销商品:">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="value.isFenxiao"
|
v-model="value.isFenxiao"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
<el-switch
|
<el-switch
|
||||||
v-model="value.newStatus"
|
v-model="value.newStatus"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0">
|
:inactive-value="0"
|
||||||
</el-switch>
|
/>
|
||||||
<span style="margin-left: 10px;margin-right: 10px">推荐</span>
|
<span style="margin-left: 10px;margin-right: 10px">推荐</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="value.recommandStatus"
|
v-model="value.recommandStatus"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0">
|
:inactive-value="0"
|
||||||
</el-switch>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务保证:">
|
<el-form-item label="服务保证:">
|
||||||
<el-checkbox-group v-model="selectServiceList">
|
<el-checkbox-group v-model="selectServiceList">
|
||||||
@@ -60,18 +60,18 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="详细页标题:">
|
<el-form-item label="详细页标题:">
|
||||||
<el-input v-model="value.detailTitle"></el-input>
|
<el-input v-model="value.detailTitle" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="详细页描述:">
|
<el-form-item label="详细页描述:">
|
||||||
<el-input v-model="value.detailDesc"></el-input>
|
<el-input v-model="value.detailDesc" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品关键字:">
|
<el-form-item label="商品关键字:">
|
||||||
<el-input v-model="value.keywords"></el-input>
|
<el-input v-model="value.keywords" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品备注:">
|
<el-form-item label="商品备注:">
|
||||||
<el-input v-model="value.note" type="textarea" :autoSize="true"></el-input>
|
<el-input v-model="value.note" type="textarea" :auto-size="true" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="选择优惠方式:">
|
<!-- <el-form-item label="选择优惠方式:">
|
||||||
<el-radio-group v-model="value.promotionType" size="small">
|
<el-radio-group v-model="value.promotionType" size="small">
|
||||||
<el-radio-button :label="0">无优惠</el-radio-button>
|
<el-radio-button :label="0">无优惠</el-radio-button>
|
||||||
<el-radio-button :label="1">特惠促销</el-radio-button>
|
<el-radio-button :label="1">特惠促销</el-radio-button>
|
||||||
@@ -88,8 +88,8 @@
|
|||||||
|
|
||||||
type="datetime"
|
type="datetime"
|
||||||
:picker-options="pickerOptions1"
|
:picker-options="pickerOptions1"
|
||||||
placeholder="选择开始时间">
|
placeholder="选择开始时间"
|
||||||
</el-date-picker>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="littleMargin">
|
<div class="littleMargin">
|
||||||
结束时间:
|
结束时间:
|
||||||
@@ -98,43 +98,49 @@
|
|||||||
|
|
||||||
type="datetime"
|
type="datetime"
|
||||||
:picker-options="pickerOptions1"
|
:picker-options="pickerOptions1"
|
||||||
placeholder="选择结束时间">
|
placeholder="选择结束时间"
|
||||||
</el-date-picker>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="littleMargin">
|
<div class="littleMargin">
|
||||||
促销价格:
|
促销价格:
|
||||||
<el-input style="width: 220px" v-model="value.promotionPrice" placeholder="输入促销价格"></el-input>
|
<el-input v-model="value.promotionPrice" style="width: 220px" placeholder="输入促销价格" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="value.promotionType===2">
|
<el-form-item v-show="value.promotionType===2">
|
||||||
<div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
|
<div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
|
||||||
{{item.memberLevelName}}:
|
{{ item.memberLevelName }}:
|
||||||
<el-input v-model="item.memberPrice" style="width: 200px"></el-input>
|
<el-input v-model="item.memberPrice" style="width: 200px" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="value.promotionType===3">
|
<el-form-item v-show="value.promotionType===3">
|
||||||
<el-table :data="value.productLadderList"
|
<el-table
|
||||||
style="width: 80%" border>
|
:data="value.productLadderList"
|
||||||
|
style="width: 80%"
|
||||||
|
border
|
||||||
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="数量"
|
label="数量"
|
||||||
align="center"
|
align="center"
|
||||||
width="120">
|
width="120"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.count"></el-input>
|
<el-input v-model="scope.row.count" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="折扣"
|
label="折扣"
|
||||||
align="center"
|
align="center"
|
||||||
width="120">
|
width="120"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.discount"></el-input>
|
<el-input v-model="scope.row.discount" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作">
|
label="操作"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" @click="handleRemoveProductLadder(scope.$index, scope.row)">删除</el-button>
|
<el-button type="text" @click="handleRemoveProductLadder(scope.$index, scope.row)">删除</el-button>
|
||||||
<el-button type="text" @click="handleAddProductLadder(scope.$index, scope.row)">添加</el-button>
|
<el-button type="text" @click="handleAddProductLadder(scope.$index, scope.row)">添加</el-button>
|
||||||
@@ -143,27 +149,33 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-show="value.promotionType===4">
|
<el-form-item v-show="value.promotionType===4">
|
||||||
<el-table :data="value.productFullReductionList"
|
<el-table
|
||||||
style="width: 80%" border>
|
:data="value.productFullReductionList"
|
||||||
|
style="width: 80%"
|
||||||
|
border
|
||||||
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="满"
|
label="满"
|
||||||
align="center"
|
align="center"
|
||||||
width="120">
|
width="120"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.fullPrice"></el-input>
|
<el-input v-model="scope.row.fullPrice" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="立减"
|
label="立减"
|
||||||
align="center"
|
align="center"
|
||||||
width="120">
|
width="120"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.reducePrice"></el-input>
|
<el-input v-model="scope.row.reducePrice" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作">
|
label="操作"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
|
<el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
|
||||||
<el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
|
<el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
|
||||||
@@ -180,10 +192,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {fetchList as fetchMemberLevelList} from '@/api/memberLevel'
|
import { fetchList as fetchMemberLevelList } from '@/api/memberLevel'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProductSaleDetail",
|
name: 'ProductSaleDetail',
|
||||||
props: {
|
props: {
|
||||||
value: Object,
|
value: Object,
|
||||||
isEdit: {
|
isEdit: {
|
||||||
@@ -193,10 +205,38 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//日期选择器配置
|
// 日期选择器配置
|
||||||
pickerOptions1: {
|
pickerOptions1: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
return time.getTime() < Date.now();
|
return time.getTime() < Date.now()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 选中的服务保证
|
||||||
|
selectServiceList: {
|
||||||
|
get() {
|
||||||
|
const list = []
|
||||||
|
if (this.value.serviceIds === undefined || this.value.serviceIds == null || this.value.serviceIds === '') return list
|
||||||
|
const ids = this.value.serviceIds.split(',')
|
||||||
|
for (let i = 0; i < ids.length; i++) {
|
||||||
|
list.push(Number(ids[i]))
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
let serviceIds = ''
|
||||||
|
if (newValue != null && newValue.length > 0) {
|
||||||
|
for (let i = 0; i < newValue.length; i++) {
|
||||||
|
serviceIds += newValue[i] + ','
|
||||||
|
}
|
||||||
|
if (serviceIds.endsWith(',')) {
|
||||||
|
serviceIds = serviceIds.substr(0, serviceIds.length - 1)
|
||||||
|
}
|
||||||
|
this.value.serviceIds = serviceIds
|
||||||
|
} else {
|
||||||
|
this.value.serviceIds = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,67 +245,39 @@
|
|||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
// this.handleEditCreated();
|
// this.handleEditCreated();
|
||||||
} else {
|
} else {
|
||||||
fetchMemberLevelList({defaultStatus: 0}).then(response => {
|
// fetchMemberLevelList({defaultStatus: 0}).then(response => {
|
||||||
let memberPriceList = [];
|
// let memberPriceList = [];
|
||||||
for (let i = 0; i < response.data.records.length; i++) {
|
// for (let i = 0; i < response.data.records.length; i++) {
|
||||||
let item = response.data.records[i];
|
// let item = response.data.records[i];
|
||||||
memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
|
// memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
|
||||||
}
|
// }
|
||||||
this.value.memberPriceList = memberPriceList;
|
// this.value.memberPriceList = memberPriceList;
|
||||||
});
|
// });
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
//选中的服务保证
|
|
||||||
selectServiceList: {
|
|
||||||
get() {
|
|
||||||
let list = [];
|
|
||||||
if (this.value.serviceIds === undefined || this.value.serviceIds == null || this.value.serviceIds === '') return list;
|
|
||||||
let ids = this.value.serviceIds.split(',');
|
|
||||||
for (let i = 0; i < ids.length; i++) {
|
|
||||||
list.push(Number(ids[i]));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
},
|
|
||||||
set(newValue) {
|
|
||||||
let serviceIds = '';
|
|
||||||
if (newValue != null && newValue.length > 0) {
|
|
||||||
for (let i = 0; i < newValue.length; i++) {
|
|
||||||
serviceIds += newValue[i] + ',';
|
|
||||||
}
|
|
||||||
if (serviceIds.endsWith(',')) {
|
|
||||||
serviceIds = serviceIds.substr(0, serviceIds.length - 1)
|
|
||||||
}
|
|
||||||
this.value.serviceIds = serviceIds;
|
|
||||||
} else {
|
|
||||||
this.value.serviceIds = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleEditCreated() {
|
handleEditCreated() {
|
||||||
let ids = this.value.serviceIds.split(',');
|
const ids = this.value.serviceIds.split(',')
|
||||||
console.log('handleEditCreated', ids);
|
console.log('handleEditCreated', ids)
|
||||||
for (let i = 0; i < ids.length; i++) {
|
for (let i = 0; i < ids.length; i++) {
|
||||||
this.selectServiceList.push(Number(ids[i]));
|
this.selectServiceList.push(Number(ids[i]))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleRemoveProductLadder(index, row) {
|
handleRemoveProductLadder(index, row) {
|
||||||
let productLadderList = this.value.productLadderList;
|
const productLadderList = this.value.productLadderList
|
||||||
if (productLadderList.length === 1) {
|
if (productLadderList.length === 1) {
|
||||||
productLadderList.pop();
|
productLadderList.pop()
|
||||||
productLadderList.push({
|
productLadderList.push({
|
||||||
count: 0,
|
count: 0,
|
||||||
discount: 0,
|
discount: 0,
|
||||||
price: 0
|
price: 0
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
productLadderList.splice(index, 1);
|
productLadderList.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleAddProductLadder(index, row) {
|
handleAddProductLadder(index, row) {
|
||||||
let productLadderList = this.value.productLadderList;
|
const productLadderList = this.value.productLadderList
|
||||||
if (productLadderList.length < 3) {
|
if (productLadderList.length < 3) {
|
||||||
productLadderList.push({
|
productLadderList.push({
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -276,33 +288,33 @@
|
|||||||
this.$message({
|
this.$message({
|
||||||
message: '最多只能添加三条',
|
message: '最多只能添加三条',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleRemoveFullReduction(index, row) {
|
handleRemoveFullReduction(index, row) {
|
||||||
let fullReductionList = this.value.productFullReductionList;
|
const fullReductionList = this.value.productFullReductionList
|
||||||
if (fullReductionList.length === 1) {
|
if (fullReductionList.length === 1) {
|
||||||
fullReductionList.pop();
|
fullReductionList.pop()
|
||||||
fullReductionList.push({
|
fullReductionList.push({
|
||||||
fullPrice: 0,
|
fullPrice: 0,
|
||||||
reducePrice: 0
|
reducePrice: 0
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
fullReductionList.splice(index, 1);
|
fullReductionList.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleAddFullReduction(index, row) {
|
handleAddFullReduction(index, row) {
|
||||||
let fullReductionList = this.value.productFullReductionList;
|
const fullReductionList = this.value.productFullReductionList
|
||||||
if (fullReductionList.length < 3) {
|
if (fullReductionList.length < 3) {
|
||||||
fullReductionList.push({
|
fullReductionList.push({
|
||||||
fullPrice: 0,
|
fullPrice: 0,
|
||||||
reducePrice: 0
|
reducePrice: 0
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '最多只能添加三条',
|
message: '最多只能添加三条',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handlePrev() {
|
handlePrev() {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div class="main-content">
|
|
||||||
<button-bar ref="btnbar" view-title="商品列表" :btndisabled="btndisabled" @btnhandle="btnHandle" />
|
<button-bar ref="btnbar" view-title="商品列表" :btndisabled="btndisabled" @btnhandle="btnHandle" />
|
||||||
|
|
||||||
<!-- <el-card class="filter-container" shadow="never">
|
<!-- <el-card class="filter-container" shadow="never">
|
||||||
@@ -381,7 +380,6 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ButtonBar from '@/components/ButtonBar'
|
import ButtonBar from '@/components/ButtonBar'
|
||||||
|
|||||||
Reference in New Issue
Block a user