Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks
Commits
0693335f
Commit
0693335f
authored
Oct 25, 2021
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增商品促销折扣组件
parent
19eebfbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
2 deletions
+135
-2
index.vue
...ent/DynamicForm/component/DiscountGoodsSelector/index.vue
+132
-0
index.ts
app/web/page/editor/component/DynamicForm/index.ts
+2
-1
index.ts
app/web/page/editor/index.ts
+1
-1
No files found.
app/web/page/editor/component/DynamicForm/component/DiscountGoodsSelector/index.vue
0 → 100644
View file @
0693335f
<
template
>
<div
class=
"discountGoodsContainer"
>
<div
class=
"discountGoodsItem"
v-for=
"(item, index) in goods"
:key=
"index"
>
<p>
商品
{{
index
+
1
}}
<span
v-if=
"item.status == 2"
>
(已隐藏,商品已下架)
</span></p>
<Form
@
submit
.
native
.
prevent
ref=
"formCustom"
:model=
"item"
:label-width=
"80"
label-position=
"left"
>
<FormItem
label=
"sku_no"
prop=
"skuNo"
>
<Input
v-model=
"item.skuNo"
placeholder=
"请输入商品sku编码"
@
on-focus=
"setPrevVal(item.skuNo)"
@
on-blur=
"getSkuInfo(item.skuNo, index)"
></Input>
</FormItem>
<FormItem
label=
"商品名称"
prop=
"skuName"
>
<Input
v-model=
"item.skuName"
placeholder=
"请输入商品名称"
></Input>
</FormItem>
<FormItem
label=
"横幅文案"
prop=
"subtitle"
>
<Input
v-model=
"item.subtitle"
placeholder=
"请输入商品横幅文案"
></Input>
</FormItem>
<FormItem
label=
"标签文案"
prop=
"tag"
>
<Input
v-model=
"item.tag"
placeholder=
"请输入商品标签文案"
></Input>
</FormItem>
<FormItem
label=
"标签颜色"
prop=
"tagColor"
>
<ColorSelector
v-model=
"item.goodsTagFontColor"
@
input=
"updateStyle($event, 'tagColor', item)"
></ColorSelector>
</FormItem>
<FormItem
label=
"标签背景"
prop=
"tagBg"
>
<Upload
v-model=
"item.goodsTagBgImg"
@
change=
"updateStyle($event, 'tagBg', item)"
></Upload>
</FormItem>
</Form>
<Button
type=
"error"
@
click=
"del(index)"
class=
"deleteGood"
>
删除
</Button>
</div>
<Button
type=
"dashed"
icon=
"plus-round"
@
click=
"add"
>
添加商品
</Button>
<!--
<Button
type=
"primary"
@
click=
"save"
>
保存
</Button>
-->
</div>
</
template
>
<
script
>
import
ColorSelector
from
'
@editor/component/DynamicForm/component/ColorSelector/index.vue
'
;
import
Upload
from
'
@editor/component/DynamicForm/component/Upload/index.vue
'
;
import
operationApi
from
'
@api/operation.api
'
;
export
default
{
props
:
{
value
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
components
:
{
Upload
,
ColorSelector
},
data
()
{
return
{
goods
:
[],
prevEditSkuNo
:
''
}
},
watch
:
{
goods
:
{
handler
()
{
this
.
$emit
(
'
input
'
,
this
.
goods
);
},
immediate
:
true
,
deep
:
true
}
},
created
()
{
this
.
goods
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
value
));
},
methods
:
{
setPrevVal
(
skuNo
)
{
this
.
prevEditSkuNo
=
skuNo
;
},
async
getSkuInfo
(
skuNo
,
index
)
{
if
(
skuNo
===
this
.
prevEditSkuNo
)
return
;
if
(
isNaN
(
parseInt
(
skuNo
)))
return
;
const
res
=
await
operationApi
.
getGoods
({
skus
:
[
skuNo
]
});
const
result
=
res
.
skus
[
0
];
if
(
!
result
)
return
;
const
item
=
{
skuNo
:
result
.
skuNo
||
''
,
skuName
:
result
.
skuName
||
''
,
skuImg
:
result
.
skuUrl
||
''
,
marketPrice
:
result
.
marketPrice
||
''
,
salePrice
:
result
.
salePrice
||
''
,
goodsTagFontColor
:
this
.
goods
[
index
].
goodsTagFontColor
||
''
,
subtitle
:
this
.
goods
[
index
].
subtitle
||
''
,
tag
:
this
.
goods
[
index
].
tag
||
''
,
goodsTagBgImg
:
this
.
goods
[
index
].
goodsTagBgImg
||
''
,
status
:
result
.
status
}
this
.
$set
(
this
.
goods
,
index
,
item
);
// const goods = JSON.parse(JSON.stringify(this.goods));
// goods[index] = item;
// this.goods = goods;
console
.
log
(
this
.
goods
,
index
);
},
updateStyle
(
e
,
key
,
item
)
{
item
[
key
]
=
e
;
},
add
()
{
this
.
goods
.
push
({
skuNo
:
''
,
skuName
:
''
,
skuImg
:
''
,
subtitle
:
''
,
marketPrice
:
''
,
salePrice
:
''
,
tag
:
''
,
goodsTagFontColor
:
''
,
goodsTagBgImg
:
''
})
},
del
(
index
)
{
this
.
goods
.
splice
(
index
,
1
)
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
.discountGoodsContainer{
.discountGoodsItem{
border: 1px solid #dddee1;
border-radius: 4px;
margin-bottom: 10px;
padding: 5px;
.deleteGood{
width: 100%;
margin-top: 10px;
}
/deep/ .ivu-form-item{
margin-bottom: 10px;
}
}
}
</
style
>
app/web/page/editor/component/DynamicForm/index.ts
View file @
0693335f
...
@@ -5,6 +5,7 @@ import ContextMenuMixin from '@editor/mixins/contextMenu.mixin';
...
@@ -5,6 +5,7 @@ import ContextMenuMixin from '@editor/mixins/contextMenu.mixin';
import
DynamicFormMixin
from
'
./component/mixins/dynamicForm.mixin
'
;
import
DynamicFormMixin
from
'
./component/mixins/dynamicForm.mixin
'
;
import
Upload
from
'
./component/Upload/index.vue
'
;
import
Upload
from
'
./component/Upload/index.vue
'
;
import
ColorSelector
from
'
./component/ColorSelector/index.vue
'
;
import
ColorSelector
from
'
./component/ColorSelector/index.vue
'
;
import
DiscountGoodsSelector
from
'
./component/DiscountGoodsSelector/index.vue
'
;
import
BaseSelect
from
'
./component/BaseSelect/index.vue
'
;
import
BaseSelect
from
'
./component/BaseSelect/index.vue
'
;
import
ComponentSelect
from
'
./component/ComponentSelect/index.vue
'
;
import
ComponentSelect
from
'
./component/ComponentSelect/index.vue
'
;
import
FormList
from
'
./component/FormList/index.vue
'
;
import
FormList
from
'
./component/FormList/index.vue
'
;
...
@@ -16,7 +17,7 @@ import ColumnSelector from './component/ColumnSelector/index.vue';
...
@@ -16,7 +17,7 @@ import ColumnSelector from './component/ColumnSelector/index.vue';
import
{
resizeDiv
,
getStyle
}
from
'
@/service/utils.service
'
;
import
{
resizeDiv
,
getStyle
}
from
'
@/service/utils.service
'
;
import
EventBus
from
'
@service/eventBus.service
'
;
import
EventBus
from
'
@service/eventBus.service
'
;
@
Component
({
components
:
{
Upload
,
ColorSelector
,
BaseSelect
,
FormList
,
Textarea
,
Number
,
ComponentSelect
,
GoodsTableModal
,
CouponTableModal
,
ColumnSelector
},
name
:
'
DynamicForm
'
})
@
Component
({
components
:
{
Upload
,
ColorSelector
,
BaseSelect
,
FormList
,
Textarea
,
Number
,
ComponentSelect
,
GoodsTableModal
,
CouponTableModal
,
ColumnSelector
,
DiscountGoodsSelector
},
name
:
'
DynamicForm
'
})
export
default
class
DynamicForm
extends
Mixins
(
ContextMenuMixin
,
DynamicFormMixin
)
{
export
default
class
DynamicForm
extends
Mixins
(
ContextMenuMixin
,
DynamicFormMixin
)
{
@
State
(
state
=>
state
.
editor
.
curEleIndex
)
curEleIndex
;
@
State
(
state
=>
state
.
editor
.
curEleIndex
)
curEleIndex
;
@
State
(
state
=>
state
.
editor
.
curChildIndex
)
curChildIndex
;
@
State
(
state
=>
state
.
editor
.
curChildIndex
)
curChildIndex
;
...
...
app/web/page/editor/index.ts
View file @
0693335f
...
@@ -6,7 +6,7 @@ import createStore from '@store/index';
...
@@ -6,7 +6,7 @@ import createStore from '@store/index';
import
createRouter
from
'
./router/index
'
;
import
createRouter
from
'
./router/index
'
;
import
entry
from
'
@editor/view/home/index.vue
'
;
import
entry
from
'
@editor/view/home/index.vue
'
;
import
'
./public-path
'
;
import
'
./public-path
'
;
Vue
.
config
.
devtools
=
true
const
create
=
function
(
initState
)
{
const
create
=
function
(
initState
)
{
console
.
log
(
'
initState
'
,
initState
);
console
.
log
(
'
initState
'
,
initState
);
const
store
=
createStore
(
initState
);
const
store
=
createStore
(
initState
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment