家政小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const $ = global;
  2. const orderTexts = [
  3. '已预约,等待处理',
  4. '未付款',
  5. '已付款'
  6. ]
  7. new $.Page({
  8. data: {
  9. services: [],
  10. goods: []
  11. },
  12. onShow() {
  13. this.init();
  14. },
  15. init() {
  16. $.request('my/orders', 'GET', {}).then((res) => {
  17. const services = []
  18. const goods = []
  19. if (res.data && res.data.length > 0) {
  20. res.data.forEach(e => {
  21. e.orderText = orderTexts[e.status];
  22. if (e.order_type == 'product_order') {
  23. if (e.status == 0)
  24. e.orderText = '待付款';
  25. goods.push(e);
  26. } else {
  27. services.push(e);
  28. }
  29. });
  30. this.setData({
  31. services,
  32. goods
  33. });
  34. }
  35. });
  36. },
  37. toPay(e) {
  38. const {
  39. id,
  40. type
  41. } = e.target.dataset;
  42. if (id && type) {
  43. $.wx.showToast({
  44. title: '支付中'
  45. }, 'loading');
  46. $.request('payments/pay', 'POST', {
  47. order_id: id,
  48. order_type: type
  49. }).then((res) => {
  50. $.wx.hideToast('loading');
  51. });
  52. }
  53. },
  54. addComment(e) {
  55. const {
  56. id
  57. } = e.target.dataset;
  58. if (id) {
  59. $.router.goto({
  60. path: '/pages/addComment/index'
  61. });
  62. }
  63. }
  64. });