Browse Source

fenzhihebing

lianbingjie 1 year ago
parent
commit
0fd791b335

+ 1 - 1
src/db.json

@@ -70,7 +70,7 @@
   "mysql": {
     "main": {
       "dbName": "jianyu",
-      "address" : "192.168.3.217:4000",
+      "address": "192.168.3.217:4000",
       "userName": "root",
       "passWord": "=PDT49#80Z!RVv52_z",
       "maxOpenConns": 10,

+ 3 - 3
src/jfw/modules/app/src/db.json

@@ -46,9 +46,9 @@
     "mysql": {
 	    "main": {
 	        "dbName": "jianyu",
-	        "address": "192.168.3.149:3306",
-	        "userName": "root",
-	        "passWord": "Topnet123",
+        "address": "192.168.3.217:4000",
+        "userName": "root",
+        "passWord": "=PDT49#80Z!RVv52_z",
 			"maxOpenConns": 2,
 			"maxIdleConns": 2
 	    },

+ 62 - 12
src/jfw/modules/app/src/web/templates/invoice/check_invoice.html

@@ -80,8 +80,9 @@
             </div>
             <!-- 开票完成  -->
             <div class="j-button-group" id="change" style="display: none;">
+              <button class="j-button-cancel again_inv" >换开申请</button>
 
-                <button class="j-button-cancel again_inv" onclick="replaceInvoice()">换开申请</button>
+<!--                <button class="j-button-cancel again_inv" onclick="replaceInvoice()">换开申请</button>-->
                 <a id="show_invoice" download class="j-button-confirm checkbtn" >查看发票</a>
             </div>
         </div>
@@ -102,6 +103,18 @@
                 <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary know">我知道了</a>
             </div>
         </div>
+    </div>
+    <!-- 红冲弹窗 -->
+    <div class="js_dialog" id="switchModal" style="display:none;">
+      <div class="weui-mask"></div>
+      <div class="weui-dialog">
+        <div class="dialog_content weui-dialog__bd" style="text-align:justify;font-size: .32rem;line-height: .48rem;">
+          温馨提醒:<br>
+        </div>
+        <div class="weui-dialog__ft">
+          <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary red_know">我知道了</a>
+        </div>
+      </div>
     </div>
 	  <script src="https://cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js"></script>
     <script src="{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/local/weui.min.js"></script>
@@ -115,6 +128,8 @@
     		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
         var isOk =false;
         var interval;
+        var redInvoiceSwitch = false;
+        var redInvoiceMsg = "";
         $(function () {
             checkInvoiceStatus(order_code);
             function checkInvoiceStatus(order_code){
@@ -160,23 +175,51 @@
             }
         }
         checkInvoice.init()
+        //红冲
+        var redInvoice = {
+          init:function(){
+            this.redInvoiceFunc();
+            this.hideRedDialog();
+          },
+          redInvoiceFunc:function() {
+            $('.again_inv').on('click',function(){
+              if(!redInvoiceSwitch){
+                $('#switchModal').find('.dialog_content').append(redInvoiceMsg);
+                $('#switchModal').show();
+              }else {
+                window.location.href = "/jyapp/front/invoice/showpage?order_code="+order_code+"&c=1"
+              }
+            })
+          },
+          hideRedDialog:function(){
+            $('.red_know').on('click',function(){
+              $('#switchModal').hide()
+            })
+          }
+        }
+        redInvoice.init()
         function replaceInvoice(){
+          if(!redInvoiceSwitch){
+            $('#switchModal').find('#dialog_content').text(redInvoiceMsg);
+            $('#switchModal').show();
+          }else {
             window.location.href = "/jyapp/front/invoice/showpage?order_code="+order_code+"&c=1"
+          }
         }
         $("#show_invoice").on("click",function () {
             var url = $("#show_invoice").attr("href_");
-			if (isAndroid) {
-			    location.href = "/jyapp/front/viewPdf?file="+ url;
-			} else {
-				JyObj.openExternalLink(url,'电子发票');
-			}
+            //if (isAndroid) {
+            //    location.href = "/jyapp/front/viewPdf?file="+ url;
+            //} else {
+              JyObj.openExternalLink(url,'电子发票');
+            //}
         })
         function download(download_url) {
-			if (isAndroid) {
-			    location.href = "/jyapp/front/viewPdf?file="+ download_url;
-			} else {
-				JyObj.openExternalLink(download_url,'电子发票');
-			}
+            // if (isAndroid) {
+            //     location.href = "/jyapp/front/viewPdf?file="+ download_url;
+            // } else {
+              JyObj.openExternalLink(download_url,'电子发票');
+            // }
         }
         function getParam(name) {
             var search = document.location.search;
@@ -214,6 +257,11 @@
                 data:{"order_code":order_code},
                 success:function (r) {
                     console.log("rrrr",r)
+                    //红冲开关
+                    if(r.redSwitchInfo){
+                      redInvoiceSwitch=r.redSwitchInfo.ris;
+                      redInvoiceMsg=r.redSwitchInfo.rim;
+                    }
                     if (r.data !=""){
                         $(".taitou").text(r.data.invoice_type)
                         $("#phone_num").text(r.data.phone);
@@ -230,7 +278,9 @@
                             $("#process li").addClass("active")
                             $("#processing").hide()
                             $("#change").show()
-                            r.data.url=   r.data.url.replace("http","https");
+                            if(r.data.url.indexOf("https")<0){
+                                r.data.url =   r.data.url.replace("http","https");
+                            }
                             download_url = r.data.url
                             $("#show_invoice").attr('href_',r.data.url);
                             if (r.data.invoice_changed == 1){

+ 2 - 2
src/jfw/modules/bigmember/src/db.json

@@ -51,9 +51,9 @@
   "mysql": {
     "main": {
       "dbName": "jianyu",
-      "address": "192.168.3.149:3306",
+      "address" : "192.168.3.217:4000",
       "userName": "root",
-      "passWord": "Topnet123",
+      "passWord": "=PDT49#80Z!RVv52_z",
       "maxOpenConns": 5,
       "maxIdleConns": 5
     },

+ 2 - 2
src/jfw/modules/subscribepay/src/config.json

@@ -76,9 +76,9 @@
   },
   "activityMysql": {
     "dbName": "jyactivities",
-    "address": "192.168.3.149:3306",
+    "address": "192.168.3.217:4000",
     "userName": "root",
-    "passWord": "Topnet123",
+    "passWord": "=PDT49#80Z!RVv52_z",
     "maxOpenConns": 5,
     "maxIdleConns": 5
   },

+ 4 - 1
src/jfw/modules/subscribepay/src/config/config.go

@@ -219,7 +219,10 @@ type Invoice struct {
 		Model int
 		Time  string
 	}
-	Invoice_switch bool
+	Invoice_switch     bool
+	Red_invoice_switch bool   //红冲发票是否可用开关
+	Red_invoice_msg    string //提示信息
+	Third_party_switch bool   //第三方开票开关
 }
 
 type entnicheConfig struct {

+ 6 - 3
src/jfw/modules/subscribepay/src/invoice.json

@@ -6,8 +6,11 @@
   "invoice_interface_address": "http://127.0.0.1:7070",
   "code": "3040205000000000000",
   "switch_paymch":{
-	"model":1,
-	"time":"2022-01-17 10:00:00"
+    "model":1,
+    "time":"2022-01-17 10:00:00"
   },
-  "invoice_switch": true
+  "invoice_switch": true,
+  "red_invoice_switch": false,
+  "red_invoice_msg": "由于系统升级,线上换开发票功能暂时维护阶段,如需换开请直接联系在线客服!",
+  "third_party_switch": false
 }

+ 155 - 69
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -242,6 +242,7 @@ func (this *Invoice) Addinvoice() error {
 				data["create_time"] = time.Now().Unix()
 				data["user_id"] = userId
 				data["invoice_status"] = 0
+				data["invoice_money"] = price
 				var orders = []map[string]interface{}{}
 				var items = []map[string]interface{}{}
 				item := map[string]interface{}{
@@ -281,52 +282,58 @@ func (this *Invoice) Addinvoice() error {
 					if len(*status) > 0 {
 						return nil
 					}
-					util.Mysql.Insert(dbname, data)
+					if i := util.Mysql.Insert(dbname, data); i > 0 {
+						invoice_status = 0
+					}
 					if !util.Mysql.Update("dataexport_order", map[string]interface{}{"order_code": order_code, "user_id": userId}, dataexport_data) {
 						invoice_status = -1
 					}
 				} else {
-					util.Mysql.Update(dbname, map[string]interface{}{
+					if ok := util.Mysql.Update(dbname, map[string]interface{}{
 						"order_code":      order_code,
 						"user_id":         userId,
 						"invoice_changed": 0,
-					}, data)
+					}, data); ok {
+						invoice_status = 0
+					}
 				}
-				b, _ := json.Marshal(body)
-				buffer := bytes.NewBuffer(b)
-				request, _ := http.NewRequest("POST", config.InvoiceConfig.Invoice_interface_address+"/Invoice/Add", buffer)
-				response, err := client.Do(request)
-				if err == nil {
-					res, err := ioutil.ReadAll(response.Body)
-					if err != nil {
-						invoice_status = -1
-					} else {
-						resMap := qutil.ObjToMap(string(res))
-						if *resMap != nil {
-							if qutil.IntAll((*resMap)["code"]) == 0 { //开票成功
-								invoice_status = 1
-								jsonData["invoice_status"] = invoice_status
-							} else if qutil.IntAll((*resMap)["code"]) == 2 { //开票中
-								// log.Println("开票中")
-								invoice_status = 0
-								jsonData["invoice_status"] = invoice_status
-							} else { //开票失败
-								// log.Println("开票失败")
-								invoice_status = -1
-								jsonData["invoice_status"] = invoice_status
+				if config.InvoiceConfig.Third_party_switch {
+					b, _ := json.Marshal(body)
+					buffer := bytes.NewBuffer(b)
+					request, _ := http.NewRequest("POST", config.InvoiceConfig.Invoice_interface_address+"/Invoice/Add", buffer)
+					response, err := client.Do(request)
+					if err == nil {
+						res, err := ioutil.ReadAll(response.Body)
+						if err != nil {
+							invoice_status = -1
+						} else {
+							resMap := qutil.ObjToMap(string(res))
+							if *resMap != nil {
+								if qutil.IntAll((*resMap)["code"]) == 0 { //开票成功
+									invoice_status = 1
+									jsonData["invoice_status"] = invoice_status
+								} else if qutil.IntAll((*resMap)["code"]) == 2 { //开票中
+									// log.Println("开票中")
+									invoice_status = 0
+									jsonData["invoice_status"] = invoice_status
+								} else { //开票失败
+									// log.Println("开票失败")
+									invoice_status = -1
+									jsonData["invoice_status"] = invoice_status
+								}
+							}
+							defer response.Body.Close()
+							resData := (*resMap)["data"].(map[string]interface{})
+							update_status := util.Mysql.Update(dbname, map[string]interface{}{"order_code": order_code}, map[string]interface{}{
+								"invoice_serialnum": resData["swno"],
+								"invoice_code":      resData["fpdm"],
+								"invoice_number":    resData["fphm"],
+								"url":               resData["path"],
+								"invoice_status":    invoice_status,
+							})
+							if !update_status {
+								log.Println("order_ocde:", order_code+"update fail")
 							}
-						}
-						defer response.Body.Close()
-						resData := (*resMap)["data"].(map[string]interface{})
-						update_status := util.Mysql.Update(dbname, map[string]interface{}{"order_code": order_code}, map[string]interface{}{
-							"invoice_serialnum": resData["swno"],
-							"invoice_code":      resData["fpdm"],
-							"invoice_number":    resData["fphm"],
-							"url":               resData["path"],
-							"invoice_status":    invoice_status,
-						})
-						if !update_status {
-							log.Println("order_ocde:", order_code+"update fail")
 						}
 					}
 				}
@@ -348,42 +355,86 @@ func (this *Invoice) Showinvoice() {
 	data := make(map[string]interface{})
 	data["order_code"] = order_code
 	status := util.Mysql.Find(dbname, data, "", "create_time", 0, 0)
-	if len(*status) != 0 {
-		if len(*status) > 1 {
-			if (*status)[1]["url"] != nil && (*status)[1]["url"] != "" {
+	//红冲发票开关
+	redSwitchInfo := map[string]interface{}{
+		"ris": config.InvoiceConfig.Red_invoice_switch,
+		"rim": config.InvoiceConfig.Red_invoice_msg,
+	}
+	if status != nil && len(*status) != 0 {
+		count := len(*status)
+		data := (*status)[count-1]
+		if data != nil {
+			delete(data, "user_id")
+			if url := qutil.InterfaceToStr(data["url"]); url != "" {
+				//ios 移动端
+				if util.IsMobileIOS(this.Request.UserAgent()) {
+					//国家税务局-增值税电子发票公共服务平台
+					if strings.Contains(url, "tysl.beijing.chinatax") {
+						data["url"] = strings.ReplaceAll(url, "/preview.html?code=", "/web-reader/reader?file=")
+					}
+				}
 				this.ServeJson(map[string]interface{}{
-					"status":  "success",
-					"changed": true,
-					"data":    (*status)[1],
+					"status":        "success",
+					"changed":       qutil.If(count > 1, true, false).(bool),
+					"data":          data,
+					"redSwitchInfo": redSwitchInfo,
 				})
 			} else {
 				this.ServeJson(map[string]interface{}{
-					"status":  "processing",
-					"changed": true,
-					"data":    (*status)[1],
+					"status":        "processing",
+					"changed":       qutil.If(count > 1, true, false).(bool),
+					"data":          data,
+					"redSwitchInfo": redSwitchInfo,
 				})
 			}
 		} else {
-			if (*status)[0]["url"] != nil && (*status)[0]["url"] != "" {
-				this.ServeJson(map[string]interface{}{
-					"status":  "success",
-					"changed": false,
-					"data":    (*status)[0],
-				})
-			} else {
-				this.ServeJson(map[string]interface{}{
-					"status":  "processing",
-					"changed": false,
-					"data":    (*status)[0],
-				})
-			}
+			this.ServeJson(map[string]interface{}{
+				"status":        "fail",
+				"changed":       false,
+				"data":          "",
+				"redSwitchInfo": redSwitchInfo,
+			})
 		}
+		//if len(*status) > 1 {
+		//	if (*status)[1]["url"] != nil && (*status)[1]["url"] != "" {
+		//		this.ServeJson(map[string]interface{}{
+		//			"status":        "success",
+		//			"changed":       true,
+		//			"data":          (*status)[1],
+		//			"redSwitchInfo": redSwitchInfo,
+		//		})
+		//	} else {
+		//		this.ServeJson(map[string]interface{}{
+		//			"status":        "processing",
+		//			"changed":       true,
+		//			"data":          (*status)[1],
+		//			"redSwitchInfo": redSwitchInfo,
+		//		})
+		//	}
+		//} else {
+		//	if (*status)[0]["url"] != nil && (*status)[0]["url"] != "" {
+		//		this.ServeJson(map[string]interface{}{
+		//			"status":        "success",
+		//			"changed":       false,
+		//			"data":          (*status)[0],
+		//			"redSwitchInfo": redSwitchInfo,
+		//		})
+		//	} else {
+		//		this.ServeJson(map[string]interface{}{
+		//			"status":        "processing",
+		//			"changed":       false,
+		//			"data":          (*status)[0],
+		//			"redSwitchInfo": redSwitchInfo,
+		//		})
+		//	}
+		//}
 	} else {
 		datas := util.Mysql.FindOne("dataexport_order", data, "order_status,applybill_status,order_code,user_mail,applybill_type,applybill_company,user_phone,applybill_taxnum", "")
 		this.ServeJson(map[string]interface{}{
-			"status": "fail",
-			"data":   "",
-			"datas":  datas,
+			"status":        "fail",
+			"data":          "",
+			"datas":         datas,
+			"redSwitchInfo": redSwitchInfo,
 		})
 	}
 
@@ -672,6 +723,14 @@ func (this *Invoice) Callbackinvoice() {
 
 // 换票
 func (this *Invoice) Replaceinvoice() {
+	//红冲开关
+	if !config.InvoiceConfig.Red_invoice_switch {
+		this.ServeJson(map[string]interface{}{
+			"invoice_status": -1,
+			"invoice_msg":    config.InvoiceConfig.Red_invoice_msg,
+		})
+		return
+	}
 	userId := qutil.ObjToString(this.GetSession("userId"))
 	order_code := this.GetString("order_code")
 	isSys, _ := this.GetBool("isSys")
@@ -780,6 +839,7 @@ func (this *Invoice) Replaceinvoice() {
 				return
 			}
 		}
+		invoice_status := 0
 		dataexport_data := make(map[string]interface{})
 		if invoice_type == "个人" {
 			dataexport_data["applyBill_type"] = 0
@@ -802,20 +862,31 @@ func (this *Invoice) Replaceinvoice() {
 		data["invoice_changed"] = 1
 		data["create_time"] = time.Now().Unix()
 		data["user_id"] = userId
-		data["invoice_status"] = 0
+		data["invoice_status"] = invoice_status
 		data["product_type"] = (*res)["product_type"]
 		if !isSys {
 			status := util.Mysql.Find(dbname, map[string]interface{}{"order_code": order_code, "user_id": userId}, "", "create_time", 0, 0)
-			if len(*status) > 1 {
-				return
+			if len(*status) == 0 {
+				if id := util.Mysql.Insert(dbname, data); id > 0 {
+					invoice_status = 1
+				}
+			} else {
+				invoice_status = 1
 			}
-			util.Mysql.Insert(dbname, data)
 		} else {
-			util.Mysql.Update(dbname, map[string]interface{}{
+			if ok := util.Mysql.Update(dbname, map[string]interface{}{
 				"order_code":      order_code,
 				"user_id":         userId,
 				"invoice_changed": 1,
-			}, data)
+			}, data); ok {
+				invoice_status = 1
+			}
+		}
+		if !config.InvoiceConfig.Third_party_switch {
+			this.ServeJson(map[string]interface{}{
+				"invoice_status": invoice_status,
+			})
+			return
 		}
 		var orders = []map[string]interface{}{}
 		var items = []map[string]interface{}{}
@@ -934,6 +1005,13 @@ func (this *Invoice) Replaceinvoice() {
 
 // 退票
 func (this *Invoice) Refundinvoice() {
+	if !config.InvoiceConfig.Third_party_switch {
+		this.ServeJson(map[string]interface{}{
+			"invoice_status": -1,
+			"invoice_msg":    config.InvoiceConfig.Red_invoice_msg,
+		})
+		return
+	}
 	var refund_flag = -1
 	userid := this.GetSession("userId")
 	invoice_serialnum := this.GetString("invoice_serialnum") //发票流水号
@@ -1113,6 +1191,11 @@ func (this *Invoice) InvoiceSubmit() {
 	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", "")
+			productType := ""
+			if orderInfo != nil {
+				productType = qutil.InterfaceToStr((*orderInfo)["product_type"])
+			}
 			data := map[string]interface{}{
 				"order_code":          orderCode,
 				"company_name":        this.GetString("company_name"),
@@ -1141,6 +1224,7 @@ func (this *Invoice) InvoiceSubmit() {
 				"bank_name":           this.GetString("bank_name"),
 				"recipient":           this.GetString("recipient"),
 				"delivery_address":    this.GetString("delivery_address"),
+				"product_type":        productType,
 			}
 			if util.Mysql.Insert("invoice", data) <= 0 {
 				return false
@@ -1189,7 +1273,9 @@ func (this *Invoice) InvoiceSubmit() {
 			} else {
 				body["custName"] = "个人"
 			}
-			go htjs(body, orderArr, this.GetString("invoice_type"), this.GetString("company_name"), this.GetString("taxpayer_identnum"), this.GetString("mail"), this.GetString("phone"))
+			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 := ""

+ 25 - 18
src/jfw/modules/subscribepay/src/util/util.go

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

+ 42 - 0
src/web/staticres/electronic_invoice/css/check_invoice.css

@@ -303,3 +303,45 @@
   color: #fff;
   outline: 0;
 }
+
+#check_invoice #switchModal .modal-header {
+  padding: 32px 15px 24px;
+  border-bottom: 0;
+}
+
+#check_invoice #switchModal .modal-content {
+  max-width: 540px;
+}
+
+#check_invoice #switchModal .modal-title {
+  font-size: 18px;
+  line-height: 24px;
+  color: #1D1D1D;
+  text-align: center;
+}
+
+#check_invoice #switchModal .modal-body {
+  padding: 0 30px;
+}
+
+#check_invoice #switchModal .modal-body .text {
+  font-size: 14px;
+  line-height: 24px;
+  color: #1D1D1D;
+}
+
+#check_invoice #switchModal .modal-footer {
+  border-top: 0;
+  text-align: center;
+  padding: 32px 15px;
+}
+
+#check_invoice #switchModal .modal-footer .btn-default {
+  width: 132px;
+  height: 46px;
+  background: #2CB7CA;
+  border-radius: 6px;
+  border: 0;
+  color: #fff;
+  outline: 0;
+}

File diff suppressed because it is too large
+ 0 - 0
src/web/staticres/landingpage/mobile/css/index.css


+ 37 - 11
src/web/templates/pc/check_invoice.html

@@ -111,6 +111,21 @@
                 </div>
             </div>
         </div>
+        <div class="modal fade" id="switchModal" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
+          <div class="modal-dialog" style="max-width:400px;">
+            <div class="modal-content">
+              <div class="modal-header">
+                <h4 class="modal-title" style="font-weight: 700;">温馨提醒</h4>
+              </div>
+              <div class="modal-body">
+                <div class="text"></div>
+              </div>
+              <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal" id="i-know-btn">我知道了</button>
+              </div>
+            </div>
+          </div>
+        </div>
     </div>
     <!-- main END -->
     <!-- footer -->
@@ -119,22 +134,24 @@
     <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 () {
-                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)
-                });
-            });
+  $(function () {
+      $('#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)
+          });
+      });
 			var order_code={{.T.order_code}};
 			$(".order_code").text(order_code)
 			viewInvoice(order_code)
-			checkInvoice(order_code);
+			//checkInvoice(order_code);
 			var changed = false;
 			var interval;
 			var isOk =false;
+      var redInvoiceSwitch = false;
+      var redInvoiceMsg = "";
 			function checkInvoice(order_code) {
 				if (interval) {
 					clearInterval(interval);
@@ -250,7 +267,11 @@
 			}
 
 			$("#again_invoice").on("click",function(){
-				window.location.href = "/front/order/invoice/"+ order_code +"?changed=true";
+        if(!redInvoiceSwitch){
+          $('#switchModal').modal('show').find('.text').text(redInvoiceMsg);
+        }else{
+				  window.location.href = "/front/order/invoice/"+ order_code +"?changed=true";
+        }
 			})
 
 			function viewInvoice(order_code){
@@ -261,6 +282,11 @@
 					}else{
 						$("#l").text("已提交");
 					}
+          //红冲开关
+          if(r.redSwitchInfo){
+            redInvoiceSwitch=r.redSwitchInfo.ris;
+            redInvoiceMsg=r.redSwitchInfo.rim;
+          }
 					if (r.status=="success") {
 						$(".backInvoice").hide();
 						$("#fptt").text(r.data.invoice_type);

+ 50 - 7
src/web/templates/weixin/invoice/check_invoice.html

@@ -81,7 +81,8 @@
             </div>
             <!-- 开票完成  -->
             <div class="j-button-group" id="change" style="display: none;">
-                <button class="j-button-cancel again_inv" onclick=replaceInvoice()>换开申请</button>
+<!--                <button class="j-button-cancel again_inv" onclick=replaceInvoice()>换开申请</button>-->
+                <button class="j-button-cancel again_inv">换开申请</button>
                 <a id="show_invoice" href="" download class="j-button-confirm">查看发票</a>
             </div>
         </div>
@@ -102,6 +103,18 @@
                 <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary know">我知道了</a>
             </div>
         </div>
+    </div>
+    <!-- 红冲弹窗 -->
+    <div class="js_dialog" id="switchModal" style="display:none;">
+      <div class="weui-mask"></div>
+      <div class="weui-dialog">
+        <div class="dialog_content weui-dialog__bd" style="text-align:justify;font-size: .32rem;line-height: .48rem;">
+          温馨提醒:<br>
+        </div>
+        <div class="weui-dialog__ft">
+          <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary red_know">我知道了</a>
+        </div>
+      </div>
     </div>
 	<script src="{{Msg "seo" "cdn"}}/invoice/js/jquery.min.js"></script>
     <script src="{{Msg "seo" "cdn"}}/invoice/js/weui.min.js"></script>
@@ -112,6 +125,8 @@
         var changed = ""
         var isOk =false;
         var interval;
+        var redInvoiceSwitch = false;
+        var redInvoiceMsg = "";
         $(function () {
             checkInvoiceStatus(order_code);
             function checkInvoiceStatus(order_code){
@@ -120,11 +135,7 @@
                 }
                 clicktime()
                 interval = setInterval(clicktime,2000)
-
             }
-
-
-
             if (getParam("cc")=="replaceInv"){
               $(".again_inv").hide();
             }
@@ -157,8 +168,35 @@
             }
         }
         checkInvoice.init()
+        //红冲
+        var redInvoice = {
+          init:function(){
+            this.redInvoiceFunc();
+            this.hideRedDialog();
+          },
+          redInvoiceFunc:function() {
+            $('.again_inv').on('click',function(){
+              if(!redInvoiceSwitch){
+                $('#switchModal').find('.dialog_content').append(redInvoiceMsg);
+                $('#switchModal').show();
+              }else {
+                window.location.href = "/jyapp/front/invoice/showpage?order_code="+order_code+"&c=1"
+              }
+            })
+          },
+          hideRedDialog:function(){
+            $('.red_know').on('click',function(){
+              $('#switchModal').hide()
+            })
+          }
+        }
+        redInvoice.init()
         function replaceInvoice(){
-            window.location.href = "/front/invoice/showpage?order_code="+order_code+"&c=1"
+          if(!redInvoiceSwitch){
+            $('#switchModal').modal('show').find('#dialog_content').text(redInvoiceMsg);
+          }else {
+            window.location.href = "/front/invoice/showpage?order_code=" + order_code + "&c=1"
+          }
         }
 
       /******* 获取url参数(正则)********/
@@ -198,6 +236,11 @@
                 data:{"order_code":order_code},
                 success:function (r) {
                     console.log("rr",r)
+                    //红冲开关
+                    if(r.redSwitchInfo){
+                      redInvoiceSwitch=r.redSwitchInfo.ris;
+                      redInvoiceMsg=r.redSwitchInfo.rim;
+                    }
                     if (r.data !=""){
                         $(".taitou").text(r.data.invoice_type)
                         $("#phone_num").text(r.data.phone);
@@ -264,4 +307,4 @@
         }
     </script>
 </body>
-</html>
+</html>

+ 5 - 3
src/web/templates/weixin/landingpage/index.html

@@ -44,9 +44,11 @@
         <div class="next-page"></div>
     </div>
     <!--down-app-->
-    <a class="down-app">
-        <img id="toload" src="{{Msg "seo" "cdn"}}/landingpage/mobile/zip-images/down-app1.png" alt="下载剑鱼标讯" style="pointer-events: auto;" data-name="down-app">
-    </a>
+    <div class="down-app">
+        <a class="web-page" href="https://www.jianyu360.cn/">继续访问网页版</a>
+        <span id="toload" class="download-text" alt="下载剑鱼标讯App" style="pointer-events: auto;" data-name="down-app">下载剑鱼标讯App</span>
+        <!-- <img id="toload" src="{{Msg "seo" "cdn"}}/landingpage/mobile/zip-images/down-app1.png" alt="下载剑鱼标讯" style="pointer-events: auto;" data-name="down-app"> -->
+    </div>
     <!--two-->
     <div class="page-2">
         <!--title-->

Some files were not shown because too many files changed in this diff