order_detail.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // pages/order_detail/order_detail.js
  2. const { postOrderChange } = require('../../API/appraise')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: String,
  9. title: String,
  10. desc: String,
  11. orderId: Number,
  12. change_state: 1
  13. },
  14. evaluateInput(e) {
  15. const {value, cursor, keycode} = e.detail;
  16. this.setData({
  17. desc: value
  18. })
  19. },
  20. changeOrderState() {
  21. const id = parseInt(this.data.orderId)
  22. const state = this.data.change_state
  23. const data = {
  24. id,
  25. state
  26. }
  27. const send = {data}
  28. // console.log(data);
  29. postOrderChange(send).then((res) => {
  30. console.log(res);
  31. }).catch((err) => {
  32. console.log(err);
  33. })
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad(options) {
  39. this.setData({
  40. imgUrl: options.imgUrl,
  41. title: options.title,
  42. price: options.price,
  43. orderId: options.orderId
  44. })
  45. console.log(this.data.orderId);
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady() {
  51. },
  52. /**
  53. * 生命周期函数--监听页面显示
  54. */
  55. onShow() {
  56. },
  57. /**
  58. * 生命周期函数--监听页面隐藏
  59. */
  60. onHide() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面卸载
  64. */
  65. onUnload() {
  66. },
  67. /**
  68. * 页面相关事件处理函数--监听用户下拉动作
  69. */
  70. onPullDownRefresh() {
  71. },
  72. /**
  73. * 页面上拉触底事件的处理函数
  74. */
  75. onReachBottom() {
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage() {
  81. }
  82. })