|
|
@@ -33,6 +33,21 @@
|
|
|
<span class="short-link" @click="openLinkFn(scope.row)">链接</span>
|
|
|
</template>
|
|
|
|
|
|
+ <template #table-column-inTurn="{scope}">
|
|
|
+ <span v-if="!scope.row._inTurn" @click="showSort(scope.row)">{{
|
|
|
+ scope.row.inTurn
|
|
|
+ }}</span>
|
|
|
+
|
|
|
+ <el-input-number
|
|
|
+ ref="sort-input"
|
|
|
+ focus
|
|
|
+ size="mini"
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.inTurn"
|
|
|
+ @blur="changeSort(scope.row)"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+
|
|
|
<!-- 添加商品 -->
|
|
|
<template #slot-add-goods-btn="{scope}">
|
|
|
<el-button type="primary" size="mini" @click="addFn">添加</el-button>
|
|
|
@@ -52,6 +67,28 @@
|
|
|
<template #slot-takeOff="{scope}">
|
|
|
<el-button type="text" @click="downFn(scope.row)">下架</el-button>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template #slot-category>
|
|
|
+ <el-select
|
|
|
+ v-model="selects.cId"
|
|
|
+ size="mini"
|
|
|
+ style="width: 200px;margin-right: 10px"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ @change="
|
|
|
+ cId => {
|
|
|
+ refresh({ cId });
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option label="全部" value="-1"></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in category"
|
|
|
+ :key="index"
|
|
|
+ :label="item.categoryName"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
</cl-crud>
|
|
|
<!-- 添加商品 -->
|
|
|
<el-dialog title="商品短链接:" :visible.sync="dialogFormVisible" width="40%">
|
|
|
@@ -67,6 +104,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapGetters } from 'vuex';
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -88,9 +127,13 @@ export default {
|
|
|
text: '下架',
|
|
|
key: '0'
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ selects: {}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['category'])
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleClick(tab, e) {
|
|
|
console.log(tab, e);
|
|
|
@@ -166,11 +209,6 @@ export default {
|
|
|
align: 'center',
|
|
|
'min-width': 180
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'inTurn',
|
|
|
- label: '顺序',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
{
|
|
|
prop: 'price',
|
|
|
label: '价格',
|
|
|
@@ -188,6 +226,12 @@ export default {
|
|
|
label: '浏览量',
|
|
|
align: 'center'
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'inTurn',
|
|
|
+ label: '排序',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 100
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'status',
|
|
|
label: '状态',
|
|
|
@@ -225,7 +269,7 @@ export default {
|
|
|
})
|
|
|
.set('layout', [
|
|
|
['slot-tabs'],
|
|
|
- ['search-key', 'flex1', 'slot-add-goods-btn', 'refresh-btn'],
|
|
|
+ ['slot-category', 'search-key', 'flex1', 'slot-add-goods-btn', 'refresh-btn'],
|
|
|
['data-table'],
|
|
|
['flex1', 'pagination']
|
|
|
])
|
|
|
@@ -236,6 +280,34 @@ export default {
|
|
|
})
|
|
|
.done();
|
|
|
app.refresh({ status: this.tabIndex });
|
|
|
+ },
|
|
|
+
|
|
|
+ refresh(params) {
|
|
|
+ this.app.refresh(params);
|
|
|
+ },
|
|
|
+
|
|
|
+ showSort(e) {
|
|
|
+ this.$set(e, '_inTurn', true);
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['sort-input'].focus();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ changeSort(d) {
|
|
|
+ d._inTurn = false;
|
|
|
+
|
|
|
+ this.$service.goods
|
|
|
+ .sort({
|
|
|
+ inTurn: d.inTurn,
|
|
|
+ id: d.id
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success('修改成功');
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.error(err);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|