Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 afb7fb8b
authored
Oct 14, 2022
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
商品管理
1 parent
9554d9a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
40 deletions
linkwe-pc/src/api/commodityCenter/commodityManage.js
linkwe-pc/src/components/PhoneTemplate.vue
linkwe-pc/src/router/index.js
linkwe-pc/src/views/commodityCenter/commodityManage/list.vue
linkwe-pc/src/api/commodityCenter/commodityManage.js
View file @
afb7fb8
import
request
from
'@/utils/request'
import
request
from
'@/utils/request'
const
service
=
window
.
CONFIG
.
services
.
system
+
'/product'
const
service
=
window
.
CONFIG
.
services
.
system
+
window
.
CONFIG
.
services
.
wecom
+
'/product'
/**
/**
* 商品列表
* 商品列表
...
...
linkwe-pc/src/components/PhoneTemplate.vue
View file @
afb7fb8
<
template
>
<
template
>
<div
class=
"preview"
>
<div
class=
"preview"
>
<div
class=
"
title"
>
{{
nam
e
}}
</div>
<div
class=
"
preview-title"
>
{{
titl
e
}}
</div>
<div
class=
"content"
>
<div
class=
"
preview-
content"
>
<slot
/>
<slot
/>
</div>
</div>
</div>
</div>
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
export
default
{
export
default
{
components
:
{},
components
:
{},
props
:
{
props
:
{
nam
e
:
{
titl
e
:
{
type
:
String
,
type
:
String
,
default
:
'小微'
,
default
:
'小微'
,
},
},
...
@@ -27,6 +27,7 @@ export default {
...
@@ -27,6 +27,7 @@ export default {
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.preview
{
.preview
{
margin
:
0
auto
;
margin
:
0
auto
;
padding
:
0
10px
;
position
:
relative
;
position
:
relative
;
width
:
300px
;
width
:
300px
;
height
:
640px
;
height
:
640px
;
...
@@ -34,7 +35,7 @@ export default {
...
@@ -34,7 +35,7 @@ export default {
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
.title
{
.
preview-
title
{
position
:
absolute
;
position
:
absolute
;
top
:
37px
;
top
:
37px
;
left
:
50%
;
left
:
50%
;
...
@@ -45,17 +46,15 @@ export default {
...
@@ -45,17 +46,15 @@ export default {
color
:
#333333
;
color
:
#333333
;
}
}
.content
{
.
preview-
content
{
position
:
absolut
e
;
position
:
relativ
e
;
height
:
545px
;
height
:
545px
;
width
:
280px
;
overflow-y
:
auto
;
overflow-y
:
auto
;
top
:
70px
;
top
:
70px
;
left
:
50%
;
//
left
:
50%
;
transform
:
translateX
(
-50%
);
//
transform
:
translateX
(
-50%
);
border-bottom-left-radius
:
20px
;
border-bottom-left-radius
:
20px
;
border-bottom-right-radius
:
20px
;
border-bottom-right-radius
:
20px
;
padding
:
20px
;
}
}
}
}
</
style
>
</
style
>
linkwe-pc/src/router/index.js
View file @
afb7fb8
...
@@ -4,7 +4,7 @@ import Router from 'vue-router'
...
@@ -4,7 +4,7 @@ import Router from 'vue-router'
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
const
originalPush
=
Router
.
prototype
.
push
const
originalPush
=
Router
.
prototype
.
push
Router
.
prototype
.
push
=
function
push
(
location
)
{
Router
.
prototype
.
push
=
function
push
(
location
)
{
return
originalPush
.
call
(
this
,
location
).
catch
((
err
)
=>
err
)
return
originalPush
.
call
(
this
,
location
).
catch
((
err
)
=>
err
)
}
}
...
@@ -33,6 +33,37 @@ import visitor from '@/layout/visitor'
...
@@ -33,6 +33,37 @@ import visitor from '@/layout/visitor'
// 公共路由
// 公共路由
export
const
constantRoutes
=
[
export
const
constantRoutes
=
[
{
{
path
:
'/commodityCenter'
,
component
:
Layout
,
hidden
:
true
,
meta
:
{
title
:
'商品中心'
,
},
children
:
[
{
path
:
'commodityManage'
,
name
:
'group-code-analyse'
,
component
:
(
resolve
)
=>
require
([
'@/views/commodityCenter/commodityManage/list'
],
resolve
),
meta
:
{
title
:
'商品管理'
,
activeMenu
:
'/commodityCenter/commodityManage'
,
breadcrumb
:
true
,
},
},
{
path
:
'detail'
,
name
:
'group-code-analyse'
,
component
:
(
resolve
)
=>
require
([
'@/views/commodityCenter/commodityManage/detail'
],
resolve
),
meta
:
{
title
:
'商品管理'
,
activeMenu
:
'/commodityCenter/commodityManage'
,
breadcrumb
:
true
,
},
},
],
},
{
path
:
'/drainageCode/qrCode'
,
path
:
'/drainageCode/qrCode'
,
component
:
Layout
,
component
:
Layout
,
hidden
:
true
,
hidden
:
true
,
...
...
linkwe-pc/src/views/commodityCenter/commodityManage/list.vue
View file @
afb7fb8
<
script
>
<
script
>
import
*
as
api
from
'@/api/commodityCenter/commodityManage'
import
*
as
api
from
'@/api/commodityCenter/commodityManage'
const
defaultForm
=
{
picture
:
''
,
price
:
1
,
describe
:
''
,
attachments
:
[],
}
export
default
{
export
default
{
components
:
{},
components
:
{},
props
:
{},
props
:
{},
...
@@ -13,12 +20,10 @@ export default {
...
@@ -13,12 +20,10 @@ export default {
},
},
// 遮罩层
// 遮罩层
loading
:
false
,
loading
:
false
,
submitLoading
:
false
,
dialogVisible
:
false
,
dialogVisible
:
false
,
// 表单参数
// 表单参数
form
:
{
form
:
JSON
.
parse
(
JSON
.
stringify
(
defaultForm
)),
groupName
:
''
,
weTags
:
[],
},
// 添加标签输入框
// 添加标签输入框
newInput
:
''
,
newInput
:
''
,
// 添加标签显隐
// 添加标签显隐
...
@@ -26,8 +31,8 @@ export default {
...
@@ -26,8 +31,8 @@ export default {
// 表单验证规则
// 表单验证规则
rules
:
Object
.
freeze
({
rules
:
Object
.
freeze
({
picture
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change'
}],
picture
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change'
}],
groupName
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur
'
}],
price
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change
'
}],
groupNam
e
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
describ
e
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
}),
}),
// 选中数组
// 选中数组
ids
:
[],
ids
:
[],
...
@@ -61,13 +66,11 @@ export default {
...
@@ -61,13 +66,11 @@ export default {
this
.
loading
=
false
this
.
loading
=
false
})
})
},
},
edit
(
data
,
type
)
{
edit
(
data
=
{},
type
)
{
this
.
form
=
JSON
.
parse
(
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
assign
(
defaultForm
,
data
)))
JSON
.
stringify
(
Object
.
assign
({
groupTagType
:
this
.
type
,
weTags
:
[]
},
data
||
{}))
)
this
.
dialogVisible
=
true
this
.
dialogVisible
=
true
},
},
sync
Tag
()
{
sync
()
{
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
'Loading'
,
text
:
'Loading'
,
...
@@ -85,6 +88,21 @@ export default {
...
@@ -85,6 +88,21 @@ export default {
loading
.
close
()
loading
.
close
()
})
})
},
},
submit
()
{
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
let
form
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
form
.
price
=
form
.
price
.
toFixed
(
2
)
this
.
submitLoading
=
true
api
[
form
.
id
?
'update'
:
'add'
](
form
)
.
then
(()
=>
{
this
.
msgSuccess
(
'操作成功'
)
this
.
dialogVisible
=
false
})
.
finally
(()
=>
{
this
.
submitLoading
=
false
})
})
},
// 多选框选中数据
// 多选框选中数据
handleSelectionChange
(
selection
)
{
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
((
item
)
=>
item
.
groupId
)
this
.
ids
=
selection
.
map
((
item
)
=>
item
.
groupId
)
...
@@ -104,6 +122,14 @@ export default {
...
@@ -104,6 +122,14 @@ export default {
this
.
msgSuccess
(
'删除成功'
)
this
.
msgSuccess
(
'删除成功'
)
})
})
},
},
goRoute
(
row
)
{
this
.
$router
.
push
({
path
:
'./detail'
,
query
:
{
id
:
row
.
id
,
},
})
},
},
},
}
}
</
script
>
</
script
>
...
@@ -148,9 +174,9 @@ export default {
...
@@ -148,9 +174,9 @@ export default {
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"{ row, index }"
>
<
template
slot-scope=
"{ row, index }"
>
<!-- v-hasPermi="['customerManage:tag:edit']" -->
<!-- v-hasPermi="['customerManage:tag:edit']" -->
<el-button
type=
"text"
@
click=
"goRoute(row
, index
)"
>
详情
</el-button>
<el-button
type=
"text"
@
click=
"goRoute(row)"
>
详情
</el-button>
<el-button
type=
"text"
@
click=
"edit(row, index)"
>
编辑
</el-button>
<el-button
type=
"text"
@
click=
"edit(row, index)"
>
编辑
</el-button>
<el-button
@
click=
"remove(row.groupId)"
type=
"text
"
>
删除
</el-button>
<el-button
type=
"text"
@
click=
"remove(row.id)
"
>
删除
</el-button>
<!-- v-hasPermi="['customerManage:tag:remove']" -->
<!-- v-hasPermi="['customerManage:tag:remove']" -->
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
@@ -168,15 +194,15 @@ export default {
...
@@ -168,15 +194,15 @@ export default {
<el-dialog
<el-dialog
:title=
"form.id ? '修改' : '新建'"
:title=
"form.id ? '修改' : '新建'"
:visible
.
sync=
"dialogVisible"
:visible
.
sync=
"dialogVisible"
width=
"
6
00px"
width=
"
8
00px"
:close-on-click-modal=
"false"
:close-on-click-modal=
"false"
>
>
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"
8
0px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"
10
0px"
>
<el-form-item
label=
"商品封面"
prop=
"picture"
>
<el-form-item
label=
"商品封面"
prop=
"picture"
>
<upload
:fileUrl
.
sync=
"form.picture"
type=
"0"
>
<upload
:fileUrl
.
sync=
"form.picture"
type=
"0"
>
<div
slot=
"tip"
>
支持jpg/jpeg/png格式,图片大小不超过20M
</div>
<div
slot=
"tip"
class=
"tip"
>
支持jpg/jpeg/png格式,图片大小不超过20M
</div>
</upload>
</upload>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品单价(元)"
prop=
"price"
>
<el-form-item
label=
"商品单价(元)"
prop=
"price"
>
...
@@ -195,39 +221,60 @@ export default {
...
@@ -195,39 +221,60 @@ export default {
type=
"textarea"
type=
"textarea"
:maxlength=
"300"
:maxlength=
"300"
show-word-limit
show-word-limit
:autosize=
"{ minRows:
2
, maxRows: 50 }"
:autosize=
"{ minRows:
4
, maxRows: 50 }"
placeholder=
"请输入"
placeholder=
"请输入"
></el-input>
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品详情"
>
<el-form-item
label=
"商品详情"
>
<upload
:fileUrl
.
sync=
"form.attachments"
type=
"0"
>
<upload
:fileUrl
.
sync=
"form.attachments"
type=
"0"
>
<div
slot=
"tip"
>
<div
slot=
"tip"
class=
"tip"
>
最多添加八张详情
</div>
最多添加八张详情,支持JPG,PNG格式,图片大小不超过2M,建议上传宽高1:1的图片
</div>
</upload>
</upload>
</el-form-item>
</el-form-item>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
v-loading=
"submitLoading"
@
click=
"submit"
>
确 定
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
</div>
</el-form>
</el-form>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<PhoneTemplate>
<PhoneTemplate>
<el-image
style=
"width: 100%; height: 50px"
:src=
"form.picture"
></el-image>
<div
class=
"phone-content"
>
<div
class=
"price"
>
¥{{ form.picture }}
</div>
<el-image
class=
"commodity-img commodity-thumb"
style=
"width: 100%; height: 50px"
:src=
"form.picture"
></el-image>
<div
class=
"price"
>
¥{{ form.price.toFixed(2) }}
</div>
<div
class=
"content"
>
{{ form.describe }}
</div>
<div
class=
"content"
>
{{ form.describe }}
</div>
<el-image
<el-image
v-for=
"(item, index) of form.attachments"
v-for=
"(item, index) of form.attachments"
style=
"width: 100%; height: 50px
"
class=
"commodity-img
"
:src=
"item.picURL"
:src=
"item.picURL"
:key=
"index"
:key=
"index"
></el-image>
></el-image>
</div>
</PhoneTemplate>
</PhoneTemplate>
</el-col>
</el-col>
</el-row>
</el-row>
<div
slot=
"footer"
class=
"dialog-footer ar"
>
<el-button
type=
"primary"
v-loading=
"submitLoading"
@
click=
"submit"
>
确 定
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
</div>
</el-dialog>
</el-dialog>
</div>
</div>
</template>
</template>
<
style
lang=
"scss"
scoped
></
style
>
<
style
lang=
"scss"
scoped
>
.tip
{
color
:
#aaa
;
font-size
:
12px
;
line-height
:
20px
;
}
.phone-content
{
padding
:
10px
;
}
.price
{
font-weight
:
500
;
font-size
:
20px
;
margin
:
10px
0
;
}
.commodity-img
{
width
:
100%
;
}
</
style
>
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