Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
cailing
9 years ago
Commit
659b04e9f6e4329d7afb3fc52de7984ff9d14b15
2 parents
5af3c0a0
4e379816
Merge branch 'feature/rebuy' into release/4.8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
151 additions
and
22 deletions
library/LibModels/Web/Home/OrderData.php
script/nginx/conf/vhost/production/location/yohobuypc_node.conf
script/nginx/conf/vhost/testing/location/yohobuypc_node.conf
template/www.yohobuy.com/partials/home/order-block.phtml
web-static/js/cart/cart.js
web-static/js/home/order-block.js
web-static/sass/home/_order-block.css
yohobuy/www.yohobuy.com/application/models/Home/Order.php
yohobuy/www.yohobuy.com/application/modules/Home/controllers/Orders.php
library/LibModels/Web/Home/OrderData.php
View file @
659b04e
...
...
@@ -214,4 +214,20 @@ class OrderData
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/** 再次购买
* @param type $uid
* @param type $orderCode
* @return type
*/
public
static
function
reAddData
(
$uid
,
$orderCode
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.readd'
;
$param
[
'uid'
]
=
$uid
;
$param
[
'order_code'
]
=
$orderCode
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
script/nginx/conf/vhost/production/location/yohobuypc_node.conf
View file @
659b04e
...
...
@@ -40,12 +40,3 @@ location ^~ /passport/autosign/wechat/ {
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
^~ /
product
/
sale
/ {
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Real
-
IP
$
remote_addr
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
...
...
script/nginx/conf/vhost/testing/location/yohobuypc_node.conf
0 → 100644
View file @
659b04e
location
^~ /
passport
/
autosign
/
wechat
/ {
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
^~ /
passport
/
login
/
wechat
/ {
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
= /
product
/
index
/
getNodeContent
{
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Real
-
IP
$
remote_addr
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
^~ /
product
/
sale
/ {
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Real
-
IP
$
remote_addr
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
^~ /
product
/
outlets
/ {
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
-
node
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Real
-
IP
$
remote_addr
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
...
...
template/www.yohobuy.com/partials/home/order-block.phtml
View file @
659b04e
...
...
@@ -112,16 +112,20 @@
{{#if cancelOrder}}
<span class="op-item cancel-order">取消订单</span>
{{^}}
{{#if confirmReceived}}
<span class="op-item confirm-received">确认收货</span>
{{#if reBuy}}
<span class="rebuy">再次购买</span>
{{^}}
<a class="op-item{{#if payNow}} pay-now{{/if}}" href="{{href}}" target="_blank">
{{#if payNow}}
立即付款
{{^}}
{{name}}
{{/if}}
</a>
{{#if confirmReceived}}
<span class="op-item confirm-received">确认收货</span>
{{^}}
<a class="op-item{{#if payNow}} pay-now{{/if}}" href="{{href}}" target="_blank">
{{#if payNow}}
立即付款
{{^}}
{{name}}
{{/if}}
</a>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
...
...
web-static/js/cart/cart.js
View file @
659b04e
...
...
@@ -130,7 +130,17 @@ $cartnewSum.one('click', 'input[type="checkbox"]', function() {
};
choiceOut
(
dataJSON
);
});
// 滚动到第一个选中的商品
function
scrollToFirst
(){
var
$selected
=
$
(
'.pay-wapper tbody tr'
).
find
(
'.cart-item-check:checked'
);
var
top
=
0
;
if
(
$selected
.
length
>
0
){
$selected
=
$selected
.
eq
(
0
);
}
top
=
$selected
.
offset
().
top
-
50
;
$
(
'html,body'
).
scrollTop
(
top
);
return
false
;
}
function
isCheck
(
obj
,
className
)
{
selectArray
=
[];
dataJSON
=
{};
...
...
@@ -880,4 +890,5 @@ $payWapper.on('selectstart', function() {
});
$goodsDetail
.
on
(
'selectstart'
,
function
()
{
return
false
;
});
\ No newline at end of file
});
scrollToFirst
();
\ No newline at end of file
...
...
web-static/js/home/order-block.js
View file @
659b04e
...
...
@@ -180,8 +180,24 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
active
=
editOrder
(
$
(
this
).
closest
(
'.order, .order-detail'
).
data
(
'id'
))
active
.
show
();
newAddress
(
0
);
}).
on
(
'click'
,
'.rebuy'
,
function
()
{
var
id
=
$
(
this
).
closest
(
'.order, .order-detail'
).
data
(
'id'
);
buyAgain
(
id
);
});
//再次购买
function
buyAgain
(
id
){
$
.
ajax
({
type
:
'post'
,
url
:
'/home/orders/reAdd'
,
data
:
{
orderCode
:
id
}
}).
then
(
function
(
d
)
{
if
(
d
.
code
===
200
)
{
location
.
href
=
'/shopping/cart'
;
}
else
{
new
dialog
.
Alert
(
d
.
message
).
show
();
}
})
}
// 地址操作
function
newAddress
(
id
)
{
var
code
,
codeId
;
...
...
@@ -403,7 +419,7 @@ function saveAddress(id) {
$
.
ajax
({
type
:
'post'
,
url
:
'/home/orders/modifyAddress'
,
url
:
'/home/orders/modifyAddress'
,
data
:
postData
}).
then
(
function
(
d
)
{
if
(
d
.
code
===
200
)
{
...
...
web-static/sass/home/_order-block.css
View file @
659b04e
...
...
@@ -257,6 +257,16 @@
border-radius
:
4px
;
width
:
68px
;
}
.operation
.rebuy
{
display
:
inline-block
;
box-sizing
:
border-box
;
width
:
68px
;
height
:
18px
;
line-height
:
18px
;
border-radius
:
5px
;
text-align
:
center
;
border
:
1px
solid
#000
;
}
}
}
...
...
yohobuy/www.yohobuy.com/application/models/Home/Order.php
View file @
659b04e
...
...
@@ -610,6 +610,10 @@ class OrderModel
if
(
$status
>=
6
&&
$time
<
86400
*
$orderRefundLimitTime
&&
$attribute
!=
3
&&
$isCancel
==
'N'
)
{
$operation
[]
=
array
(
'href'
=>
$refundUrl
,
'name'
=>
'申请退货'
,
'optDis'
=>
$opRefundStatus
);
}
//再次购买
if
(
$isCancel
==
'Y'
)
{
$operation
[]
=
array
(
'name'
=>
'再次购买'
,
'reBuy'
=>
true
);
}
return
$operation
;
}
...
...
yohobuy/www.yohobuy.com/application/modules/Home/controllers/Orders.php
View file @
659b04e
...
...
@@ -274,5 +274,39 @@ class OrdersController extends WebAction
$this
->
echoJson
(
$result
);
}
/**
* 我的订单——再次购买
*/
public
function
reAddAction
()
{
$result
=
array
(
'code'
=>
401
,
'message'
=>
'商品加入购物车失败'
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
//获取相关参数
$uid
=
$this
->
getUid
(
true
);
$orderCode
=
$this
->
post
(
'orderCode'
,
''
);
if
(
!
$uid
||
!
$orderCode
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'缺失参数'
,
'data'
=>
''
);
break
;
}
$reAddData
=
OrderData
::
reAddData
(
$uid
,
$orderCode
);
if
(
!
isset
(
$reAddData
[
'code'
])
||
$reAddData
[
'code'
]
!=
200
){
break
;
}
$result
=
array
(
'code'
=>
200
,
'message'
=>
'商品已重新加入购物车'
,
'data'
=>
$reAddData
[
'data'
]);
if
(
!
isset
(
$result
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$result
);
}
}
...
...
Please
register
or
login
to post a comment