Commit 1972f16f by lixiaomin

修改店铺商品限制

parent 029a3a72
...@@ -167,3 +167,10 @@ export function testStart(shopId){ ...@@ -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 @@ ...@@ -11,7 +11,7 @@
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="6"> <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>
<el-button type="danger" @click="soldOutGoos" plain icon="el-icon-minus" size="small">下架商品</el-button> <el-button type="danger" @click="soldOutGoos" plain icon="el-icon-minus" size="small">下架商品</el-button>
</el-col> </el-col>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
</template> </template>
<script> <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 SelectGoods from '@/components/SelectGoods';
import AddRecommend from './addRecommend.vue' import AddRecommend from './addRecommend.vue'
import Preferential from './preferential.vue'; import Preferential from './preferential.vue';
...@@ -115,7 +115,8 @@ export default { ...@@ -115,7 +115,8 @@ export default {
btnId: '', btnId: '',
outIds: '', outIds: '',
total: null, total: null,
goodsList:[] goodsList:[],
showButton:true
} }
}, },
mounted() { mounted() {
...@@ -154,27 +155,36 @@ export default { ...@@ -154,27 +155,36 @@ export default {
}, },
getList() { getList() {
if (!this.shopId) return; if (!this.shopId) return;
this.list=[]; checkMachine(this.shopId).then(({ data }) => {
getCategoryGoods(this.shopId).then(({ data }) => { if(data){
if (data && data.length > 0) { this.showButton=false;
this.options = data; this.list=[];
if(this.btnId==''){ getCategoryGoods(this.shopId).then(({ data }) => {
this.list = data[0].goodsList; if (data && data.length > 0) {
this.btnId = data[0].id; this.options = data;
}else{ if(this.btnId==''){
for(let i=0;i<data.length;i++){ this.list = data[0].goodsList;
if(this.btnId==data[i].id){ this.btnId = data[0].id;
this.list = data[i].goodsList; }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; }else{
this.total=this.list.length; this.$message.error('请先绑定店铺机器!');
this.totalNum=this.list.length; this.showButton=true;
}else{
this.options=[];
} }
}) })
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { 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