master
2290867136 2 years ago
parent 112b11bb82
commit 14adcb035b

@ -1,8 +1,5 @@
#include "customer.h" #include "customer.h"
#include "login.h"
#include "registers.h"
#include "ui_customer.h" #include "ui_customer.h"
/* /*
* ID * ID
*/ */
@ -29,13 +26,12 @@ void customer::paintEvent(QPaintEvent*)
void customer::init()//初始化 void customer::init()//初始化
{ {
customer_id = "123"; id = "123";
//id = login->ui->lineEdit_account->text();崩溃
ui->setupUi(this); ui->setupUi(this);
this->setFixedSize(1920,1080); this->setFixedSize(1920,1080);
this->setWindowTitle("用户界面"); this->setWindowTitle("用户界面");
this->setWindowIcon(QIcon(":image/icon/logo"));//创造本界面 this->setWindowIcon(QIcon(":image/icon/logo"));//创造本界面
lg = new login(this);
lg->hide();
rm = new ResetMessage(this); rm = new ResetMessage(this);
rm->hide();//创造副界面 rm->hide();//创造副界面
labelone = new QLabel(this); labelone = new QLabel(this);
@ -46,9 +42,14 @@ void customer::init()//初始化
findall(); findall();
flush_data(userinfo);//初始显示全部 flush_data(userinfo);//初始显示全部
setmousehand();//装饰鼠标 setmousehand();//装饰鼠标
ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{background-color: rgb(0, 0, 0,30);}");//表头透明度
ui->tableWidget->verticalHeader()->setStyleSheet("QHeaderView::section{background-color: rgb(0, 0, 0,30);}");//行头透明度
ui->Reservation1->setEnabled(false);
ui->checking_out1->setEnabled(false);//初始退订按钮 ui->tableWidget->setColumnHidden(5, true);//隐藏列
ui->tableWidget->setColumnHidden(6, true);
ui->Reservation1->setEnabled(false);//初始退订按钮
ui->checking_out1->setEnabled(false);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//表格不可编辑 ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//表格不可编辑
} }
@ -65,7 +66,7 @@ void customer::setmousehand()//鼠标小手 完成
void customer::on_checking_out1_clicked()//退房 完成 void customer::on_checking_out1_clicked()//退房 完成
{ {
int c = row;//总之是获取选中的行 int c = row;//总之是获取选中的行
if( ui->tableWidget->model()->index(c,6).data().toString() == "123" ){ if( ui->tableWidget->model()->index(c,6).data().toString() == id ){
QString QS = "空闲"; QString QS = "空闲";
QSqlQuery query((db)); QSqlQuery query((db));
@ -101,7 +102,7 @@ void customer::on_checking_out1_clicked()//退房 完成
} }
void customer::on_Reservation1_clicked()//订房 id是什么 void customer::on_Reservation1_clicked()//订房 完成
{ {
int c = row;//总之是获取选中的行 int c = row;//总之是获取选中的行
QString QS = "使用"; QString QS = "使用";
@ -121,7 +122,7 @@ void customer::on_Reservation1_clicked()//订房 id是什么
query.bindValue(":num",num); query.bindValue(":num",num);
query.exec(); query.exec();
query.prepare("UPDATE room set customer_id=:id where room_num = :num"); query.prepare("UPDATE room set customer_id=:id where room_num = :num");
query.bindValue(":id",123); query.bindValue(":id",id);
query.bindValue(":num",num); query.bindValue(":num",num);
query.exec(); query.exec();
@ -160,14 +161,6 @@ void customer::on_checkBox_2_clicked(bool checked)//装饰品
else ui->tableWidget->verticalHeader()->hide(); else ui->tableWidget->verticalHeader()->hide();
} }
void customer::on_checkBox_3_clicked(bool checked)//装饰品
{
if(checked){
ui->tableWidget->setAlternatingRowColors(true);
}
else ui->tableWidget->setAlternatingRowColors(false);
}
void customer::findall()//显示全部 完成 void customer::findall()//显示全部 完成
{ {
userinfo.clear();//清楚存储向量rec的向量的数据 userinfo.clear();//清楚存储向量rec的向量的数据
@ -193,7 +186,7 @@ void customer::flush_data(QVector<QVector<QString>>&userinfo)//插入数据 完
ui->tableWidget->clear(); ui->tableWidget->clear();
if(!userinfo.size())return; if(!userinfo.size())return;
ui->tableWidget->setRowCount(userinfo.size());//行 ui->tableWidget->setRowCount(userinfo.size());//行
ui->tableWidget->setColumnCount(5);//列 ui->tableWidget->setColumnCount(7);//列
for(int i=0;i<userinfo.size();i++) for(int i=0;i<userinfo.size();i++)
{ {
@ -204,7 +197,7 @@ void customer::flush_data(QVector<QVector<QString>>&userinfo)//插入数据 完
QW->setTextAlignment(Qt::AlignCenter);//设置中心对齐 QW->setTextAlignment(Qt::AlignCenter);//设置中心对齐
} }
} }
ui->tableWidget->setHorizontalHeaderLabels({"房间号","房间类型","是否带窗","负责人","状态"});//设置表头 //ui->tableWidget->setHorizontalHeaderLabels({"房间号","房间类型","是否带窗","负责人","状态"});//设置表头
} }
void customer::on_tableWidget_itemClicked(QTableWidgetItem *item)//点击表格格子 获取行数 完成 void customer::on_tableWidget_itemClicked(QTableWidgetItem *item)//点击表格格子 获取行数 完成

@ -10,6 +10,7 @@
#include <QSqlRecord> #include <QSqlRecord>
#include <resetmessage.h> #include <resetmessage.h>
#include <QDate> #include <QDate>
#include <ui_login.h>
namespace Ui { namespace Ui {
class customer; class customer;
@ -27,7 +28,7 @@ public:
void flush_data(QVector<QVector<QString>>&userinfo); void flush_data(QVector<QVector<QString>>&userinfo);
bool find_byname(QString name); bool find_byname(QString name);
void setmousehand(); void setmousehand();
QString customer_id;
void init(); void init();
private slots: private slots:
@ -41,10 +42,6 @@ private slots:
void on_checkBox_2_clicked(bool checked); void on_checkBox_2_clicked(bool checked);
void on_checkBox_3_clicked(bool checked);
void on_tableWidget_itemClicked(QTableWidgetItem *item); void on_tableWidget_itemClicked(QTableWidgetItem *item);
void on_search_clicked(); void on_search_clicked();
@ -55,11 +52,11 @@ protected:
private: private:
Ui::customer *ui; Ui::customer *ui;
QLabel *labelone; QLabel *labelone;
login *lg;
ResetMessage *rm; ResetMessage *rm;
QSqlDatabase db; QSqlDatabase db;
QVector<QVector<QString>>userinfo; QVector<QVector<QString>>userinfo;
int row; int row;
login *login;
QString id; QString id;
}; };

@ -114,6 +114,9 @@
<pointsize>25</pointsize> <pointsize>25</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color:rgb(255, 255, 255)</string>
</property>
<property name="text"> <property name="text">
<string>房间检索-&gt;</string> <string>房间检索-&gt;</string>
</property> </property>
@ -124,12 +127,51 @@
<widget class="QTableWidget" name="tableWidget"> <widget class="QTableWidget" name="tableWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>120</x>
<y>300</y> <y>290</y>
<width>1471</width> <width>1531</width>
<height>671</height> <height>731</height>
</rect> </rect>
</property> </property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0,50);
color: rgb(255, 255, 255);
</string>
</property>
<column>
<property name="text">
<string>房间号</string>
</property>
</column>
<column>
<property name="text">
<string>房间类型</string>
</property>
</column>
<column>
<property name="text">
<string>是否带窗</string>
</property>
</column>
<column>
<property name="text">
<string>负责人</string>
</property>
</column>
<column>
<property name="text">
<string>状态</string>
</property>
</column>
</widget> </widget>
<widget class="QPushButton" name="search"> <widget class="QPushButton" name="search">
<property name="geometry"> <property name="geometry">
@ -145,6 +187,10 @@
<pointsize>22</pointsize> <pointsize>22</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">background-color: rgb(108, 162, 162);
color: rgb(255, 255, 255);</string>
</property>
<property name="text"> <property name="text">
<string>搜索</string> <string>搜索</string>
</property> </property>
@ -165,13 +211,14 @@
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">image:url(:/image/icon/resetcode.png); <string notr="true">image:url(:/image/icon/resetcode.png);
backgroundcolor:rgb(255, 255, 255)</string> background-color: rgb(108, 162, 162);
</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1760</x> <x>1760</x>

@ -2,6 +2,8 @@
<qresource prefix="/image/bg"> <qresource prefix="/image/bg">
<file>login.png</file> <file>login.png</file>
<file>customerbackground.webp</file> <file>customerbackground.webp</file>
<file>sea.jpg</file>
<file>stone.jpg</file>
</qresource> </qresource>
<qresource prefix="/image/icon"> <qresource prefix="/image/icon">
<file>info.png</file> <file>info.png</file>

@ -12,10 +12,16 @@ ResetMessage::ResetMessage(QWidget *parent) :
this->setWindowIcon(logo); this->setWindowIcon(logo);
setWindowTitle("宜客酒店"); setWindowTitle("宜客酒店");
this->setFixedSize(800,600); this->setFixedSize(800,600);
/*
bg = new QLabel(this); bg = new QLabel(this);
bg->setScaledContents(true); bg->setScaledContents(true);
bg->setPixmap(QPixmap(":/image/bg/customerbackground.webp"));//未完 bg->setPixmap(QPixmap(":/image/bg/sea.jpg"));//未完
bg->lower(); bg->lower();
*/
QPalette q;//调色板
q.setBrush(QPalette::Window,QBrush(QPixmap("/image/bg/sea,jpg")));
this->setPalette(q);
ui->code->setEchoMode(QLineEdit::Password); ui->code->setEchoMode(QLineEdit::Password);
ui->confirm_code->setEchoMode(QLineEdit::Password); ui->confirm_code->setEchoMode(QLineEdit::Password);
ui->radioButton_man->setChecked(1); ui->radioButton_man->setChecked(1);

@ -6,13 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>812</width> <width>800</width>
<height>653</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QLabel" name="label_code"> <widget class="QLabel" name="label_code">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -27,6 +30,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>密码</string> <string>密码</string>
</property> </property>
@ -48,6 +54,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>确认密码</string> <string>确认密码</string>
</property> </property>
@ -69,6 +78,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>姓名</string> <string>姓名</string>
</property> </property>
@ -87,6 +99,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>身份证</string> <string>身份证</string>
</property> </property>
@ -145,6 +160,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>性别</string> <string>性别</string>
</property> </property>
@ -161,8 +179,12 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>男</string> <string>男</string>
</property> </property>
@ -181,6 +203,9 @@
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 127);</string>
</property>
<property name="text"> <property name="text">
<string>女</string> <string>女</string>
</property> </property>
@ -199,10 +224,42 @@
<pointsize>15</pointsize> <pointsize>15</pointsize>
</font> </font>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>更新</string> <string>更新</string>
</property> </property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/image/bg/sea.jpg&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget> </widget>
<zorder>label</zorder>
<zorder>label_code</zorder>
<zorder>label_confirm</zorder>
<zorder>label_name</zorder>
<zorder>label_id</zorder>
<zorder>ID_card</zorder>
<zorder>code</zorder>
<zorder>confirm_code</zorder>
<zorder>name</zorder>
<zorder>label_gender</zorder>
<zorder>radioButton_man</zorder>
<zorder>radioButton_woman</zorder>
<zorder>pushButton</zorder>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Loading…
Cancel
Save