Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
ufo-platform
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
Lixiaodi
7 years ago
Commit
15f181bffa6bfcc4b9391481127ee4a94a43de49
2 parents
f0a35cf2
ca0a83d7
Merge branch 'master' of
http://git.yoho.cn/ufo/ufo-platform
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
1512 additions
and
196 deletions
dal/src/main/java/com/yoho/order/dal/BuyerOrderMetaMapper.java
dal/src/main/java/com/yoho/order/dal/ExpressCompanyMapper.java
dal/src/main/java/com/yoho/order/dal/SellerOrderMetaMapper.java
dal/src/main/java/com/yoho/order/model/BuyerOrderMeta.java
dal/src/main/java/com/yoho/order/model/ExpressCompany.java
dal/src/main/java/com/yoho/order/model/ExpressInfo.java
dal/src/main/java/com/yoho/order/model/SellerOrderMeta.java
dal/src/main/resources/META-INF/mybatis/BuyerOrderMeta.xml
dal/src/main/resources/META-INF/mybatis/ExpressCompanyMapper.xml
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
dal/src/main/resources/META-INF/mybatis/SellerOrderMeta.xml
order/src/main/java/com/yoho/ufo/order/controller/BuyerOrderController.java
order/src/main/java/com/yoho/ufo/order/service/IBuyerOrderService.java
order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
pom.xml
product/pom.xml
product/src/main/java/com/yoho/ufo/service/impl/ProductAssistService.java
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
product/src/main/java/com/yoho/ufo/service/impl/StoragePriceService.java
product/src/main/java/com/yoho/ufo/service/impl/StorageService.java
web/src/main/resources/databases.yml
web/src/main/webapp/META-INF/autoconf/databases.yml
web/src/main/webapp/html/goods/storage/storageDetail.html
web/src/main/webapp/html/goods/storage/storageList.html
web/src/main/webapp/html/judgeCenter/list.html
web/src/main/webapp/html/judgeCenter/pass.html
web/src/main/webapp/html/judgeCenter/reject.html
web/src/main/webapp/html/product/productEdit.html
web/src/main/webapp/html/product/productList.html
dal/src/main/java/com/yoho/order/dal/BuyerOrderMetaMapper.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
dal
;
import
org.apache.ibatis.annotations.Param
;
import
com.yoho.order.model.BuyerOrderMeta
;
/**
* Created by caoyan on 2018/9/12.
*/
public
interface
BuyerOrderMetaMapper
{
BuyerOrderMeta
selectByOrderCodeAndKey
(
@Param
(
"orderCode"
)
String
orderCode
,
@Param
(
"metaKey"
)
String
metaKey
);
}
...
...
dal/src/main/java/com/yoho/order/dal/ExpressCompanyMapper.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
dal
;
import
java.util.List
;
import
com.yoho.order.model.ExpressCompany
;
/**
* Created by caoyan on 2018/9/12.
*/
public
interface
ExpressCompanyMapper
{
List
<
ExpressCompany
>
selectAll
();
}
...
...
dal/src/main/java/com/yoho/order/dal/SellerOrderMetaMapper.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
dal
;
import
org.apache.ibatis.annotations.Param
;
import
com.yoho.order.model.SellerOrderMeta
;
/**
* Created by caoyan on 2018/9/12.
*/
public
interface
SellerOrderMetaMapper
{
SellerOrderMeta
selectBySkupAndKey
(
@Param
(
"skup"
)
Integer
skup
,
@Param
(
"metaKey"
)
String
metaKey
);
}
...
...
dal/src/main/java/com/yoho/order/model/BuyerOrderMeta.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
model
;
import
java.io.Serializable
;
/**
* @author caoyan
* @date 2018/9/13
*/
public
class
BuyerOrderMeta
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2607922995706119816L
;
private
Integer
id
;
private
Integer
uid
;
private
String
orderCode
;
private
String
metaKey
;
private
String
metaValue
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getUid
()
{
return
uid
;
}
public
void
setUid
(
Integer
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderCode
()
{
return
orderCode
;
}
public
void
setOrderCode
(
String
orderCode
)
{
this
.
orderCode
=
orderCode
;
}
public
String
getMetaKey
()
{
return
metaKey
;
}
public
void
setMetaKey
(
String
metaKey
)
{
this
.
metaKey
=
metaKey
;
}
public
String
getMetaValue
()
{
return
metaValue
;
}
public
void
setMetaValue
(
String
metaValue
)
{
this
.
metaValue
=
metaValue
;
}
@Override
public
String
toString
()
{
return
"BuyerOrderMeta{"
+
"id="
+
id
+
", uid='"
+
uid
+
'\''
+
", orderCode='"
+
orderCode
+
'\''
+
", metaKey='"
+
metaKey
+
'\''
+
", metaValue="
+
metaValue
+
'}'
;
}
}
...
...
dal/src/main/java/com/yoho/order/model/ExpressCompany.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
model
;
import
java.io.Serializable
;
/**
* @author caoyan
* @date 2018/9/13
*/
public
class
ExpressCompany
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2607922995706119816L
;
private
Integer
id
;
private
String
companyName
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
@Override
public
String
toString
()
{
return
"ExpressInfo{"
+
"id="
+
id
+
", companyName='"
+
companyName
+
'\''
+
'}'
;
}
}
...
...
dal/src/main/java/com/yoho/order/model/ExpressInfo.java
View file @
15f181b
...
...
@@ -116,7 +116,7 @@ public class ExpressInfo implements Serializable {
@Override
public
String
toString
()
{
return
"
Brand
{"
+
return
"
ExpressInfo
{"
+
"id="
+
id
+
", uid='"
+
uid
+
'\''
+
", orderCode='"
+
orderCode
+
'\''
+
...
...
dal/src/main/java/com/yoho/order/model/SellerOrderMeta.java
0 → 100644
View file @
15f181b
package
com
.
yoho
.
order
.
model
;
import
java.io.Serializable
;
/**
* @author caoyan
* @date 2018/9/13
*/
public
class
SellerOrderMeta
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2607922995706119816L
;
private
Integer
id
;
private
Integer
skup
;
private
Integer
uid
;
private
String
metaKey
;
private
String
metaValue
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getSkup
()
{
return
skup
;
}
public
void
setSkup
(
Integer
skup
)
{
this
.
skup
=
skup
;
}
public
Integer
getUid
()
{
return
uid
;
}
public
void
setUid
(
Integer
uid
)
{
this
.
uid
=
uid
;
}
public
String
getMetaKey
()
{
return
metaKey
;
}
public
void
setMetaKey
(
String
metaKey
)
{
this
.
metaKey
=
metaKey
;
}
public
String
getMetaValue
()
{
return
metaValue
;
}
public
void
setMetaValue
(
String
metaValue
)
{
this
.
metaValue
=
metaValue
;
}
@Override
public
String
toString
()
{
return
"SellerOrderMeta{"
+
"id="
+
id
+
", uid='"
+
uid
+
'\''
+
", skup='"
+
skup
+
'\''
+
", metaKey='"
+
metaKey
+
'\''
+
", metaValue="
+
metaValue
+
'}'
;
}
}
...
...
dal/src/main/resources/META-INF/mybatis/BuyerOrderMeta.xml
0 → 100644
View file @
15f181b
<?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.order.dal.BuyerOrderMetaMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.order.model.BuyerOrderMeta"
>
<result
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"uid"
property=
"uid"
jdbcType=
"INTEGER"
/>
<result
column=
"order_code"
property=
"orderCode"
jdbcType=
"BIGINT"
/>
<result
column=
"meta_key"
property=
"metaKey"
jdbcType=
"VARCHAR"
/>
<result
column=
"meta_value"
property=
"metaValue"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, uid, order_code, meta_key, meta_value
</sql>
<select
id=
"selectByOrderCodeAndKey"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from buyer_order_meta where order_code=#{orderCode} and meta_key=#{metaKey}
</select>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/ExpressCompanyMapper.xml
0 → 100644
View file @
15f181b
<?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.order.dal.ExpressCompanyMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.order.model.ExpressCompany"
>
<result
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"company_name"
property=
"companyName"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, company_name
</sql>
<select
id=
"selectAll"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from express_company
</select>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
View file @
15f181b
...
...
@@ -175,17 +175,31 @@
</update>
<select
id=
"selectProductStorageCount"
resultType=
"java.lang.Integer"
>
select count(*) from product p where
<include
refid=
"skcPageCondition"
/>
select
<if
test=
"product.storageNum != null"
>
count(DISTINCT p.id)
</if>
<if
test=
"product.storageNum == null"
>
count(p.id)
</if>
from product p where
<include
refid=
"skcPageCondition"
/>
</select>
<select
id=
"selectProductStorageList"
resultMap=
"BaseResultMap"
>
select id, brand_id, product_name, max_sort_id, mid_sort_id
select
<if
test=
"product.storageNum != null"
>
DISTINCT p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id
</if>
<if
test=
"product.storageNum == null"
>
p.id, p.brand_id, p.product_name, p.max_sort_id, p.mid_sort_id
</if>
from product p
where
<include
refid=
"skcPageCondition"
/>
limit #{start},#{rows}
</select>
<sql
id=
"skcPageCondition"
>
1 = 1
<if
test=
"product.storageNum != null"
>
<if
test=
"product.storageNum == 0"
>
And exists(SELECT 1 FROM storage s WHERE s.storage_num = 0 AND s.product_id= p.id)
</if>
<if
test=
"product.storageNum != 0"
>
And exists(SELECT 1 FROM storage s WHERE s.storage_num >= 1 AND s.product_id= p.id)
</if>
</if>
<if
test=
"product.id != null and product.id > 0"
>
and p.id = #{product.id}
</if>
...
...
dal/src/main/resources/META-INF/mybatis/SellerOrderMeta.xml
0 → 100644
View file @
15f181b
<?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.order.dal.SellerOrderMetaMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.order.model.SellerOrderMeta"
>
<result
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"skup"
property=
"skup"
jdbcType=
"INTEGER"
/>
<result
column=
"uid"
property=
"uid"
jdbcType=
"INTEGER"
/>
<result
column=
"meta_key"
property=
"metaKey"
jdbcType=
"VARCHAR"
/>
<result
column=
"meta_value"
property=
"metaValue"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, skup, uid, meta_key, meta_value
</sql>
<select
id=
"selectBySkupAndKey"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from seller_order_meta where skup=#{skup} and meta_key=#{metaKey}
</select>
</mapper>
\ No newline at end of file
...
...
order/src/main/java/com/yoho/ufo/order/controller/BuyerOrderController.java
View file @
15f181b
package
com
.
yoho
.
ufo
.
order
.
controller
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yoho.order.model.BuyerOrderReq
;
import
com.yoho.order.model.ExpressCompany
;
import
com.yoho.ufo.order.service.IBuyerOrderService
;
import
com.yoho.ufo.service.model.ApiResponse
;
import
com.yoho.ufo.service.model.PageResponseBO
;
...
...
@@ -46,6 +49,37 @@ public class BuyerOrderController {
}
else
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"更新失败"
).
build
();
}
}
@RequestMapping
(
value
=
"/getReceiveInfoByOrderCode"
)
public
ApiResponse
getReceiveInfoByOrderCode
(
BuyerOrderReq
req
)
{
if
(
null
==
req
||
StringUtils
.
isEmpty
(
req
.
getOrderCode
()))
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"参数有误"
).
build
();
}
BuyerOrderResp
result
=
buyerOrderService
.
getReceiveInfoByOrderCode
(
req
);
if
(
null
==
result
)
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"获取收货信息失败"
).
build
();
}
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
200
).
message
(
"获取信息成功"
).
data
(
result
).
build
();
}
@RequestMapping
(
value
=
"/getSendBackInfoBySkup"
)
public
ApiResponse
getSendBackInfoBySkup
(
BuyerOrderReq
req
)
{
if
(
null
==
req
||
null
==
req
.
getSkup
())
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"参数有误"
).
build
();
}
BuyerOrderResp
result
=
buyerOrderService
.
getSendBackInfoBySkup
(
req
);
if
(
null
==
result
)
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
500
).
message
(
"获取收货信息失败"
).
build
();
}
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
200
).
message
(
"获取信息成功"
).
data
(
result
).
build
();
}
@RequestMapping
(
value
=
"/queryExpressCompanyList"
)
public
ApiResponse
queryExpressCompanyList
()
{
List
<
ExpressCompany
>
result
=
buyerOrderService
.
queryAllExpressCompanyList
();
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
200
).
message
(
"获取信息成功"
).
data
(
result
).
build
();
}
}
...
...
order/src/main/java/com/yoho/ufo/order/service/IBuyerOrderService.java
View file @
15f181b
package
com
.
yoho
.
ufo
.
order
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.yoho.order.model.BuyerOrderReq
;
import
com.yoho.order.model.ExpressCompany
;
import
com.yoho.ufo.service.model.PageResponseBO
;
import
com.yohobuy.ufo.model.order.resp.BuyerOrderResp
;
...
...
@@ -16,4 +18,10 @@ public interface IBuyerOrderService {
PageResponseBO
<
BuyerOrderResp
>
queryOrderList
(
BuyerOrderReq
req
);
int
updateOrderStatus
(
BuyerOrderReq
req
);
BuyerOrderResp
getReceiveInfoByOrderCode
(
BuyerOrderReq
req
);
List
<
ExpressCompany
>
queryAllExpressCompanyList
();
BuyerOrderResp
getSendBackInfoBySkup
(
BuyerOrderReq
req
);
}
...
...
order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
View file @
15f181b
...
...
@@ -20,15 +20,21 @@ import com.yoho.core.common.utils.DateUtil;
import
com.yoho.core.rest.client.ServiceCaller
;
import
com.yoho.order.dal.BuyerOrderGoodsMapper
;
import
com.yoho.order.dal.BuyerOrderMapper
;
import
com.yoho.order.dal.BuyerOrderMetaMapper
;
import
com.yoho.order.dal.ExpressCompanyMapper
;
import
com.yoho.order.dal.ExpressInfoMapper
;
import
com.yoho.order.dal.SellerOrderGoodsMapper
;
import
com.yoho.order.dal.SellerOrderMapper
;
import
com.yoho.order.dal.SellerOrderMetaMapper
;
import
com.yoho.order.model.BuyerOrder
;
import
com.yoho.order.model.BuyerOrderGoods
;
import
com.yoho.order.model.BuyerOrderMeta
;
import
com.yoho.order.model.BuyerOrderReq
;
import
com.yoho.order.model.ExpressCompany
;
import
com.yoho.order.model.ExpressInfo
;
import
com.yoho.order.model.SellerOrder
;
import
com.yoho.order.model.SellerOrderGoods
;
import
com.yoho.order.model.SellerOrderMeta
;
import
com.yoho.ufo.order.constant.Constant
;
import
com.yoho.ufo.order.service.IBuyerOrderService
;
import
com.yoho.ufo.service.model.PageResponseBO
;
...
...
@@ -59,8 +65,21 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private
SellerOrderGoodsMapper
sellerOrderGoodsMapper
;
@Autowired
private
BuyerOrderMetaMapper
buyerOrderMetaMapper
;
@Autowired
private
SellerOrderMetaMapper
sellerOrderMetaMapper
;
@Autowired
private
ExpressCompanyMapper
expressCompanyMapper
;
@Autowired
private
ServiceCaller
serviceCaller
;
private
static
final
String
BUYER_ORDER_META_KEY_DELIVERY_ADDRESS
=
"delivery_address"
;
private
static
final
String
SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS
=
"back_delivery_address"
;
public
Map
<
String
,
Integer
>
getCountByJudgeStatus
(){
List
<
Byte
>
toBeJudgedList
=
Lists
.
newArrayList
();
List
<
Byte
>
alreadyJudgedList
=
Lists
.
newArrayList
();
...
...
@@ -130,7 +149,53 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
}
return
buyerOrderMapper
.
updateStatusById
(
req
.
getId
(),
req
.
getStatus
());
}
public
BuyerOrderResp
getReceiveInfoByOrderCode
(
BuyerOrderReq
req
)
{
BuyerOrderMeta
meta
=
buyerOrderMetaMapper
.
selectByOrderCodeAndKey
(
req
.
getOrderCode
(),
BUYER_ORDER_META_KEY_DELIVERY_ADDRESS
);
if
(
null
==
meta
)
{
return
null
;
}
JSONObject
metaValue
=
JSONObject
.
parseObject
(
meta
.
getMetaValue
());
BuyerOrderResp
result
=
new
BuyerOrderResp
();
result
.
setReceiveName
(
metaValue
.
getString
(
"addresseeName"
));
result
.
setReceiveMobile
(
metaValue
.
getString
(
"mobile"
));
result
.
setReceiveAddress
(
rebuildReceiveAddress
(
metaValue
.
getJSONObject
(
"area"
)));
return
result
;
}
public
BuyerOrderResp
getSendBackInfoBySkup
(
BuyerOrderReq
req
)
{
SellerOrderMeta
meta
=
sellerOrderMetaMapper
.
selectBySkupAndKey
(
req
.
getSkup
(),
SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS
);
if
(
null
==
meta
)
{
return
null
;
}
JSONObject
metaValue
=
JSONObject
.
parseObject
(
meta
.
getMetaValue
());
BuyerOrderResp
result
=
new
BuyerOrderResp
();
result
.
setReceiveName
(
metaValue
.
getString
(
"consignee"
));
result
.
setReceiveMobile
(
metaValue
.
getString
(
"phone"
));
result
.
setReceiveAddress
(
metaValue
.
getString
(
"address"
));
return
result
;
}
public
List
<
ExpressCompany
>
queryAllExpressCompanyList
()
{
return
expressCompanyMapper
.
selectAll
();
}
private
String
rebuildReceiveAddress
(
JSONObject
address
)
{
String
fourthName
=
address
.
getString
(
"caption"
);
JSONObject
thirdObj
=
address
.
getJSONObject
(
"parent"
);
String
thirdName
=
thirdObj
.
getString
(
"caption"
);
JSONObject
secondObj
=
thirdObj
.
getJSONObject
(
"parent"
);
String
secondName
=
secondObj
.
getString
(
"caption"
);
JSONObject
firstObj
=
secondObj
.
getJSONObject
(
"parent"
);
String
firstName
=
firstObj
.
getString
(
"caption"
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
firstName
).
append
(
secondName
).
append
(
thirdName
).
append
(
fourthName
);
return
sb
.
toString
();
}
private
List
<
BuyerOrderResp
>
convertToResp
(
List
<
BuyerOrder
>
orderList
,
Map
<
String
,
BuyerOrderGoods
>
buyerGoodsMap
,
...
...
@@ -147,6 +212,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp
.
setSkuStr
(
sellerGoodsMap
.
get
(
skup
).
getStorageId
().
toString
());
resp
.
setDepotNo
(
sellerGoodsMap
.
get
(
skup
).
getDepotNo
());
resp
.
setSellerWaybillCode
(
expressInfoMap
.
get
(
sellerOrder
.
getOrderCode
()).
getWaybillCode
());
resp
.
setSellerOrderCode
(
sellerOrder
.
getOrderCode
());
resp
.
setSkup
(
skup
);
resp
.
setCreateTimeStr
(
null
==
item
.
getCreateTime
()
?
""
:
DateUtil
.
long2DateStr
(
item
.
getCreateTime
().
longValue
()*
1000
,
"yyyy-MM-dd HH:mm:ss"
));
respList
.
add
(
resp
);
...
...
pom.xml
View file @
15f181b
...
...
@@ -34,6 +34,11 @@
<version>
${ufo.model.version}
</version>
</dependency>
<dependency>
<groupId>
com.yoho.ufo.model
</groupId>
<artifactId>
user-ufo-model
</artifactId>
<version>
${ufo.model.version}
</version>
</dependency>
<dependency>
<groupId>
com.yoho.ufo
</groupId>
<artifactId>
ufo-platform-dal
</artifactId>
<version>
${project.version}
</version>
...
...
product/pom.xml
View file @
15f181b
...
...
@@ -26,6 +26,10 @@
<artifactId>
product-ufo-model
</artifactId>
</dependency>
<dependency>
<groupId>
com.yoho.ufo.model
</groupId>
<artifactId>
user-ufo-model
</artifactId>
</dependency>
<dependency>
<groupId>
com.yoho.ufo
</groupId>
<artifactId>
ufo-platform-dal
</artifactId>
</dependency>
...
...
product/src/main/java/com/yoho/ufo/service/impl/ProductAssistService.java
View file @
15f181b
...
...
@@ -91,6 +91,7 @@ public class ProductAssistService {
respBo
.
setBrandId
(
item
.
getBrandId
());
respBo
.
setMaxSortId
(
item
.
getMaxSortId
());
respBo
.
setMaxSortId
(
item
.
getMidSortId
());
respBo
.
setProductName
(
item
.
getProductName
());
}
});
return
this
;
...
...
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
View file @
15f181b
...
...
@@ -10,6 +10,7 @@ import java.util.Map;
import
com.yoho.core.dal.datasource.annotation.Database
;
import
com.yoho.ufo.event.model.StorageNumEvent
;
import
com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -506,8 +507,15 @@ public static void main(String[] args) {
}
// TODO 发推送给商家端
LOGGER
.
info
(
"send info to seller, product_name is {}"
,
bo
.
getProductName
());
InboxBusinessTypeEnum
.
SALE_NOTIFIED_UNSHELF
.
getType
();
InboxBusinessTypeEnum
.
SALE_NOTIFIED_UNSHELF
.
getBusinessType
();
bo
.
getProductName
();
// TODO 调用银联接口退保证金
LOGGER
.
info
(
"send refund info to payment, seller_uid is {}, skup is {}"
,
sp
.
getSellerUid
(),
sp
.
getSkup
());
return
new
ApiResponse
<>(
200
,
"操作成功"
);
}
...
...
product/src/main/java/com/yoho/ufo/service/impl/StoragePriceService.java
View file @
15f181b
...
...
@@ -26,9 +26,10 @@ public class StoragePriceService {
@Autowired
private
ProductConvertService
productConvertService
;
// 如果不需要查询skup表则,返回null。如果需要查询,但查询是空的话则返回空列表
public
List
<
Integer
>
selectProductIdBySkupInfo
(
Product
product
)
{
if
(
null
==
product
||
(
null
==
product
.
getStorageId
()
&&
null
==
product
.
getSkup
()
&&
null
==
product
.
getSellerUid
()))
{
return
Lists
.
newArrayList
()
;
return
null
;
}
StoragePrice
storagePrice
=
productConvertService
.
convertProduct2Skup
(
product
);
...
...
product/src/main/java/com/yoho/ufo/service/impl/StorageService.java
View file @
15f181b
...
...
@@ -51,7 +51,13 @@ public class StorageService {
Product
product
=
OrikaUtils
.
map
(
bo
,
Product
.
class
);
// 如果查询条件含storage_price,先根据条件查询出productId列表 ,再到product表中联合查询
product
.
setProductIdList
(
storagePriceService
.
selectProductIdBySkupInfo
(
product
));
List
<
Integer
>
integerList
=
storagePriceService
.
selectProductIdBySkupInfo
(
product
);
if
(
null
!=
integerList
&&
integerList
.
isEmpty
())
{
// 返回空列表,代表查询了storage_price表,但是查询的接口是空,再联合查询肯定也是空,所有直接返回空
LOGGER
.
warn
(
"storagePriceService.selectProductIdBySkupInfo count is 0.param = {}"
,
bo
);
return
new
PageResponseBO
<>();
}
product
.
setProductIdList
(
integerList
);
int
count
=
productMapper
.
selectProductStorageCount
(
product
);
if
(
count
==
0
)
{
...
...
web/src/main/resources/databases.yml
View file @
15f181b
...
...
@@ -22,6 +22,10 @@ datasources:
-
com.yoho.order.dal.SellerOrderGoodsMapper
-
com.yoho.order.dal.ExpressInfoMapper
-
com.yoho.order.dal.BuyerOrderGoodsMapper
-
com.yoho.order.dal.BuyerOrderMetaMapper
-
com.yoho.order.dal.ExpressCompanyMapper
-
com.yoho.order.dal.BuyerOrderMetaMapper
-
com.yoho.order.dal.SellerOrderMetaMapper
readOnlyInSlave
:
true
...
...
web/src/main/webapp/META-INF/autoconf/databases.yml
View file @
15f181b
...
...
@@ -22,5 +22,9 @@ datasources:
-
com.yoho.order.dal.SellerOrderGoodsMapper
-
com.yoho.order.dal.ExpressInfoMapper
-
com.yoho.order.dal.BuyerOrderGoodsMapper
-
com.yoho.order.dal.BuyerOrderMetaMapper
-
com.yoho.order.dal.ExpressCompanyMapper
-
com.yoho.order.dal.BuyerOrderMetaMapper
-
com.yoho.order.dal.SellerOrderMetaMapper
readOnlyInSlave
:
${readOnlyInSlave}
...
...
web/src/main/webapp/html/goods/storage/storageDetail.html
View file @
15f181b
...
...
@@ -36,6 +36,20 @@
</div>
<script
type=
"text/javascript"
>
var
ENUM
=
{
sku_p_status
:
{
0
:
'待付保证金'
,
1
:
'出售中'
,
2
:
'卖家取消支付'
,
3
:
'卖家支付超时'
,
4
:
'卖家取消出售'
,
100
:
'已出售'
,
101
:
'买家手动取消'
,
102
:
'买家超时未支付'
,
200
:
'平台取消出售'
,
201
:
'鉴定失败'
}
};
function
parseURL
(
url
){
var
url
=
url
.
split
(
"?"
)[
1
];
var
para
=
url
.
split
(
"&"
);
...
...
@@ -57,12 +71,19 @@
location
.
href
=
contextPath
+
"/html/goods/storage/storageList.html"
;
}
});
// /** 1:可售,2卖出,3鉴定失败,4卖家取消, 5客服取消. */
//
// * 卖家操作
//* 0:初始(未支付保证金),*1:可售(已经支付保证金),2:卖家取消支付保证金,3:卖家超时未支付保证金,4:卖家支付保证金后取消售卖
//* 买家操作
//* 100:购买使得商品卖出(可能下单未支付,且未超时,或者已支付),101:取消卖出(买家手动),102:取消卖出(超时未支付)
//* 平台操作
//* 200:客服取消,201:鉴定失败
$
(
"#status"
).
myCombobox
({
prompt
:
"状态"
,
width
:
200
,
data
:
[{
id
:
'1'
,
text
:
'待付保证金'
},
{
id
:
'2'
,
text
:
'卖家取消支付'
},
{
id
:
'2'
,
text
:
'卖家支付超时'
},
{
id
:
'2'
,
text
:
'出售中'
}
,
{
id
:
'2'
,
text
:
'卖家取消出售'
},
{
id
:
'2'
,
text
:
'平台取消出售'
},
{
id
:
'2'
,
text
:
'已出售'
}],
data
:
[{
id
:
'0'
,
text
:
'待付保证金'
},
{
id
:
'2'
,
text
:
'卖家取消支付'
},
{
id
:
'3'
,
text
:
'卖家支付超时'
},
{
id
:
'1'
,
text
:
'出售中'
},
{
id
:
'4'
,
text
:
'卖家取消出售'
},
{
id
:
'200'
,
text
:
'平台取消出售'
},
{
id
:
'100'
,
text
:
'已出售'
},
{
id
:
'101'
,
text
:
'买家手动取消'
},
{
id
:
'102'
,
text
:
'买家超时未支付'
},
{
id
:
'201'
,
text
:
'鉴定失败'
}],
valueField
:
"id"
,
textField
:
"text"
});
...
...
@@ -147,10 +168,7 @@
width
:
50
,
align
:
"center"
,
formatter
:
function
(
value
,
rowData
)
{
if
(
value
==
1
)
{
return
'开启'
;
}
return
'关闭'
;
return
ENUM
.
sku_p_status
[
value
];
},
},
{
title
:
"创建时间"
,
...
...
@@ -164,7 +182,7 @@
align
:
"center"
,
formatter
:
function
(
value
,
rowData
)
{
if
(
rowData
.
status
==
1
)
{
return
"<a role='edit' dataId='"
+
rowData
.
skup
+
"' style='margin-left:10px'>取消售卖</a>"
;
return
"<a role='edit' dataId='"
+
rowData
.
skup
+
"'
product_name='"
+
rowData
.
productName
+
"'
style='margin-left:10px'>取消售卖</a>"
;
}
else
{
return
''
;
}
...
...
@@ -182,7 +200,7 @@
iconCls
:
"icon-edit"
,
onClick
:
function
()
{
var
id
=
$
(
this
).
attr
(
"dataId"
);
editRow
(
id
);
editRow
(
id
,
$
(
this
).
attr
(
"product_name"
)
);
}
});
}
...
...
@@ -243,7 +261,7 @@
}
function
editRow
(
id
)
{
function
editRow
(
id
,
productName
)
{
var
skup
=
id
;
var
div
=
$
(
"<div>"
).
appendTo
(
$
(
document
.
body
));
var
message
=
"确定要取消售卖此件商品吗?商品取消售卖后,卖家的该件商品强制下架,退还卖家保证金"
;
...
...
@@ -255,7 +273,7 @@
interval
:
500
,
text
:
""
});
$
.
post
(
contextPath
+
"/product/cancelSaleSkup"
,{
"skup"
:
skup
},
function
(
data
)
{
$
.
post
(
contextPath
+
"/product/cancelSaleSkup"
,{
"skup"
:
skup
,
"productName"
:
productName
},
function
(
data
)
{
window
.
top
.
$
.
messager
.
progress
(
"close"
);
if
(
data
.
code
==
200
)
{
$
(
"#skupTable"
).
myDatagrid
(
"reload"
);
...
...
web/src/main/webapp/html/goods/storage/storageList.html
View file @
15f181b
...
...
@@ -62,7 +62,7 @@
$
(
"#storageNum"
).
myCombobox
({
prompt
:
"商品库存"
,
width
:
200
,
data
:
[{
id
:
'1'
,
text
:
'有库存'
},
{
id
:
'
2
'
,
text
:
'无库存'
}],
data
:
[{
id
:
'1'
,
text
:
'有库存'
},
{
id
:
'
0
'
,
text
:
'无库存'
}],
valueField
:
"id"
,
textField
:
"text"
});
...
...
web/src/main/webapp/html/judgeCenter/list.html
View file @
15f181b
...
...
@@ -6,6 +6,8 @@
<script
src=
"/ufoPlatform/js/include.js"
></script>
</head>
<body
class=
"easyui-layout"
>
<input
type=
"hidden"
id=
"buyerOrderCode"
>
<input
type=
"skup"
id=
"skup"
>
<div
region=
"north"
style=
"height:300px;"
>
<script>
document
.
write
(
addHead
(
'鉴定中心'
,
'列表管理'
));
...
...
@@ -261,8 +263,8 @@ function getToBeJudgedList(){
if
(
rowData
.
status
==
2
)
{
return
"<a role='confirm' dataId='"
+
rowData
.
id
+
"' style='margin-left:10px;background-color: #5cb85c !important;'>确认收货</a>"
;
}
else
if
(
rowData
.
status
==
3
)
{
return
"<a role='pass' dataId='"
+
rowData
.
id
+
"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定通过</a>"
+
"<a role='reject' dataId='"
+
rowData
.
id
+
"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定不通过</a>"
;
return
"<a role='pass' dataId='"
+
rowData
.
id
+
"'"
+
" orderCode='"
+
rowData
.
orderCode
+
"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定通过</a>"
+
"<a role='reject' dataId='"
+
rowData
.
id
+
"'"
+
" skup='"
+
rowData
.
skup
+
"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定不通过</a>"
;
}
}
}]],
...
...
@@ -293,51 +295,21 @@ function getToBeJudgedList(){
});
}
});
}
});
$
(
this
).
datagrid
(
"getPanel"
).
find
(
"a[role='pass']"
).
linkbutton
({
onClick
:
function
()
{
var
shopsId
=
$
(
this
).
attr
(
"dataId"
);
$
.
post
(
contextPath
+
"/couponLimit/shopStartOrStop.do"
,
{
shopsIdForShop
:
shopsId
,
shopLimitStatus
:
0
,
type
:
0
},
function
(
data
)
{
if
(
data
.
code
==
CODE_SUCCESS
)
{
$
(
"#limitListTable"
).
datagrid
(
"reload"
);
window
.
self
.
$
.
messager
.
show
({
title
:
"提示"
,
msg
:
"关闭成功!"
});
}
else
{
window
.
self
.
$
.
messager
.
alert
(
"失败"
,
data
.
message
,
"error"
);
}
});
var
buyerOrderCode
=
$
(
this
).
attr
(
"orderCode"
);
$
(
"#buyerOrderCode"
).
val
(
buyerOrderCode
);
addPassPage
(
$
(
this
).
attr
(
"dataId"
));
}
});
$
(
this
).
datagrid
(
"getPanel"
).
find
(
"a[role='reject']"
).
linkbutton
({
onClick
:
function
()
{
var
shopsId
=
$
(
this
).
attr
(
"dataId"
);
$
.
post
(
contextPath
+
"/couponLimit/shopStartOrStop.do"
,
{
shopsIdForShop
:
shopsId
,
shopLimitStatus
:
0
,
type
:
0
},
function
(
data
)
{
if
(
data
.
code
==
CODE_SUCCESS
)
{
$
(
"#limitListTable"
).
datagrid
(
"reload"
);
window
.
self
.
$
.
messager
.
show
({
title
:
"提示"
,
msg
:
"关闭成功!"
});
}
else
{
window
.
self
.
$
.
messager
.
alert
(
"失败"
,
data
.
message
,
"error"
);
}
});
var
skup
=
$
(
this
).
attr
(
"skup"
);
$
(
"#skup"
).
val
(
skup
);
addRejectPage
(
$
(
this
).
attr
(
"dataId"
));
}
});
...
...
@@ -416,34 +388,123 @@ function getAlreadyJudgedList(){
});
}
function
addConfirmPage
()
{
var
div
=
$
(
"<div id='confirmDiv'>"
).
appendTo
(
$
(
document
.
body
));
var
url
=
contextPath
+
"/html/promotion/useCouponLimit/add.html"
;
function
addPassPage
(
id
)
{
var
div
=
$
(
"<div id='passDiv'>"
).
appendTo
(
$
(
document
.
body
));
var
url
=
contextPath
+
"/html/judgeCenter/pass.html"
;
$
(
div
).
myDialog
({
width
:
"50%"
,
height
:
"40%"
,
title
:
"导入商品的用券限制"
,
height
:
"60%"
,
title
:
"发货(鉴定通过)"
,
href
:
url
,
modal
:
true
,
collapsible
:
true
,
cache
:
false
,
buttons
:
[{
text
:
"保存"
,
text
:
"取消"
,
iconCls
:
"icon-cancel"
,
handler
:
function
()
{
$
(
div
).
dialog
(
"close"
);
}
},{
text
:
"发货"
,
id
:
"saveBtn"
,
iconCls
:
"icon-save"
,
onClick
:
function
()
{
$
(
'#uploadFile'
).
click
(
);
deliverGoods
(
id
);
}
},
{
text
:
"关闭"
,
}]
});
}
function
addRejectPage
(
id
)
{
var
div
=
$
(
"<div id='rejectDiv'>"
).
appendTo
(
$
(
document
.
body
));
var
url
=
contextPath
+
"/html/judgeCenter/reject.html"
;
$
(
div
).
myDialog
({
width
:
"50%"
,
height
:
"60%"
,
title
:
"商品寄回(鉴定不通过)"
,
href
:
url
,
modal
:
true
,
collapsible
:
true
,
cache
:
false
,
buttons
:
[{
text
:
"取消"
,
iconCls
:
"icon-cancel"
,
handler
:
function
()
{
$
(
div
).
dialog
(
"close"
);
}
},{
text
:
"寄回"
,
id
:
"saveBtn"
,
iconCls
:
"icon-save"
,
onClick
:
function
()
{
sendBackGoods
(
id
);
}
}]
});
}
function
deliverGoods
(
id
){
var
expressCompany
=
$
(
"#expressCompany"
).
myCombobox
(
"getValue"
);
var
waybillCode
=
$
(
"#waybillCode"
).
textbox
(
"getValue"
);
if
(
expressCompany
==
''
){
alert
(
"请选择快递公司!"
);
return
;
}
if
(
waybillCode
==
''
){
alert
(
"请填写快递单号!"
)
return
;
}
$
.
post
(
contextPath
+
"/buyerOrder/updateOrderStatus"
,
{
id
:
id
,
status
:
4
,
expressCompay
:
expressCompany
,
waybillCode
:
waybillCode
},
function
(
data
)
{
if
(
data
.
code
==
200
)
{
$
(
"#passDiv"
).
dialog
(
"close"
);
$
(
"#orderListTable"
).
datagrid
(
"reload"
);
window
.
self
.
$
.
messager
.
show
({
title
:
"提示"
,
msg
:
"鉴定通过操作成功!"
});
}
else
{
window
.
self
.
$
.
messager
.
alert
(
"失败"
,
"失败!"
,
"error"
);
}
});
}
function
sendBackGoods
(
id
){
var
expressCompany
=
$
(
"#expressCompany"
).
myCombobox
(
"getValue"
);
var
waybillCode
=
$
(
"#waybillCode"
).
textbox
(
"getValue"
);
if
(
expressCompany
==
''
){
alert
(
"请选择快递公司!"
);
return
;
}
if
(
waybillCode
==
''
){
alert
(
"请填写快递单号!"
)
return
;
}
$
.
post
(
contextPath
+
"/buyerOrder/updateOrderStatus"
,
{
id
:
id
,
status
:
13
,
expressCompay
:
expressCompany
,
waybillCode
:
waybillCode
},
function
(
data
)
{
if
(
data
.
code
==
200
)
{
$
(
"#rejectDiv"
).
dialog
(
"close"
);
$
(
"#orderListTable"
).
datagrid
(
"reload"
);
window
.
self
.
$
.
messager
.
show
({
title
:
"提示"
,
msg
:
"鉴定不通过操作成功!"
});
}
else
{
window
.
self
.
$
.
messager
.
alert
(
"失败"
,
"失败!"
,
"error"
);
}
});
}
</script>
</body>
</html>
\ No newline at end of file
...
...
web/src/main/webapp/html/judgeCenter/pass.html
0 → 100644
View file @
15f181b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
main
</title>
<script
src=
"/ufoPlatform/js/include.js"
></script>
</head>
<body
class=
"easyui-layout"
fit=
"true"
>
<div
id=
"passDiv"
region=
"center"
>
<table
id=
"passTable"
border=
"1px"
cellpadding=
"1"
cellspacing=
"0"
align=
"center"
style=
"margin-top: 30px; line-height: 30px;width:95%;border-color: #999999"
>
<tr>
<td>
买家地址:
</td>
<td
colspan=
"2"
>
<span
id=
"receiveInfo"
></span>
</td>
</tr>
<tr>
<td>
快递公司:
</td>
<td
colspan=
"2"
>
<input
id=
"expressCompany"
class=
"easyui-combobox"
/>
</td>
</tr>
<tr>
<td>
快递单号:
</td>
<td
colspan=
"2"
>
<input
type=
"text"
class=
"easyui-textbox"
id=
"waybillCode"
style=
"width:300px"
/>
</td>
</tr>
</table>
</div>
<script>
$
(
function
()
{
//根据买家订单号获取买家收货信息
getReceiveInfo
();
// 快递公司下拉框
initExpressCompanyDropdown
();
});
function
getReceiveInfo
(){
var
form
=
new
FormData
();
form
.
append
(
"orderCode"
,
document
.
getElementById
(
"buyerOrderCode"
).
value
);
//发送请求
$
.
ajax
({
type
:
"POST"
,
url
:
contextPath
+
'/buyerOrder/getReceiveInfoByOrderCode'
,
data
:
form
,
async
:
false
,
cache
:
false
,
contentType
:
false
,
processData
:
false
,
dataType
:
'json'
,
success
:
function
(
result
)
{
if
(
result
.
code
==
200
)
{
var
name
=
result
.
data
.
receiveName
;
var
mobile
=
result
.
data
.
receiveMobile
;
var
address
=
result
.
data
.
receiveAddress
;
$
(
"#receiveInfo"
).
html
(
"姓名:"
+
name
+
"<br>"
+
"手机号:"
+
mobile
+
"<br>"
+
"地址:"
+
address
);
}
else
{
$
.
messager
.
alert
(
"失败"
,
result
.
message
,
"error"
);
}
}
});
}
function
initExpressCompanyDropdown
()
{
$
.
ajax
({
contentType
:
"application/json"
,
dataType
:
"json"
,
type
:
"POST"
,
url
:
contextPath
+
'/buyerOrder/queryExpressCompanyList'
,
data
:
{},
success
:
function
(
data
)
{
if
(
data
.
code
!=
200
||
!
data
.
data
||
data
.
data
.
length
==
0
)
{
return
;
}
$
(
"#expressCompany"
).
myCombobox
({
width
:
130
,
data
:
data
.
data
,
valueField
:
"id"
,
textField
:
"companyName"
});
}
});
}
</script>
</body>
</html>
\ No newline at end of file
...
...
web/src/main/webapp/html/judgeCenter/reject.html
0 → 100644
View file @
15f181b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
main
</title>
<script
src=
"/ufoPlatform/js/include.js"
></script>
</head>
<body
class=
"easyui-layout"
fit=
"true"
>
<div
id=
"rejectDiv"
region=
"center"
>
<table
id=
"rejectTable"
border=
"1px"
cellpadding=
"1"
cellspacing=
"0"
align=
"center"
style=
"margin-top: 30px; line-height: 30px;width:95%;border-color: #999999"
>
<tr>
<td>
商品寄回地址:
</td>
<td
colspan=
"2"
>
<span
id=
"sendBackInfo"
></span>
</td>
</tr>
<tr>
<td>
快递公司:
</td>
<td
colspan=
"2"
>
<input
id=
"expressCompany"
class=
"easyui-combobox"
/>
</td>
</tr>
<tr>
<td>
快递单号:
</td>
<td
colspan=
"2"
>
<input
type=
"text"
class=
"easyui-textbox"
id=
"waybillCode"
style=
"width:300px"
/>
</td>
</tr>
</table>
</div>
<script>
$
(
function
()
{
//根据skup获取卖家收货信息
getSendBackInfo
();
// 快递公司下拉框
initExpressCompanyDropdown
();
});
function
getSendBackInfo
(){
var
form
=
new
FormData
();
form
.
append
(
"skup"
,
document
.
getElementById
(
"skup"
).
value
);
//发送请求
$
.
ajax
({
type
:
"POST"
,
url
:
contextPath
+
'/buyerOrder/getSendBackInfoBySkup'
,
data
:
form
,
async
:
false
,
cache
:
false
,
contentType
:
false
,
processData
:
false
,
dataType
:
'json'
,
success
:
function
(
result
)
{
if
(
result
.
code
==
200
)
{
var
name
=
result
.
data
.
receiveName
;
var
mobile
=
result
.
data
.
receiveMobile
;
var
address
=
result
.
data
.
receiveAddress
;
$
(
"#sendBackInfo"
).
html
(
"姓名:"
+
name
+
"<br>"
+
"手机号:"
+
mobile
+
"<br>"
+
"地址:"
+
address
);
}
else
{
$
.
messager
.
alert
(
"失败"
,
result
.
message
,
"error"
);
}
}
});
}
function
initExpressCompanyDropdown
()
{
$
.
ajax
({
contentType
:
"application/json"
,
dataType
:
"json"
,
type
:
"POST"
,
url
:
contextPath
+
'/buyerOrder/queryExpressCompanyList'
,
data
:
{},
success
:
function
(
data
)
{
if
(
data
.
code
!=
200
||
!
data
.
data
||
data
.
data
.
length
==
0
)
{
return
;
}
$
(
"#expressCompany"
).
myCombobox
({
width
:
130
,
data
:
data
.
data
,
valueField
:
"id"
,
textField
:
"companyName"
});
}
});
}
</script>
</body>
</html>
\ No newline at end of file
...
...
web/src/main/webapp/html/product/productEdit.html
View file @
15f181b
<!DOCTYPE html>
<div
id=
"tt"
class=
"easyui-layout"
fit=
"true"
style=
"overflow-y: scroll"
>
<input
id=
"editBrandId"
type=
"text"
>
<input
id=
"editSeriesId"
type=
"text"
>
<input
id=
"editProductName"
type=
"text"
/>
<input
id=
"editSaleTime"
type=
"text"
/>
<input
id=
"editGender"
type=
"text"
/>
<input
id=
"editMaxSortId"
type=
"text"
/>
<input
id=
"editMidSortId"
type=
"text"
/>
<input
id=
"editProductCode"
type=
"text"
/>
<input
id=
"editMinPrice"
type=
"text"
/>
<input
id=
"editMaxPrice"
type=
"text"
/>
<input
id=
"editColorId"
type=
"text"
/>
<input
id=
"editColorName"
type=
"text"
/>
<input
id=
"editGoodsName"
type=
"text"
/>
<input
id=
"editSizeIdList"
type=
"text"
/>
<input
id=
"editImageUrlList"
type=
"text"
/>
<input
id=
"editKeyWords"
type=
"text"
/>
<input
id=
"editGoodsId"
type=
"hidden"
/>
<input
id=
"editId"
type=
"hidden"
/>
<html>
<head>
<meta
charset=
"UTF-8"
/>
<title>
Yoho!Buy运营平台
</title>
<script
src=
"/ufoPlatform/js/include.js"
></script>
<script
src=
"/ufoPlatform/js/ajaxfileupload.js"
></script>
<style>
.product-detail-page
ul
,
.product-detail-page
li
{
list-style
:
none
;
padding
:
0
;
margin
:
0
;
}
.product-detail-page
.container
>
li
{
border-bottom
:
1px
solid
#eee
;
padding-bottom
:
20px
;
}
.product-detail-page
.container
{
padding
:
0
30px
;
}
.product-detail-page
.base-info
li
,
.product-detail-page
.keyword
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
10px
;
}
.product-detail-page
.label
{
width
:
120px
;
font-size
:
14px
;
text-align
:
right
;
}
.product-detail-page
.red
{
color
:
red
;
}
.product-detail-page
.group-color
,
.product-detail-page
.group-size
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
20px
;
}
.product-detail-page
.group-color
li
{
margin-right
:
5px
;
float
:
left
;
line-height
:
30px
;
margin-left
:
5px
;
padding
:
0
5px
;
position
:
relative
;
}
.product-detail-page
.group-color
.actived
:before
{
content
:
''
;
width
:
100%
;
height
:
100%
;
display
:
block
;
position
:
absolute
;
top
:
0
;
background
:
#000
;
opacity
:
0.5
;
border-radius
:
5px
;
}
.product-detail-page
.group-size
.size
{
float
:
left
;
margin-left
:
10px
;
}
.product-detail-page
.goods-image
{
display
:
flex
;
}
.product-detail-page
.goods-image
.img
{
width
:
104px
;
height
:
104px
;
margin-right
:
10px
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
position
:
relative
;
}
.product-detail-page
.goods-image
.img
:hover:before
{
content
:
"删除"
;
width
:
100%
;
display
:
block
;
position
:
absolute
;
top
:
0
;
background
:
#000
;
opacity
:
0.5
;
color
:
#fff
;
text-align
:
center
;
line-height
:
104px
;
}
</style>
</head>
<body
class=
"easyui-layout product-detail-page"
fit=
"true"
>
<div
region=
"north"
>
<script>
document
.
write
(
addHead
(
'商品管理 /基础商品 /商品创建'
,
''
));
</script>
</div>
<div
region=
"center"
style=
"overflow-y: scroll; top: 65px; padding-top: 10px;"
>
<from
id=
"productDetail"
>
<ul
class=
"container"
>
<li>
<h2>
基本信息
</h2>
<ul
class=
"base-info"
>
<li>
<div
class=
"label"
>
品牌
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<input
id=
"editBrandId"
type=
"text"
name=
"brandId"
>
系列:
<input
id=
"editSeriesId"
name=
"seriesId"
type=
"text"
>
</div>
</li>
<li>
<div
class=
"label"
>
商品名称
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<input
id=
"editProductName"
type=
"text"
name=
"productName"
/>
</div>
</li>
<li>
<div
class=
"label"
>
发售日期
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<input
id=
"editSaleTime"
type=
"text"
name=
"saleTime"
/>
</div>
</li>
<li>
<div
class=
"label"
>
性别
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<label
for=
"boy"
><input
id=
"boy"
type=
"radio"
value=
"1"
name=
"gender"
checked
>
男
</label>
<label
for=
"girl"
><input
id=
"girl"
type=
"radio"
value=
"2"
name=
"gender"
>
女
</label>
<label
for=
"all"
><input
id=
"all"
type=
"radio"
value=
"3"
name=
"gender"
>
通用
</label>
</div>
</li>
<li>
<div
class=
"label"
>
分类
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<input
id=
"editMaxSortId"
type=
"text"
name=
"maxSortId"
/>
<input
id=
"editMidSortId"
type=
"text"
name=
"midSortId"
/>
货号
<span
class=
"red"
>
*
</span>
:
<input
id=
"editProductCode"
type=
"text"
name=
"productCode"
/>
</div>
</li>
<li>
<div
class=
"label"
>
商品价格限制
<span
class=
"red"
>
*
</span>
:
</div>
<div
class=
"base-info-item"
>
<input
id=
"editMinPrice"
type=
"text"
name=
"minPrice"
/>
<span
style=
"margin-right: 20px;c"
>
~
</span>
<input
id=
"editMaxPrice"
type=
"text"
name=
"maxPrice"
/>
</div>
</li>
</ul>
</li>
<li>
<h2>
颜色尺码
</h2>
<div
class=
"group-color"
>
<div
class=
"label"
>
*颜色
</div>
<ul
style=
"float:left; margin-left: 10px;"
>
</ul>
</div>
<div
class=
"group-size"
>
<div
class=
"label"
>
*尺寸
</div>
<div
class=
"size"
></div>
</div>
<table
id=
"colorSizeTable"
style=
"width:100%;height:auto"
></table>
</li>
<li>
<h2>
商品图片
</h2>
<div
class=
"goods-image"
>
<div
id=
"imageUpload"
></div>
</div>
</li>
<li>
<h2>
商品关键词
</h2>
<div
class=
"keyword"
>
<div
class=
"label"
style=
"width: 120px;"
>
商品关键词:
</div>
<div
class=
"keyword-right"
>
<input
type=
"text"
id=
"keyword"
name=
"keyWords"
>
</div>
</div>
<div
class=
"red"
style=
"margin-left:120px;"
>
*每个关键词用英文逗号隔开
</div>
</li>
<li
style=
"text-align: center; margin-top: 20px;"
>
<a
id=
"submitBtn"
class=
"easyui-linkbutton btn-success"
>
提交
</a>
<a
id=
"cancelBtn"
class=
"easyui-linkbutton btn-default"
>
取消
</a>
</li>
</ul>
</from>
</div>
<script>
/* 新增,修改公用页面
...
...
@@ -29,115 +203,536 @@
2.修改:首先根据传进来的id,获取商品信息把页面控件填写好。hidden记录id、goodsId、等参数
提交参数:{"brandId":78,"colorId":2,"colorName":"蓝色","editImage":1,"gender":3,"goodsId":6,"goodsName":"自定义蓝色","id":10000004,"imageUrlList":["https://img10.static.yhbimg.com/goodsimg/2018/08/25/16/01e99496407347514356e5fe327d1f661d.jpg","https://img12.static.yhbimg.com/goodsimg/2018/08/25/16/0292fcebd071444401e6de340bcf2d8c19.jpg"],"keyWords":"球鞋,adidas2","maxPrice":"898","maxSortId":10,"midSortId":18,"minPrice":"598","productCode":"009-009-009-e","productName":"测试商品009-e","saleTime":"2018-11-12","seriesId":8}
不可修改:品牌、分类、颜色、尺码、SKU(颜色展示名称除外:goodsName)
*/
*/
var
productDetail
=
{
initData
:
function
(
detail
)
{
$
(
"#editBrandId"
).
combobox
(
'select'
,
detail
.
brandId
)
$
(
"#editProductName"
).
textbox
(
'setValue'
,
detail
.
productName
);
$
(
"#editSaleTime"
).
myDatebox
(
'setValue'
,
detail
.
saleTime
);
$
(
'input[name=gender]'
).
eq
(
detail
.
gender
-
1
).
attr
(
'checked'
,
'true'
);
$
(
'#editMinPrice'
).
textbox
(
'setValue'
,
detail
.
minPrice
);
$
(
'#editMaxPrice'
).
textbox
(
'setValue'
,
detail
.
maxPrice
);
$
(
'#editProductCode'
).
textbox
(
'setValue'
,
detail
.
productCode
);
$
(
"#editMaxSortId"
).
combobox
(
'select'
,
detail
.
maxSortId
);
$
(
"#editMidSortId"
).
combobox
(
'select'
,
detail
.
midSortId
);
$
(
"#editSeriesId"
).
combobox
(
'select'
,
detail
.
seriesId
);
$
(
'.group-color li[data-id='
+
detail
.
colorId
+
']'
).
addClass
(
'actived'
);
if
(
detail
.
imageUrlList
.
length
>
0
)
{
detail
.
imageUrlList
.
map
(
function
(
item
)
{
$
(
'#imageUpload'
).
before
(
'<div class="img" data-url="'
+
item
+
'" style="background-image:url('
+
item
+
');">'
);
});
}
},
initForm
:
function
()
{
var
that
=
this
;
$
(
function
()
{
$
(
"#editBrandId"
).
myCombobox
({
url
:
contextPath
+
'/brand/getBrandName'
,
method
:
"get"
,
editable
:
false
,
prompt
:
"选择品牌"
,
width
:
200
,
valueField
:
"id"
,
textField
:
"text"
,
loadFilter
:
function
(
data
)
{
return
defaultLoadFilter
(
data
);
}
});
$
(
"#editSeriesId"
).
myCombobox
({
url
:
contextPath
+
'/brandSeries/querySeriesByBrandId?brandId='
,
method
:
"get"
,
editable
:
false
,
prompt
:
"选择品牌"
,
width
:
200
,
valueField
:
"id"
,
textField
:
"text"
,
loadFilter
:
function
(
data
)
{
return
defaultLoadFilter
(
data
);
}
});
$
(
"#editProductName"
).
textbox
({
required
:
true
,
missingMessage
:
"商品名称不能为空"
,
prompt
:
"商品名称"
//width: 240
});
$
(
"#editSaleTime"
).
myDatebox
({
prompt
:
"发售时间"
});
$
(
"#editGender"
).
textbox
({
prompt
:
"性别"
});
$
(
'#editMaxSortId'
).
myCombobox
({
url
:
contextPath
+
"/productSort/getLevel1SortIdAndName"
,
method
:
"get"
,
editable
:
false
,
valueField
:
'id'
,
textField
:
'text'
,
prompt
:
"一级分类"
,
loadFilter
:
function
(
data
)
{
return
defaultLoadFilter
(
data
);
},
onSelect
:
function
(
rec
)
{
if
(
0
===
rec
.
id
)
{
try
{
$
(
'#midSortId'
).
combobox
(
'disable'
);
}
catch
(
e
)
{
}
return
;
}
try
{
$
(
'#editMidSortId'
).
combobox
(
'clear'
);
$
(
'#editMidSortId'
).
combobox
(
'reload'
,
contextPath
+
"/productSort/getLevel2SortBySortId?sortId="
+
rec
.
id
);
$
(
'#editMidSortId'
).
combobox
(
'enable'
);
}
catch
(
e
)
{
}
}
});
$
(
'#editMidSortId'
).
myCombobox
({
method
:
"get"
,
editable
:
false
,
valueField
:
'id'
,
textField
:
'text'
,
multiple
:
true
,
prompt
:
"二级分类"
,
loadFilter
:
function
(
data
)
{
data
=
defaultLoadFilter
(
data
);
/* for (var i = 0; i < data.length; i ++) {
$('#editMidSortId').combobox('select', data[i].id);
} */
return
data
;
}
});
$
(
"#editProductCode"
).
textbox
({
prompt
:
"请输入"
});
$
(
"#editMinPrice"
).
textbox
({
prompt
:
"最低价"
});
$
(
"#editMaxPrice"
).
textbox
({
prompt
:
"最高价"
});
//<input id="editColorId" type="text"/>
//<input id="editSizeIdList" type="text"/>
//<input id="editImageUrlList" type="text"/>
//<input id="editKeyWords" type="text"/>
$
(
"#editKeyWords"
).
textbox
({
prompt
:
"请输入"
});
//<input id="goodsId" type="hidden"/>
// 编辑的情况需要根据id查询商品信息
$
.
ajax
({
contentType
:
"application/json"
,
dataType
:
"json"
,
type
:
"GET"
,
url
:
contextPath
+
'/product/find?id=10000004'
,
success
:
function
(
data
)
{
if
(
data
.
code
!=
200
)
{
return
;
$
(
"#editProductName"
).
textbox
({
required
:
true
,
missingMessage
:
"商品名称不能为空"
,
prompt
:
"商品名称"
,
width
:
460
});
$
(
'#keyword'
).
textbox
({
width
:
700
});
$
(
"#editBrandId"
).
combobox
({
editable
:
false
,
prompt
:
"选择品牌"
,
width
:
200
,
valueField
:
"id"
,
textField
:
"text"
,
onSelect
:
function
(
data
)
{
$
(
'#editSeriesId'
).
combobox
(
'enable'
);
$
(
"#editSeriesId"
).
myCombobox
(
'reload'
,
contextPath
+
'/brandSeries/querySeriesByBrandId?brandId='
+
data
.
id
);
$
(
"#editSeriesId"
).
combobox
(
'select'
)
}
});
$
(
"#editSeriesId"
).
myCombobox
({
method
:
"get"
,
editable
:
false
,
prompt
:
"请选择"
,
width
:
200
,
valueField
:
"id"
,
textField
:
"text"
,
loadFilter
:
function
(
data
)
{
if
(
data
&&
data
.
code
==
200
&&
data
.
data
.
length
>
0
)
{
$
(
"#editSeriesId"
).
combobox
(
'select'
,
data
.
data
[
0
].
id
);
}
return
defaultLoadFilter
(
data
);
}
});
$
(
'#editMaxSortId'
).
myCombobox
({
editable
:
false
,
valueField
:
'id'
,
textField
:
'text'
,
prompt
:
"一级分类"
,
onSelect
:
function
(
rec
)
{
$
(
'#editMidSortId'
).
combobox
(
'clear'
);
$
(
'#editMidSortId'
).
combobox
(
'reload'
,
contextPath
+
"/productSort/getLevel2SortBySortId?sortId="
+
rec
.
id
);
if
(
!
that
.
productId
)
{
$
(
'#editMidSortId'
).
combobox
(
'enable'
);
}
}
// 设置页面上面所有属性值和hidden属性
}
});
});
$
(
"#editSaleTime"
).
myDatebox
({
prompt
:
"发售时间"
});
$
(
'#editMidSortId'
).
myCombobox
({
method
:
'get'
,
editable
:
false
,
valueField
:
'id'
,
textField
:
'text'
,
prompt
:
"二级分类"
,
loadFilter
:
function
(
data
)
{
if
(
data
&&
data
.
code
==
200
&&
data
.
data
.
length
>
0
)
{
$
(
"#editMidSortId"
).
combobox
(
'select'
,
data
.
data
[
0
].
id
);
}
return
defaultLoadFilter
(
data
);
},
onSelect
:
function
(
opt
)
{
that
.
getSizeInfo
(
opt
.
id
);
}
});
$
(
"#editProductCode"
).
textbox
({
prompt
:
"请输入"
,
required
:
true
,
missingMessage
:
"货号不能为空"
});
$
(
"#editMinPrice"
).
textbox
({
prompt
:
"最低价"
,
required
:
true
,
missingMessage
:
"最低价不能为空"
});
$
(
"#editMaxPrice"
).
textbox
({
prompt
:
"最高价"
,
required
:
true
,
missingMessage
:
"最高价不能为空"
});
$
(
'#colorSizeTable'
).
myDatagrid
({
fit
:
false
,
fitColumns
:
true
,
autoRowHeight
:
true
,
nowrap
:
false
,
columns
:
[[{
title
:
"色系名称"
,
field
:
"colorName"
,
width
:
40
,
align
:
"center"
},
{
title
:
"颜色展示名称"
,
field
:
"goodsName"
,
width
:
80
,
height
:
50
,
align
:
"center"
,
formatter
:
function
(
value
)
{
return
'<input type="text" class="goods-name" value="'
+
value
+
'">'
;
}
},
{
title
:
"尺码"
,
field
:
"size"
,
width
:
100
,
align
:
"center"
},
{
title
:
"SKU"
,
field
:
"sku"
,
width
:
80
,
align
:
"center"
}]],
cache
:
false
,
pagination
:
false
,
idField
:
"id"
,
singleSelect
:
false
,
checkOnSelect
:
false
,
onLoadSuccess
:
function
()
{
$
(
'.goods-name'
).
textbox
({
width
:
100
});
}
});
if
(
!
this
.
productId
)
{
$
(
'#editSeriesId'
).
combobox
(
'disable'
);
$
(
'#editMidSortId'
).
combobox
(
'disable'
);
}
else
{
$
(
"#editBrandId"
).
combobox
(
'disable'
);
$
(
"#editMaxSortId"
).
combobox
(
'disable'
);
$
(
"#editMidSortId"
).
combobox
(
'disable'
);
}
},
init
:
function
()
{
var
that
=
this
;
this
.
productId
=
this
.
getUrlParam
(
'id'
);
this
.
detailData
=
{};
this
.
submitFlag
=
false
;
this
.
colorSizeTableData
=
{
total
:
0
,
rows
:
[]
};
this
.
initForm
();
$
(
"#imageUpload"
).
imageUpload
({
width
:
104
,
height
:
104
,
realInputName
:
"goodsImage"
,
url
:
contextPath
+
'/fileupload/uploadFile'
,
queryParams
:
{
bucket
:
"goodsimg"
},
onBeforeSubmit
:
function
()
{
$
.
messager
.
progress
({
title
:
"正在执行"
,
msg
:
"正在执行,请稍后..."
,
interval
:
500
,
text
:
""
});
},
filterFileName
:
function
(
data
)
{
if
(
!
data
||
data
.
code
!=
200
)
{
$
.
messager
.
progress
(
"close"
);
$
.
messager
.
alert
(
"错误"
,
data
.
message
);
return
""
;
}
return
data
.
data
.
url
;
},
onLoadSuccess
:
function
(
data
)
{
$
.
messager
.
progress
(
"close"
);
$
(
document
).
find
(
'.file-close'
).
click
();
$
(
'#imageUpload'
).
before
(
'<div class="img" data-url="'
+
data
.
data
.
url
+
'" style="background-image:url('
+
data
.
data
.
url
+
');">'
);
return
false
;
}
});
$
.
when
(
this
.
getBrandList
(),
this
.
getMaxSortList
(),
this
.
getColorInfo
()).
then
(
function
(
brand
,
maxSort
,
colors
)
{
var
brandId
=
''
;
brand
=
brand
[
0
];
maxSort
=
maxSort
[
0
];
colors
=
colors
[
0
]
||
[];
if
(
brand
&&
brand
.
code
==
200
)
{
$
(
"#editBrandId"
).
combobox
({
data
:
brand
.
data
||
[]
});
}
if
(
maxSort
&&
maxSort
.
code
==
200
)
{
$
(
"#editMaxSortId"
).
combobox
({
data
:
maxSort
.
data
||
[]
});
}
if
(
colors
&&
colors
.
code
==
200
)
{
colors
.
data
.
map
(
function
(
item
)
{
var
color
=
item
.
colorValue
?
'background: url('
+
item
.
colorValue
+
')'
:
'background:#'
+
item
.
colorCode
;
$
(
'.group-color ul'
).
append
(
'<li data-id="'
+
item
.
id
+
'"><i style="float: left;width: 30px; height: 30px;border-radius: 50%; margin-right: 3px;'
+
color
+
';background-size: contain;"></i>'
+
item
.
colorName
+
'</li>'
);
});
}
if
(
that
.
productId
)
{
that
.
getDetailInfo
();
}
else
{
that
.
getSizeInfo
();
}
});
$
(
document
).
on
(
'click'
,
'.group-color li'
,
function
()
{
if
(
that
.
productId
)
{
$
.
messager
.
alert
(
'操作提示'
,
"颜色不可修改!"
);
return
;
}
if
(
!
$
(
this
).
hasClass
(
'actived'
))
{
var
colorName
=
$
(
this
).
text
();
if
(
that
.
colorSizeTableData
.
rows
.
length
>
0
)
{
that
.
colorSizeTableData
.
rows
.
map
(
function
(
item
)
{
item
.
colorName
=
colorName
;
item
.
goodsName
=
colorName
;
});
}
else
{
that
.
colorSizeTableData
.
rows
.
push
({
colorName
:
colorName
,
goodsName
:
colorName
,
size
:
''
,
sku
:
'-'
});
}
that
.
mergeCells
();
$
(
this
).
siblings
().
removeClass
(
'actived'
);
$
(
this
).
addClass
(
'actived'
);
}
});
$
(
document
).
on
(
'click'
,
'.group-size input'
,
function
()
{
var
colorName
=
goodsName
=
''
;
if
(
that
.
productId
)
{
$
.
messager
.
alert
(
'操作提示'
,
'尺码不可修改!'
);
return
false
;
}
if
(
$
(
'.group-color .actived'
).
length
==
0
)
{
$
.
messager
.
alert
(
'操作提示'
,
'请先选择颜色!'
);
return
false
;
}
if
(
that
.
colorSizeTableData
.
rows
.
length
>
0
)
{
colorName
=
that
.
colorSizeTableData
.
rows
[
0
].
colorName
;
goodsName
=
that
.
colorSizeTableData
.
rows
[
0
].
goodsName
;
}
else
{
colorName
=
goodsName
=
$
(
'.group-color .actived'
).
text
();
}
that
.
colorSizeTableData
.
rows
=
[];
$
(
'.size-item:checked'
).
each
(
function
(
index
,
item
)
{
that
.
colorSizeTableData
.
rows
.
push
({
colorName
:
colorName
,
goodsName
:
goodsName
,
size
:
$
(
item
).
parent
().
text
(),
sku
:
'-'
});
});
if
(
$
(
'.size-item:checked'
).
length
==
0
&&
colorName
)
{
that
.
colorSizeTableData
.
rows
.
push
({
colorName
:
colorName
,
goodsName
:
goodsName
,
size
:
''
,
sku
:
'-'
});
}
that
.
mergeCells
();
});
$
(
document
).
on
(
'click'
,
'.goods-image .img'
,
function
()
{
$
(
this
).
remove
();
});
$
(
'#cancelBtn'
).
linkbutton
({
onClick
:
function
()
{
window
.
location
.
href
=
contextPath
+
"/html/product/productList.html"
;
}
});
$
(
'#submitBtn'
).
linkbutton
({
onClick
:
function
()
{
var
imageUrlList
=
[];
var
sizeIdList
=
[];
var
editImage
=
0
;
if
(
this
.
submitFlag
)
{
return
;
}
this
.
submitFlag
=
true
;
$
(
'.goods-image .img'
).
each
(
function
(
index
,
item
)
{
imageUrlList
.
push
(
$
(
item
).
data
(
'url'
));
});
if
(
that
.
productId
)
{
if
(
imageUrlList
.
length
==
that
.
detailData
.
imageUrlList
.
length
)
{
$
.
each
(
imageUrlList
,
function
(
index
,
item
)
{
if
(
item
!=
that
.
detailData
.
imageUrlList
[
index
])
{
editImage
=
1
;
}
});
}
else
{
editImage
=
1
;
}
}
else
{
editImage
=
1
;
$
(
'.group-size input:checked'
).
each
(
function
(
index
,
item
)
{
sizeIdList
.
push
(
+
$
(
item
).
val
());
});
}
var
ajaxData
=
{
brandId
:
+
$
(
'#editBrandId'
).
textbox
(
'getValue'
),
colorId
:
+
$
(
'.group-color .actived'
).
data
(
'id'
),
colorName
:
$
(
'.group-color .actived'
).
text
(),
editImage
:
editImage
,
gender
:
+
$
(
'input[name="gender"]:checked'
).
val
(),
goodsName
:
$
(
'.goods-name'
).
length
>
0
&&
$
(
'.goods-name'
).
textbox
(
'getValue'
)
||
''
,
imageUrlList
:
imageUrlList
,
keyWords
:
$
(
'#keyword'
).
textbox
(
'getValue'
),
maxPrice
:
$
(
'#editMaxPrice'
).
textbox
(
'getValue'
),
maxSortId
:
+
$
(
'#editMaxSortId'
).
combobox
(
'getValue'
),
midSortId
:
+
$
(
'#editMidSortId'
).
combobox
(
'getValue'
),
minPrice
:
$
(
'#editMinPrice'
).
textbox
(
'getValue'
),
productCode
:
$
(
'#editProductCode'
).
textbox
(
'getValue'
),
productName
:
$
(
'#editProductName'
).
textbox
(
'getValue'
),
saleTime
:
$
(
"#editSaleTime"
).
myDatebox
(
'getValue'
),
seriesId
:
+
$
(
'#editSeriesId'
).
combobox
(
'getValue'
)
};
if
(
!
ajaxData
.
brandId
)
{
$
.
messager
.
alert
(
'操作提示'
,
'请选择品牌!'
);
return
false
;
}
if
(
!
ajaxData
.
saleTime
)
{
$
.
messager
.
alert
(
'操作提示'
,
'请选择发售时间!'
);
return
false
;
}
if
(
!
ajaxData
.
maxSortId
)
{
$
.
messager
.
alert
(
'操作提示'
,
'请选择一级分类!'
);
return
false
;
}
if
(
!
ajaxData
.
midSortId
)
{
$
.
messager
.
alert
(
'错误提示'
,
'请选择二级分类!'
);
return
false
;
}
if
(
imageUrlList
.
length
==
0
)
{
$
.
messager
.
alert
(
'操作提示'
,
'至少添加一张图片!'
);
return
false
;
}
if
(
!
$
(
'#productDetail'
).
form
(
"validate"
))
{
return
false
;
}
if
(
!
that
.
productId
)
{
ajaxData
.
sizeIdList
=
sizeIdList
;
if
(
!
ajaxData
.
colorName
)
{
$
.
messager
.
alert
(
'错误提示'
,
'请选择颜色!'
);
return
false
;
}
if
(
sizeIdList
.
length
==
0
)
{
$
.
messager
.
alert
(
'错误提示'
,
'请选择尺码!'
);
return
false
;
}
}
else
{
ajaxData
.
id
=
that
.
detailData
.
id
;
ajaxData
.
goodsId
=
that
.
detailData
.
goodsId
;
}
$
.
messager
.
progress
({
title
:
"正在执行"
,
msg
:
"正在执行,请稍后..."
,
interval
:
500
,
text
:
""
});
$
.
ajax
({
url
:
contextPath
+
'/product/addOrUpdate'
,
contentType
:
"application/json"
,
dataType
:
"json"
,
type
:
"POST"
,
data
:
JSON
.
stringify
(
ajaxData
),
success
:
function
(
data
)
{
that
.
submitFlag
=
false
;
$
.
messager
.
progress
(
"close"
);
$
.
messager
.
alert
(
'操作提示'
,
'提交成功!'
);
},
error
:
function
(
err
)
{
that
.
submitFlag
=
false
;
$
.
messager
.
alert
(
'操作提示'
,
err
.
message
);
}
});
}
});
},
mergeCells
:
function
()
{
this
.
colorSizeTableData
.
total
=
this
.
colorSizeTableData
.
rows
.
length
;
$
(
'#colorSizeTable'
).
datagrid
(
'loadData'
,
this
.
colorSizeTableData
);
$
(
'#colorSizeTable'
).
datagrid
(
'mergeCells'
,
{
index
:
0
,
field
:
'colorName'
,
rowspan
:
this
.
colorSizeTableData
.
total
});
$
(
'#colorSizeTable'
).
datagrid
(
'mergeCells'
,
{
index
:
0
,
field
:
'goodsName'
,
rowspan
:
this
.
colorSizeTableData
.
total
});
$
(
'#colorSizeTable'
).
datagrid
(
'resize'
);
},
getUrlParam
:
function
(
name
)
{
var
reg
=
new
RegExp
(
"(^|&)"
+
name
+
"=([^&]*)(&|$)"
);
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
{
return
unescape
(
r
[
2
]);
}
return
null
;
},
getDetailInfo
:
function
()
{
var
that
=
this
;
// 编辑的情况需要根据id查询商品信息
$
.
get
(
contextPath
+
'/product/find?id='
+
this
.
productId
).
then
(
function
(
ret
)
{
if
(
ret
&&
ret
.
code
==
200
)
{
ret
=
ret
.
data
||
{};
that
.
initData
(
ret
);
that
.
detailData
=
ret
;
}
});
},
getBrandList
:
function
()
{
// 获取所有品牌
return
$
.
get
(
contextPath
+
'/brand/getBrandName'
);
},
getMaxSortList
:
function
()
{
// 获取一级分类
return
$
.
get
(
contextPath
+
"/productSort/getLevel1SortIdAndName"
);
},
getSizeInfo
:
function
(
sortId
)
{
var
that
=
this
;
sortId
=
sortId
||
0
;
// 获取所有尺寸
$
.
get
(
contextPath
+
'/size/queryAllSize4Goods?sortId='
+
sortId
,
function
(
ret
)
{
if
(
ret
&&
ret
.
code
==
200
)
{
$
(
'.group-size .size'
).
html
(
''
);
$
.
each
(
ret
.
data
||
[],
function
(
index
,
item
)
{
if
(
item
.
id
)
{
$
(
'.group-size .size'
).
append
(
'<label for="size" style="margin-right: 5px;" data-id="'
+
item
.
id
+
'"><input type="checkbox" value="'
+
item
.
id
+
'" class="size-item">'
+
item
.
text
+
'</label>'
);
}
});
if
(
that
.
detailData
.
sizeIdList
)
{
that
.
detailData
.
sizeIdList
.
map
(
function
(
item
)
{
$
(
'.group-size label[data-id='
+
item
+
'] input'
).
attr
(
'checked'
,
'true'
);
that
.
colorSizeTableData
.
rows
.
push
({
colorName
:
$
(
'.group-color li[data-id='
+
that
.
detailData
.
colorId
+
']'
).
text
(),
goodsName
:
that
.
detailData
.
goodsName
,
size
:
$
(
'.group-size label[data-id='
+
item
+
']'
).
text
(),
sku
:
'-'
});
});
}
that
.
mergeCells
();
}
});
},
getColorInfo
:
function
()
{
// 获取所有颜色
return
$
.
get
(
contextPath
+
'/productColor/getAllColor'
);
}
};
$
(
function
()
{
productDetail
.
init
();
});
</script>
\ No newline at end of file
</script>
</body>
</html>
\ No newline at end of file
...
...
web/src/main/webapp/html/product/productList.html
View file @
15f181b
...
...
@@ -11,7 +11,7 @@
<script>
document
.
write
(
addHead
(
'商品管理 /基础商品'
,
''
));
</script>
<div
style=
"margin
-left:
30px;"
class=
"div_search"
>
<div
style=
"margin
: 10px 0 10px
30px;"
class=
"div_search"
>
<a
id=
"addProduct"
class=
"easyui-linkbutton btn-success"
>
+创建商品
</a>
</div>
<div
style=
"margin-left: 30px;"
class=
"div_search"
>
...
...
@@ -125,7 +125,10 @@
title
:
"商品图片"
,
field
:
"colorImage"
,
width
:
80
,
align
:
"center"
align
:
"center"
,
formatter
:
function
(
value
)
{
return
'<img src="'
+
value
+
'" style="width: 48px; height: 48px;vertical-align: middle;">'
}
},
{
title
:
"商品名称"
,
field
:
"productName"
,
...
...
@@ -223,6 +226,12 @@
$
(
"#productTable"
).
myDatagrid
(
"load"
,
param
);
}
});
$
(
'#addProduct'
).
linkbutton
({
onClick
:
function
()
{
window
.
location
.
href
=
contextPath
+
"/html/product/productEdit.html"
;
}
});
function
editRow
(
id
)
{
brandSeriesId
=
id
;
...
...
@@ -232,8 +241,12 @@
if
(
id
==
0
)
{
title
=
"添加品牌系列"
;
message
=
"确认添加品牌系列信息吗?"
;
}
else
{
window
.
location
.
href
=
contextPath
+
"/html/product/productEdit.html?id="
+
id
;
}
$
(
div
).
myDialog
({
/* $(div).myDialog({
width: "600px",
height: "380px",
title: title,
...
...
@@ -294,7 +307,7 @@
$(div).dialog("close");
}
}]
});
});
*/
}
function
updateBrandSeriesStatus
(
id
,
status
)
{
...
...
Please
register
or
login
to post a comment