• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

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

武飞扬头像
caxiou
帮助1


0 前言

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

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

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

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

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

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

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

🧿 选题指导, 项目分享:

https://gitee.com/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.1
  • iview
  • layer3.0.3
  • jquery2.2.4
  • bootstrap3.3.7
  • jqgrid5.1.1
  • ztree3.5.26
  • froala_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 最后

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgahfeb
系列文章
更多 icon
同类精品
更多 icon
继续加载