|
|
@@ -28,10 +28,10 @@
|
|
|
<span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
|
|
|
</template>
|
|
|
|
|
|
-
|
|
|
+
|
|
|
<template #table-column-inTurn="{scope}">
|
|
|
<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="changeSort(scope.row)" ></el-input>
|
|
|
+ <el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row, 'inTurn')" ></el-input>
|
|
|
</template>
|
|
|
|
|
|
<template #table-header-inTurn>
|
|
|
@@ -45,18 +45,30 @@
|
|
|
|
|
|
<template #table-column-addPrice="{scope}">
|
|
|
<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.inTurn"></el-input>
|
|
|
+ <el-input style="width:50%;" ref="add-price-input" focus size="mini" v-else v-model="scope.row.addPrice" @blur="changeSort(scope.row, 'addPrice')" ></el-input>
|
|
|
</template>
|
|
|
|
|
|
<template #table-header-addPrice>
|
|
|
<div class="set-sort">
|
|
|
<span>每扎加价</span>
|
|
|
<el-button v-if="!canAddPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showAddPrice" class="show"></el-button>
|
|
|
- <el-button class="hide" v-else size="mini" @click="hideAddPrice" type="primary">完成</el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+ <template #table-header-cost>
|
|
|
+ <div class="set-sort">
|
|
|
+ <span>每扎成本价</span>
|
|
|
+ <el-button v-if="!costPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showCost" class="show"></el-button>
|
|
|
+ <el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
|
|
|
+
|
|
|
+ <template #table-column-cost="{scope}">
|
|
|
+ <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="changeSort(scope.row, 'cost')" ></el-input>
|
|
|
+ </template>
|
|
|
<template #slot-add-goods-btn>
|
|
|
<el-button type="primary" size="mini" @click="addFn()">添加</el-button>
|
|
|
</template>
|
|
|
@@ -92,14 +104,30 @@ export default {
|
|
|
status: false
|
|
|
},
|
|
|
canAddPrice:false,
|
|
|
+ costPrice: false,
|
|
|
classId: 0,
|
|
|
className:'',
|
|
|
showItemModal: false,
|
|
|
+ dataList: {
|
|
|
+ form: {
|
|
|
+ data: '',
|
|
|
+ type: ''
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ initData: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
},
|
|
|
methods: {
|
|
|
+ showCost() {
|
|
|
+ this.initData = []
|
|
|
+ this.costPrice = true
|
|
|
+ },
|
|
|
+ hideCost() {
|
|
|
+ this.costPrice = false
|
|
|
+ },
|
|
|
selectItemFn (currentItem) {
|
|
|
|
|
|
let item = currentItem.list
|
|
|
@@ -180,7 +208,7 @@ export default {
|
|
|
prop: 'cost',
|
|
|
label: '每扎成本价',
|
|
|
align: 'center',
|
|
|
- 'min-width': 90
|
|
|
+ 'min-width': 120
|
|
|
},
|
|
|
{
|
|
|
prop: 'addPrice',
|
|
|
@@ -254,32 +282,38 @@ export default {
|
|
|
this.app.refresh(params);
|
|
|
},
|
|
|
showAddPrice(){
|
|
|
+ this.initData = []
|
|
|
this.canAddPrice = true
|
|
|
},
|
|
|
- hideAddPrice(){
|
|
|
- this.canAddPrice = false
|
|
|
- },
|
|
|
showSort (e) {
|
|
|
+ this.initData = []
|
|
|
this.sort.status = true;
|
|
|
},
|
|
|
|
|
|
hideSort (e) {
|
|
|
+ this.dataList.form.data = JSON.stringify(this.initData)
|
|
|
+ this.$service.product.productBatchUpdate(this.dataList.form).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.$message.success('保存成功!');
|
|
|
+ }).catch(err => {console.log(err)})
|
|
|
this.sort.status = false;
|
|
|
+ this.canAddPrice = false
|
|
|
+ this.costPrice = false
|
|
|
},
|
|
|
|
|
|
- changeSort (d) {
|
|
|
- this.$service.goods
|
|
|
- .sort({
|
|
|
- inTurn: d.inTurn,
|
|
|
- id: d.id
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$message.success('修改成功');
|
|
|
- this.refresh();
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- this.$message.error(err);
|
|
|
- });
|
|
|
+ changeSort (d, type) {
|
|
|
+ this.dataList.form.type = type
|
|
|
+ let obj = {
|
|
|
+ id: d.id,
|
|
|
+ }
|
|
|
+ if(type == 'inTurn') {
|
|
|
+ obj.inTurn = d.inTurn
|
|
|
+ } else if(type == 'addPrice') {
|
|
|
+ obj.addPrice = d.addPrice
|
|
|
+ } else if(type == 'cost') {
|
|
|
+ obj.cost = d.cost
|
|
|
+ }
|
|
|
+ this.initData.push(obj)
|
|
|
}
|
|
|
}
|
|
|
};
|