Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
op-web-service
Commits
18bf36d7
Commit
18bf36d7
authored
Jul 27, 2021
by
Qingyu Deng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add refund function
parent
0738ebd6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
172 additions
and
131 deletions
+172
-131
groupmeal.js
server/controllers/groupmeal.js
+84
-83
router.js
server/router.js
+1
-1
index.vue
src/pages/Groupmeal/orderManagement/index.vue
+41
-15
groupmeal.js
src/service/Groupmeal/groupmeal.js
+46
-32
No files found.
server/controllers/groupmeal.js
View file @
18bf36d7
...
...
@@ -113,15 +113,16 @@ exports.orderItemList = async ctx => {
// 订单退款列表
exports
.
orderRefund
=
async
ctx
=>
{
const
url
=
`
${
GROUPMEAL_URI
}
/order/background/order_refundt
`
;
const
url
=
`
${
GROUPMEAL_URI
}
/order/background/order_refund
`
;
const
opts
=
{
url
,
method
:
"GET"
method
:
"POST"
,
json
:
true
,
body
:
ctx
.
request
.
body
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
// 订单驳回
exports
.
orderRefundReject
=
async
ctx
=>
{
const
url
=
`
${
GROUPMEAL_URI
}
/order/background/order_refund_reject`
;
...
...
server/router.js
View file @
18bf36d7
...
...
@@ -78,6 +78,6 @@ router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport
router
.
get
(
`
${
API_VERSION
}
/order/background/print`
,
groupmeal
.
orderPrint
);
router
.
get
(
`
${
API_VERSION
}
/order/background/order_item_list`
,
groupmeal
.
orderItemList
);
router
.
get
(
`
${
API_VERSION
}
/order/background/order_refund_reject`
,
groupmeal
.
orderRefundReject
);
router
.
get
(
`
${
API_VERSION
}
/order/background/order_refundt
`
,
groupmeal
.
orderRefund
);
router
.
post
(
`
${
API_VERSION
}
/order/background/order_refund
`
,
groupmeal
.
orderRefund
);
module
.
exports
=
router
;
src/pages/Groupmeal/orderManagement/index.vue
View file @
18bf36d7
...
...
@@ -243,19 +243,24 @@
v-model=
"item.refundableQuantity"
@
change=
"handleChange"
:min=
"1"
:max=
"
10
"
:max=
"
item.goods_num
"
label=
"描述文字"
></el-input-number>
</el-row>
<el-row>
退款金额(可退金额{{ item.refundAmount }}元):
<el-input
v-model=
"item.ipt"
style=
"width: 150px"
></el-input>
<el-input
v-model=
"item.amountToRefund"
style=
"width: 150px"
></el-input>
</el-row>
</div>
<
template
#
footer
>
<span
class=
"dialog-footer refundBtnGroup"
>
<el-button
@
click=
"refundShow = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"refundConfirm"
>
退款
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirmRefund"
>
退款
</el-button
>
</span>
</
template
>
</el-dialog>
...
...
@@ -274,7 +279,7 @@ import {
orderPrint
,
orderItemList
,
orderRefundReject
,
orderRefund
,
refundOrder
,
}
from
"@/service/Groupmeal/groupmeal"
;
import
page
from
"../../components/Pagination.vue"
;
...
...
@@ -366,7 +371,7 @@ export default {
payment
:
""
,
// 实付
refundableQuantity
:
""
,
refundAmount
:
""
,
ipt
:
""
,
amountToRefund
:
""
,
},
],
};
...
...
@@ -528,15 +533,37 @@ export default {
this
.
refundGoods
=
res
.
result
;
},
// 退款确认
async
refundConfirm
()
{
const
params
=
{
order_id
:
""
,
refund_list
:
""
,
order_item_id
:
""
,
refund_num
:
""
,
refund_amount
:
""
,
async
handleConfirmRefund
()
{
const
isCheckAllSelected
=
()
=>
this
.
refundGoods
.
refundedGoodsSel
;
const
getAllItems
=
()
=>
this
.
refundGoods
;
const
getSelectedItems
=
()
=>
{
const
isSelected
=
({
refundedGoodsSel
})
=>
refundedGoodsSel
;
return
this
.
refundGoods
.
filter
(
isSelected
);
};
const
convertToNumber
=
(
str
)
=>
{
return
!
Number
.
isNaN
(
parseFloat
(
str
))
?
parseFloat
(
str
)
:
0
;
};
const
processRefundItem
=
(
item
)
=>
{
return
{
order_item_id
:
item
.
order_item_id
,
refund_num
:
item
.
refundableQuantity
||
0
,
refund_amount
:
convertToNumber
(
item
.
amountToRefund
),
};
const
res
=
await
orderRefund
(
params
);
};
const
orderId
=
this
.
refundGoods
[
0
].
order_id
;
let
itemsToRefund
=
null
;
if
(
isCheckAllSelected
())
{
itemsToRefund
=
getAllItems
();
}
else
{
itemsToRefund
=
getSelectedItems
();
}
itemsToRefund
=
itemsToRefund
.
map
(
processRefundItem
);
const
res
=
await
refundOrder
(
orderId
,
itemsToRefund
);
console
.
log
(
res
);
},
},
...
...
@@ -548,5 +575,4 @@ export default {
};
</
script
>
<
style
lang=
"less"
src=
"./index.less"
scope
>
</
style
>
\ No newline at end of file
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
src/service/Groupmeal/groupmeal.js
View file @
18bf36d7
import
axios
from
"@/utils/request"
;
// 获取主页配送员列表
export
async
function
getList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/list_day_deliverer_conf"
,{
params
});
export
async
function
getList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/list_day_deliverer_conf"
,
{
params
}
);
return
res
;
}
}
// 获取分配配送员列表
export
async
function
getDelivererList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/list_day_deliverer"
,
params
);
export
async
function
getDelivererList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/list_day_deliverer"
,
params
);
return
res
;
}
}
// 添加配送员
export
async
function
getAddDeliverer
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/add_deliverer"
,
params
);
export
async
function
getAddDeliverer
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/add_deliverer"
,
params
);
return
res
;
}
// 分配配送员
export
async
function
getSaveDeliverer
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/save_day_deliverer"
,
params
);
export
async
function
getSaveDeliverer
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/order/deliverer/save_day_deliverer"
,
params
);
return
res
;
}
// 获取订单列表
export
async
function
getOrderList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_list"
,{
export
async
function
getOrderList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_list"
,
{
params
});
return
res
;
}
// 获取活动名称
export
async
function
getMarketingList
()
{
export
async
function
getMarketingList
()
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/marketing_list"
);
return
res
;
}
// 获取商品名称
export
async
function
getGoodsList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/goods_list"
,{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/goods_list"
,
{
params
});
return
res
;
...
...
@@ -51,7 +60,7 @@ export async function getSubShopList() {
// 导出订单
export
async
function
orderExport
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_export"
,{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_export"
,
{
params
});
return
res
;
...
...
@@ -59,7 +68,7 @@ export async function orderExport(params) {
// 打印订单
export
async
function
orderPrint
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/print"
,{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/print"
,
{
params
});
return
res
;
...
...
@@ -67,23 +76,28 @@ export async function orderPrint(params) {
// 订单退款列表
export
async
function
orderItemList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_item_list"
,{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_item_list"
,
{
params
});
return
res
;
}
// 订单退款
export
async
function
orderRefund
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_refund"
,{
params
export
async
function
refundOrder
(
orderId
,
itemsToRefund
)
{
// const params = {
// order_id: orderId,
// refund_list: itemsToRefund
// };
const
res
=
await
axios
.
post
(
"/api/v1/order/background/order_refund"
,
{
order_id
:
orderId
,
refund_list
:
itemsToRefund
});
return
res
;
}
// 订单驳回
export
async
function
orderRefundReject
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_refund_reject"
,{
const
res
=
await
axios
.
get
(
"/api/v1/order/background/order_refund_reject"
,
{
params
});
return
res
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment