Authored by dongjunjie

支付管理

module.exports=function(app) {
/*支付管理首页*/
app.get("/operations/payment/index","operations.payment.Index", function () {
this.$extend = {
moduleName: "支付管理",
pageName: "支付管理"
}
});
app.post("/Payment/findPayManageList", "payment_findPayManageList");
app.post("/Payment/findPayInfoById", "payment_findPayInfoById");
app.post("/Payment/createPayMode", "payment_createPayMode");
app.post("/Payment/updatePayInfoById", "payment_updatePayInfoById");
app.post("/Payment/openPayModeById", "payment_openPayModeById");
app.post("/Payment/closePayModeById", "payment_closePayModeById");
}
... ...
module.exports= {
namespace: "payment",
apis: {
findPayManageList: {
title: "支付管理列表",
url: "/PayManageController/findPayManageList",
params: []
},
findPayInfoById: {
title: "支付方式详情",
url: "/PayManageController/findPayInfoById",
params: [
{name:id, type:Number}
]
},
createPayMode: {
title: "新增支付方式",
url: "/PayManageController/createPayMode",
params: [
{name:payName, type:String},
{name:recommendOrderPage, type:Number, default:0},
{name:recommendWords, type:String},
{name:sortNumber, type:Number, default:0},
{name:recommendText1, type:String},
{name:recommendText2, type:String}
]
},
updatePayInfoById: {
title: "编辑支付方式",
url: "/PayManageController/updatePayInfoById",
params: [
{name:id, type:Number},
{name:payName, type:String},
{name:recommendOrderPage, type:Number, default:0},
{name:recommendWords, type:String},
{name:sortNumber, type:Number, default:0},
{name:recommendText1, type:String},
{name:recommendText2, type:String}
]
},
openPayModeById: {
title: "开启支付方式",
url: "/PayManageController/openPayModeById",
params: [
{name:id, type:Number}
]
},
closePayModeById: {
title: "关闭支付方式",
url: "/PayManageController/closePayModeById",
params: [
{name:id, type:Number}
]
}
}
}
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div style="margin-bottom: 20px">
<a href="javascript:" class="btn btn-success edit-btn"><i class="fa fa-plus"></i> 添加支付方式</a>
</div>
<div class="panel">
<div class="panel-body nopadding">
<div class="basicTable_wrapper" id="payment-list"></div>
</div>
</div>
</div>
<script type="text/template" id="template">
<div class="form-horizontal" id="paymentEdit">
<input type="hidden" value="[[id]]" id="id" />
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: center">支付方式:</label>
<div class="col-sm-5" style="padding-top: 10px">[[payName]]</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: center">推荐到确认订单页:</label>
<div class="col-sm-5" style="padding-top: 3px">
<label class="radio-inline"><input name="sort" type="radio" value="1"></label>&nbsp;&nbsp;
<label class="radio-inline"><input name="sort" type="radio" value="0"></label>
</div>
</div>
<div class="form-group">
<label for="recommendWords" class="col-sm-3 control-label" style="text-align: center">推荐文案:</label>
<div class="col-sm-5">
<input type="text" id="recommendWords" value="[[recommendWords]]" class="form-control" />
</div>
</div>
<div class="form-group">
<label for="sortNumber" class="col-sm-3 control-label" style="text-align: center">前端排序:</label>
<div class="col-sm-5">
<input type="number" id="sortNumber" value="[[sortNumber]]" class="form-control" />
</div>
<div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 数字越大越靠前,不要跟其他排序相同</label></div>
</div>
<div class="form-group">
<label for="recommentText1" class="col-sm-3 control-label" style="text-align: center">推荐语1</label>
<div class="col-sm-5">
<input type="text" id="recommentText1" value="[[recommendText1]]" class="form-control" maxlength="20" />
</div>
<div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 建议10个字以内,不超过20个字</label></div>
</div>
<div class="form-group">
<label for="recommentText2" class="col-sm-3 control-label" style="text-align: center">推荐语2</label>
<div class="col-sm-5">
<input type="text" id="recommentText2" value="[[recommendText2]]" class="form-control" maxlength="20" />
</div>
<div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 建议10个字以内,不超过20个字</label></div>
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../../../common/common');
var ENUM = {
recommendOrderPage: ["否","是"]
};
var g = new common.grid({
el: '#payment-list',
columns: [
{display: "ID", name: "id"},
{display: '支付方式名称', name: "payName"},
{display: '推荐到确认订单页', render: function (item) {
var rop = ENUM.recommendOrderPage[item.recommendOrderPage];
return item.recommendOrderPage == 1 ? rop+"("+item.recommendWords+")" : rop;
}},
{display: "前端排序", name: "sortNumber"},
{display: "推荐语1", name: "recommendText1"},
{display: "推荐语2", name: "recommendText2"},
{display: '操作', render: function (item) {
var HtmArr = [];
HtmArr.push('<a href="javascript:" class="btn btn-info btn-xs edit-btn">编辑</a>');
if(item.status == 1){
HtmArr.push('<a href="javascript:" class="btn btn-danger btn-xs close-btn">关闭</a>');
}else{
HtmArr.push('<a href="javascript:" class="btn btn-success btn-xs open-btn">开启</a>');
}
return HtmArr.join('');
}}
]
});
g.init("/Payment/findPayManageList");
//编辑
$(document).on("click", ".edit-btn", function () {
new common.dialog({
title: "支付方式编辑",
width: "50%",
content: common.util.__template2($("#template").html(), {}),
button: [
{value: "确认", css:"btn-primary", callback: function () {
}},
{value: "取消", css:"btn-default"}
]
});
common.util.__ajax({
url: '/Payment/findPayInfoById',
data: {id: obj.id}
}, function () {
}, true)
});
//开启
$(document).on("click", ".open-btn", function () {
common.util.__ajax({
url: '/Payment/openPayModeById',
data: {id: obj.id}
}, function () {
g.reload();
})
});
//关闭
$(document).on("click", ".close-btn", function () {
common.util.__ajax({
url: '/Payment/closePayModeById',
data: {id: obj.id}
}, function () {
g.reload();
})
});
\ No newline at end of file
... ...