recharge.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * 充值卡模型
  3. */
  4. define(['base', '$', 'native', 'api', 'user', 'config'], function (base, $, native, api, user) {
  5. var Recharge = function () {
  6. if (typeof Recharge.instance === 'object') {
  7. return Recharge.instance;
  8. }
  9. Recharge.instance = this;
  10. this.storagePrefix = 'recharge';
  11. }
  12. Recharge.prototype = new base();
  13. // 获取充值卡列表
  14. Recharge.prototype.getRechargeList = function (callback) {
  15. var that = this;
  16. api.getRechargeList({}, function (res) {
  17. if (res.success) {
  18. }
  19. if (typeof(callback) == 'function') {
  20. callback(res);
  21. }
  22. });
  23. };
  24. // 充值
  25. Recharge.prototype.addRechargeorder = function (data, callback) {
  26. var that = this;
  27. api.addRechargeorder({
  28. user_id: data.user_id,
  29. recharge_id: data.recharge_id
  30. }, function (res) {
  31. if (res.success) {
  32. //更新user
  33. }
  34. if (typeof(callback) == 'function') {
  35. callback(res);
  36. }
  37. });
  38. };
  39. return new Recharge();
  40. })