支付web端配置,HTML设计

master
Miku 1 year ago
parent 6643157050
commit 1bcd266b5f

@ -0,0 +1,52 @@
package com.smart.module.pay.web;
import com.smart.common.model.Result;
import com.smart.module.pay.entity.AppPayConfig;
import com.smart.module.pay.repository.PayConfigRepository;
import com.smart.module.pay.service.PayConfigService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController // 处理HTTP请求并将结果封装为JSON格式返回
@RequestMapping("/pay/config")
public class PayConfigController {
@Autowired
private PayConfigService payConfigService; // 注入支付配置业务逻辑层接口的实例
@Autowired
private PayConfigRepository payConfigRepository; // 注入支付配置数据访问层接口的实例
/**
* ID
*/
@PostMapping("getByCarParkId")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) // 需要具备"admin"或"orgAdmin"角色之一
public Result getByCarParkId(Long carParkId){
AppPayConfig entity = payConfigRepository.findByCarParkId(carParkId); // 根据停车场ID从数据库中获取相应的支付配置
return Result.ok(entity); // 将支付配置封装到Result对象中并返回
}
/**
*
*/
@PostMapping("save")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) // 需要具备"admin"或"orgAdmin"角色之一
public Result save(@RequestBody AppPayConfig entity){
return payConfigService.save(entity); // 调用业务逻辑层的方法保存支付配置,并返回保存结果
}
/**
*
*/
@PostMapping("delete")
@RequiresRoles(value={"admin","orgAdmin"},logical = Logical.OR) // 需要具备"admin"或"orgAdmin"角色之一
public Result delete(Long id){
payConfigRepository.deleteById(id); // 根据支付配置ID从数据库中删除相应的支付配置
return Result.ok(); // 返回删除成功的结果
}
}

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(links)"/>
<body>
<div class="ok-body" id="app" v-cloak>
<template>
<i-form label-colon ref="checkForm" :model="entity" :rules="ruleValidate" :label-width="140">
<form-item prop="mchId" label="支付申请">
https://dwz.cn/mPQmSPss
</form-item>
<form-item prop="mchId" label="商户号">
<i-input maxlength="20" v-model="entity.mchId" placeholder="请输入商户号"></i-input>
</form-item>
<form-item prop="secretKey" label="秘钥">
<i-input v-model="entity.secretKey" placeholder="请输秘钥"></i-input>
</form-item>
</i-form>
</template>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
var vm = new Vue({
el: '#app',
data:{
entity:{
},
ruleValidate : {
mchId: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
secretKey: [
{ required: true, message: '不能为空', trigger: 'blur'}
],
},
okUtils:null,
okLayer:null
},
methods: {
load : function(){
layui.use(["okUtils", "okLayer"], function () {
vm.okUtils = layui.okUtils;
vm.okLayer = layui.okLayer;
if(vm.entity.carParkId!=undefined){
vm.okUtils.ajaxCloud({
url:"/pay/config/getByCarParkId",
param : {carParkId:vm.entity.carParkId},
close : false,
success : function(result) {
if(result.msg!=null){
vm.entity = result.msg;
}
}
});
}
});
},
acceptClick : function(dialog){
vm.$refs.checkForm.validate(function(valid){
if (valid) {
vm.okUtils.ajaxCloud({
url:"/pay/config/save",
param : vm.entity,
json:true,
success : function(result) {
vm.okLayer.msg.greenTick(result.msg)
dialog.load();
}
});
}
});
},
},
created: function() {
}
});
</script>
</body>
</html>
Loading…
Cancel
Save