@@ -1,15 +1,18 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="ChangeListManager"> | |||
<list default="true" id="648f7d15-dc9f-4b1e-bba1-58d66fbf1157" name="Default Changelist" comment=""> | |||
<list default="true" id="648f7d15-dc9f-4b1e-bba1-58d66fbf1157" name="Default Changelist" comment="init"> | |||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/view/order_main/add.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/view/order_main/add.html" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/css/app.56f3ccab0a4c003d09cb925186c6d511.css" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/fonts/element-icons.535877f.woff" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/fonts/element-icons.732389d.ttf" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/js/app.38a975aa76887068fb55.js" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/js/manifest.2ae2e69a05c33dfc65f8.js" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/static/js/vendor.b77d5750c7830a38b1ff.js" beforeDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/controller/CfItem.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/CfItem.php" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/controller/CfRoomInfo.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/CfRoomInfo.php" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/controller/CfRoomPlan.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/CfRoomPlan.php" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/lang/zh-cn/cf_item.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/lang/zh-cn/cf_item.php" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/lang/zh-cn/order_item.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/lang/zh-cn/order_item.php" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/application/admin/view/cf_item/edit.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/view/cf_item/edit.html" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/assets/js/backend/cf_hotel_info.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/assets/js/backend/cf_hotel_info.js" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/assets/js/backend/cf_item.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/assets/js/backend/cf_item.js" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/assets/js/backend/cf_room_info.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/assets/js/backend/cf_room_info.js" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/public/assets/js/backend/cf_room_plan.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/assets/js/backend/cf_room_plan.js" afterDir="false" /> | |||
</list> | |||
<option name="SHOW_DIALOG" value="false" /> | |||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |||
@@ -24,7 +27,10 @@ | |||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> | |||
<option name="UPDATE_TYPE" value="MERGE" /> | |||
</component> | |||
<component name="PhpDebugGeneral" xdebug_debug_port="9006" listening_started="true" /> | |||
<component name="PhpDebugGeneral" xdebug_debug_port="9006" listening_started="true"> | |||
<xdebug_debug_ports port="9006" /> | |||
<xdebug_debug_ports port="9003" /> | |||
</component> | |||
<component name="PhpServers"> | |||
<servers> | |||
<server host="cz.com" id="e1f06fd7-deb9-41a7-9d36-436111235361" name="Unnamed" /> | |||
@@ -83,21 +89,30 @@ | |||
<option name="showLibraryContents" value="true" /> | |||
</component> | |||
<component name="PropertiesComponent"> | |||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> | |||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | |||
<property name="WebServerToolWindowFactoryState" value="false" /> | |||
<property name="last_opened_file_path" value="$PROJECT_DIR$/public" /> | |||
<property name="settings.editor.selected.configurable" value="reference.settings.php.debug.xdebug.proxy" /> | |||
</component> | |||
<component name="RecentsManager"> | |||
<key name="CopyFile.RECENT_KEYS"> | |||
<recent name="E:\code\lou\public" /> | |||
</key> | |||
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> | |||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> | |||
</component> | |||
<component name="RunManager"> | |||
<configuration name="Unnamed" type="PhpWebAppRunConfigurationType" factoryName="PHP Web Application" nameIsGenerated="true" server_name="Unnamed"> | |||
<method v="2" /> | |||
</configuration> | |||
</component> | |||
<component name="ServiceViewManager"> | |||
<option name="viewStates"> | |||
<list> | |||
<serviceView> | |||
<treeState> | |||
<expand /> | |||
<select /> | |||
</treeState> | |||
</serviceView> | |||
</list> | |||
</option> | |||
</component> | |||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> | |||
<component name="SvnConfiguration"> | |||
<configuration /> | |||
</component> | |||
@@ -112,7 +127,11 @@ | |||
<workItem from="1633843542476" duration="7474000" /> | |||
<workItem from="1633967176055" duration="7788000" /> | |||
<workItem from="1634461088170" duration="4763000" /> | |||
<workItem from="1634567190291" duration="34134000" /> | |||
<workItem from="1634567190291" duration="41479000" /> | |||
<workItem from="1635654134462" duration="35523000" /> | |||
<workItem from="1636808249831" duration="601000" /> | |||
<workItem from="1636878434062" duration="121000" /> | |||
<workItem from="1636878580264" duration="13648000" /> | |||
</task> | |||
<task id="LOCAL-00001" summary="init"> | |||
<created>1633847937612</created> | |||
@@ -184,11 +203,102 @@ | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635067483089</updated> | |||
</task> | |||
<option name="localTasksCounter" value="11" /> | |||
<task id="LOCAL-00011" summary="init"> | |||
<created>1635067920033</created> | |||
<option name="number" value="00011" /> | |||
<option name="presentableId" value="LOCAL-00011" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635067920033</updated> | |||
</task> | |||
<task id="LOCAL-00012" summary="init"> | |||
<created>1635083574492</created> | |||
<option name="number" value="00012" /> | |||
<option name="presentableId" value="LOCAL-00012" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635083574492</updated> | |||
</task> | |||
<task id="LOCAL-00013" summary="init"> | |||
<created>1635088810703</created> | |||
<option name="number" value="00013" /> | |||
<option name="presentableId" value="LOCAL-00013" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635088810703</updated> | |||
</task> | |||
<task id="LOCAL-00014" summary="init"> | |||
<created>1635655791788</created> | |||
<option name="number" value="00014" /> | |||
<option name="presentableId" value="LOCAL-00014" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635655791788</updated> | |||
</task> | |||
<task id="LOCAL-00015" summary="init"> | |||
<created>1635775792351</created> | |||
<option name="number" value="00015" /> | |||
<option name="presentableId" value="LOCAL-00015" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635775792351</updated> | |||
</task> | |||
<task id="LOCAL-00016" summary="init"> | |||
<created>1635780400746</created> | |||
<option name="number" value="00016" /> | |||
<option name="presentableId" value="LOCAL-00016" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635780400746</updated> | |||
</task> | |||
<task id="LOCAL-00017" summary="init"> | |||
<created>1635865804532</created> | |||
<option name="number" value="00017" /> | |||
<option name="presentableId" value="LOCAL-00017" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1635865804532</updated> | |||
</task> | |||
<task id="LOCAL-00018" summary="init"> | |||
<created>1636265845920</created> | |||
<option name="number" value="00018" /> | |||
<option name="presentableId" value="LOCAL-00018" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636265845920</updated> | |||
</task> | |||
<task id="LOCAL-00019" summary="init"> | |||
<created>1636268317457</created> | |||
<option name="number" value="00019" /> | |||
<option name="presentableId" value="LOCAL-00019" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636268317457</updated> | |||
</task> | |||
<task id="LOCAL-00020" summary="init"> | |||
<created>1636268567040</created> | |||
<option name="number" value="00020" /> | |||
<option name="presentableId" value="LOCAL-00020" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636268567040</updated> | |||
</task> | |||
<task id="LOCAL-00021" summary="init"> | |||
<created>1636276001595</created> | |||
<option name="number" value="00021" /> | |||
<option name="presentableId" value="LOCAL-00021" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636276001595</updated> | |||
</task> | |||
<task id="LOCAL-00022" summary="init"> | |||
<created>1636276496007</created> | |||
<option name="number" value="00022" /> | |||
<option name="presentableId" value="LOCAL-00022" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636276496007</updated> | |||
</task> | |||
<task id="LOCAL-00023" summary="init"> | |||
<created>1636891272640</created> | |||
<option name="number" value="00023" /> | |||
<option name="presentableId" value="LOCAL-00023" /> | |||
<option name="project" value="LOCAL" /> | |||
<updated>1636891272640</updated> | |||
</task> | |||
<option name="localTasksCounter" value="24" /> | |||
<servers /> | |||
</component> | |||
<component name="TypeScriptGeneratedFilesManager"> | |||
<option name="version" value="1" /> | |||
<option name="version" value="3" /> | |||
</component> | |||
<component name="Vcs.Log.Tabs.Properties"> | |||
<option name="TAB_STATES"> | |||
@@ -203,129 +313,10 @@ | |||
<option name="oldMeFiltersMigrated" value="true" /> | |||
</component> | |||
<component name="VcsManagerConfiguration"> | |||
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="true" /> | |||
<MESSAGE value="hotel" /> | |||
<MESSAGE value="11111" /> | |||
<MESSAGE value="init" /> | |||
<option name="LAST_COMMIT_MESSAGE" value="init" /> | |||
</component> | |||
<component name="WindowStateProjectService"> | |||
<state x="222" y="0" key="#Servers" timestamp="1634445412897"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="222" y="0" key="#Servers/0.0.1280.680@0.0.1280.680" timestamp="1634445412897" /> | |||
<state x="96" y="0" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1634462037912"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="96" y="0" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1280.680@0.0.1280.680" timestamp="1634462037912" /> | |||
<state x="365" y="143" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1634985372691"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="365" y="143" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1280.680@0.0.1280.680" timestamp="1634985372691" /> | |||
<state x="371" y="96" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1635064055100"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="371" y="96" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1280.680@0.0.1280.680" timestamp="1635064055100" /> | |||
<state x="247" y="0" key="CommitChangelistDialog2" timestamp="1635067780648"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="247" y="0" key="CommitChangelistDialog2/0.0.1280.680@0.0.1280.680" timestamp="1635067780648" /> | |||
<state x="0" y="0" key="DiffContextDialog" timestamp="1635073555540"> | |||
<screen x="0" y="0" width="2560" height="1392" /> | |||
</state> | |||
<state x="0" y="0" key="DiffContextDialog/0.0.2560.1392@0.0.2560.1392" timestamp="1635073555540" /> | |||
<state x="421" y="96" key="FileChooserDialogImpl" timestamp="1634453017169"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="421" y="96" key="FileChooserDialogImpl/0.0.1280.680@0.0.1280.680" timestamp="1634453017169" /> | |||
<state width="1238" height="149" key="GridCell.Tab.0.bottom" timestamp="1634462364022"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.0.bottom/0.0.1280.680@0.0.1280.680" timestamp="1634462364022" /> | |||
<state width="1238" height="149" key="GridCell.Tab.0.center" timestamp="1634462364020"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.0.center/0.0.1280.680@0.0.1280.680" timestamp="1634462364020" /> | |||
<state width="1238" height="149" key="GridCell.Tab.0.left" timestamp="1634462364019"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.0.left/0.0.1280.680@0.0.1280.680" timestamp="1634462364019" /> | |||
<state width="1238" height="149" key="GridCell.Tab.0.right" timestamp="1634462364021"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.0.right/0.0.1280.680@0.0.1280.680" timestamp="1634462364021" /> | |||
<state width="1238" height="149" key="GridCell.Tab.1.bottom" timestamp="1634462364026"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.1.bottom/0.0.1280.680@0.0.1280.680" timestamp="1634462364026" /> | |||
<state width="1238" height="149" key="GridCell.Tab.1.center" timestamp="1634462364024"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.1.center/0.0.1280.680@0.0.1280.680" timestamp="1634462364024" /> | |||
<state width="1238" height="149" key="GridCell.Tab.1.left" timestamp="1634462364023"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.1.left/0.0.1280.680@0.0.1280.680" timestamp="1634462364023" /> | |||
<state width="1238" height="149" key="GridCell.Tab.1.right" timestamp="1634462364025"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state width="1238" height="149" key="GridCell.Tab.1.right/0.0.1280.680@0.0.1280.680" timestamp="1634462364025" /> | |||
<state x="350" y="56" key="MultipleFileMergeDialog" timestamp="1634829448022"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="350" y="56" key="MultipleFileMergeDialog/0.0.1280.680@0.0.1280.680" timestamp="1634829448022" /> | |||
<state x="500" y="51" key="RollbackChangesDialog" timestamp="1634222863596"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="500" y="51" key="RollbackChangesDialog/0.0.1280.680@0.0.1280.680" timestamp="1634222863596" /> | |||
<state x="142" y="0" key="SettingsEditor" timestamp="1634462282710"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="142" y="0" key="SettingsEditor/0.0.1280.680@0.0.1280.680" timestamp="1634462282710" /> | |||
<state x="371" y="90" width="591" height="524" key="StructurePopup" timestamp="1635064046155"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="371" y="90" width="591" height="524" key="StructurePopup/0.0.1280.680@0.0.1280.680" timestamp="1635064046155" /> | |||
<state x="466" y="151" key="Vcs.Push.Dialog.v2" timestamp="1635073559224"> | |||
<screen x="0" y="0" width="2560" height="1392" /> | |||
</state> | |||
<state x="233" y="74" key="Vcs.Push.Dialog.v2/0.0.1280.680@0.0.1280.680" timestamp="1635067861265" /> | |||
<state x="466" y="151" key="Vcs.Push.Dialog.v2/0.0.2560.1392@0.0.2560.1392" timestamp="1635073559224" /> | |||
<state x="335" y="237" width="760" height="312" maximized="true" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1634222692562"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="335" y="237" width="760" height="312" maximized="true" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.1280.680@0.0.1280.680" timestamp="1634222692562" /> | |||
<state x="872" y="528" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1635073538876"> | |||
<screen x="0" y="0" width="2560" height="1392" /> | |||
</state> | |||
<state x="436" y="258" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1280.680@0.0.1280.680" timestamp="1634829543368" /> | |||
<state x="872" y="528" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2560.1392@0.0.2560.1392" timestamp="1635073538876" /> | |||
<state x="319" y="72" width="779" height="600" key="find.popup" timestamp="1634984161512"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="319" y="72" width="779" height="600" key="find.popup/0.0.1280.680@0.0.1280.680" timestamp="1634984161512" /> | |||
<state x="305" y="4" width="672" height="678" key="search.everywhere.popup" timestamp="1635063310208"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="305" y="4" width="672" height="678" key="search.everywhere.popup/0.0.1280.680@0.0.1280.680" timestamp="1635063310208" /> | |||
<state x="439" y="306" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1633843159458"> | |||
<screen x="0" y="0" width="1280" height="680" /> | |||
</state> | |||
<state x="439" y="306" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.0.1280.680@0.0.1280.680" timestamp="1633843159458" /> | |||
</component> | |||
<component name="XDebuggerManager"> | |||
<breakpoint-manager> | |||
<breakpoints> | |||
<line-breakpoint enabled="true" type="php"> | |||
<url>file://$PROJECT_DIR$/public/index.php</url> | |||
<line>13</line> | |||
<option name="timeStamp" value="3" /> | |||
</line-breakpoint> | |||
<line-breakpoint enabled="true" type="php"> | |||
<url>file://$PROJECT_DIR$/public/hotel.php</url> | |||
<line>15</line> | |||
<option name="timeStamp" value="4" /> | |||
</line-breakpoint> | |||
</breakpoints> | |||
</breakpoint-manager> | |||
</component> | |||
</project> |
@@ -2,6 +2,7 @@ | |||
namespace app\admin\controller; | |||
use app\admin\command\Util; | |||
use app\common\controller\Backend; | |||
use app\common\exception\UploadException; | |||
use app\common\library\Upload; | |||
@@ -289,6 +290,26 @@ class Ajax extends Backend | |||
$provincelist = Db::name('area')->where($where)->field('id as value,name')->select(); | |||
$this->success('', '', $provincelist); | |||
} | |||
/** | |||
* 读取省市区数据,联动列表 | |||
*/ | |||
public function areaList() | |||
{ | |||
$province = $this->request->post('province', ''); | |||
$city = $this->request->post('city', ''); | |||
$where = ['pid' => 0, 'level' => 1]; | |||
$provincelist = null; | |||
if ($province !== '') { | |||
$where['pid'] = $province; | |||
$where['level'] = 2; | |||
if ($city !== '') { | |||
$where['pid'] = $city; | |||
$where['level'] = 3; | |||
} | |||
} | |||
$provincelist = Db::name('area')->where($where)->field('id as value,name')->select(); | |||
return json(Util::returnArrSu("",$provincelist->toArray())); | |||
} | |||
/** | |||
* 生成后缀图标 | |||
@@ -3,6 +3,7 @@ | |||
namespace app\admin\controller; | |||
use app\admin\model\Area; | |||
use app\admin\service\CfHotelInfoService; | |||
use app\common\controller\Backend; | |||
use think\Db; | |||
use think\exception\PDOException; | |||
@@ -15,7 +16,7 @@ use think\exception\ValidateException; | |||
*/ | |||
class CfHotelInfo extends Backend | |||
{ | |||
/** | |||
* CfHotelInfo模型对象 | |||
* @var \app\admin\model\CfHotelInfo | |||
@@ -40,42 +41,6 @@ class CfHotelInfo extends Backend | |||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | |||
*/ | |||
/** | |||
* 查看 | |||
*/ | |||
public function index() | |||
{ | |||
//设置过滤方法 | |||
$this->request->filter(['strip_tags', 'trim']); | |||
if ($this->request->isAjax()) { | |||
//如果发送的来源是Selectpage,则转发到Selectpage | |||
if ($this->request->request('keyField')) { | |||
return $this->selectpage(); | |||
} | |||
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | |||
$group_id=$this->auth->getGroupId(); | |||
$list = $this->model | |||
->alias("a") | |||
->join('hbp_admin c','a.create_id = c.id','left') | |||
->field("a.*,c.nickname") | |||
->where($where); | |||
if ($group_id){ | |||
$list = $list | |||
->where("group_id","=",$group_id) | |||
->order($sort, $order) | |||
->paginate($limit); | |||
}else{ | |||
$list = $list | |||
->order($sort, $order) | |||
->paginate($limit); | |||
} | |||
$result = array("total" => $list->total(), "rows" => $list->items()); | |||
return json($result); | |||
} | |||
return $this->view->fetch(); | |||
} | |||
public function getHotelList(){ | |||
$name=$this->request->post('name'); | |||
$keyValue=$this->request->post('keyValue'); | |||
@@ -86,124 +51,36 @@ class CfHotelInfo extends Backend | |||
return json(['list' => $result]); | |||
} | |||
/****=========================================**/ | |||
/** | |||
* 添加 | |||
* 获取列表 | |||
* @return \think\response\Json | |||
*/ | |||
public function add() | |||
{ | |||
if ($this->request->isPost()) { | |||
$params = $this->request->post("row/a"); | |||
if ($params) { | |||
$params = $this->preExcludeFields($params); | |||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | |||
$params[$this->dataLimitField] = $this->auth->id; | |||
} | |||
$result = false; | |||
Db::startTrans(); | |||
try { | |||
//是否采用模型验证 | |||
if ($this->modelValidate) { | |||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | |||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; | |||
$this->model->validateFailException(true)->validate($validate); | |||
} | |||
$area=new Area(); | |||
if ($params["area"]){ | |||
$params["area_name"]=$area->where("id","=",$params["area"])->value("name"); | |||
} | |||
if ($params["province"]){ | |||
$params["province_name"]=$area->where("id","=",$params["province"])->value("name"); | |||
} | |||
if ($params["city"]){ | |||
$params["city_name"]=$area->where("id","=",$params["city"])->value("name"); | |||
} | |||
$params['create_id']=$this->auth->id; | |||
$params['group_id']=$this->auth->getGroupId(); | |||
$result = $this->model->allowField(true)->save($params); | |||
Db::commit(); | |||
} catch (ValidateException $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} catch (PDOException $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} catch (Exception $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} | |||
if ($result !== false) { | |||
$this->success(); | |||
} else { | |||
$this->error(__('No rows were inserted')); | |||
} | |||
} | |||
$this->error(__('Parameter %s can not be empty', '')); | |||
} | |||
return $this->view->fetch(); | |||
public function getList(){ | |||
$params=$this->request->post(); | |||
$service = new CfHotelInfoService(); | |||
return json($service->getList($params)); | |||
} | |||
/** | |||
* 保存记录 | |||
* @return \think\response\Json | |||
*/ | |||
public function save(){ | |||
$params=$this->request->post(); | |||
$params['create_id']=$this->auth->id; | |||
$params['group_id']=$this->auth->getGroupId(); | |||
$service = new CfHotelInfoService(); | |||
return json($service->save($params)); | |||
} | |||
/** | |||
* 编辑 | |||
* 删除 | |||
* @return \think\response\Json | |||
*/ | |||
public function edit($ids = null) | |||
{ | |||
$row = $this->model->get($ids); | |||
if (!$row) { | |||
$this->error(__('No Results were found')); | |||
} | |||
$adminIds = $this->getDataLimitAdminIds(); | |||
if (is_array($adminIds)) { | |||
if (!in_array($row[$this->dataLimitField], $adminIds)) { | |||
$this->error(__('You have no permission')); | |||
} | |||
} | |||
if ($this->request->isPost()) { | |||
$params = $this->request->post("row/a"); | |||
if ($params) { | |||
$params = $this->preExcludeFields($params); | |||
$result = false; | |||
Db::startTrans(); | |||
try { | |||
//是否采用模型验证 | |||
if ($this->modelValidate) { | |||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | |||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; | |||
$row->validateFailException(true)->validate($validate); | |||
} | |||
$area=new Area(); | |||
if ($params["area"]){ | |||
$params["area_name"]=$area->where("id","=",$params["area"])->value("name"); | |||
} | |||
if ($params["province"]){ | |||
$params["province_name"]=$area->where("id","=",$params["province"])->value("name"); | |||
} | |||
if ($params["city"]){ | |||
$params["city_name"]=$area->where("id","=",$params["city"])->value("name"); | |||
} | |||
$result = $row->allowField(true)->save($params); | |||
Db::commit(); | |||
} catch (ValidateException $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} catch (PDOException $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} catch (Exception $e) { | |||
Db::rollback(); | |||
$this->error($e->getMessage()); | |||
} | |||
if ($result !== false) { | |||
$this->success(); | |||
} else { | |||
$this->error(__('No rows were updated')); | |||
} | |||
} | |||
$this->error(__('Parameter %s can not be empty', '')); | |||
} | |||
$this->view->assign("row", $row); | |||
return $this->view->fetch(); | |||
public function delAll(){ | |||
$params=$this->request->post(); | |||
$service = new CfHotelInfoService(); | |||
return json($service->del($params)); | |||
} | |||
} |
@@ -3,6 +3,7 @@ | |||
namespace app\admin\controller; | |||
use app\admin\model\Area; | |||
use app\admin\service\CfItemService; | |||
use app\common\controller\Backend; | |||
use think\Db; | |||
use think\exception\PDOException; | |||
@@ -57,7 +58,7 @@ class CfItem extends Backend | |||
->alias("a") | |||
->join('hbp_admin c','a.create_id = c.id','left') | |||
->join('hbp_admin d','a.purchase_user_id = d.id','left') | |||
->field("a.*,c.nickname,d.nickname as purchase_user_name") | |||
->field("a.*,d.nickname") | |||
->where($where); | |||
if ($group_id){ | |||
$list = $list | |||
@@ -76,7 +77,7 @@ class CfItem extends Backend | |||
$config1 = json_decode($config1,true); | |||
$res = $list->items(); | |||
foreach ($res as $key=>$val){ | |||
$res[$key]["item_type_name"]=$config[$val["item_type"]]; | |||
$res[$key]["item_type"]=$config[$val["item_type"]]; | |||
$res[$key]["item_unit"]=$config1[$val["item_unit"]]; | |||
} | |||
$result = array("total" => $list->total(), "rows" => $list->items()); | |||
@@ -213,12 +214,13 @@ class CfItem extends Backend | |||
$name=$this->request->post('name'); | |||
$keyValue=$this->request->post('keyValue'); | |||
$this->model->field('id,item_name as name,item_unit,item_type,item_memo'); | |||
$where = ["del_flag"=>0]; | |||
if($keyValue){ | |||
$this->model->where(['id'=>$keyValue]); | |||
$where = ['id'=>$keyValue,"del_flag"=>0]; | |||
}elseif($name){ | |||
$this->model->where(['item_name'=>['like','%'.$name.'%']]); | |||
$where = ['item_name'=>['like','%'.$name.'%'],"del_flag"=>0]; | |||
} | |||
$result= $this->model->select()->toArray(); | |||
$result= $this->model->where($where)->select()->toArray(); | |||
$config = \think\Config::get("site.item_category"); | |||
$config = json_decode($config,true); | |||
@@ -236,4 +238,36 @@ class CfItem extends Backend | |||
return json(['list' => $result]); | |||
} | |||
/**=================================================**/ | |||
/** | |||
* 获取列表 | |||
* @return \think\response\Json | |||
*/ | |||
public function list(){ | |||
$params=$this->request->post(); | |||
$service = new CfItemService(); | |||
return json($service->getList($params)); | |||
} | |||
/** | |||
* 保存记录 | |||
* @return \think\response\Json | |||
*/ | |||
public function save(){ | |||
$params=$this->request->post(); | |||
$params['create_id']=$this->auth->id; | |||
$params['group_id']=$this->auth->getGroupId(); | |||
$service = new CfItemService(); | |||
return json($service->save($params)); | |||
} | |||
/** | |||
* 删除 | |||
* @return \think\response\Json | |||
*/ | |||
public function delAll(){ | |||
$params=$this->request->post(); | |||
$service = new CfItemService(); | |||
return json($service->del($params)); | |||
} | |||
} |
@@ -57,7 +57,7 @@ class CfRoomInfo extends Backend | |||
->alias('a') | |||
->join('hbp_cf_hotel_info b','a.hotel_id = b.id','left') | |||
->join('hbp_admin c','a.create_id = c.id','left') | |||
->field("a.id,a.room_name,a.room_memo,b.hotel_name,a.create_time,a.update_time,c.nickname") | |||
->field("a.id,a.hotel_id,a.room_name,a.room_memo,b.hotel_name,a.create_time,a.update_time,c.nickname") | |||
->where($where); | |||
if ($group_id){ | |||
$list = $list | |||
@@ -181,7 +181,7 @@ class CfRoomInfo extends Backend | |||
$hotelId=$this->request->get('hotelId'); | |||
$result= $this->model | |||
->field("id,room_name as name,room_memo") | |||
->where("hotel_id","=",$hotelId)->select(); | |||
->where(["hotel_id"=>$hotelId,"del_flag"=>0])->select(); | |||
return json(['list' => $result]); | |||
} | |||
@@ -52,16 +52,17 @@ class CfRoomPlan extends Backend | |||
$name=$this->request->post('name'); | |||
$keyValue=$this->request->post('keyValue'); | |||
$this->model->field('id,plan_name as name,purchase_user_id,plan_memo'); | |||
$where = ["del_flag"=>0]; | |||
if($keyValue){ | |||
$this->model->where(['id'=>$keyValue]); | |||
$where = ['id'=>$keyValue,"del_flag"=>0]; | |||
}elseif($name){ | |||
$this->model->where(['plan_name'=>['like','%'.$name.'%']]); | |||
$where = ['plan_name'=>['like','%'.$name.'%'],"del_flag"=>0]; | |||
} | |||
$roomId =$this->request->get('room_id'); | |||
if ($roomId){ | |||
$this->model->where("room_id","=",$roomId); | |||
$where["room_id"] = $roomId; | |||
} | |||
$result= $this->model->select(); | |||
$result= $this->model->where($where)->select(); | |||
if($keyValue){ | |||
return json(['list' => $result]); | |||
} | |||
@@ -84,11 +85,10 @@ class CfRoomPlan extends Backend | |||
$group_id=$this->auth->getGroupId(); | |||
$list = $this->model | |||
->alias("a") | |||
->join('hbp_admin c','a.create_id = c.id','left') | |||
->join('hbp_admin d','a.purchase_user_id = d.id','left') | |||
->join('hbp_admin','a.purchase_user_id = hbp_admin.id','left') | |||
->join('hbp_cf_room_info e','a.room_id = e.id','left') | |||
->join('hbp_cf_hotel_info f','a.hotel_id = f.id','left') | |||
->field("a.*,c.nickname,d.nickname as purchase_user_name,e.room_name,f.hotel_name") | |||
->field("a.*,hbp_admin.nickname,e.room_name,f.hotel_name") | |||
->where($where); | |||
if ($group_id){ | |||
$list = $list | |||
@@ -100,7 +100,12 @@ class CfRoomPlan extends Backend | |||
->order($sort, $order) | |||
->paginate($limit); | |||
} | |||
$result = array("total" => $list->total(), "rows" => $list->items()); | |||
$result = $list->items(); | |||
foreach ($result as $k=>$item){ | |||
$result[$k]["continuity_type"]=$this->continuity_type[$item["continuity_type"]]; | |||
$result[$k]["hbp_admin.nickname"] = $item["nickname"]; | |||
} | |||
$result = array("total" => $list->total(), "rows" => $result); | |||
return json($result); | |||
} | |||
return $this->view->fetch(); | |||
@@ -8,6 +8,7 @@ use app\common\controller\Backend; | |||
use think\Db; | |||
use think\exception\PDOException; | |||
use think\exception\ValidateException; | |||
use think\Loader; | |||
/** | |||
* 订单主管理 | |||
@@ -26,7 +27,7 @@ class OrderMain extends Backend | |||
{ | |||
parent::_initialize(); | |||
$this->model = new \app\admin\model\OrderMain; | |||
$this->relationSearch = true; | |||
} | |||
public function import() | |||
@@ -56,10 +57,10 @@ class OrderMain extends Backend | |||
list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | |||
$group_id=$this->auth->getGroupId(); | |||
$list = $this->model | |||
->alias("a") | |||
->join('hbp_cf_channel_info b','a.channel_id = b.id','left') | |||
->join('hbp_admin c','a.create_id = c.id','left') | |||
->field("a.*,b.channel_name,c.nickname") | |||
->alias("order_main") | |||
->join('hbp_cf_channel_info b','order_main.channel_id = b.id','left') | |||
->join('hbp_admin','order_main.create_id = hbp_admin.id','left') | |||
->field("order_main.*,b.channel_name,hbp_admin.nickname") | |||
->where($where); | |||
if ($group_id){ | |||
$list = $list | |||
@@ -90,6 +91,7 @@ class OrderMain extends Backend | |||
$result[$k]["order_status"]="已取消"; | |||
break; | |||
} | |||
$result[$k]["hbp_admin.nickname"] = $item["nickname"]; | |||
} | |||
$result = array("total" => $list->total(), "rows" =>$result); | |||
@@ -100,6 +102,187 @@ class OrderMain extends Backend | |||
/** | |||
* 生成查询所需要的条件,排序方式 | |||
* @param mixed $searchfields 快速查询的字段 | |||
* @param boolean $relationSearch 是否关联查询 | |||
* @return array | |||
*/ | |||
protected function buildparams($searchfields = null, $relationSearch = null) | |||
{ | |||
$searchfields = is_null($searchfields) ? $this->searchFields : $searchfields; | |||
$relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch; | |||
$search = $this->request->get("search", ''); | |||
$filter = $this->request->get("filter", ''); | |||
$op = $this->request->get("op", '', 'trim'); | |||
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id'); | |||
$order = $this->request->get("order", "DESC"); | |||
$offset = $this->request->get("offset/d", 0); | |||
$limit = $this->request->get("limit/d", 999999); | |||
//新增自动计算页码 | |||
$page = $limit ? intval($offset / $limit) + 1 : 1; | |||
if ($this->request->has("page")) { | |||
$page = $this->request->get("page/d", 1); | |||
} | |||
$this->request->get([config('paginate.var_page') => $page]); | |||
$filter = (array)json_decode($filter, true); | |||
$op = (array)json_decode($op, true); | |||
$filter = $filter ? $filter : []; | |||
$where = []; | |||
$alias = []; | |||
$bind = []; | |||
$name = ''; | |||
$aliasName = ''; | |||
if (!empty($this->model) && $this->relationSearch) { | |||
$name = $this->model->getTable(); | |||
$alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model)))); | |||
$aliasName = $alias[$name] . '.'; | |||
} | |||
$sortArr = explode(',', $sort); | |||
foreach ($sortArr as $index => & $item) { | |||
$item = stripos($item, ".") === false ? $aliasName . trim($item) : $item; | |||
} | |||
unset($item); | |||
$sort = implode(',', $sortArr); | |||
$adminIds = $this->getDataLimitAdminIds(); | |||
if (is_array($adminIds)) { | |||
$where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds]; | |||
} | |||
if ($search) { | |||
$searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields); | |||
foreach ($searcharr as $k => &$v) { | |||
$v = stripos($v, ".") === false ? $aliasName . $v : $v; | |||
} | |||
unset($v); | |||
$where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"]; | |||
} | |||
$index = 0; | |||
foreach ($filter as $k => $v) { | |||
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) { | |||
continue; | |||
} | |||
$sym = isset($op[$k]) ? $op[$k] : '='; | |||
if (stripos($k, ".") === false) { | |||
$k = $aliasName . $k; | |||
} | |||
$v = !is_array($v) ? trim($v) : $v; | |||
$sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym); | |||
//null和空字符串特殊处理 | |||
if (!is_array($v)) { | |||
if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) { | |||
$sym = strtoupper($v); | |||
} | |||
if (in_array($v, ['""', "''"])) { | |||
$v = ''; | |||
$sym = '='; | |||
} | |||
} | |||
switch ($sym) { | |||
case '=': | |||
case '<>': | |||
$where[] = [$k, $sym, (string)$v]; | |||
break; | |||
case 'LIKE': | |||
case 'NOT LIKE': | |||
case 'LIKE %...%': | |||
case 'NOT LIKE %...%': | |||
$where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"]; | |||
break; | |||
case '>': | |||
case '>=': | |||
case '<': | |||
case '<=': | |||
$where[] = [$k, $sym, intval($v)]; | |||
break; | |||
case 'FINDIN': | |||
case 'FINDINSET': | |||
case 'FIND_IN_SET': | |||
$v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v)); | |||
$findArr = array_values($v); | |||
foreach ($findArr as $idx => $item) { | |||
$bindName = "item_" . $index . "_" . $idx; | |||
$bind[$bindName] = $item; | |||
$where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)"; | |||
} | |||
break; | |||
case 'IN': | |||
case 'IN(...)': | |||
case 'NOT IN': | |||
case 'NOT IN(...)': | |||
$where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)]; | |||
break; | |||
case 'BETWEEN': | |||
case 'NOT BETWEEN': | |||
$arr = array_slice(explode(',', $v), 0, 2); | |||
if (stripos($v, ',') === false || !array_filter($arr)) { | |||
continue 2; | |||
} | |||
//当出现一边为空时改变操作符 | |||
if ($arr[0] === '') { | |||
$sym = $sym == 'BETWEEN' ? '<=' : '>'; | |||
$arr = $arr[1]; | |||
} elseif ($arr[1] === '') { | |||
$sym = $sym == 'BETWEEN' ? '>=' : '<'; | |||
$arr = $arr[0]; | |||
} | |||
$where[] = [$k, $sym, $arr]; | |||
break; | |||
case 'RANGE': | |||
case 'NOT RANGE': | |||
$v = str_replace(' - ', ',', $v); | |||
$arr = array_slice(explode(',', $v), 0, 2); | |||
if (stripos($v, ',') === false || !array_filter($arr)) { | |||
continue 2; | |||
} | |||
//当出现一边为空时改变操作符 | |||
if ($arr[0] === '') { | |||
$sym = $sym == 'RANGE' ? '<=' : '>'; | |||
$arr = $arr[1]; | |||
} elseif ($arr[1] === '') { | |||
$sym = $sym == 'RANGE' ? '>=' : '<'; | |||
$arr = $arr[0]; | |||
} | |||
$tableArr = explode('.', $k); | |||
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) { | |||
//修复关联模型下时间无法搜索的BUG | |||
$relation = Loader::parseName($tableArr[0], 1, false); | |||
$alias[$this->model->$relation()->getTable()] = $tableArr[0]; | |||
} | |||
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr]; | |||
break; | |||
case 'NULL': | |||
case 'IS NULL': | |||
case 'NOT NULL': | |||
case 'IS NOT NULL': | |||
$where[] = [$k, strtolower(str_replace('IS ', '', $sym))]; | |||
break; | |||
default: | |||
break; | |||
} | |||
$index++; | |||
} | |||
if (!empty($this->model)) { | |||
$this->model->alias($alias); | |||
} | |||
$model = $this->model; | |||
$where = function ($query) use ($where, $alias, $bind, &$model) { | |||
if (!empty($model)) { | |||
$model->alias($alias); | |||
$model->bind($bind); | |||
} | |||
foreach ($where as $k => $v) { | |||
if (is_array($v)) { | |||
call_user_func_array([$query, 'where'], $v); | |||
} else { | |||
$query->where($v); | |||
} | |||
} | |||
}; | |||
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind]; | |||
} | |||
/** | |||
* 添加 | |||
*/ | |||
public function add() | |||
@@ -246,6 +429,8 @@ class OrderMain extends Backend | |||
*/ | |||
public function subOrderSave(){ | |||
$params=$this->request->post(); | |||
$params['create_id']=$this->auth->id; | |||
$params['group_id']=$this->auth->getGroupId(); | |||
$orderMainService = new OrderMainService(); | |||
Db::startTrans(); | |||
$result = $orderMainService->subOrderSave($params); | |||
@@ -2,6 +2,7 @@ | |||
namespace app\admin\controller; | |||
use app\admin\service\PaymentOrderService; | |||
use app\common\controller\Backend; | |||
/** | |||
@@ -35,6 +36,84 @@ class PaymentOrder extends Backend | |||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | |||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | |||
*/ | |||
/** | |||
* 保存记录 | |||
* @return \think\response\Json | |||
*/ | |||
public function save(){ | |||
$params=$this->request->post(); | |||
$params['create_id']=$this->auth->id; | |||
$params['group_id']=$this->auth->getGroupId(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->save($params); | |||
return json($result); | |||
} | |||
/** | |||
* 获取列表 | |||
* @return \think\response\Json | |||
*/ | |||
public function getList(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->getList($params); | |||
return json($result); | |||
} | |||
/** | |||
* 状态设置 | |||
* @return \think\response\Json | |||
*/ | |||
public function setStatus(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->setStatus($params['id'],$params['status']); | |||
return json($result); | |||
} | |||
/** | |||
* 添加到收款单 | |||
* @return \think\response\Json | |||
*/ | |||
public function addOrderMain(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->addSubOrder($params); | |||
return json($result); | |||
} | |||
/** | |||
* 移除收购单 | |||
* @return \think\response\Json | |||
*/ | |||
public function removeOrderMain(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->removeSubOrder($params); | |||
return json($result); | |||
} | |||
/** | |||
* 获取订单列表 | |||
* @return \think\response\Json | |||
*/ | |||
public function getSubOrderList(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->getSubOrderList($params); | |||
return json($result); | |||
} | |||
/** | |||
* 删除收款单 | |||
*/ | |||
public function delAll(){ | |||
$params=$this->request->post(); | |||
$service = new PaymentOrderService(); | |||
$result = $service->delAll($params['id']); | |||
return json($result); | |||
} | |||
} |
@@ -256,4 +256,14 @@ class ReceiptOrder extends Backend | |||
return json($result); | |||
} | |||
/** | |||
* 删除收款单 | |||
*/ | |||
public function delAll(){ | |||
$params=$this->request->post(); | |||
$service = new ReceiptOrderService(); | |||
$result = $service->delAll($params['id']); | |||
return json($result); | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
* Time: 15:49 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -20,7 +20,7 @@ class AdminDao | |||
* @param int $id | |||
* @return array | |||
*/ | |||
public function getInfoById(int $id) { | |||
public function getInfoById($id) { | |||
try{ | |||
$model = new Admin(); | |||
$info = $model->where(["id"=>$id])->find(); |
@@ -6,7 +6,7 @@ | |||
* Time: 15:20 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; |
@@ -0,0 +1,103 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/23 | |||
* Time: 11:35 | |||
*/ | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
use app\admin\model\CfHotelInfo; | |||
class CfHotelInfoDao | |||
{ | |||
/** | |||
* 添加记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param) | |||
{ | |||
try { | |||
$data = [ | |||
'hotel_name' => $param['hotel_name'], | |||
'hotel_phone' => $param['hotel_phone'], | |||
'area' => $param['area'], | |||
'area_name' => $param['area_name'], | |||
'province' => $param['province'], | |||
'province_name' => $param['province_name'], | |||
'city' => $param['city'], | |||
'city_name' => $param['city_name'], | |||
'detail_address' => $param['detail_address'] | |||
]; | |||
$model = new CfHotelInfo(); | |||
if (empty($param['id'])) { | |||
$data['create_id'] = $param['create_id']; | |||
$data['group_id'] = $param['group_id']; | |||
$id = $model->insertGetId($data); | |||
return Util::returnArrSu("", $id); | |||
} else { | |||
$model->save($data, ['id' => $param['id']]); | |||
return Util::returnArrSu("", $param['id']); | |||
} | |||
} catch (\Exception $e) { | |||
return Util::returnArrEr("更新记录失败:" . $e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param) | |||
{ | |||
try { | |||
$where = ["del_flag"=>0]; | |||
if (!empty($param['hotel_name'])) { | |||
$where['hotel_name'] = ["like","%".$param['hotel_name']."%"]; | |||
} | |||
if (!empty($param['hotel_phone'])) { | |||
$where["hotel_phone"] = $param['hotel_phone']; | |||
} | |||
if (!empty($param['area'])) { | |||
$where["area"] = $param['area']; | |||
} | |||
if (!empty($param['province'])) { | |||
$where["province"] = $param['province']; | |||
} | |||
if (!empty($param['city'])) { | |||
$where["city"] = $param['city']; | |||
} | |||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||
$model = new CfHotelInfo(); | |||
$total = $model->where($where)->count(); | |||
$list = $model->where($where) | |||
->limit($offset, $param['pageSize']) | |||
->order("id","DESC")->select(); | |||
$data = ["total" => $total, "list" => $list->toArray()]; | |||
return Util::returnArrSu("", $data); | |||
} catch (\Exception $e) { | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
/** | |||
* 删除 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function del($id){ | |||
try { | |||
//设置收购单状态 | |||
$model = new CfHotelInfo(); | |||
$model->save(['del_flag' => 1], ['id' => $id]); | |||
return Util::returnArrSu(); | |||
} catch (\Exception $e) { | |||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,106 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/23 | |||
* Time: 17:24 | |||
*/ | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
use app\admin\model\CfItem; | |||
class CfItemDao | |||
{ | |||
/** | |||
* 添加记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param) | |||
{ | |||
try { | |||
$data = [ | |||
'item_type' => $param['item_type'], | |||
'item_name' => $param['item_name'], | |||
'item_unit' => $param['item_unit'], | |||
'item_memo' => $param['item_memo'], | |||
'area' => $param['area'], | |||
'area_name' => $param['area_name'], | |||
'province' => $param['province'], | |||
'province_name' => $param['province_name'], | |||
'city' => $param['city'], | |||
'city_name' => $param['city_name'], | |||
'detail_address' => $param['detail_address'], | |||
'purchase_user_id'=>$param['purchase_user_id'] | |||
]; | |||
$model = new CfItem(); | |||
if (empty($param['id'])) { | |||
$data['create_id'] = $param['create_id']; | |||
$data['group_id'] = $param['group_id']; | |||
$id = $model->insertGetId($data); | |||
return Util::returnArrSu("", $id); | |||
} else { | |||
$model->save($data, ['id' => $param['id']]); | |||
return Util::returnArrSu("", $param['id']); | |||
} | |||
} catch (\Exception $e) { | |||
return Util::returnArrEr("更新记录失败:" . $e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param) | |||
{ | |||
try { | |||
$where = ["del_flag"=>0]; | |||
if (!empty($param['item_name'])) { | |||
$where['item_name'] = ["like","%".$param['item_name']."%"]; | |||
} | |||
if (!empty($param['item_type'])) { | |||
$where["item_type"] = $param['item_type']; | |||
} | |||
if (!empty($param['area'])) { | |||
$where["area"] = $param['area']; | |||
} | |||
if (!empty($param['province'])) { | |||
$where["province"] = $param['province']; | |||
} | |||
if (!empty($param['city'])) { | |||
$where["city"] = $param['city']; | |||
} | |||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||
$model = new CfItem(); | |||
$total = $model->where($where)->count(); | |||
$list = $model->where($where) | |||
->limit($offset, $param['pageSize']) | |||
->order("id","DESC")->select(); | |||
$data = ["total" => $total, "list" => $list->toArray()]; | |||
return Util::returnArrSu("", $data); | |||
} catch (\Exception $e) { | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
/** | |||
* 删除 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function del($id){ | |||
try { | |||
//设置收购单状态 | |||
$model = new CfItem(); | |||
$model->save(['del_flag' => 1], ['id' => $id]); | |||
return Util::returnArrSu(); | |||
} catch (\Exception $e) { | |||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||
} | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
* Time: 16:03 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; |
@@ -6,7 +6,7 @@ | |||
* Time: 13:36 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -218,4 +218,105 @@ class OrderHotelDao | |||
return Util::returnArrEr("获取酒店订单列表异常:".$e->getMessage()); | |||
} | |||
} | |||
/**=====================================**/ | |||
/** | |||
* 更新付款单下的状态 | |||
* @param $paymentOrderId | |||
* @param $status | |||
* @return array | |||
*/ | |||
public function setPaymentOrderStatus($paymentOrderId, $status){ | |||
try{ | |||
$model = new OrderHotel(); | |||
$model->save(['payment_order_status'=>$status],['payment_order_id'=>$paymentOrderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新收款单下的酒店订单状态失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 添加酒店订单到付款单下 | |||
* @param $paymentOrder | |||
* @param $orderIds | |||
* @return array | |||
*/ | |||
public function addSubOrderInPayment($paymentOrder,$orderIds){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>$paymentOrder['id'], | |||
"payment_order_status"=>$paymentOrder['status'], | |||
"payment_order_name"=>$paymentOrder['name'] | |||
]; | |||
$model = new OrderHotel(); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("添加酒店订单到付款单下失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 将酒店订单从付款单下移除 | |||
* @param $orderIds | |||
* @return array | |||
*/ | |||
public function removeSubOrderFormPayment($orderIds){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>0, | |||
"payment_order_status"=>0, | |||
"payment_order_name"=>"" | |||
]; | |||
$model = new OrderHotel(); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将酒店订单从付款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 删除采购单 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function delPaymentOrder($id){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>0, | |||
"payment_order_status"=>0, | |||
"payment_order_name"=>"" | |||
]; | |||
$model = new OrderHotel(); | |||
$model->save($data,["payment_order_id"=>$id]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将酒店订单从付款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取主订单ID | |||
* @param $payment_order_id | |||
* @return array | |||
*/ | |||
public function getOrderMainIdByPayment($payment_order_id){ | |||
$subOrderModel = new OrderHotel(); | |||
try { | |||
$subOrderList = $subOrderModel->where(["payment_order_id" => $payment_order_id, "del_flag" => 0])->select()->toArray(); | |||
if (null == $subOrderList) { | |||
return []; | |||
} | |||
$id = []; | |||
foreach ($subOrderList as $val){ | |||
$id[] = $val['order_id']; | |||
} | |||
return array_unique($id); | |||
}catch (Exception $e) { | |||
return []; | |||
} | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
* Time: 13:36 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -169,4 +169,104 @@ class OrderItemDao | |||
} | |||
/**=====================================**/ | |||
/** | |||
* 更新付款单下的状态 | |||
* @param $paymentOrderId | |||
* @param $status | |||
* @return array | |||
*/ | |||
public function setPaymentOrderStatus($paymentOrderId, $status){ | |||
try{ | |||
$model = new OrderItem(); | |||
$model->save(['payment_order_status'=>$status],['payment_order_id'=>$paymentOrderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新收款单下的附加项目订单状态失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 添加附加项目订单到付款单下 | |||
* @param $paymentOrder | |||
* @param $orderIds | |||
* @return array | |||
*/ | |||
public function addSubOrderInPayment($paymentOrder,$orderIds){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>$paymentOrder['id'], | |||
"payment_order_status"=>$paymentOrder['status'], | |||
"payment_order_name"=>$paymentOrder['name'] | |||
]; | |||
$model = new OrderItem(); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("添加附加项目订单到付款单下失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 将附加项目订单从付款单下移除 | |||
* @param $orderIds | |||
* @return array | |||
*/ | |||
public function removeSubOrderFormPayment($orderIds){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>0, | |||
"payment_order_status"=>0, | |||
"payment_order_name"=>"" | |||
]; | |||
$model = new OrderItem(); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将附加项目订单从付款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 删除采购单 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function delPaymentOrder($id){ | |||
try{ | |||
$data = [ | |||
"payment_order_id"=>0, | |||
"payment_order_status"=>0, | |||
"payment_order_name"=>"" | |||
]; | |||
$model = new OrderItem(); | |||
$model->save($data,["payment_order_id"=>$id]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将附加项目订单从付款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取主订单ID | |||
* @param $payment_order_id | |||
* @return array | |||
*/ | |||
public function getOrderMainIdByPayment($payment_order_id){ | |||
$subOrderModel = new OrderItem(); | |||
try { | |||
$subOrderList = $subOrderModel->where(["payment_order_id" => $payment_order_id, "del_flag" => 0])->select()->toArray(); | |||
if (null == $subOrderList) { | |||
return []; | |||
} | |||
$id = []; | |||
foreach ($subOrderList as $val){ | |||
$id[] = $val['order_id']; | |||
} | |||
return array_unique($id); | |||
}catch (Exception $e) { | |||
return []; | |||
} | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
* Time: 11:26 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -72,21 +72,43 @@ class OrderMainDao | |||
try { | |||
$itemModel = new OrderItem(); | |||
$hotelModel = new OrderHotel(); | |||
$itemList = $itemModel->where(["order_id" => $orderId])->select()->toArray(); | |||
$hotelList = $hotelModel->where(["order_id" => $orderId])->select()->toArray(); | |||
$itemList = $itemModel->where(["order_id" => $orderId,"del_flag"=>0])->select()->toArray(); | |||
$hotelList = $hotelModel->where(["order_id" => $orderId,"del_flag"=>0])->select()->toArray(); | |||
$amount = 0; | |||
$cost = 0; | |||
//状态数量统计 用于统计当前订单的状态 | |||
$statusList = [ | |||
1=>0, | |||
2=>0, | |||
3=>0, | |||
4=>0, | |||
"isPayment"=>0 | |||
]; | |||
$cnt = count($itemList)+count($hotelList); | |||
foreach ($itemList as $item) { | |||
$amount += $item['total_price']; | |||
$cost += $item['total_cost']; | |||
$statusList[$item['confirm_status']]++; | |||
if ($item['payment_order_status'] ==2) { | |||
$statusList['isPayment']++; | |||
} | |||
} | |||
foreach ($hotelList as $hotel) { | |||
$amount += $hotel['total_price']; | |||
$cost += $hotel["total_cost"]; | |||
$statusList[$hotel['confirm_status']]++; | |||
if ($hotel['payment_order_status'] ==2) { | |||
$statusList['isPayment']++; | |||
} | |||
} | |||
$orderInfoRe = $this->getInfoById($orderId); | |||
if (!$orderInfoRe['flag']) { | |||
return $orderInfoRe; | |||
} | |||
$orderStatus = $this->getStatus($cnt,$statusList,$orderInfoRe['data']); | |||
//更新金额 | |||
$orderMain = new OrderMain(); | |||
$orderMain->save(["total_amount" => $amount, "cost_amount" => $cost,"profit_amount"=>$amount-$cost],["id" => $orderId]); | |||
$orderMain->save(["total_amount" => $amount, "cost_amount" => $cost,"profit_amount"=>$amount-$cost,"order_status"=>$orderStatus],["id" => $orderId]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("更新主表订单金额失败:".$e->getMessage()); | |||
@@ -94,6 +116,43 @@ class OrderMainDao | |||
} | |||
/** | |||
* 获取订单状态 | |||
* @param $cnt | |||
* @param $statusList | |||
* @param $orderInfo | |||
* @return int | |||
*/ | |||
public function getStatus($cnt,$statusList,$orderInfo){ | |||
//资源单状态 1、未发单/ 2已发单、3已确认、4已取消 | |||
//订单状态0待处理 1已确认 2部分取消 3处理中 10已完成 11已取消 | |||
//已完成:订单已完成付款、已完成收款(无视子订单状态) | |||
if ($orderInfo['receipt_order_status'] ==2 && $statusList['isPayment'] == $cnt) { | |||
return 10; | |||
} | |||
//全部未发单 待处理:子订单全部未发单 | |||
if ($statusList[1] == $cnt) { | |||
return 0; | |||
} | |||
//全部已确认 已确认:子订单全部已确认 | |||
if ($statusList[3] == $cnt) { | |||
return 1; | |||
} | |||
//全部已取消 已取消:订单中所有子订单已取消 | |||
if ($statusList[4] == $cnt) { | |||
return 11; | |||
} | |||
//部分取消:订单中有子订单取消,其他子订单已确认 | |||
if (($statusList[3]+$statusList[4]) == $cnt ) { | |||
return 2; | |||
} | |||
//处理中:非以上状态,即部分子订单确认、或者部分子订单在已发单,或部分子订单在未发单。 | |||
return 3; | |||
} | |||
/** | |||
* 根据ID获取详情 | |||
* @param $id | |||
* @return array | |||
@@ -143,7 +202,7 @@ class OrderMainDao | |||
} | |||
/** | |||
* 更新采购单下的订单信息 | |||
* 更新收款单下的订单信息 | |||
* @param $receiptOrderId | |||
* @param $status | |||
* @return array | |||
@@ -159,7 +218,7 @@ class OrderMainDao | |||
} | |||
/** | |||
* 添加主订单到采购单下 | |||
* 添加主订单到收款单下 | |||
* @param $receiptOrder | |||
* @param $orderIds | |||
* @return array | |||
@@ -172,15 +231,15 @@ class OrderMainDao | |||
"receipt_order_name"=>$receiptOrder['name'] | |||
]; | |||
$model = new OrderMain(); | |||
$model->save($data,["id"=>$orderIds]); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("添加主订单到采购单下失败".$e->getMessage()); | |||
return Util::returnArrEr("添加主订单到收款单下失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 将主订单从采购单下移除 | |||
* 将主订单从收款单下移除 | |||
* @param $orderIds | |||
* @return array | |||
*/ | |||
@@ -192,10 +251,10 @@ class OrderMainDao | |||
"receipt_order_name"=>"" | |||
]; | |||
$model = new OrderMain(); | |||
$model->save($data,["id"=>$orderIds]); | |||
$model->save($data,["id"=>["in",$orderIds]]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将主订单从采购单下移除失败".$e->getMessage()); | |||
return Util::returnArrEr("将主订单从收款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
@@ -216,4 +275,47 @@ class OrderMainDao | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
/** | |||
* 删除收款单 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function delReceiptOrder($id){ | |||
try{ | |||
$data = [ | |||
"receipt_order_id"=>0, | |||
"receipt_order_status"=>0, | |||
"receipt_order_name"=>"" | |||
]; | |||
$model = new OrderMain(); | |||
$model->save($data,["receipt_order_id"=>$id]); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("将主订单从收款单下移除失败".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取收款单下所有主订单的订单ID | |||
* @param $receipt_order_id | |||
* @return array | |||
*/ | |||
public function getOrderMainIdsByReceipt($receipt_order_id){ | |||
$orderModel = new OrderMain(); | |||
try { | |||
$subOrderList = $orderModel->where(["receipt_order_id" => $receipt_order_id, "del_flag" => 0])->select()->toArray(); | |||
if (null == $subOrderList) { | |||
return []; | |||
} | |||
$id = []; | |||
foreach ($subOrderList as $val){ | |||
$id[] = $val['id']; | |||
} | |||
return array_unique($id); | |||
}catch (Exception $e) { | |||
return []; | |||
} | |||
} | |||
} |
@@ -0,0 +1,236 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/17 | |||
* Time: 17:29 | |||
*/ | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
use app\admin\model\PaymentOrder; | |||
use think\Db; | |||
use think\Exception; | |||
class PaymentOrderDao | |||
{ | |||
/** | |||
* 获取详情 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function getInfoById($id){ | |||
try{ | |||
$model = new PaymentOrder(); | |||
$info = $model->where(["id"=>$id])->find(); | |||
if ($info == null) { | |||
return Util::returnArrEr("获取付款单信息失败:".$id); | |||
} | |||
return Util::returnArrSu("",$info->toArray()); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("获取付款单信息失败:".$e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 添加记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param) | |||
{ | |||
if ($this->checkName($param)) { | |||
return Util::returnArrEr("名称已经存在"); | |||
} | |||
try { | |||
$data = [ | |||
'name' => $param['name'], | |||
"create_id"=>$param['create_id'], | |||
"group_id"=>$param['group_id'] | |||
]; | |||
$receiptOrder = new PaymentOrder(); | |||
if (empty($param['id'])) { | |||
$id = $receiptOrder->insertGetId($data); | |||
return Util::returnArrSu("", $id); | |||
} else { | |||
$receiptOrder->save($data, ['id' => $param['id']]); | |||
return Util::returnArrSu("", $param['id']); | |||
} | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("更新主订单失败:" . $e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 校验名称 | |||
* @param $param | |||
* @return bool | |||
*/ | |||
public function checkName($param):bool { | |||
try { | |||
$model = new PaymentOrder(); | |||
$infoRe = $model->where(["name" => $param['name']])->find(); | |||
if ($infoRe == null) { | |||
return false; | |||
} | |||
$info = $infoRe->toArray(); | |||
if (isset($param['id'])) { | |||
if ($param['id'] != $info['id']) { | |||
return true; | |||
} | |||
}else{ | |||
return true; | |||
} | |||
return false; | |||
} catch (Exception $e) { | |||
return false; | |||
} | |||
} | |||
/** | |||
* 修改状态 | |||
* @param $id | |||
* @param $status | |||
* @return array | |||
*/ | |||
public function setStatus($id, $status) | |||
{ | |||
try { | |||
//设置收购单状态 | |||
$receiptOrder = new PaymentOrder(); | |||
$receiptOrder->save(['status' => $status], ['id' => $id]); | |||
return Util::returnArrSu(); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param) | |||
{ | |||
try { | |||
$where = ["a.del_flag"=>0]; | |||
if (!empty($param['name'])) { | |||
$where['a.name'] = ["like","%".$param['name']."%"]; | |||
} | |||
if ($param['status']."" != 'all') { | |||
$where["a.status"] = $param['status']; | |||
} | |||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||
$receiptOrder = new PaymentOrder(); | |||
$total = $receiptOrder | |||
->alias("a") | |||
->group("a.id") | |||
->where($where)->count(); | |||
$list = $receiptOrder | |||
->alias("a") | |||
->field("a.*, | |||
(SELECT concat('订单:',ifnull( GROUP_CONCAT( id ORDER BY id DESC ), '-' ), '</br>金额:',ifnull( sum( total_price ), '-' )) from hbp_order_item where payment_order_id = a.id) 'item', | |||
(SELECT concat('订单:',ifnull( GROUP_CONCAT( id ORDER BY id DESC ), '-' ), '</br>金额:',ifnull( sum( total_price ), '-' )) from hbp_order_hotel where payment_order_id = a.id) 'hotel' | |||
") | |||
->group("a.id") | |||
->where($where) | |||
->limit($offset, $param['pageSize']) | |||
->order("a.id","DESC")->select(); | |||
$data = ["total" => $total, "list" => $list->toArray()]; | |||
return Util::returnArrSu("", $data); | |||
} catch (Exception $e) { | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
/** | |||
* 删除 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function del($id){ | |||
try { | |||
//设置收购单状态 | |||
$receiptOrder = new PaymentOrder(); | |||
$receiptOrder->save(['del_flag' => 1], ['id' => $id]); | |||
return Util::returnArrSu(); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||
} | |||
} | |||
/** | |||
* 获取子订单列表 | |||
* @param $hotel_where | |||
* @param $item_where | |||
* @param $where | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getSubOrderListByWhere($hotel_where,$item_where,$where,$param):array { | |||
$limit = $param['pageSize']; | |||
$offset = ($param['pageNum']-1)*$param['pageSize']; | |||
$sqlCnt = "SELECT count(1) cnt | |||
from ( | |||
( | |||
SELECT a.order_id,a.id,d.supplier_name,a.trade_order_number,a.item_type 'hotel_name',a.item_name 'room_name', | |||
a.item_unit 'plan_name', | |||
a.check_in_date,a.check_in_date 'check_out_date',d.count,a.create_time,'item' as 'prod_type' | |||
,a.payment_order_name,a.payment_order_status,a.payment_order_id,a.customer_name,a.total_cost,a.total_price,a.confirm_status | |||
from hbp_order_item a | |||
INNER JOIN hbp_purchase d on a.id = d.order_detail_id and d.prod_type='item' | |||
where | |||
$item_where | |||
order by a.create_time desc | |||
) | |||
UNION | |||
( | |||
SELECT b.order_id,b.id,c.supplier_name,b.trade_order_number,b.hotel_name ,b.room_name ,b.plan_name, | |||
b.check_in_date,b.check_out_date,c.count,b.create_time,'hotel' as 'prod_type' | |||
,b.payment_order_name,b.payment_order_status,b.payment_order_id,b.customer_name,b.total_cost,b.total_price,b.confirm_status | |||
from hbp_order_hotel b | |||
INNER JOIN hbp_purchase c on b.id=c.order_detail_id and c.prod_type='hotel' | |||
where | |||
$hotel_where | |||
order by b.create_time desc | |||
) | |||
) x | |||
$where | |||
ORDER BY x.create_time desc"; | |||
$totalRe = Db::query($sqlCnt); | |||
$sql = "SELECT x.* | |||
from ( | |||
( | |||
SELECT a.order_id,a.id,d.supplier_name,a.trade_order_number,a.item_type 'hotel_name',a.item_name 'room_name', | |||
a.item_unit 'plan_name', | |||
a.check_in_date,a.check_in_date 'check_out_date',d.count,a.create_time,'item' as 'prod_type' | |||
,a.payment_order_name,a.payment_order_status,a.payment_order_id,a.customer_name,a.total_cost,a.total_price,a.confirm_status | |||
from hbp_order_item a | |||
INNER JOIN hbp_purchase d on a.id = d.order_detail_id and d.prod_type='item' | |||
where | |||
$item_where | |||
order by a.create_time desc | |||
) | |||
UNION | |||
( | |||
SELECT b.order_id,b.id,c.supplier_name,b.trade_order_number,b.hotel_name ,b.room_name ,b.plan_name, | |||
b.check_in_date,b.check_out_date,c.count,b.create_time,'hotel' as 'prod_type' | |||
,b.payment_order_name,b.payment_order_status,b.payment_order_id,b.customer_name,b.total_cost,b.total_price,b.confirm_status | |||
from hbp_order_hotel b | |||
INNER JOIN hbp_purchase c on b.id=c.order_detail_id and c.prod_type='hotel' | |||
where | |||
$hotel_where | |||
order by b.create_time desc | |||
) | |||
) x | |||
ORDER BY x.create_time desc | |||
limit $limit offset $offset"; | |||
$list = Db::query($sql); | |||
$result = ["list"=>$list,"total"=>$totalRe[0]['cnt']]; | |||
return Util::returnArrSu("",$result); | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
* Time: 16:38 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -88,7 +88,7 @@ class PurchaseDao | |||
} | |||
$data = [ | |||
"order_id" => $itemOrder['order_id'], | |||
"prod_type" => 'hotel', | |||
"prod_type" => 'item', | |||
"order_detail_id" => $itemOrder['id'], | |||
"group_id" => $param['group_id'], | |||
"item_name" => $itemOrder['item_name'], |
@@ -6,7 +6,7 @@ | |||
* Time: 19:19 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; |
@@ -6,7 +6,7 @@ | |||
* Time: 10:20 | |||
*/ | |||
namespace app\admin\service; | |||
namespace app\admin\dao; | |||
use app\admin\command\Util; | |||
@@ -24,14 +24,14 @@ class ReceiptOrderDao | |||
*/ | |||
public function getInfoById($id){ | |||
try{ | |||
$model = new OrderMain(); | |||
$model = new ReceiptOrder(); | |||
$info = $model->where(["id"=>$id])->find(); | |||
if ($info == null) { | |||
return Util::returnArrEr("获取管理员信息失败:".$id); | |||
return Util::returnArrEr("获取收款单信息失败:".$id); | |||
} | |||
return Util::returnArrSu("",$info->toArray()); | |||
}catch (Exception $e){ | |||
return Util::returnArrEr("获取管理员信息失败:".$e->getMessage()); | |||
return Util::returnArrEr("获取收款单信息失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -42,6 +42,9 @@ class ReceiptOrderDao | |||
*/ | |||
public function save($param) | |||
{ | |||
if ($this->checkName($param)) { | |||
return Util::returnArrEr("名称已经存在"); | |||
} | |||
try { | |||
$data = [ | |||
'name' => $param['name'], | |||
@@ -62,6 +65,32 @@ class ReceiptOrderDao | |||
} | |||
/** | |||
* 校验名称 | |||
* @param $param | |||
* @return bool | |||
*/ | |||
public function checkName($param):bool { | |||
try { | |||
$model = new ReceiptOrder(); | |||
$infoRe = $model->where(["name" => $param['name']])->find(); | |||
if ($infoRe == null) { | |||
return false; | |||
} | |||
$info = $infoRe->toArray(); | |||
if (isset($param['id'])) { | |||
if ($param['id'] != $info['id']) { | |||
return true; | |||
} | |||
}else{ | |||
return true; | |||
} | |||
return false; | |||
} catch (Exception $e) { | |||
return false; | |||
} | |||
} | |||
/** | |||
* 修改状态 | |||
* @param $id | |||
* @param $status | |||
@@ -88,11 +117,11 @@ class ReceiptOrderDao | |||
public function getList($param) | |||
{ | |||
try { | |||
$where = []; | |||
$where = ["a.del_flag"=>0]; | |||
if (!empty($param['name'])) { | |||
$where['a.name'] = ["like","%".$param['name']."%"]; | |||
} | |||
if ($param['status'] != 'all') { | |||
if ($param['status']."" != 'all') { | |||
$where["a.status"] = $param['status']; | |||
} | |||
$offset = ($param['pageNum'] - 1) * $param['pageSize']; | |||
@@ -107,7 +136,7 @@ class ReceiptOrderDao | |||
$list = $receiptOrder | |||
->alias("a") | |||
->join('hbp_order_main b', 'a.id = b.receipt_order_id', 'left') | |||
->field("a.*,GROUP_CONCAT(b.id) order_ids,sum(b.total_amount) total_amount") | |||
->field("a.*,GROUP_CONCAT(b.id ORDER BY b.id DESC) order_ids,sum(b.total_amount) total_amount") | |||
->group("a.id") | |||
->where($where) | |||
->limit($offset, $param['pageSize']) | |||
@@ -118,4 +147,20 @@ class ReceiptOrderDao | |||
return Util::returnArrSu("", ["total" => 0, "list" => []]); | |||
} | |||
} | |||
/** | |||
* 删除 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function del($id){ | |||
try { | |||
//设置收购单状态 | |||
$receiptOrder = new ReceiptOrder(); | |||
$receiptOrder->save(['del_flag' => 1], ['id' => $id]); | |||
return Util::returnArrSu(); | |||
} catch (Exception $e) { | |||
return Util::returnArrEr("修改状态失败" . $e->getMessage()); | |||
} | |||
} | |||
} |
@@ -4,7 +4,7 @@ return [ | |||
'Id' => '附加项目ID', | |||
'Item_type' => '附件项目类型', | |||
'Item_name' => '附件项目名称', | |||
'Item_unit' => '计价单位 件、份、匝、张等', | |||
'Item_unit' => '计价单位', | |||
'Item_memo' => '附件项目说明', | |||
'Item_log' => '日志', | |||
'Country_id' => '国家ID', | |||
@@ -7,7 +7,7 @@ return [ | |||
'Item_type' => '附加项目类型', | |||
'Item_name' => '附加项目名称', | |||
'Item_memo' => '附加项目说明', | |||
'Item_unit' => '计价单位 件、份、匝、张等', | |||
'Item_unit' => '计价单位', | |||
'Use_date' => '使用日期', | |||
'Prod_num' => '产品数量', | |||
'Total_price' => '总金额', | |||
@@ -31,12 +31,13 @@ class CfHotelInfo extends Model | |||
public function getList($name='',$keyValue=''){ | |||
$this->field('id,hotel_name as name'); | |||
$where = ["del_flag"=>0]; | |||
if($keyValue){ | |||
$this->where(['id'=>$keyValue]); | |||
$where = ['id'=>$keyValue,"del_flag"=>0]; | |||
}elseif($name){ | |||
$this->where(['hotel_name'=>['like','%'.$name.'%']]); | |||
$where = ['hotel_name'=>['like','%'.$name.'%'],"del_flag"=>0]; | |||
} | |||
return $this->select()->toArray(); | |||
return $this->where($where)->select()->toArray(); | |||
} | |||
@@ -0,0 +1,45 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/23 | |||
* Time: 11:34 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\dao\CfHotelInfoDao; | |||
class CfHotelInfoService | |||
{ | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param){ | |||
$dao = new CfHotelInfoDao(); | |||
return $dao->getList($param); | |||
} | |||
/** | |||
* 保存记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param){ | |||
$dao = new CfHotelInfoDao(); | |||
return $dao->save($param); | |||
} | |||
/** | |||
* 删除记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function del($param){ | |||
$dao = new CfHotelInfoDao(); | |||
return $dao->del($param['id']); | |||
} | |||
} |
@@ -0,0 +1,45 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/23 | |||
* Time: 17:23 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\dao\CfItemDao; | |||
class CfItemService | |||
{ | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param){ | |||
$dao = new CfItemDao(); | |||
return $dao->getList($param); | |||
} | |||
/** | |||
* 保存记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param){ | |||
$dao = new CfItemDao(); | |||
return $dao->save($param); | |||
} | |||
/** | |||
* 删除记录 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function del($param){ | |||
$dao = new CfItemDao(); | |||
return $dao->del($param['id']); | |||
} | |||
} |
@@ -3,13 +3,11 @@ | |||
namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\model\OrderHotel; | |||
use app\admin\model\OrderItem; | |||
use app\admin\model\OrderMain; | |||
use app\admin\model\Purchase; | |||
use app\admin\model\PurchasePrice; | |||
use think\Exception; | |||
use think\Url; | |||
use app\admin\dao\OrderHotelDao; | |||
use app\admin\dao\OrderItemDao; | |||
use app\admin\dao\OrderMainDao; | |||
use app\admin\dao\PurchaseDao; | |||
use app\admin\dao\PurchasePriceDao; | |||
/** | |||
* Created by PhpStorm. | |||
@@ -35,6 +33,9 @@ class OrderMainService | |||
if (!$addOrderMain["flag"]) { | |||
return $addOrderMain; | |||
} | |||
if (!isset($param['subOrderList']) || count($param['subOrderList'])==0) { | |||
return Util::returnArrSu("成功",$addOrderMain['data']); | |||
} | |||
$orderId = $addOrderMain['data']; | |||
//所有子订单设置为删除 | |||
$orderHotelDao = new OrderHotelDao(); | |||
@@ -109,7 +110,7 @@ class OrderMainService | |||
if (!$setOrderMainRe['flag']) { | |||
return $setOrderMainRe; | |||
} | |||
return Util::returnArrSu("",$orderId); | |||
return Util::returnArrSu("成功",$orderId); | |||
} | |||
/** | |||
@@ -135,20 +136,22 @@ class OrderMainService | |||
} | |||
$subOrderId = $addSubOrder['data']; | |||
$subOrderInfo = $subOrderDao->getInfoById($subOrderId); | |||
if (!$subOrderInfo['flag']) { | |||
return $subOrderInfo; | |||
} | |||
/** | |||
* 2.1添加子订单下的采购单 | |||
*/ | |||
$purchaseDao = new PurchaseDao(); | |||
if ($subOrderParam['prod_type'] == 'hotel') { | |||
$addPurchase = $purchaseDao->saveHotelPurchase($subOrderParam, $subOrderInfo); | |||
$addPurchase = $purchaseDao->saveHotelPurchase($subOrderParam, $subOrderInfo['data']); | |||
} else { | |||
$addPurchase = $purchaseDao->saveItemPurchase($subOrderParam, $subOrderInfo); | |||
$addPurchase = $purchaseDao->saveItemPurchase($subOrderParam, $subOrderInfo['data']); | |||
} | |||
if (!$addPurchase['flag']) { | |||
return $addPurchase; | |||
} | |||
$purchaseId = $addPurchase['id']; | |||
$purchaseId = $addPurchase['data']; | |||
/** | |||
* 2.1.1添加采购单的每日价格 | |||
@@ -182,7 +185,7 @@ class OrderMainService | |||
if (!$setOrderMainRe['flag']) { | |||
return $setOrderMainRe; | |||
} | |||
return Util::returnArrSu("",$subOrderId); | |||
return Util::returnArrSu("保存成功",$subOrderId); | |||
} | |||
/** | |||
@@ -211,8 +214,8 @@ class OrderMainService | |||
//重新计算订单总金额 | |||
$orderMainDao = new OrderMainDao(); | |||
$orderMainDao->setOrderAmount($subOrderRe['data']['order_id']); | |||
return Util::returnArrSu(); | |||
}catch (Exception $e){ | |||
return Util::returnArrSu("成功"); | |||
}catch (\Exception $e){ | |||
return Util::returnArrEr("删除子订单失败:".$e->getMessage()); | |||
} | |||
} | |||
@@ -263,6 +266,6 @@ class OrderMainService | |||
return $subOrderList; | |||
} | |||
$orderMain["subOrderList"]=$subOrderList['data']; | |||
return Util::returnArrSu("",$orderMain); | |||
return Util::returnArrSu("成功",$orderMain); | |||
} | |||
} |
@@ -0,0 +1,250 @@ | |||
<?php | |||
/** | |||
* Created by PhpStorm. | |||
* User: nizongfeng | |||
* Date: 2021/11/17 | |||
* Time: 17:29 | |||
*/ | |||
namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\dao\OrderHotelDao; | |||
use app\admin\dao\OrderItemDao; | |||
use app\admin\dao\OrderMainDao; | |||
use app\admin\dao\PaymentOrderDao; | |||
use think\Db; | |||
class PaymentOrderService | |||
{ | |||
/** | |||
* 保存详情 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function save($param){ | |||
//保存 | |||
$dao = new PaymentOrderDao(); | |||
$addRe = $dao->save($param); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
* 获取列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getList($param){ | |||
$dao = new PaymentOrderDao(); | |||
return $dao->getList($param); | |||
} | |||
/** | |||
* 设置状态 | |||
* @param $id | |||
* @param $status | |||
* @return array | |||
*/ | |||
public function setStatus($id,$status) { | |||
Db::startTrans(); | |||
//1.设置收购单状态 | |||
$dao = new PaymentOrderDao(); | |||
$statusRe = $dao->setStatus($id,$status); | |||
if (!$statusRe['flag']) { | |||
Db::rollback(); | |||
return$statusRe; | |||
} | |||
//2.设置所有订单表的状态 | |||
$hotelDao = new OrderHotelDao(); | |||
$hotelRe = $hotelDao->setPaymentOrderStatus($id,$status); | |||
if (!$hotelRe['flag']) { | |||
Db::rollback(); | |||
return $hotelRe; | |||
} | |||
$itemDao = new OrderItemDao(); | |||
$itemRe = $itemDao->setPaymentOrderStatus($id,$status); | |||
if (!$itemRe['flag']) { | |||
Db::rollback(); | |||
return $itemRe; | |||
} | |||
//3.获取所有子订单对应的主订单ID | |||
$hotelIds = $hotelDao->getOrderMainIdByPayment($id); | |||
$itemIds = $itemDao->getOrderMainIdByPayment($id); | |||
$orderMainIds = array_unique(array_merge($hotelIds,$itemIds)); | |||
$orderMainDao = new OrderMainDao(); | |||
foreach ($orderMainIds as $orderId) { | |||
$setRe = $orderMainDao->setOrderAmount($orderId); | |||
if (!$setRe['flag']) { | |||
Db::rollback(); | |||
return $setRe; | |||
} | |||
} | |||
Db::commit(); | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
* 添加子订单到付款单 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function addSubOrder($param){ | |||
$model = new PaymentOrderDao(); | |||
$infoRe = $model->getInfoById($param['id']); | |||
if (!$infoRe['flag']) { | |||
return $infoRe; | |||
} | |||
if (isset($param['hotel_id']) && count($param['hotel_id'])>0) { | |||
$orderMainDao = new OrderHotelDao(); | |||
$addRe = $orderMainDao->addSubOrderInPayment($infoRe['data'],$param['hotel_id']); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
} | |||
if (isset($param['item_id']) && count($param['item_id'])>0) { | |||
$orderMainDao = new OrderItemDao(); | |||
$addRe = $orderMainDao->addSubOrderInPayment($infoRe['data'],$param['item_id']); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
} | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
* 移除子订单 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function removeSubOrder($param){ | |||
if (isset($param['hotel_id']) && count($param['hotel_id'])>0) { | |||
$orderMainDao = new OrderHotelDao(); | |||
$addRe = $orderMainDao->removeSubOrderFormPayment($param['hotel_id']); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
} | |||
if (isset($param['item_id']) && count($param['item_id'])>0) { | |||
$orderMainDao = new OrderItemDao(); | |||
$addRe = $orderMainDao->removeSubOrderFormPayment($param['item_id']); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
} | |||
return Util::returnArrSu(""); | |||
} | |||
/** | |||
* 获取子订单列表 | |||
* @param $param | |||
* @return array | |||
*/ | |||
public function getSubOrderList($param){ | |||
$dao = new PaymentOrderDao(); | |||
$item_where_arr = ["d.del_flag=0","a.del_flag=0"]; | |||
$hotel_where_arr = ["c.del_flag=0","b.del_flag=0"]; | |||
$where_arr = []; | |||
if ($param['prod_type']=='hotel'){ | |||
$item_where_arr[] = " a.id = 0 "; | |||
}else{ | |||
$hotel_where_arr[]=" b.id = 0 "; | |||
} | |||
if (!empty($param['order_id'])) { | |||
$item_where_arr[] = " a.id = {$param["order_id"]} "; | |||
$hotel_where_arr[]=" b.id = {$param['order_id']} "; | |||
} | |||
if (!empty($param['supplier_id'])) { | |||
$item_where_arr[] = " d.supplier_id = {$param["supplier_id"]} "; | |||
$hotel_where_arr[]=" c.supplier_id = {$param['supplier_id']} "; | |||
} | |||
if (!empty($param['confirm_status'])) { | |||
$item_where_arr[] = " a.confirm_status = {$param["confirm_status"]} "; | |||
$hotel_where_arr[]=" b.confirm_status = {$param['confirm_status']} "; | |||
} | |||
if (!empty($param['customer_name'])) { | |||
$item_where_arr[] = " a.customer_name like %{$param["customer_name"]}% "; | |||
$hotel_where_arr[]=" b.customer_name like %{$param['customer_name']}% "; | |||
} | |||
if (!empty($param['item_id'])) { | |||
$item_where_arr[] = " a.item_id = {$param["item_id"]} "; | |||
} | |||
if (!empty($param['hotel_id'])) { | |||
$item_where_arr[] = " a.hotel_id = {$param["hotel_id"]} "; | |||
} | |||
switch ($param['inPayment']) { | |||
case 1: | |||
$item_where_arr[] = " a.payment_order_id = {$param["payment_order_id"]} "; | |||
$hotel_where_arr[]=" b.payment_order_id = {$param['payment_order_id']} "; | |||
break; | |||
case 2: | |||
$item_where_arr[] = " a.payment_order_id != {$param["payment_order_id"]} "; | |||
$hotel_where_arr[]=" b.payment_order_id != {$param['payment_order_id']} "; | |||
break; | |||
case 3: | |||
$item_where_arr[] = " a.payment_order_id = '' "; | |||
$hotel_where_arr[]=" b.payment_order_id = '' "; | |||
} | |||
//金额区间查询 | |||
if (!empty($param['startMoney'])) { | |||
$item_where_arr[] = " a.total_cost >= {$param["startMoney"]} "; | |||
$hotel_where_arr[]=" b.total_cost >= {$param['startMoney']} "; | |||
} | |||
if (!empty($param['endMoney'])) { | |||
$item_where_arr[] = " a.total_cost <= {$param["endMoney"]} "; | |||
$hotel_where_arr[]=" b.total_cost <= {$param['endMoney']} "; | |||
} | |||
//时间区间查询 | |||
if (!empty($param['startTime']) ) { | |||
$item_where_arr[] = " a.create_time >= {$param["startTime"]} 00:00:00 "; | |||
$hotel_where_arr[]=" b.create_time >= {$param['startTime']} 00:00:00 "; | |||
} | |||
if (!empty($param['endTime'])) { | |||
$item_where_arr[] = " a.create_time <= {$param["endTime"]} 23:59:59 "; | |||
$hotel_where_arr[]=" b.create_time <= {$param['endTime']} 23:59:59 "; | |||
} | |||
return $dao->getSubOrderListByWhere(join(" and ",$hotel_where_arr),join(" and ",$item_where_arr),join(" and ",$where_arr),$param); | |||
} | |||
/** | |||
* 删除付款单 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function delAll($id){ | |||
Db::startTrans(); | |||
//1.删除付款单下的附加项目订单 | |||
$itemDao = new OrderItemDao(); | |||
$itemRe = $itemDao->delPaymentOrder($id); | |||
if (!$itemRe['flag']) { | |||
Db::rollback(); | |||
return $itemRe; | |||
} | |||
//1.删除付款单下的酒店订单 | |||
$hotelDao = new OrderHotelDao(); | |||
$hotelRe = $hotelDao->delPaymentOrder($id); | |||
if (!$hotelRe['flag']) { | |||
Db::rollback(); | |||
return $hotelRe; | |||
} | |||
//2.删除付款单 | |||
$model = new PaymentOrderDao(); | |||
$delRe = $model->del($id); | |||
if (!$delRe['flag']) { | |||
Db::rollback(); | |||
return $delRe; | |||
} | |||
Db::commit(); | |||
return Util::returnArrSu(); | |||
} | |||
} |
@@ -10,8 +10,9 @@ namespace app\admin\service; | |||
use app\admin\command\Util; | |||
use app\admin\dao\OrderMainDao; | |||
use app\admin\dao\ReceiptOrderDao; | |||
use think\Db; | |||
use think\Exception; | |||
class ReceiptOrderService | |||
{ | |||
@@ -22,8 +23,14 @@ class ReceiptOrderService | |||
* @return array | |||
*/ | |||
public function save($param){ | |||
//保存 | |||
$dao = new ReceiptOrderDao(); | |||
return $dao->save($param); | |||
$addRe = $dao->save($param); | |||
if (!$addRe['flag']) { | |||
return $addRe; | |||
} | |||
return Util::returnArrSu(); | |||
} | |||
/** | |||
@@ -58,6 +65,16 @@ class ReceiptOrderService | |||
Db::rollback(); | |||
return $orderRe; | |||
} | |||
//3.设置订单状态 | |||
$orderIds = $orderDao->getOrderMainIdsByReceipt($id); | |||
foreach ($orderIds as $orderId) { | |||
$setRe = $orderDao->setOrderAmount($orderId); | |||
if (!$setRe['flag']) { | |||
Db::rollback(); | |||
return $setRe; | |||
} | |||
} | |||
Db::commit(); | |||
return Util::returnArrSu(); | |||
@@ -106,9 +123,45 @@ class ReceiptOrderService | |||
if (!empty($param['order_id'])) { | |||
$where["order"]=$param['order_id']; | |||
} | |||
if (!empty($param['channel_id'])) { | |||
$where['channel_id'] = $param['channel_id']; | |||
} | |||
if ($param['order_status'] != '') { | |||
$where['order_status'] = $param['order_status']; | |||
} | |||
if (!empty($param['commissioner_id'])) { | |||
$where['commissioner_id'] = $param['commissioner_id']; | |||
} | |||
if (!empty($param['user_name'])) { | |||
$where['user_name'] = ["like","%".$param['user_name']."%"]; | |||
} | |||
if (!empty($param['user_phone'])) { | |||
$where['user_phone'] = $param['user_phone']; | |||
} | |||
if (!empty($param['create_id'])) { | |||
$where['create_id'] = $param['create_id']; | |||
} | |||
//金额区间查询 | |||
if (!empty($param['startMoney'])&& empty($param['endMoney'])) { | |||
$where['total_amount'] = [">=",$param['startMoney']]; | |||
} | |||
if (!empty($param['endMoney']) && empty($param['startMoney'])) { | |||
$where['total_amount'] = ["<=",$param['endMoney']]; | |||
} | |||
if (!empty($param['endMoney']) && !empty($param['startMoney'])) { | |||
$where['total_amount'] = ["between",[$param['startMoney'],$param['endMoney']]]; | |||
} | |||
//时间区间查询 | |||
if (!empty($param['startTime']) && empty($param['endTime'])) { | |||
$where['create_time'] = [">=",$param['startTime']." 00:00:00"]; | |||
} | |||
if (!empty($param['endTime'])&& empty($param['startTime'])) { | |||
$where['create_time'] = ["<=",$param['endTime']." 23:59:59"]; | |||
} | |||
if(!empty($param['endTime'])&& !empty($param['startTime'])){ | |||
$where['create_time'] = ["between",[$param['startTime']." 00:00:00",$param['endTime']." 23:59:59"]]; | |||
} | |||
switch ($param['inReceipt']) { | |||
case 0: | |||
break; | |||
case 1: | |||
$where["receipt_order_id"] = $param['receipt_order_id']; | |||
break; | |||
@@ -120,4 +173,29 @@ class ReceiptOrderService | |||
} | |||
return $orderMainDao->getOrderListByWhere($where,$param); | |||
} | |||
/** | |||
* 删除采购单 | |||
* @param $id | |||
* @return array | |||
*/ | |||
public function delAll($id){ | |||
Db::startTrans(); | |||
//1.删除采购单下的主订单 | |||
$orderMainDao = new OrderMainDao(); | |||
$delReceipt = $orderMainDao->delReceiptOrder($id); | |||
if (!$delReceipt['flag']) { | |||
Db::rollback(); | |||
return $delReceipt; | |||
} | |||
//2.删除采购单 | |||
$model = new ReceiptOrderDao(); | |||
$delRe = $model->del($id); | |||
if (!$delRe['flag']) { | |||
Db::rollback(); | |||
return $delRe; | |||
} | |||
Db::commit(); | |||
return Util::returnArrSu(); | |||
} | |||
} |
@@ -1,35 +1,438 @@ | |||
<div class="panel panel-default panel-intro"> | |||
{:build_heading()} | |||
<div class="panel-body"> | |||
<div id="myTabContent" class="tab-content"> | |||
<div class="tab-pane fade active in" id="one"> | |||
<div class="widget-body no-padding"> | |||
<div id="toolbar" class="toolbar"> | |||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | |||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('cf_hotel_info/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | |||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('cf_hotel_info/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('cf_hotel_info/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('cf_hotel_info/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | |||
<div class="dropdown btn-group {:$auth->check('cf_hotel_info/multi')?'':'hide'}"> | |||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | |||
<ul class="dropdown-menu text-left" role="menu"> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" | |||
data-operate-edit="{:$auth->check('cf_hotel_info/edit')}" | |||
data-operate-del="{:$auth->check('cf_hotel_info/del')}" | |||
width="100%"> | |||
</table> | |||
</div> | |||
</div> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<!-- import CSS --> | |||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||
</head> | |||
<body> | |||
<div id="app" class="table"> | |||
<div> | |||
<div class="header-search"> | |||
<span>名称:</span> | |||
<el-input v-model="search.hotel_name" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
<span>手机号:</span> | |||
<el-input v-model="search.hotel_phone" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
<span>省份</span> | |||
<el-select v-model="search.province" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in province" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<span>市</span> | |||
<el-select v-model="search.city" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in city" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<span>区</span> | |||
<el-select v-model="search.area" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in area" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | |||
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增</el-button> | |||
</div> | |||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | |||
style="font-size:12px;width: 100%;margin-top: 12px"> | |||
<el-table-column prop="id" label="酒店ID" min-width="50"></el-table-column> | |||
<el-table-column prop="hotel_name" label="名称" min-width="180"></el-table-column> | |||
<el-table-column prop="hotel_phone" label="手机号" min-width="100"></el-table-column> | |||
<el-table-column prop="province_name" label="省" min-width="90"></el-table-column> | |||
<el-table-column prop="city_name" label="市" min-width="90"></el-table-column> | |||
<el-table-column prop="area_name" label="区" min-width="90"></el-table-column> | |||
<el-table-column prop="detail_address" label="详细地址" min-width="250"></el-table-column> | |||
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column> | |||
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column> | |||
<el-table-column label="操作" min-width="180"> | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button> | |||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<el-pagination | |||
:page-size="search.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
:current-page="search.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeChange" | |||
@current-change="getData" | |||
@prev-click="getData" | |||
@next-click="getData" | |||
></el-pagination> | |||
</div> | |||
<transition name="bounce" v-if="editShow"> | |||
<el-dialog title="付款单详情" :visible.sync="editShow" width="90%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item v-if="editType" label="ID:" style="width: 80%"> | |||
<div v-html="editData.id"></div> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="名称:" style="width: 80%"> | |||
<el-input v-model="editData.hotel_name" style="width: 280px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="手机号:" style="width: 80%"> | |||
<el-input v-model="editData.hotel_phone" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div style="display: flex"> | |||
<el-form-item label="省:" > | |||
<el-select v-model="editData.province" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in province" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="市:" > | |||
<el-select v-model="editData.city" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in edit_city" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="区:" > | |||
<el-select v-model="editData.area" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in edit_area" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="详细地址:" style="width: 80%"> | |||
<el-input v-model="editData.detail_address" style="width: 580px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-button type="primary" @click="editDoing()" >保存</el-button> | |||
</div> | |||
</el-form> | |||
</el-dialog> | |||
</transition> | |||
</div> | |||
</body> | |||
<!-- import Vue before Element --> | |||
<script src="/assets/js/vue/vue.js"></script> | |||
<!-- import JavaScript --> | |||
<script src="/assets/js/vue/index.js"></script> | |||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |||
<script> | |||
new Vue({ | |||
el: '#app', | |||
data: function () { | |||
return { | |||
search: { | |||
hotel_name: "", | |||
hotel_phone: "", | |||
province:"", | |||
city:"", | |||
area: "", | |||
pageSize:10, | |||
pageNum: 1 | |||
}, | |||
total: 0, | |||
tableData: [], | |||
editShow: false, | |||
editType: false, | |||
editData: { | |||
}, | |||
province: [], | |||
city: [], | |||
area:[], | |||
edit_city_set:3, | |||
edit_city: [], | |||
edit_area:[], | |||
} | |||
}, | |||
created() { | |||
this.getProvince(); | |||
this.getData(1) | |||
}, | |||
watch: { | |||
"search.province" : function (newVal,oldVal){ | |||
this.city = [] | |||
this.area = [] | |||
this.search.city="" | |||
this.search.area="" | |||
if (newVal==''){ | |||
return false; | |||
} | |||
let row = { | |||
"province":newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.city = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"search.city" : function (newVal,oldVal){ | |||
this.area = [] | |||
this.search.area="" | |||
if (newVal == "") { | |||
return false; | |||
} | |||
let row = { | |||
province:this.search.province, | |||
city:newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.area = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"editData.province" : function (newVal,oldVal){ | |||
if (this.edit_city_set==3) { | |||
this.edit_city = [] | |||
this.edit_area = [] | |||
this.editData.city="" | |||
this.editData.area="" | |||
} | |||
if (newVal==''){ | |||
return false; | |||
} | |||
let row = { | |||
"province":newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.edit_city = data.data; | |||
this.edit_city_set++; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"editData.city" : function (newVal,oldVal){ | |||
if (this.edit_city_set==3) { | |||
this.edit_area = [] | |||
this.editData.area="" | |||
} | |||
if (newVal == "") { | |||
return false; | |||
} | |||
let row = { | |||
province:this.editData.province, | |||
city:newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.edit_area = data.data; | |||
this.edit_city_set++; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
} | |||
}, | |||
methods: { | |||
getProvince(){ | |||
axios.post("/hotel.php/ajax/areaList", {}).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.province = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
sizeChange(pageSize) { | |||
this.search.pageSize = pageSize; | |||
this.getData(this.search.pageNum) | |||
}, | |||
//獲取列表 | |||
getData(page) { | |||
this.search.pageNum = page; | |||
axios.post("/hotel.php/cf_hotel_info/getList", this.search).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.tableData = data.data.list; | |||
this.total = data.data.total; | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
edit(info) { | |||
if (info == null) { | |||
this.editType = false; | |||
this.editData = { | |||
hotel_name: "", | |||
hotel_phone: "", | |||
province:"", | |||
city:"", | |||
area: "", | |||
detail_address:"" | |||
} | |||
} else { | |||
this.edit_city_set = 1; | |||
this.editType = true; | |||
this.editData = { | |||
id:info.id, | |||
hotel_name: info.hotel_name, | |||
hotel_phone: info.hotel_phone, | |||
province:info.province, | |||
province_name:info.province_name, | |||
city:info.city, | |||
city_name:info.city_name, | |||
area: info.area, | |||
area_name:info.area_name, | |||
detail_address:info.detail_address | |||
} | |||
} | |||
this.editShow = true; | |||
}, | |||
setAreaName(){ | |||
for (let i = 0; i < this.province.length; i++) { | |||
if (this.province[i].value == this.editData.province) { | |||
this.editData.province_name = this.province[i].name; | |||
break | |||
} | |||
} | |||
for (let i = 0; i < this.edit_city.length; i++) { | |||
if (this.edit_city[i].value == this.editData.city) { | |||
this.editData.city_name = this.edit_city[i].name; | |||
break | |||
} | |||
} | |||
for (let i = 0; i < this.edit_area.length; i++) { | |||
if (this.edit_area[i].value == this.editData.area) { | |||
this.editData.area_name = this.edit_area[i].name; | |||
break; | |||
} | |||
} | |||
}, | |||
editDoing(){ | |||
if (this.editData.hotel_name==''){ | |||
this.$message.error("名称不能为空");return false; | |||
} | |||
if (this.editData.hotel_phone==''){ | |||
this.$message.error("手机号不能为空");return false; | |||
} | |||
if (this.editData.province==''){ | |||
this.$message.error("省不能为空");return false; | |||
} | |||
if (this.editData.city==''){ | |||
this.$message.error("市不能为空");return false; | |||
} | |||
if (this.editData.area==''){ | |||
this.$message.error("区不能为空");return false; | |||
} | |||
this.setAreaName(); | |||
axios.post("/hotel.php/cf_hotel_info/save", this.editData).then( (response)=> { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.$message({ | |||
message: '保存成功!', | |||
type: 'success' | |||
}); | |||
this.editShow = false; | |||
this.getData(1); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
}); | |||
}, | |||
delAll(id){ | |||
this.$confirm('确定删除酒店?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
let param = { | |||
id: id | |||
} | |||
axios.post("/hotel.php/cf_hotel_info/delAll", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.getData(this.search.pageNum) | |||
this.$message.success("保存成功"); | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
this.getData(this.search.pageNum) | |||
}) | |||
} | |||
} | |||
}) | |||
</script> | |||
<style lang="scss" scoped> | |||
.el-table thead { | |||
background-color: #5a5e66 !important; | |||
} | |||
.header-search { | |||
font-size: 14px; | |||
font-weight: 900; | |||
} | |||
body { | |||
background-color: white; | |||
} | |||
.table { | |||
width: 100%; | |||
font-size: 12px; | |||
margin-top: 12px; | |||
background-color: white; | |||
} | |||
.el-form-item{ | |||
margin-bottom: 5px !important; | |||
} | |||
</style> | |||
</html> |
@@ -16,7 +16,7 @@ | |||
<div class="form-group"> | |||
<label class="control-label col-xs-12 col-sm-2">{:__('Item_unit')}:</label> | |||
<div class="col-xs-12 col-sm-8"> | |||
<input id="c-item_unit" data-rule="required" data-source="general/config/getList?key=site.item_unit" class="form-control selectpage" name="row[item_unit]" type="text" value="{$row.item_type|htmlentities}> | |||
<input id="c-item_unit" data-rule="required" data-source="general/config/getList?key=site.item_unit" class="form-control selectpage" name="row[item_unit]" type="text" value="{$row.item_type|htmlentities}"> | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
@@ -1,35 +1,527 @@ | |||
<div class="panel panel-default panel-intro"> | |||
{:build_heading()} | |||
<div class="panel-body"> | |||
<div id="myTabContent" class="tab-content"> | |||
<div class="tab-pane fade active in" id="one"> | |||
<div class="widget-body no-padding"> | |||
<div id="toolbar" class="toolbar"> | |||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | |||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('cf_item/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | |||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('cf_item/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('cf_item/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('cf_item/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | |||
<div class="dropdown btn-group {:$auth->check('cf_item/multi')?'':'hide'}"> | |||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | |||
<ul class="dropdown-menu text-left" role="menu"> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | |||
</ul> | |||
</div> | |||
</div> | |||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" | |||
data-operate-edit="{:$auth->check('cf_item/edit')}" | |||
data-operate-del="{:$auth->check('cf_item/del')}" | |||
width="100%"> | |||
</table> | |||
</div> | |||
</div> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<!-- import CSS --> | |||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||
</head> | |||
<body> | |||
<div id="app" class="table"> | |||
<div> | |||
<div class="header-search"> | |||
<span>名称:</span> | |||
<el-input v-model="search.item_name" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
<span>类型:</span> | |||
<el-select v-model="search.item_type" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in type_list" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>省份</span> | |||
<el-select v-model="search.province" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in province" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<span>市</span> | |||
<el-select v-model="search.city" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in city" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<span>区</span> | |||
<el-select v-model="search.area" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option | |||
v-for="item in area" | |||
:key="item.value" | |||
:label="item.name" | |||
:value="item.value"> | |||
</el-option> | |||
</el-select> | |||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | |||
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增</el-button> | |||
</div> | |||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | |||
style="font-size:12px;width: 100%;margin-top: 12px"> | |||
<el-table-column prop="id" label="ID" min-width="50"></el-table-column> | |||
<el-table-column prop="item_type" label="类型" min-width="70" :formatter="getTypeName" ></el-table-column> | |||
<el-table-column prop="item_name" label="名称" min-width="180"></el-table-column> | |||
<el-table-column prop="item_unit" label="计价单位" min-width="70" :formatter="getUnitName" ></el-table-column> | |||
<el-table-column prop="purchase_user_id" label="采购负责人" :formatter="getUserName" min-width="80"></el-table-column> | |||
<el-table-column prop="province_name" label="省" min-width="80"></el-table-column> | |||
<el-table-column prop="city_name" label="市" min-width="80"></el-table-column> | |||
<el-table-column prop="area_name" label="区" min-width="80"></el-table-column> | |||
<el-table-column prop="detail_address" label="详细地址" min-width="250"></el-table-column> | |||
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column> | |||
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column> | |||
<el-table-column label="操作" min-width="180"> | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button> | |||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<el-pagination | |||
:page-size="search.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
:current-page="search.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeChange" | |||
@current-change="getData" | |||
@prev-click="getData" | |||
@next-click="getData" | |||
></el-pagination> | |||
</div> | |||
<transition name="bounce" v-if="editShow"> | |||
<el-dialog title="付款单详情" :visible.sync="editShow" width="90%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item v-if="editType" label="ID:" style="width: 80%"> | |||
<div v-html="editData.id"></div> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="名称:" style="width: 80%"> | |||
<el-input v-model="editData.item_name" style="width: 280px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="类型:" > | |||
<el-select v-model="editData.item_type" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in type_list" :key="item.id" :label="item.name" :value="item.id"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="计价单位:" > | |||
<el-select v-model="editData.item_unit" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in unit_list" :key="item.id" :label="item.name" :value="item.id"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
</div> | |||
<div style="display: flex"> | |||
<el-form-item label="省:" > | |||
<el-select v-model="editData.province" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in province" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="市:" > | |||
<el-select v-model="editData.city" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in edit_city" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="区:" > | |||
<el-select v-model="editData.area" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in edit_area" :key="item.value" :label="item.name" :value="item.value"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="详细地址:" style="width: 80%"> | |||
<el-input v-model="editData.detail_address" style="width: 580px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="采购负责人:" > | |||
<el-select v-model="editData.purchase_user_id" placeholder="请选择" style="width: 120px;" clearable> | |||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> | |||
</el-select> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="说明:" > | |||
<el-input style="width: 580px;" type="textarea" :rows="2" placeholder="请输入内容" v-model="editData.item_memo"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-button type="primary" @click="editDoing()" >保存</el-button> | |||
</div> | |||
</el-form> | |||
</el-dialog> | |||
</transition> | |||
</div> | |||
</body> | |||
<!-- import Vue before Element --> | |||
<script src="/assets/js/vue/vue.js"></script> | |||
<!-- import JavaScript --> | |||
<script src="/assets/js/vue/index.js"></script> | |||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |||
<script> | |||
new Vue({ | |||
el: '#app', | |||
data: function () { | |||
return { | |||
search: { | |||
item_name: "", | |||
item_type: "", | |||
province:"", | |||
city:"", | |||
area: "", | |||
pageSize:10, | |||
pageNum: 1 | |||
}, | |||
total: 0, | |||
tableData: [], | |||
editShow: false, | |||
editType: false, | |||
editData: { | |||
}, | |||
province: [], | |||
city: [], | |||
area:[], | |||
edit_city_set:3, | |||
edit_city: [], | |||
edit_area:[], | |||
unit_list:[], | |||
type_list:[], | |||
userList: [] | |||
} | |||
}, | |||
created() { | |||
this.getAdminUser(); | |||
this.getProvince(); | |||
this.getConfig(); | |||
this.getData(1) | |||
}, | |||
watch: { | |||
"search.province" : function (newVal,oldVal){ | |||
this.city = [] | |||
this.area = [] | |||
this.search.city="" | |||
this.search.area="" | |||
if (newVal==''){ | |||
return false; | |||
} | |||
let row = { | |||
"province":newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.city = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"search.city" : function (newVal,oldVal){ | |||
this.area = [] | |||
this.search.area="" | |||
if (newVal == "") { | |||
return false; | |||
} | |||
let row = { | |||
province:this.search.province, | |||
city:newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.area = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"editData.province" : function (newVal,oldVal){ | |||
if (this.edit_city_set==3) { | |||
this.edit_city = [] | |||
this.edit_area = [] | |||
this.editData.city="" | |||
this.editData.area="" | |||
} | |||
if (newVal==''){ | |||
return false; | |||
} | |||
let row = { | |||
"province":newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.edit_city = data.data; | |||
this.edit_city_set++; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
"editData.city" : function (newVal,oldVal){ | |||
if (this.edit_city_set==3) { | |||
this.edit_area = [] | |||
this.editData.area="" | |||
} | |||
if (newVal == "") { | |||
return false; | |||
} | |||
let row = { | |||
province:this.editData.province, | |||
city:newVal | |||
} | |||
axios.post("/hotel.php/ajax/areaList", row).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.edit_area = data.data; | |||
this.edit_city_set++; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
} | |||
}, | |||
methods: { | |||
getUserName(info) { | |||
for (let i = 0; i < this.userList.length; i++) { | |||
if (this.userList[i].id == info.purchase_user_id) { | |||
return this.userList[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
getTypeName(info) { | |||
for (let i = 0; i < this.type_list.length; i++) { | |||
if (this.type_list[i].id == info.item_type) { | |||
return this.type_list[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
getUnitName(info) { | |||
for (let i = 0; i < this.unit_list.length; i++) { | |||
if (this.unit_list[i].id == info.item_unit) { | |||
return this.unit_list[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
getAdminUser() { | |||
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => { | |||
this.userList = response.data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getConfig(){ | |||
axios.post("/hotel.php/general/config/getList?key=site.item_unit", {}).then((response) => { | |||
let data = response.data; | |||
this.unit_list = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
axios.post("/hotel.php/general/config/getList?key=site.item_category", {}).then((response) => { | |||
let data = response.data; | |||
this.type_list = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getProvince(){ | |||
axios.post("/hotel.php/ajax/areaList", {}).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.province = data.data; | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
sizeChange(pageSize) { | |||
this.search.pageSize = pageSize; | |||
this.getData(this.search.pageNum) | |||
}, | |||
//獲取列表 | |||
getData(page) { | |||
this.search.pageNum = page; | |||
axios.post("/hotel.php/cf_item/list", this.search).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.tableData = data.data.list; | |||
this.total = data.data.total; | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
edit(info) { | |||
if (info == null) { | |||
this.editType = false; | |||
this.editData = { | |||
item_type:"", | |||
item_unit: "", | |||
item_name: "", | |||
province:"", | |||
city:"", | |||
area: "", | |||
detail_address:"", | |||
purchase_user_id:"", | |||
item_memo:"" | |||
} | |||
} else { | |||
this.edit_city_set = 1; | |||
this.editType = true; | |||
this.editData = { | |||
id:info.id, | |||
item_type:info.item_type, | |||
item_unit: info.item_unit, | |||
item_name: info.item_name, | |||
province:info.province, | |||
province_name:info.province_name, | |||
city:info.city, | |||
city_name:info.city_name, | |||
area: info.area, | |||
area_name:info.area_name, | |||
detail_address:info.detail_address, | |||
purchase_user_id:info.purchase_user_id, | |||
item_memo:info.item_memo | |||
} | |||
} | |||
this.editShow = true; | |||
}, | |||
setAreaName(){ | |||
for (let i = 0; i < this.province.length; i++) { | |||
if (this.province[i].value == this.editData.province) { | |||
this.editData.province_name = this.province[i].name; | |||
break | |||
} | |||
} | |||
for (let i = 0; i < this.edit_city.length; i++) { | |||
if (this.edit_city[i].value == this.editData.city) { | |||
this.editData.city_name = this.edit_city[i].name; | |||
break | |||
} | |||
} | |||
for (let i = 0; i < this.edit_area.length; i++) { | |||
if (this.edit_area[i].value == this.editData.area) { | |||
this.editData.area_name = this.edit_area[i].name; | |||
break; | |||
} | |||
} | |||
}, | |||
editDoing(){ | |||
if (this.editData.item_name==''){ | |||
this.$message.error("名称不能为空");return false; | |||
} | |||
if (this.editData.item_type==''){ | |||
this.$message.error("请选择类型");return false; | |||
} | |||
if (this.editData.item_unit==''){ | |||
this.$message.error("请选择计价单位");return false; | |||
} | |||
if (this.editData.province==''){ | |||
this.$message.error("省不能为空");return false; | |||
} | |||
if (this.editData.city==''){ | |||
this.$message.error("市不能为空");return false; | |||
} | |||
if (this.editData.area==''){ | |||
this.$message.error("区不能为空");return false; | |||
} | |||
this.setAreaName(); | |||
axios.post("/hotel.php/cf_item/save", this.editData).then( (response)=> { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.$message({ | |||
message: '保存成功!', | |||
type: 'success' | |||
}); | |||
this.editShow = false; | |||
this.getData(1); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
}); | |||
}, | |||
delAll(id){ | |||
this.$confirm('确定删除记录?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
let param = { | |||
id: id | |||
} | |||
axios.post("/hotel.php/cf_item/delAll", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.getData(this.search.pageNum) | |||
this.$message.success("保存成功"); | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
this.getData(this.search.pageNum) | |||
}) | |||
} | |||
} | |||
}) | |||
</script> | |||
<style lang="scss" scoped> | |||
.el-table thead { | |||
background-color: #5a5e66 !important; | |||
} | |||
.header-search { | |||
font-size: 14px; | |||
font-weight: 900; | |||
} | |||
body { | |||
background-color: white; | |||
} | |||
.table { | |||
width: 100%; | |||
font-size: 12px; | |||
margin-top: 12px; | |||
background-color: white; | |||
} | |||
.el-form-item{ | |||
margin-bottom: 5px !important; | |||
} | |||
</style> | |||
</html> |
@@ -1,35 +1,690 @@ | |||
<div class="panel panel-default panel-intro"> | |||
{:build_heading()} | |||
<div class="panel-body"> | |||
<div id="myTabContent" class="tab-content"> | |||
<div class="tab-pane fade active in" id="one"> | |||
<div class="widget-body no-padding"> | |||
<div id="toolbar" class="toolbar"> | |||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | |||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('payment_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | |||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('payment_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('payment_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('payment_order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | |||
<div class="dropdown btn-group {:$auth->check('payment_order/multi')?'':'hide'}"> | |||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | |||
<ul class="dropdown-menu text-left" role="menu"> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | |||
</ul> | |||
</div> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<!-- import CSS --> | |||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||
</head> | |||
<body> | |||
<div id="app" class="table"> | |||
<div> | |||
<div class="header-search"> | |||
<span>名称:</span> | |||
<el-input v-model="search.name" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
<span>状态</span> | |||
<el-select v-model="search.status" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in status" | |||
:key="item.id" | |||
:label="item.value" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | |||
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增付款单</el-button> | |||
</div> | |||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | |||
style="font-size:12px;width: 100%;margin-top: 12px"> | |||
<el-table-column prop="create_id" label="创建人" min-width="70" :formatter="getUserName"></el-table-column> | |||
<el-table-column prop="id" label="付款单号" min-width="50"></el-table-column> | |||
<el-table-column prop="name" label="付款单名称" min-width="120"></el-table-column> | |||
<el-table-column prop="status" label="付款单状态" :formatter="getStatusName" min-width="150"> | |||
<template slot-scope="scope"> | |||
<el-radio-group v-model="scope.row.status" size="mini" @change="setStatus(scope.row)"> | |||
<el-radio-button label="0">未付款</el-radio-button> | |||
<el-radio-button label="1">付款中</el-radio-button> | |||
<el-radio-button label="2">已付款</el-radio-button> | |||
</el-radio-group> | |||
</template> | |||
</el-table-column> | |||
<el-table-column prop="order_ids" label="酒店" min-width="130"> | |||
<template slot-scope="scope"> | |||
<div v-html="scope.row.hotel"></div> | |||
</template> | |||
</el-table-column> | |||
<el-table-column prop="total_amount" label="附加项目" min-width="130"> | |||
<template slot-scope="scope"> | |||
<div v-html="scope.row.item"></div> | |||
</template> | |||
</el-table-column> | |||
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column> | |||
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column> | |||
<el-table-column label="操作" min-width="180"> | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button> | |||
<el-button type="success" size="mini" @click="editOrderDivShow(scope.row)" icon="el-icon-share">订单</el-button> | |||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<el-pagination | |||
:page-size="search.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
:current-page="search.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeChange" | |||
@current-change="getData" | |||
@prev-click="getData" | |||
@next-click="getData" | |||
></el-pagination> | |||
</div> | |||
<transition name="bounce" v-if="editShow"> | |||
<el-dialog title="付款单详情" :visible.sync="editShow" width="90%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item v-if="editType" label="付款单ID:" style="width: 80%"> | |||
<div v-html="editData.id"></div> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="付款单名称:" style="width: 80%"> | |||
<el-input v-model="editData.name" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item v-if="editType" label="付款单状态:" style="width: 80%"> | |||
<el-radio-group v-model="editData.status" size="mini" disabled> | |||
<el-radio-button label="0">未付款</el-radio-button> | |||
<el-radio-button label="1">付款中</el-radio-button> | |||
<el-radio-button label="2">已付款</el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-button type="primary" @click="editDoing()" >保存</el-button> | |||
</div> | |||
</el-form> | |||
</el-dialog> | |||
</transition> | |||
<transition name="bounce" v-if="editOrderShow"> | |||
<el-dialog title="详情" :visible.sync="editOrderShow" width="100%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 10px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item label="付款单ID:" style="width: 80%"> | |||
<div v-html="editOrder.id"></div> | |||
</el-form-item> | |||
<el-form-item label="付款单名称:" style="width: 80%"> | |||
<div v-html="editOrder.name"></div> | |||
</el-form-item> | |||
<el-form-item label="付款单状态:" style="width: 80%"> | |||
<el-radio-group v-model="editOrder.status" size="mini" disabled> | |||
<el-radio-button label="0">未付款</el-radio-button> | |||
<el-radio-button label="1">付款中</el-radio-button> | |||
<el-radio-button label="2">已付款</el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</div> | |||
</el-form> | |||
<div> | |||
<div class="header-search" style="width: 100%;margin-bottom: 10px"> | |||
<span>订单类型:</span> | |||
<el-select v-model="orderMainListSearch.prod_type" style="width: 120px;" placeholder="请选择" > | |||
<el-option | |||
v-for="item in prodTypeList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>子订单ID:</span> | |||
<el-input v-model="orderMainListSearch.order_id" style="width: 120px;" placeholder="请输入内容"></el-input> | |||
<span>用户名</span> | |||
<el-input v-model="orderMainListSearch.customer_name" style="width: 120px;" placeholder="请输入内容" clearable></el-input> | |||
</el-input> | |||
<span>确认单状态:</span> | |||
<el-select v-model="orderMainListSearch.confirm_status" style="width: 120px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in confirmStatusList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>付款单状态</span> | |||
<el-select v-model="orderMainListSearch.inPayment" style="width: 120px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in inPaymentList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>供应商:</span> | |||
<el-select v-model="orderMainListSearch.supplier_id" style="width: 120px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in supplierList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</div> | |||
<div class="header-search" style="width: 100%;margin-bottom: 10px"> | |||
<span>成本</span> | |||
<el-input-number v-model="orderMainListSearch.startMoney" style="width: 120px;" placeholder="请输入内容" clearable></el-input-number> | |||
~ | |||
<el-input-number v-model="orderMainListSearch.endMoney" style="width: 120px;" placeholder="请输入内容" clearable></el-input-number> | |||
<span>时间</span> | |||
<el-date-picker | |||
style="width: 120px;" | |||
v-model="orderMainListSearch.startTime" | |||
type="date" | |||
value-format="yyyy-MM-dd" | |||
placeholder="选择日期"> | |||
</el-date-picker> | |||
~ | |||
<el-date-picker | |||
style="width: 120px;" | |||
v-model="orderMainListSearch.endTime" | |||
value-format="yyyy-MM-dd" | |||
type="date" | |||
placeholder="选择日期"> | |||
</el-date-picker> | |||
<span>附加项目</span> | |||
<el-select v-model="orderMainListSearch.item_id" style="width: 120px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in itemList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>酒店</span> | |||
<el-select v-model="orderMainListSearch.hotel_id" style="width: 120px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in hotelList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | |||
</div> | |||
<div> | |||
<el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin-top: 12px" @selection-change="handleSelectionChange"> | |||
<el-table-column type="selection" width="30" :selectable="checkSelect"></el-table-column> | |||
<el-table-column prop="order_id" label="主订单ID" min-width="20" ></el-table-column> | |||
<el-table-column prop="id" label="子订单ID" min-width="20" ></el-table-column> | |||
<el-table-column label="订单类型" min-width="30" :formatter="getProdTypeName" ></el-table-column> | |||
<el-table-column prop="supplier_name" label="供应商" min-width="40" ></el-table-column> | |||
<el-table-column prop="trade_order_number" label="第三方订单号" min-width="40" ></el-table-column> | |||
<el-table-column prop="hotel_name" label="酒店/附加项目" min-width="60" ></el-table-column> | |||
<el-table-column prop="room_name" label="房型/附加项目" min-width="60" ></el-table-column> | |||
<el-table-column prop="plan_name" label="价格方案/计价单位" min-width="40" ></el-table-column> | |||
<el-table-column prop="check_in_date" label="时间" min-width="40" > | |||
<template slot-scope="scope"> | |||
<div v-html="scope.row.check_in_date"></div> | |||
<div v-html="scope.row.check_out_date"></div> | |||
</template> | |||
</el-table-column> | |||
<el-table-column prop="count" label="数量" min-width="20" ></el-table-column> | |||
<el-table-column prop="customer_name" label="出游人姓名" min-width="40" ></el-table-column> | |||
<el-table-column prop="total_cost" label="总成本" min-width="40" ></el-table-column> | |||
<el-table-column label="发单状态" min-width="30" :formatter="confirmStatusName"></el-table-column> | |||
<el-table-column prop="create_time" label="子订单生成时间" min-width="60" ></el-table-column> | |||
<el-table-column prop="payment_order_name" label="付款单" min-width="40" > | |||
<template slot-scope="scope"> | |||
<div v-html="scope.row.payment_order_id"></div> | |||
<div v-html="scope.row.payment_order_name"></div> | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="操作" > | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" v-if="scope.row.payment_order_id==0 && editOrder.status==0" @click="addOrderInfo(scope.row)" icon="el-icon-edit">添加</el-button> | |||
<el-button type="danger" size="mini" v-if="scope.row.payment_order_id==editOrder.id && editOrder.status==0" @click="removeOrderMain(scope.row)" icon="el-icon-delete">移除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<div style="margin-top: 5px"> | |||
<el-button type="primary" icon="el-icon-circle-plus" @click="addOrderAll()" :disabled="multipleSelection.length==0">添加到采购单</el-button> | |||
</div> | |||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" | |||
data-operate-edit="{:$auth->check('payment_order/edit')}" | |||
data-operate-del="{:$auth->check('payment_order/del')}" | |||
width="100%"> | |||
</table> | |||
<el-pagination | |||
:page-size="orderMainListSearch.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="orderMainTotal" | |||
:current-page="orderMainListSearch.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeOrderMainChange" | |||
@current-change="getOrderMainData" | |||
@prev-click="getOrderMainData" | |||
@next-click="getOrderMainData" | |||
></el-pagination> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</el-dialog> | |||
</transition> | |||
</div> | |||
</body> | |||
<!-- import Vue before Element --> | |||
<script src="/assets/js/vue/vue.js"></script> | |||
<!-- import JavaScript --> | |||
<script src="/assets/js/vue/index.js"></script> | |||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |||
<script> | |||
new Vue({ | |||
el: '#app', | |||
data: function () { | |||
return { | |||
search: { | |||
name: "", | |||
status: "all", | |||
pageSize: 10, | |||
pageNum: 1 | |||
}, | |||
status: [ | |||
{"id": "all", "value": "请选择"}, | |||
{"id": 0, 'value': "未付款"}, | |||
{"id": 1, 'value': "付款中"}, | |||
{"id": 2, 'value': "已付款"} | |||
], | |||
total: 0, | |||
tableData: [], | |||
userList: [], | |||
info: { | |||
id: null, | |||
name: "", | |||
status: 0, | |||
list: [] | |||
}, | |||
editShow: false, | |||
editType: false, | |||
editData: {}, | |||
editOrderShow:false, | |||
editOrder:{}, | |||
orderMainListSearch:{ | |||
"payment_order_id":"", | |||
"order_id":"", | |||
"prod_type":"hotel", | |||
"supplier_id":"", | |||
"inPayment":"", | |||
"confirm_status":"", | |||
"customer_name":"", | |||
"startMoney":"", | |||
"endMoney":"", | |||
"startTime":"", | |||
"endTime":"", | |||
"pageNum":1, | |||
"pageSize":10, | |||
"item_id":"", | |||
"hotel_id":"", | |||
"room_id":"", | |||
"plan_id":"" | |||
}, | |||
orderMainTotal:0, | |||
orderMainList:[], | |||
inPaymentList:[ | |||
{id:1,name:"在此付款单中"}, | |||
{id:2,name:"不在此付款单中"}, | |||
{id:3,name:"不在任何付款单中"} | |||
], | |||
//1、未发单/ 2已发单、3已确认、4已取消 | |||
confirmStatusList:[ | |||
{id:1,name:"未发单"}, | |||
{id:2,name:"已发单"}, | |||
{id:3,name:"已确认"}, | |||
{id:4,name:"已取消"} | |||
], | |||
prodTypeList:[ | |||
{id:"hotel",name:"酒店"}, | |||
{id:"item",name:"附加项目"} | |||
], | |||
supplierList:[], | |||
multipleSelection: [], | |||
hotelList:[], | |||
itemList:[] | |||
} | |||
}, | |||
created() { | |||
this.getAdminUser(); | |||
this.getSupplierList(); | |||
this.getData(1) | |||
this.getHotelList() | |||
this.getItemList() | |||
}, | |||
watch: { | |||
"orderMainListSearch.prod_type" : function (newVal,oldVal){ | |||
this.getOrderMainData(1) | |||
} | |||
}, | |||
methods: { | |||
getProdTypeName(info){ | |||
for (let i = 0; i < this.prodTypeList.length; i++) { | |||
if (this.prodTypeList[i].id == info.prod_type) { | |||
return this.prodTypeList[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
getHotelList(){ | |||
axios.post("/hotel.php/cf_hotel_info/getHotelList", this.search).then((response) => { | |||
console.log(response) | |||
let data = response.data; | |||
this.hotelList = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getItemList(){ | |||
axios.post("/hotel.php/cf_item/getList", this.search).then((response) => { | |||
console.log(response) | |||
let data = response.data; | |||
this.itemList = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
checkSelect(row,index){ | |||
if (this.editOrder.status != 0) { | |||
return false; | |||
} | |||
if (row.payment_order_id ==0) { | |||
return true; | |||
} | |||
return false; | |||
}, | |||
handleSelectionChange(val) { | |||
this.multipleSelection = val; | |||
}, | |||
getSupplierList(){ | |||
axios.post("/hotel.php/cf_suplier_info/getList", this.search).then((response) => { | |||
console.log(response) | |||
let data = response.data; | |||
this.supplierList = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getStatusName(info) { | |||
for (let i = 0; i < this.status.length; i++) { | |||
if (this.status[i].id == info.status) { | |||
return this.status[i].value | |||
} | |||
} | |||
return "-" | |||
}, | |||
getUserName(info) { | |||
for (let i = 0; i < this.userList.length; i++) { | |||
if (this.userList[i].id == info.create_id) { | |||
return this.userList[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
confirmStatusName(info){ | |||
for (let i = 0; i < this.confirmStatusList.length; i++) { | |||
if (this.confirmStatusList[i].id == info.confirm_status) { | |||
return this.confirmStatusList[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
sizeChange(pageSize) { | |||
this.search.pageSize = pageSize; | |||
this.getData(this.search.pageNum) | |||
}, | |||
sizeOrderMainChange(pageSize) { | |||
this.orderMainListSearch.pageSize = pageSize; | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
}, | |||
//獲取列表 | |||
getData(page) { | |||
this.search.pageNum = page; | |||
axios.post("/hotel.php/payment_order/getList", this.search).then((response) => { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.tableData = data.data.list; | |||
this.total = data.data.total; | |||
console.log(this.tableData); | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getAdminUser() { | |||
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => { | |||
this.userList = response.data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
edit(info) { | |||
if (info == null) { | |||
this.editType = false; | |||
this.editData = { | |||
name: "" | |||
} | |||
} else { | |||
this.editType = true; | |||
this.editData = { | |||
id:info.id, | |||
name: info.name, | |||
status:info.status | |||
} | |||
} | |||
this.editShow = true; | |||
}, | |||
editDoing(){ | |||
axios.post("/hotel.php/payment_order/save", this.editData).then( (response)=> { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.$message({ | |||
message: '保存成功!', | |||
type: 'success' | |||
}); | |||
this.editShow = false; | |||
this.getData(1); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
}); | |||
}, | |||
setStatus(info){ | |||
this.$confirm('确定修改状态?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
axios.post("/hotel.php/payment_order/setStatus", info).then( (response)=> { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '设置成功!', | |||
type: 'success' | |||
}); | |||
} else { | |||
this.$message.error(data.msg); | |||
this.getData(this.search.pageNum) | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
this.getData(this.search.pageNum) | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
this.getData(this.search.pageNum) | |||
}) | |||
}, | |||
editOrderDivShow(info){ | |||
console.log(info); | |||
this.editOrder = info; | |||
this.orderMainListSearch.payment_order_id = info.id; | |||
this.orderMainList=[]; | |||
this.getOrderMainData(1); | |||
this.editOrderShow = true; | |||
}, | |||
getOrderMainData(page){ | |||
this.orderMainListSearch.pageNum = page; | |||
axios.post("/hotel.php/payment_order/getSubOrderList", this.orderMainListSearch).then((response) => { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.orderMainList = data.data.list; | |||
this.orderMainTotal = data.data.total; | |||
console.log(this.orderMainList); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
addOrderInfo(info){ | |||
let param = { | |||
hotel_id:[], | |||
item_id:[], | |||
id:this.editOrder.id | |||
} | |||
if (info.prod_type=='hotel') { | |||
param.hotel_id.push(info.id) | |||
}else{ | |||
param.item_id.push(info.id) | |||
} | |||
this.addOrderMain(param) | |||
}, | |||
addOrderMain(param){ | |||
axios.post("/hotel.php/payment_order/addOrderMain", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '添加成功!', | |||
type: 'success' | |||
}); | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
addOrderAll(){ | |||
let param = { | |||
hotel_id:[], | |||
item_id:[], | |||
id:this.editOrder.id | |||
} | |||
let length = this.multipleSelection.length; | |||
for (var k = 0; k < length; k++) { | |||
if (this.multipleSelection[k].prod_type=='hotel'){ | |||
param.hotel_id.push(this.multipleSelection[k].id) | |||
}else{ | |||
param.item_id.push(this.multipleSelection[k].id) | |||
} | |||
} | |||
this.addOrderMain(param); | |||
}, | |||
removeOrderMain(info){ | |||
let param = { | |||
hotel_id:[], | |||
item_id:[], | |||
id:this.editOrder.id | |||
} | |||
if (info.prod_type=='hotel') { | |||
param.hotel_id.push(info.id) | |||
}else{ | |||
param.item_id.push(info.id) | |||
} | |||
axios.post("/hotel.php/payment_order/removeOrderMain", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '移除成功!', | |||
type: 'success' | |||
}); | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
delAll(id){ | |||
let param = { | |||
id:id | |||
} | |||
this.$confirm('确定删除采购单?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
axios.post("/hotel.php/payment_order/delAll", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '移除成功!', | |||
type: 'success' | |||
}); | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
}); | |||
} | |||
} | |||
}) | |||
</script> | |||
<style lang="scss" scoped> | |||
.el-table thead { | |||
background-color: #5a5e66 !important; | |||
} | |||
.header-search { | |||
font-size: 14px; | |||
font-weight: 900; | |||
} | |||
body { | |||
background-color: white; | |||
} | |||
.table { | |||
width: 100%; | |||
font-size: 12px; | |||
margin-top: 12px; | |||
background-color: white; | |||
} | |||
.el-form-item{ | |||
margin-bottom: 5px !important; | |||
} | |||
</style> | |||
</html> |
@@ -1,35 +1,603 @@ | |||
<div class="panel panel-default panel-intro"> | |||
{:build_heading()} | |||
<div class="panel-body"> | |||
<div id="myTabContent" class="tab-content"> | |||
<div class="tab-pane fade active in" id="one"> | |||
<div class="widget-body no-padding"> | |||
<div id="toolbar" class="toolbar"> | |||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | |||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('receipt_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | |||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('receipt_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('receipt_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | |||
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('receipt_order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a> | |||
<div class="dropdown btn-group {:$auth->check('receipt_order/multi')?'':'hide'}"> | |||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | |||
<ul class="dropdown-menu text-left" role="menu"> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li> | |||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | |||
</ul> | |||
</div> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<!-- import CSS --> | |||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||
</head> | |||
<body> | |||
<div id="app" class="table"> | |||
<div> | |||
<div class="header-search"> | |||
<span>名称:</span> | |||
<el-input v-model="search.name" style="width: 150px;" placeholder="请输入内容"></el-input> | |||
<span>状态</span> | |||
<el-select v-model="search.status" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in status" | |||
:key="item.id" | |||
:label="item.value" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button> | |||
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增收款单</el-button> | |||
</div> | |||
<el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" | |||
style="font-size:12px;width: 100%;margin-top: 12px"> | |||
<el-table-column prop="create_id" label="创建人" min-width="70" :formatter="getUserName"></el-table-column> | |||
<el-table-column prop="id" label="收款单号" min-width="50"></el-table-column> | |||
<el-table-column prop="name" label="收款单名称" min-width="120"></el-table-column> | |||
<el-table-column prop="status" label="收款单状态" :formatter="getStatusName" min-width="140"> | |||
<template slot-scope="scope"> | |||
<el-radio-group v-model="scope.row.status" size="mini" @change="setStatus(scope.row)"> | |||
<el-radio-button label="0">未收款</el-radio-button> | |||
<el-radio-button label="1">收款中</el-radio-button> | |||
<el-radio-button label="2">已收款</el-radio-button> | |||
</el-radio-group> | |||
</template> | |||
</el-table-column> | |||
<el-table-column prop="order_ids" label="关联订单" min-width="150"></el-table-column> | |||
<el-table-column prop="total_amount" label="金额" min-width="60"></el-table-column> | |||
<el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column> | |||
<el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column> | |||
<el-table-column label="操作" min-width="180"> | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button> | |||
<el-button type="success" size="mini" @click="editOrderDivShow(scope.row)" icon="el-icon-share">订单</el-button> | |||
<el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<el-pagination | |||
:page-size="search.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="total" | |||
:current-page="search.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeChange" | |||
@current-change="getData" | |||
@prev-click="getData" | |||
@next-click="getData" | |||
></el-pagination> | |||
</div> | |||
<transition name="bounce" v-if="editShow"> | |||
<el-dialog title="收款单详情" :visible.sync="editShow" width="90%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item v-if="editType" label="收款单ID:" style="width: 80%"> | |||
<div v-html="editData.id"></div> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item label="收款单名称:" style="width: 80%"> | |||
<el-input v-model="editData.name" style="width: 150px;" placeholder="请输入内容"></el-input> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-form-item v-if="editType" label="收款单状态:" style="width: 80%"> | |||
<el-radio-group v-model="editData.status" size="mini" disabled> | |||
<el-radio-button label="0">未收款</el-radio-button> | |||
<el-radio-button label="1">收款中</el-radio-button> | |||
<el-radio-button label="2">已收款</el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</div> | |||
<div> | |||
<el-button type="primary" @click="editDoing()" >保存</el-button> | |||
</div> | |||
</el-form> | |||
</el-dialog> | |||
</transition> | |||
<transition name="bounce" v-if="editOrderShow"> | |||
<el-dialog title="详情" :visible.sync="editOrderShow" width="90%" top="15px"> | |||
<el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 10px"> | |||
<div style="display: flex;width: 100%"> | |||
<el-form-item label="收款单ID:" style="width: 80%"> | |||
<div v-html="editOrder.id"></div> | |||
</el-form-item> | |||
<el-form-item label="收款单名称:" style="width: 80%"> | |||
<div v-html="editOrder.name"></div> | |||
</el-form-item> | |||
<el-form-item label="收款单状态:" style="width: 80%"> | |||
<el-radio-group v-model="editOrder.status" size="mini" disabled="true"> | |||
<el-radio-button label="0">未收款</el-radio-button> | |||
<el-radio-button label="1">收款中</el-radio-button> | |||
<el-radio-button label="2">已收款</el-radio-button> | |||
</el-radio-group> | |||
</el-form-item> | |||
</div> | |||
</el-form> | |||
<div> | |||
<div class="header-search" style="width: 100%;margin-bottom: 10px"> | |||
<span>订单ID:</span> | |||
<el-input v-model="orderMainListSearch.order_id" style="width: 150px;" placeholder="请输入内容"></el-input> | |||
<span>订单状态:</span> | |||
<el-select v-model="orderMainListSearch.order_status" style="width: 150px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in orderMainStatus" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>收款单状态</span> | |||
<el-select v-model="orderMainListSearch.inReceipt" style="width: 150px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in inReceipt" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>渠道:</span> | |||
<el-select v-model="orderMainListSearch.channel_id" style="width: 150px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in channelList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>专员</span> | |||
<el-select v-model="orderMainListSearch.commissioner_id" style="width: 150px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in userList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
<span>下单人</span> | |||
<el-select v-model="orderMainListSearch.create_id" style="width: 150px;" placeholder="请选择" clearable> | |||
<el-option | |||
v-for="item in userList" | |||
:key="item.id" | |||
:label="item.name" | |||
:value="item.id"> | |||
</el-option> | |||
</el-select> | |||
</div> | |||
<div class="header-search" style="width: 100%;margin-bottom: 10px"> | |||
<span>用户名</span> | |||
<el-input v-model="orderMainListSearch.user_name" style="width: 150px;" placeholder="请输入内容" clearable></el-input> | |||
<span>手机号</span> | |||
<el-input v-model="orderMainListSearch.user_phone" style="width: 150px;" placeholder="请输入内容" clearable></el-input> | |||
<span>金额</span> | |||
<el-input-number v-model="orderMainListSearch.startMoney" style="width: 150px;" placeholder="请输入内容" clearable></el-input-number> | |||
~ | |||
<el-input-number v-model="orderMainListSearch.endMoney" style="width: 150px;" placeholder="请输入内容" clearable></el-input-number> | |||
<span>时间</span> | |||
<el-date-picker | |||
style="width: 150px;" | |||
v-model="orderMainListSearch.startTime" | |||
type="date" | |||
value-format="yyyy-MM-dd" | |||
placeholder="选择日期"> | |||
</el-date-picker> | |||
~ | |||
<el-date-picker | |||
style="width: 150px;" | |||
v-model="orderMainListSearch.endTime" | |||
value-format="yyyy-MM-dd" | |||
type="date" | |||
placeholder="选择日期"> | |||
</el-date-picker> | |||
<el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button> | |||
</div> | |||
<div> | |||
<el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin-top: 12px" @selection-change="handleSelectionChange"> | |||
<el-table-column type="selection" width="30" :selectable="checkSelect"></el-table-column> | |||
<el-table-column prop="id" label="订单ID" min-width="40" ></el-table-column> | |||
<el-table-column prop="commissioner_id" label="专员" min-width="40" :formatter="getUserName"></el-table-column> | |||
<el-table-column prop="channel_name" label="渠道" min-width="80" ></el-table-column> | |||
<el-table-column prop="channel_order_no" label="渠道订单号" min-width="90" ></el-table-column> | |||
<el-table-column prop="create_id" label="下单人" min-width="50" :formatter="getUserName"></el-table-column> | |||
<el-table-column prop="user_name" label="用户名称" min-width="50" ></el-table-column> | |||
<el-table-column prop="user_phone" label="手机号" min-width="60" ></el-table-column> | |||
<el-table-column prop="total_amount" label="总金额" min-width="40" ></el-table-column> | |||
<el-table-column prop="order_status" label="状态" min-width="40" :formatter="getOrderMainStatus"></el-table-column> | |||
<el-table-column prop="create_time" label="下单时间" min-width="80" ></el-table-column> | |||
<el-table-column prop="receipt_order_id" label="收款单ID" min-width="40" ></el-table-column> | |||
<el-table-column prop="receipt_order_name" label="收款单名称" min-width="80" ></el-table-column> | |||
<el-table-column label="操作" > | |||
<template slot-scope="scope"> | |||
<el-button-group> | |||
<el-button type="primary" size="mini" v-if="scope.row.receipt_order_id==0 && editOrder.status==0" @click="addOrderMain(scope.row.id)" icon="el-icon-edit">添加</el-button> | |||
<el-button type="danger" size="mini" v-if="scope.row.receipt_order_id==editOrder.id && editOrder.status==0" @click="removeOrderMain(scope.row.id)" icon="el-icon-delete">移除</el-button> | |||
</el-button-group> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<div style="margin-top: 5px"> | |||
<el-button type="primary" icon="el-icon-circle-plus" @click="addOrderAll()" :disabled="multipleSelection.length==0">添加到采购单</el-button> | |||
</div> | |||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" | |||
data-operate-edit="{:$auth->check('receipt_order/edit')}" | |||
data-operate-del="{:$auth->check('receipt_order/del')}" | |||
width="100%"> | |||
</table> | |||
<el-pagination | |||
:page-size="orderMainListSearch.pageSize" | |||
:pager-count="11" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="orderMainTotal" | |||
:current-page="orderMainListSearch.pageNum" | |||
:page-sizes="[10, 20, 30, 40, 50]" | |||
@size-change="sizeOrderMainChange" | |||
@current-change="getOrderMainData" | |||
@prev-click="getOrderMainData" | |||
@next-click="getOrderMainData" | |||
></el-pagination> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</el-dialog> | |||
</transition> | |||
</div> | |||
</body> | |||
<!-- import Vue before Element --> | |||
<script src="/assets/js/vue/vue.js"></script> | |||
<!-- import JavaScript --> | |||
<script src="/assets/js/vue/index.js"></script> | |||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |||
<script> | |||
new Vue({ | |||
el: '#app', | |||
data: function () { | |||
return { | |||
search: { | |||
name: "", | |||
status: "all", | |||
pageSize: 10, | |||
pageNum: 1 | |||
}, | |||
status: [ | |||
{"id": "all", "value": "请选择"}, | |||
{"id": 0, 'value': "未收款"}, | |||
{"id": 1, 'value': "收款中"}, | |||
{"id": 2, 'value': "已收款"} | |||
], | |||
total: 0, | |||
tableData: [], | |||
userList: [], | |||
info: { | |||
id: null, | |||
name: "", | |||
status: 0, | |||
list: [] | |||
}, | |||
editShow: false, | |||
editType: false, | |||
editData: {}, | |||
editOrderShow:false, | |||
editOrder:{}, | |||
orderMainListSearch:{ | |||
"receipt_order_id":"", | |||
"inReceipt":"", | |||
"order_id":"", | |||
"channel_id":"", | |||
"order_status":"", | |||
"commissioner_id":"", | |||
"user_name":"", | |||
"user_phone":"", | |||
"create_id":"", | |||
"startMoney":"", | |||
"endMoney":"", | |||
"startTime":"", | |||
"endTime":"", | |||
"pageNum":1, | |||
"pageSize":10 | |||
}, | |||
orderMainTotal:0, | |||
orderMainList:[], | |||
inReceipt:[ | |||
{id:1,name:"在此收款单中"}, | |||
{id:2,name:"不在此收款单中"}, | |||
{id:3,name:"不在任何收款单中"} | |||
], | |||
//0待处理 1已确认 2部分取消 10已完成 11已取消 | |||
orderMainStatus:[ | |||
{id:0,name:"待处理"}, | |||
{id:1,name:"已确认"}, | |||
{id:2,name:"部分取消"}, | |||
{id:3,name:"处理中"}, | |||
{id:10,name:"已完成"}, | |||
{id:11,name:"已取消"} | |||
], | |||
channelList:[], | |||
multipleSelection: [] | |||
} | |||
}, | |||
created() { | |||
this.getAdminUser(); | |||
this.getChannelList(); | |||
this.getData(1) | |||
}, | |||
methods: { | |||
checkSelect(row,index){ | |||
if (this.editOrder.status != 0) { | |||
return false; | |||
} | |||
if (row.receipt_order_id ==0) { | |||
return true; | |||
} | |||
return false; | |||
}, | |||
handleSelectionChange(val) { | |||
this.multipleSelection = val; | |||
}, | |||
getChannelList(){ | |||
axios.post("/hotel.php/cf_channel_info/getList", this.search).then((response) => { | |||
console.log(response) | |||
let data = response.data; | |||
this.channelList = data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getStatusName(info) { | |||
for (let i = 0; i < this.status.length; i++) { | |||
if (this.status[i].id == info.status) { | |||
return this.status[i].value | |||
} | |||
} | |||
return "-" | |||
}, | |||
getUserName(info) { | |||
for (let i = 0; i < this.userList.length; i++) { | |||
if (this.userList[i].id == info.create_id) { | |||
return this.userList[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
getOrderMainStatus(info){ | |||
for (let i = 0; i < this.orderMainStatus.length; i++) { | |||
if (this.orderMainStatus[i].id == info.order_status) { | |||
return this.orderMainStatus[i].name | |||
} | |||
} | |||
return "-" | |||
}, | |||
sizeChange(pageSize) { | |||
this.search.pageSize = pageSize; | |||
this.getData(this.search.pageNum) | |||
}, | |||
sizeOrderMainChange(pageSize) { | |||
this.orderMainListSearch.pageSize = pageSize; | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
}, | |||
//獲取列表 | |||
getData(page) { | |||
this.search.pageNum = page; | |||
axios.post("/hotel.php/receipt_order/getList", this.search).then((response) => { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.tableData = data.data.list; | |||
this.total = data.data.total; | |||
console.log(this.tableData); | |||
} else { | |||
this.$message.error(response.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
getAdminUser() { | |||
axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => { | |||
this.userList = response.data.list; | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
edit(info) { | |||
if (info == null) { | |||
this.editType = false; | |||
this.editData = { | |||
name: "" | |||
} | |||
} else { | |||
this.editType = true; | |||
this.editData = { | |||
id:info.id, | |||
name: info.name, | |||
status:info.status | |||
} | |||
} | |||
this.editShow = true; | |||
}, | |||
editDoing(){ | |||
axios.post("/hotel.php/receipt_order/save", this.editData).then( (response)=> { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.$message({ | |||
message: '保存成功!', | |||
type: 'success' | |||
}); | |||
this.editShow = false; | |||
this.getData(1); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
}); | |||
}, | |||
setStatus(info){ | |||
this.$confirm('确定修改状态?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
axios.post("/hotel.php/receipt_order/setStatus", info).then( (response)=> { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '设置成功!', | |||
type: 'success' | |||
}); | |||
} else { | |||
this.$message.error(data.msg); | |||
this.getData(this.search.pageNum) | |||
} | |||
}).catch(function (error) { | |||
this.$message.error("保存失败"); | |||
console.log(error); | |||
this.getData(this.search.pageNum) | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
this.getData(this.search.pageNum) | |||
}) | |||
}, | |||
editOrderDivShow(info){ | |||
console.log(info); | |||
this.editOrder = info; | |||
this.orderMainListSearch.receipt_order_id = info.id; | |||
this.orderMainList=[]; | |||
this.getOrderMainData(1); | |||
this.editOrderShow = true; | |||
}, | |||
getOrderMainData(page){ | |||
this.orderMainListSearch.pageNum = page; | |||
axios.post("/hotel.php/receipt_order/getOrderMainList", this.orderMainListSearch).then((response) => { | |||
let data = response.data; | |||
console.log(this.tableData); | |||
if (data.flag) { | |||
this.orderMainList = data.data.list; | |||
this.orderMainTotal = data.data.total; | |||
console.log(this.orderMainList); | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
addOrderMain(order_id){ | |||
let param = { | |||
order_id:order_id, | |||
id:this.editOrder.id | |||
} | |||
axios.post("/hotel.php/receipt_order/addOrderMain", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '添加成功!', | |||
type: 'success' | |||
}); | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
addOrderAll(){ | |||
let orderId = ""; | |||
let length = this.multipleSelection.length; | |||
for (var k = 0; k < length; k++) { | |||
if (orderId == "") { | |||
orderId = this.multipleSelection[k].id; | |||
continue; | |||
} | |||
orderId =orderId+","+this.multipleSelection[k].id; | |||
} | |||
this.addOrderMain(orderId); | |||
}, | |||
removeOrderMain(order_id){ | |||
let param = { | |||
order_id:order_id, | |||
id:this.editOrder.id | |||
} | |||
axios.post("/hotel.php/receipt_order/removeOrderMain", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '移除成功!', | |||
type: 'success' | |||
}); | |||
this.getOrderMainData(this.orderMainListSearch.pageNum) | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}, | |||
delAll(id){ | |||
let param = { | |||
id:id | |||
} | |||
this.$confirm('确定删除采购单?', '提示', { | |||
confirmButtonText: '确定', | |||
cancelButtonText: '取消', | |||
type: 'warning' | |||
}).then(() => { | |||
axios.post("/hotel.php/receipt_order/delAll", param).then((response) => { | |||
let data = response.data; | |||
if (data.flag) { | |||
this.$message({ | |||
message: '移除成功!', | |||
type: 'success' | |||
}); | |||
this.getData(this.search.pageNum) | |||
} else { | |||
this.$message.error(data.msg); | |||
} | |||
}).catch(function (error) { | |||
console.log(error); | |||
}); | |||
}).catch(() => { | |||
this.$message({ | |||
type: 'info', | |||
message: '已取消' | |||
}); | |||
}); | |||
} | |||
} | |||
}) | |||
</script> | |||
<style lang="scss" scoped> | |||
.el-table thead { | |||
background-color: #5a5e66 !important; | |||
} | |||
.header-search { | |||
font-size: 14px; | |||
font-weight: 900; | |||
} | |||
body { | |||
background-color: white; | |||
} | |||
.table { | |||
width: 100%; | |||
font-size: 12px; | |||
margin-top: 12px; | |||
background-color: white; | |||
} | |||
.el-form-item{ | |||
margin-bottom: 5px !important; | |||
} | |||
</style> | |||
</html> |
@@ -24,7 +24,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
sortName: 'id', | |||
columns: [ | |||
[ | |||
{checkbox: true}, | |||
{field: 'id', title: __('Id')}, | |||
{field: 'hotel_name', title: __('Hotel_name'), operate: 'LIKE'}, | |||
{field: 'hotel_phone', title: __('Hotel_phone'), operate: 'LIKE'}, | |||
{field: 'nickname', title: __('创建人')}, | |||
@@ -16,7 +16,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
}); | |||
var table = $("#table"); | |||
table.on('post-common-search.bs.table', function (event, table) { | |||
var form = $("form", table.$commonsearch); | |||
$("input[name='nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); | |||
Form.events.cxselect(form); | |||
Form.events.selectpage(form); | |||
}); | |||
// 初始化表格 | |||
table.bootstrapTable({ | |||
url: $.fn.bootstrapTable.defaults.extend.index_url, | |||
@@ -25,15 +30,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
columns: [ | |||
[ | |||
{field: 'id', title: __('Id')}, | |||
{field: 'item_type_name', title: __('Item_type')}, | |||
{field: 'item_type', title: __('Item_type'), | |||
searchList: {"1":"一日游","2":"交通接驳","3":"租车","4":"门票"}}, | |||
{field: 'item_name', title: __('Item_name'), operate: 'LIKE'}, | |||
{field: 'item_unit', title: __('计价单位'), operate: 'LIKE'}, | |||
{field: 'item_memo', title: __('Item_memo'), operate: 'LIKE'}, | |||
{field: 'item_unit', title: __('计价单位'), | |||
searchList: {"1":"件","2":"份","3":"匝","4":"张"}}, | |||
{field: 'item_memo', title: __('Item_memo'), operate: 'LIKE',visible: false}, | |||
{field: 'province_name', title: __('Province_name'), operate: 'LIKE'}, | |||
{field: 'city_name', title: __('City_name'), operate: 'LIKE'}, | |||
{field: 'area_name', title: __('地区名'), operate: 'LIKE'}, | |||
{field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'}, | |||
{field: 'purchase_user_name', title: __('采购负责人'), operate: 'LIKE'}, | |||
{field: 'nickname', title: __('采购负责人')}, | |||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | |||
@@ -24,9 +24,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
sortName: 'id', | |||
columns: [ | |||
[ | |||
{checkbox: true}, | |||
{field: 'hotel_name', title: __('酒店名称')}, | |||
{field: 'hotel_id', title: __('酒店ID')}, | |||
{field: 'hotel_name', title: __('酒店名称'),operate: 'LIKE'}, | |||
{field: 'nickname', title: __('创建人')}, | |||
{field: 'id', title: __('房型ID')}, | |||
{field: 'room_name', title: __('Room_name'), operate: 'LIKE'}, | |||
{field: 'room_memo', title: __('Room_memo'), operate: 'LIKE'}, | |||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
@@ -16,7 +16,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
}); | |||
var table = $("#table"); | |||
table.on('post-common-search.bs.table', function (event, table) { | |||
var form = $("form", table.$commonsearch); | |||
$("input[name='hbp_admin.nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); | |||
Form.events.cxselect(form); | |||
Form.events.selectpage(form); | |||
}); | |||
// 初始化表格 | |||
table.bootstrapTable({ | |||
url: $.fn.bootstrapTable.defaults.extend.index_url, | |||
@@ -25,15 +30,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
columns: [ | |||
[ | |||
{field: 'id', title: __('Id')}, | |||
{field: 'hotel_id', title: __('酒店ID')}, | |||
{field: 'hotel_name', title: __('酒店')}, | |||
{field: 'room_id', title: __('房型ID')}, | |||
{field: 'room_name', title: __('房型')}, | |||
{field: 'plan_name', title: __('Plan_name'), operate: 'LIKE'}, | |||
{field: 'breakfast_num', title: __('Breakfast_num')}, | |||
{field: 'book_end_day', title: __('Book_end_day')}, | |||
{field: 'book_end_hour', title: __('Book_end_hour')}, | |||
{field: 'continuity_type', title: __('Continuity_type')}, | |||
{field: 'continuity_type', title: __('Continuity_type'), | |||
searchList: {"0": __('无限制'), "1": __('连住几晚'),"2": __('连住几晚及以上'),"3": __('连住几晚及其倍数')}}, | |||
{field: 'coutinuity_day', title: __('Coutinuity_day')}, | |||
{field: 'purchase_user_name', title: __('Charge_person'), operate: 'LIKE'}, | |||
{field: 'hbp_admin.nickname', title: __('采购负责人')}, | |||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | |||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | |||
@@ -21,6 +21,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
table.on('post-body.bs.table',function(){ | |||
$(".btn-editone").data("area",["100%","100%"]); | |||
}); | |||
table.on('post-common-search.bs.table', function (event, table) { | |||
var form = $("form", table.$commonsearch); | |||
$("input[name='channel_name']", form).addClass("selectpage").data("source", "cf_channel_info/index").data("primaryKey", "channel_name").data("field", "channel_name").data("orderBy", "id desc"); | |||
$("input[name='commissioner']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); | |||
$("input[name='hbp_admin.nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); | |||
Form.events.cxselect(form); | |||
Form.events.selectpage(form); | |||
}); | |||
// 初始化表格 | |||
table.bootstrapTable({ | |||
url: $.fn.bootstrapTable.defaults.extend.index_url, | |||
@@ -28,11 +36,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | |||
sortName: 'id', | |||
columns: [ | |||
[ | |||
{field: 'id', title: __('Id')}, | |||
{field: 'commissioner', title: __('Commissioner'), operate: 'LIKE'}, | |||
{field: 'id', title: __('Id'),operate:"false"}, | |||
{field: 'commissioner', title: __('Commissioner'),formatter: Table.api.formatter.search}, | |||
{field: 'channel_name', title: __('下单渠道'), operate: 'LIKE'}, | |||
{field: 'channel_order_no', title: __('Channel_order_no'), operate: 'LIKE'}, | |||
{field: 'nickname', title: __('下单用户'), operate: 'LIKE'}, | |||
{field: 'hbp_admin.nickname', title: __('订单提交人'), operate: 'LIKE'}, | |||
{field: 'user_name', title: __('订单联系人'), operate: 'LIKE'}, | |||
{field: 'user_phone', title: __('User_phone'), operate: 'LIKE'}, | |||
{field: 'total_amount', title: __('Total_amount'), operate:'BETWEEN'}, | |||
{field: 'cost_amount', title: __('Cost_amount'), operate:'BETWEEN'}, | |||