|
|
@@ -58,6 +58,13 @@
|
|
|
label="销量"
|
|
|
></el-table-column>
|
|
|
|
|
|
+ <el-table-column
|
|
|
+ prop="sort"
|
|
|
+ label="排序号"
|
|
|
+ width="100"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+
|
|
|
<el-table-column
|
|
|
prop="isShow"
|
|
|
label="显示状态"
|
|
|
@@ -111,6 +118,12 @@
|
|
|
style="color: #0066FF;"
|
|
|
@click="handleGoodSale(scope.row)"
|
|
|
>调整销量</el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ style="color: #0066FF;"
|
|
|
+ @click="handleGoodSort(scope.row)"
|
|
|
+ >修改排序</el-button>
|
|
|
<el-button
|
|
|
type="text"
|
|
|
size="small"
|
|
|
@@ -251,6 +264,31 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <el-dialog
|
|
|
+ title="修改排序"
|
|
|
+ :visible.sync="sortDialogVisible"
|
|
|
+ width="400px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ >
|
|
|
+ <el-form :model="sortForm" ref="sortForm" :rules="sortRules">
|
|
|
+ <el-form-item label="排序号" prop="sort">
|
|
|
+ <el-input-number
|
|
|
+ v-model="sortForm.sort"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ controls-position="right"
|
|
|
+ style="width: 100%;"
|
|
|
+ ></el-input-number>
|
|
|
+ <div style="color: #909399; font-size: 12px; margin-top: 5px;">数字越小,排序越靠前</div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="sortDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmSortChange">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -287,6 +325,7 @@ export default {
|
|
|
socket: null,
|
|
|
stockDialogVisible: false,
|
|
|
salesDialogVisible: false,
|
|
|
+ sortDialogVisible: false,
|
|
|
stockForm: {
|
|
|
goodsId: '',
|
|
|
stock: 0
|
|
|
@@ -296,6 +335,10 @@ export default {
|
|
|
sales: 0,
|
|
|
productId: 0,
|
|
|
},
|
|
|
+ sortForm: {
|
|
|
+ goodsId: '',
|
|
|
+ sort: 0
|
|
|
+ },
|
|
|
stockRules: {
|
|
|
stock: [
|
|
|
{ required: true, message: '请输入库存数量', trigger: 'blur' },
|
|
|
@@ -307,6 +350,12 @@ export default {
|
|
|
{ required: true, message: '请输入销量数量', trigger: 'blur' },
|
|
|
{ type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
|
|
|
]
|
|
|
+ },
|
|
|
+ sortRules: {
|
|
|
+ sort: [
|
|
|
+ { required: true, message: '请输入排序号', trigger: 'blur' },
|
|
|
+ { type: 'number', min: 0, message: '排序号不能小于0', trigger: 'blur' }
|
|
|
+ ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
@@ -529,6 +578,11 @@ export default {
|
|
|
this.salesForm.productId = row.productId;
|
|
|
this.salesDialogVisible = true;
|
|
|
},
|
|
|
+ handleGoodSort(row){
|
|
|
+ this.sortForm.goodsId = row.goodsId;
|
|
|
+ this.sortForm.sort = row.sort || 0;
|
|
|
+ this.sortDialogVisible = true;
|
|
|
+ },
|
|
|
// 添加确认修改库存方法
|
|
|
confirmStockChange() {
|
|
|
this.$refs.stockForm.validate((valid) => {
|
|
|
@@ -568,6 +622,25 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 添加确认修改排序方法
|
|
|
+ confirmSortChange() {
|
|
|
+ this.$refs.sortForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ updateLiveGoods({
|
|
|
+ goodsId: this.sortForm.goodsId,
|
|
|
+ sort: this.sortForm.sort
|
|
|
+ }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.$message.success('排序修改成功');
|
|
|
+ this.sortDialogVisible = false;
|
|
|
+ this.getLiveGoodsList(); // 重新获取列表数据
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '排序修改失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
}
|
|
|
};
|