聚合支付:也称“融合支付”,是指只从事“支付、结算、清算”服务之外的“支付服务”,依托银行、非银机构或清算组织,借助银行、非银机构或清算组织的支付通道与清结算能力,利用自身的技术与服务集成能力,将一个以上的银行、非银机构或清算组织的支付服务,整合到一起,为商户提供支付服务。
部分代码
1调接口--跳转到特定页面
async getH5Pay(form) {
const params = {
...form,
mchUserId: "",
gmtCreator: "0",
gmtUpdater: "0",
mchOrderNo: this.mchOrderNo,
currency: "CNY",
subject: "",
body: "",
notifyUrl: "",
redirectUrl: "",
expiredTime: dayjs().add(15, "minute"),
divisionMode: 0,
version: "1.0",
reqTime: new Date().getTime(),
mchType: 1,
sign: "",
signType: "md5",
gmtCreated: "jack",
};
let res = await this.$request.api.callCashH5(params);
const { code, data } = res.data;
if (code == "SUCCESS") {
const routerParams = {
...form,
expireTime: Date.parse(data[0].expireTime),
mchOrderNo: this.mchOrderNo,
payWayList: data[0].payWayResultDTOList,
};
const routerName = data[0].cashPageH5Url.split("/").reverse()[0];
this.$router.push({ name: routerName, params: { ...routerParams } });
} else {
this.$notify({
title: "提示",
message: "接口调用失败",
type: "warning",
duration: 5000,
});
}
},
2获取跳转路径、参数及二维码路径在该页面进行渲然二维码进行扫码
countDown(times) {
return countDown(times);
},
// 二维码失效倒计时
payTimeoutCount() {
let _this = this;
var interval = setInterval(() => {
_this.expireTime--;
setTimeout(() => {
if (_this.expireTime <= Date.now()) {
_this.codeStatus = 0;
clearInterval(interval);
}
}, 0);
}, 1000);
},
handleUnifiedPay() {
const params = {
mchOrderNo: this.mchOrderNo,
wayCode: this.payWay,
amount: this.amount,
appId: this.appId,
mchNo: this.mchNo,
mchUserId: "",
gmtCreator: 0,
gmtUpdater: 0,
currency: "CNY",
subject: "test",
body: "testbody",
notifyUrl: "",
redirectUrl: "",
expiredTime: dayjs().add(15, "minute"),
divisionMode: 0,
version: "1.0",
channelCode: "wxpay",
reqTime: new Date().getTime(),
mchType: 1,
isvNo: "",
sign: "",
signType: "md5",
gmtCreated: "",
};
this.$request.api.unifiedPay(params).then((res) => {
if (res.code == "SUCCESS") {
this.route =
window.location.href.split("h5-cashier")[0] + "pay-success";
const { reqUrl } = res.data;
if (this.payWay.toString() === "WX_H5") {
window.location.replace(
reqUrl + `&redirect_uri=${encodeURIComponent(this.route)}`
);
} else if (this.payWay.toString() === "ALI_WAP") {
window.location.replace(reqUrl);
} else {
this.$notify({
title: "提示",
message: "请使用微信或支付宝扫二维码",
type: "warning",
duration: 5000,
});
}
} else {
this.$notify({
title: "提示",
message: "调用失败",
type: "warning",
duration: 5000,
});
}
});
},