Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8aaf4739
authored
Aug 17, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat 功能修改
1 parent
59dd1703
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
33 deletions
src/views/goods/purchaseOnShelves/components/groundingForm.spec.js
src/views/goods/purchaseOnShelves/components/groundingForm.vue
src/views/goods/purchaseOnShelves/components/relateStoreDialog.spec.js
src/views/goods/purchaseOnShelves/components/groundingForm.spec.js
View file @
8aaf473
import
{
validateStoreRegion
}
from
"@api/grounding"
;
import
{
validateStoreRegion
}
from
"@api/grounding"
;
import
{
createLocalVue
,
shallowMount
}
from
"@vue/test-utils"
;
import
ElementUI
from
"element-ui"
;
import
EditGrounding
from
"../editGrounding.vue"
;
import
GroundingForm
from
"./groundingForm.vue"
;
import
GroundingForm
from
"./groundingForm.vue"
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
ElementUI
);
jest
.
mock
(
"@api/grounding"
,
()
=>
({
jest
.
mock
(
"@api/grounding"
,
()
=>
({
validateStoreRegion
:
jest
.
fn
(),
validateStoreRegion
:
jest
.
fn
(),
}));
}));
...
@@ -33,39 +39,47 @@ describe("purchase grounding form", () => {
...
@@ -33,39 +39,47 @@ 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"
,
()
=>
{
it
(
"renders the selected product purchase cost in the product details"
,
async
()
=>
{
const
context
=
{
const
editForm
=
EditGrounding
.
data
.
call
({}).
editForm
;
formData
:
{
const
wrapper
=
shallowMount
(
GroundingForm
,
{
purchaseCostType
:
0
,
localVue
,
purchasePrice
:
""
,
mocks
:
{
upgradeGoods
:
{},
$
$
:
(
value
,
key
)
=>
value
?.[
key
],
$store
:
{
state
:
{
d2admin
:
{
loading
:
{
value
:
false
}
},
},
},
},
},
positionTypeList
:
[],
propsData
:
{
filterSpecsStr
:
jest
.
fn
().
mockReturnValue
(
"黑色"
),
formList
:
editForm
,
filterEmpty
:
GroundingForm
.
methods
.
filterEmpty
,
originData
:
{
$set
(
target
,
key
,
value
)
{
goodsType
:
3
,
target
[
key
]
=
value
;
productType
:
[],
purchaseCostType
:
0
,
purchasePrice
:
""
,
upgradeGoodsId
:
10
,
upgradeGoods
:
{
purchaseCost
:
1
},
},
},
},
handleSelectGoodsClose
:
jest
.
fn
(),
stubs
:
{
};
ElForm
:
{
context
.
syncAutomaticPurchasePrice
=
()
=>
GroundingForm
.
methods
.
syncAutomaticPurchasePrice
.
call
(
context
);
methods
:
{
clearValidate
()
{},
GroundingForm
.
methods
.
handleSelectGoodsConfirm
.
call
(
context
,
{
},
id
:
10
,
template
:
"<form><slot /></form>"
,
commodityCode
:
"UID-001"
,
},
position
:
""
,
EllipsisPopover
:
{
djCost
:
""
,
props
:
[
"content"
],
purchaseCost
:
28.6
,
template
:
"<span class=\"rendered-product-detail\">{{ content }}</span>"
,
goodsInfo
:
{
},
goodsName
:
"测试系列"
,
goodsType
:
3
,
supplierCode
:
"SUP-001"
,
},
},
upgradeGoodsServiceItemsList
:
[],
carTypeConfigList
:
[],
});
});
await
wrapper
.
vm
.
$nextTick
();
const
purchasePriceItem
=
wrapper
.
findAll
(
".incid_box .item"
).
wrappers
.
find
(
item
=>
item
.
find
(
".label"
).
text
().
includes
(
"采购价"
));
expect
(
context
.
formData
.
upgradeGoods
.
purchasePrice
).
toBe
(
28.6
);
expect
(
purchasePriceItem
.
find
(
".rendered-product-detail"
).
text
()).
toBe
(
"1.00元"
);
});
});
it
(
"rolls stores back when an invalid region confirmation is cancelled"
,
async
()
=>
{
it
(
"rolls stores back when an invalid region confirmation is cancelled"
,
async
()
=>
{
...
...
src/views/goods/purchaseOnShelves/components/groundingForm.vue
View file @
8aaf473
...
@@ -54,8 +54,8 @@
...
@@ -54,8 +54,8 @@
<
/div
>
<
/div
>
<
div
class
=
"value"
>
<
div
class
=
"value"
>
<
EllipsisPopover
:
content
=
"subItem.unit
<
EllipsisPopover
:
content
=
"subItem.unit
? priceFilter(
formData.upgradeGoods[subItem.value]
)
? priceFilter(
getProductDetailValue(subItem)
)
:
formData.upgradeGoods[subItem.value]
|| ''
:
getProductDetailValue(subItem)
|| ''
"
>
"
>
<
/EllipsisPopover
>
<
/EllipsisPopover
>
<
/div
>
<
/div
>
...
@@ -793,6 +793,12 @@ export default {
...
@@ -793,6 +793,12 @@ export default {
filterEmpty
(
data
)
{
filterEmpty
(
data
)
{
return
(
data
??
""
)
===
""
;
return
(
data
??
""
)
===
""
;
}
,
}
,
getProductDetailValue
(
item
)
{
if
(
item
.
value
===
"purchasePrice"
&&
!
this
.
filterEmpty
(
this
.
formData
.
upgradeGoods
?.
purchaseCost
))
{
return
this
.
formData
.
upgradeGoods
.
purchaseCost
;
}
return
this
.
formData
.
upgradeGoods
?.[
item
.
value
];
}
,
// 清空上传文件数组项内容
// 清空上传文件数组项内容
clearItem
(
targetItem
,
subIndex
)
{
clearItem
(
targetItem
,
subIndex
)
{
this
.
$set
(
this
.
formData
[
targetItem
.
name
][
subIndex
],
"voucherFileUrl"
,
""
);
this
.
$set
(
this
.
formData
[
targetItem
.
name
][
subIndex
],
"voucherFileUrl"
,
""
);
...
@@ -1007,7 +1013,6 @@ export default {
...
@@ -1007,7 +1013,6 @@ 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
)
...
...
src/views/goods/purchaseOnShelves/components/relateStoreDialog.spec.js
View file @
8aaf473
...
@@ -14,15 +14,17 @@ describe("purchase shelves merchant dialog", () => {
...
@@ -14,15 +14,17 @@ describe("purchase shelves merchant dialog", () => {
"el-row"
:
{
template
:
"<div><slot /></div>"
},
"el-row"
:
{
template
:
"<div><slot /></div>"
},
"el-table"
:
{
template
:
"<div><slot /></div>"
},
"el-table"
:
{
template
:
"<div><slot /></div>"
},
"el-table-column"
:
{
"el-table-column"
:
{
props
:
[
"prop"
],
props
:
[
"
label"
,
"
prop"
],
template
:
"<div class='merchant-column' :data-prop='prop'></div>"
,
template
:
"<div class='merchant-column' :data-
label='label' :data-
prop='prop'></div>"
,
},
},
},
},
});
});
await
wrapper
.
vm
.
$nextTick
();
await
wrapper
.
vm
.
$nextTick
();
const
columnProps
=
wrapper
.
findAll
(
".merchant-column"
).
wrappers
.
map
(
column
=>
column
.
attributes
(
"data-prop"
));
const
columnProps
=
wrapper
.
findAll
(
".merchant-column"
).
wrappers
.
map
(
column
=>
column
.
attributes
(
"data-prop"
));
const
addressColumn
=
wrapper
.
find
(
"[data-prop='address']"
);
expect
(
columnProps
.
slice
(
1
,
4
)).
toEqual
([
"merchantName"
,
"address"
,
"merchantId"
]);
expect
(
columnProps
.
slice
(
1
,
4
)).
toEqual
([
"merchantName"
,
"address"
,
"merchantId"
]);
expect
(
addressColumn
.
attributes
(
"data-label"
)).
toBe
(
"商户地址"
);
});
});
});
});
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment