Commit 1972f16f by lixiaomin

修改店铺商品限制

parent 029a3a72
......@@ -167,3 +167,10 @@ export function testStart(shopId){
});
}
// 店铺是否绑定机器
export function checkMachine(id) {
return request({
url: "/system/machine/bind/check/" + id,
method: "get",
});
}
......@@ -11,7 +11,7 @@
</el-button>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="openSelectGoos" plain icon="el-icon-plus" size="small">添加商品
<el-button type="primary" @click="openSelectGoos" plain icon="el-icon-plus" size="small" :disabled="showButton">添加商品
</el-button>
<el-button type="danger" @click="soldOutGoos" plain icon="el-icon-minus" size="small">下架商品</el-button>
</el-col>
......@@ -88,7 +88,7 @@
</template>
<script>
import { getCategoryGoods, addGoods ,offGoods,turnList} from "@/api/system/shop";
import { getCategoryGoods, addGoods ,offGoods,turnList,checkMachine} from "@/api/system/shop";
import SelectGoods from '@/components/SelectGoods';
import AddRecommend from './addRecommend.vue'
import Preferential from './preferential.vue';
......@@ -115,7 +115,8 @@ export default {
btnId: '',
outIds: '',
total: null,
goodsList:[]
goodsList:[],
showButton:true
}
},
mounted() {
......@@ -154,27 +155,36 @@ export default {
},
getList() {
if (!this.shopId) return;
this.list=[];
getCategoryGoods(this.shopId).then(({ data }) => {
if (data && data.length > 0) {
this.options = data;
if(this.btnId==''){
this.list = data[0].goodsList;
this.btnId = data[0].id;
}else{
for(let i=0;i<data.length;i++){
if(this.btnId==data[i].id){
this.list = data[i].goodsList;
checkMachine(this.shopId).then(({ data }) => {
if(data){
this.showButton=false;
this.list=[];
getCategoryGoods(this.shopId).then(({ data }) => {
if (data && data.length > 0) {
this.options = data;
if(this.btnId==''){
this.list = data[0].goodsList;
this.btnId = data[0].id;
}else{
for(let i=0;i<data.length;i++){
if(this.btnId==data[i].id){
this.list = data[i].goodsList;
}
}
}
this.goodsList=this.list;
this.total=this.list.length;
this.totalNum=this.list.length;
}else{
this.options=[];
}
}
this.goodsList=this.list;
this.total=this.list.length;
this.totalNum=this.list.length;
}else{
this.options=[];
})
}else{
this.$message.error('请先绑定店铺机器!');
this.showButton=true;
}
})
})
},
// 多选框选中数据
handleSelectionChange(selection) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment