Browse Source

品牌、类别

master
liupopo 1 year ago
parent
commit
be1e6fb220
  1. 18
      src/api/adminmallapi.js
  2. 57
      src/layout/components/Sidebar/index.vue
  3. 168
      src/views/commodity/commodityAdd.vue
  4. 10
      src/views/pms/brand/components/BrandDetail.vue
  5. 243
      src/views/pms/product/components/ProductInfoDetail.vue
  6. 154
      src/views/pms/product/components/ProductSaleDetail.vue
  7. 2
      src/views/pms/product/index.vue

18
src/api/adminmallapi.js

@ -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'
})
}
}

57
src/layout/components/Sidebar/index.vue

@ -62,25 +62,27 @@
},
name: '/pms',
path: '/pms',
children: [{
alwaysShow: true,
component: 'product',
meta: {
icon: 'el-icon-help',
title: '商品列表'
},
name: '/pms/product',
path: '/pms/product'
},
children: [
// {
// alwaysShow: true,
// component: 'product',
// meta: {
// icon: 'el-icon-help',
// title: ''
// },
// 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,
component: 'brand',
meta: {
@ -98,16 +100,17 @@
},
name: '/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'
// }
]
},
{

168
src/views/commodity/commodityAdd.vue

@ -16,24 +16,61 @@
<div class="listconadd">
<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">
<span class="item_text">名称</span>
<el-input v-model="formobj.name" placeholder="" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">编码</span>
<el-input v-model="formobj.code" placeholder="" class="item_input" clearable
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" />
<el-input
v-model="formobj.code"
placeholder=""
class="item_input"
clearable
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')"
/>
</div>
<div class="item">
<span class="item_text">条码</span>
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable
oninput="value=value.replace(/[^0-9]/g,'')" />
<el-input
v-model="formobj.barcode"
placeholder=""
class="item_input"
clearable
oninput="value=value.replace(/[^0-9]/g,'')"
/>
</div>
<div class="item">
<span class="item_text">价格 (/)</span>
<el-input 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, '')" />
<el-input
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 class="item">
@ -59,14 +96,22 @@
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
<span class="item_text">图片</span>
<upload style="margin-top: 20px;" class="item_input" ref="uploadImg2" v-model="imgList" :limit="1"
@change="backData" bucket="map" :class="{ hide: hideUploadBtn }"
:upload-data="{ type: '0001' }"></upload>
<upload
ref="uploadImg2"
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>
<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>
</el-card>
@ -80,6 +125,7 @@
import req from '@/api/commodity/commodity.js'
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue'
import Editor from '@/components/Editor'
import reqMall from '@/api/adminmallapi.js'
export default {
components: {
@ -90,39 +136,54 @@
return {
imgList: [
],
submitdisabled: false,
formobj: {
sid: "",
sid: '',
name: '',
code: '',
barcode: '',
price: "",
unitName: "份",
specificationUnit:"",
weight:"",
remarks: "",
content: "",
picUrl: "",
appContent: ''
price: '',
unitName: '份',
specificationUnit: '',
weight: '',
remarks: '',
content: '',
picUrl: '',
brandId: null,
brandName: '',
categoryId: null,
categoryName: ''
},
hideUploadBtn: false,
brandList: [],
cateList: [],
hideUploadBtn: false
}
},
created() {
this.initData()
},
methods: {
initData() {
reqMall.listAllBrand().then(resp => {
this.brandList = resp.data
})
reqMall.listAllCategory().then(resp => {
this.cateList = resp.data
})
},
backData(value) {
console.log("backData》》》》", value)
console.log("imgList", this.imgList)
console.log('backData》》》》', value)
console.log('imgList', this.imgList)
if (this.imgList.length > 0) {
this.formobj.picUrl = this.imgList[0].url
} else {
this.formobj.picUrl = ""
this.formobj.picUrl = ''
}
this.hideUploadBtn = this.imgList.length != 0;
console.log("this.hideUploadBtn", this.hideUploadBtn)
this.hideUploadBtn = this.imgList.length != 0
console.log('this.hideUploadBtn', this.hideUploadBtn)
},
saveOrUpdate() {
@ -146,22 +207,21 @@
if (isreload === 'true') this.$emit('reloadlist')
this.imgList = []
this.formobj = {
sid: "",
sid: '',
name: '',
code: '',
barcode: '',
price: "",
unitName: "份",
specificationUnit:"",
weight:"",
remarks: "",
content: "",
picUrl: "",
price: '',
unitName: '份',
specificationUnit: '',
weight: '',
remarks: '',
content: '',
picUrl: '',
appContent: ''
}
this.$emit('doback')
},
showAdd() {
console.log(this.imgList, 88888888)
},
@ -171,29 +231,47 @@
if (resp.success) {
this.formobj = resp.data
this.imgList = []
if (resp.data.picUrl != '')
if (resp.data.picUrl != '') {
this.imgList.push({
url: resp.data.picUrl
})
}
this.hideUploadBtn = this.imgList.length != 0;
console.log("this.hideUploadBtn", this.hideUploadBtn)
this.hideUploadBtn = this.imgList.length != 0
console.log('this.hideUploadBtn', this.hideUploadBtn)
}
})
.catch(e => {
this.formobj = row
this.imgList = []
if (resp.data.picUrl != '')
this.imgList.push({
url: formobj.picUrl
})
this.hideUploadBtn = this.imgList.length != 0;
console.log("this.hideUploadBtn", this.hideUploadBtn)
// if (resp.data.picUrl != '') {
// this.imgList.push({
// url: formobj.picUrl
// })
// }
// this.hideUploadBtn = this.imgList.length != 0
console.log('this.hideUploadBtn', this.hideUploadBtn)
})
},
editinput(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
}
}
}
}
}

10
src/views/pms/brand/components/BrandDetail.vue

@ -32,6 +32,12 @@
<el-radio :label="0"></el-radio>
</el-radio-group>
</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-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
@ -55,7 +61,9 @@
logo: '',
name: '',
showStatus: 0,
sort: 0
sort: 0,
qssl: 0,
dgxy: ''
}
export default {
name: 'BrandDetail',

243
src/views/pms/product/components/ProductInfoDetail.vue

@ -1,30 +1,31 @@
<template>
<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-cascader
change-on-select
v-model="selectProductCateValue"
:options="productCateOptions">
</el-cascader>
change-on-select
:options="productCateOptions"
/>
</el-form-item>
<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 label="副标题:" prop="subTitle">
<el-input v-model="value.subTitle"></el-input>
<el-input v-model="value.subTitle" />
</el-form-item>
<el-form-item label="商品品牌:" prop="brandId">
<el-select
v-model="value.brandId"
placeholder="请选择品牌"
@change="handleBrandChange"
placeholder="请选择品牌">
>
<el-option
v-for="item in brandOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="店内分类:" prop="storeClassId">
@ -46,7 +47,7 @@
v-model="selectAreaValue"
:options="areaOptions">
</el-cascader>
</el-form-item> -->
</el-form-item>
<el-form-item label="标签" prop="tags">
<el-select
v-model="value.tagList"
@ -64,42 +65,44 @@
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="商品介绍:">
<el-input
:autoSize="true"
v-model="value.description"
:auto-size="true"
type="textarea"
placeholder="请输入内容"></el-input>
placeholder="请输入内容"
/>
</el-form-item>
<el-form-item label="商品货号:">
<el-input v-model="value.productSn"></el-input>
<el-input v-model="value.productSn" />
</el-form-item>
<el-form-item label="商品售价:">
<el-input v-model="value.price"></el-input>
<el-input v-model="value.price" />
</el-form-item>
<el-form-item label="惠农价:">
<el-input v-model="value.originalPrice"></el-input>
<el-input v-model="value.originalPrice" />
</el-form-item>
<el-form-item label="商品库存:">
<el-input v-model="value.stock"></el-input>
<el-input v-model="value.stock" />
</el-form-item>
<el-form-item label="计量单位:">
<el-select
v-model="value.unit"
placeholder="请选择计量单位">
placeholder="请选择计量单位"
>
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.id"
:value="item.id">
</el-option>
:value="item.id"
/>
</el-select>
</el-form-item>
<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>
</el-form-item>
<!-- <el-form-item label="固定运费:">
@ -120,7 +123,7 @@
</el-form-item> -->
<el-form-item label="排序">
<el-input v-model="value.sort"></el-input>
<el-input v-model="value.sort" />
</el-form-item>
<el-form-item style="text-align: center">
<el-button type="primary" size="medium" @click="handleNext('productInfoForm')">下一步</el-button>
@ -136,11 +139,11 @@
import { fetchList as fetchBrandList } from '@/api/brand'
import { fetchList as fetchStoreClassList } from '@/api/sys/sysStoreClass'
import {fetchList as fetchFeightTemplateList} from '@/api/pms/feightTemplate';
import {getProduct} from '@/api/product';
import { fetchList as fetchFeightTemplateList } from '@/api/pms/feightTemplate'
import { getProduct } from '@/api/product'
let userRoles = []
export default {
name: "ProductInfoDetail",
name: 'ProductInfoDetail',
props: {
value: Object,
isEdit: {
@ -164,42 +167,42 @@ let userRoles = []
areaList: [],
feightTemplateOptions: [],
unitOptions: [{
id: "个",
name: "个",
id: '个',
name: '个'
}, {
id: "袋",
name: "袋",
id: '袋',
name: '袋'
},
{
id: "箱",
name: "箱",
id: '箱',
name: '箱'
},
{
id: "条",
name: "条",
id: '条',
name: '条'
},
{
id: "盒",
name: "盒",
id: '盒',
name: '盒'
}, {
id: "包",
name: "包",
id: '包',
name: '包'
}, {
id: "斤",
name: "斤",
id: '斤',
name: '斤'
}, {
id: "两",
name: "两",
id: '两',
name: '两'
}, {
id: "件",
name: "件",
id: '件',
name: '件'
}, {
id: "瓶",
name: "瓶",
id: '瓶',
name: '瓶'
}, {
id: "千克",
name: "千克",
id: '千克',
name: '千克'
}],
rules: {
name: [
@ -213,56 +216,53 @@ let userRoles = []
description: [{ required: true, message: '请输入商品介绍', trigger: 'blur' }],
requiredProp: [{ required: true, message: '该项为必填项', trigger: 'blur' }]
}
};
},
created() {
this.getProductCateList();
this.getAreaList();
this.getBrandList();
this.getTagList();
this.getFeightTemplateList();
this.getStoreClassList();
}
},
computed: {
//
productId() {
return this.value.id;
return this.value.id
}
},
watch: {
productId: function(newValue) {
if(!this.isEdit)return;
if(this.hasEditCreated)return;
if (!this.isEdit) return
if (this.hasEditCreated) return
console.log(newValue)
if(newValue===undefined||newValue==null||newValue===0)return;
this.handleEditCreated();
if (newValue === undefined || newValue == null || newValue === 0) return
this.handleEditCreated()
},
selectProductCateValue: function(newValue) {
if (newValue != null) {
this.value.productCategoryId = newValue[newValue.length-1 >0?newValue.length-1:0];
this.value.productCategoryName= this.getCateNameById(this.value.productCategoryId);
this.value.productCategoryId = newValue[newValue.length - 1 > 0 ? newValue.length - 1 : 0]
this.value.productCategoryName = this.getCateNameById(this.value.productCategoryId)
} else {
this.value.productCategoryId = null;
this.value.productCategoryName=null;
this.value.productCategoryId = null
this.value.productCategoryName = null
}
},
selectAreaValue: function(newValue) {
if (newValue != null) {
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 => {
this.value.areaName = response.data.name;
});
this.value.areaName = response.data.name
})
} else {
this.value.areaId = null;
this.value.areaName=null;
this.value.areaId = null
this.value.areaName = null
}
}
},
created() {
this.getProductCateList()
// this.getAreaList()
this.getBrandList()
// this.getTagList()
// this.getFeightTemplateList()
// this.getStoreClassList()
},
methods: {
changeRole(value) {
userRoles = []
@ -288,23 +288,21 @@ let userRoles = []
},
//
handleEditCreated() {
console.log(this.value)
if (this.value.productCategoryId != null) {
let seleval = []
seleval.push(this.value.cateParentId);
seleval.push(this.value.productCategoryId);
const seleval = []
seleval.push(this.value.cateParentId)
seleval.push(this.value.productCategoryId)
this.selectProductCateValue = seleval
// this.selectProductCateValue.push(this.value.cateParentId);
// this.selectProductCateValue.push(this.value.productCategoryId);
}
if (this.value.areaId != null) {
getArea(this.value.areaId).then(response => {
this.selectAreaValue.push(response.data.pid);
this.selectAreaValue.push(this.value.areaId);
});
this.selectAreaValue.push(response.data.pid)
this.selectAreaValue.push(this.value.areaId)
})
}
console.log(this.selectAreaValue)
userRoles = []
@ -317,114 +315,111 @@ let userRoles = []
})
console.log(this.value.tagList)
this.value.tagList = roles
this.hasEditCreated=true;
this.hasEditCreated = true
},
getAreaList() {
fetchAreaListWithChildren().then(response => {
let list = response.data;
this.areaList=list;
this.areaOptions = [];
const list = response.data
this.areaList = list
this.areaOptions = []
for (let i = 0; i < list.length; i++) {
let children = [];
const children = []
if (list[i].children != null && list[i].children.length > 0) {
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) {
let name=null;
let name = null
for (let i = 0; i < this.productCateOptions.length; i++) {
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) {
name=this.productCateOptions[i].children[j].label;
return name;
name = this.productCateOptions[i].children[j].label
return name
}
}
}
return name;
return name
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
const list = response.data
this.productCateOptions = []
for (let i = 0; i < list.length; i++) {
let children = [];
const children = []
if (list[i].children != null && list[i].children.length > 0) {
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() {
fetchFeightTemplateList({ pageNum: 1, pageSize: 100 }).then(response => {
this.feightTemplateOptions = [];
let feightTemplateList = response.data.records;
this.feightTemplateOptions = []
const feightTemplateList = response.data.records
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() {
fetchBrandList({ pageNum: 1, pageSize: 100 }).then(response => {
this.brandOptions = [];
let brandList = response.data.records;
this.brandOptions = []
const brandList = response.data.records
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() {
fetchStoreClassList({ pageNum: 1, pageSize: 100 }).then(response => {
this.storeClassOptions = [];
let brandList = response.data.records;
this.storeClassOptions = []
const brandList = response.data.records
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() {
fetchTagList({ pageNum: 1, pageSize: 100, type: 2, status: 1 }).then(response => {
this.TagList = response.data.records;
});
this.TagList = response.data.records
})
},
handleNext(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$emit('nextStep');
this.$emit('nextStep')
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
})
return false
}
});
})
},
handleBrandChange(val) {
let brandName = '';
let brandName = ''
for (let i = 0; i < this.brandOptions.length; i++) {
if (this.brandOptions[i].value === val) {
brandName = this.brandOptions[i].label;
break;
brandName = this.brandOptions[i].label
break
}
}
this.value.brandName = brandName;
this.value.brandName = brandName
}
}
}

154
src/views/pms/product/components/ProductSaleDetail.vue

@ -1,6 +1,6 @@
<template>
<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-input v-model="value.giftPoint"></el-input>
</el-form-item>
@ -21,8 +21,8 @@
<el-switch
v-model="value.publishStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
:inactive-value="0"
/>
</el-form-item>
<!-- <el-form-item label="分销商品:">
<el-switch
@ -43,14 +43,14 @@
<el-switch
v-model="value.newStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
:inactive-value="0"
/>
<span style="margin-left: 10px;margin-right: 10px">推荐</span>
<el-switch
v-model="value.recommandStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
:inactive-value="0"
/>
</el-form-item>
<el-form-item label="服务保证:">
<el-checkbox-group v-model="selectServiceList">
@ -60,16 +60,16 @@
</el-checkbox-group>
</el-form-item>
<el-form-item label="详细页标题:">
<el-input v-model="value.detailTitle"></el-input>
<el-input v-model="value.detailTitle" />
</el-form-item>
<el-form-item label="详细页描述:">
<el-input v-model="value.detailDesc"></el-input>
<el-input v-model="value.detailDesc" />
</el-form-item>
<el-form-item label="商品关键字:">
<el-input v-model="value.keywords"></el-input>
<el-input v-model="value.keywords" />
</el-form-item>
<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 label="选择优惠方式:">
<el-radio-group v-model="value.promotionType" size="small">
@ -88,8 +88,8 @@
type="datetime"
:picker-options="pickerOptions1"
placeholder="选择开始时间">
</el-date-picker>
placeholder="选择开始时间"
/>
</div>
<div class="littleMargin">
结束时间
@ -98,43 +98,49 @@
type="datetime"
:picker-options="pickerOptions1"
placeholder="选择结束时间">
</el-date-picker>
placeholder="选择结束时间"
/>
</div>
<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>
</el-form-item>
<el-form-item v-show="value.promotionType===2">
<div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
{{ item.memberLevelName }}
<el-input v-model="item.memberPrice" style="width: 200px"></el-input>
<el-input v-model="item.memberPrice" style="width: 200px" />
</div>
</el-form-item>
<el-form-item v-show="value.promotionType===3">
<el-table :data="value.productLadderList"
style="width: 80%" border>
<el-table
:data="value.productLadderList"
style="width: 80%"
border
>
<el-table-column
label="数量"
align="center"
width="120">
width="120"
>
<template slot-scope="scope">
<el-input v-model="scope.row.count"></el-input>
<el-input v-model="scope.row.count" />
</template>
</el-table-column>
<el-table-column
label="折扣"
align="center"
width="120">
width="120"
>
<template slot-scope="scope">
<el-input v-model="scope.row.discount"></el-input>
<el-input v-model="scope.row.discount" />
</template>
</el-table-column>
<el-table-column
align="center"
label="操作">
label="操作"
>
<template slot-scope="scope">
<el-button type="text" @click="handleRemoveProductLadder(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-form-item>
<el-form-item v-show="value.promotionType===4">
<el-table :data="value.productFullReductionList"
style="width: 80%" border>
<el-table
:data="value.productFullReductionList"
style="width: 80%"
border
>
<el-table-column
label="满"
align="center"
width="120">
width="120"
>
<template slot-scope="scope">
<el-input v-model="scope.row.fullPrice"></el-input>
<el-input v-model="scope.row.fullPrice" />
</template>
</el-table-column>
<el-table-column
label="立减"
align="center"
width="120">
width="120"
>
<template slot-scope="scope">
<el-input v-model="scope.row.reducePrice"></el-input>
<el-input v-model="scope.row.reducePrice" />
</template>
</el-table-column>
<el-table-column
align="center"
label="操作">
label="操作"
>
<template slot-scope="scope">
<el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
<el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
@ -183,7 +195,7 @@
import { fetchList as fetchMemberLevelList } from '@/api/memberLevel'
export default {
name: "ProductSaleDetail",
name: 'ProductSaleDetail',
props: {
value: Object,
isEdit: {
@ -196,76 +208,76 @@
//
pickerOptions1: {
disabledDate(time) {
return time.getTime() < Date.now();
return time.getTime() < Date.now()
}
}
}
},
created() {
if (this.isEdit) {
// this.handleEditCreated();
} else {
fetchMemberLevelList({defaultStatus: 0}).then(response => {
let memberPriceList = [];
for (let i = 0; i < response.data.records.length; i++) {
let item = response.data.records[i];
memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
}
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(',');
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]));
list.push(Number(ids[i]))
}
return list;
return list
},
set(newValue) {
let serviceIds = '';
let serviceIds = ''
if (newValue != null && newValue.length > 0) {
for (let i = 0; i < newValue.length; i++) {
serviceIds += newValue[i] + ',';
serviceIds += newValue[i] + ','
}
if (serviceIds.endsWith(',')) {
serviceIds = serviceIds.substr(0, serviceIds.length - 1)
}
this.value.serviceIds = serviceIds;
this.value.serviceIds = serviceIds
} else {
this.value.serviceIds = null;
this.value.serviceIds = null
}
}
}
},
created() {
if (this.isEdit) {
// this.handleEditCreated();
} else {
// fetchMemberLevelList({defaultStatus: 0}).then(response => {
// let memberPriceList = [];
// for (let i = 0; i < response.data.records.length; i++) {
// let item = response.data.records[i];
// memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
// }
// this.value.memberPriceList = memberPriceList;
// });
}
},
methods: {
handleEditCreated() {
let ids = this.value.serviceIds.split(',');
console.log('handleEditCreated', ids);
const ids = this.value.serviceIds.split(',')
console.log('handleEditCreated', ids)
for (let i = 0; i < ids.length; i++) {
this.selectServiceList.push(Number(ids[i]));
this.selectServiceList.push(Number(ids[i]))
}
},
handleRemoveProductLadder(index, row) {
let productLadderList = this.value.productLadderList;
const productLadderList = this.value.productLadderList
if (productLadderList.length === 1) {
productLadderList.pop();
productLadderList.pop()
productLadderList.push({
count: 0,
discount: 0,
price: 0
})
} else {
productLadderList.splice(index, 1);
productLadderList.splice(index, 1)
}
},
handleAddProductLadder(index, row) {
let productLadderList = this.value.productLadderList;
const productLadderList = this.value.productLadderList
if (productLadderList.length < 3) {
productLadderList.push({
count: 0,
@ -276,33 +288,33 @@
this.$message({
message: '最多只能添加三条',
type: 'warning'
});
})
}
},
handleRemoveFullReduction(index, row) {
let fullReductionList = this.value.productFullReductionList;
const fullReductionList = this.value.productFullReductionList
if (fullReductionList.length === 1) {
fullReductionList.pop();
fullReductionList.pop()
fullReductionList.push({
fullPrice: 0,
reducePrice: 0
});
})
} else {
fullReductionList.splice(index, 1);
fullReductionList.splice(index, 1)
}
},
handleAddFullReduction(index, row) {
let fullReductionList = this.value.productFullReductionList;
const fullReductionList = this.value.productFullReductionList
if (fullReductionList.length < 3) {
fullReductionList.push({
fullPrice: 0,
reducePrice: 0
});
})
} else {
this.$message({
message: '最多只能添加三条',
type: 'warning'
});
})
}
},
handlePrev() {

2
src/views/pms/product/index.vue

@ -1,6 +1,5 @@
<template>
<div class="app-container">
<div class="main-content">
<button-bar ref="btnbar" view-title="商品列表" :btndisabled="btndisabled" @btnhandle="btnHandle" />
<!-- <el-card class="filter-container" shadow="never">
@ -381,7 +380,6 @@
</el-dialog>
</div>
</div>
</div>
</template>
<script>
import ButtonBar from '@/components/ButtonBar'

Loading…
Cancel
Save