share.vue 4.6 KB

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