|
@@ -230,7 +230,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
logo:[],
|
|
|
video:null,
|
|
|
size:{},
|
|
|
- spec:{},
|
|
|
sku:{},
|
|
|
detail:{},
|
|
|
service:[{name:null,value:null}],
|
|
@@ -247,7 +246,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
describe:[{required:true,message:'此项必须'}],
|
|
|
logo:[{required:true,message:'此项必须'},{type:'array',min:1,message: '请上传'}],
|
|
|
size:[{required:true,message:'此项必须'}],
|
|
|
- spec:[{required:true,message:'此项必须'}],
|
|
|
sku:[{required:true,message:'此项必须'}],
|
|
|
}
|
|
|
}
|
|
@@ -255,6 +253,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
mounted(){
|
|
|
Controller.api.bindevent();
|
|
|
},
|
|
|
+ filters:{
|
|
|
+ showName(key){
|
|
|
+ }
|
|
|
+ },
|
|
|
methods:{
|
|
|
addImg(type, index, multiple) {
|
|
|
let that = this;
|
|
@@ -288,51 +290,65 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
delVideo(){
|
|
|
this.form.video=null
|
|
|
},
|
|
|
- addSize(type){
|
|
|
- this.idx++
|
|
|
- this.$set(this.form[type],this.idx,{
|
|
|
- type,
|
|
|
+ addMain(){
|
|
|
+ let idx=Date.now()
|
|
|
+ this.$set(this.form.size,idx,{
|
|
|
+ type:null,
|
|
|
+ names:{},
|
|
|
+ })
|
|
|
+ },
|
|
|
+ delMain(idx){
|
|
|
+ this.$delete(this.form.size,idx)
|
|
|
+ },
|
|
|
+ addName(spec){
|
|
|
+ let idx=Date.now()
|
|
|
+ this.$set(spec.names,idx,{
|
|
|
name:null
|
|
|
})
|
|
|
- Object.keys(this.form.size).forEach(sizeIdx=>{
|
|
|
- let size=this.form.size[sizeIdx]
|
|
|
- Object.keys(this.form.spec).forEach((spec_idx)=>{
|
|
|
- let spec=this.form.spec[spec_idx],key=`${sizeIdx}_${spec_idx}`
|
|
|
- if(!this.form.sku[key]){
|
|
|
- this.$set(this.form.sku,key,{
|
|
|
- size,
|
|
|
- spec,
|
|
|
+ let size=this.form.size
|
|
|
+ let sizeLen=Object.keys(size).length
|
|
|
+ let k=Object.keys(size)[0]
|
|
|
+ let thisNames=size[k].names
|
|
|
+ Object.keys(thisNames).forEach((_k)=>{
|
|
|
+ let key={},show=false
|
|
|
+ key[_k]={
|
|
|
+ size:size[k],
|
|
|
+ name:thisNames[_k]
|
|
|
+ }
|
|
|
+ Object.keys(size).forEach((kk)=>{
|
|
|
+ if(k===kk){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ show=true
|
|
|
+ let nameKeys=Object.keys(size[kk].names)
|
|
|
+ for (let i=0;i<nameKeys.length;i++){
|
|
|
+ let kkk=nameKeys[i]
|
|
|
+ key[kkk]={
|
|
|
+ size:size[kk],
|
|
|
+ name:size[kk].names[kkk]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(show && Object.keys(key).length>1){
|
|
|
+ let keyStr=Object.keys(key).join(',')
|
|
|
+ if(!this.form.sku[keyStr]){
|
|
|
+ this.$set(this.form.sku,keyStr,{
|
|
|
+ key,
|
|
|
num_stock:null,
|
|
|
num_stock_kill:null,
|
|
|
amount_cost:null,
|
|
|
- amount_ladder:[{min:null,max:null,amount:null}],
|
|
|
- amount_kill_ladder:[{min:null,max:null,amount:null}],
|
|
|
- })
|
|
|
- }
|
|
|
- if(!this.form.detail[key]){
|
|
|
- this.$set(this.form.detail,key,{
|
|
|
- arr:[],
|
|
|
- size,
|
|
|
- spec,
|
|
|
+ amount_ladder:[],
|
|
|
+ amount_kill_ladder:[],
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- delSize(type,idx){
|
|
|
- if(type==='size'){
|
|
|
- Object.keys(this.form.spec).forEach((spec_idx)=>{
|
|
|
- let key=`${idx}_${spec_idx}`
|
|
|
- this.$delete(this.form.sku,key)
|
|
|
- })
|
|
|
- }else{
|
|
|
- Object.keys(this.form.size).forEach((size_idx)=>{
|
|
|
- let key=`${size_idx}_${idx}`
|
|
|
- this.$delete(this.form.sku,key)
|
|
|
- })
|
|
|
- }
|
|
|
- this.$delete(this.form[type],idx)
|
|
|
- this.$delete(this.form.detail,idx)
|
|
|
+ nameChange(idx,name){
|
|
|
+ console.log(this.form.sku,this.sku)
|
|
|
+ },
|
|
|
+ delSize(spec,idx){
|
|
|
+ this.$delete(spec.names,idx)
|
|
|
},
|
|
|
addLadder(ladder){
|
|
|
ladder.push({min:null,max:null,amount:null})
|