147 行
4.2 KiB
JavaScript
可执行文件
147 行
4.2 KiB
JavaScript
可执行文件
/**
|
|
* 选择门店的供货商
|
|
*/
|
|
Vue.component('select-store-supplier', {
|
|
template: `<el-select v-model="supplier_id"
|
|
:placeholder="placeholder"
|
|
:disabled="isDisabled"
|
|
size="small"
|
|
@change="changeSupplier"
|
|
clearable filterable>
|
|
<el-option v-for="item in dataList"
|
|
:value-key="item.id"
|
|
:key="item.id"
|
|
:label="item.supplier_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>`,
|
|
props: {
|
|
'supplierId': {
|
|
type: String,
|
|
default: '',
|
|
},//门店ID
|
|
'placeholder': {
|
|
type: String,
|
|
default: '选择供货商',
|
|
},//选择的供货商ID
|
|
'isDisabled': {
|
|
type: Boolean,
|
|
default: false,
|
|
},//是否禁止修改
|
|
},
|
|
data() {
|
|
return {
|
|
supplier_id: '',//已选中的供货商id
|
|
dataList: [],// 数据
|
|
page: 1,
|
|
limit: 20,
|
|
};
|
|
},
|
|
methods: {
|
|
//切换供货商
|
|
changeSupplier(val) {
|
|
this.$emit('update:supplierId', val);
|
|
this.$emit('change', val);
|
|
},
|
|
//获取供货商列表
|
|
getSupplierList() {
|
|
this.sendRequest('Retail/SSupplier/getUsedSupplierList', {
|
|
data: {
|
|
page: this.page,
|
|
limit: this.limit,
|
|
},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.dataList = res.data;
|
|
} else {
|
|
this.$message.error(res.message);
|
|
}
|
|
},
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
this.supplier_id = this.supplierId == '0' ? '' : this.supplierId;
|
|
this.getSupplierList();
|
|
},
|
|
watch: {
|
|
supplierId(n) {
|
|
this.supplier_id = n == '0' ? '' : n;
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
/**
|
|
* 选择商户的供货商
|
|
*/
|
|
Vue.component('select-mer-supplier', {
|
|
template: `<el-select v-model="supplier_id"
|
|
:placeholder="placeholder"
|
|
:disabled="isDisabled"
|
|
size="small"
|
|
@change="changeSupplier"
|
|
clearable filterable>
|
|
<el-option v-for="item in dataList"
|
|
:value-key="item.id"
|
|
:key="item.id"
|
|
:label="item.supplier_name"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>`,
|
|
props: {
|
|
'supplierId': {
|
|
type: String,
|
|
default: '',
|
|
},//门店ID
|
|
'placeholder': {
|
|
type: String,
|
|
default: '选择供货商',
|
|
},//选择的供货商ID
|
|
'isDisabled': {
|
|
type: Boolean,
|
|
default: false,
|
|
},//是否禁止修改
|
|
},
|
|
data() {
|
|
return {
|
|
supplier_id: '',//已选中的供货商id
|
|
dataList: [],// 数据
|
|
page: 1,
|
|
limit: 20,
|
|
};
|
|
},
|
|
methods: {
|
|
//切换供货商
|
|
changeSupplier(val) {
|
|
this.$emit('update:supplierId', val);
|
|
this.$emit('change', val);
|
|
},
|
|
//获取供货商列表
|
|
getSupplierList() {
|
|
this.sendRequest('Retail/Supplier/getUsedSupplierList', {
|
|
data: {
|
|
page: this.page,
|
|
limit: this.limit,
|
|
},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.dataList = res.data;
|
|
} else {
|
|
this.$message.error(res.message);
|
|
}
|
|
},
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
this.supplier_id = this.supplierId == '0' ? '' : this.supplierId;
|
|
this.getSupplierList();
|
|
},
|
|
watch: {
|
|
supplierId(n) {
|
|
this.supplier_id = n == '0' ? '' : n;
|
|
}
|
|
}
|
|
})
|