优化商品编辑,规格编辑

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