selectedOrders.js 1.5 KB

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