detail.vue 9.4 KB

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