|
|
@@ -1,9 +1,13 @@
|
|
|
<!-- <link href="__CDN__/assets/libs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> -->
|
|
|
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
|
|
|
<script src="__CDN__/assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
|
|
|
+<style>
|
|
|
+ .confirm-btn {
|
|
|
+ background-color: #f75444 !important;
|
|
|
+ color: white !important;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<table class="table table-striped">
|
|
|
|
|
|
<thead>
|
|
|
@@ -46,9 +50,11 @@
|
|
|
{case value="6"}
|
|
|
<span class="label label-success">{$vo.status_txt}</span>
|
|
|
{eq name="userpledge_status" value="0"}
|
|
|
- <a href="javascript:;" class="btn btn-xs btn-danger cancelStorage" data-id="{$vo.id}">{:__('Cancel storage')}</a>
|
|
|
+ <a href="javascript:;" class="btn btn-xs btn-danger cancelStorage" data-id="{$vo.id}"
|
|
|
+ data-userpledge_id="{$userpledge_id}">{:__('Cancel storage')}</a>
|
|
|
+ {$userpledge_id}
|
|
|
{/eq}
|
|
|
-
|
|
|
+
|
|
|
{/case}
|
|
|
{default /}
|
|
|
{/switch}
|
|
|
@@ -69,23 +75,53 @@
|
|
|
$(function () {
|
|
|
$(".cancelStorage").click(function () {
|
|
|
var id = $(this).data('id');
|
|
|
- $.ajax({
|
|
|
- url: "user/Userpledge/cancelStorage",
|
|
|
- type: "POST",
|
|
|
- data: { id: id },
|
|
|
- dataType: "json",
|
|
|
- success: function(response) {
|
|
|
- if(response==1){
|
|
|
- window.location.reload(); // 刷新父页面
|
|
|
+ var userpledgeId = $(this).data('userpledge_id');
|
|
|
+
|
|
|
+ swal({
|
|
|
+ title: "确认取消存储",
|
|
|
+ icon: "warning",
|
|
|
+ buttons: {
|
|
|
+ cancel: "取消",
|
|
|
+ catch: {
|
|
|
+ text: "确认",
|
|
|
+ value: "catch",
|
|
|
+ className: "confirm-btn"
|
|
|
}
|
|
|
},
|
|
|
- error: function(xhr, status, error) {
|
|
|
- console.error("请求失败", error);
|
|
|
- },
|
|
|
- complete: function() {
|
|
|
- console.log("请求完成(无论成功/失败)");
|
|
|
- }
|
|
|
- });
|
|
|
+ dangerMode: true,
|
|
|
+ }
|
|
|
+
|
|
|
+ )
|
|
|
+ .then((willDelete) => {
|
|
|
+ if (willDelete) {
|
|
|
+ $.ajax({
|
|
|
+ url: "user/Userpledge/cancelStorage",
|
|
|
+ type: "POST",
|
|
|
+ data: { id: id, userpledgeId: userpledgeId },
|
|
|
+ dataType: "json",
|
|
|
+ success: function (response) {
|
|
|
+ let code = response.code;
|
|
|
+ if (code == 1) {
|
|
|
+ window.location.reload(); // 刷新父页面
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (xhr, status, error) {
|
|
|
+ console.error("请求失败", error);
|
|
|
+ },
|
|
|
+ complete: function () {
|
|
|
+ console.log("请求完成(无论成功/失败)");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // console.log("取消")
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
</script>
|