You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1126 lines
31 KiB

3 months ago
  1. <template>
  2. <div :data-theme="theme">
  3. <div class="group-con">
  4. <div class="header acea-row row-between-wrapper">
  5. <div class="pictrue"><image :src="storeCombination.image" /></div>
  6. <div class="text">
  7. <div class="line1" v-text="storeCombination.title"></div>
  8. <div class="money font_price">
  9. <span class="num" v-text="storeCombination.price || 0"></span>
  10. <span class="team cart-color">{{storeCombination.people?storeCombination.people:0 }}人拼</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-color-red"></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. 剩余
  21. <CountDown :bgColor="bgColor" :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '"
  22. :minute-text="' : '" :second-text="' '" :datatime="pinkT.stopTime/1000"></CountDown>
  23. <span class="end">结束</span>
  24. </div>
  25. <div class="line"></div>
  26. </div>
  27. <div class="tips font-color-red" v-if="pinkBool === 1">恭喜您拼团成功</div>
  28. <div class="tips" v-else-if="pinkBool === -1">还差{{ count }}拼团失败</div>
  29. <div class="tips font-color-red" v-else-if="pinkBool === 0">拼团中还差{{ count }}人拼团成功</div>
  30. <div class="list acea-row row-middle"
  31. :class="[pinkBool === 1 || pinkBool === -1 ? 'result' : '', iShidden ? 'on' : '']">
  32. <div class="pinkT">
  33. <div class="pictrue"><image :src="pinkT.avatar" /></div>
  34. <div class="chief">团长</div>
  35. </div>
  36. <block v-if="pinkAll.length > 0">
  37. <div class="pictrue" v-for="(item, index) in pinkAll" :key="index"><image :src="item.avatar" /></div>
  38. </block>
  39. <div class="pictrue" v-for="index in count" :key="index">
  40. <image class="img-none" :src="urlDomain+'crmebimage/perset/activityImg/vacancy.png'" />
  41. </div>
  42. </div>
  43. <div v-if="(pinkBool === 1 || pinkBool === -1) && count > 9" class="lookAll acea-row row-center-wrapper"
  44. @click="lookAll">
  45. {{ iShidden ? '收起' : '查看全部' }}
  46. <span class="iconfont" :class="iShidden ? 'icon-xiangshang' : 'icon-xiangxia'"></span>
  47. </div>
  48. <!-- #ifndef MP -->
  49. <div v-if="userBool === 1 && isOk == 0 && pinkBool === 0">
  50. <div class="teamBnt bg-color-red" v-if='pinkT.stopTime>timestamp' @click="goPoster">邀请好友参团</div>
  51. </div>
  52. <!-- #endif -->
  53. <!-- #ifdef MP -->
  54. <button open-type="share" class="teamBnt bg-color-red"
  55. v-if="userBool === 1 && isOk == 0 && pinkBool === 0 && pinkT.stopTime>timestamp">邀请好友参团</button>
  56. <!-- #endif -->
  57. <div class="teamBnt bg-color-hui" v-if="pinkT.stopTime<timestamp && isOk == 0 && pinkBool === 0">拼团已过期</div>
  58. <div class="teamBnt bg-color-red"
  59. v-else-if="userBool === 0 && pinkBool === 0 && count > 0 && pinkT.stopTime>timestamp" @click="pay">我要参团
  60. </div>
  61. <div class="teamBnt bg-color-red" v-if="pinkBool === 1 || pinkBool === -1"
  62. @click="goDetail(storeCombination.id)">再次开团</div>
  63. <div class="cancel" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">
  64. <span class="iconfont icon-guanbi3"></span>
  65. 取消开团
  66. </div>
  67. <div class="lookOrder" v-if="pinkBool === 1" @click="goOrder">
  68. 查看订单信息
  69. <span class="iconfont icon-xiangyou"></span>
  70. </div>
  71. </div>
  72. <div class="group-recommend">
  73. <div class="title acea-row row-between-wrapper">
  74. <div>大家都在拼</div>
  75. <div class="more" @click="goList">
  76. 更多拼团
  77. <span class="iconfont icon-jiantou"></span>
  78. </div>
  79. </div>
  80. <div class="list acea-row row-middle">
  81. <div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
  82. <div class="pictrue">
  83. <image :src="item.image" />
  84. <div class="team" v-text="item.people + '人团'"></div>
  85. </div>
  86. <div class="name line1" v-text="item.title"></div>
  87. <div class="money font_price" v-text="'¥' + item.price"></div>
  88. </div>
  89. </div>
  90. </div>
  91. <product-window :attr="attr" :onceNum="onceNum" :limitNum="1" :iSbnt="1" @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
  92. @ChangeCartNum="ChangeCartNum" @iptCartNum="iptCartNum" @attrVal="attrVal" @goCat="goPay"></product-window>
  93. <!-- 分享按钮 -->
  94. <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
  95. <!-- #ifdef APP-PLUS -->
  96. <view class="item" @click="appShare('WXSceneSession')">
  97. <view class="iconfont icon-weixin3"></view>
  98. <view class="">微信好友</view>
  99. </view>
  100. <view class="item" @click="appShare('WXSenceTimeline')">
  101. <view class="iconfont icon-pengyouquan"></view>
  102. <view class="">微信朋友圈</view>
  103. </view>
  104. <!-- #endif -->
  105. </view>
  106. <view class="mask" v-if="posters || canvasStatus" @click="listenerActionClose"></view>
  107. <!-- 发送给朋友图片 -->
  108. <view class="share-box" v-if="H5ShareBox">
  109. <image :src="urlDomain+'crmebimage/perset/staticImg/share-info.png'" @click="H5ShareBox = false"></image>
  110. </view>
  111. <!-- 海报展示 -->
  112. <view class='poster-pop' v-if="canvasStatus">
  113. <image :src='imagePath'></image>
  114. <!-- #ifndef H5 -->
  115. <view class='save-poster' @click="savePosterPath">保存到手机</view>
  116. <!-- #endif -->
  117. <!-- #ifdef H5 -->
  118. <view class="keep">长按图片保存至相册</view>
  119. <view class='iconfont icon-cha2 close' @tap='listenerActionClose'></view>
  120. <!-- #endif -->
  121. </view>
  122. <view class="canvas">
  123. <canvas style="width:597px;height:850px;" canvas-id="activityCanvas"></canvas>
  124. <canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}"
  125. style="opacity: 0;" />
  126. </view>
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. import CountDown from '@/components/countDown';
  132. import ProductWindow from '@/components/productWindow';
  133. import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
  134. import {
  135. tokenIsExistApi
  136. } from '@/api/api.js';
  137. import {
  138. imageBase64
  139. } from "@/api/public";
  140. import {
  141. toLogin
  142. } from '@/libs/login.js';
  143. import {
  144. mapGetters
  145. } from 'vuex';
  146. import {
  147. getCombinationPink,
  148. postCombinationRemove,
  149. getCombinationMore
  150. } from '@/api/activity';
  151. import {
  152. postCartAdd
  153. } from '@/api/store';
  154. // #ifdef APP-PLUS
  155. import {
  156. HTTP_H5_URL
  157. } from '@/config/app.js';
  158. // #endif
  159. const NAME = 'GroupRule';
  160. import {
  161. silenceBindingSpread
  162. } from "@/utils";
  163. const app = getApp();
  164. export default {
  165. name: NAME,
  166. components: {
  167. CountDown,
  168. ProductWindow
  169. },
  170. props: {},
  171. data: function() {
  172. return {
  173. urlDomain: this.$Cache.get("imgHost"),
  174. bgColor: {
  175. 'bgColor': '#333333',
  176. 'Color': '#fff',
  177. 'width': '44rpx',
  178. 'timeTxtwidth': '16rpx',
  179. 'isDay': true
  180. },
  181. currentPinkOrder: '', //当前拼团订单
  182. isOk: 0, //判断拼团是否完成
  183. pinkBool: 0, //判断拼团是否成功|0=失败,1=成功
  184. userBool: 0, //判断当前用户是否在团内|0=未在,1=在
  185. pinkAll: [], //团员
  186. pinkT: [], //团长信息
  187. storeCombination: null, //拼团产品
  188. storeCombinationHost: [], //拼团推荐
  189. pinkId: 0,
  190. count: 0, //拼团剩余人数
  191. iShidden: false,
  192. isOpen: false, //是否打开属性组件
  193. attr: {
  194. cartAttr: false,
  195. productSelect: {
  196. image: '',
  197. storeName: '',
  198. price: '',
  199. quota: 0,
  200. unique: '',
  201. cart_num: 1,
  202. quotaShow: 0,
  203. stock: 0,
  204. num: 0
  205. },
  206. attrValue: '',
  207. productAttr: []
  208. },
  209. cart_num: '',
  210. limit: 10,
  211. page: 1,
  212. loading: false,
  213. loadend: false,
  214. userInfo: {},
  215. posters: false, // app分享
  216. H5ShareBox: false, //公众号分享图片
  217. isAuto: false, //没有授权的不会自动授权
  218. isShowAuth: false, //是否隐藏授权
  219. onceNum: 0, //一次可以购买几个,
  220. timestamp: 0, // 当前时间戳
  221. qrcodeSize: 600,
  222. posterbackgd: '/static/images/canbj.png',
  223. PromotionCode: '', //二维码
  224. canvasStatus: false,
  225. imgTop: '', //商品图base64位
  226. imagePath: '', // 海报图片
  227. theme:app.globalData.theme,
  228. vacancyPic: require('../static/vacancy.png'),
  229. tokenIsExist: app.globalData.tokenIsExist ,//登录是否失效
  230. openPages: '' //分享链接
  231. };
  232. },
  233. watch: {
  234. isLogin: {
  235. handler: function(newV, oldV) {
  236. if (newV) {
  237. this.getCombinationPink();
  238. if(parseInt(app.globalData.spread)>0)silenceBindingSpread()
  239. }
  240. },
  241. deep: true
  242. },
  243. },
  244. computed: mapGetters({
  245. 'isLogin': 'isLogin',
  246. 'userData': 'userInfo',
  247. 'uid': 'uid'
  248. }),
  249. onLoad(options) {
  250. this.loadend = false;
  251. this.loading = false;
  252. this.combinationMore();
  253. this.$set(this,'theme',this.$Cache.get('theme'));
  254. this.pinkId = options.id;
  255. if(options.spread) app.globalData.spread = options.spread;
  256. switch (this.theme) {
  257. case 'theme1':
  258. this.posterbackgd = require('../images/bargain_post1.png') // 因为跨域不能使用网络图片,
  259. break;
  260. case 'theme2':
  261. this.posterbackgd = require('../images/bargain_post2.png')
  262. break;
  263. case 'theme3':
  264. this.posterbackgd = require('../images/bargain_post3.png')
  265. break;
  266. case 'theme4':
  267. this.posterbackgd = require('../images/bargain_post4.png')
  268. break;
  269. case 'theme5':
  270. this.posterbackgd = require('../images/bargain_post5.png')
  271. break;
  272. }
  273. if (this.isLogin) {
  274. this.timestamp = (new Date()).getTime();
  275. this.getCombinationPink();
  276. if(parseInt(app.globalData.spread)>0)silenceBindingSpread()
  277. }else{
  278. this.$Cache.set('login_back_url',
  279. `/pages/activity/goods_combination_status/index?id=${options.id}&spread=${app.globalData.spread?app.globalData.spread:0}`
  280. );
  281. toLogin();
  282. }
  283. },
  284. //#ifdef MP
  285. /**
  286. * 用户点击右上角分享
  287. */
  288. onShareAppMessage: function() {
  289. let that = this;
  290. return {
  291. title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
  292. path: that.openPages,
  293. imageUrl: that.storeCombination.image
  294. };
  295. },
  296. //#endif
  297. methods: {
  298. //校验token是否有效,true为有效,false为无效
  299. getTokenIsExist() {
  300. //校验token是否有效,true为有效,false为无效
  301. this.$LoginAuth.getTokenIsExist().then(data => {
  302. this.combinationMore();
  303. if (data) {
  304. this.timestamp = (new Date()).getTime();
  305. this.getCombinationPink();
  306. silenceBindingSpread()
  307. }else{
  308. toLogin();
  309. }
  310. });
  311. },
  312. // app分享
  313. // #ifdef APP-PLUS
  314. appShare(scene) {
  315. let that = this
  316. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  317. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  318. uni.share({
  319. provider: "weixin",
  320. scene: scene,
  321. type: 0,
  322. href: `${HTTP_H5_URL}${curRoute}`,
  323. title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
  324. imageUrl: that.storeCombination.image,
  325. success: function(res) {
  326. that.posters = false;
  327. },
  328. fail: function(err) {
  329. uni.showToast({
  330. title: '分享失败',
  331. icon: 'none',
  332. duration: 2000
  333. })
  334. that.posters = false;
  335. }
  336. });
  337. },
  338. // #endif
  339. // 分享关闭
  340. listenerActionClose: function() {
  341. this.posters = false;
  342. this.canvasStatus = false;
  343. },
  344. // 更多拼团
  345. combinationMore: function() {
  346. var that = this;
  347. if (that.loadend) return;
  348. if (that.loading) return;
  349. var data = {
  350. page: that.page,
  351. limit: that.limit,
  352. comId: that.pinkId
  353. };
  354. this.loading = true
  355. getCombinationMore(data)
  356. .then(res => {
  357. var storeCombinationHost = that.storeCombinationHost;
  358. var limit = that.limit;
  359. that.page++;
  360. that.loadend = limit > res.data.length;
  361. that.storeCombinationHost = storeCombinationHost.concat(res.data.list);
  362. that.page = that.data.page;
  363. that.loading = false;
  364. })
  365. .catch(res => {
  366. that.loading = false
  367. that.$util.Tips({
  368. title: res
  369. });
  370. });
  371. },
  372. /**
  373. * 购物车手动填写
  374. *
  375. */
  376. iptCartNum: function(e) {
  377. if (e > this.onceNum) {
  378. this.$util.Tips({
  379. title: `该商品每次限购${this.onceNum}${this.storeCombination.unitName}`
  380. });
  381. this.$set(this.attr.productSelect, 'cart_num', this.onceNum);
  382. this.$set(this, "cart_num", this.onceNum);
  383. } else {
  384. this.$set(this.attr.productSelect, 'cart_num', e);
  385. this.$set(this, "cart_num", e);
  386. }
  387. },
  388. attrVal(val) {
  389. this.attr.productAttr[val.indexw].index = this.attr.productAttr[val.indexw].attrValues[val.indexn];
  390. },
  391. onMyEvent: function() {
  392. this.$set(this.attr, 'cartAttr', false);
  393. this.$set(this, 'isOpen', false);
  394. },
  395. //将父级向子集多次传送的函数合二为一;
  396. // changeFun: function(opt) {
  397. // if (typeof opt !== "object") opt = {};
  398. // let action = opt.action || "";
  399. // let value = opt.value === undefined ? "" : opt.value;
  400. // this[action] && this[action](value);
  401. // },
  402. // changeattr: function(res) {
  403. // var that = this;
  404. // that.attr.cartAttr = res;
  405. // },
  406. //选择属性;
  407. ChangeAttr: function(res) {
  408. this.$set(this, 'cart_num', 1);
  409. let productSelect = this.productValue[res];
  410. if (productSelect) {
  411. this.$set(this.attr.productSelect, 'image', productSelect.image);
  412. this.$set(this.attr.productSelect, 'price', productSelect.price);
  413. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  414. this.$set(this.attr.productSelect, 'unique', productSelect.id);
  415. this.$set(this.attr.productSelect, 'cart_num', 1);
  416. this.$set(this.attr.productSelect, 'stock', productSelect.stock);
  417. this.$set(this.attr.productSelect, 'quotaShow', productSelect.quotaShow);
  418. this.attrValue = res;
  419. this.attrTxt = '已选择';
  420. } else {
  421. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  422. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  423. this.$set(this.attr.productSelect, 'quota', 0);
  424. this.$set(this.attr.productSelect, 'unique', '');
  425. this.$set(this.attr.productSelect, 'cart_num', 0);
  426. this.$set(this.attr.productSelect, 'quotaShow', 0);
  427. this.$set(this.attr.productSelect, 'stock', 0);
  428. this.attrValue = '';
  429. this.attrTxt = '请选择';
  430. }
  431. },
  432. ChangeCartNum: function(res) {
  433. //获取当前变动属性
  434. let productSelect = this.productValue[this.attrValue];
  435. if (this.onceNum === productSelect.cart_num) {
  436. return this.$util.Tips({
  437. title: `该商品每次限购${this.onceNum}${this.storeCombination.unitName}`
  438. });
  439. }
  440. if (this.cart_num) {
  441. productSelect.cart_num = this.cart_num;
  442. this.attr.productSelect.cart_num = this.cart_num;
  443. }
  444. //如果没有属性,赋值给商品默认库存
  445. if (productSelect === undefined && !this.attr.productAttr.length) productSelect = this.attr
  446. .productSelect;
  447. if (productSelect === undefined) return;
  448. let stock = productSelect.stock || 0;
  449. let quotaShow = productSelect.quotaShow || 0;
  450. let quota = productSelect.quota || 0;
  451. let num = this.attr.productSelect;
  452. let nums = this.storeCombination.num || 0;
  453. //设置默认数据
  454. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  455. if (res) {
  456. num.cart_num++;
  457. let arrMin = [];
  458. arrMin.push(nums);
  459. arrMin.push(quota);
  460. arrMin.push(stock);
  461. let minN = Math.min.apply(null, arrMin);
  462. if (num.cart_num >= minN) {
  463. this.$set(this.attr.productSelect, 'cart_num', minN ? minN : 1);
  464. this.$set(this, 'cart_num', minN ? minN : 1);
  465. }
  466. this.$set(this, 'cart_num', num.cart_num);
  467. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  468. } else {
  469. num.cart_num--;
  470. if (num.cart_num < 1) {
  471. this.$set(this.attr.productSelect, 'cart_num', 1);
  472. this.$set(this, 'cart_num', 1);
  473. }
  474. this.$set(this, 'cart_num', num.cart_num);
  475. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  476. }
  477. },
  478. //默认选中属性;
  479. DefaultSelect() {
  480. let productAttr = this.attr.productAttr,
  481. value = [];
  482. for (var key in this.productValue) {
  483. if (this.productValue[key].quota > 0) {
  484. value = this.attr.productAttr.length ? key.split(',') : [];
  485. break;
  486. }
  487. }
  488. for (let i = 0; i < productAttr.length; i++) {
  489. this.$set(productAttr[i], 'index', value[i]);
  490. }
  491. //sort();排序函数:数字-英文-汉字;
  492. let productSelect = this.productValue[value.join(',')];
  493. if (productSelect && productAttr.length) {
  494. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  495. this.$set(this.attr.productSelect, 'image', productSelect.image);
  496. this.$set(this.attr.productSelect, 'price', productSelect.price);
  497. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  498. this.$set(this.attr.productSelect, 'unique', productSelect.id);
  499. this.$set(this.attr.productSelect, 'cart_num', 1);
  500. this.$set(this.attr.productSelect, 'stock', productSelect.stock);
  501. this.$set(this.attr.productSelect, 'quotaShow', productSelect.quotaShow);
  502. //this.$set(this, 'attrValue', value.join(','));
  503. this.attrValue = value.join(',');
  504. this.attrTxt = '已选择';
  505. //this.$set(this, 'attrTxt', '已选择');
  506. } else if (!productSelect && productAttr.length) {
  507. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  508. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  509. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  510. this.$set(this.attr.productSelect, 'quota', 0);
  511. this.$set(this.attr.productSelect, 'unique', '');
  512. this.$set(this.attr.productSelect, 'cart_num', 0);
  513. this.$set(this.attr.productSelect, 'stock', 0);
  514. this.$set(this.attr.productSelect, 'quotaShow', 0);
  515. //this.$set(this, 'attrValue', '');
  516. this.attrValue = '';
  517. this.attrTxt = '请选择';
  518. // this.$set(this, 'attrTxt', '请选择');
  519. } else if (!productSelect && !productAttr.length) {
  520. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  521. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  522. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  523. this.$set(this.attr.productSelect, 'quota', 0);
  524. this.$set(this.attr.productSelect, 'unique', this.storeCombination.id || '');
  525. this.$set(this.attr.productSelect, 'cart_num', 1);
  526. this.$set(this.attr.productSelect, 'quotaShow', 0);
  527. this.$set(this.attr.productSelect, 'stock', 0);
  528. //this.$set(this, 'attrValue', '');
  529. this.attrValue = '';
  530. this.attrTxt = '请选择';
  531. //this.$set(this, 'attrTxt', '请选择');
  532. }
  533. },
  534. setProductSelect: function() {
  535. var that = this;
  536. var attr = that.attr;
  537. attr.productSelect.image = that.storeCombination.image;
  538. attr.productSelect.storeName = that.storeCombination.title;
  539. attr.productSelect.price = that.storeCombination.price;
  540. attr.productSelect.quota = 0;
  541. attr.productSelect.quotaShow = 0;
  542. attr.productSelect.stock = 0;
  543. attr.cartAttr = false;
  544. that.$set(that, 'attr', attr);
  545. },
  546. pay: function() {
  547. var that = this;
  548. that.attr.cartAttr = true;
  549. that.isOpen = true;
  550. },
  551. goPay() {
  552. this.$Order.getPreOrder("buyNow", [{
  553. "attrValueId": parseFloat(this.attr.productSelect.unique),
  554. "combinationId": parseFloat(this.storeCombination.id),
  555. "productNum": parseFloat(this.attr.productSelect.cart_num),
  556. "productId": parseFloat(this.storeCombination.productId),
  557. "pinkId": parseFloat(this.pinkId)
  558. }]);
  559. },
  560. goPoster: function() {
  561. //#ifdef H5
  562. if (this.$wechat.isWeixin()) {
  563. this.H5ShareBox = true;
  564. } else {
  565. uni.showLoading({
  566. title: '海报生成中',
  567. mask: true
  568. });
  569. this.posters = false;
  570. let arrImagesUrl = '';
  571. let arrImagesUrlTop = '';
  572. if (!this.PromotionCode) {
  573. uni.hideLoading();
  574. this.$util.Tips({
  575. title: this.errT
  576. });
  577. return
  578. }
  579. setTimeout(() => {
  580. if (!this.imgTop) {
  581. uni.hideLoading();
  582. this.$util.Tips({
  583. title: '无法生成商品海报!'
  584. });
  585. return
  586. }
  587. }, 1000);
  588. uni.downloadFile({
  589. url: this.imgTop,
  590. success: (res) => {
  591. arrImagesUrlTop = res.tempFilePath;
  592. let arrImages = [this.posterbackgd, arrImagesUrlTop, this.PromotionCode];
  593. setTimeout(() => {
  594. this.$util.activityCanvas(arrImages, this.storeCombination.title,
  595. this.storeCombination.price, this.storeCombination.people +
  596. '人团', '还差' + this.count + '人拼团成功', 9,
  597. (tempFilePath) => {
  598. this.imagePath = tempFilePath;
  599. this.canvasStatus = true;
  600. uni.hideLoading();
  601. });
  602. }, 500);
  603. }
  604. });
  605. }
  606. //#endif
  607. //#ifdef APP-PLUS
  608. this.posters = true;
  609. //#endif
  610. },
  611. goOrder: function() {
  612. var that = this;
  613. uni.navigateTo({
  614. url: '/pages/order/order_details/index?order_id=' + that.currentPinkOrder
  615. });
  616. },
  617. //拼团列表
  618. goList: function() {
  619. uni.navigateTo({
  620. url: '/pages/activity/goods_combination/index'
  621. });
  622. },
  623. //拼团详情
  624. goDetail: function(id) {
  625. this.pinkId = id;
  626. uni.navigateTo({
  627. url: '/pages/activity/goods_combination_details/index?id=' + id
  628. });
  629. },
  630. // 商品图片转base64
  631. getImageBase64: function(images) {
  632. let that = this;
  633. imageBase64({
  634. url: images
  635. }).then(res => {
  636. that.imgTop = res.data.code;
  637. })
  638. },
  639. // 生成二维码;
  640. make() {
  641. let href = location.protocol + '//' + location.host +
  642. '/pages/activity/goods_combination_status/index?id=' + this.pinkId + "&spread=" + this.uid;
  643. uQRCode.make({
  644. canvasId: 'qrcode',
  645. text: href,
  646. size: this.qrcodeSize,
  647. margin: 10,
  648. success: res => {
  649. this.PromotionCode = res;
  650. },
  651. complete: () => {},
  652. fail: res => {
  653. this.$util.Tips({
  654. title: '海报二维码生成失败!'
  655. });
  656. }
  657. })
  658. },
  659. //拼团信息
  660. getCombinationPink: function() {
  661. var that = this;
  662. getCombinationPink(that.pinkId)
  663. .then(res => {
  664. that.openPages = '/pages/activity/goods_combination_status/index?id=' + that.pinkId +
  665. "&spread=" + that.uid;
  666. let storeCombination = res.data.storeCombination;
  667. res.data.pinkT.stop_time = parseInt(res.data.pinkT.stopTime);
  668. that.$set(that, 'storeCombination', storeCombination);
  669. that.$set(that.attr.productSelect, 'num', storeCombination.totalNum);
  670. that.$set(that, 'pinkT', res.data.pinkT);
  671. that.$set(that, 'pinkAll', res.data.pinkAll);
  672. that.$set(that, 'count', res.data.count);
  673. that.$set(that, 'userBool', res.data.userBool);
  674. that.$set(that, 'pinkBool', res.data.pinkBool);
  675. that.$set(that, 'isOk', res.data.isOk);
  676. that.$set(that, 'currentPinkOrder', res.data.currentPinkOrder);
  677. that.$set(that, 'userInfo', res.data.userInfo);
  678. that.onceNum = storeCombination.onceNum;
  679. that.attr.productAttr = storeCombination.productAttr;
  680. that.productValue = storeCombination.productValue;
  681. //#ifdef H5
  682. this.getImageBase64(storeCombination.image);
  683. that.make();
  684. that.setOpenShare();
  685. //#endif
  686. that.setProductSelect();
  687. if (that.attr.productAttr != 0) that.DefaultSelect();
  688. })
  689. .catch(err => {
  690. if (that.isLogin) {
  691. that.$util.Tips({
  692. title: err
  693. }, {
  694. url: '/pages/index/index'
  695. });
  696. }
  697. });
  698. },
  699. //#ifdef H5
  700. setOpenShare() {
  701. let that = this;
  702. let configTimeline = {
  703. title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
  704. desc: that.storeCombination.title,
  705. link: window.location.protocol + '//' + window.location.host +
  706. '/pages/activity/goods_combination_status/index?id=' + that.pinkId + "&spread=" + this.uid,
  707. imgUrl: that.storeCombination.image
  708. };
  709. if (this.$wechat.isWeixin()) {
  710. this.$wechat
  711. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage',
  712. 'onMenuShareTimeline'
  713. ], configTimeline)
  714. .then(res => {
  715. })
  716. .catch(res => {
  717. if (res.is_ready) {
  718. res.wx.updateAppMessageShareData(configTimeline);
  719. res.wx.updateTimelineShareData(configTimeline);
  720. res.wx.onMenuShareAppMessage(configTimeline);
  721. res.wx.onMenuShareTimeline(configTimeline);
  722. }
  723. });
  724. }
  725. },
  726. //#endif
  727. //拼团取消
  728. getCombinationRemove: function() {
  729. var that = this;
  730. postCombinationRemove({
  731. id: that.pinkId,
  732. cid: that.storeCombination.id
  733. })
  734. .then(res => {
  735. that.$util.Tips({
  736. title: res.msg
  737. }, {
  738. tab: 3
  739. });
  740. })
  741. .catch(res => {
  742. that.$util.Tips({
  743. title: res
  744. });
  745. });
  746. },
  747. lookAll: function() {
  748. this.iShidden = !this.iShidden;
  749. }
  750. }
  751. };
  752. </script>
  753. <style lang="scss" scoped>
  754. .generate-posters {
  755. width: 100%;
  756. height: 170rpx;
  757. background-color: #fff;
  758. position: fixed;
  759. left: 0;
  760. bottom: 0;
  761. z-index: 300;
  762. transform: translate3d(0, 100%, 0);
  763. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  764. border-top: 1rpx solid #eee;
  765. }
  766. .generate-posters.on {
  767. transform: translate3d(0, 0, 0);
  768. }
  769. .generate-posters .item {
  770. flex: 1;
  771. text-align: center;
  772. font-size: 30rpx;
  773. }
  774. .generate-posters .item .iconfont {
  775. font-size: 80rpx;
  776. color: #5eae72;
  777. }
  778. .generate-posters .item .iconfont.icon-haibao {
  779. color: #5391f1;
  780. }
  781. .pinkT {
  782. position: relative;
  783. .chief {
  784. position: absolute;
  785. width: 72rpx;
  786. height: 30rpx;
  787. @include main_bg_color(theme);
  788. border-radius: 15rpx;
  789. font-size: 20rpx;
  790. line-height: 30rpx;
  791. text-align: center;
  792. right: -24rpx;
  793. top: -16rpx;
  794. color: #fff;
  795. }
  796. }
  797. .bg-color-red{
  798. @include main_bg_color(theme);
  799. }
  800. .canvas {
  801. position: fixed;
  802. opacity: 0;
  803. }
  804. .poster-pop {
  805. width: 594rpx;
  806. height: 850rpx;
  807. position: fixed;
  808. left: 50%;
  809. transform: translateX(-50%);
  810. z-index: 999;
  811. top: 50%;
  812. margin-top: -466rpx;
  813. image {
  814. width: 100%;
  815. height: 100%;
  816. display: block;
  817. border-radius: 10rpx;
  818. }
  819. .close {
  820. text-align: center;
  821. margin-top: 55rpx;
  822. color: #fff;
  823. font-size: 52rpx;
  824. }
  825. .save-poster {
  826. background-color: #df2d0a;
  827. font-size: 22rpx;
  828. color: #fff;
  829. text-align: center;
  830. height: 76rpx;
  831. line-height: 76rpx;
  832. width: 100%;
  833. }
  834. .keep {
  835. color: #fff;
  836. text-align: center;
  837. font-size: 25rpx;
  838. margin-top: 25rpx;
  839. }
  840. }
  841. /*开团*/
  842. .group-con .header {
  843. height: 186rpx;
  844. background-color: #fff;
  845. border-top: 1px solid #f5f5f5;
  846. margin: 20rpx 30rpx 0;
  847. border-radius: 14rpx;
  848. position: relative;
  849. }
  850. .group-con .header .iconfont {
  851. font-size: 100rpx;
  852. position: absolute;
  853. color: #ccc;
  854. right: 33rpx;
  855. bottom: 20rpx;
  856. }
  857. .group-con .header .pictrue {
  858. width: 140rpx;
  859. height: 140rpx;
  860. }
  861. .group-con .header .pictrue image {
  862. width: 100%;
  863. height: 100%;
  864. border-radius: 6rpx;
  865. }
  866. .group-con .header .text {
  867. width: 540rpx;
  868. font-size: 30rpx;
  869. color: #222;
  870. }
  871. .group-con .header .text .money {
  872. font-size: 24rpx;
  873. font-weight: bold;
  874. margin-top: 15rpx;
  875. }
  876. .group-con .header .text .money .num {
  877. font-size: 32rpx;
  878. }
  879. .group-con .header .text .money .team {
  880. padding: 1rpx 10rpx;
  881. font-weight: normal;
  882. border-radius: 50rpx;
  883. font-size: 20rpx;
  884. vertical-align: 4rpx;
  885. margin-left: 15rpx;
  886. @include main_color(theme);
  887. @include coupons_border_color(theme);
  888. }
  889. .group-con .wrapper {
  890. background-color: #fff;
  891. margin: 20rpx 30rpx 0;
  892. border-radius: 14rpx;
  893. padding-bottom: 20rpx;
  894. }
  895. .group-con .wrapper .title {
  896. margin-top: 30rpx;
  897. padding-top: 30rpx;
  898. }
  899. .group-con .wrapper .title .line {
  900. width: 136rpx;
  901. height: 1px;
  902. background-color: #ddd;
  903. }
  904. .group-con .wrapper .title .name {
  905. margin: 0 45rpx;
  906. font-size: 28rpx;
  907. color: #282828;
  908. }
  909. .group-con .wrapper .title .name .time {
  910. margin: 0 14rpx;
  911. }
  912. .group-con .wrapper .title .name .timeTxt {
  913. color: #fc4141;
  914. }
  915. .group-con .wrapper .title .name .time .styleAll {
  916. background-color: #ffcfcb;
  917. text-align: center;
  918. border-radius: 3rpx;
  919. font-size: 28rpx;
  920. font-weight: bold;
  921. display: inline-block;
  922. vertical-align: middle;
  923. color: #fc4141;
  924. padding: 2rpx 5rpx;
  925. }
  926. .group-con .wrapper .tips {
  927. font-size: 30rpx;
  928. font-weight: bold;
  929. text-align: center;
  930. margin-top: 30rpx;
  931. color: #999;
  932. }
  933. .group-con .wrapper .list {
  934. padding: 0 30rpx;
  935. margin-top: 45rpx;
  936. }
  937. .group-con .wrapper .list.result {
  938. max-height: 240rpx;
  939. }
  940. .group-con .wrapper .list.result.on {
  941. max-height: 2000rpx;
  942. }
  943. .group-con .wrapper .list .pictrue {
  944. width: 94rpx;
  945. height: 94rpx;
  946. margin: 0 0 29rpx 35rpx;
  947. }
  948. .group-con .wrapper .list .pictrue image {
  949. width: 100%;
  950. height: 100%;
  951. border-radius: 50%;
  952. @include coupons_border_color(theme);
  953. }
  954. .group-con .wrapper .list .pictrue image.img-none {
  955. border: none;
  956. }
  957. .group-con .wrapper .lookAll {
  958. font-size: 24rpx;
  959. color: #282828;
  960. padding-top: 10rpx;
  961. }
  962. .group-con .wrapper .lookAll .iconfont {
  963. font-size: 25rpx;
  964. margin: 2rpx 0 0 10rpx;
  965. }
  966. .group-con .wrapper .teamBnt {
  967. font-size: 30rpx;
  968. width: 620rpx;
  969. height: 86rpx;
  970. border-radius: 50rpx;
  971. text-align: center;
  972. line-height: 86rpx;
  973. color: #fff;
  974. margin: 21rpx auto 0 auto;
  975. }
  976. .group-con .wrapper .cancel,
  977. .group-con .wrapper .lookOrder {
  978. text-align: center;
  979. font-size: 24rpx;
  980. color: #282828;
  981. padding-top: 30rpx;
  982. padding-bottom:30rpx;
  983. }
  984. .group-con .wrapper .cancel .iconfont {
  985. font-size: 35rpx;
  986. color: #2c2c2c;
  987. vertical-align: -4rpx;
  988. margin-right: 9rpx;
  989. }
  990. .group-con .wrapper .lookOrder .iconfont {
  991. font-size: 25rpx;
  992. color: #2c2c2c;
  993. margin-left: 10rpx;
  994. }
  995. .group-con .group-recommend {
  996. background-color: #fff;
  997. margin: 20rpx 30rpx 0;
  998. border-radius: 14rpx;
  999. }
  1000. .group-con .group-recommend .title {
  1001. padding-right: 30rpx;
  1002. margin-left: 30rpx;
  1003. height: 85rpx;
  1004. border-bottom: 1px solid #eee;
  1005. font-size: 28rpx;
  1006. color: #282828;
  1007. }
  1008. .group-con .group-recommend .title .more {
  1009. color: #808080;
  1010. }
  1011. .group-con .group-recommend .title .more .iconfont {
  1012. margin-left: 13rpx;
  1013. font-size: 28rpx;
  1014. }
  1015. .group-con .group-recommend .list {
  1016. margin-top: 30rpx;
  1017. }
  1018. .group-con .group-recommend .list .item {
  1019. width: 190rpx;
  1020. margin: 0 0 25rpx 30rpx;
  1021. }
  1022. .group-con .group-recommend .list .item .pictrue {
  1023. width: 100%;
  1024. height: 190rpx;
  1025. position: relative;
  1026. }
  1027. .group-con .group-recommend .list .item .pictrue image {
  1028. width: 100%;
  1029. height: 100%;
  1030. border-radius: 10rpx;
  1031. }
  1032. .group-con .group-recommend .list .item .pictrue .team {
  1033. position: absolute;
  1034. top: 28rpx;
  1035. left: -5rpx;
  1036. min-width: 100rpx;
  1037. height: 36rpx;
  1038. line-height: 36rpx;
  1039. text-align: center;
  1040. border-radius: 0 18rpx 18rpx 0;
  1041. font-size: 20rpx;
  1042. color: #fff;
  1043. @include main_bg_color(theme);
  1044. }
  1045. .group-con .group-recommend .list .item .name {
  1046. font-size: 28rpx;
  1047. color: #333;
  1048. margin-top: 0.18rem;
  1049. }
  1050. .group-con .group-recommend .list .item .money {
  1051. font-weight: bold;
  1052. font-size: 28rpx;
  1053. }
  1054. .share-box {
  1055. z-index: 1000;
  1056. position: fixed;
  1057. left: 0;
  1058. top: 0;
  1059. width: 100%;
  1060. height: 100%;
  1061. image {
  1062. width: 100%;
  1063. height: 100%;
  1064. }
  1065. }
  1066. .font_price{
  1067. @include price_color(theme);
  1068. }
  1069. </style>