|
@@ -0,0 +1,149 @@
|
|
|
+{{define "chooseProduct.html"}}
|
|
|
+ <!DOCTYPE html>
|
|
|
+ <html lang="en">
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
|
|
|
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
|
|
|
+ <title>用户选择产品页面</title>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <table border="0" id="tableId">
|
|
|
+ <thead>
|
|
|
+ <tr class="tableTitle">
|
|
|
+ <th style="width: 20px"><input type="checkbox" name="item">
|
|
|
+ </td></th>
|
|
|
+ <th style="width: 50px">序号</th>
|
|
|
+ <th style="width: 100px">产品名称</th>
|
|
|
+ <th style="width: 200px">url</th>
|
|
|
+ <th style="width: 100px">产品单价</th>
|
|
|
+ <th style="width: 100px">产品类型</th>
|
|
|
+ <th style="width: 100px">最小单位</th>
|
|
|
+ <th style="width: 100px">试用次数</th>
|
|
|
+ {{/* <th style="width: 100px">开始时间</th>*/}}
|
|
|
+ {{/* <th style="width: 100px">结束时间</th>*/}}
|
|
|
+ {{/* <th style="width: 100px">结束时间</th>*/}}
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody class="box">
|
|
|
+
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <div style="margin-top: 20px">
|
|
|
+ 开始时间:<input id="startTime" type="text">
|
|
|
+ 结束时间:<input id="endTime" type="text" name="" id=""><br>
|
|
|
+ 扣费模式:<select id="costModel" style="width: 165px;height: 25px;margin-top: 10px">
|
|
|
+ <option value="0">剩余量</option>
|
|
|
+ <option value="1">余额</option>
|
|
|
+ </select>
|
|
|
+ 充值量:<input id="leftNum" type="text"><br>
|
|
|
+ 充值金额:<input id="money" type="text">
|
|
|
+ 产品状态:<select id="interfaceStatus" style="width: 165px;height: 25px;margin-top: 10px">
|
|
|
+ <option value="0">开启</option>
|
|
|
+ <option value="1">关闭</option>
|
|
|
+ </select><br>
|
|
|
+ 每日调用次数:<input id="dayLimit" type="text">
|
|
|
+ 每次获取数据量:<input id="oneLimit" type="text">
|
|
|
+ 用户appid:<input id="appId" type="text">
|
|
|
+ </div>
|
|
|
+ <div style="margin-top: 10px">
|
|
|
+ <button type="submit" onclick="submit()" style="width: 80px;height: 30px;">提交</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <p class="result"></p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+ <script>
|
|
|
+ productList()
|
|
|
+
|
|
|
+ function productList() {
|
|
|
+ $.ajax({
|
|
|
+ url: "/manage/product/list",
|
|
|
+ type: "POST",
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code === 0) {
|
|
|
+ console.log(r.data)
|
|
|
+ var str = ""
|
|
|
+ for (var i = 0; i < r.data.length; i++) {
|
|
|
+ var item = r.data[i];
|
|
|
+ str += '<tr>';
|
|
|
+ str += '<td style="width: 20px"><input id=' + item["id"] + ' value=' + item["id"] + ' type="radio" name="item"></td>';
|
|
|
+ str += '<td style="width: 50px">' + (i + 1) + '</td>';
|
|
|
+ str += '<td style="width: 100px">' + item.name + '</td>';
|
|
|
+ str += '<td style="width: 200px">' + item.url + '</td>';
|
|
|
+ str += '<td style="width: 100px">' + item.unit_price + '</td>';
|
|
|
+ if (item.product_type === 0) {
|
|
|
+ str += '<td style="width: 100px">按次</td>';
|
|
|
+ } else {
|
|
|
+ str += '<td style="width: 100px">按条</td>';
|
|
|
+ }
|
|
|
+
|
|
|
+ str += '<td style="width: 100px">' + item.min_unit + '</td>';
|
|
|
+ str += '<td style="width: 100px">' + item.test_num + '</td>';
|
|
|
+ str += '</tr>';
|
|
|
+ }
|
|
|
+ $('.box').html(str);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function submit() {
|
|
|
+ var productId = $("input[name='item']:checked").val();
|
|
|
+ var startTime = $("#startTime").val();
|
|
|
+ var endTime = $("#endTime").val();
|
|
|
+ var leftNum = $("#leftNum").val();
|
|
|
+ var money = $("#money").val();
|
|
|
+ var costModel = $("#costModel").find("option:selected").val();
|
|
|
+ var interfaceStatus = $("#interfaceStatus").find("option:selected").val();
|
|
|
+ var dayLimit = $("#dayLimit").val();
|
|
|
+ var oneLimit = $("#oneLimit").val();
|
|
|
+ var appId = $("#appId").val();
|
|
|
+ var product = {}
|
|
|
+ product["productId"] = productId
|
|
|
+ product["startTime"] = startTime
|
|
|
+ product["endTime"] = endTime
|
|
|
+ product["leftNum"] = leftNum
|
|
|
+ product["tradeMoney"] = money
|
|
|
+ product["costModel"] = costModel
|
|
|
+ product["interfaceStatus"] = interfaceStatus
|
|
|
+ product["callTimesLimitDay"] = dayLimit
|
|
|
+ product["dataNumOneTimes"] = oneLimit
|
|
|
+ var products = []
|
|
|
+ products.push(product)
|
|
|
+ param = {
|
|
|
+ "products": products,
|
|
|
+ "appId": appId,
|
|
|
+ "buyType": 1,
|
|
|
+ }
|
|
|
+ console.log("参数:", param)
|
|
|
+ /*if (productId === undefined || productId === "") {
|
|
|
+ return
|
|
|
+ }*/
|
|
|
+ $.ajax({
|
|
|
+ url: "/manage/user/userProductChoose",
|
|
|
+ data: JSON.stringify(param),
|
|
|
+ type: "POST",
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ success: function (r) {
|
|
|
+ var a = JSON.stringify(r)
|
|
|
+ $(".result").html(a);
|
|
|
+ /*if (r.code == 0) {
|
|
|
+ $(".result").html("请求成功!" + r.msg);
|
|
|
+ } else {
|
|
|
+ $(".result").html("购买产品失败!" + r.msg);
|
|
|
+ }
|
|
|
+*/
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+{{end}}
|