Commit f9cbd50b by 张立顺

feat 功能修复

1 parent 239fdaa8
...@@ -33,6 +33,41 @@ describe("purchase grounding form", () => { ...@@ -33,6 +33,41 @@ describe("purchase grounding form", () => {
expect(context.selectGoodsVisible).toBe(false); expect(context.selectGoodsVisible).toBe(false);
}); });
it("shows the selected product purchase cost in the product details", () => {
const context = {
formData: {
purchaseCostType: 0,
purchasePrice: "",
upgradeGoods: {},
},
positionTypeList: [],
filterSpecsStr: jest.fn().mockReturnValue("黑色"),
filterEmpty: GroundingForm.methods.filterEmpty,
$set(target, key, value) {
target[key] = value;
},
handleSelectGoodsClose: jest.fn(),
};
context.syncAutomaticPurchasePrice = () => GroundingForm.methods.syncAutomaticPurchasePrice.call(context);
GroundingForm.methods.handleSelectGoodsConfirm.call(context, {
id: 10,
commodityCode: "UID-001",
position: "",
djCost: "",
purchaseCost: 28.6,
goodsInfo: {
goodsName: "测试系列",
goodsType: 3,
supplierCode: "SUP-001",
},
upgradeGoodsServiceItemsList: [],
carTypeConfigList: [],
});
expect(context.formData.upgradeGoods.purchasePrice).toBe(28.6);
});
it("rolls stores back when an invalid region confirmation is cancelled", async () => { it("rolls stores back when an invalid region confirmation is cancelled", async () => {
validateStoreRegion.mockResolvedValue({ validateStoreRegion.mockResolvedValue({
allMatch: false, allMatch: false,
......
...@@ -737,7 +737,7 @@ export default { ...@@ -737,7 +737,7 @@ export default {
const success = (res) => { const success = (res) => {
_formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress; // 文件地址 _formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress; // 文件地址
}; };
const fail = (err) => { const fail = () => {
this.clearItem(targetItem, index); // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标 this.clearItem(targetItem, index); // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
}; };
this.handleOssUpload(fileInfo, fileName, success, fail); this.handleOssUpload(fileInfo, fileName, success, fail);
...@@ -807,6 +807,7 @@ export default { ...@@ -807,6 +807,7 @@ export default {
const shopType const shopType
= formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : ""; = formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : "";
const shopForm = deepClone(copyFormList[copyProductFormIndex].formBlock); const shopForm = deepClone(copyFormList[copyProductFormIndex].formBlock);
// 权益/延保类无升级成本,新增嘀加成本和第三方成本
const spliceForm const spliceForm
= shopType == "1" = shopType == "1"
? [ ? [
...@@ -827,8 +828,7 @@ export default { ...@@ -827,8 +828,7 @@ export default {
"djCost", "djCost",
"thirdPartyCost", "thirdPartyCost",
] ]
: // 权益/延保类 无升级成本 新增嘀加成本和第三方成本 : this.equitySceneType.includes(formData?.goodsType)
this.equitySceneType.includes(formData?.goodsType)
|| this.extendedPosiType.includes(formData?.goodsType) || this.extendedPosiType.includes(formData?.goodsType)
? [ ? [
"productType", "productType",
...@@ -1007,14 +1007,15 @@ export default { ...@@ -1007,14 +1007,15 @@ export default {
.join("/") .join("/")
: "", : "",
specificationData: this.filterSpecsStr(_valueObj), specificationData: this.filterSpecsStr(_valueObj),
purchasePrice: _valueObj?.purchaseCost,
djCost: _valueObj?.djCost, djCost: _valueObj?.djCost,
carTypeConfigName: _valueObj?.carTypeConfigList carTypeConfigName: _valueObj?.carTypeConfigList
?.map(item => item.seriesName) ?.map(item => item.seriesName)
.join("/"), .join("/"),
upgradeCommodityCode: _valueObj?.commodityCode, upgradeCommodityCode: _valueObj?.commodityCode,
} };
; (_formData.goodsType = _valueObj?.goodsInfo?.goodsType), _formData.goodsType = _valueObj?.goodsInfo?.goodsType;
(_formData.upgradeGoodsId = _valueObj.id); _formData.upgradeGoodsId = _valueObj.id;
_formData.positionNamesArr = _positionNamesArr; _formData.positionNamesArr = _positionNamesArr;
_formData.productType = []; // 切换上架商品 将服务类型清空 _formData.productType = []; // 切换上架商品 将服务类型清空
_formData.baseSupplyMode = ""; // 切换上架商品 将基础供货模式清空 _formData.baseSupplyMode = ""; // 切换上架商品 将基础供货模式清空
...@@ -1189,7 +1190,7 @@ export default { ...@@ -1189,7 +1190,7 @@ export default {
// 价格过滤 // 价格过滤
handleInput(e, item) { handleInput(e, item) {
e = e.replace(/[^\d.]/g, ""); e = e.replace(/[^\d.]/g, "");
let oldValue = `${this.formData["old" + item.name]}`; const oldValue = `${this.formData["old" + item.name]}`;
this.$set(this.formData, `${item.name}`, limitPrice(e, oldValue, 6, 2, 0)); this.$set(this.formData, `${item.name}`, limitPrice(e, oldValue, 6, 2, 0));
this.$set(this.formData, `old${item.name}`, this.formData[item.name]); this.$set(this.formData, `old${item.name}`, this.formData[item.name]);
}, },
...@@ -1197,7 +1198,7 @@ export default { ...@@ -1197,7 +1198,7 @@ export default {
selectAddAttr(value, targetItem) { selectAddAttr(value, targetItem) {
const _formData = this.formData; const _formData = this.formData;
if (targetItem.name == "merchantId") { if (targetItem.name == "merchantId") {
let _tempVal = targetItem.optionList.find( const _tempVal = targetItem.optionList.find(
item => item.merchantId === value, item => item.merchantId === value,
); );
_formData.merchantName = _tempVal.merchantName; _formData.merchantName = _tempVal.merchantName;
...@@ -1242,12 +1243,9 @@ export default { ...@@ -1242,12 +1243,9 @@ export default {
jumpScroll(idName) { jumpScroll(idName) {
document.getElementById(idName).scrollIntoView(); document.getElementById(idName).scrollIntoView();
}, },
filterEmpty(data) {
return (data ?? "") === "";
},
// 处理金额补零 // 处理金额补零
priceFilter(num) { priceFilter(num) {
let pow = 10 ** 2; const pow = 10 ** 2;
if (this.filterEmpty(num)) { if (this.filterEmpty(num)) {
return "-"; return "-";
} }
...@@ -1268,7 +1266,7 @@ export default { ...@@ -1268,7 +1266,7 @@ export default {
if (valid) { if (valid) {
this.$emit("handleAddConfirm", { ...this.formData, num: e }); this.$emit("handleAddConfirm", { ...this.formData, num: e });
} else { } else {
let needRuleList = Object.keys(options); const needRuleList = Object.keys(options);
this.jumpScroll(needRuleList[0]); this.jumpScroll(needRuleList[0]);
return true; return true;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!