kira 6 years ago
parent 7ae106869f
commit 00e9c8b7da

@ -8,10 +8,15 @@
left join
pmt_transactions t
on r.order_id = t.order_id
<where>
<if test="channel!=null">
and r.channel = #{channel}
</if>
<where>
<if test="date!=null">
DATE(t.transaction_time) = #{date}
</if>
</where>
</select>
</mapper>

@ -931,6 +931,12 @@ margin-bottom: 10%;"/>
Bill QR Code
</a>
</li>
<li>
<a ui-sref="custom">
Declare Custom
</a>
</li>
</ul>
</li>

@ -0,0 +1,107 @@
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch'], function (angular) {
'use strict';
var app = angular.module('customManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('custom', {
url: '/custom',
templateUrl: '/static/payment/custom/templates/custom.html',
controller: 'customCtrl'
})
}]);
app.controller('customCtrl', ['$scope', '$http', 'commonDialog','$filter','orderService', function ($scope, $http, commonDialog,$filter,orderService) {
$scope.pagination = {};
$scope.params = {};
$scope.new_bill = {};
$scope.minDate = new Date();
var maxDate = new Date();
$scope.maxDate = maxDate.setDate(maxDate.getDate() + 14);
$scope.loadBills = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/partner/qrcode', {params: params}).then(function (resp) {
$scope.bills = resp.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadBills(1);
$scope.generateBill = function () {
var params = angular.copy($scope.new_bill);
if(!params.client_order_id){
alert("client order id为空是否后台自动生成");
}
if(!params.order_amount){
alert("order amount不可为空");
return;
}
if(params.cancle_time){
params.cancle_time = $filter('date')(params.cancle_time, 'yyyy-MM-dd HH:mm:ss')
}else {
alert("Expire Date 不可为空!");
}
$http.post('/partner/qrcode/bills',params).then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
$scope.code_url = resp.data;
$scope.loadBills(1);
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
$scope.disableBill = function (bill) {
commonDialog.confirm(
{
title: 'Delete Bill',
content: 'Are you sure to delete this bill?'
}).then(function () {
$http.delete('/partner/qrcode/'+bill.bill_code_id).then(function(){
$scope.loadBills(1);
});
})
};
$scope.clearBill = function () {
$scope.new_bill = {};
$scope.code_url = "";
};
$scope.showTradeDetail = function (order) {
orderService.clientOrderDetail(order)
};
}]);
app.filter('billStatus', function () {
return function (status) {
switch (status + '') {
case '1':
return 'wait for payment';
case '2':
return 'disabled';
case '3':
return 'payment success'
}
}
});
app.filter('remarkCut', function () {
return function (value, wordwise, max, tail) {
if (!value) return '';
max = parseInt(max, 10);
if (!max) return value;
if (value.length <= max) return value;
value = value.substr(0, max);
if (wordwise) {
var lastspace = value.lastIndexOf(' ');
if (lastspace != -1) {
value = value.substr(0, lastspace);
}
}
return value + (tail || ' …');
};
});
return app;
});

@ -0,0 +1,180 @@
<style>
.delete {
text-decoration-line: line-through;
}
</style>
<div ui-view>
<section class="content-header">
<h1>Custom</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Custom
</li>
<li class="active">Custom Management</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="form-horizontal col-sm-8">
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Order Amount</label>
<div class="col-xs-8 col-sm-6">
<div class="input-group">
<input type="number" step="0.01" name="order_amount" class="form-control form-control-float"
ng-model="new_bill.order_amount" required
onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">$</span>
</div>
<p class="small text-info"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Expire Date</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.cancle_time"
uib-datepicker-popup size="10" is-open="ctrl.dateInput"
ng-click="ctrl.dateInput=true"
datepicker-options="{minDate:minDate,maxDate:maxDate}" name="cancle_time" required>
<p class="small text-info">The date of expiry should not exceed fifteen days</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Reference NO</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.client_order_id">
<p class="small text-info"> System will automatically generate when the Reference NO is empty</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Remark</label>
<div class="col-xs-8 col-sm-6">
<textarea maxlength="100" class="form-control" ng-model="new_bill.remark"></textarea>
<p class="small text-info">within 100 characters</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3"></label>
<div class="col-sm-6">
<button class="btn btn-success" ng-click="generateBill()">generate
</button>&nbsp;&nbsp;&nbsp;
<button class="btn btn-primary" ng-click="clearBill()">clear</button>
</div>
</div>
</div>
<div class="col-sm-4" style="text-align: center" ng-if="code_url">
<a class="thumbnail" download ng-href="{{code_url}}" uib-tooltip="Download">
<img ng-src="{{code_url}}">
</a>
<p>
<a ng-href="{{code_url}}" download><i class="fa fa-download"></i> Download Bill QR
Code Image</a>
</p>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label">Bill Status</label>
&nbsp;
<a role="button" ng-class="{'bg-primary':params.status==null}"
ng-click="params.status=null;loadBills(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status==3}"
ng-click="params.status=3;loadBills(1)">Success</a> |
<a role="button" ng-class="{'bg-primary':params.status==2}"
ng-click="params.status=2;loadBills(1)">Disabled</a>
</div>
&nbsp; &nbsp; &nbsp; &nbsp;
<div class="form-group">
<label class="control-label" >Reference NO</label>
<input type="text" class="form-control"
ng-model="params.client_order_id"
ng-enter="loadBills(1)">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadBills(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">
Bill List
</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order Amount</th>
<th>Reference NO</th>
<th>Payer</th>
<th>Order Status</th>
<th>Bill Status</th>
<th>Expire Date</th>
<th>Remark</th>
<th>Create time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bill in bills"
ng-class="{'delete':bill.status==2}">
<td ng-bind="bill.order_amount | currency:'AUD '"></td>
<th ng-bind="bill.client_order_id"></th>
<td ng-bind="bill.nickname"></td>
<th ng-bind="bill.order_status|tradeStatus"></th>
<th ng-bind="bill.status|billStatus"></th>
<td ng-bind="bill.cancle_time |limitTo:10"></td>
<td ng-bind="bill.remark|remarkCut:true:10:'...'"></td>
<td ng-bind="bill.create_time"></td>
<td>
<a ng-if="bill.order_id&&bill.status!=2" class="text-primary" role="button" title="Detail"
ng-click="showTradeDetail(bill)">
<i class="fa fa-search"></i>
</a>
<a ng-if="bill.code_url&&bill.status==1" ng-href="{{bill.code_url}}" download><i
class="fa fa-download"
uib-tooltip="Download Bill QR Code Image"></i></a>
<a ng-if="!bill.order_id&&bill.status==1"
class="text-bold text-danger" role="button" ng-click="disableBill(bill)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="bills.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadBills(1)"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Loading…
Cancel
Save