Vue.component('label-link-goods-list', { template: ` 搜索 `, props: { 'show': { type: Boolean, default: false, }, 'labelId': { type: String, default: '', },//标签ID 'storeId': { type: String, default: '', },//门店ID 'operateType': { type: Number, default: '', },//操作类型 1商户 2门店 'operate': { type: Object, default() { return {} }, },//操作权限 'requestUrl': { type: Object, default() { return {} } },//请求地址 }, data() { return { searchForm: { search_type: 2, search_text: '', firstClass: '', secondClass: '', thirdClass: '', page: 1, limit: 10, }, currentLen: 0, goodsList: [], loading: false, } }, methods: { closeDialog() { this.searchForm = { search_type: 2, search_text: '', firstClass: '', secondClass: '', thirdClass: '', page: 1, limit: 10, }; this.$emit('close'); }, // 取消绑定商品 delLinkGoods(id) { this.$confirm("确认要删除该商品与标签的绑定关系吗?", "温馨提示", { confirmButtonText: '删除', cancelButtonText: '取消', type: 'info' }).then(() => { this.$loading({ lock: true, text: '删除中,请等待', spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.7)' }); this.sendRequest(this.requestUrl.delLinkGoods,{ data: { ids: id, operate_type: this.operateType, }, success: (res) => { this.$loading().close(); if (res.status == 1) { this.$message.success(res.message); this.getGoodsList(); } else { this.$message.error(res.message) } }, }) }).catch(() => { }) }, // 切换记录每页数量 limitChange(val) { this.searchForm.limit = val; this.searchForm.page = 1; this.getGoodsList(); }, // 切换记录页数 pageChange(val) { this.searchForm.page = val; this.getGoodsList(); }, // 获取绑定的商品列表 getGoodsList() { this.loading = true; this.sendRequest('Retail/LabelInventory/getLabelBelongGoods',{ data: { label_id: this.labelId, operate_type: this.operateType, ...this.searchForm, }, success: (res) => { if (res.status == 1) { this.goodsList = res.data.list; this.currentLen = res.data.count * 1; } else { this.goodsList = []; this.currentLen = 0; } this.loading = false; } }) }, }, watch: { show(n, o) { if (n) { this.pageChange(1); } }, }, });