index.vue 28 KB

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