如需源码可以添加q-------3290510686,也有演示视频演示具体功能,源码不免费,尊重创作,尊重劳动。
1.开发环境
android stuido3.6jak1.8
eclipse
mysql
tomcat
2.功能介绍
安卓端:1.注册登录
2.查看餐品列表
3.查看餐品详情
4.加入购物车,
5.购物车支付结算功能
6.我的订单
7.餐品评论功能
服务端:
1.管理员登录功能
2.用户管理
3.餐品管理
4.评论管理
5.订单管理
3.系统截图
1.后台登录界面
2.后台主界面,包括用户管理,商品管理,订单管理,评论管理,
3.安卓端登录注册
核心代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="@color/mycolor_theme"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="注册"
android:textColor="@color/my_white"
android:textSize="14sp" />
</RelativeLayout>
<LinearLayout
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<EditText
android:id="@+id/et_login_activity_zhanghao"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入账号"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入密码"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入姓名"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入性别"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_age"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入年龄"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入地址"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_tel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入手机号"
android:padding="8dp" />
<EditText
android:id="@+id/et_login_activity_sfz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint="请输入身份证号"
android:padding="8dp" />
<TextView
android:visibility="gone"
android:id="@+id/tv_select_tea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:layout_marginRight="40dp"
android:background="@drawable/login_button_bg"
android:hint=""
android:padding="8dp" />
<RadioGroup
android:visibility="gone"
android:id="@+id/RG"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical">
<!--默认选中b1-->
<RadioButton
android:paddingVertical="10dp"
android:id="@+id/b1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
<RadioButton
android:paddingVertical="10dp"
android:id="@+id/b2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/btn_login_activity_register"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@color/mycolor_theme"
android:text="注册"
android:textColor="@color/my_white"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<Button
android:id="@+id/btn_login_activity_login"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@color/mycolor_theme"
android:text="登录"
android:textColor="@color/my_white"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
btn_login_activity_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String uname = et_login_activity_zhanghao.getText().toString().trim();
String pwd = et_login_activity_password.getText().toString().trim();
String nickname = et_login_activity_nickname.getText().toString().trim();
String sex = et_login_activity_sex.getText().toString().trim();
String age = et_login_activity_age.getText().toString().trim();
String address = et_login_activity_address.getText().toString().trim();
String tel = et_login_activity_tel.getText().toString().trim();
String sfz = et_login_activity_sfz.getText().toString().trim();
if (TextUtils.isEmpty(uname)) {
Toast.makeText(RegistActivity.this, "请输入账号", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(pwd)) {
Toast.makeText(RegistActivity.this, "请输入密码", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(nickname)) {
Toast.makeText(RegistActivity.this, "请输入姓名", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(sex)) {
Toast.makeText(RegistActivity.this, "请输入性别", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(age)) {
Toast.makeText(RegistActivity.this, "请输入年龄", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(address)) {
Toast.makeText(RegistActivity.this, "请输入地址", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(tel)) {
Toast.makeText(RegistActivity.this, "请输入手机号", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(sfz)) {
Toast.makeText(RegistActivity.this, "请输入身份证号", Toast.LENGTH_SHORT).show();
return;
}
showLoading();
String shijian = MyDateUtils.getTime();
QueryUserBean queryUserBean = Contants.getloginbean(RegistActivity.this);
String sql = "insert into users(loginname,loginpw,type,typename,xingming,xingbie,nianling" +
",address,dianhua,shenhe)"
+ "values('" + uname + "','" + pwd + "','" + "2" + "','" + "用户" + "','" +
nickname + "','" + sex + "','" + age + "','" + address + "','" + tel +
"','" + "yes" + "')";
Log.e("-注册sql--", "注册sql---" + sql);
Map<String, String> map = new HashMap<>();
map.put("action", "add");
map.put("sql", sql);
showLoading();
RetrofigGetUser.getInstance().getCommonApis()
.register(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObserver<ResponseBody>() {
@Override
public void onNext(ResponseBody responseBody) {
hideLoading();
String s = "";
try {
s = responseBody.string();
} catch (IOException e) {
e.printStackTrace();
}
if (s.equals("ok")) {
ToastUtil.shortShow("操作成功");
finish();
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
// ToastUtil.shortShow("访问失败,请检测网络");
hideLoading();
}
});
}
});
4.安卓端主界面
5.购物车结算界面