if ($serverfee < 0) {
         $serverfee = 0;
     }
 }
 $totalfee = $freight + $serverfee + GetNum($deliveryrow['customs_fee']);
 if ($totalfee > $_USERS['money']) {
     print "<script language='javascript'>alert('账户余额不足!请充值后重新操作!');</script>";
     jumpurl(url('m.php?name=orderlist'));
 }
 $totalfee = sprintf("%01.2f", $totalfee);
 $freight = sprintf("%01.2f", $freight);
 $serverfee = sprintf("%01.2f", $serverfee);
 $deliveryrow['customs_fee'] = sprintf("%01.2f", $deliveryrow['customs_fee']);
 $addarray = array('uid' => $_USERS['uid'], 'uname' => $_USERS['uname'], 'email' => $_USERS['email'], 'oids' => $oids, 'couponid' => GetNum($couponid), 'freight' => GetNum($freight), 'serverfee' => $serverfee, 'customsfee' => $deliveryrow['customs_fee'], 'totalfee' => $totalfee, 'countmoney' => $countmoney, 'countweight' => $countweight, 'consignee' => $consignee, 'country' => $country, 'city' => $city, 'zip' => $zip, 'tel' => $tel, 'address' => $address, 'remark' => $remark, 'did' => $did, 'deliveryname' => $deliveryrow['deliveryname'], 'areaname' => $deliveryrow['areaname'], 'addtime' => time(), 'uptime' => time(), 'state' => 1);
 include_once INC_PATH . "/sendorder.class.php";
 $sendorderobj = SendOrderClass::init();
 $sid = $sendorderobj->add($addarray);
 if (GetNum($sid)) {
     //提交成功,处理扣费和修改订单状态
     include_once INC_PATH . "/member.class.php";
     $m = new memberclass();
     $note = "提交运单,运单ID:" . $sid;
     $m->moneyedit($_USERS['uname'], -$totalfee, 3, $note);
     //扣费操作
     editstate($tablepre . "order", "state", $wheresqlo, 5);
     //更改订单状态操作
     editstate($tablepre . "order", "sid", $wheresqlo, $sid);
     //更改订单对应运单ID操作
     if (GetNum($couponid)) {
         editstate($tablepre . "coupon", "state", "cid = " . GetNum($couponid), 3);
         //更改优惠卷状态操作
Exemplo n.º 2
0
<?php

//我的劵
InitGP(array("action", "type", "oid", "page"));
//初始化变量全局返回
include_once INC_PATH . "/sendorder.class.php";
$o = SendOrderClass::init();
AjaxHead();
if (empty($action)) {
    $uname = $_USERS['uname'];
    $wherestr[] = "uname='{$uname}'";
    if ($type == 1) {
        $wherestr[] = "state in(2,3)";
    } elseif ($type == 2) {
        $wherestr[] = "state =3";
        $wherestr[] = "commenttime is null";
    }
    if (!empty($wherestr)) {
        $wheresql = implode(' AND ', $wherestr);
    }
    //条件汇总
    $dataarray = $o->getdata("", $wheresql, "");
    //获取团购数据
} elseif ($action == 'cancel') {
    $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input')));
    $info = $o->del($jsondata->id);
    if ($info == "OK") {
        exit(json_encode('OK'));
    } else {
        exit(json_encode($info));
    }