From 0bc6915fd779f380688a805e00d28b01b84c830b Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Mon, 12 Oct 2020 21:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E7=95=8C=E9=9D=A2=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Host/Views.Mobile/Product/buy.cshtml | 38 ++++++++++++++++---------- Host/Views.Mobile/Product/rebuy.cshtml | 36 +++++++++++++++--------- Host/Views/Product/buy.cshtml | 25 ++++++++++++----- Host/Views/Product/rebuy.cshtml | 11 ++++++-- 4 files changed, 73 insertions(+), 37 deletions(-) diff --git a/Host/Views.Mobile/Product/buy.cshtml b/Host/Views.Mobile/Product/buy.cshtml index 2a4abc2..89bf48c 100644 --- a/Host/Views.Mobile/Product/buy.cshtml +++ b/Host/Views.Mobile/Product/buy.cshtml @@ -164,12 +164,12 @@
- - + +
- - + +
@@ -286,12 +286,12 @@
- - + +
- - + +
@@ -397,7 +397,7 @@ }, OnePayAmount: function () { var restAmout = this.OneBuyModel.UseAccountAmount == 1 ?this.RestAmount:0; - var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount - restAmout; + var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount ; total= total < 0 ? 0 : total; return total.toFixed(2); }, @@ -407,7 +407,7 @@ }, MorePayAmount: function () { var restAmout = this.MoreBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0; - var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount - restAmout; + var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount ; total= total < 0 ? 0 : total; return total.toFixed(2); } @@ -434,6 +434,8 @@ } } return; + } else { + this.OneBuyModel.CouponAmount = 0; } } }, @@ -447,6 +449,7 @@ if (totalAmount < item.AllowMinAmount) { continue; } + if (item.Id == newValue) { if (item.CouponType == 1) {//满减 this.MoreBuyModel.CouponAmount = item.CouponValue; @@ -460,6 +463,8 @@ } } return; + } else { + this.MoreBuyModel.CouponAmount = 0; } } }, @@ -553,9 +558,12 @@ this.OneBuyModel.ConnectCount = parseInt(this.OneBuyModel.ConnectCount) if (!this.isNum(this.OneBuyModel.ConnectCount)) return; if (!this.checkOneAccount() || !this.checkOnePwd()) return; - if (this.OnePayAmount > 0 ) { - if (this.OneBuyModel.UseAccountAmount){ + + if (this.OneBuyModel.UseAccountAmount) { + if (this.RestAmount < this.OnePayAmount){ alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.OnePayAmount; } } var that = this; @@ -591,9 +599,11 @@ if (!this.isNum(this.MoreBuyModel.ConnectCount)) return; if (!this.checkMoreAccount() || !this.checkMorePwd() || this.MoreBuyModel.MaxPostfix>500) return; var that = this; - if (this.OnePayAmount > 0 ) { - if (this.MoreBuyModel.UseAccountAmount){ + if (this.MoreBuyModel.UseAccountAmount) { + if (this.RestAmount < this.MorePayAmount){ alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.MorePayAmount; } } if (this.MoreBuyModel.UseAccountAmount === true) this.MoreBuyModel.UseAccountAmount = 1; diff --git a/Host/Views.Mobile/Product/rebuy.cshtml b/Host/Views.Mobile/Product/rebuy.cshtml index bd3581d..1737913 100644 --- a/Host/Views.Mobile/Product/rebuy.cshtml +++ b/Host/Views.Mobile/Product/rebuy.cshtml @@ -103,13 +103,13 @@
- 余额抵扣: + 余额:
-
- 当前账户余额@(userEntity.RestAmount)元 - @* - *@ +
+ 当前账户余额@(userEntity.RestAmount)元 + 前往充值 +
@@ -119,12 +119,16 @@
- - + +
- - + + +
+
+ +
@@ -188,7 +192,7 @@ PayAmount: function () { var count = this.OneBuyModel.Account.split(',').length; var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0; - var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount - restAmout; + var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount ; total= total < 0 ? 0 : total; return total.toFixed(2); } @@ -215,8 +219,10 @@ } } return; + } else { + this.OneBuyModel.CouponAmount = 0; } - } + } }, immediate: true }, @@ -253,8 +259,12 @@ }) }, onePay: function () { - if (this.PayAmount == 0 || this.OneBuyModel.UseAccountAmount) { - if (!confirm('余额和微信支付宝组合支付时,余额将立即扣除,请务必完成后续差额支付!')) return; + if (this.OneBuyModel.UseAccountAmount) { + if (this.RestAmount < this.PayAmount){ + alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.PayAmount; + } } var that = this; if (this.OneBuyModel.UseAccountAmount === true) this.OneBuyModel.UseAccountAmount = 1; diff --git a/Host/Views/Product/buy.cshtml b/Host/Views/Product/buy.cshtml index 8b03b43..e0faecd 100644 --- a/Host/Views/Product/buy.cshtml +++ b/Host/Views/Product/buy.cshtml @@ -342,7 +342,7 @@
- 应付款 + 总金额:
{{MoreTotalAmount}}元 @@ -463,7 +463,7 @@ }, OnePayAmount: function () { var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0; - var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount - restAmout; + var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount ; total = total < 0 ? 0 : total; return total.toFixed(2); }, @@ -473,7 +473,7 @@ }, MorePayAmount: function () { var restAmout = this.MoreBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0; - var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount - restAmout; + var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount ; total = total < 0 ? 0 : total; return total.toFixed(2); } @@ -487,6 +487,9 @@ if (totalAmount < item.AllowMinAmount) { continue; } + if(newValue == '0'){ + this.OneBuyModel.CouponAmount = 0; + } if (item.Id == newValue) { if (item.CouponType == 1) {//满减 this.OneBuyModel.CouponAmount = item.CouponValue; @@ -513,6 +516,9 @@ if (totalAmount < item.AllowMinAmount) { continue; } + if(newValue == '0'){ + this.OneBuyModel.CouponAmount = 0; + } if (item.Id == newValue) { if (item.CouponType == 1) {//满减 this.MoreBuyModel.CouponAmount = item.CouponValue; @@ -617,9 +623,12 @@ this.OneBuyModel.ConnectCount = parseInt(this.OneBuyModel.ConnectCount) if (!this.isNum(this.OneBuyModel.ConnectCount)) return; if (!this.checkOneAccount() || !this.checkOnePwd()) return; - if (this.OnePayAmount > 0 ) { - if (this.OneBuyModel.UseAccountAmount){ + + if (this.OneBuyModel.UseAccountAmount) { + if (this.RestAmount < this.OnePayAmount){ alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.OnePayAmount; } } var that = this; @@ -655,9 +664,11 @@ if (!this.isNum(this.MoreBuyModel.ConnectCount)) return; if (!this.checkMoreAccount() || !this.checkMorePwd() || this.MoreBuyModel.MaxPostfix>500) return; var that = this; - if (this.MorePayAmount > 0 ) { - if (this.MoreBuyModel.UseAccountAmount){ + if (this.MoreBuyModel.UseAccountAmount) { + if (this.RestAmount < this.MorePayAmount){ alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.MorePayAmount; } } if (this.MoreBuyModel.UseAccountAmount === true) this.MoreBuyModel.UseAccountAmount = 1; diff --git a/Host/Views/Product/rebuy.cshtml b/Host/Views/Product/rebuy.cshtml index 10d699d..e329c23 100644 --- a/Host/Views/Product/rebuy.cshtml +++ b/Host/Views/Product/rebuy.cshtml @@ -257,7 +257,7 @@ PayAmount: function () { var count = this.OneBuyModel.Account.split(',').length; var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0; - var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount - restAmout; + var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount ; total= total < 0 ? 0 : total; return total.toFixed(2); } @@ -271,6 +271,9 @@ if (totalAmount < item.AllowMinAmount) { continue; } + if(newValue == '0'){ + this.OneBuyModel.CouponAmount = 0; + } if (item.Id == newValue) { if (item.CouponType == 1) {//满减 this.OneBuyModel.CouponAmount = item.CouponValue; @@ -316,9 +319,11 @@ }) }, onePay: function () { - if (this.PayAmount > 0 ) { - if (this.OneBuyModel.UseAccountAmount){ + if (this.OneBuyModel.UseAccountAmount) { + if (this.RestAmount < this.PayAmount){ alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return; + } else { + this.RestAmount = this.RestAmount - this.PayAmount; } } var that = this;