Date field change on select option and todays date

hi, i am trying to change the due date in sales order depends on selection of Terms Del (i.e if 30 days and date == todays date) then due date should be current date + 3 days
2.if 60 days and date == todays date then due date should be today’s date +6 days.
help me with this.
thanks in advance

my script :
frappe.ui.form.on(‘Delivery Note’, ‘onload’, function(frm){

cur_frm.cscript.custom_posting_date = function(doc) {
if (doc.terms_del == "30 days" && doc.posting_date == frappe.datetime.get_today()) {
cur_frm.set_value("due_date", frappe.datetime.add_days(doc.posting_date, 3));		

    }  }