index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // components/out-order-item/index.js
  2. import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. item: Object
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. },
  15. /**
  16. * 组件的方法列表
  17. */
  18. methods: {
  19. navigate: function(e) {
  20. wx.navigateTo({
  21. url: e.currentTarget.dataset.url,
  22. })
  23. },
  24. doAction: function(e) {
  25. var type = e.currentTarget.dataset.type
  26. if(type == 'edit' || type == 'detail') {
  27. this.navigate(e)
  28. } else if(type == 'confirm') {
  29. var that = this
  30. var order = e.currentTarget.dataset.order
  31. Dialog.confirm({
  32. title: '提示',
  33. message: '确定订单吗',
  34. })
  35. .then(() => {
  36. that.submitCheck(order)
  37. })
  38. }
  39. },
  40. submitCheck(order) {
  41. var that = this
  42. http({
  43. url: 'orders/check',
  44. data: {
  45. id: order.id,
  46. type: 'confirm',
  47. remark: order.remark
  48. },
  49. success: function (res) {
  50. if (res.code == 0) {
  51. that.triggerEvent("itemChange")
  52. }
  53. }
  54. })
  55. },
  56. }
  57. })