Commit f9cbd50b by 张立顺

feat 功能修复

1 parent 239fdaa8
......@@ -33,6 +33,41 @@ describe("purchase grounding form", () => {
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 () => {
validateStoreRegion.mockResolvedValue({
allMatch: false,
......
......@@ -737,7 +737,7 @@ export default {
const success = (res) => {
_formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress; // 文件地址
};
const fail = (err) => {
const fail = () => {
this.clearItem(targetItem, index); // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
};
this.handleOssUpload(fileInfo, fileName, success, fail);
......@@ -807,6 +807,7 @@ export default {
const shopType
= formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : "";
const shopForm = deepClone(copyFormList[copyProductFormIndex].formBlock);
// 权益/延保类无升级成本,新增嘀加成本和第三方成本
const spliceForm
= shopType == "1"
? [
......@@ -827,9 +828,8 @@ export default {
"djCost",
"thirdPartyCost",
]
: // 权益/延保类 无升级成本 新增嘀加成本和第三方成本
this.equitySceneType.includes(formData?.goodsType)
|| this.extendedPosiType.includes(formData?.goodsType)
: this.equitySceneType.includes(formData?.goodsType)
|| this.extendedPosiType.includes(formData?.goodsType)
? [
"productType",
"warrantyType",
......@@ -1007,14 +1007,15 @@ export default {
.join("/")
: "",
specificationData: this.filterSpecsStr(_valueObj),
purchasePrice: _valueObj?.purchaseCost,
djCost: _valueObj?.djCost,
carTypeConfigName: _valueObj?.carTypeConfigList
?.map(item => item.seriesName)
.join("/"),
upgradeCommodityCode: _valueObj?.commodityCode,
}
; (_formData.goodsType = _valueObj?.goodsInfo?.goodsType),
(_formData.upgradeGoodsId = _valueObj.id);
};
_formData.goodsType = _valueObj?.goodsInfo?.goodsType;
_formData.upgradeGoodsId = _valueObj.id;
_formData.positionNamesArr = _positionNamesArr;
_formData.productType = []; // 切换上架商品 将服务类型清空
_formData.baseSupplyMode = ""; // 切换上架商品 将基础供货模式清空
......@@ -1189,7 +1190,7 @@ export default {
// 价格过滤
handleInput(e, item) {
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, `old${item.name}`, this.formData[item.name]);
},
......@@ -1197,7 +1198,7 @@ export default {
selectAddAttr(value, targetItem) {
const _formData = this.formData;
if (targetItem.name == "merchantId") {
let _tempVal = targetItem.optionList.find(
const _tempVal = targetItem.optionList.find(
item => item.merchantId === value,
);
_formData.merchantName = _tempVal.merchantName;
......@@ -1242,12 +1243,9 @@ export default {
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView();
},
filterEmpty(data) {
return (data ?? "") === "";
},
// 处理金额补零
priceFilter(num) {
let pow = 10 ** 2;
const pow = 10 ** 2;
if (this.filterEmpty(num)) {
return "-";
}
......@@ -1268,7 +1266,7 @@ export default {
if (valid) {
this.$emit("handleAddConfirm", { ...this.formData, num: e });
} else {
let needRuleList = Object.keys(options);
const needRuleList = Object.keys(options);
this.jumpScroll(needRuleList[0]);
return true;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!