<template>
<div>
<Tips :title="title"></Tips>
<div class="c-form f-single">
<Form ref="editLabel" :model="editLabelForm" :rules="ruleInline">
<FormItem label="标签ID:" prop="labelId">
<Input v-model="editLabelForm.labelId" disabled="disabled" ></Input>
</FormItem>
<FormItem label="标签编码:" prop="labelCode">
<Input v-model="editLabelForm.labelCode" disabled="disabled" ></Input>
</FormItem>
<FormItem label="标签名称:" prop="labelName">
<Input v-model="editLabelForm.labelName"></Input>
</FormItem>
<FormItem label="标签值:" prop="labelValue">
<Input v-model="editLabelForm.labelValue" ></Input>
</FormItem>
<FormItem label="店铺名称:" prop="shopName">
<Input v-model="editLabelForm.shopName" disabled="disabled"></Input>
</FormItem>
<FormItem label="商品名称:" prop="commodityName">
<Input v-model="editLabelForm.commodityName" @on-focus="showCommodityModal" ></Input>
</FormItem>
<FormItem label="单品名称:" prop="skuId">
<Select v-model='editLabelForm.skuId'>
<Option v-for="item in selectList.optionsData" :value="item.skuId" :key="item.skuId">
{{ item.skuName }} <!-- :label="item.skuName"-->
</Option>
</Select>
<!--<Input v-model="editLabelForm.skuName" ></Input>-->
</FormItem>
<FormItem label="备注:" prop="remark">
<Input v-model="editLabelForm.remark" type="textarea" :autosize="{minRows: 3,maxRows: 5}">
</Input>
</FormItem>
<FormItem class="c-btn btnGroup">
<Button type="primary" @click="sumbit()">提交</Button>
<Button type="text" @click="goback()">返回</Button>
</FormItem>
</Form>
</div>
data() {
return {
title: '修改标签',
selection: [],
selectList: {
Url: "busi/sku/query", //单品名称接口
optionsData: [],
},
query: {
supplierShopId:'',
shopName:'',
commodityId:'',
commodityName:'',
// skuId:'',
// skuName:'',
},
commodityModal: false,
editLabelForm:{
labelId:'',
labelCode:'',
labelName:'',
labelValue:'',
shopName:'',
supplierShopId:'',
commodityName:'',
commodityId:'',
skuName:'',
skuId:'',
remark:'',
},
mounted(){
this.editLabel();
},
methods:{
editLabel() {
let store = JSON.parse(sessionStorage.getItem('edit'));
_.assign(this.editLabelForm, store);
console.log(this.editLabelForm);
},
commodityQuery(){ //商品查询
let arg = { pageNo: 1 };
let data = _.assign(this.query,arg );
this.$refs['commodityBasetable'].query(data);
},
choiceCommodity(row){ //选择商品
let param = {
};
this.editLabelForm.commodityName = row.commodityName;
this.editLabelForm.commodityId = row.commodityId;
this.commodityModal = false;
console.log(this.editLabelForm);//
console.log(this.editLabelForm.supplierShopId);//
console.log(this.editLabelForm.commodityId);//没有店铺
this.skuIdQuery(row);
},
skuIdQuery(row) { //选择单品下拉框
let param = {
commodityId: row.commodityId,
};
queryApi(this.selectList.Url, param).then(res => {
this.selectList.optionsData = res.rows;
});
this.editLabelForm.skuName = row.skuName;
this.editLabelForm.skuId = row.skuId;
console.log(this.selectList.Url, param);
},
commoditySelectionChange(data) {
this.selection = data;
},
showCommodityModal() { //显示商品
this.$refs['commodityForm'].resetFields();
this.commodityModal = true;
this.commodityQuery();
},