/** * 选择门店的供货商 */ Vue.component('select-store-supplier', { template: ` `, 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: ` `, 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; } } })