index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. let Parse = getApp().Parse;
  2. const company = getApp().globalData.company;
  3. const rechText = require('../../../../../utils/rech-text');
  4. const dateF = require('../../../../../utils/date')
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. id: "",
  11. goods: {},
  12. shopstore: {},
  13. score: 3,
  14. comments: null,
  15. },
  16. submit() {
  17. let id = this.data.id
  18. // let uid = this.data.shopstore.
  19. console.log(id);
  20. wx.navigateTo({
  21. url: '/nova-tourism/pages/gourmet/store-package/goods-details/submit/index?id=' + id
  22. });
  23. },
  24. async getComments() {
  25. let Order = new Parse.Query('ShopOrder')
  26. Order.equalTo("goods", this.data.id);
  27. Order.include("user");
  28. Order.include("goods");
  29. Order.greaterThanOrEqualTo("status", 800);
  30. Order.ascending('updatedAt')
  31. Order.notEqualTo('hiddenComment', true)
  32. Order.limit(10)
  33. Order.find().then(res => {
  34. let comments = []
  35. res.forEach(item => {
  36. let activitys = item.toJSON()
  37. activitys.time = dateF.formatTime("YYYY-mm-dd HH:MM:SS", activitys.goods.updatedAt)
  38. comments.push(activitys)
  39. })
  40. this.setData({
  41. comments
  42. }),
  43. console.log(this.data.comments)
  44. })
  45. },
  46. phone() {
  47. let phone = this.data.goods.shopStore.mobile
  48. console.log(phone);
  49. wx.makePhoneCall({
  50. phoneNumber: phone
  51. })
  52. },
  53. async getShopgoods() {
  54. let id = this.data.id
  55. let ShopStore = new Parse.Query('ShopGoods')
  56. ShopStore.include('shopStore')
  57. let shopstore = await ShopStore.get(id)
  58. shopstore = shopstore.toJSON()
  59. if (shopstore.details) {
  60. shopstore.details = rechText.formatRichText(shopstore.details)
  61. }
  62. this.setData({
  63. goods: shopstore
  64. })
  65. console.log(this.data.goods);
  66. },
  67. /**
  68. * 生命周期函数--监听页面加载
  69. */
  70. onLoad: function (options) {
  71. this.setData({
  72. activeColor:getApp().globalData.activeColor || '#229293'
  73. })
  74. let id = options.id
  75. console.log(id);
  76. this.setData({
  77. id: id
  78. })
  79. this.getShopgoods()
  80. this.getComments()
  81. },
  82. /**
  83. * 生命周期函数--监听页面初次渲染完成
  84. */
  85. onReady: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面显示
  89. */
  90. onShow: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面隐藏
  94. */
  95. onHide: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面卸载
  99. */
  100. onUnload: function () {
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh: function () {
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom: function () {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage: function () {
  116. return {
  117. title: `${this.data.goods.name}`,
  118. }
  119. }
  120. })