joinGroup.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="box" :class="[AppTheme]" v-if="cache">
  3. <view class="information">
  4. <image :src=" apppic" ></image>
  5. <view class="text">
  6. <p class="title">{{ cache.name }}</p>
  7. <p>{{ cache.peoplenum }}人团· 已团{{ cache.sells }}件</p>
  8. <p>
  9. <span>¥{{ cache.price }}</span>
  10. /{{ cache.unit }} 拼团省{{ cache.oprice - cache.price }}元
  11. </p>
  12. </view>
  13. </view>
  14. <view class="tag">
  15. <view class="tag_item">
  16. <u-icon name="checkmark-circle" color="red"></u-icon>
  17. <view class="">全程包邮</view>
  18. </view>
  19. <view class="tag_item">
  20. <u-icon name="checkmark-circle" color="red"></u-icon>
  21. <view class="">24小时发货</view>
  22. </view>
  23. <view class="tag_item">
  24. <u-icon name="checkmark-circle" color="red"></u-icon>
  25. <view>假一赔十</view>
  26. </view>
  27. </view>
  28. <view class="invite_msg">
  29. <view class="my_team">
  30. <view class="member captain">
  31. <span class="bg-primary">团长</span>
  32. <image :src="vip.headimgurl" mode=""></image>
  33. </view>
  34. <view class="member" v-if="member" v-for="item in member" :key="item.headimgurl"><image :src="item.headimgurl" mode=""></image></view>
  35. <view class="member" v-if="group.left != 0"><image :src="settingFile.root_img+'/static/app/cart/6.png'" mode=""></image></view>
  36. </view>
  37. <view class="b_text">
  38. 仅剩
  39. <span>{{ group.left }}</span>
  40. 个名额,
  41. <u-count-down :time="group.rtime > timestamp ? group.rtime - timestamp : 0" font-size="28"></u-count-down>
  42. 后结束
  43. </view>
  44. </view>
  45. <view class="invite_bth bg-linear-gradient" @click="fastbuy">一键参团</view>
  46. <view class="access">
  47. <span>拼团须知</span>
  48. <view class="text">
  49. 好友参团·人满发货·人不满退款
  50. <u-icon name="arrow-right"></u-icon>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import mall from '@/api/mall/index.js';
  57. // import siteinfo from '@/siteinfo.js'
  58. export default {
  59. data() {
  60. return {
  61. primary:this.$theme.primary,
  62. cache: '',
  63. vip: '',
  64. group: '',
  65. apppic: '',
  66. member: '',
  67. timestamp: '',
  68. data: '',
  69. settingFile:getApp().globalData.siteinfo
  70. };
  71. },
  72. onLoad(option) {
  73. console.log(option);
  74. this.timestamp = Date.parse(new Date()) / 1000;
  75. mall.joinGroup({ id: option.id }).then(res => {
  76. this.data = res.data;
  77. this.cache = res.data.cache;
  78. this.vip = res.data.vip;
  79. this.group = res.data.group;
  80. this.apppic = res.data.apppic;
  81. this.member = res.data.member;
  82. });
  83. },
  84. methods: {
  85. fastbuy() {
  86. var goodsnum = this.cache.num;
  87. var num = 1;
  88. var goodsid = this.cache.id;
  89. var vipid = uni.getStorageSync('userInfo').id
  90. var groupid = this.data.group.id;
  91. var goodstype= this.cache.type;
  92. this.$store.state.groupid = groupid;
  93. if (goodsnum - num <= 0) {
  94. this.$refs.uTips.show({
  95. title: '该产品库存不足!请调整购买量或选择其他属性!',
  96. type: 'error',
  97. duration: '2300'
  98. });
  99. return;
  100. }
  101. let obj = {
  102. sid: 0,
  103. goodsid,
  104. vipid,
  105. num,
  106. goodstype,
  107. isact: 1,
  108. groupid
  109. };
  110. mall.fastbuys(obj).then(res => {
  111. if (res.status == 200) {
  112. uni.showToast({
  113. icon: 'loading',
  114. title: '生成订单',
  115. duration: 2000
  116. });
  117. setTimeout(() => {
  118. this.$u.route('/pagesD/pages/order/createOrder', {
  119. sid: 0,
  120. isact: 1,
  121. goodstype:this.cache.type,
  122. lasturl: this.data.lasturl
  123. });
  124. }, 2000);
  125. } else {
  126. this.$u.toast(res.data);
  127. }
  128. });
  129. }
  130. }
  131. };
  132. </script>
  133. <style lang="scss">
  134. .information {
  135. padding: 30rpx;
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-around;
  139. image {
  140. width: 250rpx;
  141. height: 165rpx;
  142. margin-right: 15rpx;
  143. border-radius: 10rpx;
  144. }
  145. p {
  146. margin-left: 25rpx;
  147. color: #999999;
  148. &:nth-child(1) {
  149. // font-size: 17rpx * 2;
  150. color: black;
  151. margin-bottom: 20rpx;
  152. line-height: 40rpx;
  153. font-weight: bold;
  154. }
  155. &:nth-child(2) {
  156. margin-top: 10rpx;
  157. }
  158. &:nth-child(3) {
  159. margin-top: 10rpx;
  160. span {
  161. color: red;
  162. font-size: 18rpx * 2;
  163. }
  164. }
  165. }
  166. }
  167. .tag {
  168. height: 80rpx;
  169. width: 100%;
  170. padding: 20rpx 0rpx;
  171. background-color: #f6f6f6;
  172. display: flex;
  173. justify-content: space-around;
  174. align-items: center;
  175. .tag_item{
  176. display: flex;
  177. align-items: center;
  178. }
  179. }
  180. .invite_msg {
  181. margin-top: 150rpx;
  182. width: 100%;
  183. height: 400rpx;
  184. .my_team {
  185. height: 200rpx;
  186. display: flex;
  187. justify-content: center;
  188. align-items: center;
  189. .member {
  190. margin: 0 10rpx;
  191. width: 120rpx;
  192. height: 120rpx;
  193. position: relative;
  194. image {
  195. border-radius: 100%;
  196. width: 100%;
  197. height: 100%;
  198. }
  199. }
  200. .captain {
  201. span {
  202. position: absolute;
  203. font-size: 24rpx;
  204. border-radius: 30rpx;
  205. padding: 0 10rpx;
  206. border: 4rpx solid #fff;
  207. line-height: 1.4;
  208. color: #666;
  209. z-index: 10;
  210. }
  211. }
  212. }
  213. .b_text {
  214. text-align: center;
  215. font-size: 16rpx * 2;
  216. span {
  217. color: red;
  218. }
  219. }
  220. }
  221. .invite_bth {
  222. width: 95%;
  223. border-radius: 20rpx;
  224. margin: 0 auto;
  225. text-align: center;
  226. line-height: 37rpx * 2;
  227. height: 37rpx * 2;
  228. color: #ffffff;
  229. }
  230. .access {
  231. width: 100%;
  232. height: 45rpx ;
  233. line-height: 45rpx;
  234. padding: 30rpx 20rpx;
  235. margin-top: 50rpx;
  236. border: 1px solid #d9d9d9;
  237. display: flex;
  238. justify-content: space-between;
  239. > view {
  240. display: flex;
  241. align-items: center;
  242. color: #999999;
  243. margin-right: 30rpx;
  244. }
  245. }
  246. </style>