detail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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-countdowns
  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-countdowns>
  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 uniCountdowns from '@/components/uni-countdown/uni-countdowns.vue';
  87. import { getCombinationLisPink } from '@/api/product.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. data() {
  94. return {
  95. gp_id: 0, //拼团商品id
  96. goods: {}, //商品信息
  97. pinkT: {}, //拼团团长信息
  98. people: [], //拼团成员信息
  99. status: 0, //判断是否为团长
  100. gid: 0,
  101. user_info: {}, //当前用户信息
  102. // 倒计时
  103. stopTime: {
  104. stopTimeH: 0,
  105. stopTimeM: 0,
  106. stopTimeS: 0
  107. },
  108. pinkBool: 0, //拼团状态0为待拼团 -1为拼团失败 1为拼团成功
  109. userBool: 0, //判断用户是否已经参与拼团 0未参加 1为已参加
  110. spread: '', //默认没有邀请人
  111. userInfo: {} ,//当前用户信息
  112. peopleNub:0
  113. };
  114. },
  115. onLoad(e) {
  116. // 保存拼团订单id
  117. this.gp_id = e.id;
  118. // 判断是否有人邀请
  119. if (e.spread) {
  120. // 存储邀请人
  121. this.spread = e.spread;
  122. uni.setStorageSync('spread', option.spread);
  123. }
  124. },
  125. onShow() {
  126. this.getData();
  127. },
  128. components: {
  129. uniCountdowns
  130. },
  131. methods: {
  132. //前往参团
  133. goBuy() {
  134. let _self = this;
  135. uni.navigateTo({
  136. url: '/pages/order/createOrder?pinkId=' + this.gp_id + '&type=pink' + '&pid=' + this.goods.product_id + '&gid=' + this.goods.id + '&merid=' + this.goods.mer_id
  137. });
  138. },
  139. //邀请参团
  140. invitation() {
  141. let obj = this;
  142. // 判断拼团是否已经结束
  143. if (obj.userBool == 0) {
  144. uni.showModal({
  145. title: '提示',
  146. content: '该拼团已经结束!',
  147. showCancel: false,
  148. success: res => {},
  149. fail: () => {},
  150. complete: () => {}
  151. });
  152. return;
  153. }
  154. uni.navigateTo({
  155. url: '/pages/product/groupBooking/inviteImg?id=' + this.pinkT.id + '&spread=' + this.userInfo.uid,
  156. success: res => {},
  157. fail: e => {
  158. console.log(e);
  159. },
  160. complete: () => {}
  161. });
  162. },
  163. // #ifdef H5
  164. // 加载微信html5页面分享方法
  165. shareDate() {
  166. let obj = this;
  167. // 判断是否微信浏览器
  168. let bool = uni.getStorageSync('weichatBrowser') || '';
  169. if (bool) {
  170. // 过滤微信强制添加的链接地址
  171. url = url.replace('?from=singlemessage', '');
  172. let data = {
  173. link: url, // 分享链接
  174. imgUrl: obj.goodsObjact.image, // 分享图标
  175. desc: obj.goodsObjact.store_info,
  176. title: obj.goodsObjact.store_name,
  177. success: function() {}
  178. };
  179. obj.weichatObj.updateAppMessageShareData(data);
  180. obj.weichatObj.updateTimelineShareData(data);
  181. }
  182. },
  183. // #endif
  184. // 获取拼团信息
  185. getData() {
  186. let obj = this;
  187. // let data = {gp_id:_self.gp_id},
  188. getCombinationLisPink({}, this.gp_id).then(e => {
  189. let r = e.data;
  190. // 保存拼团商品详细
  191. obj.goods = r.store_combination;
  192. // 保存团长信息
  193. obj.pinkT = r.pinkT;
  194. /* 计算倒计时 */
  195. obj.timeComputed(obj.pinkT.stop_time * 1000);
  196. // 获取拼团用户列表
  197. obj.people = r.pinkAll;
  198. // 获取当前是否已参与过这个拼团
  199. obj.userBool = r.userBool;
  200. // 判断当前用户是否为团长
  201. if (r.pinkT.uid == r.userInfo.uid) {
  202. // 显示邀请好用选项
  203. obj.status = 1;
  204. }
  205. // 保存当前登录用户信息
  206. obj.userInfo = r.userInfo;
  207. // 获取拼团是否已经过期
  208. obj.pinkBool = r.pinkBool;
  209. obj.peopleNub = obj.pinkT.people - 1 - obj.people.length;
  210. // #ifdef H5
  211. // 加载微信分享配置
  212. this.shareDate();
  213. // #endif
  214. });
  215. },
  216. // 计算倒计时时间
  217. timeComputed(da) {
  218. let obj = this;
  219. let stopTime = timeComputed(da);
  220. obj.stopTime.stopTimeH = stopTime.hours;
  221. obj.stopTime.stopTimeM = stopTime.minutes;
  222. obj.stopTime.stopTimeS = stopTime.seconds;
  223. }
  224. }
  225. };
  226. </script>
  227. <style lang="scss">
  228. .box {
  229. /* #ifdef APP-PLUS | MP */
  230. padding-top: var(--status-bar-height);
  231. /* #endif */
  232. }
  233. .lyy-c {
  234. width: 100%;
  235. background: rgba(255, 255, 255, 1);
  236. .lyy-c-word {
  237. font-size: 28rpx;
  238. color: rgba(102, 102, 102, 1);
  239. line-height: 50rpx;
  240. }
  241. .lyy-c-p {
  242. padding: 39rpx 30rpx;
  243. }
  244. }
  245. .lyy-wrap {
  246. background-color: #f4f4f4;
  247. }
  248. .lyy-hx {
  249. height: 14rpx;
  250. }
  251. .image1 {
  252. width: 200rpx;
  253. height: 33rpx;
  254. background: url('http://lxscimg.liuniu946.com/2019-11-02_5dbd0e10a2160.png') center center no-repeat;
  255. background-size: 200rpx auto;
  256. }
  257. .lyy-b {
  258. width: 100%;
  259. background-color: white;
  260. .lyy-b-p {
  261. padding: 30rpx 45rpx;
  262. .lyy-b-word2,
  263. .lyy-b-word3 {
  264. font-size: 28rpx;
  265. font-weight: bold;
  266. }
  267. .lyy-b-word2 {
  268. color: #fc5b62;
  269. }
  270. .lyy-b-word3 {
  271. color: #1d2023;
  272. }
  273. .lyy-b-jz {
  274. width: 100%;
  275. justify-content: center;
  276. margin-bottom: 20rpx;
  277. .lyy-y {
  278. width: 80rpx;
  279. height: 80rpx;
  280. margin: 0px 15rpx;
  281. border-radius: 40rpx;
  282. overflow: hidden;
  283. .user-list-img {
  284. width: 100%;
  285. height: 100%;
  286. }
  287. }
  288. .lyy-y-word {
  289. margin-top: 10rpx;
  290. font-size: 28rpx;
  291. text-align: center;
  292. width: 110rpx;
  293. }
  294. .lyy-b-but {
  295. width: 550rpx;
  296. height: 80rpx;
  297. background: #fc5b62;
  298. border-radius: 100rpx;
  299. text-align: center;
  300. color: white;
  301. line-height: 80rpx;
  302. font-size: 32rpx;
  303. }
  304. .cmy-user-box {
  305. .user-list {
  306. display: inline-block;
  307. line-height: 1;
  308. }
  309. }
  310. }
  311. .lyy-b-word {
  312. text-align: center;
  313. font-size: 26rpx;
  314. color: rgba(29, 32, 35, 1);
  315. }
  316. }
  317. }
  318. // 商品列表样式
  319. .lyy-a {
  320. width: 100%;
  321. background-color: white;
  322. .lyy-a-p {
  323. padding: 22rpx 30rpx;
  324. .lyy-a-f {
  325. display: flex;
  326. align-items: center;
  327. .lyy-a-f2 {
  328. flex: 1;
  329. }
  330. .lyy-a-tu {
  331. width: 122rpx;
  332. height: 122rpx;
  333. }
  334. .lyy-a-z {
  335. padding-left: 30rpx;
  336. flex-grow: 1;
  337. .money-box {
  338. justify-content: flex-start;
  339. .lyy-a-tu2 {
  340. background: rgba(255, 255, 255, 1);
  341. border: 1rpx solid #fc5b62;
  342. .lyy-a-tu3 {
  343. background-color: #fc5b62;
  344. padding: 2px 4px 0px 4px;
  345. text-align: center;
  346. height: 26rpx;
  347. .lyy-a-tu5 {
  348. width: 20rpx;
  349. height: 20rpx;
  350. display: block;
  351. }
  352. }
  353. .lyy-a-tu4 {
  354. margin-left: 2px;
  355. font-size: 10px;
  356. color: #fc5b62;
  357. padding: 0px 10rpx;
  358. text-align: center;
  359. }
  360. }
  361. }
  362. .lyy-a-word {
  363. line-height: 56rpx;
  364. .lyy-a-word3 {
  365. font-size: 28rpx;
  366. font-weight: bold;
  367. color: #fc5b62;
  368. }
  369. }
  370. .lyy-a-word2 {
  371. font-size: 30rpx;
  372. color: rgba(29, 32, 35, 1);
  373. }
  374. }
  375. }
  376. }
  377. }
  378. </style>