index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  1. <template>
  2. <view :style="viewColor" class="page-container">
  3. <view class='bargain'>
  4. <!-- #ifdef H5 -->
  5. <view class='iconfont icon-xiangzuo' v-if='!$wechat.isWeixin()' @tap='goBack' :style="'top:'+navH+'px'"></view>
  6. <!-- #endif -->
  7. <view class="header"
  8. :style="{ 'background-image': bargainInfo.relation == 10 ? `url(${domain}/static/diy/assist_detail2${keyColor}.png)` : `url(${domain}/static/diy/assist_detail1${keyColor}.png)`}">
  9. <view class='people'>
  10. {{bargainInfo.view_num || 0}}人查看 丨 {{bargainInfo.share_num || 0}}人分享 丨 {{bargainInfo.user_count_all || 0}}人参与
  11. </view>
  12. <countDown v-if="bargainInfo.relation == 10" :tipText="'倒计时'" :dayText="'天'" :hourText="'时'" :minuteText="'分'"
  13. :secondText="'秒'" :datatime="datatime" :isView="true" :isDay="true" :bgImage="`${domain}/static/images/assist-time.png`"></countDown>
  14. <view v-if="bargainInfo.relation == 1" class='pictxt acea-row row-center-wrapper'>
  15. <view class='pictrue'>
  16. <image :src='userInfo.avatar ? userInfo.avatar : "/static/images/f.png"'></image>
  17. </view>
  18. <view class='text'>
  19. {{userInfo.nickname || ''}}
  20. <text>邀请您助力加油</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class='wrapper'>
  25. <view class='pictxt acea-row row-between-wrapper' @tap="goProduct">
  26. <view class='pictrue'>
  27. <image :src='bargainInfo.product && bargainInfo.product.image ? bargainInfo.product.image : ""'></image>
  28. <view class="bargain_view">
  29. 查看商品
  30. <text class="iconfont icon-jiantou iconfonts"></text>
  31. </view>
  32. </view>
  33. <view class='text acea-row row-column-around'>
  34. <view class='line2'>{{bargainData.store_name}}</view>
  35. <view>
  36. <text class='money t-color'>
  37. 助力价: ¥
  38. <text class='num'>{{bargainPrice}}</text>
  39. </text>
  40. <text class="old-price">¥{{old_price}}</text>
  41. </view>
  42. <view class='successNum'>{{bargainInfo.user_count_product}}人正在参与</view>
  43. </view>
  44. </view>
  45. <!-- 进度条 -->
  46. <block>
  47. <view class="cu-progress acea-row row-middle round margin-top">
  48. <view class='acea-row row-middle bg-red' :style="'width:'+ (bargainInfo.yet_assist_count/bargainInfo.assist_count*100).toFixed(2) +'%;'"></view>
  49. </view>
  50. <view class='money acea-row row-between-wrapper'>
  51. <view v-if="bargainInfo.yet_assist_count != bargainInfo.assist_count">还差{{bargainInfo.assist_count-bargainInfo.yet_assist_count}}人</view>
  52. </view>
  53. </block>
  54. <!-- 帮助助力、助力成功: -->
  55. <view v-if="bargainInfo.relation == 10">
  56. <view v-if="bargainInfo.yet_assist_count == bargainInfo.assist_count">
  57. <view class='bargainSuccess'>
  58. <text class='iconfont icon-xiaolian'></text>
  59. 恭喜您助力成功,快去支付
  60. </view>
  61. <view v-if="bargainInfo.order.paid != 0 && bargainInfo.order.paid != 1" class='bargainBnt' @tap='goPay'>立即支付</view>
  62. <view v-else class='bargainBnt' @tap='goOrderDetail(bargainInfo.order)'>查看订单</view>
  63. <view class='bargainBnt on' @tap='goBargainList'>抢更多商品</view>
  64. </view>
  65. <view v-else>
  66. <!-- #ifdef H5 -->
  67. <button class='bargainBnt' v-if="$wechat.isWeixin()" @click="H5ShareBox = true">邀请好友助力</button>
  68. <button v-else class='bargainBnt copy-data' :data-clipboard-text="protocol +
  69. '//' +
  70. host +
  71. '/pages/activity/assist_detail/index?id='+
  72. id+'&spid='+uid">邀请好友助力</button>
  73. <!-- #endif -->
  74. <!-- #ifdef MP-->
  75. <button open-type='share' class='bargainBnt'>邀请好友助力</button>
  76. <!-- #endif -->
  77. <!-- #ifdef APP-PLUS -->
  78. <button class='bargainBnt' @click="listenerActionSheet">邀请好友助力</button>
  79. <!-- #endif -->
  80. <view class='tip'>
  81. 已有
  82. <text class='t-color'>{{bargainInfo.yet_assist_count}}</text>
  83. 位好友成功助力
  84. </view>
  85. </view>
  86. </view>
  87. <view v-if="bargainInfo.relation == 1">
  88. <view class='bargainBnt' @tap='setBargainHelp' :class="load ? 'disabled' : ''">为好友助力</view>
  89. </view>
  90. <view v-if="bargainInfo.relation == -1 || bargainInfo.relation == -2">
  91. <view>
  92. <view v-if="bargainInfo.relation == -2" class='bargainSuccess'>
  93. <text class='iconfont icon-xiaolian'></text>
  94. 已成功助力好友
  95. </view>
  96. <view v-else class='bargainSuccess'>
  97. <text class='iconfont icon-xiaolian' style="color: #999999;"></text>
  98. 商品助力次数上限
  99. </view>
  100. <view class='bargainBnt' @tap='currentBargainUser'>我也要发起助力</view>
  101. </view>
  102. </view>
  103. <view class='lock' :style="{ 'background-image': `url(${domain}/static/images/assist-lock.png)`}"></view>
  104. </view>
  105. <view class='bargainGang'>
  106. <view class='title font-color acea-row row-center-wrapper'>
  107. <view class='pictrue'>
  108. <image :src="domain+'/static/diy/left'+keyColor+'.png'"></image>
  109. </view>
  110. <view class='titleCon'>助力好友</view>
  111. <view class='pictrue on'>
  112. <image :src="domain+'/static/diy/left'+keyColor+'.png'"></image>
  113. </view>
  114. </view>
  115. <view class='list'>
  116. <block v-for="(item,index) in bargainUserHelpList" :key='index'>
  117. <view class='item acea-row row-between-wrapper'>
  118. <view class='pictxt acea-row row-between-wrapper'>
  119. <view class='pictrue'>
  120. <image :src='item.avatar_img' v-if="item.avatar_img"></image>
  121. <image src="/static/images/f.png" v-else></image>
  122. </view>
  123. <view class='text'>
  124. <view class='name line1'>{{item.nickname}}</view>
  125. <view class='line1 t-color'>{{item.create_time}}</view>
  126. </view>
  127. </view>
  128. <view class='money t-color'>
  129. 已助力
  130. </view>
  131. </view>
  132. </block>
  133. </view>
  134. <view class='load font-color' v-if="!limitStatus" @tap='getBargainUser'>点击加载更多</view>
  135. <view class='lock'></view>
  136. </view>
  137. <view class='goodsDetails'>
  138. <view class='title font-color acea-row row-center-wrapper'>
  139. <view class='pictrue'>
  140. <image :src="domain+'/static/diy/left'+keyColor+'.png'"></image>
  141. </view>
  142. <view class='titleCon'>商品详情</view>
  143. <view class='pictrue on'>
  144. <image :src="domain+'/static/diy/left'+keyColor+'.png'"></image>
  145. </view>
  146. </view>
  147. <view v-if="bargainInfo.product && bargainInfo.product.content" class='conter'>
  148. <jyf-parser :domain='domain' :html="bargainInfo.product.content.content.replace(/<br\/>/ig, '')" ref="article" :tag-style="tagStyle"></jyf-parser>
  149. </view>
  150. <view class='lock'></view>
  151. </view>
  152. <view class='mask' catchtouchmove="true" v-show='active==true' @tap='close'></view>
  153. </view>
  154. <!-- 发送给朋友图片 -->
  155. <view class="share-box" v-if="H5ShareBox">
  156. <image :src="`${domain}/static/images/share-info.png`" @click="H5ShareBox = false"></image>
  157. </view>
  158. <home></home>
  159. <!-- 分享按钮 -->
  160. <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
  161. <button class="item" hover-class='none' @tap="downloadFilePromotionCode">
  162. <view class="iconfont icon-haibao"></view>
  163. <view class="">生成海报</view>
  164. </button>
  165. <button class="item" hover-class='none' @click="copyPwd">
  166. <view class="iconfont icon-fuzhikouling1"></view>
  167. <view>生成口令</view>
  168. </button>
  169. </view>
  170. <view class="mask" v-if="posters || posterImageStatus" @click="listenerActionClose"></view>
  171. <!--口令复制结果-->
  172. <copyPassword :isCopy='isCopy' :copyUrl='copyUrl' @close="closeCopy"></copyPassword>
  173. <!-- 海报展示 -->
  174. <view class='poster-pop' v-if="posterImageStatus">
  175. <image src='../../../static/images/poster-close.png' class='close' @click="posterImageClose"></image>
  176. <image class="poster-image" :src='posterImage'></image>
  177. <!-- #ifndef H5 -->
  178. <view class='save-poster' @click="savePosterPath">保存到手机</view>
  179. <!-- #endif -->
  180. <!-- #ifdef H5 -->
  181. <view class="keep">长按图片可以保存到手机</view>
  182. <!-- #endif -->
  183. </view>
  184. <canvas class="canvas" canvas-id='myCanvas' v-if="canvasStatus"></canvas>
  185. <!-- #ifndef H5 -->
  186. <passwordPopup></passwordPopup>
  187. <!-- #endif -->
  188. </view>
  189. </template>
  190. <script>
  191. // +----------------------------------------------------------------------
  192. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  193. // +----------------------------------------------------------------------
  194. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  195. // +----------------------------------------------------------------------
  196. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  197. // +----------------------------------------------------------------------
  198. // | Author: CRMEB Team <admin@crmeb.com>
  199. // +----------------------------------------------------------------------
  200. import {
  201. getAssistDetail,
  202. postAssistHelp,
  203. assistHelpList,
  204. initiateAssistApi,
  205. getAssistUser
  206. } from '../../../api/activity.js';
  207. import { HTTP_REQUEST_URL } from '@/config/app';
  208. import { toLogin } from '@/libs/login.js';
  209. import { postCartAdd, getProductCode, copyPasswordApi } from '../../../api/store.js';
  210. import copyPassword from '@/components/copyPassword';
  211. import util from '../../../utils/util.js';
  212. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  213. import { mapGetters } from "vuex";
  214. import { configMap } from "@/utils";
  215. // #ifndef H5
  216. import passwordPopup from '@/components/passwordPopup';
  217. // #endif
  218. import countDown from '@/components/countDown';
  219. import home from '@/components/home';
  220. import parser from "@/components/jyf-parser/jyf-parser";
  221. import { silenceBindingSpread } from "@/utils";
  222. import { spread, imgToBase } from '@/api/user.js'
  223. import history from "@/mixins/history";
  224. import shareScence from "@/libs/spread";
  225. const app = getApp();
  226. export default {
  227. components: {
  228. // #ifndef H5
  229. passwordPopup,
  230. // #endif
  231. countDown,
  232. copyPassword,
  233. home,
  234. "jyf-parser": parser
  235. },
  236. mixins: [history],
  237. /**
  238. * 页面的初始数据
  239. */
  240. data() {
  241. return {
  242. countDownDay: '00',
  243. countDownHour: '00',
  244. countDownMinute: '00',
  245. countDownSecond: '00',
  246. active: false,
  247. id: 0, //助力产品编号
  248. userInfo: {}, //当前用户信息
  249. bargainUid: 0, //开启助力用户
  250. bargainUserInfo: {}, //开启助力用户信息
  251. bargainUserId: 0, //开启助力编号
  252. bargainInfo: [], //助力产品
  253. bargainData: {
  254. assistSku: []
  255. },
  256. offset: 0,
  257. limit: 20,
  258. limitStatus: false,
  259. bargainUserHelpList: [],
  260. bargainUserHelpInfo: [],
  261. bargainUserBargainPrice: 0,
  262. status: '', // 0 开启助力 1 朋友帮忙助力 2 朋友帮忙助力成功 3 完成助力 4 助力失败 5已创建订单
  263. bargainCount: [], //分享人数 浏览人数 参与人数
  264. old_price: 0,
  265. retunTop: true,
  266. bargainPartake: 0,
  267. interval: null,
  268. userBargainStatus: 0, //判断自己是否助力
  269. productStock: 0, //判断是否售罄;
  270. quota: 0, //判断是否已限量;
  271. userBargainStatusHelp: true,
  272. navH: '',
  273. statusPay: '',
  274. bargainSumCount: 0,
  275. bargainPrice: 0,
  276. datatime: 0,
  277. offest: '',
  278. tagStyle: {
  279. img: 'width:100%;display:block;',
  280. video: 'width:100%;'
  281. },
  282. domain: HTTP_REQUEST_URL,
  283. H5ShareBox: false, //公众号分享图片
  284. systemH: 0,
  285. pages: '',
  286. protocol: '',
  287. host: '',
  288. currSpid: "",
  289. posters: false,
  290. actionSheetHidden: true,
  291. posterImageStatus: false,
  292. storeImage: '', //海报产品图
  293. PromotionCode: '', //二维码图片
  294. canvasStatus: false, //海报绘图标签
  295. posterImage: '', //海报路径
  296. posterbackgd: '/static/images/posterbackgd.png',
  297. isDown: true,
  298. isCopy: false,
  299. copyUrl: '',
  300. load: false,
  301. }
  302. },
  303. computed:{
  304. ...configMap({site_name: '',share_pic: ''}, mapGetters(['isLogin','uid','viewColor','keyColor'])),
  305. },
  306. watch: {
  307. isLogin: {
  308. handler: function(newV, oldV) {
  309. if (newV) {
  310. this.getBargainDetails();
  311. }
  312. },
  313. deep: true
  314. }
  315. },
  316. /**
  317. * 生命周期函数--监听页面加载
  318. */
  319. onLoad: function(options) {
  320. var that = this;
  321. if(options.spid){
  322. app.globalData.spid = options.spid;
  323. that.currSpid = options.spid
  324. }
  325. // #ifdef MP
  326. uni.getSystemInfo({
  327. success: function(res) {
  328. that.systemH = res.statusBarHeight
  329. that.navH = that.systemH + 10
  330. }
  331. })
  332. // #endif
  333. var pages = getCurrentPages();
  334. if (pages.length <= 1) {
  335. // that.retunTop = false
  336. }
  337. //扫码携带参数处理
  338. // #ifdef MP
  339. if (options.scene) {
  340. var value = util.getUrlParams(decodeURIComponent(options.scene));
  341. if (typeof value === 'object') {
  342. if (value.id) options.id = value.id;
  343. if (value.bargain) options.bargain = value.bargain;
  344. //记录推广人uid
  345. if (value.spid){
  346. app.globalData.spid = value.spid;
  347. that.currSpid = value.spid
  348. }
  349. } else {
  350. app.globalData.spid = value;
  351. }
  352. }
  353. //记录推广人uid
  354. if (options.spid) app.globalData.spid = options.spid;
  355. // #endif
  356. if (options.hasOwnProperty('id')) {
  357. that.id = options.id;
  358. that.bargainUid = options.bargain || 0
  359. }
  360. if (that.isLogin) {
  361. if (that.bargainUid == 'undefined') {
  362. that.bargainUid = that.$store.state.app.uid
  363. }
  364. that.getBargainDetails();
  365. // that.downloadFilePromotionCode();
  366. // #ifdef MP
  367. that.getHistory()
  368. // #endif
  369. } else {
  370. toLogin()
  371. }
  372. shareScence(that.currSpid,that.isLogin)
  373. uni.setNavigationBarTitle({
  374. title: '助力详情'
  375. })
  376. },
  377. onShow: function(){
  378. // #ifdef H5
  379. this.protocol = window.location.protocol
  380. this.host = window.location.host
  381. //#endif
  382. },
  383. onReady: function() {
  384. // #ifdef H5
  385. this.$nextTick(function() {
  386. const clipboard = new ClipboardJS(".copy-data");
  387. clipboard.on("success", () => {
  388. this.$util.Tips({
  389. title: '链接已复制成功,请粘贴分享'
  390. });
  391. });
  392. });
  393. // #endif
  394. },
  395. methods: {
  396. goBack: function() {
  397. uni.navigateBack({
  398. delta: 1
  399. })
  400. },
  401. // 去商品页
  402. goProduct() {
  403. uni.navigateTo({
  404. url: `/pages/goods_details/index?id=${this.bargainInfo.product.old_product_id}`
  405. })
  406. },
  407. /**
  408. * 生成海报
  409. */
  410. async goPoster() {
  411. if (this.posterImage) {
  412. this.posterImageStatus = true
  413. this.posters = false
  414. return
  415. }
  416. let that = this;
  417. let arr2
  418. that.posters = false;
  419. that.$set(that, 'canvasStatus', true);
  420. uni.showLoading({
  421. title: '海报生成中',
  422. mask: true
  423. });
  424. // #ifdef H5
  425. arr2 = [that.posterbackgd, await that.imgToBase(that.storeImage), await that.imgToBase(that.codeImg), await that.imgToBase(that.share_pic)];
  426. // #endif
  427. // #ifdef MP || APP-PLUS
  428. arr2 = [that.posterbackgd, await that.fileStoreImage(that.storeImage), await that.fileStoreImage(
  429. that.codeImg), await that.fileStoreImage(that.share_pic)];
  430. // #endif
  431. that.$util.goodsPosterCanvas(arr2, that.bargainData.store_name, that.bargainPrice, that.site_name, that.old_price, function(tempFilePath) {
  432. that.$set(that, 'posterImage', tempFilePath);
  433. that.$set(that, 'posterImageStatus', true);
  434. that.$set(that, 'canvasStatus', false);
  435. that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
  436. }, (err) => {
  437. that.$set(that, 'canvasStatus', false);
  438. });
  439. },
  440. async imgToBase(url) {
  441. let res = await imgToBase({
  442. image: url
  443. })
  444. return res.data.image
  445. },
  446. //图片转符合安全域名路径
  447. fileStoreImage(url) {
  448. if(url){
  449. // #ifdef MP
  450. let ishttps = url.split('//')[0] == 'https:'
  451. if (!ishttps) {
  452. url = 'https://'+url.split('//')[1]
  453. }
  454. // #endif
  455. return new Promise((resolve, reject) => {
  456. let that = this;
  457. uni.downloadFile({
  458. url: url,
  459. success: function(res) {
  460. resolve(res.tempFilePath);
  461. },
  462. fail: function(error) {
  463. return that.$util.Tips({
  464. title: `${error}`
  465. });
  466. }
  467. });
  468. })
  469. }
  470. },
  471. /**
  472. * 分享打开
  473. *
  474. */
  475. listenerActionSheet: function() {
  476. this.posters = !this.posters;
  477. },
  478. // 分享关闭
  479. listenerActionClose: function() {
  480. this.posters = false;
  481. },
  482. //隐藏海报
  483. posterImageClose: function() {
  484. this.posterImageStatus = false
  485. },
  486. downloadFilePromotionCode() {
  487. let that = this;
  488. let type;
  489. // #ifndef MP
  490. type = 'wechat'
  491. // #endif
  492. // #ifdef MP
  493. type = 'routine'
  494. // #endif
  495. getProductCode(that.id, {
  496. type: type,
  497. product_type: 3
  498. }).then(async res => {
  499. that.codeImg = res.data.url;
  500. that.$set(that, 'isDown', false);
  501. that.goPoster()
  502. }).catch(err => {
  503. that.$util.Tips({
  504. title: err
  505. });
  506. that.posters = false;
  507. that.$set(that, 'isDown', false);
  508. that.$set(that, 'PromotionCode', '');
  509. });
  510. },
  511. /*
  512. * 保存到手机相册
  513. */
  514. savePosterPath: function() {
  515. let that = this;
  516. // #ifdef APP-PLUS
  517. uni.saveImageToPhotosAlbum({
  518. filePath: that.posterImage,
  519. success: function(res) {
  520. that.posterImageClose();
  521. that.$util.Tips({
  522. title: '保存成功',
  523. icon: 'success'
  524. });
  525. },
  526. fail: function(res) {
  527. that.$util.Tips({
  528. title: '保存失败'
  529. });
  530. },
  531. })
  532. // #endif
  533. },
  534. //复制口令
  535. copyPwd(){
  536. let that = this;
  537. copyPasswordApi({
  538. id: that.id,
  539. product_type: 30
  540. }).then(async res => {
  541. that.copyUrl = res.data.str;
  542. that.posters = false
  543. that.isCopy = true;
  544. })
  545. },
  546. closeCopy(){
  547. this.isCopy = false
  548. },
  549. goPay: function() { //立即支付
  550. var that = this;
  551. var data = {
  552. product_id: that.bargainInfo.product_assist_set_id,
  553. product_attr_unique: that.bargainInfo.product.unique,
  554. cart_num: 1,
  555. product_type: 3,
  556. is_new: 1
  557. };
  558. postCartAdd(data).then(res => {
  559. uni.navigateTo({
  560. url: '/pages/users/order_confirm/index?new=1&cartId=' + res.data.cart_id
  561. });
  562. }).catch(err => {
  563. return that.$util.Tips({
  564. title: err
  565. })
  566. });
  567. },
  568. getBargainDetails: function() { //获取助力产品详情
  569. var that = this;
  570. var id = that.id;
  571. getAssistDetail(id,{type: 2}).then(function(res) {
  572. that.bargainInfo = res.data;
  573. that.bargainData = res.data.assist;
  574. that.bargainPrice = that.bargainData.assistSku[0].assist_price;
  575. that.old_price = (that.bargainData.assistSku[0].sku && that.bargainData.assistSku[0].sku.price) || 0;
  576. that.userInfo = res.data.user;
  577. that.bargainSumCount = res.data.yet_assist_count;
  578. that.$set(that, 'storeImage', that.bargainInfo.product.image);
  579. that.datatime = res.data.stopTime;
  580. that.pages = '/pages/activity/assist_detail/index?id=' + that.id;
  581. that.bargainUserHelpList = []
  582. that.getBargainUser();
  583. //#ifdef H5
  584. that.setOpenShare();
  585. //#endif
  586. }).catch(function(err) {
  587. that.$util.Tips({
  588. title: err
  589. }, {
  590. tab: 3
  591. })
  592. })
  593. },
  594. currentBargainUser: function() { //当前用户助力
  595. let that = this;
  596. let id = that.bargainInfo.product_assist_id;
  597. initiateAssistApi(id).then(res => {
  598. let assist_id = res.data.product_assist_set_id
  599. uni.hideLoading();
  600. uni.navigateTo({
  601. url: '/pages/activity/assist_detail/index?id=' + assist_id
  602. });
  603. }).catch((err) => {
  604. uni.hideLoading();
  605. that.$util.Tips({
  606. title: err
  607. })
  608. });
  609. },
  610. setBargainHelp: function() { //帮好友助力
  611. var that = this;
  612. that.load = true
  613. postAssistHelp(that.bargainInfo.product_assist_set_id).then(res => {
  614. that.$set(that, 'bargainUserHelpList', []);
  615. that.getBargainUser();
  616. that.$util.Tips({
  617. title: res.message
  618. })
  619. that.getBargainDetails();
  620. that.load = false
  621. }).catch(err => {
  622. that.$util.Tips({
  623. title: err
  624. })
  625. that.$set(that, 'bargainUserHelpList', []);
  626. that.getBargainUser();
  627. that.load = false
  628. })
  629. },
  630. getBargainUser: function() { //获取助力帮
  631. var that = this;
  632. var data = {
  633. offset: that.offset,
  634. limit: that.limit,
  635. };
  636. assistHelpList(that.id).then(res => {
  637. var bargainUserHelpListNew = [];
  638. var bargainUserHelpList = that.bargainUserHelpList;
  639. var len = res.data.list.length;
  640. bargainUserHelpListNew = bargainUserHelpList.concat(res.data.list);
  641. that.$set(that, 'bargainUserHelpList', res.data.list);
  642. that.$set(that, 'limitStatus', data.limit > len);
  643. that.$set(that, 'offest', (Number(data.offset) + Number(data.limit)));
  644. });
  645. },
  646. goBargainList: function() {
  647. uni.navigateTo({
  648. url: '/pages/activity/assist/index',
  649. })
  650. },
  651. goOrderDetail: function(order) {
  652. if (order.paid == 1) {
  653. uni.navigateTo({
  654. url: '/pages/order_details/index?order_id=' + order.order_id,
  655. })
  656. } else {
  657. uni.navigateTo({
  658. url: '/pages/order_details/stay?order_id=' + order.group_order_id,
  659. })
  660. }
  661. },
  662. close: function() {
  663. this.$set(this, 'active', false);
  664. },
  665. addShareAssist: function() { //添加分享次数 获取人数
  666. var that = this;
  667. getAssistUser(that.bargainInfo.product_assist_set_id).then(res => {});
  668. },
  669. //#ifdef H5
  670. setOpenShare() {
  671. let that = this;
  672. let configTimeline = {
  673. title: "您的好友" +
  674. that.userInfo.nickname +
  675. "邀请您助力" +
  676. that.bargainInfo.product.store_name,
  677. desc: that.bargainInfo.product.store_name,
  678. link: window.location.protocol +
  679. "//" +
  680. window.location.host +
  681. "/pages/activity/assist_detail/index?id=" +
  682. that.id+'&spid='+that.uid,
  683. imgUrl: that.bargainInfo.product.image,
  684. };
  685. if (this.$wechat.isWeixin()) {
  686. this.$wechat.wechatEvevt([
  687. "updateAppMessageShareData",
  688. "updateTimelineShareData",
  689. "onMenuShareAppMessage",
  690. "onMenuShareTimeline"
  691. ],
  692. configTimeline
  693. )
  694. .then(res => {
  695. console.log(res);
  696. })
  697. .catch(res => {
  698. if (res.is_ready) {
  699. res.wx.updateAppMessageShareData(configTimeline);
  700. res.wx.updateTimelineShareData(configTimeline);
  701. res.wx.onMenuShareAppMessage(configTimeline);
  702. res.wx.onMenuShareTimeline(configTimeline);
  703. }
  704. });
  705. }
  706. }
  707. //#endif
  708. },
  709. /** 生命周期函数--监听页面隐藏
  710. */
  711. onHide: function() {
  712. if (this.interval !== null) clearInterval(this.interval);
  713. },
  714. /**
  715. * 生命周期函数--监听页面卸载
  716. */
  717. onUnload: function() {
  718. if (this.interval !== null) clearInterval(this.interval);
  719. },
  720. //#ifdef MP
  721. /**
  722. * 用户点击右上角分享
  723. */
  724. onShareAppMessage: function() {
  725. let that = this,
  726. share = {
  727. title: '您的好友' + that.userInfo.nickname + '邀请您帮他助力' + that.bargainInfo.product.store_name + ' 快去帮忙吧!',
  728. path: '/pages/activity/assist_detail/index?id=' + this.id+'&spread='+that.uid,
  729. imageUrl: that.bargainInfo.product.image,
  730. };
  731. that.close();
  732. that.addShareAssist();
  733. return share;
  734. },
  735. //#endif
  736. }
  737. </script>
  738. <style lang="scss" scoped>
  739. .page-container {
  740. min-height: 100vh;
  741. background-color: var(--view-theme);
  742. }
  743. .canvas {
  744. z-index: 300;
  745. width: 750px;
  746. height: 1190px;
  747. opacity: 0;
  748. }
  749. .poster-pop {
  750. width: 600rpx;
  751. height: 897rpx;
  752. position: fixed;
  753. left: 50%;
  754. transform: translateX(-50%);
  755. z-index: 1000;
  756. top: 50%;
  757. margin-top: -446rpx;
  758. }
  759. .poster-pop image {
  760. width: 100%;
  761. height: 100%;
  762. display: block;
  763. }
  764. .poster-pop .close {
  765. width: 46rpx;
  766. height: 75rpx;
  767. position: fixed;
  768. right: 0;
  769. top: -73rpx;
  770. display: block;
  771. }
  772. .poster-pop .save-poster {
  773. background-color: #df2d0a;
  774. font-size: :22rpx;
  775. color: #fff;
  776. text-align: center;
  777. height: 76rpx;
  778. line-height: 76rpx;
  779. width: 100%;
  780. border-radius: 43rpx;
  781. margin-top: 20rpx;
  782. }
  783. .poster-pop .keep {
  784. color: #fff;
  785. text-align: center;
  786. font-size: 25rpx;
  787. margin-top: 10rpx;
  788. }
  789. .mask {
  790. position: fixed;
  791. top: 0;
  792. left: 0;
  793. right: 0;
  794. bottom: 0;
  795. width: 100%;
  796. height: 100%;
  797. background-color: rgba(0, 0, 0, 0.6);
  798. z-index: 100;
  799. }
  800. .generate-posters {
  801. width: 100%;
  802. height: 170rpx;
  803. background-color: #fff;
  804. position: fixed;
  805. left: 0;
  806. bottom: 0;
  807. z-index: 999;
  808. transform: translate3d(0, 100%, 0);
  809. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  810. border-top: 1px solid #eee;
  811. }
  812. .generate-posters.on {
  813. transform: translate3d(0, 0, 0);
  814. }
  815. .generate-posters .item {
  816. flex: 50%;
  817. text-align: center;
  818. font-size: 30rpx;
  819. }
  820. .generate-posters .item .iconfont {
  821. font-size: 80rpx;
  822. color: #5eae72;
  823. }
  824. .generate-posters .item .iconfont.icon-haibao {
  825. color: #5391f1;
  826. }
  827. .generate-posters .item .iconfont.icon-fuzhikouling1 {
  828. color: #FBB324;
  829. }
  830. .bargain .icon-xiangzuo {
  831. font-size: 40rpx;
  832. color: #fff;
  833. position: fixed;
  834. top: 30rpx;
  835. left: 30rpx;
  836. z-index: 99;
  837. font-size: 36rpx;
  838. }
  839. .bargain .header {
  840. background-repeat: no-repeat;
  841. background-size: 100% 100%;
  842. width: 698rpx;
  843. height: 572rpx;
  844. margin: 0 auto;
  845. padding-top: 0.1rpx;
  846. position: relative;
  847. }
  848. .bargain .header .pictxt {
  849. margin: 330rpx auto 0 auto;
  850. font-size: 26rpx;
  851. color: #fff;
  852. }
  853. .bargain .header .pictxt .pictrue {
  854. width: 56rpx;
  855. height: 56rpx;
  856. margin-right: 30rpx;
  857. }
  858. .bargain .header .pictxt .pictrue image {
  859. width: 100%;
  860. height: 100%;
  861. border-radius: 50%;
  862. border: 2rpx solid #fff;
  863. }
  864. .bargain .header .pictxt .text text {
  865. margin-left: 20rpx;
  866. }
  867. /deep/.bargain .header .time {
  868. background-repeat: no-repeat;
  869. background-size: 100% 100%;
  870. width: 480rpx;
  871. height: 166rpx;
  872. font-size: 22rpx;
  873. text-align: center;
  874. padding-top: 11rpx;
  875. box-sizing: border-box;
  876. position: absolute;
  877. top: 340rpx;
  878. left: 50%;
  879. margin-left: -240rpx;
  880. align-items: inherit;
  881. }
  882. .t-color {
  883. color: var(--view-theme);
  884. }
  885. .b-color {
  886. background-color: var(--view-theme);
  887. }
  888. .bargain .header .people {
  889. text-align: center;
  890. color: #fff;
  891. font-size: 20rpx;
  892. position: absolute;
  893. width: 100%;
  894. /* #ifdef MP || APP-PLUS */
  895. height: 44px;
  896. line-height: 44px;
  897. /* #endif */
  898. /* #ifdef H5 */
  899. top: 36rpx;
  900. /* #endif */
  901. }
  902. .bargain .wrapper,
  903. .bargain .bargainGang,
  904. .bargain .goodsDetails {
  905. width: 660rpx;
  906. border: 6rpx solid #fc8b42;
  907. background-color: #fff;
  908. border-radius: 20rpx;
  909. margin: -162rpx auto 0 auto;
  910. box-sizing: border-box;
  911. padding: 0 24rpx 47rpx 24rpx;
  912. position: relative;
  913. }
  914. .bargain .wrapper .pictxt {
  915. margin: 26rpx 0 37rpx 0;
  916. }
  917. .bargain .wrapper .pictxt .pictrue {
  918. width: 180rpx;
  919. height: 180rpx;
  920. position: relative;
  921. }
  922. .bargain .wrapper .pictxt .pictrue image {
  923. width: 100%;
  924. height: 100%;
  925. border-radius: 6rpx;
  926. }
  927. .bargain .wrapper .pictxt .text {
  928. width: 395rpx;
  929. font-size: 28rpx;
  930. color: #282828;
  931. height: 180rpx;
  932. }
  933. .bargain .wrapper .pictxt .text .money {
  934. font-weight: bold;
  935. font-size: 24rpx;
  936. color: var(--view-priceColor);
  937. }
  938. .bargain .wrapper .pictxt .text .money .num {
  939. font-size: 36rpx;
  940. }
  941. .bargain .wrapper .pictxt .text .old-price{
  942. text-decoration: line-through;
  943. color: #999;
  944. margin-left: 10rpx;
  945. font-size: 24rpx;
  946. }
  947. .bargain .wrapper .pictxt .text .successNum {
  948. font-size: 22rpx;
  949. color: #999;
  950. }
  951. .bargain .wrapper .cu-progress {
  952. overflow: hidden;
  953. height: 12rpx;
  954. background-color: #eee;
  955. width: 100%;
  956. border-radius: 20rpx;
  957. }
  958. .bargain .wrapper .cu-progress .bg-red {
  959. width: 0;
  960. height: 100%;
  961. transition: width 0.6s ease;
  962. border-radius: 20rpx;
  963. background-image: linear-gradient(to right, var(--view-bntColor11) 0%, var(--view-bntColor12) 100%);
  964. }
  965. .bargain .wrapper .money {
  966. font-size: 22rpx;
  967. color: #999;
  968. margin-top: 15rpx;
  969. }
  970. .bargain .wrapper .bargainSuccess {
  971. font-size: 26rpx;
  972. color: #282828;
  973. text-align: center;
  974. }
  975. .bargain .wrapper .bargainSuccess .iconfont {
  976. font-size: 45rpx;
  977. color: #54c762;
  978. padding-right: 18rpx;
  979. vertical-align: -5rpx;
  980. }
  981. .bargain .wrapper .bargainBnt {
  982. font-size: 30rpx;
  983. font-weight: bold;
  984. color: #fff;
  985. width: 600rpx;
  986. height: 80rpx;
  987. border-radius: 40rpx;
  988. background-image: linear-gradient(to right, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  989. text-align: center;
  990. line-height: 80rpx;
  991. margin-top: 32rpx;
  992. &.disabled {
  993. background: #BFBFBF;
  994. pointer-events: none;
  995. }
  996. }
  997. .bargain .wrapper .bargainBnt.on {
  998. border: 2rpx solid var(--view-theme);
  999. color: var(--view-theme);
  1000. background-image: linear-gradient(to right, #fff 0%, #fff 100%);
  1001. width: 596rpx;
  1002. height: 76rpx;
  1003. }
  1004. .bargain .wrapper .bargainBnt.grey {
  1005. color: #fff;
  1006. background-image: linear-gradient(to right, #BBBBBB 0%, #BBBBBB 100%);
  1007. }
  1008. .bargain .wrapper .tip {
  1009. font-size: 22rpx;
  1010. color: #999;
  1011. text-align: center;
  1012. margin-top: 20rpx;
  1013. }
  1014. .bargain .wrapper .lock,
  1015. .bargain .bargainGang .lock,
  1016. .bargain .goodsDetails .lock {
  1017. background-repeat: no-repeat;
  1018. background-size: 100% 100%;
  1019. width: 548rpx;
  1020. height: 66rpx;
  1021. position: absolute;
  1022. left: 50%;
  1023. transform: translateX(-50%);
  1024. bottom: -43rpx;
  1025. z-index: 5;
  1026. }
  1027. .bargain .bargainGang {
  1028. margin: 13rpx auto 0 auto;
  1029. }
  1030. .bargain .bargainGang .title,
  1031. .bargain .goodsDetails .title {
  1032. font-size: 32rpx;
  1033. font-weight: bold;
  1034. height: 80rpx;
  1035. margin-top: 30rpx;
  1036. }
  1037. .bargain .bargainGang .title .pictrue,
  1038. .bargain .goodsDetails .title .pictrue {
  1039. width: 46rpx;
  1040. height: 24rpx;
  1041. }
  1042. .bargain .bargainGang .title .pictrue.on,
  1043. .bargain .goodsDetails .title .pictrue.on {
  1044. transform: rotate(180deg);
  1045. }
  1046. .bargain .bargainGang .title .pictrue image,
  1047. .bargain .goodsDetails .title .pictrue image {
  1048. width: 100%;
  1049. height: 100%;
  1050. display: block;
  1051. }
  1052. .bargain .bargainGang .title .titleCon,
  1053. .bargain .goodsDetails .title .titleCon {
  1054. margin: 0 20rpx;
  1055. color: var(--view-theme);
  1056. }
  1057. .bargain .bargainGang .list .item {
  1058. border-bottom: 1rpx dashed #ddd;
  1059. height: 112rpx;
  1060. }
  1061. .bargain .bargainGang .list .item .pictxt {
  1062. width: 310rpx;
  1063. }
  1064. .bargain .bargainGang .list .item .pictxt .pictrue {
  1065. width: 70rpx;
  1066. height: 70rpx;
  1067. }
  1068. .bargain .bargainGang .list .item .pictxt .pictrue image {
  1069. width: 100%;
  1070. height: 100%;
  1071. border-radius: 50%;
  1072. }
  1073. .bargain .bargainGang .list .item .pictxt .text {
  1074. width: 225rpx;
  1075. font-size: 20rpx;
  1076. color: #999;
  1077. }
  1078. .bargain .bargainGang .list .item .pictxt .text .name {
  1079. font-size: 25rpx;
  1080. color: #282828;
  1081. margin-bottom: 7rpx;
  1082. }
  1083. .bargain .bargainGang .list .item .money {
  1084. font-size: 25rpx;
  1085. }
  1086. .bargain .bargainGang .list .item .money .iconfont {
  1087. font-size: 35rpx;
  1088. vertical-align: middle;
  1089. margin-right: 10rpx;
  1090. }
  1091. .bargain .bargainGang .load {
  1092. font-size: 24rpx;
  1093. text-align: center;
  1094. line-height: 80rpx;
  1095. height: 80rpx;
  1096. }
  1097. .bargain .goodsDetails {
  1098. margin: 13rpx auto 0 auto;
  1099. }
  1100. .bargain .goodsDetails~.goodsDetails {
  1101. margin-bottom: 50rpx;
  1102. }
  1103. .bargain .goodsDetails .conter {
  1104. margin-top: 20rpx;
  1105. overflow: hidden;
  1106. }
  1107. .bargain_view {
  1108. width: 180rpx;
  1109. height: 48rpx;
  1110. background: rgba(0, 0, 0, 0.5);
  1111. opacity: 1;
  1112. border-radius: 0 0 6rpx 6rpx;
  1113. position: absolute;
  1114. bottom: 0;
  1115. font-size: 22rpx;
  1116. color: #fff;
  1117. text-align: center;
  1118. line-height: 48rpx;
  1119. }
  1120. .iconfonts {
  1121. font-size: 22rpx !important;
  1122. }
  1123. .bargain .mask {
  1124. z-index: 100;
  1125. }
  1126. .share-box {
  1127. z-index: 1000;
  1128. position: fixed;
  1129. left: 0;
  1130. top: 0;
  1131. width: 100%;
  1132. height: 100%;
  1133. image {
  1134. width: 100%;
  1135. height: 100%;
  1136. }
  1137. }
  1138. </style>