index.vue 29 KB

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