Эх сурвалжийг харах

Merge branch 'dev/v4.9.21_tsz' of qmx/jy into feature/v4.9.21

汤世哲 1 жил өмнө
parent
commit
f045d4d2de

+ 4 - 0
src/web/staticres/electronic_invoice/css/invoice.css

@@ -77,6 +77,10 @@ input[type="number"] {
 #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;
 }

+ 97 - 100
src/web/templates/pc/invoice.html

@@ -106,13 +106,13 @@
                       </el-card>
                     </el-form-item>
                     <el-form-item label="单位税号:" prop="taxpayer_identnum">
-                      <el-input placeholder="请输入单位税号" v-model="ruleForm.taxpayer_identnum"></el-input>
+                      <el-input @blur="validateForm" 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="电话号码:">
-                      <el-input placeholder="请输入电话号码" v-model="ruleForm.company_phone"></el-input>
+                      <el-input maxlength="11" placeholder="请输入电话号码" v-model="ruleForm.company_phone"></el-input>
                     </el-form-item>
                     <el-form-item label="开户银行:">
                       <el-input placeholder="请输入开户银行" v-model="ruleForm.bank_name"></el-input>
@@ -125,16 +125,16 @@
                     </el-form-item>
                   </div>
                   <el-form-item label="联系电话:" prop="phone">
-                    <el-input placeholder="请输入手机号" v-model="ruleForm.phone"></el-input>
+                    <el-input maxlength="11" @blur="validateForm" 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-input @blur="validateForm" 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 :disabled="!isFormValid" type="primary" @click="submitForm('ruleForm')">提交</el-button>
                     <el-button @click="resetForm('ruleForm')">取消</el-button>
                   </el-form-item>
                 </el-form>
@@ -167,7 +167,7 @@
 	        </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 fade" id="switchModal" tabindex="-1" data-keyboard="false" 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">
@@ -180,7 +180,7 @@
 	                <button type="button" class="btn btn-default" data-dismiss="modal" id="i-know-btn">我知道了</button>
 	            </div>
 	        </div>
-	    </div> -->
+	    </div>
 	</div>
     <!-- main END -->
 	{{include "/common/pcbottom.html"}}
@@ -196,83 +196,19 @@
         var order_code = {{.T.order_code}};
         var order_mail = {{.T.mail}};
         var order_phone = {{.T.phone}};
-        // 查询是否可以开发票
-        // $.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();
-        //   			  $(".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");
-        //         }
-        //       });
-        //     }
-        //   }
-        // })
         haslogin({{.T.logid}});
+        $('#i-know-btn').on('click', function () {
+            // 新窗口打开
+            // 判断窗口是不是window.open打开的
+            if (window.opener && window.opener !== window) {
+                window.close()
+            } else {
+                if (history.length <= 1) {
+                    window.close()
+                }
+                history.back()
+            }
+        })
         var invoiceNode = new Vue({
           el: '#invoice',
           delimiters: ['${', '}'],
@@ -335,7 +271,8 @@
                 only_Identifying: ''
               },
               addressHeight: 36,
-              remarkHeight: 36
+              remarkHeight: 36,
+              isFormValid: false // 表单是否通过校验
             }
           },
           created () {
@@ -346,8 +283,14 @@
             const invoiceid = utils.getParam('invoiceid')
             this.urlParams.type = type
             this.urlParams.invoiceid = invoiceid
+            this.setPageOver()
             this.invouceInfoEcho()
           },
+          mounted() {
+            setTimeout(() => {
+              this.validateForm()
+            }, 200)
+          },
           watch: {
             'ruleForm.invoice_variety': {
               handler (val) {
@@ -365,9 +308,44 @@
               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")
+                      }
+                    }
+                  })
+                }
+              })
+            },
+            validateForm() {
+              this.$refs.ruleForm.validate(valid => {
+                // this.$refs.ruleForm.clearValidate();
+                this.isFormValid = valid
+              });
+            },
             getTextareaHeight(textareaEl) {
               textareaEl = textareaEl.querySelector('textarea');
               textareaEl.style.height = 'auto';
@@ -392,7 +370,7 @@
               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.invoice_content = invoice_content
               this.ruleForm.mail = mail
               this.ruleForm.phone = phone
               this.ruleForm.remark = remark
@@ -482,15 +460,30 @@
               })
             },
             resetForm(formName) {
-              this.$refs[formName].resetFields();
+              this.ruleForm = {
+                order_code: '',
+                invoice_content: '信息技术服务-技术服务费',
+                invoice_type: '单位',
+                invoice_variety: '电子普通发票',
+                mail: '',
+                phone: '',
+                remark: '',
+                company_name: '',
+                taxpayer_identnum: '',
+                company_address: '',
+                company_phone: '',
+                bank_name: '',
+                bank_account: ''
+              }
             },
             handleInput(value) {
-              this.debounce(this.getCompanyList(value), 500)
+              utils.debounce(this.getCompanyList(value), 300)
             },
             handleBlur() {
               setTimeout(() => {
                 this.companyList = []
               }, 200);
+              this.validateForm()
             },
             handleClick(item) {
               const { name, taxCode } = item
@@ -510,22 +503,26 @@
               }
               this.ajaxComponent(url, params).then((res) => {
                 if(res && res.error_code === 0) {
-                  this.companyList = res.data.list
+                  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);
-              };
-            },
+            // 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) => {

+ 1 - 7
src/web/templates/pc/member_orderDetail.html

@@ -362,13 +362,7 @@
                                             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');
-                                            }
-                                        })
+                                        window.open("/front/order/invoice/" + orderCode, '_self');
                                     });
                                 }else if (r.data.applybill_status === 1 || r.data.applybill_status === 2) {
                                     $(".lookinvoice").css("display", "").on("click", function () {

+ 5 - 11
src/web/templates/pc/myOrder.html

@@ -554,8 +554,8 @@
                           '再次' : '去'#@支付</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.invoice_price" data-jy-track="click-hover"
+                    <div v-if="item.order_status === 1 && item.filter.badge!='exchange'">
+                      <p><a v-if="item.applybill_status === 0 && (item.is_backstage_order === 0 || item.order_channel === 'xdqd04' ||  item.qmx_invoice ) && item.invoice_price" 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)">发票信息</a></p>
                     </div>
@@ -593,7 +593,7 @@
                     </p>
                     <!--已完成 && && item.filter.badge!='exchange' P307 权益码兑换 不开发票-->
                     <p v-if="item.order_status === 1 && item.filter.badge!='exchange'"><a
-                        v-if="item.billingMode === 1 && (item.is_backstage_order === 0 || item.order_channel === 'xdqd04' ||  item.order_qmx_invoice ) && item.invoice_price"
+                        v-if="item.billingMode === 1 && (item.is_backstage_order === 0 || item.order_channel === 'xdqd04' ||  item.qmx_invoice ) && item.invoice_price"
                         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)">发票信息</a></p>
                     <!--已取消-->
@@ -1386,7 +1386,7 @@
             } 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) {
@@ -1433,13 +1433,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 = ''