detail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="box">
  3. <!-- 拼团 -->
  4. <view class="lyy-a">
  5. <view class="lyy-a-p">
  6. <view class="lyy-a-f">
  7. <view><image :src="goods.image" class="lyy-a-tu" /></view>
  8. <view class="lyy-a-z">
  9. <view class="lyy-a-word lyy-a-word2">{{ goods.title }}</view>
  10. <view class="flex money-box">
  11. <view class="lyy-a-f lyy-a-word margin-r-20">
  12. <view class="lyy-a-word3">¥{{ goods.price }}</view>
  13. </view>
  14. <view class="lyy-a-tu2 lyy-a-f padding-c-20 border-radius-all">
  15. <view class="lyy-a-tu3"><image src="http://lxscimg.liuniu946.com/2019-11-02_5dbd110b5928a.png" class="lyy-a-tu5"></image></view>
  16. <view class="lyy-a-tu4 flex-shrink-false">{{ goods.people }}人拼</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="lyy-hx"></view>
  24. <!-- 第二部分 -->
  25. <view class="lyy-b padding-t-20">
  26. <view class="lyy-b-p">
  27. <view class="lyy-b-jz flex">
  28. <view class="image1"><view class="lyy-b-word">剩余时间</view></view>
  29. </view>
  30. <view class="lyy-b-jz flex">
  31. <uni-countdown
  32. v-if="pinkBool == 0"
  33. color="#FFFFFF"
  34. splitor-color="#FC5B62"
  35. background-color="#FC5B62"
  36. border-color="#FC5B62"
  37. :show-day="false"
  38. :hour="stopTime.stopTimeH"
  39. :minute="stopTime.stopTimeM"
  40. :second="stopTime.stopTimeS"
  41. ></uni-countdown>
  42. </view>
  43. <view class="lyy-b-jz flex">
  44. <span class="lyy-b-word2">{{ pinkT.people }}</span>
  45. <span class="lyy-b-word3">人成团,还差{{ peopleNub }}人</span>
  46. </view>
  47. <view class="lyy-b-jz flex">
  48. <view class="cmy-user-box">
  49. <view class="user-list">
  50. <view class="lyy-y bg-gray"><image :src="pinkT.avatar" class="user-list-img" /></view>
  51. <view class="lyy-y-word clamp">{{ pinkT.nickname }}</view>
  52. </view>
  53. <view class="user-list" v-for="(item , i) in people" :key='i'>
  54. <view class="lyy-y bg-gray"><image :src="item.avatar" class="user-list-img" /></view>
  55. <view class="lyy-y-word clamp">{{ item.nickname }}</view>
  56. </view>
  57. <view class="user-list" v-for="(l, i) in peopleNub" :key="i">
  58. <view class="lyy-y bg-gray"></view>
  59. <view class="lyy-y-word clamp">待邀请</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="lyy-b-jz flex">
  64. <view class="lyy-b-but" v-if="status == 1 && pinkBool == 0" @click="invitation">邀请好友参团</view>
  65. <view class="lyy-b-but" v-if="status == 0&&pinkBool==0" @click="goBuy">立即加入</view>
  66. <!-- <view class="lyy-b-but" @click="goBuy">立即加入</view> -->
  67. <view class="lyy-b-but bg-gray" v-if="pinkBool == -1">拼团失败</view>
  68. <view class="lyy-b-but" v-if="pinkBool == 1">拼团成功</view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="lyy-hx"></view>
  73. <!-- 第三部分 -->
  74. <view class="lyy-c">
  75. <view class="lyy-c-p">
  76. <view class="lyy-c-word">
  77. <view>拼团规则:</view>
  78. <view>1.点击商品进入商品详情,通过超值拼团进入订单支付 页,用户付款成功后,按页面提示分享给微信好友。</view>
  79. <view>2.好友通过分享,加入超值拼团,完成订单支付,待达成 拼团人数后,拼团成功。</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  87. import { getCombinationLisPink } from '@/api/groupBooking.js';
  88. import { groupGoods } from '@/api/product.js';
  89. import { timeComputed } from '@/utils/rocessor.js';
  90. import { mapState } from 'vuex';
  91. // 倒计时
  92. export default {
  93. computed: {
  94. // 还需要报名的人数
  95. peopleNub() {
  96. return this.pinkT.people - 1 - this.people.length;
  97. }
  98. },
  99. data() {
  100. return {
  101. gp_id: 0, //拼团商品id
  102. goods: {}, //商品信息
  103. pinkT: {}, //拼团团长信息
  104. people: [], //拼团成员信息
  105. status: 0, //判断是否为团长
  106. gid: 0,
  107. user_info: {}, //当前用户信息
  108. // 倒计时
  109. stopTime: {
  110. stopTimeH: 0,
  111. stopTimeM: 0,
  112. stopTimeS: 0
  113. },
  114. pinkBool: 0, //拼团状态0为待拼团 -1为拼团失败 1为拼团成功
  115. userBool: 0, //判断用户是否已经参与拼团 0未参加 1为已参加
  116. spread: '', //默认没有邀请人
  117. userInfo: {} //当前用户信息
  118. };
  119. },
  120. onLoad(e) {
  121. // 保存拼团订单id
  122. this.gp_id = e.id;
  123. // 判断是否有人邀请
  124. if (e.spread) {
  125. // 存储邀请人
  126. this.spread = e.spread;
  127. uni.setStorageSync('spread', option.spread);
  128. }
  129. },
  130. onShow() {
  131. this.getData();
  132. },
  133. components: {
  134. uniCountdown
  135. },
  136. methods: {
  137. //前往参团
  138. goBuy() {
  139. let _self = this;
  140. uni.navigateTo({
  141. url: '/pages/order/createOrder?pinkId=' + this.gp_id + '&type=pink' + '&pid=' + this.goods.product_id + '&gid=' + this.goods.id + '&merid=' + this.goods.mer_id
  142. });
  143. },
  144. //邀请参团
  145. invitation() {
  146. let obj = this;
  147. // 判断拼团是否已经结束
  148. if (obj.userBool == 0) {
  149. uni.showModal({
  150. title: '提示',
  151. content: '该拼团已经结束!',
  152. showCancel: false,
  153. success: res => {},
  154. fail: () => {},
  155. complete: () => {}
  156. });
  157. return;
  158. }
  159. uni.navigateTo({
  160. url: '/pages/groupBooking/inviteImg?id=' + this.pinkT.id + '&spread=' + this.userInfo.uid,
  161. success: res => {},
  162. fail: e => {
  163. console.log(e);
  164. },
  165. complete: () => {}
  166. });
  167. },
  168. // #ifdef H5
  169. // 加载微信html5页面分享方法
  170. shareDate() {
  171. let obj = this;
  172. // 判断是否微信浏览器
  173. let bool = uni.getStorageSync('weichatBrowser') || '';
  174. if (bool) {
  175. // 过滤微信强制添加的链接地址
  176. url = url.replace('?from=singlemessage', '');
  177. let data = {
  178. link: url, // 分享链接
  179. imgUrl: obj.goodsObjact.image, // 分享图标
  180. desc: obj.goodsObjact.store_info,
  181. title: obj.goodsObjact.store_name,
  182. success: function() {}
  183. };
  184. obj.weichatObj.updateAppMessageShareData(data);
  185. obj.weichatObj.updateTimelineShareData(data);
  186. }
  187. },
  188. // #endif
  189. // 获取拼团信息
  190. getData() {
  191. let obj = this;
  192. // let data = {gp_id:_self.gp_id},
  193. getCombinationLisPink({}, this.gp_id).then(e => {
  194. let r = e.data;
  195. // 保存拼团商品详细
  196. obj.goods = r.store_combination;
  197. // 保存团长信息
  198. obj.pinkT = r.pinkT;
  199. /* 计算倒计时 */
  200. obj.timeComputed(obj.pinkT.stop_time * 1000);
  201. // 获取拼团用户列表
  202. obj.people = r.pinkAll;
  203. // 获取当前是否已参与过这个拼团
  204. obj.userBool = r.userBool;
  205. // 判断当前用户是否为团长
  206. if (r.pinkT.uid == r.userInfo.uid) {
  207. // 显示邀请好用选项
  208. obj.status = 1;
  209. }
  210. // 保存当前登录用户信息
  211. obj.userInfo = r.userInfo;
  212. // 获取拼团是否已经过期
  213. obj.pinkBool = r.pinkBool;
  214. // #ifdef H5
  215. // 加载微信分享配置
  216. this.shareDate();
  217. // #endif
  218. });
  219. },
  220. // 计算倒计时时间
  221. timeComputed(da) {
  222. let obj = this;
  223. let stopTime = timeComputed(da);
  224. obj.stopTime.stopTimeH = stopTime.hours;
  225. obj.stopTime.stopTimeM = stopTime.minutes;
  226. obj.stopTime.stopTimeS = stopTime.seconds;
  227. }
  228. }
  229. };
  230. </script>
  231. <style lang="scss">
  232. .box {
  233. /* #ifdef APP-PLUS | MP */
  234. padding-top: var(--status-bar-height);
  235. /* #endif */
  236. }
  237. .lyy-c {
  238. width: 100%;
  239. background: rgba(255, 255, 255, 1);
  240. .lyy-c-word {
  241. font-size: 28rpx;
  242. color: rgba(102, 102, 102, 1);
  243. line-height: 50rpx;
  244. }
  245. .lyy-c-p {
  246. padding: 39rpx 30rpx;
  247. }
  248. }
  249. .lyy-wrap {
  250. background-color: #f4f4f4;
  251. }
  252. .lyy-hx {
  253. height: 14rpx;
  254. }
  255. .image1 {
  256. width: 200rpx;
  257. height: 33rpx;
  258. background: url('http://lxscimg.liuniu946.com/2019-11-02_5dbd0e10a2160.png') center center no-repeat;
  259. background-size: 200rpx auto;
  260. }
  261. .lyy-b {
  262. width: 100%;
  263. background-color: white;
  264. .lyy-b-p {
  265. padding: 30rpx 45rpx;
  266. .lyy-b-word2,
  267. .lyy-b-word3 {
  268. font-size: 28rpx;
  269. font-weight: bold;
  270. }
  271. .lyy-b-word2 {
  272. color: #fc5b62;
  273. }
  274. .lyy-b-word3 {
  275. color: #1d2023;
  276. }
  277. .lyy-b-jz {
  278. width: 100%;
  279. justify-content: center;
  280. margin-bottom: 20rpx;
  281. .lyy-y {
  282. width: 80rpx;
  283. height: 80rpx;
  284. margin: 0px 15rpx;
  285. border-radius: 40rpx;
  286. overflow: hidden;
  287. .user-list-img {
  288. width: 100%;
  289. height: 100%;
  290. }
  291. }
  292. .lyy-y-word {
  293. margin-top: 10rpx;
  294. font-size: 28rpx;
  295. text-align: center;
  296. width: 110rpx;
  297. }
  298. .lyy-b-but {
  299. width: 550rpx;
  300. height: 80rpx;
  301. background: #fc5b62;
  302. border-radius: 100rpx;
  303. text-align: center;
  304. color: white;
  305. line-height: 80rpx;
  306. font-size: 32rpx;
  307. }
  308. .cmy-user-box {
  309. .user-list {
  310. display: inline-block;
  311. line-height: 1;
  312. }
  313. }
  314. }
  315. .lyy-b-word {
  316. text-align: center;
  317. font-size: 26rpx;
  318. color: rgba(29, 32, 35, 1);
  319. }
  320. }
  321. }
  322. // 商品列表样式
  323. .lyy-a {
  324. width: 100%;
  325. background-color: white;
  326. .lyy-a-p {
  327. padding: 22rpx 30rpx;
  328. .lyy-a-f {
  329. display: flex;
  330. align-items: center;
  331. .lyy-a-f2 {
  332. flex: 1;
  333. }
  334. .lyy-a-tu {
  335. width: 122rpx;
  336. height: 122rpx;
  337. }
  338. .lyy-a-z {
  339. padding-left: 30rpx;
  340. flex-grow: 1;
  341. .money-box {
  342. justify-content: flex-start;
  343. .lyy-a-tu2 {
  344. background: rgba(255, 255, 255, 1);
  345. border: 1rpx solid #fc5b62;
  346. .lyy-a-tu3 {
  347. background-color: #fc5b62;
  348. padding: 2px 4px 0px 4px;
  349. text-align: center;
  350. height: 26rpx;
  351. .lyy-a-tu5 {
  352. width: 20rpx;
  353. height: 20rpx;
  354. display: block;
  355. }
  356. }
  357. .lyy-a-tu4 {
  358. margin-left: 2px;
  359. font-size: 10px;
  360. color: #fc5b62;
  361. padding: 0px 10rpx;
  362. text-align: center;
  363. }
  364. }
  365. }
  366. .lyy-a-word {
  367. line-height: 56rpx;
  368. .lyy-a-word3 {
  369. font-size: 28rpx;
  370. font-weight: bold;
  371. color: #fc5b62;
  372. }
  373. }
  374. .lyy-a-word2 {
  375. font-size: 30rpx;
  376. color: rgba(29, 32, 35, 1);
  377. }
  378. }
  379. }
  380. }
  381. }
  382. </style>