发布商品增加局部刷新与去除成本价

master
mahe 2023-12-18 18:04:44 +08:00
parent 195ea35798
commit 286295393d
2 changed files with 60 additions and 39 deletions

View File

@ -214,14 +214,14 @@ export default {
}); });
} else { } else {
this.skuColumn.push( this.skuColumn.push(
{ // {
title: "成本", // title: "",
key: "cost", // key: "cost",
render: (h, params) => { // render: (h, params) => {
console.log(params) // console.log(params)
return h("priceColorScheme", {props:{value:params.row.cost,color:this.$mainColor}} ); // return h("priceColorScheme", {props:{value:params.row.cost,color:this.$mainColor}} );
}, // },
}, // },
{ {
title: "价格", title: "价格",
key: "price", key: "price",

View File

@ -29,6 +29,7 @@
<Select v-model="baseInfoForm.brandId" filterable style="width: 200px"> <Select v-model="baseInfoForm.brandId" filterable style="width: 200px">
<Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option> <Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option>
</Select> </Select>
<Button shape="circle" icon="md-refresh" @click="refresh('brand')" class="refresh-icon" type="text"></Button>
</FormItem> </FormItem>
</div> </div>
<h4>商品交易信息</h4> <h4>商品交易信息</h4>
@ -38,6 +39,7 @@
<Option v-for="(item, index) in goodsUnitList" :key="index" :value="item">{{ item }} <Option v-for="(item, index) in goodsUnitList" :key="index" :value="item">{{ item }}
</Option> </Option>
</Select> </Select>
<Button shape="circle" icon="md-refresh" @click="refresh('goodsUnit')" class="refresh-icon" type="text"></Button>
</FormItem> </FormItem>
<FormItem class="form-item-view-el" label="销售模式" prop="salesModel"> <FormItem class="form-item-view-el" label="销售模式" prop="salesModel">
<RadioGroup v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'" v-model="baseInfoForm.salesModel" <RadioGroup v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'" v-model="baseInfoForm.salesModel"
@ -61,7 +63,7 @@
<Input v-model="wholesaleData[index].num" min="1" number type="number" <Input v-model="wholesaleData[index].num" min="1" number type="number"
@on-blur="checkWholesaleNum(index)"> @on-blur="checkWholesaleNum(index)">
<span slot="append">{{ <span slot="append">{{
baseInfoForm.goodsUnit || "" baseInfoForm.goodsUnit || ""
}}</span> }}</span>
</Input> </Input>
</div> </div>
@ -226,12 +228,12 @@
}}</span> }}</span>
</Input> </Input>
</template> </template>
<template slot="cost" slot-scope="{ row }"> <!-- <template slot="cost" slot-scope="{ row }">
<Input v-model="row.cost" clearable placeholder="请输入成本价" <Input v-model="row.cost" clearable placeholder="请输入成本价"
@on-change="updateSkuTable(row, 'cost')"> @on-change="updateSkuTable(row, 'cost')">
<span slot="append"></span> <span slot="append"></span>
</Input> </Input>
</template> </template> -->
<template slot="price" slot-scope="{ row }"> <template slot="price" slot-scope="{ row }">
<Input v-model="row.price" clearable placeholder="请输入价格" <Input v-model="row.price" clearable placeholder="请输入价格"
@on-change="updateSkuTable(row, 'price')"> @on-change="updateSkuTable(row, 'price')">
@ -341,6 +343,7 @@
<Option v-for="item in logisticsTemplate" :key="item.id" :value="item.id">{{ item.name }} <Option v-for="item in logisticsTemplate" :key="item.id" :value="item.id">{{ item.name }}
</Option> </Option>
</Select> </Select>
<Button shape="circle" icon="md-refresh" @click="refresh('template')" class="refresh-icon" type="text"></Button>
</FormItem> </FormItem>
<FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="商品重量" <FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="商品重量"
prop="weight"> prop="weight">
@ -611,7 +614,7 @@ export default {
"_index", "_index",
"_rowKey", "_rowKey",
"sn", "sn",
"cost", // "cost",
"price", "price",
"weight", "weight",
"quantity", "quantity",
@ -629,6 +632,17 @@ export default {
} }
}, },
methods: { methods: {
//
refresh(v){
if( v == 'template'){
this.GET_ShipTemplate()
}else if( v == 'goodsUnit'){
this.goodsUnitList = []
this.GET_GoodsUnit()
}else{
this.getGoodsBrandList()
}
},
getImages(v) { getImages(v) {
this.previewImage = v; this.previewImage = v;
this.visible = true; this.visible = true;
@ -990,7 +1004,7 @@ export default {
id: e.id, id: e.id,
sn: e.sn, sn: e.sn,
price: e.price, price: e.price,
cost: e.cost, // cost: e.cost,
quantity: e.quantity, quantity: e.quantity,
weight: e.weight, weight: e.weight,
}; };
@ -1273,7 +1287,7 @@ export default {
find.id = ""; find.id = "";
find.price && (find.price = ""); find.price && (find.price = "");
find.sn && (find.sn = ""); find.sn && (find.sn = "");
find.cost && (find.cost = ""); // find.cost && (find.cost = "");
find.quantity && (find.quantity = ""); find.quantity && (find.quantity = "");
find.weight && (find.weight = ""); find.weight && (find.weight = "");
@ -1287,7 +1301,7 @@ export default {
find.id = ""; find.id = "";
find.price && (find.price = ""); find.price && (find.price = "");
find.sn && (find.sn = ""); find.sn && (find.sn = "");
find.cost && (find.cost = ""); // find.cost && (find.cost = "");
find.quantity && (find.quantity = ""); find.quantity && (find.quantity = "");
find.weight && (find.weight = ""); find.weight && (find.weight = "");
@ -1340,10 +1354,10 @@ export default {
// //
if (this.baseInfoForm.salesModel !== "WHOLESALE") { if (this.baseInfoForm.salesModel !== "WHOLESALE") {
pushData.push( pushData.push(
{ // {
title: "成本价", // title: "",
slot: "cost", // slot: "cost",
}, // },
{ {
title: "价格", title: "价格",
slot: "price", slot: "price",
@ -1422,7 +1436,7 @@ export default {
id: skus[index].id, id: skus[index].id,
sn: skus[index].sn, sn: skus[index].sn,
quantity: skus[index].quantity, quantity: skus[index].quantity,
cost: skus[index].cost, cost: 1,
price: skus[index].price, price: skus[index].price,
[spec[0].name]: specItem.value, [spec[0].name]: specItem.value,
images: images:
@ -1503,18 +1517,19 @@ export default {
this.validatatxt = "请输入0~99999999之间的整数"; this.validatatxt = "请输入0~99999999之间的整数";
return; return;
} }
} else if (item === "cost" || item === "price") {
if (
!regular.money.test(row[item]) ||
parseInt(row[item]) < 0 ||
parseInt(row[item]) > 99999999
) {
//
this.validateError.push([index, item]);
this.validatatxt = "请输入0~99999999之间的价格";
return;
}
} }
// else if (item === "cost" || item === "price") {
// if (
// !regular.money.test(row[item]) ||
// parseInt(row[item]) < 0 ||
// parseInt(row[item]) > 99999999
// ) {
// //
// this.validateError.push([index, item]);
// this.validatatxt = "0~99999999";
// return;
// }
// }
this.$nextTick(() => { this.$nextTick(() => {
this.skuTableData[index][item] = row[item]; this.skuTableData[index][item] = row[item];
}); });
@ -1592,7 +1607,7 @@ export default {
submit.skuList = []; submit.skuList = [];
this.skuTableData.map((sku) => { this.skuTableData.map((sku) => {
let skuCopy = { let skuCopy = {
cost: sku.cost, cost: 1,
price: sku.price, price: sku.price,
quantity: sku.quantity, quantity: sku.quantity,
sn: sku.sn, sn: sku.sn,
@ -1702,17 +1717,20 @@ export default {
} }
}); });
}, },
GET_ShipTemplate(){
//
API_Shop.getShipTemplate().then((res) => {
if (res.success) {
this.logisticsTemplate = res.result;
}
});
}
}, },
mounted() { mounted() {
this.accessToken = { this.accessToken = {
accessToken: this.getStore("accessToken"), accessToken: this.getStore("accessToken"),
}; };
// this.GET_ShipTemplate()
API_Shop.getShipTemplate().then((res) => {
if (res.success) {
this.logisticsTemplate = res.result;
}
});
if (this.$route.query.id || this.$route.query.draftId) { if (this.$route.query.id || this.$route.query.draftId) {
// //
this.GET_GoodData(this.$route.query.id, this.$route.query.draftId); this.GET_GoodData(this.$route.query.id, this.$route.query.draftId);
@ -1783,4 +1801,7 @@ export default {
.view-video{ .view-video{
margin: 0 10px; margin: 0 10px;
} }
.refresh-icon{
margin-left: 10px;
}
</style> </style>