showMy.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. const {fetchGraphql} = require('../../../utils/util.js');
  2. const {orderbyprops} = require('../../../config/gql.js');
  3. const app = getApp();
  4. Component({
  5. properties: {
  6. kind: {
  7. type: String,
  8. value: 'success',
  9. observer(newVal, oldVal, changedPath) {
  10. this.setData({
  11. loading: true,
  12. orders: ''
  13. });
  14. if (newVal !== '') {
  15. fetchGraphql(orderbyprops,
  16. {
  17. user_id: app.globalData.userID,
  18. orderStatus: newVal
  19. },
  20. 'orders',
  21. 'orderbyprops',
  22. this
  23. )
  24. .then(orders => {
  25. this.setData({
  26. loading: false
  27. });
  28. console.log(orders)
  29. });
  30. }
  31. }
  32. }
  33. },
  34. lifetimes: {
  35. attached() {
  36. // 在组件实例进入页面节点树时执行
  37. fetchGraphql(orderbyprops,
  38. {
  39. user_id: app.globalData.userID,
  40. orderStatus: 'success'
  41. },
  42. 'orders',
  43. 'orderbyprops',
  44. this
  45. )
  46. .then(orders => {
  47. this.setData({
  48. loading: false
  49. })
  50. });
  51. }
  52. },
  53. data: {
  54. loading: true,
  55. orders: ''
  56. },
  57. methods: {
  58. deleteThis() {
  59. },
  60. cancelThis() {
  61. }
  62. }
  63. });