1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<template>
<div class="good-page">
<div class="good-search" v-if="!isShowGoods">
<div>
<a-radio-group v-model:value="status">
<a-radio-button value="0" class="status" @search="onSearch">全部</a-radio-button>
<a-radio-button value="1" class="status" @search="onSearch">正常</a-radio-button>
<a-radio-button value="2" class="status" @search="onSearch">已下架</a-radio-button>
</a-radio-group>
<a-input-search v-model:value="value" placeholder="input search text" style="width: 200px; margin-left: 10px"
@search="onSearch" />
</div>
<div class="good-cad">
<a-button type="primary" class="mr10" @click="onGoods(0)">新建商品</a-button>
<a-button type="primary" @click="onGoods(1)">新建商品包</a-button>
</div>
</div>
<div class="goods-list" v-if="!isShowGoods">
<a-table :columns="columns" :data-source="list">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'tags'">
<a-button type="primary">编辑</a-button>
<a-button type="primary" style="margin-left:20px;">统计</a-button>
<a-button type="primary" style="margin-left:20px;">下架</a-button>
<a-button type="primary" style="margin-left:20px;">删除</a-button>
</template>
</template>
</a-table>
</div>
<div v-if="isShowGoods">
<div style="display: flex; align-items: center; justify-content: space-between" v-if="isShowGoods">
<a-button class="small left" @click="onBack">
<template #icon>
<LeftOutlined />
</template>
</a-button>
</div>
<GoodsBags :props="{ propsData }" v-if="propsData.isCad == 0"></GoodsBags>
<GoodsBagSubs :props="{ propsData }" v-else> </GoodsBagSubs>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, onMounted } from "vue";
import { LeftOutlined } from "@ant-design/icons-vue";
import GoodsBags from "./components/goods/index.vue";
import GoodsBagSubs from "./components/goodsubs/index.vue";
import { onSelectGoods,onfindby } from '@/api/index'
import { getUid } from "@/utils/userInfo";
const columns = [
{
title: "商品编号",
dataIndex: "goodsid",
key: "goodsid",
},
{
title: "商品名称",
dataIndex: "shortname",
key: "shortname",
},
{
title: "商品类型",
dataIndex: "sellingmodel",
key: "sellingmodel",
},
{
title: "商品售卖数",
key: "markingprice",
dataIndex: "markingprice",
},
{
title: "默认金额售卖数",
key: "price",
dataIndex: "price",
},
{
title: "已售金额",
key: "price",
dataIndex: "price",
},
{
title: "商品状态",
key: "status",
dataIndex: "status",
},
{
title: "操作",
key: "tags",
dataIndex: "tags",
},
];
interface props {
isCad: Number;
}
const list = ref<Array<Object>>([])
const value = ref<string>("");
const status = ref<string>("0")
const propsData = reactive<props>({
isCad: 0,
});
const isShowGoods = ref<Boolean>(false);
const onSearch = async() => {
const params = {
status:status.value,
name:value.value,
uid:getUid()
}
const data = await onfindby(params)
console.log(data,'data');
};
const onGoods = (e: Number) => {
propsData.isCad = e;
isShowGoods.value = true;
};
const onBack = (e: Number) => {
isShowGoods.value = false;
};
onMounted(async () => {
const uid = getUid()
const data = await onSelectGoods(uid)
list.value = data.data
return list
})
defineExpose({
status,
value,
columns,
isShowGoods,
propsData,
onBack,
onSearch,
onGoods,
});
</script>
<style lang="less" scoped>
.good-page {
.good-search {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.status{
margin-right: 20px;
width: 80px;
border-radius: 5px;
border: 1px solid rgba(0, 0, 0, 0.65);
}
.status::before{
display: none;
}
.ant-radio-button-wrapper-checked{
border: 1px solid @primary-color;
}
.ood-cad {
width: 100%;
}
.ml10 {
margin-left: 10px;
}
.mr10 {
margin-right: 10px;
}
}
.goods-list {
margin-top: 10px;
}
.small {
border: none;
height: 30px;
width: 50px;
}
.left {
border-left: 1px solid rgb(236, 236, 236);
border-top: 1px solid rgb(236, 236, 236);
border-bottom: 1px solid rgb(236, 236, 236);
border-right-width: 80%;
border-right: 1px solid rgb(236, 236, 236);
border-bottom-left-radius: 25px;
border-top-left-radius: 25px;
}
}
</style>
<style lang="less">
.ant-layout-content{
overflow-y: scroll;
}
</style>