index.vue 4.9 KB

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