|
@@ -8,14 +8,14 @@
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template #table-column-cover="{ scope }">
|
|
|
|
|
- <cl-avatar
|
|
|
|
|
- shape="square"
|
|
|
|
|
- :size="32"
|
|
|
|
|
- :src="scope.row.cover"
|
|
|
|
|
- :style="{ margin: 'auto' }"
|
|
|
|
|
- ></cl-avatar>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <template #table-column-cover="{ scope }">
|
|
|
|
|
+ <cl-avatar
|
|
|
|
|
+ shape="square"
|
|
|
|
|
+ :size="32"
|
|
|
|
|
+ :src="scope.row.cover"
|
|
|
|
|
+ :style="{ margin: 'auto' }"
|
|
|
|
|
+ ></cl-avatar>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
<template #table-column-goodsName="{scope}">
|
|
<template #table-column-goodsName="{scope}">
|
|
|
<span>{{ scope.row.goodsName }}</span>
|
|
<span>{{ scope.row.goodsName }}</span>
|
|
@@ -25,20 +25,36 @@
|
|
|
<span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
|
|
<span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template #table-column-price="{scope}">
|
|
|
|
|
+ <span v-if="!priceInput"><span>{{ scope.row.price}}</span></span>
|
|
|
|
|
+ <el-input style="width:80%;" ref="sort-input" focus size="mini" v-else placeholder="" v-model="scope.row.price" @blur="changeInputValue(scope.row, 'price')" ></el-input>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #table-header-price>
|
|
|
|
|
+ <div class="set-sort">
|
|
|
|
|
+ <span>售价</span>
|
|
|
|
|
+ <el-button v-if="!priceInput" icon="el-icon-edit-outline" size="small" type="text" @click="showPriceInput" class="show"></el-button>
|
|
|
|
|
+ <el-button class="hide" v-else size="mini" @click="commitChange('price')" type="primary">完成</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
<template #table-column-inTurn="{scope}">
|
|
<template #table-column-inTurn="{scope}">
|
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
- <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeValue(scope.row, 'inTurn')" ></el-input>
|
|
|
|
|
|
|
+ <el-input style="width:80%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeInputValue(scope.row, 'inTurn')" ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #table-header-inTurn>
|
|
<template #table-header-inTurn>
|
|
|
<div class="set-sort">
|
|
<div class="set-sort">
|
|
|
<span>排序</span>
|
|
<span>排序</span>
|
|
|
- <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show"></el-button>
|
|
|
|
|
|
|
+ <el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showInTurn" class="show"></el-button>
|
|
|
<el-button class="hide" v-else size="mini" @click="commitChange('inTurn')" type="primary">完成</el-button>
|
|
<el-button class="hide" v-else size="mini" @click="commitChange('inTurn')" type="primary">完成</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template #table-column-prePrice="{scope}">
|
|
|
|
|
+ <span>{{ (scope.row.prePrice)}}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<template #slot-modify="{ scope }">
|
|
<template #slot-modify="{ scope }">
|
|
|
<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id,1)" >修改</el-button>
|
|
<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id,1)" >修改</el-button>
|
|
|
<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setStatusFun(scope.row.id,0)" >上架</el-button>
|
|
<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setStatusFun(scope.row.id,0)" >上架</el-button>
|
|
@@ -54,7 +70,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-column-cost="{scope}">
|
|
<template #table-column-cost="{scope}">
|
|
|
<span v-if="!costPrice">{{ scope.row.cost }}</span>
|
|
<span v-if="!costPrice">{{ scope.row.cost }}</span>
|
|
|
- <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.cost" @blur="changeValue(scope.row, 'cost')" ></el-input>
|
|
|
|
|
|
|
+ <el-input style="width:80%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.cost" @blur="changeInputValue(scope.row, 'cost')" ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-header-addPrice="{scope}">
|
|
<template #table-header-addPrice="{scope}">
|
|
|
<div class="set-sort">
|
|
<div class="set-sort">
|
|
@@ -66,10 +82,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-column-addPrice="{scope}">
|
|
<template #table-column-addPrice="{scope}">
|
|
|
<span v-if="!canAddPrice">{{ scope.row.addPrice }}</span>
|
|
<span v-if="!canAddPrice">{{ scope.row.addPrice }}</span>
|
|
|
- <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.addPrice" @blur="changeValue(scope.row, 'addPrice')" ></el-input>
|
|
|
|
|
|
|
+ <el-input style="width:80%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.addPrice" @blur="changeInputValue(scope.row, 'addPrice')" ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template #table-header-ratio="{scope}">
|
|
|
|
|
|
|
+ <template #table-header-ratio>
|
|
|
<div class="set-sort">
|
|
<div class="set-sort">
|
|
|
<span>单位比</span>
|
|
<span>单位比</span>
|
|
|
<el-button v-if="!canAddRatio" icon="el-icon-edit-outline" size="small" type="text" @click="showAddRatio" class="show"></el-button>
|
|
<el-button v-if="!canAddRatio" icon="el-icon-edit-outline" size="small" type="text" @click="showAddRatio" class="show"></el-button>
|
|
@@ -78,7 +94,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-column-ratio="{scope}">
|
|
<template #table-column-ratio="{scope}">
|
|
|
<span v-if="!canAddRatio">{{ scope.row.ratio }}</span>
|
|
<span v-if="!canAddRatio">{{ scope.row.ratio }}</span>
|
|
|
- <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.ratio" @blur="changeValue(scope.row, 'ratio')" ></el-input>
|
|
|
|
|
|
|
+ <el-input style="width:80%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.ratio" @blur="changeInputValue(scope.row, 'ratio')" ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #table-header-weight>
|
|
<template #table-header-weight>
|
|
@@ -90,7 +106,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-column-weight="{scope}">
|
|
<template #table-column-weight="{scope}">
|
|
|
<span v-if="!costWeight">{{ scope.row.weight }}</span>
|
|
<span v-if="!costWeight">{{ scope.row.weight }}</span>
|
|
|
- <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeValue(scope.row, 'weight')"></el-input>
|
|
|
|
|
|
|
+ <el-input style="width:80%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.weight" @blur="changeInputValue(scope.row, 'weight')"></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
<template #table-column-delStatus="{scope}">
|
|
<template #table-column-delStatus="{scope}">
|
|
|
<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
|
|
<span>{{ scope.row.delStatus==0?'上架':'下架' }}</span>
|
|
@@ -242,7 +258,6 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
-import { mapGetters } from 'vuex';
|
|
|
|
|
import itemListLayer from '@/components/module/item-list-layer';
|
|
import itemListLayer from '@/components/module/item-list-layer';
|
|
|
export default {
|
|
export default {
|
|
|
name: 'item_list',
|
|
name: 'item_list',
|
|
@@ -272,6 +287,7 @@ export default {
|
|
|
canAddRatio:false,
|
|
canAddRatio:false,
|
|
|
costPrice: false,
|
|
costPrice: false,
|
|
|
costWeight: false,
|
|
costWeight: false,
|
|
|
|
|
+ priceInput:false,
|
|
|
classId: 0,
|
|
classId: 0,
|
|
|
className:'',
|
|
className:'',
|
|
|
showItemModal: false,
|
|
showItemModal: false,
|
|
@@ -352,11 +368,12 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
showCost() {
|
|
showCost() {
|
|
|
- this.initData = []
|
|
|
|
|
- this.costPrice = true
|
|
|
|
|
- },
|
|
|
|
|
- hideCost() {
|
|
|
|
|
- this.costPrice = false
|
|
|
|
|
|
|
+ this.initData = []
|
|
|
|
|
+ this.costPrice = true
|
|
|
|
|
+ this.priceInput = false;
|
|
|
|
|
+ this.sort.status = false;
|
|
|
|
|
+ this.canAddRatio = false;
|
|
|
|
|
+ this.costWeight = false;
|
|
|
},
|
|
},
|
|
|
selectItemFn (currentItem) {
|
|
selectItemFn (currentItem) {
|
|
|
|
|
|
|
@@ -483,25 +500,13 @@ export default {
|
|
|
prop: 'name',
|
|
prop: 'name',
|
|
|
label: '名称',
|
|
label: '名称',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- 'min-width': 180
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'className',
|
|
|
|
|
- label: '分类',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- 'min-width': 80
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'stockWarning',
|
|
|
|
|
- label: '库存预警',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- 'min-width': 80
|
|
|
|
|
|
|
+ 'min-width': 160
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
prop: 'cost',
|
|
prop: 'cost',
|
|
|
label: '每扎成本价',
|
|
label: '每扎成本价',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- 'min-width': 150
|
|
|
|
|
|
|
+ 'min-width': 140
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
prop: 'addPrice',
|
|
prop: 'addPrice',
|
|
@@ -510,10 +515,16 @@ export default {
|
|
|
'min-width': 150
|
|
'min-width': 150
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'weight',
|
|
|
|
|
- label: '重量(公斤)',
|
|
|
|
|
|
|
+ prop: 'prePrice',
|
|
|
|
|
+ label: '原价',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- 'min-width': 130
|
|
|
|
|
|
|
+ minWidth: 80
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'price',
|
|
|
|
|
+ label: '售价',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth:140
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
prop: 'unit',
|
|
prop: 'unit',
|
|
@@ -527,6 +538,12 @@ export default {
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
'min-width': 110
|
|
'min-width': 110
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'weight',
|
|
|
|
|
+ label: '重量(公斤)',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ 'min-width': 130
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
prop: 'inTurn',
|
|
prop: 'inTurn',
|
|
|
label: '排序',
|
|
label: '排序',
|
|
@@ -534,15 +551,22 @@ export default {
|
|
|
minWidth: 130
|
|
minWidth: 130
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'addTime',
|
|
|
|
|
- label: '创建时间',
|
|
|
|
|
|
|
+ prop: 'className',
|
|
|
|
|
+ label: '分类',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ 'min-width': 70
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'stockWarning',
|
|
|
|
|
+ label: '库存预警',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- minWidth: 140
|
|
|
|
|
- },{
|
|
|
|
|
|
|
+ 'min-width': 75
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
prop: 'delStatus',
|
|
prop: 'delStatus',
|
|
|
label: '状态',
|
|
label: '状态',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- minWidth: 100
|
|
|
|
|
|
|
+ minWidth: 70
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
op: {
|
|
op: {
|
|
@@ -566,6 +590,9 @@ export default {
|
|
|
placeholder: '分类名称'
|
|
placeholder: '分类名称'
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ .set('pagination', {
|
|
|
|
|
+ size: 50
|
|
|
|
|
+ })
|
|
|
.set('layout', [
|
|
.set('layout', [
|
|
|
['slot-tabs'],
|
|
['slot-tabs'],
|
|
|
['search-key'],
|
|
['search-key'],
|
|
@@ -590,7 +617,8 @@ export default {
|
|
|
},
|
|
},
|
|
|
showAddPrice(){
|
|
showAddPrice(){
|
|
|
this.initData = []
|
|
this.initData = []
|
|
|
- this.canAddPrice = true
|
|
|
|
|
|
|
+ this.canAddPrice = true;
|
|
|
|
|
+ this.priceInput = false;
|
|
|
this.sort.status = false;
|
|
this.sort.status = false;
|
|
|
this.costPrice = false;
|
|
this.costPrice = false;
|
|
|
this.canAddRatio = false;
|
|
this.canAddRatio = false;
|
|
@@ -598,7 +626,8 @@ export default {
|
|
|
},
|
|
},
|
|
|
showAddRatio(){
|
|
showAddRatio(){
|
|
|
this.initData = []
|
|
this.initData = []
|
|
|
- this.canAddRatio = true
|
|
|
|
|
|
|
+ this.canAddRatio = true;
|
|
|
|
|
+ this.priceInput = false;
|
|
|
this.sort.status = false;
|
|
this.sort.status = false;
|
|
|
this.costPrice = false;
|
|
this.costPrice = false;
|
|
|
this.canAddPrice = false;
|
|
this.canAddPrice = false;
|
|
@@ -607,22 +636,31 @@ export default {
|
|
|
showWeight(){
|
|
showWeight(){
|
|
|
this.initData = []
|
|
this.initData = []
|
|
|
this.costWeight = true
|
|
this.costWeight = true
|
|
|
|
|
+ this.priceInput = false;
|
|
|
this.sort.status = false;
|
|
this.sort.status = false;
|
|
|
this.costPrice = false;
|
|
this.costPrice = false;
|
|
|
this.canAddPrice = false;
|
|
this.canAddPrice = false;
|
|
|
this.canAddRatio = false;
|
|
this.canAddRatio = false;
|
|
|
},
|
|
},
|
|
|
- showSort (e) {
|
|
|
|
|
|
|
+ showInTurn (e) {
|
|
|
this.initData = []
|
|
this.initData = []
|
|
|
this.sort.status = true;
|
|
this.sort.status = true;
|
|
|
|
|
+ this.priceInput = false;
|
|
|
this.costPrice = false;
|
|
this.costPrice = false;
|
|
|
this.canAddPrice = false;
|
|
this.canAddPrice = false;
|
|
|
this.canAddRatio = false;
|
|
this.canAddRatio = false;
|
|
|
this.costWeight = false;
|
|
this.costWeight = false;
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- commitChange (type) {
|
|
|
|
|
- if(this.$util.isEmpty(this.initData)){
|
|
|
|
|
|
|
+ showPriceInput(e){
|
|
|
|
|
+ this.initData = []
|
|
|
|
|
+ this.priceInput = true;
|
|
|
|
|
+ this.sort.status = false;
|
|
|
|
|
+ this.costPrice = false;
|
|
|
|
|
+ this.canAddPrice = false;
|
|
|
|
|
+ this.canAddRatio = false;
|
|
|
|
|
+ this.costWeight = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ hiddenInput(type){
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case 'inTurn':
|
|
case 'inTurn':
|
|
|
this.sort.status = false;
|
|
this.sort.status = false;
|
|
@@ -639,39 +677,43 @@ export default {
|
|
|
case 'weight':
|
|
case 'weight':
|
|
|
this.costWeight = false;
|
|
this.costWeight = false;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'price':
|
|
|
|
|
+ this.priceInput = false;
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ commitChange (type) {
|
|
|
|
|
+
|
|
|
|
|
+ if(this.$util.isEmpty(this.initData)){
|
|
|
|
|
+ this.$message.error('没有修改');
|
|
|
|
|
+ this.hiddenInput(type)
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: '处理中'
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
this.dataList.form.data = JSON.stringify(this.initData)
|
|
this.dataList.form.data = JSON.stringify(this.initData)
|
|
|
this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
|
|
this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
|
|
|
- console.log(res)
|
|
|
|
|
- this.$message.success('保存成功!');
|
|
|
|
|
- this.app.refresh()
|
|
|
|
|
- }).catch(err => {console.log(err)})
|
|
|
|
|
- switch (type) {
|
|
|
|
|
- case 'inTurn':
|
|
|
|
|
- this.sort.status = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'cost':
|
|
|
|
|
- this.costPrice = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'addPrice':
|
|
|
|
|
- this.canAddPrice = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'ratio':
|
|
|
|
|
- this.canAddRatio = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'weight':
|
|
|
|
|
- this.costWeight = false;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ loading.close();
|
|
|
|
|
+
|
|
|
|
|
+ this.hiddenInput(type)
|
|
|
|
|
+
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.hiddenInput(type)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
replaceBtnFn(id) {
|
|
replaceBtnFn(id) {
|
|
|
this.getAllClass()
|
|
this.getAllClass()
|
|
|
this.getAllUnit()
|
|
this.getAllUnit()
|
|
|
this.addDialog = true
|
|
this.addDialog = true
|
|
|
this.currentItemId = id;
|
|
this.currentItemId = id;
|
|
|
-
|
|
|
|
|
if(id==0){
|
|
if(id==0){
|
|
|
this.replaceFormRules = {};
|
|
this.replaceFormRules = {};
|
|
|
this.replaceForm = {
|
|
this.replaceForm = {
|
|
@@ -773,7 +815,7 @@ export default {
|
|
|
this.batchAddPrice='';
|
|
this.batchAddPrice='';
|
|
|
this.dialogFormVisible = true;
|
|
this.dialogFormVisible = true;
|
|
|
},
|
|
},
|
|
|
- changeValue (d, type) {
|
|
|
|
|
|
|
+ changeInputValue (d, type) {
|
|
|
this.dataList.form.type = type
|
|
this.dataList.form.type = type
|
|
|
let obj = {
|
|
let obj = {
|
|
|
id: d.id,
|
|
id: d.id,
|
|
@@ -788,6 +830,8 @@ export default {
|
|
|
obj.weight = d.weight
|
|
obj.weight = d.weight
|
|
|
}else if(type == 'ratio') {
|
|
}else if(type == 'ratio') {
|
|
|
obj.ratio = d.ratio
|
|
obj.ratio = d.ratio
|
|
|
|
|
+ }else if(type == 'price') {
|
|
|
|
|
+ obj.price = d.price
|
|
|
}
|
|
}
|
|
|
this.initData.push(obj)
|
|
this.initData.push(obj)
|
|
|
}
|
|
}
|