Authored by 郝肖肖

门票填写订单yoho币使用 js

... ... @@ -529,10 +529,10 @@ class CartData
* @param int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type int $yohoNum yoho币
* @param type int $yohoCoin yoho币
* @return type []
*/
public static function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
public static function addTicket($uid, $productSku, $buyNumber, $yohoCoin = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.ticket';
... ... @@ -540,8 +540,8 @@ class CartData
$param['product_sku'] = intval($productSku);
$param['buy_number'] = intval($buyNumber);
//yoho币转换成元,1yoho币等于一分钱
if (isset($yohoNum) && $yohoNum > 0) {
$param['use_yoho_coin'] = $yohoNum / 100;
if (isset($yohoCoin) && $yohoCoin > 0) {
$param['use_yoho_coin'] = $yohoCoin / 100;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(API_URL, $param);
... ... @@ -553,10 +553,10 @@ class CartData
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type string $mobile 手机号码
* @param type int $yohoNum yoho币
* @param type int $yohoCoin yoho币
* @return type []
*/
public static function submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoNum = 0)
public static function submitTicket($uid, $productSku, $buyNumber, $mobile, $yohoCoin = 0)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.submitTicket';
... ... @@ -565,8 +565,8 @@ class CartData
$param['buy_number'] = intval($buyNumber);
$param['mobile'] = $mobile;
//yoho币转换成元,1yoho币等于一分钱
if (isset($yohoNum) && $yohoNum > 0) {
$param['use_yoho_coin'] = $yohoNum / 100;
if (isset($yohoCoin) && $yohoCoin > 0) {
$param['use_yoho_coin'] = $yohoCoin / 100;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(API_URL, $param);
... ...
... ... @@ -157,7 +157,7 @@ var TicketCat = {
el.$loading.show();
$.ajax({
type: 'POST',
url: '/cart/index/orderCompute',
url: '/cart/index/setTicket',
data: selectData,
success: function(data) {
el.$loading.hide();
... ... @@ -227,7 +227,7 @@ var TicketCat = {
render: function(data) {
var e = this.el,
i,
dArr = data.promotion_formula_list,
dArr = data.shopping_cart_data.promotion_formula_list,
str = '',
isExpress = '';
... ... @@ -250,14 +250,14 @@ var TicketCat = {
}
e.$payTotal.html(str);
e.$toPay.html((data.last_order_amount).toFixed(2));
e.$toPay.html((data.shopping_cart_data.last_order_amount).toFixed(2));
//有货币清零状态更新
$('#biprice').val(accMul(100, data.use_yoho_coin));
$('#biprice').val(accMul(100, data.shopping_cart_data.use_yoho_coin));
if (data.use_yoho_coin === 0) {
$('.errbitip').text('');
} else {
$('.errbitip').text('抵扣' + data.use_yoho_coin.toFixed(2) + '元');
$('.errbitip').text('抵扣' + data.shopping_cart_data.use_yoho_coin.toFixed(2) + '元');
}
},
... ...
... ... @@ -1411,12 +1411,12 @@ class CartModel
* @param int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type int $yohoNum yoho币
* @param type int $yohoCoin yoho币
* @return type []
*/
public function addTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
public function addTicket($uid, $productSku, $buyNumber, $yohoCoin = 0)
{
return CartData::addTicket($uid, $productSku, $buyNumber, $yohoNum);
return CartData::addTicket($uid, $productSku, $buyNumber, $yohoCoin);
}
/**
... ... @@ -1424,14 +1424,14 @@ class CartModel
* @param int $uid 用户ID
* @param type int $productSku 产品sku
* @param type int $buyNumber 购买数量,范围1-4
* @param type int $yohoNum yoho币
* @param type int $yohoCoin yoho币
* @return type
*/
public function filterTicket($uid, $productSku, $buyNumber, $yohoNum = 0)
public function filterTicket($uid, $productSku, $buyNumber, $yohoCoin = 0)
{
$cartType = 'advance';
$data = self::addTicket($uid, $productSku, $buyNumber, $yohoNum);
$data = self::addTicket($uid, $productSku, $buyNumber, $yohoCoin);
return self::filterCartPay($data, $cartType, false);
}
... ...
... ... @@ -582,16 +582,13 @@ class IndexController extends WebAction
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoNum = $this->post('yohoNum', 0);
$yohoCoin = $this->post('yohoCoin', 0);
// 执行加入购物车操作
$orderEnsure = CartModel::filterTicket($uid, $productSku, $buyNumber, $yohoNum);
$orderEnsure = CartModel::filterTicket($uid, $productSku, $buyNumber, $yohoCoin);
// if (empty($orderEnsure)) {
// $this->error();
// }
// print_r($orderEnsure);
// print_r($result);
// exit;
$this->_view->display('ticket-ensure', array(
'ticketEnsurePage' => true,
'orderEnsure' => $orderEnsure,
... ... @@ -621,9 +618,9 @@ class IndexController extends WebAction
//购买数量,范围1-4
$buyNumber = $this->post('buyNumber', 0);
//yoho币数量
$yohoNum = $this->post('yohoNum', 0);
$yohoCoin = $this->post('yohoCoin', 0);
// 执行加入购物车操作
$result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoNum);
$result = CartModel::addTicket($uid, $productSku, $buyNumber, $yohoCoin);
} while (false);
... ...