步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

using BBWY.Client.APIServices;
using BBWY.Client.Models;
using System.Threading.Tasks;
using System.Windows;
namespace BBWY.Client.ViewModels
{
public class OrderCouponDetailViewModel : BaseVM
{
private string orderId;
private OrderService orderService;
private Shop shop;
public OrderCouponDetailViewModel(OrderService orderService)
{
this.orderService = orderService;
}
public string OrderId { get => orderId; set { Set(ref orderId, value); } }
public OrderCouponDetailResponse Coupon { get => coupon; set { Set(ref coupon, value); } }
private OrderCouponDetailResponse coupon;
public void SetData(string orderId, Shop shop)
{
this.OrderId = orderId;
this.shop = shop;
Task.Factory.StartNew(() => orderService.GetOrderCouponDetail(orderId, shop))
.ContinueWith(t =>
{
var r = t.Result;
if (!r.Success)
{
MessageBox.Show(r.Msg, "优惠券明细");
return;
}
this.Coupon = r.Data;
});
}
}
}