Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
9 years ago
Commit
e8a11c5e800b9c1479743b8a7388e37bbe28b574
1 parent
dd25c98a
退货提交
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
46 deletions
apps/me/controllers/returns.js
apps/me/models/returns-api.js
apps/me/models/returns.js
apps/me/views/partial/refund.hbs
public/js/me/returns-refund.page.js
public/scss/me/_returns.css
apps/me/controllers/returns.js
View file @
e8a11c5
...
...
@@ -32,15 +32,15 @@ const detail = (req, res, next) => {
};
const
refund
=
(
req
,
res
,
next
)
=>
{
let
code
=
parseInt
(
req
.
params
.
orderCode
,
10
);
let
uid
=
req
.
user
.
uid
||
'8050560'
;
let
code
=
parseInt
(
req
.
params
.
orderCode
,
10
)
||
'160192757'
;
req
.
user
.
uid
=
'8050560'
;
code
=
'160192757'
;
if
(
!
req
.
user
.
uid
||
!
code
)
{
if
(
!
uid
||
!
code
)
{
return
next
();
}
returns
.
getRefundGoodsData
(
code
,
req
.
user
.
uid
).
then
(
result
=>
{
returns
.
getRefundGoodsData
(
code
,
uid
).
then
(
result
=>
{
res
.
display
(
'index'
,
{
page
:
'returns-refund'
,
content
:
result
...
...
@@ -54,9 +54,6 @@ const refundApply = (req, res, next) => {
goods
=
req
.
body
.
goods
,
payment
=
req
.
body
.
payment
;
uid
=
'8050560'
;
orderCode
=
'160192757'
;
if
(
!
orderCode
||
_
.
isEmpty
(
goods
)
||
_
.
isEmpty
(
payment
))
{
return
res
.
json
({
code
:
203
,
...
...
apps/me/models/returns-api.js
View file @
e8a11c5
...
...
@@ -31,7 +31,7 @@ const refundSubmitAsync = (orderCode, uid, goods, payment) => {
uid
:
uid
,
goods
:
JSON
.
stringify
(
goods
),
payment
:
JSON
.
stringify
(
payment
)
});
}
,
{
code
:
200
}
);
};
module
.
exports
=
{
...
...
apps/me/models/returns.js
View file @
e8a11c5
...
...
@@ -110,11 +110,14 @@ const getRefundGoodsData = (orderCode, uid) => {
Object
.
assign
(
resData
,
_setSideMenu
(
'我的退/换货'
));
resData
.
returns
=
{
title
:
'退货申请'
title
:
'退货申请'
,
refund
:
{}
};
if
(
result
.
data
)
{
Object
.
assign
(
resData
.
returns
,
_setRefundGoodList
(
result
.
data
));
Object
.
assign
(
resData
.
returns
.
refund
,
_setRefundGoodList
(
result
.
data
),
{
orderCode
:
orderCode
});
}
return
resData
;
...
...
@@ -125,7 +128,10 @@ const saveRefund = (orderCode, uid, goods, payment) => {
return
returnsAPI
.
getOrderInfoAsync
(
orderCode
,
uid
,
''
).
then
(
result
=>
{
if
(
!
_
.
isEmpty
(
result
))
{
return
returnsAPI
.
refundSubmitAsync
(
orderCode
,
uid
,
goods
,
payment
).
then
(
subRes
=>
{
return
subRes
;
if
(
subRes
&&
subRes
.
data
)
{
return
{
code
:
200
,
data
:
{
refer
:
subRes
.
data
.
apply_id
}};
}
return
{
code
:
400
,
message
:
'申请失败'
};
});
}
else
{
return
{
code
:
403
,
message
:
'没有找到该订单'
};
...
...
apps/me/views/partial/refund.hbs
View file @
e8a11c5
{{#
refund
}}
<h4
class=
"third-title"
>
选择退货商品
</h4>
<div
class=
"refund-goods clearfix"
{{#
speclialReason
}}
data-
{{
id
}}
="
{{
@index
}}
"
{{/
speclialReason
}}
>
<div
class=
"refund-goods clearfix"
{{#
speclialReason
}}
data-
{{
id
}}
="
{{
@index
}}
"
{{/
speclialReason
}}
>
<input
id=
"order-code"
type=
"hidden"
value=
"
{{
orderCode
}}
"
>
<ul
class=
"goods-header"
>
<li
class=
"info"
>
商品信息
</li>
<li
class=
"reason"
>
退货原因
</li>
...
...
@@ -46,23 +47,23 @@
<label
class=
"type-item union-item"
title=
"银行卡"
></label>
</div>
<dl
class=
"alipay"
>
<dd>
账号:
<input
type=
"text"
placeholder=
"收款人支付宝账号"
></dd>
<dd>
姓名:
<input
type=
"text"
placeholder=
"姓名"
></dd>
<dd>
账号:
<input
type=
"text"
class=
"name"
placeholder=
"收款人支付宝账号"
></dd>
<dd>
姓名:
<input
type=
"text"
class=
"account"
placeholder=
"姓名"
></dd>
</dl>
<dl
class=
"unionpay hide"
>
<dd>
银行:
<select>
<select
class=
"bank"
>
<option>
中国银行
</option>
<option>
中国农业银行
</option>
<option>
中国工商银行
</option>
<option>
中国建设银行
</option>
</select>
<input
type=
"text"
placeholder=
"开户支行"
>
<span
class=
"blue"
>
例:江苏省南京市奥体支行
</span>
<span
class=
"blue"
class=
"area"
>
例:江苏省南京市奥体支行
</span>
</dd>
<dd>
账号:
<input
type=
"text"
placeholder=
"收款人银行卡号"
></dd>
<dd>
姓名:
<input
type=
"text"
placeholder=
"姓名"
></dd>
<dd>
账号:
<input
type=
"text"
class=
"account"
placeholder=
"收款人银行卡号"
></dd>
<dd>
姓名:
<input
type=
"text"
class=
"name"
placeholder=
"姓名"
></dd>
</dl>
</div>
<div
class=
"opt-btn"
>
...
...
public/js/me/returns-refund.page.js
View file @
e8a11c5
...
...
@@ -13,7 +13,8 @@ var $refundTable = $('.refund-goods'),
var
$applyBtn
=
$
(
'#apply-btn'
);
var
specialReason
=
$refundTable
.
data
()
||
{},
var
orderCode
=
$
(
'#order-code'
).
val
()
||
0
,
specialReason
=
$refundTable
.
data
()
||
{},
payInfo
=
{
// 退款信息
type
:
3
,
// 2--银行卡 3--支付宝 4--yoho币
dom
:
$typeInfo
.
eq
(
0
)
...
...
@@ -34,9 +35,78 @@ function restApplyBtn() {
}
function
packApplyInfo
()
{
var
dom
,
isLack
=
false
,
payment
=
{},
resData
=
{
order_code
:
orderCode
};
if
(
checked
&&
checked
.
documents
)
{
console
.
log
(
checked
);
dom
=
checked
.
documents
;
resData
.
goods
=
[];
// 打包商品信息
$
.
each
(
dom
,
function
(
key
)
{
var
data
=
$
(
dom
[
key
]).
data
(),
good
=
{
last_price
:
data
.
price
,
goods_type
:
data
.
type
,
product_skn
:
data
.
skn
,
product_skc
:
data
.
skc
,
product_sku
:
data
.
sku
};
if
(
isLack
||
!
data
.
reason
)
{
isLack
=
true
;
return
;
}
else
{
good
.
returned_reason
=
data
.
reason
;
// if (specialReason.hasOwnProperty(data.reason)) {
// remark: ,
// returned_reason: 3,
// evidence_images: ,
// }
}
resData
.
goods
.
push
(
good
);
});
// 处理退款信息
if
(
payInfo
)
{
payment
=
{
return_amount_mode
:
payInfo
.
type
};
switch
(
payInfo
.
type
)
{
case
2
:
payment
.
bank_name
=
payInfo
.
dom
.
find
(
'.bank'
).
val
();
payment
.
bank_card
=
payInfo
.
dom
.
find
(
'.account'
).
val
();
payment
.
payee_name
=
payInfo
.
dom
.
find
(
'.name'
).
val
();
break
;
case
3
:
payment
.
alipay_account
=
payInfo
.
dom
.
find
(
'.account'
).
val
();
payment
.
alipay_name
=
payInfo
.
dom
.
find
(
'.name'
).
val
();
break
;
default
:
isLack
=
true
;
break
;
}
// 检查信息完整性
$
.
each
(
payment
,
function
(
key
)
{
if
(
!
payment
[
key
])
{
isLack
=
true
;
}
});
resData
.
payment
=
payment
;
}
}
if
(
isLack
)
{
return
false
;
}
return
resData
;
}
$check
.
check
({
...
...
@@ -82,32 +152,28 @@ $refundType.on('click', '.type-item', function() {
}
});
$applyBtn
.
click
(
function
()
{
var
$tip
=
$applyBtn
.
siblings
(
'.apply-tip'
),
param
=
packApplyInfo
();
// "last_price": "385.00",
// "remark": "重量不行",
// "returned_reason": "8",
// "evidence_images": [
// "/2016/06/30/11/02ba04e8b96654fc6c1fab12dda61bec21.png",
// "/2016/06/30/11/014c64b459499081c8bd237eb8e26decf8.png"
// ],
// "product_skn": "51177771",
// "goods_type": "1",
// "product_skc": "310207",
// "product_sku": "978129"
if
(
!
param
)
{
$tip
.
removeClass
(
'hide'
);
return
;
}
else
{
$tip
.
addClass
(
'hide'
);
}
$applyBtn
.
click
(
function
()
{
packApplyInfo
();
// $.ajax({
// type: 'POST',
// url: '/me/return/refund/apply',
// data: {
// id: 11
// },
// success: function(data) {
// if (data.code === 200) {
// console.log(data);
// }
// }
// });
$
.
ajax
({
type
:
'POST'
,
url
:
'/me/return/refund/apply'
,
data
:
param
,
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
if
(
data
.
data
&&
data
.
data
.
refer
)
{
location
.
href
=
data
.
data
.
refer
;
}
$tip
.
text
(
'申请成功'
).
removeClass
(
'hide'
);
}
}
});
});
...
...
public/scss/me/_returns.css
View file @
e8a11c5
...
...
@@ -212,6 +212,17 @@
dd
{
padding
:
5px
0
;
}
select
,
input
{
height
:
24px
;
border
:
1px
solid
#eee
;
padding
:
0
8px
;
}
.bank
{
border-color
:
#1d1d1d
;
}
}
}
}
...
...
Please
register
or
login
to post a comment