index.js 1.2 KB

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