Browse Source

代码同步

shilinxiao 4 years ago
parent
commit
2465ea55c6

+ 41 - 0
src/main/java/cn/com/ota/web/controller/FlightOrderController.java

@@ -274,6 +274,47 @@ public class FlightOrderController extends BaseController {
     }
 
     @RequiresPermissions(value = {"Order:OrderInfo:edit"})
+    @RequestMapping(value = "/delPayRecord/{id}", method = {RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE})
+    @ResponseBody
+    public MsgResult delPayRecord(@PathVariable("id") Long id) {
+        MsgResult msgRet = new MsgResult();
+        try {
+            String msg = "";
+            FlightPayRecord payRecord = flightPayRecordService.findById(id);
+            String orderId = payRecord.getOrderId();
+            FlightOrder order = getService().getByOrderId(orderId);
+            if (order.getLocked() == 1) {
+                String operator = getLoginUser().getUsername();
+                if (order.getOperator().equals(operator)) {
+
+                    msg += "删除前: " + payRecord.toString() + " ";
+                    flightPayRecordService.deleteByEntity(payRecord);
+
+                    //操作记录
+                    FlightOrderLog log = new FlightOrderLog();
+                    log.setTitle("支付记录删除");
+                    log.setOrderId(orderId);
+                    log.setOperator(operator);
+                    log.setDes(msg);
+                    flightOrderLogService.save(log);
+                    msg = "删除成功";
+                } else {
+                    msg = "无权限";
+                }
+            } else {
+                msg = "未锁单-不可操作";
+            }
+
+            msgRet.pushOk(msg);
+        } catch (Exception e) {
+            msgRet.pushError("失败:" + e.getMessage());
+            logger.error("发生异常!", e);
+        }
+        return msgRet;
+    }
+
+
+    @RequiresPermissions(value = {"Order:OrderInfo:edit"})
     @RequestMapping(value = "/lock/{id}", method = {RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE})
     @ResponseBody
     public MsgResult lock(@PathVariable("id") Long id) {

+ 129 - 67
src/main/webapp/WEB-INF/views/ota/order/orderInfo/form.jsp

@@ -40,11 +40,16 @@
                 <h2 class="layui-colla-title " style="border-top: 5px solid #3c8dbc;margin-bottom:5px;padding:5px; ">
                     <div class="layui-row">
                         <h3><i class="layui-icon layui-icon-diamond" style="font-size: 20px; color: #FF5722;"></i>&nbsp;订单信息
-                            <button class="layui-btn layui-btn-sm" style="float: right"
+                            <button id="saveOrder" class="layui-btn layui-btn-sm" style="float: right"
                                     v-on:click="saveOrder(orderInfo,flightPassengers,payRecords)"
                                     type="button">
                                 保存
                             </button>
+                            <button class="layui-btn layui-btn-danger layui-btn-sm" style="float: right"
+                                    v-on:click="lock(orderInfo)"
+                                    type="button">
+                                锁单/解锁
+                            </button>
                         </h3>
                     </div>
                 </h2>
@@ -53,22 +58,21 @@
                         <table class="layui-table" lay-size="sm" id="table_flight">
                             <thead>
                             <tr>
+                                <th>订单ID</th>
                                 <th>同程订单号</th>
-                                <th>航司订单号</th>
                                 <th>订单状态</th>
                                 <th>政策代码</th>
                                 <th>总价</th>
                                 <th>票面价</th>
                                 <th>总机建燃油费</th>
-                                <th>优惠券</th>
                                 <th>利润</th>
                                 <%--<th>操作</th>--%>
                             </tr>
                             </thead>
                             <tbody>
                             <tr>
+                                <td>{{orderInfo.orderId}}</td>
                                 <td>{{orderInfo.orderSerialId}}</td>
-                                <td><input type="text" name="tianJinOrderNo" v-model="orderInfo.tianJinOrderNo"></td>
                                 <td>
                                     <select name="orderStatus" v-model="orderStatusSelected"
                                             @change="getOrderStatusSelected(orderInfo,orderStatusSelected)">
@@ -82,7 +86,6 @@
                                 <td>{{orderInfo.allFacePrice}}</td>
                                 <td>{{orderInfo.allSalePrice}}</td>
                                 </td>
-                                <td><input type="text" name="couponIds" v-model="orderInfo.couponIds"></td>
                                 <td>{{orderInfo.profit}}</td>
                             </tr>
                             </tbody>
@@ -127,7 +130,7 @@
                                 <td> {{item.airPortBuildFee}}</td>
                                 <td> {{item.salePrice+item.airPortBuildFee}}</td>
                                 <td> {{item.subPnr}}</td>
-                                <td> {{item.subBigPnr}}</td>
+                                <td><input type="text" name="subBigPnr" v-model="item.subBigPnr"></td>
                                 <td><input type="text" name="eticketNo" v-model="item.eticketNo"></td>
                             <tr/>
                             </tbody>
@@ -185,11 +188,11 @@
                 <h2 class="layui-colla-title " style="border-top: 5px solid #3c8dbc;margin-bottom:5px;padding:5px; ">
                     <div class="layui-row ">
                         <h4><i class="layui-icon layui-icon-list" style="font-size: 20px; color: #FF5722;"></i>&nbsp;支付记录
-                            <%--<button class="layui-btn layui-btn-primary layui-btn-sm" style="float: right"
-                                    v-on:click="addPayRecord(orderInfo)"
+                            <button class="layui-btn layui-btn-primary layui-btn-sm" style="float: right"
+                                    v-on:click="addPayRecord()"
                                     type="button">
                                 添加
-                            </button>--%>
+                            </button>
                         </h4>
                     </div>
                 </h2>
@@ -203,10 +206,11 @@
                                 <th>支付渠道</th>
                                 <th>出票渠道</th>
                                 <th>支付金额</th>
+                                <th>删除</th>
                             </tr>
                             </thead>
                             <tbody>
-                            <tr v-for="item in payRecords">
+                            <tr v-for="(item,index) in payRecords">
                                 <td><input type="text" name="payRecordsPnr" v-model="item.pnr"></td>
                                 <td>
                                     <select id="payRecordsPayType" name="payRecordsPayType" v-model="item.payType">
@@ -217,6 +221,9 @@
                                         <option value="fhCard" <c:if test="{{item.payType=='fhCard'}}">selected</c:if>>
                                             凤凰卡
                                         </option>
+                                        <option value="coupon" <c:if test="{{item.payType=='coupon'}}">selected</c:if>>
+                                            优惠券
+                                        </option>
                                         <option value="AliPay" <c:if test="{{item.payType=='AliPay'}}">selected</c:if>>
                                             支付宝
                                         </option>
@@ -237,6 +244,13 @@
                                 <td><input type="text" name="payRecordsTicketChannel" v-model="item.ticketChannel"></td>
                                 <td><input type="number" name="payRecordsAmount" v-model="item.amount"
                                            @change="getOrderProfit(orderInfo,item)"></td>
+                                <td>
+                                    <button class="layui-btn layui-btn-primary layui-btn-sm" style="float: right"
+                                            v-on:click="delPayRecord(index,item.id)"
+                                            type="button">
+                                        删除
+                                    </button>
+                                </td>
                             </tr>
                             <tr id="payRecord_tr" hidden="true">
                             </tr>
@@ -309,6 +323,7 @@
         });
     });
 
+
     new Vue({
         el: '#vueapp',
         data: {
@@ -397,38 +412,38 @@
                 }
             },
             saveOrder: function (orderInfo, psassengers, payRecords) {
+                $("#saveOrder").css({'background-color': 'gray'});
+                $("#saveOrder").attr("disabled", true);
+
+
                 var flag = 'true';
                 var reTmsg = '';
 
-                if (orderInfo.tianJinOrderNo != '' && orderInfo.tianJinOrderNo != null) {
-                    //保存订单详情
-                    $.ajax({
-                        type: 'POST',
-                        url: contextPath + "/ota/order/orderInfo/saveOrderInfo/",
-                        // data: JSON.stringify(orderInfo),
-                        data: orderInfo,
-                        success: function (data) {
-                            // console.log(data);
-                            if (data.status == 'OK') {
-                                reTmsg = data.message;
-                            } else if (data.status == 'ERROR') {
-                                flag = 'false';
-                                reTmsg = data.message;
-                            } else if (data.status == 'TIMEOUT') {
-                                flag = 'false';
-                                reTmsg = data.message;
-                            } else {
-                                flag = 'false';
-                                reTmsg = '保存失败或其他错误';
-                            }
-                        },
-                        dataType: 'json',
-                        async: false
-                    });
-                }else{
-                    flag = 'false';
-                    reTmsg='航司订单号不能为空';
-                }
+                //保存订单详情
+                $.ajax({
+                    type: 'POST',
+                    url: contextPath + "/ota/order/orderInfo/saveOrderInfo/",
+                    // data: JSON.stringify(orderInfo),
+                    data: orderInfo,
+                    success: function (data) {
+                        // console.log(data);
+                        if (data.status == 'OK') {
+                            reTmsg = data.message;
+                        } else if (data.status == 'ERROR') {
+                            flag = 'false';
+                            reTmsg = data.message;
+                        } else if (data.status == 'TIMEOUT') {
+                            flag = 'false';
+                            reTmsg = data.message;
+                        } else {
+                            flag = 'false';
+                            reTmsg = '保存失败或其他错误';
+                        }
+                    },
+                    dataType: 'json',
+                    async: false
+                });
+
                 if (flag == 'true') {
                     //保存乘客list
                     for (var i = 0; i < psassengers.length; i++) {
@@ -525,10 +540,45 @@
                     CmMsg.error("订单信息-" + reTmsg, -1);
                 }
 
+
             },
             test: function (item) {
                 // alert(item.id)
             },
+            lock: function (orderInfo) {
+                var flag = 'true';
+                var reTmsg = '';
+                // alert(item.id)
+                $.ajax({
+                    type: 'POST',
+                    url: contextPath + "/ota/order/orderInfo/lock/" + orderInfo.id,
+                    // data: payRecord,
+                    success: function (data) {
+                        // console.log(data);
+                        if (data.status == 'OK') {
+                            reTmsg = data.message;
+                        } else if (data.status == 'ERROR') {
+                            flag = 'false';
+                            reTmsg = data.message;
+                        } else if (data.status == 'TIMEOUT') {
+                            flag = 'false';
+                            reTmsg = data.message;
+                        } else {
+                            flag = 'false';
+                            reTmsg = '失败或其他错误';
+                        }
+                    },
+                    dataType: 'json',
+                    async: false
+                });
+                if (flag == 'true') {
+                    CmMsg.success(reTmsg, -1);
+                    $('#table-data').bootstrapTable('refresh', {silent: true});
+                } else {
+                    CmMsg.error(reTmsg, -1);
+                }
+
+            },
             getOrderStatusSelected: function (orderInfo, orderStatus) {
                 //获取选中的id
                 // alert(orderInfo.id)
@@ -536,30 +586,45 @@
                 orderInfo.orderStatus = orderStatus;
                 console.log(orderInfo)
             },
-            /*addPayRecord: function (orderInfo){
-                var html = "";
-                html+='<tr>'+
-                '<td><input type="text"></td>'+
-                '<td>'+
-                '<select>'+
-                '<option value="0">请选择</option>'+
-                '<option value="fhCard">凤凰卡</option>'+
-                '<option value="AliPay">支付宝</option>'+
-                '<option value="WeChat">微信</option>'+
-                '<option value="VC">虚拟卡</option>'+
-                '<option value="UN">银联</option>'+
-                '</select>'+
-                '</td>'+
-                '<td><input type="text" id="payRecordsPayChannel" name="payRecordsPayChannel"class="payRecordsPayChannel" v-model="item.payChannel"'+
-                'autocomplete="on" list="mylist" @keyup="search(item.payType)">'+
-                '<datalist id="mylist"></datalist>'+
-                '</td>'+
-                '<td><input type="text" name="payRecordsTicketChannel" v-model="item.ticketChannel"></td>'+
-                '<td><input type="number" name="payRecordsAmount" v-model="item.amount"'+
-                '@change="getOrderProfit(orderInfo,item)"></td>'+
-                '</tr>';
-                $("#payRecord_tr").before(html);
-            },*/
+            getOrderProfit: function (orderInfo, payRecord) {
+                //计算价格 总价-支付价
+                orderInfo.profit = (orderInfo.allPrice - payRecord.amount).toFixed(3);
+            },
+            addPayRecord: function () {
+                this.payRecords.push({"orderId": "" + this.orderInfo.orderId + ""});
+            },
+            delPayRecord: function (index, id) {
+                if (id != null && id != '') {
+                    console.log(index, id)
+                    var flag = false;
+                    $.ajax({
+                        type: 'POST',
+                        url: contextPath + "/ota/order/orderInfo/delPayRecord/" + id,
+                        // data: JSON.stringify(orderInfo),
+                        // data: orderInfo,
+                        success: function (data) {
+                            // console.log(data);
+                            if (data.status == 'OK') {
+                                flag = true;
+                                CmMsg.success(data.message, -1);
+                            } else if (data.status == 'ERROR') {
+                                CmMsg.error(data.message, -1);
+                            } else if (data.status == 'TIMEOUT') {
+                                CmMsg.error(data.message, -1);
+                            } else {
+                                CmMsg.error("失败或其他错误", -1);
+                            }
+                        },
+                        dataType: 'json',
+                        async: false
+                    });
+                    if (flag == true) {
+                        this.payRecords.splice(index, 1);
+                    }
+                }else{
+                    CmMsg.error("空行-无需删除", -1);
+                }
+            }
             /*saveOrderInfo: function (orderInfo) {
                 // console.log(orderInfo)
                 $.ajax({
@@ -659,10 +724,7 @@
                     dataType: 'json'
                 });
             },*/
-            getOrderProfit: function (orderInfo, payRecord) {
-                //计算价格 总价-支付价
-                orderInfo.profit = (orderInfo.allPrice - payRecord.amount).toFixed(3);
-            }
+
         }
     });