Commit edb6be28 by lixiaomin

修改店铺添加商品列表

parent a5bb8c8c
...@@ -62,3 +62,12 @@ export function offShop(params) { ...@@ -62,3 +62,12 @@ export function offShop(params) {
} }
// 店铺添加商品查询列表
export function goodslist(query) {
return request({
url: "/system/shop/goodslist",
method: "get",
params: query,
});
}
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<el-dialog title="选择商品" :visible.sync="open" width="1000px" append-to-body> <el-dialog title="选择商品" :visible.sync="open" width="1000px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px"> label-width="68px">
<el-form-item label="商品名称" prop="spuName"> <el-form-item label="商品名称" prop="goodsName">
<el-input v-model="queryParams.spuName" placeholder="请输入商品名称" clearable <el-input v-model="queryParams.goodsName" placeholder="请输入商品名称" clearable
@keyup.enter.native="handleQuery" /> @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="分类" prop="category"> <el-form-item label="分类" prop="category">
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</template> </template>
<script> <script>
import { listSpu } from "@/api/system/goods"; import { goodslist } from "@/api/system/goods";
import SelectCategory from '@/components/SelectCategory' import SelectCategory from '@/components/SelectCategory'
export default { export default {
components: { SelectCategory }, components: { SelectCategory },
...@@ -64,9 +64,10 @@ export default { ...@@ -64,9 +64,10 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
spuName: null, goodsName: null,
category: null, category: null,
state: 3, state: 3,
shopId: null
}, },
}; };
}, },
...@@ -85,9 +86,10 @@ export default { ...@@ -85,9 +86,10 @@ export default {
return list; return list;
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList(shopId) {
this.loading = true; this.loading = true;
listSpu(this.queryParams).then((response) => { this.queryParams.shopId=shopId
goodslist(this.queryParams).then((response) => {
this.spuList = response.rows; this.spuList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -101,7 +103,7 @@ export default { ...@@ -101,7 +103,7 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.spuName=null; this.queryParams.goodsName=null;
this.queryParams.category=null; this.queryParams.category=null;
this.handleQuery(); this.handleQuery();
}, },
...@@ -114,13 +116,13 @@ export default { ...@@ -114,13 +116,13 @@ export default {
this.open = false; this.open = false;
//this.reset(); //this.reset();
}, },
openModal() { openModal(shopId) {
this.open = true; this.open = true;
this.getList(); this.getList(shopId);
}, },
submit() { submit() {
this.$emit('callback', this.ids) this.$emit('callback', this.ids);
this.open = false //this.open = false
} }
}, },
}; };
......
...@@ -46,13 +46,10 @@ ...@@ -46,13 +46,10 @@
<el-table-column label="总销量" align="center" prop="salesVolume" /> <el-table-column label="总销量" align="center" prop="salesVolume" />
<el-table-column label="上架时间" align="center" prop="shelfat" width="150" /> <el-table-column label="上架时间" align="center" prop="shelfat" width="150" />
<el-table-column label="状态" align="center" prop="state" width="150"> <el-table-column label="状态" align="center" prop="state" width="150">
<!-- <template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.state == 1">已创建</span> <span v-if="scope.row.state == 1">售卖</span>
<span v-if="scope.row.state == 2">已完成编程</span> <span v-if="scope.row.state == 2">告罄</span>
<span v-if="scope.row.state == 3">已上架</span> </template>
<span v-if="scope.row.state == 4">已下架</span>
<span v-if="scope.row.state == 5">已删除</span>
</template> -->
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center"> <el-table-column label="排序" align="center">
</el-table-column> </el-table-column>
...@@ -135,61 +132,52 @@ export default { ...@@ -135,61 +132,52 @@ export default {
this.outIds = selection.map((item) => item.id); this.outIds = selection.map((item) => item.id);
}, },
soldOutGoos(){ soldOutGoos(){
this.$confirm('是否确认下架所选商品?', '提示', { this.$confirm('是否确认下架所选商品?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
offGoods({"shopId":this.shopId,"goodsIds":this.outIds}).then(({ response }) => { offGoods({"shopId":this.shopId,"goodsIds":this.outIds}).then(res => {
if(response.code=="200"){ if(res.code=="200"){
this.getList();
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '所选商品下架成功!'
}); });
} }
}) })
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: '已取消下架所选商品!'
}); });
}); });
// offGoods({"shopId":this.shopId,"goodsIds":this.outIds}).then(({ response }) => {
// console.log("response",response);
// })
// this.$modal
// .confirm('是否确认下架所选商品?')
// .then(function () {
// return offGoods({"shopId":this.shopId,"goodsIds":this.outIds});
// })
// .then((response) => {
// // console.log("response",response);
// // if(response.code=="200"){
// // this.getList();
// //this.$modal.msgSuccess('' + mess + '成功');
// // }
// })
// .catch(() => { });
}, },
openSelectGoos() { openSelectGoos() {
this.$refs.selectGoods.openModal() this.$refs.selectGoods.openModal(this.shopId)
}, },
selectGoos(ids) { selectGoos(ids) {
addGoods({ shopId: this.shopId, goodsIds: ids.join(',') }).then(res => { this.$confirm('是否确认添加所选商品?', '提示', {
this.getList() confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
addGoods({"shopId":this.shopId,"goodsIds":ids.join(',')}).then(res => {
if(res.code=="200"){
this.$refs.selectGoods.open = false;
this.getList();
this.$message({
type: 'success',
message: '所选商品添加成功!'
});
}
}) })
}).catch(() => {
this.$message({
type: 'info',
message: '已取消所选的商品!'
});
});
} }
} }
} }
......
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