define({ template: `
话费充值
开启 关闭
首次发布商品,先点击发布商品,再重新编辑商品,设置话费充值规格!
如果您修改了商品规格,需要手动设置关联!
建议尺寸: 640 * 640 ,或正方型图片
`, style: ` .moreCol .el-table thead{ display:none } .moreCol .el-table--border, .el-table--group{ border: none; } .el-table .cell{ padding-right:0 !important; } .el-table th > .cell { text-align: center; } .el-table .cell { text-align: center; } `, props: { form: { default() { return {}; }, }, formKey: { type: String, }, }, data() { return { showSelectMaterialPopup: false, materialType: "1", formFieldName: "", channel: '', list: [ { spec: '', status:"", desc:"", charge_type:"", specValueList:[ { spec_value:'' }, { spec_value:'' }, { spec_value:'' } ], typeList:[ { type:'', bingbird_goods_id:0 }, { type:'', bingbird_goods_id:0 }, { type:'', bingbird_goods_id:0 } ], statusList: [ {status: 0}, {status: 0}, {status: 0}, ] }, { spec: '', status:"", desc:"", charge_type:"", specValueList:[ { spec_value:'' }, { spec_value:'' }, { spec_value:'' } ], typeList:[ { type:'', bingbird_goods_id:0 }, { type:'', bingbird_goods_id:0 }, { type:'', bingbird_goods_id:0 } ], statusList: [ {status: 0}, {status: 0}, {status: 0}, ] } ], typeList: [{ value: 1, label: '50' }, { value: 2, label: '100' }, { value: 3, label: '200' }], chargeTypeList: [{ value: 0, label: '慢充' }, { value: 1, label: '快充' }], } }, created() { // console.log(this.form,115); // this.form.options = [ // { // "goods_option_id": 79, // "desc": "", // "status": 0, // "charge_type": "1", // "type": "1", // "spec": "蓝色", // "spec_value": "规格1" // }, // { // "goods_option_id": 80, // "desc": "", // "status": 0, // "charge_type": "0", // "type": "2", // "spec": "蓝色", // "spec_value": "规格2" // }, // { // "goods_option_id": 81, // "desc": "", // "status": 0, // "charge_type": "1", // "type": "3", // "spec": "绿色", // "spec_value": "规格1" // }, // { // "goods_option_id": 82, // "desc": "", // "status": 0, // "charge_type": "0", // "type": "1", // "spec": "绿色", // "spec_value": "规格2" // }, // { // "goods_option_id": 110, // "desc": "", // "status": 0, // "charge_type": "1", // "type": "2", // "spec": "蓝色", // "spec_value": "规格3" // }, // { // "goods_option_id": 111, // "desc": "1", // "status": 0, // "charge_type": "0", // "type": "1", // "spec": "绿色", // "spec_value": "规格3" // } // ] this.channel = this.form.channel; if(this.form.options.length == 0){ this.list = [] return } let itemList = [] let chargeTypeList = [] let descList = [] console.log(this.form.options) for(let item of this.form.options){ itemList.push(item.spec) chargeTypeList.push(item.charge_type) descList.push(item.desc) } itemList = Array.from(new Set(itemList)) chargeTypeList = Array.from(new Set(chargeTypeList)) descList = Array.from(new Set(descList)) this.list[0].spec = itemList[0] this.list[1].spec = itemList[1] this.list[0].charge_type = chargeTypeList[0] this.list[1].charge_type = chargeTypeList[1] this.list[0].desc = descList[0] this.list[1].desc = descList[1] this.form.options.slice(0,3).forEach((item,index) => { this.list[0].typeList[index].type = item.type this.list[0].typeList[index].bingbird_goods_id = item.bingbird_goods_id this.list[0].specValueList[index].spec_value = item.spec_value this.list[0].statusList[index].status = item.status; }) this.form.options.slice(3,6).forEach((item,index) => { this.list[1].typeList[index].type = item.type this.list[1].typeList[index].bingbird_goods_id = item.bingbird_goods_id this.list[1].specValueList[index].spec_value = item.spec_value this.list[1].statusList[index].status = item.status; }) console.log(itemList,this.list,'itemList'); }, methods: { validate() { this.form.options.forEach((item,index) => { if(index < 3){ item.desc = this.list[0].desc item.charge_type = this.list[0].charge_type item.spec = this.list[0].spec item.spec_value = this.list[0].specValueList[index].spec_value item.type = this.list[0].typeList[index].type item.bingbird_goods_id = this.list[0].typeList[index].bingbird_goods_id item.status = this.list[0].statusList[index].status; }else{ item.desc = this.list[1].desc item.charge_type = this.list[1].charge_type item.spec = this.list[1].spec item.spec_value = this.list[1].specValueList[index - 3].spec_value item.type = this.list[1].typeList[index - 3].type item.bingbird_goods_id = this.list[1].typeList[index - 3].bingbird_goods_id item.status = this.list[1].statusList[index - 3].status; } }) // this.form.options.forEach(item => { // item.status = this.form.phone_bill_pro_goods.is_open // }) return { status:this.form.phone_bill_pro_goods.is_open, banner:this.form.phone_bill_pro_goods.banner, options:this.form.options } }, displaySelectMaterialPopup(fieldName = "thumb", type = 1) { this.formFieldName = fieldName; this.showSelectMaterialPopup = !this.showSelectMaterialPopup; this.materialType = String(type); }, selectedMaterial(name, image, imageUrl) { this.form.phone_bill_pro_goods.banner = imageUrl[0].url }, btnDelete(){ this.form.phone_bill_pro_goods.banner = "" } }, });