购买自动升级折扣
This commit is contained in:
@@ -244,6 +244,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<span style="font-size: 30px;font-weight: bold;">{{OnePayAmount}}</span>元
|
<span style="font-size: 30px;font-weight: bold;">{{OnePayAmount}}</span>元
|
||||||
|
<span>{{auto_discount_text}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 text-left">
|
<div class="col-lg-4 text-left">
|
||||||
<span></span>
|
<span></span>
|
||||||
@@ -395,6 +396,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<span style="font-size: 30px;font-weight: bold;">{{MorePayAmount}}</span>元
|
<span style="font-size: 30px;font-weight: bold;">{{MorePayAmount}}</span>元
|
||||||
|
<span>{{auto_discount_text}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 text-left">
|
<div class="col-lg-4 text-left">
|
||||||
<span></span>
|
<span></span>
|
||||||
@@ -450,6 +452,7 @@
|
|||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
|
auto_discount_text:'',
|
||||||
acount_list:'',
|
acount_list:'',
|
||||||
payHandler: null,
|
payHandler: null,
|
||||||
Tip: '',
|
Tip: '',
|
||||||
@@ -509,6 +512,40 @@
|
|||||||
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount ;
|
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount - this.OneBuyModel.CouponAmount ;
|
||||||
total = total < 0 ? 0 : total;
|
total = total < 0 ? 0 : total;
|
||||||
|
|
||||||
|
if(@(userEntity.agent_id) == 0){
|
||||||
|
var consume_value = @(userEntity.ConsumeAmount);
|
||||||
|
var cost_money = total + consume_value;
|
||||||
|
var discount = 100;
|
||||||
|
if (cost_money>=200 && cost_money<500){
|
||||||
|
discount = 90;
|
||||||
|
this.auto_discount_text = '(自动升级至 9 折会员)';
|
||||||
|
} else if(cost_money>=500 && cost_money<1500) {
|
||||||
|
discount = 80;
|
||||||
|
this.auto_discount_text = '(自动升级至 8 折会员)';
|
||||||
|
} else if(cost_money>=1500 && cost_money<3000) {
|
||||||
|
discount = 70;
|
||||||
|
this.auto_discount_text = '(自动升级至 7 折会员)';
|
||||||
|
} else if(cost_money>=3000 && cost_money<6000) {
|
||||||
|
discount = 65;
|
||||||
|
this.auto_discount_text = '(自动升级至 6.5 折会员)';
|
||||||
|
} else if(cost_money>=6000) {
|
||||||
|
discount = 60;
|
||||||
|
this.auto_discount_text = '(自动升级至 6 折会员)';
|
||||||
|
}
|
||||||
|
|
||||||
|
var need_cost = 100000000;
|
||||||
|
|
||||||
|
if(discount != 100){
|
||||||
|
need_cost = @(Model.Package.LinePrice) * this.OneBuyModel.ConnectCount * discount / 100 - this.OneBuyModel.CouponAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(need_cost<total){
|
||||||
|
total = need_cost;
|
||||||
|
} else {
|
||||||
|
this.auto_discount_text = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
},
|
},
|
||||||
MoreTotalAmount: function () {
|
MoreTotalAmount: function () {
|
||||||
@@ -524,6 +561,40 @@
|
|||||||
var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount ;
|
var total = this.MoreBuyModel.Price * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix - this.MoreBuyModel.CouponAmount ;
|
||||||
total = total < 0 ? 0 : total;
|
total = total < 0 ? 0 : total;
|
||||||
|
|
||||||
|
if(@(userEntity.agent_id) == 0){
|
||||||
|
var consume_value = @(userEntity.ConsumeAmount);
|
||||||
|
var cost_money = total + consume_value;
|
||||||
|
var discount = 100;
|
||||||
|
if (cost_money>=200 && cost_money<500){
|
||||||
|
discount = 90;
|
||||||
|
this.auto_discount_text = '(自动升级至 9 折会员)';
|
||||||
|
} else if(cost_money>=500 && cost_money<1500) {
|
||||||
|
discount = 80;
|
||||||
|
this.auto_discount_text = '(自动升级至 8 折会员)';
|
||||||
|
} else if(cost_money>=1500 && cost_money<3000) {
|
||||||
|
discount = 70;
|
||||||
|
this.auto_discount_text = '(自动升级至 7 折会员)';
|
||||||
|
} else if(cost_money>=3000 && cost_money<6000) {
|
||||||
|
discount = 65;
|
||||||
|
this.auto_discount_text = '(自动升级至 6.5 折会员)';
|
||||||
|
} else if(cost_money>=6000) {
|
||||||
|
discount = 60;
|
||||||
|
this.auto_discount_text = '(自动升级至 6 折会员)';
|
||||||
|
}
|
||||||
|
|
||||||
|
var need_cost = 100000000;
|
||||||
|
|
||||||
|
if(discount != 100){
|
||||||
|
need_cost = @(Model.Package.LinePrice) * this.MoreBuyModel.ConnectCount * this.MoreBuyModel.MaxPostfix * discount / 100 - this.MoreBuyModel.CouponAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(need_cost<total){
|
||||||
|
total = need_cost;
|
||||||
|
} else {
|
||||||
|
this.auto_discount_text = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -207,6 +207,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<span style="font-size: 30px;font-weight: bold;">{{PayAmount}}</span>元
|
<span style="font-size: 30px;font-weight: bold;">{{PayAmount}}</span>元
|
||||||
|
<span>{{auto_discount_text}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 text-left">
|
<div class="col-lg-4 text-left">
|
||||||
<span></span>
|
<span></span>
|
||||||
@@ -253,6 +254,7 @@
|
|||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
|
auto_discount_text:'',
|
||||||
payHandler: null,
|
payHandler: null,
|
||||||
Tip:'',
|
Tip:'',
|
||||||
RestAmount: @(userEntity.RestAmount),
|
RestAmount: @(userEntity.RestAmount),
|
||||||
@@ -288,6 +290,42 @@
|
|||||||
var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0;
|
var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0;
|
||||||
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount ;
|
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount ;
|
||||||
total= total < 0 ? 0 : total;
|
total= total < 0 ? 0 : total;
|
||||||
|
|
||||||
|
//自动折扣
|
||||||
|
if(@(userEntity.agent_id) == 0){
|
||||||
|
var consume_value = @(userEntity.ConsumeAmount);
|
||||||
|
var cost_money = total + consume_value;
|
||||||
|
var discount = 100;
|
||||||
|
if (cost_money>=200 && cost_money<500){
|
||||||
|
discount = 90;
|
||||||
|
this.auto_discount_text = '(自动升级至 9 折会员)';
|
||||||
|
} else if(cost_money>=500 && cost_money<1500) {
|
||||||
|
discount = 80;
|
||||||
|
this.auto_discount_text = '(自动升级至 8 折会员)';
|
||||||
|
} else if(cost_money>=1500 && cost_money<3000) {
|
||||||
|
discount = 70;
|
||||||
|
this.auto_discount_text = '(自动升级至 7 折会员)';
|
||||||
|
} else if(cost_money>=3000 && cost_money<6000) {
|
||||||
|
discount = 65;
|
||||||
|
this.auto_discount_text = '(自动升级至 6.5 折会员)';
|
||||||
|
} else if(cost_money>=6000) {
|
||||||
|
discount = 60;
|
||||||
|
this.auto_discount_text = '(自动升级至 6 折会员)';
|
||||||
|
}
|
||||||
|
|
||||||
|
var need_cost = 100000000;
|
||||||
|
|
||||||
|
if(discount != 100){
|
||||||
|
need_cost = @(Model.Package.LinePrice) * this.OneBuyModel.ConnectCount * discount / 100 - this.OneBuyModel.CouponAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(need_cost<total){
|
||||||
|
total = need_cost;
|
||||||
|
} else {
|
||||||
|
this.auto_discount_text = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return total.toFixed(2);
|
return total.toFixed(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -253,6 +253,8 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
return new ApiResult<ProductOrderEntity>(ResultCode.C_INVALID_ERROR, "链接数至少为1!");
|
return new ApiResult<ProductOrderEntity>(ResultCode.C_INVALID_ERROR, "链接数至少为1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//是否已经设置会员价
|
//是否已经设置会员价
|
||||||
var is_user_price = true;
|
var is_user_price = true;
|
||||||
@@ -267,7 +269,57 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
if (discount != null)
|
if (discount != null)
|
||||||
{
|
{
|
||||||
dis_price = packageEntity.LinePrice * discount.discount / 100;
|
dis_price = packageEntity.LinePrice * discount.discount / 100;
|
||||||
is_user_price = false;
|
if(discount.discount < 65){
|
||||||
|
is_user_price = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(userEntity.agent_id == 0){
|
||||||
|
|
||||||
|
var cost_price = price;
|
||||||
|
if(cost_price > dis_price){
|
||||||
|
cost_price = dis_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
//自动使用折扣
|
||||||
|
var cost = 0M;
|
||||||
|
if (request.OrderType == OrderType.New || request.OrderType == OrderType.AgainBuy)
|
||||||
|
{
|
||||||
|
cost = cost_price * request.ConnectCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.OrderType == OrderType.News)
|
||||||
|
{
|
||||||
|
var accounts = GreateBatchAccount(request.Account, request.MinPostfix, request.MaxPostfix);
|
||||||
|
cost = cost_price * request.ConnectCount * accounts.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.OrderType == OrderType.AgainBuys)
|
||||||
|
{
|
||||||
|
int count = request.Account.Split(",").Length;
|
||||||
|
cost = cost_price * request.ConnectCount * count;
|
||||||
|
}
|
||||||
|
var cost_money = cost + userEntity.ConsumeAmount;
|
||||||
|
var discount_reset = 100;
|
||||||
|
if (cost_money>=200 && cost_money<500){
|
||||||
|
discount_reset = 90;
|
||||||
|
} else if(cost_money>=500 && cost_money<1500) {
|
||||||
|
discount_reset = 80;
|
||||||
|
} else if(cost_money>=1500 && cost_money<3000) {
|
||||||
|
discount_reset = 70;
|
||||||
|
} else if(cost_money>=3000 && cost_money<6000) {
|
||||||
|
discount_reset = 65;
|
||||||
|
} else if(cost_money>=6000) {
|
||||||
|
discount_reset = 60;
|
||||||
|
}
|
||||||
|
if (discount != null)
|
||||||
|
{
|
||||||
|
if(discount_reset<discount.discount){
|
||||||
|
dis_price = packageEntity.LinePrice * discount_reset / 100;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dis_price = packageEntity.LinePrice * discount_reset / 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//根据会员价
|
//根据会员价
|
||||||
@@ -278,9 +330,12 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
is_user_price = false;
|
is_user_price = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//确定价格
|
||||||
if(dis_price<price){
|
if(dis_price<price){
|
||||||
price = dis_price;
|
price = dis_price;
|
||||||
}
|
}
|
||||||
|
//最低价
|
||||||
if(price<packageEntity.MinPrice){
|
if(price<packageEntity.MinPrice){
|
||||||
price = packageEntity.MinPrice;
|
price = packageEntity.MinPrice;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user