Files
kangyuan-mobile/pages/merchant/storeManage.vue
T

241 lines
5.4 KiB
Vue

<template>
<s-layout
title="网店管理"
:showLeftButton="false"
tabbar="/pages/merchant/storeManage"
navPreset="light"
>
<template #navRight>
<modeSwitch />
</template>
<view class="page">
<view class="stats">
<view class="stat bg24">
<view class="stat-label c_999 size24">总网店数</view>
<view class="stat-value">{{ stats.total }}</view>
</view>
<view class="stat bg24">
<view class="stat-label c_999 size24">营业中</view>
<view class="stat-value cGreen">{{ stats.open }}</view>
</view>
<view class="stat bg24">
<view class="stat-label c_999 size24">今日新增订单</view>
<view class="stat-value cOrange">{{ stats.todayOrders }}</view>
</view>
</view>
<view class="tool-row bg24">
<view class="search-box flex-center flex1">
<uni-icons type="search" size="18" color="#8a8a8a" />
<uni-easyinput
class="search-input flex1"
v-model="keyword"
placeholder="搜索网店名称/编号"
:inputBorder="false"
:styles="{ fontSize: '28rpx' }"
/>
</view>
<view class="btnAdd" @tap="addStore">+ 新增网店</view>
</view>
<view class="table bg24">
<view class="thead flex-center">
<view class="th w1">店名</view>
<view class="th w2">编号</view>
<view class="th w3">状态</view>
<view class="th w4">操作</view>
</view>
<view v-for="row in filteredList" :key="row.id" class="tr flex-center">
<view class="td w1 lineOne">{{ row.name }}</view>
<view class="td w2 c_999">{{ row.code }}</view>
<view class="td w3">
<view class="badge" :class="{ badgeOpen: row.status === 'open' }">
{{ row.status === 'open' ? '营业中' : '休息中' }}
</view>
</view>
<view class="td w4 flex-center ju-flex-end">
<view class="op opPrimary" @tap="edit(row)">编辑</view>
<view class="op opDanger" @tap="toggle(row)">{{ row.status === 'open' ? '停用' : '启用' }}</view>
</view>
</view>
<view v-if="filteredList.length === 0" class="empty c_999">暂无数据</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import { computed, ref } from 'vue';
import modeSwitch from '@/components/mode_switch/mode_switch.vue';
const stats = ref({
total: 28,
open: 24,
todayOrders: 156,
});
const keyword = ref('');
const list = ref([
{ id: 1, name: '虹桥枢纽自提站', code: 'SP-2024001', status: 'open' },
{ id: 2, name: '静安寺中心站', code: 'SP-2024002', status: 'open' },
{ id: 3, name: '徐家汇社区站', code: 'SP-2024003', status: 'rest' },
{ id: 4, name: '五角场站', code: 'SP-2024004', status: 'open' },
]);
const filteredList = computed(() => {
const k = String(keyword.value || '').trim();
if (!k) return list.value;
return list.value.filter((row) => String(row.name).includes(k) || String(row.code).includes(k));
});
const addStore = () => {
uni.showToast({ title: '功能开发中', icon: 'none' });
};
const edit = () => {
uni.showToast({ title: '功能开发中', icon: 'none' });
};
const toggle = (row) => {
row.status = row.status === 'open' ? 'rest' : 'open';
uni.showToast({ title: '已更新', icon: 'success' });
};
</script>
<style scoped lang="scss">
.page {
padding: 24rpx 24rpx 170rpx;
box-sizing: border-box;
}
.stats {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 16rpx;
margin-bottom: 18rpx;
}
.stat {
border-radius: 24rpx;
padding: 18rpx 18rpx 16rpx;
box-sizing: border-box;
}
.stat-value {
margin-top: 8rpx;
font-size: 44rpx;
font-weight: 800;
color: #222;
}
.cGreen {
color: #14a44d;
}
.cOrange {
color: #ff7a00;
}
.tool-row {
border-radius: 24rpx;
padding: 16rpx;
box-sizing: border-box;
display: flex;
align-items: center;
gap: 14rpx;
margin-bottom: 18rpx;
}
.search-box {
border-radius: 18rpx;
background: #f6f7fb;
padding: 6rpx 16rpx;
box-sizing: border-box;
}
:deep(.search-input .uni-easyinput__content) {
background: transparent !important;
}
.btnAdd {
padding: 14rpx 18rpx;
border-radius: 18rpx;
background: #2556ec;
color: #fff;
font-size: 24rpx;
flex-shrink: 0;
}
.table {
border-radius: 24rpx;
padding: 16rpx;
box-sizing: border-box;
}
.thead {
padding: 10rpx 0;
border-bottom: 2rpx solid #f1f2f6;
}
.tr {
padding: 18rpx 0;
border-bottom: 2rpx solid #f6f7fb;
}
.th,
.td {
font-size: 24rpx;
color: #333;
}
.w1 {
width: 34%;
}
.w2 {
width: 26%;
}
.w3 {
width: 18%;
display: flex;
align-items: center;
}
.w4 {
width: 22%;
}
.badge {
padding: 6rpx 12rpx;
border-radius: 999rpx;
font-size: 22rpx;
color: #ff7a00;
background: rgba(255, 122, 0, 0.12);
}
.badgeOpen {
color: #14a44d;
background: rgba(20, 164, 77, 0.12);
}
.op {
font-size: 24rpx;
margin-left: 14rpx;
}
.opPrimary {
color: #2556ec;
}
.opDanger {
color: #ff4d4f;
}
.empty {
text-align: center;
padding: 80rpx 0;
}
</style>