Commit f01a18bf by 魏强

update;

parent 4c73776a
...@@ -356,6 +356,8 @@ def force_refund(): ...@@ -356,6 +356,8 @@ def force_refund():
if not refund_type or not rent_no: if not refund_type or not rent_no:
return jsonify(PARAMETER_ERROR) return jsonify(PARAMETER_ERROR)
back_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
rent_info = db.session.query(Production, Rent).join(Rent, Rent.id == Production.rent_id).filter( rent_info = db.session.query(Production, Rent).join(Rent, Rent.id == Production.rent_id).filter(
Rent.rent_no == rent_no).first() Rent.rent_no == rent_no).first()
...@@ -363,6 +365,9 @@ def force_refund(): ...@@ -363,6 +365,9 @@ def force_refund():
logger.info('no production') logger.info('no production')
return jsonify(REFUND_NOT_PRODUCTION_INFO) return jsonify(REFUND_NOT_PRODUCTION_INFO)
if rent_info.Rent.is_over == 1:
return jsonify(BASE_RESPONSE(error_code=-1, error_message='该订单已结束,请去租金退款接口').to_dict())
if refund_type == '1': if refund_type == '1':
# 扣15元, 退84元 # 扣15元, 退84元
money = 8400 money = 8400
...@@ -381,25 +386,8 @@ def force_refund(): ...@@ -381,25 +386,8 @@ def force_refund():
check_fee = RentService.check_fee_liuyuan(rent_info.Rent.pay_time.strftime('%Y-%m-%d %H:%M:%S'), back_time, check_fee = RentService.check_fee_liuyuan(rent_info.Rent.pay_time.strftime('%Y-%m-%d %H:%M:%S'), back_time,
rent_info.Rent.one_day_price, rent_info.Rent.free_time) rent_info.Rent.one_day_price, rent_info.Rent.free_time)
money = check_fee['total'] money = rent_info.Rent.deposit - check_fee['total']
# elif refund_type == '4':
# # 退10元
# if not comment:
# return jsonify(PARAMETER_ERROR)
#
# money = 1000
# elif refund_type == '5':
# # 退15元
# if not comment:
# return jsonify(PARAMETER_ERROR)
#
# money = 1500
# elif refund_type == '6':
# # 退25元
# if not comment:
# return jsonify(PARAMETER_ERROR)
#
# money = 2500
else: else:
return jsonify(BASE_RESPONSE(error_code=-1, error_message='refund type error!').to_dict()) return jsonify(BASE_RESPONSE(error_code=-1, error_message='refund type error!').to_dict())
...@@ -422,12 +410,12 @@ def force_refund(): ...@@ -422,12 +410,12 @@ def force_refund():
rent.total = rent.deposit - int(money) rent.total = rent.deposit - int(money)
rent.real_total = rent.deposit - int(money) rent.real_total = rent.deposit - int(money)
rent.is_over = 1 rent.is_over = 1
rent.over_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') rent.over_time = back_time
rent.back_money += int(money) rent.back_money += int(money)
production.is_return = 1 production.is_return = 1
production.return_machine_id = production.rent_machine_id production.return_machine_id = production.rent_machine_id
production.return_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') production.return_time = back_time
production.total = rent.deposit - int(money) production.total = rent.deposit - int(money)
production.is_refund = 1 production.is_refund = 1
production.refund_no = rent_refund_no production.refund_no = rent_refund_no
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment