200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 【毕业设计】微信小程序商城购物系统

【毕业设计】微信小程序商城购物系统

时间:2019-07-24 03:18:00

相关推荐

【毕业设计】微信小程序商城购物系统

文章目录

0 前言1 项目介绍1.1 代码工程结构1.2 前端技术1.3 后端技术1.4 实现功能1.4.1 会员管理1.4.2 商城配置1.4.3 商品编辑1.4.4 推广管理1.4.5 订单管理1.4.6 系统管理1.4.7 短信服务平台2 运行效果2.1 前端效果2.2 后端效果3 实现部分源码3.1 前端布局3.2 后端逻辑4 最后

0 前言

🔥 Hi,大家好,这里是丹成学长的毕设系列文章!

🔥 对毕设有任何疑问都可以问学长哦!

这两年开始,各个学校对毕设的要求越来越高,难度也越来越大… 毕业设计耗费时间,耗费精力,甚至有些题目即使是专业的老师或者硕士生也需要很长时间,所以一旦发现问题,一定要提前准备,避免到后面措手不及,草草了事。

为了大家能够顺利以及最少的精力通过毕设,学长分享优质毕业设计项目,今天要分享的新项目是

🚩基于微信小程序的商城购物系统

🥇学长这里给一个题目综合评分(每项满分5分)

难度系数:4分工作量:4分创新点:3分

🧿选题指导, 项目分享:

/yaa-dc/BJH/blob/master/gg/cc/README.md


1 项目介绍

1.1 代码工程结构

platform-wechat-mall

|–platform-admin 后台管理

|–platform-api 微信小程序商城api接口

|–platform-common 公共模块

|–platform-framework 系统WEB合并,请打包发布此项目

|–platform-gen 代码生成

|–platform-mp 微信公众号模块

|–platform-schedule 定时任务

|–platform-shop 商城后台管理

|–wx-mall 微信小程序商城

|–platform-vue 微信公众号商城

1.2 前端技术

Vue2.5.1iviewlayer3.0.3jquery2.2.4bootstrap3.3.7jqgrid5.1.1ztree3.5.26froala_editor1.2.2

1.3 后端技术

springframework4.3.7.RELEASE

mybatis3.1.0、MyBatis-Plus 3.1.0

shiro1.3.2

servlet3.1.0

druid1.0.28

slf4j1.7.19

fastjson1.2.30

poi3.15

velocity1.7

quartz2.2.3

mysql5.1.39

swagger2.4

j2cache2.3.22-release

weixin-java-mp3.2.0

MybatisPlus3.1.0

lombok

1.4 实现功能

1.4.1 会员管理

a 会员管理b 会员等级c 收货地址管理d 会员优惠劵e 会员收藏f 会员足迹g 搜索历史h 购物车

1.4.2 商城配置

a 区域配置b 商品属性种类c 品牌制造商d 商品规格e 订单管理f 商品类型g 渠道管理h 商品问答i 反馈j 关键词

1.4.3 商品编辑

a 所有商品b 用户评论c 产品设置d 商品规格e 商品回收站

1.4.4 推广管理

a 广告列表b 广告位置c 优惠劵管理d 专题管理e 专题分类

1.4.5 订单管理

a 所有订单管理

1.4.6 系统管理

a 管理员列表b 角色管理c 菜单管理d SQL监控e 定时任务f 参数管理g 代码生成器h 系统日志i 文件上传j 通用字典表

1.4.7 短信服务平台

a 配置短信平台账户信息b 向外提供发送短信接口:

2 运行效果

2.1 前端效果

2.2 后端效果

3 实现部分源码

3.1 前端布局

<view class="container"> <view wx:for="{{menus}}" wx:key="id" class="section"><view class="flex-wrp" style="flex-direction:row;"><image style="width: 500rpx; height: 200rpx; background-color: #eeeeee;" mode="aspectFill" src="{{item.image}}" bindtap="preview" data-imgsrc="{{item.image}}" ></image><view class="flex-item"><text>{{item.name}}</text>\n<text class="flex-desc">{{item.description}}</text>\n<text class="red">¥ {{item.price}}</text></view> </view><button type='primary' bindtap="onbuy" data-id="{{item.id}}">购买</button> </view><!--section--></view><!--container-->

3.2 后端逻辑

namespace Api\Controller;use Think\Controller;class ShoppingController extends Controller {//***************************// 会员获取购物车列表接口//***************************public function index(){$shopping=M("shopping_char");$product=M("menu");$user_id = intval($_REQUEST['user_id']);if (!$user_id) {echo json_encode(array('status'=>0));exit();}/*$shop = $shopping->where(''.$qz.'shopping_char.uid='.intval($user_id))->join('left join __SHANGCHANG__ on __SHANGCHANG__.id = __SHOPPING_CHAR__.shop_id')->distinct(''.$qz.'shopping_char.shop_id')->field(''.$qz.'shangchang.id,'.$qz.'shangchang.name,'.$qz.'shangchang.logo')->select();foreach ($shop as $n=>$v){$shop[$n]['logo'] = __DATAURL__.$v['logo'];$shop[$n]['slist']=$shopping->where(''.$qz.'shopping_char.uid='.intval($user_id).' and '.$qz.'shopping_char.shop_id='.intval($v['id']))->join('LEFT JOIN __PRODUCT__ ON __SHOPPING_CHAR__.pid = __PRODUCT__.id')->field(''.$qz.'shopping_char.id,'.$qz.'product.id as proid,'.$qz.'product.name,'.$qz.'product.num as pnum,'.$qz.'product.price_yh,'.$qz.'product.photo_x,'.$qz.'shopping_char.num,'.$qz.'shopping_char.buff,'.$qz.'shopping_char.price')->select();//获取产品规格名称foreach ($shop[$n]['slist'] as $k=>$vl){$key=explode(',', $vl['buff']);foreach ($key as $m=>$val){$buff_text=M('guige')->where('id='.intval($val))->getField('name');$shop[$n]['slist'][$k]['g_name'] .= '&nbsp;'.$buff_text;}$shop[$n]['slist'][$k]['photo_x'] = __DATAURL__.$vl['photo_x'];}}*/$cart = $shopping->where('uid='.intval($user_id))->field('id,uid,pid,price,num')->select();foreach ($cart as $k => $v) {$pro_info = $product->where('id='.intval($v['pid']))->field('name,image')->find();$cart[$k]['pro_name']=$pro_info['name'];$cart[$k]['photo_x']=$pro_info['image'];}echo json_encode(array('status'=>1,'cart'=>$cart));exit();}//购物车商品删除public function delete(){$shopping=M("shopping_char");$cart_id=intval($_REQUEST['cart_id']);$check_id = $shopping->where('id='.intval($cart_id))->getField('id');if (!$check_id) {echo json_encode(array('status'=>1));exit();}$res = $shopping->where('id ='.intval($cart_id))->delete(); // 删除if($res){echo json_encode(array('status'=>1));exit();}else{echo json_encode(array('status'=>0));exit();}}//***************************// 会员修改购物车数量接口//***************************public function up_cart(){$shopping=M("shopping_char");$uid = intval($_REQUEST['user_id']);$cart_id = intval($_REQUEST['cart_id']);$num=intval($_REQUEST['num']);if (!$uid || !$cart_id || !$num) {echo json_encode(array('status'=>0,'err'=>'网络异常.'.__LINE__));exit();}$check = $shopping->where('id='.intval($cart_id))->find();if (!$check) {echo json_encode(array('status'=>0,'err'=>'购物车信息错误!'));exit();}$data=array();$data['num']=$num;$res = $shopping->where('id ='.intval($cart_id).' AND uid='.intval($uid))->save($data);if ($res) {echo json_encode(array('status'=>1,'succ'=>'操作成功!'));exit();}else{echo json_encode(array('status'=>0,'err'=>'操作失败.'));exit();}}//多个购物车商品删除public function qdelete(){$uid = intval($_REQUEST['uid']);if (!$uid) {echo json_encode(array('status'=>0,'err'=>'网络异常,请稍后再试.'));exit();}$shopping=M("shopping_char");$cart_id=trim($_REQUEST['cart_id'],',');if (!$cart_id) {echo json_encode(array('status'=>0,'err'=>'网络错误,请稍后再试.'));exit();}$res = $shopping->where('id in ('.$cart_id.') AND uid='.intval($uid))->delete(); // 删除if($res){echo json_encode(array('status'=>1));exit();}else{echo json_encode(array('status'=>0,'err'=>'操作失败.'));exit();}}//添加购物车public function add(){$uid = intval($_REQUEST['uid']);if (!$uid) {echo json_encode(array('status'=>0,'err'=>'登录状态异常.'));exit();}$pid = intval($_REQUEST['id']);$num = 1;if (!intval($pid) || !intval($num)) {echo json_encode(array('status'=>0,'err'=>'参数错误.'));exit();}//加入购物车$check = $this->check_cart(intval($pid));if ($check['status']==0) {echo json_encode(array('status'=>0,'err'=>$check['err']));exit;}$check_info = M('menu')->where('id='.intval($pid).' AND status=1')->find();//判断库存if (!$check_info) {echo json_encode(array('status'=>0,'err'=>'没有这个商品!'));exit;}$shpp=M("shopping_char");// $shu=trim($_POST['val'],',');// if($shu){// //判断用户是否已经选择完规格,未选完则提示错误// $a = explode(',', $check_info['pro_buff']);// $b = explode(',', $shu);// if (count($a)!==count($b) || in_array('0', $b)) {// echo json_encode(array('status'=>0,'err'=>'请选择规格.'));// exit;// }// }else{// if ($check_info['pro_buff']) {// echo json_encode(array('status'=>0,'err'=>'请选择规格.'.__LINE__));// }// }//判断购物车内是否已经存在该商品$data = array();$cart_info = $shpp->where('pid='.intval($pid).' AND uid='.intval($uid))->field('id,num')->find();if ($cart_info) {$data['num'] = intval($cart_info['num'])+intval($num);$shpp->where('id='.intval($cart_info['id']))->save($data);$res = $cart_info['id'];}else{$data['pid']=intval($pid);$data['num']=intval($num);$data['addtime']=time();$data['uid']=intval($uid);$data['shop_id']=intval($check_info['shop_id']);$ptype = 1;if (intval($check_info['pro_type'])) {$ptype = intval($check_info['pro_type']);}$data['type']=$ptype;$data['price'] = $check_info['price'];$res=$shpp->add($data);}if($res){echo json_encode(array('status'=>1,'cart_id'=>$res)); //该商品已成功加入您的购物车exit;}else{echo json_encode(array('status'=>0,'err'=>'加入失败.'));exit;}}//***************************// 会员立即购买下单接口//***************************public function check_shop(){$cart_id = trim($_REQUEST['cart_id'],',');$id=explode(',',$cart_id);if (!$cart_id) {echo json_encode(array('status'=>0));exit();}foreach ($id as $k=>$v){$shoop[$k]=M("shopping_char")->where('id ='.intval($v))->field('shop_id,pid')->find();}foreach($shoop as $key => $value){$result[$key] = M("product")->where('id='.intval($value['pid']))->field('id,price,price_yh')->select();$price[] = i_array_column($result[$key], 'price_yh');}//dump($price);exit;foreach($price as $keys => $va){$str .= implode(",", $va).",";}$str = trim($str, ",");$parr = explode(",", $str);if(array_sum($parr) && in_array("0", $parr)){echo json_encode(array('status'=>0));exit();}$names = i_array_column($shoop, 'shop_id');$arr=array_unique($names);$val= sizeof($arr);if($val=='1'){echo json_encode(array('status'=>1));exit();}else{echo json_encode(array('status'=>2));exit();} }//购物车添加。删除检测公共方法public function check_cart($pid){//检查产品是否存在或删除$check_info = M('menu')->where('id='.intval($pid).' AND status=1')->find();if (!$check_info) {return array('status'=>0,'err'=>'商品不存在或已下架.');}return array('status'=>1);} /*去除HTNL标签*/public function html_entity($array){foreach ($array as $key => $value) {$array[$key]['content'] = strip_tags(html_entity_decode($value['content']));}return $array;}}

4 最后

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。