提交 03f9b307 authored 作者: 潘鹏's avatar 潘鹏

attributes

上级 321ae59a
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
<div class="activityEdit"> <div class="activityEdit">
<ul> <ul>
<li v-for="(item,index) in attrDesc" :key="index"> <li v-for="(item,index) in attrDesc" :key="index">
描述(英文)&nbsp;&nbsp;<i-input v-model="item.C" style="width: 77px"></i-input>&nbsp;&nbsp; 描述(英文)&nbsp;&nbsp;<i-input v-model="item.E" style="width: 77px"></i-input>&nbsp;&nbsp;
(中文)&nbsp;&nbsp;<i-input v-model="item.E" style="width: 77px"></i-input> (中文)&nbsp;&nbsp;<i-input v-model="item.C" style="width: 77px"></i-input>
<!-- <i-input v-model="item" style="width: 77px"></i-input>--> <!-- <i-input v-model="item" style="width: 77px"></i-input>-->
<span @click="delCondition(item)">删除</span> <span @click="delCondition(item)">删除</span>
</li> </li>
......
...@@ -638,10 +638,10 @@ ...@@ -638,10 +638,10 @@
<i-input v-model="tbCfStationItem.itemCode" placeholder="商品编号"/> <i-input v-model="tbCfStationItem.itemCode" placeholder="商品编号"/>
</Form-item> </Form-item>
<Form-item label="商品名称" prop="itemName" style="width: 800px"> <Form-item label="商品名称" prop="itemName" style="width: 800px">
<i-input v-model="tbCfStationItem.itemName" placeholder="商品名字"/> <i-input v-model="tbCfStationItem.itemName" placeholder="商品名字" @on-change="verifyInput(1)"/>
</Form-item> </Form-item>
<Form-item label="商品标题" prop="itemBrief" style="width: 800px"> <Form-item label="商品标题" prop="itemBrief" style="width: 800px">
<i-input v-model="tbCfStationItem.itemBrief" placeholder="商品标题"/> <i-input v-model="tbCfStationItem.itemBrief" placeholder="商品标题" @on-change="verifyInput(2)"/>
</Form-item> </Form-item>
<!-- <Form-item label="商品链接" prop="itemUrl"> <!-- <Form-item label="商品链接" prop="itemUrl">
<i-input v-model="tbCfStationItem.itemUrl" placeholder="商品链接"/> <i-input v-model="tbCfStationItem.itemUrl" placeholder="商品链接"/>
...@@ -1029,27 +1029,27 @@ ...@@ -1029,27 +1029,27 @@
<!-- <i-button style="margin-left:10px;" type="primary" @click='save'>保存</i-button>--> <!-- <i-button style="margin-left:10px;" type="primary" @click='save'>保存</i-button>-->
</section> </section>
</Card> </Card>
<Card class="container" style="margin-top:20px;width: 1000px"> <Card class="container" style="margin-top:20px;width: 1535px">
<section class="form-wrapper"> <section class="form-wrapper">
<h4>商品参数</h4> <h4>商品参数</h4>
<transition-group tag="ul" name="slide"> <transition-group tag="ul" name="slide">
<li class="prev-li" v-for="(item,index) in paramster" :key="index" style="margin-bottom: 0;width: 415px;float: left"> <li class="prev-li" v-for="(item,index) in paramsters" :key="index" style="margin-top:40px;width: 700px;float: left">
<div> <div>
<!-- <i-input v-model="item.paramName" size="small" type="text" placeholder="参数名称"/>--> <!-- <i-input v-model="item.paramName" size="small" type="text" placeholder="参数名称"/>-->
<span :style="`width:100px;line-height: 40px;text-align: center;height: 40px;`">{{item.paramName}}</span> <span :style="`width:100px;line-height: 40px;text-align: center;height: 40px;`">{{item.attrName}}</span>
</div> </div>
<!-- <div>--> <div>
<!-- <i-input v-model="item.paramValue" size="small" type="text" placeholder="参数值"/>--> <!-- <i-input v-model="item.paramValue" size="small" type="text" placeholder="参数值"/>-->
<el-select v-model="value1" multiple placeholder="参数值" :style="`width: 300px;`"> <el-select v-model="item.value" multiple filterable placeholder="参数值" :style="`width: 500px;`">
<el-option <el-option
v-for="item in options" v-for="el in item.options"
:key="item.value" :key="el"
:label="item.label" :label="el"
:value="item.value" :value="el"
> >
</el-option> </el-option>
</el-select> </el-select>
<!-- </div>--> </div>
<!-- <i-button class="prev-del paramster-del" type="warning" @click="delParamster(index)">删除--> <!-- <i-button class="prev-del paramster-del" type="warning" @click="delParamster(index)">删除-->
<!-- </i-button>--> <!-- </i-button>-->
</li> </li>
......
...@@ -139,9 +139,14 @@ let vm = new Vue({ ...@@ -139,9 +139,14 @@ let vm = new Vue({
let arr = vm.attributes.attrDesc.split(",") let arr = vm.attributes.attrDesc.split(",")
vm.attrDesc = [] vm.attrDesc = []
arr.forEach(item=>{ arr.forEach(item=>{
console.log(item.indexOf("("))
let obj = {} let obj = {}
obj.C = item.split("(")[0] if(item.indexOf("(")!=-1){
obj.E = item.split("(")[1].split(")")[0] obj.E = item.split("(")[0]
obj.C = item.split("(")[1].split(")")[0]
}else {
obj.E = item
}
vm.attrDesc.push(obj) vm.attrDesc.push(obj)
}) })
console.log(vm.attrDesc) console.log(vm.attrDesc)
...@@ -152,6 +157,9 @@ let vm = new Vue({ ...@@ -152,6 +157,9 @@ let vm = new Vue({
if(item.E&&item.C){ if(item.E&&item.C){
let str = `${item.E}(${item.C})` let str = `${item.E}(${item.C})`
arr.push(str) arr.push(str)
}else if(item.E&&!item.C){
let str = `${item.E}`
arr.push(str)
} }
}) })
// console.log(arr.join()) // console.log(arr.join())
......
...@@ -143,23 +143,24 @@ let vm = new Vue({ ...@@ -143,23 +143,24 @@ let vm = new Vue({
handleProductAttr_Batch: [], handleProductAttr_Batch: [],
//商品参数 //商品参数
options: [{ // options: [{
value: '选项1', // value: '选项1',
label: '黄金糕' // label: '黄金糕'
}, { // }, {
value: '选项2', // value: '选项2',
label: '双皮奶' // label: '双皮奶'
}, { // }, {
value: '选项3', // value: '选项3',
label: '蚵仔煎' // label: '蚵仔煎'
}, { // }, {
value: '选项4', // value: '选项4',
label: '龙须面' // label: '龙须面'
}, { // }, {
value: '选项5', // value: '选项5',
label: '北京烤鸭' // label: '北京烤鸭'
}], // }],
value1: [], // value1: [],
paramsters:[]
}, },
methods: { methods: {
delSku(id, i) { delSku(id, i) {
...@@ -572,6 +573,7 @@ let vm = new Vue({ ...@@ -572,6 +573,7 @@ let vm = new Vue({
this.disabledChangeAttribute = false; this.disabledChangeAttribute = false;
// vm.tbCfStationItem.itemImg = ""; // vm.tbCfStationItem.itemImg = "";
UE.getEditor('itemDesc').setContent(""); UE.getEditor('itemDesc').setContent("");
vm.getAttrName();
}, },
update: function (event) { update: function (event) {
window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void (0); window.sessionStorage.getItem('_copy_product_info') ? this.show_paste_btn = true : void (0);
...@@ -613,7 +615,19 @@ let vm = new Vue({ ...@@ -613,7 +615,19 @@ let vm = new Vue({
paramArr.push(item) paramArr.push(item)
}) })
vm.tbCfStationItem.paramster = this.paramster; // vm.tbCfStationItem.paramster = this.paramster;
// console.log(this.paramster)
// console.log(this.paramsters)
let parArr = []
this.paramsters.forEach(item=>{
if(item.value.length!=0){
let obj = {}
obj.paramName = item.attrName
obj.paramValue = item.value.join();
parArr.push(obj)
}
})
vm.tbCfStationItem.paramster = parArr
let label = null; let label = null;
vm.tbCfStationItem.itemLabel = this.isSelectedArr.map(item => item.id).join(','); vm.tbCfStationItem.itemLabel = this.isSelectedArr.map(item => item.id).join(',');
vm.tbCfStationItem.prevItem = resArr vm.tbCfStationItem.prevItem = resArr
...@@ -629,7 +643,10 @@ let vm = new Vue({ ...@@ -629,7 +643,10 @@ let vm = new Vue({
vm.tbCfStationItem.itemDesc = encodeURI(UE.getEditor('itemDesc').getContent()); // 富文本取值 vm.tbCfStationItem.itemDesc = encodeURI(UE.getEditor('itemDesc').getContent()); // 富文本取值
vm.tbCfStationItem.itemDesc = vm.tbCfStationItem.itemDesc.replace(/&nbsp;/g, " "); vm.tbCfStationItem.itemDesc = vm.tbCfStationItem.itemDesc.replace(/&nbsp;/g, " ");
vm.tbCfStationItem.skuImgs = vm.AttributeImgArr.map(item => item.img_path).join(';'); vm.tbCfStationItem.skuImgs = vm.AttributeImgArr.map(item => item.img_path).join(';');
vm.tbCfStationItem.itemName = vm.tbCfStationItem.itemName.trim();
vm.tbCfStationItem.itemBrief = vm.tbCfStationItem.itemBrief.trim();
let url = vm.tbCfStationItem.itemId == null ? "../tbcfstationitem/save" : "../tbcfstationitem/update"; let url = vm.tbCfStationItem.itemId == null ? "../tbcfstationitem/save" : "../tbcfstationitem/update";
console.log(vm.tbCfStationItem,_this.putaway,vm.prevItem,itemDesc)
Ajax.request({ Ajax.request({
url: url, url: url,
params: JSON.stringify(vm.tbCfStationItem), params: JSON.stringify(vm.tbCfStationItem),
...@@ -795,7 +812,21 @@ let vm = new Vue({ ...@@ -795,7 +812,21 @@ let vm = new Vue({
} }
}); });
console.log("进入页面")
$.get('../attributes/queryAttrInfo?itemId='+itemId,res=>{
console.log(JSON.parse(res).list)
JSON.parse(res).list.forEach(item=>{
console.log(typeof itemCobe)
vm.paramsters.forEach(_item=>{
// console.log(item)
// console.log(_item)
if(item.paramName==_item.attrName){
let itemCobe = item.paramValue
_item.value = itemCobe.split(",")
}
})
})
})
}, },
importExcel: function () { importExcel: function () {
this.modal = '' this.modal = ''
...@@ -1216,7 +1247,44 @@ let vm = new Vue({ ...@@ -1216,7 +1247,44 @@ let vm = new Vue({
//商品参数 //商品参数
getAttrName(){
$.get('../attributes/queryAttrNames', res => {
let Attr = JSON.parse(res).list
Attr.forEach(item=>{
$.get('../attributes/queryAttrDescs?id='+item.id,_res=>{
item.options = JSON.parse(_res).list
item.value = []
console.log(item)
})
})
vm.paramsters = Attr
console.log(Attr)
})
},
//限制输入
verifyInput(e){
document.onkeyup=function(){
// 合并两个空格为一个空格
String.prototype.ResetBlank=function(){
let regEx = /\s{2,}/g;
return this.replace(regEx, '');
};
String.prototype.ResetBlank2=function(){
let regEx = /[^\w_\s]/g;
return this.replace(regEx,'');
};
// var str = e;//获取文本框的值
// [^\w_]
if(e == 1){
vm.tbCfStationItem.itemName = vm.tbCfStationItem.itemName.ResetBlank().ResetBlank2()//trim()去除首尾空格
}else {
vm.tbCfStationItem.itemBrief = vm.tbCfStationItem.itemBrief.ResetBlank().ResetBlank2()
}
//重置文本框
// tbCfStationItem.itemName = str.ResetBlank().trim()//trim()去除首尾空格
}
}
}, },
created() { created() {
this.getTagsData(); this.getTagsData();
...@@ -1229,14 +1297,14 @@ let vm = new Vue({ ...@@ -1229,14 +1297,14 @@ let vm = new Vue({
$.get('../tbcfgoodstype/queryAll', res => { $.get('../tbcfgoodstype/queryAll', res => {
this.Goodstype = res.list; this.Goodstype = res.list;
}) })
$.get('../tbcfexpresstemplate/queryAll', res => { $.get('../tbcfexpresstemplate/queryAll',res => {
console.log('国家', JSON.parse(res)) // console.log('国家', JSON.parse(res))
vm.templateList = JSON.parse(res).list; vm.templateList = JSON.parse(res).list;
}) })
$.get('../tbcfstationitem/queryCreator', res => { $.get('../tbcfstationitem/queryCreator',res => {
let parse = JSON.parse(res); let parse = JSON.parse(res);
this.creatorList = parse.list; this.creatorList = parse.list;
console.log('用户', this.creatorList) // console.log('用户', this.creatorList)
}) })
//获取默认规格 //获取默认规格
$.get('../tbcategorytemplate/queryAll', res => { $.get('../tbcategorytemplate/queryAll', res => {
...@@ -1246,7 +1314,7 @@ let vm = new Vue({ ...@@ -1246,7 +1314,7 @@ let vm = new Vue({
this.serverSkuAttr.push(item.categoryDesc) this.serverSkuAttr.push(item.categoryDesc)
}) })
}) })
this.getAttrName();
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论