Browse Source

feat:开发票开关添加

yangfeng 3 years ago
parent
commit
1c37702b0b

+ 12 - 0
src/jfw/modules/app/src/web/staticres/jyapp/invoice/css/invoicing.css

@@ -205,3 +205,15 @@
 input:disabled{
   background-color: #FFFFFF;
 }
+.jy-alert .weui-dialog__hd {
+  padding: 16px 24px 0;
+  text-align: center;
+}
+.jy-alert .weui-dialog__title{
+  font-weight: 600;
+  text-align: center;
+  font-size: .4rem;
+}
+.jy-alert .weui-dialog__bd{
+  text-align: justify;
+}

+ 30 - 11
src/jfw/modules/app/src/web/templates/invoice/invoicing.html

@@ -147,9 +147,9 @@
                                 if (product_name == "历史数据"){  //历史数据
                                     $(".user-phone").attr("value",r.datas.user_phone)
                                     $(".user-mail").attr("value",r.datas.user_mail)
-									invoice.phoneStatus = true;
-									invoice.emailStatus = true;
-									$(".j-button-confirm").removeAttr("disabled")
+                                    invoice.phoneStatus = true;
+                                    invoice.emailStatus = true;
+                                    $(".j-button-confirm").removeAttr("disabled")
                                 }
                                 if (r.datas.applybill_status == 1){
                                     $(".j-footer").hide();
@@ -268,9 +268,6 @@
                                         if (c==1){
                                             $('.invoice-value').text("个人")
                                             $('.company-cell').hide()
-
-
-
                                         }else{
                                             if (r.data.invoice_type == "单位"){
                                                 $('.company-cell').show()
@@ -328,6 +325,7 @@
                 this.checkCode();
                 this.checkInput();
                 this.submitHandle()
+                this.switchInvoice(); // 是否可以开发票
             },
             // 控制单位和个人填写
             isShowForm:function(){
@@ -518,7 +516,6 @@
             // 社会信用代码校验
             checkCode:function(){
                 var that = this;
-
                 $('input[name="code"]').on('blur',function(){
                     if ($(this).val() == ''){
                         that.codeStatus = false;
@@ -549,8 +546,32 @@
                     $('#rules_dialog').hide()
                 })
             },
+            // 发票功能是否开启
+            switchInvoice: function() {
+              $.ajax({
+                  url: '/jypay/invoice/switch?t=' + Date.now(),
+                  type: "GET",
+                  success: function(res) {
+                    if (res.code === '1001') {
+                      $('.j-button-confirm').attr('disabled',true)
+                      return weui.alert(res.messge, {
+                          title: '温馨提醒',
+                          className: 'jy-alert',
+                          buttons: [{
+                            label: '我知道了',
+                            onClick: function(){ 
+                              history.back()
+                            }
+                          }]
+                      })
+                    }
+                  },
+                  fail: function(err) {
+                    console.log(err)
+                  }
+              })
+            },
             // 提交
-
             submitHandle:function(){
                 var that = this
                 $('.j-button-confirm').on('click',function(){
@@ -591,7 +612,6 @@
 
                     }
                     // 个人发票提交
-
                     if (isHidden) {
                         if(that.phoneStatus && that.emailStatus){
                             $.ajax({
@@ -626,14 +646,13 @@
                                 className: 'j-toast-icon',
                                 callback: function(){
                                   if(c!=""){
-                                     window.location.href = '/jyapp/front/invoice/check_invoice.html?cc=replaceInv&order_code='+order_code
+                                    window.location.href = '/jyapp/front/invoice/check_invoice.html?cc=replaceInv&order_code='+order_code
                                     }else{
                                       window.location.href = '/jyapp/front/invoice/check_invoice.html?order_code='+order_code
                                     }
                                 }
                             });
                         }
-
                     }
                 })
             }

+ 14 - 7
src/web/staticres/electronic_invoice/css/invoice.css

@@ -216,39 +216,46 @@ input[type="number"] {
   color: #fff;
 }
 
-#ruleModal .modal-header {
+#ruleModal .modal-header,
+#switchModal .modal-header{
   padding: 32px 15px 24px;
   border-bottom: 0;
 }
 
-#ruleModal .modal-content {
+#ruleModal .modal-content,
+#switchModal .modal-content {
   max-width: 540px;
 }
 
-#ruleModal .modal-title {
+#ruleModal .modal-title,
+#switchModal .modal-title {
   font-size: 18px;
   line-height: 24px;
   color: #1D1D1D;
   text-align: center;
 }
 
-#ruleModal .modal-body {
+#ruleModal .modal-body,
+#switchModal .modal-body {
   padding: 0 30px;
 }
 
-#ruleModal .modal-body .text {
+#ruleModal .modal-body .text,
+#switchModal .modal-body .text {
   font-size: 14px;
   line-height: 24px;
   color: #1D1D1D;
 }
 
-#ruleModal .modal-footer {
+#ruleModal .modal-footer,
+#switchModal .modal-footer {
   border-top: 0;
   text-align: center;
   padding: 32px 15px;
 }
 
-#ruleModal .modal-footer .btn-default {
+#ruleModal .modal-footer .btn-default,
+#switchModal .modal-footer .btn-default  {
   width: 132px;
   height: 46px;
   background: #2CB7CA;

+ 12 - 0
src/web/staticres/electronic_invoice/js/invoice.js

@@ -121,6 +121,18 @@ $(function () {
         $('.unit_invoice').hide()
     }
     initSelect();
+    // 查询是否可以开发票
+    $.ajax({
+      url: '/jypay/invoice/switch',
+      type: "GET",
+      success: function(res) {
+        if (res.code === '1001') {
+          // 不能开票
+          $('#switchModal').modal('show').find('.text').text(res.messge)
+          return 
+        }
+      }
+    })
     // 提交
     $('.submit_btn').click(function(){
 		var order_code =$(".order_code").text();

+ 13 - 0
src/web/staticres/invoice/css/invoicing.css

@@ -205,4 +205,17 @@
 input:disabled{
   background-color: #FFFFFF;
   background: #fff;
+}
+
+.jy-alert .weui-dialog__hd {
+  padding: 16px 24px 0;
+  text-align: center;
+}
+.jy-alert .weui-dialog__title{
+  font-weight: 600;
+  text-align: center;
+  font-size: .4rem;
+}
+.jy-alert .weui-dialog__bd{
+  text-align: justify;
 }

+ 17 - 2
src/web/templates/pc/invoice.html

@@ -123,7 +123,7 @@
             <span>提交成功</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 fade" id="ruleModal" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
 	    <div class="modal-dialog">
 	        <div class="modal-content">
 	            <div class="modal-header">
@@ -143,12 +143,26 @@
 	            </div>
 	        </div>
 	    </div>
+	  </div>
+    <div class="modal fade" id="switchModal" tabindex="-1" data-keyboard="false" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
+	    <div class="modal-dialog">
+	        <div class="modal-content" style="max-width:400px;">
+	            <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" onclick="history.back()">我知道了</button>
+	            </div>
+	        </div>
+	    </div>
 	</div>
     <!-- main END -->
 	{{include "/common/pcbottom.html"}}
 	{{include "/common/baiducc.html"}}
     <!-- footer -->
-    <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/jquery-2.1.4.min.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样式 -->
@@ -156,6 +170,7 @@
     <script src="{{Msg "seo" "cdn"}}/electronic_invoice/js/invoice.js?v={{Msg "seo" "version"}}"></script>
 	<script>
 		  $(function(){
+        
 			  var order_mail = {{.T.mail}};
 			  var order_phone = {{.T.phone}};
 			  if(order_mail!==""&&order_mail!==null&&order_mail!==undefined){

+ 26 - 0
src/web/templates/weixin/invoice/invoicing.html

@@ -338,6 +338,7 @@
                 this.checkCode();
                 this.checkInput();
                 this.submitHandle();
+                this.switchInvoice(); // 是否可以开发票
             },
             // 控制单位和个人填写
             isShowForm:function(){
@@ -595,6 +596,31 @@
                     $('#rules_dialog').hide()
                 })
             },
+            // 发票功能是否开启
+            switchInvoice: function() {
+              $.ajax({
+                  url: '/jypay/invoice/switch?t=' + Date.now(),
+                  type: "GET",
+                  success: function(res) {
+                    if (res.code === '1001') {
+                      $('.j-button-confirm').attr('disabled',true)
+                      return weui.alert(res.messge, {
+                          title: '温馨提醒',
+                          className: 'jy-alert',
+                          buttons: [{
+                            label: '我知道了',
+                            onClick: function(){ 
+                              history.back()
+                            }
+                          }]
+                      })
+                    }
+                  },
+                  fail: function(err) {
+                    console.log(err)
+                  }
+              })
+            },
             // 提交
             submitHandle:function(){
                 var that = this