优化tao店铺商品拉取、关联
This commit is contained in:
parent
1a47ac320c
commit
ec5e4281ea
|
|
@ -20,7 +20,7 @@
|
|||
<module>pdd-api</module>
|
||||
<module>dou-api</module>
|
||||
<module>wei-api</module>
|
||||
<module>kwai-api</module>
|
||||
<!-- <module>kwai-api</module>-->
|
||||
</modules>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
|
|
|
|||
|
|
@ -73,103 +73,87 @@ public class GoodsApiController extends BaseController {
|
|||
int insertSuccess = 0;//新增成功的订单
|
||||
int totalError = 0;
|
||||
int hasExistOrder = 0;//已存在的订单数
|
||||
try {
|
||||
ApiResultVo<GoodsItem> goodsItemApiResultVo = GoodsApiHelper.pullGoodsList(appKey, appSecret, sessionKey);
|
||||
if (goodsItemApiResultVo.getCode() == ApiResultVoEnum.SUCCESS.getIndex()) {
|
||||
//成功
|
||||
if (goodsItemApiResultVo.getList() != null) {
|
||||
for (var g : goodsItemApiResultVo.getList()) {
|
||||
OmsTaoGoods goods = new OmsTaoGoods();
|
||||
// TODO:转换goods
|
||||
goods.setNumIid(g.getNum_iid());
|
||||
goods.setTitle(g.getTitle());
|
||||
goods.setType(g.getType());
|
||||
goods.setCid(g.getCid());
|
||||
goods.setPicUrl(g.getPic_url());
|
||||
goods.setNum(g.getNum());
|
||||
goods.setValidThru(g.getValid_thru());
|
||||
goods.setHasDiscount(g.isHas_discount() + "");
|
||||
goods.setHasInvoice(g.isHas_invoice() + "");
|
||||
goods.setHasWarranty(g.isHas_warranty() + "");
|
||||
goods.setHasShowcase(g.isHas_showcase() + "");
|
||||
goods.setModified(DateUtil.stringtoDate(g.getModified()));
|
||||
goods.setDelistTime(StringUtils.isEmpty(g.getDelist_time()) ? null : DateUtil.stringtoDate(g.getDelist_time()));
|
||||
goods.setPostageId(g.getPostage_id());
|
||||
goods.setOuterId(g.getOuter_id());
|
||||
goods.setListTime(StringUtils.isEmpty(g.getList_time()) ? null : DateUtil.stringtoDate(g.getList_time()));
|
||||
goods.setPrice(g.getPrice());
|
||||
goods.setSoldQuantity(g.getSold_quantity());
|
||||
goods.setShopId(req.getShopId());
|
||||
List<OmsTaoGoodsSku> skuList = new ArrayList<>();
|
||||
for (var s : g.getSkuList()) {
|
||||
OmsTaoGoodsSku sku = new OmsTaoGoodsSku();
|
||||
sku.setShopId(req.getShopId());
|
||||
sku.setNumIid(s.getNum_iid());
|
||||
sku.setIid(s.getIid());
|
||||
sku.setSkuId(s.getSku_id());
|
||||
sku.setProperties(s.getProperties());
|
||||
sku.setPropertiesName(s.getProperties_name());
|
||||
sku.setQuantity(s.getQuantity());
|
||||
sku.setSkuSpecId(s.getSku_spec_id() + "");
|
||||
sku.setPrice(StringUtils.isEmpty(s.getPrice()) ? null : Double.parseDouble(s.getPrice()));
|
||||
sku.setOuterId(s.getOuter_id());
|
||||
sku.setCreated(StringUtils.isEmpty(s.getCreated()) ? null : DateUtil.stringtoDate(s.getCreated()));
|
||||
sku.setModified(StringUtils.isEmpty(s.getModified()) ? null : DateUtil.stringtoDate(s.getModified()));
|
||||
sku.setStatus(s.getStatus());
|
||||
sku.setCreateTime(new Date());
|
||||
skuList.add(sku);
|
||||
}
|
||||
goods.setSkuList(skuList);
|
||||
|
||||
ApiResultVo<GoodsItem> goodsItemApiResultVo = GoodsApiHelper.pullGoodsList(appKey, appSecret, sessionKey);
|
||||
if(goodsItemApiResultVo.getCode() == ApiResultVoEnum.SUCCESS.getIndex()){
|
||||
//成功
|
||||
if(goodsItemApiResultVo.getList()!=null){
|
||||
for (var g:goodsItemApiResultVo.getList()) {
|
||||
OmsTaoGoods goods = new OmsTaoGoods();
|
||||
// TODO:转换goods
|
||||
goods.setNumIid(g.getNum_iid());
|
||||
goods.setTitle(g.getTitle());
|
||||
goods.setType(g.getType());
|
||||
goods.setCid(g.getCid());
|
||||
goods.setPicUrl(g.getPic_url());
|
||||
goods.setNum(g.getNum());
|
||||
goods.setValidThru(g.getValid_thru());
|
||||
goods.setHasDiscount(g.isHas_discount()+"");
|
||||
goods.setHasInvoice(g.isHas_invoice()+"");
|
||||
goods.setHasWarranty(g.isHas_warranty()+"");
|
||||
goods.setHasShowcase(g.isHas_showcase()+"");
|
||||
goods.setModified(DateUtil.stringtoDate(g.getModified()));
|
||||
goods.setDelistTime(StringUtils.isEmpty(g.getDelist_time())?null:DateUtil.stringtoDate(g.getDelist_time()));
|
||||
goods.setPostageId(g.getPostage_id());
|
||||
goods.setOuterId(g.getOuter_id());
|
||||
goods.setListTime(StringUtils.isEmpty(g.getList_time())?null:DateUtil.stringtoDate(g.getList_time()));
|
||||
goods.setPrice(g.getPrice());
|
||||
goods.setSoldQuantity(g.getSold_quantity());
|
||||
goods.setShopId(req.getShopId());
|
||||
List<OmsTaoGoodsSku> skuList = new ArrayList<>();
|
||||
for (var s:g.getSkuList()) {
|
||||
OmsTaoGoodsSku sku = new OmsTaoGoodsSku();
|
||||
sku.setShopId(req.getShopId());
|
||||
sku.setNumIid(s.getNum_iid());
|
||||
sku.setIid(s.getIid());
|
||||
sku.setSkuId(s.getSku_id());
|
||||
sku.setProperties(s.getProperties());
|
||||
sku.setPropertiesName(s.getProperties_name());
|
||||
sku.setQuantity(s.getQuantity());
|
||||
sku.setSkuSpecId(s.getSku_spec_id()+"");
|
||||
sku.setPrice(StringUtils.isEmpty(s.getPrice())?null:Double.parseDouble(s.getPrice()));
|
||||
sku.setOuterId(s.getOuter_id());
|
||||
sku.setCreated(StringUtils.isEmpty(s.getCreated())?null:DateUtil.stringtoDate(s.getCreated()));
|
||||
sku.setModified(StringUtils.isEmpty(s.getModified())?null: DateUtil.stringtoDate(s.getModified()));
|
||||
sku.setStatus(s.getStatus());
|
||||
sku.setCreateTime(new Date());
|
||||
skuList.add(sku);
|
||||
}
|
||||
goods.setSkuList(skuList);
|
||||
|
||||
int result = goodsService.saveAndUpdateGoods(req.getShopId(), goods);
|
||||
if (result == ResultVoEnum.DataExist.getIndex()) {
|
||||
//已经存在
|
||||
hasExistOrder++;
|
||||
} else if (result == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
insertSuccess++;
|
||||
}else {
|
||||
totalError++;
|
||||
int result = goodsService.saveAndUpdateGoods(req.getShopId(), goods);
|
||||
if (result == ResultVoEnum.DataExist.getIndex()) {
|
||||
//已经存在
|
||||
hasExistOrder++;
|
||||
} else if (result == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
insertSuccess++;
|
||||
} else {
|
||||
totalError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String msg = "成功,总共找到:" + goodsItemApiResultVo.getTotalRecords() + "条商品数据,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "条";
|
||||
logger.info(msg);
|
||||
SysShopPullLogs logs = new SysShopPullLogs();
|
||||
logs.setShopId(req.getShopId());
|
||||
logs.setShopType(EnumShopType.TAO.getIndex());
|
||||
logs.setPullType("GOODS");
|
||||
logs.setPullWay("主动拉取");
|
||||
logs.setPullParams("{PageNo:1,PageSize:100}");
|
||||
logs.setPullResult("{successTotal:"+goodsItemApiResultVo.getTotalRecords()+"}");
|
||||
logs.setPullTime(currDateTime);
|
||||
logs.setDuration(System.currentTimeMillis() - startTime);
|
||||
pullLogsService.save(logs);
|
||||
String msg = "成功,总共找到:" + goodsItemApiResultVo.getTotalRecords() + "条商品数据,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "条";
|
||||
logger.info(msg);
|
||||
SysShopPullLogs logs = new SysShopPullLogs();
|
||||
logs.setShopId(req.getShopId());
|
||||
logs.setShopType(EnumShopType.TAO.getIndex());
|
||||
logs.setPullType("GOODS");
|
||||
logs.setPullWay("主动拉取");
|
||||
logs.setPullParams("{PageNo:1,PageSize:100}");
|
||||
logs.setPullResult("{successTotal:" + goodsItemApiResultVo.getTotalRecords() + "}");
|
||||
logs.setPullTime(currDateTime);
|
||||
logs.setDuration(System.currentTimeMillis() - startTime);
|
||||
pullLogsService.save(logs);
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), msg);
|
||||
return AjaxResult.success(msg);
|
||||
}else{
|
||||
return AjaxResult.error(goodsItemApiResultVo.getCode(),goodsItemApiResultVo.getMsg());
|
||||
return AjaxResult.success(msg);
|
||||
} else {
|
||||
return AjaxResult.error(goodsItemApiResultVo.getCode(), goodsItemApiResultVo.getMsg());
|
||||
}
|
||||
}catch (IllegalStateException e){
|
||||
e.printStackTrace();
|
||||
log.info("链接超时!!!!");
|
||||
return AjaxResult.error("链接超时!!!!");
|
||||
}
|
||||
// ApiResultVo<TaoGoods> resultVo = goodsApiService.pullGoodsList(req.getShopId(), url, appKey, appSecret, sessionKey);
|
||||
|
||||
|
||||
// for (var goods:resultVo.getList()) {
|
||||
// int result = goodsService.saveAndUpdateGoods(req.getShopId(), goods);
|
||||
// if (result == ResultVoEnum.DataExist.getIndex()) {
|
||||
// //已经存在
|
||||
// hasExistOrder++;
|
||||
// } else if (result == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
// insertSuccess++;
|
||||
// }else {
|
||||
// totalError++;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// String msg = "成功,总共找到:" + resultVo.getTotalRecords() + "条商品数据";
|
||||
// logger.info(msg);
|
||||
//// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), msg);
|
||||
// return AjaxResult.success(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.qihang.common.common.PageResult;
|
|||
import com.qihang.common.common.TableDataInfo;
|
||||
import com.qihang.tao.common.BaseController;
|
||||
import com.qihang.tao.domain.OmsTaoGoods;
|
||||
import com.qihang.tao.domain.OmsTaoGoodsSku;
|
||||
import com.qihang.tao.domain.bo.TaoGoodsBo;
|
||||
import com.qihang.tao.domain.vo.TaoGoodsSkuListVo;
|
||||
import com.qihang.tao.service.OmsTaoGoodsService;
|
||||
|
|
@ -44,14 +45,15 @@ public class GoodsController extends BaseController {
|
|||
{
|
||||
return AjaxResult.success(skuService.getById(id));
|
||||
}
|
||||
// @PostMapping(value = "/sku/linkErp")
|
||||
// public AjaxResult linkErp(@RequestBody LinkErpGoodsSkuBo bo)
|
||||
// {
|
||||
// TaoGoodsSku sku = new TaoGoodsSku();
|
||||
// sku.setId(bo.getId());
|
||||
// sku.setErpGoodsSkuId(Long.parseLong(bo.getErpGoodsSkuId()));
|
||||
// skuService.updateById(sku);
|
||||
// return success();
|
||||
// }
|
||||
|
||||
@PostMapping(value = "/sku/linkErp")
|
||||
public AjaxResult linkErp(@RequestBody LinkErpGoodsSkuBo bo)
|
||||
{
|
||||
OmsTaoGoodsSku sku = new OmsTaoGoodsSku();
|
||||
sku.setId(bo.getId());
|
||||
sku.setErpGoodsSkuId(Long.parseLong(bo.getErpGoodsSkuId()));
|
||||
skuService.updateById(sku);
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class OmsTaoGoodsSku implements Serializable {
|
|||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* sku所属商品数字id
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@ public class OmsTaoGoodsServiceImpl extends ServiceImpl<OmsTaoGoodsMapper, OmsTa
|
|||
// sku.setTaoGoodsId(goods.getId());
|
||||
sku.setShopId(shopId);
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuNum, sku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
sku.setErpGoodsId(oGoodsSkus.get(0).getErpGoodsId());
|
||||
sku.setErpGoodsSkuId(oGoodsSkus.get(0).getErpSkuId());
|
||||
}
|
||||
|
||||
}
|
||||
// if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
// List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuNum, sku.getOuterId()));
|
||||
// if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
// sku.setErpGoodsId(oGoodsSkus.get(0).getErpGoodsId());
|
||||
// sku.setErpGoodsSkuId(oGoodsSkus.get(0).getErpSkuId());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,13 +85,13 @@ public class OmsTaoGoodsServiceImpl extends ServiceImpl<OmsTaoGoodsMapper, OmsTa
|
|||
// sku.setTaoGoodsId(goods.getId());
|
||||
sku.setShopId(shopId);
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuNum, sku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
sku.setErpGoodsId(oGoodsSkus.get(0).getErpGoodsId());
|
||||
sku.setErpGoodsSkuId(oGoodsSkus.get(0).getErpSkuId());
|
||||
}
|
||||
}
|
||||
// if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
// List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuNum, sku.getOuterId()));
|
||||
// if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
// sku.setErpGoodsId(oGoodsSkus.get(0).getErpGoodsId());
|
||||
// sku.setErpGoodsSkuId(oGoodsSkus.get(0).getErpSkuId());
|
||||
// }
|
||||
// }
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,45 @@
|
|||
package com.qihang.tao.task;
|
||||
|
||||
import com.qihang.common.task.SchedulingConfiguration;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@Log
|
||||
@Component
|
||||
public class CronTaskLoader implements ApplicationRunner {
|
||||
// private static final Logger log = LoggerFactory.getLogger(CronTaskLoader.class);
|
||||
private final SchedulingConfiguration schedulingConfiguration;
|
||||
private final AtomicBoolean appStarted = new AtomicBoolean(false);
|
||||
private final AtomicBoolean initializing = new AtomicBoolean(false);
|
||||
|
||||
public CronTaskLoader(SchedulingConfiguration schedulingConfiguration) {
|
||||
this.schedulingConfiguration = schedulingConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务配置刷新(10分钟刷新一次)
|
||||
*/
|
||||
@Scheduled(fixedDelay = 600000)
|
||||
public void cronTaskConfigRefresh() {
|
||||
if (appStarted.get() && initializing.compareAndSet(false, true)) {
|
||||
log.info("定时调度任务动态加载开始>>>>TAO>>");
|
||||
try {
|
||||
schedulingConfiguration.refresh();
|
||||
} finally {
|
||||
initializing.set(false);
|
||||
}
|
||||
// log.info("定时调度任务动态加载结束<<<<<<");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
if (appStarted.compareAndSet(false, true)) {
|
||||
cronTaskConfigRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.qihang.tao.task;
|
||||
//
|
||||
//import com.qihang.common.task.SchedulingConfiguration;
|
||||
//import lombok.extern.java.Log;
|
||||
//import org.springframework.boot.ApplicationArguments;
|
||||
//import org.springframework.boot.ApplicationRunner;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.concurrent.atomic.AtomicBoolean;
|
||||
//@Log
|
||||
//@Component
|
||||
//public class CronTaskLoader implements ApplicationRunner {
|
||||
//// private static final Logger log = LoggerFactory.getLogger(CronTaskLoader.class);
|
||||
// private final SchedulingConfiguration schedulingConfiguration;
|
||||
// private final AtomicBoolean appStarted = new AtomicBoolean(false);
|
||||
// private final AtomicBoolean initializing = new AtomicBoolean(false);
|
||||
//
|
||||
// public CronTaskLoader(SchedulingConfiguration schedulingConfiguration) {
|
||||
// this.schedulingConfiguration = schedulingConfiguration;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 定时任务配置刷新(10分钟刷新一次)
|
||||
// */
|
||||
// @Scheduled(fixedDelay = 600000)
|
||||
// public void cronTaskConfigRefresh() {
|
||||
// if (appStarted.get() && initializing.compareAndSet(false, true)) {
|
||||
// log.info("定时调度任务动态加载开始>>>>TAO>>");
|
||||
// try {
|
||||
// schedulingConfiguration.refresh();
|
||||
// } finally {
|
||||
// initializing.set(false);
|
||||
// }
|
||||
//// log.info("定时调度任务动态加载结束<<<<<<");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void run(ApplicationArguments args) {
|
||||
// if (appStarted.compareAndSet(false, true)) {
|
||||
// cronTaskConfigRefresh();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -1,30 +1,30 @@
|
|||
package com.qihang.tao.task;
|
||||
|
||||
import com.qihang.common.task.IPollableService;
|
||||
import com.qihang.tao.domain.SysTask;
|
||||
import com.qihang.tao.service.SysTaskService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Log
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class OrderTask implements IPollableService {
|
||||
|
||||
private final SysTaskService taskService;
|
||||
@Override
|
||||
public void poll() {
|
||||
log.info("=======自动任务==TAO===拉取订单========="+ LocalDateTime.now());
|
||||
// System.out.printf("更新TAO订单%s","echo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCronExpression() {
|
||||
SysTask task = taskService.getById(1);
|
||||
// return "0/1 * * * * ?";
|
||||
return task.getCron();
|
||||
}
|
||||
}
|
||||
//package com.qihang.tao.task;
|
||||
//
|
||||
//import com.qihang.common.task.IPollableService;
|
||||
//import com.qihang.tao.domain.SysTask;
|
||||
//import com.qihang.tao.service.SysTaskService;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.extern.java.Log;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//
|
||||
//@Log
|
||||
//@AllArgsConstructor
|
||||
//@Service
|
||||
//public class OrderTask implements IPollableService {
|
||||
//
|
||||
// private final SysTaskService taskService;
|
||||
// @Override
|
||||
// public void poll() {
|
||||
// log.info("=======自动任务==TAO===拉取订单========="+ LocalDateTime.now());
|
||||
//// System.out.printf("更新TAO订单%s","echo");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCronExpression() {
|
||||
// SysTask task = taskService.getById(1);
|
||||
//// return "0/1 * * * * ?";
|
||||
// return task.getCron();
|
||||
// }
|
||||
//}
|
||||
|
|
@ -161,7 +161,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:3}).then(response => {
|
||||
listShop({platform:3}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -756,7 +756,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:6}).then(response => {
|
||||
listShop({platform:6}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||
<el-option
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="商品编码" prop="goodsNum">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNum"
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="物流单号" prop="logisticsCode">
|
||||
<el-input
|
||||
v-model="queryParams.logisticsCode"
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
|
|
@ -403,7 +403,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:6}).then(response => {
|
||||
listShop({platform:6}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -1,255 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="品牌名" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入品牌名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:brand:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['goods:brand:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:brand:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:brand:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="brandList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="品牌名" align="center" prop="name" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:brand:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:brand:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品品牌对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="品牌名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入品牌名" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listBrand, getBrand, delBrand, addBrand, updateBrand } from "@/api/goods/brand";
|
||||
|
||||
export default {
|
||||
name: "Brand",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品品牌表格数据
|
||||
brandList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "品牌名不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品品牌列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listBrand(this.queryParams).then(response => {
|
||||
this.brandList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
status: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品品牌";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getBrand(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品品牌";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateBrand(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addBrand(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品品牌编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delBrand(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/brand/export', {
|
||||
...this.queryParams
|
||||
}, `brand_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="分类id" prop="categoryId">
|
||||
<el-input
|
||||
v-model="queryParams.categoryId"
|
||||
placeholder="请输入分类id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="'属性名'" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入'属性名'"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="固定值color颜色size尺码style款式" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入固定值color颜色size尺码style款式"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:categoryAttribute:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['goods:categoryAttribute:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:categoryAttribute:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:categoryAttribute:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryAttributeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" />
|
||||
<el-table-column label="分类id" align="center" prop="categoryId" />
|
||||
<el-table-column label="类型:0属性1规格" align="center" prop="type" />
|
||||
<el-table-column label="'属性名'" align="center" prop="title" />
|
||||
<el-table-column label="固定值color颜色size尺码style款式" align="center" prop="code" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:categoryAttribute:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:categoryAttribute:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品分类属性对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="分类id" prop="categoryId">
|
||||
<el-input v-model="form.categoryId" placeholder="请输入分类id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="'属性名'" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入'属性名'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="固定值color颜色size尺码style款式" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入固定值color颜色size尺码style款式" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategoryAttribute, getCategoryAttribute, delCategoryAttribute, addCategoryAttribute, updateCategoryAttribute } from "@/api/goods/categoryAttribute";
|
||||
|
||||
export default {
|
||||
name: "CategoryAttribute",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品分类属性表格数据
|
||||
categoryAttributeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
categoryId: null,
|
||||
type: null,
|
||||
title: null,
|
||||
code: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
categoryId: [
|
||||
{ required: true, message: "分类id不能为空", trigger: "blur" }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: "类型:0属性1规格不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品分类属性列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategoryAttribute(this.queryParams).then(response => {
|
||||
this.categoryAttributeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
categoryId: null,
|
||||
type: null,
|
||||
title: null,
|
||||
code: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品分类属性";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCategoryAttribute(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品分类属性";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCategoryAttribute(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCategoryAttribute(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品分类属性编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delCategoryAttribute(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/categoryAttribute/export', {
|
||||
...this.queryParams
|
||||
}, `categoryAttribute_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="属性id" prop="categoryAttributeId">
|
||||
<el-input
|
||||
v-model="queryParams.categoryAttributeId"
|
||||
placeholder="请输入属性id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性值文本" prop="value">
|
||||
<el-input
|
||||
v-model="queryParams.value"
|
||||
placeholder="请输入属性值文本"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="生成SKU的编码" prop="skuCode">
|
||||
<el-input
|
||||
v-model="queryParams.skuCode"
|
||||
placeholder="请输入生成SKU的编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="orderNum">
|
||||
<el-input
|
||||
v-model="queryParams.orderNum"
|
||||
placeholder="请输入排序"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="isDelete">
|
||||
<el-input
|
||||
v-model="queryParams.isDelete"
|
||||
placeholder="请输入是否删除"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:categoryAttributeValue:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['goods:categoryAttributeValue:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:categoryAttributeValue:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:categoryAttributeValue:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryAttributeValueList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键,属性值id" align="center" prop="id" />
|
||||
<el-table-column label="属性id" align="center" prop="categoryAttributeId" />
|
||||
<el-table-column label="属性值文本" align="center" prop="value" />
|
||||
<el-table-column label="生成SKU的编码" align="center" prop="skuCode" />
|
||||
<el-table-column label="排序" align="center" prop="orderNum" />
|
||||
<el-table-column label="是否删除" align="center" prop="isDelete" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:categoryAttributeValue:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:categoryAttributeValue:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品分类属性值对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="属性id" prop="categoryAttributeId">
|
||||
<el-input v-model="form.categoryAttributeId" placeholder="请输入属性id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性值文本" prop="value">
|
||||
<el-input v-model="form.value" placeholder="请输入属性值文本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生成SKU的编码" prop="skuCode">
|
||||
<el-input v-model="form.skuCode" placeholder="请输入生成SKU的编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="orderNum">
|
||||
<el-input v-model="form.orderNum" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入是否删除" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategoryAttributeValue, getCategoryAttributeValue, delCategoryAttributeValue, addCategoryAttributeValue, updateCategoryAttributeValue } from "@/api/goods/categoryAttributeValue";
|
||||
|
||||
export default {
|
||||
name: "CategoryAttributeValue",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品分类属性值表格数据
|
||||
categoryAttributeValueList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
categoryAttributeId: null,
|
||||
value: null,
|
||||
skuCode: null,
|
||||
orderNum: null,
|
||||
isDelete: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
isDelete: [
|
||||
{ required: true, message: "是否删除不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品分类属性值列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategoryAttributeValue(this.queryParams).then(response => {
|
||||
this.categoryAttributeValueList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
categoryAttributeId: null,
|
||||
value: null,
|
||||
skuCode: null,
|
||||
orderNum: null,
|
||||
isDelete: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品分类属性值";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCategoryAttributeValue(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品分类属性值";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCategoryAttributeValue(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCategoryAttributeValue(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品分类属性值编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delCategoryAttributeValue(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/categoryAttributeValue/export', {
|
||||
...this.queryParams
|
||||
}, `categoryAttributeValue_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,351 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="分类编码" prop="number">
|
||||
<el-input
|
||||
v-model="queryParams.number"
|
||||
placeholder="请输入分类编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入分类名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否删除" prop="isDelete">
|
||||
|
||||
<el-select v-model="queryParams.isDelete" placeholder="是否删除" clearable @change="handleQuery">
|
||||
<el-option value="0" label="否"></el-option>
|
||||
<el-option value="1" label="是"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd(null)"
|
||||
v-hasPermi="['goods:category:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['goods:category:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:category:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:category:export']"
|
||||
>导出</el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryList" row-key="id" :tree-props="{children: 'children'}" >
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" /> -->
|
||||
<el-table-column label="分类名称" prop="name" />
|
||||
<el-table-column label="分类编码" align="center" prop="number" />
|
||||
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
|
||||
<el-table-column label="排序值" align="center" prop="sort" />
|
||||
<el-table-column label="图片" align="center" prop="image" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否删除" align="center" prop="isDelete" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.isDelete === 0">正常</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.isDelete === 1">已删除</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['goods:category:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:category:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:category:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- <pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/> -->
|
||||
|
||||
<!-- 添加或修改商品分类对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="上级分类" prop="parentId">
|
||||
<el-input v-model="form.parent" placeholder="" disabled />
|
||||
<!-- <el-select v-model="form.parentId" placeholder="上级分类">
|
||||
<el-option
|
||||
v-for="item in shopList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="分类编码" prop="number">
|
||||
<el-input v-model="form.number" placeholder="请输入分类编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序值" prop="sort">
|
||||
<el-input v-model.number="form.sort" placeholder="请输入排序值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="image">
|
||||
<image-upload v-model="form.image"/>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/goods/category";
|
||||
|
||||
export default {
|
||||
name: "Category",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品分类表格数据
|
||||
categoryList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
number: null,
|
||||
name: null,
|
||||
parentId: null,
|
||||
path: null,
|
||||
sort: null,
|
||||
image: null,
|
||||
isDelete: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
parent:null
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
number: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
buildTree(list, parentId) {
|
||||
let tree = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].parentId === parentId) {
|
||||
let node = {
|
||||
id: list[i].id,
|
||||
name: list[i].name,
|
||||
image:list[i].image,
|
||||
sort:list[i].sort,
|
||||
remark:list[i].remark,
|
||||
isDelete:list[i].isDelete,
|
||||
children: this.buildTree(list, list[i].id)
|
||||
};
|
||||
tree.push(node);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
|
||||
/** 查询商品分类列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = this.buildTree(response.rows,0)
|
||||
console.log("构建后的list",this.categoryList)
|
||||
// this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
number: null,
|
||||
name: null,
|
||||
remark: null,
|
||||
parentId: null,
|
||||
path: null,
|
||||
sort: null,
|
||||
image: null,
|
||||
isDelete: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
if(row){
|
||||
this.form.parent = row.name
|
||||
this.form.parentId = row.id
|
||||
}else{
|
||||
this.form.parent = '一级分类'
|
||||
this.form.parentId = 0
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加商品分类";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCategory(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品分类";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品分类编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delCategory(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/category/export', {
|
||||
...this.queryParams
|
||||
}, `category_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,580 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="108px">
|
||||
|
||||
<el-form-item label="商品分类" prop="categoryId">
|
||||
<treeselect :options="dataList" placeholder="请选择上级菜单" v-model="form.categoryId" style="width:220px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商id" prop="supplierId">
|
||||
<!-- <el-input v-model="form.supplierId" placeholder="请输入供应商id" /> -->
|
||||
<el-select v-model="form.supplierId" filterable placeholder="请选择供应商名称">
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片" prop="image">
|
||||
<image-upload v-model="form.image" :limit="1"/>
|
||||
<el-input v-model="form.image" placeholder="请输入商品图片" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号" prop="number" >
|
||||
<el-input v-model="form.number" placeholder="请输入商品编号" style="width:220px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计采购价格" prop="purPrice">
|
||||
<el-input type="number" v-model.number="form.purPrice" placeholder="请输入预计采购价格" style="width:220px"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="建议批发价" prop="wholePrice">
|
||||
<el-input type="number" v-model.number="form.wholePrice" placeholder="请输入建议批发价" style="width:220px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="建议零售价" prop="retailPrice">
|
||||
<el-input type="number" v-model.number="form.retailPrice" placeholder="请输入建议零售价" style="width:220px"/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="单位名称" prop="unitName">
|
||||
<el-input v-model="form.unitName" placeholder="请输入单位名称" style="width:220px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input v-model="form.barCode" placeholder="请输入条码" style="width:220px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="衣长/裙长/裤长" prop="length">
|
||||
<el-input v-model="form.length" placeholder="请输入衣长/裙长/裤长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="高度/袖长" prop="height">
|
||||
<el-input v-model="form.height" placeholder="请输入高度/袖长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="宽度/胸阔(围)" prop="width">
|
||||
<el-input v-model="form.width" placeholder="请输入宽度/胸阔(围)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="肩阔" prop="width1">
|
||||
<el-input v-model="form.width1" placeholder="请输入肩阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="腰阔" prop="width2">
|
||||
<el-input v-model="form.width2" placeholder="请输入腰阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="臀阔" prop="width3">
|
||||
<el-input v-model="form.width3" placeholder="请输入臀阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="重量" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入重量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="0启用 1禁用" prop="disable">
|
||||
<el-input v-model="form.disable" placeholder="请输入0启用 1禁用" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保质期" prop="period">
|
||||
<el-input v-model="form.period" placeholder="请输入保质期" />
|
||||
</el-form-item> -->
|
||||
|
||||
<!-- <el-form-item label="单位成本" prop="unitCost">
|
||||
<el-input v-model="form.unitCost" placeholder="请输入单位成本" />
|
||||
</el-form-item> -->
|
||||
|
||||
<!-- <el-form-item label="品牌id" prop="brandId">
|
||||
<el-input v-model="form.brandId" placeholder="请输入品牌id" />
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="属性1:季节" prop="attr1">
|
||||
<el-input v-model="form.attr1" placeholder="请输入属性1:季节" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性2:分类" prop="attr2">
|
||||
<el-input v-model="form.attr2" placeholder="请输入属性2:分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性3:风格" prop="attr3">
|
||||
<el-input v-model="form.attr3" placeholder="请输入属性3:风格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性4:年份" prop="attr4">
|
||||
<el-input v-model="form.attr4" placeholder="请输入属性4:年份" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性5:面料" prop="attr5">
|
||||
<el-input v-model="form.attr5" placeholder="请输入属性5:面料" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="外链url" prop="linkUrl">
|
||||
<el-input v-model="form.linkUrl" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="最低库存" prop="lowQty">
|
||||
<el-input v-model="form.lowQty" placeholder="请输入最低库存" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最高库存" prop="highQty">
|
||||
<el-input v-model="form.highQty" placeholder="请输入最高库存" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="发货地" prop="provinces">
|
||||
<el-cascader style="width:250px"
|
||||
size="large"
|
||||
:options="pcaTextArr"
|
||||
v-model="form.provinces">
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品规格">
|
||||
<el-row :gutter="10" class="mb8" >
|
||||
<el-col :span="1.5" style="width: 56px">颜色:</el-col>
|
||||
<el-col :span="20">
|
||||
<treeselect :options="colorList" placeholder="颜色" v-model="form.colorValues" :normalizer="normalizer" @input="onSpecChange" :multiple="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mb8" >
|
||||
|
||||
<el-col :span="24" style="margin-left: 60px;">
|
||||
<ul style=" display: flex;list-style: none;padding: 0;">
|
||||
<li v-for="color in form.colorValues" :key="color" style="margin-left: 20px;">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="uploadImgUrl"
|
||||
:show-file-list="false"
|
||||
:headers="headers"
|
||||
:on-success="(response, file, fileList) =>
|
||||
handleUploadSuccess(
|
||||
response,
|
||||
file,
|
||||
fileList,
|
||||
color
|
||||
)
|
||||
"
|
||||
:before-upload="handleBeforeUpload">
|
||||
<img v-if="form.colorImages[color]" :src="form.colorImages[color]" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
<span>{{form.colorNames[color]}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mb8" >
|
||||
<el-col :span="1.5" style="width: 60px">尺码:</el-col>
|
||||
<el-col :span="20">
|
||||
<treeselect :options="sizeList" placeholder="尺码" v-model="form.sizeValues" :normalizer="normalizer" @input="onSpecChange" :multiple="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mb8" >
|
||||
<el-col :span="1.5" style="width: 60px">款式:</el-col>
|
||||
<el-col :span="20">
|
||||
<treeselect :options="styleList" placeholder="款式" v-model="form.styleValues" :normalizer="normalizer" @input="onSpecChange" :multiple="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form-item>
|
||||
<!-- <el-divider content-position="center" style="margin-left: 98px;">商品信息</el-divider> -->
|
||||
|
||||
<el-table style="margin-left: 108px;" :data="form.specList" :row-class-name="rowSShopOrderItemIndex" ref="sShopOrderItem">
|
||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||
<el-table-column label="颜色" prop="color" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.colorValue" disabled placeholder="颜色" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="尺码" prop="size" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.sizeValue" disabled placeholder="尺码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="款式" prop="style" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.styleValue" disabled placeholder="款式" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格编码" prop="specNum" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.specNum" placeholder="规格编码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预计采购价" prop="purPrice" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.purPrice" placeholder="预计采购价" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="规格图片" prop="colorImage" width="150">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!--<!– <image-upload v-model="scope.row.colorImage" :limit="1" style="width: 100px;height: 100px"/>–>-->
|
||||
<!-- <el-upload-->
|
||||
<!-- class="avatar-uploader"-->
|
||||
<!-- :action="uploadImgUrl"-->
|
||||
<!-- :show-file-list="false"-->
|
||||
<!-- :headers="headers"-->
|
||||
<!-- :file-list="fileList"-->
|
||||
<!-- :on-success="handleUploadSuccess"-->
|
||||
<!-- :before-upload="handleBeforeUpload">-->
|
||||
<!-- <img v-if="scope.row.colorImage" :src="scope.row.colorImage" class="avatar">-->
|
||||
<!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i>-->
|
||||
<!-- </el-upload>-->
|
||||
<!-- </template>-->
|
||||
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" style="margin-left: 108px;margin-top:20px;margin-bottom: 50px;">
|
||||
<el-button type="primary" @click="submitForm">添加商品</el-button>
|
||||
<!-- <el-button @click="cancel">取 消</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import { listCategory } from "@/api/goods/category";
|
||||
import { listCategoryAttributeValue } from "@/api/goods/categoryAttributeValue";
|
||||
import { addGoods } from "@/api/goods/goods";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import {
|
||||
provinceAndCityData,
|
||||
pcTextArr,
|
||||
regionData,
|
||||
pcaTextArr,
|
||||
codeToText,
|
||||
} from "element-china-area-data";
|
||||
|
||||
export default {
|
||||
name: "OrderCreate",
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload",
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
},
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: ["png", "jpg", "jpeg"],
|
||||
uploadList: [],
|
||||
fileList: [],
|
||||
// 表单参数
|
||||
form: {
|
||||
colorValues:undefined,
|
||||
colorImages:{},
|
||||
colorNames:{},
|
||||
sizeValues:undefined,
|
||||
styleValues:undefined,
|
||||
number:'',
|
||||
specList:[],
|
||||
provinces: [],
|
||||
|
||||
},
|
||||
supplierList: [],
|
||||
pcaTextArr,
|
||||
dataList:[{
|
||||
id: 'fruits',
|
||||
label: 'Fruits',
|
||||
children: [],
|
||||
}],
|
||||
// 表单校验
|
||||
rules: {
|
||||
categoryId: [{ required: true, message: '请选择分类' }],
|
||||
supplierId: [{ required: true, message: '请选择供应商' }],
|
||||
name: [{ required: true, message: '商品名不能为空' }],
|
||||
image: [{ required: true, message: '商品图片不能为空' }],
|
||||
number: [{ required: true, message: '商品编码不能为空' }],
|
||||
purPrice: [{ required: true, message: '请填写预计采购价' }],
|
||||
|
||||
},
|
||||
// 子表选中数据
|
||||
checkedSShopOrderItem: [],
|
||||
// 颜色
|
||||
colorList:[],
|
||||
// 尺码
|
||||
sizeList:[],
|
||||
//款式
|
||||
styleList:[],
|
||||
privateData:{}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getCategoryList()
|
||||
listCategoryAttributeValue({categoryAttributeId:114}).then(resp=>{
|
||||
this.colorList = resp.rows
|
||||
})
|
||||
listCategoryAttributeValue({categoryAttributeId:115}).then(resp=>{
|
||||
this.sizeList = resp.rows
|
||||
})
|
||||
listCategoryAttributeValue({categoryAttributeId:116}).then(resp=>{
|
||||
this.styleList = resp.rows
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getRowDate(row){
|
||||
|
||||
},
|
||||
// 上传前loading加载
|
||||
handleBeforeUpload(file) {
|
||||
let isImg = false;
|
||||
if (this.fileType.length) {
|
||||
let fileExtension = "";
|
||||
if (file.name.lastIndexOf(".") > -1) {
|
||||
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
||||
}
|
||||
isImg = this.fileType.some(type => {
|
||||
if (file.type.indexOf(type) > -1) return true;
|
||||
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
isImg = file.type.indexOf("image") > -1;
|
||||
}
|
||||
|
||||
if (!isImg) {
|
||||
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
|
||||
return false;
|
||||
}
|
||||
if (this.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||
if (!isLt) {
|
||||
this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// this.$modal.loading("正在上传图片,请稍候...");
|
||||
// this.number++;
|
||||
},
|
||||
// 文件个数超出
|
||||
handleExceed() {
|
||||
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
|
||||
},
|
||||
// 上传成功回调
|
||||
handleUploadSuccess(response, file,ty, color) {
|
||||
// console.log('====上传成功回调====',file,response)
|
||||
console.log('====上传成功回调====',color,response.url)
|
||||
this.$nextTick(()=>{
|
||||
this.form.colorImages[color] = response.url
|
||||
console.log('=====上传回调赋值=====',this.form.colorImages)
|
||||
})
|
||||
this.form = { ...this.form, colorImages: { ...this.form.colorImages, [color]: response.url } };
|
||||
// if (res.code === 200) {
|
||||
//
|
||||
// this.uploadList.push({ name: res.fileName, url: res.url });
|
||||
// this.uploadedSuccessfully();
|
||||
// } else {
|
||||
// this.number--;
|
||||
// this.$modal.closeLoading();
|
||||
// this.$modal.msgError(res.msg);
|
||||
// this.$refs.imageUpload.handleRemove(file);
|
||||
// this.uploadedSuccessfully();
|
||||
// }
|
||||
},
|
||||
// 删除图片
|
||||
handleDelete(file) {
|
||||
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
||||
if(findex > -1) {
|
||||
this.fileList.splice(findex, 1);
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
}
|
||||
},
|
||||
// 上传失败
|
||||
handleUploadError() {
|
||||
this.$modal.msgError("上传图片失败,请重试");
|
||||
this.$modal.closeLoading();
|
||||
},
|
||||
// 上传结束处理
|
||||
uploadedSuccessfully() {
|
||||
if (this.number > 0 && this.uploadList.length === this.number) {
|
||||
this.fileList = this.fileList.concat(this.uploadList);
|
||||
this.uploadList = [];
|
||||
this.number = 0;
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
},
|
||||
normalizer(node) {
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.value
|
||||
};
|
||||
},
|
||||
buildTree(list, parentId) {
|
||||
let tree = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].parentId === parentId) {
|
||||
let node = {
|
||||
id: list[i].id,
|
||||
label: list[i].name,
|
||||
children: this.buildTree(list, list[i].id)
|
||||
};
|
||||
tree.push(node);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
/** 查询商品分类列表 */
|
||||
getCategoryList() {
|
||||
// this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.dataList = this.buildTree(response.rows,0)
|
||||
// console.log("构建后的list",this.categoryList)
|
||||
// this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
onSpecChange(selected){
|
||||
// console.log('=====选择了=======',selected)
|
||||
// console.log('=======颜色:====',this.form.colorValues)
|
||||
// console.log('=======尺码:====',this.form.sizeValues)
|
||||
// console.log('=======款式:====',this.form.styleValues)
|
||||
|
||||
//组合
|
||||
if(this.form.colorValues){
|
||||
this.form.specList = []
|
||||
// this.form.specList.push()
|
||||
if(this.form.sizeValues && this.form.styleValues){
|
||||
console.log('====颜色、尺码、款式===')
|
||||
this.form.colorValues.forEach(c=>{
|
||||
const color = this.colorList.find(x=>x.id === c)
|
||||
this.form.sizeValues.forEach(s=>{
|
||||
const size = this.sizeList.find(y=>y.id === s)
|
||||
this.form.styleValues.forEach(st=>{
|
||||
const style = this.styleList.find(z=>z.id === st)
|
||||
const spec = {
|
||||
colorId:c,
|
||||
colorValue:color.value,
|
||||
sizeId:s,
|
||||
sizeValue:size.value,
|
||||
styleId:st,
|
||||
styleValue:style.value,
|
||||
specNum:this.form.number+color.skuCode+size.skuCode+style.skuCode
|
||||
}
|
||||
this.form.specList.push(spec)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
}else {
|
||||
// 有一个没有选择
|
||||
if(this.form.sizeValues){
|
||||
console.log('====颜色、尺码===')
|
||||
this.form.colorValues.forEach(c=>{
|
||||
const color = this.colorList.find(x=>x.id === c)
|
||||
this.form.sizeValues.forEach(s=>{
|
||||
const size = this.sizeList.find(y=>y.id === s)
|
||||
const spec = {
|
||||
colorId:c,
|
||||
colorValue:color.value,
|
||||
sizeId:s,
|
||||
sizeValue:size.value,
|
||||
styleId:null,
|
||||
styleValue:'',
|
||||
specNum:this.form.number+color.skuCode+size.skuCode
|
||||
}
|
||||
this.form.specList.push(spec)
|
||||
})
|
||||
})
|
||||
}else if(this.form.styleValues){
|
||||
// 选择了款式
|
||||
console.log('====颜色、款式===')
|
||||
|
||||
}else{
|
||||
console.log('====颜色===')
|
||||
this.form.colorValues.forEach(x=>{
|
||||
const color = this.colorList.find(c=>c.id === x)
|
||||
const spec = {
|
||||
colorId:x,
|
||||
colorValue:color.value,
|
||||
sizeId:null,
|
||||
sizeValue:'',
|
||||
styleId:null,
|
||||
styleValue:'',
|
||||
specNum:this.form.number+color.skuCode
|
||||
}
|
||||
this.form.specList.push(spec)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.form.colorNames = {}
|
||||
this.form.colorValues.forEach(c=>{
|
||||
const color = this.colorList.find(x=>x.id === c)
|
||||
this.form.colorNames[c] = color.value
|
||||
})
|
||||
}else{
|
||||
this.$modal.msgError("必须选择【颜色】")
|
||||
this.form.sizeValues = []
|
||||
this.form.styleValues = []
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
/** ${subTable.functionName}序号 */
|
||||
rowSShopOrderItemIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1;
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log('=====添加商品===',this.form)
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
|
||||
// 判断规格 specList
|
||||
if(!this.form.specList || this.form.specList.length === 0){
|
||||
this.$modal.msgError("请添加商品规格")
|
||||
return
|
||||
}else{
|
||||
for(let i=0;i<this.form.specList.length;i++){
|
||||
const sp = this.form.specList[i]
|
||||
if(!sp.specNum){
|
||||
this.$modal.msgError("商品规格编码不能为空")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addGoods(this.form).then(response => {
|
||||
this.$modal.msgSuccess("商品添加成功");
|
||||
// 调用全局挂载的方法,关闭当前标签页
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push('/goods/goods_list');
|
||||
});
|
||||
// this.form.province = this.form.provinces[0]
|
||||
// this.form.city = this.form.provinces[1]
|
||||
// this.form.town = this.form.provinces[2]
|
||||
|
||||
// if(this.form.itemList && this.form.itemList.length >0){
|
||||
// this.form.itemList.forEach(x=>{
|
||||
// if(!x.goodsId || !x.quantity){
|
||||
// this.$modal.msgError("请完善商品信息");
|
||||
// return
|
||||
// }
|
||||
// })
|
||||
|
||||
// console.log('======创建订单=====',this.form)
|
||||
// addOrder(this.form).then(response => {
|
||||
// this.$modal.msgSuccess("订单创建成功");
|
||||
// // 调用全局挂载的方法,关闭当前标签页
|
||||
// this.$store.dispatch("tagsView/delView", this.$route);
|
||||
// this.$router.push('/sale/order/list');
|
||||
// });
|
||||
|
||||
// }else{
|
||||
// this.$modal.msgError("请添加商品");
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 78px;
|
||||
height: 78px;
|
||||
line-height: 78px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 78px;
|
||||
height: 78px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="商品ID" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.goodsId"
|
||||
placeholder="请输入商品ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码" prop="goodsNumber">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNumber"
|
||||
placeholder="请输入商品编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格ID" prop="specId">
|
||||
<el-input
|
||||
v-model="queryParams.specId"
|
||||
placeholder="请输入商品规格ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格编码" prop="specNumber">
|
||||
<el-input
|
||||
v-model="queryParams.specNumber"
|
||||
placeholder="请输入规格编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['api:goodsInventory:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsInventoryList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" />-->
|
||||
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||
<el-table-column label="商品编码" align="center" prop="goodsNumber" />
|
||||
<el-table-column label="规格ID" align="center" prop="specId" />
|
||||
<el-table-column label="规格编码" align="center" prop="specNumber" />
|
||||
<el-table-column label="当前库存" align="center" prop="currentQty" />
|
||||
<el-table-column label="锁定库存" align="center" prop="lockedQty" />
|
||||
<!-- <el-table-column label="0正常 1删除" align="center" prop="isDelete" />-->
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新人" align="center" prop="updateBy" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['api:goodsInventory:edit']"
|
||||
>库存详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品库存对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
<el-table :data="erpGoodsInventoryDetailList" :row-class-name="rowErpGoodsInventoryDetailIndex" ref="erpGoodsInventoryDetail">
|
||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||
<el-table-column label="入库时间" prop="createTime" width="180"></el-table-column>
|
||||
<el-table-column label="入库数量" prop="inQty" width="80">
|
||||
</el-table-column>
|
||||
<el-table-column label="入库仓位id" prop="inLocation" width="100"></el-table-column>
|
||||
<el-table-column label="入库前数量" prop="originQty" width="100">
|
||||
</el-table-column>
|
||||
<el-table-column label="当前库存" prop="currentQty" width="100">
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" width="150">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" prop="createBy" width="150">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGoodsInventory, getGoodsInventory, delGoodsInventory, addGoodsInventory, updateGoodsInventory } from "@/api/goods/goodsInventory";
|
||||
|
||||
export default {
|
||||
name: "GoodsInventory",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 子表选中数据
|
||||
checkedErpGoodsInventoryDetail: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品库存表格数据
|
||||
goodsInventoryList: [],
|
||||
// 商品库存明细表格数据
|
||||
erpGoodsInventoryDetailList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsId: null,
|
||||
goodsNumber: null,
|
||||
specId: null,
|
||||
specNumber: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsId: [
|
||||
{ required: true, message: "商品id不能为空", trigger: "blur" }
|
||||
],
|
||||
specId: [
|
||||
{ required: true, message: "商品规格id不能为空", trigger: "blur" }
|
||||
],
|
||||
specNumber: [
|
||||
{ required: true, message: "规格编码不能为空", trigger: "blur" }
|
||||
],
|
||||
currentQty: [
|
||||
{ required: true, message: "当前库存不能为空", trigger: "blur" }
|
||||
],
|
||||
lockedQty: [
|
||||
{ required: true, message: "锁定库存不能为空", trigger: "blur" }
|
||||
],
|
||||
isDelete: [
|
||||
{ required: true, message: "0正常 1删除不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
updateTime: [
|
||||
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品库存列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoodsInventory(this.queryParams).then(response => {
|
||||
this.goodsInventoryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
goodsId: null,
|
||||
goodsNumber: null,
|
||||
specId: null,
|
||||
specNumber: null,
|
||||
currentQty: null,
|
||||
lockedQty: null,
|
||||
isDelete: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null
|
||||
};
|
||||
this.erpGoodsInventoryDetailList = [];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getGoodsInventory(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.erpGoodsInventoryDetailList = response.data.erpGoodsInventoryDetailList;
|
||||
this.open = true;
|
||||
this.title = "商品库存详情";
|
||||
});
|
||||
},
|
||||
/** 商品库存明细序号 */
|
||||
rowErpGoodsInventoryDetailIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1;
|
||||
},
|
||||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('api/goodsInventory/export', {
|
||||
...this.queryParams
|
||||
}, `goodsInventory_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,515 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
|
||||
<el-form-item label="商品名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号" prop="number">
|
||||
<el-input
|
||||
v-model="queryParams.number"
|
||||
placeholder="请输入商品编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="商品分类" prop="categoryId">
|
||||
<!-- <el-input
|
||||
v-model="queryParams.categoryId"
|
||||
placeholder="请输入商品分类ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/> -->
|
||||
<treeselect :options="categoryTree" placeholder="请选择上级菜单" v-model="queryParams.categoryId" style="width: 230px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="supplierId">
|
||||
<el-select v-model="queryParams.supplierId" filterable placeholder="请选择供应商名称">
|
||||
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input
|
||||
v-model="queryParams.barCode"
|
||||
placeholder="请输入条码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="状态" prop="disable">
|
||||
<el-input
|
||||
v-model="queryParams.disable"
|
||||
placeholder="请输入0启用 1禁用"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:goods:add']"
|
||||
>添加商品</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['goods:goods:edit']"
|
||||
>导入商品</el-button>
|
||||
</el-col>
|
||||
<!--
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:goods:remove']"
|
||||
>删除</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:goods:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="商品名称" align="center" prop="name" />
|
||||
<el-table-column label="商品图片" align="center" prop="image" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编号" align="center" prop="number" />
|
||||
<!-- <el-table-column label="单位名称" align="center" prop="unitName" /> -->
|
||||
<el-table-column label="商品分类" align="center" prop="categoryId" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small">{{categoryList.find(x=>x.id === scope.row.categoryId).name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="条码" align="center" prop="barCode" /> -->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
|
||||
<!-- <el-table-column label="衣长/裙长/裤长" align="center" prop="length" />
|
||||
<el-table-column label="高度/袖长" align="center" prop="height" />
|
||||
<el-table-column label="宽度/胸阔(围)" align="center" prop="width" />
|
||||
<el-table-column label="肩阔" align="center" prop="width1" />
|
||||
<el-table-column label="腰阔" align="center" prop="width2" />
|
||||
<el-table-column label="臀阔" align="center" prop="width3" />
|
||||
<el-table-column label="重量" align="center" prop="weight" />
|
||||
<el-table-column label="0启用 1禁用" align="center" prop="disable" />
|
||||
<el-table-column label="保质期" align="center" prop="period" /> -->
|
||||
<el-table-column label="预计采购价格" align="center" prop="purPrice" />
|
||||
<el-table-column label="建议批发价" align="center" prop="wholePrice" />
|
||||
<el-table-column label="建议零售价" align="center" prop="retailPrice" />
|
||||
<!-- <el-table-column label="单位成本" align="center" prop="unitCost" /> -->
|
||||
<el-table-column label="供应商" align="center" prop="supplierId" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small">{{supplierList.find(x=>x.id === scope.row.supplierId).name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="品牌id" align="center" prop="brandId" />
|
||||
<el-table-column label="属性1:季节" align="center" prop="attr1" />
|
||||
<el-table-column label="属性2:分类" align="center" prop="attr2" />
|
||||
<el-table-column label="属性3:风格" align="center" prop="attr3" />
|
||||
<el-table-column label="属性4:年份" align="center" prop="attr4" />
|
||||
<el-table-column label="属性5:面料" align="center" prop="attr5" />
|
||||
<el-table-column label="外链url" align="center" prop="linkUrl" />
|
||||
<el-table-column label="最低库存" align="center" prop="lowQty" />
|
||||
<el-table-column label="最高库存" align="center" prop="highQty" /> -->
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.status === 1">销售中</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.status === 2">已下架</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:goods:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:goods:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<!-- 导入ERP商品 -->
|
||||
<el-dialog title="导入商品" :visible.sync="importOpen" width="400px" append-to-body>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:headers="headers"
|
||||
drag
|
||||
action="/dev-api/tao/order/order_import"
|
||||
accept="xlsx"
|
||||
multiple >
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改商品管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="商品名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片地址" prop="image">
|
||||
<image-upload v-model="form.image"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号" prop="number">
|
||||
<el-input v-model="form.number" placeholder="请输入商品编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="unitName">
|
||||
<el-input v-model="form.unitName" placeholder="请输入单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类ID" prop="categoryId">
|
||||
<el-input v-model="form.categoryId" placeholder="请输入商品分类ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input v-model="form.barCode" placeholder="请输入条码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="衣长/裙长/裤长" prop="length">
|
||||
<el-input v-model="form.length" placeholder="请输入衣长/裙长/裤长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="高度/袖长" prop="height">
|
||||
<el-input v-model="form.height" placeholder="请输入高度/袖长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="宽度/胸阔(围)" prop="width">
|
||||
<el-input v-model="form.width" placeholder="请输入宽度/胸阔(围)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="肩阔" prop="width1">
|
||||
<el-input v-model="form.width1" placeholder="请输入肩阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="腰阔" prop="width2">
|
||||
<el-input v-model="form.width2" placeholder="请输入腰阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="臀阔" prop="width3">
|
||||
<el-input v-model="form.width3" placeholder="请输入臀阔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="重量" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入重量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="0启用 1禁用" prop="disable">
|
||||
<el-input v-model="form.disable" placeholder="请输入0启用 1禁用" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保质期" prop="period">
|
||||
<el-input v-model="form.period" placeholder="请输入保质期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预计采购价格" prop="purPrice">
|
||||
<el-input v-model="form.purPrice" placeholder="请输入预计采购价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="建议批发价" prop="wholePrice">
|
||||
<el-input v-model="form.wholePrice" placeholder="请输入建议批发价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="建议零售价" prop="retailPrice">
|
||||
<el-input v-model="form.retailPrice" placeholder="请输入建议零售价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位成本" prop="unitCost">
|
||||
<el-input v-model="form.unitCost" placeholder="请输入单位成本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商id" prop="supplierId">
|
||||
<el-input v-model="form.supplierId" placeholder="请输入供应商id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌id" prop="brandId">
|
||||
<el-input v-model="form.brandId" placeholder="请输入品牌id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性1:季节" prop="attr1">
|
||||
<el-input v-model="form.attr1" placeholder="请输入属性1:季节" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性2:分类" prop="attr2">
|
||||
<el-input v-model="form.attr2" placeholder="请输入属性2:分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性3:风格" prop="attr3">
|
||||
<el-input v-model="form.attr3" placeholder="请输入属性3:风格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性4:年份" prop="attr4">
|
||||
<el-input v-model="form.attr4" placeholder="请输入属性4:年份" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性5:面料" prop="attr5">
|
||||
<el-input v-model="form.attr5" placeholder="请输入属性5:面料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外链url" prop="linkUrl">
|
||||
<el-input v-model="form.linkUrl" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最低库存" prop="lowQty">
|
||||
<el-input v-model="form.lowQty" placeholder="请输入最低库存" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最高库存" prop="highQty">
|
||||
<el-input v-model="form.highQty" placeholder="请输入最高库存" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGoods, getGoods, delGoods, addGoods, updateGoods } from "@/api/goods/goods";
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import { listCategory } from "@/api/goods/category";
|
||||
import {getToken} from "@/utils/auth";
|
||||
export default {
|
||||
name: "Goods",
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
importOpen:false,
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() },
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品管理表格数据
|
||||
goodsList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
image: null,
|
||||
number: null,
|
||||
unitName: null,
|
||||
categoryId: null,
|
||||
barCode: null,
|
||||
status: null,
|
||||
disable: null,
|
||||
supplierId: null,
|
||||
brandId: null,
|
||||
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
categoryList: [],
|
||||
categoryTree: [],
|
||||
// 表单校验
|
||||
rules: {
|
||||
status: [
|
||||
{ required: true, message: "状态1销售中2已下架不能为空", trigger: "change" }
|
||||
],
|
||||
length: [
|
||||
{ required: true, message: "衣长/裙长/裤长不能为空", trigger: "blur" }
|
||||
],
|
||||
height: [
|
||||
{ required: true, message: "高度/袖长不能为空", trigger: "blur" }
|
||||
],
|
||||
width: [
|
||||
{ required: true, message: "宽度/胸阔(围)不能为空", trigger: "blur" }
|
||||
],
|
||||
width1: [
|
||||
{ required: true, message: "肩阔不能为空", trigger: "blur" }
|
||||
],
|
||||
width2: [
|
||||
{ required: true, message: "腰阔不能为空", trigger: "blur" }
|
||||
],
|
||||
width3: [
|
||||
{ required: true, message: "臀阔不能为空", trigger: "blur" }
|
||||
],
|
||||
weight: [
|
||||
{ required: true, message: "重量不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// listCategory(this.queryParams).then(response => {
|
||||
// this.categoryList = response.rows
|
||||
// this.categoryTree = this.buildTree(response.rows,0)
|
||||
// });
|
||||
// listSupplier({}).then(response => {
|
||||
// this.supplierList = response.rows;
|
||||
// // this.supplierLoading = false;
|
||||
// });
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
normalizer(node) {
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.value
|
||||
};
|
||||
},
|
||||
buildTree(list, parentId) {
|
||||
let tree = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].parentId === parentId) {
|
||||
let node = {
|
||||
id: list[i].id,
|
||||
label: list[i].name,
|
||||
children: this.buildTree(list, list[i].id)
|
||||
};
|
||||
tree.push(node);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
/** 查询商品管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoods(this.queryParams).then(response => {
|
||||
this.goodsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAdd(){
|
||||
this.$router.push('/goods/create');
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
image: null,
|
||||
number: null,
|
||||
unitName: null,
|
||||
categoryId: null,
|
||||
barCode: null,
|
||||
remark: null,
|
||||
status: null,
|
||||
length: null,
|
||||
height: null,
|
||||
width: null,
|
||||
width1: null,
|
||||
width2: null,
|
||||
width3: null,
|
||||
weight: null,
|
||||
disable: null,
|
||||
period: null,
|
||||
purPrice: null,
|
||||
wholePrice: null,
|
||||
retailPrice: null,
|
||||
unitCost: null,
|
||||
supplierId: null,
|
||||
brandId: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: null,
|
||||
attr5: null,
|
||||
linkUrl: null,
|
||||
lowQty: null,
|
||||
highQty: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品管理编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delGoods(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/goods/export', {
|
||||
...this.queryParams
|
||||
}, `goods_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleImport(){
|
||||
this.importOpen = true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="天猫" name="taoGoods">
|
||||
<goods-tao></goods-tao>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="京东" name="jdGoods" lazy>
|
||||
<goods-jd></goods-jd>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="抖店" name="douOrder" lazy>
|
||||
<goods-dou></goods-dou>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="拼多多" name="pddOrder" lazy>
|
||||
<goods-pdd></goods-pdd>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GoodsTao from "@/views/tao/goods/index";
|
||||
import GoodsJd from "@/views/jd/goods/index";
|
||||
import GoodsDou from "@/views/dou/goods/index";
|
||||
import GoodsPdd from "@/views/pdd/goods/index";
|
||||
export default {
|
||||
name: "Goods",
|
||||
components:{GoodsTao,GoodsJd,GoodsDou,GoodsPdd},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'taoGoods'
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,297 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||
<el-form-item label="ERP商品ID" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.erpGoodsId"
|
||||
placeholder="请输入ERP商品ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP商品SKUID" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.erpSkuId"
|
||||
placeholder="请输入ERP商品SKUID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="SKU编码" prop="skuNum">
|
||||
<el-input
|
||||
v-model="queryParams.skuNum"
|
||||
placeholder="请输入SKU编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:goods:add']"
|
||||
>添加商品SKU</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['goods:goods:edit']"
|
||||
>导入商品SKU</el-button>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsSpecList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<el-table-column label="ERP Sku ID" align="center" prop="erpSkuId" />
|
||||
<el-table-column label="ERP商品ID" align="center" prop="erpGoodsId" />
|
||||
<el-table-column label="Sku名" align="center" prop="skuName" />
|
||||
<el-table-column label="Sku编码" align="center" prop="skuNum" />
|
||||
<!-- <el-table-column label="颜色" align="center" prop="colorValue" />-->
|
||||
<!-- <el-table-column label="颜色图片" align="center" prop="colorImage" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <image-preview :src="scope.row.colorImage" :width="50" :height="50"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column label="尺码" align="center" prop="sizeValue" />-->
|
||||
<!-- <el-table-column label="款式" align="center" prop="styleValue" />-->
|
||||
<el-table-column label="Tag" align="center" prop="tag" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.tag">{{ scope.row.tag }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.status===1">上架中</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.status===2">已下架</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['api:goodsSpec:edit']"
|
||||
>修改</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品规格库存管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="SKU名" prop="skuName">
|
||||
<el-input v-model="form.skuName" placeholder="请输入SKU名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="SKU编码" prop="skuNum">
|
||||
<el-input v-model="form.skuNum" placeholder="请输入SKU编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="颜色" prop="colorValue">
|
||||
<el-input v-model="form.colorValue" placeholder="请输入颜色值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="colorImage">
|
||||
<image-upload v-model="form.colorImage" :limit="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="尺码" prop="sizeValue">
|
||||
<el-input v-model="form.sizeValue" placeholder="请输入尺码值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="款式" prop="styleValue">
|
||||
<el-input v-model="form.styleValue" placeholder="请输入款式值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP商品ID" prop="erpGoodsId">
|
||||
<el-input type="number" v-model.number="form.erpGoodsId" placeholder="请输入ERP商品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP商品SkuID" prop="erpSkuId">
|
||||
<el-input type="number" v-model.number="form.erpSkuId" placeholder="请输入ERP商品SkuID" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 导入ERP商品sku -->
|
||||
<el-dialog title="导入商品SKU" :visible.sync="importOpen" width="400px" append-to-body>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:headers="headers"
|
||||
drag
|
||||
action="/dev-api/api/oms-api/goods/goods_sku_import"
|
||||
accept="xlsx"
|
||||
multiple >
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listGoodsSpec, getGoodsSpec, updateGoodsSpec, addGoodsSpec} from "@/api/goods/goodsSpec";
|
||||
import {getToken} from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
name: "GoodsSpec",
|
||||
data() {
|
||||
return {
|
||||
importOpen:false,
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() },
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品规格库存管理表格数据
|
||||
goodsSpecList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
erpGoodsId: null,
|
||||
erpSkuId: null,
|
||||
skuName: null,
|
||||
skuNum: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
skuName: [{ required: true, message: "SKU编码不能为空", trigger: "blur" }],
|
||||
skuNum: [{ required: true, message: "SKU名称不能为空", trigger: "blur" }],
|
||||
erpGoodsId: [{ required: true, message: "SerpGoodsId不能为空", trigger: "blur" }],
|
||||
erpSkuId: [{ required: true, message: "erpSkuId不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品规格库存管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoodsSpec(this.queryParams).then(response => {
|
||||
this.goodsSpecList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
goodsId: null,
|
||||
skuName: null,
|
||||
skuNum: null,
|
||||
colorValue: null,
|
||||
colorImage: null,
|
||||
sizeValue: null,
|
||||
styleValue: null,
|
||||
erpGoodsId: null,
|
||||
erpSkuId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getGoodsSpec(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.disable = response.data.disable+''
|
||||
this.open = true;
|
||||
this.title = "修改商品规格库存管理";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateGoodsSpec(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}else{
|
||||
addGoodsSpec(this.form).then(response => {
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleAdd(){
|
||||
this.open = true
|
||||
},
|
||||
handleImport(){
|
||||
this.importOpen = true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -176,7 +176,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:2}).then(response => {
|
||||
listShop({platform:2}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:3}).then(response => {
|
||||
listShop({platform:3}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:2}).then(response => {
|
||||
listShop({platform:2}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:4}).then(response => {
|
||||
listShop({platform:4}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -882,7 +882,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:5}).then(response => {
|
||||
listShop({platform:5}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="拼多多商品id" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.goodsId"
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="商品编码" prop="goodsNumber">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNumber"
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="快递单号" prop="trackingNumber">
|
||||
<el-input
|
||||
v-model="queryParams.trackingNumber"
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
</el-table-column> -->
|
||||
<el-table-column label="备注" align="center" prop="describe" />
|
||||
<el-table-column label="退货说明" align="center" prop="remark" />
|
||||
|
||||
|
||||
<!-- <el-table-column label="erp退货单号" align="center" prop="erpOrderReturnNum" /> -->
|
||||
<!-- <el-table-column label="erp退货单id" align="center" prop="erpOrderReturnId" /> -->
|
||||
<el-table-column label="标记" align="center" prop="sign" />
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
|
|
@ -409,7 +409,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:5}).then(response => {
|
||||
listShop({platform:5}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:6}).then(response => {
|
||||
listShop({platform:6}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
@ -260,7 +260,7 @@ export default {
|
|||
if(response.code === 1401) {
|
||||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
// isRelogin.show = false;
|
||||
this.$router.push({path:"/shop/shop_list",query:{type:6}})
|
||||
this.$router.push({path:"/shop/shop_list",query:{platform:6}})
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
// })
|
||||
|
|
|
|||
|
|
@ -1,503 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!-- <el-form-item label="平台" prop="shopType">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.shopType"-->
|
||||
<!-- placeholder="请输入平台"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.shopId"-->
|
||||
<!-- placeholder="请输入店铺"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<el-select v-model="form.shopId" filterable r placeholder="搜索店铺" >
|
||||
<el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 1">1688</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 2">视频号小店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 3">京东</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 4">淘系店铺</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 5">拼多多</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 6">抖店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 7">小红书</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 8">快手小店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 99">其他</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码" prop="goodsNum">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNum"
|
||||
placeholder="请输入商品编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入商品标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="发布日期" prop="publishTime">-->
|
||||
<!-- <el-date-picker clearable-->
|
||||
<!-- v-model="queryParams.publishTime"-->
|
||||
<!-- type="date"-->
|
||||
<!-- value-format="yyyy-MM-dd"-->
|
||||
<!-- placeholder="请选择发布日期">-->
|
||||
<!-- </el-date-picker>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['shop:goods:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handlePull"
|
||||
v-hasPermi="['pdd:order:remove']"
|
||||
>API拉取店铺商品</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- v-hasPermi="['shop:goods:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- @click="handleDelete"-->
|
||||
<!-- v-hasPermi="['shop:goods:remove']"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-download"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- v-hasPermi="['shop:goods:export']"-->
|
||||
<!-- >导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="序号" type="index" />
|
||||
<el-table-column label="网店商品ID" align="center" prop="goodsId" />
|
||||
<el-table-column label="店铺" align="center" prop="shopId" />
|
||||
<el-table-column label="商品编码" align="center" prop="goodsNum" />
|
||||
<el-table-column label="商品标题" align="center" prop="title" />
|
||||
<el-table-column label="主图" align="center" prop="thumbUrl" >
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 70px; height: 70px" :src="scope.row.thumbUrl"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="累计销量" align="center" prop="totalSales" />
|
||||
<el-table-column label="发布日期" align="center" prop="publishTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shop:goods:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shop:goods:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改店铺商品对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="平台商品ID" prop="goodsId">
|
||||
<el-input v-model="form.goodsId" placeholder="请输入平台商品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Erp商品ID" prop="erpGoodsId">
|
||||
<el-input v-model="form.erpGoodsId" placeholder="请输入Erp商品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<!-- <el-input v-model="form.shopId" placeholder="请输入${comment}" />-->
|
||||
<el-select v-model="form.shopId" filterable r placeholder="搜索店铺" >
|
||||
<el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.id">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 1">1688</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 2">视频号小店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 3">京东</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 4">淘系店铺</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 5">拼多多</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 6">抖店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 7">小红书</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 8">快手小店</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.type === 99">其他</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码" prop="goodsNum">
|
||||
<el-input v-model="form.goodsNum" placeholder="请输入商品编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参考价格" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入参考价格,返回价格区间,可能为空" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入商品标题" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="${comment}" prop="remark">-->
|
||||
<!-- <el-input v-model="form.remark" placeholder="请输入${comment}" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="主图URL" prop="thumbUrl">
|
||||
<el-input v-model="form.thumbUrl" placeholder="请输入主图" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="商品图片json" prop="imageUrl">-->
|
||||
<!-- <el-input v-model="form.imageUrl" type="textarea" placeholder="请输入内容" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="${comment}" prop="isMoreSku">-->
|
||||
<!-- <el-input v-model="form.isMoreSku" placeholder="请输入${comment}" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="${comment}" prop="isOnsale">-->
|
||||
<!-- <el-input v-model="form.isOnsale" placeholder="请输入${comment}" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="累计销量" prop="totalSales">-->
|
||||
<!-- <el-input v-model="form.totalSales" placeholder="请输入累计销量" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="发布日期" prop="publishTime">-->
|
||||
<!-- <el-date-picker clearable-->
|
||||
<!-- v-model="form.publishTime"-->
|
||||
<!-- type="date"-->
|
||||
<!-- value-format="yyyy-MM-dd"-->
|
||||
<!-- placeholder="请选择发布日期">-->
|
||||
<!-- </el-date-picker>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-divider content-position="center">商品SKU信息</el-divider>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddSShopGoodsSku">添加</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteSShopGoodsSku">删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="sShopGoodsSkuList" :row-class-name="rowSShopGoodsSkuIndex" @selection-change="handleSShopGoodsSkuSelectionChange" ref="sShopGoodsSku">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||
<el-table-column label="平台商品ID" prop="goodsId" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsId" placeholder="请输入平台商品ID" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台SkuId" prop="skuId" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.skuId" placeholder="请输入平台SkuId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="sku编码" prop="outerId" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.outerId" placeholder="请输入sku编码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="建议零售价" prop="retailPrice" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.retailPrice" placeholder="请输入建议零售价" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGoods, getGoods, delGoods, addGoods, updateGoods } from "@/api/shop/goods";
|
||||
import {listShop} from "@/api/shop/shop";
|
||||
|
||||
export default {
|
||||
name: "Goods",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 子表选中数据
|
||||
checkedSShopGoodsSku: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 店铺商品表格数据
|
||||
goodsList: [],
|
||||
// ${subTable.functionName}表格数据
|
||||
sShopGoodsSkuList: [],
|
||||
shopList:[],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsId: null,
|
||||
erpGoodsId: null,
|
||||
shopId: null,
|
||||
shopType: null,
|
||||
goodsNum: null,
|
||||
goodsName: null,
|
||||
price: null,
|
||||
title: null,
|
||||
thumbUrl: null,
|
||||
imageUrl: null,
|
||||
isMoreSku: null,
|
||||
isOnsale: null,
|
||||
totalSales: null,
|
||||
publishTime: null,
|
||||
createTime: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsId: [{ required: true, message: "平台商品ID不能为空", trigger: "blur" }],
|
||||
shopId: [{ required: true, message: "请选择店铺", trigger: "blur" }],
|
||||
goodsNum: [{ required: true, message: "商品编码不能为空", trigger: "change" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// console.log('url参数:',this.$route.query.shopType)
|
||||
// if(this.$route.query.shopType) {
|
||||
// this.queryParams.shopType = this.$route.query.shopType
|
||||
listShop({type:this.queryParams.shopType}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
// }
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询店铺商品列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoods(this.queryParams).then(response => {
|
||||
this.goodsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
goodsId: null,
|
||||
erpGoodsId: null,
|
||||
shopId: null,
|
||||
shopType: null,
|
||||
goodsNum: null,
|
||||
goodsName: null,
|
||||
price: null,
|
||||
title: null,
|
||||
remark: null,
|
||||
thumbUrl: null,
|
||||
imageUrl: null,
|
||||
isMoreSku: null,
|
||||
isOnsale: null,
|
||||
totalSales: null,
|
||||
publishTime: null,
|
||||
createTime: null
|
||||
};
|
||||
this.sShopGoodsSkuList = [];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加店铺商品";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getGoods(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.sShopGoodsSkuList = response.data.sShopGoodsSkuList;
|
||||
this.open = true;
|
||||
this.title = "修改店铺商品";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.sShopGoodsSkuList = this.sShopGoodsSkuList;
|
||||
if (this.form.id != null) {
|
||||
updateGoods(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addGoods(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除店铺商品编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delGoods(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** ${subTable.functionName}序号 */
|
||||
rowSShopGoodsSkuIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1;
|
||||
},
|
||||
/** ${subTable.functionName}添加按钮操作 */
|
||||
handleAddSShopGoodsSku() {
|
||||
let obj = {};
|
||||
obj.goodsId = "";
|
||||
obj.skuId = "";
|
||||
obj.spec = "";
|
||||
obj.erpGoodsSpecId = "";
|
||||
obj.erpGoodsId = "";
|
||||
obj.erpGoodsSpecCode = "";
|
||||
obj.skuQuantity = "";
|
||||
obj.consignPrice = "";
|
||||
obj.outerId = "";
|
||||
obj.outerGoodsId = "";
|
||||
obj.price = "";
|
||||
obj.retailPrice = "";
|
||||
obj.amountOnSale = "";
|
||||
obj.isSkuOnsale = "";
|
||||
obj.cargoNumber = "";
|
||||
obj.attributes = "";
|
||||
this.sShopGoodsSkuList.push(obj);
|
||||
},
|
||||
/** ${subTable.functionName}删除按钮操作 */
|
||||
handleDeleteSShopGoodsSku() {
|
||||
if (this.checkedSShopGoodsSku.length == 0) {
|
||||
this.$modal.msgError("请先选择要删除的${subTable.functionName}数据");
|
||||
} else {
|
||||
const sShopGoodsSkuList = this.sShopGoodsSkuList;
|
||||
const checkedSShopGoodsSku = this.checkedSShopGoodsSku;
|
||||
this.sShopGoodsSkuList = sShopGoodsSkuList.filter(function(item) {
|
||||
return checkedSShopGoodsSku.indexOf(item.index) == -1
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 复选框选中数据 */
|
||||
handleSShopGoodsSkuSelectionChange(selection) {
|
||||
this.checkedSShopGoodsSku = selection.map(item => item.index)
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('shop/goods/export', {
|
||||
...this.queryParams
|
||||
}, `goods_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,341 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="店铺名" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入店铺名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择平台" clearable>
|
||||
<el-option
|
||||
v-for="item in typeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['shop:shop:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['shop:shop:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['shop:shop:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="shopList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="店铺ID" align="center" prop="id" />
|
||||
<el-table-column label="店铺名" align="center" prop="name" />
|
||||
<el-table-column label="平台" align="center" prop="type" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag >{{typeList.find(x=>x.id === scope.row.type).name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺ID" align="center" prop="sellerId" />
|
||||
<el-table-column label="accessToken" align="center" prop="accessToken" />
|
||||
<el-table-column label="描述" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-s-goods"
|
||||
size="mini"
|
||||
@click="handleGoodsList(scope.row)"
|
||||
>店铺商品管理</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="handleLogistics(scope.row)"
|
||||
>快递公司库</el-button>
|
||||
|
||||
<el-row>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shop:shop:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shop:shop:remove']"
|
||||
>删除</el-button>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改店铺对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="店铺名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入店铺名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="平台" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择平台">
|
||||
<el-option
|
||||
v-for="item in typeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="卖家Id" prop="sellerId">
|
||||
<el-input v-model="form.sellerId" placeholder="请输入卖家Id名" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listShop,listPlatform, getShop, delShop, addShop, updateShop } from "@/api/shop/shop";
|
||||
|
||||
export default {
|
||||
name: "Shop",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 店铺表格数据
|
||||
shopList: [],
|
||||
typeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
apiOpen: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
type:null
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "店铺名不能为空", trigger: "blur" }],
|
||||
type: [{ required: true, message: "请选择平台", trigger: "change" }],
|
||||
sellerId: [{ required: true, message: "不能为空", trigger: "change" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listPlatform().then(res => {
|
||||
this.typeList = res.rows;
|
||||
})
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询店铺列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listShop(this.queryParams).then(response => {
|
||||
this.shopList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.apiOpen = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
nickName: null,
|
||||
ename: null,
|
||||
company: null,
|
||||
type: null,
|
||||
url: null,
|
||||
orderNum: null,
|
||||
isDelete: null,
|
||||
isShow: null,
|
||||
modifyOn: null,
|
||||
remark: null,
|
||||
sellerUserId: null,
|
||||
sellerUserIdStr: null,
|
||||
sessionKey: null,
|
||||
appkey: null,
|
||||
appSercet: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加店铺";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getShop(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.$nextTick(()=>{
|
||||
this.form.type = response.data.type+'';
|
||||
})
|
||||
|
||||
this.open = true;
|
||||
this.title = "修改店铺";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateShop(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.apiOpen = false
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addShop(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除店铺编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delShop(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleGoodsList(row){
|
||||
console.log('=======商品list=====',row)
|
||||
if(row.type === 1){
|
||||
this.$router.push({path:'/shop/goods/tao_goods_list',query:{shopId:row.id}})
|
||||
}else if(row.type === 2){
|
||||
this.$router.push({path:'/shop/goods/jd_goods_list',query:{shopId:row.id}})
|
||||
}else if(row.type === 3){
|
||||
this.$router.push({path:'/shop/goods/dou_goods_list',query:{shopId:row.id}})
|
||||
}else if(row.type === 4){
|
||||
this.$router.push({path:'/shop/goods/pdd_goods_list',query:{shopId:row.id}})
|
||||
}
|
||||
},
|
||||
handleLogistics(row) {
|
||||
if(row.type === 1){
|
||||
this.$router.push({path:"/shop/logistics_companies",query:{id:row.type}})
|
||||
}else if(row.type === 2){
|
||||
this.$router.push({path:"/shop/logistics_companies",query:{id:row.type,shopId:row.id}})
|
||||
} else if(row.type === 3){
|
||||
this.$router.push({path:"/shop/logistics_companies",query:{id:row.type,shopId:row.id}})
|
||||
} else if(row.type === 4){
|
||||
this.$router.push({path:"/shop/logistics_companies",query:{id:row.type,shopId:row.id}})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -178,7 +178,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type: 3}).then(response => {
|
||||
listShop({platform: 3}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
@ -250,7 +250,7 @@ export default {
|
|||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
// isRelogin.show = false;
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
this.$router.push({path:"/shop/shop_list",query:{type:3}})
|
||||
this.$router.push({path:"/shop/shop_list",query:{platform:3}})
|
||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
// })
|
||||
}).catch(() => {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:5}).then(response => {
|
||||
listShop({platform:5}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
@ -246,7 +246,7 @@ export default {
|
|||
console.log('拉取PDD商品接口返回=====',response)
|
||||
if(response.code === 1401) {
|
||||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
this.$router.push({path:"/shop/shop_list",query:{type:5}})
|
||||
this.$router.push({path:"/shop/shop_list",query:{platform:5}})
|
||||
// isRelogin.show = false;
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
<el-table-column label="描述" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="第三方平台店铺id,淘宝天猫开放平台使用" align="center" prop="sellerUserId" /> -->
|
||||
<!-- <el-table-column label="卖家userId" align="center" prop="sellerUserIdStr" /> -->
|
||||
<!-- <el-table-column label="第三方平台sessionKey" align="center" prop="sessionKey" /> -->
|
||||
<el-table-column label="AccessToken" align="center" prop="accessToken" />
|
||||
<!-- <el-table-column label="Appkey暂时抖音用" align="center" prop="appkey" /> -->
|
||||
<!-- <el-table-column label="Appsercet暂时抖音用" align="center" prop="appSercet" /> -->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
|
@ -171,6 +171,10 @@
|
|||
<el-form-item label="视频号appSercet" prop="appSercet" v-if="form.platform === 2">
|
||||
<el-input v-model="form.appSercet" placeholder="请输入视频号appSercet" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AccessToken" prop="accessToken" >
|
||||
<el-input v-model="form.accessToken" type="textarea" placeholder="请输入accessToken" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
|
|
@ -268,8 +272,8 @@ export default {
|
|||
created() {
|
||||
listPlatform().then(res=>{
|
||||
this.typeList = res.rows;
|
||||
if(this.$route.query.type){
|
||||
this.queryParams.type = parseInt(this.$route.query.type)
|
||||
if(this.$route.query.platform){
|
||||
this.queryParams.platform = parseInt(this.$route.query.platform)
|
||||
}
|
||||
this.getList();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type: 4}).then(response => {
|
||||
listShop({platform: 4}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
@ -230,7 +230,7 @@ export default {
|
|||
if(response.code === 1401) {
|
||||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
// isRelogin.show = false;
|
||||
this.$router.push({path:"/shop/shop_list",query:{type:4}})
|
||||
this.$router.push({path:"/shop/shop_list",query:{platform:4}})
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
// })
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
// listShop({type:3}).then(response => {
|
||||
// listShop({platform:3}).then(response => {
|
||||
// this.shopList = response.rows;
|
||||
// });
|
||||
// this.getList();
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
// listShop({type:3}).then(response => {
|
||||
// listShop({platform:3}).then(response => {
|
||||
// this.shopList = response.rows;
|
||||
// });
|
||||
// this.getList();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type: 2}).then(response => {
|
||||
listShop({platform: 2}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
// listShop({type:3}).then(response => {
|
||||
// listShop({platform:3}).then(response => {
|
||||
// this.shopList = response.rows;
|
||||
// });
|
||||
// this.getList();
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type: 2}).then(response => {
|
||||
listShop({platform: 2}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:2}).then(response => {
|
||||
listShop({platform:2}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -1,278 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="平台商品ID" prop="numIid">
|
||||
<el-input
|
||||
v-model="queryParams.numIid"
|
||||
placeholder="请输入平台商品ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台SkuId" prop="skuId">
|
||||
<el-input
|
||||
v-model="queryParams.skuId"
|
||||
placeholder="请输入平台SkuId"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商家sku编码" prop="outerId">
|
||||
<el-input
|
||||
v-model="queryParams.outerId"
|
||||
placeholder="请输入商家sku编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP skuId" prop="erpGoodsSkuId">
|
||||
<el-input
|
||||
v-model="queryParams.erpGoodsSkuId"
|
||||
placeholder="请输入ERP skuId"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="item in shopList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handlePull"
|
||||
>API拉取商品数据</el-button>
|
||||
</el-col>
|
||||
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" >
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<el-table-column label="平台skuId" align="center" prop="skuId" />
|
||||
<el-table-column label="平台商品ID" align="center" prop="numIid" />
|
||||
<el-table-column label="商家编码" align="center" prop="outerId" />
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="主图" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 70px; height: 70px;" :src="scope.row.picUrl"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" align="center" prop="propertiesName" />
|
||||
<el-table-column label="ERP商品sku Id" align="center" prop="erpGoodsSkuId" />
|
||||
<!-- <el-table-column label="快递单号" align="center" prop="logisticsCode" />-->
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-share"
|
||||
@click="handleLink(scope.row)"
|
||||
>关联ERP</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 关联ERP -->
|
||||
<el-dialog title="关联ERP商品SKU" :visible.sync="detailOpen" width="560px" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" inline>
|
||||
<el-form-item label="ERP商品SkuId" prop="erpGoodsSkuId">
|
||||
<el-input v-model.number="form.erpGoodsSkuId" placeholder="请输入ERP商品SkuId" style="width:250px" />
|
||||
<!-- <el-select v-model="form.erpGoodsSkuId" filterable remote reserve-keyword placeholder="搜索(sku编码、skuId)" style="width: 350px;"-->
|
||||
<!-- :remote-method="searchSku" :loading="skuListLoading" @change="skuChanage(scope.row)">-->
|
||||
<!-- <el-option v-for="item in skuList" :key="item.id"-->
|
||||
<!-- :label="item.name + ' - ' + item.colorValue + ' ' + item.sizeValue + ' ' + item.styleValue"-->
|
||||
<!-- :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listShop } from "@/api/shop/shop";
|
||||
import { searchSku } from "@/api/goods/goods";
|
||||
import {MessageBox} from "element-ui";
|
||||
import {isRelogin} from "../../../utils/request";
|
||||
import {getGoodsSku, linkErpGoodsSkuId, listGoodsSku, pullGoodsList} from "@/api/tao/goods";
|
||||
|
||||
export default {
|
||||
name: "GoodsTao",
|
||||
data() {
|
||||
return {
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
goodsList:[],
|
||||
shopList:[],
|
||||
skuList:[],
|
||||
// 是否显示弹出层
|
||||
detailOpen:false,
|
||||
skuListLoading:false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
shopId: null,
|
||||
numIid: null,
|
||||
skuId: null,
|
||||
outerId: null,
|
||||
erpGoodsSkuId: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
erpGoodsSkuId:null,
|
||||
id:null
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
erpGoodsSkuId: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:1}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
},
|
||||
mounted() {
|
||||
if(this.$route.query.shopId){
|
||||
this.queryParams.shopId = this.$route.query.shopId
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询淘宝订单列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
console.log('====222222==',this.queryParams)
|
||||
listGoodsSku(this.queryParams).then(response => {
|
||||
this.goodsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.detailOpen = false;
|
||||
this.saleAfterOpen = false
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
erpGoodsSkuId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
handlePull() {
|
||||
if(this.queryParams.shopId){
|
||||
pullGoodsList({shopId:this.queryParams.shopId}).then(response => {
|
||||
console.log('拉取淘宝商品接口返回=====',response)
|
||||
if(response.code === 1401) {
|
||||
MessageBox.confirm('Token已过期,需要重新授权', '系统提示', { confirmButtonText: '重新授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
isRelogin.show = false;
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
// })
|
||||
}).catch(() => {
|
||||
isRelogin.show = false;
|
||||
});
|
||||
|
||||
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
}else
|
||||
this.$modal.msgSuccess(JSON.stringify(response));
|
||||
})
|
||||
}else{
|
||||
this.$modal.msgSuccess("请先选择店铺");
|
||||
}
|
||||
|
||||
// this.$modal.msgSuccess("请先配置API");
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
linkErpGoodsSkuId(this.form).then(response => {
|
||||
this.$modal.msgSuccess("关联成功");
|
||||
this.detailOpen = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleLink(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getGoodsSku(id).then(response => {
|
||||
console.log('=====00000000============',response)
|
||||
this.form = response.data;
|
||||
this.detailOpen = true;
|
||||
});
|
||||
},
|
||||
// 搜索SKU
|
||||
searchSku(query) {
|
||||
this.shopLoading = true;
|
||||
const qw = {
|
||||
keyword: query
|
||||
}
|
||||
searchSku(qw).then(res => {
|
||||
this.skuList = res.rows;
|
||||
this.skuListLoading = false;
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -193,7 +193,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:4}).then(response => {
|
||||
listShop({platform:4}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:1}).then(response => {
|
||||
listShop({platform:1}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
listShop({type:7}).then(response => {
|
||||
listShop({platform:7}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
|
|
|
|||
Loading…
Reference in New Issue