orderItemInfo.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // components/orderItemInfo/orderItemInfo.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. order:{
  8. type:Object,
  9. value:{
  10. nozzle:5,
  11. status:'已授权',
  12. statusColor:'#a6d53f',
  13. oilName:'92#汽油',
  14. volume:30,
  15. amount:224.7,
  16. payAmount:209.4,
  17. discount:15.3,
  18. orderId:'20251111111111',
  19. time:'2025-01-20 18:33'
  20. }
  21. }
  22. },
  23. /**
  24. * 组件的初始数据
  25. */
  26. data: {
  27. contentHeight: 10,
  28. isHide:false,
  29. rotateDeg:0
  30. },
  31. /**
  32. * 组件的方法列表
  33. */
  34. methods: {
  35. showOrHide(){
  36. const height = this.data.isHide?10:23;
  37. console.log("点击了",this.data.isHide,height)
  38. this.setData({
  39. contentHeight:height,
  40. isHide:!this.data.isHide,
  41. rotateDeg:this.data.rotateDeg+180
  42. })
  43. },
  44. //第一个按钮的点击事件
  45. buttonClick1(){
  46. this.triggerEvent('bottonEvent1',{
  47. order:this.properties.order,
  48. event:3 //第一个按钮只会传递取消订单
  49. })
  50. },
  51. //第二个按钮的点击事件
  52. buttonClick2(){
  53. /**第二个按钮会是去支付:1和去授权:2两种
  54. * 当当前订单状态为未支付或者支付失败时,第二个按钮点击就是去支付,event 传递1
  55. * 当当前订单状态为已失效时,第二个按钮点击就是去重新授权,event 传递2
  56. */
  57. var sendEvent = 1;
  58. if(this.properties.order.status == "已失效") sendEvent = 2
  59. this.triggerEvent('bottonEvent2',{
  60. order:this.properties.order,
  61. event:sendEvent
  62. })
  63. },
  64. }
  65. })