detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <app-layout>
  3. <view class="detail" v-if="detail">
  4. <view class="detail-top">
  5. <app-detail-top
  6. :cover_pic="detail.goods_cover_pic"
  7. :name="detail.goods_name"
  8. :people_num="detail.people_num"
  9. :price="detail.price"
  10. :original_price="detail.original_price"
  11. :status="detail.status"
  12. :theme="getTheme"
  13. :group_economize_price="detail.group_economize_price"
  14. ></app-detail-top>
  15. </view>
  16. <view class="group-avatar">
  17. <app-group-short
  18. @share="hShareAppMessage"
  19. :url="url"
  20. :surplus_people="detail.surplus_people"
  21. :surplusDateTime="detail.surplus_date_time"
  22. :group_users="detail.group_users"
  23. :status="detail.status"
  24. :goodsId="detail.goods_id"
  25. :one_goods_id="detail.one_goods_id"
  26. :is_join="detail.is_join"
  27. :detail="detail"
  28. :theme="getTheme"
  29. :has-poster-nav="true"
  30. :poster-config="poster_config"
  31. :poster-generate="poster_generate"
  32. ></app-group-short>
  33. </view>
  34. <view class="rule dir-left-nowrap main-between cross-center" @click="router">
  35. <text class="app-left">拼团须知</text>
  36. <view class="app-right dir-left-nowrap cross-center">
  37. <text>· 好友参团</text>
  38. <text>· 人满发货</text>
  39. <text>· 人不满退款</text>
  40. <image class="app-icon" src="/static/image/icon/arrow-right.png"></image>
  41. </view>
  42. </view>
  43. <view class="rule more">
  44. <app-jump-button form arrangement="b" url="/plugins/pt/index/index">
  45. <text class="app-left">更多拼团</text>
  46. <view class="app-right dir-left-nowrap cross-center">
  47. <text>更多</text>
  48. <image class="app-icon" src="/static/image/icon/arrow-right.png"></image>
  49. </view>
  50. </app-jump-button>
  51. </view>
  52. <view class="list">
  53. <app-product-list :theme="getTheme" :list="list"></app-product-list>
  54. </view>
  55. </view>
  56. </app-layout>
  57. </template>
  58. <script>
  59. import appDetailTop from '../components/app-detail-top.vue';
  60. import appGroupAvatarShort from '../components/app-group-avatar-short.vue';
  61. import appProductList from '../components/app-product-list.vue';
  62. import {mapGetters, mapState} from 'vuex';
  63. export default {
  64. name: 'detail',
  65. data() {
  66. return {
  67. detail: null,
  68. url: '',
  69. list: [],
  70. id: null,
  71. poster_config: this.$api.pt.poster_config,
  72. poster_generate: this.$api.pt.poster_generate,
  73. }
  74. },
  75. onLoad(options) { this.$commonLoad.onload(options);
  76. this.id = options.id;
  77. this.request(options.id);
  78. },
  79. onShow() {
  80. this.$store.dispatch('gConfig/setTabBarBoolean', this.tabBarNavs.navs);
  81. },
  82. computed: {
  83. ...mapGetters('mallConfig', {
  84. tabBarNavs: 'getNavBar',
  85. getTheme: 'getTheme',
  86. })
  87. },
  88. // #ifdef MP
  89. onShareAppMessage() {
  90. return this.hShareAppMessage();
  91. },
  92. // #endif
  93. methods: {
  94. hShareAppMessage(s = false) {
  95. return this.$shareAppMessage({
  96. path: '/plugins/pt/detail/detail',
  97. title: this.detail.app_share_title ? this.detail.app_share_title : this.detail.name,
  98. imageUrl: this.detail.app_share_pic ? this.detail.app_share_pic : '',
  99. params: {
  100. id: this.id
  101. }
  102. },s);
  103. },
  104. attrTap(data) {
  105. if (data !== null) {
  106. this.selectAttr = data;
  107. } else {
  108. this.selectAttr = {};
  109. }
  110. },
  111. request(id) {
  112. this.$request({
  113. url: this.$api.pt.pt_detail,
  114. data: {
  115. id: id,
  116. }
  117. }).then(response => {
  118. if (response.code === 0) {
  119. this.detail = response.data.detail;
  120. this.url = `${this.$api.pt.order_poster}&pintuan_group_id=${id}&goods_id=${this.detail.goods_id}`;
  121. this.poster_config = `${this.poster_config}&pintuan_group_id=${id}&goods_id=${this.detail.goods_id}`;
  122. this.poster_generate = `${this.poster_generate}&pintuan_group_id=${id}&goods_id=${this.detail.goods_id}`;
  123. }
  124. }).catch(() => {
  125. });
  126. this.$request({
  127. url: this.$api.pt.goods,
  128. }).then(response => {
  129. if(response.code === 0) {
  130. this.list = response.data.list;
  131. }
  132. })
  133. },
  134. router() {
  135. uni.navigateTo({
  136. url: `/pages/rules/index?url=${encodeURIComponent(this.$api.pt.index)}&keys=${JSON.stringify(['setting', 'new_rules'])}`,
  137. });
  138. }
  139. },
  140. components: {
  141. 'app-detail-top': appDetailTop,
  142. 'app-group-short': appGroupAvatarShort,
  143. 'app-product-list': appProductList,
  144. }
  145. }
  146. </script>
  147. <style scoped lang="scss">
  148. .rule {
  149. width: #{750rpx};
  150. height: #{90rpx};
  151. background-color: white;
  152. padding: 0 #{24rpx};
  153. box-sizing: border-box;
  154. .app-left{
  155. font-size: #{26rpx};
  156. color: #353535;
  157. }
  158. .app-right>text {
  159. font-size: #{24rpx};
  160. color: #999999;
  161. margin-left: #{30rpx};
  162. }
  163. .app-icon {
  164. width: #{12rpx};
  165. height: #{22rpx};
  166. margin-left: #{12rpx};
  167. }
  168. }
  169. .more {
  170. margin-top: #{20rpx};
  171. }
  172. </style>