Browse Source

加入竞品列表字段

master
feng 2 years ago
parent
commit
e48f18bade
  1. 3
      src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs
  2. 34
      src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs
  3. 14
      src/Coldairarrow.Entity/DTO/TeamitemDto.cs
  4. 5
      src/Coldairarrow.Entity/HuiYan/teamitems.cs
  5. 13
      客户端/齐越慧眼/齐越慧眼/ApiHelper.cs
  6. 2
      客户端/齐越慧眼/齐越慧眼/MainWindow.xaml.cs
  7. 21
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
  8. 12
      客户端/齐越慧眼/齐越慧眼/Windows/CompetingWindow.xaml
  9. 25
      客户端/齐越慧眼/齐越慧眼/Windows/CompetingWindow.xaml.cs
  10. 20
      客户端/齐越慧眼/齐越慧眼/Windows/ItemDetailWindow.xaml
  11. 157
      客户端/齐越慧眼/齐越慧眼/Windows/ItemDetailWindow.xaml.cs
  12. 6
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js
  13. 6
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js
  14. 510
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/competing/Index.vue

3
src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs

@ -125,7 +125,8 @@ namespace Coldairarrow.Business.HuiYan
GoodsUrl = b.GoodsUrl,
PriceTaskId=c.Id,
PriceTaskState = (int)c.State,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson),
CompetingItems = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamCompetingItem>>(a.CompetingItemJson??"[]"),
};
var search = input.Search;

34
src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs

@ -93,7 +93,8 @@ namespace Coldairarrow.Business.HuiYan
Platform = b.Platform,
GoodsUrl = b.GoodsUrl,
CatName = c == null ? String.Empty : c.Name,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson),
CompetingItems = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamCompetingItem>>(a.CompetingItemJson ?? "[]"),
};
var search = input.Search;
@ -127,7 +128,12 @@ namespace Coldairarrow.Business.HuiYan
}
else
{
where = where.And(c => c.State == state);
if (state == -1)
{
where = where.And(c => c.State!=3);
}
else
where = where.And(c => c.State == state);
}
}
@ -143,6 +149,8 @@ namespace Coldairarrow.Business.HuiYan
}
return new PageResult<TeamitemDto>() { Data = result, Total = 1, Success = true };
}
}
where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => string.IsNullOrEmpty(d.CatName) ? true : d.CatName.Contains(keyWord));
@ -154,6 +162,15 @@ namespace Coldairarrow.Business.HuiYan
var list = q.Where(where).GetPageResultAsync(input).Result;
list.Data.ForEach(item => {
if (string.IsNullOrEmpty(item.GoodsUrl))
{
if (item.Platform == 3)
{
item.GoodsUrl = $"https://mobile.pinduoduo.com/goods.html?goods_id={item.GoodsId}";
}
}
});
return list;
}
@ -171,7 +188,8 @@ namespace Coldairarrow.Business.HuiYan
HasFilter = b.HasFilter,
Platform = b.Platform,
GoodsUrl = b.GoodsUrl,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson),
CompetingItems = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamCompetingItem>>(a.CompetingItemJson ?? "[]"),
};
select = select.BuildExtendSelectExpre();
@ -181,11 +199,13 @@ namespace Coldairarrow.Business.HuiYan
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>();
where = where.And(c => c.State == state);
where = where.And(c => _operator.SonTeamList.Contains(c.TeamId));
where = where.And(c => ids.Contains(c.GoodsId));
return await q.Where(where).ToListAsync();
}
@ -246,6 +266,7 @@ namespace Coldairarrow.Business.HuiYan
CreatorId = _operator.UserId,
Deleted = false,
ExtensionJson = Newtonsoft.Json.JsonConvert.SerializeObject(model.Extensions),
CompetingItemJson = "[]",
Id = IdHelper.GetId(),
TeamId = _operator.TeamId,
@ -282,6 +303,11 @@ namespace Coldairarrow.Business.HuiYan
{
int row = Db.Update<teamitems>(c => c.Id == model.Id, (item) =>
{
if (model.CompetingItems!=null)
{
item.CompetingItemJson = Newtonsoft.Json.JsonConvert.SerializeObject(model.CompetingItems);
}
item.ExtensionJson = Newtonsoft.Json.JsonConvert.SerializeObject(model.Extensions);
item.RivalGoodsId = model.RivalGoodsId;
item.RivalPLCount = model.RivalPLCount;
@ -628,7 +654,7 @@ namespace Coldairarrow.Business.HuiYan
private bool CheckIsPass(teamitems item)
{
decimal profits = 0;
var extList= Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(item.ExtensionJson);
var extList= Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(item.ExtensionJson);
var ex= extList.OrderByDescending(c => c.Profits).FirstOrDefault();

14
src/Coldairarrow.Entity/DTO/TeamitemDto.cs

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Coldairarrow.Entity.DTO
{
public class TeamitemDto:teamitems
public class TeamitemDto : teamitems
{
public string PriceTaskId { get; set; }
/// <summary>
@ -44,6 +44,10 @@ namespace Coldairarrow.Entity.DTO
/// 扩展信息
/// </summary>
public List<TeamItemExtension> Extensions { get; set; }
/// <summary>
/// 竞品信息
/// </summary>
public List<TeamCompetingItem> CompetingItems { get; set; }
}
public class TeamItemExtension
@ -98,4 +102,12 @@ namespace Coldairarrow.Entity.DTO
/// </summary>
public decimal Profits { get; set; }
}
/// <summary>
/// 竞品信息
/// </summary>
public class TeamCompetingItem
{
}
}

5
src/Coldairarrow.Entity/HuiYan/teamitems.cs

@ -102,6 +102,11 @@ namespace Coldairarrow.Entity.HuiYan
/// </summary>
public String ExtensionJson { get; set; }
/// <summary>
/// 竞品列表Json
/// </summary>
public string CompetingItemJson { get; set; }
/// <summary>
/// 对标商品评价数量
/// </summary>

13
客户端/齐越慧眼/齐越慧眼/ApiHelper.cs

@ -13,8 +13,8 @@ namespace 齐越慧眼
public class ApiHelper
{
#if LOCATION
public static string ApiBase { get; set; } = "http://localhost:5000";
//public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com";
//public static string ApiBase { get; set; } = "http://localhost:5000";
public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com";
#else
public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com";
@ -32,19 +32,22 @@ namespace 齐越慧眼
#if LOCATION
https://item.taobao.com/item.htm?id=676752909206 //小一
return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDA1MTUxNjE5NTk0NTg4MTYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNTE2OTc0MjUwNTQyNTAxODg4LDE0MzA0NzE3NDA0NDU2OTE5MDQsMTYyMDM0MzgyNzQ3MjU4NDcwNCIsImV4cCI6MTcwOTQzMDc5MH0.L4F0c7Mx_AbXjiazGmcFDQxVAYwKen91oTS7pZYtqkQ";
//https://item.taobao.com/item.htm?id=676752909206 //小一
///return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDA1MTUxNjE5NTk0NTg4MTYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNTE2OTc0MjUwNTQyNTAxODg4LDE0MzA0NzE3NDA0NDU2OTE5MDQsMTYyMDM0MzgyNzQ3MjU4NDcwNCIsImV4cCI6MTcwOTQzMDc5MH0.L4F0c7Mx_AbXjiazGmcFDQxVAYwKen91oTS7pZYtqkQ";
//return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTA5MzA3MDA4MTU5NzQ0IiwidGVhbUlkIjoiMTQzOTg5ODUxNDIyMDkxMjY0MCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3MDgzMzM1NDF9.6WCMQzB8iRtYsOZl88YPJrmZVYuuvboO4R8dAQHdLuE";
//测试001
return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzAwMDEzMTg2NjgyODgwIiwidGVhbUlkIjoiMTU0NzM5OTExMTU1NTE1ODAxNiIsInNvblRlYW1JZHMiOiIxNjIwMzQzODI3NDcyNTg0NzA0IiwiZXhwIjoxNzA3ODExMjQxfQ.Vw_BhiUJnT_Sxm7QzbD2-lSguQI_pA9BDbTcQQ-sfQo";
//比价团
//return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjMyNTYwODE3NTk5NjgwNTEyIiwidGVhbUlkIjoiMTQ2MzAyOTM1NTEwNDk2NDYwOCIsInNvblRlYW1JZHMiOiIxNDYzMDI5MzU1MTA0OTY0NjA4IiwiZXhwIjoxNzExNDYxMTcxfQ.4DuJkbmmrZFobMw7TaaVsZTxVQ5k7cOsP-chRZnRY6c";
//叶秋
//return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTgyMjA1NjAwOTk2MDAzODQwIiwidGVhbUlkIjoiMTUxNzczNzYwNDQyNDkyOTI4MCIsInNvblRlYW1JZHMiOiIxNTE3NzM3NjA0NDI0OTI5MjgwIiwiZXhwIjoxNzA3Mjg0MDQxfQ.gXfsdhGTUg1ZPhSGi5j9xG8UwAk6IS4D0oIUeRgLgas";
//芒格
//return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTgwNzM5MTY4NTg0MDc3MzEyIiwidGVhbUlkIjoiMTYyMDM0MzgyNzQ3MjU4NDcwNCIsInNvblRlYW1JZHMiOiIxNjIwMzQzODI3NDcyNTg0NzA0IiwiZXhwIjoxNzA3Mjg0MDc1fQ.ERRSAbj9t1cvRPTbbqTsNoHd2ErclxK8tU_4w3gb_JI";
// return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM5OTA0MDUwNzc3NjkwMTEyIiwiZXhwIjoxNzA3ODEwNTUxfQ.wzpfkvDy_GTrbBW4urJJ3mqJHbsdWlwL8eWMhXc-3zg";
// return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM5OTA0MDUwNzc3NjkwMTEyIiwiZXhwIjoxNzA3ODEwNTUxfQ.wzpfkvDy_GTrbBW4urJJ3mqJHbsdWlwL8eWMhXc-3zg";
#endif
return jwtToken;
}

2
客户端/齐越慧眼/齐越慧眼/MainWindow.xaml.cs

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -14,6 +15,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using HandyControl.Controls;
using .Helpers;
using .Windows;
namespace
{

21
客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs

@ -72,6 +72,8 @@ namespace 齐越慧眼.UserControls
web.ResourceRequestHandlerFactory = myResourceRequestHandlerFactory;
}
grid.Children.Add(web);
Loaded += BrowerControl_Loaded;
@ -210,7 +212,24 @@ namespace 齐越慧眼.UserControls
private void Web_StartNewWindow(object sender, NewWindowEventArgs e)
{
// WpfNoticeMsg.NoticeMessage.Show(e.Url);
var match= Regex.Match(e.Url, @"item\.jd\.com/(.*?)\.html");
if (match.Success)
{
Thread t = new Thread(() => {
//判断是否添加成功
if (Windows.ItemDetailWindow.Show(e.Url) == true)
{
WpfNoticeMsg.NoticeMessage.Show("添加成功!");
}
});
t.IsBackground = true;
t.Start();
return;
}
//
//WpfNoticeMsg.NoticeMessage.Show(e.Url);
BrowerHelper.OpenUrl(e.Url);
//MainWindow.Main.brower.NewTab(e.Url);
//web.Load(e.Url);

12
客户端/齐越慧眼/齐越慧眼/Windows/CompetingWindow.xaml

@ -0,0 +1,12 @@
<Window x:Class="齐越慧眼.Windows.CompetingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:齐越慧眼.Windows"
mc:Ignorable="d"
Title="CompetingWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

25
客户端/齐越慧眼/齐越慧眼/Windows/CompetingWindow.xaml.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace .Windows
{
/// <summary>
/// CompetingWindow.xaml 的交互逻辑
/// </summary>
public partial class CompetingWindow : Window
{
public CompetingWindow()
{
InitializeComponent();
}
}
}

20
客户端/齐越慧眼/齐越慧眼/Windows/ItemDetailWindow.xaml

@ -0,0 +1,20 @@
<Window x:Class="齐越慧眼.Windows.ItemDetailWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:齐越慧眼.Windows"
mc:Ignorable="d"
Title="竞品选取" Height="768" Width="1280">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="grid"></Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="btn_canel" Content="取消" Click="btn_canel_Click" Style="{StaticResource ButtonCustom}" Padding="40 5" Cursor="Hand" FontSize="13" Foreground="#555555"></Button>
<Button x:Name="btn_add" Click="btn_add_Click" Content="添加为竞品" Style="{StaticResource ButtonPrimary}" Margin="20 0 0 0" Height="60" Cursor="Hand" Padding="40 0" Background="#8080ff" FontSize="13" Foreground="White"></Button>
</StackPanel>
</Grid>
</Window>

157
客户端/齐越慧眼/齐越慧眼/Windows/ItemDetailWindow.xaml.cs

@ -0,0 +1,157 @@
using CefSharp;
using CefSharp.Wpf;
using System;
using System.Collections.Generic;
using System.Security.Policy;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using .cefhelper;
namespace .Windows
{
/// <summary>
/// ItemDetailWindow.xaml 的交互逻辑
/// </summary>
public partial class ItemDetailWindow : Window
{
private ExtChromiumBrowser web;
private ItemDetailWindow(string url)
{
InitializeComponent();
KeyDown += ItemDetailWindow_KeyDown;
web = new ExtChromiumBrowser(url)
{
BrowserSettings =
{
DefaultEncoding = "UTF-8",
Plugins = CefState.Enabled,
//关于跨域限制
//WebSecurity = CefState.Disabled,
ApplicationCache = CefState.Enabled,
LocalStorage = CefState.Enabled
},
//RequestHandler =new MyRequestHandler()
};
grid.Children.Add(web);
}
private void LoadUrl(string url)
{
web.Load(url);
}
/// <summary>
/// 显示
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static bool? Show(string url)
{
ItemDetailWindow window = null ;
bool? result = null;
MainWindow.Main.Dispatcher.Invoke(new Action(() => {
window = new ItemDetailWindow(url);
result= window.ShowDialog();
}));
return result;
}
private void ItemDetailWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == System.Windows.Input.Key.F12)
{
web.ShowDevTools();
}
}
bool isWait = false;
private void btn_add_Click(object sender, RoutedEventArgs e)
{
if (isWait)
{
web.LoadUrlAsync("www.baidu.com");
return;
}
isWait = true;
Task<JavascriptResponse> task = null;
Application.Current.Dispatcher.Invoke(() =>
{
task = web.EvaluateScriptAsPromiseAsync("return $(document.body).html();",TimeSpan.FromSeconds(10));
});
var result = task.Result;
//判断是否加载完成
if (!result.Success)
{
WpfNoticeMsg.NoticeMessage.Show("请等待页面加载完成后重试!");
return;
}
string imgUrl = EvalScript("return $('#spec-img').attr('src')").Replace(".avif","");
if (imgUrl.StartsWith("//"))
{
imgUrl = "https:" + imgUrl;
}
string title = EvalScript("return $($(\".sku-name\")[0]).text().trim()");
string price = EvalScript("return $($(\".p-price\")[0]).text().trim()").Replace("¥", "").Trim();
string comment = EvalScript("return $($(\"li[data-anchor=#comment]\")[0]).text().trim()");
var match= Regex.Match(comment, @"商品评价\((.*?)\)");
if (match.Success)
{
comment= match.Groups[1].Value;
}
string url = web.Address;
this.DialogResult = true;
}
private void btn_canel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
string EvalScript(string js)
{
Task<JavascriptResponse> task = null;
Application.Current.Dispatcher.Invoke(() =>
{
task = web.EvaluateScriptAsPromiseAsync(js, TimeSpan.FromSeconds(10));
});
var result = task.Result;
if (result.Success)
{
return result.Result.ToString();
}
return string.Empty;
}
}
}

6
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js

@ -9,11 +9,12 @@ axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
let $httpVue = null, currentToken = '';
//'application/json;charset=utf-8';//
if (process.env.NODE_ENV == 'development') {
axios.defaults.baseURL = 'http://hyapi.qiyue666.com/';
// axios.defaults.baseURL = 'http://hyapi.qiyue666.com/';
//axios.defaults.baseURL = 'http://localhost:5000/';
currentToken='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTA3NDY1MDMzNDIwODAwIiwidGVhbUlkIjoiMTQzNjI4ODUwMDIzNTI0MzUyMCIsImV4cCI6MTY3MTAwOTkyM30.p3yLjbeUilDZxkfRv4GaCvIYJ_jFoe_8Sw8hY18swdA'
currentToken='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzAwMDEzMTg2NjgyODgwIiwidGVhbUlkIjoiMTU0NzM5OTExMTU1NTE1ODAxNiIsInNvblRlYW1JZHMiOiIxNjIwMzQzODI3NDcyNTg0NzA0IiwiZXhwIjoxNzA3ODExMjQxfQ.Vw_BhiUJnT_Sxm7QzbD2-lSguQI_pA9BDbTcQQ-sfQo'
// currentToken='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTAwNjY3OTAyNDU2NTAwMjI0IiwidGVhbUlkIjoiMTQ2MzAyOTM1NTEwNDk2NDYwOCIsImV4cCI6MTY5MDI1NTI1Nn0.McaUJU3XY_twiL5TI_-KBn9X_ePzLfsEIhgiZ274Bv0'
}
else if (process.env.NODE_ENV == 'production') {
axios.defaults.baseURL = 'http://hyapi.qiyue666.com/';
}
@ -23,6 +24,7 @@ let ipAddress = axios.defaults.baseURL;
axios.defaults.baseURL = 'http://hyapi.qiyue666.com/';
//axios.defaults.baseURL = 'http://111.230.132.27:8033/';
axios.defaults.baseURL = 'http://localhost:5000/';
axios.interceptors.request.use((config) => {
//axios.defaults.headers[_Authorization] = $httpVue.$store.getters.getToken();

6
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js

@ -4,6 +4,7 @@ import Home from '../views/cats/Index.vue'
import Items from '../views/items/Index.vue'
import PriceTask from '../views/pricetask/Index.vue'
import Info from '../views/info/Index.vue'
import Competing from '../views/competing/Index.vue'
Vue.use(VueRouter)
@ -27,6 +28,11 @@ const routes = [
path: '/info',
name: 'info',
component: Info
},
{
path: '/competing',
name: 'competing',
component: Competing
}
]

510
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/competing/Index.vue

@ -0,0 +1,510 @@
<template>
<div class="about">
<a-tabs @change="changeTab">
<a-tab-pane
key="-1"
:tab="'竞品分析'"
>
</a-tab-pane>
<a-tab-pane
key="0"
:tab="'待比价(' + getTaskCount(0) + ')'"
>
</a-tab-pane>
<a-tab-pane
key="6"
:tab="'已比价(' + getTaskCount(6) + ')'"
>
</a-tab-pane>
<a-tab-pane
key="1"
:tab="'精选(' + getTaskCount(1) + ')'"
>
</a-tab-pane>
<a-tab-pane
key="8"
:tab="'待上架(' + getTaskCount(8) + ')'"
>
</a-tab-pane>
<a-tab-pane
key="2"
:tab="'已上架(' +getTaskCount(2) + ')'"
>
</a-tab-pane>
<a-tab-pane
key="3"
:tab="'放弃(' + getTaskCount(3) + ')'"
>
</a-tab-pane>
</a-tabs>
<!-- <a-row :gutter="10" style="margin-bottom:10px">
<a-col :span="5">
<a-input
v-model="catKeyWord"
placeholder="搜索品类词"
>
</a-input>
</a-col>
<a-col :span="1">
<a-button @click="searchDatas">搜索</a-button>
</a-col>
</a-row> -->
<div class="border">
<!--标题-->
<div style="background-color: #f3f2f7;border: 1px solid #d7d7d7;border-left: 0; border-right: 0;background: #f3f2f7;justify-items: center;text-align: center;display: flex;align-items: center; vertical-align: center;height: 35px;">
<div style="width: 171px;" class="titleDiv">
<div>
来源</div>
</div>
<div style="width: 177px;" class="titleDiv">
战场
</div>
<div style="width: 177px;" class="titleDiv">
竞争环境
</div>
<div style="width: 177px;" class="titleDiv">
兵力规划
</div>
<div style="width: 801px;" class="titleDiv">
对手信息
</div>
<div style="width: 177px;" class="titleDiv">
操作
</div>
</div>
<!--内容页面-->
<div v-for="item in datas"
:key="item.Id">
<div style="padding-left: 10px;display: flex;align-items: center;color: #333333;background: #f3f2f7;height: 35px; border: 1px solid #d7d7d7;border-left: 0; border-right: 0;">
SKU名称:{{item.Title}}
售价:{{item.Price}}
付款人数:{{item.Sales}}
</div>
<div style="background-color: #f3f2f7;border-bottom: 0px solid #d7d7d7;background: #ffffff;justify-items: center;text-align: center;display: flex;align-items: center; vertical-align: center;height: 171px;">
<div style="width: 171px;" class="contentDiv">
<img :src="item.ItemImg" style="width: 151px;height: 151px;" >
</div>
<div style="width: 177px;" class="contentDiv">
战场
</div>
<div style="width: 177px;" class="contentDiv">
竞争环境
</div>
<div style="width: 177px;" class="contentDiv">
兵力规划
</div>
<div style="width: 801px;" class="contentDiv">
对手信息
</div>
<div style="width: 177px;" class="contentDiv">
操作
</div>
</div>
</div>
<!--分页条-->
<div style="float: right; margin-top: 30px">
<a-pagination
v-model="pagination.current"
:default-current="1"
:total="pagination.total"
:page-size="pagination.pageSize"
@change="changePage"
/>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
showSearchPic:false,
searchpicurl:undefined,
searchPicType:undefined,
datas: [],
pagination: {
current: 1,
pageSize: 10,
total: 0,
showTotal: (total, range) =>
`总数:${total} 当前:${range[0]}-${range[1]}`,
},
filters: {},
sorter: { field: "Id", order: "asc" },
loading: false,
queryParam: { condition: "State", keyword: 0 },
selectedRowKeys: [],
currentTab: "0",
catKeyWord:undefined,
lastEditData: undefined,
extFormList: ["以图搜款"],
stateList: [],
platformList: [
{ id: 0, name: "淘宝" },
{ id: 1, name: "京东" },
{ id: 2, name: "1688" },
{ id: 3, name: "拼多多" },
],
};
},
mounted() {
window.getDatas = this.getDatas;
this.getDatas(0);
this.getTabCount();
},
activated() {
//this.getDatas(0)
},
methods: {
searchPicByUrl(){
this.getImgBase64(this.getImgPath(this.searchpicurl), 2)
this.showSearchPic=false
},
showSearchPicModel(type){
this.searchpicurl=undefined
this.searchPicType=type
this.showSearchPic=true
},
getTabCount() {
this.http.get("/HuiYan/teamitems/GetTeamCount").then((res) => {
this.stateList = res.Data;
});
},
getTaskCount(id){
var task= this.stateList.find(c=>c.Id==id)
if(task==null||task==undefined)
{
return 0
}
return task.Count
},
getImgPath(img) {
if (!img||img==undefined) return;
if (img.indexOf("http") >= 0) {
return img;
} else {
return "http:" + img;
}
},
// select
handleSearch(value, ext, item) {
this.handleChange(value, ext, item);
},
handleChange(value, ext, item) {
ext.SupplierFrom = value != null && value != "" ? value : [];
if (
item.Extensions.filter((c) => c.SupplierFrom == "以图搜款").length > 2
) {
this.$message.error("以图搜款最多可选择2个!");
ext.SupplierFrom = "";
}
},
handleBlur(value, ext) {
ext.SupplierFrom = value;
if (value && this.extFormList.indexOf(value) == -1) {
this.extFormList.push(value);
}
},
openItemInfoWeb(item){
if(item==undefined||item.RivalGoodsId==undefined||item.RivalGoodsId==null)
{
this.$message.error("请先输入竞品链接!");
return
}
hyCoreModel.getItemInfoByUrl(item.RivalGoodsId).then(res=>{
var result= JSON.parse(res)
if(result.success)
{
var data=result.data
item.RivalTitle=data.title
item.RivalPrice=data.price
item.RivalPLCount=data.commont
item.RivalImg=data.img
this.$message.success("获取成功");
}else{
this.$message.error(result.msg);
}
})
},
changeTab(e) {
this.getDatas(e);
this.currentTab = e;
this.pagination.current = 1;
},
changePage(page, pageSize) {
this.pagination.current = page;
this.getDatas(this.currentTab);
},
searchDatas(){
this.pagination.current = 1;
this.getDatas(this.currentTab);
},
getDatas(type) {
var that = this;
var url='/HuiYan/teamitems/GetItems'
if(this.catKeyWord&&this.catKeyWord.length>0)
{
url="/HuiYan/teamitems/GetItems?keyword="+this.catKeyWord
}
this.http
.post(url, {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || "Id",
SortType: this.sorter.order,
Search: { condition: "State", keyword: -1 },
...this.filters,
})
.then((res) => {
that.pagination.total = res.Total;
res.Data.forEach((item) => {
item.isEdit = false;
item.Extensions.forEach((ext) => {
var keys= Object.keys(ext)
keys.forEach(key=>{
if(ext[key]==null)
ext[key]=undefined
})
this.initProfits(item,ext)
});
});
this.datas = res.Data;
});
},
//
initProfits(item,ext){
if(item.RivalPrice!=undefined){
ext.PlatformPoint = parseFloat(item.RivalPrice * 0.05).toFixed(2);
}
if(ext.BuyPrice>0)
{
if(ext.TaxPrice==undefined||ext.TaxPrice==''){
ext.TaxPrice = parseFloat(ext.BuyPrice * 0.03).toFixed(2);
}
}
if(ext.KDPrice==undefined)
{
ext.KDPrice=parseFloat(6)
}
ext.Profit =
parseFloat(item.RivalPrice) -
parseFloat(ext.BuyPrice) -
parseFloat(ext.KDPrice) -
parseFloat(ext.PlatformPoint)-
(ext.TaxPrice==undefined||ext.TaxPrice==null?0:parseFloat(ext.TaxPrice))
ext.Profit=parseFloat(
ext.Profit
).toFixed(2);
if (ext.BuyPrice == 0) {
ext.Profits = 0;
} else {
ext.Profits = parseFloat(
(ext.Profit / (parseFloat(ext.BuyPrice)+parseFloat(ext.KDPrice))) * 100
).toFixed(2);
}
},
editData(data) {
data.isEdit = true;
data.isRival=true;
this.lastEditData = JSON.parse(JSON.stringify(data));
},
canelEdit(data) {
this.lastEditData.isEdit = false;
Object.assign(data, this.lastEditData);
},
setData(data) {
data.Extensions.forEach((ext) => {
this.initProfits(data,ext)
});
this.http.post("/HuiYan/teamitems/SetItem", data).then((res) => {
if (res.Success) {
this.$message.success("操作成功!");
data.isEdit = false;
} else {
this.$message.error(res.Msg);
}
});
},
setState(id, type) {
///
if (type == 5) {
this.sendPriceTask(id);
} else if (type == 0) {
this.canelPriceTask(id);
} else {
this.http
.post(`/HuiYan/teamitems/SetState?id=${id}&state=${type}`)
.then((res) => {
if (res.Success) {
this.$message.success("操作成功!");
this.getDatas(this.currentTab);
} else {
this.$message.error(res.Msg);
}
});
}
},
sendPriceTask(id) {
this.http.post(`/HuiYan/pricetasklog/AddTask?id=${id}`).then((res) => {
if (res.Success) {
this.$message.success("操作成功!");
this.getDatas(this.currentTab);
} else {
this.$message.error(res.Msg);
}
});
},
canelPriceTask(id) {
this.http.post(`/HuiYan/pricetasklog/CanelTask?id=${id}`).then((res) => {
if (res.Success) {
this.$message.success("操作成功!");
this.getDatas(this.currentTab);
} else {
this.$message.error(res.Msg);
}
});
},
getImgBase64(src, type) {
hyCoreModel.getImgBase64(src, type).then((res) => {
console.log(res);
});
},
},
};
</script>
<style>
.titleDiv{
/* border: 1px solid #d7d7d7; */
border-right: 1px solid #d7d7d7;
background-color: #f3f2f7;
box-sizing: border-box;
font-family: "Arial", sans-serif;
color: #333333;
text-align: center;
height: 35px;
display: flex;
flex-direction: row;
justify-items: center;
align-items: center;
justify-content: center;
align-content: center;
}
.titleDiv:last-child
{
border-right: 0px;
}
.contentDiv{
border-right: 1px solid #d7d7d7;
background-color: #ffffff;
box-sizing: border-box;
font-family: "Arial", sans-serif;
color: #333333;
text-align: center;
display: flex;
flex-direction: row;
justify-items: center;
align-items: center;
justify-content: center;
align-content: center;
height: 170px;
}
.headCol {
border: 1px solid rgba(215, 215, 215, 1);
border-left: 0px;
text-align: center;
background-color: rgba(243, 242, 247, 1);
}
.headColFirst {
border-left: 1px solid rgba(215, 215, 215, 1);
}
.borderNoTop {
border: 1px solid rgba(215, 215, 215, 1);
border-top: 0px;
border-bottom: 0px;
}
.borderT {
border: 1px solid rgba(215, 215, 215, 1);
border-left: 0px;
border-right: 0px;
}
.border {
border: 1px solid rgba(215, 215, 215, 1);
width: 1708px;
}
.borderLeft {
border: 1px solid rgba(215, 215, 215, 1);
border-top: 0px;
border-right: 0px;
border-bottom: 0px;
}
.borderRight {
border: 1px solid rgba(215, 215, 215, 1);
border-top: 0px;
border-left: 0px;
border-bottom: 0px;
}
.itemtitle {
height: 50px;
max-height: 50px;
display: block;
overflow: auto;
}
.spanValue {
display: block;
overflow-x: scroll;
white-space:nowrap;
}
::-webkit-scrollbar {
width: 6px; /*高宽分别对应横竖滚动条的尺寸*/
height: 6px;
}
::-webkit-scrollbar-thumb {
border-radius: 6px;
background: rgba(144, 147, 153, 0.5);
}
::-webkit-scrollbar-track {
border-radius: 5px;
background: transparent;
}
</style>
Loading…
Cancel
Save