details.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view>
  3. <view class="top">
  4. <image :src="ip + item.pic" class="pic"></image>
  5. <view class="title">{{ item.title }}</view>
  6. </view>
  7. <view class="contents">
  8. <view class="xq">商品详情</view>
  9. <view><u-parse :html="item.details"></u-parse></view>
  10. </view>
  11. <view class="lfooter">
  12. <view class="lfx">
  13. <view class="f price">¥{{ item.price }}</view>
  14. <view class="f buy" @click="buy()">购买</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. ip: this.$http.urls.ip,
  24. item: {}
  25. };
  26. },
  27. onLoad(e) {
  28. this.$http.request({
  29. url: this.$http.urls.goods_detail + e.id,
  30. success: res => {
  31. this.item = res.data.data;
  32. this.item.goodsType=e.goodsType;
  33. }
  34. });
  35. },
  36. methods: {
  37. //购买服务
  38. buy() {
  39. let item=this.item;
  40. delete item.details;
  41. uni.navigateTo({
  42. url:'buy?item='+JSON.stringify(this.item)
  43. })
  44. }
  45. },
  46. };
  47. </script>
  48. <style lang="scss">
  49. .top {
  50. background-color: white;
  51. .pic {
  52. width: 100%;
  53. height: 350px;
  54. }
  55. .title {
  56. font-size: 15px;
  57. font-weight: 500;
  58. padding: 10px 15px 12px 15px;
  59. }
  60. }
  61. .contents {
  62. margin-top: 10px;
  63. padding: 10px 20px 70px 20px;
  64. background-color: white;
  65. .xq {
  66. text-align: center;
  67. font-size: 14px;
  68. margin-bottom: 12px;
  69. }
  70. }
  71. .lfooter {
  72. font-size: 17px;
  73. .price {
  74. line-height: 52px;
  75. color: $theme-color;
  76. }
  77. .buy {
  78. background-color: $theme-color;
  79. text-align: center;
  80. color: white;
  81. height: 52px;
  82. line-height: 52px;
  83. }
  84. }
  85. </style>