Authored by yyq

formid

import ensureModel from '../../../models/cart/ensure';
import addressModel from '../../../models/home/address';
import payModel from '../../../models/pay/pay';
import wechatAddressUtil from '../../../utils/wechat-address';
import { wechatPay } from '../../../utils/wechat-pay';
import Yas from '../../../common/yas';
... ... @@ -284,7 +285,9 @@ Page({
this.setData({invoiceInfo: invoice});
},
submitOrder() {
submitOrder(e) {
this.formId = e.detail.formId;
if (this.orderType === ORDER_TYPE.BUYNOW) {
this.buynowOrderSubmit();
} else {
... ... @@ -353,6 +356,14 @@ Page({
ORDER_TYPE: 102 // 101购物车下单,102立即购买下单
});
//上报formID
payModel.paySuccessConfirm({
order_code: data.order_code,
openId: app.getOpenID(),
miniapp_type: app.getMiniappType(),
formId: this.formId
});
data.needJump = true;
wechatPay(data);
} else {
... ...
... ... @@ -61,6 +61,8 @@
</view>
</view>
<view class="submit-wrap">
<button bindtap="submitOrder" class="submit-btn">使用微信安全支付</button>
<form bindsubmit="submitOrder" report-submit='true'>
<button formType="submit" class="submit-btn">使用微信安全支付</button>
</form>
</view>
</view>
... ...
import Yas from '../../../common/yas';
import Yas from '../../common/yas';
const yas = new Yas();
const router = global.router;
... ...
... ... @@ -47,6 +47,13 @@ function wechatPay(order, callback) {
let orderCode = order.order_code,
orderAmount = order.order_amount;
if (parseInt(orderAmount) <= 0) {
router.go('paySuccess', {
orderCode: orderCode,
price: orderAmount
});
}
if (!orderCode || !orderAmount) {
reportPayStatus();
... ... @@ -114,8 +121,8 @@ function wechatPay(order, callback) {
});
router.go('paySuccess', {
orderCode: order_code,
price: order_amount
orderCode: orderCode,
price: orderAmount
});
},
fail: function(res) {
... ...