...
|
...
|
@@ -18,6 +18,23 @@ const ORDER_TYPE = { // 结算订单类型 |
|
|
const app = getApp();
|
|
|
let yas;
|
|
|
|
|
|
function _queryFromServiceAsync(fn) {
|
|
|
if (fn) {
|
|
|
let args = [...arguments];
|
|
|
|
|
|
args.shift();
|
|
|
|
|
|
args[0] = args[0] || {};
|
|
|
Object.assign(args[0], {
|
|
|
appType: app.getAppType()
|
|
|
});
|
|
|
|
|
|
return fn(...args);
|
|
|
} else {
|
|
|
return Promise.reject();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function formatPaymentData(data, yasInfo) {
|
|
|
data = data || {};
|
|
|
|
...
|
...
|
@@ -227,7 +244,7 @@ Page({ |
|
|
loadShoppingPayment(options) {
|
|
|
this.orderType = ORDER_TYPE.ORDINARY;
|
|
|
|
|
|
return ensureModel.shoppingPayment({
|
|
|
return _queryFromServiceAsync(ensureModel.shoppingPayment, {
|
|
|
cart_type: options.cartType || 'ordinary',
|
|
|
yoho_coin_mode: 0
|
|
|
}).then(res => {
|
...
|
...
|
@@ -247,7 +264,7 @@ Page({ |
|
|
Object.assign(this.orderData, data);
|
|
|
}
|
|
|
|
|
|
return ensureModel.shoppingCompute({
|
|
|
return _queryFromServiceAsync(ensureModel.shoppingCompute, {
|
|
|
cart_type: 'ordinary',
|
|
|
payment_type: 1, // 支付方式,1 在线支付 2 货到付款
|
|
|
delivery_way: this.orderData.deliveryWayId, // 快递方式,1 普通 2 加急
|
...
|
...
|
@@ -271,7 +288,7 @@ Page({ |
|
|
if (options.productSku) {
|
|
|
this.orderType = ORDER_TYPE.BUYNOW;
|
|
|
|
|
|
ensureModel.buynowPayment({
|
|
|
_queryFromServiceAsync(ensureModel.buynowPayment, {
|
|
|
sku_type: SKU_TYPE,
|
|
|
product_sku: options.productSku,
|
|
|
buy_number: options.buyNumber || 1,
|
...
|
...
|
@@ -311,7 +328,7 @@ Page({ |
|
|
Object.assign(this.orderData, data);
|
|
|
}
|
|
|
|
|
|
ensureModel.buynowCompute({
|
|
|
_queryFromServiceAsync(ensureModel.buynowCompute, {
|
|
|
cart_type: 'ordinary',
|
|
|
sku_type: SKU_TYPE,
|
|
|
product_sku: this.orderData.productSku,
|
...
|
...
|
@@ -506,7 +523,7 @@ Page({ |
|
|
|
|
|
this.orderSubmiting = true;
|
|
|
|
|
|
ensureModel.buynowSubmit(param).then(res => {
|
|
|
_queryFromServiceAsync(ensureModel.buynowSubmit, param).then(res => {
|
|
|
this.orderSubmiting = false;
|
|
|
|
|
|
if (res.code === 200) {
|
...
|
...
|
@@ -592,7 +609,7 @@ Page({ |
|
|
|
|
|
this.orderSubmiting = true;
|
|
|
|
|
|
return ensureModel.shoppingSubmit(param).then(res => {
|
|
|
return _queryFromServiceAsync(ensureModel.shoppingSubmit, param).then(res => {
|
|
|
this.orderSubmiting = false;
|
|
|
|
|
|
if (res.code !== 200) {
|
...
|
...
|
|