index.vue 30 KB

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