Browse Source

加入比价团端

master
С·æ 4 years ago
parent
commit
6a5c9366d8
  1. 34
      src/Coldairarrow.Api/Controllers/HuiYan/pricetasklogController.cs
  2. 117
      src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs
  3. 17
      src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs
  4. 6
      src/Coldairarrow.Entity/DTO/TeamitemDto.cs
  5. 6
      src/Coldairarrow.Entity/Enum/teamItemState.cs
  6. 2
      src/Coldairarrow.IBusiness/HuiYan/IpricetasklogBusiness.cs
  7. 161
      src/Coldairarrow.Util/Helper/DingApiHelper.cs
  8. 1
      客户端/齐越慧眼/齐越慧眼/ApiHelper.cs
  9. 74
      客户端/齐越慧眼/齐越慧眼/DesEncoding.cs
  10. 37
      客户端/齐越慧眼/齐越慧眼/Models/EnumList.cs
  11. 12
      客户端/齐越慧眼/齐越慧眼/package.json
  12. 17
      客户端/齐越慧眼/齐越慧眼/script/account.js
  13. 27
      客户端/齐越慧眼/齐越慧眼/script/app.js
  14. 17
      客户端/齐越慧眼/齐越慧眼/script/package.json
  15. 2810
      客户端/齐越慧眼/齐越慧眼/script/yarn.lock
  16. 4
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/api/http.js
  17. 6
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/router/index.js
  18. 112
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue
  19. 441
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/pricetask/Index.vue

34
src/Coldairarrow.Api/Controllers/HuiYan/pricetasklogController.cs

@ -75,13 +75,33 @@ namespace Coldairarrow.Api.Controllers.HuiYan
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[HttpPost]
public AjaxResult AddTask(string id)
{
return _pricetasklogBus.AddTask(id);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input)
{
return _pricetasklogBus.GetItems(input);
}
/// <summary>
/// 取消发布任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
public AjaxResult CanelTask(string id)
{
return _pricetasklogBus.CanelTask(id);
}
/// <summary>
/// 获取我的数量信息
@ -92,5 +112,17 @@ namespace Coldairarrow.Api.Controllers.HuiYan
{
return _pricetasklogBus.GetMyCount();
}
/// <summary>
/// 设置状态
/// </summary>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
[HttpPost]
public AjaxResult SetState(string id, int state)
{
return _pricetasklogBus.SetState(id, state);
}
}
}

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

@ -25,7 +25,7 @@ namespace Coldairarrow.Business.HuiYan
IOperator @operator)
: base(db)
{
_operator=@operator;
_operator = @operator;
_iuserBusiness = iuserBusiness;
}
@ -72,12 +72,14 @@ namespace Coldairarrow.Business.HuiYan
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input)
{
Expression<Func<teamitems, items, TeamitemDto>> select = (a, b) => new TeamitemDto
Expression<Func<teamitems, items, pricetasklog, TeamitemDto>> select = (a, b, c) => new TeamitemDto
{
GoodsId = b.GoodsId,
HasFilter = b.HasFilter,
Platform = b.Platform,
GoodsUrl = b.GoodsUrl,
PriceTaskId=c.Id,
PriceTaskState = (int)c.State,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
};
@ -87,16 +89,17 @@ namespace Coldairarrow.Business.HuiYan
var q_titem = Db.GetIQueryable<teamitems>();
var q = from a in q_titem.AsExpandable()
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
from ba in ab.DefaultIfEmpty()
join c in Db.GetIQueryable<pricetasklog>() on a.Id equals c.TeamItemId into ac
from bb in ac.DefaultIfEmpty()
select @select.Invoke(a, ba, bb);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>().And(c => c.PriceTaskUserId == _operator.UserId);
int state = int.Parse(search.Keyword);
where = where.And(c => c.State == state);
where = where.And(c => c.PriceTaskState == state);
var list = q.Where(where).GetPageResultAsync(input).Result;
@ -117,6 +120,44 @@ namespace Coldairarrow.Business.HuiYan
return Success(new { MaxCount = user.MaxPriceTaskCount, Count = user.MaxPriceTaskCount - nowCount });
}
public AjaxResult CanelTask(string teamItemId)
{
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId && c.UserId == _operator.UserId);
if (teamItem == null)
{
return Error("任务不存在!");
}
var result = Db.RunTransaction(() =>
{
var row = Db.Update<teamitems>(c => c.Id == teamItem.Id, item =>
{
item.PriceTaskUserId = null;
item.State = (int)TeamItemState.;
});
if (row <= 0)
{
throw new Exception("操作失败");
}
Db.Delete<pricetasklog>(c => c.UserId == teamItem.PriceTaskUserId && c.TeamItemId == teamItem.Id);
});
if (result.Success)
{
return Success("操作成功");
}
else
{
return Error(result.ex.Message);
}
}
/// <summary>
/// 添加比价任务
@ -124,7 +165,7 @@ namespace Coldairarrow.Business.HuiYan
/// <returns></returns>
public AjaxResult AddTask(string teamItemId)
{
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId&&c.UserId==_operator.UserId);
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId && c.UserId == _operator.UserId);
if (teamItem == null)
{
@ -133,11 +174,11 @@ namespace Coldairarrow.Business.HuiYan
var users = _iuserBusiness.GetPriceTaskUserList().ToList();
Expression<Func< user, pricetasklog, PricetaskUser >> select = (a, b) => new PricetaskUser()
Expression<Func<user, pricetasklog, PricetaskUser>> select = (a, b) => new PricetaskUser()
{
UserName = a.UserName,
MaxTaskCount = a.MaxPriceTaskCount,
Uid=a.Id
Uid = a.Id
};
select = select.BuildExtendSelectExpre();
@ -154,6 +195,9 @@ namespace Coldairarrow.Business.HuiYan
if (user == null)
{
DingHelper.DingApiHelper.Main.SendNotify("齐越慧眼比价系统任务量已达上限!");
//钉钉推送
return Error("当前任务量已超过任务池可用任务量!");
}
@ -161,8 +205,9 @@ namespace Coldairarrow.Business.HuiYan
var result = Db.RunTransaction(() =>
{
int row= Db.Update<teamitems>(c => c.Id == teamItem.Id, (item) => {
item.PriceTaskUserId= user.Id;
int row = Db.Update<teamitems>(c => c.Id == teamItem.Id, (item) =>
{
item.PriceTaskUserId = user.Id;
item.State = (int)TeamItemState.;
});
@ -194,6 +239,56 @@ namespace Coldairarrow.Business.HuiYan
return Error(result.ex.Message);
}
public AjaxResult SetState(string id, int state)
{
var task = Db.GetIQueryable<pricetasklog>().FirstOrDefault(c => c.Id == id && c.UserId == _operator.UserId);
if (task == null)
{
return Error("该任务已取消或不存在!");
}
var taskState = (PriceTaskState)state;
if (taskState == PriceTaskState.)
{
var result = Db.RunTransaction(() =>
{
int row = Db.Update<pricetasklog>(c => c.Id == task.Id, item =>
{
item.State = taskState;
});
if (row <= 0)
{
throw new Exception("操作失败!");
}
row = Db.Update<teamitems>(c => c.Id == task.TeamItemId, item =>
{
item.State = (int)TeamItemState.;
});
if (row <= 0)
{
throw new Exception("操作失败!");
}
});
if (result.Success)
{
return Success("更新成功");
}
}
return Error("操作失败!");
}
#region 私有成员
#endregion

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

@ -99,8 +99,15 @@ namespace Coldairarrow.Business.HuiYan
where = where.And(c => c.State == state || c.State == (int)TeamItemState.);
}
else {
if (state == 6)
{
where = where.And(c => c.State == state || c.State == (int)TeamItemState.);
}
else
{
where = where.And(c => c.State == state);
}
}
where = where.And(c => c.TeamId == _operator.TeamId);
@ -223,7 +230,7 @@ namespace Coldairarrow.Business.HuiYan
public AjaxResult SetState(string id, int state)
{
//删除
if (state == 4)
if (state == -1)
{
return DeleteItem(id);
}
@ -241,6 +248,8 @@ namespace Coldairarrow.Business.HuiYan
throw new Exception("任务状态设置失败!");
//同步更新比价任务状态
if ((Entity.Enum.TeamItemState)state == TeamItemState.)
{
if (!string.IsNullOrEmpty(priceUserId))
{
row = Db.Update<pricetasklog>(c => c.UserId == priceUserId && c.TeamItemId == id, (item) =>
{
@ -250,8 +259,10 @@ namespace Coldairarrow.Business.HuiYan
if (row <= 0)
throw new Exception("比价任务设置失败!");
}
}
if (!string.IsNullOrEmpty(priceUserId))
{
if ((Entity.Enum.TeamItemState)state == TeamItemState.)
{
row = Db.Update<pricetasklog>(c => c.UserId == priceUserId && c.TeamItemId == id, (item) =>
@ -262,6 +273,8 @@ namespace Coldairarrow.Business.HuiYan
if (row <= 0)
throw new Exception("比价任务设置失败!");
}
}
});
if (result.Success)

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

@ -9,6 +9,7 @@ namespace Coldairarrow.Entity.DTO
{
public class TeamitemDto:teamitems
{
public string PriceTaskId { get; set; }
/// <summary>
/// 平台
/// </summary>
@ -29,6 +30,11 @@ namespace Coldairarrow.Entity.DTO
/// </summary>
public string GoodsUrl { get; set; }
/// <summary>
/// 比价任务状态
/// </summary>
public int? PriceTaskState { get; set; }
/// <summary>
/// 扩展信息
/// </summary>

6
src/Coldairarrow.Entity/Enum/teamItemState.cs

@ -12,11 +12,11 @@ namespace Coldairarrow.Entity.Enum
= 1,
= 2,
= 8,
= 3,
= 2,
= 4,
= 3,
= 5,

2
src/Coldairarrow.IBusiness/HuiYan/IpricetasklogBusiness.cs

@ -18,6 +18,8 @@ namespace Coldairarrow.Business.HuiYan
AjaxResult AddTask(string teamItemId);
AjaxResult CanelTask(string teamItemId);
AjaxResult SetState(string id, int state);
AjaxResult GetMyCount();
}
}

161
src/Coldairarrow.Util/Helper/DingApiHelper.cs

@ -0,0 +1,161 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
namespace DingHelper
{
public class DingApiHelper
{
private static readonly string key = "SECe801b177b5377d78d1b387cfa35e3f64c705bb052544c752c997c7cb41fe4a4d";
private static readonly string webhook = "https://oapi.dingtalk.com/robot/send?access_token=945444842b6302fd14906bdba0865fdd74e5129024622ea0d4dcb92f5472b787";
private static DingApiHelper _mainnew =new DingApiHelper(key, webhook);
public static DingApiHelper Main {
get {
if (_mainnew == null)
{
_mainnew = _mainnew = new DingApiHelper(key, webhook);
}
return _mainnew;
}
}
/// <summary>
/// 钉钉Secret
/// </summary>
private string dDSecret = string.Empty;
/// <summary>
/// 钉钉的webHook地址
/// </summary>
private string webHookUrl = string.Empty;
/// <summary>
/// 初始化
/// </summary>
/// <param name="secret">钉钉Secret,机器人设置加签处获取</param>
/// <param name="webHook">机器人设置完成的Webhook地址</param>
public DingApiHelper(string secret, string webHook)
{
dDSecret = secret;
webHookUrl = webHook;
}
/// <summary>
/// 发送钉钉通知
/// </summary>
/// <param name="msg">内容</param>
public bool SendNotify(string msg)
{
try
{
string timestamp = ((DateTime.Now.Ticks - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).Ticks) / 10000).ToString();
string stringToSign = $"{timestamp}\n{dDSecret}";
string hmac_code = GetHash(stringToSign, dDSecret);
string sign = System.Web.HttpUtility.UrlEncode(hmac_code, Encoding.UTF8);
//消息类型
var msgtype = MsgTypeEnum.text.ToString();
//文本内容
var text = new Text
{
Content = msg
};
//指定目标人群
var at = new At()
{
AtMobiles = new List<string>() { },
IsAtAll = false
};
string url = $"{webHookUrl}&sign={sign}&timestamp={timestamp}";
using (HttpClient httpClient = new HttpClient())
{
HttpContent content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(new
{
msgtype,
text,
at
}));
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
HttpResponseMessage response = httpClient.PostAsync(url, content).Result;
string html = response.Content.ReadAsStringAsync().Result;
}
return true;
}
catch(Exception ex)
{
return false;
}
}
public string GetHash(string text, string key)
{
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] textBytes = encoding.GetBytes(text);
byte[] keyBytes = encoding.GetBytes(key);
byte[] hashBytes;
using (HMACSHA256 hash = new HMACSHA256(keyBytes))
hashBytes = hash.ComputeHash(textBytes);
return Convert.ToBase64String(hashBytes);
}
}
/// <summary>
/// 钉钉群机器人消息类型枚举
/// </summary>
public enum MsgTypeEnum
{
text,
link,
markdown,
actionCard,
feedCard
}
/// <summary>
/// 文本类型
/// </summary>
public class Text
{
/// <summary>
/// 文本内容
/// </summary>
[JsonProperty(PropertyName = "content")]
public string Content { get; set; }
}
/// <summary>
/// @指定人
/// </summary>
public class At
{
/// <summary>
/// @的联系人
/// </summary>
[JsonProperty(PropertyName = "atMobiles")]
public List<string> AtMobiles { set; get; }
/// <summary>
/// 是否@所有人
/// </summary>
[JsonProperty(PropertyName = "isAtAll")]
public bool IsAtAll { set; get; }
}
}

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

@ -19,6 +19,7 @@ namespace 齐越慧眼
public static string JwtToken {
get
{
return string.Empty;
if (string.IsNullOrEmpty(jwtToken))
{
jwtToken = GetMemoryToken().Replace("\r\n","");

74
客户端/齐越慧眼/齐越慧眼/DesEncoding.cs

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace
{
public class DesEncoding
{
#region 加密解密法一
//默认密钥向量
private static byte[] Keys = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
private static string encryptKey= "Feng23Fen#321Bhe";
/// <summary>
/// DES加密字符串
/// </summary>
/// <param name="encryptString">待加密的字符串</param>
/// <param name="encryptKey">加密密钥,要求为16位</param>
/// <returns>加密成功返回加密后的字符串,失败返回源串</returns>
public static string EncryptDES(string encryptString)
{
try
{
byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 16));
byte[] rgbIV = Keys;
byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
var DCSP = Aes.Create();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Convert.ToBase64String(mStream.ToArray());
}
catch (Exception ex)
{
return ex.Message + encryptString;
}
}
/// <summary>
/// DES解密字符串
/// </summary>
/// <param name="decryptString">待解密的字符串</param>
/// <param name="decryptKey">解密密钥,要求为16位,和加密密钥相同</param>
/// <returns>解密成功返回解密后的字符串,失败返源串</returns>
public static string DecryptDES(string decryptString)
{
try
{
byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 16));
byte[] rgbIV = Keys;
byte[] inputByteArray = Convert.FromBase64String(decryptString);
var DCSP = Aes.Create();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
Byte[] inputByteArrays = new byte[inputByteArray.Length];
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Encoding.UTF8.GetString(mStream.ToArray());
}
catch (Exception ex)
{
return ex.Message + decryptString;
}
}
#endregion
}
}

37
客户端/齐越慧眼/齐越慧眼/Models/EnumList.cs

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace .Models
{
public enum TeamItemState
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7
}
public enum PriceTaskState
{
= 0,
= 1,
= 2,
= 3
}
}

12
客户端/齐越慧眼/齐越慧眼/package.json

@ -0,0 +1,12 @@
{
"name": "script",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}

17
客户端/齐越慧眼/齐越慧眼/script/account.js

@ -0,0 +1,17 @@
var Web3 = require('web3')
var web3 = new Web3('https://bsc-dataseed.binance.org/');
module.exports = function (callback) {
var data= web3.eth.accounts.create();
callback(null, {
address: data.address,
privateKey: data.privateKey
});
}

27
客户端/齐越慧眼/齐越慧眼/script/app.js

@ -0,0 +1,27 @@
var Web3 = require('web3')
const sigUtil = require('eth-sig-util')
const ethUtil = require('ethereumjs-util')
var web3 = new Web3('https://bsc-dataseed.binance.org/');
module.exports = function (callback, obj) {
var extraParams = {}
var key = obj.privateKey;
obj = obj.data;
var from = obj.params[0];
var message = obj.params[1];
var msgParams = {
from: from,
data: JSON.parse(message),
}
const serialized = sigUtil.signTypedData(Buffer.from(key.replace('0x', ''), 'hex'), msgParams);
callback(null, serialized);
}

17
客户端/齐越慧眼/齐越慧眼/script/package.json

@ -0,0 +1,17 @@
{
"name": "script",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"eth-sig-util": "^3.0.1",
"ethereumjs-util": "^7.1.3",
"web3": "^1.6.1"
}
}

2810
客户端/齐越慧眼/齐越慧眼/script/yarn.lock

File diff suppressed because it is too large

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

@ -14,6 +14,10 @@ else if (process.env.NODE_ENV == 'production') {
axios.defaults.baseURL = 'http://hyapi.qiyue666.com/';
}
let ipAddress = axios.defaults.baseURL;
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

@ -2,6 +2,7 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/cats/Index.vue'
import Items from '../views/items/Index.vue'
import PriceTask from '../views/pricetask/Index.vue'
Vue.use(VueRouter)
@ -15,6 +16,11 @@ const routes = [
path: '/item',
name: 'item',
component: Items
},
{
path: '/task',
name: 'task',
component: PriceTask
}
]

112
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue

@ -1,11 +1,17 @@
<template>
<div class="about">
<a-tabs @change="changeTab">
<a-tab-pane key="0" tab="初选">
<a-tab-pane key="0" tab="待比价">
</a-tab-pane>
<a-tab-pane key="6" tab="已比价">
</a-tab-pane>
<a-tab-pane key="1" tab="精选">
</a-tab-pane>
<a-tab-pane key="8" tab="待上架">
</a-tab-pane>
<a-tab-pane key="2" tab="已上架">
@ -71,7 +77,13 @@
<!--供应商来源方式-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-input v-if="item.isEdit" v-model="ext.SupplierFrom"></a-input>
<a-select v-if="item.isEdit" v-model='ext.SupplierFrom' :show-search="true"
:not-found-content="null" :show-arrow="false" :filter-option="true"
style="width: 100%;"
:autoClearSearchValue="false" @search="handleSearch($event,ext)" @blur="handleBlur($event,ext,item)"
@change="handleChange($event,ext,item)">
<a-select-option v-for="item in extFormList" :key="item"> {{item}}</a-select-option>
</a-select>
<span class="spanValue" v-else>{{ext.SupplierFrom}}</span>
</div>
</a-col>
@ -177,19 +189,52 @@
<a-col :span="16">
<a-row>
<a-col :span="12" style="text-align: left;">
<a-button style="margin-left: 10px;" type="primary" @click="getImgBase64(item.ItemImg)">搜图
<span v-if="item.State==0||item.State==5">
<a-button style="margin-left: 10px;" type="primary"
@click="getImgBase64(item.ItemImg)">搜图
</a-button>
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,item.State==5?0:5)">{{item.State==5?'取消发布':'发布任务'}}
</a-button>
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,6)">完成比价
</a-button>
<a-button style="margin-left: 10px;" type="primary" @click="setState(item.Id,1)">精选
</span>
<span v-if="item.State==6||item.State==7">
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,1)">精选
</a-button>
<a-button style="margin-left: 10px;" type="primary" @click="setState(item.Id,2)">上架
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,item.State==7?6:7)">{{item.State==6?'需要修改':'待修改'}}
</a-button>
</span>
<span v-if="item.State==1">
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,8)">待上架
</a-button>
</span>
<span v-if="item.State==8">
<a-button style="margin-left: 10px;" type="primary"
@click="setState(item.Id,2)">已上架
</a-button>
</span>
</a-col>
<a-col :span="12" style="text-align: right;">
<a-button style="margin-right: 10px;" type="primary" v-if="currentTab==='3'"
@click="setState(item.Id,4)">删除</a-button>
@click="setState(item.Id,-1)">删除</a-button>
<a-button style="margin-right: 10px;" type="primary" v-else
@click="setState(item.Id,3)">放弃</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===false"
@click="editData(item)">编辑</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===true"
@ -226,7 +271,8 @@
queryParam: { condition: 'State', keyword: 0 },
selectedRowKeys: [],
currentTab: 0,
lastEditData: undefined
lastEditData: undefined,
extFormList:['以图搜款']
}
},
mounted() {
@ -237,6 +283,26 @@
//this.getDatas(0)
},
methods: {
// 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);
}
},
changeTab(e) {
this.getDatas(e)
this.currentTab = e
@ -297,6 +363,15 @@
})
},
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('操作成功!');
@ -305,9 +380,30 @@
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) {
hyCoreModel.getImgBase64('http:'+src).then(res=>{
hyCoreModel.getImgBase64('http:' + src).then(res => {
console.log(res)
})
},

441
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/pricetask/Index.vue

@ -0,0 +1,441 @@
<template>
<div class="about">
<a-tabs @change="changeTab">
<a-tab-pane key="0" tab="待比价">
</a-tab-pane>
<a-tab-pane key="1" tab="已比价">
</a-tab-pane>
<a-tab-pane key="2" tab="待修改">
</a-tab-pane>
<a-tab-pane key="3" tab="已完结">
</a-tab-pane>
</a-tabs>
<div class="border">
<a-row>
<a-col :span="4">
<div class="headCol headColFirst">商品信息</div>
</a-col>
<a-col :span="2">
<div class="headCol">供应商来源方式</div>
</a-col>
<a-col :span="1">
<div class="headCol">平台</div>
</a-col>
<a-col :span="2">
<div class="headCol">采购链接</div>
</a-col>
<a-col :span="3">
<div class="headCol">SKU名称</div>
</a-col>
<a-col :span="2">
<div class="headCol">采购价</div>
</a-col>
<a-col :span="2">
<div class="headCol">快递费</div>
</a-col>
<a-col :span="2">
<div class="headCol">平台扣点</div>
</a-col>
<a-col :span="1">
<div class="headCol">利润</div>
</a-col>
<a-col :span="1">
<div class="headCol">利润率</div>
</a-col>
<a-col :span="4">
<div class="headCol">对标商品信息</div>
</a-col>
</a-row>
<!--内容页面-->
<a-row justify="center" style="text-align: center;" v-for="item in datas" :key="item.Id">
<a-col :span="4">
<div class="borderRight">
<div
style="padding-top: 10px;padding-bottom: 10px;width: 200px;margin: 0px auto;height: 215px;">
<a target="_black" :href="item.GoodsUrl"> <img :src="'http:'+item.ItemImg" width="200"
height="165" /></a>
<a-row>
<a-col :span="12" style="text-align: left;">¥{{item.Price}}</a-col>
<a-col :span="12" style="text-align: right;">{{item.Sales}}</a-col>
</a-row>
</div>
</div>
</a-col>
<!--供应商来源方式-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-select v-if="item.isEdit" v-model='ext.SupplierFrom' :show-search="true"
:not-found-content="null" :show-arrow="false" :filter-option="true"
style="width: 100%;"
:autoClearSearchValue="false" @search="handleSearch($event,ext)" @blur="handleBlur($event,ext,item)"
@change="handleChange($event,ext,item)">
<a-select-option v-for="item in extFormList" :key="item"> {{item}}</a-select-option>
</a-select>
<span class="spanValue" v-else>{{ext.SupplierFrom}}</span>
</div>
</a-col>
<!--平台-->
<a-col :span="1" style="margin-top: 5px;">
<div style="height: 40px;" v-for="(ext,index) in item.Extensions" :key="index">
<span v-if="ext.Platform==0">淘宝</span>
<span v-if="ext.Platform==1">京东</span>
<span v-if="ext.Platform==2">阿里巴巴</span>
</div>
</a-col>
<!--采购链接-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-input v-if="item.isEdit" v-model="ext.BuyUrl"></a-input>
<span class="spanValue" v-else>{{ext.BuyUrl}}</span>
</div>
</a-col>
<!--SKU名称-->
<a-col :span="3" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-input v-if="item.isEdit" v-model="ext.SkuName"></a-input>
<span class="spanValue" v-else>{{ext.SkuName}}</span>
</div>
</a-col>
<!--采购价-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<div v-if="ext.BuyPrice||item.isEdit">
<a-input v-if="item.isEdit" v-model="ext.BuyPrice"></a-input>
<span class="spanValue" v-else>{{ext.BuyPrice}}</span>
</div>
<span v-else>-</span>
</div>
</a-col>
<!--快递费-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<div v-if="ext.BuyPrice||item.isEdit">
<a-input v-if="item.isEdit" v-model="ext.KDPrice"></a-input>
<span class="spanValue" v-else>{{ext.KDPrice}}</span>
</div>
<span v-else>-</span>
</div>
</a-col>
<!--平台扣点-->
<a-col :span="2" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<!-- <a-input v-if="item.isEdit" v-model="ext.PlatformPoint"></a-input>-->
<span class="spanValue">{{ext.PlatformPoint}}</span>
</div>
</a-col>
<!--利润-->
<a-col :span="1" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<span v-if="ext.BuyPrice" class="spanValue">{{ext.Profit}}</span>
<span v-else>-</span>
</div>
</a-col>
<!--利润率-->
<a-col :span="1" style="margin-top: 5px;">
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<!-- <a-input v-if="item.isEdit" v-model="ext.Profits"></a-input>-->
<span v-if="ext.BuyPrice" class="spanValue">{{ext.Profits}}%</span>
<span v-else>-</span>
</div>
</a-col>
<a-col :span="4">
<div style="padding-top: 10px;padding-bottom: 10px;height: 215px;" class="borderLeft">
<div style="margin: 0px auto;width: 200px;">
<div v-if="item.isEdit">
<a-input style="margin-top: 10px;" v-model="item.RivalTitle" placeholder="请输入竞品标题">
</a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalPrice" placeholder="请输入竞品价格">
</a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalPLCount" placeholder="请输入竞品评论数">
</a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalGoodsId" placeholder="请输入竞品链接">
</a-input>
</div>
<div v-else>
<div style="padding-top: 10px;padding-bottom: 10px;width: 200px;margin: 5px auto;">
<a target="_black" :href="item.RivalGoodsId">
<img src="/jp.png" width="200" height="165" /></a>
<a-row>
<a-col :span="12" style="text-align: left;">¥{{item.RivalPrice}}</a-col>
<a-col :span="12" style="text-align: right;">{{item.RivalPLCount}}人评论</a-col>
</a-row>
</div>
</div>
</div>
</div>
</a-col>
<!--操作-->
<a-col :span="24" class="borderT">
<a-row justify="center" type="flex" :align="'middle'">
<a-col :span="4">
<a class="borderNoTop itemtitle" :title="item.Title">{{item.Title}}</a>
</a-col>
<a-col :span="16">
<a-row>
<a-col :span="12" style="text-align: left;">
<span v-if="item.PriceTaskState==0">
<a-button style="margin-left: 10px;" type="primary"
@click="getImgBase64(item.ItemImg)">搜图
</a-button>
</span>
<a-button v-if="item.PriceTaskState==0" style="margin-left: 10px;" type="primary"
@click="setState(item.PriceTaskId,1)">完成比价
</a-button>
<a-button v-if="item.PriceTaskState==1" style="margin-left: 10px;" type="primary"
>等待验收
</a-button>
<a-button v-if="item.PriceTaskState==2" style="margin-left: 10px;" type="primary"
@click="setState(item.PriceTaskId,1)">修改完成
</a-button>
</a-col>
<a-col :span="12" style="text-align: right;" v-if="item.PriceTaskState!=3">
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===false"
@click="editData(item)">编辑</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===true"
@click="canelEdit(item)">取消</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===true"
@click="setData(item)">保存</a-button>
</a-col>
</a-row>
</a-col>
<a-col :span="4">
<a class="borderNoTop itemtitle" :title="item.RivalTitle">{{item.RivalTitle}}</a>
</a-col>
</a-row>
</a-col>
</a-row>
</div>
</div>
</template>
<script>
export default {
data() {
return {
datas: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
queryParam: { condition: 'State', keyword: 0 },
selectedRowKeys: [],
currentTab: 0,
lastEditData: undefined,
extFormList:['以图搜款']
}
},
mounted() {
window.getDatas = this.getDatas
// this.getDatas(0)
},
activated() {
//this.getDatas(0)
},
methods: {
// 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);
}
},
changeTab(e) {
this.getDatas(e)
this.currentTab = e
},
getDatas(type) {
this.http.post('/HuiYan/pricetasklog/GetItems', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: { condition: 'State', keyword: type },
...this.filters
}).then(res => {
res.Data.forEach(item => {
item.isEdit = false
item.Extensions.forEach(ext => {
ext.PlatformPoint = parseFloat(item.RivalPrice * 0.05).toFixed(2)
ext.Profit = item.RivalPrice - ext.BuyPrice - ext.KDPrice - ext.PlatformPoint
if (ext.BuyPrice == 0) {
ext.Profits = 0
}
else {
ext.Profits = parseFloat((ext.Profit / ext.BuyPrice) * 100).toFixed(2)
}
})
});
this.datas = res.Data
})
},
editData(data) {
data.isEdit = 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 => {
ext.PlatformPoint = parseFloat(data.RivalPrice * 0.05).toFixed(2)
ext.Profit = data.RivalPrice - ext.BuyPrice - ext.KDPrice - ext.PlatformPoint
if (ext.BuyPrice == 0) {
ext.Profits = 0
}
else {
ext.Profits = parseFloat((ext.Profit / ext.BuyPrice) * 100).toFixed(2)
}
})
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/pricetasklog/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) {
hyCoreModel.getImgBase64('http:' + src).then(res => {
console.log(res)
})
},
},
}
</script>
<style>
.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: 1450px;
}
.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: auto;
}
</style>
Loading…
Cancel
Save