2022-08-02 10:16:07 +08:00
|
|
|
<template>
|
2022-08-06 20:03:35 +08:00
|
|
|
<div class="conent">
|
|
|
|
|
<!-- 新增按钮 -->
|
|
|
|
|
<div class="btn">
|
|
|
|
|
<el-button type="primary" @click="handAdd">新增</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="table">
|
|
|
|
|
<el-table :data="tableData" style="width: 100%">
|
|
|
|
|
<el-table-column prop="id" label="ID" width="180"> </el-table-column>
|
|
|
|
|
<el-table-column prop="name" label="店铺名称" width="180">
|
|
|
|
|
</el-table-column>
|
2022-08-12 18:26:27 +08:00
|
|
|
<el-table-column prop="plat_id" label="所属平台"></el-table-column>
|
|
|
|
|
<el-table-column label="操作">
|
2022-08-06 20:03:35 +08:00
|
|
|
<template slot-scope="scope">
|
2022-08-12 18:26:27 +08:00
|
|
|
<el-button type="danger" v-if="scope.row.status === '未授权'"
|
2022-08-16 19:57:31 +08:00
|
|
|
><a
|
|
|
|
|
:href="scope.row.authUrl"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
> 授 权 </a
|
|
|
|
|
></el-button
|
2022-08-06 20:03:35 +08:00
|
|
|
>
|
2022-08-17 15:40:04 +08:00
|
|
|
<div v-if="scope.row.status === '重新授权'">
|
|
|
|
|
<el-button type="danger" target="_blank"
|
|
|
|
|
><a :href="scope.row.authUrl" rel="noopener noreferrer"
|
|
|
|
|
>重新授权</a
|
|
|
|
|
></el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button @click="download(scope.row)">下载商品</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-if="scope.row.status === '无需授权'">
|
|
|
|
|
<el-button type="success">{{ scope.row.status }}</el-button>
|
|
|
|
|
<el-button @click="download(scope.row)">下载商品</el-button>
|
|
|
|
|
</div>
|
2022-08-06 20:03:35 +08:00
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
|
2022-08-04 18:59:32 +08:00
|
|
|
<!-- 新增店铺 -->
|
2022-08-15 19:55:44 +08:00
|
|
|
<el-dialog
|
|
|
|
|
title="新增店铺"
|
|
|
|
|
:visible.sync="dialogFormVisible"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
>
|
2022-08-04 18:59:32 +08:00
|
|
|
<el-form :model="form">
|
|
|
|
|
<el-form-item label="店铺名称">
|
2022-08-06 20:03:35 +08:00
|
|
|
<el-input v-model="form.name" placeholder="输入店铺名称"></el-input>
|
2022-08-04 18:59:32 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="店铺平台">
|
2022-08-06 20:03:35 +08:00
|
|
|
<el-select v-model="form.plat_id" placeholder="输入店铺平台">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(item, index) in storeId"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="item"
|
|
|
|
|
:value="index"
|
|
|
|
|
>
|
2022-08-04 18:59:32 +08:00
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2022-08-06 20:03:35 +08:00
|
|
|
<div slot="footer" class="dialog-footer">
|
2022-08-04 18:59:32 +08:00
|
|
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
2022-08-06 20:03:35 +08:00
|
|
|
<el-button type="primary" @click="addSubmit">确 定</el-button>
|
2022-08-04 18:59:32 +08:00
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
2022-08-06 20:03:35 +08:00
|
|
|
|
|
|
|
|
<!-- 分页功能 -->
|
|
|
|
|
<div class="block">
|
|
|
|
|
<el-pagination
|
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
:current-page="current_page"
|
|
|
|
|
:page-sizes="[15, 50, 100]"
|
|
|
|
|
:page-size="per_page"
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
:total="Paginationdata.total"
|
|
|
|
|
>
|
|
|
|
|
</el-pagination>
|
|
|
|
|
</div>
|
2022-08-04 18:59:32 +08:00
|
|
|
</div>
|
2022-08-02 10:16:07 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-08-17 15:40:04 +08:00
|
|
|
import { shopListId, shopAdd, storeList, downloadGoods } from "../../api/shop";
|
2022-08-02 10:16:07 +08:00
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-08-04 18:59:32 +08:00
|
|
|
dialogFormVisible: false,
|
|
|
|
|
form: {
|
2022-08-06 20:03:35 +08:00
|
|
|
name: "",
|
|
|
|
|
plat_id: "",
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
|
|
|
|
storeId: [], // 店铺id
|
|
|
|
|
tableData: [],
|
2022-08-06 20:03:35 +08:00
|
|
|
Paginationdata: {}, //分页相关数据
|
|
|
|
|
current_page: 1, //当前页
|
|
|
|
|
per_page: 15, //每页显示数量
|
|
|
|
|
};
|
2022-08-02 10:16:07 +08:00
|
|
|
},
|
2022-08-04 18:59:32 +08:00
|
|
|
mounted() {
|
|
|
|
|
// 展示店铺列表
|
2022-08-06 20:03:35 +08:00
|
|
|
this.getStoreList();
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 点击新增
|
|
|
|
|
handAdd() {
|
2022-08-06 20:03:35 +08:00
|
|
|
this.form.name = "";
|
|
|
|
|
this.form.plat_id = "";
|
|
|
|
|
this.dialogFormVisible = true;
|
2022-08-12 18:26:27 +08:00
|
|
|
this.getshop();
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
2022-08-12 18:26:27 +08:00
|
|
|
|
2022-08-04 18:59:32 +08:00
|
|
|
// 新增商品
|
|
|
|
|
addSubmit() {
|
2022-08-06 20:03:35 +08:00
|
|
|
const datas = this.form;
|
2022-08-04 18:59:32 +08:00
|
|
|
shopAdd(datas).then((res) => {
|
|
|
|
|
if (res.status == 200) {
|
|
|
|
|
this.$message({
|
2022-08-06 20:03:35 +08:00
|
|
|
type: "success",
|
|
|
|
|
message: "添加成功",
|
|
|
|
|
});
|
2022-08-04 18:59:32 +08:00
|
|
|
}
|
2022-08-06 20:03:35 +08:00
|
|
|
this.getStoreList();
|
|
|
|
|
});
|
|
|
|
|
this.dialogFormVisible = false;
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
2022-08-12 18:26:27 +08:00
|
|
|
|
2022-08-04 18:59:32 +08:00
|
|
|
// 店铺列表
|
|
|
|
|
getStoreList() {
|
2022-08-12 18:26:27 +08:00
|
|
|
let page = {
|
|
|
|
|
page: this.current_page,
|
|
|
|
|
per_page: this.per_page,
|
|
|
|
|
};
|
|
|
|
|
storeList(page).then((res) => {
|
|
|
|
|
this.tableData = res.data.data;
|
|
|
|
|
this.Paginationdata = res.data.meta;
|
2022-08-16 19:57:31 +08:00
|
|
|
console.log(111111, this.tableData);
|
2022-08-12 18:26:27 +08:00
|
|
|
});
|
2022-08-06 20:03:35 +08:00
|
|
|
},
|
2022-08-12 18:26:27 +08:00
|
|
|
|
2022-08-06 20:03:35 +08:00
|
|
|
//分页功能
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
//当前条数
|
|
|
|
|
this.per_page = val;
|
|
|
|
|
// console.log(1111, val);
|
|
|
|
|
this.getStoreList();
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
//当前页
|
|
|
|
|
this.current_page = val;
|
|
|
|
|
// console.log(2222, val);
|
|
|
|
|
this.getStoreList();
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
2022-08-12 18:26:27 +08:00
|
|
|
|
|
|
|
|
// 店铺平台
|
|
|
|
|
getshop() {
|
|
|
|
|
shopListId().then((res) => {
|
|
|
|
|
this.storeId = res.data.data;
|
|
|
|
|
});
|
|
|
|
|
},
|
2022-08-17 15:40:04 +08:00
|
|
|
|
|
|
|
|
// 下载商品
|
|
|
|
|
download(row) {
|
|
|
|
|
// console.log(row);
|
|
|
|
|
downloadGoods(row.id).then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
});
|
|
|
|
|
},
|
2022-08-04 18:59:32 +08:00
|
|
|
},
|
2022-08-06 20:03:35 +08:00
|
|
|
};
|
2022-08-02 10:16:07 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-08-16 19:57:31 +08:00
|
|
|
a {
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-06 20:03:35 +08:00
|
|
|
.conent {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-height: calc(100vh - 200px);
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.btn {
|
|
|
|
|
height: 104px;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
.el-button {
|
|
|
|
|
width: 114px;
|
|
|
|
|
height: 44px;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.table {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
.block {
|
|
|
|
|
margin-top: 30px;
|
|
|
|
|
}
|
2022-08-02 10:16:07 +08:00
|
|
|
</style>
|