orderItemInfo.js 2.0 KB

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