index.vue 29 KB

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