提交 6a59975a authored 作者: 潘鹏's avatar 潘鹏

4-11

上级 35847f22
...@@ -85,6 +85,11 @@ ...@@ -85,6 +85,11 @@
justify-content: start; justify-content: start;
margin-bottom: 10px; margin-bottom: 10px;
} }
.container .prev-li img{
cursor: pointer;
object-fit: cover;
border-radius: 4px;
}
.ivu-tag { .ivu-tag {
padding: 2px 8px; padding: 2px 8px;
...@@ -330,12 +335,13 @@ ...@@ -330,12 +335,13 @@
justify-content: flex-start; justify-content: flex-start;
} }
.attribute-img{ .attribute-img{
width:200px; width:150px;
height:200px; height:150px;
position: relative; position: relative;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
} }
.attribute-img>.attribute-img-remove-icon{ .attribute-img>.attribute-img-remove-icon{
width:40px; width:40px;
...@@ -371,8 +377,8 @@ ...@@ -371,8 +377,8 @@
box-shadow: 2px 2px 2px #eee; box-shadow: 2px 2px 2px #eee;
} }
.attribute-sku-tag-active{ .attribute-sku-tag-active{
box-shadow: 2px 2px 2px rgba(255,0,0,0.3); box-shadow: 2px 2px 2px #1ab394;
border-color: rgba(255,0,0,0.5); border-color: #1ab394;
} }
.attr-img{ .attr-img{
width:58px; width:58px;
...@@ -710,11 +716,15 @@ ...@@ -710,11 +716,15 @@
<div class="attribute-img-lists"> <div class="attribute-img-lists">
<div class="attribute-img" v-for="(element,index) in AttributeImgArr"> <div class="attribute-img" v-for="(element,index) in AttributeImgArr">
<div class="attribute-img-remove-icon"> <div class="attribute-img-remove-icon">
<Icon size="20" type="ios-eye-outline" ></Icon> <!-- <Icon size="20" type="ios-eye-outline" ></Icon>-->
<i></i>
<Icon size="20" type="ios-trash-outline" @click="removeAttributeImg(element.img_path,index)"></Icon> <Icon size="20" type="ios-trash-outline" @click="removeAttributeImg(element.img_path,index)"></Icon>
</div> </div>
<img :src="element.img_path" @click="selectImg(element.img_path)"> <img :src="element.img_path" @click="selectImg(element.img_path)">
</div> </div>
<div class="attribute-img" @click="cancelSelectImg" >
<img title="取消选择" src="http://ku.90sjimg.com/element_origin_min_pic/01/47/26/835743e2ba5da85.jpg" width="100%" height="100%" />
</div>
</div> </div>
<div class="attribute-img-upload"> <div class="attribute-img-upload">
<Upload <Upload
...@@ -790,11 +800,11 @@ ...@@ -790,11 +800,11 @@
</div> </div>
<div> <div>
<h3 style="margin:20px 0;">属性价格</h3> <h3 style="margin:20px 0;">属性价格</h3>
<i-input type="number" @on-change="changeBatch($event,'amount')" placeholder="属性价格"/> <i-input type="number" ref="amount" @on-change="changeBatch($event,'amount')" placeholder="属性价格"/>
</div> </div>
<div> <div>
<h3 style="margin:20px 0;">属性库存</h3> <h3 style="margin:20px 0;">属性库存</h3>
<i-input type="number" @on-change="changeBatch($event,'count')" placeholder="属性库存"/> <i-input type="number" ref="count" @on-change="changeBatch($event,'count')" placeholder="属性库存"/>
</div> </div>
<div class="confirm-btn"> <div class="confirm-btn">
<i-button type="primary" @click="saveBatchData()">保存</i-button> <i-button type="primary" @click="saveBatchData()">保存</i-button>
...@@ -806,7 +816,7 @@ ...@@ -806,7 +816,7 @@
确定商品规格 确定商品规格
</i-button> </i-button>
<!-- 预览 --> <!-- 预览 -->
<section class="form-prev"> <section class="form-prev">
<h4>预览</h4> <h4>预览</h4>
<transition-group tag="ul" name="slide"> <transition-group tag="ul" name="slide">
...@@ -835,7 +845,7 @@ ...@@ -835,7 +845,7 @@
</li> </li>
</transition-group> </transition-group>
</section> </section>
<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>
...@@ -855,7 +865,7 @@ ...@@ -855,7 +865,7 @@
</Form-item> </Form-item>
<Form-item> <Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button> <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/> <i-button type="warning" @click="back()" style="margin-left: 8px"/>
返回</i-button> 返回</i-button>
<i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button> <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
</Form-item> </Form-item>
......
...@@ -94,6 +94,10 @@ let vm = new Vue({ ...@@ -94,6 +94,10 @@ let vm = new Vue({
batchCount:0 batchCount:0
}, },
methods: { methods: {
cancelSelectImg(){
this.prevItem[this.skuListsIndex].skuImg=null;
this.showAttributeImg = false;
},
changeBatch(e,flag){ changeBatch(e,flag){
if(flag==='amount'){ if(flag==='amount'){
this.batchAmount=e.target.value; this.batchAmount=e.target.value;
...@@ -101,6 +105,7 @@ let vm = new Vue({ ...@@ -101,6 +105,7 @@ let vm = new Vue({
this.batchCount=e.target.value; this.batchCount=e.target.value;
} }
}, },
//批量操作
saveBatchData(){ saveBatchData(){
let activeImgPath = ''; let activeImgPath = '';
this.AttributeImgArr.map( item => { this.AttributeImgArr.map( item => {
...@@ -114,25 +119,28 @@ let vm = new Vue({ ...@@ -114,25 +119,28 @@ let vm = new Vue({
return false; return false;
} }
}) })
// console.log(this.allAttributes); this.prevItem.map( item => item.isSelected =false);
let prevItemIndex = null;
this.prevItem.map( item => { this.prevItem.map( item => {
this.allAttributes.map( _item => { this.allAttributes.map( _item => {
if(item.skuDesc.includes(_item.text)){ if(_item.isSelected&&item.skuDesc.includes(_item.text)){
item.skuImg = _item.skuImg; item.isSelected = true;
item.skuPrice = _item.amount; console.log(item,_item,'00');
item.skuCount = _item.count;
return false;
} }
}) })
}) })
this.prevItem.map( (item,index) => {
console.log(this.prevItem); if(item.isSelected){
item.skuImg = activeImgPath;
item.skuPrice = this.batchAmount;
item.skuCount = this.batchCount;
}
})
this.prevItem.map( item => delete item.isSelected);
this.showBatch = false; this.showBatch = false;
}, },
//批处理图片选择 //批处理图片选择
BatchSelectImg(item,index){ BatchSelectImg(item,index){
this.AttributeImgArr.map( (_item,_index) => _item.isSelected = false); this.AttributeImgArr.map( (_item,_index) => index!==_index?_item.isSelected = false:null);
this.AttributeImgArr[index].isSelected = !this.AttributeImgArr[index].isSelected; this.AttributeImgArr[index].isSelected = !this.AttributeImgArr[index].isSelected;
}, },
//批量处理单选属性 //批量处理单选属性
...@@ -141,6 +149,8 @@ let vm = new Vue({ ...@@ -141,6 +149,8 @@ let vm = new Vue({
}, },
//显示批量处理模态框 //显示批量处理模态框
showBatchModel(){ showBatchModel(){
this.$refs.amount.$el.children[1].value = this.batchAmount = null;
this.$refs.count.$el.children[1].value = this.batchCount = null;
this.showBatch = true; this.showBatch = true;
//获取所有具体属性 //获取所有具体属性
this.allAttributes = []; this.allAttributes = [];
...@@ -181,12 +191,12 @@ let vm = new Vue({ ...@@ -181,12 +191,12 @@ let vm = new Vue({
} }
}, },
//删除属性图片 //删除属性图片
removeAttributeImg(e,i){ removeAttributeImg(e,i,notShowMessage){
this.$delete(this.AttributeImgArr,i); this.$delete(this.AttributeImgArr,i);
this.delAttributeImg(e); this.delAttributeImg(e,notShowMessage);
}, },
//删除图片 //删除图片
delAttributeImg(url){ delAttributeImg(url,notShowMessage){
Ajax.request({ Ajax.request({
url: "../api/upload/delFile?url=" + url, url: "../api/upload/delFile?url=" + url,
async: false, async: false,
...@@ -194,7 +204,7 @@ let vm = new Vue({ ...@@ -194,7 +204,7 @@ let vm = new Vue({
contentType: "application/json", contentType: "application/json",
successCallback: function (resultData) { successCallback: function (resultData) {
// console.log(resultData); // console.log(resultData);
iview.Message.success(resultData.success); !notShowMessage?iview.Message.success(resultData.success):null;
} }
}); });
}, },
...@@ -256,11 +266,13 @@ let vm = new Vue({ ...@@ -256,11 +266,13 @@ let vm = new Vue({
vm.tbCfStationItem = {}; vm.tbCfStationItem = {};
this.uploadList.length = 0; this.uploadList.length = 0;
this.uploadList1.length = 0; this.uploadList1.length = 0;
this.disabledChangeAttribute = false;
// vm.tbCfStationItem.itemImg = ""; // vm.tbCfStationItem.itemImg = "";
UE.getEditor('itemDesc').setContent(""); UE.getEditor('itemDesc').setContent("");
}, },
update: function (event) { update: function (event) {
this.prevItem = [] this.disabledChangeAttribute = true;
this.prevItem = [];
let itemId = getSelectedRow("#jqGrid"); let itemId = getSelectedRow("#jqGrid");
if (itemId == null) { if (itemId == null) {
return; return;
...@@ -283,7 +295,7 @@ let vm = new Vue({ ...@@ -283,7 +295,7 @@ let vm = new Vue({
vm.tbCfStationItem.itemImg = vm.uploadList.map(res => res).join(';'); vm.tbCfStationItem.itemImg = vm.uploadList.map(res => res).join(';');
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(';');
let url = vm.tbCfStationItem.itemId == null ? "../tbcfstationitem/save" : "../tbcfstationitem/update"; let url = vm.tbCfStationItem.itemId == null ? "../tbcfstationitem/save" : "../tbcfstationitem/update";
Ajax.request({ Ajax.request({
url: url, url: url,
...@@ -292,7 +304,7 @@ let vm = new Vue({ ...@@ -292,7 +304,7 @@ let vm = new Vue({
data: { data: {
putaway: _this.putaway, putaway: _this.putaway,
prevItem: vm.prevItem, prevItem: vm.prevItem,
itemDesc: itemDesc itemDesc: itemDesc,
}, },
contentType: "application/json", contentType: "application/json",
successCallback: function (r) { successCallback: function (r) {
...@@ -340,6 +352,7 @@ let vm = new Vue({ ...@@ -340,6 +352,7 @@ let vm = new Vue({
}); });
}, },
getInfo: function (itemId) { getInfo: function (itemId) {
this.AttributeImgArr = [];
// this.isDisabled = true // this.isDisabled = true
let _this = this let _this = this
Ajax.request({ Ajax.request({
...@@ -370,6 +383,12 @@ let vm = new Vue({ ...@@ -370,6 +383,12 @@ let vm = new Vue({
skuCode:item.skuCode skuCode:item.skuCode
}) })
}) })
r.tbCfStationItem.item.skuImgs.split(';').map( item => {
vm.AttributeImgArr.push({
img_path: item,
isSelected:false
})
})
console.log(r) console.log(r)
})() })()
vm.tbCfStationItem = r.tbCfStationItem.item; vm.tbCfStationItem = r.tbCfStationItem.item;
...@@ -416,6 +435,18 @@ let vm = new Vue({ ...@@ -416,6 +435,18 @@ let vm = new Vue({
}); });
}, },
back(){
//清除未保存商品的图片
if(!vm.tbCfStationItem.itemId){
this.AttributeImgArr.map( (item,index) => {
this.delAttributeImg(item.img_path,true);
})
setTimeout(()=>{
this.AttributeImgArr = [];
},0)
}
this.reload();
},
reload: function (event) { reload: function (event) {
this.prevItem = [] this.prevItem = []
this.attrItem = [] this.attrItem = []
...@@ -647,20 +678,6 @@ let vm = new Vue({ ...@@ -647,20 +678,6 @@ let vm = new Vue({
skuCount: this.default_count skuCount: this.default_count
}) })
}) })
// var temp = [];
// let _this = this;
// function deWeightTwo() {
// _this.prevItem.forEach(function(a) {
// var check = temp.every(function(b) {
// return a.skuDesc !== b.skuDesc;
// })
// check ? temp.push(a) : ''
// })
// return temp;
// }
// var newArr2 = deWeightTwo();
// console.log('%c%s', 'color:red;', '方法二:es5,newArr2', newArr2);
//显示回显数据 //显示回显数据
if (this.tmdSkudata) { if (this.tmdSkudata) {
this.prevItem.map(item => { this.prevItem.map(item => {
...@@ -780,5 +797,5 @@ let vm = new Vue({ ...@@ -780,5 +797,5 @@ let vm = new Vue({
this.serverSkuAttr.push(item.categoryDesc) this.serverSkuAttr.push(item.categoryDesc)
}) })
}) })
} },
}); });
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论