优化商品编辑,规格编辑

This commit is contained in:
gyq 2024-07-10 13:33:17 +08:00
parent 66f8f95cda
commit bcf5d09b3b
2 changed files with 1400 additions and 1069 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,10 @@
<div class="head-container">
<el-form :model="query" inline>
<el-form-item label="搜索">
<el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
<el-input
v-model="query.name"
placeholder="请输入昵称或手机号"
></el-input>
</el-form-item>
<el-form-item label="是否为会员">
<el-select v-model="query.isVip" placeholder="是否是会员">
@ -40,10 +43,11 @@
<div class="n">{{ shopInfo.chageTotal || 0 }}</div>
</div>
<div class="item">
<el-button type="success" @click="toPage('charge')">充值记录</el-button>
<el-button type="success" @click="toPage('charge')"
>充值记录</el-button
>
<!-- <el-button type="danger" @click="toPage('cost')">消费记录</el-button> -->
</div>
</div>
</div>
</div>
@ -53,7 +57,10 @@
<el-table-column label="用户" prop="headImg" width="200px">
<template v-slot="scope">
<div class="user_info">
<el-image :src="scope.row.headImg" style="width: 40px;height: 40px;flex-shrink: 0;">
<el-image
:src="scope.row.headImg"
style="width: 40px;height: 40px;flex-shrink: 0;"
>
<div slot="error" class="image-slot">
<i class="el-icon-user"></i>
</div>
@ -64,19 +71,29 @@
</el-table-column>
<el-table-column label="性别" prop="sex">
<template v-slot="scope">
<el-tag type="priamry">{{ scope.row.sex || '未知' }}</el-tag>
<el-tag type="priamry">{{ scope.row.sex || "未知" }}</el-tag>
</template>
</el-table-column>
<el-table-column label="会员" prop="isVip">
<template v-slot="scope">
<el-tag type="warning" v-if="scope.row.isVip">会员等级{{ scope.row.isVip }}</el-tag>
<el-tag type="warning" v-if="scope.row.isVip"
>会员等级{{ scope.row.isVip }}</el-tag
>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="余额" prop="amount"></el-table-column>
<el-table-column label="积分" prop="totalScore"></el-table-column>
<el-table-column label="手机号" prop="telephone" width="160"></el-table-column>
<el-table-column label="生日" prop="birthDay" width="200"></el-table-column>
<el-table-column
label="手机号"
prop="telephone"
width="160"
></el-table-column>
<el-table-column
label="生日"
prop="birthDay"
width="200"
></el-table-column>
<el-table-column label="注册时间" prop="createAt" width="200">
<template v-slot="scope">
{{ scope.row.createAt | timeFilter }}
@ -99,22 +116,27 @@
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
<el-pagination
:total="tableData.total"
:current-page="tableData.page + 1"
:page-size="tableData.size"
@size-change="sizeChange"
@current-change="paginationChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
@current-change="paginationChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
</div>
</div>
</template>
<script>
import { queryAllShopUser ,queryAllShopInfo} from '@/api/shop'
import dayjs from 'dayjs'
let cacheData = {}
import { queryAllShopUser, queryAllShopInfo } from "@/api/shop";
import dayjs from "dayjs";
let cacheData = {};
export default {
data() {
return {
query: {
name: '',
name: "",
isVip: 1
},
shopInfo: {
@ -129,88 +151,89 @@ export default {
loading: false,
total: 0
}
}
};
},
filters: {
timeFilter(s) {
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
return dayjs(s).format("YYYY-MM-DD HH:mm:ss");
}
},
mounted() {
cacheData={...this.query}
this.getTableData()
this.getShopInfo()
cacheData = { ...this.query };
this.getTableData();
this.getShopInfo();
},
methods: {
toPage(type) {
const pages = {
charge:'charge_list',
cost:'cost_list'
}
charge: "charge_list",
cost: "cost_list"
};
this.$router.push({
name: pages[type]
})
console.log(pages[type])
});
console.log(pages[type]);
},
//
async getShopInfo() {
try {
const res = await queryAllShopInfo(this.query)
this.shopInfo=res
const res = await queryAllShopInfo(this.query);
this.shopInfo = res;
} catch (error) {
console.log(error)
console.log(error);
}
},
sizeChange() {
this.tableData.page=0
this.getTableData()
this.tableData.page = 0;
this.getTableData();
},
//
async statusChange(e, row) {
try {
this.tableData.loading = true
const data = { ...row }
data.status = e
await modityActivate(data)
this.getTableData()
this.tableData.loading = true;
const data = { ...row };
data.status = e;
await modityActivate(data);
this.getTableData();
} catch (error) {
console.log(error)
this.tableData.loading = false
console.log(error);
this.tableData.loading = false;
}
},
//
resetHandle() {
this.query.telephone = ''
this.getTableData()
this.query.name = "";
this.query.isVip = 1;
this.getTableData();
},
//
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
this.tableData.page = e - 1;
this.getTableData();
},
//
async getTableData() {
this.tableData.loading = true
this.tableData.loading = true;
//2
if (cacheData.isVip !== this.query.isVip) {
this.tableData.page=0
this.tableData.page = 0;
}
cacheData.isVip=this.query.isVip
cacheData.isVip = this.query.isVip;
try {
const res = await queryAllShopUser({
...this.query,
size: this.tableData.size,
page: this.tableData.page + 1
})
this.tableData.loading = false
this.tableData.data = res.content
this.tableData.total = res.totalElements
});
this.tableData.loading = false;
this.tableData.data = res.content;
this.tableData.total = res.totalElements;
} catch (error) {
console.log(error)
}
console.log(error);
}
}
}
};
</script>
<style scoped lang="scss">
@ -220,7 +243,6 @@ export default {
.name {
margin-left: 10px;
}
}