123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <!-- -->
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 直播商品管理
- </h2>
- <div class="m-core">
- <auth auths="liveGoods/add">
- <el-button
- type="primary"
- style="margin-bottom: 30px; margian-right: 10px"
- @click="addLiveShop"
- >新建商品</el-button
- >
- </auth>
- <save-form
- :inline="true"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- >
- <el-form-item>
- <el-input
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="search"
- placeholder="商品编号/名称"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item>
- </save-form>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- >
- <el-table-column
- align="center"
- prop="id"
- label="商品编号"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="name"
- label="商品名称"
- ></el-table-column>
- <el-table-column align="center" prop="originalPrice" label="原价">
- <template slot-scope="scope">
- <div>
- {{ scope.row.originalPrice | moneyFormat(true) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="currentPrice" label="直播价">
- <template slot-scope="scope">
- <div>
- {{ scope.row.currentPrice | moneyFormat(true) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- prop="stockCount"
- label="库存"
- ></el-table-column>
- <el-table-column align="center" prop="studentId" label="操作">
- <template slot-scope="scope">
- <div>
- <auth
- auths="liveGoods/update"
- >
- <el-button type="text" @click="resetShop(scope.row)"
- >修改</el-button
- >
- </auth>
- <auth
- auths="liveGoods/delete"
- >
- <el-button type="text" @click="deteleShop(scope.row)"
- >删除</el-button
- >
- </auth>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- sync
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <eidtLiveShop ref="eidtLiveShop" @getList="getList" />
- </div>
- </template>
- <script>
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- import pagination from "@/components/Pagination/index";
- import load from "@/utils/loading";
- import { getTimes } from "@/utils";
- import { getLiveGoodsMapperList,delLiveGoods } from "./api";
- import eidtLiveShop from "./models/eidtLiveShop";
- export default {
- components: { pagination, eidtLiveShop },
- data() {
- return {
- searchForm: {
- search: null,
- },
- tableList: [],
- organList: [],
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 获取分部
- this.init();
- },
- methods: {
- init() {
- this.getList();
- },
- async getList() {
- let params = {
- ...this.searchForm,
- page: this.rules.page,
- rows: this.rules.limit,
- };
- try {
- const res = await getLiveGoodsMapperList({ ...params });
- this.tableList = res.data.rows;
- this.rules.total = res.data.total;
- } catch (e) {
- console.log(e);
- }
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- onReSet() {
- this.searchForm.search = "";
- this.search();
- },
- resetShop(row) {
- this.$refs.eidtLiveShop.openDioag(row);
- },
- addLiveShop() {
- this.$refs.eidtLiveShop.openDioag();
- },
- deteleShop(row) {
- this.$confirm(`确定删除"${row.name}"?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- delLiveGoods({ goodsId: row.id }).then((res) => {
- if (res.code === 200) {
- this.$message.success("删除成功");
- this.getList();
- // this.routeOrderStatus = false;
- }
- });
- })
- .catch();
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- </style>
|