Commit 670c4d03 by 赵永成

spec

parent e36da6cc
......@@ -60,3 +60,17 @@ export function getSpu(id) {
method: "get",
});
}
// 删除指定sku
export function del_sku_bySkuId(id) {
return request({
url: '/system/goods/sku/delete/'+id,
method: 'get'
})
}
// 恢复指定sku
export function rec_sku_bySkuId(id) {
return request({
url: '/system/goods/sku/recover/'+id,
method: 'get'
})
}
\ No newline at end of file
......@@ -25,14 +25,9 @@
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button @click="specal_opt(scope.$index,scope.row,'view_step')" type="text" size="small"> 查看步骤 </el-button>
<el-button @click.native.prevent="specal_opt(scope.$index,scope.row,'save')" type="text" size="small"> 保存 </el-button>
<el-button @click.native.prevent="specal_opt(scope.$index,scope.row,'del')" type="text" size="small"> 删除 </el-button>
<el-button @click.native.prevent="specal_opt(scope.$index,scope.row,'restore')" type="text" size="small"> 恢复 </el-button>
<el-button @click="specal_set(scope.$index,scope.row,'view_step')" type="text" size="small"> 配置制作步骤 </el-button>
<el-button @click.native.prevent="sku_del(scope.$index,scope.row,'save')" type="text" size="small"> 删除当前sku </el-button>
<el-button v-if="spec_ShowBtn('set_sku',scope.row)" @click="specal_set(scope.$index,scope.row,'view_step')" type="text" size="small"> 配置制作步骤 </el-button>
<el-button v-if="spec_ShowBtn('del_sku',scope.row)" @click.native.prevent="sku_del(scope.row)" type="text" size="small"> 删除当前sku </el-button>
<el-button v-if="spec_ShowBtn('rec_sku',scope.row)" @click.native.prevent="sku_rec(scope.row)" type="text" size="small"> 恢复当前sku </el-button>
</template>
</el-table-column>
</el-table>
......@@ -44,7 +39,7 @@
</div>
</template>
<script>
import { list_machine_model,list_step,add_spec_step,list_data_spec_step,del_spec_step,list_sku_byGoodsId } from "@/api/system/specification.js";
import { list_machine_model,list_step,add_spec_step,list_data_spec_step,del_spec_step,list_sku_byGoodsId,del_sku_bySkuId,rec_sku_bySkuId } from "@/api/system/specification.js";
import { stringify } from "querystring";
export default {
props: {
......@@ -101,6 +96,10 @@ export default {
let t_skuList = [];
for(let i=0;i<res.data.length;i++){
let sku = res.data[i];
//现在的sku状态字段为isDeleted 有两个值:0-未删除 1-已删除,2-手动删除
//如果状态是(1-已删除)的这里暂不显示
if(sku.isDeleted==1) continue;
let skuObj_ary = [];
let ruleList = JSON.parse(sku.ruleList);
for(let j=0;j<ruleList.length;j++){
......@@ -114,6 +113,7 @@ export default {
}
let skuObj = {};
skuObj.sku_id=sku.id;
skuObj.isDeleted = sku.isDeleted;
skuObj.skuAry = skuObj_ary;
t_skuList.push(skuObj);
}
......@@ -140,6 +140,7 @@ export default {
"sku_spec_name":strName,
"model_name":mach_mode.model_name,
"model_id":mach_mode.id,
"sku_isDeleted":skuObj.isDeleted,
"tb_steps":[{
"step_lab":"步骤1",
"step_akv":[]
......@@ -219,7 +220,6 @@ export default {
openSpecial(tag){
this.open = true;
},
/**获取商品对应的sku list 组装数据结构供页面显示,使用同步加载,避免数据回显不正常*/
getSkuByGoodsId(goodsId){
return new Promise((resolve,reject)=>{
......@@ -233,7 +233,6 @@ export default {
});
});
},
/**可选制作步骤 list 组装数据结构供页面显示,使用同步加载,避免数据回显不正常*/
getStepListByMidAndSkuId(p_queryParams){
return new Promise((resolve,reject)=>{
......@@ -246,8 +245,6 @@ export default {
});
});
},
/**获取已保存的步骤数据 */
get_step_data(){
this.queryParams={goods_id:this.goods.id};
......@@ -256,8 +253,6 @@ export default {
}).catch((response) => {
console.log("get_step_data error",response);
});
},
findSkuById(p_skuid,p_modelid){
let tb_data = null;
......@@ -295,7 +290,6 @@ export default {
step_akv.push(step_item.result);
tb_steps.push({'step_lab':step_num,'step_akv':step_akv})
}
}else{
tb_steps = [{
"step_lab":"步骤1",
......@@ -305,7 +299,6 @@ export default {
tb_data.tb_steps = tb_steps;
console.log("initStepData tb_data.tb_steps 2",tb_data.tb_steps);
}
},
/**列表操作 */
specal_opt(pindex,prow,tag){
......@@ -323,7 +316,6 @@ export default {
if(tag == "del"){
this.spec_step_del(prow);
}
},
specal_tb_row_click(r,c,e){
// this.testPromic(1,2823).then((response) => {
......@@ -391,7 +383,6 @@ export default {
}).catch((response) => {
console.log("error del_spec_step",response);
});
},
fillStepById(step_obj,t_step,prow){
......@@ -445,10 +436,76 @@ export default {
specal_set(){
},
sku_del(){
/**删除sku*/
sku_del(skuRow){
console.log("sku_del skuRow",skuRow);
this.$modal.confirm('是否确认删除当前SKU?商品上架后对应SKU将不可用').then(function () {
return del_sku_bySkuId(skuRow.sku_id);
}).then(() => {
this.showSpecial(true,this.goods)
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
// del_sku_bySkuId(skuRow.sku_id).then((response) => {
// console.log("sku_del",response);
// this.showSpecial(true,this.goods)
// }).catch((response) => {
// console.log("del_sku_bySkuId error",response);
// reject(response);
// });
},
/**恢复sku*/
sku_rec(skuRow){
console.log("sku_del skuRow",skuRow);
this.$modal.confirm('是否确认恢复当前SKU?').then(function () {
return rec_sku_bySkuId(skuRow.sku_id);
}).then(() => {
this.showSpecial(true,this.goods)
this.$modal.msgSuccess("恢复成功");
}).catch(() => { });
// rec_sku_bySkuId(skuRow.sku_id).then((response) => {
// console.log("sku_rec",response);
// this.showSpecial(true,this.goods)
// }).catch((response) => {
// console.log("sku_rec error",response);
// reject(response);
// });
},
spec_ShowBtn(btnTag,skuRow){
if(btnTag == 'del_sku'){
//只有下架的商品 sku才能删除
if(this.goods.state == 4 ){
//如果sku状态是正常的显示删除按钮
if(skuRow.sku_isDeleted==0){
return true;
}
}
return false;
}
else if(btnTag == 'rec_sku'){
//只有下架的商品 sku才能恢复
if(this.goods.state == 4 ){
//如果sku状态是手动删除的显示恢复按钮
if(skuRow.sku_isDeleted==2){
return true;
}
}
return false;
}
else if(btnTag == 'set_sku'){
//如果sku状态是手动删除的显示恢复按钮
// if(skuRow.sku_isDeleted==0){
// return true;
// }
// return false;
return true;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment