Browse Source

完成产品库前端编辑

master
С·æ 4 years ago
parent
commit
297de9da38
  1. 37
      src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs
  2. 55
      src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs
  3. 6
      src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs
  4. 128
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/items/Index.vue

37
src/Coldairarrow.Api/Controllers/HuiYan/teamitemsController.cs

@ -2,6 +2,7 @@
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -63,15 +64,49 @@ namespace Coldairarrow.Api.Controllers.HuiYan
#endregion
/// <summary>
/// 获取数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost, AllowAnonymous]
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input)
{
return _teamitemsBus.GetItems(input);
}
/// <summary>
/// 添加商品信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[HttpPost, AllowAnonymous]
public AjaxResult AddItem(TeamitemDto model)
{
return _teamitemsBus.AddItem(model);
}
/// <summary>
/// 设置商品信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost, AllowAnonymous]
public AjaxResult SetItem(TeamitemDto model)
{
return _teamitemsBus.SetItem(model);
}
/// <summary>
/// 设置商品状态
/// </summary>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
[HttpPost, AllowAnonymous]
public AjaxResult SetState(string id, int state)
{
return _teamitemsBus.SetState(id, state);
}
}
}

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

@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Business.HuiYan
@ -64,6 +65,34 @@ namespace Coldairarrow.Business.HuiYan
#endregion
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input)
{
Expression<Func<teamitems, items, TeamitemDto>> select = (a, b) => new TeamitemDto
{
GoodsId = b.GoodsId,
HasFilter = b.HasFilter,
Platform = b.Platform,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
};
var search = input.Search;
select = select.BuildExtendSelectExpre();
var q_titem = GetIQueryable();
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);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>().And(c => c.State == int.Parse(search.Keyword));
var list = q.Where(where).GetPageResultAsync(input).Result;
return list;
}
public AjaxResult AddItem(TeamitemDto model)
{
@ -120,5 +149,31 @@ namespace Coldairarrow.Business.HuiYan
return Success();
}
public AjaxResult SetItem(TeamitemDto model)
{
int row= Db.Update<teamitems>(c=>c.Id==model.Id,(item)=> {
item.ExtensionJson = Newtonsoft.Json.JsonConvert.SerializeObject(model.Extensions);
item.RivalGoodsId = model.RivalGoodsId;
item.RivalPLCount = model.RivalPLCount;
item.RivalPrice = model.RivalPrice;
});
if (row > 0)
return Success();
return Error("操作失败!");
}
public AjaxResult SetState(string id,int state)
{
int row = Db.Update<teamitems>(c => c.Id == id, (item) => {
item.State = state;
});
if (row > 0)
return Success();
return Error("操作失败!");
}
}
}

6
src/Coldairarrow.IBusiness/HuiYan/IteamitemsBusiness.cs

@ -14,6 +14,12 @@ namespace Coldairarrow.Business.HuiYan
Task UpdateDataAsync(teamitems data);
Task DeleteDataAsync(List<string> ids);
PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input);
AjaxResult AddItem(TeamitemDto model);
AjaxResult SetItem(TeamitemDto model);
AjaxResult SetState(string id, int state);
}
}

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

@ -51,56 +51,89 @@
<!--内容页面-->
<a-row justify="center" style="text-align: center;">
<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: 5px auto;">
<img src="//img14.360buyimg.com/n7/jfs/t1/112118/6/12037/103796/5f06bf16E350bf67c/a27484a55ba13cf8.jpg"
width="200" height="165">
<a-row>
<a-col :span="12" style="text-align: left;">¥46.0</a-col>
<a-col :span="12" style="text-align: right;">160人收货</a-col>
</a-row>
<div style="padding-top: 10px;padding-bottom: 10px;width: 200px;margin: 5px auto;">
<img :src="item.ItemImg" width="200" height="165">
<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>
</div>
</a-col>
<a-col :span="1" style="margin-top: 5px;">
<div style="height: 40px;">平台</div>
<div style="height: 40px;">平台</div>
<div style="height: 40px;">平台</div>
<div style="height: 40px;">平台</div>
<div style="height: 40px;">平台</div>
<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="3" style="margin-top: 5px;">
<div>SKU名称</div>
<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 v-else>{{ext.SkuName}}</span>
</div>
</a-col>
<a-col :span="2" style="margin-top: 5px;">
<div>采购链接</div>
<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 v-else>{{ext.BuyUrl}}</span>
</div>
</a-col>
<a-col :span="3" style="margin-top: 5px;">
<div>供应商来源方式</div>
<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>
<span v-else>{{ext.SupplierFrom}}</span>
</div>
</a-col>
<a-col :span="2" style="margin-top: 5px;">
<div>采购价</div>
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-input v-if="item.isEdit" v-model="ext.BuyPrice"></a-input>
<span v-else>{{ext.BuyPrice}}</span>
</div>
</a-col>
<a-col :span="2" style="margin-top: 5px;">
<div>快递费</div>
<div v-for="(ext,index) in item.Extensions" style="height: 40px;" :key="index">
<a-input v-if="item.isEdit" v-model="ext.KDPrice"></a-input>
<span v-else>{{ext.KDPrice}}</span>
</div>
</a-col>
<a-col :span="2" style="margin-top: 5px;">
<div>平台扣点</div>
<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 v-else>{{ext.PlatformPoint}}</span>
</div>
</a-col>
<a-col :span="1" style="margin-top: 5px;">
<div>利润率</div>
<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-else>{{ext.Profits}}</span>
</div>
</a-col>
<a-col :span="4">
<div style="padding-top: 10px;padding-bottom: 10px;" class="borderLeft">
<div style="padding-top: 10px;padding-bottom: 10px;height: 215px;" class="borderLeft">
<div style="margin: 0px auto;width: 200px;">
<img src="//img14.360buyimg.com/n7/jfs/t1/112118/6/12037/103796/5f06bf16E350bf67c/a27484a55ba13cf8.jpg"
width="200" height="165">
<a-row>
<a-col :span="12" style="text-align: left;">¥46.0</a-col>
<a-col :span="12" style="text-align: right;">160人收货</a-col>
</a-row>
<div v-if="item.isEdit">
<a-input style="margin-top: 10px;" v-model="item.RivalTitle"></a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalPrice"></a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalPLCount"></a-input>
<a-input style="margin-top: 10px;" v-model="item.RivalGoodsId"></a-input>
</div>
<div v-else>
<div style="padding-top: 10px;padding-bottom: 10px;width: 200px;margin: 5px auto;">
<img :src="item.ItemImg" width="200" height="165">
<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>
@ -108,7 +141,7 @@
<a-col :span="24" class="borderT">
<a-row justify="center" type="flex" :align="'middle'">
<a-col :span="4">
<div class="borderNoTop">儿童玩具男孩枪CS对战装备红外线激光枪镭射对战枪儿童真人CS武器</div>
<div class="borderNoTop">{{item.Title}}</div>
</a-col>
<a-col :span="16">
<a-row>
@ -119,12 +152,13 @@
<a-col :span="12" style="text-align: right;">
<a-button style="margin-right: 10px;" type="primary">放弃</a-button>
<a-button style="margin-right: 10px;" type="primary">保存</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===false" @click="()=>{item.isEdit=true}">编辑</a-button>
<a-button style="margin-right: 10px;" type="primary" v-if="item.isEdit===true" @click="()=>{item.isEdit=false}">保存</a-button>
</a-col>
</a-row>
</a-col>
<a-col :span="4">
<div class="borderNoTop">儿童玩具男孩枪CS对战装备红外线激光枪镭射对战枪儿童真人CS武器</div>
<div class="borderNoTop" style="height: 50px;">{{item.RivalTitle}}</div>
</a-col>
</a-row>
</a-col>
@ -138,12 +172,37 @@
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: []
}
},
mounted() {
this.getDatas()
},
methods: {
getDatasByJson(row){
getDatas() {
this.http.post('/HuiYan/teamitems/GetItems', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
}).then(res => {
res.Data.forEach(item => {
item.isEdit=false
});
this.datas = res.Data
})
}
},
}
@ -185,6 +244,7 @@
border-right: 0px;
border-bottom: 0px;
}
.borderRight {
border: 1px solid rgba(215, 215, 215, 1);
border-top: 0px;

Loading…
Cancel
Save