index.vue 28 KB

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