orderDetail.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var util = require('../../../utils/util.js');
  2. var api = require('../../../config/api.js');
  3. Page({
  4. data:{
  5. orderId: 0,
  6. orderInfo: {},
  7. orderGoods: [],
  8. handleOption: {}
  9. },
  10. onLoad:function(options){
  11. // 页面初始化 options为页面跳转所带来的参数
  12. this.setData({
  13. orderId: options.id
  14. });
  15. this.getOrderDetail();
  16. },
  17. getOrderDetail() {
  18. let that = this;
  19. util.request(api.OrderDetail, {
  20. orderId: that.data.orderId
  21. }).then(function (res) {
  22. if (res.errno === 0) {
  23. console.log(res.data);
  24. that.setData({
  25. orderInfo: res.data.orderInfo,
  26. orderGoods: res.data.orderGoods,
  27. handleOption: res.data.handleOption
  28. });
  29. //that.payTimer();
  30. }
  31. });
  32. },
  33. payTimer (){
  34. let that = this;
  35. let orderInfo = that.data.orderInfo;
  36. setInterval(() => {
  37. console.log(orderInfo);
  38. orderInfo.add_time -= 1;
  39. that.setData({
  40. orderInfo: orderInfo,
  41. });
  42. }, 1000);
  43. },
  44. payOrder() {
  45. wx.redirectTo({
  46. url: '/pages/pay/pay',
  47. })
  48. },
  49. onReady:function(){
  50. // 页面渲染完成
  51. },
  52. onShow:function(){
  53. // 页面显示
  54. },
  55. onHide:function(){
  56. // 页面隐藏
  57. },
  58. onUnload:function(){
  59. // 页面关闭
  60. }
  61. })