share.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1">
  6. <text>超值拼团</text>
  7. </view>
  8. <view class="one_2">
  9. <text class="iconfont icon-qianggou"></text>
  10. <text>快叫上伙伴一起抢</text>
  11. <text class="iconfont icon-qianggou"></text>
  12. </view>
  13. </view>
  14. <view class="two">
  15. <view class="two_1">
  16. <view class="img">
  17. <image class="image" :src="info.goods.file&&info.goods.file.length>0?info.goods.file[0].url:''"
  18. mode=""></image>
  19. </view>
  20. </view>
  21. <view class="two_2">
  22. <view class="name">
  23. {{info.goods.name}}
  24. </view>
  25. <view class="money">
  26. ¥{{info.goodsSpec.group_config.money}}元
  27. </view>
  28. <view class="brief">
  29. {{info.goods.brief||''}}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="thr">
  34. <scroll-view scroll-y="true" class="scroll-view">
  35. <view class="list-scroll-view">
  36. <view class="thr_1">
  37. <view class="list" v-for="(item,index) in info.persons" :key="index">
  38. <view class="img" v-if="item.status==0">
  39. <image class="image" :src="item.icon&&item.icon.length>0?item.icon[0].url:''"
  40. mode=""></image>
  41. </view>
  42. <view class="name" v-if="item.status==0">
  43. {{item.name}}
  44. </view>
  45. </view>
  46. <view class="list list_1" v-if="info.group_persons>info.persons.length">
  47. <button type="default" size="mini" @tap.stop="toOpen">参团</button>
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </view>
  53. </view>
  54. </mobile-frame>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. id: '',
  61. user: {},
  62. info: {},
  63. // 分享
  64. share: {}
  65. };
  66. },
  67. onLoad: function(e) {
  68. const that = this;
  69. that.$set(that, `id`, e.id || '');
  70. },
  71. onShow: function() {
  72. const that = this;
  73. that.watchLogin();
  74. that.search();
  75. },
  76. methods: {
  77. watchLogin() {
  78. const that = this;
  79. uni.getStorage({
  80. key: 'token',
  81. success: function(res) {
  82. let user = that.$jwt(res.data);
  83. if (user) that.$set(that, `user`, user)
  84. }
  85. })
  86. },
  87. async search() {
  88. const that = this;
  89. if (that.id) {
  90. let res = await that.$api(`/group/${that.id}`, `GET`);
  91. if (res.errcode == '0') {
  92. that.$set(that, `info`, res.data);
  93. let share = {
  94. title: res.data.goods.name,
  95. path: `/pagesHome/group/share?id=${that.id}`,
  96. imageUrl: '',
  97. }
  98. that.$set(that, `share`, share);
  99. } else {
  100. uni.showToast({
  101. title: res.errmsg,
  102. icon: 'none'
  103. })
  104. }
  105. }
  106. },
  107. // 参团
  108. toOpen() {
  109. const that = this;
  110. console.log(that.info);
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. .main {
  117. display: flex;
  118. flex-direction: column;
  119. width: 100vw;
  120. height: 100vh;
  121. background-color: #23B67A;
  122. .one {
  123. background-color: #D9FDEF;
  124. margin: 2vw 6vw;
  125. border-radius: 10px;
  126. padding: 2vw;
  127. .one_1 {
  128. text-align: center;
  129. border-bottom: 1px dashed #085623;
  130. margin: 0 0 2vw 0;
  131. padding: 0 0 1vw 0;
  132. text {
  133. font-size: 61px;
  134. font-weight: bold;
  135. color: #357846;
  136. font-family: cursive;
  137. }
  138. }
  139. .one_2 {
  140. text-align: center;
  141. text {
  142. padding: 0 5px;
  143. }
  144. text:nth-child(2) {
  145. font-size: 18px;
  146. letter-spacing: 5px;
  147. font-weight: bold;
  148. color: #357846;
  149. }
  150. }
  151. }
  152. .two {
  153. background-color: #D9FDEF;
  154. margin: 2vw;
  155. border-radius: 10px;
  156. padding: 2vw;
  157. display: flex;
  158. .two_1 {
  159. display: flex;
  160. .img {
  161. .image {
  162. width: 100px;
  163. height: 100px;
  164. border-radius: 90px;
  165. }
  166. }
  167. }
  168. .two_2 {
  169. padding: 0 0 0 2vw;
  170. .name {
  171. font-size: 20px;
  172. font-weight: bold;
  173. margin: 0 0 2vw 0;
  174. color: #357846;
  175. }
  176. .money {
  177. font-size: 18px;
  178. color: #ff0000;
  179. font-weight: bold;
  180. margin: 0 0 2vw 0;
  181. }
  182. .brief {
  183. font-size: 14px;
  184. overflow: hidden;
  185. text-overflow: ellipsis;
  186. -webkit-line-clamp: 2;
  187. word-break: break-all;
  188. display: -webkit-box;
  189. -webkit-box-orient: vertical;
  190. color: #858585;
  191. }
  192. }
  193. }
  194. .thr {
  195. position: relative;
  196. flex-grow: 1;
  197. margin: 0 2vw 2vw 2vw;
  198. width: 94vw;
  199. border-radius: 10px;
  200. border: 3px solid #D9FDEF;
  201. .thr_1 {
  202. padding: 2vw;
  203. display: flex;
  204. flex-wrap: wrap;
  205. .list {
  206. width: 20vw;
  207. text-align: center;
  208. margin: 0 3vw 2vw 0;
  209. .img {
  210. .image {
  211. width: 16vw;
  212. height: 16vw;
  213. border-radius: 90px;
  214. }
  215. }
  216. .name {
  217. font-size: 14px;
  218. font-weight: bold;
  219. }
  220. }
  221. .list:nth-child(4n) {
  222. margin: 0 0 2vw 0;
  223. }
  224. .list_1 {
  225. button {
  226. padding: 0;
  227. border-radius: 90px;
  228. width: 16vw;
  229. height: 16vw;
  230. text-align: center;
  231. line-height: 16vw;
  232. background-color: #ffffff5f;
  233. font-size: 16px;
  234. font-weight: bold;
  235. color: #fff;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. .scroll-view {
  242. position: absolute;
  243. top: 0;
  244. left: 0;
  245. right: 0;
  246. bottom: 0;
  247. .list-scroll-view {
  248. display: flex;
  249. flex-direction: column;
  250. }
  251. }
  252. </style>