Esempio n. 1
0
 public function balance()
 {
     //是否已经登录
     User::isLogin();
     $uid = LuS::get('uid');
     //取出默认地址,没有默认地址默认为第一条
     $default_address = UserAddress::getDefaultAddress($uid);
     if ($default_address) {
         $default_address_id = $default_address['address_id'];
         //地址详情
         $address_detail = RegionM::getAddressDetail($default_address['province'], $default_address['city'], $default_address['district']);
         $default_address['address_detail'] = $address_detail . $default_address['address'];
         //电话
         $call = UserAddress::getDefaultCall($default_address);
         $default_address['call'] = $call;
     } else {
         $default_address = null;
         $default_address_id = 0;
     }
     //取出购物车信息
     $cart_goods_list = Cart::select($uid);
     if (!$cart_goods_list) {
         //购物车空空如也
         $url = HOMEURL;
         header('Location:' . $url);
         throw new Exception('exit');
     }
     $data = Cart::getOrderTotal($cart_goods_list);
     $total = $data['total'];
     $shipping_fee = Cart::getOrderShippingFee($total);
     $money_paid = $total + $shipping_fee;
     //下单链接
     $add_order_url = url('goods', 'goods::addtoorder');
     //详情链接,不带订单号,在页面上拼接上
     $order_detail_url = url('usercenter', 'usercenter::detail');
     //添加地址链接
     $add_addr_url = url('usercenter', 'usercenter::addaddr');
     //地址链接
     $addr_url = url('usercenter', 'usercenter::addr');
     //填写完地址后回跳
     $addr_jump_url = url('goods', 'goods::balance');
     LuS::set('addr_jump_url', $addr_jump_url);
     $smarty = get_smarty();
     $smarty->assign('total', $total);
     $smarty->assign('amount', $money_paid);
     $smarty->assign('shipping_fee', $shipping_fee);
     $smarty->assign('default_address_id', $default_address_id);
     $smarty->assign('default_address', $default_address);
     $smarty->assign('goods_list', $cart_goods_list);
     $smarty->assign('add_order_url', $add_order_url);
     $smarty->assign('order_detail_url', $order_detail_url);
     $smarty->assign('add_addr_url', $add_addr_url);
     $smarty->assign('addr_url', $addr_url);
     $smarty->display('goods/order.html');
 }
Esempio n. 2
0
 public function addr()
 {
     $addr_jump_url = LuS::get('addr_jump_url');
     $is_jump = isset($addr_jump_url) && !empty($addr_jump_url) ? true : false;
     $uid = LuS::get('uid');
     //获取用户的所有地址
     $address_list = UserAddress::getAddrList($uid);
     foreach ($address_list as $key => $value) {
         $address_id = $value['address_id'];
         $address_list[$key]['del_addr_url'] = url('usercenter', 'usercenter::deladdr', $address_id);
         $address_list[$key]['edit_addr_url'] = url('usercenter', 'usercenter::editaddr', $address_id);
         //详细地址
         $address_detail = RegionM::getAddressDetail($value['province'], $value['city'], $value['district']);
         $address_list[$key]['address2'] = $address_detail . $value['address'];
         //电话
         $call = UserAddress::getDefaultCall($value);
         $address_list[$key]['call'] = $call;
         if ($is_jump) {
             $address_list[$key]['jump_url'] = url('usercenter', 'usercenter::jump', $address_id);
         }
     }
     $smarty = get_smarty();
     $smarty->assign("is_jump", $is_jump);
     $smarty->assign("address_list", $address_list);
     //添加地址
     $addr_add_url = url('usercenter', 'usercenter::addaddr');
     $smarty->assign('addr_add_url', $addr_add_url);
     $smarty->display('usercenter/usercenter_addr.html');
 }
Esempio n. 3
0
 protected function _newOrderList($list)
 {
     if (!$list) {
         return false;
     }
     if (is_array($list)) {
         foreach ($list as $key => $value) {
             $list[$key]['order_money2'] = $value['order_money'] + $value['shipping_fee'] - $value['bonus'];
             //应付款金额
             //收货地址
             $address_detail = '';
             $address_detail = RegionM::getAddressDetail($value['province'], $value['city'], $value['district']);
             $list[$key]['address2'] = $address_detail . $value['address'];
             $list[$key]['order_detail_url'] = url('admin', 'adminorder::detail', $value['order_id']);
             //订单详情
             $list[$key]['change_order_url'] = url('admin', 'adminorder::changeorder', $value['order_id']);
             //恢复无效订单
             $list[$key]['change_unorder_url'] = url('admin', 'adminorder::changeunorder', $value['order_id']);
             //取消订单
             $list[$key]['change_confirm_url'] = url('admin', 'adminorder::changeconfirm', $value['order_id']);
             //确认订单
             $list[$key]['change_unconfirm_url'] = url('admin', 'adminorder::changeunconfirm', $value['order_id']);
             //确认=>未确认
             $list[$key]['change_ready_url'] = url('admin', 'adminorder::changeready', $value['order_id']);
             //确认=>配货中
             $list[$key]['change_unready_url'] = url('admin', 'adminorder::changeunready', $value['order_id']);
             //配货中=>确认
             $list[$key]['change_shipping_url'] = url('admin', 'adminorder::changeshipping', $value['order_id']);
             //配货中=>已发货
             $list[$key]['change_unshipping_url'] = url('admin', 'adminorder::changeunshipping', $value['order_id']);
             //已发货=>配货中
             $list[$key]['change_receive_url'] = url('admin', 'adminorder::changereceive', $value['order_id']);
             //确认收货
             $list[$key]['change_unreceive_url'] = url('admin', 'adminorder::changeunreceive', $value['order_id']);
             //确认收货=>已发货
         }
     }
     return $list;
 }