index.vue 28 KB

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