index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="component-wrapper" :style="wrapper_style">
  3. <view v-if="datas.show_title" class="morebox">
  4. <view :style="title_style" class="title">{{ title }}</view>
  5. <view class="title2" @click="more">查看更多
  6. <u-icon :style="img_style2" color="#949494" name="arrow-right" size="14"></u-icon>
  7. </view>
  8. </view>
  9. <view class="bigbox" v-for="(item, index) in list" @click="gobuy(item.id)">
  10. <view class="bigbox_top">
  11. <u-icon class="img" name="share" color='orangered' size="22"></u-icon>
  12. <view>{{item.activity_title}}</view>
  13. </view>
  14. <view class="img_box" :style="img_style">
  15. <view class="avtivity_state">{{item.end_time}}</view>
  16. <image :src="item.activity_img || emptyImage" :key="index" :style="img_style"></image>
  17. </view>
  18. <view class="case_titleblock">
  19. <view class="case_title">{{item.activity_title}}</view>
  20. </view>
  21. <view class="price_selection">
  22. <view class="commodity_price">
  23. <view class="commodity_price_red " :style="price_style">{{item.child_fares+'-'+item.adult_fares }}
  24. </view>
  25. </view>
  26. </view>
  27. <view class="case_title_sm">{{item.start_time+'-'+item.end_time }}</view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import landApi from '@/api/land/index.js'
  33. export default {
  34. props: ['styles', 'datas'],
  35. data() {
  36. let siteinfo = getApp().globalData.siteinfo;
  37. this.activityinit()
  38. return {
  39. avtiveid:[],
  40. settingFile: siteinfo,
  41. emptyImage: siteinfo.root_img + '/static/app/image.png',
  42. list:[]
  43. }
  44. },
  45. computed: {
  46. //价格设置
  47. price_style() {
  48. const {
  49. price_color,
  50. price_size
  51. } = this.datas
  52. return `
  53. font-size:${price_size}px;
  54. color:${price_color};
  55. margin-right:5px;
  56. `;
  57. },
  58. /** 副标题内容 */
  59. title() {
  60. return this.datas.title || '活动';
  61. },
  62. img_style2() {
  63. return `
  64. width:15px;
  65. height:15px;
  66. margin:auto;
  67. `;
  68. },
  69. // 副标题栏样式
  70. title_style() {
  71. const {
  72. text_size,
  73. text_color,
  74. } = this.datas;
  75. return `
  76. font-size: ${text_size}px;
  77. color: ${text_color};
  78. `;
  79. },
  80. /** 样式 */
  81. wrapper_style() {
  82. if (this.datas) {
  83. const {
  84. padding_top,
  85. padding_bottom,
  86. padding_left,
  87. padding_right,
  88. bg_color
  89. } = this.datas;
  90. return `
  91. background-color:${bg_color};
  92. padding-top: ${padding_top}px;
  93. padding-bottom: ${padding_bottom}px;
  94. padding-left: ${padding_left}px;
  95. padding-right: ${padding_right}px;
  96. `;
  97. }
  98. },
  99. img_style() {
  100. return `
  101. width: 100%;
  102. height:420rpx;
  103. border-radius: 5px;
  104. margin:5px 0;
  105. `;
  106. },
  107. },
  108. methods: {
  109. async activityinit() {
  110. let that = this
  111. let ids = []
  112. that.datas.goods.forEach(ele => {
  113. ids.push(ele.id)
  114. })
  115. let res = landApi.getlist({
  116. gids: ids,
  117. gtype: 'activity',
  118. }).then(res => {
  119. if (res.status == 200) {
  120. that.list = res.data;
  121. }
  122. });
  123. },
  124. more() {
  125. uni.navigateTo({
  126. url: '/pagesB/pages/activitylist/activitylist'
  127. })
  128. },
  129. gobuy(id) {
  130. uni.navigateTo({
  131. url: '/pagesB/pages/activitydetails/activitydetails?id=' + id
  132. })
  133. },
  134. }
  135. };
  136. </script>
  137. <style lang="less" scoped>
  138. .component-wrapper {
  139. // width: 375px;
  140. .morebox {
  141. display: flex;
  142. justify-content: space-between;
  143. align-items: center;
  144. padding: 0 12px;
  145. .title2 {
  146. font-size: 28rpx;
  147. display: flex;
  148. color: #949494;
  149. align-items: center;
  150. }
  151. }
  152. .bigbox {
  153. padding: 10px;
  154. border-radius: 5px;
  155. margin-top: 15rpx;
  156. background-color: #ffffff;
  157. .bigbox_top {
  158. display: flex;
  159. align-items: center;
  160. .img {
  161. margin-right: 5px;
  162. }
  163. }
  164. .img_box {
  165. position: relative;
  166. .avtivity_state {
  167. position: absolute;
  168. color: #fff;
  169. right: 0;
  170. top: 15px;
  171. padding: 1px 15px;
  172. background-color: rgba(51, 51, 51, .7);
  173. border-bottom-left-radius: 5px;
  174. border-top-left-radius: 5px;
  175. z-index: 9;
  176. }
  177. }
  178. }
  179. .case_titleblock {
  180. display: flex;
  181. justify-content: flex-start;
  182. align-items: center;
  183. width: 100%;
  184. .case_title {
  185. font-size: 15px;
  186. height: 27px;
  187. line-height: 27px;
  188. color: #000;
  189. font-weight: 550;
  190. white-space: nowrap;
  191. text-overflow: ellipsis;
  192. overflow: hidden;
  193. }
  194. }
  195. .case_title_sm {
  196. display: flex;
  197. justify-content: flex-start;
  198. align-items: center;
  199. width: 80%;
  200. font-size: 13px;
  201. color: #999;
  202. height: 27px;
  203. text-overflow: ellipsis;
  204. overflow: hidden;
  205. white-space: nowrap;
  206. }
  207. .price_selection {
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. height: 27px;
  212. .commodity_price {
  213. display: flex;
  214. font-size: 14px;
  215. color: #333;
  216. .commodity_price_red {
  217. font-weight: 800;
  218. color: red;
  219. }
  220. }
  221. }
  222. }
  223. </style>