api.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. /**
  2. * desc: 接口请求类
  3. * author: wangyang
  4. * date: 2015-04-11
  5. */
  6. // define(['config', 'base', '$'], function(config, base, $) {
  7. define(['config', 'base'], function (config, base) {
  8. var API = function () {
  9. if (typeof API.instance === 'object') {
  10. return API.instance;
  11. }
  12. API.instance = this;
  13. this.isLoading = false;
  14. }
  15. API.prototype = new base();
  16. var apiErrorResult = {
  17. success: false,
  18. message: '网页加载失败,请您返回首页重新访问 <( ̄︶ ̄)>'
  19. };
  20. // 人员信息录入 moonclub/employe/SaveEmployInfo
  21. API.prototype.SaveEmployInfo = function (data, callback) {
  22. var that = this;
  23. this.isLoading = true;
  24. $.signAjax({
  25. url: config.apiPath + '/index.php?r=moonclub/employe/SaveEmployeInfo',
  26. data: data,
  27. dataType: 'JSON',
  28. success: function (res) {
  29. that.isLoading = false;
  30. if (callback) {
  31. callback(res);
  32. }
  33. },
  34. error: function (res) {
  35. that.isLoading = false;
  36. if (callback) {
  37. callback(apiErrorResult);
  38. }
  39. }
  40. });
  41. };
  42. // 角色 moonclub/employe/GetAuthinfo
  43. API.prototype.GetAuthinfo = function (data, callback) {
  44. var that = this;
  45. this.isLoading = true;
  46. $.signAjax({
  47. url: config.apiPath + '/index.php?r=moonclub/employe/GetAuthinfo',
  48. data: data,
  49. dataType: 'JSON',
  50. success: function (res) {
  51. that.isLoading = false;
  52. if (callback) {
  53. callback(res);
  54. }
  55. },
  56. error: function (res) {
  57. that.isLoading = false;
  58. if (callback) {
  59. callback(apiErrorResult);
  60. }
  61. }
  62. });
  63. };
  64. //获取预约信息
  65. API.prototype.geteservation = function (data, callback) {
  66. var that = this;
  67. this.isLoading = true;
  68. $.signAjax({
  69. url: config.apiPath + '/index.php?r=moonclub/reserve/myService',
  70. data: data,
  71. dataType: 'JSON',
  72. success: function (res) {
  73. that.isLoading = false;
  74. if (callback) {
  75. callback(res);
  76. }
  77. },
  78. error: function (res) {
  79. that.isLoading = false;
  80. if (callback) {
  81. callback(apiErrorResult);
  82. }
  83. }
  84. });
  85. };
  86. // 获取验证码
  87. API.prototype.getCode = function (data, callback) {
  88. var that = this;
  89. this.isLoading = true;
  90. $.signAjax({
  91. url: config.apiPath + '/index.php?r=moonclub/reserve/code',
  92. data: data,
  93. dataType: 'JSON',
  94. success: function (res) {
  95. that.isLoading = false;
  96. if (callback) {
  97. callback(res);
  98. }
  99. },
  100. error: function (res) {
  101. that.isLoading = false;
  102. if (callback) {
  103. callback(apiErrorResult);
  104. }
  105. }
  106. });
  107. };
  108. //获取用户信息
  109. API.prototype.getUserInfo = function (data, callback) {
  110. var that = this;
  111. this.isLoading = true;
  112. $.signAjax({
  113. url: config.apiPath + '/index.php?r=api/user/info',
  114. data: data,
  115. dataType: 'JSON',
  116. success: function (res) {
  117. that.isLoading = false;
  118. if (callback) {
  119. callback(res);
  120. }
  121. },
  122. error: function (res) {
  123. that.isLoading = false;
  124. if (callback) {
  125. callback(apiErrorResult);
  126. }
  127. }
  128. });
  129. };
  130. API.prototype.getO2oUserInfo = function (data, callback) {
  131. var that = this;
  132. this.isLoading = true;
  133. $.signAjax({
  134. url: config.apiPath + '/index.php?r=moonclub/user/info',
  135. data: data,
  136. dataType: 'JSON',
  137. success: function (res) {
  138. that.isLoading = false;
  139. if (callback) {
  140. callback(res);
  141. }
  142. },
  143. error: function (res) {
  144. that.isLoading = false;
  145. if (callback) {
  146. callback(apiErrorResult);
  147. }
  148. }
  149. });
  150. };
  151. //获取商品列表
  152. API.prototype.getProductList = function (data, callback) {
  153. var that = this;
  154. this.isLoading = true;
  155. $.signAjax({
  156. url: config.apiPath + '/index.php?r=moonclub/product/list',
  157. data: data,
  158. dataType: 'JSON',
  159. success: function (res) {
  160. that.isLoading = false;
  161. if (callback) {
  162. callback(res);
  163. }
  164. },
  165. error: function (res) {
  166. that.isLoading = false;
  167. if (callback) {
  168. callback(apiErrorResult);
  169. }
  170. }
  171. });
  172. };
  173. API.prototype.getAgreement = function (data, callback) {
  174. var that = this;
  175. this.isLoading = true;
  176. $.signAjax({
  177. url: config.apiPath + '/index.php?r=api/common/staticSource&key=agreement',
  178. data: data,
  179. dataType: 'JSON',
  180. success: function (res) {
  181. that.isLoading = false;
  182. if (callback) {
  183. callback(res);
  184. }
  185. },
  186. error: function (res) {
  187. that.isLoading = false;
  188. if (callback) {
  189. callback(apiErrorResult);
  190. }
  191. }
  192. });
  193. };
  194. API.prototype.getHelp = function (data, callback) {
  195. var that = this;
  196. this.isLoading = true;
  197. $.signAjax({
  198. url: config.apiPath + '/index.php?r=api/common/staticSource&key=help_center',
  199. data: data,
  200. dataType: 'JSON',
  201. success: function (res) {
  202. that.isLoading = false;
  203. if (callback) {
  204. callback(res);
  205. }
  206. },
  207. error: function (res) {
  208. that.isLoading = false;
  209. if (callback) {
  210. callback(apiErrorResult);
  211. }
  212. }
  213. });
  214. };
  215. API.prototype.getAbout = function (data, callback) {
  216. var that = this;
  217. this.isLoading = true;
  218. $.signAjax({
  219. url: config.apiPath + '/index.php?r=api/common/staticSource&key=about_us',
  220. data: data,
  221. dataType: 'JSON',
  222. success: function (res) {
  223. that.isLoading = false;
  224. if (callback) {
  225. callback(res);
  226. }
  227. },
  228. error: function (res) {
  229. that.isLoading = false;
  230. if (callback) {
  231. callback(apiErrorResult);
  232. }
  233. }
  234. });
  235. };
  236. //获取优惠券列表
  237. API.prototype.getCouponList = function (data, callback) {
  238. var that = this;
  239. $.signAjax({
  240. url: config.apiPath + '/index.php?r=moonclub/order/usableCoupon',
  241. data: data,
  242. dataType: 'JSON',
  243. success: function (res) {
  244. that.isLoading = false;
  245. if (callback) {
  246. callback(res);
  247. }
  248. },
  249. error: function (res) {
  250. that.isLoading = false;
  251. if (callback) {
  252. callback(apiErrorResult);
  253. }
  254. }
  255. });
  256. };
  257. //兑换优惠券
  258. API.prototype.exchangeCoupon = function (data, callback) {
  259. var that = this;
  260. $.signAjax({
  261. url: config.apiPath + '/index.php?r=moonclub/user/exchangeCoupon',
  262. data: data,
  263. dataType: 'JSON',
  264. success: function (res) {
  265. that.isLoading = false;
  266. if (callback) {
  267. callback(res);
  268. }
  269. },
  270. error: function (res) {
  271. that.isLoading = false;
  272. if (callback) {
  273. callback(apiErrorResult);
  274. }
  275. }
  276. });
  277. };
  278. //检查用户的地址是否在服务站内
  279. API.prototype.checkAddress = function (data, callback) {
  280. var that = this;
  281. $.signAjax({
  282. url: config.apiPath + '/index.php?r=moonclub/order/checkAddress',
  283. data: data,
  284. dataType: 'JSON',
  285. success: function (res) {
  286. that.isLoading = false;
  287. if (callback) {
  288. callback(res);
  289. }
  290. },
  291. error: function (res) {
  292. that.isLoading = false;
  293. if (callback) {
  294. callback(apiErrorResult);
  295. }
  296. }
  297. });
  298. };
  299. //提交订单
  300. API.prototype.addOrder = function (data, callback) {
  301. var that = this;
  302. $.signAjax({
  303. url: config.apiPath + '/index.php?r=moonclub/order/add',
  304. data: data,
  305. dataType: 'JSON',
  306. success: function (res) {
  307. that.isLoading = false;
  308. if (callback) {
  309. callback(res);
  310. }
  311. },
  312. error: function (res) {
  313. that.isLoading = false;
  314. if (callback) {
  315. callback(apiErrorResult);
  316. }
  317. }
  318. });
  319. };
  320. //取消订单
  321. API.prototype.cancelOrder = function (data, callback) {
  322. var that = this;
  323. $.signAjax({
  324. url: config.apiPath + '/index.php?r=moonclub/order/del',
  325. data: data,
  326. dataType: 'JSON',
  327. success: function (res) {
  328. that.isLoading = false;
  329. if (callback) {
  330. callback(res);
  331. }
  332. },
  333. error: function (res) {
  334. that.isLoading = false;
  335. if (callback) {
  336. callback(apiErrorResult);
  337. }
  338. }
  339. });
  340. };
  341. // 追加订单
  342. API.prototype.appendOrder = function (data, callback) {
  343. var that = this;
  344. $.signAjax({
  345. url: config.apiPath + '/index.php?r=moonclub/order/append',
  346. data: data,
  347. dataType: 'JSON',
  348. success: function (res) {
  349. that.isLoading = false;
  350. if (callback) {
  351. callback(res);
  352. }
  353. },
  354. error: function (res) {
  355. that.isLoading = false;
  356. if (callback) {
  357. callback(apiErrorResult);
  358. }
  359. }
  360. });
  361. };
  362. // 订单详情
  363. API.prototype.getOrderDetail = function (data, callback) {
  364. var that = this;
  365. $.signAjax({
  366. url: config.apiPath + '/index.php?r=moonclub/order/detail',
  367. data: data,
  368. dataType: 'JSON',
  369. success: function (res) {
  370. that.isLoading = false;
  371. if (callback) {
  372. callback(res);
  373. }
  374. },
  375. error: function (res) {
  376. that.isLoading = false;
  377. if (callback) {
  378. callback(apiErrorResult);
  379. }
  380. }
  381. });
  382. };
  383. //获取支付信息
  384. API.prototype.getPayCharge = function (data, callback) {
  385. var that = this;
  386. $.signAjax({
  387. url: config.apiPath + '/index.php?r=moonclub/order/pay',
  388. data: data,
  389. dataType: 'JSON',
  390. success: function (res) {
  391. that.isLoading = false;
  392. if (callback) {
  393. callback(res);
  394. }
  395. },
  396. error: function (res) {
  397. that.isLoading = false;
  398. if (callback) {
  399. callback(apiErrorResult);
  400. }
  401. }
  402. });
  403. };
  404. // 获取追加订单信息
  405. API.prototype.getAppendPayCharge = function (data, callback) {
  406. var that = this;
  407. $.signAjax({
  408. url: config.apiPath + '/index.php?r=moonclub/order/appendPay',
  409. data: data,
  410. dataType: 'JSON',
  411. success: function (res) {
  412. that.isLoading = false;
  413. if (callback) {
  414. callback(res);
  415. }
  416. },
  417. error: function (res) {
  418. that.isLoading = false;
  419. if (callback) {
  420. callback(apiErrorResult);
  421. }
  422. }
  423. });
  424. };
  425. //获取我的订单
  426. API.prototype.getMyOrder = function (data, callback) {
  427. var that = this;
  428. $.signAjax({
  429. url: config.apiPath + '/index.php?r=moonclub/user/XOrderByUserId',
  430. data: data,
  431. dataType: 'JSON',
  432. success: function (res) {
  433. that.isLoading = false;
  434. if (callback) {
  435. callback(res);
  436. }
  437. },
  438. error: function (res) {
  439. that.isLoading = false;
  440. if (callback) {
  441. callback(apiErrorResult);
  442. }
  443. }
  444. });
  445. };
  446. //获取我的订单详情
  447. API.prototype.getMyOrderInfo = function (data, callback) {
  448. var that = this;
  449. $.signAjax({
  450. url: config.apiPath + '/index.php?r=moonclub/user/GetServiceByXOrderId',
  451. data: data,
  452. dataType: 'JSON',
  453. success: function (res) {
  454. that.isLoading = false;
  455. if (callback) {
  456. callback(res);
  457. }
  458. },
  459. error: function (res) {
  460. that.isLoading = false;
  461. if (callback) {
  462. callback(apiErrorResult);
  463. }
  464. }
  465. });
  466. };
  467. //获取我的订单列表
  468. API.prototype.getMyOrderList = function (data, callback) {
  469. var that = this;
  470. $.signAjax({
  471. url: config.apiPath + '/index.php?r=moonclub/order/list',
  472. data: data,
  473. dataType: 'JSON',
  474. success: function (res) {
  475. that.isLoading = false;
  476. if (callback) {
  477. callback(res);
  478. }
  479. },
  480. error: function (res) {
  481. that.isLoading = false;
  482. if (callback) {
  483. callback(apiErrorResult);
  484. }
  485. }
  486. });
  487. };
  488. //获取雇员服务订单列表 user_id
  489. API.prototype.getTechInfoByUserId = function (data, callback) {
  490. var that = this;
  491. $.signAjax({
  492. url: config.apiPath + '/index.php?r=moonclub/employe/GetTechInfoByUserId',
  493. data: data,
  494. dataType: 'JSON',
  495. success: function (res) {
  496. that.isLoading = false;
  497. if (callback) {
  498. callback(res);
  499. }
  500. },
  501. error: function (res) {
  502. that.isLoading = false;
  503. if (callback) {
  504. callback(apiErrorResult);
  505. }
  506. }
  507. });
  508. };
  509. // 雇员注册信息获取
  510. API.prototype.getQueryPersonalInfo = function (data, callback) {
  511. var that = this;
  512. $.signAjax({
  513. url: config.apiPath + '/index.php?r=moonclub/employe/QueryPersonalInfoByUserId',
  514. data: data,
  515. dataType: 'JSON',
  516. success: function (res) {
  517. that.isLoading = false;
  518. if (callback) {
  519. callback(res);
  520. }
  521. },
  522. error: function (res) {
  523. that.isLoading = false;
  524. if (callback) {
  525. callback(apiErrorResult);
  526. }
  527. }
  528. });
  529. };
  530. // 预约状态值 moonclub/employe/ServiceStatus
  531. API.prototype.getServiceStatus = function (data, callback) {
  532. var that = this;
  533. $.signAjax({
  534. url: config.apiPath + '/index.php?r=moonclub/employe/ServiceStatus',
  535. data: data,
  536. dataType: 'JSON',
  537. success: function (res) {
  538. that.isLoading = false;
  539. if (callback) {
  540. callback(res);
  541. }
  542. },
  543. error: function (res) {
  544. that.isLoading = false;
  545. if (callback) {
  546. callback(apiErrorResult);
  547. }
  548. }
  549. });
  550. };
  551. // 雇员针对某一订单改变其状态
  552. API.prototype.getModifyStatus = function (data, callback) {
  553. var that = this;
  554. $.signAjax({
  555. url: config.apiPath + '/index.php?r=moonclub/employe/ModifyStatusByUserId',
  556. data: data,
  557. dataType: 'JSON',
  558. success: function (res) {
  559. that.isLoading = false;
  560. if (callback) {
  561. callback(res);
  562. }
  563. },
  564. error: function (res) {
  565. that.isLoading = false;
  566. if (callback) {
  567. callback(apiErrorResult);
  568. }
  569. }
  570. });
  571. };
  572. //发表评价
  573. API.prototype.postReview = function (data, callback) {
  574. var that = this;
  575. $.signAjax({
  576. url: config.apiPath + '/index.php?r=moonclub/product/comment',
  577. data: data,
  578. dataType: 'JSON',
  579. success: function (res) {
  580. that.isLoading = false;
  581. if (callback) {
  582. callback(res);
  583. }
  584. },
  585. error: function (res) {
  586. that.isLoading = false;
  587. if (callback) {
  588. callback(apiErrorResult);
  589. }
  590. }
  591. });
  592. };
  593. //评价列表
  594. API.prototype.getReviewList = function (data, callback) {
  595. var that = this;
  596. $.signAjax({
  597. url: config.apiPath + '/index.php?r=moonclub/product/commentList',
  598. data: data,
  599. dataType: 'JSON',
  600. success: function (res) {
  601. that.isLoading = false;
  602. if (callback) {
  603. callback(res);
  604. }
  605. },
  606. error: function (res) {
  607. that.isLoading = false;
  608. if (callback) {
  609. callback(apiErrorResult);
  610. }
  611. }
  612. });
  613. };
  614. //地址列表
  615. API.prototype.getAddressList = function (data, callback) {
  616. var that = this;
  617. $.signAjax({
  618. url: config.apiPath + '/index.php?r=api/shop/addressList',
  619. data: data,
  620. dataType: 'JSON',
  621. success: function (res) {
  622. that.isLoading = false;
  623. if (callback) {
  624. callback(res);
  625. }
  626. },
  627. error: function (res) {
  628. that.isLoading = false;
  629. if (callback) {
  630. callback(apiErrorResult);
  631. }
  632. }
  633. });
  634. };
  635. //新增地址
  636. API.prototype.addAddress = function (data, callback) {
  637. var that = this;
  638. $.signAjax({
  639. url: config.apiPath + '/index.php?r=api/shop/addAddress',
  640. data: data,
  641. dataType: 'JSON',
  642. success: function (res) {
  643. that.isLoading = false;
  644. if (callback) {
  645. callback(res);
  646. }
  647. },
  648. error: function (res) {
  649. that.isLoading = false;
  650. if (callback) {
  651. callback(apiErrorResult);
  652. }
  653. }
  654. });
  655. };
  656. //删除地址
  657. API.prototype.deleteAddress = function (data, callback) {
  658. var that = this;
  659. $.signAjax({
  660. url: config.apiPath + '/index.php?r=api/shop/delAddress',
  661. data: data,
  662. dataType: 'JSON',
  663. success: function (res) {
  664. that.isLoading = false;
  665. if (callback) {
  666. callback(res);
  667. }
  668. },
  669. error: function (res) {
  670. that.isLoading = false;
  671. if (callback) {
  672. callback(apiErrorResult);
  673. }
  674. }
  675. });
  676. };
  677. // 修改地址
  678. API.prototype.editAddress = function (data, callback) {
  679. var that = this;
  680. $.signAjax({
  681. url: config.apiPath + '/index.php?r=api/shop/editAddress',
  682. data: data,
  683. dataType: 'JSON',
  684. success: function (res) {
  685. that.isLoading = false;
  686. if (callback) {
  687. callback(res);
  688. }
  689. },
  690. error: function (res) {
  691. that.isLoading = false;
  692. if (callback) {
  693. callback(apiErrorResult);
  694. }
  695. }
  696. });
  697. };
  698. // 获取上传图片token
  699. API.prototype.gettoken = function (data, callback) {
  700. var that = this;
  701. $.signAjax({
  702. url: config.apiPath + '/index.php?r=api/upload/gettoken',
  703. data: data,
  704. dataType: 'JSON',
  705. success: function (res) {
  706. that.isLoading = false;
  707. if (callback) {
  708. callback(res);
  709. }
  710. },
  711. error: function (res) {
  712. that.isLoading = false;
  713. if (callback) {
  714. callback(apiErrorResult);
  715. }
  716. }
  717. });
  718. };
  719. // 退款
  720. API.prototype.refundOrder = function (data, callback) {
  721. var that = this;
  722. $.signAjax({
  723. url: config.apiPath + '/index.php?r=moonclub/order/retrieve',
  724. data: data,
  725. dataType: 'JSON',
  726. success: function (res) {
  727. that.isLoading = false;
  728. if (callback) {
  729. callback(res);
  730. }
  731. },
  732. error: function (res) {
  733. that.isLoading = false;
  734. if (callback) {
  735. callback(apiErrorResult);
  736. }
  737. }
  738. });
  739. };
  740. // 确认完成
  741. API.prototype.finishOrder = function (data, callback) {
  742. var that = this;
  743. $.signAjax({
  744. url: config.apiPath + '/index.php?r=moonclub/order/confirmComplete',
  745. data: data,
  746. dataType: 'JSON',
  747. success: function (res) {
  748. that.isLoading = false;
  749. if (callback) {
  750. callback(res);
  751. }
  752. },
  753. error: function (res) {
  754. that.isLoading = false;
  755. if (callback) {
  756. callback(apiErrorResult);
  757. }
  758. }
  759. });
  760. };
  761. // 触宝 获取加密支付信息
  762. API.prototype.getTradeStr = function (data, callback) {
  763. var that = this;
  764. $.signAjax({
  765. url: config.apiPath + '/index.php?r=moonclub/chubao/chubaoPay',
  766. data: data,
  767. dataType: 'JSON',
  768. success: function (res) {
  769. that.isLoading = false;
  770. if (callback) {
  771. callback(res);
  772. }
  773. },
  774. error: function (res) {
  775. that.isLoading = false;
  776. if (callback) {
  777. callback(apiErrorResult);
  778. }
  779. }
  780. });
  781. };
  782. // 选择保洁师
  783. API.prototype.selectTech = function (data, callback) {
  784. var that = this;
  785. $.signAjax({
  786. url: config.apiPath + '/index.php?r=moonclub/order/selectTech',
  787. data: data,
  788. dataType: 'JSON',
  789. success: function (res) {
  790. that.isLoading = false;
  791. if (callback) {
  792. callback(res);
  793. }
  794. },
  795. error: function (res) {
  796. that.isLoading = false;
  797. if (callback) {
  798. callback(apiErrorResult);
  799. }
  800. }
  801. });
  802. };
  803. API.prototype.techComment = function (data, callback) {
  804. var that = this;
  805. $.signAjax({
  806. url: config.apiPath + '/index.php?r=moonclub/order/techComment',
  807. data: data,
  808. dataType: 'JSON',
  809. success: function (res) {
  810. that.isLoading = false;
  811. if (callback) {
  812. callback(res);
  813. }
  814. },
  815. error: function (res) {
  816. that.isLoading = false;
  817. if (callback) {
  818. callback(apiErrorResult);
  819. }
  820. }
  821. });
  822. };
  823. //创建充值卡订单
  824. API.prototype.addRechargeorder = function (data, callback) {
  825. var that = this;
  826. $.signAjax({
  827. url: config.apiPath + '/index.php?r=moonclub/recharge/addRechargeorder',
  828. data: data,
  829. dataType: 'JSON',
  830. success: function (res) {
  831. that.isLoading = false;
  832. if (callback) {
  833. callback(res);
  834. }
  835. },
  836. error: function (res) {
  837. that.isLoading = false;
  838. if (callback) {
  839. callback(apiErrorResult);
  840. }
  841. }
  842. });
  843. };
  844. //充值卡支付
  845. API.prototype.payRecharge = function (data, callback) {
  846. var that = this;
  847. $.signAjax({
  848. url: config.apiPath + '/index.php?r=moonclub/recharge/payRecharge',
  849. data: data,
  850. dataType: 'JSON',
  851. success: function (res) {
  852. that.isLoading = false;
  853. if (callback) {
  854. callback(res);
  855. }
  856. },
  857. error: function (res) {
  858. that.isLoading = false;
  859. if (callback) {
  860. callback(apiErrorResult);
  861. }
  862. }
  863. });
  864. };
  865. //充值卡列表
  866. API.prototype.getRechargeList = function (data, callback) {
  867. var that = this;
  868. $.signAjax({
  869. url: config.apiPath + '/index.php?r=moonclub/recharge/rechargeList',
  870. data: data,
  871. dataType: 'JSON',
  872. success: function (res) {
  873. that.isLoading = false;
  874. if (callback) {
  875. callback(res);
  876. }
  877. },
  878. error: function (res) {
  879. that.isLoading = false;
  880. if (callback) {
  881. callback(apiErrorResult);
  882. }
  883. }
  884. });
  885. };
  886. // 提交表单数据 moonclub/Reserve/Month
  887. API.prototype.getReserveMonth = function (data, callback) {
  888. var that = this;
  889. $.signAjax({
  890. url: config.apiPath + '/index.php?r=moonclub/Reserve/Month1',
  891. data: data,
  892. dataType: 'JSON',
  893. success: function (res) {
  894. that.isLoading = false;
  895. if (callback) {
  896. callback(res);
  897. }
  898. },
  899. error: function (res) {
  900. that.isLoading = false;
  901. if (callback) {
  902. callback(apiErrorResult);
  903. }
  904. }
  905. });
  906. };
  907. // 提交注册表单数据 moonclub/User/UserDetail
  908. API.prototype.getUserDetail = function (data, callback) {
  909. var that = this;
  910. $.signAjax({
  911. url: config.apiPath + '/index.php?r=moonclub/User/UserDetail',
  912. data: data,
  913. dataType: 'JSON',
  914. success: function (res) {
  915. that.isLoading = false;
  916. if (callback) {
  917. callback(res);
  918. }
  919. },
  920. error: function (res) {
  921. that.isLoading = false;
  922. if (callback) {
  923. callback(apiErrorResult);
  924. }
  925. }
  926. });
  927. };
  928. return new API();
  929. })