Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dsyerp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
dsyerp
Commits
2f6a03bd
Commit
2f6a03bd
authored
Nov 17, 2023
by
wxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动添加商品编码
parent
405e5ffb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
module/Store/src/Controller/GoodsController.php
module/Store/src/Controller/GoodsController.php
+21
-0
module/Store/view/store/goods/add.phtml
module/Store/view/store/goods/add.phtml
+11
-0
No files found.
module/Store/src/Controller/GoodsController.php
View file @
2f6a03bd
...
@@ -585,4 +585,25 @@ class GoodsController extends AbstractActionController
...
@@ -585,4 +585,25 @@ class GoodsController extends AbstractActionController
exit
;
exit
;
return
;
return
;
}
}
/**
* 分类id检索,ajax输出
* @return JsonModel
*/
public
function
goodsCategoryIdSearchAction
()
:
JsonModel
{
$array
=
[
'state'
=>
'false'
];
$goodsCategoryId
=
(
int
)
$this
->
params
()
->
fromPost
(
'goodsCategoryId'
,
0
);
if
(
$goodsCategoryId
>
0
)
{
$goodsInfo
=
$this
->
entityManager
->
getRepository
(
Goods
::
class
)
->
findOneBy
([
'goodsCategoryId'
=>
$goodsCategoryId
],[
"goodsId"
=>
"DESC"
]);
if
(
$goodsInfo
)
{
$array
[
'state'
]
=
'ok'
;
$array
[
'goods_number'
]
=
$goodsInfo
->
getgoodsNumber
()
+
1
;
}
}
return
new
JsonModel
(
$array
);
}
}
}
\ No newline at end of file
module/Store/view/store/goods/add.phtml
View file @
2f6a03bd
...
@@ -242,4 +242,15 @@
...
@@ -242,4 +242,15 @@
}
}
});
});
});
});
</script>
<script
type=
"text/javascript"
>
$
(
"
#goodsCategoryId
"
).
change
(
function
()
{
// 这里可以写些验证代码
var
goodsCategoryId
=
$
(
"
#goodsCategoryId
"
).
val
();
$
.
post
(
"
<?php
echo
$this
->
url
(
'goods'
,
[
'action'
=>
'goodsCategoryIdSearch'
]);
?>
"
,
{
goodsCategoryId
:
goodsCategoryId
},
function
(
data
)
{
if
(
data
.
state
==
'
ok
'
)
{
$
(
'
#goodsNumber
'
).
val
(
data
.
goods_number
);
}
})
});
</script>
</script>
\ No newline at end of file
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