淘宝买手登录 70%
This commit is contained in:
1 parent
97278249ae
commit
78ef8eedf3
10 files changed
+1117
-93
No files matched your search
@@ -40,6 +40,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
cmbPddBuyer.ItemsSource = GlobalConfig.PDDBuyerLoginList;
|
||||
cmbTaobaoBuyer.ItemsSource = GlobalConfig.TaobaoBuyerLoginList;
|
||||
}
|
||||
|
||||
private void btnLoginPdd_Click(object sender, RoutedEventArgs e)
|
||||
@@ -145,48 +146,143 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
});
|
||||
}
|
||||
}
|
||||
//var pddBuyer =
|
||||
|
||||
//var ids = dgvBuyer.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).Select(s => s.Cells["colBuyerId"].Value.ParseToString()).ToList();
|
||||
//var buyers = GlobalConfig.PDDBuyerLoginList.Where(b => ids.Contains(b.buyer_id)).ToList();
|
||||
//this.statusBar.pgbTaskProgress.Maximum = buyers.Count;
|
||||
//pbLoading.Visible = true;
|
||||
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// int i = 0;
|
||||
// foreach (var buyer in buyers)
|
||||
// {
|
||||
// i++;
|
||||
// this.Invoke(new Action(() =>
|
||||
// {
|
||||
// this.statusBar.lblTaskStatus.Text = "正在删除...";
|
||||
// this.statusBar.pgbTaskProgress.Value = i;
|
||||
// this.statusBar.pgbTaskProgress.Text = i + "/" + buyers.Count;
|
||||
// }));
|
||||
|
||||
|
||||
|
||||
// Thread.Sleep(100);
|
||||
// }
|
||||
// this.Invoke(new Action(() =>
|
||||
// {
|
||||
// this.statusBar.lblTaskStatus.Text = "删除完成";
|
||||
// this.statusBar.pgbTaskProgress.Value = buyers.Count;
|
||||
// this.statusBar.pgbTaskProgress.Text = buyers.Count + "/" + buyers.Count;
|
||||
// }));
|
||||
// GetPddBuyer();
|
||||
//});
|
||||
}
|
||||
|
||||
private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible)
|
||||
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
|
||||
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1)
|
||||
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1);
|
||||
if (wpPddBuyer.Visibility == Visibility.Visible)
|
||||
{
|
||||
if (MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility != Visibility.Visible)
|
||||
MainWindow.Instance.gridPddBuyerOrderReadCtrl.Visibility = Visibility.Visible;
|
||||
if (Panel.GetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl) < 1)
|
||||
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, 1);
|
||||
else
|
||||
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (wpPddBuyer.Visibility == Visibility.Visible)
|
||||
{
|
||||
wpPddBuyer.Visibility = Visibility.Collapsed;
|
||||
wpTaobaoBuyer.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
wpPddBuyer.Visibility = Visibility.Visible;
|
||||
wpTaobaoBuyer.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnLoginTaobao_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BuyerLoginInfo buyer = null;
|
||||
if (cmbTaobaoBuyer.SelectedItem != null)
|
||||
{
|
||||
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
|
||||
}
|
||||
|
||||
TaobaoLoginView taobaoBuyerForm = new TaobaoLoginView(buyer);
|
||||
taobaoBuyerForm.ViewModel.OpenType = EnumOpenType.login;
|
||||
taobaoBuyerForm.ViewModel.InitUrl = "https://login.taobao.com/havanaone/login/login.htm";
|
||||
new DialogWindow()
|
||||
{
|
||||
Title = "淘宝买手登录",
|
||||
Content = taobaoBuyerForm,
|
||||
}.ShowDialog();
|
||||
|
||||
MainWindow.Instance.GetTaobaoBuyer();
|
||||
|
||||
}
|
||||
|
||||
private void cmbTaobao_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
BuyerLoginInfo buyer = null;
|
||||
if (cmbTaobaoBuyer.SelectedItem != null)
|
||||
{
|
||||
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
|
||||
}
|
||||
GlobalConfig.CurrentTaobaoBuyer = buyer;
|
||||
}
|
||||
|
||||
private void cmbTaobao_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.GetPosition(sender as IInputElement).X > cmbTaobaoBuyer.ActualWidth - 18)
|
||||
return;
|
||||
|
||||
BuyerLoginInfo buyer = null;
|
||||
if (cmbTaobaoBuyer.SelectedItem != null)
|
||||
{
|
||||
buyer = cmbTaobaoBuyer.SelectedItem as BuyerLoginInfo;
|
||||
}
|
||||
if (buyer == null)
|
||||
return;
|
||||
|
||||
bool islogin = false;
|
||||
TaobaoLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
|
||||
TaobaoLoginView buyerLoginForm = new TaobaoLoginView(buyer);
|
||||
if (buyer.status == "在线")
|
||||
{
|
||||
buyerLoginForm.ViewModel.OpenType = EnumOpenType.manage;
|
||||
buyerLoginForm.ViewModel.InitUrl = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?";
|
||||
|
||||
new DialogWindow()
|
||||
{
|
||||
Width = 1280,
|
||||
Height = 800,
|
||||
Title = "买手主页",
|
||||
Content = buyerLoginForm,
|
||||
}.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
buyerLoginForm.ViewModel.OpenType = EnumOpenType.login;
|
||||
buyerLoginForm.ViewModel.InitUrl = "https://login.taobao.com/havanaone/login/login.htm";
|
||||
|
||||
new DialogWindow()
|
||||
{
|
||||
Width = 1280,
|
||||
Height = 800,
|
||||
Title = "买手登录",
|
||||
Content = buyerLoginForm,
|
||||
}.ShowDialog();
|
||||
}
|
||||
if (islogin)
|
||||
MainWindow.Instance.GetTaobaoBuyer();
|
||||
}
|
||||
|
||||
private void btnDeleteTaobaoItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (BaseMsgWindow.ShowConfirm("确定删除吗?删除后不可恢复!").DialogResult != true)
|
||||
return;
|
||||
|
||||
if (sender is Button btn)
|
||||
{
|
||||
if (btn.DataContext is BuyerLoginInfo buyer)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var url = BaseClass.Build29WxObjString("user/del_taobao_buyer");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
+ "&buyer_id=" + buyer.buyer_id;
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (result.Contains("\"code\":200"))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
GlobalConfig.TaobaoBuyerLoginList.Remove(buyer);
|
||||
this.cmbPddBuyer.SelectedIndex = 0;
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user