Authored by caoyan

自助尺码

package com.yoho.product.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.product.model.SelfSize;
import com.yoho.product.model.SelfSizeReq;
public interface SelfSizeMapper {
int selectTotalByCondition(@Param("selfSizeReq")SelfSizeReq selfSizeReq);
List<SelfSize> selectByCondition(@Param("selfSizeReq")SelfSizeReq selfSizeReq);
SelfSize selectByPrimaryKey(@Param("id") Integer id);
int upadteAuditResult(@Param("id") Integer id, @Param("status") Integer status, @Param("auditUid") Integer auditUid);
}
\ No newline at end of file
... ...
package com.yoho.product.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.product.model.SelfSizeUid;
public interface SelfSizeUidMapper {
List<Integer> selectUidByProductIdAndSizeId(@Param("productId")Integer productId, @Param("sizeId") Integer sizeId);
SelfSizeUid selectByPrimaryKey(@Param("id") Integer id);
List<SelfSizeUid> selectByPrdIdList(@Param("prdIdList") List<Integer> prdIdList);
}
\ No newline at end of file
... ...
package com.yoho.product.model;
public class SelfSize {
private Integer id;
private Integer productId;
private Integer goodsId;
private Integer sizeId;
private Integer auditTime;
private Integer auditUid;
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public Integer getSizeId() {
return sizeId;
}
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public Integer getAuditTime() {
return auditTime;
}
public void setAuditTime(Integer auditTime) {
this.auditTime = auditTime;
}
public Integer getAuditUid() {
return auditUid;
}
public void setAuditUid(Integer auditUid) {
this.auditUid = auditUid;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
\ No newline at end of file
... ...
package com.yoho.product.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by caoyan.
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SelfSizeReq extends PageRequestBO{
/**
*
*/
private static final long serialVersionUID = 1620427808531296022L;
private Integer id;
private String productName;
private String productCode;
private Integer status;
}
... ...
package com.yoho.product.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by caoyan.
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SelfSizeRsp extends PageRequestBO{
/**
*
*/
private static final long serialVersionUID = 1620427808531296022L;
private Integer id;
private String brandName;
private String productName;
private String productCode;
private Integer productId;
private String applySizeName;
private String sellingSizeName;
private String applyUid;
private String statusStr;
private Integer status;
}
... ...
package com.yoho.product.model;
public class SelfSizeUid {
private Integer id;
private Integer productId;
private Integer goodsId;
private Integer sizeId;
private Integer uid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public Integer getSizeId() {
return sizeId;
}
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.product.dal.SelfSizeMapper" >
<resultMap id="BaseResultMap" type="com.yoho.product.model.SelfSize" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="goods_id" property="goodsId" jdbcType="INTEGER" />
<result column="size_id" property="sizeId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="INTEGER" />
<result column="audit_uid" property="auditUid" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, goods_id, size_id, audit_time, audit_uid, status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from self_size
where id = #{id,jdbcType=INTEGER}
</select>
<sql id="Query_Sql" >
<if test="selfSizeReq.productName != null and selfSizeReq.productName != '' ">
<bind name="pattern" value="'%' + selfSizeReq.productName + '%'" />
and product_name like #{pattern}
</if>
<if test="selfSizeReq.productCode != null and selfSizeReq.productCode != '' ">
and product_code=#{selfSizeReq.productCode}
</if>
<if test="selfSizeReq.status != null">
and status=#{selfSizeReq.status}
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.product.model.SelfSizeReq">
select count(1)
from self_size
where 1=1
<include refid="Query_Sql"></include>
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.product.model.SelfSizeReq">
select <include refid="Base_Column_List"></include>
from self_size
where 1=1
<include refid="Query_Sql"></include>
order by id desc
<if test="selfSizeReq.start!=null and selfSizeReq.size != null">
limit #{selfSizeReq.start},#{selfSizeReq.size}
</if>
</select>
<update id="upadteAuditResult">
update self_size set status=#{status}, audit_time=unix_timestamp(), audit_uid=#{auditUid}
where id=#{id}
</update>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.product.dal.SelfSizeUidMapper" >
<resultMap id="BaseResultMap" type="com.yoho.product.model.SelfSizeUid" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="goods_id" property="goodsId" jdbcType="INTEGER" />
<result column="size_id" property="sizeId" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, goods_id, size_id, uid
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from self_size_uid
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectUidByProductIdAndSizeId" resultType="java.lang.Integer">
select uid from self_size_uid
where product_id=#{productId} and size_id=#{sizeId}
</select>
<select id="selectByPrdIdList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from self_size_uid
where product_id in
<foreach collection="prdIdList" item="prdId" open="(" close=")" separator=",">
#{prdId}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.ufo.controller.product;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yoho.product.model.SelfShelvesReq;
import com.yoho.product.model.SelfShelvesRsp;
import com.yoho.product.model.SelfSizeReq;
import com.yoho.product.model.SelfSizeRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.service.ISelfSizeService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageResponseBO;
@RestController
@RequestMapping(value = "/selfSize")
public class SellerSelfSizeController {
private static final Logger LOGGER = LoggerFactory.getLogger(SellerSelfSizeController.class);
@Autowired
private ISelfSizeService selfSizeService;
@RequestMapping(value = "/queryList")
public ApiResponse queryList(SelfSizeReq req) {
LOGGER.info("queryList in. req is {}", req);
PageResponseBO<SelfSizeRsp> result = selfSizeService.queryList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
@RequestMapping(value = "/getDetailById")
public ApiResponse getDetailById(SelfSizeReq req) {
LOGGER.info("getDetailById in. req is {}", req);
SelfSizeRsp result = selfSizeService.getDetail(req);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("保存成功").build();
}
@RequestMapping(value = "/updateAuditInfoById")
public ApiResponse updateAuditInfoById(SelfSizeReq req) {
LOGGER.info("updateAuditInfoById in. req is {}", req);
int result;
try {
result = selfSizeService.updateAuditResult(req);
} catch (PlatformException e) {
return new ApiResponse.ApiResponseBuilder().code(500).message(e.getMessage()).build();
}
if(result>0) {
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("保存成功").build();
}else {
return new ApiResponse.ApiResponseBuilder().code(500).data(result).message("保存失败").build();
}
}
}
... ...
package com.yoho.ufo.service;
import com.yoho.product.model.SelfSizeReq;
import com.yoho.product.model.SelfSizeRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.service.model.PageResponseBO;
public interface ISelfSizeService {
PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req);
SelfSizeRsp getDetail(SelfSizeReq req);
int updateAuditResult(SelfSizeReq req) throws PlatformException;
}
... ...
package com.yoho.ufo.service.impl;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.yoho.product.dal.SelfSizeMapper;
import com.yoho.product.dal.SelfSizeUidMapper;
import com.yoho.product.model.SelfSize;
import com.yoho.product.model.SelfSizeReq;
import com.yoho.product.model.SelfSizeRsp;
import com.yoho.product.model.SelfSizeUid;
import com.yoho.ufo.dal.BrandMapper;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.StorageMapper;
import com.yoho.ufo.dal.UfoSizeMapper;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.dal.model.Storage;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.model.brand.Brand;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.service.ISelfSizeService;
import com.yoho.ufo.service.UserProxyService;
import com.yoho.ufo.service.model.PageResponseBO;
/**
* @author caoyan
* @date 2019/3/19
*/
@Service
public class SelfSizeServiceImpl implements ISelfSizeService {
private static final Logger LOGGER = LoggerFactory.getLogger(SelfSizeServiceImpl.class);
@Autowired
private SelfSizeMapper selfSizeMapper;
@Autowired
private SelfSizeUidMapper selfSizeUidMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private BrandMapper brandMapper;
@Autowired
private UfoSizeMapper ufoSizeMapper;
@Autowired
private StorageMapper storageMapper;
@Autowired
private InboxServiceImpl inboxService;
@Autowired
private UserProxyService userProxyService;
@Override
public PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req){
int total = selfSizeMapper.selectTotalByCondition(req);
if(total == 0) {
return null;
}
List<SelfSize> list = selfSizeMapper.selectByCondition(req);
if(CollectionUtils.isEmpty(list)) {
return null;
}
List<Integer> productIdList = list.stream().map(SelfSize::getProductId).collect(Collectors.toList());
List<Product> productList = productMapper.selectProductListByIds(productIdList);
Map<Integer, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p->p));
List<Integer> brandIdList = productList.stream().map(Product::getBrandId).collect(Collectors.toList());
List<Brand> brandList = brandMapper.selectBrandByIdList(brandIdList);
Map<Integer, String> brandIdNameMap = brandList.stream().collect(Collectors.toMap(Brand::getId, Brand::getBrandName));
List<Integer> sizeIdList = list.stream().map(SelfSize::getSizeId).collect(Collectors.toList());
List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
Map<Integer, String> sizeIdNameMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Size::getSizeName));
List<Integer> goodsIdList = list.stream().map(SelfSize::getGoodsId).collect(Collectors.toList());
Map<Integer, String> goodsIdSizeNameMap = getSellingSizeNameMap(goodsIdList);
List<SelfSizeUid> uidInfoList = selfSizeUidMapper.selectByPrdIdList(productIdList);
Map<Integer, List<SelfSizeUid>> selfSizeUidMap = uidInfoList.stream().collect(Collectors.groupingBy(SelfSizeUid::getSizeId));
List<SelfSizeRsp> rspList = Lists.newArrayList();
for(SelfSize item : list) {
SelfSizeRsp rsp = new SelfSizeRsp();
rsp.setId(item.getId());
rsp.setBrandName(brandIdNameMap.get(productMap.get(item.getProductId()).getBrandId()));
rsp.setProductName(productMap.get(item.getProductId()).getProductName());
rsp.setProductCode(productMap.get(item.getProductId()).getProductCode());
rsp.setProductId(item.getProductId());
rsp.setApplySizeName(sizeIdNameMap.get(item.getSizeId()));
rsp.setStatus(item.getStatus());
rsp.setStatusStr(getStatusStr(item.getStatus()));
rsp.setSellingSizeName(goodsIdSizeNameMap.get(item.getGoodsId()));
List<SelfSizeUid> selfSizeUids = selfSizeUidMap.get(item.getSizeId());
List<Integer> applyUidList = selfSizeUids.stream().map(SelfSizeUid::getUid).collect(Collectors.toList());
rsp.setApplyUid(getApplyUidStr(applyUidList));
rspList.add(rsp);
}
PageResponseBO<SelfSizeRsp> result=new PageResponseBO<>();
result.setList(rspList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
private String getApplyUidStr(List<Integer> uidList) {
Set<String> uidStrSet = Sets.newHashSet();
for(Integer uid : uidList) {
uidStrSet.add(String.valueOf(uid));
}
return String.join("、", uidStrSet);
}
private Map<Integer, String> getSellingSizeNameMap(List<Integer> goodsIdList){
List<Storage> storageList = storageMapper.selectByGoodsIdList(goodsIdList);
Map<Integer, List<Storage>> goodsIdMap = storageList.stream().collect(Collectors.groupingBy(Storage::getGoodsId));
List<Integer> sizeIdList = storageList.stream().map(Storage::getSizeId).collect(Collectors.toList());
List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
Map<Integer, String> sizeIdNameMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Size::getSizeName));
Map<Integer, String> result = Maps.newHashMap();
for(Entry<Integer, List<Storage>> entry : goodsIdMap.entrySet()) {
List<Integer> sizeIds = entry.getValue().stream().map(Storage::getSizeId).collect(Collectors.toList());
List<String> sizeNameList = Lists.newArrayList();
for(Integer sizeId : sizeIds) {
sizeNameList.add(sizeIdNameMap.get(sizeId));
}
result.put(entry.getKey(), String.join("、", sizeNameList));
}
return result;
}
private String getStatusStr(Integer status) {
if(status.intValue() == 0) {
return "待审核";
}else if(status.intValue() == 1) {
return "已通过";
}else if(status.intValue() == 2) {
return "不通过";
}else {
return "";
}
}
@Override
public SelfSizeRsp getDetail(SelfSizeReq req) {
SelfSize selfSize = selfSizeMapper.selectByPrimaryKey(req.getId());
if(null == selfSize) {
return null;
}
Product product = productMapper.selectByPrimaryKey(selfSize.getProductId());
Brand brand = brandMapper.selectOneById(product.getBrandId());
Size size = ufoSizeMapper.selectOneById(selfSize.getSizeId());
List<Storage> storageList = storageMapper.selectByGoodsId(selfSize.getGoodsId());
List<Integer> sizeIdList = storageList.stream().map(Storage::getSizeId).collect(Collectors.toList());
List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
List<String> sizeNameList = sizeList.stream().map(Size::getSizeName).collect(Collectors.toList());
List<Integer> uidList = selfSizeUidMapper.selectUidByProductIdAndSizeId(selfSize.getProductId(), selfSize.getSizeId());
SelfSizeRsp rsp = new SelfSizeRsp();
rsp.setBrandName(brand.getBrandName());
rsp.setProductName(product.getProductName());
rsp.setProductId(product.getId());
rsp.setProductCode(product.getProductCode());
rsp.setApplySizeName(size.getSizeName());
rsp.setSellingSizeName(String.join("、", sizeNameList));
List<String> uidStrList = Lists.newArrayList();
for(Integer uid : uidList) {
uidStrList.add(String.valueOf(uid));
}
rsp.setApplyUid(String.join("、", uidStrList));
return rsp;
}
@Override
public int updateAuditResult(SelfSizeReq req) throws PlatformException {
SelfSize selfSize = selfSizeMapper.selectByPrimaryKey(req.getId());
if(null == selfSize) {
throw new PlatformException("记录不存在", 400);
}
UserHelper userInfo = new UserHelper();
int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
if(num > 0 && req.getStatus().intValue() == 1) {//审核通过
//发送站内信
// inboxService.addInboxForPlatform(pss.getUid(), InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getType(),
// InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getBusinessType(), buildParams(pss.getBrand(), pss.getProductName(), pss.getProductCode()));
// //发送短信
// SmsMessageReq smsReq = new SmsMessageReq();
// //获取手机号
// String mobile = userProxyService.getMobile(pss.getUid());
// smsReq.setMobileList(Lists.newArrayList(mobile));
// smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getContent(), pss.getBrand(), pss.getProductName(), pss.getProductCode()));
// inboxService.sendSmsMessage(smsReq);
}
return num;
}
private String getReplacedContent(String content ,Object... params) {
return MessageFormatter.arrayFormat(content, params).getMessage();
}
public static String buildParams(Object... objects) {
if (objects == null) {
return null;
}
if (objects.length == 1) {
return objects[0].toString();
}
String params = StringUtils.join(objects, ",");
return params;
}
private String getAuditStatusStr(int status) {
if(status == 0) {
return "待审核";
}else if(status == 1) {
return "已上架";
}else if(status == 2) {
return "不通过";
}else if(status == 3) {
return "待上架";
}
return "";
}
}
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js?version=6.9.3"></script>
<style>
.sub-info th{
font-size: 16px;
text-align: right;
width: 30%;
}
.sub-info td{
font-size: 16px;
width: 70%;
}
</style>
</head>
<body class="easyui-layout">
<div region="north" style="height:90px;">
<script>
document.write(addHead('商品管理', '卖家自主尺码申请'));
</script>
</div>
<div id="businessDiv" region="center">
<table id="businessTable" class="sub-info" frame="void" width="80%" cellpadding="16" align="center">
<tr>
<th>品牌</th>
<td id="brandName"></td>
</tr>
<tr>
<th>商品名称</th>
<td id="productName"></td>
</tr>
<tr>
<th>SKN</th>
<td id="productId"></td>
</tr>
<tr>
<th>货号</th>
<td id="productCode"></td>
</tr>
<tr>
<th>申请尺码</th>
<td id="applySizeName"></td>
</tr>
<tr>
<th>出售中尺码</th>
<td id="sellingSizeName"></td>
</tr>
<tr>
<th>申请人UID</th>
<td id="applyUid"></td>
</tr>
</table>
<div id="btnList" style="text-align:center;">
<a id="rejectBtn" class="btn-long" style="background-color: rgba(217, 0, 27, 1);">不通过</a>
<a id="passBtn" class="btn-long" style="background-color: rgba(2, 125, 180, 1);">已添加尺码并审核通过</a>
</div>
<br>
<br>
</div>
<script>
$(function() {
var param=window.location.search;
var id = getQueryString(param, "id");
getDetailInfo(id);
$("#rejectBtn").linkbutton({
text: "不通过",
iconCls: "icon-ok",
onClick: function () {
updateAudit(id, 2);
}
});
$("#passBtn").linkbutton({
text: "通过",
iconCls: "icon-ok",
onClick: function () {
updateAudit(id, 1);
}
});
});
function updateAudit(id, status){
$.post(contextPath + "/selfSize/updateAuditInfoById", {
id : id,
status : status
}, function(data) {
if (data.code == 200) {
document.getElementById("btnList").style.display= "none";
window.self.$.messager.show({
title : "提示",
msg : "审核成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
function getDetailInfo(id){
var form = new FormData();
form.append("id", id);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/selfSize/getDetailById',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
$("#brandName").html(replacexss(result.data.brandName));
$("#productName").html(replacexss(result.data.productName));
$("#productId").html(result.data.productId);
$("#productCode").html(result.data.productCode);
$("#applySizeName").html(result.data.applySizeName);
$("#sellingSizeName").html(result.data.sellingSizeName);
$("#applyUid").html(result.data.applyUid);
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
}
function getQueryString(paraPart,name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = paraPart.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js?version=6.9.3"></script>
</head>
<body class="easyui-layout">
<div region="north" style="height:230px;">
<script>
document.write(addHead('商品管理', '卖家自助尺码申请'));
</script>
<div style="margin-left: 10px;margin-top: 30px">
<div style="border:1px solid #ddd;border-radius:5px 5px 5px 5px;">
<div style="margin-left: 10px;margin-top: 20px;margin-bottom: 20px">
<input id="productName" name="productName" />
<input id="productCode" name="productCode" />
<input id="status" name="status" />
<a id="searchBtn" class="btn-info">筛选</a>
<a id="allBtn" class="btn-success">全部</a>
</div>
</div>
</div>
</div>
<div id="sizeList" region="center">
<table id="mainListTable"></table>
</div>
<script>
var listUrl = contextPath + "/selfSize/queryList";
var viewUrl = contextPath + "/html/sellerSelfSize/view.html";
var auditUrl = contextPath + "/html/sellerSelfSize/audit.html";
$(function() {
$("#productName").textbox({
prompt: "名称",
width: 200
});
$("#productCode").textbox({
prompt: "货号",
width: 200
});
$("#status").combobox({
prompt: "审核状态",
width: 150,
editable : false,
data: [
{"text" : "待审核", "value" : 1},
{"text" : "已通过", "value" : 2},
{"text" : "已拒绝", "value" : 3}
]
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
var status = $("#status").myCombobox("getValue")-1;
$("#mainListTable").datagrid("load", {
productName : $("#productName").val(),
productCode : $("#productCode").val(),
status : status == -1 ? null : status
});
}
});
//全部按钮
$("#allBtn").linkbutton({
iconCls: "icon-import",
onClick: function () {
$("#productName").textbox('setValue','');
$("#productCode").textbox('setValue','');
$("#status").combobox('setValue','');
$("#mainListTable").datagrid("load", {});
}
});
loadMainList();
});
function loadMainList(){
$("#mainListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: listUrl,
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "品牌",
field: "brandName",
width: 20,
align: "center"
}, {
title: "商品名称",
field: "productName",
width: 20,
align: "center"
}, {
title: "SKN",
field: "productId",
width: 20,
align: "center"
}, {
title: "货号",
field: "productCode",
width: 30,
align: "center"
}, {
title: "申请尺码",
field: "applySizeName",
width: 20,
align: "center"
}, {
title: "出售中尺码",
field: "sellingSizeName",
width: 20,
align: "center"
}, {
title: "申请人UID",
field: "applyUid",
width: 10,
align: "center"
}, {
title: "状态",
field: "statusStr",
width: 20,
align: "center"
}, {
title: "操作",
field: "asdf",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str = "";
if(rowData.status==0){
str = "<a role='audit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核</a>" + str;
}else{
str = "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>查看</a>";
}
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
$(this).datagrid("getPanel").find("a[role='detail']").linkbutton({
onClick: function () {
var id = $(this).attr("dataId");
window.open(viewUrl + "?id=" + id + "&ver=" + new Date().getTime())
}
});
$(this).datagrid("getPanel").find("a[role='audit']").linkbutton({
onClick: function () {
var id = $(this).attr("dataId");
window.open(auditUrl + "?id=" + id + "&ver=" + new Date().getTime()); }
});
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js?version=6.9.3"></script>
<style>
.sub-info th{
font-size: 16px;
text-align: right;
width: 30%;
}
.sub-info td{
font-size: 16px;
width: 70%;
}
</style>
</head>
<body class="easyui-layout">
<div region="north" style="height:90px;">
<script>
document.write(addHead('商品管理', '卖家自主尺码申请'));
</script>
</div>
<div id="businessDiv" region="center">
<table id="businessTable" class="sub-info" frame="void" width="80%" cellpadding="16" align="center">
<tr>
<th>品牌</th>
<td id="brandName"></td>
</tr>
<tr>
<th>商品名称</th>
<td id="productName"></td>
</tr>
<tr>
<th>SKN</th>
<td id="productId"></td>
</tr>
<tr>
<th>货号</th>
<td id="productCode"></td>
</tr>
<tr>
<th>申请尺码</th>
<td id="applySizeName"></td>
</tr>
<tr>
<th>出售中尺码</th>
<td id="sellingSizeName"></td>
</tr>
<tr>
<th>申请人UID</th>
<td id="applyUid"></td>
</tr>
</table>
<br>
<br>
</div>
<script>
$(function() {
var param=window.location.search;
var id = getQueryString(param, "id");
getDetailInfo(id);
});
function getDetailInfo(id){
var form = new FormData();
form.append("id", id);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/selfSize/getDetailById',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
$("#brandName").html(replacexss(result.data.brandName));
$("#productName").html(replacexss(result.data.productName));
$("#productId").html(result.data.productId);
$("#productCode").html(result.data.productCode);
$("#applySizeName").html(result.data.applySizeName);
$("#sellingSizeName").html(result.data.sellingSizeName);
$("#applyUid").html(result.data.applyUid);
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
}
function getQueryString(paraPart,name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = paraPart.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
</script>
</body>
</html>
\ No newline at end of file
... ...