123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <el-container>
- <sidebar></sidebar>
- <el-container>
- <el-header>
- <span @click="showMerchant" v-if="$store.state.userInfo.memberType === 1" class="header-button">成为商户</span>
- <div class="account" @click="goAccount">
- <img src="../../static/image/head-account2.png" alt="">
- <div class="num">¥{{$store.state.userInfo.amount}}</div>
- </div>
- <div class="print" @click="goPrinter">
- <img src="../../static/image/head-print2.png" alt="">
- <div class="num con">打印设置</div>
- </div>
- <el-dropdown trigger="click">
- <span class="el-dropdown-link">
- <span style="cursor: pointer;">{{ userInfo.nickname }}</span>
- <i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="loginOut">退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-header>
- <el-main style="background:#F1F2F5;">
- <router-view></router-view>
- </el-main>
- </el-container>
- <merchant-add ref="merchantAdd" :products="productList"></merchant-add>
- </el-container>
- </template>
- <script>
- import sidebar from "../common/sider.vue";
- import { mapState } from "vuex";
- import bus from "../common/bus.js";
- import merchantAdd from "../components/merchantAdd.vue";
- import { getProductList } from "../api/shop.js";
- export default {
- data() {
- return {
- audio: null,
- productList: [],
- };
- },
- computed: {
- ...mapState(["userInfo"]),
- },
- components: {
- sidebar,
- merchantAdd,
- },
- created() {
- bus.$emit("openGetSoundMsg");
- this.getProductList();
- let memberType = this.$store.state.userInfo.memberType;
- if (memberType === 1) {
- this.$confirm("您当前还不是商户,请先申请成为商户!", "提示", {
- confirmButtonText: "成为商户",
- cancelButtonText: "取消",
- type: "warning",
- center: true,
- })
- .then(() => {
- this.$refs.merchantAdd.init(0);
- })
- .catch(() => {});
- }
- },
- methods: {
- goAccount() {
- this.$router.push({
- name: "wallet",
- });
- },
- showMerchant() {
- this.$refs.merchantAdd.init(0);
- },
- getProductList() {
- getProductList().then((res) => {
- if (res.code === 200) {
- this.productList = res.data;
- } else {
- this.$message({
- type: "error",
- message: res.msg,
- });
- }
- });
- },
- goPrinter() {
- this.$router.push({
- name: "print",
- });
- },
- loginOut() {
- this.$confirm("此操作将退出当前登录用户, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- localStorage.clear();
- this.$store.commit("setFirstLogin", true);
- bus.$emit("closeGetSoundMsg");
- this.$router.push({
- path: "/login",
- });
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped="scoped">
- /deep/.el-header {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- position: relative;
- width: 100%;
- height: 80px !important;
- }
- .el-main {
- position: absolute;
- left: 254px;
- right: 0;
- top: 80px;
- bottom: 0;
- background-color: #f1f2f5;
- padding: 10px;
- min-width: 550px;
- }
- .header-button {
- font-size: 16px;
- font-family: PingFang SC;
- font-weight: 400;
- color: #777777;
- cursor: pointer;
- margin-right: 40px;
- }
- .account,
- .print {
- display: flex;
- align-items: center;
- margin-right: 20px;
- cursor: pointer;
- img {
- width: 20px;
- height: 20px;
- margin-right: 5px;
- }
- .num {
- line-height: 25px;
- font-size: 16px;
- font-weight: 500;
- color: #fc7200;
- }
- .con {
- font-size: 15px;
- color: #333333;
- }
- }
- .home-content {
- display: flex;
- .side-box {
- // width: 200px;
- position: relative;
- }
- .content {
- flex: 1;
- flex-shrink: 1;
- }
- .title {
- color: #0074d9;
- }
- }
- </style>
|