orderItemInfo.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. price:''
  21. }
  22. },
  23. bottonText1:{
  24. type:String,
  25. value:"按钮一"
  26. },
  27. bottonText2:{
  28. type:String,
  29. value:"按钮二"
  30. }
  31. },
  32. /**
  33. * 组件的初始数据
  34. */
  35. data: {
  36. contentHeight: 10,
  37. isHide:false,
  38. rotateDeg:0
  39. },
  40. /**
  41. * 组件的方法列表
  42. */
  43. methods: {
  44. showOrHide(){
  45. const height = this.data.isHide?10:29;
  46. console.log("点击了",this.data.isHide,height)
  47. this.setData({
  48. contentHeight:height,
  49. isHide:!this.data.isHide,
  50. rotateDeg:this.data.rotateDeg+180
  51. })
  52. },
  53. //第一个按钮的点击事件
  54. buttonClick1(){
  55. this.triggerEvent('bottonEvent1',{
  56. order:this.properties.order,
  57. event:3 //第一个按钮只会传递取消订单
  58. })
  59. },
  60. //第二个按钮的点击事件
  61. buttonClick2(){
  62. wx.showLoading({
  63. title: '正在跳转',
  64. })
  65. /**第二个按钮会是去支付:1和去授权:2两种
  66. * 当当前订单状态为未支付或者支付失败时,第二个按钮点击就是去支付,event 传递1
  67. * 当当前订单状态为已失效时,第二个按钮点击就是去重新授权,event 传递2
  68. */
  69. var sendEvent = 1;
  70. if(this.properties.order.status == "已失效") sendEvent = 2
  71. wx.hideLoading()
  72. this.triggerEvent('bottonEvent2',{
  73. order:this.properties.order,
  74. event:sendEvent
  75. })
  76. },
  77. }
  78. })