index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <template>
  2. <div class="group-con" :style="colorStyle">
  3. <div class="header acea-row row-between-wrapper" v-if="storeCombination">
  4. <div class="pictrue"><img :src="storeCombination.image" /></div>
  5. <div class="text">
  6. <div class="line1" v-text="storeCombination.title"></div>
  7. <div class="money">
  8. {{$t(`¥`)}}
  9. <span class="num" v-text="storeCombination.price"></span>
  10. <span class="team cart-color">{{storeCombination.people + $t(`人拼`)}}</span>
  11. </div>
  12. </div>
  13. <div v-if="pinkBool === -1" class="iconfont icon-pintuanshibai"></div>
  14. <div v-else-if="pinkBool === 1" class="iconfont icon-pintuanchenggong font-num"></div>
  15. </div>
  16. <div class="wrapper">
  17. <div class="title acea-row row-center-wrapper" v-if="pinkBool === 0">
  18. <div class="line"></div>
  19. <div class="name acea-row row-center-wrapper">
  20. {{$t(`剩余`)}}
  21. <CountDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '"
  22. :second-text="' '" :datatime="pinkT.stop_time"></CountDown>
  23. {{$t(`结束`)}}
  24. </div>
  25. <div class="line"></div>
  26. </div>
  27. <div class="tips font-num" v-if="pinkBool === 1">{{$t(`恭喜您拼团成功`)}}</div>
  28. <div class="tips" v-else-if="pinkBool === -1">{{$t(`还差`)}}{{ count }}{{$t(`人,拼团失败`)}}</div>
  29. <div class="tips font-num" v-else-if="pinkBool === 0">{{$t(`拼团中,还差`)}}{{ count }}{{$t(`人拼团成功`)}}</div>
  30. <div class="list acea-row row-middle"
  31. :class="[pinkBool === 1 || pinkBool === -1 ? 'result' : '', iShidden ? 'on' : '']">
  32. <div class="pictrue"><img :src="pinkT.avatar" />
  33. <view class="dumpling">{{$t(`团长`)}}</view>
  34. </div>
  35. <div class="acea-row row-middle" v-if="pinkAll.length > 0">
  36. <div class="pictrue" v-for="(item, index) in pinkAll" :key="index"><img :src="item.avatar" /></div>
  37. </div>
  38. <div class="pictrue" v-for="index in count" :key="index">
  39. <image class="img-none" src="../static/vacancy.png"> </image>
  40. </div>
  41. </div>
  42. <div v-if="(pinkBool === 1 || pinkBool === -1) && count > 9" class="lookAll acea-row row-center-wrapper"
  43. @click="lookAll">
  44. {{ iShidden ? $t(`收起`) : $t(`查看更多`) }}
  45. <span class="iconfont" :class="iShidden ? 'icon-xiangshang' : 'icon-xiangxia'"></span>
  46. </div>
  47. <div v-if="userBool === 1 && isOk == 0 && pinkBool === 0">
  48. <div class="teamBnt bg-color-red" @click="listenerActionSheet">{{$t(`邀请好友参团`)}}</div>
  49. </div>
  50. <div class="teamBnt bg-color-red" v-else-if="userBool === 0 && pinkBool === 0 && count > 0" @click="pay">
  51. {{$t(`我要参团`)}}
  52. </div>
  53. <div class="teamBnt bg-color-red" v-if="pinkBool === 1 || pinkBool === -1"
  54. @click="goDetail(storeCombination.id)">{{$t(`再次开团`)}}</div>
  55. <div class="cancel" @click="getCombinationRemove"
  56. v-if="pinkBool === 0 && userBool === 1 && pinkT.uid == userInfo.uid">
  57. <span class="iconfont icon-guanbi3"></span>
  58. {{$t(`取消开团`)}}
  59. </div>
  60. <div class="lookOrder" v-if="pinkBool === 1 && orderPid === 0" @click="goOrder">
  61. {{$t(`查看订单信息`)}}
  62. <span class="iconfont icon-xiangyou"></span>
  63. </div>
  64. </div>
  65. <div class="group-recommend">
  66. <div class="title acea-row row-between-wrapper">
  67. <div>{{$t(`大家都在拼`)}}</div>
  68. <div class="more" @click="goList">
  69. {{$t(`更多拼团`)}}
  70. <span class="iconfont icon-jiantou"></span>
  71. </div>
  72. </div>
  73. <div class="list acea-row row-middle">
  74. <div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
  75. <div class="pictrue">
  76. <img :src="item.image" />
  77. <div class="team" v-text="item.people + $t(`人团`)"></div>
  78. </div>
  79. <div class="name line1" v-text="item.title"></div>
  80. <div class="money font-color-red" v-text="$t(`¥`) + item.price"></div>
  81. </div>
  82. </div>
  83. </div>
  84. <product-window :attr="attr" :limitNum="1" :iSbnt="1" @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
  85. @ChangeCartNum="ChangeCartNum" @iptCartNum="iptCartNum" @attrVal="attrVal" @goCat="goPay"></product-window>
  86. <!-- 分享按钮 -->
  87. <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
  88. <!-- #ifndef MP -->
  89. <button class="item" hover-class='none' v-if="weixinStatus === true" @click="H5ShareBox = true">
  90. <!-- <button class="item" hover-class='none' v-if="weixinStatus === true" @click="setShareInfoStatus"> -->
  91. <view class="iconfont icon-weixin3"></view>
  92. <view class="">{{$t(`发送给朋友`)}}</view>
  93. </button>
  94. <!-- #endif -->
  95. <!-- #ifdef MP -->
  96. <button class="item" open-type="share" hover-class='none' @click="goFriend">
  97. <view class="iconfont icon-weixin3"></view>
  98. <view class="">{{$t(`发送给朋友`)}}</view>
  99. </button>
  100. <!-- #endif -->
  101. <!-- #ifdef APP-PLUS -->
  102. <view class="item" @click="appShare('WXSceneSession')">
  103. <view class="iconfont icon-weixin3"></view>
  104. <view class="">{{$t(`微信好友`)}}</view>
  105. </view>
  106. <view class="item" @click="appShare('WXSenceTimeline')">
  107. <view class="iconfont icon-pengyouquan"></view>
  108. <view class="">{{$t(`微信朋友圈`)}}</view>
  109. </view>
  110. <!-- #endif -->
  111. <!-- #ifndef APP-PLUS -->
  112. <button class="item" hover-class='none' @tap="goPoster">
  113. <view class="iconfont icon-haibao"></view>
  114. <view class="">{{$t(`生成海报`)}}</view>
  115. </button>
  116. <!-- #endif -->
  117. </view>
  118. <view class="mask" v-if="posters" @click="listenerActionClose"></view>
  119. <!-- 发送给朋友图片 -->
  120. <view class="share-box" v-if="H5ShareBox">
  121. <image :src="imgHost + '/statics/images/share-info.png'" @click="H5ShareBox = false"></image>
  122. </view>
  123. <!-- #ifdef MP -->
  124. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  125. <!-- #endif -->
  126. <!-- <Product-window v-on:changeFun="changeFun" :attr="attr" :limitNum='1' :iSbnt='1'></Product-window> -->
  127. <!-- #ifndef MP -->
  128. <home></home>
  129. <!-- #endif -->
  130. </div>
  131. </template>
  132. <script>
  133. import CountDown from '@/components/countDown';
  134. import ProductWindow from '@/components/productWindow';
  135. import util from '../../../utils/util.js';
  136. import {
  137. toLogin
  138. } from '@/libs/login.js';
  139. import {
  140. mapGetters
  141. } from 'vuex';
  142. import {
  143. getCombinationPink,
  144. postCombinationRemove
  145. } from '@/api/activity';
  146. import {
  147. postCartAdd
  148. } from '@/api/store';
  149. // #ifdef MP
  150. import authorize from '@/components/Authorize';
  151. // #endif
  152. import home from '@/components/home';
  153. const NAME = 'GroupRule';
  154. // #ifdef APP-PLUS
  155. import {
  156. TOKENNAME
  157. } from '@/config/app.js';
  158. // #endif
  159. const app = getApp();
  160. import colors from '@/mixins/color.js';
  161. import {
  162. HTTP_REQUEST_URL
  163. } from '@/config/app';
  164. export default {
  165. name: NAME,
  166. components: {
  167. CountDown,
  168. ProductWindow,
  169. home,
  170. // #ifdef MP
  171. authorize
  172. // #endif
  173. },
  174. props: {},
  175. mixins: [colors],
  176. data: function() {
  177. return {
  178. imgHost: HTTP_REQUEST_URL,
  179. currentPinkOrder: '', //当前拼团订单
  180. isOk: 0, //判断拼团是否完成
  181. pinkBool: 0, //判断拼团是否成功|0=失败,1=成功
  182. userBool: 0, //判断当前用户是否在团内|0=未在,1=在
  183. pinkAll: [], //团员
  184. pinkT: [], //团长信息
  185. storeCombination: undefined, //拼团产品
  186. storeCombinationHost: [], //拼团推荐
  187. pinkId: 0,
  188. count: 0, //拼团剩余人数
  189. iShidden: false,
  190. isOpen: false, //是否打开属性组件
  191. attr: {
  192. cartAttr: false,
  193. productSelect: {
  194. image: '',
  195. store_name: '',
  196. price: '',
  197. quota: 0,
  198. unique: '',
  199. cart_num: 1,
  200. quota_show: 0,
  201. product_stock: 0,
  202. num: 0
  203. },
  204. productAttr: []
  205. },
  206. cart_num: '',
  207. userInfo: {},
  208. posters: false,
  209. weixinStatus: false,
  210. H5ShareBox: false, //公众号分享图片
  211. isAuto: false, //没有授权的不会自动授权
  212. isShowAuth: false, //是否隐藏授权
  213. attrTxt: this.$t(`请选择`), //属性页面提示
  214. attrValue: '', //已选属性,
  215. orderPid: 0
  216. };
  217. },
  218. computed: mapGetters({
  219. 'isLogin': 'isLogin',
  220. 'userData': 'userInfo'
  221. }),
  222. watch: {
  223. isLogin: {
  224. handler: function(newV, oldV) {
  225. if (newV) {
  226. this.getCombinationPink();
  227. } else {
  228. toLogin();
  229. }
  230. },
  231. deep: true
  232. },
  233. userData: {
  234. handler: function(newV, oldV) {
  235. if (newV) {
  236. this.userInfo = newV;
  237. app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
  238. }
  239. },
  240. deep: true
  241. }
  242. },
  243. onLoad(options) {
  244. var that = this;
  245. // #ifdef MP
  246. if (options.scene) {
  247. var value = util.getUrlParams(decodeURIComponent(options.scene));
  248. if (typeof value === 'object') {
  249. if (value.id) options.id = value.id;
  250. //记录推广人uid
  251. if (value.pid) app.globalData.spid = value.pid;
  252. }
  253. }
  254. // #endif
  255. if (options.id) {
  256. that.pinkId = options.id;
  257. }
  258. if (that.isLogin == false) {
  259. this.$Cache.set('login_back_url', `/pages/activity/goods_combination_status/index?id=${options.id}`);
  260. toLogin();
  261. }
  262. },
  263. //#ifdef MP
  264. /**
  265. * 用户点击右上角分享
  266. */
  267. onShareAppMessage: function() {
  268. let that = this;
  269. return {
  270. title: that.$t(`您的好友`) + that.userInfo.nickname + this.$t(`邀请您参团`) + that.storeCombination.title,
  271. path: app.globalData.openPages,
  272. imageUrl: that.storeCombination.image
  273. };
  274. },
  275. //#endif
  276. mounted() {
  277. if (this.isLogin) {
  278. this.getCombinationPink();
  279. }
  280. },
  281. methods: {
  282. // app分享
  283. // #ifdef APP-PLUS
  284. appShare(scene) {
  285. let that = this
  286. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  287. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  288. uni.share({
  289. provider: "weixin",
  290. scene: scene,
  291. type: 0,
  292. href: `${HTTP_REQUEST_URL}${curRoute}`,
  293. title: that.$t(`您的好友`) + that.userInfo.nickname + that.$t(`邀请您参团`) + that.storeCombination
  294. .title,
  295. imageUrl: that.storeCombination.small_image,
  296. success: function(res) {
  297. uni.showToast({
  298. title: that.$t(`分享成功`),
  299. icon: 'success'
  300. })
  301. that.posters = false;
  302. },
  303. fail: function(err) {
  304. uni.showToast({
  305. title: that.$t(`分享失败`),
  306. icon: 'none',
  307. duration: 2000
  308. })
  309. that.posters = false;
  310. }
  311. });
  312. },
  313. // #endif
  314. // 授权关闭
  315. authColse: function(e) {
  316. this.isShowAuth = e;
  317. },
  318. // 授权后回调
  319. onLoadFun: function(e) {
  320. this.userInfo = e;
  321. app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
  322. this.getCombinationPink();
  323. },
  324. /**
  325. * 分享打开
  326. *
  327. */
  328. listenerActionSheet: function() {
  329. if (this.isLogin == false) {
  330. toLogin();
  331. } else {
  332. // #ifdef H5
  333. if (this.$wechat.isWeixin() === true) {
  334. this.weixinStatus = true;
  335. }
  336. // #endif
  337. this.posters = true;
  338. }
  339. },
  340. // 分享关闭
  341. listenerActionClose: function() {
  342. this.posters = false;
  343. },
  344. // 小程序关闭分享弹窗;
  345. goFriend: function() {
  346. this.posters = false;
  347. },
  348. /**
  349. * 购物车手动填写
  350. *
  351. */
  352. iptCartNum: function(e) {
  353. this.$set(this.attr.productSelect, 'cart_num', e);
  354. this.$set(this, 'cart_num', e);
  355. },
  356. attrVal(val) {
  357. this.attr.productAttr[val.indexw].index = this.attr.productAttr[val.indexw].attr_values[val.indexn];
  358. },
  359. onMyEvent: function() {
  360. this.$set(this.attr, 'cartAttr', false);
  361. this.$set(this, 'isOpen', false);
  362. },
  363. //将父级向子集多次传送的函数合二为一;
  364. // changeFun: function(opt) {
  365. // if (typeof opt !== "object") opt = {};
  366. // let action = opt.action || "";
  367. // let value = opt.value === undefined ? "" : opt.value;
  368. // this[action] && this[action](value);
  369. // },
  370. // changeattr: function(res) {
  371. // var that = this;
  372. // that.attr.cartAttr = res;
  373. // },
  374. //选择属性;
  375. ChangeAttr: function(res) {
  376. this.$set(this, 'cart_num', 1);
  377. let productSelect = this.productValue[res];
  378. if (productSelect) {
  379. this.$set(this.attr.productSelect, 'image', productSelect.image);
  380. this.$set(this.attr.productSelect, 'price', productSelect.price);
  381. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  382. this.$set(this.attr.productSelect, 'unique', productSelect.unique);
  383. this.$set(this.attr.productSelect, 'cart_num', 1);
  384. this.$set(this.attr.productSelect, 'product_stock', productSelect.product_stock);
  385. this.$set(this.attr.productSelect, 'quota_show', productSelect.quota_show);
  386. this.$set(this, 'attrValue', res);
  387. this.$set(this, 'attrTxt', this.$t(`已选择`));
  388. } else {
  389. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  390. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  391. this.$set(this.attr.productSelect, 'quota', 0);
  392. this.$set(this.attr.productSelect, 'unique', '');
  393. this.$set(this.attr.productSelect, 'cart_num', 0);
  394. this.$set(this.attr.productSelect, 'quota_show', 0);
  395. this.$set(this.attr.productSelect, 'product_stock', 0);
  396. this.$set(this, 'attrValue', '');
  397. this.$set(this, 'attrTxt', this.$t(`请选择`));
  398. }
  399. },
  400. ChangeCartNum: function(res) {
  401. //changeValue:是否 加|减
  402. //获取当前变动属性
  403. let productSelect = this.productValue[this.attrValue];
  404. if (this.cart_num) {
  405. productSelect.cart_num = this.cart_num;
  406. this.attr.productSelect.cart_num = this.cart_num;
  407. }
  408. //如果没有属性,赋值给商品默认库存
  409. if (productSelect === undefined && !this.attr.productAttr.length) productSelect = this.attr
  410. .productSelect;
  411. if (productSelect === undefined) return;
  412. let stock = productSelect.stock || 0;
  413. let quotaShow = productSelect.quota_show || 0;
  414. let quota = productSelect.quota || 0;
  415. let productStock = productSelect.product_stock || 0;
  416. let num = this.attr.productSelect;
  417. let nums = this.storeCombination.num || 0;
  418. //设置默认数据
  419. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  420. if (res) {
  421. num.cart_num++;
  422. let arrMin = [];
  423. arrMin.push(nums);
  424. arrMin.push(quota);
  425. arrMin.push(productStock);
  426. let minN = Math.min.apply(null, arrMin);
  427. if (num.cart_num >= minN) {
  428. this.$set(this.attr.productSelect, 'cart_num', minN ? minN : 1);
  429. this.$set(this, 'cart_num', minN ? minN : 1);
  430. }
  431. // if(quotaShow >= productStock){
  432. // if (num.cart_num > productStock) {
  433. // this.$set(this.attr.productSelect, "cart_num", productStock);
  434. // this.$set(this, "cart_num", productStock);
  435. // }
  436. // }else{
  437. // if (num.cart_num > quotaShow) {
  438. // this.$set(this.attr.productSelect, "cart_num", quotaShow);
  439. // this.$set(this, "cart_num", quotaShow);
  440. // }
  441. // }
  442. this.$set(this, 'cart_num', num.cart_num);
  443. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  444. } else {
  445. num.cart_num--;
  446. if (num.cart_num < 1) {
  447. this.$set(this.attr.productSelect, 'cart_num', 1);
  448. this.$set(this, 'cart_num', 1);
  449. }
  450. this.$set(this, 'cart_num', num.cart_num);
  451. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  452. }
  453. // if (res) {
  454. // num.cart_num++;
  455. // if (num.cart_num > quota) {
  456. // this.$set(this.attr.productSelect, "cart_num", quota);
  457. // this.$set(this, "cart_num", quota);
  458. // }
  459. // } else {
  460. // num.cart_num--;
  461. // if (num.cart_num < 1) {
  462. // this.$set(this.attr.productSelect, "cart_num", 1);
  463. // this.$set(this, "cart_num", 1);
  464. // }
  465. // }
  466. },
  467. //默认选中属性;
  468. DefaultSelect() {
  469. let productAttr = this.attr.productAttr,
  470. value = [];
  471. for (var key in this.productValue) {
  472. if (this.productValue[key].quota > 0) {
  473. value = this.attr.productAttr.length ? key.split(',') : [];
  474. break;
  475. }
  476. }
  477. for (let i = 0; i < productAttr.length; i++) {
  478. this.$set(productAttr[i], 'index', value[i]);
  479. }
  480. //sort();排序函数:数字-英文-汉字;
  481. let productSelect = this.productValue[value.join(',')];
  482. if (productSelect && productAttr.length) {
  483. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  484. this.$set(this.attr.productSelect, 'image', productSelect.image);
  485. this.$set(this.attr.productSelect, 'price', productSelect.price);
  486. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  487. this.$set(this.attr.productSelect, 'unique', productSelect.unique);
  488. this.$set(this.attr.productSelect, 'cart_num', 1);
  489. this.$set(this.attr.productSelect, 'product_stock', productSelect.product_stock);
  490. this.$set(this.attr.productSelect, 'quota_show', productSelect.quota_show);
  491. this.$set(this, 'attrValue', value.join(','));
  492. this.attrValue = value.join(',');
  493. this.$set(this, 'attrTxt', this.$t(`已选择`));
  494. } else if (!productSelect && productAttr.length) {
  495. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  496. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  497. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  498. this.$set(this.attr.productSelect, 'quota', 0);
  499. this.$set(this.attr.productSelect, 'unique', '');
  500. this.$set(this.attr.productSelect, 'cart_num', 0);
  501. this.$set(this.attr.productSelect, 'product_stock', 0);
  502. this.$set(this.attr.productSelect, 'quota_show', 0);
  503. this.$set(this, 'attrValue', '');
  504. this.$set(this, 'attrTxt', this.$t(`请选择`));
  505. } else if (!productSelect && !productAttr.length) {
  506. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  507. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  508. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  509. this.$set(this.attr.productSelect, 'quota', 0);
  510. this.$set(this.attr.productSelect, 'unique', this.storeCombination.unique || '');
  511. this.$set(this.attr.productSelect, 'cart_num', 1);
  512. this.$set(this.attr.productSelect, 'quota_show', 0);
  513. this.$set(this.attr.productSelect, 'product_stock', 0);
  514. this.$set(this, 'attrValue', '');
  515. this.$set(this, 'attrTxt', this.$t(`请选择`));
  516. }
  517. },
  518. setProductSelect: function() {
  519. var that = this;
  520. var attr = that.attr;
  521. attr.productSelect.image = that.storeCombination.image;
  522. attr.productSelect.store_name = that.storeCombination.title;
  523. attr.productSelect.price = that.storeCombination.price;
  524. attr.productSelect.quota = 0;
  525. attr.productSelect.quota_show = 0;
  526. attr.productSelect.product_stock = 0;
  527. attr.cartAttr = false;
  528. that.$set(that, 'attr', attr);
  529. },
  530. pay: function() {
  531. var that = this;
  532. that.attr.cartAttr = true;
  533. that.isOpen = true;
  534. },
  535. goPay() {
  536. var that = this;
  537. var data = {};
  538. // that.attr.cartAttr = res;
  539. data.productId = that.storeCombination.product_id;
  540. data.cartNum = that.attr.productSelect.cart_num;
  541. data.uniqueId = that.attr.productSelect.unique;
  542. data.combinationId = that.storeCombination.id;
  543. data.new = 1;
  544. postCartAdd(data)
  545. .then(res => {
  546. uni.navigateTo({
  547. url: '/pages/goods/order_confirm/index?new=1&cartId=' + res.data.cartId +
  548. '&pinkId=' + that.pinkId
  549. });
  550. })
  551. .catch(res => {
  552. that.$util.Tips({
  553. title: res
  554. });
  555. });
  556. },
  557. goPoster: function() {
  558. var that = this;
  559. that.posters = false;
  560. uni.navigateTo({
  561. url: '/pages/activity/poster-poster/index?type=2&id=' + that.pinkId
  562. });
  563. },
  564. goOrder: function() {
  565. var that = this;
  566. uni.navigateTo({
  567. url: '/pages/goods/order_details/index?order_id=' + that.currentPinkOrder
  568. });
  569. },
  570. //拼团列表
  571. goList: function() {
  572. uni.navigateTo({
  573. url: '/pages/activity/goods_combination/index'
  574. });
  575. },
  576. //拼团详情
  577. goDetail: function(id) {
  578. this.pinkId = id;
  579. // this.getCombinationPink();
  580. uni.navigateTo({
  581. url: '/pages/activity/goods_combination_details/index?id=' + id
  582. });
  583. // this.$router.push({
  584. // path: "/activity/group_detail/" + id
  585. // });
  586. },
  587. //拼团信息
  588. getCombinationPink: function() {
  589. var that = this;
  590. getCombinationPink(that.pinkId)
  591. .then(res => {
  592. that.$set(that, 'storeCombinationHost', res.data.store_combination_host);
  593. res.data.pinkT.stop_time = parseInt(res.data.pinkT.stop_time);
  594. that.$set(that, 'storeCombination', res.data.store_combination);
  595. that.$set(that.attr.productSelect, 'num', res.data.store_combination.num);
  596. that.$set(that, 'pinkT', res.data.pinkT);
  597. that.$set(that, 'pinkAll', res.data.pinkAll);
  598. that.$set(that, 'count', res.data.count);
  599. that.$set(that, 'userBool', res.data.userBool);
  600. that.$set(that, 'pinkBool', res.data.pinkBool);
  601. that.$set(that, 'isOk', res.data.is_ok);
  602. that.$set(that, 'currentPinkOrder', res.data.current_pink_order);
  603. that.$set(that, 'userInfo', res.data.userInfo);
  604. that.$set(that, 'orderPid', res.data.order_pid);
  605. that.attr.productAttr = res.data.store_combination.productAttr;
  606. that.productValue = res.data.store_combination.productValue;
  607. //#ifdef H5
  608. that.setOpenShare();
  609. //#endif
  610. that.setProductSelect();
  611. if (that.attr.productAttr != 0) that.DefaultSelect();
  612. if (res.data.is_ok == 1 && res.data.userBool == 0) {
  613. return this.$util.Tips({
  614. title: that.$t(`你不是该团的成员`),
  615. }, () => {
  616. uni.navigateTo({
  617. url: '/pages/activity/goods_combination/index'
  618. })
  619. });
  620. }
  621. })
  622. .catch(err => {
  623. return this.$util.Tips({
  624. title: err,
  625. }, () => {
  626. uni.navigateBack()
  627. // uni.switchTab({
  628. // url: '/pages/index/index'
  629. // })
  630. });
  631. });
  632. },
  633. //#ifdef H5
  634. setOpenShare() {
  635. let that = this;
  636. let configTimeline = {
  637. title: that.$t(`您的好友`) + that.userInfo.nickname + that.$t(`邀请您参团`) + that.storeCombination.title,
  638. desc: that.storeCombination.title,
  639. link: window.location.protocol + '//' + window.location.host +
  640. '/pages/activity/goods_combination_status/index?id=' + that.pinkId + '&bargain=' + that
  641. .userInfo.uid +
  642. '&spid=' +
  643. that.userInfo.uid,
  644. imgUrl: that.storeCombination.image
  645. };
  646. if (this.$wechat.isWeixin()) {
  647. this.$wechat
  648. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage',
  649. 'onMenuShareTimeline'
  650. ], configTimeline)
  651. .then(res => {})
  652. .catch(res => {
  653. if (res.is_ready) {
  654. res.wx.updateAppMessageShareData(configTimeline);
  655. res.wx.updateTimelineShareData(configTimeline);
  656. res.wx.onMenuShareAppMessage(configTimeline);
  657. res.wx.onMenuShareTimeline(configTimeline);
  658. }
  659. });
  660. }
  661. },
  662. //#endif
  663. //拼团取消
  664. getCombinationRemove: function() {
  665. var that = this;
  666. postCombinationRemove({
  667. id: that.pinkId,
  668. cid: that.storeCombination.id
  669. })
  670. .then(res => {
  671. that.$util.Tips({
  672. title: res.msg
  673. });
  674. this.getCombinationPink()
  675. })
  676. .catch(res => {
  677. that.$util.Tips({
  678. title: res
  679. });
  680. });
  681. },
  682. lookAll: function() {
  683. this.iShidden = !this.iShidden;
  684. }
  685. }
  686. };
  687. </script>
  688. <style lang="scss" scoped>
  689. .generate-posters {
  690. width: 100%;
  691. height: 170rpx;
  692. background-color: #fff;
  693. position: fixed;
  694. left: 0;
  695. bottom: 0;
  696. z-index: 300;
  697. transform: translate3d(0, 100%, 0);
  698. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  699. border-top: 1rpx solid #eee;
  700. }
  701. .generate-posters.on {
  702. transform: translate3d(0, 0, 0);
  703. }
  704. .generate-posters .item {
  705. flex: 1;
  706. text-align: center;
  707. font-size: 30rpx;
  708. }
  709. .generate-posters .item .iconfont {
  710. font-size: 80rpx;
  711. color: #5eae72;
  712. }
  713. .generate-posters .item .iconfont.icon-haibao {
  714. color: #5391f1;
  715. }
  716. /*开团*/
  717. .group-con .header {
  718. width: 100%;
  719. height: 186rpx;
  720. background-color: #fff;
  721. border-top: 1px solid #f5f5f5;
  722. padding: 0 30rpx;
  723. position: relative;
  724. }
  725. .group-con .header .iconfont {
  726. font-size: 100rpx;
  727. position: absolute;
  728. color: #ccc;
  729. right: 33rpx;
  730. bottom: 20rpx;
  731. }
  732. .group-con .header .pictrue {
  733. width: 140rpx;
  734. height: 140rpx;
  735. }
  736. .group-con .header .pictrue img {
  737. width: 100%;
  738. height: 100%;
  739. border-radius: 6rpx;
  740. }
  741. .group-con .header .text {
  742. width: 540rpx;
  743. font-size: 30rpx;
  744. color: #222;
  745. }
  746. .group-con .header .text .money {
  747. font-size: 24rpx;
  748. font-weight: bold;
  749. margin-top: 15rpx;
  750. }
  751. .group-con .header .text .money .num {
  752. font-size: 32rpx;
  753. }
  754. .group-con .header .text .money .team {
  755. padding: 1rpx 10rpx;
  756. font-weight: normal;
  757. border-radius: 50rpx;
  758. font-size: 20rpx;
  759. vertical-align: 4rpx;
  760. margin-left: 15rpx;
  761. }
  762. .group-con .wrapper {
  763. background-color: #fff;
  764. margin-top: 20rpx;
  765. padding: 2rpx 0 35rpx 0;
  766. }
  767. .group-con .wrapper .title {
  768. margin-top: 30rpx;
  769. }
  770. .group-con .wrapper .title .line {
  771. width: 136rpx;
  772. height: 1px;
  773. background-color: #ddd;
  774. }
  775. .group-con .wrapper .title .name {
  776. margin: 0 45rpx;
  777. font-size: 28rpx;
  778. color: #282828;
  779. }
  780. .group-con .wrapper .title .name .time {
  781. margin: 0 14rpx;
  782. }
  783. .group-con .wrapper .title .name .timeTxt {
  784. color: #fc4141;
  785. }
  786. .group-con .wrapper .title .name /deep/.time .styleAll {
  787. background-color: var(--view-minorColorT);
  788. text-align: center;
  789. border-radius: 3rpx;
  790. font-size: 28rpx;
  791. font-weight: bold;
  792. display: inline-block;
  793. vertical-align: middle;
  794. color: var(--view-theme);
  795. padding: 2rpx 5rpx;
  796. }
  797. .group-con .wrapper .tips {
  798. font-size: 30rpx;
  799. font-weight: bold;
  800. text-align: center;
  801. margin-top: 30rpx;
  802. color: #999;
  803. }
  804. .group-con .wrapper .list {
  805. padding: 0 30rpx;
  806. margin-top: 45rpx;
  807. }
  808. .group-con .wrapper .list.result {
  809. max-height: 240rpx;
  810. }
  811. .group-con .wrapper .list.result.on {
  812. max-height: 2000rpx;
  813. }
  814. .group-con .wrapper .list .pictrue {
  815. width: 94rpx;
  816. height: 94rpx;
  817. margin: 0 0 29rpx 35rpx;
  818. }
  819. .group-con .wrapper .list .pictrue {
  820. position: relative;
  821. }
  822. .group-con .wrapper .list .pictrue .dumpling {
  823. width: 72rpx;
  824. height: 32rpx;
  825. line-height: 32rpx;
  826. font-size: 18rpx;
  827. text-align: center;
  828. color: #fff;
  829. top: -12rpx;
  830. right: -20rpx;
  831. border-radius: 18rpx;
  832. position: absolute;
  833. background-color: var(--view-theme);
  834. }
  835. .group-con .wrapper .list .pictrue img,
  836. .group-con .wrapper .list .pictrue image {
  837. width: 100%;
  838. height: 100%;
  839. border-radius: 50%;
  840. border: 2rpx solid var(--view-theme);
  841. }
  842. .group-con .wrapper .list .pictrue image.img-none {
  843. border: none;
  844. }
  845. .group-con .wrapper .lookAll {
  846. font-size: 24rpx;
  847. color: #282828;
  848. padding-top: 10rpx;
  849. }
  850. .group-con .wrapper .lookAll .iconfont {
  851. font-size: 25rpx;
  852. margin: 2rpx 0 0 10rpx;
  853. }
  854. .group-con .wrapper .teamBnt {
  855. font-size: 30rpx;
  856. width: 620rpx;
  857. height: 86rpx;
  858. border-radius: 50rpx;
  859. text-align: center;
  860. line-height: 86rpx;
  861. color: #fff;
  862. margin: 21rpx auto 0 auto;
  863. }
  864. .group-con .wrapper .cancel,
  865. .group-con .wrapper .lookOrder {
  866. text-align: center;
  867. font-size: 24rpx;
  868. color: #282828;
  869. padding-top: 30rpx;
  870. }
  871. .group-con .wrapper .cancel .iconfont {
  872. font-size: 35rpx;
  873. color: #2c2c2c;
  874. vertical-align: -4rpx;
  875. margin-right: 9rpx;
  876. }
  877. .group-con .wrapper .lookOrder .iconfont {
  878. font-size: 25rpx;
  879. color: #2c2c2c;
  880. margin-left: 10rpx;
  881. }
  882. .group-con .group-recommend {
  883. background-color: #fff;
  884. margin-top: 25rpx;
  885. }
  886. .group-con .group-recommend .title {
  887. padding-right: 30rpx;
  888. margin-left: 30rpx;
  889. height: 85rpx;
  890. border-bottom: 1px solid #eee;
  891. font-size: 28rpx;
  892. color: #282828;
  893. }
  894. .group-con .group-recommend .title .more {
  895. color: #808080;
  896. }
  897. .group-con .group-recommend .title .more .iconfont {
  898. margin-left: 13rpx;
  899. font-size: 28rpx;
  900. }
  901. .group-con .group-recommend .list {
  902. margin-top: 30rpx;
  903. }
  904. .group-con .group-recommend .list .item {
  905. width: 210rpx;
  906. margin: 0 0 25rpx 30rpx;
  907. }
  908. .group-con .group-recommend .list .item .pictrue {
  909. width: 100%;
  910. height: 210rpx;
  911. position: relative;
  912. }
  913. .group-con .group-recommend .list .item .pictrue img {
  914. width: 100%;
  915. height: 100%;
  916. border-radius: 10rpx;
  917. }
  918. .group-con .group-recommend .list .item .pictrue .team {
  919. position: absolute;
  920. top: 28rpx;
  921. left: -5rpx;
  922. min-width: 100rpx;
  923. height: 36rpx;
  924. line-height: 36rpx;
  925. text-align: center;
  926. border-radius: 0 18rpx 18rpx 0;
  927. font-size: 20rpx;
  928. color: #fff;
  929. background-color: var(--view-theme);
  930. // background-image: linear-gradient(to right, #fb5445 0%, #e93323 100%);
  931. }
  932. .group-con .group-recommend .list .item .name {
  933. font-size: 28rpx;
  934. color: #333;
  935. margin-top: 0.18rem;
  936. }
  937. .group-con .group-recommend .list .item .money {
  938. font-weight: bold;
  939. font-size: 28rpx;
  940. }
  941. .share-box {
  942. z-index: 1000;
  943. position: fixed;
  944. left: 0;
  945. top: 0;
  946. width: 100%;
  947. height: 100%;
  948. image {
  949. width: 100%;
  950. height: 100%;
  951. }
  952. }
  953. </style>