index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  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. this.getCombinationPink();
  278. },
  279. methods: {
  280. // app分享
  281. // #ifdef APP-PLUS
  282. appShare(scene) {
  283. let that = this
  284. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  285. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  286. uni.share({
  287. provider: "weixin",
  288. scene: scene,
  289. type: 0,
  290. href: `${HTTP_REQUEST_URL}${curRoute}`,
  291. title: that.$t(`您的好友`) + that.userInfo.nickname + that.$t(`邀请您参团`) + that.storeCombination
  292. .title,
  293. imageUrl: that.storeCombination.small_image,
  294. success: function(res) {
  295. uni.showToast({
  296. title: that.$t(`分享成功`),
  297. icon: 'success'
  298. })
  299. that.posters = false;
  300. },
  301. fail: function(err) {
  302. uni.showToast({
  303. title: that.$t(`分享失败`),
  304. icon: 'none',
  305. duration: 2000
  306. })
  307. that.posters = false;
  308. }
  309. });
  310. },
  311. // #endif
  312. // 授权关闭
  313. authColse: function(e) {
  314. this.isShowAuth = e;
  315. },
  316. // 授权后回调
  317. onLoadFun: function(e) {
  318. this.userInfo = e;
  319. app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
  320. this.getCombinationPink();
  321. },
  322. /**
  323. * 分享打开
  324. *
  325. */
  326. listenerActionSheet: function() {
  327. if (this.isLogin == false) {
  328. toLogin();
  329. } else {
  330. // #ifdef H5
  331. if (this.$wechat.isWeixin() === true) {
  332. this.weixinStatus = true;
  333. }
  334. // #endif
  335. this.posters = true;
  336. }
  337. },
  338. // 分享关闭
  339. listenerActionClose: function() {
  340. this.posters = false;
  341. },
  342. // 小程序关闭分享弹窗;
  343. goFriend: function() {
  344. this.posters = false;
  345. },
  346. /**
  347. * 购物车手动填写
  348. *
  349. */
  350. iptCartNum: function(e) {
  351. this.$set(this.attr.productSelect, 'cart_num', e);
  352. this.$set(this, 'cart_num', e);
  353. },
  354. attrVal(val) {
  355. this.attr.productAttr[val.indexw].index = this.attr.productAttr[val.indexw].attr_values[val.indexn];
  356. },
  357. onMyEvent: function() {
  358. this.$set(this.attr, 'cartAttr', false);
  359. this.$set(this, 'isOpen', false);
  360. },
  361. //将父级向子集多次传送的函数合二为一;
  362. // changeFun: function(opt) {
  363. // if (typeof opt !== "object") opt = {};
  364. // let action = opt.action || "";
  365. // let value = opt.value === undefined ? "" : opt.value;
  366. // this[action] && this[action](value);
  367. // },
  368. // changeattr: function(res) {
  369. // var that = this;
  370. // that.attr.cartAttr = res;
  371. // },
  372. //选择属性;
  373. ChangeAttr: function(res) {
  374. this.$set(this, 'cart_num', 1);
  375. let productSelect = this.productValue[res];
  376. if (productSelect) {
  377. this.$set(this.attr.productSelect, 'image', productSelect.image);
  378. this.$set(this.attr.productSelect, 'price', productSelect.price);
  379. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  380. this.$set(this.attr.productSelect, 'unique', productSelect.unique);
  381. this.$set(this.attr.productSelect, 'cart_num', 1);
  382. this.$set(this.attr.productSelect, 'product_stock', productSelect.product_stock);
  383. this.$set(this.attr.productSelect, 'quota_show', productSelect.quota_show);
  384. this.$set(this, 'attrValue', res);
  385. this.$set(this, 'attrTxt', this.$t(`已选择`));
  386. } else {
  387. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  388. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  389. this.$set(this.attr.productSelect, 'quota', 0);
  390. this.$set(this.attr.productSelect, 'unique', '');
  391. this.$set(this.attr.productSelect, 'cart_num', 0);
  392. this.$set(this.attr.productSelect, 'quota_show', 0);
  393. this.$set(this.attr.productSelect, 'product_stock', 0);
  394. this.$set(this, 'attrValue', '');
  395. this.$set(this, 'attrTxt', this.$t(`请选择`));
  396. }
  397. },
  398. ChangeCartNum: function(res) {
  399. //changeValue:是否 加|减
  400. //获取当前变动属性
  401. let productSelect = this.productValue[this.attrValue];
  402. if (this.cart_num) {
  403. productSelect.cart_num = this.cart_num;
  404. this.attr.productSelect.cart_num = this.cart_num;
  405. }
  406. //如果没有属性,赋值给商品默认库存
  407. if (productSelect === undefined && !this.attr.productAttr.length) productSelect = this.attr
  408. .productSelect;
  409. if (productSelect === undefined) return;
  410. let stock = productSelect.stock || 0;
  411. let quotaShow = productSelect.quota_show || 0;
  412. let quota = productSelect.quota || 0;
  413. let productStock = productSelect.product_stock || 0;
  414. let num = this.attr.productSelect;
  415. let nums = this.storeCombination.num || 0;
  416. //设置默认数据
  417. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  418. if (res) {
  419. num.cart_num++;
  420. let arrMin = [];
  421. arrMin.push(nums);
  422. arrMin.push(quota);
  423. arrMin.push(productStock);
  424. let minN = Math.min.apply(null, arrMin);
  425. if (num.cart_num >= minN) {
  426. this.$set(this.attr.productSelect, 'cart_num', minN ? minN : 1);
  427. this.$set(this, 'cart_num', minN ? minN : 1);
  428. }
  429. // if(quotaShow >= productStock){
  430. // if (num.cart_num > productStock) {
  431. // this.$set(this.attr.productSelect, "cart_num", productStock);
  432. // this.$set(this, "cart_num", productStock);
  433. // }
  434. // }else{
  435. // if (num.cart_num > quotaShow) {
  436. // this.$set(this.attr.productSelect, "cart_num", quotaShow);
  437. // this.$set(this, "cart_num", quotaShow);
  438. // }
  439. // }
  440. this.$set(this, 'cart_num', num.cart_num);
  441. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  442. } else {
  443. num.cart_num--;
  444. if (num.cart_num < 1) {
  445. this.$set(this.attr.productSelect, 'cart_num', 1);
  446. this.$set(this, 'cart_num', 1);
  447. }
  448. this.$set(this, 'cart_num', num.cart_num);
  449. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  450. }
  451. // if (res) {
  452. // num.cart_num++;
  453. // if (num.cart_num > quota) {
  454. // this.$set(this.attr.productSelect, "cart_num", quota);
  455. // this.$set(this, "cart_num", quota);
  456. // }
  457. // } else {
  458. // num.cart_num--;
  459. // if (num.cart_num < 1) {
  460. // this.$set(this.attr.productSelect, "cart_num", 1);
  461. // this.$set(this, "cart_num", 1);
  462. // }
  463. // }
  464. },
  465. //默认选中属性;
  466. DefaultSelect() {
  467. let productAttr = this.attr.productAttr,
  468. value = [];
  469. for (var key in this.productValue) {
  470. if (this.productValue[key].quota > 0) {
  471. value = this.attr.productAttr.length ? key.split(',') : [];
  472. break;
  473. }
  474. }
  475. for (let i = 0; i < productAttr.length; i++) {
  476. this.$set(productAttr[i], 'index', value[i]);
  477. }
  478. //sort();排序函数:数字-英文-汉字;
  479. let productSelect = this.productValue[value.join(',')];
  480. if (productSelect && productAttr.length) {
  481. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  482. this.$set(this.attr.productSelect, 'image', productSelect.image);
  483. this.$set(this.attr.productSelect, 'price', productSelect.price);
  484. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  485. this.$set(this.attr.productSelect, 'unique', productSelect.unique);
  486. this.$set(this.attr.productSelect, 'cart_num', 1);
  487. this.$set(this.attr.productSelect, 'product_stock', productSelect.product_stock);
  488. this.$set(this.attr.productSelect, 'quota_show', productSelect.quota_show);
  489. this.$set(this, 'attrValue', value.join(','));
  490. this.attrValue = value.join(',');
  491. this.$set(this, 'attrTxt', this.$t(`已选择`));
  492. } else if (!productSelect && productAttr.length) {
  493. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  494. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  495. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  496. this.$set(this.attr.productSelect, 'quota', 0);
  497. this.$set(this.attr.productSelect, 'unique', '');
  498. this.$set(this.attr.productSelect, 'cart_num', 0);
  499. this.$set(this.attr.productSelect, 'product_stock', 0);
  500. this.$set(this.attr.productSelect, 'quota_show', 0);
  501. this.$set(this, 'attrValue', '');
  502. this.$set(this, 'attrTxt', this.$t(`请选择`));
  503. } else if (!productSelect && !productAttr.length) {
  504. this.$set(this.attr.productSelect, 'store_name', this.storeCombination.title);
  505. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  506. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  507. this.$set(this.attr.productSelect, 'quota', 0);
  508. this.$set(this.attr.productSelect, 'unique', this.storeCombination.unique || '');
  509. this.$set(this.attr.productSelect, 'cart_num', 1);
  510. this.$set(this.attr.productSelect, 'quota_show', 0);
  511. this.$set(this.attr.productSelect, 'product_stock', 0);
  512. this.$set(this, 'attrValue', '');
  513. this.$set(this, 'attrTxt', this.$t(`请选择`));
  514. }
  515. },
  516. setProductSelect: function() {
  517. var that = this;
  518. var attr = that.attr;
  519. attr.productSelect.image = that.storeCombination.image;
  520. attr.productSelect.store_name = that.storeCombination.title;
  521. attr.productSelect.price = that.storeCombination.price;
  522. attr.productSelect.quota = 0;
  523. attr.productSelect.quota_show = 0;
  524. attr.productSelect.product_stock = 0;
  525. attr.cartAttr = false;
  526. that.$set(that, 'attr', attr);
  527. },
  528. pay: function() {
  529. var that = this;
  530. that.attr.cartAttr = true;
  531. that.isOpen = true;
  532. },
  533. goPay() {
  534. var that = this;
  535. var data = {};
  536. // that.attr.cartAttr = res;
  537. data.productId = that.storeCombination.product_id;
  538. data.cartNum = that.attr.productSelect.cart_num;
  539. data.uniqueId = that.attr.productSelect.unique;
  540. data.combinationId = that.storeCombination.id;
  541. data.new = 1;
  542. postCartAdd(data)
  543. .then(res => {
  544. uni.navigateTo({
  545. url: '/pages/goods/order_confirm/index?new=1&cartId=' + res.data.cartId +
  546. '&pinkId=' + that.pinkId
  547. });
  548. })
  549. .catch(res => {
  550. that.$util.Tips({
  551. title: res
  552. });
  553. });
  554. },
  555. goPoster: function() {
  556. var that = this;
  557. that.posters = false;
  558. uni.navigateTo({
  559. url: '/pages/activity/poster-poster/index?type=2&id=' + that.pinkId
  560. });
  561. },
  562. goOrder: function() {
  563. var that = this;
  564. uni.navigateTo({
  565. url: '/pages/goods/order_details/index?order_id=' + that.currentPinkOrder
  566. });
  567. },
  568. //拼团列表
  569. goList: function() {
  570. uni.navigateTo({
  571. url: '/pages/activity/goods_combination/index'
  572. });
  573. },
  574. //拼团详情
  575. goDetail: function(id) {
  576. this.pinkId = id;
  577. // this.getCombinationPink();
  578. uni.navigateTo({
  579. url: '/pages/activity/goods_combination_details/index?id=' + id
  580. });
  581. // this.$router.push({
  582. // path: "/activity/group_detail/" + id
  583. // });
  584. },
  585. //拼团信息
  586. getCombinationPink: function() {
  587. var that = this;
  588. getCombinationPink(that.pinkId)
  589. .then(res => {
  590. that.$set(that, 'storeCombinationHost', res.data.store_combination_host);
  591. res.data.pinkT.stop_time = parseInt(res.data.pinkT.stop_time);
  592. that.$set(that, 'storeCombination', res.data.store_combination);
  593. that.$set(that.attr.productSelect, 'num', res.data.store_combination.num);
  594. that.$set(that, 'pinkT', res.data.pinkT);
  595. that.$set(that, 'pinkAll', res.data.pinkAll);
  596. that.$set(that, 'count', res.data.count);
  597. that.$set(that, 'userBool', res.data.userBool);
  598. that.$set(that, 'pinkBool', res.data.pinkBool);
  599. that.$set(that, 'isOk', res.data.is_ok);
  600. that.$set(that, 'currentPinkOrder', res.data.current_pink_order);
  601. that.$set(that, 'userInfo', res.data.userInfo);
  602. that.$set(that, 'orderPid', res.data.order_pid);
  603. that.attr.productAttr = res.data.store_combination.productAttr;
  604. that.productValue = res.data.store_combination.productValue;
  605. //#ifdef H5
  606. that.setOpenShare();
  607. //#endif
  608. that.setProductSelect();
  609. if (that.attr.productAttr != 0) that.DefaultSelect();
  610. if (res.data.is_ok == 1 && res.data.userBool == 0) {
  611. return this.$util.Tips({
  612. title: that.$t(`你不是该团的成员`),
  613. }, () => {
  614. uni.navigateTo({
  615. url: '/pages/activity/goods_combination/index'
  616. })
  617. });
  618. }
  619. })
  620. .catch(err => {
  621. return this.$util.Tips({
  622. title: err,
  623. }, () => {
  624. uni.navigateBack()
  625. // uni.switchTab({
  626. // url: '/pages/index/index'
  627. // })
  628. });
  629. });
  630. },
  631. //#ifdef H5
  632. setOpenShare() {
  633. let that = this;
  634. let configTimeline = {
  635. title: that.$t(`您的好友`) + that.userInfo.nickname + that.$t(`邀请您参团`) + that.storeCombination.title,
  636. desc: that.storeCombination.title,
  637. link: window.location.protocol + '//' + window.location.host +
  638. '/pages/activity/goods_combination_status/index?id=' + that.pinkId + '&bargain=' + that
  639. .userInfo.uid +
  640. '&spid=' +
  641. that.userInfo.uid,
  642. imgUrl: that.storeCombination.image
  643. };
  644. if (this.$wechat.isWeixin()) {
  645. this.$wechat
  646. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage',
  647. 'onMenuShareTimeline'
  648. ], configTimeline)
  649. .then(res => {})
  650. .catch(res => {
  651. if (res.is_ready) {
  652. res.wx.updateAppMessageShareData(configTimeline);
  653. res.wx.updateTimelineShareData(configTimeline);
  654. res.wx.onMenuShareAppMessage(configTimeline);
  655. res.wx.onMenuShareTimeline(configTimeline);
  656. }
  657. });
  658. }
  659. },
  660. //#endif
  661. //拼团取消
  662. getCombinationRemove: function() {
  663. var that = this;
  664. postCombinationRemove({
  665. id: that.pinkId,
  666. cid: that.storeCombination.id
  667. })
  668. .then(res => {
  669. that.$util.Tips({
  670. title: res.msg
  671. });
  672. this.getCombinationPink()
  673. })
  674. .catch(res => {
  675. that.$util.Tips({
  676. title: res
  677. });
  678. });
  679. },
  680. lookAll: function() {
  681. this.iShidden = !this.iShidden;
  682. }
  683. }
  684. };
  685. </script>
  686. <style lang="scss" scoped>
  687. .generate-posters {
  688. width: 100%;
  689. height: 170rpx;
  690. background-color: #fff;
  691. position: fixed;
  692. left: 0;
  693. bottom: 0;
  694. z-index: 300;
  695. transform: translate3d(0, 100%, 0);
  696. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  697. border-top: 1rpx solid #eee;
  698. }
  699. .generate-posters.on {
  700. transform: translate3d(0, 0, 0);
  701. }
  702. .generate-posters .item {
  703. flex: 1;
  704. text-align: center;
  705. font-size: 30rpx;
  706. }
  707. .generate-posters .item .iconfont {
  708. font-size: 80rpx;
  709. color: #5eae72;
  710. }
  711. .generate-posters .item .iconfont.icon-haibao {
  712. color: #5391f1;
  713. }
  714. /*开团*/
  715. .group-con .header {
  716. width: 100%;
  717. height: 186rpx;
  718. background-color: #fff;
  719. border-top: 1px solid #f5f5f5;
  720. padding: 0 30rpx;
  721. position: relative;
  722. }
  723. .group-con .header .iconfont {
  724. font-size: 100rpx;
  725. position: absolute;
  726. color: #ccc;
  727. right: 33rpx;
  728. bottom: 20rpx;
  729. }
  730. .group-con .header .pictrue {
  731. width: 140rpx;
  732. height: 140rpx;
  733. }
  734. .group-con .header .pictrue img {
  735. width: 100%;
  736. height: 100%;
  737. border-radius: 6rpx;
  738. }
  739. .group-con .header .text {
  740. width: 540rpx;
  741. font-size: 30rpx;
  742. color: #222;
  743. }
  744. .group-con .header .text .money {
  745. font-size: 24rpx;
  746. font-weight: bold;
  747. margin-top: 15rpx;
  748. }
  749. .group-con .header .text .money .num {
  750. font-size: 32rpx;
  751. }
  752. .group-con .header .text .money .team {
  753. padding: 1rpx 10rpx;
  754. font-weight: normal;
  755. border-radius: 50rpx;
  756. font-size: 20rpx;
  757. vertical-align: 4rpx;
  758. margin-left: 15rpx;
  759. }
  760. .group-con .wrapper {
  761. background-color: #fff;
  762. margin-top: 20rpx;
  763. padding: 2rpx 0 35rpx 0;
  764. }
  765. .group-con .wrapper .title {
  766. margin-top: 30rpx;
  767. }
  768. .group-con .wrapper .title .line {
  769. width: 136rpx;
  770. height: 1px;
  771. background-color: #ddd;
  772. }
  773. .group-con .wrapper .title .name {
  774. margin: 0 45rpx;
  775. font-size: 28rpx;
  776. color: #282828;
  777. }
  778. .group-con .wrapper .title .name .time {
  779. margin: 0 14rpx;
  780. }
  781. .group-con .wrapper .title .name .timeTxt {
  782. color: #fc4141;
  783. }
  784. .group-con .wrapper .title .name /deep/.time .styleAll {
  785. background-color: var(--view-minorColorT);
  786. text-align: center;
  787. border-radius: 3rpx;
  788. font-size: 28rpx;
  789. font-weight: bold;
  790. display: inline-block;
  791. vertical-align: middle;
  792. color: var(--view-theme);
  793. padding: 2rpx 5rpx;
  794. }
  795. .group-con .wrapper .tips {
  796. font-size: 30rpx;
  797. font-weight: bold;
  798. text-align: center;
  799. margin-top: 30rpx;
  800. color: #999;
  801. }
  802. .group-con .wrapper .list {
  803. padding: 0 30rpx;
  804. margin-top: 45rpx;
  805. }
  806. .group-con .wrapper .list.result {
  807. max-height: 240rpx;
  808. }
  809. .group-con .wrapper .list.result.on {
  810. max-height: 2000rpx;
  811. }
  812. .group-con .wrapper .list .pictrue {
  813. width: 94rpx;
  814. height: 94rpx;
  815. margin: 0 0 29rpx 35rpx;
  816. }
  817. .group-con .wrapper .list .pictrue {
  818. position: relative;
  819. }
  820. .group-con .wrapper .list .pictrue .dumpling {
  821. width: 72rpx;
  822. height: 32rpx;
  823. line-height: 32rpx;
  824. font-size: 18rpx;
  825. text-align: center;
  826. color: #fff;
  827. top: -12rpx;
  828. right: -20rpx;
  829. border-radius: 18rpx;
  830. position: absolute;
  831. background-color: var(--view-theme);
  832. }
  833. .group-con .wrapper .list .pictrue img,
  834. .group-con .wrapper .list .pictrue image {
  835. width: 100%;
  836. height: 100%;
  837. border-radius: 50%;
  838. border: 2rpx solid var(--view-theme);
  839. }
  840. .group-con .wrapper .list .pictrue image.img-none {
  841. border: none;
  842. }
  843. .group-con .wrapper .lookAll {
  844. font-size: 24rpx;
  845. color: #282828;
  846. padding-top: 10rpx;
  847. }
  848. .group-con .wrapper .lookAll .iconfont {
  849. font-size: 25rpx;
  850. margin: 2rpx 0 0 10rpx;
  851. }
  852. .group-con .wrapper .teamBnt {
  853. font-size: 30rpx;
  854. width: 620rpx;
  855. height: 86rpx;
  856. border-radius: 50rpx;
  857. text-align: center;
  858. line-height: 86rpx;
  859. color: #fff;
  860. margin: 21rpx auto 0 auto;
  861. }
  862. .group-con .wrapper .cancel,
  863. .group-con .wrapper .lookOrder {
  864. text-align: center;
  865. font-size: 24rpx;
  866. color: #282828;
  867. padding-top: 30rpx;
  868. }
  869. .group-con .wrapper .cancel .iconfont {
  870. font-size: 35rpx;
  871. color: #2c2c2c;
  872. vertical-align: -4rpx;
  873. margin-right: 9rpx;
  874. }
  875. .group-con .wrapper .lookOrder .iconfont {
  876. font-size: 25rpx;
  877. color: #2c2c2c;
  878. margin-left: 10rpx;
  879. }
  880. .group-con .group-recommend {
  881. background-color: #fff;
  882. margin-top: 25rpx;
  883. }
  884. .group-con .group-recommend .title {
  885. padding-right: 30rpx;
  886. margin-left: 30rpx;
  887. height: 85rpx;
  888. border-bottom: 1px solid #eee;
  889. font-size: 28rpx;
  890. color: #282828;
  891. }
  892. .group-con .group-recommend .title .more {
  893. color: #808080;
  894. }
  895. .group-con .group-recommend .title .more .iconfont {
  896. margin-left: 13rpx;
  897. font-size: 28rpx;
  898. }
  899. .group-con .group-recommend .list {
  900. margin-top: 30rpx;
  901. }
  902. .group-con .group-recommend .list .item {
  903. width: 210rpx;
  904. margin: 0 0 25rpx 30rpx;
  905. }
  906. .group-con .group-recommend .list .item .pictrue {
  907. width: 100%;
  908. height: 210rpx;
  909. position: relative;
  910. }
  911. .group-con .group-recommend .list .item .pictrue img {
  912. width: 100%;
  913. height: 100%;
  914. border-radius: 10rpx;
  915. }
  916. .group-con .group-recommend .list .item .pictrue .team {
  917. position: absolute;
  918. top: 28rpx;
  919. left: -5rpx;
  920. min-width: 100rpx;
  921. height: 36rpx;
  922. line-height: 36rpx;
  923. text-align: center;
  924. border-radius: 0 18rpx 18rpx 0;
  925. font-size: 20rpx;
  926. color: #fff;
  927. background-color: var(--view-theme);
  928. // background-image: linear-gradient(to right, #fb5445 0%, #e93323 100%);
  929. }
  930. .group-con .group-recommend .list .item .name {
  931. font-size: 28rpx;
  932. color: #333;
  933. margin-top: 0.18rem;
  934. }
  935. .group-con .group-recommend .list .item .money {
  936. font-weight: bold;
  937. font-size: 28rpx;
  938. }
  939. .share-box {
  940. z-index: 1000;
  941. position: fixed;
  942. left: 0;
  943. top: 0;
  944. width: 100%;
  945. height: 100%;
  946. image {
  947. width: 100%;
  948. height: 100%;
  949. }
  950. }
  951. </style>