博主介绍:本人专注于Android/java/数据库/微信小程序技术领域的开发,以及有好几年的计算机毕业设计方面的实战开发经验和技术积累;尤其是在安卓(Android)的app的开发和微信小程序的开发,很是熟悉和了解;本人也是多年的Android开发人员;希望我发布的此篇文件可以帮助到您;
🍅文章末尾获取源码下载方式🍅
目录
源码下载以及详细的配置说明
一、项目介绍
系统注册,登录
商品信息,用户信息管理
商品查找,查找推荐,网页推荐,分类显示功能
消息公告,商品评论,评分功能
销售统计,排序功能
用户添加/修改地址,提交订单。取消订单
订单页面,对历史订单的查看
购物车,购物车商品结算,删除,付款
我的页面,修改用户密码,修改地址,修改个人信息
商家订单管理,商品管理,留言评论管理
二、运行环境
1:客户端使用Android stuido进行开发;
2:服务端后台使用Myeclipse2014进行开发;
3:mysql数据库进行数据存储;
4:需要jdk1.7以上
5:使用雷电模拟器或者Androidstuio自带的模拟器进行运行
三、使用技术
总体设计逻辑和思路:
1:先设计数据库表文件
2:写服务端jsp页面以及写api接口给客户端提供数据
3:完成后台服务端的数据交互,也就是jsp页面数据的存储和显示
4:进行客户端页面的开发;
5:进行客户端对api接口的调用,也就是获取数据库的数据以及在客户端进行显示移动端:
1:使用android原生控件以及xml布局文件来完成界面的显示
2:使用java代码完成功能的数据和逻辑交互
3:使用http网络请求完成数据的请求;
4:使用json数据解析完成客户端数据的回调和显示服务端后台:
1:使用mysql完成数据的存储
2:使用jdbc完成数据库和代码的逻辑交互
3:使用jsp完成网页数据的显示
4:使用java代码完成api接口的编写以及以及数据的回调
四、数据库设计
/*
Navicat MySQL Data Transfer
Source Server : mydb
Source Server Version : 50528
Source Host : localhost:3306
Source Database : snacksdb
Target Server Type : MYSQL
Target Server Version : 50528
File Encoding : 65001
Date: 2018-11-11 15:03:34
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for noticetb
-- ----------------------------
DROP TABLE IF EXISTS `noticetb`;
CREATE TABLE `noticetb` (
`noticeId` int(50) NOT NULL AUTO_INCREMENT,
`noticeTitel` varchar(255) DEFAULT NULL,
`noticeContent` varchar(1500) DEFAULT NULL,
`noticeTime` varchar(100) DEFAULT NULL,
PRIMARY KEY (`noticeId`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of noticetb
-- ----------------------------
INSERT INTO `noticetb` VALUES ('3', '天猫双11', '距离今年的天猫双十一就剩最后的几个小时了,天猫十一红包大放送倒计时 教你领淘宝双十一红包最后一波1111元高额红包,各位小伙伴们请抓住最后的机会不然的话真的是要等你一年了', '2018-11-10 23:04');
INSERT INTO `noticetb` VALUES ('4', '哪些商品支持使用天猫双11购物津贴?', '2018天猫双11活动店铺全店商品(包含双11活动商品及非活动商品)均须支持使用“双十一购物津贴”(部分不支持双11购物津贴使用类目除外)。2018天猫双11活动店铺全店商品(包含双11活动商品及非活动商品)均须支持使用“双十一购物津贴”(部分不支持双11购物津贴使用类目除外)。', '2018-11-10 23:04');
INSERT INTO `noticetb` VALUES ('5', '2018双十一红包使用顺序', '消费者付款时默认优先使用单品优惠券、店铺优惠券,如订单满足“双十一购物津贴”和“品类购物券”使用条件则可继续叠加使用“双十一购物津贴”和“品类购物券”。消费者付款时默认优先使用单品优惠券、店铺优惠券,如订单满足“双十一购物津贴”和“品类购物券”使用条件则可继续叠加使用“双十一购物津贴”和“品类购物券”。', '2018-11-10 23:04');
-- ----------------------------
-- Table structure for ordermsg
-- ----------------------------
DROP TABLE IF EXISTS `ordermsg`;
CREATE TABLE `ordermsg` (
`orderId` int(50) NOT NULL AUTO_INCREMENT,
`orderFoodId` varchar(50) DEFAULT NULL,
`orderFoodName` varchar(255) DEFAULT NULL,
`orderFoodMoney` varchar(255) DEFAULT NULL,
`orderUserId` varchar(255) DEFAULT NULL,
`orderUserName` varchar(255) DEFAULT NULL,
`orderCreateTime` varchar(100) DEFAULT NULL,
`orderState` varchar(255) DEFAULT NULL,
`orderFoodImg` varchar(255) DEFAULT NULL,
`orderNumber` varchar(100) DEFAULT NULL,
`orderUserState` varchar(255) DEFAULT NULL,
`orderTotalMoney` int(255) DEFAULT NULL,
`orderPayType` varchar(255) DEFAULT NULL,
`orderAddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`orderId`)
) ENGINE=InnoDB AUTO_INCREMENT=183 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of ordermsg
-- ----------------------------
INSERT INTO `ordermsg` VALUES ('156', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('157', '50', '香蕉', '5', '11', 'pony', '2018-11-10 23:26:10', '2', '1505283939521.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('158', '51', '橘子', '10', '11', 'pony', '2018-11-10 22:14:37', '2', '47020002a9cdee957096.jpg', '1', '1', '20', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('159', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('160', '50', '香蕉', '5', '11', 'pony', '2018-11-10 23:26:10', '2', '1505283939521.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('161', '53', '梨', '6', '11', 'pony', '2018-11-10 20:14:38', '2', 'ms4.jpg', '1', '1', '6', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('163', '51', '橘子', '10', '11', 'pony', '2018-11-10 22:14:37', '2', '47020002a9cdee957096.jpg', '1', '1', '20', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('164', '55', '草莓', '15', '11', 'pony', '2018-11-10 22:13:57', '2', 'timg.jpg', '4', '1', '70', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('165', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('166', '51', '橘子', '10', '11', 'pony', '2018-11-10 22:14:37', '2', '47020002a9cdee957096.jpg', '1', '1', '20', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('173', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('174', '50', '香蕉', '5', '11', 'pony', '2018-11-10 23:26:10', '2', '1505283939521.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('175', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '6', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('176', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '2', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('177', '50', '香蕉', '5', '11', 'pony', '2018-11-10 23:26:10', '2', '1505283939521.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('179', '49', '苹果', '10', '11', 'pony', '2018-11-10 23:26:10', '2', '1497354407228.jpg', '1', '1', '15', '微信支付', '西安市雁塔区');
INSERT INTO `ordermsg` VALUES ('182', '51', '橘子', '10', '11', 'pony', '2018-11-10 23:27:23', '1', '47020002a9cdee957096.jpg', '1', '1', null, null, null);
-- ----------------------------
-- Table structure for review
-- ----------------------------
DROP TABLE IF EXISTS `review`;
CREATE TABLE `review` (
`reviewId` int(50) NOT NULL AUTO_INCREMENT,
`reviewUserId` varchar(50) NOT NULL,
`reviewUserName` varchar(100) NOT NULL,
`reviewMessageId` varchar(100) NOT NULL,
`reviewReviewContent` varchar(300) NOT NULL,
`reviewScore` varchar(255) DEFAULT NULL,
`reviewCreatime` varchar(100) NOT NULL,
PRIMARY KEY (`reviewId`)
) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of review
-- ----------------------------
INSERT INTO `review` VALUES ('93', '11', 'pony', '51', '还可以,味道不错', '2', '2018-11-08 23:03:36');
INSERT INTO `review` VALUES ('94', '11', 'pony', '52', '很好吃,极力推荐', '1', '2018-11-08 23:03:50');
INSERT INTO `review` VALUES ('95', '15', '小花', '50', '很好吃', '2', '2018-11-08 23:24:09');
-- ----------------------------
-- Table structure for snacksmsg
-- ----------------------------
DROP TABLE IF EXISTS `snacksmsg`;
CREATE TABLE `snacksmsg` (
`snacksId` int(50) NOT NULL AUTO_INCREMENT,
`snacksTitle` varchar(100) NOT NULL,
`snacksTypeId` varchar(255) DEFAULT NULL,
`snacksTypeName` varchar(255) DEFAULT NULL,
`snacksMoney` varchar(255) DEFAULT NULL,
`snacksNumber` int(100) DEFAULT NULL,
`snacksCreatTime` varchar(100) NOT NULL,
`snacksImage` varchar(100) NOT NULL,
PRIMARY KEY (`snacksId`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of snacksmsg
-- ----------------------------
INSERT INTO `snacksmsg` VALUES ('49', '苹果', '8', '水果', '10', '94', '2018-11-08 16:11:53', '1497354407228.jpg');
INSERT INTO `snacksmsg` VALUES ('50', '香蕉', '8', '水果', '5', '97', '2018-11-08 16:12:08', '1505283939521.jpg');
INSERT INTO `snacksmsg` VALUES ('51', '橘子', '8', '水果', '10', '98', '2018-11-08 16:12:23', '47020002a9cdee957096.jpg');
INSERT INTO `snacksmsg` VALUES ('52', '手撕面包', '9', '面包', '5', '100', '2018-11-08 16:12:53', '1501153409556.jpg');
INSERT INTO `snacksmsg` VALUES ('53', '梨', '8', '水果', '6', '99', '2018-11-08 22:40:25', 'ms4.jpg');
INSERT INTO `snacksmsg` VALUES ('55', '草莓', '8', '水果', '15', '99', '2018-11-08 23:22:14', 'timg.jpg');
INSERT INTO `snacksmsg` VALUES ('56', '椰子', '8', '水果', '10', '60', '2018-11-10 22:32:36', 'ms1.jpg');
-- ----------------------------
-- Table structure for typetb
-- ----------------------------
DROP TABLE IF EXISTS `typetb`;
CREATE TABLE `typetb` (
`typeId` int(50) NOT NULL AUTO_INCREMENT,
`typeName` varchar(255) DEFAULT NULL,
`typeTime` varchar(100) DEFAULT NULL,
PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of typetb
-- ----------------------------
INSERT INTO `typetb` VALUES ('8', '水果', '2018-11-08 15:19');
INSERT INTO `typetb` VALUES ('9', '面包', '2018-11-08 15:20');
INSERT INTO `typetb` VALUES ('10', '瓜子', '2018-11-08 15:20');
INSERT INTO `typetb` VALUES ('11', '巧克力', '2018-11-08 15:20');
INSERT INTO `typetb` VALUES ('12', '糖果', '2018-11-08 15:20');
INSERT INTO `typetb` VALUES ('13', '饮料', '2018-11-08 15:23');
INSERT INTO `typetb` VALUES ('14', '炒货', '2018-11-08 15:24');
INSERT INTO `typetb` VALUES ('15', '肉类', '2018-11-08 15:25');
INSERT INTO `typetb` VALUES ('16', '蛋制品', '2018-11-08 15:25');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`uid` int(50) NOT NULL AUTO_INCREMENT,
`uname` varchar(100) NOT NULL,
`uphone` varchar(100) NOT NULL,
`upswd` varchar(100) NOT NULL,
`utime` varchar(100) NOT NULL,
`uaddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('11', 'pony', '15249243002', '123456', '2018-11-08 10:33', '西安市雁塔区');
INSERT INTO `user` VALUES ('12', 'tom', '15249241234', '123456', '2018-11-0818:25', null);
INSERT INTO `user` VALUES ('13', 'Jack', '15249245678', '123456', '2018-11-08 18:35', null);
INSERT INTO `user` VALUES ('14', '小明', '15249248888', '123456', '2018-11-08 23:20', null);
INSERT INTO `user` VALUES ('15', '小花', '15249249999', '123456', '2018-11-08 23:22', '西安市雁塔区');
五、部分代码
1:我的订单代码
public class MyOrderActivity extends BaseActivity {
private TextView mTvTitle;
private ImageView mIvBack;
private TextView mIvStu;
private ListView mListMessage;
private List<OrderModel> list_result = new ArrayList<OrderModel>();
private String state;
private LinearLayout mllNomessage;
OrderListAdapter orderListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_im);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.mIvBack:
finish();
break;
}
}
@Override
public void initWidget() {
mIvStu = (TextView) findViewById(R.id.mIvStu);
mIvStu.setText("Ìí¼Ó");
mIvStu.setVisibility(View.GONE);
mllNomessage = (LinearLayout) findViewById(R.id.mllNomessage);
mListMessage = (ListView) findViewById(R.id.mListMessage);
mIvBack = (ImageView) findViewById(R.id.mIvBack);
mTvTitle = (TextView) findViewById(R.id.mTvTitle);
state = this.getIntent().getStringExtra("state");
mIvBack.setVisibility(View.VISIBLE);
mIvBack.setOnClickListener(this);
mIvStu.setOnClickListener(this);
}
@Override
public void initData() {
MessageAction(true);
mListMessage.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
Intent intent = new Intent(MyOrderActivity.this, OrderMessageActivity.class);
intent.putExtra("msg", list_result.get(pos));
MyOrderActivity.this.startActivity(intent);
}
});
}
private void MessageAction(boolean isShow) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "orderListMessagePhone");
params.put("orderUserId", MemberUserUtils.getUid(this));
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultFlag, isShow, "");
}
@Override
protected void callBackSuccess(ResponseEntry entry, int actionId) {
super.callBackSuccess(entry, actionId);
switch (actionId) {
case Consts.actionId.resultFlag:
if (null != entry.getData() && !TextUtils.isEmpty(entry.getData())) {
String jsonMsg = entry.getData().substring(1, entry.getData().length() - 1);
if (null != jsonMsg && !TextUtils.isEmpty(jsonMsg)) {
list_result = mGson.fromJson(entry.getData(), new TypeToken<List<OrderModel>>() {
}.getType());
orderListAdapter = new OrderListAdapter(MyOrderActivity.this, list_result);
mListMessage.setAdapter(orderListAdapter);
} else {
mllNomessage.setVisibility(View.VISIBLE);
}
}
break;
default:
break;
}
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
initWidget();
initData();
}
}
2:我的购物车
public class MyCarActivity extends BaseActivity implements FoodNumberListner {
// 标题
private TextView mTvTitle;
//返回
private ImageView mIvBack;
private TextView mIvStu;
private ListView mListMessage;
private List<OrderModel> list_result = new ArrayList<OrderModel>();
private String state;
private LinearLayout mllNomessage;
CarListAdapter orderListAdapter;
private TextView setting_text;
private LinearLayout mllGoBuy;
private TypeModel tableModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mycar);
initWidget();
initData();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.mIvBack: //返回按钮
finish();
break;
}
}
@Override
public void initWidget() {
tableModel = (TypeModel) this.getIntent().getSerializableExtra("msg");
setting_text = (TextView) findViewById(R.id.setting_text);
mIvStu = (TextView) findViewById(R.id.mIvStu);
mIvStu.setText("添加");
mIvStu.setVisibility(View.GONE);
mllNomessage = (LinearLayout) findViewById(R.id.mllNomessage);
mListMessage = (ListView) findViewById(R.id.mListMessage); //选择商品界面 ListView
mllGoBuy = (LinearLayout) findViewById(R.id.mllGoBuy); //立即购买
mIvBack = (ImageView) findViewById(R.id.mIvBack);
mTvTitle = (TextView) findViewById(R.id.mTvTitle);
state = this.getIntent().getStringExtra("state");
mTvTitle.setText("我的购物车"); //设置界面标题为:
mIvBack.setVisibility(View.VISIBLE);
mIvBack.setOnClickListener(this);
mIvStu.setOnClickListener(this);
mllGoBuy.setOnClickListener(this);
}
@Override
public void initData() {
MessageAction(true);
// 设置选择商品界面 ListView
mListMessage.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
Intent intent = new Intent(MyCarActivity.this, OrderMessageActivity.class);
intent.putExtra("msg", list_result.get(pos));
MyCarActivity.this.startActivity(intent);
}
});
//为立即购买 设置监听事件
mllGoBuy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ArrayList<OrderModel> listFoodPay = new ArrayList<OrderModel>();
for (int i = 0; i < list_result.size(); i++) {
if(Integer.valueOf(list_result.get(i).getOrderNumber())!=0){
listFoodPay.add(list_result.get(i));
}
}
//跳转到支付确认界面
Intent intent = new Intent(MyCarActivity.this,PayMessageActivity.class);
intent.putExtra("payShop",(Serializable) listFoodPay);
intent.putExtra("payMoney",foodTotalMoney+"");
intent.putExtra("msg", tableModel);
MyCarActivity.this.startActivity(intent);
MyCarActivity.this.finish();
}
});
}
private void listOrderDeleteMessage(boolean isShow) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "listOrderDeleteMessage");
params.put("orderUserId", MemberUserUtils.getUid(this));
params.put("orderFoodId", MemberUserUtils.getUid(this));
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultFlag, isShow, "正在加载...");
}
private void MessageAction(boolean isShow) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "noPayOrder"); //我的购物车
params.put("orderUserId", MemberUserUtils.getUid(this));
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultFlag, isShow, "正在加载...");
}
//商品 +
private void updateAddState(boolean isShow, OrderModel orderModel) {
int orderNumberMgs = Integer.valueOf(orderModel.getOrderNumber());
orderNumberMgs++;
AjaxParams params = new AjaxParams();
params.put("action_flag", "updateAddState");
params.put("orderUserId", MemberUserUtils.getUid(this));
params.put("orderId", orderModel.getOrderId());
params.put("orderNumber", orderNumberMgs + "");
params.put("foodId", orderModel.getOrderFoodId() + "");
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultCode, isShow, "正在加载...");
}
//商品 -
private void updateReduceState(boolean isShow, OrderModel orderModel) {
int orderNumberMgs = Integer.valueOf(orderModel.getOrderNumber());
orderNumberMgs--;
AjaxParams params = new AjaxParams();
params.put("action_flag", "updateReduceState");
params.put("orderUserId", MemberUserUtils.getUid(this));
params.put("orderId", orderModel.getOrderId());
params.put("orderNumber", orderNumberMgs + "");
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultMsg, isShow, "正在加载...");
}
//商品删除deleteOrder方法
private void deleteOrder(boolean isShow, OrderModel orderModel) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "deleteOrder");
params.put("orderId", orderModel.getOrderId());
httpPost(Consts.URL + Consts.APP.OrderAction, params, Consts.actionId.resultState, isShow, "正在加载...");
}
@Override
protected void callBackSuccess(ResponseEntry entry, int actionId) {
super.callBackSuccess(entry, actionId);
switch (actionId) {
case Consts.actionId.resultFlag:
if (null != entry.getData() && !TextUtils.isEmpty(entry.getData())) {
String jsonMsg = entry.getData().substring(1, entry.getData().length() - 1);
if (null != jsonMsg && !TextUtils.isEmpty(jsonMsg)) {
list_result.clear();
list_result = mGson.fromJson(entry.getData(), new TypeToken<List<OrderModel>>() {
}.getType());
TotalMoney();
orderListAdapter = new CarListAdapter(MyCarActivity.this, list_result, MyCarActivity.this);
mListMessage.setAdapter(orderListAdapter);
} else {
mllNomessage.setVisibility(View.VISIBLE);
}
}
break;
case Consts.actionId.resultCode:
OrderModel checkOrderModel = list_result.get(posNum);
int orderNumberMgs = Integer.valueOf(checkOrderModel.getOrderNumber());
orderNumberMgs++;
checkOrderModel.setOrderNumber(orderNumberMgs+"");
list_result.set(posNum, checkOrderModel);
orderListAdapter.notifyDataSetChanged();
TotalMoney();
break;
case Consts.actionId.resultMsg:
OrderModel checkOrderModelReDuce = list_result.get(posNum);
int orderNumberReDuce = Integer.valueOf(checkOrderModelReDuce.getOrderNumber());
orderNumberReDuce--;
if(orderNumberReDuce==0){
list_result.remove(posNum);
}else{
checkOrderModelReDuce.setOrderNumber(orderNumberReDuce+"");
list_result.set(posNum, checkOrderModelReDuce);
}
orderListAdapter.notifyDataSetChanged();
TotalMoney();
break;
default:
break;
}
}
@Override
protected void callBackAllFailure(String strMsg, int actionId) {
super.callBackAllFailure(strMsg, actionId);
ToastUtil.show(MyCarActivity.this, strMsg);
}
/**
* 加的操作
*/
int posNum;
@Override
public void setAdd(int pos, OrderModel orderModel) {
posNum = pos;
updateAddState(false, orderModel);
}
/**
* 减的操作
*/
@Override
public void setReduce(int pos, OrderModel orderModel) {
posNum = pos;
if(list_result.get(posNum).getOrderNumber().equals("1")){
ToastUtil.show(this,"剩余一个了不能再减了");
return;
}
updateReduceState(false, orderModel);
}
/**
* 删除操作
*/
@Override
public void setDelete(int pos, OrderModel orderModel) {
posNum = pos;
deleteOrder(true ,orderModel);
}
int foodTotalMoney ;
/**
* 计算总价格
*/
private void TotalMoney() {
int shopMoneyPrice = 0;
int shopNumber = 0;
for (int i = 0; i < list_result.size(); i++) {
int shopmonyTotal = Integer.valueOf(list_result.get(i).getOrderNumber()) * Integer.valueOf(list_result.get(i).getOrderFoodMoney());
shopMoneyPrice = shopMoneyPrice + shopmonyTotal;
shopNumber = shopNumber + Integer.valueOf(list_result.get(i).getOrderNumber());
}
foodTotalMoney = shopMoneyPrice;
setting_text.setText("总价格:" + shopMoneyPrice + "元");
}
}
六、浏览更多Android毕业设计
毕业设计-基于android的租房信息发布平台的APP_信息发布app源码_Android毕业设计源码的博客-CSDN博客
毕业设计-基于android选课系统的设计与实现_android学生选课系统_Android毕业设计源码的博客-CSDN博客
毕业设计之校园一卡通管理系统的设计与实现_一卡通管理系统实现_Android毕业设计源码的博客-CSDN博客
基于Android的校园二手闲置物品交易系统设计与实现_基于android的二手交易平台_Android毕业设计源码的博客-CSDN博客
基于androidstudio校园快递APP系统的设计与实现_android studio论文_Android毕业设计源码的博客-CSDN博客
基于android的商城购物定制APP_安卓开发购物app_Android毕业设计源码的博客-CSDN博客
更多毕业设计可以浏览我的个人主页哦!
七、源码下载
大家点赞、收藏、关注、评论啦 、查看👇🏻👇🏻👇🏻获取联系方式👇🏻👇🏻👇🏻
https://download.csdn.net/download/u014388322/88206152