Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var affiliate = {
- customerId: 0,
- money: 0,
- bonus: 0,
- max_rate: 0,
- getBonuses: function () {
- var self = affiliate;
- $.ajax({
- url: backend_url + "/shop/?plugin=paybonus&action=get",
- type: "GET",
- data: {
- id: self.customerId
- },
- success: function (response) {
- self.money = response.data.money;
- self.bonus = response.data.bonus;
- self.max_rate = response.data.max_rate;
- // $("#paybonus").find("#bonus-count").html(response.data.bonus);
- },
- error: function (xhr) {
- console.log(xhr);
- }
- });
- },
- changeBonus: function () {
- // $("#paybonus").find("#bonus").on("input", function(){
- var $this = $(this);
- console.log($this.val());
- // });
- },
- selectCustomer: function() {
- var self = affiliate;
- setTimeout(function(){
- self.customerId = $("#s-customer-id").val();
- if (self.customerId !== 0) {
- self.getBonuses();
- $("#paybonus").removeClass("hidden");
- }
- // console.log(self.bonus);
- }, 400);
- self.debug();
- },
- debug: function () {
- console.log(this);
- }
- };
- $("#customer-autocomplete").on("select", affiliate.selectCustomer);
- $("#paybonus").find("#bonus").on("input", affiliate.changeBonus);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement