index.vue 28 KB

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