index.vue 28 KB

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