From 8c5f4cd9ede5b9c5bdb8a3df8a1b3a296998f05e Mon Sep 17 00:00:00 2001 From: fanfan Date: Mon, 25 Mar 2024 20:22:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E4=BB=B7=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/goods/Index.vue | 100 ++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/src/views/goods/Index.vue b/src/views/goods/Index.vue index af2e48d..7f62205 100644 --- a/src/views/goods/Index.vue +++ b/src/views/goods/Index.vue @@ -19,6 +19,13 @@ v-decorator="['categoryId', { initialValue: 0 }]" > + + + + {{ item.name }} + + + 搜索 @@ -34,29 +41,21 @@ 已售罄 - 创建商品创建商品 批量导入批量导入
上架 - 下架下架 删除 @@ -89,20 +88,18 @@ class="cur-p" :color="text == 10 ? 'green' : 'red'" @click="handleUpdateStatus([item.goods_id], text != 10)" - >{{ text == 10 ? '上架' : '下架' }}{{ text == 10 ? '上架' : '下架' }}
- 编辑编辑 复制复制 删除
@@ -125,13 +122,13 @@ const columns = [ { title: '商品图片', dataIndex: 'goods_image', - scopedSlots: { customRender: 'goods_image' } + scopedSlots: { customRender: 'goods_image' }, }, { title: '商品名称', dataIndex: 'goods_name', width: '302px', - scopedSlots: { customRender: 'goods_name' } + scopedSlots: { customRender: 'goods_name' }, }, { title: '商品价格', @@ -158,12 +155,12 @@ const columns = [ { title: '状态', dataIndex: 'status', - scopedSlots: { customRender: 'status' } + scopedSlots: { customRender: 'status' }, }, { title: '排序', dataIndex: 'sort', - sorter: true, + sorter: true, }, { title: '添加时间', @@ -175,17 +172,17 @@ const columns = [ title: '操作', dataIndex: 'action', width: '150px', - scopedSlots: { customRender: 'action' } - } + scopedSlots: { customRender: 'action' }, + }, ] export default { name: 'Index', components: { ContentHeader, - STable + STable, }, - data () { + data() { return { // 当前表单元素 searchForm: this.$form.createForm(this), @@ -193,7 +190,8 @@ export default { categoryListTree: [], // 查询参数 queryParam: { - listType: 'all' + listType: 'all', + spec_type: '', }, // 正在加载 isLoading: false, @@ -221,10 +219,15 @@ export default { return GoodsApi.list(data).then((response) => { return response.data.list }) - } + }, + specsType: [ + { name: '全部', val: '' }, + { name: '单规格', val: 10 }, + { name: '多规格', val: 20 }, + ], } }, - created () { + created() { // 默认的查询参数 if (this.$route.query.listType) { this.queryParam.listType = this.$route.query.listType @@ -233,27 +236,30 @@ export default { this.getCategoryList() }, computed: { - rowSelection () { + rowSelection() { return { selectedRowKeys: this.selectedRowKeys, - onChange: this.onSelectChange + onChange: this.onSelectChange, } - } + }, }, methods: { + onchangeSpecs(val) { + this.queryParam.spec_type = val + }, // 选中项发生变化时的回调 - onSelectChange (selectedRowKeys) { + onSelectChange(selectedRowKeys) { this.selectedRowKeys = selectedRowKeys }, // 切换tab - handleTabs (e) { + handleTabs(e) { this.queryParam.listType = e.target.value this.handleRefresh(true) }, // 确认搜索 - handleSearch (e) { + handleSearch(e) { e.preventDefault() this.searchForm.validateFields((error, values) => { if (!error) { @@ -264,12 +270,12 @@ export default { }, // 重置搜索表单 - handleReset () { + handleReset() { this.searchForm.resetFields() }, // 获取分类列表 - getCategoryList () { + getCategoryList() { this.isLoading = true CategoryModel.getListFromScreen() .then((selectList) => { @@ -279,7 +285,7 @@ export default { }, // 修改商品状态(上下架) - handleUpdateStatus (goodsIds, state = true) { + handleUpdateStatus(goodsIds, state = true) { if (!this.$auth('/goods/index.status')) { return false } @@ -296,29 +302,29 @@ export default { }, // 删除记录 - handleDelete (goodsIds) { + handleDelete(goodsIds) { const app = this const modal = this.$confirm({ title: '您确定要删除该记录吗?', content: '删除后不可恢复', - onOk () { + onOk() { return GoodsApi.deleted({ goodsIds }) .then((result) => { app.$message.success(result.message, 1.5) app.handleRefresh() }) .finally((result) => modal.destroy()) - } + }, }) }, // 新增记录 - handleCreate () { + handleCreate() { this.$router.push('/goods/create') }, // 批量导入 - handleImport () { + handleImport() { this.$router.push('/goods/import/batch') }, @@ -326,11 +332,11 @@ export default { * 刷新列表 * @param Boolean bool 强制刷新到第一页 */ - handleRefresh (bool = false) { + handleRefresh(bool = false) { this.selectedRowKeys = [] this.$refs.table.refresh(bool) - } - } + }, + }, }