微信小程序线上预约管理系统

微信小程序线上预约管理系统

核心代码展示

/**
* 人员列表
* @param {Object} $table 表名
* @param {Object} $pageindex 分页page
* @param {Object} $pagesize 分页num
* @param {Object} $where 条件
* @param {Object} $data
*/

    技 术 支 持 Q Qpublic static function staffList($table, $pageindex, $pagesize, $where, $data,$order = ' order by sort ASC , id DESC',$type = 1,$lat = 0, $lng = 0)
    {
        $sql = "SELECT * FROM " . tablename($table) . $where . $order;
        $select_sql = $sql . " LIMIT " . ($pageindex - 1) * $pagesize . "," . $pagesize;
        $list = pdo_fetchall($select_sql, $data);
        $total = pdo_fetchcolumn("SELECT count(*) FROM " . tablename($table) . $where, $data);
        $pager = pagination($total, $pageindex, $pagesize);
        if ($list) {
            foreach($list as &$v){
                $v['add_time'] = Common::time($v['add_time']);
                $v['type'] = pdo_get('yzd_my_staff_type',array('id'=>$v['type_id']))['title'];
                $service_arr = json_decode($v['service_arr'],true);
                for ($i=0; $i < count($service_arr); $i++) { 
                    $service_arr[$i] = pdo_get('yzd_my_service',array('id'=>$service_arr[$i]['id']));
                }
                $v['service_arr'] = $service_arr;
                $v['content'] = '';
                if($type == 2){
                    $v['juli'] = (int)Common::GetDistance($v['latitude'], $v['longitude'], $lat, $lng);
					if($v['juli']>1000){
						$v['juli']= round($v['juli']/1000,2) . 'km';
					}else{
						$v['juli']= $v['juli'] . 'm';
					}
                }
                $comment_num_sql = "select count(id) as count from " . tablename("yzd_my_staff_comment") . " where uniacid = " . $v['uniacid'] . " and staff_id = " . $v['id'] . " and state=1 ";
                $v['comment_num'] = pdo_fetch($comment_num_sql)['count'];

                $order_num_sql = "select count(id) as count from " . tablename("yzd_my_service_order") . " where uniacid = " . $v['uniacid'] . " and staff_id = " . $v['id'] . " and is_pay = 1 and is_refund = 0 ";
                $v['order_num'] = pdo_fetch($order_num_sql)['count'];

            }
        }
        $res['data'] = $list;
        $res['total'] = $total;
        return $res;
    }
// 服务订单过售后
    static public function ServiceSale($order_id,$uniacid){
        $order = pdo_get('yzd_my_service_order',array('uniacid'=>$uniacid,'id'=>$order_id));
        pdo_update('yzd_my_service_order',array('is_sale'=>1),array('uniacid'=>$uniacid,'id'=>$order_id));
        //判断是否有赠送积分
        if($order['integral'] > 0) {
            $note = '预约服务送积分,订单号:'.$order['ordercode'].',金额为:'.$order['total_pay_price'];
            Common::saveIntegral($order['user_id'], 1, $order['integral'], 1, $note,$uniacid,$order['id']);
        }
        // 算分销
        if($order['distribute_price'] > 0){
            $dis_order = pdo_get('yzd_my_distribute_order',array('order_id'=>$order['id'],'type'=>1));
            pdo_update('yzd_my_distribute_order',array('state'=>2),array('order_id'=>$order['id']));
            if($dis_order['one_user_id'] > 0 && $dis_order['one_money'] > 0){
                $one_dis = pdo_get('yzd_my_distribute',array('user_id'=>$dis_order['one_user_id']));
                pdo_update('yzd_my_distribute_wallet',array('bktx_money -='=>$dis_order['one_money'],'ktx_money +='=>$dis_order['one_money']),array('dis_id'=>$one_dis['id']));
            }
            if($dis_order['two_user_id'] > 0 && $dis_order['two_money'] > 0){
                $two_dis = pdo_get('yzd_my_distribute',array('user_id'=>$dis_order['two_user_id']));
                pdo_update('yzd_my_distribute_wallet',array('bktx_money -='=>$dis_order['two_money'],'ktx_money +='=>$dis_order['two_money']),array('dis_id'=>$two_dis['id']));
            }
            if($dis_order['three_user_id'] > 0 && $dis_order['three_money'] > 0){
                $three_dis = pdo_get('yzd_my_distribute',array('user_id'=>$dis_order['three_user_id']));
                pdo_update('yzd_my_distribute_wallet',array('bktx_money -='=>$dis_order['three_money'],'ktx_money +='=>$dis_order['three_money']),array('dis_id'=>$three_dis['id']));
            }
        }
        // 人员钱包
        pdo_update('yzd_my_staff_wallet',array('bktx_money -='=>$order['staff_price'],'ktx_money +='=>$order['staff_price']),array('staff_id'=>$order['staff_id']));
        pdo_update('yzd_my_staff_wallet_log',array('time2'=>time(),'in_state'=>2),array('type'=>1,'type2'=>1,'order_id'=>$order['id']));

        // 加销量
        pdo_update('yzd_my_service',array('sales +='=>1),array('id'=>$order['service_id']));

        Common::updateVipGrade($order['user_id']);
    }

    static public function object_array($array) {  
        if(is_object($array)) {  
            $array = (array)$array;  
        } 
        if(is_array($array)) {
            foreach($array as $key=>$value) {  
                $array[$key] = object_array($value);  
            }  
        }  
        return $array;  
    }
    static function rgbToColor($str)
    {
        $str = explode('(',$str)[1];
        $str = explode(')',$str)[0];
        return $str;
    }
    static function poster($uniacid)
    {
        $res = pdo_get('yzd_my_poster', array('uniacid'=>$uniacid));
        $res['servicePoster'] = $res['servicePoster'] ? json_decode($res['servicePoster'], true) : false;
        $res['goodPoster'] = $res['goodPoster'] ? json_decode($res['goodPoster'], true) : false;
        $res['staffPoster'] = $res['staffPoster'] ? json_decode($res['staffPoster'], true) : false;
        $res['articlePoster'] = $res['articlePoster'] ? json_decode($res['articlePoster'], true) : false;
        $res['disPoster'] = $res['disPoster'] ? json_decode($res['disPoster'], true) : false;
        return $res;
    }


    // 服务订单已确认待服务
    static public function ServiceConfirmed($uniacid,$order_id){
        $res = pdo_update('yzd_my_service_order',array('state'=>3,'confirm_time'=>time()),array('uniacid'=>$uniacid,'id'=>$order_id));
        return $res;
    }

手机微信扫码,可以在线体验一下案例的效果
在这里插入图片描述
服务详情预约界面
在这里插入图片描述
在线预约时间选择功能模块
在这里插入图片描述
支付后完成订单的在线预约
在这里插入图片描述

二次开发 技术交流 QQ扫一扫

在这里插入图片描述

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

linlinlove2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值