MEE
This commit is contained in:
commit
a65793b2c2
@ -71,7 +71,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Сумма оплаты должна быть больше 0", nameof(model.SumPayment));
|
throw new ArgumentNullException("Сумма оплаты должна быть больше 0", nameof(model.SumPayment));
|
||||||
}
|
}
|
||||||
_logger.LogInformation($"Payment. ID:{model.ID}.ProductID:{model.ProductID}.Sum:{model.SumPayment}.OrderID:{model.OrderID}" +
|
_logger.LogInformation($"Payment. ID:{model.ID}.Sum:{model.SumPayment}.OrderID:{model.OrderID}" +
|
||||||
$".PayOption{model.PayOption}");
|
$".PayOption{model.PayOption}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
var record = new ReportPaymeantsViewModel
|
var record = new ReportPaymeantsViewModel
|
||||||
{
|
{
|
||||||
PaymeantID=paymeant.ID,
|
PaymeantID=paymeant.ID,
|
||||||
ProductID=paymeant.ProductID,
|
//ProductID=paymeant.ProductID,
|
||||||
OrderID=paymeant.OrderID,
|
OrderID=paymeant.OrderID,
|
||||||
PayOption=paymeant.PayOption,
|
PayOption=paymeant.PayOption,
|
||||||
SumPayment=paymeant.SumPayment,
|
SumPayment=paymeant.SumPayment,
|
||||||
|
@ -12,12 +12,12 @@ namespace ElectronicsShopContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public int ProductID { get; set; }
|
|
||||||
|
|
||||||
public int OrderID { get; set; }
|
public int OrderID { get; set; }
|
||||||
|
|
||||||
public double SumPayment { get; set; }
|
public double SumPayment { get; set; }
|
||||||
|
|
||||||
public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено;
|
public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено;
|
||||||
|
|
||||||
|
public int ClientID { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,6 @@ namespace ElectronicsShopContracts.SearchModels
|
|||||||
public int? ProductID { get; set; }
|
public int? ProductID { get; set; }
|
||||||
public int? OrderID { get; set; }
|
public int? OrderID { get; set; }
|
||||||
public double? SumPay { get; set; }
|
public double? SumPay { get; set; }
|
||||||
|
public int? ClientID { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,6 @@ namespace ElectronicsShopContracts.ViewModels
|
|||||||
public class PaymeantViewModel : IPaymentModel {
|
public class PaymeantViewModel : IPaymentModel {
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public int ProductID { get; set; }
|
|
||||||
|
|
||||||
public int OrderID { get; set; }
|
public int OrderID { get; set; }
|
||||||
|
|
||||||
[DisplayName("Cумма оплаты продукта")]
|
[DisplayName("Cумма оплаты продукта")]
|
||||||
@ -21,5 +19,8 @@ namespace ElectronicsShopContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Статус оплаты")]
|
[DisplayName("Статус оплаты")]
|
||||||
public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено;
|
public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено;
|
||||||
}
|
|
||||||
|
[DisplayName("Клиент")]
|
||||||
|
public int ClientID { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,11 @@ namespace ElectronicsShopDataBaseImplement.Implements {
|
|||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new Database();
|
using var context = new Database();
|
||||||
|
if (model.ClientID.HasValue) {
|
||||||
|
return context.Paymeants
|
||||||
|
.Where(x => x.ClientID == model.ClientID)
|
||||||
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
}
|
||||||
return context.Paymeants
|
return context.Paymeants
|
||||||
.Where(x => x.ID == model.ID)
|
.Where(x => x.ID == model.ID)
|
||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(Database))]
|
[DbContext(typeof(Database))]
|
||||||
[Migration("20240531153626_Init")]
|
[Migration("20240601012156_InitMigration")]
|
||||||
partial class Init
|
partial class InitMigration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -191,6 +191,9 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientID")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
b.Property<int>("OrderID")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -200,9 +203,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
b.Property<int?>("PaymentID")
|
b.Property<int?>("PaymentID")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
b.Property<double>("SumPayment")
|
||||||
.HasColumnType("float");
|
.HasColumnType("float");
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Init : Migration
|
public partial class InitMigration : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -111,8 +111,8 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
ID = table.Column<int>(type: "int", nullable: false)
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
ProductID = table.Column<int>(type: "int", nullable: false),
|
|
||||||
OrderID = table.Column<int>(type: "int", nullable: false),
|
OrderID = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||||
SumPayment = table.Column<double>(type: "float", nullable: false),
|
SumPayment = table.Column<double>(type: "float", nullable: false),
|
||||||
PayOption = table.Column<int>(type: "int", nullable: false),
|
PayOption = table.Column<int>(type: "int", nullable: false),
|
||||||
PaymentID = table.Column<int>(type: "int", nullable: true)
|
PaymentID = table.Column<int>(type: "int", nullable: true)
|
@ -188,6 +188,9 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientID")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
b.Property<int>("OrderID")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -197,9 +200,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
b.Property<int?>("PaymentID")
|
b.Property<int?>("PaymentID")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
b.Property<double>("SumPayment")
|
||||||
.HasColumnType("float");
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ProductID")]
|
|
||||||
public int ProductID { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("OrderID")]
|
[ForeignKey("OrderID")]
|
||||||
public int OrderID { get; set; }
|
public int OrderID { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
public int ClientID { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public double SumPayment { get; set; }
|
public double SumPayment { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@ -38,10 +38,10 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
return new Paymeant()
|
return new Paymeant()
|
||||||
{
|
{
|
||||||
ID = model.ID,
|
ID = model.ID,
|
||||||
ProductID = model.ProductID,
|
|
||||||
OrderID = model.OrderID,
|
OrderID = model.OrderID,
|
||||||
SumPayment = model.SumPayment,
|
SumPayment = model.SumPayment,
|
||||||
PayOption = model.PayOption,
|
PayOption = model.PayOption,
|
||||||
|
ClientID = model.ClientID,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(PaymeantBindingModel? model)
|
public void Update(PaymeantBindingModel? model)
|
||||||
@ -50,7 +50,6 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ProductID = model.ProductID;
|
|
||||||
OrderID = model.OrderID;
|
OrderID = model.OrderID;
|
||||||
SumPayment = model.SumPayment;
|
SumPayment = model.SumPayment;
|
||||||
PayOption = model.PayOption;
|
PayOption = model.PayOption;
|
||||||
@ -59,11 +58,10 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
public PaymeantViewModel GetViewModel => new()
|
public PaymeantViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
ID = ID,
|
ID = ID,
|
||||||
ProductID = ProductID,
|
|
||||||
OrderID = OrderID,
|
OrderID = OrderID,
|
||||||
SumPayment = SumPayment,
|
SumPayment = SumPayment,
|
||||||
PayOption = PayOption,
|
PayOption = PayOption,
|
||||||
|
ClientID = ClientID,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ namespace ElectronicsShopDataModels.Models
|
|||||||
{
|
{
|
||||||
public interface IPaymentModel: IID
|
public interface IPaymentModel: IID
|
||||||
{
|
{
|
||||||
int ProductID { get; }
|
|
||||||
int OrderID { get; }
|
int OrderID { get; }
|
||||||
double SumPayment { get; }
|
double SumPayment { get; }
|
||||||
PaymeantOption PayOption { get; }
|
PaymeantOption PayOption { get; }
|
||||||
|
int ClientID { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,12 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IClientLogic _logic;
|
private readonly IClientLogic _logic;
|
||||||
|
private readonly IPaymeantLogic _payLogic;
|
||||||
|
|
||||||
public ClientController(ILogger<ClientController> logger, IClientLogic logic) {
|
public ClientController(ILogger<ClientController> logger, IClientLogic logic, IPaymeantLogic payLogic) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
_payLogic = payLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -54,5 +56,26 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreatePaymeant (PaymeantBindingModel model) {
|
||||||
|
try {
|
||||||
|
_payLogic.CreatePay(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
_logger.LogError(ex, "Ошибка создания оплаты");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public List<PaymeantViewModel>? GetPaymeants(int _clientID) {
|
||||||
|
try {
|
||||||
|
return _payLogic.ReadList(new PaymeantSearchModel { ClientID = _clientID });
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
_logger.LogError(ex, $"Ошибка получения списка оплат клиента id = {_clientID}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
|||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<IPaymeantStorage, PaymeantStorage>();
|
builder.Services.AddTransient<IPaymeantStorage, PaymeantStorage>();
|
||||||
builder.Services.AddTransient<ICostItemStorage, CostItemStorage>();
|
builder.Services.AddTransient<ICostItemStorage, CostItemStorage>();
|
||||||
|
builder.Services.AddTransient<IPaymeantStorage, PaymeantStorage>();
|
||||||
|
|
||||||
builder.Services.AddTransient<AbstractSaveToExcelClient, SaveToExcelClient>();
|
builder.Services.AddTransient<AbstractSaveToExcelClient, SaveToExcelClient>();
|
||||||
builder.Services.AddTransient<AbstractSaveToExcelEmployee, SaveToExcelEmployee>();
|
builder.Services.AddTransient<AbstractSaveToExcelEmployee, SaveToExcelEmployee>();
|
||||||
|
@ -2,6 +2,7 @@ using ElectronicsShopContracts.BindingModels;
|
|||||||
using ElectronicsShopContracts.BusinessLogicContracts;
|
using ElectronicsShopContracts.BusinessLogicContracts;
|
||||||
using ElectronicsShopContracts.SearchModels;
|
using ElectronicsShopContracts.SearchModels;
|
||||||
using ElectronicsShopContracts.ViewModels;
|
using ElectronicsShopContracts.ViewModels;
|
||||||
|
using ElectronicsShopDataModels.Enums;
|
||||||
using ElectronicsShopDataModels.Models;
|
using ElectronicsShopDataModels.Models;
|
||||||
using ElectronicsShopUserApp.Models;
|
using ElectronicsShopUserApp.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -28,7 +29,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
if (APIClient.Client == null) {
|
if (APIClient.Client == null) {
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return View(APIClient.GetRequset<List<OrderViewModel>>($"api/main/getorders?_clientid={APIClient.Client.ID}"));
|
return View(APIClient.GetRequset<List<PaymeantViewModel>>($"api/client/getpaymeants?_clientid={APIClient.Client.ID}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -150,7 +151,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void EditOrder(int sum, int id) {
|
public void EditOrder(double sum, int id) {
|
||||||
if (sum <= 0) {
|
if (sum <= 0) {
|
||||||
APIClient.PostRequest($"api/main/deleteorders", new OrderBindingModel { ID = id });
|
APIClient.PostRequest($"api/main/deleteorders", new OrderBindingModel { ID = id });
|
||||||
}
|
}
|
||||||
@ -181,7 +182,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void OrderView(int sum, int id) {
|
public void OrderView(double sum, int id) {
|
||||||
if (sum <= 0) {
|
if (sum <= 0) {
|
||||||
APIClient.PostRequest($"api/main/deleteorders", new OrderBindingModel { ID = id});
|
APIClient.PostRequest($"api/main/deleteorders", new OrderBindingModel { ID = id});
|
||||||
}
|
}
|
||||||
@ -211,12 +212,6 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
Response.Redirect("OrderView");
|
Response.Redirect("OrderView");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public double Calc(int count, int product)
|
|
||||||
{
|
|
||||||
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
|
||||||
return count * (_product?.Price ?? 1);
|
|
||||||
}
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Report()
|
public IActionResult Report()
|
||||||
{
|
{
|
||||||
@ -233,6 +228,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
//ViewBag.Reports = APIClient.GetRequset<List<ProductViewModel>>($"api/main/getproducts"); Ïèñåì òàê æå ïîêà íåìà
|
//ViewBag.Reports = APIClient.GetRequset<List<ProductViewModel>>($"api/main/getproducts"); Ïèñåì òàê æå ïîêà íåìà
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Payment(int id)
|
public IActionResult Payment(int id)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
@ -242,7 +239,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
return Redirect("Orders");
|
return Redirect("~/Home/Index");
|
||||||
}
|
}
|
||||||
var products = APIClient.GetRequset<List<List<string>>>($"api/main/getorderproducts?_orderid={id}");
|
var products = APIClient.GetRequset<List<List<string>>>($"api/main/getorderproducts?_orderid={id}");
|
||||||
|
|
||||||
@ -256,6 +253,39 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
(int, Dictionary<int, (IProductModel, int)>) tuple = (id, _productList);
|
(int, Dictionary<int, (IProductModel, int)>) tuple = (id, _productList);
|
||||||
return View(tuple);
|
return View(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Payment(double sum, double paysum, int id) {
|
||||||
|
if (APIClient.Client == null) {
|
||||||
|
throw new Exception("Òîëüêî äëÿ àâòîðèçîâàííûõ");
|
||||||
|
}
|
||||||
|
if (paysum <= 0) {
|
||||||
|
throw new Exception("Ñóììà îïïëàòû äîëæíà áûòü áîëüøå 0");
|
||||||
|
}
|
||||||
|
if (paysum > sum) {
|
||||||
|
throw new Exception("Ññóìà îïëàòû íå äîëæíà ïðåâûøàòü ñóììó ê îïëàòå");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest("api/client/createpaymeant", new PaymeantBindingModel {
|
||||||
|
OrderID = id,
|
||||||
|
SumPayment = paysum,
|
||||||
|
PayOption = PayOptionCalc(sum, paysum),
|
||||||
|
ClientID = APIClient.Client.ID
|
||||||
|
});
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public PaymeantOption PayOptionCalc(double sum, double paysum) {
|
||||||
|
if (paysum < sum) {
|
||||||
|
return PaymeantOption.×àñòè÷íàÿ_îïëàòà;
|
||||||
|
}
|
||||||
|
else if (paysum == sum) {
|
||||||
|
return PaymeantOption.Ïîëíàÿ_îïëàòà;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return PaymeantOption.Íåîïëà÷åíî;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@using ElectronicsShopContracts.ViewModels
|
@using ElectronicsShopContracts.ViewModels
|
||||||
|
|
||||||
@model List<OrderViewModel>
|
@model List<PaymeantViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
@ -20,14 +20,17 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Номер заказа
|
Номер заказа
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Дата создания
|
Сумма к оплате
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Сумма
|
Статус оплаты
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -38,10 +41,13 @@
|
|||||||
@Html.DisplayFor(modelItem => item.ID)
|
@Html.DisplayFor(modelItem => item.ID)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => item.DateCreate)
|
@Html.DisplayFor(modelItem => item.OrderID)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => item.Sum)
|
@Html.DisplayFor(modelItem => item.SumPayment)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.PayOption)
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,23 @@
|
|||||||
<div class="col-4"></div>
|
<div class="col-4"></div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input id="id" type="hidden" name="id" readonly value="@Model.Item1" />
|
<input id="id" type="hidden" name="id" readonly value="@Model.Item1" />
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Сумма платежа:</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<input type="text" name="paysum" id="paysum" />
|
|
||||||
<input type="submit" value="Оплатить!" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class=" text-center">
|
<div class=" text-center">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Сумма платежа:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="text" name="paysum" id="paysum" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Сумма к оплате:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="text" name="sum" id="sum" readonly />
|
||||||
|
</divЫ>
|
||||||
|
<input type="submit" value="Оплатить!" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -70,28 +76,29 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4"></div>
|
<div class="col-4"></div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="submit" value="Заказ готов, вернуться!" class="btn btn-primary" />
|
<a class="btn btn-primary btn-sm" asp-action="Index">Отменить - вернуться на главную страницу</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('#paysum').on('change', function () {
|
$('#btn').on('click', function () {
|
||||||
check();
|
calc();
|
||||||
});
|
});
|
||||||
function check() {
|
|
||||||
var paysum = $('#paysum').val();
|
let sum = 0;
|
||||||
if (count && product) {
|
const elementRows = document.querySelectorAll('.element');
|
||||||
$.ajax({
|
calc();
|
||||||
method: "POST",
|
|
||||||
url: "/Home/Calc",
|
function calc() {
|
||||||
data: { paysum: paysum },
|
elementRows.forEach(row => {
|
||||||
success: function (result) {
|
const count = parseInt(row.querySelector('.count').innerHTML, 10);
|
||||||
$("#sum").val(result);
|
const countsum = parseInt(row.querySelector('.countsum').innerHTML, 10);
|
||||||
}
|
const rowTotal = count * countsum;
|
||||||
});
|
sum += rowTotal;
|
||||||
};
|
});
|
||||||
|
$('#sum').val(sum);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user