Authored by peuei

Merge branch 'test_screen_qrcode_lineshops' into test6.8.5

package com.yoho.ufo.controller.product;
import com.yoho.ufo.service.InfoPrintService;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.request.product.InfoPrintRequestBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/***
* @author peuei
* @date 2019/1/8 10:16
* @description 门店商品相关打印控制
*/
@Controller
@RequestMapping("/infoPrint")
public class InfoPrintController {
private static final Logger logger = LoggerFactory.getLogger(InfoPrintController.class);
@Resource
private InfoPrintService infoPrintService;
/**
* 获得服务系统时间
*
* @return
*/
@RequestMapping(value = "/getServerCurrentTime")
@ResponseBody
public ApiResponse<Long> getServerCurrentTime() {
return new ApiResponse(System.currentTimeMillis());
}
/**
* 打印商品吊牌
*
* @param bo
* @return
*/
@RequestMapping("/printCode")
@ResponseBody
public ApiResponse printCode(@RequestBody InfoPrintRequestBo bo) {
logger.info("begin printCode with request InfoPrintRequestBo is {}", bo);
if (bo == null || bo.getStoreId() == null)
return new ApiResponse(201, "print error , storeId is necessary");
return infoPrintService.printCode(bo);
}
/**
* 拉取打印内容
*
* @param storeIds
* @return
*/
@RequestMapping("/getPrintContent.do")
@ResponseBody
public ApiResponse getPrintContent(@RequestParam(value = "storeIds") String storeIds) {
logger.info("begin getPrintContent with request storeIds is {}", storeIds);
if (storeIds == null || storeIds.split(",").length < 1)
return new ApiResponse(201, "storeId can not be empty");
List<Integer> ids = new ArrayList();
storeIds = storeIds.replace("%2C", ",");// 逗号可能被编码
Arrays.stream(storeIds.split(",")).forEach(e ->
ids.add(Integer.valueOf(e))
);
return infoPrintService.getPrintContent(ids);
}
}
... ...
package com.yoho.ufo.controller.product;
import com.yoho.ufo.service.IProductService;
import com.yoho.ufo.service.impl.StorageService;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
... ... @@ -36,4 +35,29 @@ public class StorageController {
LOGGER.info("StorageController.storagePriceList param = {}", bo);
return new ApiResponse(storageService.storagePriceList(bo));
}
/**
* 门店商品 菜单栏专用查询通道
*
* @param bo
* @return
*/
@RequestMapping(value = "/storageListLineShops")
public ApiResponse<PageResponseBO<ProductResponceBo>> storageListLineShops(ProductRequestBo bo) {
LOGGER.info("StorageController.storageListLineShops param = {}", bo);
return new ApiResponse(storageService.storageListLineShops(bo));
}
/**
* 门店商品 菜单栏 商品详情查询
*
* @param bo
* @return
*/
@RequestMapping(value = "/storagePriceListLineShops")
public ApiResponse<PageResponseBO<ProductResponceBo>> storagePriceListLineShops(ProductRequestBo bo) {
LOGGER.info("StorageController.storagePriceListLineShops param = {}", bo);
return new ApiResponse(storageService.storagePriceListLineShops(bo));
}
}
... ...
package com.yoho.ufo.service;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.request.product.InfoPrintRequestBo;
import java.util.List;
public interface InfoPrintService {
ApiResponse printCode(InfoPrintRequestBo bo);
ApiResponse getPrintContent(List<Integer> storeIds);
}
... ...
package com.yoho.ufo.service.impl;
import com.yoho.ufo.service.InfoPrintService;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.request.product.InfoPrintRequestBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
/***
* @author peuei
* @date 2019/1/8 10:35
* @description 门店商品信息打印
*/
@Service
public class InfoPrintServiceImpl implements InfoPrintService {
private static final Logger logger = LoggerFactory.getLogger(InfoPrintServiceImpl.class);
/**
* 内部维护一个打印队列 长度 100
* 每个门店对应一个打印队列
*/
private Map<Integer, BlockingQueue<InfoPrintRequestBo>> printQueueMap = new HashMap<>();
private static final int PRINT_QUEUE_LENGTH = 100;
/**
* 装载打印信息
*
* @param bo
* @return
*/
@Override
public ApiResponse printCode(InfoPrintRequestBo bo) {
// 获取对应打印队列
BlockingQueue<InfoPrintRequestBo> queue = getQueueByStoreId(bo.getStoreId());
if (!queue.offer(bo)) {
logger.warn("print queue full, storeId {} and content {}", bo.getStoreId(), bo.getCodeList());
return new ApiResponse(201, "unlucky print queue is full");
}
// 操作码默认200 成功
return new ApiResponse();
}
/**
* 拉取打印内容
*
* @param storeIds
* @return
*/
@Override
public ApiResponse getPrintContent(List<Integer> storeIds) {
List<InfoPrintRequestBo> resultList = new ArrayList<>();
for (int storeId : storeIds)
resultList.addAll(getContentByStoreId(storeId));
return new ApiResponse(resultList);
}
/**
* 获取打印内容
*
* @param storeId
* @return
*/
private List<InfoPrintRequestBo> getContentByStoreId(int storeId) {
List<InfoPrintRequestBo> contentList = new ArrayList<>();
BlockingQueue<InfoPrintRequestBo> printQueue = getQueueByStoreId(storeId);
InfoPrintRequestBo printContent;
int count = 0;
// 从队列中拉出打印内容
while ((printContent = printQueue.poll()) != null) {
contentList.add(printContent);
if (count++ >= 50)
break;
}
return contentList;
}
/**
* 根据门店ID获取对应打印队列
*
* @param storeId
* @return
*/
private BlockingQueue<InfoPrintRequestBo> getQueueByStoreId(int storeId) {
BlockingQueue<InfoPrintRequestBo> queue = printQueueMap.get(storeId);
if (queue == null) {
queue = new ArrayBlockingQueue<InfoPrintRequestBo>(PRINT_QUEUE_LENGTH);
printQueueMap.put(storeId, queue);
}
return queue;
}
}
... ...
... ... @@ -2,25 +2,29 @@ package com.yoho.ufo.service.impl;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.convert.ProductConvertService;
import com.yoho.ufo.dal.GoodsMapper;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.StoragePriceMapper;
import com.yoho.ufo.dal.model.Goods;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.dal.model.StoragePrice;
import com.yoho.ufo.model.goodsmanage.ProductPool;
import com.yoho.ufo.util.CollectionUtil;
import com.yoho.ufo.util.ImagesConstant;
import com.yoho.ufo.util.ImagesHelper;
import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.request.productpool.ProductPoolResponseBo;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Created by li.ma on 2018/9/18.
... ... @@ -44,6 +48,9 @@ public class StorageService {
@Autowired
private ProductAssistService productAssistService;
@Autowired
private GoodsMapper goodsMapper;
//商品编码 商品名称 品牌 最低价 可售库存
public PageResponseBO<ProductResponceBo> storageList(ProductRequestBo bo) {
LOGGER.info("StorageService storageList param = {}", bo);
... ... @@ -107,4 +114,61 @@ public class StorageService {
return new PageResponseBO<>(count, responseBos, bo.getPage(), bo.getRows());
}
/**
* 门店商品 菜单栏专用查询
*
* @param request
* @return
*/
public PageResponseBO<ProductResponceBo> storageListLineShops(ProductRequestBo request) {
LOGGER.info("StorageService storageListLineShops param = {}", request);
PageResponseBO<ProductResponceBo> productPageRsp = storageList(request);
/**
* 设置图片
*/
List<ProductResponceBo> productList = productPageRsp.getList();
List<Integer> productIdList = CollectionUtil.distinct(productList, ProductResponceBo::getId);
List<Goods> goodsList = goodsMapper.selectByProductId(productIdList);
Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId);
productList.forEach(respBo -> {
Goods goods = goodsMap.get(respBo.getId());
if (goods != null) {
respBo.setColorImage(ImagesHelper.getImageAbsoluteUrl(goods.getColorImage(), ImagesConstant.BUCKET_GOODS_IMG));
}
});
return productPageRsp;
}
/**
* 门店商品 菜单栏专用查询
*
* @param bo
* @return
*/
public PageResponseBO<ProductResponceBo> storagePriceListLineShops(ProductRequestBo bo) {
LOGGER.info("StorageService storagePriceListLineShops param = {}", bo);
PageResponseBO<ProductResponceBo> result = storagePriceList(bo);
/**
* 排序 : 尺码小 价格低 创建时间前 的排序越靠前
*/
Collections.sort(result.getList(), (o1, o2) -> {
Double compareSize = Double.parseDouble(o1.getSizeName() == null ? "0" : o1.getSizeName()) - Double.parseDouble(o2.getSizeName() == null ? "0" : o2.getSizeName());
if (compareSize < 0)
return -1;
else if (compareSize > 0)
return 1;
else {
Double comparePrice = Double.parseDouble(o1.getSkupPrice() == null ? "0" : o1.getSkupPrice()) - Double.parseDouble(o2.getSkupPrice() == null ? "0" : o2.getSkupPrice());
if (comparePrice < 0)
return -1;
else if (comparePrice > 0)
return 1;
else
return (int) (DateUtil.stringToDate(o1.getSkupCreateTime(), DateUtil.DATE_TIME_FORMAT).getTime()
- DateUtil.stringToDate(o2.getSkupCreateTime(), DateUtil.DATE_TIME_FORMAT).getTime());
}
});
return result;
}
}
... ...
... ... @@ -20,6 +20,7 @@
<list>
<value>platformLogin.do</value>
<value>logout.do</value>
<value>getPrintContent.do</value><!-- 开放门店商品吊牌打印接口 -->
</list>
</property>
</bean>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!UFO运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 160px">
<script>
document.write(addHead('库存详情', ''));
</script>
<style>
.div_search input {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
</style>
<div style="margin-left: 30px;" class="div_search">
<input id="status" type="text"/><!-- 状态 -->
<input id="SKUP" type="text"><!-- SKU-P -->
<input id="sellerUid" type="text"><!-- 卖家UID -->
<input id="storageId" type="text"><!-- SKU -->
<input id="sizeId" type="text"><!-- 尺码 -->
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
<a id="returnList" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">返回列表</a>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="skupTable"></table>
</div>
</div>
<script type="text/javascript">
(function () {
// 解析出需要 ID
var productId = parseURL(window.location.href).productId;
var midSortId = parseURL(window.location.href).midSortId;
// 状态枚举
var ENUM = {
sku_p_status: {
0: '待付保证金',
1: '出售中',
2: '卖家取消支付',
3: '卖家支付超时',
4: '卖家取消出售',
100: '已出售',
101: '出售中',
102: '出售中',
200: '平台取消出售',
201: '已出售'
}
};
// 加载列表
$("#skupTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/storage/storagePriceListLineShops",
method: 'POST',
queryParams: {
id: productId,
status: 1 // 默认查询出售中的
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "SKU_P",
field: "skup",
width: 40,
align: "center"
}, {
title: "SKU",
field: "storageId",
width: 80,
align: "center",
}, {
title: "颜色",
field: "goodsName",
width: 100,
align: "center"
}, {
title: "尺码",
field: "sizeName",
width: 80,
align: "center"
}, {
title: "卖家UID",
field: "sellerUid",
width: 200,
align: "center"
}, {
title: "销售价",
field: "skupPrice",
width: 50,
align: "center",
}, {
title: "状态",
field: "status",
width: 50,
align: "center",
formatter: function (value) {
return ENUM.sku_p_status[value];
},
}, {
title: "创建时间",
field: "skupCreateTime",
width: 130,
align: "center"
}, {
title: "操作",
field: "operations",
width: 120,
align: "center",
formatter: function (value, rowData) {
if (rowData.status == 1) {
return "<a role='edit' dataId='" + rowData.skup + "' product_name='" + rowData.productName + "' style='margin-left:10px'>打印吊牌标签</a>";
} else {
return '';
}
}
}]],
cache: false,
pagination: true,
pageSize: 50,
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId"); // sku-p
editRow(id, $(this).attr("product_name")); // 商品名称
}
});
}
});
// 执行打印吊牌标签
function editRow(skup) {
var param = {
type: "shopProduct",
header: "数据|码|EPC",
storeId: 70,
codeList: []
};
var codeTemplate = "https://o.yohobuy.com/ufo?p={storeId_Uid}&skup={skup}&productId={skn}&skn={skn}";
var content = codeTemplate.replace('{storeId_Uid}', [param.storeId, ",", "500031170"].join(""));
content = content.replace('{skup}', skup);
content = content.replace(new RegExp('{skn}', 'g'), productId);
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
async: false,
url: contextPath + "/infoPrint/getServerCurrentTime",
success: function (result) {
if (result.code != 200 || !result.data || result.data.length == 0) {
return;
}
var epc = ("00000000" + skup).substr(-8) + "000" + result.data;
param.codeList.push([content, "|", skup, "|", epc].join(""));
console.log(param)
// 嵌套 ajax
$.ajax({
contentType: "application/json",
dataType: "json",
type: "POST",
async: false,
url: contextPath + "/infoPrint/printCode",
data: JSON.stringify(param),
success: function (result) {
if (result.code == 200) {
$.messager.show({
title: "提示",
msg: "打印成功"
});
} else {
$.messager.alert("打印失败", result.message, "error");
}
}
});
}
});
}
// 解析URL
function parseURL(url) {
var url = url.split("?")[1];
var para = url.split("&");
var len = para.length;
var res = {};
var arr = [];
for (var i = 0; i < len; i++) {
arr = para[i].split("=");
res[arr[0]] = arr[1];
}
return res;
}
// 返回列表页
$('#returnList').linkbutton({
onClick: function () {
location.href = contextPath + "/html/goods/storageLineShops/storageLineShopsList.html";
}
});
// 加载搜索栏 状态
$("#status").myCombobox({
prompt: "状态",
width: 200,
data: [{id: '0', text: '待付保证金'}, {id: '2', text: '卖家取消支付'}, {id: '3', text: '卖家支付超时'}, {id: '1', text: '出售中'},
{id: '4', text: '卖家取消出售'}, {id: '200', text: '平台取消出售'}, {id: '100', text: '已出售'}],
valueField: "id",
textField: "text"
});
// 加载尺码
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
url: contextPath + '/size/queryAllSize4Goods?sortId=' + midSortId,
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
return;
}
$("#sizeId").myCombobox({
prompt: "尺码",
width: 200,
data: data.data,
valueField: "id",
textField: "text"
});
}
});
// 加载其他
$("#SKUP").textbox({
prompt: "SKU_P"
});
$("#sellerUid").textbox({
prompt: "卖家UID"
});
$("#storageId").textbox({
prompt: "SKU"
});
// 提取搜索参数
function getParams() {
var status = $('#status').combobox('getValue');
var skup = $('#SKUP').textbox('getValue');
var sellerUid = $('#sellerUid').textbox('getValue');
var storageId = $('#storageId').textbox('getValue');
var sizeId = $('#sizeId').combobox('getValue');
var param = {'id': productId};
if (undefined !== status && null !== status && "" !== status) {
param.status = status;
}
if (undefined !== skup && null !== skup && "" !== skup) {
param.skup = skup;
}
if (undefined !== sellerUid && null !== sellerUid && "" !== sellerUid) {
param.sellerUid = sellerUid;
}
if (undefined !== storageId && null !== storageId && "" !== storageId) {
param.storageId = storageId;
}
if (undefined !== sizeId && null !== sizeId && "" !== sizeId) {
param.sizeId = sizeId;
}
return param;
}
// 过滤搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
$("#skupTable").myDatagrid("load", param);
}
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$("#skupTable").myDatagrid("load", {'id': productId});
}
});
}())
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!UFO运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 220px">
<script>
document.write(addHead('门店商品', ''));
</script>
<style>
.div_search input {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
</style>
<div style="margin-left: 30px;" class="div_search">
<input id="id" type="text"><!-- 商品编码 -->
<input id="productName" type="text"><!-- 商品名称 -->
<input id="maxSortId" type="text"><!-- 一级分类 -->
<input id="middleSortId" type="text"><!-- 二级分类 -->
<input id="brandName" type="text"><!-- 品牌名称 -->
<input id="sellerUid" type="text"><!-- 卖家UID -->
<input id="storageNum" type="text"><!-- 商品库存 -->
<input id="storageId" type="text"><!-- SKU -->
<input id="skup" type="text"><!-- SKU-P -->
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="productTable"></table>
</div>
</div>
<script type="text/javascript">
(function () {
// 加载列表
$("#productTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/storage/storageListLineShops",
method: 'POST',
queryParams: {
sellerUid: 500031170 // 默认查询该 UID
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "商品编码",
field: "id",
width: 40,
align: "center"
}, {
title: "商品图片",
field: "colorImage",
width: 40,
align: "center",
formatter: function (value) {
return '<img src="' + value + '" style="width: 48px; height: 48px;vertical-align: middle;">'
}
}, {
title: "商品名称",
field: "productName",
width: 100,
align: "center",
}, {
title: "品牌",
field: "brandName",
width: 60,
align: "center"
}, {
title: "最低价",
field: "currentPrice",
width: 40,
align: "center",
formatter: function (value) {
if (value) {
return value;
}
return '--';
}
}, {
title: "可售库存",
field: "storage",
width: 20,
align: "center",
formatter: function (value) {
if (value) {
return value;
}
return 0;
}
}, {
title: "操作",
field: "operations",
width: 40,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' sortId = '" + rowData.midSortId + "' style='margin-left:10px'>库存详情</a>";
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
var midSortId = $(this).attr("sortId");
detailStorage(id, midSortId);
}
});
}
});
// 获取品牌名称
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
url: contextPath + '/brand/getBrandName',
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
return;
}
$("#brandName").myCombobox({
prompt: "品牌名称",
width: 200,
data: data.data,
valueField: "id",
textField: "text"
});
}
});
// 商品库存
$("#storageNum").myCombobox({
prompt: "商品库存",
width: 200,
data: [{id: '1', text: '有库存'}, {id: '0', text: '无库存'}],
valueField: "id",
textField: "text"
});
// 一级和二级分类 联动
var mxSortCombobox = $("#maxSortId");
var mdSortCombobox = $("#middleSortId");
var sortComboboxUrl = contextPath + '/productSort/getLevel2SortBySortId?sortId='
mxSortCombobox.combobox({
url: sortComboboxUrl,
method: "get",
editable: false,
valueField: 'id',
textField: 'text',
loadFilter: function (data) {
data = defaultLoadFilter(data);
data.unshift({id: 0, text: "一级品类"});
return data;
},
onSelect: function (rec) {
if (0 === rec.id) {
try {
mdSortCombobox.combobox('disable');
mdSortCombobox.combobox('setValue', '0');
} catch (e) {
}
return;
}
try {
mdSortCombobox.combobox('reload', sortComboboxUrl + rec.id);
mdSortCombobox.combobox('enable');
mdSortCombobox.combobox('setValue', '0');
} catch (e) {
}
},
loadFilter: function (data) {
data = defaultLoadFilter(data);
data.unshift({id: 0, text: "一级分类"});
return data;
}
});
mdSortCombobox.combobox({
method: "get",
editable: false,
valueField: 'id',
textField: 'text',
data: [{text: '二级分类', id: '0'}],
loadFilter: function (data) {
data = defaultLoadFilter(data);
data.unshift({id: 0, text: "请选择分类"});
return data;
},
onSelect: function (rec) {
if (0 === rec.id) {
return;
}
},
loadFilter: function (data) {
data = defaultLoadFilter(data);
data.unshift({id: 0, text: "请选择二级分类"});
return data;
}
});
// 其他搜索框
$("#id").textbox({
prompt: "商品编码"
});
$("#productName").textbox({
prompt: "商品名称"
});
$("#sellerUid").textbox({
prompt: "卖家UID"
});
$("#storageId").textbox({
prompt: "SKU"
});
$("#skup").textbox({
prompt: "SKU-P"
});
// 筛选 过滤
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
$("#productTable").myDatagrid("load", param);
}
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$("#productTable").myDatagrid("load", {});
}
});
// 提取搜索参数
function getParams() {
var brandName = $('#brandName').combobox('getValue');
var storageNum = $('#storageNum').combobox('getValue');
var id = $('#id').textbox('getValue');
var productName = $('#productName').textbox('getValue');
var sellerUid = $('#sellerUid').textbox('getValue');
var storageId = $('#storageId').textbox('getValue');
var maxSortId = $('#maxSortId').combobox('getValue');
var midSortId = $('#middleSortId').combobox('getValue');
var skup = $('#skup').textbox('getValue');
var param = {};
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.brandId = brandName;
}
if (undefined !== storageNum && null !== storageNum && "" !== storageNum) {
param.storageNum = storageNum;
}
if (undefined !== id && null !== id && "" !== id) {
param.id = id;
}
if (undefined !== productName && null !== productName && "" !== productName) {
param.productName = productName;
}
if (undefined !== sellerUid && null !== sellerUid && "" !== sellerUid) {
param.sellerUid = sellerUid;
}
if (undefined !== storageId && null !== storageId && "" !== storageId) {
param.storageId = storageId;
}
if (undefined !== skup && null !== skup && "" !== skup) {
param.skup = skup;
}
if (maxSortId !== undefined && null !== maxSortId && "" !== maxSortId && 0 != maxSortId) {
param.maxSortId = maxSortId;
}
if (midSortId !== undefined && null !== midSortId && "" !== midSortId && 0 != midSortId) {
param.midSortId = midSortId;
}
return param;
}
// 跳转编辑页
function detailStorage(id, midSortId) {
this.location.href = contextPath + "/html/goods/storageLineShops/storageLineShopsDetail.html?productId=" + id + "&midSortId=" + midSortId;
}
}())
</script>
</body>
</html>
\ No newline at end of file
... ...