소스 검색

fleat: order update

igb 3 주 전
부모
커밋
fbea376fd6
2개의 변경된 파일46개의 추가작업 그리고 17개의 파일을 삭제
  1. 30 5
      order.php
  2. 16 12
      order_details.php

+ 30 - 5
order.php

@@ -263,11 +263,12 @@ $sqlStr .= " $fliterStr ORDER BY {$ordStr}o.created_at DESC";
                 <div class="notepanel clear">
                     <div class="noteItem">订单详情</div>
                     <div class="lx">
-                        <div class="price-details">
-                            <div><strong>小计:</strong> <?= number_format($row['subtotal'], 2) ?></div>
-                            <div><strong>折扣金额:</strong> <?= number_format($row['discount_amount'], 2) ?></div>
-                            <div><strong>总金额:</strong> <?= number_format($row['total_amount'], 2) ?></div>
-                        </div>
+                        <div><strong>总金额:</strong> <?= number_format($row['total_amount'], 2) ?></div>
+<!--                        <div class="price-details">-->
+<!--                            <div><strong>小计:</strong> --><?php //= number_format($row['subtotal'], 2) ?><!--</div>-->
+<!--                            <div><strong>折扣金额:</strong> --><?php //= number_format($row['discount_amount'], 2) ?><!--</div>-->
+
+<!--                        </div>-->
                     </div>
                     <div class="noteItem2">备注</div>
                     <div class="notecontent"><?= htmlspecialcharsFix($row['notes']) ?></div>
@@ -333,6 +334,30 @@ $sqlStr .= " $fliterStr ORDER BY {$ordStr}o.created_at DESC";
 
     <script>
     $(document).ready(function() {
+        // 添加日期验证逻辑
+        $('input[name="fliterToDate"]').on('change', function() {
+            var fromDate = $('input[name="fliterFromDate"]').val();
+            var toDate = $(this).val();
+            
+            if (fromDate && toDate && new Date(toDate) < new Date(fromDate)) {
+                alert('结束日期不能早于开始日期');
+                $(this).val(''); // 清空结束日期
+                return false;
+            }
+        });
+        
+        // 开始日期变更时也进行验证
+        $('input[name="fliterFromDate"]').on('change', function() {
+            var fromDate = $(this).val();
+            var toDate = $('input[name="fliterToDate"]').val();
+            
+            if (fromDate && toDate && new Date(toDate) < new Date(fromDate)) {
+                alert('开始日期不能晚于结束日期');
+                $('input[name="fliterToDate"]').val(''); // 清空结束日期
+                return false;
+            }
+        });
+
         // 处理筛选条件改变
         $('.filterSearch').change(function() {
             var url = '?';

+ 16 - 12
order_details.php

@@ -8,7 +8,7 @@ $id = $_GET['id'] ?? '';
 if (!empty($id) && is_numeric($id)) {
     // 获取订单基本信息
     $employee_id = $_SESSION['employee_id'];
-    $sql = "SELECT o.*, c.cs_company, cc.contact_name, e.em_user as employee_name 
+    $sql = "SELECT o.*, c.cs_company, c.cs_code, cc.contact_name, e.em_user as employee_name 
             FROM orders o 
             LEFT JOIN customer c ON o.customer_id = c.id 
             LEFT JOIN customer_contact cc ON o.contact_id = cc.id 
@@ -126,7 +126,11 @@ if (!empty($id) && is_numeric($id)) {
             <span class="info-label">订单编号:</span> <?= htmlspecialcharsFix($order['order_code']) ?>
         </div>
         <div class="info-row">
-            <span class="info-label">客户:</span> <?= htmlspecialcharsFix($order['cs_company']) ?>
+            <span class="info-label">客户:</span> 
+            <?php if (!empty($order['cs_code'])): ?>
+                <?= htmlspecialcharsFix($order['cs_code']) ?> - 
+            <?php endif; ?>
+            <?= htmlspecialcharsFix($order['cs_company']) ?>
         </div>
         <div class="info-row">
             <span class="info-label">联系人:</span> <?= htmlspecialcharsFix($order['contact_name']) ?>
@@ -183,14 +187,14 @@ if (!empty($id) && is_numeric($id)) {
     </table>
 
     <div class="total-section">
-        <div>
-            <strong>订单小计:</strong> <?= number_format($order['subtotal'], 2) ?>
-        </div>
-        <?php if(isset($order['discount_amount']) && $order['discount_amount'] > 0): ?>
-        <div>
-            <strong>订单折扣:</strong> <?= number_format($order['discount_amount'], 2) ?>
-        </div>
-        <?php endif; ?>
+<!--        <div>-->
+<!--            <strong>订单小计:</strong> --><?php //= number_format($order['subtotal'], 2) ?>
+<!--        </div>-->
+<!--        --><?php //if(isset($order['discount_amount']) && $order['discount_amount'] > 0): ?>
+<!--        <div>-->
+<!--            <strong>订单折扣:</strong> --><?php //= number_format($order['discount_amount'], 2) ?>
+<!--        </div>-->
+<!--        --><?php //endif; ?>
         <div style="font-size: 1.2em; margin-top: 5px;">
             <strong>订单总额:</strong> <?= number_format($order['total_amount'], 2) ?>
         </div>
@@ -198,9 +202,9 @@ if (!empty($id) && is_numeric($id)) {
 
     <?php if (!empty($order['notes'])): ?>
         <div class="notes-section">
-            <h2>备注信息</h2>
+            <h2>订单备注</h2>
             <div>
-                <strong>订单备注:</strong>
+             
                 <p><?= nl2br(htmlspecialcharsFix($order['notes'])) ?></p>
             </div>
         </div>