8.17下午

This commit is contained in:
yezhenman 2022-08-17 15:40:04 +08:00
parent 79cfae3a26
commit bfecf71d08
6 changed files with 89 additions and 76 deletions

Binary file not shown.

View File

@ -18,10 +18,17 @@ export function shopAdd(data) {
}); });
} }
// 店铺列表 // 店铺列表
export function storeList(data) { export function storeList() {
return http({ return http({
url: "/api/shops", url: "/api/shops",
method: "get", method: "get",
data, });
}
// 下载商品
export function downloadGoods(id) {
return http({
url: `/api/download/${id}/goods`,
method: "get",
}); });
} }

View File

@ -55,12 +55,13 @@ instance.interceptors.response.use(
} }
}, },
(error) => { (error) => {
console.log(error);
// 对响应错误做点什么 // 对响应错误做点什么
Message({ Message({
message: error, message: error,
type: "error", type: "error",
}); });
console.log(error, "44444"); // for debug // console.log(error, "44444"); // for debug
// if (error.response.status === 401) { // if (error.response.status === 401) {
// Message({ // Message({
// message: '账户登录过期,请重新登录', // message: '账户登录过期,请重新登录',

View File

@ -21,17 +21,19 @@
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a
></el-button ></el-button
> >
<el-button <div v-if="scope.row.status === '重新授权'">
type="danger" <el-button type="danger" target="_blank"
v-if="scope.row.status === '重新授权'" ><a :href="scope.row.authUrl" rel="noopener noreferrer"
target="_blank" >重新授权</a
><a :href="scope.row.authUrl" rel="noopener noreferrer" ></el-button
>重新授权</a >
></el-button <el-button @click="download(scope.row)">下载商品</el-button>
> </div>
<span v-if="scope.row.status === '无需授权'">{{
scope.row.status <div v-if="scope.row.status === '无需授权'">
}}</span> <el-button type="success">{{ scope.row.status }}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -82,7 +84,7 @@
</template> </template>
<script> <script>
import { shopListId, shopAdd, storeList } from "../../api/shop"; import { shopListId, shopAdd, storeList, downloadGoods } from "../../api/shop";
export default { export default {
data() { data() {
return { return {
@ -159,6 +161,14 @@ export default {
this.storeId = res.data.data; this.storeId = res.data.data;
}); });
}, },
//
download(row) {
// console.log(row);
downloadGoods(row.id).then((res) => {
console.log(res);
});
},
}, },
}; };
</script> </script>

View File

@ -286,8 +286,8 @@ export default {
title: "", title: "",
sku_code: "", sku_code: "",
status: "0", status: "0",
num: "", num: "0",
cost: "", cost: "0",
}, },
], ],
@ -388,7 +388,6 @@ export default {
}, },
...this.goodschoose, ...this.goodschoose,
]; ];
console.log(this.goodschoose);
}); });
}, },
@ -401,7 +400,6 @@ export default {
goods_id: this.lid, goods_id: this.lid,
skus: skus, skus: skus,
}; };
console.log(updata);
addGoods(updata).then((res) => { addGoods(updata).then((res) => {
if (res.statusText === "OK") { if (res.statusText === "OK") {
this.$message({ this.$message({
@ -410,11 +408,6 @@ export default {
}); });
this.updateForm(); this.updateForm();
this.$router.push("/GOODS_LIST"); this.$router.push("/GOODS_LIST");
} else {
this.$message({
message: "商品添加失败!",
type: "error",
});
} }
}); });
}, },
@ -472,16 +465,6 @@ export default {
// //
getgoodsidData() { getgoodsidData() {
let id = this.bigID; let id = this.bigID;
// let token = localStorage.getItem("token");
// axios
// .get(`/api/goods_skus/${id}`, {
// headers: {
// Authorization: `Bearer ${token}`,
// },
// })
// .then((res) => {
// this.goodsData = res.data.data;
// });
checkGoods(id).then((res) => { checkGoods(id).then((res) => {
this.goodsData = res.data.data; this.goodsData = res.data.data;
}); });
@ -497,7 +480,7 @@ export default {
// console.log("goodsid", this.goodsData.goods_id); // console.log("goodsid", this.goodsData.goods_id);
let goods = { let goods = {
title: this.goodsData.goods.title, title: this.goodsData.goods.title,
img_url: this.from.img_url, img_url: this.goodsData.goods.img_url,
type_id: this.goodsData.goods.type_id, type_id: this.goodsData.goods.type_id,
brand_id: this.goodsData.goods.brand_id, brand_id: this.goodsData.goods.brand_id,
goods_code: this.goodsData.goods.goods_code, goods_code: this.goodsData.goods.goods_code,
@ -522,11 +505,11 @@ export default {
sku, sku,
}; };
updateGoods(id, updateData).then((res) => { updateGoods(id, updateData).then((res) => {
this.$router.push("/GOODS_LIST");
this.$message({ this.$message({
message: "商品编辑成功!", message: "商品编辑成功!",
type: "success", type: "success",
}); });
this.$router.push("/GOODS_LIST");
}); });
}, },
@ -615,8 +598,8 @@ export default {
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 148px;
height: 178px; height: 148px;
display: block; display: block;
} }
</style> </style>

View File

@ -203,15 +203,14 @@
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
max-height="500"
> >
<!-- 多选框 --> <!-- 多选框 -->
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="商品信息" width="250"> <el-table-column label="商品信息" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="commodityimg"> <div class="commodityimg">
<img <img :src="scope.row.goods.img_url" class="Img" />
src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-dc-site/c40319b0-6080-11eb-918d-3d24828c498c.png"
/>
</div> </div>
<div> <div>
<p>{{ scope.row.goods.title }}</p> <p>{{ scope.row.goods.title }}</p>
@ -247,16 +246,10 @@
<el-table-column sortable label="今日到货" min-width="110"> <el-table-column sortable label="今日到货" min-width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="isShow"> <div v-if="isShow">
<el-input <el-input v-model="scope.row.arrived_today_num11"></el-input>
v-model="scope.row.daily.arrived_today_num"
></el-input>
</div> </div>
<div v-else> <div v-else>
{{ {{ scope.row.daily.arrived_today_num }}
scope.row.daily != null
? scope.row.daily.arrived_today_num
: 0
}}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -393,10 +386,14 @@
</div> </div>
<!-- 点击库存按钮弹出框 --> <!-- 点击库存按钮弹出框 -->
<el-dialog title="修改" :visible.sync="ejectstock1" width="30%"> <el-dialog
title="库存修改"
:visible.sync="ejectstock1"
width="30%"
:close-on-click-modal="false"
>
<el-table <el-table
:data="ommodityInventory" :data="ommodityInventory"
class="table"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@ -432,7 +429,7 @@
</el-table> </el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="ejectstock1 = false"> </el-button> <el-button @click="cancelStock()"> </el-button>
<el-button type="primary" @click="oldStock()" <el-button type="primary" @click="oldStock()"
> </el-button > </el-button
> >
@ -523,8 +520,6 @@ export default {
status: "", // status: "", //
keyword_value: "", // keyword_value: "", //
}, },
// cost_input: "", //input
// arrived_today_num: "", //input
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
@ -591,10 +586,17 @@ export default {
per_page: this.per_page, per_page: this.per_page,
}; };
goods(page).then((res) => { goods(page).then((res) => {
console.log("列表数据", res);
this.tableData = res.data.data; this.tableData = res.data.data;
this.tableData = this.tableData.map((item) => {
item = {
...item,
arrived_today_num11: 0,
};
return item;
});
this.total = res.data.meta.total; this.total = res.data.meta.total;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
console.log(this.tableData);
}); });
}, },
@ -625,6 +627,13 @@ export default {
} }
goods(newObj).then((res) => { goods(newObj).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.tableData = this.tableData.map((item) => {
item = {
...item,
arrived_today_num11: 0,
};
return item;
});
this.total = res.data.meta.total; this.total = res.data.meta.total;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
@ -653,10 +662,9 @@ export default {
// //
update() { update() {
// this.dialogVisible = false;
this.isShow = true; this.isShow = true;
this.updateType = "newest";
this.stock = false; this.stock = false;
this.updateType = "newest";
}, },
// //
handleSelectionChange(val) { handleSelectionChange(val) {
@ -685,9 +693,9 @@ export default {
//or //or
cancel() { cancel() {
this.handleChoose();
this.isShow = false; this.isShow = false;
this.stock = false; this.stock = false;
this.getList();
}, },
// or // or
@ -699,7 +707,7 @@ export default {
{ {
id: item.id, id: item.id,
cost: item.cost, cost: item.cost,
arrived_today_num: item.daily.arrived_today_num, arrived_today_num: item.arrived_today_num11,
}, },
]; ];
}); });
@ -707,10 +715,9 @@ export default {
updateType: this.updateType, updateType: this.updateType,
skus: skus.flat(), skus: skus.flat(),
}; };
console.log(patchdata);
// //
update(patchdata).then((res) => { update(patchdata).then((res) => {
this.getList(); this.handleChoose();
this.$message({ this.$message({
message: "上新成功!", message: "上新成功!",
type: "success", type: "success",
@ -734,16 +741,19 @@ export default {
}; };
// //
update(patchdata).then((res) => { update(patchdata).then((res) => {
this.getList(); this.handleChoose();
this.$message({ this.$message({
message: "库存盘点成功!", message: "库存盘点成功!",
type: "success", type: "success",
}); });
}); });
} }
this.isShow = false;
this.stock = false;
this.handleChoose();
}, },
// //
onCount() { onCount() {
this.dialogVisible2 = false; this.dialogVisible2 = false;
this.isShow = false; this.isShow = false;
@ -759,6 +769,12 @@ export default {
this.ommodityInventory.push(row); this.ommodityInventory.push(row);
}, },
//
cancelStock() {
this.handleChoose();
this.ejectstock1 = false;
},
// //
oldStock() { oldStock() {
this.ejectstock1 = false; this.ejectstock1 = false;
@ -780,7 +796,7 @@ export default {
}; };
// //
update(stockpatch).then((res) => { update(stockpatch).then((res) => {
this.getList(); this.handleChoose();
this.$message({ this.$message({
message: "库存更新成功!", message: "库存更新成功!",
type: "success", type: "success",
@ -838,17 +854,6 @@ export default {
exportType: this.value, exportType: this.value,
}; };
console.log(data); console.log(data);
// let token = localStorage.getItem("token");
// axios
// .get("/api/goods_skus/export", data, {
// headers: {
// Authorization: `Bearer ${token}`,
// },
// })
// .then((res) => {
// console.log(res);
// });
this.Tableexport = false; this.Tableexport = false;
}, },
@ -946,6 +951,7 @@ export default {
loss_num: row.daily.loss_num, loss_num: row.daily.loss_num,
}; };
singleUpdate(id, lossData).then((res) => { singleUpdate(id, lossData).then((res) => {
this.getList();
this.id2 = ""; this.id2 = "";
this.$message({ this.$message({
message: "损耗添加成功!", message: "损耗添加成功!",
@ -970,9 +976,9 @@ export default {
}, },
mounted() { mounted() {
this.getList();
this.getgoodsType(); this.getgoodsType();
this.getbrandType(); this.getbrandType();
this.getList();
this.id = ""; this.id = "";
this.id1 = ""; this.id1 = "";
this.id2 = ""; this.id2 = "";
@ -987,6 +993,7 @@ export default {
.table { .table {
margin-top: 40px; margin-top: 40px;
position: relative;
} }
.btn { .btn {
float: right; float: right;
@ -1006,6 +1013,11 @@ export default {
margin-right: 12px; margin-right: 12px;
} }
.Img {
width: 100%;
height: 100%;
}
.confirmbtn { .confirmbtn {
width: 114px; width: 114px;
height: 44px; height: 44px;