zhanghua
2022-10-31 feebf68645a0c91e07c7eadeb04ae970001f1fc1
src/views/operate/fivepack/shop/components/main/index.vue
@@ -7,30 +7,31 @@
                :data="tableData" style="width: 100%" :row-class-name="tableRowClassName">
                <el-table-column type="selection" min-width="5">
                </el-table-column>
                <el-table-column prop="storeNumber" label="店铺编号" min-width="10">
                </el-table-column>
                <el-table-column label="店铺名称" min-width="10">
                    <template slot-scope="scope">{{ scope.row.id }}</template>
                    <template slot-scope="scope">{{ scope.row.storeName }}</template>
                </el-table-column>
                <el-table-column prop="nickName" label="店铺负责人" min-width="10">
                <el-table-column prop="owner" label="店铺负责人" min-width="10">
                </el-table-column>
                <el-table-column prop="username" label="店铺联系电话" min-width="10">
                <el-table-column prop="contact" label="店铺联系电话" min-width="10">
                </el-table-column>
                <el-table-column prop="mobile" label="店铺详细地址" min-width="10">
                </el-table-column>
                <el-table-column prop="note" label="店铺编号" min-width="10">
                <el-table-column prop="storeAddress" label="店铺详细地址" min-width="10">
                </el-table-column>
                <el-table-column prop="operation" label="操作" min-width="15">
                    <template slot-scope="scope">
                        <div class="operation">
                            <el-link icon="el-icon-edit" :underline="false">编辑</el-link>
                            <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false">删除</el-link>
                            <el-link icon="el-icon-edit" :underline="false" @click.native.prevent='handleEdit(scope.row)'>编辑</el-link>
                            <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false"
                                @click.native.prevent="hadnleDelete(scope.row)">删除</el-link>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 查看修改页面 -->
            <el-dialog :visible.sync="dialogUpdate" width="45%" v-if="dialogUpdate"
                :title="updateFlag ? '修改用户部门信息' :'查看用户信息'">
                <updateUser :updateFlag="updateFlag" :userInfo=userInfo />
                title="编辑商铺信息" :before-close="handleClose">
                <updateUser :userInfo=userInfo @changeDialog="changeDialog" />
            </el-dialog>
            <!-- 分页 -->
            <div class="pagination">
@@ -52,11 +53,10 @@
    data() {
        return {
            tableData: [],
            search: "111",
            search: "",
            dialogUpdate: false,
            updateFlag: false,
            userInfo: '',
            totalNum: 200,
            totalNum: 0,
            pageSize: 10,
            currentPage: 1,
            renderFlag: false,
@@ -66,6 +66,64 @@
        this.getUserList();
    },
    methods: {
        // 关闭弹窗
        handleClose(done){
            this.$confirm('确认关闭')
            .then(_=>{
                done();
            })
            .catch(err=>{
                console.log(err);
            })
        },
        // 改变弹窗状态
        changeDialog({flag}){
            this.dialogUpdate = flag;
            this.getUserList();
        },
        // 删除
        hadnleDelete({id}) {
            console.log(id);
            this.$confirm('确定删除?')
            .then(_=>{
                this.$axios({
                    method:'get',
                    url:`sccg/store/storeinfo/delete/${id}`
                })
                .then(res=>{
                    if(res.code === 200){
                        this.$message({
                            type:'success',
                            message:'删除成功',
                        })
                        this.getUserList();
                    }
                })
                .catch(err=>{
                    console.log(err,2)
                })
            })
            .catch(err=>{
                console.log(err,1);
            })
        },
        // 编辑
        async handleEdit({id}){
            this.userInfo = await this.getShopInfo(id);
            this.dialogUpdate = true;
        },
        // 获取门店信息
        async getShopInfo(id){
            let obj = {};
            await this.$axios({
                method:'get',
                url:`sccg/store/storeinfo/${id}`,
            })
            .then(res=>{
                obj = res.data
            })
            return obj;
        },
        // 当前页改变触发事件
        changeCurrentPage(page) {
            this.currentPage = page;
@@ -81,25 +139,10 @@
            this.currentPage = page;
            this.getUserList();
        },
        // 修改角色
        handleChangeRole(obj) {
            this.dialogUpdate = true
            this.user = obj;
            // console.log(obj)
        },
        // 修改用户状态
        handleChangeStatus(obj) {
            let { id, status } = obj;
            status == true ? status = 1 : status = 0;
            this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => {
                console.log(res);
            })
        },
        // 获取用户列表
        getUserList() {
            const that = this;
            const { currentPage, pageSize, search } = this;
            console.log(typeof search);
            this.$axios.get(`sccg/store/storeinfo/list?keyword=${search}&pageNum=${currentPage}&pageSize=${pageSize}`)
                .then(res => {
                    if (res.code === 200) {
@@ -112,18 +155,6 @@
                        this.renderFlag = true;
                    }
                })
        },
        // 查看用户信息(不可修改)
        handleFind(rowData) {
            this.dialogUpdate = true;
            this.updateFlag = false;
            this.userInfo = rowData;
        },
        // 修改用户部门信息
        handleUpdate(rowData) {
            this.dialogUpdate = true;
            this.updateFlag = true;
            this.userInfo = rowData
        },
        // 设置表格斑马纹
        tableRowClassName({ row, rowIndex }) {