|
|
/*
|
|
|
* @Author: Targaryen
|
|
|
* @Date: 2017-06-21 10:15:45
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2017-06-21 11:38:49
|
|
|
*/
|
|
|
const api = global.yoho.API;
|
|
|
|
|
|
class EasyPayModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 结算页面数据渲染
|
|
|
* @param {*} params
|
|
|
*/
|
|
|
easyPayment(params) {
|
|
|
let finalParams = {
|
|
|
method: 'app.Shopping.easyPayment',
|
|
|
uid: params.uid,
|
|
|
enable_red_envelopes: 0, // h5不返回红包
|
|
|
cart_type: params.cart_type || 'ordinary',
|
|
|
yoho_coin_mode: params.yoho_coin_mode || 0, // 是否使用有货币
|
|
|
product_sku_list: JSON.stringify(params.product_sku_list),
|
|
|
is_support_apple_pay: 'N'
|
|
|
};
|
|
|
|
|
|
if (params.activity_id) {
|
|
|
finalParams.activity_id = params.activity_id;
|
|
|
}
|
|
|
|
|
|
return api.get('', finalParams, { cache: false });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 数据改变,重新计算结算数据
|
|
|
* @param {*} params
|
|
|
*/
|
|
|
easyCompute(params) {
|
|
|
let finalParams = {
|
|
|
method: 'app.Shopping.easyCompute',
|
|
|
uid: params.uid,
|
|
|
cart_type: params.cart_type,
|
|
|
delivery_way: params.delivery_way,
|
|
|
payment_type: params.payment_type,
|
|
|
product_sku_list: params.product_sku_list
|
|
|
};
|
|
|
|
|
|
if (params.coupon_code) {
|
|
|
finalParams.coupon_code = params.coupon_code;
|
|
|
}
|
|
|
|
|
|
if (params.use_yoho_coin) {
|
|
|
finalParams.use_yoho_coin = params.use_yoho_coin;
|
|
|
}
|
|
|
|
|
|
return api.get('', finalParams, {cache: false});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 提交订单
|
|
|
* @param {*} params
|
|
|
*/
|
|
|
easySubmit(params) {
|
|
|
let finalParams = {
|
|
|
method: 'app.Shopping.easySubmit',
|
|
|
uid: params.uid,
|
|
|
cart_type: params.cart_type,
|
|
|
address_id: params.address_id,
|
|
|
delivery_time: params.delivery_time,
|
|
|
delivery_way: params.delivery_way,
|
|
|
use_yoho_coin: params.use_yoho_coin || 0,
|
|
|
use_red_envelopes: params.use_red_envelopes || 0,
|
|
|
payment_id: params.payment_id,
|
|
|
payment_type: params.payment_type || 1,
|
|
|
product_sku_list: JSON.stringify(params.product_sku_list),
|
|
|
is_print_price: params.is_print_price || 'N',
|
|
|
qhy_union: params.qhy_union
|
|
|
};
|
|
|
|
|
|
if (params.invoices_title) {
|
|
|
finalParams.invoices_title = params.invoices_title;
|
|
|
}
|
|
|
|
|
|
if (params.invoices_type_id) {
|
|
|
finalParams.invoices_type_id = params.invoices_type_id;
|
|
|
}
|
|
|
|
|
|
if (params.remark) {
|
|
|
finalParams.remark = params.remark;
|
|
|
}
|
|
|
|
|
|
if (params.activity_id) {
|
|
|
finalParams.activity_id = params.activity_id;
|
|
|
}
|
|
|
|
|
|
return api.get('', finalParams, {cache: false});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module.exports = EasyPayModel; |
...
|
...
|
|