微信小程序线上预约管理系统
/**
* 人员列表
* @param {Object} $table 表名
* @param {Object} $pageindex 分页page
* @param {Object} $pagesize 分页num
* @param {Object} $where 条件
* @param {Object} $data
*/
技 术 支 持 Q Q :
public 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;
}
手机微信扫码,可以在线体验一下案例的效果
服务详情预约界面
在线预约时间选择功能模块
支付后完成订单的在线预约