@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
96 lines • 7.2 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var router_1 = require("@angular/router");
var data_source_helper_1 = require("./../../service/data-source.helper");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var core_1 = require("@angular/core");
var ng_zorro_antd_1 = require("ng-zorro-antd");
var SmsRechargePayQrcodeComponent = /** @class */ (function () {
function SmsRechargePayQrcodeComponent(dataSourceHelper, activatedRoute, userStorageService, _message, router, activateRoute) {
this.dataSourceHelper = dataSourceHelper;
this.activatedRoute = activatedRoute;
this.userStorageService = userStorageService;
this._message = _message;
this.router = router;
this.activateRoute = activateRoute;
this.qrcodeValue = 'loading...';
this._isSpinning = false;
this.data = {};
this.t = null;
this.modalShow = false;
this.dataSource = this.dataSourceHelper.smsPackagesBuy;
this.smsToWxNativePayDataSource = this.dataSourceHelper.smsToWxNativePay;
this.smsPayOrderDataSource = this.dataSourceHelper.smsPayOrder;
}
SmsRechargePayQrcodeComponent.prototype.ngOnInit = function () {
this.packageId = this.activatedRoute.snapshot.queryParams['packageId'];
this.communityGroupId = this.userStorageService.getCurrentOffice().id;
this.loadAll();
};
SmsRechargePayQrcodeComponent.prototype.loadAll = function () {
var _this = this;
this._isSpinning = true;
this.dataSource.createOne(this.packageId, null, {
communityGroupId: this.communityGroupId
}).subscribe(function (res) {
_this.orderId = res.body.orderId;
_this.smsToWxNativePayDataSource.create(null, {
orderId: res.body.orderId
}).subscribe(function (resp) {
_this.data = resp.body;
_this.qrcodeValue = JSON.parse(resp.body.openPayStartResult)['code_url'];
_this._isSpinning = false;
_this.getPayStatus();
}, function (error) {
_this.qrcodeValue = error.error;
_this._message.error(error.error);
_this._isSpinning = false;
});
});
};
SmsRechargePayQrcodeComponent.prototype.getPayStatus = function () {
var _this = this;
this.t = setInterval(function () {
_this.smsPayOrderDataSource.findOne(_this.orderId).subscribe(function (res) {
if (res.body.orderState === 'BUSINESS_SUCCESS') {
clearInterval(_this.t);
_this.t = null;
_this.orderStateText = '支付成功';
_this.modalShow = true;
setTimeout(function () {
_this.router.navigate(['../../../sms-recharge'], { relativeTo: _this.activateRoute });
}, 3000);
}
}, function (error) {
clearInterval(_this.t);
_this.t = null;
_this.orderStateText = '支付失败';
});
}, 2000);
};
SmsRechargePayQrcodeComponent.prototype.ngOnDestroy = function () {
clearInterval(this.t);
this.t = null;
};
SmsRechargePayQrcodeComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-sms-recharge-pay-qrcode',
template: "<zx-header-block [title]=\"'\u77ED\u4FE1\u5145\u503C'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\" [breadcrumbAppendings]=\"['\u652F\u4ED8']\"><p>\u77ED\u4FE1\u670D\u52A1\u5145\u503C\u4E1A\u52A1</p></zx-header-block><div class=\"main\"><div><div><div><span>\u5546\u54C1\u8BE6\u60C5\uFF1A</span> <span>{{data.orderTitle}}</span></div><div><span>\u8BA2\u5355\u53F7\uFF1A</span> <span>{{data.orderId}}</span></div><div><span>\u6536\u6B3E\u65B9\uFF1A</span> <span>\u798F\u5EFA\u6211\u5BB6\u7F51\u7EDC\u79D1\u6280\u6709\u9650\u516C\u53F8</span></div></div><div><span>\u5F85\u652F\u4ED8\uFF1A</span> <span>{{data.totleAmount | number: '1.1'}}</span> <span>\u5143</span></div></div><div><span><nz-spin [nzSpinning]=\"_isSpinning\"><div><zx-qrcode [value]=\"qrcodeValue\" [size]=\"220\" style=\"padding:6px;\" *ngIf=\"qrcodeValue\"></zx-qrcode><div class=\"pay-modal\" *ngIf=\"modalShow\"><p>{{orderStateText}}</p><p *ngIf=\"orderStateText === '\u652F\u4ED8\u6210\u529F'\">\u4E09\u79D2\u540E\u8DF3\u8F6C</p></div></div><p>\u4F7F\u7528\u3010\u5FAE\u4FE1\u626B\u4E00\u626B\u3011\u5373\u53EF\u4ED8\u6B3E</p></nz-spin></span></div><p>\u6E29\u99A8\u63D0\u793A\uFF1A\u5982\u679C\u652F\u4ED8\u6210\u529F\uFF0C\u6B64\u9875\u9762\u6CA1\u6709\u8DF3\u8F6C\uFF0C\u8BF7\u5230\u8BA2\u5355\u4E2D\u67E5\u770B\u5904\u7406\u60C5\u51B5</p></div>",
styles: [
"\n :host .main{\n width: 60%;\n overflow: hidden;\n background: #fff;\n margin: 0 auto;\n margin-top: 60px;\n border-top: 8px solid #01b700;\n }\n :host .main > div:nth-child(1){\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 30px 40px;\n }\n :host .main > div:nth-child(2), :host .main > p {\n text-align:center;\n margin-top: 25px;\n }\n :host .main > p{\n margin-bottom:80px;\n }\n :host .main > div:nth-child(2) span{\n display: inline-block;\n border: 1px solid #ddd;\n padding: 5px;\n }\n :host .main > div > div:nth-child(1) > div{\n margin:5px 0;\n }\n :host .main > div > div:nth-child(2) > span:nth-child(2){\n font-size: 26px;\n color: #ff4400;\n font-weight: bold;\n }\n :host ::ng-deep .main .ant-spin-nested-loading > div > .ant-spin{\n width:0;\n }\n :host .pay-modal{\n position: absolute;\n width: 232px;\n height: 232px;\n top: 0;\n background: rgba(0,0,0,0.6);\n text-align: center;\n font-size: 22px;\n color: #fff;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n }\n "
]
},] },
];
/** @nocollapse */
SmsRechargePayQrcodeComponent.ctorParameters = function () { return [
{ type: data_source_helper_1.DataSourceHelper, },
{ type: router_1.ActivatedRoute, },
{ type: ngx_webapp_fx_1.UserStorageService, },
{ type: ng_zorro_antd_1.NzMessageService, },
{ type: router_1.Router, },
{ type: router_1.ActivatedRoute, },
]; };
return SmsRechargePayQrcodeComponent;
}());
exports.SmsRechargePayQrcodeComponent = SmsRechargePayQrcodeComponent;
//# sourceMappingURL=sms-recharge-pay-qrcode.component.js.map