index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="component-wrapper" :style="wrapper_style">
  3. <view 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 :style="box_style" class="reinitem" v-for="(item, index) in list" @click="gobuy(item.id)">
  10. <view class="imgren">
  11. <view class="leticon">认</view>
  12. <image :src="item.pic || emptyImage" :key="index" :style="img_style" mode="aspectFill" class="renitem_thu">
  13. </view>
  14. </image>
  15. <view class="rightiation_bar">
  16. <view class="rightiation_bar_p1">{{ item.name }}</view>
  17. <view class="rightiation_bar_p2">收获:{{ item.bonusway }}</view>
  18. <view class="rightiation_bar_p3">
  19. <view class="right_text_p1">已售:</view>
  20. <view class="right_text_p2 text-primary">{{ item.sells }}</view>
  21. <view class="right_text_p1">剩余:</view>
  22. <view class="right_text_p2 text-primary">{{ item.num }}</view>
  23. </view>
  24. <progress :activeColor="primary" :percent="item.rgbl" stroke-width="3" />
  25. <view class="rightiation_bar_p3" :show-percent="false"
  26. style="justify-content: space-between;margin: 15rpx 0 0 0">
  27. <view class="right_buton_p1 text-neutral">¥{{ item.copies_price }}</view>
  28. <view class="right_buton_p2 bg-primary " :style="buttonstyle">进行中</view>
  29. </view>
  30. </view>
  31. <!-- <view class="uliline2"></view> -->
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import landApi from '@/api/land/index.js'
  37. export default {
  38. props: ['styles', 'datas'],
  39. data() {
  40. let siteinfo = getApp().globalData.siteinfo;
  41. this.adoptinit();
  42. return {
  43. primary: this.$theme.primary,
  44. settingFile: siteinfo,
  45. emptyImage: siteinfo.root_img + '/static/app/image.png',
  46. adoptid: [],
  47. list: []
  48. }
  49. },
  50. computed: {
  51. /** 副标题内容 */
  52. title() {
  53. return this.datas.title || '标题';
  54. },
  55. img_style2() {
  56. return `
  57. width:15px;
  58. height:15px;
  59. margin:auto;
  60. `;
  61. },
  62. // 副标题栏样式
  63. title_style() {
  64. const {
  65. text_size,
  66. text_color,
  67. } = this.datas;
  68. return `
  69. font-size: ${text_size}px;
  70. color: ${text_color};
  71. `;
  72. },
  73. /** 样式 */
  74. wrapper_style() {
  75. if (this.datas) {
  76. const {
  77. padding_top,
  78. padding_bottom,
  79. padding_left,
  80. padding_right,
  81. bg_color
  82. } = this.datas;
  83. return `
  84. background-color:${bg_color};
  85. padding-top: ${padding_top}px;
  86. padding-bottom: ${padding_bottom}px;
  87. padding-left: ${padding_left}px;
  88. padding-right: ${padding_right}px;
  89. `;
  90. }
  91. },
  92. img_style() {
  93. const {
  94. picture_border,
  95. } = this.datas;
  96. return `
  97. width: 220rpx;
  98. height: 220rpx;
  99. `;
  100. },
  101. box_style() {
  102. const {
  103. picture_border,
  104. } = this.datas;
  105. return `
  106. overflow: hidden;
  107. `;
  108. },
  109. leftbox_right() {
  110. const {
  111. bg_color
  112. } = this.datas;
  113. return `
  114. overflow: hidden;
  115. background-color:${bg_color};
  116. `;
  117. },
  118. //按钮设置
  119. buttonstyle() {
  120. const {
  121. border_radius,
  122. button_color,
  123. buttontitle_color
  124. } = this.datas
  125. return `
  126. color:${buttontitle_color};
  127. background-color:${button_color};
  128. border-radius:${border_radius}px;
  129. white-space: nowrap;
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. `
  133. },
  134. //价格设置
  135. price_style() {
  136. const {
  137. price_color
  138. } = this.datas
  139. return `
  140. color:${price_color};
  141. font-weight: 600;
  142. `;
  143. },
  144. //已售设置
  145. soldout_style() {
  146. const {
  147. soldout_color
  148. } = this.datas
  149. return `
  150. color:${soldout_color};
  151. `;
  152. },
  153. //剩余设置
  154. residue_style() {
  155. const {
  156. residue_color
  157. } = this.datas
  158. return `
  159. color:${residue_color};
  160. `;
  161. },
  162. },
  163. methods: {
  164. adoptinit() {
  165. let that = this
  166. let ids = []
  167. that.datas.goods.forEach(ele => {
  168. ids.push(ele.id)
  169. })
  170. let res = landApi.getlist({
  171. gids: ids,
  172. gtype: 'renyang',
  173. }).then(res => {
  174. if (res.status == 200) {
  175. that.list = res.data;
  176. }
  177. });
  178. },
  179. more() {
  180. uni.switchTab({
  181. url: '/pages/index/adoplist/adoplist'
  182. })
  183. },
  184. gobuy(id) {
  185. uni.navigateTo({
  186. url: '/pagesA/pages/adopt/adopt?id=' + id
  187. })
  188. },
  189. }
  190. };
  191. </script>
  192. <style lang="less" scoped>
  193. .component-wrapper {
  194. .morebox {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. padding: 0 12px;
  199. margin-bottom: 15px;
  200. .title2 {
  201. font-size: 28rpx;
  202. display: flex;
  203. color: #949494;
  204. align-items: center;
  205. }
  206. }
  207. .reinitem {
  208. display: flex;
  209. justify-content: left;
  210. align-items: flex-start;
  211. margin: 25rpx 0 0 0;
  212. .imgren{
  213. position: relative;
  214. }
  215. }
  216. .leticon {
  217. background-color: #ff8000;
  218. position: absolute;
  219. left: 0;
  220. top: 0;
  221. padding: 15rpx 15rpx 20rpx 15rpx;
  222. border-radius: 0 0 35rpx 35rpx;
  223. color: #ffffff;
  224. z-index: 9;
  225. }
  226. .renitem_thu {
  227. width: 220rpx;
  228. height: 220rpx;
  229. }
  230. .rightiation_bar {
  231. margin-left: 20rpx;
  232. width: 100%;
  233. }
  234. .rightiation_bar_p1 {
  235. color: #000;
  236. line-height: 38rpx;
  237. font-size: 28rpx;
  238. overflow:hidden;
  239. text-overflow:ellipsis;
  240. display:-webkit-box;
  241. -webkit-box-orient:vertical;
  242. -webkit-line-clamp:1;
  243. }
  244. .rightiation_bar_p2 {
  245. font-size: 24rpx;
  246. color: #434343;
  247. margin: 15rpx 0;
  248. }
  249. .rightiation_bar_p3 {
  250. display: flex;
  251. justify-content: flex-start;
  252. margin: 15rpx 0;
  253. align-items: center;
  254. }
  255. .right_text_p1 {
  256. color: #999;
  257. font-size: 22rpx;
  258. }
  259. .right_text_p2 {
  260. font-size: 24rpx;
  261. margin-right: 25rpx;
  262. }
  263. .right_buton_p1 {
  264. font-size: 32rpx;
  265. font-weight: 600;
  266. }
  267. .right_buton_p2 {
  268. color: #fff;
  269. border-radius: 30rpx;
  270. font-size: 26rpx;
  271. padding: 16rpx 30rpx;
  272. }
  273. }
  274. </style>