Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
刘小敏
loveisland
Commits
4634fe1a
Commit
4634fe1a
authored
Jun 05, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理后台商品列表增加3D试戴图字段
parent
b58fdb78
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
4 deletions
+76
-4
Goods.php
application/admin/controller/shopro/goods/Goods.php
+26
-0
index.html
application/admin/view/shopro/goods/goods/index.html
+5
-0
sa-uploader.js
public/assets/addons/shopro/components/sa-uploader.js
+9
-4
goods.js
public/assets/js/backend/shopro/goods/goods.js
+36
-0
No files found.
application/admin/controller/shopro/goods/Goods.php
View file @
4634fe1a
...
...
@@ -216,6 +216,32 @@ class Goods extends Common
}
public
function
upload3d
(
$id
=
null
)
{
if
(
!
$this
->
request
->
isAjax
())
{
$goods
=
$this
->
model
->
where
(
'id'
,
$id
)
->
find
();
$image_3d
=
''
;
if
(
$goods
)
{
$image_3d
=
$goods
->
image_3d
;
}
$this
->
view
->
assign
(
'image_3d'
,
urlencode
(
$image_3d
));
$this
->
view
->
assign
(
'id'
,
$id
);
$this
->
view
->
assign
(
'site'
,
[
'version'
=>
config
(
'site.version'
)
?:
time
()]);
return
$this
->
view
->
fetch
(
'shopro/goods/upload3d'
);
}
$params
=
$this
->
request
->
only
([
'image_3d'
]);
$goods
=
$this
->
model
->
where
(
'id'
,
$id
)
->
find
();
if
(
!
$goods
)
{
$this
->
error
(
__
(
'No Results were found'
));
}
$goods
->
save
(
$params
);
$this
->
success
(
'更新成功'
,
null
,
[
'image_3d'
=>
$params
[
'image_3d'
]]);
}
public
function
addStock
(
$id
)
{
if
(
!
$this
->
request
->
isAjax
())
{
...
...
application/admin/view/shopro/goods/goods/index.html
View file @
4634fe1a
...
...
@@ -373,6 +373,11 @@
</div>
</template>
</el-table-column>
<el-table-column
label=
"3D试戴图"
min-width=
"120"
>
<template
#
default=
"scope"
>
<sa-uploader
v-model=
"scope.row.image_3d"
@
select=
"onSelect3DImage(scope.row)"
@
delete=
"onDelete3DImage(scope.row)"
type=
"image"
></sa-uploader>
</template>
</el-table-column>
<el-table-column
sortable=
"custom"
prop=
"price"
label=
"价格"
min-width=
"150"
>
<template
#
default=
"scope"
>
<div>
{{ scope.row.price?.join('~') || 0 }}
</div>
...
...
public/assets/addons/shopro/components/sa-uploader.js
View file @
4634fe1a
...
...
@@ -45,7 +45,7 @@ const SaUploader = {
</el-image>
</div>
</div>`
,
emit
:
[
'update:modelValue'
,
'success'
],
emit
:
[
'update:modelValue'
,
'success'
,
'select'
,
'delete'
],
props
:
{
modelValue
:
{
type
:
[
Array
,
String
],
...
...
@@ -96,13 +96,18 @@ const SaUploader = {
data
.
url
.
split
(
','
).
forEach
(
item
=>
{
urlList
.
value
.
push
(
item
)
});
emit
(
'update:modelValue'
,
props
.
multiple
?
urlList
.
value
:
urlList
.
value
.
join
(
','
))
const
newValue
=
props
.
multiple
?
urlList
.
value
:
urlList
.
value
.
join
(
','
);
emit
(
'update:modelValue'
,
newValue
);
emit
(
'select'
,
{
url
:
newValue
});
}
});
}
function
onDeleteFile
(
index
)
{
urlList
.
value
.
splice
(
index
,
1
)
emit
(
'update:modelValue'
,
props
.
multiple
?
urlList
.
value
:
urlList
.
value
.
join
(
','
))
const
deletedUrl
=
urlList
.
value
[
index
];
urlList
.
value
.
splice
(
index
,
1
);
const
newValue
=
props
.
multiple
?
urlList
.
value
:
urlList
.
value
.
join
(
','
);
emit
(
'update:modelValue'
,
newValue
);
emit
(
'delete'
,
{
url
:
deletedUrl
,
list
:
newValue
});
}
...
...
public/assets/js/backend/shopro/goods/goods.js
View file @
4634fe1a
...
...
@@ -357,6 +357,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
function
(
ret
,
res
)
{
})
}
function
onSelect3DImage
(
row
)
{
if
(
!
row
.
image_3d
)
{
return
;
}
Fast
.
api
.
ajax
({
url
:
'shopro/goods/goods/upload3d?id='
+
row
.
id
,
type
:
'POST'
,
data
:
{
image_3d
:
row
.
image_3d
},
loading
:
true
},
function
(
ret
,
res
)
{
ElMessage
.
success
(
'3D试戴图更新成功'
);
},
function
(
ret
,
res
)
{
ElMessage
.
error
(
res
.
msg
||
'更新失败'
);
row
.
image_3d
=
''
;
});
}
function
onDelete3DImage
(
row
)
{
ElMessageBox
.
confirm
(
`确定要删除商品ID [
${
row
.
id
}
] 的3D试戴图吗?`
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}).
then
(()
=>
{
Fast
.
api
.
ajax
({
url
:
`shopro/goods/goods/upload3d?id=
${
row
.
id
}
`
,
type
:
'POST'
,
data
:
{
image_3d
:
''
}
},
function
(
ret
,
res
)
{
row
.
image_3d
=
''
;
},
function
(
ret
,
res
)
{
})
});
}
function
onRecyclebin
()
{
Fast
.
api
.
open
(
'shopro/goods/goods/recyclebin'
,
"回收站"
,
{
callback
()
{
...
...
@@ -414,6 +448,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
onChangeCategoryIds
,
onFold
,
defaultExpandedKeys
,
onSelect3DImage
,
onDelete3DImage
,
}
}
}
...
...
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