Drew 6 yıl önce
ebeveyn
işleme
8329661da1
1 değiştirilmiş dosya ile 46 ekleme ve 1 silme
  1. 46 1
      src/main/webapp/system/memberInfo.jsp

+ 46 - 1
src/main/webapp/system/memberInfo.jsp

@@ -15,6 +15,9 @@
 <%@ page import="org.jooq.*" %>
 <%@ page import="static jooq.Tables.DATATYPEINFO" %>
 <%@ page import="net.sf.json.JSONArray" %>
+<%@ page import="java.math.BigDecimal" %>
+<%@ page import="com.sun.org.apache.bcel.internal.generic.IFNULL" %>
+<%@ page import="static org.jooq.impl.DSL.ifnull" %>
 <jsp:useBean id="db" class="dbconnection.DbConnection" scope="page"/>
 <%
     String operator = ExtendString.getDBStr(request.getParameter("operator"));
@@ -69,6 +72,21 @@
         out.print(jsonObject);
         ctx.close();
         return;
+    } else if (operator.equals("charge")) {
+        response.setContentType("application/json");
+        String memberpk = ExtendString.getDBStr(request.getParameter("memberpk"));
+        String amount = ExtendString.getDBStr(request.getParameter("amount"));
+
+        ctx.update(MEMBERINFO)
+           .set(MEMBERINFO.COIN_A, MEMBERINFO.COIN_A.plus(Integer.parseInt(amount)))
+           .set(MEMBERINFO.CAN_CHAT, 1)
+           .where(MEMBERINFO.PK.equal(Integer.parseInt(memberpk)))
+           .execute();
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("success", true);
+        out.print(jsonObject);
+        ctx.close();
+        return;
     }
 
 %>
@@ -100,10 +118,11 @@
         <el-table-column prop="coin_O" label="提现支出" width="80"></el-table-column>
         <el-table-column prop="coin_OI" label="预支币额" width="80"></el-table-column>
         <el-table-column prop="MDate" label="注册日期" width="200" :formatter="dateFormatter"></el-table-column>
-        <el-table-column label="操作" width="200" fixed="right">
+        <el-table-column label="操作" width="250" fixed="right">
             <template slot-scope="{row}">
                 <el-button size="small" type="text" @click="inviteList(row)">邀请列表</el-button>
                 <el-button size="small" type="text" @click="sendMsg(row)">发消息</el-button>
+                <el-button size="small" type="text" @click="charge(row)">充值</el-button>
                 <el-button size="small" type="text" @click="del(row)">删除</el-button>
             </template>
         </el-table-column>
@@ -202,6 +221,32 @@
                     width: 400,
                     height: 300
                 });
+            },
+            charge: function (row) {
+                this.$prompt('输入金额', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    inputPattern: /^\d+$/,
+                    inputErrorMessage: '金额不正确',
+                    callback: function (action, instance) {
+                        if ('confirm' === action) {
+                            console.log(Number(instance.inputValue));
+                            $.post({
+                                url: '${pageContext.request.contextPath}${pageContext.request.servletPath}',
+                                data: {
+                                    operator: 'charge',
+                                    memberpk: row.PK,
+                                    amount: Number(instance.inputValue)
+                                },
+                                success: function () {
+                                    this.$message.success("充值成功");
+                                    this.getData()
+                                }.bind(this)
+                            });
+                        }
+                    }.bind(this)
+                })
+
             }
         },
         watch: {}