feat(GoodsStock.vue): 商品上架库存页面升级调整

This commit is contained in:
郝先瑞
2022-01-12 00:23:41 +08:00
parent 56ffda6e31
commit e215894064
2 changed files with 40 additions and 25 deletions

View File

@@ -4,7 +4,13 @@
<el-card class="box-card"> <el-card class="box-card">
<template #header> <template #header>
<span>商品规格</span> <span>商品规格</span>
<el-button style="float: right;" type="primary" size="mini" @click="handleSpecAdd"> <el-button
:icon="Plus"
type="success"
@click="handleSpecAdd"
size="mini"
style="float: right;"
>
添加规格项 添加规格项
</el-button> </el-button>
</template> </template>
@@ -48,26 +54,35 @@
</template> </template>
<template #default="scope"> <template #default="scope">
<div style="margin-right:15px;display: inline-block" v-for="item in scope.row.values"> <div v-for="item in scope.row.values"
style="margin-right:15px;display: inline-block"
>
<el-tag <el-tag
size="small"
closable closable
:type="colors[scope.row.index%colors.length]" :type="colors[scope.$index%colors.length]"
@close="handleSpecValueRemove(scope.row.index,item.id)"> @close="handleSpecValueRemove(scope.$index,item.id)"
>
{{ item.value }} {{ item.value }}
</el-tag> </el-tag>
<mini-card-upload v-if="scope.row.index==0" style="margin-top: 5px" v-model="item.picUrl"/> <single-upload
v-model="item.picUrl"
v-if="scope.$index==0"
style="margin-top: 5px"
/>
</div> </div>
<el-input <el-input
v-if="tagInputs[scope.row.index].visible" v-if="tagInputs[scope.$index].visible"
v-model="tagInputs[scope.row.index].value" v-model="tagInputs[scope.$index].value"
@keyup.enter.native="handleSpecValueInput(scope.row.index)" @keyup.enter.native="handleSpecValueInput(scope.$index)"
@blur="handleSpecValueInput(scope.row.index)" @blur="handleSpecValueInput(scope.$index)"
style="width: 80px;vertical-align: top" style="width: 80px;vertical-align: top"
size="mini" size="mini"
/> />
<el-button <el-button
v-else v-else
@click="handleSpecValueAdd(scope.row.index)" @click="handleSpecValueAdd(scope.$index)"
:icon="Plus" :icon="Plus"
style="vertical-align: top" style="vertical-align: top"
size="mini" size="mini"
@@ -81,7 +96,7 @@
<template #default="scope"> <template #default="scope">
<el-button <el-button
type="danger" type="danger"
icon="el-icon-delete" :icon="Minus"
size="mini" size="mini"
circle circle
plain plain
@@ -158,12 +173,12 @@
<script setup lang="ts"> <script setup lang="ts">
import {listAttributes} from "@/api/pms/attribute"; import {listAttributes} from "@/api/pms/attribute";
import MiniCardUpload from '@/components/Upload/MiniCardUpload.vue' import SingleUpload from '@/components/Upload/SingleUpload.vue'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import {addGoods, updateGoods} from "@/api/pms/goods"; import {addGoods, updateGoods} from "@/api/pms/goods";
import {computed, getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs, unref, watch} from "vue"; import {computed, getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs, unref, watch} from "vue";
import {ElMessage, ElTable, ElForm} from "element-plus" import {ElMessage, ElTable, ElForm} from "element-plus"
import {Plus} from '@element-plus/icons' import {Plus, Minus} from '@element-plus/icons'
import SvgIcon from '@/components/SvgIcon/index.vue' import SvgIcon from '@/components/SvgIcon/index.vue'
import {useRouter} from "vue-router"; import {useRouter} from "vue-router";
@@ -187,7 +202,7 @@ const categoryId = computed(() => props.modelValue.categoryId);
const state = reactive({ const state = reactive({
specForm: { specForm: {
specList: [] as Array<any>, specList: [{}] as Array<any>,
}, },
skuForm: { skuForm: {
skuList: [] skuList: []
@@ -274,7 +289,6 @@ function loadData() {
nextTick(() => { nextTick(() => {
registerSpecDragSortEvent() registerSpecDragSortEvent()
}) })
console.log('tagInputs',tagInputs)
} }
} }
@@ -545,7 +559,6 @@ function submitForm() {
}) })
} }
function openFullScreen() { function openFullScreen() {
state.loading = proxy.$loading({ state.loading = proxy.$loading({
lock: true, lock: true,

View File

@@ -1,41 +1,43 @@
<template> <template>
<div class="components-container"> <div class="components-container">
<el-steps :active="active" process-status="finish" finish-status="success" simple> <el-steps :active="active" process-status="finish" finish-status="success" simple>
<el-step title="选择商品分类"></el-step> <el-step title="选择商品分类"></el-step>
<el-step title="填写商品信息"></el-step> <el-step title="填写商品信息"></el-step>
<el-step title="设置商品属性"></el-step> <el-step title="设置商品属性"></el-step>
<el-step title="设置商品库存"></el-step> <el-step title="设置商品库存"></el-step>
</el-steps> </el-steps>
<goods-category <goods-category
v-show="active==0" v-show="active==0"
v-model="goods" v-model="goods"
v-if="loaded==true" v-if="loaded==true"
@prev="prev" @prev="prev"
@next="next"> @next="next"
</goods-category> />
<goods-info <goods-info
v-show="active==1" v-show="active==1"
v-model="goods" v-model="goods"
v-if="loaded==true" v-if="loaded==true"
@prev="prev" @prev="prev"
@next="next"> @next="next"
</goods-info> />
<goods-attribute <goods-attribute
v-show="active==2" v-show="active==2"
v-model="goods" v-model="goods"
v-if="loaded==true" v-if="loaded==true"
@prev="prev" @prev="prev"
@next="next"> @next="next"
</goods-attribute> />
<goods-stock <goods-stock
v-show="active==3" v-show="active==3"
v-model="goods" v-model="goods"
v-if="loaded==true" v-if="loaded==true"
@prev="prev" @prev="prev"
@next="next"> @next="next"
</goods-stock> />
</div> </div>
</template> </template>