|
@@ -134,6 +134,11 @@
|
|
|
<p>{{ scope.row.createTime }}</p>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="onUpdate(scope.row)" :disabled="scope.row.internalSaleStock != 0 ||scope.row.taxSaleStock != 0">修改</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="pagination-container">
|
|
@@ -150,7 +155,7 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
- title="新增入库"
|
|
|
+ :title="type == 'create' ? '新增入库' : '修改入库'"
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="40%"
|
|
|
>
|
|
@@ -189,7 +194,7 @@
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="handleClose">取 消</el-button>
|
|
|
- <el-button type="primary" @click="handleConfirm('productAttrCatForm')"
|
|
|
+ <el-button type="primary" :disabled="loading" v-loading="loading" @click="handleConfirm('productAttrCatForm')"
|
|
|
>确 定</el-button
|
|
|
>
|
|
|
</span>
|
|
@@ -218,6 +223,7 @@ export default {
|
|
|
name: "productList",
|
|
|
data() {
|
|
|
return {
|
|
|
+ type: 'create',
|
|
|
dialogVisible: false,
|
|
|
editSkuInfo: {
|
|
|
productId: null,
|
|
@@ -234,6 +240,7 @@ export default {
|
|
|
price: [{ required: true, message: '请输入采购价', trigger: 'blur' }],
|
|
|
productSkuId: [{ required: true, message: '请选择Sku', trigger: 'change, blur' }],
|
|
|
},
|
|
|
+ loading: false,
|
|
|
stockList: [],
|
|
|
productId: null,
|
|
|
listQuery: Object.assign({}, defaultListQuery),
|
|
@@ -270,15 +277,18 @@ export default {
|
|
|
...this.editSkuInfo,
|
|
|
productId: this.productId,
|
|
|
}
|
|
|
+ this.loading = true
|
|
|
getProductSkuStockRecordCreate(obj).then(response=>{
|
|
|
this.$message({
|
|
|
- message: '添加成功',
|
|
|
+ message: this.type == 'create' ? '添加成功' : '修改成功',
|
|
|
type: 'success',
|
|
|
duration:1000
|
|
|
});
|
|
|
this.dialogVisible = false;
|
|
|
this.handleClose()
|
|
|
this.getList();
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
});
|
|
|
} else {
|
|
|
console.log('error submit!!');
|
|
@@ -287,6 +297,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
handleClose(){
|
|
|
+ this.dialogVisible = false;
|
|
|
if (!this.dialogVisible && this.$refs.productAttrCatForm) {
|
|
|
this.$refs.productAttrCatForm.clearValidate()
|
|
|
}
|
|
@@ -295,7 +306,48 @@ export default {
|
|
|
this.listQuery.pageNum = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
+ onUpdate(row) {
|
|
|
+ this.type = 'update'
|
|
|
+ this.loading = false
|
|
|
+ this.editSkuInfo = {
|
|
|
+ productId: row.productId,
|
|
|
+ productSkuId: row.productSkuId,
|
|
|
+ selectProductSn: row.selectProductSn,
|
|
|
+ internalStock: row.internalStock,
|
|
|
+ taxStock: row.taxStock,
|
|
|
+ price: row.price
|
|
|
+ }
|
|
|
+ fetchSkuStockList(this.productId).then((response) => {
|
|
|
+ try {
|
|
|
+ // debugger
|
|
|
+ const tempResult = response.data || [];
|
|
|
+ tempResult.forEach((product) => {
|
|
|
+ const spData = product.spData ? JSON.parse(product.spData) : [{ key: '默认' }]
|
|
|
+ let spText = ''
|
|
|
+ spData.forEach((sp) => {
|
|
|
+ spText += sp.key + (sp.value ? ':' + sp.value: '')
|
|
|
+ })
|
|
|
+ product.spText = spText
|
|
|
+ })
|
|
|
+
|
|
|
+ this.stockList = tempResult;
|
|
|
+ this.dialogVisible = true;
|
|
|
+ } catch(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
handleAddProduct() {
|
|
|
+ this.type = 'create'
|
|
|
+ this.loading = false
|
|
|
+ this.editSkuInfo = {
|
|
|
+ productId: null,
|
|
|
+ productSkuId: null,
|
|
|
+ selectProductSn: null,
|
|
|
+ internalStock: null,
|
|
|
+ taxStock: null,
|
|
|
+ price: null
|
|
|
+ }
|
|
|
fetchSkuStockList(this.productId).then((response) => {
|
|
|
try {
|
|
|
// debugger
|
|
@@ -341,6 +393,7 @@ export default {
|
|
|
handleResetSearch() {
|
|
|
this.selectProductCateValue = [];
|
|
|
this.listQuery = Object.assign({}, defaultListQuery);
|
|
|
+ this.handleSearchList()
|
|
|
},
|
|
|
},
|
|
|
};
|