Authored by dongjunjie

支付管理

  1 +module.exports=function(app) {
  2 + /*支付管理首页*/
  3 + app.get("/operations/payment/index","operations.payment.Index", function () {
  4 + this.$extend = {
  5 + moduleName: "支付管理",
  6 + pageName: "支付管理"
  7 + }
  8 + });
  9 +
  10 + app.post("/Payment/findPayManageList", "payment_findPayManageList");
  11 +
  12 + app.post("/Payment/findPayInfoById", "payment_findPayInfoById");
  13 +
  14 + app.post("/Payment/createPayMode", "payment_createPayMode");
  15 +
  16 + app.post("/Payment/updatePayInfoById", "payment_updatePayInfoById");
  17 +
  18 + app.post("/Payment/openPayModeById", "payment_openPayModeById");
  19 +
  20 + app.post("/Payment/closePayModeById", "payment_closePayModeById");
  21 +}
  1 +module.exports= {
  2 + namespace: "payment",
  3 + apis: {
  4 + findPayManageList: {
  5 + title: "支付管理列表",
  6 + url: "/PayManageController/findPayManageList",
  7 + params: []
  8 + },
  9 +
  10 + findPayInfoById: {
  11 + title: "支付方式详情",
  12 + url: "/PayManageController/findPayInfoById",
  13 + params: [
  14 + {name:id, type:Number}
  15 + ]
  16 + },
  17 +
  18 + createPayMode: {
  19 + title: "新增支付方式",
  20 + url: "/PayManageController/createPayMode",
  21 + params: [
  22 + {name:payName, type:String},
  23 + {name:recommendOrderPage, type:Number, default:0},
  24 + {name:recommendWords, type:String},
  25 + {name:sortNumber, type:Number, default:0},
  26 + {name:recommendText1, type:String},
  27 + {name:recommendText2, type:String}
  28 + ]
  29 + },
  30 +
  31 + updatePayInfoById: {
  32 + title: "编辑支付方式",
  33 + url: "/PayManageController/updatePayInfoById",
  34 + params: [
  35 + {name:id, type:Number},
  36 + {name:payName, type:String},
  37 + {name:recommendOrderPage, type:Number, default:0},
  38 + {name:recommendWords, type:String},
  39 + {name:sortNumber, type:Number, default:0},
  40 + {name:recommendText1, type:String},
  41 + {name:recommendText2, type:String}
  42 + ]
  43 + },
  44 +
  45 + openPayModeById: {
  46 + title: "开启支付方式",
  47 + url: "/PayManageController/openPayModeById",
  48 + params: [
  49 + {name:id, type:Number}
  50 + ]
  51 + },
  52 +
  53 + closePayModeById: {
  54 + title: "关闭支付方式",
  55 + url: "/PayManageController/closePayModeById",
  56 + params: [
  57 + {name:id, type:Number}
  58 + ]
  59 + }
  60 + }
  61 +}
  1 +<%include '../../../common/views/__ui/header'%>
  2 +<%include '../../../common/views/__partail/ListHeader'%>
  3 +
  4 +<div class="contentpanel">
  5 + <div style="margin-bottom: 20px">
  6 + <a href="javascript:" class="btn btn-success edit-btn"><i class="fa fa-plus"></i> 添加支付方式</a>
  7 + </div>
  8 + <div class="panel">
  9 + <div class="panel-body nopadding">
  10 + <div class="basicTable_wrapper" id="payment-list"></div>
  11 + </div>
  12 + </div>
  13 +</div>
  14 +
  15 +<script type="text/template" id="template">
  16 + <div class="form-horizontal" id="paymentEdit">
  17 + <input type="hidden" value="[[id]]" id="id" />
  18 +
  19 + <div class="form-group">
  20 + <label class="col-sm-3 control-label" style="text-align: center">支付方式:</label>
  21 + <div class="col-sm-5" style="padding-top: 10px">[[payName]]</div>
  22 + </div>
  23 +
  24 + <div class="form-group">
  25 + <label class="col-sm-3 control-label" style="text-align: center">推荐到确认订单页:</label>
  26 + <div class="col-sm-5" style="padding-top: 3px">
  27 + <label class="radio-inline"><input name="sort" type="radio" value="1"></label>&nbsp;&nbsp;
  28 + <label class="radio-inline"><input name="sort" type="radio" value="0"></label>
  29 + </div>
  30 + </div>
  31 +
  32 + <div class="form-group">
  33 + <label for="recommendWords" class="col-sm-3 control-label" style="text-align: center">推荐文案:</label>
  34 + <div class="col-sm-5">
  35 + <input type="text" id="recommendWords" value="[[recommendWords]]" class="form-control" />
  36 + </div>
  37 + </div>
  38 +
  39 + <div class="form-group">
  40 + <label for="sortNumber" class="col-sm-3 control-label" style="text-align: center">前端排序:</label>
  41 + <div class="col-sm-5">
  42 + <input type="number" id="sortNumber" value="[[sortNumber]]" class="form-control" />
  43 + </div>
  44 + <div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 数字越大越靠前,不要跟其他排序相同</label></div>
  45 + </div>
  46 +
  47 + <div class="form-group">
  48 + <label for="recommentText1" class="col-sm-3 control-label" style="text-align: center">推荐语1</label>
  49 + <div class="col-sm-5">
  50 + <input type="text" id="recommentText1" value="[[recommendText1]]" class="form-control" maxlength="20" />
  51 + </div>
  52 + <div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 建议10个字以内,不超过20个字</label></div>
  53 + </div>
  54 +
  55 + <div class="form-group">
  56 + <label for="recommentText2" class="col-sm-3 control-label" style="text-align: center">推荐语2</label>
  57 + <div class="col-sm-5">
  58 + <input type="text" id="recommentText2" value="[[recommendText2]]" class="form-control" maxlength="20" />
  59 + </div>
  60 + <div class="col-sm-4"><label style="color: #999; line-height: 40px"> * 建议10个字以内,不超过20个字</label></div>
  61 + </div>
  62 + </div>
  63 +</script>
  64 +
  65 +<%include '../../../common/views/__ui/footer'%>
  1 +var $ = require('jquery'),
  2 + common = require('../../../common/common');
  3 +
  4 +var ENUM = {
  5 + recommendOrderPage: ["否","是"]
  6 +};
  7 +
  8 +var g = new common.grid({
  9 + el: '#payment-list',
  10 + columns: [
  11 + {display: "ID", name: "id"},
  12 + {display: '支付方式名称', name: "payName"},
  13 + {display: '推荐到确认订单页', render: function (item) {
  14 + var rop = ENUM.recommendOrderPage[item.recommendOrderPage];
  15 + return item.recommendOrderPage == 1 ? rop+"("+item.recommendWords+")" : rop;
  16 + }},
  17 + {display: "前端排序", name: "sortNumber"},
  18 + {display: "推荐语1", name: "recommendText1"},
  19 + {display: "推荐语2", name: "recommendText2"},
  20 + {display: '操作', render: function (item) {
  21 + var HtmArr = [];
  22 + HtmArr.push('<a href="javascript:" class="btn btn-info btn-xs edit-btn">编辑</a>');
  23 + if(item.status == 1){
  24 + HtmArr.push('<a href="javascript:" class="btn btn-danger btn-xs close-btn">关闭</a>');
  25 + }else{
  26 + HtmArr.push('<a href="javascript:" class="btn btn-success btn-xs open-btn">开启</a>');
  27 + }
  28 + return HtmArr.join('');
  29 + }}
  30 + ]
  31 +});
  32 +
  33 +g.init("/Payment/findPayManageList");
  34 +
  35 +//编辑
  36 +$(document).on("click", ".edit-btn", function () {
  37 + new common.dialog({
  38 + title: "支付方式编辑",
  39 + width: "50%",
  40 + content: common.util.__template2($("#template").html(), {}),
  41 + button: [
  42 + {value: "确认", css:"btn-primary", callback: function () {
  43 +
  44 + }},
  45 + {value: "取消", css:"btn-default"}
  46 + ]
  47 + });
  48 +
  49 + common.util.__ajax({
  50 + url: '/Payment/findPayInfoById',
  51 + data: {id: obj.id}
  52 + }, function () {
  53 +
  54 + }, true)
  55 +});
  56 +
  57 +//开启
  58 +$(document).on("click", ".open-btn", function () {
  59 + common.util.__ajax({
  60 + url: '/Payment/openPayModeById',
  61 + data: {id: obj.id}
  62 + }, function () {
  63 + g.reload();
  64 + })
  65 +});
  66 +
  67 +//关闭
  68 +$(document).on("click", ".close-btn", function () {
  69 + common.util.__ajax({
  70 + url: '/Payment/closePayModeById',
  71 + data: {id: obj.id}
  72 + }, function () {
  73 + g.reload();
  74 + })
  75 +});