Selaa lähdekoodia

Merge branch 'master' into feature/v4.9.24

lianbingjie 1 vuosi sitten
vanhempi
commit
1d3c8703ab
67 muutettua tiedostoa jossa 2666 lisäystä ja 1293 poistoa
  1. 1 1
      src/config.yaml
  2. 74 2
      src/jfw/front/dataExport.go
  3. 24 25
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_order_detail.js
  4. 19 15
      src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_aiForecastPack.html
  5. 31 27
      src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_member.html
  6. 19 15
      src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_subAccount.html
  7. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/areaPack/orderDetail.html
  8. 19 14
      src/jfw/modules/app/src/web/templates/commonPay/bidfile/bidfileDetail.html
  9. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/buyerPortraitPack/orderDetail.html
  10. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/dataFile/orderDetail.html
  11. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/dataPack/orderDetail.html
  12. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/filePack/orderDetail.html
  13. 18 14
      src/jfw/modules/app/src/web/templates/commonPay/integral/integralDetail.html
  14. 4 0
      src/jfw/modules/app/src/web/templates/commonPay/myOrder.html
  15. 18 14
      src/jfw/modules/app/src/web/templates/dataExport/dataExport_toOrderDetail.html
  16. 18 14
      src/jfw/modules/app/src/web/templates/entniche/entniche_order_detail.html
  17. 2 1
      src/jfw/modules/app/src/web/templates/invoice/cantInvoice.html
  18. 3 1
      src/jfw/modules/subscribepay/src/config.json
  19. 7 3
      src/jfw/modules/subscribepay/src/config/config.go
  20. 1 1
      src/jfw/modules/subscribepay/src/entity/equityActive.go
  21. 1 0
      src/jfw/modules/subscribepay/src/filter/sessionfilter.go
  22. 1 1
      src/jfw/modules/subscribepay/src/go.mod
  23. 10 2
      src/jfw/modules/subscribepay/src/invoice.json
  24. 1 1
      src/jfw/modules/subscribepay/src/mailtemplate.html
  25. 613 161
      src/jfw/modules/subscribepay/src/service/invoice.go
  26. 32 11
      src/jfw/modules/subscribepay/src/service/orderListDetails.go
  27. 1 1
      src/jfw/modules/subscribepay/src/service/salesCreateOrder.go
  28. 13 12
      src/jfw/modules/subscribepay/src/util/util.go
  29. 86 56
      src/web/staticres/common-module/order-list/js/order-detail.js
  30. 8 4
      src/web/staticres/common-module/order-list/js/order-list-config.js
  31. 93 66
      src/web/staticres/common-module/order-list/js/order-list.js
  32. 132 11
      src/web/staticres/electronic_invoice/css/check_invoice.css
  33. 102 1
      src/web/staticres/electronic_invoice/css/invoice.css
  34. 166 166
      src/web/staticres/electronic_invoice/js/invoice.js
  35. 4 10
      src/web/templates/areaPack/pc/page_order.html
  36. 12 18
      src/web/templates/frontRouter/pc/dataFile/sess/orderDetail.html
  37. 12 18
      src/web/templates/order/pc/bidfile/bidfileDetail.html
  38. 12 18
      src/web/templates/order/pc/buyerPortraitPack/detail.html
  39. 12 19
      src/web/templates/order/pc/datareport/detail.html
  40. 12 18
      src/web/templates/order/pc/filePack/detail.html
  41. 12 18
      src/web/templates/order/pc/integral/integralDetail.html
  42. 17 27
      src/web/templates/pc/aiPack_orderDetail.html
  43. 228 36
      src/web/templates/pc/check_invoice.html
  44. 12 18
      src/web/templates/pc/dataPack/packDetail.html
  45. 12 19
      src/web/templates/pc/entniche_orderDetail.html
  46. 514 151
      src/web/templates/pc/invoice.html
  47. 16 25
      src/web/templates/pc/medaratus_orderDetail.html
  48. 21 39
      src/web/templates/pc/member_orderDetail.html
  49. 19 28
      src/web/templates/pc/myOrder.html
  50. 6 15
      src/web/templates/pc/orderDetail.html
  51. 16 27
      src/web/templates/pc/subAccount_orderDetail.html
  52. 16 25
      src/web/templates/pc/vip_orderDetail.html
  53. 4 0
      src/web/templates/weixin/commonPay/areaPack/orderDetail.html
  54. 18 14
      src/web/templates/weixin/commonPay/bidfile/bidfiledetail.html
  55. 4 0
      src/web/templates/weixin/commonPay/buyerPortraitPack/orderDetail.html
  56. 4 0
      src/web/templates/weixin/commonPay/dataFile/orderDetail.html
  57. 4 0
      src/web/templates/weixin/commonPay/dataPack/orderDetail.html
  58. 4 0
      src/web/templates/weixin/commonPay/filePack/orderDetail.html
  59. 18 14
      src/web/templates/weixin/commonPay/integral/integralDetail.html
  60. 6 3
      src/web/templates/weixin/commonPay/medical/orderDetail.html
  61. 4 0
      src/web/templates/weixin/commonPay/myOrder.html
  62. 18 14
      src/web/templates/weixin/dataExport/dataExport_toOrderDetail.html
  63. 2 1
      src/web/templates/weixin/invoice/cantInvocie.html
  64. 19 15
      src/web/templates/weixin/member/aiForecastPackdetail.html
  65. 32 30
      src/web/templates/weixin/member/memberdetail.html
  66. 18 15
      src/web/templates/weixin/member/subAccountDetail.html
  67. 21 18
      src/web/templates/weixin/vipsubscribe/vip_order_detail.html

+ 1 - 1
src/config.yaml

@@ -11,5 +11,5 @@ publicserviceKey: "publicservice.rpc"
 
 database:
   default:
-    link: "clickhouse:jianyu_appl:Cli3#fkh4ouSe@tcp(127.0.0.1:4012)/jyseo_test?dial_timeout=2000ms&max_execution_time=60"
+    link: "clickhouse:jianyu_appl:Cli3#fkh4ouSe@tcp(172.17.16.40:4012)/jyseo_test?dial_timeout=2000ms&max_execution_time=60"
     debug: true

+ 74 - 2
src/jfw/front/dataExport.go

@@ -346,6 +346,66 @@ func (d *DataExport) CancelOrder() error {
 	return nil
 }
 
+// 是否可开票
+func IsAllowInvoice(res map[string]interface{}) bool {
+	if util.IntAll(res["applybill_status"]) > 0 {
+		return false
+	}
+	filter := util.ObjToString(res["filter"].(string))
+	filter_map := map[string]interface{}{}
+	_ = json.Unmarshal([]byte(filter), &filter_map)
+	if util.IntAll(res["order_status"]) == 1 && util.InterfaceToStr(filter_map["badge"]) != "exchange" {
+		//用户下单|| 代用户下单
+		if util.IntAll(res["is_backstage_order"]) == 0 || util.InterfaceToStr(res["order_channel"]) == "xdqd04" {
+			return len(ShowList(util.InterfaceToStr(res["order_code"]))) == 0
+		} else { //qmx下单 已全额回款 发票企业为剑鱼
+			return util.IntAll(res["return_status"]) == 1 && util.InterfaceToStr(res["signing_subject"]) == "h01" &&
+				len(ShowList(util.InterfaceToStr(res["order_code"]))) == 0
+		}
+	}
+	return false
+}
+
+// 剩余金额
+func InvoicePrice(orderData map[string]interface{}) int64 {
+	residueMoney := int64(0)
+	if util.Int64All(orderData["applybill_status"]) == 2 {
+		return residueMoney
+	}
+
+	return util.Int64All(orderData["pay_money"]) - InvoiceAmount(util.InterfaceToStr(orderData["order_code"]))
+}
+
+func InvoiceAmount(orderCode string) (invoicedMoney int64) {
+	invoicedInfo := public.Mysql.SelectBySql(fmt.Sprintf("SELECT invoice_order_money,only_Identifying FROM invoice WHERE order_code = '%s' and invoice_status>=0", orderCode))
+	if invoicedInfo != nil && len(*invoicedInfo) > 0 {
+		onlyMap := make(map[string]int64)
+		for _, m := range *invoicedInfo {
+			if m["only_Identifying"] != nil { //过滤换票过程中的数据
+				onlyMap[util.InterfaceToStr(m["only_Identifying"])] = util.Int64All(m["invoice_order_money"])
+			} else {
+				invoicedMoney += util.Int64All(m["invoice_order_money"])
+			}
+		}
+		if len(onlyMap) > 0 {
+			for _, i := range onlyMap {
+				invoicedMoney += i
+			}
+		}
+	}
+	return
+}
+
+func ShowList(order_code string) []map[string]interface{} {
+	data := public.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
+  SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and  b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
+) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety not  LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
+	if data == nil {
+		return nil
+	}
+	return *data
+}
+
 /*
 *
 根据 订单编号+userId 查询
@@ -367,7 +427,18 @@ func (d *DataExport) ToOrderDetail(orderCode string) error {
 	if orderCode != "" {
 		orderDetail = *public.Mysql.FindOne(tableName_order, queryMap, "", "")
 		//最后一次开票查询
-		orderDetail["source"] = LastInvoiceSource(orderCode)
+		//orderDetail["source"] = LastInvoiceSource(orderCode)
+		//是否满足可开票
+		var isCanInvoic bool
+		create_time_str := util.ObjToString(orderDetail["create_time"])
+		create_time, _ := time.ParseInLocation(Date_Full_Layout, create_time_str, time.Local)
+		if create_time.Unix() > 1704038400 {
+			//可开票
+			isCanInvoic = IsAllowInvoice(orderDetail)
+		}
+		orderDetail["is_can_invoice"] = isCanInvoic
+		//是否存在可查看发票
+		orderDetail["invoice_show"] = len(ShowList(util.InterfaceToStr(orderDetail["order_code"]))) > 0
 	}
 	//	log.Println("ToOrderDetail", orderCode, orderDetail)
 	if orderDetail["pay_money"] != nil {
@@ -926,10 +997,11 @@ func (d *DataExport) Invoice(order_code string) error {
 	res := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
 		"user_id":    userid,
 		"order_code": order_code,
-	}, "user_mail,user_phone", "create_time desc")
+	}, "user_mail,user_phone,company_name", "create_time desc")
 	if *res != nil {
 		d.T["mail"] = (*res)["user_mail"]
 		d.T["phone"] = (*res)["user_phone"]
+		d.T["company_name"] = (*res)["company_name"]
 	}
 	if public.Mysql.CountBySql("select count(1) as count from dataexport_order where user_id = ? and order_code = ? and order_status = ?", userid, order_code, 1) > 0 {
 		return d.Render("/pc/invoice.html", &d.T)

+ 24 - 25
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_order_detail.js

@@ -455,12 +455,10 @@ $(function () {
                 }
 
                 // 后台渠道为xdqd04(销售代下单)可以开发票,其他后台创建订单不可以开发票
-                if (r.data.order.is_backstage_order!==1 || r.data.order.order_channel === 'xdqd04'){
                     var pay_again = ""
                     //发票
-                    if (r.data.order.applybill_status === 0) {
+                    if (r.data.order.is_can_invoice) {
                         //已支付未申请发票
-                        if(r.data.order.source !== 1){
                             pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()' style='width: 100%!important;'>开发票</button>"
                             $(".invoice .invoicing").css("display", "");
                             $(".invoicing").on("click", function () {
@@ -476,12 +474,12 @@ $(function () {
                                 })
                             });
 
-                        }
-                    } else {
+                        
+                    } 
                         //已支付已申请发票
-                        if(r.data.order.source !== 1){
+                        if(r.data.order.invoice_show){
                         pay_again += "<button class=\"j-button-cancel\" onclick= 'checkinvoice(" + r.data.order.applybill_status + ")' style='width: 100%!important;'>查看发票</button >"
-                        $(".invoice").css("display", "none");
+                        // $(".invoice").css("display", "none");
                         }
 
                         switch (r.data.order.applybill_type) {
@@ -494,11 +492,9 @@ $(function () {
                                 $(".taxpayer_number").html(r.data.order.applybill_taxnum);
                                 break;
                         }
-                    }
-                    if(r.data.order.source !== 1){
-                       $(".j-footer").show().html(pay_again)
-                    }
-                }
+                    
+                       $(".j-footer").show().html(pay_again)     
+                
             } else if (r.data.order.order_status == -2 || r.data.order.order_status == -3) {
                 $("#card-header-bg").addClass("bg cancel-bg")
                 $("#pageTitle").addClass("status")
@@ -771,16 +767,17 @@ $(".icon-fanhui").on("click", function () {
 
 //查看发票
 function checkinvoice(flag) {
-    if (flag === 2) {
-        weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-            buttons: [{
-                label: '我知道了',
-                type: 'primary'
-            }]
-        });
-        return
-    }
-    window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode_
+    // if (flag === 2) {
+    //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+    //         buttons: [{
+    //             label: '我知道了',
+    //             type: 'primary'
+    //         }]
+    //     });
+    //     return
+    // }
+    // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode_
+    window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode_
 }
 
 //开发票
@@ -795,11 +792,13 @@ function invoiceAdd() {
     var orderCode_ = decodeURIComponent(getParam("orderCode"));
     $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode_}, function (data) {
         if (data.status == 1) {
-            window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode_;
+            // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode_;
+            window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode_;
         } else {
-            window.location.href = "/jyapp/front/cantInvoice";
+            // window.location.href = "/jyapp/front/cantInvoice";
+            window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode_;
         }
-        ;
+        
     })
 }
 

+ 19 - 15
src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_aiForecastPack.html

@@ -222,10 +222,11 @@
                 if (source === ""){
                   var pay_again = ""
                   //发票
-                  if (r.data.applybill_status === 0 && r.data.source !== 1) {
+                  if (r.data.is_can_invoice) {
                       //已支付未申请发票
                       pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\"; onclick='invoiceAdd()'>开发票</button>"
-                  } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                  } 
+                   if ( r.data.invoice_show) {
                       //已支付已申请发票
                       pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\" onclick='checkinvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                   }
@@ -335,7 +336,7 @@
                 $(".invoice").css("display", "none");//隐藏开发票
             }
             if(r.data.is_backstage_order===1){
-                $(".invoice").css("display", "none");//隐藏开发票
+                // $(".invoice").css("display", "none");//隐藏开发票
             }
         })
     })
@@ -364,9 +365,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
             ;
         })
@@ -379,16 +382,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 31 - 27
src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_member.html

@@ -462,20 +462,21 @@
 
                 //有效周期
                 $(".line_cycle").css("display", "");
-                if (source === ""&&filterObj.badge!="exchange") {
+
                     var pay_again = ""
                     //发票
-                    if (r.data.applybill_status === 0 && r.data.source !== 1) {
+                    if (r.data.is_can_invoice) {
                         //已支付未申请发票
                         pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\"; onclick='invoiceAdd()'>开发票</button>"
-                    } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                    } 
+                     if (r.data.invoice_show) {
                         //已支付已申请发票
                         pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\" onclick='checkinvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                     }
-                    if(r.data.source !== 1){
+                  
                       $('.j-footer').show().html(pay_again);
-                    }
-                }
+                    
+                
                 //支付方式
                 if (r.data.billingMode===1){
                     if (r.data.pay_way.indexOf("wx") > -1||r.data.return_type===1) {
@@ -640,15 +641,15 @@
 
     //开发票
     function invoiceAdd() {
-        if (window.isTransferPay) {
-            weui.alert('请联系客服开票<br>客服热线:400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
+        // if (window.isTransferPay) {
+        //     weui.alert('请联系客服开票<br>客服热线:400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
         // return weui.alert('因年底集中结算,发票功能暂停使用。给您带来的不便表示抱歉,我们会在恢复发票功能后第一时间通知!', {
         //     title: '温馨提示',
         //     buttons: [{
@@ -658,9 +659,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -672,16 +675,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 19 - 15
src/jfw/modules/app/src/web/templates/big-member/page_orderdetail_subAccount.html

@@ -226,10 +226,11 @@
                 if (source === "") {
                   var pay_again = ""
                   //发票
-                  if (r.data.applybill_status === 0 && r.data.source !== 1) {
+                  if (r.data.is_can_invoice) {
                       //已支付未申请发票
                       pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\"; onclick='invoiceAdd()'>开发票</button>"
-                  } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2)  && r.data.source !== 1) {
+                  }
+                   if ( r.data.invoice_show) {
                       //已支付已申请发票
                       pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\" onclick='checkinvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                   }
@@ -340,7 +341,7 @@
                 $(".invoice").css("display", "none");//隐藏开发票
             }
             if(r.data.is_backstage_order===1){
-                $(".invoice").css("display", "none");//隐藏开发票
+                // $(".invoice").css("display", "none");//隐藏开发票
             }
         })
     })
@@ -369,9 +370,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
             ;
         })
@@ -384,16 +387,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/areaPack/orderDetail.html

@@ -85,6 +85,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                        <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 19 - 14
src/jfw/modules/app/src/web/templates/commonPay/bidfile/bidfileDetail.html

@@ -194,10 +194,11 @@
 
                 var pay_again = ""
                 //发票
-                if (r.data.applybill_status === 0  && r.data.source !== 1) {
+                if ( r.data.is_can_invoice) {
                     //已支付未申请发票
                     pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\"; onclick='invoiceAdd()'>开发票</button>"
-                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                } 
+                 if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.show_invoice) {
                     //已支付已申请发票
                     pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\" onclick='checkinvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                 }
@@ -343,9 +344,12 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
+                
             }
             ;
         })
@@ -358,16 +362,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/buyerPortraitPack/orderDetail.html

@@ -85,6 +85,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                        <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/dataFile/orderDetail.html

@@ -85,6 +85,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/dataPack/orderDetail.html

@@ -85,6 +85,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/filePack/orderDetail.html

@@ -85,6 +85,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 18 - 14
src/jfw/modules/app/src/web/templates/commonPay/integral/integralDetail.html

@@ -196,10 +196,11 @@
 
                     var pay_again = ""
                     //发票
-                    if (r.data.applybill_status === 0  && r.data.source !== 1) {
+                    if (r.data.is_can_invoice) {
                         //已支付未申请发票
                         pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\"; onclick='invoiceAdd()'>开发票</button>"
-                    } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2)  && r.data.source !== 1) {
+                    } 
+                    if (r.data.invoice_show) {
                         //已支付已申请发票
                         pay_again += "<button class=\"j-button-cancel\" style=\"width: 100%!important;height: 0.92rem!important;\" onclick='checkinvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                     }
@@ -361,9 +362,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/cantInvoice";
             }
             ;
         })
@@ -376,16 +379,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/myOrder.html

@@ -96,6 +96,10 @@
                                                     class="order-action-button click-active invoke"
                                                     v-if="item.buttonConf.invokeButtonShow"
                                                     @click="clickInvoke(item)">${ item.buttonConf.invokeButtonText }</button>
+                                            <button
+                                                    class="order-action-button click-active invoke"
+                                                    v-if="item.buttonConf.lookInvoiceButtonShow"
+                                                    @click="clickInvoke(item,'look')">${ item.buttonConf.lookInvoiceButtonText }</button>
                                             <button
                                                     class="order-action-button click-active main-color pay"
                                                     v-if="item.buttonConf.payConfirmShow"

+ 18 - 14
src/jfw/modules/app/src/web/templates/dataExport/dataExport_toOrderDetail.html

@@ -686,16 +686,17 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" +{{.T.o.order_code}}
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" +{{.T.o.order_code}}
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" +{{.T.o.order_code}}
     }
 
     function invoiceAdd() {
@@ -708,9 +709,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code":{{.T.o.order_code}}}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" +{{.T.o.order_code}}
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" +{{.T.o.order_code}}
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" +{{.T.o.order_code}}
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" +{{.T.o.order_code}}
             }
             ;
         })
@@ -738,9 +741,10 @@
                                 $(".order-main").before(finish_html)
 
                                 var html = '<div class="j-button-group">'
-                                if (r.data.applybill_status === 0 && r.data.source !== 1) {
+                                if (r.data.is_can_invoice) {
                                     html += '<button class="j-button-cancel" onclick="invoiceAdd()">开发票</button><button class="j-button-confirm" id="buytwo" onclick="payAgain()">再次购买</button>'
-                                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                                } 
+                                if ( r.data.invoice_show) {
                                     html += '<button class="j-button-cancel" onclick= checkinvoice(' + r.data.applybill_status+ ')>查看发票</button><button class="j-button-confirm" id="buytwo" onclick="payAgain()">再次购买</button>'
                                 }
                             } else {

+ 18 - 14
src/jfw/modules/app/src/web/templates/entniche/entniche_order_detail.html

@@ -467,9 +467,10 @@
                     $("#card-header-bg").addClass("bg finish-bg")
                     $("#pageTitle").addClass("status")
                     $(".order_status").text("已完成");
-                    if (data.applybill_status === 0 && data.source !== 1) {
+                    if (data.is_can_invoice) {
                         pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button></div>"
-                    } else if ((data.applybill_status === 1 || data.applybill_status === 2) && data.source !== 1) {
+                    } 
+                    if (data.invoice_show) {
                         pay_again += "<button class=\"j-button-cancel\" onclick= 'checkinvoice(" + data.applybill_status + ")'>查看发票</button></div>"
                     }
                     $(".j-footer").html(pay_again)
@@ -555,17 +556,18 @@
 
     //查看发票
     function checkinvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
         orderCode = decodeURIComponent(getParam("order_code"))
-        window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        // window.location.href = "/jyapp/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     //开发票
@@ -580,9 +582,11 @@
         orderCode = decodeURIComponent(getParam("order_code"))
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/jyapp/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/jyapp/front/cantInvoice";
+                // window.location.href = "/jyapp/front/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
             ;
         })

+ 2 - 1
src/jfw/modules/app/src/web/templates/invoice/cantInvoice.html

@@ -152,7 +152,8 @@
         }
         checkInvoice.init()
         function replaceInvoice(){
-            window.location.href = "/jyapp/front/invoice/showpage?order_code="+order_code+"&c=1"
+            // window.location.href = "/jyapp/front/invoice/showpage?order_code="+order_code+"&c=1"
+            window.location.href = "/jy_mobile/invoice/Invoicing?order_code="+order_code+"&type=Replace"
         }
 
     </script>

+ 3 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -236,5 +236,7 @@
       }
     }
   },
-  "newOrderTime": 1709827200
+  "newOrderTime": 1709827200,
+  "signing_Subject":"北京剑鱼信息技术有限公司",
+  "orderTime":1704038400
 }

+ 7 - 3
src/jfw/modules/subscribepay/src/config/config.go

@@ -236,9 +236,13 @@ type Invoice struct {
 		Time  string
 	}
 	Invoice_switch     bool
-	Red_invoice_switch bool   //红冲发票是否可用开关
-	Red_invoice_msg    string //提示信息
-	Third_party_switch bool   //第三方开票开关
+	Red_invoice_switch bool            //红冲发票是否可用开关
+	Red_invoice_msg    string          //提示信息
+	Third_party_switch bool            //第三方开票开关
+	Order_createtime   int64           //24年之前的订单不能开票
+	SigningSubject     string          `json:"signing_subject"` //管理后台订单发票签约主体配置
+	SubmitNum          int64           `json:"submit_num"`
+	Invoice_type       map[string]bool //发票类型
 }
 
 type entnicheConfig struct {

+ 1 - 1
src/jfw/modules/subscribepay/src/entity/equityActive.go

@@ -331,7 +331,7 @@ func (e *EquityActive) SendPayRaffleMsg() {
 	prizeOrder := map[string]interface{}{
 		"active_id":   activityInfo.ActivityId,
 		"phone":       e.Phone,
-		"position_id": common.If(e.positionId>0,e.positionId,nil),
+		"position_id": common.If(e.positionId > 0, e.positionId, nil),
 		"mgo_user_id": e.mgoId,
 		"order_code":  e.OrderCode,
 		"create_time": date.NowFormat(date.Date_Full_Layout),

+ 1 - 0
src/jfw/modules/subscribepay/src/filter/sessionfilter.go

@@ -25,6 +25,7 @@ func (l *sessionfilter) Do() bool {
 		strings.HasPrefix(rqu, "/jypay/free/") || //销售代创建订单
 		strings.HasPrefix(rqu, "/jypay/invoice/submit") || //发票信息提交
 		strings.HasPrefix(rqu, "/jypay/invoice/query") || //发票信息查询
+		strings.HasPrefix(rqu, "/jypay/invoice/newReplace") || //扫码换票
 		rqu == "/jypay/wx/getwxSdkSign" ||
 		rqu == "/jypay/user/company/association" || rqu == "/jypay/getDomain" { //微信js调用参数
 		return true

+ 1 - 1
src/jfw/modules/subscribepay/src/go.mod

@@ -12,6 +12,7 @@ require (
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 	github.com/SKatiyar/qr v0.0.0-20151201054752-25b6bdf44e67
 	github.com/gogf/gf/v2 v2.7.0
+	github.com/google/uuid v1.6.0
 	github.com/shopspring/decimal v1.3.1
 	github.com/tealeg/xlsx v1.0.5
 	go.mongodb.org/mongo-driver v1.14.0
@@ -56,7 +57,6 @@ require (
 	github.com/google/gnostic-models v0.6.8 // indirect
 	github.com/google/go-cmp v0.6.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
-	github.com/google/uuid v1.6.0 // indirect
 	github.com/gorilla/websocket v1.5.0 // indirect
 	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect

+ 10 - 2
src/jfw/modules/subscribepay/src/invoice.json

@@ -10,7 +10,15 @@
     "time":"2022-01-17 10:00:00"
   },
   "invoice_switch": true,
-  "red_invoice_switch": false,
+  "red_invoice_switch": true,
   "red_invoice_msg": "由于系统升级,线上换开发票功能暂时维护阶段,如需换开请直接联系在线客服!",
-  "third_party_switch": false
+  "third_party_switch": true,
+  "order_createtime": 1704038400,
+  "submit_num": 3,
+  "signing_Subject":"北京剑鱼信息技术有限公司",
+  "invoice_type": {
+    "电子普通发票": true,
+    "电子专用发票": true,
+    "普通发票(电子发票)": true
+  }
 }

+ 1 - 1
src/jfw/modules/subscribepay/src/mailtemplate.html

@@ -54,6 +54,6 @@
             </p>
             <p class="item">
                 <span class="label">发票内容:</span>
-                <span class="value">信息技术服务-技术服务费</span>
+                <span class="value">%s</span>
             </p>
             %s

+ 613 - 161
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -13,6 +13,7 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/google/uuid"
 	"io/ioutil"
 	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/util"
@@ -26,16 +27,20 @@ import (
 
 type Invoice struct {
 	*xweb.Action
-	addinvoice      xweb.Mapper `xweb:"/invoice/add"`       //开发票
-	showinvoice     xweb.Mapper `xweb:"/invoice/show"`      //查看发票
-	callbackinvoice xweb.Mapper `xweb:"/invoice/callback"`  //开发票回调
-	replaceinvoice  xweb.Mapper `xweb:"/invoice/replace"`   //换发票
-	refundinvoice   xweb.Mapper `xweb:"/invoice/refund"`    //退票
-	invoiceinfo     xweb.Mapper `xweb:"/invoice/info"`      //订单详情数据
-	available       xweb.Mapper `xweb:"/invoice/available"` //是否可用开发票
-	invoiceswitch   xweb.Mapper `xweb:"/invoice/switch"`    //发票开关
-	invoiceQuery    xweb.Mapper `xweb:"/invoice/query"`     //发票信息查询
-	invoiceSubmit   xweb.Mapper `xweb:"/invoice/submit"`    //发票信息提交
+	addinvoice        xweb.Mapper `xweb:"/invoice/add"`            //开发票
+	showinvoice       xweb.Mapper `xweb:"/invoice/show"`           //查看发票
+	newInvoiceShow    xweb.Mapper `xweb:"/invoice/newShow"`        //查看发票
+	showinvoiceList   xweb.Mapper `xweb:"/invoice/showList"`       //新查看发票 p537
+	callbackinvoice   xweb.Mapper `xweb:"/invoice/callback"`       //开发票回调
+	replaceinvoice    xweb.Mapper `xweb:"/invoice/replace"`        //换发票
+	newReplaceinvoice xweb.Mapper `xweb:"/invoice/newReplace"`     //新换发票
+	refundinvoice     xweb.Mapper `xweb:"/invoice/refund"`         //退票
+	invoiceinfo       xweb.Mapper `xweb:"/invoice/info"`           //订单详情数据
+	available         xweb.Mapper `xweb:"/invoice/available"`      //是否可用开发票
+	invoiceswitch     xweb.Mapper `xweb:"/invoice/switch"`         //发票开关
+	invoiceQuery      xweb.Mapper `xweb:"/invoice/query"`          //发票信息查询
+	invoiceSubmit     xweb.Mapper `xweb:"/invoice/submit"`         //发票信息提交
+	getCompanyCode    xweb.Mapper `xweb:"/invoice/getCompanyCode"` //开票联想税号
 }
 
 var dbname = "invoice"
@@ -180,6 +185,7 @@ func (this *Invoice) Invoiceswitch() {
 	}
 }
 
+// Addinvoice 用户端-线上开票只能选电子普票
 func (this *Invoice) Addinvoice() error {
 	defer qutil.Catch()
 	userId := qutil.ObjToString(this.GetSession("userId"))
@@ -201,19 +207,15 @@ func (this *Invoice) Addinvoice() error {
 		pos := qutil.IntAllDef(last, 0)
 		locks[pos].Lock()
 		defer locks[pos].Unlock()
-		u := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": order_code, "user_id": userId, "applyBill_status": map[string]interface{}{"ne": 2}}, "order_money,product_type,order_channel,pay_way,pay_money,is_backstage_order,billingMode", "")
+		u := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": order_code, "user_id": userId, "applyBill_status": map[string]interface{}{"ne": 2}}, "order_money,product_type,pay_way,pay_money,is_backstage_order,billingMode,signing_subject,return_status,applybill_status", "")
 		if u != nil {
 			//后端代用户下单支持开票 order_channel = xdqd04
-			if qutil.IntAll((*u)["billingMode"]) == 1 && (qutil.IntAll((*u)["is_backstage_order"]) != 1 || qutil.InterfaceToStr((*u)["order_channel"]) == "xdqd04") {
+			if qutil.IntAll((*u)["billingMode"]) == 1 && (qutil.IntAll((*u)["is_backstage_order"]) != 1 || (qutil.IntAll((*u)["is_backstage_order"]) == 1 && qutil.ObjToString((*u)["signing_subject"]) == "h01" && qutil.IntAll((*u)["return_status"]) == 1 && qutil.IntAll((*u)["applybill_status"]) == 0)) {
 				var prices float64
 				//公对公转账 账单金额可以修改 开发票应取实付金额 pay_money
 				//微信支付宝支付 pay_money为订单金额减去微信or支付包红包
-				if qutil.ObjToString((*u)["pay_way"]) == "transferAccounts" {
-					prices = qutil.Float64All((*u)["pay_money"]) // float64(100)
-				} else {
-					prices = qutil.Float64All((*u)["order_money"]) // float64(100)
-				}
-				//price = strconv.FormatFloat(prices, 'f', -1, 64)
+				prices = qutil.Float64All((*u)["pay_money"]) / float64(100)
+				price = strconv.FormatFloat(prices, 'f', -1, 64)
 				product_name = (*u)["product_type"].(string)
 				applyBill_status = 1
 				data := make(map[string]interface{})
@@ -242,7 +244,7 @@ func (this *Invoice) Addinvoice() error {
 				data["create_time"] = time.Now().Unix()
 				data["user_id"] = userId
 				data["invoice_status"] = 0
-				data["invoice_money"] = prices
+				data["invoice_money"] = price
 				var orders = []map[string]interface{}{}
 				var items = []map[string]interface{}{}
 				item := map[string]interface{}{
@@ -251,7 +253,7 @@ func (this *Invoice) Addinvoice() error {
 					"yhzcbs":      config.InvoiceConfig.Tax_policy,
 					"lineType":    config.InvoiceConfig.Invoice_nature,
 					"taxRate":     config.InvoiceConfig.Tax_rate,
-					"taxPrice":    price, // 不再使用
+					"taxPrice":    price,
 					"totalAmount": price,
 					"quantity":    "1",
 				}
@@ -440,6 +442,106 @@ func (this *Invoice) Showinvoice() {
 
 }
 
+// 查看发票
+func (this *Invoice) ShowinvoiceList() {
+	order_code := this.GetString("order_code")
+	//红冲发票开关
+	redSwitchInfo := map[string]interface{}{
+		"ris": config.InvoiceConfig.Red_invoice_switch,
+		"rim": config.InvoiceConfig.Red_invoice_msg,
+	}
+	invoices := ShowList(order_code)
+	if invoices != nil && len(invoices) > 0 {
+		isIos := util.IsMobileIOS(this.Request.UserAgent())
+		var invoiceData []map[string]interface{}
+		for _, data := range invoices {
+			//是否换过票
+			isChanged := qutil.IntAll(data["isChanged"]) > 1
+			if isChanged && qutil.IntAll(data["invoice_changed"]) == 0 { //换过票的 只展示换票后的数据
+				continue
+			}
+			delete(data, "user_id")
+			data["id"] = encrypt.SE.Encode2Hex(qutil.InterfaceToStr(data["id"]))
+			timeLimit := qutil.Int64All(data["create_time"]) <= config.InvoiceConfig.Order_createtime                                //24年之前的发票不让换票
+			isJyInvoice := !(qutil.InterfaceToStr(data["invoice_number"]) != "" && qutil.InterfaceToStr(data["invoice_code"]) == "") //非数电票
+			isJyEntity := data["invoicing_entity"] != nil && qutil.InterfaceToStr(data["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
+			data["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
+			//if url := qutil.InterfaceToStr(data["url"]); url != "" {
+			//ios 移动端
+			if !isIos {
+				data["url"] = qutil.If(data["source_url"] != nil && qutil.ObjToString(data["source_url"]) != "", data["source_url"], data["url"])
+				//国家税务局-增值税电子发票公共服务平台
+				//if strings.Contains(url, "tysl.beijing.chinatax") {
+				//	data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
+				//}
+			}
+			//}
+			isReopen := timeLimit
+			//var isReopen bool
+			if qutil.IntAll(data["invoice_status"]) == -1 && !isReopen {
+				isReopen = util.Mysql.Count("invoice_fail_record", map[string]interface{}{
+					"only_Identifying": data["only_Identifying"],
+					"order_code":       order_code,
+				})+1 >= config.InvoiceConfig.SubmitNum
+			}
+			data["only_Identifying"] = encrypt.SE.EncodeString(qutil.InterfaceToStr(data["only_Identifying"]))
+			data["isReopen"] = isReopen
+			invoiceData = append(invoiceData, data)
+		}
+		this.ServeJson(map[string]interface{}{
+			"status":        "success",
+			"invoiceData":   invoiceData,
+			"redSwitchInfo": redSwitchInfo,
+		})
+	} else {
+		data := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
+			"order_code": order_code,
+		}, "order_status,applybill_status,order_code,user_mail,applybill_type,applybill_company,user_phone,applybill_taxnum", "")
+		if data != nil {
+			(*data)["status"] = "fail"
+		}
+
+		this.ServeJson(map[string]interface{}{
+			"status":        "fail",
+			"orderData":     data,
+			"redSwitchInfo": redSwitchInfo,
+		})
+	}
+}
+
+func ShowList(order_code string) []map[string]interface{} {
+	data := util.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
+  SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and  b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
+) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety is not null and invoice_variety not  LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
+	if data == nil {
+		return nil
+	}
+	return *data
+}
+
+func (this *Invoice) NewInvoiceShow() {
+	stype := this.GetString("stype")
+	code := this.GetString("code")
+	data := make(map[string]interface{})
+	switch stype {
+	case "1": //订单回显金额
+		data["pay_money"] = ResidueMoney(code)
+	case "2": //发票信息回显
+		invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": encrypt.SE.Decode4Hex(code)}, "id,only_Identifying,order_code,invoice_order_code,invoice_money,remark,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
+		if invoice != nil {
+			(*invoice)["id"] = code
+			if (*invoice)["invoice_order_code"] != nil {
+				(*invoice)["order_code"] = (*invoice)["invoice_order_code"]
+			}
+			(*invoice)["only_Identifying"] = encrypt.SE.EncodeString(qutil.InterfaceToStr((*invoice)["only_Identifying"]))
+		}
+		data["invoice"] = invoice
+	}
+	this.ServeJson(map[string]interface{}{
+		"data": data,
+	})
+}
+
 // 开发票回调
 func (this *Invoice) Callbackinvoice() {
 	isRed, _ := this.GetBool("isRed")
@@ -1003,6 +1105,180 @@ func (this *Invoice) Replaceinvoice() {
 
 }
 
+// 新换票
+func (this *Invoice) NewReplaceinvoice() {
+	//红冲开关
+	if !config.InvoiceConfig.Red_invoice_switch {
+		this.ServeJson(map[string]interface{}{
+			"invoice_status": -1,
+			"invoice_msg":    config.InvoiceConfig.Red_invoice_msg,
+		})
+		return
+	}
+	invoice_type := this.GetString("invoice_type")
+	phone := this.GetString("phone")
+	e_mail := this.GetString("mail")
+	company_name := this.GetString("company_name")
+	id_num := strings.ToUpper(this.GetString("taxpayer_identnum")) //纳税人识别号
+	invoiceContent := this.GetString("invoiceContent")
+	remark := this.GetString("remark")
+	invoiceVariety := this.GetString("invoice_variety")
+	invoice_status := 0
+	//userId := qutil.ObjToString(this.GetSession("userId"))  支持扫描换票
+	//order_code := this.GetString("order_code")
+	sid := encrypt.SE.Decode4Hex(this.GetString("sid"))
+	oRes := util.Mysql.FindOne(dbname, map[string]interface{}{"id": sid, "invoice_changed": 0, "invoice_status": 1}, "", "") //仅线上开发票可换票
+	if oRes != nil && len(*oRes) > 0 &&
+		((*oRes)["invoicing_entity"] == nil || qutil.InterfaceToStr((*oRes)["invoicing_entity"]) == config.InvoiceConfig.SigningSubject) {
+		var (
+			qSql    string
+			errCode []string
+			//saveData []map[string]interface{}
+			resArr []map[string]interface{}
+		)
+		pCode := qutil.InterfaceToStr((*oRes)["order_code"])
+		//多订单联合开票
+		if invoice_order_code := qutil.InterfaceToStr((*oRes)["invoice_order_code"]); len(strings.Split(invoice_order_code, ",")) > 1 {
+			pCode = invoice_order_code
+			qSql = fmt.Sprintf(`SELECT * FROM invoice WHERE invoice_order_code = '%s' and invoice_changed = 0 and invoice_status = 1`, qutil.InterfaceToStr((*oRes)["invoice_order_code"]))
+			res1 := util.Mysql.SelectBySql(qSql)
+			if res1 != nil && len(*res1) > 0 {
+				resArr = *res1
+			}
+		} else {
+			resArr = append(resArr, *oRes)
+		}
+		var isMail bool
+		tm := time.Now()
+		for _, res := range resArr {
+			if res["only_Identifying"] == nil { //无唯一id 允许换票一次 生成唯一id
+				newUuid := uuid.New()
+				res["only_Identifying"] = newUuid
+				util.Mysql.Update(dbname, map[string]interface{}{"id": res["id"]}, map[string]interface{}{"only_Identifying": newUuid})
+			} else if util.Mysql.Count(dbname, map[string]interface{}{
+				"order_code":       res["order_code"],
+				"user_id":          res["user_id"],
+				"only_Identifying": res["only_Identifying"],
+			}) > 1 {
+				continue
+			}
+
+			res["company_phone"] = this.GetString("company_phone")
+			res["operable_time"] = FormatDate(&tm, Date_Full_Layout)
+			res["bank_account"] = this.GetString("bank_account")
+			res["company_address"] = this.GetString("company_address")
+			res["bank_name"] = this.GetString("bank_name")
+			res["recipient"] = this.GetString("recipient")
+			res["delivery_address"] = this.GetString("delivery_address")
+			data := res
+			delete(data, "id")
+			switch IsEdit(res, phone, e_mail, id_num, company_name, invoice_type, invoiceContent, remark, invoiceVariety) {
+			case true:
+				data["phone"] = phone
+				data["mail"] = e_mail
+				data["invoice_content"] = invoiceContent
+				data["company_name"] = company_name
+				data["invoice_type"] = invoice_type
+				data["taxpayer_identnum"] = id_num
+				data["remark"] = remark
+				data["invoice_variety"] = invoiceVariety
+				//var html string
+				//if invoice_type == "个人" {
+				//	emailHtml := emailHtml_gr
+				//	emailHtmls := fmt.Sprintf(emailHtml, phone, e_mail)
+				//	html = fmt.Sprintf(email_format, data["order_code"], data["url"], emailHtmls)
+				//} else {
+				//	emailHtml := emailHtml_gs
+				//	emailHtmls := fmt.Sprintf(emailHtml, company_name, id_num, phone, e_mail)
+				//	html = fmt.Sprintf(email_format, data["order_code"], data["url"], emailHtmls)
+				//}
+				data["invoice_changed"] = 1
+				data["invoice_status"] = 1
+				data["billing_time"] = tm.Unix()
+				data["create_time"] = tm.Unix()
+				order_id := util.Mysql.Insert(dbname, data)
+				if order_id == -1 {
+					errCode = append(errCode, fmt.Sprintf("%s_%s", data["order_code"], data["invoice_order_code"]))
+				}
+				if !isMail { //成功发邮件
+					isMail = true
+					sendMail(invoice_type, pCode, company_name, id_num, e_mail, phone, qutil.InterfaceToStr(data["source_url"]), invoiceContent)
+					//InvoiceSendMail(data["mail"].(string), html, "电子发票")
+				}
+			case false:
+				if !config.InvoiceConfig.Third_party_switch {
+					this.ServeJson(map[string]interface{}{
+						"error_code": -2,
+						"error_msg":  "暂不支持换票",
+					})
+					return
+				}
+				data["phone"] = phone
+				data["mail"] = e_mail
+				data["invoice_content"] = invoiceContent
+				data["company_name"] = company_name
+				data["invoice_type"] = invoice_type
+				data["taxpayer_identnum"] = id_num
+				data["remark"] = remark
+				data["invoice_variety"] = invoiceVariety
+				dataexport_data := make(map[string]interface{})
+				if invoice_type == "个人" {
+					dataexport_data["applyBill_type"] = 0
+					dataexport_data["applyBill_taxnum"] = ""
+					dataexport_data["applybill_company"] = ""
+				} else {
+					dataexport_data["applyBill_type"] = 1
+					dataexport_data["applyBill_taxnum"] = id_num
+					dataexport_data["applybill_company"] = company_name
+				}
+				dataexport_data["user_mail"] = e_mail
+				util.Mysql.Update("dataexport_order", map[string]interface{}{"order_code": res["order_code"]}, dataexport_data)
+				data["mail"] = e_mail
+				data["phone"] = phone
+				data["invoice_type"] = invoice_type
+				data["company_name"] = company_name
+				data["taxpayer_identnum"] = id_num
+				data["invoice_changed"] = 1
+				data["create_time"] = time.Now().Unix()
+				data["invoice_status"] = invoice_status
+				order_id := util.Mysql.Insert(dbname, data)
+				if order_id == -1 {
+					errCode = append(errCode, fmt.Sprintf("%s_%s", data["order_code"], data["invoice_order_code"]))
+				}
+			}
+		}
+		log.Println("换票错误信息:", errCode)
+		this.ServeJson(map[string]interface{}{
+			"error_code": 0,
+			"error_msg":  "",
+		})
+
+	} else {
+		this.ServeJson(map[string]interface{}{
+			"error_code": -1,
+			"error_msg":  "订单状态异常",
+		})
+		return
+	}
+
+}
+
+func IsEdit(res map[string]interface{}, phone, e_mail, id_num, company_name, invoice_type, invoiceContent, remark, invoiceVariety string) bool {
+	if invoice_type == "个人" {
+		if phone == res["phone"] && e_mail == res["mail"] && res["invoice_type"] == "个人" &&
+			res["invoice_content"] == invoiceContent && res["remark"] == remark && res["invoice_variety"] == invoiceVariety {
+			return true
+		}
+	} else {
+		if phone == res["phone"] && e_mail == res["mail"] && id_num == res["taxpayer_identnum"] &&
+			company_name == res["company_name"] && res["invoice_type"] == "单位" &&
+			res["invoice_content"] == invoiceContent && res["remark"] == remark && res["invoice_variety"] == invoiceVariety {
+			return true
+		}
+	}
+	return false
+}
+
 // 退票
 func (this *Invoice) Refundinvoice() {
 	if !config.InvoiceConfig.Third_party_switch {
@@ -1077,6 +1353,15 @@ func (this *Invoice) Invoiceinfo() {
 		}
 		delete((*status), "d_relation_id")
 		(*status)["countdown"] = countdowntime
+		var isCanInvoic bool
+		create_time, _ := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*status)["create_time"]), time.Local)
+		if create_time.Unix() > config.InvoiceConfig.Order_createtime {
+			//剩余可开票金额
+			isCanInvoic = IsAllowInvoice(*status)
+		}
+		(*status)["is_can_invoice"] = isCanInvoic
+		//是否存在可查看发票
+		(*status)["invoice_show"] = len(ShowList(order_code)) > 0
 		this.ServeJson(map[string]interface{}{
 			"status": "success",
 			"data":   status,
@@ -1114,6 +1399,30 @@ func LastInvoiceSource(orderCode string) int64 {
 	}
 	return 0
 }
+
+// 是否可开票
+func IsAllowInvoice(res map[string]interface{}) bool {
+	if qutil.IntAll(res["applybill_status"]) > 0 {
+		return false
+	}
+	if qutil.Float64All(res["pay_money"]) == 0 {
+		return false
+	}
+	filter := qutil.ObjToString(res["filter"].(string))
+	filter_map := map[string]interface{}{}
+	_ = json.Unmarshal([]byte(filter), &filter_map)
+	if qutil.IntAll(res["order_status"]) == 1 && qutil.InterfaceToStr(filter_map["badge"]) != "exchange" {
+		//用户下单|| 代用户下单
+		if qutil.IntAll(res["is_backstage_order"]) == 0 || qutil.InterfaceToStr(res["order_channel"]) == "xdqd04" {
+			return len(ShowList(qutil.InterfaceToStr(res["order_code"]))) == 0
+		} else { //qmx下单 已全额回款 发票企业为剑鱼
+			return qutil.IntAll(res["return_status"]) == 1 && qutil.InterfaceToStr(res["signing_subject"]) == "h01" &&
+				len(ShowList(qutil.InterfaceToStr(res["order_code"]))) == 0
+		}
+	}
+	return false
+}
+
 func (this *Invoice) Available() {
 	u := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": this.GetString("order_code")}, "pay_time", "")
 	status := 0
@@ -1134,6 +1443,8 @@ func (this *Invoice) Available() {
 					status = 1
 				}
 			}
+		} else {
+			status = 1
 		}
 	}
 	this.ServeJson(map[string]interface{}{
@@ -1150,22 +1461,182 @@ func delReplaceInvoice(query map[string]interface{}) bool {
 	return util.Mysql.Delete(dbname, query)
 }
 
-// 发票信息提交
+func InvoiceAmount(orderCode string) (invoicedMoney int64) {
+	invoicedInfo := util.Mysql.SelectBySql(fmt.Sprintf("SELECT invoice_order_money,only_Identifying FROM invoice WHERE order_code = '%s' and invoice_status>=0", orderCode))
+	if invoicedInfo != nil && len(*invoicedInfo) > 0 {
+		onlyMap := make(map[string]int64)
+		for _, m := range *invoicedInfo {
+			if m["only_Identifying"] != nil { //过滤换票过程中的数据
+				onlyMap[qutil.InterfaceToStr(m["only_Identifying"])] = qutil.Int64All(m["invoice_order_money"])
+			} else {
+				invoicedMoney += qutil.Int64All(m["invoice_order_money"])
+			}
+		}
+		if len(onlyMap) > 0 {
+			for _, i := range onlyMap {
+				invoicedMoney += i
+			}
+		}
+	}
+	return
+}
+
+// InvoiceSubmit 发票信息提交
 func (this *Invoice) InvoiceSubmit() {
+	if !R.CheckReqParam(this.ResponseWriter, this.Request, "invoice_variety", "invoiceContent", "invoice_type", "phone", "mail") {
+		this.ServeJson(NewResult("", errors.New("缺少参数")))
+		return
+	}
+	if this.GetString("invoice_type") == "单位" && !R.CheckReqParam(this.ResponseWriter, this.Request, "company_name", "taxpayer_identnum") {
+		this.ServeJson(NewResult("", errors.New("缺少参数")))
+		return
+	}
+	if !config.InvoiceConfig.Invoice_type[this.GetString("invoice_variety")] {
+		this.ServeJson(NewResult("", errors.New("发票类型有误")))
+		return
+	}
+	if this.GetString("invoice_type") != "个人" && this.GetString("invoice_type") != "单位" {
+		this.ServeJson(NewResult("", errors.New("发票抬头有误")))
+		return
+	}
 	now := time.Now()
-	onlyIdentifying := encrypt.SE.DecodeString(this.GetString("onlyIdentifying"))
-	invoiceMoney := encrypt.SE.DecodeString(this.GetString("invoiceMoney"))
-	operator := encrypt.SE.Decode4HexByCheck(this.GetString("operator"))
-	if onlyIdentifying == "" || invoiceMoney == "" {
-		this.ServeJson(NewResult("", errors.New("传入参数不正确")))
+	again, _ := this.GetInteger("again")                                                //是否是失败重新开票 0 首次提交  1 再此提交
+	oldOnlyIdentifying := encrypt.SE.DecodeString(this.GetString("oldOnlyIdentifying")) //最后一次失败的发票信息唯一标识
+	data := map[string]interface{}{
+		"company_name":      this.GetString("company_name"),
+		"phone":             this.GetString("phone"),
+		"mail":              this.GetString("mail"),
+		"invoice_type":      this.GetString("invoice_type"),
+		"invoice_content":   this.GetString("invoiceContent"),
+		"invoice_status":    0,
+		"invoice_changed":   0,
+		"company_phone":     this.GetString("company_phone"),
+		"taxpayer_identnum": this.GetString("taxpayer_identnum"),
+		"create_time":       time.Now().Unix(),
+		"operable_time":     FormatDate(&now, Date_Full_Layout),
+		"invoicing_entity":  "北京剑鱼信息技术有限公司",
+		"remark":            this.GetString("remark"),
+		"invoice_variety":   this.GetString("invoice_variety"),
+		"bank_account":      this.GetString("bank_account"),
+		"company_address":   this.GetString("company_address"),
+		"bank_name":         this.GetString("bank_name"),
+		"recipient":         this.GetString("recipient"),
+		"delivery_address":  this.GetString("delivery_address"),
+	}
+	if again == 1 {
+		err := OpenInvoiceAgain(oldOnlyIdentifying, data)
+		if err != nil {
+			this.ServeJson(NewResult("", err))
+			return
+		}
+		this.ServeJson(NewResult("保存信息成功", nil))
 		return
 	}
-	data := util.Mysql.FindOne("invoice", map[string]interface{}{
+	source, _ := this.GetInteger("source")
+	switch source {
+	case 0: //用户端开票
+		userId := qutil.ObjToString(this.GetSession("userId"))
+		if userId == "" {
+			this.ServeJson(NewResult("", errors.New("userId为空")))
+			return
+		}
+		orderCode := this.GetString("order_code")
+		err := JyOpenInvoice(orderCode, userId, data)
+		if err != nil {
+			this.ServeJson(NewResult("", err))
+			return
+		}
+	case 1: //管理后台扫码开票
+		onlyIdentifying := encrypt.SE.DecodeString(this.GetString("onlyIdentifying"))
+		invoiceMoney := encrypt.SE.DecodeString(this.GetString("invoiceMoney"))
+		operator := encrypt.SE.Decode4HexByCheck(this.GetString("operator"))
+		if onlyIdentifying == "" || invoiceMoney == "" {
+			this.ServeJson(NewResult("", errors.New("传入参数不正确")))
+			return
+		}
+		err := AdminOpenInvoice(onlyIdentifying, invoiceMoney, operator, data)
+		if err != nil {
+			this.ServeJson(NewResult("", err))
+			return
+		}
+	}
+	this.ServeJson(NewResult("保存信息成功", nil))
+}
+
+func OpenInvoiceAgain(oldOnlyIdentifying string, data map[string]interface{}) error {
+	if oldOnlyIdentifying == "" {
+		return errors.New("缺少关键参数")
+	}
+	if util.Mysql.Count("invoice_fail_record", map[string]interface{}{"only_Identifying": oldOnlyIdentifying}) >= config.InvoiceConfig.SubmitNum {
+		return errors.New("提交次数已达上限")
+	}
+	ok := InvoiceFailRecord(oldOnlyIdentifying)
+	if !ok {
+		return errors.New("插入失败记录出错")
+	}
+	delete(data, "invoice_changed")
+	if !util.Mysql.Update("invoice", map[string]interface{}{"only_Identifying": oldOnlyIdentifying, "invoice_status": -1}, data) {
+		return errors.New("再次开票更新发票信息出错")
+	}
+	return nil
+}
+
+func JyOpenInvoice(orderCode, userId string, data map[string]interface{}) error {
+	onlyIdentifying := fmt.Sprintf("%s%s%s", "aa", time.Now().Format("150405"), qutil.GetRandom(4))
+	orderInfo := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": orderCode}, "product_type,user_mail,pay_money,create_time,signing_subject,applybill_status", "")
+	if orderInfo == nil {
+		return errors.New("订单不存在")
+	}
+	createTime, _ := time.ParseInLocation("2006-01-02 15:04:05", qutil.ObjToString((*orderInfo)["create_time"]), time.Local)
+	if createTime.Unix() < config.InvoiceConfig.Order_createtime {
+		return errors.New("2024年之前的订单不在开票")
+	}
+	if qutil.ObjToString((*orderInfo)["signing_subject"]) == "h02" {
+		return errors.New("签约主体为拓普")
+	}
+	/*if qutil.IntAll((*orderInfo)["applybill_status"]) != 0 {
+		return errors.New("已提交发票信息")
+	}*/
+	invoicedMoney := InvoiceAmount(orderCode) //已开票金额
+	invoiceMoney := qutil.Int64All((*orderInfo)["pay_money"]) - invoicedMoney
+	data["order_code"] = orderCode
+	data["invoice_order_code"] = orderCode
+	data["only_Identifying"] = onlyIdentifying
+	data["invoice_money"] = invoiceMoney
+	data["invoice_order_money"] = invoiceMoney
+	data["product_type"] = qutil.ObjToString((*orderInfo)["product_type"])
+	data["user_id"] = userId
+	data["source"] = 0
+	if !util.Mysql.ExecTx("用户端开发票", func(tx *sql.Tx) bool {
+		if util.Mysql.InsertByTx(tx, "invoice", data) <= 0 {
+			log.Println("插入invoice出错", orderCode)
+			return false
+		}
+		if !util.Mysql.UpdateByTx(tx, "dataexport_order", map[string]interface{}{
+			"order_code": orderCode,
+		}, map[string]interface{}{
+			"applybill_status": 1,
+		}) {
+			log.Println("更新dataexport_order出错", orderCode)
+			return false
+		}
+		return true
+	}) {
+		return errors.New("用户端开票插入数据出错")
+	}
+	return nil
+}
+
+func AdminOpenInvoice(onlyIdentifying, invoiceMoney, operator string, data map[string]interface{}) error {
+	//二维码
+	path := "/front/invoiceScan/qr"
+	urlStr := fmt.Sprintf("onlyIdentifying=%s&invoiceMoney=%s&operator=%s", encrypt.SE.EncodeString(onlyIdentifying), encrypt.SE.EncodeString(invoiceMoney), encrypt.SE.Encode2HexByCheck(operator))
+	fullUrl := path + "?" + urlStr
+	oldData := util.Mysql.FindOne("invoice", map[string]interface{}{
 		"only_Identifying": onlyIdentifying,
 	}, "id", "")
-	if data != nil {
-		this.ServeJson(NewResult("", errors.New("该订单发票信息已经提交过申请")))
-		return
+	if oldData != nil {
+		return errors.New("该订单发票信息已经提交过申请")
 	}
 	orderArr := []string{}
 	mailOrderArr := []string{}
@@ -1184,49 +1655,33 @@ func (this *Invoice) InvoiceSubmit() {
 	//提交时订单金额再做一次校验
 	for orderCode, money := range orderMap {
 		if ResidueMoney(orderCode) < qutil.Int64All(money) {
-			this.ServeJson(NewResult("", errors.New("该订单发票信息已经提交过申请")))
-			return
+			return errors.New("该订单发票信息已经提交过申请")
 		}
 	}
 	if !util.Mysql.ExecTx("发票信息保存", func(tx *sql.Tx) bool {
 		for orderCode, money := range orderMap {
-			userId := GetUserId(orderCode)
-			orderInfo := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": orderCode}, "product_type,user_mail", "")
+			orderInfo := util.Mysql.FindOne("dataexport_order", map[string]interface{}{"order_code": orderCode}, "product_type,user_mail,user_id,create_time", "")
 			productType := ""
 			if orderInfo != nil {
 				productType = qutil.InterfaceToStr((*orderInfo)["product_type"])
 			}
-			data := map[string]interface{}{
-				"order_code":          orderCode,
-				"company_name":        this.GetString("company_name"),
-				"phone":               this.GetString("phone"),
-				"mail":                this.GetString("mail"),
-				"invoice_type":        this.GetString("invoice_type"),
-				"invoice_content":     "信息技术服务-技术服务费",
-				"invoice_status":      0,
-				"invoice_changed":     0,
-				"invoice_order_code":  strings.Join(orderArr, ","),
-				"company_phone":       this.GetString("company_phone"),
-				"taxpayer_identnum":   this.GetString("taxpayer_identnum"),
-				"create_time":         time.Now().Unix(),
-				"user_id":             userId,
-				"operator":            operator,
-				"operable_time":       FormatDate(&now, Date_Full_Layout),
-				"invoice_money":       Allmoney,
-				"invoice_order_money": money,
-				"invoicing_entity":    "北京剑鱼信息技术有限公司",
-				"remark":              this.GetString("remark"),
-				"source":              1,
-				"invoice_variety":     this.GetString("invoice_variety"),
-				"bank_account":        this.GetString("bank_account"),
-				"only_Identifying":    onlyIdentifying,
-				"company_address":     this.GetString("company_address"),
-				"bank_name":           this.GetString("bank_name"),
-				"recipient":           this.GetString("recipient"),
-				"delivery_address":    this.GetString("delivery_address"),
-				"product_type":        productType,
+			createTime, _ := time.ParseInLocation("2006-01-02 15:04:05", qutil.ObjToString((*orderInfo)["create_time"]), time.Local)
+			if createTime.Unix() < config.InvoiceConfig.Order_createtime {
+				log.Println("2024年之前的订单不在开票", orderCode)
+				return false
 			}
+			data["order_code"] = orderCode
+			data["invoice_order_code"] = strings.Join(orderArr, ",")
+			data["only_Identifying"] = onlyIdentifying
+			data["invoice_money"] = Allmoney
+			data["invoice_order_money"] = money
+			data["product_type"] = productType
+			data["user_id"] = qutil.ObjToString((*orderInfo)["user_id"])
+			data["operator"] = operator
+			data["source"] = 1
+			data["code_url"] = fullUrl
 			if util.Mysql.Insert("invoice", data) <= 0 {
+				log.Println("扫码开票插入invoice表出错", orderCode)
 				return false
 			}
 			//订单发票状态改成已申请
@@ -1235,85 +1690,48 @@ func (this *Invoice) InvoiceSubmit() {
 			}, map[string]interface{}{
 				"applybill_status": 1,
 			}) {
+				log.Println("扫码开票更新dataexport_order表出错", orderCode)
 				return false
 			}
 		}
-		if this.GetString("invoice_variety") == "电子普通发票" && Allmoney < 1000000 {
-			//走航天金税开票
-			var orders = []map[string]interface{}{}
-			var items = []map[string]interface{}{}
-			prices := qutil.Float64All(Allmoney) / float64(100)
-			price := strconv.FormatFloat(prices, 'f', -1, 64)
-			item := map[string]interface{}{
-				"name":        "技术服务费",
-				"code":        config.InvoiceConfig.Code,
-				"yhzcbs":      config.InvoiceConfig.Tax_policy,
-				"lineType":    config.InvoiceConfig.Invoice_nature,
-				"taxRate":     config.InvoiceConfig.Tax_rate,
-				"taxPrice":    price,
-				"totalAmount": price,
-				"quantity":    "1",
-			}
-			items = append(items, item)
-			order := map[string]interface{}{
-				"billNo": onlyIdentifying,
-				"items":  items,
-			}
-			orders = append(orders, order)
-			body := map[string]interface{}{
-				"Swno":      onlyIdentifying,
-				"custType":  "03",
-				"orders":    orders,
-				"custTaxNo": this.GetString("taxpayer_identnum"),
-				"changed":   "0",
-				"phone":     this.GetString("phone"),
-			}
-			if this.GetString("invoice_type") == "单位" {
-				body["custName"] = this.GetString("company_name")
-			} else {
-				body["custName"] = "个人"
-			}
-			if config.InvoiceConfig.Third_party_switch {
-				go htjs(body, orderArr, this.GetString("invoice_type"), this.GetString("company_name"), this.GetString("taxpayer_identnum"), this.GetString("mail"), this.GetString("phone"))
-			}
-		} else {
-			//给王航发信息
-			recipientStr := ""
-			deliveryAddressStr := ""
-			if this.GetString("invoice_variety") == "纸质普通发票" || this.GetString("invoice_variety") == "纸质专用发票" {
-				recipientStr = fmt.Sprintf("<p class=\"item\">\n      <span class=\"label\">收件人:</span>\n      <span class=\"value\">%s</span>\n    </p>", this.GetString("recipient"))
-				deliveryAddressStr = fmt.Sprintf("<p class=\"item\">\n      <span class=\"label\">收件地址:</span>\n      <span class=\"value\">%s</span>\n    </p>", this.GetString("delivery_address"))
-			}
-			prices := qutil.Float64All(Allmoney) / float64(100)
-			price := strconv.FormatFloat(prices, 'f', -1, 64)
-			html := fmt.Sprintf(email_format_new,
-				FormatDate(&now, Date_Full_Layout),
-				strings.Join(orderArr, ","),
-				strings.Join(mailOrderArr, ","),
-				price,
-				this.GetString("invoice_variety"),
-				qutil.InterfaceToStr(qutil.If(this.GetString("invoice_type") == "", "--", this.GetString("invoice_type"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("company_name") == "", "--", this.GetString("company_name"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("taxpayer_identnum") == "", "--", this.GetString("taxpayer_identnum"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("company_address") == "", "--", this.GetString("company_address"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("company_phone") == "", "--", this.GetString("company_phone"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("bank_name") == "", "--", this.GetString("bank_name"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("bank_account") == "", "--", this.GetString("bank_account"))),
-				qutil.InterfaceToStr(qutil.If(this.GetString("remark") == "", "--", this.GetString("remark"))),
-				recipientStr,
-				this.GetString("phone"),
-				deliveryAddressStr,
-			)
-			for _, v := range strings.Split(config.Config.FinanceMail, ",") {
-				go InvoiceSendMail(v, html, fmt.Sprintf("客户申请开具%s", this.GetString("invoice_variety")))
+		return true
+	}) {
+		return errors.New("发票信息保存失败")
+	}
+	return nil
+}
+
+func InvoiceFailRecord(oldOnlyIdentifying string) bool {
+	//开票失败再次提交
+	invoiceData := util.Mysql.Find("invoice", map[string]interface{}{"only_Identifying": oldOnlyIdentifying, "invoice_status": -1}, "", "", -1, -1)
+	if invoiceData == nil && len(*invoiceData) <= 0 {
+		log.Println("未找到开票记录", oldOnlyIdentifying)
+		return false
+	}
+	//插入开票失败记录表
+	ok := util.Mysql.ExecTx("插入开票失败记录表", func(tx *sql.Tx) bool {
+		for _, val := range *invoiceData {
+			delete(val, "id")
+			delete(val, "code_url")
+			if util.Mysql.InsertByTx(tx, "invoice_fail_record", val) <= 0 {
+				return false
 			}
 		}
 		return true
-	}) {
-		this.ServeJson(NewResult("", errors.New("发票信息保存失败")))
-		return
+	})
+	return ok
+}
+
+func (this *Invoice) GetCompanyCode() {
+	code := ""
+	companyInfo := util.Mysql.FindOne("entniche_info", map[string]interface{}{"name": this.GetString("companyName")}, "code", "")
+	if companyInfo != nil && len(*companyInfo) > 0 {
+		code = qutil.ObjToString((*companyInfo)["code"])
 	}
-	this.ServeJson(NewResult("保存信息成功", nil))
+	this.ServeJson(NewResult(map[string]interface{}{
+		"code": code,
+	}, nil))
+	return
 }
 
 // 发票信息查询
@@ -1334,7 +1752,7 @@ func (this *Invoice) InvoiceQuery() {
 	}
 	invoiceOne := util.Mysql.FindOne("invoice", map[string]interface{}{
 		"only_Identifying": onlyIdentifying,
-	}, " bank_account, company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,    operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address", "")
+	}, "id,invoice_changed,order_code, invoice_order_code,bank_account,invoice_code, create_time,invoice_number,company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address,only_Identifying", " create_time   DESC")
 	companyName := ""
 	if invoiceOne == nil {
 		//查询公司名称
@@ -1343,13 +1761,38 @@ func (this *Invoice) InvoiceQuery() {
 		if orderArr != nil && len(*orderArr) > 0 {
 			companyName = qutil.ObjToString((*orderArr)[0]["company_name"])
 		}
+	} else {
+		(*invoiceOne)["order_code"] = qutil.If((*invoiceOne)["invoice_order_code"] != nil, (*invoiceOne)["invoice_order_code"], (*invoiceOne)["order_code"])
+		(*invoiceOne)["id"] = encrypt.SE.Encode2Hex(qutil.InterfaceToStr((*invoiceOne)["id"]))
+		timeLimit := qutil.Int64All((*invoiceOne)["create_time"]) <= config.InvoiceConfig.Order_createtime //24年之前的发票不让换票
+		switch qutil.IntAll((*invoiceOne)["invoice_status"]) {
+		case 1:
+			isJyInvoice := !(qutil.InterfaceToStr((*invoiceOne)["invoice_number"]) != "" && qutil.InterfaceToStr((*invoiceOne)["invoice_code"]) == "") //非数电票
+			isJyEntity := (*invoiceOne)["invoicing_entity"] != nil && qutil.InterfaceToStr((*invoiceOne)["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
+			isChanged := util.Mysql.Count("invoice", map[string]interface{}{
+				"only_Identifying": onlyIdentifying,
+				"order_code":       (*invoiceOne)["order_code"],
+			}) > 1
+			(*invoiceOne)["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
+		case -1: //失败支持重新提交否
+			if !timeLimit {
+				(*invoiceOne)["isReopen"] = util.Mysql.Count("invoice_fail_record", map[string]interface{}{
+					"only_Identifying": onlyIdentifying,
+					"order_code":       (*invoiceOne)["order_code"],
+				})+1 >= config.InvoiceConfig.SubmitNum
+			} else {
+				(*invoiceOne)["isReopen"] = false
+			}
+		}
 	}
+
 	this.ServeJson(NewResult(map[string]interface{}{
 		"orderCodes":   strings.Join(orderArr, ","),
 		"money":        money,
 		"invoice":      &invoiceOne,
 		"operator":     operator,
 		"company_name": companyName,
+		"isFollowWx":   1,
 	}, nil))
 }
 
@@ -1388,7 +1831,7 @@ func htjs(body map[string]interface{}, orderCode []string, invoiceType, companyN
 			defer response.Body.Close()
 			resData := (*resMap)["data"].(map[string]interface{})
 			if invoice_status == 1 {
-				sendMail(invoiceType, strings.Join(orderCode, ","), companyName, taxpayerIdentnum, mail, phone, qutil.InterfaceToStr(resData["path"]))
+				sendMail(invoiceType, strings.Join(orderCode, ","), companyName, taxpayerIdentnum, mail, phone, qutil.InterfaceToStr(resData["path"]), "")
 			}
 			for _, v := range orderCode {
 				util.Mysql.Update(dbname, map[string]interface{}{"order_code": v, "invoice_status": 0}, map[string]interface{}{
@@ -1434,20 +1877,30 @@ func InvoiceStatusHandle(orderCode string) bool {
 }
 
 // 电子普票发邮箱
-func sendMail(invoiceType, orderCode, companyName, taxpayerIdentnum, mail, phone, url string) {
+func sendMail(invoiceType, orderCode, companyName, taxpayerIdentnum, mail, phone, url, invoiceContent string) {
 	if invoiceType == "个人" {
 		emailHtml := emailHtml_gr
 		emailHtmls := fmt.Sprintf(emailHtml, phone, mail)
-		html := fmt.Sprintf(email_format, orderCode, "电子普通发票", fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", url), "电子普通发票", emailHtmls)
+		html := fmt.Sprintf(email_format, orderCode, "电子普通发票", fmt.Sprintf("<a href=\"%s\" download class=\"download\">查看发票</a>", url), "电子普通发票", invoiceContent, emailHtmls)
 		InvoiceSendMail(mail, html, "电子发票")
 	} else {
 		emailHtml := emailHtml_gs
 		emailHtmls := fmt.Sprintf(emailHtml, companyName, taxpayerIdentnum, phone, mail)
-		html := fmt.Sprintf(email_format, orderCode, "电子普通发票", fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", url), "电子普通发票", emailHtmls)
+		html := fmt.Sprintf(email_format, orderCode, "电子普通发票", fmt.Sprintf("<a href=\"%s\" download class=\"download\">查看发票</a>", url), "电子普通发票", invoiceContent, emailHtmls)
 		InvoiceSendMail(mail, html, "电子发票")
 	}
 }
 
+// 剩余金额
+func InvoicePrice(orderData map[string]interface{}) int64 {
+	residueMoney := int64(0)
+	if qutil.Int64All(orderData["applybill_status"]) == 2 {
+		return residueMoney
+	}
+
+	return qutil.Int64All(orderData["pay_money"]) - InvoiceAmount(qutil.InterfaceToStr(orderData["order_code"]))
+}
+
 // 订单剩余金额查询
 func ResidueMoney(orderCode string) int64 {
 	residueMoney := int64(0)
@@ -1456,26 +1909,25 @@ func ResidueMoney(orderCode string) int64 {
 	if len(*orderData) == 0 || orderData == nil {
 		return residueMoney
 	}
-	if qutil.Int64All((*orderData)[0]["applybill_status"]) == 2 {
-		return residueMoney
-	}
+	return InvoicePrice((*orderData)[0])
+
 	//发票信息查询
-	invoiceData := util.Mysql.SelectBySql("select invoice_status,sum(invoice_order_money) as  money  from  invoice where  order_code=?  and  invoice_status>=0  GROUP BY  invoice_status", orderCode)
-	if len(*orderData) == 0 || orderData == nil {
-	} else {
-		//开过几次票
-		payMoney := qutil.Int64All((*orderData)[0]["pay_money"])
-		allMoney := int64(0)
-		for _, invoice := range *invoiceData {
-			invoice_status := qutil.Int64All(invoice["invoice_status"])
-			money := qutil.Int64All(invoice["money"])
-			if invoice_status == 0 {
-				return residueMoney
-			} else {
-				allMoney += money
-			}
-		}
-		residueMoney = payMoney - allMoney
-	}
-	return residueMoney
+	//invoiceData := util.Mysql.SelectBySql("select invoice_status,sum(invoice_order_money) as  money  from  invoice where  order_code=?  and  invoice_status>=0  GROUP BY  invoice_status", orderCode)
+	//if len(*orderData) == 0 || orderData == nil {
+	//} else {
+	//    //开过几次票
+	//    payMoney := qutil.Int64All((*orderData)[0]["pay_money"])
+	//    allMoney := int64(0)
+	//    for _, invoice := range *invoiceData {
+	//        invoice_status := qutil.Int64All(invoice["invoice_status"])
+	//        money := qutil.Int64All(invoice["money"])
+	//        if invoice_status == 0 {
+	//            return residueMoney
+	//        } else {
+	//            allMoney += money
+	//        }
+	//    }
+	//    residueMoney = payMoney - allMoney
+	//}
+	//return residueMoney
 }

+ 32 - 11
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -59,7 +59,7 @@ var (
 // 订单数据展示(订单详情页面)
 func (this *OrderListDetails) GetOrderPayAllMsg() {
 	userId := qutil.ObjToString(this.GetSession("userId"))
-	fields := "id,order_code,order_channel,prepay_time,del_status,create_time,pay_time,pay_way,original_price,order_money,pay_money,applybill_status,out_trade_no,filter,product_type,order_status,applybill_type,applybill_taxnum,applybill_company,vip_starttime,vip_endtime,vip_type,discount_price,d_relation_id,billingMode,return_status,is_backstage_order,vip_starttime,vip_endtime,expiration_time,buy_subject,buy_count"
+	fields := "id,signing_subject,order_code,order_channel,prepay_time,del_status,create_time,pay_time,pay_way,original_price,order_money,pay_money,applybill_status,out_trade_no,filter,product_type,order_status,applybill_type,applybill_taxnum,applybill_company,vip_starttime,vip_endtime,vip_type,discount_price,d_relation_id,billingMode,return_status,is_backstage_order,vip_starttime,vip_endtime,expiration_time,buy_subject,buy_count"
 	data, t, transaction_id := CommonDetail(4, fields, userId, this.GetString("orderCode"), this.Session())
 	r := &entity.FuncResult{true, nil, map[string]interface{}{
 		"order":          data,
@@ -133,7 +133,7 @@ func (o *OrderListDetails) DeleteOrder() error {
 
 		var haveNextPage = false
 		var res = []map[string]interface{}{}
-		if fromPage == "" || fromPage != "pc" {
+		if fromPage != "pc" {
 			// haveNextPage, res, _ = o.Datas1(queryM, pageNum, 10)
 			haveNextPage, res, _ = o.Datas(sql, pageNum, 10)
 			if len(res) > 0 {
@@ -413,7 +413,7 @@ func (o *OrderListDetails) GetVipOrderInfo() {
 // 企业商机管理详情页
 func (o *OrderListDetails) GetEntnicheDetails() {
 	userId := qutil.ObjToString(o.GetSession("userId"))
-	fields := "id,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,buy_subject,buy_count"
+	fields := "id,signing_subject,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,buy_subject,buy_count"
 	data, _, _ := CommonDetail(3, fields, userId, o.GetString("order_code"), o.Session())
 	o.ServeJson(map[string]interface{}{
 		"data": data,
@@ -627,6 +627,19 @@ func (o *OrderListDetails) Datas(sql string, pageNum, pagesize_max int) (haveNex
 					}
 				}
 			}
+			//超时关闭订单
+			create_time_str := qutil.ObjToString(result[i]["create_time"])
+			create_time, _ := time.ParseInLocation(Date_Full_Layout, create_time_str, time.Local)
+
+			//是否满足可开票
+			var isCanInvoic bool
+			if create_time.Unix() > config.InvoiceConfig.Order_createtime {
+				//剩余可开票金额
+				isCanInvoic = IsAllowInvoice(result[i])
+			}
+			result[i]["is_can_invoice"] = isCanInvoic
+			//是否存在可查看发票
+			result[i]["invoice_show"] = len(ShowList(qutil.InterfaceToStr(result[i]["order_code"]))) > 0
 			if qutil.ObjToString(result[i]["pay_way"]) == "transferAccounts" {
 				if qutil.IntAll(result[i]["course_status"]) == 2 || qutil.IntAll(result[i]["course_status"]) == 4 {
 					continue
@@ -637,9 +650,7 @@ func (o *OrderListDetails) Datas(sql string, pageNum, pagesize_max int) (haveNex
 				result[i]["userLotteryId"] = encrypt.SE.Encode2Hex(qutil.ObjToString(result[i]["d_relation_id"]))
 			}
 			delete(result[i], "d_relation_id")
-			//超时关闭订单
-			create_time_str := qutil.ObjToString(result[i]["create_time"])
-			create_time, _ := time.ParseInLocation(Date_Full_Layout, create_time_str, time.Local)
+
 			var create_time_stamp int64 = 0
 			order_countdown := config.Config.OrderCountdown //配置文件读取
 			if strings.Contains(qutil.ObjToString(order_countdown), "h") {
@@ -662,7 +673,7 @@ func (o *OrderListDetails) Datas(sql string, pageNum, pagesize_max int) (haveNex
 				go FortyEightHoursCancel(qutil.ObjToString(result[i]["order_code"]), create_time_stamp, time.Now().Unix())
 			}
 			//新增最后开票
-			result[i]["source"] = LastInvoiceSource(qutil.InterfaceToStr(result[i]["order_code"]))
+			//result[i]["source"] = LastInvoiceSource(qutil.InterfaceToStr(result[i]["order_code"])) p537 用户可查看所有发票
 
 		}
 	}
@@ -829,7 +840,7 @@ func (o *OrderListDetails) IsOver() {
 // 大会员详情订单(AI中标预测包订单详情也查询此接口)
 func (o *OrderListDetails) GetMemberDetail() {
 	userId := qutil.ObjToString(o.GetSession("userId"))
-	fields := "id,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,vip_starttime,vip_endtime,course_status,is_backstage_order,return_status,billingMode,discount_price,buy_subject,buy_count,order_channel"
+	fields := "id,signing_subject,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,vip_starttime,vip_endtime,course_status,is_backstage_order,return_status,billingMode,discount_price,buy_subject,buy_count,order_channel"
 	data, _, _ := CommonDetail(0, fields, userId, o.GetString("order_code"), o.Session())
 	o.ServeJson(map[string]interface{}{
 		"data": data,
@@ -838,7 +849,7 @@ func (o *OrderListDetails) GetMemberDetail() {
 
 func (o *OrderListDetails) GetBidfileDetail() {
 	userId := qutil.ObjToString(o.GetSession("userId"))
-	fields := "id,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,vip_starttime,vip_endtime,course_status,discount_price,d_relation_id,buy_subject,buy_count"
+	fields := "id,signing_subject,order_code,order_status,create_time,pay_time,pay_way,out_trade_no,prepay_id,product_type,pay_money,order_money,filter,applybill_type,applybill_taxnum,applybill_company,applybill_status,vip_starttime,vip_endtime,course_status,discount_price,d_relation_id,buy_subject,buy_count"
 	data, _, _ := CommonDetail(1, fields, userId, o.GetString("order_code"), o.Session())
 	o.ServeJson(map[string]interface{}{
 		"data": data,
@@ -858,13 +869,23 @@ func CommonDetail(bigm int, fields, userId, order_code string, session *httpsess
 			}
 			data = *util.Mysql.FindOne(tableName_order, info, fields, "")
 			if data != nil {
+
 				layout := "2006-01-02 15:04:05"
 				create_time := qutil.InterfaceToStr(data["create_time"])
 				t, err := time.Parse(layout, create_time)
 				if err == nil {
 					data["isNewOrder"] = qutil.If(t.Unix() >= config.Config.NewOrderTime, true, false)
 				}
-				data["source"] = LastInvoiceSource(qutil.InterfaceToStr(data["order_code"]))
+				//data["source"] = LastInvoiceSource(qutil.InterfaceToStr(data["order_code"]))
+				//是否满足可开票
+				var isCanInvoic bool
+				if t.Unix() > config.InvoiceConfig.Order_createtime {
+					//可开票
+					isCanInvoic = IsAllowInvoice(data)
+				}
+				data["is_can_invoice"] = isCanInvoic
+				//是否存在可查看发票
+				data["invoice_show"] = len(ShowList(qutil.InterfaceToStr(data["order_code"]))) > 0
 				if bigm == 0 || bigm == 4 {
 					//查询回款记录
 					if qutil.IntAll((data)["is_backstage_order"]) == 1 && qutil.IntAll((data)["return_status"]) > 0 {
@@ -1039,7 +1060,7 @@ func deleteRepeat(slice []int) []int {
 // typ 类型
 // @return sql语句 countsql语句
 func getOrderSql(userId, fromPage, typ string) (string, string) {
-	sql := fmt.Sprintf(`select id,order_code,order_channel,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,pay_money,data_count,order_status,pay_way,product_type,filter,pay_time,vip_starttime,vip_endtime,applybill_status,applybill_type,applybill_taxnum,applybill_company,vip_type,course_status,discount_price,d_relation_id,billingMode,is_backstage_order,return_status,expiration_time,buy_subject,buy_count from dataexport_order
+	sql := fmt.Sprintf(`select id,order_code,order_channel,signing_subject,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,pay_money,data_count,order_status,pay_way,product_type,filter,pay_time,vip_starttime,vip_endtime,applybill_status,applybill_type,applybill_taxnum,applybill_company,vip_type,course_status,discount_price,d_relation_id,billingMode,is_backstage_order,return_status,expiration_time,buy_subject,buy_count from dataexport_order
 		where del_status=0 and audit_status=3 AND ((is_backstage_order =0 AND user_id ='%s')`, userId)
 	sqlC := fmt.Sprintf(`select count(1) from dataexport_order
 		where del_status=0 and audit_status=3 AND ((is_backstage_order =0 AND user_id ='%s')`, userId)

+ 1 - 1
src/jfw/modules/subscribepay/src/service/salesCreateOrder.go

@@ -587,7 +587,7 @@ func (o *SalesCreateOrder) GetOrderPayAllMsg() {
 			//	r.Err = errors.New("获取订单信息失败")
 			//	goto env
 			//}
-			field := "id,order_code,del_status,prepay_time,create_time,pay_time,pay_way,user_phone,original_price,order_money,pay_money,applybill_status,out_trade_no,filter,product_type,order_status,applybill_type,applybill_taxnum,applybill_company,vip_starttime,vip_endtime,vip_type,discount_price,d_relation_id,billingMode,return_status,is_backstage_order,vip_starttime,vip_endtime"
+			field := "id,signing_subject,order_code,del_status,prepay_time,create_time,pay_time,pay_way,user_phone,original_price,order_money,pay_money,applybill_status,out_trade_no,filter,product_type,order_status,applybill_type,applybill_taxnum,applybill_company,vip_starttime,vip_endtime,vip_type,discount_price,d_relation_id,billingMode,return_status,is_backstage_order,vip_starttime,vip_endtime"
 			data, t, transactionId = CommonDetail(4, field, userId, order_code, o.Session())
 			//如果手机号号为空查找通过userid查找手机号
 			//if qutil.InterfaceToStr(data["user_phone"]) == "" {

+ 13 - 12
src/jfw/modules/subscribepay/src/util/util.go

@@ -1,25 +1,26 @@
 package util
 
 import (
-    qutil "app.yhyue.com/moapp/jybase/common"
-    "app.yhyue.com/moapp/jypkg/compatible"
-    "strings"
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jypkg/compatible"
+	"strings"
 )
 
 var (
-    Compatible *compatible.Compatible
+	Compatible *compatible.Compatible
 )
 
 func ConfirmIntArr(arr []interface{}) []int {
-    tmp := make([]int, 0)
-    for _, v := range arr {
-        tmp = append(tmp, qutil.IntAll(v))
-    }
-    return tmp
+	tmp := make([]int, 0)
+	for _, v := range arr {
+		tmp = append(tmp, qutil.IntAll(v))
+	}
+	return tmp
 }
 
-//移动端ios
+// 移动端ios
 func IsMobileIOS(userAgent string) bool {
-    userAgent = strings.ToLower(userAgent)
-    return strings.Contains(userAgent, "iphone") || strings.Contains(userAgent, "ipad") || strings.Contains(userAgent, "ipod")
+	userAgent = strings.ToLower(userAgent)
+	return mobileReg.MatchString(userAgent)
+	//return strings.Contains(userAgent, "iphone") || strings.Contains(userAgent, "ipad") || strings.Contains(userAgent, "ipod")
 }

+ 86 - 56
src/web/staticres/common-module/order-list/js/order-detail.js

@@ -23,7 +23,8 @@ var vm = new Vue({
           bottomButtonShow: {
             pay: false,
             invoke: false,
-            buyAgain: false
+            buyAgain: false,
+            lookInvoice: false
           }
         },
         0: {
@@ -34,7 +35,8 @@ var vm = new Vue({
           bottomButtonShow: {
             pay: true,
             invoke: false,
-            buyAgain: false
+            buyAgain: false,
+            lookInvoice: false
           }
         },
         1: {
@@ -46,7 +48,8 @@ var vm = new Vue({
             pay: false,
             invoke: true,
             buyAgain: false,
-            renew: false
+            renew: false,
+            lookInvoice: true
           }
         },
         '-2': {
@@ -57,7 +60,8 @@ var vm = new Vue({
           bottomButtonShow: {
             pay: false,
             invoke: false,
-            buyAgain: false
+            buyAgain: false,
+            lookInvoice: false
           }
         },
         '-3': {
@@ -68,7 +72,8 @@ var vm = new Vue({
           bottomButtonShow: {
             pay: false,
             invoke: false,
-            buyAgain: false
+            buyAgain: false,
+            lookInvoice: false
           }
         }
       },
@@ -112,7 +117,7 @@ var vm = new Vue({
   },
   computed: {
     invokeButtonText: function () {
-      return this.orderInfo.applybillStatus === 0 ? '开发票' : '查看发票'
+      return  '开发票' 
     },
     buttonGroupShow: function () {
     	if(this.orderInfo.payMoney>0){
@@ -120,7 +125,8 @@ var vm = new Vue({
 	      var payShow = this.orderStateMap[state].bottomButtonShow.pay
 	      var invokeShow = this.orderStateMap[state].bottomButtonShow.invoke
 	      var buyAgainShow = this.orderStateMap[state].bottomButtonShow.buyAgain
-	      return payShow || invokeShow || buyAgainShow
+        var lookInvoice = this.orderStateMap[state].bottomButtonShow.lookInvoice
+	      return payShow || invokeShow || buyAgainShow || lookInvoice
 	    }
     }
   },
@@ -233,14 +239,25 @@ var vm = new Vue({
         this.orderStateMap[1].bottomButtonShow.buyAgain = true
       }
 
-      var filterInfo = JSON.parse(order.filter)
+      // var filterInfo = JSON.parse(order.filter)
       // 开发票按钮展示逻辑
-      if ((order.pay_money <= 0)||(filterInfo.canInvoice!=undefined &&!filterInfo.canInvoice)) {
-        this.orderStateMap[1].bottomButtonShow.invoke = false
-      }
-      if(order.source === 1){ // 线下发票隐藏按钮
+      // if (this.invokeButtonText === '开发票' && (order.pay_money <= 0)||(filterInfo.canInvoice!=undefined &&!filterInfo.canInvoice)) {
+      //   this.orderStateMap[1].bottomButtonShow.invoke = false
+      // }
+      // if(order.source === 1){ // 线下发票隐藏按钮 p537放开此限制
+      //   this.orderStateMap[this.orderInfo.state].bottomButtonShow.invoke = false
+      // }
+      // 开发票
+      if(!order.is_can_invoice){
         this.orderStateMap[this.orderInfo.state].bottomButtonShow.invoke = false
-
+      } else {
+        this.orderStateMap[this.orderInfo.state].bottomButtonShow.invoke = true
+      }
+      // 查看发票
+      if ( !order.invoice_show) {
+        this.orderStateMap[this.orderInfo.state].bottomButtonShow.lookInvoice = false
+      } else {
+        this.orderStateMap[this.orderInfo.state].bottomButtonShow.lookInvoice = true
       }
       this.orderInfo.productInfoList = this.getProductInfoList(info)
       this.orderInfo.orderInfoList = this.getOrderInfoListList(info)
@@ -372,7 +389,7 @@ var vm = new Vue({
       return infoList
     },
     // 开发票逻辑,和订单详情相同
-    lookInvoke: function () {
+    lookInvoke: function (type) {
       var _this = this
       var platform = this.platform
       var order = this.reqOrder
@@ -381,21 +398,21 @@ var vm = new Vue({
       var applybill_status = order.applybill_status
 
       // 已开发票情况(查看发票)
-      if (applybill_status === 1) {
-        var href = assetsConf.invokeLink.lookInvoice[platform]
-        if (href) {
-          _this.goToLink(`${href}?order_code=${orderCode}`)
-        }
-        return
-      } else if (applybill_status === 2) {
-        return this.showDialog({
-          title: '',
-          message: '您已开具发票<br>如有问题请联系客服<br>400-108-6670',
-          className: 'j-confirm-dialog text-center',
-          showCancelButton: false,
-          confirmButtonText: '我知道了'
-        })
-      }
+      // if (applybill_status === 1) {
+      //   var href = assetsConf.invokeLink.lookInvoice[platform]
+      //   if (href) {
+      //     _this.goToLink(`${href}?order_code=${orderCode}`)
+      //   }
+      //   return
+      // } else if (applybill_status === 2) {
+      //   return this.showDialog({
+      //     title: '',
+      //     message: '您已开具发票<br>如有问题请联系客服<br>400-108-6670',
+      //     className: 'j-confirm-dialog text-center',
+      //     showCancelButton: false,
+      //     confirmButtonText: '我知道了'
+      //   })
+      // }
 
       // 临时需求 未开发票提示当前时期不能开具发票
       // return this.showDialog({
@@ -405,34 +422,47 @@ var vm = new Vue({
       //   showCancelButton: false,
       //   confirmButtonText: '我知道了'
       // })
-
-      var loading = this.showLoading()
-      $.ajax({
-        type: 'POST',
-        url: '/subscribepay/orderListDetails/isOver',
-        data: {
-          order_code: orderCode
-        },
-        success: function (res) {
-          loading && loading.clear()
-          if (res.status === 1) {
-            // 开发票跳转
-            var href = assetsConf.invokeLink.invoke[platform]
-            if (href) {
-              _this.goToLink(`${href}?order_code=${orderCode}`)
-            }
-          } else {
-            // 不能开发票跳转
-            var href = assetsConf.invokeLink.cantInvoke[platform]
-            if (href) {
-              _this.goToLink(`${href}?order_code=${orderCode}`)
-            }
-          }
-        },
-        error: function (err) {
-          loading && loading.clear()
+     
+      // var loading = this.showLoading()
+      // $.ajax({
+      //   type: 'POST',
+      //   url: '/subscribepay/orderListDetails/isOver',
+      //   data: {
+      //     order_code: orderCode
+      //   },
+      //   success: function (res) {
+      //     loading && loading.clear()
+      //     if (res.status === 1) {
+      //       // 开发票跳转
+      //       var href = assetsConf.invokeLink.invoke[platform]
+      //       if (href) {
+      //         _this.goToLink(`${href}?order_code=${orderCode}`)
+      //       }
+      //     } else {
+      //       // 不能开发票跳转
+      //       // var href = assetsConf.invokeLink.cantInvoke[platform]
+      //       // p537 调整为取消此不能开发票限制 
+      //       var href = assetsConf.invokeLink.invoke[platform]
+      //       if (href) {
+      //         _this.goToLink(`${href}?order_code=${orderCode}`)
+      //       }
+      //     }
+      //   },
+      //   error: function (err) {
+      //     loading && loading.clear()
+      //   }
+      // })
+      if ( type === 'look' ){
+        var href = assetsConf.invokeLink.lookInvoice[platform]
+        if (href) {
+          _this.goToLink(`${href}?order_code=${orderCode}`)
         }
-      })
+      } else {
+        var href = assetsConf.invokeLink.invoke[platform]
+        if (href) {
+          _this.goToLink(`${href}?order_code=${orderCode}`)
+        }
+      }
     },
     onConfirmPay: function () {
       var link = this.getPublicLinkOfKey(this.reqOrder.product_type, 'pay')

+ 8 - 4
src/web/staticres/common-module/order-list/js/order-list-config.js

@@ -73,16 +73,20 @@ var assetsConf = {
   // 开发票
   invokeLink: {
     invoke: { // 开发票
-      wx: '/front/invoice/showpage',
-      app: '/jyapp/front/invoice/showpage'
+      // wx: '/front/invoice/showpage',
+      // app: '/jyapp/front/invoice/showpage'
+      wx: '/jy_mobile/invoice/Invoicing',
+      app: '/jy_mobile/invoice/Invoicing'
     },
     cantInvoke: {  // 开发票超时(不能开发票)
       wx: '/front/invoice/cantInvoice',
       app: '/jyapp/front/cantInvoice'
     },
     lookInvoice: {
-      wx: '/front/invoice/check_invoice.html',
-      app: '/jyapp/front/invoice/check_invoice.html'
+      // wx: '/front/invoice/check_invoice.html',
+      // app: '/jyapp/front/invoice/check_invoice.html'
+      wx: '/jy_mobile/invoice/viewInvoice',
+      app: '/jy_mobile/invoice/viewInvoice'
     }
   },
   // 数据导出(历史数据)

+ 93 - 66
src/web/staticres/common-module/order-list/js/order-list.js

@@ -805,8 +805,10 @@ var vm = new Vue({
         cancelOrderShow: false, // 取消订单按钮是否显示
         payConfirmShow: false, // 去支付按钮是否显示
         payConfirmText: '去支付', // 去支付按钮文字
-        invokeButtonShow: false, // 开发票(查看发票)按钮是否显示
-        invokeButtonText: '开发票', // 开发票(查看发票)按钮是否显示
+        invokeButtonShow: false, // 开发票按钮是否显示
+        invokeButtonText: '开发票', // 开发票按钮是否显示
+        lookInvoiceButtonShow: false,
+        lookInvoiceButtonText:'查看发票',
         bugAgainShow: false, // 再次购买(购买/续费/升级)按钮是否显示
         bugAgainText: '再次购买', // 再次购买(购买/续费/升级)按钮是否显示
       }
@@ -842,18 +844,32 @@ var vm = new Vue({
           state.bugAgainShow = true
           state.bugAgainText = '再次购买'
         }
+          // 已完成订单 开发票判断  0未申请  1/2已申请
+        // if (order.applybill_status === 1 || order.applybill_status === 2) {
+        //   // 查看发票
+        //   state.invokeButtonText = '查看发票'
+        // }
         // 判断开发票
         // 后台渠道为xdqd04(销售代下单)可以开发票,其他后台创建订单不可以开发票
-        var backstageOrderCanInvoke = order.is_backstage_order === 0 || order.order_channel === 'xdqd04'
-        if (canInvoke.indexOf(productType) !== -1 && order.billingMode === 1 && backstageOrderCanInvoke) {
-          state.invokeButtonShow = true
-        }
+        // var backstageOrderCanInvoke = order.is_backstage_order === 0 || order.order_channel === 'xdqd04'
+        // if (state.invokeButtonText  === '开发票' && canInvoke.indexOf(productType) !== -1 && order.billingMode === 1 && backstageOrderCanInvoke) {
+        //   state.invokeButtonShow = true
+        // }
+      // if(order.source === 1){ // 线下发票隐藏按钮
+      //   state.invokeButtonShow = false
+      // }
 
-        // 已完成订单 开发票判断  0未申请  1/2已申请
-        if (order.applybill_status === 1 || order.applybill_status === 2) {
-          // 查看发票
-          state.invokeButtonText = '查看发票'
+        if (order.is_can_invoice) {
+          state.invokeButtonShow = true
+         } else {
+          state.invokeButtonShow = false
         }
+        if (order.invoice_show) {
+          state.lookInvoiceButtonShow = true
+        }else{
+          state.lookInvoiceButtonShow = false
+        }  
+      
 
       } else if (orderStatus === -2 || orderStatus === -3) {
         // 已取消或者已删除订单
@@ -868,9 +884,6 @@ var vm = new Vue({
       if (cbConf) {
         Object.assign(state, cbConf)
       }
-      if(order.source === 1){ // 线下发票隐藏按钮
-        state.invokeButtonShow = false
-      }
       return state
 
     },
@@ -981,7 +994,7 @@ var vm = new Vue({
       return state
     },
     // 开发票和查看发票
-    clickInvoke: function (order) {
+    clickInvoke: function (order,type) {
       var _this = this
       var platform = this.platform
       var orderCode = order.order_code
@@ -997,42 +1010,42 @@ var vm = new Vue({
           // 继续往下走
         } else {
           // 线上课程私有页面
-          if (applybill_status === 0) {
+          if (type !== 'look') {
             return _this.goToLink('/jyxsapp/invoice?code=' + orderCode)
-          } else if (applybill_status === 1 || applybill_status === 2) {
+          } else  {
             return _this.goToLinkAndSaveState('/jyxsapp/invoiceDetail?code=' + orderCode + '&id=' + order.id)
           }
         }
       }
 
       // 大会员公对公转账发票提示
-      if (productType === '大会员' && order.pay_way === 'transferAccounts' && applybill_status == 0) {
-        return this.showDialog({
-          title: '',
-          message: '请联系客服开票<br>客服热线:400-108-6670',
-          className: 'j-confirm-dialog text-center',
-          showCancelButton: false,
-          confirmButtonText: '我知道了'
-        })
-      }
+      // if (productType === '大会员' && order.pay_way === 'transferAccounts' && type !== 'look') {
+      //   return this.showDialog({
+      //     title: '',
+      //     message: '请联系客服开票<br>客服热线:400-108-6670',
+      //     className: 'j-confirm-dialog text-center',
+      //     showCancelButton: false,
+      //     confirmButtonText: '我知道了'
+      //   })
+      // }
 
 
       // 已开发票情况(查看发票)
-      if (applybill_status === 1) {
-        var href = assetsConf.invokeLink.lookInvoice[platform]
-        if (href) {
-          _this.goToLinkAndSaveState(`${href}?order_code=${orderCode}`)
-        }
-        return
-      } else if (applybill_status === 2) {
-        return this.showDialog({
-          title: '',
-          message: '您已开具发票<br>如有问题请联系客服<br>400-108-6670',
-          className: 'j-confirm-dialog text-center',
-          showCancelButton: false,
-          confirmButtonText: '我知道了'
-        })
-      }
+      // if (applybill_status === 1) {
+      //   var href = assetsConf.invokeLink.lookInvoice[platform]
+      //   if (href) {
+      //     _this.goToLinkAndSaveState(`${href}?order_code=${orderCode}`)
+      //   }
+      //   return
+      // } else if (applybill_status === 2) {
+      //   return this.showDialog({
+      //     title: '',
+      //     message: '您已开具发票<br>如有问题请联系客服<br>400-108-6670',
+      //     className: 'j-confirm-dialog text-center',
+      //     showCancelButton: false,
+      //     confirmButtonText: '我知道了'
+      //   })
+      // }
 
       // 临时需求 未开发票提示当前时期不能开具发票
       // return this.showDialog({
@@ -1043,33 +1056,47 @@ var vm = new Vue({
       //   confirmButtonText: '我知道了'
       // })
 
-      var loading = this.showLoading()
-      $.ajax({
-        type: 'POST',
-        url: '/subscribepay/orderListDetails/isOver',
-        data: {
-          order_code: orderCode
-        },
-        success: function (res) {
-          loading && loading.clear()
-          if (res.status === 1) {
-            // 开发票跳转
-            var href = assetsConf.invokeLink.invoke[platform]
-            if (href) {
-              _this.goToLink(`${href}?order_code=${orderCode}`)
-            }
-          } else {
-            // 不能开发票跳转
-            var href = assetsConf.invokeLink.cantInvoke[platform]
-            if (href) {
-              _this.goToLinkAndSaveState(`${href}?order_code=${orderCode}`)
-            }
-          }
-        },
-        error: function (err) {
-          loading && loading.clear()
+      // var loading = this.showLoading()
+      // $.ajax({
+      //   type: 'POST',
+      //   url: '/subscribepay/orderListDetails/isOver',
+      //   data: {
+      //     order_code: orderCode
+      //   },
+      //   success: function (res) {
+      //     loading && loading.clear()
+      //     if (res.status === 1) {
+      //       // 开发票跳转
+      //       var href = assetsConf.invokeLink.invoke[platform]
+      //       if (href) {
+      //         _this.goToLink(`${href}?order_code=${orderCode}`)
+      //       }
+      //     } else {
+      //       // 不能开发票跳转
+      //       // var href = assetsConf.invokeLink.cantInvoke[platform]
+      //       // p537 调整为取消此不能开发票限制 
+      //       var href = assetsConf.invokeLink.invoke[platform]
+      //       if (href) {
+      //         _this.goToLinkAndSaveState(`${href}?order_code=${orderCode}`)
+      //       }
+      //     }
+      //   },
+      //   error: function (err) {
+      //     loading && loading.clear()
+      //   }
+      // })
+      if (type === 'look') {
+        var href = assetsConf.invokeLink.lookInvoice[platform]
+        if (href) {
+          _this.goToLinkAndSaveState(`${href}?order_code=${orderCode}`)
         }
-      })
+      } else {           // 开发票跳转
+        var href = assetsConf.invokeLink.invoke[platform]
+        if (href) {
+          _this.goToLink(`${href}?order_code=${orderCode}`)
+         }
+
+      }
     },
     // 去支付
     clickPayConfirm: function (order) {

+ 132 - 11
src/web/staticres/electronic_invoice/css/check_invoice.css

@@ -22,6 +22,125 @@
   color: #2CB7CA;
 }
 
+#check_invoice .invoice_status{
+  position: relative;
+  padding-top: 24px;
+  /* width: auto; */
+}
+#check_invoice .invoice_status .invoice_num {
+  margin-bottom: 12px;
+  height: 22px;
+  line-height: 22px;
+  font-size: 14px;
+  color: #1D1D1D;
+}
+.invoice_main{
+  width: 100%;
+  height: 40px;
+  overflow-x: scroll;
+  overflow-y: hidden;
+}
+.invoice_main::-webkit-scrollbar {
+  display: none;
+}
+.white_shadow{
+  position: absolute;
+  left: 0;
+  bottom: 0;
+  display: flex;
+  align-items: center;
+  width: 110px;
+  height: 40px;
+  z-index: 9;
+  cursor: pointer;
+  background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
+}
+.white_shadow.right_shadow{
+  display: flex;
+  justify-content: flex-end;
+  right: 0;
+  left: initial;
+  background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
+}
+.white_shadow .el-iconfont {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 28px;
+  height: 28px;
+  background: rgba(0, 0, 0, 0.12);
+  border-radius: 50%;
+}
+.white_shadow .el-iconfont:hover{
+  background-color: #EAF8FA;
+  color: #2ABED1;
+}
+.el-icon-arrow-left, .el-icon-arrow-right{
+  font-size: 20px;
+}
+#check_invoice .invoice_status .invoice_status_list{
+  position: relative;
+  left: 0;
+  display: flex;
+  align-items: center;
+  height: 40px;
+  min-width: 1200px;
+  max-width: 100%;
+  transition: left 0.5s ease-in-out;
+}
+#check_invoice .invoice_status .invoice_status_item{
+  flex: none;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 8px 16px;
+  margin-right: 12px;
+  height: 40px;
+  border: 1px solid #E0E0E0;
+  border-radius: 4px;
+  background-color: #F2F2F4;
+  color: #686868;
+  font-size: 12px;
+  cursor: pointer;
+}
+
+#check_invoice .invoice_status .invoice_status_item_title{
+  margin-right: 8px;
+  font-size: 16px;
+  color: #1D1D1D;
+}
+#check_invoice .invoice_status .invoice_status_item.active{
+  background-color: #EAF8FA;
+  border: 1px solid #2CB7CA;
+}
+#check_invoice .invoice_status .invoice_status_item.active .invoice_status_item_title{
+  color: #2ABED1;
+}
+.w.invoice_fail_container{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 32px;
+}
+.w.invoice_fail_container .invoice_fail{
+  width: 100%;
+  text-align: center;
+}
+.w.invoice_fail_container .invoice_fail .invoice_fail_title{
+  font-size: 18px;
+  color: #171826;
+  line-height: 28px;
+}
+.w.invoice_fail_container .invoice_fail_title .el-icon-error{
+  margin-right: 10px;
+  font-size: 20px;
+  color: #FB483D;
+}
+.w.invoice_fail_container .invoice_fail_content {
+  font-size: 13px;
+  color: #5F5E64;
+  line-height: 20px;
+}
 #check_invoice .step {
   height: auto;
   padding-left: 140px;
@@ -34,8 +153,8 @@
   height: 38px;
   line-height: 38px;
   text-align: center;
-  background-color: #BFBFBF;
-  color: white;
+  background-color: #bfbfbf;
+  color: #fff;
   float: left;
   margin-right: 8px;
 }
@@ -48,12 +167,12 @@
 #check_invoice .step .l:after {
   content: "";
   position: absolute;
-  right: -23px;
+  right: -22px;
   top: 0;
   width: 0;
   height: 0;
-  border-top: 19px solid transparent;
-  border-left: 23px solid #2CB7CA;
+  border-top: 20px solid transparent;
+  border-left: 23px solid #72DAE8;
   border-bottom: 19px solid transparent;
 }
 
@@ -86,7 +205,7 @@
   top: 0;
   width: 0;
   height: 0;
-  border-top: 19px solid transparent;
+  border-top: 20px solid transparent;
   border-left: 23px solid #fff;
   border-bottom: 19px solid transparent;
 }
@@ -94,15 +213,17 @@
 #check_invoice .step .c:after {
   content: "";
   position: absolute;
-  right: -23px;
+  right: -22px;
   top: 0;
   width: 0;
   height: 0;
-  border-top: 19px solid transparent;
-  border-left: 23px solid #BFBFBF;
+  border-top: 20px solid transparent;
+  border-left: 23px solid #2CB7CA;
   border-bottom: 19px solid transparent;
 }
-
+#check_invoice .step .c.finish::after{
+  border-left: 23px solid #72DAE8;
+}
 /* 财务处理*/
 #check_invoice .step .ci {
   position: relative;
@@ -176,7 +297,7 @@
   top: 0;
   width: 0;
   height: 0;
-  border-top: 19px solid transparent;
+  border-top: 20px solid transparent;
   border-left: 23px solid #fff;
   border-bottom: 19px solid transparent;
 }

+ 102 - 1
src/web/staticres/electronic_invoice/css/invoice.css

@@ -11,6 +11,9 @@ input::-webkit-inner-spin-button {
 input[type="number"] {
   -moz-appearance: textfield;
 }
+input::placeholder, textarea::placeholder{
+  color: #999999!important;
+}
 
 #invoice {
   line-height: 1;
@@ -53,6 +56,97 @@ input[type="number"] {
   padding: 26px 30px 50px;
 }
 
+#invoice .invoice_main .i_m_body .el-form-item {
+  margin-bottom: 12px;
+  width: 696px;
+  height: 36px;
+}
+#invoice .invoice_main .i_m_body .invoice_unit{
+  border-bottom: 1px dashed #E0E0E0;
+  margin-bottom: 12px;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-button{
+  width: 180px;
+  height: 46px;
+  background-color: #2ABED1;
+  border: none;
+  color: #FFFFFF;
+  font-size: 16px;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-button.el-button--default{
+  border: 1px solid #E0E0E0;
+  background-color: #fff;
+  color: #1D1D1D;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-form-item__content{
+  line-height: 36px;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-form-item__content .el-button.is-disabled {
+  background-color: #87DFEA;
+  color: rgba(255, 255, 255, 0.6);
+}
+.el-form-item.invoice_select .el-select{
+  width: 260px;
+}
+#invoice .invoice_main .i_m_body .el-form-item.invoice_unit_name{
+  position: relative;
+}
+#invoice .invoice_main .i_m_body .el-form-item.invoice_unit_name .box-card{
+  position: absolute;
+  top: 40px;
+  width: 590px;
+  z-index: 9;
+  border-radius: 4px;
+  border: 1px solid #2ABED1;
+}
+#invoice .invoice_main .i_m_body .el-form-item.invoice_unit_name .box-card .el-card__body {
+  padding: 0;
+}
+#invoice .invoice_main .i_m_body .el-form-item.invoice_unit_name .box-card .list-item{
+  padding: 0 20px;
+  cursor: pointer;
+}
+.el-form-item.invoice_unit_name .box-card .list-item .high-light {
+  color: #2ABED1;
+}
+#invoice .invoice_main .i_m_body .el-form-item.invoice_unit_name .box-card .list-item:hover{
+  background-color: #ECECEC;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-input__inner{
+  height: 36px;
+  line-height: 36px;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-form-item__label {
+  position: relative;
+  height: 36px;
+  line-height: 36px;
+  text-align: left;
+}
+.el-form-item__label:before{
+  position: absolute;
+  left: -8px;
+}
+#invoice .invoice_main .i_m_body .el-form-item .el-form-item__error{
+  top: 26%;
+  right: -218px;
+  left: initial;
+  min-width: 200px;
+  font-size: 14px;
+}
+
+#invoice .invoice_main .i_m_body .el-radio__input.is-checked .el-radio__inner {
+  border-color: #2ABED1;
+  background: #fff;
+}
+
+#invoice .invoice_main .i_m_body .el-radio__input.is-checked .el-radio__inner::after{
+  width: 8px;
+  height: 8px;
+  background-color: #2ABED1;
+}
+#invoice .invoice_main .i_m_body .el-radio.is-checked .el-radio__label {
+  color: #1D1D1D;
+}
 #invoice .invoice_main .i_m_body .copyright {
   line-height: 24px;
 }
@@ -168,7 +262,6 @@ input[type="number"] {
 }
 
 #invoice .toast {
-  display: none;
   position: fixed;
   top: 50%;
   left: 50%;
@@ -262,4 +355,12 @@ input[type="number"] {
   border: 0;
   color: #fff;
   outline: 0;
+}
+
+.invoice_select_option .el-scrollbar__view.el-select-dropdown__list {
+  display: flex;
+  flex-direction: column;
+}
+.invoice_select_option .el-select-dropdown__item.selected {
+  color: #2ABED1;
 }

+ 166 - 166
src/web/staticres/electronic_invoice/js/invoice.js

@@ -34,171 +34,171 @@ function checkForm() {
     }
 }
 
-$(function () {
-    checkForm();//初始化
-    /*
-        |-- dom [object]        :指定生成下拉列表组件的dom对象。
-        |-- name[string]            :设置表单控件的name属性值。隐藏域的name属性,用来校验表单
-        |-- data [object]        :生成下拉列表选项的数据。
-        |-- fn[function]        :选择下来列表后的回调函数。
-    */
-    // 发票抬头
-    simSelect({
-        'dom': document.getElementById('invoice_title'),
-        'data': [{ 'key': '单位', 'value': '单位' }, { 'key': '个人', 'value': '个人' }],
-        'name': 'invoice_title',
-        'fn': function (val) {
-            if(val == '单位'){
-                $('.unit_invoice').show();
-                checkForm();
-            }else{
-                $('.unit_invoice').hide();
-                checkForm();
-            }
-        }
-    });
+// $(function () {
+//     // checkForm();//初始化
+//     /*
+//         |-- dom [object]        :指定生成下拉列表组件的dom对象。
+//         |-- name[string]            :设置表单控件的name属性值。隐藏域的name属性,用来校验表单
+//         |-- data [object]        :生成下拉列表选项的数据。
+//         |-- fn[function]        :选择下来列表后的回调函数。
+//     */
+//     // 发票抬头
+//     simSelect({
+//         'dom': document.getElementById('invoice_title'),
+//         'data': [{ 'key': '单位', 'value': '单位' }, { 'key': '个人', 'value': '个人' }],
+//         'name': 'invoice_title',
+//         'fn': function (val) {
+//             if(val == '单位'){
+//                 $('.unit_invoice').show();
+//                 checkForm();
+//             }else{
+//                 $('.unit_invoice').hide();
+//                 checkForm();
+//             }
+//         }
+//     });
 
-    // 公司名称校验
-    $('.unit_name').on('blur',function(){
-        if ($(this).val() == '') {
-            $(this).parent().siblings('.success').hide().siblings('.error').hide();
-            return;
-        }
-        if(regCompany.test($(this).val())){
-            $(this).parent().siblings('.success').show().siblings('.error').hide();
-            checkForm();
-        }else{
-            $(this).parent().siblings('.success').hide().siblings('.error').show();
-            checkForm();
-        }
-    })
-    // 纳税人识别号校验
-    $('.taxpayer_number').on('blur',function(){
-        if ($(this).val() == '') {
-            $(this).parent().siblings('.success').hide().siblings('.error').hide();
-            return;
-        }
-        if(regCode.test($(this).val())){
-            $(this).parent().siblings('.success').show().siblings('.error').hide();
-            checkForm();
-        }else{
-            $(this).parent().siblings('.success').hide().siblings('.error').show();
-            checkForm();
-        }
-    })
-    // 手机号校验
-    $('.tel').on('blur',function(){
-        if ($(this).val() == '') {
-            $(this).parent().siblings('.success').hide().siblings('.error').hide();
-            return;
-        }
-        if(regPhone.test($(this).val())){
-            $(this).parent().siblings('.success').show().siblings('.error').hide();
-            checkForm();
-        }else{
-            $(this).parent().siblings('.success').hide().siblings('.error').show();
-            checkForm();
-        }
-    })
-    // 邮箱校验
-    $('.email').on('blur',function(){
-        if ($(this).val() == '') {
-            $(this).parent().siblings('.success').hide().siblings('.error').hide();
-            return;
-        }
-        if(regEmail.test($(this).val())){
-            $(this).parent().siblings('.success').show().siblings('.error').hide();
-            checkForm();
-        }else{
-            $(this).parent().siblings('.success').hide().siblings('.error').show();
-            checkForm();
-        }
-    })
-    // 初始化默认选择
-    function initSelect(){
-        $('input[name="invoice_title"]').val("个人");
-        $('#invoice_title button').html("个人");
-        $('.unit_invoice').hide()
-    }
-    initSelect();
-    // 提交
-    $('.submit_btn').click(function(){
-		var order_code =$(".order_code").text();
-        var company = $('.unit_name').val().trim();//开票单位
-        var code = $('.taxpayer_number').val().trim();//纳税人识别号
-        var phone = $('.tel').val().trim();//手机号
-        var email = $('.email').val().trim();//邮箱
-        var inputUnit = $('input[name="invoice_title"]').val();//发票抬头
-        var param = "";
-		var invoice_title = $("#invoice_title > button").text()
-		if (invoice_title == '个人') {
-            param = {
-            	"order_code": order_code,
-            	"invoice_type": "个人",
-            	"email": email,
-            	"phone_num": phone
-            }
-        } else {
-			param = {
-				"order_code": order_code,
-				"invoice_type": "单位",
-				"company": company,
-				"id_num": code,
-				"email": email,
-				"phone_num": phone
-			}
-        }
-		$('.toast').show("linear");
-		setTimeout(function () {
-		    $('.toast').hide();
-		}, 2000)
-		var changed = getParam("changed");
-		var isSys = getParam("isSys");
-		if(isSys === "true"){
-			param["isSys"] = true
-		}
-		if(changed === "true"){
-			$.ajax({
-	            url: "/jypay/invoice/replace",
-	            async: false,//设置为同步执行 (兼容火狐浏览器)
-	            type: "POST",
-	            data: param,
-	            success: function (data) {
-	            }
-	        });
-			window.location.replace("/front/order/check_invoice/"+order_code);
-			return
-		}
-		$.ajax({
-            url: "/jypay/invoice/add",
-            async: false,//设置为同步执行 (兼容火狐浏览器)
-            type: "POST",
-            data: param,
-            success: function (data) {
-            }
-        });
-		window.location.replace("/front/order/check_invoice/"+order_code);
-    })
-    // 取消
-    $('.cancel_btn').click(function(){
-        $('.unit_name').val('');
-        $('.taxpayer_number').val('');
-        $('.tel').val('');
-        $('.email').val('');
-        $('input[name="invoice_title"]').val("个人");
-        $('#invoice_title button').html("个人");
-        $('.error').hide()
-        $('.success').hide()
-    })
+//     // 公司名称校验
+//     $('.unit_name').on('blur',function(){
+//         if ($(this).val() == '') {
+//             $(this).parent().siblings('.success').hide().siblings('.error').hide();
+//             return;
+//         }
+//         if(regCompany.test($(this).val())){
+//             $(this).parent().siblings('.success').show().siblings('.error').hide();
+//             checkForm();
+//         }else{
+//             $(this).parent().siblings('.success').hide().siblings('.error').show();
+//             checkForm();
+//         }
+//     })
+//     // 纳税人识别号校验
+//     $('.taxpayer_number').on('blur',function(){
+//         if ($(this).val() == '') {
+//             $(this).parent().siblings('.success').hide().siblings('.error').hide();
+//             return;
+//         }
+//         if(regCode.test($(this).val())){
+//             $(this).parent().siblings('.success').show().siblings('.error').hide();
+//             checkForm();
+//         }else{
+//             $(this).parent().siblings('.success').hide().siblings('.error').show();
+//             checkForm();
+//         }
+//     })
+//     // 手机号校验
+//     $('.tel').on('blur',function(){
+//         if ($(this).val() == '') {
+//             $(this).parent().siblings('.success').hide().siblings('.error').hide();
+//             return;
+//         }
+//         if(regPhone.test($(this).val())){
+//             $(this).parent().siblings('.success').show().siblings('.error').hide();
+//             checkForm();
+//         }else{
+//             $(this).parent().siblings('.success').hide().siblings('.error').show();
+//             checkForm();
+//         }
+//     })
+//     // 邮箱校验
+//     $('.email').on('blur',function(){
+//         if ($(this).val() == '') {
+//             $(this).parent().siblings('.success').hide().siblings('.error').hide();
+//             return;
+//         }
+//         if(regEmail.test($(this).val())){
+//             $(this).parent().siblings('.success').show().siblings('.error').hide();
+//             checkForm();
+//         }else{
+//             $(this).parent().siblings('.success').hide().siblings('.error').show();
+//             checkForm();
+//         }
+//     })
+//     // 初始化默认选择
+//     function initSelect(){
+//         $('input[name="invoice_title"]').val("个人");
+//         $('#invoice_title button').html("个人");
+//         $('.unit_invoice').hide()
+//     }
+//     initSelect();
+//     // 提交
+//     $('.submit_btn').click(function(){
+// 		var order_code =$(".order_code").text();
+//         var company = $('.unit_name').val().trim();//开票单位
+//         var code = $('.taxpayer_number').val().trim();//纳税人识别号
+//         var phone = $('.tel').val().trim();//手机号
+//         var email = $('.email').val().trim();//邮箱
+//         var inputUnit = $('input[name="invoice_title"]').val();//发票抬头
+//         var param = "";
+// 		var invoice_title = $("#invoice_title > button").text()
+// 		if (invoice_title == '个人') {
+//             param = {
+//             	"order_code": order_code,
+//             	"invoice_type": "个人",
+//             	"email": email,
+//             	"phone_num": phone
+//             }
+//         } else {
+// 			param = {
+// 				"order_code": order_code,
+// 				"invoice_type": "单位",
+// 				"company": company,
+// 				"id_num": code,
+// 				"email": email,
+// 				"phone_num": phone
+// 			}
+//         }
+// 		$('.toast').show("linear");
+// 		setTimeout(function () {
+// 		    $('.toast').hide();
+// 		}, 2000)
+// 		var changed = getParam("changed");
+// 		var isSys = getParam("isSys");
+// 		if(isSys === "true"){
+// 			param["isSys"] = true
+// 		}
+// 		if(changed === "true"){
+// 			$.ajax({
+// 	            url: "/jypay/invoice/replace",
+// 	            async: false,//设置为同步执行 (兼容火狐浏览器)
+// 	            type: "POST",
+// 	            data: param,
+// 	            success: function (data) {
+// 	            }
+// 	        });
+// 			window.location.replace("/front/order/check_invoice/"+order_code);
+// 			return
+// 		}
+// 		$.ajax({
+//             url: "/jypay/invoice/add",
+//             async: false,//设置为同步执行 (兼容火狐浏览器)
+//             type: "POST",
+//             data: param,
+//             success: function (data) {
+//             }
+//         });
+// 		window.location.replace("/front/order/check_invoice/"+order_code);
+//     })
+//     // 取消
+//     $('.cancel_btn').click(function(){
+//         $('.unit_name').val('');
+//         $('.taxpayer_number').val('');
+//         $('.tel').val('');
+//         $('.email').val('');
+//         $('input[name="invoice_title"]').val("个人");
+//         $('#invoice_title button').html("个人");
+//         $('.error').hide()
+//         $('.success').hide()
+//     })
 
-	function getParam(name) {
-		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-		var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
-		var context = "";
-		if (r != null)
-			context = r[2];
-		reg = null;
-		r = null;
-		return context == null || context == "" || context == "undefined" ? "" : context;
-	}
-})
+// 	function getParam(name) {
+// 		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+// 		var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+// 		var context = "";
+// 		if (r != null)
+// 			context = r[2];
+// 		reg = null;
+// 		r = null;
+// 		return context == null || context == "" || context == "undefined" ? "" : context;
+// 	}
+// })

+ 4 - 10
src/web/templates/areaPack/pc/page_order.html

@@ -221,9 +221,10 @@
                             $(".pay_num_p").css("display", "");
                             if (r.data.transaction_id) $(".pay_num").text(r.data.transaction_id);
                             //发票
-                            if (r.data.order.applybill_status === 0) {
+                            if (r.data.order.is_can_invoice) {
                                 $(".openinvoice").css("display", "");
-                            } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                            }
+                            if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
                                 $(".lookinvoice").css("display", "").on("click", function () {
                                     checkinvoice(r.data.applybill_status, orderCode)//查看发票
                                 })
@@ -304,14 +305,7 @@
 
 
             $(".openinvoice").on("click", function () {
-                // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
         })
 

+ 12 - 18
src/web/templates/frontRouter/pc/dataFile/sess/orderDetail.html

@@ -189,9 +189,10 @@
                             $(".pay_num_p").css("display", "");
                             if (r.data.transaction_id) $(".pay_num").text(r.data.transaction_id);
                             //发票
-                            if (r.data.order.applybill_status === 0 && r.data.order.billingMode === 1 && r.data.order.is_backstage_order === 0 && r.data.order.source !== 1) {
+                            if (r.data.order.is_can_invoice) {
                                 $(".openinvoice").css("display", "");
-                            } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.order.source !== 1 ) {
+                            }
+                            if (r.data.invoice_show) {
                                 $(".lookinvoice").css("display", "").on("click", function () {
                                     checkinvoice(r.data.applybill_status, orderCode)//查看发票
                                 })
@@ -228,14 +229,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
         })
 
@@ -304,14 +298,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 12 - 18
src/web/templates/order/pc/bidfile/bidfileDetail.html

@@ -178,9 +178,10 @@
                             $(".pay_num_p").show();
                         }
                         //发票
-                        if (r.data.applybill_status === 0 && r.data.source !== 1) {
+                        if (r.data.is_can_invoice) {
                             $(".openinvoice").css("display", "");
-                        } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                        }
+                        if (r.data.invoice_show) {
                             $(".lookinvoice").css("display", "").on("click", function () {
                                 checkinvoice(r.data.applybill_status, orderCode)
                             })
@@ -220,14 +221,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
 
             $(".payOrder").on("click", function () {
@@ -318,14 +312,14 @@
 
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 12 - 18
src/web/templates/order/pc/buyerPortraitPack/detail.html

@@ -190,9 +190,10 @@
                             $(".pay_num_p").css("display", "");
                             if (r.data.transaction_id) $(".pay_num").text(r.data.transaction_id);
                             //发票
-                            if (r.data.order.applybill_status === 0) {
+                            if (r.data.order.is_can_invoice) {
                                 $(".openinvoice").css("display", "");
-                            } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                            }
+                            if (r.data.invoice_show) {
                                 $(".lookinvoice").css("display", "").on("click", function () {
                                     checkinvoice(r.data.applybill_status, orderCode)//查看发票
                                 })
@@ -231,14 +232,7 @@
 
 
             $(".openinvoice").on("click", function () {
-                //return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
         })
 
@@ -307,14 +301,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 12 - 19
src/web/templates/order/pc/datareport/detail.html

@@ -166,9 +166,10 @@
                         $(".pay_num_p").css("display", "");
                         if (r.data.orderInfo.paymentId) $(".pay_num").text(r.data.orderInfo.paymentId);
                         //发票
-                        if (r.data.orderInfo.applybillStatus === 0) {
+                        if (r.data.orderInfo.is_can_invoice) {
                             $(".openinvoice").css("display", "");
-                        } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                        }
+                        if (r.data.invoice_show) {
                             $(".lookinvoice").css("display", "").on("click", function () {
                                 checkinvoice(r.data.applybill_status, orderCode)
                             })
@@ -195,15 +196,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    var hash = escape("超级订阅");
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
             $(".payOrder").on("click", function () {
                 location.href = "/front/datareport/orderPay/" + orderCode;
@@ -251,14 +244,14 @@
 
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 12 - 18
src/web/templates/order/pc/filePack/detail.html

@@ -190,9 +190,10 @@
                             $(".pay_num_p").css("display", "");
                             if (r.data.transaction_id) $(".pay_num").text(r.data.transaction_id);
                             //发票
-                            if (r.data.order.applybill_status === 0) {
+                            if (r.data.order.is_can_invoice) {
                                 $(".openinvoice").css("display", "");
-                            } else if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
+                            }
+                            if (r.data.invoice_show) {
                                 $(".lookinvoice").css("display", "").on("click", function () {
                                     checkinvoice(r.data.applybill_status, orderCode)//查看发票
                                 })
@@ -231,14 +232,7 @@
 
 
             $(".openinvoice").on("click", function () {
-                //return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
         })
 
@@ -307,14 +301,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 12 - 18
src/web/templates/order/pc/integral/integralDetail.html

@@ -200,9 +200,10 @@
                             $(".pay_num_p").show();
                         }
                         //发票
-                        if (r.data.applybill_status === 0) {
+                        if (r.data.is_can_invoice) {
                             $(".openinvoice").css("display", "");
-                        } else if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
+                        }
+                        if (r.data.invoice_show) {
                             $(".lookinvoice").css("display", "").on("click", function () {
                                 checkinvoice(r.data.applybill_status, orderCode)
                             })
@@ -242,14 +243,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
 
             $(".payOrder").on("click", function () {
@@ -340,14 +334,14 @@
 
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 17 - 27
src/web/templates/pc/aiPack_orderDetail.html

@@ -222,17 +222,14 @@
                             $(".pay_num").text(r.data.prepay_id);
                             $(".pay_num_p").css("display", "");
                         }
-                        if (source===""){
-                            if (r.data.is_backstage_order!==1){
-                                //发票
-                                if (r.data.applybill_status === 0) {
-                                    $(".openinvoice").css("display", "");
-                                }  else if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
-                                    $(".lookinvoice").css("display", "").on("click", function () {
-                                        checkinvoice(r.data.applybill_status, orderCode)
-                                    })
-                                }
-                            }
+                        //发票
+                        if (r.data.is_can_invoice) {
+                            $(".openinvoice").css("display", "");
+                        }
+                        if (r.data.invoice_show) {
+                            $(".lookinvoice").css("display", "").on("click", function () {
+                                checkinvoice(r.data.applybill_status, orderCode)
+                            })
                         }
                     }
                     if (r.data.order_status === -2) {
@@ -269,14 +266,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
 
             $(".payOrder").on("click", function () {
@@ -376,14 +366,14 @@
 
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 228 - 36
src/web/templates/pc/check_invoice.html

@@ -20,6 +20,10 @@
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/iconfont/iconfont.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/css/reset_pc.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/css/check_invoice.css?v={{Msg "seo" "version"}}">
+    <link href="//cdn-common.jianyu360.com/cdn/lib/element-ui/2.15.7/lib/theme-chalk/index.css" rel="stylesheet" />
+    <script src=//cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js></script>
+    <script src=//cdn-common.jianyu360.com/cdn/lib/element-ui/2.15.7/lib/index.js></script>
+    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/big-member/js/utils.js"></script>
     <!--[if lt IE 9]>
             <script src="https://cdn-common.jianyu360.com/cdn/lib/html5shiv/3.7.3/html5shiv.min.js"></script>
             <script src="https://cdn-common.jianyu360.com/cdn/lib/respond-js/1.4.2/respond.min.js"></script>
@@ -43,27 +47,55 @@
     <!-- header -->
 	{{include "/common/pchead.html"}}
     <!-- main  START -->
-    <div class="check_invoice" id="check_invoice">
+    <div class="check_invoice" id="check_invoice" style="display: none;">
         <div class="w ci_crumb">
             <a href="javascript:;" data-type="work-bench" data-href="/front/swordfish/toMyOrder">我的订单</a><em> > </em>
             <a href="javascript:;" class="active">查看发票</a>
         </div>
-        <div class="w step clearfix">
+        <div class="w invoice_status" v-if="invoiceData.length > 1">
+          <div class="white_shadow left_shadow" @click="clickArrow('left')" v-if="leftBtn">
+            <div class="el-iconfont">
+              <i class="el-icon-arrow-left"></i>
+            </div>
+          </div>
+          <div class="invoice_num">共 <span style="color: #2ABED1;" class="num">${invoiceData.length}</span> 张发票</div>
+          <div class="invoice_main">
+            <div class="invoice_status_list">
+              <div class="invoice_status_item" @click="changeInvoice(item)" :class="{'active': item.active}" v-for="(item, index) in invoiceData" :key="index" >
+                <div class="invoice_status_item_title">${item.info.title}</div>
+                <div class="invoice_status_item_content">申请时间: ${item.info.time}</div>
+              </div>
+            </div>
+          </div>
+          <div class="white_shadow right_shadow" @click="clickArrow('right')" v-if="showRightBtn && rightBtn">
+            <div class="el-iconfont">
+              <i class="el-icon-arrow-right"></i>
+            </div>
+          </div>
+        </div>
+        <div class="w step clearfix" v-if="selectinvoice.invoice_status !== -1">
             <!-- 进行中 类名为 active  已完成 类名为 finish  未完成默认颜色-->
-            <div id="l" class="pro l active"></div>
-            <div id="c" class="pro c">财务处理</div>
-            <div id="r" class="pro r">发票开具</div>
+            <div id="l" class="pro l active finish">已提交</div>
+            <div id="c" class="pro c" :class="{'active': selectinvoice.invoice_status === 0, 'finish': selectinvoice.invoice_status === 1}">财务处理</div>
+            <div id="r" class="pro r" :class="{'active': selectinvoice.invoice_status === 1}">发票开具</div>
             <div class="rules" data-toggle="modal" data-target="#ruleModal">开票规则</div>
         </div>
+        <div class="w step invoice_fail_container" v-else>
+          <div class="invoice_fail">
+            <div class="invoice_fail_title"><i class="el-icon-error"></i>开票失败</div>
+            <div class="invoice_fail_content">公司名称/单位税号填写错误,请核实开票信息再次申请开票</div>
+          </div>
+          <div class="rules" data-toggle="modal" data-target="#ruleModal">开票规则</div>
+        </div>
         <div class="w ci_main">
             <!-- 订单信息 -->
             <div class="ci_list">
                 <div class="list_thead">
-                    <span>订单编号:<span class="order_code"></span></span>
+                    <span>订单编号:<span class="order_code">${selectinvoice.invoice_order_code}</span></span>
                 </div>
                 <div class="list_tbody">
-                    <p>发票类型:普通发票(电子发票)  </p>
-                    <p>发票内容:明细</p>
+                    <p>发票类型:${selectinvoice.invoice_variety} </p>
+                    <p>发票内容:${selectinvoice.invoice_content}</p>
                 </div>
             </div>
             <!-- 发票信息 -->
@@ -72,21 +104,31 @@
                     <span>发票信息</span>
                 </div>
                 <div class="list_tbody">
-					<p>发票抬头:<span id="fptt"></span></p>
-                    <p class="displaynone company_p">公司名称:<span class="company_name"></span></p>
-                    <p class="displaynone tax_p">纳税人识别号:<span class="tax_num"></span></p>
-                    <p>手机号:<span class="phonenum"></span></p>
-                    <p>电子邮箱:<span class="mail"></span></p>
+					          <p>发票抬头:<span>${selectinvoice.invoice_type}</span></p>
+                    <div v-if="selectinvoice.invoice_type == '单位'">
+                      <p>公司名称:<span class="company_name">${selectinvoice.company_name || '--'}</span></p>
+                      <p>单位税号:<span class="tax_num">${selectinvoice.taxpayer_identnum || '--'}</span></p>
+                      <p>单位地址:<span class="company_address">${selectinvoice.company_address || '--'}</span></p>
+                      <p>电话号码:<span class="phonenum">${selectinvoice.company_phone || '--'}</span></p>
+                      <p>开户银行:<span class="bank_name">${selectinvoice.bank_name || '--'}</span></p>
+                      <p>银行账号:<span class="bank_account">${selectinvoice.bank_account || '--'}</span></p>
+                      <p>开票备注:<span class="remark">${selectinvoice.remark || '--'}</span></p>
+                    </div>
+                    <p>联系电话:<span class="phonenum">${selectinvoice.phone || '--'}</span></p>
+                    <p>电子邮箱:<span class="mail">${selectinvoice.mail || '--'}</span></p>
+                    <p v-if="selectinvoice.invoice_type == '个人'">开票备注:<span class="remark">${selectinvoice.remark || '--'}</span></p>
                 </div>
             </div>
             <!-- 状态 -->
             <div class="btn-cells">
-              <p class="backInvoice backP" style="display: none;padding-bottom: 8px;color: red;">系统问题,开票失败</p>
-              <button class="btn btn-confirm backInvoice" style="display: none;">重新开票</button>
-              <button class="btn btn-confirm" id="ing" disabled id="opening" style="border: 0;">开票中</button>
-              <button class="btn btn-confirm" style="display: none;" id="look_invoice">查看发票</button>
-              <button class="btn btn-cancel" style="display: none;" id="again_invoice">换开申请</button>
-              <p style="text-align: center;font-size: 14px;color: #686868;padding: 12px 0">您申请的发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收。</p>
+              <!-- <p class="backInvoice backP" style="display: none;padding-bottom: 8px;color: red;">系统问题,开票失败</p> -->
+              <button class="btn btn-confirm" id="ing" disabled v-if="selectinvoice.invoice_status == 0 || selectinvoice.invoice_status == 2">开票中</button>
+              <button class="btn btn-confirm" @click="lookInvoice" id="look_invoice" v-if="selectinvoice.invoice_status == 1 && selectinvoice.url">查看发票</button>
+              <button class="btn btn-cancel" @click="againInvoice('replace')" id="again_invoice" v-if="selectinvoice.invoice_status == 1 && !selectinvoice.changed">换开申请</button>
+              <button class="btn btn-confirm" @click="againInvoice('again')" v-if="selectinvoice.invoice_status == -1 && !selectinvoice.isReopen">再次开票</button>
+              <button class="btn btn-confirm open-customer" @click="concatKf" v-if="selectinvoice.isReopen">联系客服</button>
+              <p v-if="selectinvoice.invoice_status == 0 || selectinvoice.invoice_status == 2" style="text-align: center;font-size: 14px;color: #686868;padding: 12px 0">您申请的发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收。</p>
+              <p v-if="selectinvoice.invoice_status == 1" style="text-align: center;font-size: 14px;color: #686868;padding: 12px 0">您申请的发票已由平台开具并发送至您的邮箱,请注意查收。</p>
             </div>
         </div>
         <!-- 开票规则弹窗 -->
@@ -98,11 +140,10 @@
                     </div>
                     <div class="modal-body">
                         <div class="text" style="text-align:justify;">
-                          1.平台提供电子普通发票,您可点击“我的订单-开发票”,开票内容统一为“信息技术服务”。<br>
-                          2.您申请的发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收。<br>
-                          3.购买线上产品服务,请在订单完成90天内,申请开票,逾期请联系客服,开具纸质发票。<br>
-                          4.如需开具增值税专用发票,请联系客服,开票金额<200元发票邮寄费用自行承担。 <br>
-                          客服电话:400-108-6670
+                          1.平台提供电子普通发票、电子专用发票,发票内容为可选“信息技术服务-技术服务费”、“信息技术服务-会员费”、“信息技术服务-招投标数据服务”;<br>
+                          2.您申请的电子发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收;<br>
+                          3.新开具的数电发票共有3种格式:PDF、OFD、XML,手机端查看发票默认为PDF格式,如需OFD、XML格式,可前往邮箱或剑鱼标讯电脑端查看发票并下载;<br>
+                          4.如有问题可联系客服,客服电话:400-108-6670。<br>
                         </div>
                     </div>
                     <div class="modal-footer">
@@ -131,8 +172,6 @@
     <!-- footer -->
 	{{include "/common/pcbottom.html"}}
 	{{include "/common/baiducc.html"}}
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/jquery-2.1.4.min.js"></script>
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/bootstrap.min.js"></script>
     <script>
   $(function () {
       $('#ruleModal').on('show.bs.modal', function () {
@@ -144,8 +183,8 @@
           });
       });
 			var order_code={{.T.order_code}};
-			$(".order_code").text(order_code)
-			viewInvoice(order_code)
+			// $(".order_code").text(order_code)
+			// viewInvoice(order_code)
 			//checkInvoice(order_code);
 			var changed = false;
 			var interval;
@@ -266,13 +305,13 @@
 				}, 2000)
 			}
 
-			$("#again_invoice").on("click",function(){
-        if(!redInvoiceSwitch){
-          $('#switchModal').modal('show').find('.text').text(redInvoiceMsg);
-        }else{
-				  window.location.href = "/front/order/invoice/"+ order_code +"?changed=true";
-        }
-			})
+			// $("#again_invoice").on("click",function(){
+      //   if(!redInvoiceSwitch){
+      //     $('#switchModal').modal('show').find('.text').text(redInvoiceMsg);
+      //   }else{
+			// 	  window.location.href = "/front/order/invoice/"+ order_code +"?changed=true";
+      //   }
+			// })
 
 			function viewInvoice(order_code){
 				$.post("/jypay/invoice/show",{"order_code":order_code},function(r){
@@ -394,7 +433,160 @@
 					}
 				})
 			})
-
+      var invoiceDetailNode = new Vue({
+        el: '#check_invoice',
+        delimiters: ['${', '}'],
+        data() {
+          return {
+            invoiceData: [],
+            selectinvoice: {},
+            loading: true,
+            leftBtn: false,
+            rightBtn: true,
+            invoice_text: '',
+            showRightBtn: false
+          }
+        },
+        created() {
+          this.getInvoiceShowList();
+        },
+        mounted() {
+          $('#check_invoice').show()
+          this.$nextTick(() => {
+            const checkInvoiceDisplay = () => {
+              let canhandleNum = 0
+              const itemAllWidth = $('.invoice_status_item').map(function() {
+                return $(this).outerWidth() + 12;
+              }).get();
+              this.showRightBtn = itemAllWidth.reduce((sum, width) => sum + width, 0) - 1200 > 0;
+              if (itemAllWidth.length === 0 && canhandleNum < 10) {
+                canhandleNum++
+                setTimeout(checkInvoiceDisplay, 50)
+              }
+            }
+            checkInvoiceDisplay()
+          })
+        },
+        methods: {
+          // 联系客服
+          concatKf: function () {
+            if (goTemplateData.inIframe) {
+              window.$BRACE.$emit('open-customer')
+            } else {
+              // 打开客服弹窗
+              checkCustomerService()
+            }
+          },
+          getInvoiceShowList() {
+            const url = '/jypay/invoice/showList'
+            const params = {
+              order_code: order_code
+            }
+            this.ajaxComponent(url, params).then(res => {
+              if (res && res.status === 'success') {
+                const list = res?.invoiceData
+                if(list.length) {
+                  list.forEach((e, i) => {
+                    let info = {
+                      title: '',
+                      time: ''
+                    }
+                    info.time = new Date(e.create_time * 1000).pattern('yyyy-MM-dd')
+                    switch (e.invoice_status) {
+                      case -2:
+                        // 已冲红
+                        info.title = '已冲红'
+                        break;
+                      case -1:
+                        // 开票失败
+                        info.title = '开票失败'
+                        break;
+                      case 0:
+                        // 开票中
+                        info.title = '开票中'
+                        break;
+                      case 1:
+                        // 开票成功
+                        info.title = '已开具'
+                        break;
+                      default:
+                        break;
+                    }
+                    e.info = info
+                    e.active = false
+                    if(i == 0) {
+                      e.active = true
+                    }
+                  });
+                  this.invoiceData = list
+                  this.selectinvoice = list[0]
+                }
+              }
+            })
+          },
+          changeInvoice(item) {
+            this.invoiceData.forEach(e => {
+              e.active = false
+            });
+            item.active = true
+            this.selectinvoice = item
+          },
+          clickArrow(data) {
+            var invoiceStatusList = $('.invoice_status_list');
+            var invoiceStatusListWidth = invoiceStatusList.width();
+            var itemAllWidth = $('.invoice_status_item').map(function() {
+              return $(this).outerWidth() + 12; // 获取包括内边距的宽度 + margin值
+            }).get();
+            itemAllWidth = itemAllWidth.reduce((a, b) => a + b) - 1200;
+            var currentLeft = invoiceStatusList.position().left;
+            if(data == 'right') {
+              this.leftBtn = true
+              if(currentLeft <= -itemAllWidth) {
+                invoiceStatusList.css('left', -itemAllWidth + 'px');
+                this.rightBtn = false
+                return;
+              }
+              invoiceStatusList.css('left', currentLeft - 100 + 'px');
+            } else {
+              if(currentLeft >= 0) {
+                this.leftBtn = false
+                this.rightBtn = true
+                invoiceStatusList.css('left', 0 + 'px');
+                return;
+              }
+              this.rightBtn = true
+              invoiceStatusList.css('left', currentLeft + 100 + 'px');
+            }
+          },
+          // 查看发票
+          lookInvoice() {
+            if(this.selectinvoice.invoice_status == 1) {
+              window.open(this.selectinvoice.url, '_blank');
+            }
+          },
+          // 换开发票
+          againInvoice(type) {
+            location.href = `/front/order/invoice/${order_code}?type=${type}&invoiceid=${this.selectinvoice.id}`
+          },
+          // 封装公共ajax
+          ajaxComponent(url, params, contentType) {
+            return new Promise((resolve, reject) => {
+              $.ajax({
+                type: "POST",
+                url: url,
+                contentType: contentType || 'application/x-www-form-urlencoded',
+                data: contentType ? JSON.stringify(params) : params || {},
+                success: function (res) {
+                  resolve(res)
+                }.bind(this),
+                error: function (err) {
+                  reject(err)
+                }.bind(this)
+              });
+            });
+          }
+        }
+      })
 		})
 
 		$("#public-nav").css("background","#fff");

+ 12 - 18
src/web/templates/pc/dataPack/packDetail.html

@@ -218,9 +218,10 @@
                             $(".pay_num_p").css("display", "");
                             if (r.data.transaction_id) $(".pay_num").text(r.data.transaction_id);
                             //发票 "item.applybill_status === 0 &&  && item.is_backstage_order === 0"
-                            if (r.data.order.applybill_status === 0 && r.data.order.billingMode === 1 && r.data.order.is_backstage_order === 0) {
+                            if (r.data.order.is_can_invoice) {
                                 $(".openinvoice").css("display", "");
-                            } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                            } 
+                            if (r.data.invoice_show) {
                                 $(".lookinvoice").css("display", "").on("click", function () {
                                     checkinvoice(r.data.applybill_status, orderCode)//查看发票
                                 })
@@ -270,14 +271,7 @@
             }
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
             function diffCountdown (endTime) {
               timerId = setInterval(function() {
@@ -382,14 +376,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
         // 获取服务端时间

+ 12 - 19
src/web/templates/pc/entniche_orderDetail.html

@@ -155,9 +155,10 @@
                         $(".pay_num_p").css("display", "");
                         if (r.data.prepay_id) $(".pay_num").text(r.data.prepay_id);
                         //发票
-                        if (r.data.applybill_status === 0) {
+                        if (r.data.is_can_invoice) {
                             $(".openinvoice").css("display", "");
-                        } else if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
+                        }
+                        if (r.data.invoice_show) {
                             $(".lookinvoice").css("display", "").on("click", function () {
                                 checkinvoice(r.data.applybill_status, orderCode)//查看发票
                             })
@@ -177,15 +178,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    var hash = escape("超级订阅");
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
 
             $(".payOrder").on("click", function () {
@@ -217,14 +210,14 @@
 
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 514 - 151
src/web/templates/pc/invoice.html

@@ -22,6 +22,10 @@
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/css/reset_pc.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/css/city-picker.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/electronic_invoice/css/invoice.css?v={{Msg "seo" "version"}}">
+    <link href="//cdn-common.jianyu360.com/cdn/lib/element-ui/2.15.7/lib/theme-chalk/index.css" rel="stylesheet" />
+    <script src=//cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js></script>
+    <script src=//cdn-common.jianyu360.com/cdn/lib/element-ui/2.15.7/lib/index.js></script>
+    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/big-member/js/utils.js"></script>
     <!--[if lt IE 9]>
             <script src="https://cdn-common.jianyu360.com/cdn/lib/html5shiv/3.7.3/html5shiv.min.js"></script>
             <script src="https://cdn-common.jianyu360.com/cdn/lib/respond-js/1.4.2/respond.min.js"></script>
@@ -43,12 +47,29 @@
 	input:-ms-input-placeholder { /* Internet Explorer 10+ */
 	    color: #999999;
 	}
+  .custom-toast {
+    /* display: none; */
+  }
+  .custom-toast .toast-container{
+    /* display: none; */
+    position: fixed;
+    top: 50%;
+    left: 50%;
+    width: auto;
+    padding: 16px 32px;
+    font-size: 16px;
+    background: rgba(0, 0, 0, 0.65);
+    border-radius: 8px;
+    color: #fff;
+    transform: translateX(-50%) translateY(-50%);
+    z-index: 99;
+  }
 </style>
-<body class="hidden">
+<body>
     <!-- header -->
 	{{include "/common/pchead.html"}}
     <!-- main  START -->
-    <div class="invoice" id="invoice">
+    <div class="invoice" id="invoice" v-loading="loading">
         <div class="w invoice_crumb">
             <a href="javascript:;" data-type="work-bench" data-href="/front/swordfish/toMyOrder">我的订单</a><em> > </em>
             <a href="" class="active">开发票</a>
@@ -56,73 +77,76 @@
         <div class="w invoice_main">
             <div class="i_m_head">开发票<a style="float: right;color: #2CB7CA;" data-toggle="modal" data-target="#ruleModal">开票规则</a></div>
             <div class="i_m_body">
-                <div class="invariability">
-                    <div class="clearfix invoice_control">
-                        <div class="fl invoice_control_label">订单编号:</div>
-                        <div class="fl order_code"></div>
-                    </div>
-                    <div class="clearfix invoice_control">
-                        <div class="fl invoice_control_label">发票类型:</div>
-                        <div class="fl">普通发票(电子发票)</div>
-                    </div>
-                    <div class="clearfix invoice_control">
-                        <div class="fl invoice_control_label">发票内容:</div>
-                        <div class="fl">明细</div>
-                    </div>
-                    <div class="clearfix invoice_control">
-                        <div class="fl invoice_control_label">发票抬头:</div>
-                        <div class="fl invoice_control_select" id="invoice_title"></div>
-                    </div>
-                </div>
+                <el-form  :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
+                  <el-form-item label="订单编号:" >
+                    <div>${ruleForm.order_code}</div>
+                  </el-form-item>
+                  <el-form-item label="发票类型:">
+                    <el-radio-group v-model="ruleForm.invoice_variety">
+                      <el-radio label="电子普通发票">电子普通发票</el-radio>
+                      <el-radio label="电子专用发票">电子专用发票</el-radio>
+                    </el-radio-group>
+                  </el-form-item>
+                  <el-form-item label="发票内容:" class="invoice_select">
+                    <el-select popper-class="invoice_select_option" v-model="ruleForm.invoice_content">
+                      <el-option v-for="(item, index) in invoiceContentList" :label="item.label" :key="index" :value="item.label"></el-option>
+                    </el-select>
+                  </el-form-item>
+                  <el-form-item label="发票抬头:">
+                    <el-radio-group v-model="ruleForm.invoice_type">
+                      <el-radio v-if="ruleForm.invoice_variety != '电子专用发票'" label="个人"></el-radio>
+                      <el-radio label="单位"></el-radio>
+                    </el-radio-group>
+                  </el-form-item>
+                  <div class="invoice_unit" v-if="ruleForm.invoice_type == '单位'">
+                    <el-form-item label="公司名称:" class="invoice_unit_name" prop="company_name">
+                      <el-input @blur="handleBlur" @input="handleInput" placeholder="请输入公司名称" v-model="ruleForm.company_name"></el-input>
+                      <el-card class="box-card" v-if="companyList.length">
+                        <div @click="handleClick(item)" v-html="setHighLight(item)" v-for="(item, index) in companyList" :key="index" class="list-item"></div>
+                      </el-card>
+                    </el-form-item>
+                    <el-form-item label="单位税号:" prop="taxpayer_identnum">
+                      <el-input placeholder="请输入单位税号" v-model="ruleForm.taxpayer_identnum"></el-input>
+                    </el-form-item>
+                    <el-form-item style="min-height: 36px;height: auto;" label="单位地址:" :rules="[{ required: ruleForm.invoice_variety == '电子专用发票', message: '请输入单位地址', trigger: 'blur' }]" prop="company_address">
+                      <el-input ref="company_address" :style="{height: addressHeight + 'px'}" type="textarea" :rows="1" placeholder="请输入单位地址" v-model="ruleForm.company_address"></el-input>
+                    </el-form-item>
+                    <el-form-item label="电话号码:" prop="company_phone" :rules="[{ required: ruleForm.invoice_variety == '电子专用发票', message: '请输入电话号码', trigger: 'blur' }, { validator: validateTelPhone, trigger: 'blur' }]">
+                      <el-input placeholder="请输入电话号码" v-model="ruleForm.company_phone"></el-input>
+                    </el-form-item>
+                    <el-form-item label="开户银行:" prop="bank_name" :rules="[{ required: ruleForm.invoice_variety == '电子专用发票', message: '请输入开户银行', trigger: 'blur' }]">
+                      <el-input placeholder="请输入开户银行" v-model="ruleForm.bank_name"></el-input>
+                    </el-form-item>
+                    <el-form-item label="银行账号:" prop="bank_account" :rules="[{ required: ruleForm.invoice_variety == '电子专用发票', message: '请输入银行账号', trigger: 'blur' }, { validator: validateBankAccount, trigger: 'blur' }]">
+                      <el-input placeholder="请输入银行账号" v-model="ruleForm.bank_account"></el-input>
+                    </el-form-item>
+                    <el-form-item style="min-height: 36px;height: auto;" class="invoice_desc" label="开票备注:">
+                      <el-input ref="remark" :style="{height: remarkHeight + 'px'}" :rows="1" placeholder="非必填,此部分内容会展示在发票“备注”上,请按照贵司财务要求进行填写" type="textarea" v-model="ruleForm.remark"></el-input>
+                    </el-form-item>
+                  </div>
+                  <el-form-item label="联系电话:" prop="phone">
+                    <el-input placeholder="请输入手机号" v-model="ruleForm.phone"></el-input>
+                  </el-form-item>
+                  <el-form-item  label="电子邮箱:" prop="mail">
+                    <el-input placeholder="邮箱用于接收电子发票" v-model="ruleForm.mail"></el-input>
+                  </el-form-item>
+                  <el-form-item style="min-height: 36px;height: auto;" v-if="ruleForm.invoice_type == '个人'" label="开票备注:">
+                    <el-input ref="remark" :style="{height: remarkHeight + 'px'}" :rows="1" placeholder="非必填,此部分内容会展示在发票“备注”上,请按照贵司财务要求进行填写" type="textarea" v-model="ruleForm.remark"></el-input>
+                  </el-form-item>
+                  <el-form-item style="margin-top: 32px;">
+                    <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
+                    <el-button @click="resetForm('ruleForm')">取消</el-button>
+                  </el-form-item>
+                </el-form>
                 <!-- 单位发票信息 -->
-                <div class="unit_invoice">
-                    <div class="clearfix invoice_control" id="unitName">
-                        <div class="fl invoice_control_label">公司名称:</div>
-                        <div class="fl invoice_control_input" name="" id="">
-                            <input type="text" placeholder="请输入公司名称" class="unit_name">
-                        </div>
-                        <span class="error"><i class="iconfont icon-cuowutishi"></i>开票单位名称格式不正确</span>
-                        <span class="success"><i class="iconfont icon-zhengquetishi"></i></span>
-                    </div>
-                    <div class="clearfix invoice_control" id="txtNumber">
-                        <div class="fl invoice_control_label">纳税人识别号:</div>
-                        <div class="fl invoice_control_input" name="" id="">
-                            <input type="text" placeholder="请输入纳税人识别号" maxlength="18" class="taxpayer_number">
-                        </div>
-                        <span class="error"><i class="iconfont icon-cuowutishi"></i>纳税人识别号格式不正确</span>
-                        <span class="success"><i class="iconfont icon-zhengquetishi"></i></span>
-                    </div>
-                </div>
-                <div class="common_invoice">
-                    <div class="clearfix invoice_control" id="telBox">
-                        <div class="fl invoice_control_label">手机号:</div>
-                        <div class="fl invoice_control_input" name="" id="">
-                            <input type="text" placeholder="请输入手机号" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" class="tel">
-                        </div>
-                        <span class="error"><i class="iconfont icon-cuowutishi"></i>手机号格式不正确</span>
-                        <span class="success"><i class="iconfont icon-zhengquetishi"></i></span>
-                    </div>
-                    <div class="clearfix invoice_control" id="emailBox">
-                        <div class="fl invoice_control_label">电子邮箱:</div>
-                        <div class="fl invoice_control_input" name="" id="">
-                            <input type="text" placeholder="邮箱用于接收电子发票" class="email">
-                        </div>
-                        <span class="error"><i class="iconfont icon-cuowutishi"></i>邮箱格式不正确</span>
-                        <span class="success"><i class="iconfont icon-zhengquetishi"></i></span>
-                    </div>
-                </div>
-                <div class="invoice_btn">
-                    <button class="submit_btn save-btn" disabled>提交</button>
-                    <button class="cancel_btn">取消</button>
-                </div>
                 <p style="text-align: justify;font-size: 14px;color: #686868;padding: 12px 0 12px 100px;">您申请的发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收。</p>
             </div>
         </div>
         <!-- toast提示框 -->
-        <div class="toast">
+        <!-- <div class="toast" v-if="toastStatus.toastShow">
             <i class="iconfont icon-zhifuwancheng"></i>
-            <span>提交成功</span>
-        </div>
+            <span>${toastStatus.text}</span>
+        </div> -->
     </div>
 	  <div class="modal fade" id="ruleModal" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
 	    <div class="modal-dialog">
@@ -132,11 +156,10 @@
 	            </div>
 	            <div class="modal-body">
 	                <div class="text">
-                    1.平台提供电子普通发票,您可点击“我的订单-开发票”,开票内容统一为“信息技术服务”。<br>
-                    2.您申请的发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收。<br>
-                    3.购买线上产品服务,请在订单完成90天内,申请开票,逾期请联系客服,开具纸质发票。<br>
-                    4.如需开具增值税专用发票,请联系客服,开票金额<200元发票邮寄费用自行承担。 <br>
-                    客服电话:400-108-6670
+                    1.平台提供电子普通发票、电子专用发票,发票内容为可选“信息技术服务-技术服务费”、“信息技术服务-会员费”、“信息技术服务-招投标数据服务”;<br>
+                    2.您申请的电子发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收;<br>
+                    3.新开具的数电发票共有3种格式:PDF、OFD、XML,手机端查看发票默认为PDF格式,如需OFD、XML格式,可前往邮箱或剑鱼标讯电脑端查看发票并下载;<br>
+                    4.如有问题可联系客服,客服电话:400-108-6670。<br>
 	                </div>
 	            </div>
 	            <div class="modal-footer">
@@ -164,92 +187,15 @@
 	{{include "/common/pcbottom.html"}}
 	{{include "/common/baiducc.html"}}
     <!-- footer -->
-    <script src="{{Msg "seo" "cdn"}}/common-module/public/js/city-picker.data.js"></script>
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/city/city-picker.js"></script>
+    <!-- <script src="{{Msg "seo" "cdn"}}/common-module/public/js/city-picker.data.js"></script>
+    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/city/city-picker.js"></script> -->
     <!-- custom_select.js 为封装select控件 修改原生select样式 -->
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/custom_select.js"></script>
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/invoice.js?v={{Msg "seo" "version"}}"></script>
+    <!-- <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/custom_select.js"></script> -->
 	<script>
 		  $(function(){
-        var orderCode = {{.T.order_code}};
-        // 查询是否可以开发票
-        $.ajax({
-          url: '/jypay/invoice/switch',
-          type: "GET",
-          success: function(res) {
-            if (res.code === '1001') {
-              $('body').removeClass('hidden')
-              // 不能开票
-              $('#switchModal').modal('show').find('.text').text(res.messge)
-              return
-            } else{
-              $.post("/jypay/invoice/available",{order_code:orderCode},function(rr){
-                if(rr.status==0){
-                  window.location.replace("/front/order/invoicetimeOut?f=upgrade")
-                }else{
-                  $("body").removeClass("hidden");
-          			  var order_mail = {{.T.mail}};
-          			  var order_phone = {{.T.phone}};
-          			  if(order_mail!==""&&order_mail!==null&&order_mail!==undefined){
-          				$(".email").val(order_mail)
-          				$(".email").parent().siblings('.success').show();
-          			  }
-          			  if(order_phone!==""&&order_phone!==null&&order_phone!==undefined){
-          			  	$(".tel").val(order_phone)
-          				$(".tel").parent().siblings('.success').show();
-          			  }
-          			  var isSys = getParam("isSys");
-          			  if(isSys === "true"){
-        			  	  $.ajax({
-        			  	  	type: 'POST',
-        			  	  	url: '/jypay/invoice/show',
-        			  	  	data: {"order_code":orderCode},
-        					    success: function(r){
-            						if(r.status === "processing"){
-            							if(r.data.invoice_type === "个人"){
-            								$(".email").val(r.data.mail);
-            								$(".tel").val(r.data.phone);
-            								$(".email").parent().siblings('.success').show();
-            								$(".tel").parent().siblings('.success').show();
-            							}else{
-            								$(".email").val(r.data.mail);
-            								$(".tel").val(r.data.phone);
-            								$(".unit_name").val(r.data.company_name);
-            								$(".taxpayer_number").val(r.data.taxpayer_identnum);
-            								$(".email").parent().siblings('.success').show();
-            								$(".tel").parent().siblings('.success').show();
-            								$(".unit_name").parent().siblings('.success').show();
-            								$(".taxpayer_number").parent().siblings('.success').show();
-            								$("#invoice_title > button").text("单位")
-            								$(".unit_invoice").show();
-            							}
-            						}
-        					    }
-        			  	  });
-          			  }
-          			  checkForm();
-          			  var order_code = {{.T.order_code}};
-          			  $(".order_code").text(order_code);
-          			  $(".cancel_btn").on("click",function(){
-          					window.history.go(-1);
-          			  })
-
-          			  $('#ruleModal').on('show.bs.modal', function () {
-          			      var $this = $(this);
-          			      var $modal_dialog = $this.find('.modal-dialog');
-          			      $this.css('display', 'block');
-          			      $modal_dialog.css({
-          			          'margin-top': Math.max(0, ($(window).height() - $modal_dialog.height()) / 2)
-          			      });
-          			  });
-
-          			  $("#public-nav").css("background","#fff");
-          			  $(".public-nav").css("border-bottom", "1px solid #e0e0e0");
-                }
-              });
-            }
-          }
-        })
+        var order_code = {{.T.order_code}};
+        var order_mail = {{.T.mail}};
+        var order_phone = {{.T.phone}};
         haslogin({{.T.logid}});
         $('#i-know-btn').on('click', function () {
             // 新窗口打开
@@ -263,6 +209,423 @@
                 history.back()
             }
         })
+        var invoiceNode = new Vue({
+          el: '#invoice',
+          delimiters: ['${', '}'],
+          data() {
+            return {
+              ruleForm: {
+                order_code: '',
+                invoice_content: '信息技术服务-技术服务费',
+                invoice_type: '单位',
+                invoice_variety: '电子普通发票',
+                mail: '',
+                phone: '',
+                remark: '',
+                company_name: '',
+                taxpayer_identnum: '',
+                company_address: '',
+                company_phone: '',
+                bank_name: '',
+                bank_account: ''
+              },
+              invoiceContentList: [
+                {
+                  label: '信息技术服务-技术服务费',
+                  value: '信息技术服务-技术服务费'
+                },
+                {
+                  label: '信息技术服务-会员费',
+                  value: '信息技术服务-会员费'
+                },
+                {
+                  label: '信息技术服务-招投标数据服务',
+                  value: '信息技术服务-招投标数据服务'
+                }
+              ],
+              rules: {
+                phone: [
+                  { required: true, message: '请输入手机号', trigger: 'blur' },
+                  { validator: this.validatePhone, trigger: 'blur' }
+                ],
+                mail: [
+                  { validator: this.validateMail, trigger: 'blur' },
+                  { required: true, message: '请输入邮箱地址', trigger: 'blur' }
+                ],
+                company_name: [
+                  { required: true, message: '请输入公司名称', trigger: 'blur' },
+                  { validator: this.validateCompany, trigger: 'blur' }
+                ],
+                taxpayer_identnum: [
+                  { required: true, message: '请输入纳税人识别号', trigger: 'blur' },
+                  { validator: this.validateCode, trigger: 'blur' }
+                ]
+              },
+              companyList: [],
+              urlParams: {
+                type: '',
+                invoiceid: '',
+                only_Identifying: ''
+              },
+              addressHeight: 36,
+              remarkHeight: 36,
+              loading: false
+            }
+          },
+          created () {
+            this.ruleForm.order_code = order_code
+            this.ruleForm.mail = order_mail
+            this.ruleForm.phone = order_phone
+            const type = utils.getParam('type')
+            const invoiceid = utils.getParam('invoiceid')
+            this.urlParams.type = type
+            this.urlParams.invoiceid = invoiceid
+            this.setPageOver()
+            this.invouceInfoEcho()
+          },
+          watch: {
+            'ruleForm.invoice_variety': {
+              handler (val) {
+                // 清空校验
+                if (val === '电子专用发票') {
+                  this.ruleForm.invoice_type = '单位'
+                }
+                if(val) {
+                  this.$refs['ruleForm'].clearValidate();
+                }
+              },
+              // immediate: true
+            },
+            'ruleForm.company_address': {
+              handler() {
+                this.addressHeight = this.getTextareaHeight(this.$refs.company_address.$el);
+              }
+            },
+            'ruleForm.remark': {
+              handler() {
+                this.remarkHeight = this.getTextareaHeight(this.$refs.remark.$el);
+              }
+            },
+            'ruleForm.invoice_type': {
+              handler(val) {
+                // 清空校验
+                this.$refs['ruleForm'].clearValidate();
+              }
+            }
+          },
+          methods: {
+            // 查询是否可以开发票
+            setPageOver () {
+              const switchUrl = '/jypay/invoice/switch'
+              const url = '/jypay/invoice/available'
+              const params = {
+                order_code: this.ruleForm.order_code
+              }
+              this.ajaxComponent(switchUrl).then(r => {
+                if (r.code === '1001') {
+                  // 不能开票
+                  $('#switchModal').modal('show').find('.text').text(r.messge)
+                  return
+                } else {
+                  this.ajaxComponent(url, params).then(res => {
+                    if(res) {
+                      if(res.status !== 1) {
+                        window.location.replace("/front/order/invoicetimeOut?f=upgrade")
+                      }
+                    }
+                  })
+                }
+              })
+            },
+            getTextareaHeight(textareaEl) {
+              textareaEl = textareaEl.querySelector('textarea');
+              textareaEl.style.height = 'auto';
+              textareaEl.style.height = `${textareaEl.scrollHeight}px`;
+              console.info(textareaEl.clientHeight, 'textareaEl')
+              return textareaEl.clientHeight;
+            },
+            // 发票信息回显
+            invouceInfoEcho () {
+              const url = '/jypay/invoice/newShow'
+              const params = {
+                stype: 2,
+                code: this.urlParams.invoiceid
+              }
+              this.ajaxComponent(url, params).then((res) => {
+                if(res) {
+                  this.echoFun(res.data.invoice)
+                }
+              })
+            },
+            echoFun(data) {
+              const { only_Identifying, invoice_type, invoice_variety, invoice_content, mail, phone, remark, company_name, taxpayer_identnum, company_address, company_phone, bank_name, bank_account } = data
+              this.ruleForm.invoice_type = invoice_type
+              this.ruleForm.invoice_variety = invoice_variety
+              this.ruleForm.invoice_content = invoice_content
+              this.ruleForm.mail = mail
+              this.ruleForm.phone = phone
+              this.ruleForm.remark = remark
+              this.ruleForm.company_name = company_name
+              this.ruleForm.taxpayer_identnum = taxpayer_identnum
+              this.ruleForm.company_address = company_address
+              this.ruleForm.company_phone = company_phone
+              this.ruleForm.bank_name = bank_name
+              this.ruleForm.bank_account = bank_account
+              this.urlParams.only_Identifying = only_Identifying
+            },
+            validateCode: (rule, value, callback) => {
+              const regCode = /(^[A-Za-z0-9]{15}$)|(^[A-Za-z0-9]{17,18}$)|(^[A-Za-z0-9]{20}$)/;
+              if (!value) {
+                return callback(new Error('请输入纳税人识别号'))
+              } else {
+                if (regCode.test(value)) {
+                  return callback()
+                } else {
+                  return callback(new Error('请输入正确的纳税人识别号'))
+                }
+              }
+            },
+            validatePhone: (rule, value, callback) => {
+              const regPhone = /^1[3-9]\d{9}$/; // 手机号正则
+              const regTel = /^0\d{2,3}-?\d{7,8}$/ // 座机号码正则
+              if(!value) {
+                return callback(new Error('请输入手机号'));
+              } else {
+                if (regPhone.test(value) || regTel.test(value)) {
+                  return callback()
+                } else {
+                  return callback(new Error('联系电话格式不正确'))
+                }
+              }
+            },
+            validateTelPhone: (rule, value, callback) => {
+              const regPhone = /^1[3-9]\d{9}$/; // 手机号正则
+              const regTel = /^0\d{2,3}-?\d{7,8}$/ // 座机号码正则
+              if(invoiceNode.ruleForm.invoice_variety === '电子专用发票') {
+                if (regPhone.test(value) || regTel.test(value)) {
+                  return callback()
+                } else {
+                  return callback(new Error('电话号码格式不正确'))
+                }
+              } else {
+                // 电子普通发票,电话号码非必填,不输入不校验,输入需校验
+                if(!value) {
+                  return callback()
+                } else {
+                  if(regPhone.test(value) || regTel.test(value)) {
+                    return callback()
+                  } else {
+                    return callback(new Error('电话号码格式不正确'))
+                  }
+                }
+              }
+            },
+            validateBankAccount: (rule, value, callback) => {
+              const regAccount = /^\d+$/;
+              if(invoiceNode.ruleForm.invoice_variety === '电子专用发票') {
+                if (regAccount.test(value)) {
+                  return callback()
+                } else {
+                  return callback(new Error('请输入正确的银行账号'))
+                }
+              } else {
+                // 电子普通发票,银行账号非必填,不输入不校验,输入需校验
+                if(!value) {
+                  return callback()
+                } else {
+                  if (regAccount.test(value)) {
+                    return callback()
+                  } else {
+                    return callback(new Error('请输入正确的银行账号'))
+                  }
+                }
+              }
+            },
+            validateMail: (rule, value, callback) => {
+              const regEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/
+              if(!value) {
+                return callback(new Error('请输入邮箱'))
+              } else {
+                if (regEmail.test(value.trim())) {
+                  return callback()
+                } else {
+                  return callback(new Error('邮箱格式不正确'))
+                }
+              }
+            },
+            validateCompany: (rule, value, callback) => {
+              const regCompany=/^[\u4e00-\u9fa5_a-zA-Z0-9_\(_\)_\uff08_\uff09\)]{2,50}$/;
+              if(!value) {
+                return callback(new Error('请输入公司名称'))
+              } else {
+                if (regCompany.test(value)) {
+                  return callback()
+                } else {
+                  return callback(new Error('请输入正确的公司名称'))
+                }
+              }
+            },
+            setHighLight(item) {
+              const keyword = utils.replaceKeyword(item.name, this.ruleForm.company_name, '<span class="highlight-text">' + this.ruleForm.company_name + '</span>')
+              return keyword
+            },
+            submitForm(formName) {
+              this.$refs[formName].validate((valid) => {
+                if (valid) {
+                  this.loading = true
+                  const { order_code, invoice_content, invoice_type, invoice_variety, mail, phone, remark, company_name, taxpayer_identnum, company_address, company_phone, bank_name, bank_account } = this.ruleForm
+                  let params = {
+                    order_code: order_code, // 唯一标识
+                    invoice_variety: invoice_variety, // 发票类型
+                    invoiceContent: invoice_content, // 发票内容
+                    invoice_type: invoice_type, // 发票抬头
+                    phone: phone, // 手机号
+                    mail: mail, // 邮箱
+                    remark: remark, // 备注
+                    source: 0 // 来源
+                  }
+                  if (invoice_type === '单位') {
+                    params = {
+                      order_code: order_code, // 唯一标识
+                      invoice_variety: invoice_variety, // 发票类型
+                      invoiceContent: invoice_content, // 发票内容
+                      invoice_type: invoice_type, // 发票抬头
+                      company_name: company_name, // 公司名称
+                      taxpayer_identnum: taxpayer_identnum, // 单位税号
+                      company_address: company_address, // 单位地址
+                      company_phone: company_phone, // 电话号码
+                      bank_name: bank_name, // 开户银行
+                      bank_account: bank_account, // 银行账号
+                      phone: phone, // 手机号
+                      mail: mail, // 邮箱
+                      remark: remark, // 备注
+                      source: 0 // 来源
+                    }
+                  }
+                  let url = '/jypay/invoice/submit'
+                  if(this.urlParams.type === 'replace') {
+                    // 换开发票接口
+                    url = '/jypay/invoice/newReplace'
+                    params.sid = this.urlParams.invoiceid
+                  } else if(this.urlParams.type === 'again') {
+                    // 开票失败,再次开票
+                    params.again = 1
+                    params.oldOnlyIdentifying = this.urlParams.only_Identifying
+                    params.only_Identifying = this.urlParams.only_Identifying
+                  }
+                  this.onConfirm(url, params)
+                } else {
+                  console.log('error submit!!');
+                  return false;
+                }
+              });
+            },
+            onConfirm(url, params) {
+              this.ajaxComponent(url, params).then((res) => {
+                this.loading = false
+                if(res && res.error_code === 0) {
+                  this.toastFn('提交成功', 2000)
+                  // 新窗口打开
+                  // 判断窗口是不是window.open打开的
+                  setTimeout(() => {
+                    window.location.replace("/front/order/check_invoice/" + order_code)
+                  }, 2000)
+                } else {
+                  this.loading = false
+                  this.toastFn(res.error_msg || res.invoice_msg, 2000)
+                }
+              }).catch(err => {
+                this.loading = false
+                this.toastFn('提交失败', 2000)
+              })
+            },
+            resetForm(formName) {
+              if (window.opener && window.opener !== window) {
+                window.close()
+              } else {
+                if (history.length <= 1) {
+                    window.close()
+                }
+                history.back()
+              }
+            },
+            handleInput(value) {
+              utils.debounce(this.getCompanyList(value), 300)
+            },
+            handleBlur() {
+              setTimeout(() => {
+                this.companyList = []
+              }, 200);
+            },
+            handleClick(item) {
+              const { name, taxCode } = item
+              this.ruleForm.company_name = name
+              this.ruleForm.taxpayer_identnum = taxCode
+              setTimeout(() => {
+                this.companyList = []
+              }, 200);
+            },
+            getCompanyList(key) {
+              if(!key) return
+              const url = '/bigmember/search/ent/association'
+              const params = {
+                name: key,
+                type: "ent",
+                num: "5"
+              }
+              this.ajaxComponent(url, params).then((res) => {
+                if(res && res.error_code === 0) {
+                  if(res.data.list) {
+                    this.companyList = res.data.list
+                  } else {
+                    this.companyList = []
+                  }
+                }
+              })
+            },
+            // debounce(fn, delay) {
+            //   let timeoutId;
+            //   return function(...args) {
+            //     if (timeoutId) {
+            //       clearTimeout(timeoutId);
+            //     }
+            //     timeoutId = setTimeout(() => {
+            //       fn.apply(this, args);
+            //       timeoutId = null;
+            //     }, delay);
+            //   };
+            // },
+            // 封装公共ajax
+            ajaxComponent(url, params, contentType) {
+              return new Promise((resolve, reject) => {
+                $.ajax({
+                  type: "POST",
+                  url: url,
+                  contentType: contentType || 'application/x-www-form-urlencoded',
+                  data: contentType ? JSON.stringify(params) : params || {},
+                  success: function (res) {
+                    resolve(res)
+                  }.bind(this),
+                  error: function (err) {
+                    reject(err)
+                  }.bind(this)
+                });
+              });
+            },
+            toastFn: function (text, duration) {
+              if (!duration) {
+                duration = 1000
+              }
+              var _html = ""
+              _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
+              _html+='<span>' + text + '</span></div></div>'
+              $('body').append(_html)
+              setTimeout(function(){
+                $(".custom-toast").fadeOut().remove();
+              },duration)
+            }
+          }
+        })
       })
 	</script>
 </body>

+ 16 - 25
src/web/templates/pc/medaratus_orderDetail.html

@@ -293,15 +293,13 @@
                                 $(".pay_num").text(r.data.transaction_id);
                             }
                             //发票
-                            // 后台渠道为xdqd04(销售代下单)可以开发票,其他后台创建订单不可以开发票
-                            if (r.data.order.is_backstage_order!==1 || r.data.order.order_channel === 'xdqd04'){
-                                if (r.data.order.applybill_status === 0) {
-                                    $(".openinvoice").css("display", "");
-                                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
-                                    $(".lookinvoice").css("display", "").on("click", function () {
-                                        checkinvoice(r.data.applybill_status, orderCode)//查看发票
-                                    })
-                                }
+                            if (r.data.is_can_invoice) {
+                                $(".openinvoice").css("display", "");
+                            } 
+                            if (r.data.invoice_show) {
+                                $(".lookinvoice").css("display", "").on("click", function () {
+                                    checkinvoice(r.data.applybill_status, orderCode)//查看发票
+                                })
                             }
                         }
                     }
@@ -501,14 +499,7 @@
             }
 
             $(".openinvoice").on("click", function () {
-                // return false
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
             $(".payOrder").on("click", function () {
                 location.href = "/front/subvip/orderPay/" + orderCode;
@@ -616,14 +607,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
         // 获取服务端时间

+ 21 - 39
src/web/templates/pc/member_orderDetail.html

@@ -340,10 +340,6 @@
                                 $(".pay_way_p").css("display", "");
 
                                 $(".price").text("¥ " + formatMoney(r.data.pay_money / 100) + "元");
-                                $(".openinvoice").css({
-                                    'background': '#EDEFF2',
-                                    'color': '#5F5E64'
-                                })
                             }
                         }
 
@@ -352,32 +348,18 @@
                           $(".pay_num").text(r.data.prepay_id);
                            $(".pay_num_p").show();
                         }
-                        if (source===""){
-                            if(r.data.is_backstage_order!==1){ //发票
-                                if (r.data.applybill_status === 0) {
-                                    $(".openinvoice").css("display", "").on("click", function () {
-                                        // return false // 待可开发票时删除
-
-                                        if (window.isTransferPay) {
-                                            checkinvoice(2, '', '请联系客服开票<br>客服热线:400-108-6670')
-                                            return
-                                        }
-                                        $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                                            if (r.status != 1) {
-                                                window.open("/front/order/invoicetimeOut", '_self');
-                                            } else {
-                                                window.open("/front/order/invoice/" + orderCode, '_self');
-                                            }
-                                        })
-                                    });
-                                }else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
-                                    $(".lookinvoice").css("display", "").on("click", function () {
-                                        checkinvoice(r.data.applybill_status, orderCode)//查看发票
-                                    })
-                                }
-                            }
-
-                        }else{
+                        if (r.data.is_can_invoice) {
+                            $(".openinvoice").css("display", "").on("click", function () {
+                                // return false // 待可开发票时删除
+                                window.open("/front/order/invoice/" + orderCode, '_self');
+                            });
+                        }
+                        if (r.data.invoice_show) {
+                            $(".lookinvoice").css("display", "").on("click", function () {
+                                checkinvoice(r.data.applybill_status, orderCode)//查看发票
+                            })
+                        }
+                        if(source){
                           // 自定义大会员展示服务列表
                           var buchongbaoHtml = '';
                           var serversName = filterObj.serversName;
@@ -571,15 +553,15 @@
 
         //查看发票
         function checkinvoice(flag, orderCode, str) {
-            if (flag === 2) {
-                var tempStr = str || '您已开具发票<br>如有问题请联系客服<br>400-108-6670'
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">'+tempStr+'</div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var tempStr = str || '您已开具发票<br>如有问题请联系客服<br>400-108-6670'
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">'+tempStr+'</div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 19 - 28
src/web/templates/pc/myOrder.html

@@ -554,10 +554,10 @@
                           '再次' : '去'#@支付</a></p>
                       <p><a data-jy-track="click-hover" @click="goCancel(item)">取消订单</a></p>
                     </div>
-                    <div v-if="item.order_status === 1 && (item.filter.source || '') === '' && item.filter.badge!='exchange'">
-                      <p><a v-if="item.applybill_status === 0 && item.source !== 1" data-jy-track="click-hover"
+                    <div v-if="item.order_status === 1 && item.filter.badge!='exchange'">
+                      <p><a v-if="item.is_can_invoice" data-jy-track="click-hover"
                           @click="goInvoice(item)">开发票</a></p>
-                      <p><a v-if="(item.applybill_status === 1 || item.applybill_status === 2) && item.source !== 1" data-jy-track="click-hover" @click="goInvoice(item)">发票信息</a></p>
+                      <p><a v-if="item.invoice_show" data-jy-track="click-hover" @click="goInvoice(item, 'info')">发票信息</a></p>
                     </div>
                   </div>
                   <div class="handleBox" v-else-if="item.product_type === '大会员-AI中标预测包'
@@ -572,12 +572,12 @@
                       <p><a class="go_pay" data-jy-track="click-hover" @click="goPay(item)">去支付</a></p>
                       <p><a data-jy-track="click-hover" @click="goCancel(item)">取消订单</a></p>
                     </div>
-                    <div v-if="item.order_status === 1 && (item.filter.source || '') === ''&& item.filter.badge!='exchange'">
+                    <div v-if="item.order_status === 1 && item.filter.badge!='exchange'">
                       <!--                                        <div v-if="(item.filter.canInvoice !=undefined  && !item.filter.canInvoice)">-->
-                      <p><a v-if="item.applybill_status === 0 && item.source !== 1" data-jy-track="click-hover"
+                      <p><a v-if="item.is_can_invoice" data-jy-track="click-hover"
                           @click="goInvoice(item)">开发票</a></p>
-                      <p><a v-if="(item.applybill_status === 1 || item.applybill_status === 2) && item.source !== 1"
-                          data-jy-track="click-hover" @click="goInvoice(item)">发票信息</a></p>
+                      <p><a v-if="item.invoice_show"
+                          data-jy-track="click-hover" @click="goInvoice(item, 'info')">发票信息</a></p>
                       <!--                                        </div>-->
                     </div>
                   </div>
@@ -593,11 +593,9 @@
                     </p>
                     <!--已完成 && && item.filter.badge!='exchange' P307 权益码兑换 不开发票-->
                     <p v-if="item.order_status === 1 && item.filter.badge!='exchange'"><a
-                        v-if="item.applybill_status === 0 && item.billingMode === 1 && (item.is_backstage_order === 0 || item.order_channel === 'xdqd04') && item.source !== 1"
+                        v-if="item.is_can_invoice"
                         data-jy-track="click-hover" @click="goInvoice(item)">开发票</a></p>
-                    <p v-if="item.order_status === 1"><a
-                        v-if="(item.applybill_status === 1 || item.applybill_status === 2) && item.source !== 1" data-jy-track="click-hover"
-                        @click="goInvoice(item)">发票信息</a></p>
+                    <p v-if="item.order_status === 1"><a v-if="item.invoice_show" data-jy-track="click-hover" @click="goInvoice(item, 'info')">发票信息</a></p>
                     <!--已取消-->
                     <!--历史数据 再次购买-->
                     <p v-if="item.product_type === '历史数据'"><a target="_parent" :href="'/front/dataExport/toSieve?id=' + item.filter_id">再次购买</a>
@@ -1354,8 +1352,8 @@
             }
           });
         },
-        goInvoice: function (item) {
-          if (item.applybill_status === 0) {
+        goInvoice: function (item, look) {
+          if (!look) {
             // $.alert({
             //     title: '温馨提示',
             //     titleClass: 'custom-alert-title',
@@ -1385,17 +1383,16 @@
                 location.href = href
               }
               return
-            } else if (item.product_type === '大会员' && item.pay_way === 'transferAccounts') {
-              this.goShowTipForInvoice('请联系客服开票<br>客服热线:400-108-6670')
             } else {
-              this.goOpenInvoice(item.order_code)
+              window.open("/front/order/invoice/" + item.order_code);
             }
           } else {
-            if (item.applybill_status === 2) {
-              this.goShowTipForInvoice()
-            } else {
-              this.goLookInvoice(item)
-            }
+            // if (item.applybill_status === 2) {
+            //   this.goShowTipForInvoice()
+            // } else {
+            //   this.goLookInvoice(item)
+            // }
+            this.goLookInvoice(item)
           }
         },
         goShowTipForInvoice: function (str) {
@@ -1435,13 +1432,7 @@
           }
         },
         goOpenInvoice: function (code) {
-          $.post("/subscribepay/orderListDetails/isOver", { "order_code": code }, function (r) {
-            if (r.status !== 1) {
-              window.open("/front/order/invoicetimeOut");
-            } else {
-              window.open("/front/order/invoice/" + code);
-            }
-          })
+          window.open("/front/order/invoice/" + code);
         },
         goDetail: function (item) {
           var href = ''

+ 6 - 15
src/web/templates/pc/orderDetail.html

@@ -516,12 +516,9 @@
     $(function () {
         var orderStatus = {{ .T.o.order_status }};
         var invoiceStatus = {{ .T.o.applybill_status }}
+        var is_can_invoice = {{ .T.o.is_can_invoice }}
+        var invoice_show = {{ .T.o.invoice_show }}
         var orderCode = {{.T.o.order_code}}
-        try{
-        var source_ ={{.T.o.source}}
-        }catch(e){
-
-        }
 
         if (orderStatus === 0) {
             $("#status_wait_pay").show();
@@ -529,9 +526,10 @@
             $(".o_m_thead").removeClass("greenBg").addClass("redBg")
         } else if (orderStatus === 1) {
             $("#status_success").show();
-            if (invoiceStatus === 0) {
+            if (is_can_invoice) {
                 $(".openinvoice").show();
-            } else if ((invoiceStatus === 1 || invoiceStatus === 2) && source_ !== 1) {
+            }
+            if (invoice_show) {
                 $(".lookinvoice").show().on("click", function () {
                     checkinvoice({{.T.o.applybill_status}}, orderCode)
                 });
@@ -546,14 +544,7 @@
         })
 
         $(".openinvoice").on("click", function () {
-          // return false // 待可开发票时删除
-            $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                if (r.status != 1) {
-                    window.open("/front/order/invoicetimeOut", '_self');
-                } else {
-                    window.open("/front/order/invoice/" + orderCode, '_self');
-                }
-            })
+          window.open("/front/order/invoice/" + orderCode, '_self');
         })
     })
 

+ 16 - 27
src/web/templates/pc/subAccount_orderDetail.html

@@ -214,17 +214,13 @@
 
                         if (r.data.prepay_id) $(".pay_num").text(r.data.prepay_id);
 
-                        if (source===""){
-                          //发票
-                            if (r.data.is_backstage_order!==1){
-                                if (r.data.applybill_status === 0 && r.data.source !== 1) {
-                                    $(".openinvoice").css("display", "");
-                                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
-                                    $(".lookinvoice").css("display", "").on("click", function () {
-                                        checkinvoice(r.data.applybill_status, orderCode)//查看发票
-                                    })
-                                }
-                            }
+                        if (r.data.is_can_invoice) {
+                            $(".openinvoice").css("display", "");
+                        }
+                        if (r.data.invoice_show) {
+                            $(".lookinvoice").css("display", "").on("click", function () {
+                                checkinvoice(r.data.applybill_status, orderCode)//查看发票
+                            })
                         }
                     }
                     if (r.data.order_status === -2) {
@@ -261,14 +257,7 @@
 
 
             $(".openinvoice").on("click", function () {
-              // return false // 待可开发票时删除
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
 
             $(".payOrder").on("click", function () {
@@ -365,14 +354,14 @@
         }
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
     </script>

+ 16 - 25
src/web/templates/pc/vip_orderDetail.html

@@ -300,15 +300,13 @@
                                 $(".pay_num").text(r.data.transaction_id);
                             }
                             //发票
-                            // 后台渠道为xdqd04(销售代下单)可以开发票,其他后台创建订单不可以开发票
-                            if (r.data.order.is_backstage_order!==1 || r.data.order.order_channel === 'xdqd04'){
-                                if (r.data.order.applybill_status === 0 && r.data.order.source !== 1) {
-                                    $(".openinvoice").css("display", "");
-                                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
-                                    $(".lookinvoice").css("display", "").on("click", function () {
-                                        checkinvoice(r.data.applybill_status, orderCode)//查看发票
-                                    })
-                                }
+                            if (r.data.order.is_can_invoice) {
+                                $(".openinvoice").css("display", "");
+                            }
+                            if (r.data.invoice_show) {
+                                $(".lookinvoice").css("display", "").on("click", function () {
+                                    checkinvoice(r.data.applybill_status, orderCode)//查看发票
+                                })
                             }
                         }
                     }
@@ -514,14 +512,7 @@
             }
 
             $(".openinvoice").on("click", function () {
-                // return false
-                $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (r) {
-                    if (r.status != 1) {
-                        window.open("/front/order/invoicetimeOut", '_self');
-                    } else {
-                        window.open("/front/order/invoice/" + orderCode, '_self');
-                    }
-                })
+              window.open("/front/order/invoice/" + orderCode, '_self');
             })
             $(".payOrder").on("click", function () {
                 location.href = "/front/subvip/orderPay/" + orderCode;
@@ -629,14 +620,14 @@
         };
         //查看发票
         function checkinvoice(flag, orderCode) {
-            if (flag === 2) {
-                var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
-                var div_invoice_tip = document.createElement('div');
-                div_invoice_tip.innerHTML = showHtml;
-                div_invoice_tip.id = "invoice_tip"
-                document.body.appendChild(div_invoice_tip)
-                return
-            }
+            // if (flag === 2) {
+            //     var showHtml = '<div style="width: 100%;height: 100%;z-index: 999; position: absolute;top: 0;background: rgba(0, 0, 0, 0.65);">   <div style="position: fixed;z-index: 9999;width: 540px;height: 262px;left: 50%;top: 30%;margin-left: -270px;background-color: #fff;border-radius: 6px;padding: 32px;display: flex;flex-direction: column;justify-items: center;align-items: center;">       <div class="invoice_title" style="color: #1D1D1D;font-size: 18px;line-height: 28px;">提示</div>       <div class="invoice_body"            style="height: 78px;margin: 20px 0px;font-size: 14px;line-height: 24px;text-align: center;">           您已开具发票<br>           如有问题请联系客服<br>           400-108-6670       </div>       <div class="invoice_control"            style="width: 132px;height: 36px;text-align: center;background: #2CB7CA;border-radius: 6px;font-size: 16px;line-height: 36px;color: #FFFFFF;cursor: pointer;"            onclick="document.querySelector(\'#invoice_tip\').remove()"       >           我知道了       </div>   </div>\n</div>'
+            //     var div_invoice_tip = document.createElement('div');
+            //     div_invoice_tip.innerHTML = showHtml;
+            //     div_invoice_tip.id = "invoice_tip"
+            //     document.body.appendChild(div_invoice_tip)
+            //     return
+            // }
             window.open("/front/order/check_invoice/" + orderCode, '_self');
         }
         // 获取服务端时间

+ 4 - 0
src/web/templates/weixin/commonPay/areaPack/orderDetail.html

@@ -88,6 +88,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 18 - 14
src/web/templates/weixin/commonPay/bidfile/bidfiledetail.html

@@ -184,10 +184,11 @@
 
                 var pay_again = ""
                 //发票
-                if (r.data.applybill_status === 0) {
+                if (r.data.is_can_invoice) {
                     //已支付未申请发票
                     pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                } 
+                if ( r.data.invoice_show) {
                     //已支付已申请发票
                     pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                 }
@@ -332,9 +333,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status === 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -347,16 +350,17 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 4 - 0
src/web/templates/weixin/commonPay/buyerPortraitPack/orderDetail.html

@@ -88,6 +88,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/web/templates/weixin/commonPay/dataFile/orderDetail.html

@@ -88,6 +88,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/web/templates/weixin/commonPay/dataPack/orderDetail.html

@@ -88,6 +88,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button> 
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 4 - 0
src/web/templates/weixin/commonPay/filePack/orderDetail.html

@@ -88,6 +88,10 @@
                         class="j-button-cancel invoke"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.invoke"
                         @click="lookInvoke">${ invokeButtonText }</button>
+                    <button
+                        class="j-button-cancel invoke"
+                        v-if="orderStateMap[orderInfo.state].bottomButtonShow.lookInvoice"
+                        @click="lookInvoke('look')">查看发票</button>    
                     <button
                         class="j-button-confirm buy-again"
                         v-if="orderStateMap[orderInfo.state].bottomButtonShow.buyAgain"

+ 18 - 14
src/web/templates/weixin/commonPay/integral/integralDetail.html

@@ -190,10 +190,11 @@
     
                     var pay_again = ""
                     //发票
-                    if (r.data.applybill_status === 0) {
+                    if (res.data.is_can_invoice) {
                         //已支付未申请发票
                         pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                    } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                    } 
+                    if (r.data.invoice_show) {
                         //已支付已申请发票
                         pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                     }
@@ -350,9 +351,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status === 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -365,16 +368,17 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 6 - 3
src/web/templates/weixin/commonPay/medical/orderDetail.html

@@ -995,9 +995,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", { "order_code": orderCode }, function (data) {
             if (data.status == 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
             ;
         })
@@ -1021,7 +1023,8 @@
             return
         }
         orderCode = getParam("orderCode")
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     /******* 获取url参数(正则)********/

+ 4 - 0
src/web/templates/weixin/commonPay/myOrder.html

@@ -108,6 +108,10 @@
                                             class="order-action-button click-active invoke"
                                             v-if="item.buttonConf.invokeButtonShow"
                                             @click="clickInvoke(item)">${ item.buttonConf.invokeButtonText }</button>
+                                    <button
+                                            class="order-action-button click-active invoke"
+                                            v-if="item.buttonConf.lookInvoiceButtonShow"
+                                            @click="clickInvoke(item,'look')">${ item.buttonConf.lookInvoiceButtonText }</button>
                                     <button
                                             class="order-action-button click-active main-color pay"
                                             v-if="item.buttonConf.payConfirmShow"

+ 18 - 14
src/web/templates/weixin/dataExport/dataExport_toOrderDetail.html

@@ -550,9 +550,10 @@
                                 $(".order-main").before(finish_html)
 
                                 var html = '<div class="j-button-group">'
-                                if (r.data.applybill_status === 0) {
+                                if ( r.data.is_can_invoice) {
                                     html += '<button class="j-button-cancel" onclick="invoiceAdd(\'' + r.data.order_code + '\')">开发票</button><button class="j-button-confirm" id="buytwo" onclick="payAgain(\'' + r.data.order_code + '\')">再次购买</button>'
-                                } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                                } 
+                                if ( r.data.invoice_show) {
                                     html += '<button class="j-button-cancel" onclick= checkinvoice(\'' + r.data.order_code + '\',' + r.data.applybill_status + ')>查看发票</button><button class="j-button-confirm" id="buytwo" onclick="payAgain(\'' + r.data.order_code + '\')">再次购买</button>'
                                 }
                             } else {
@@ -634,16 +635,17 @@
 
     //查看发票
     function checkinvoice(order_code, flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + order_code
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + order_code
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + order_code
     }
 
     function invoiceAdd(order_code) {
@@ -656,9 +658,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": order_code}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + order_code;
+                // window.location.href = "/front/invoice/showpage?order_code=" + order_code;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + order_code;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + order_code;
             }
             ;
         })

+ 2 - 1
src/web/templates/weixin/invoice/cantInvocie.html

@@ -152,7 +152,8 @@
         }
         checkInvoice.init()
         function replaceInvoice(){
-            window.location.href = "/front/invoice/showpage?order_code="+order_code+"&c=1"
+            // window.location.href = "/front/invoice/showpage?order_code="+order_code+"&c=1"
+            window.location.href = "/jy_mobile/invoice/Invoicing?order_code="+order_code+"&type=Replace"
         }
         function isWeixinBrower () {
             if(navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1){

+ 19 - 15
src/web/templates/weixin/member/aiForecastPackdetail.html

@@ -221,10 +221,11 @@
                     if (source===""){
                       var pay_again = ""
                       //发票
-                      if (r.data.applybill_status === 0) {
+                      if ( r.data.is_can_invoice) {
                           //已支付未申请发票
                           pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                      } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                      } 
+                       if (r.data.invoice_show) {
                           //已支付已申请发票
                           pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                       }
@@ -336,7 +337,7 @@
                     $(".invoice").css("display", "none");//隐藏开发票
                 }
                 if(r.data.is_backstage_order===1){
-                    $(".invoice").css("display", "none");//隐藏开发票
+                    // $(".invoice").css("display", "none");//隐藏开发票
                 }
             }
         })
@@ -366,9 +367,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status === 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -381,16 +384,17 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 32 - 30
src/web/templates/weixin/member/memberdetail.html

@@ -390,22 +390,21 @@
                 $("#pageTitle").addClass("status")
                 $("#pageTitle").text("已完成");
 
-                //发票//兑换码 不展示支付时间、支付方式、发票、再次购买 p307
-                if (source === ""&&filterObj.badge!="exchange") {
-                  var pay_again = ""
+                var pay_again = ""
                   //有效周期
                   $(".line_cycle").css("display", "");
-                  if (r.data.applybill_status === 0) {
+                  if (r.data.is_can_invoice) {
                       //已支付未申请发票
                       pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                  } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                  } 
+                   if ( r.data.invoice_show) {
                       //已支付已申请发票
                       pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                   }
-                  if(r.data.source !== 1){
-                     $('.j-footer').show().html(pay_again);
-                  }
-
+                 
+                  $('.j-footer').show().html(pay_again);
+                //发票//兑换码 不展示支付时间、支付方式、发票、再次购买 p307
+                if (source === ""&&filterObj.badge!="exchange") {
                 }else{
                   var buchongbaoHtml = '';
                   var serversName = filterObj.serversName;
@@ -605,20 +604,22 @@
         //         type: 'primary'
         //     }]
         // });
-        if (window.isTransferPay) {
-            weui.alert('请联系客服开票<br>客服热线:400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
+        // if (window.isTransferPay) {
+        //     weui.alert('请联系客服开票<br>客服热线:400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status === 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -631,16 +632,17 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 18 - 15
src/web/templates/weixin/member/subAccountDetail.html

@@ -231,10 +231,10 @@
                 var pay_again = ""
                 //发票
                 if (source === "") {
-                  if (r.data.applybill_status === 0) {
+                  if ( r.data.is_can_invoice) {
                       //已支付未申请发票
                       pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                  } else if ((r.data.applybill_status === 1 || r.data.applybill_status === 2) && r.data.source !== 1) {
+                  } else if (r.data.invoice_show) {
                       //已支付已申请发票
                       pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.applybill_status + ")'>查看发票</button>"
                   }
@@ -345,7 +345,7 @@
                 $(".invoice").css("display", "none");//隐藏开发票
             }
             if(r.data.is_backstage_order===1){
-                $(".invoice").css("display", "none");//隐藏开发票
+                // $(".invoice").css("display", "none");//隐藏开发票
             }
         })
     })
@@ -374,9 +374,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status === 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
         })
     }
@@ -389,16 +391,17 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     function formatTime(t) {

+ 21 - 18
src/web/templates/weixin/vipsubscribe/vip_order_detail.html

@@ -746,20 +746,20 @@
 
                     //发票
                     // 后台渠道为xdqd04(销售代下单)可以开发票,其他后台创建订单不可以开发票
-                    if (r.data.order.is_backstage_order!==1 || r.data.order.order_channel === 'xdqd04'){
                         var pay_again = ""
-                        if (r.data.order.applybill_status === 0) {
+                        if (  r.data.order.is_can_invoice) {
                             //已支付未申请发票
                             pay_again += "<button class=\"j-button-cancel\" onclick='invoiceAdd()'>开发票</button>"
-                        } else if ((r.data.order.applybill_status === 1 || r.data.order.applybill_status === 2) && r.data.order.source !== 1) {
+                        } 
+                        if ( r.data.order.invoice_show) {
                             //已支付已申请发票
                             pay_again += "<button class=\"j-button-cancel\" onclick='checkInvoice(" + r.data.order.applybill_status + ")'>查看发票</button>"
                         }
-                        if(r.data.order.source !== 1){
+                        
                           $('.j-footer').show().html(pay_again)
-                         }
+                         
 
-                    }
+                    
                     if (r.data.order.billingMode==0){
                        $(".j-footer").hide();//隐藏开发票
                     }
@@ -977,9 +977,11 @@
         // });
         $.post("/subscribepay/orderListDetails/isOver", {"order_code": orderCode}, function (data) {
             if (data.status == 1) {
-                window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                // window.location.href = "/front/invoice/showpage?order_code=" + orderCode;
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             } else {
-                window.location.href = "/front/invoice/cantInvoice";
+                // window.location.href = "/front/invoice/cantInvoice";
+                window.location.href = "/jy_mobile/invoice/Invoicing?order_code=" + orderCode;
             }
             ;
         })
@@ -993,17 +995,18 @@
 
     //查看发票
     function checkInvoice(flag) {
-        if (flag === 2) {
-            weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
-                buttons: [{
-                    label: '我知道了',
-                    type: 'primary'
-                }]
-            });
-            return
-        }
+        // if (flag === 2) {
+        //     weui.alert('您已开具发票<br>如有问题请联系客服<br>400-108-6670', {
+        //         buttons: [{
+        //             label: '我知道了',
+        //             type: 'primary'
+        //         }]
+        //     });
+        //     return
+        // }
         orderCode = getParam("orderCode")
-        window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        // window.location.href = "/front/invoice/check_invoice.html?order_code=" + orderCode
+        window.location.href = "/jy_mobile/invoice/viewInvoice?order_code=" + orderCode
     }
 
     /******* 获取url参数(正则)********/