serviceDetails.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // pages/order/serviceDetails/serviceDetails.js
  2. const app=getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. goods:{},
  9. carNum:1,
  10. carPrice:0,
  11. title:"",
  12. address:"",
  13. worke_id:"",
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. var goods_id=options.goods_id;
  20. var title=options.title;
  21. var address=options.address;
  22. var worke_id=options.worke_id;
  23. this.setData({
  24. title:title,
  25. address:address,
  26. worke_id:worke_id,
  27. })
  28. var that=this;
  29. app.api.useApi(app.globalData.baseAppUrl + "api/goods_info", {
  30. network_id: wx.getStorageSync('nid'),
  31. good_id:goods_id
  32. }, "get").then(function (res) {
  33. console.log(res);
  34. if (res.code != 200) {
  35. console.log(res.code);
  36. wx.showLoading({
  37. title: res.message.msg,
  38. })
  39. } else {
  40. that.setData({
  41. goods:res.message.data.good,
  42. carPrice:res.message.data.good.price.sale_price,
  43. })
  44. }
  45. wx.hideLoading();
  46. }).catch(function (err) {
  47. console.log(222);
  48. })
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function () {
  84. }
  85. })