detail.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  1. <template>
  2. <view v-if="allShow">
  3. <!--group/detail/detail.wxml-->
  4. <view class="banner">
  5. <swiper class="swiper" @change="swiperChange" :current="current" autoplay="true" circular="true"
  6. duration="1000">
  7. <block v-for="(item, index) in bannerUrls" :key="index">
  8. <swiper-item autoplay="true">
  9. <image :src="item + '?x-oss-process=style/w750-auto'" mode="aspectFit"></image>
  10. </swiper-item>
  11. </block>
  12. </swiper>
  13. <view class="dots dflex">
  14. <block v-for="(item, index) in bannerUrls" :key="index">
  15. <view :class="'dot ' + (index == swiperCurrent ? ' active' : '')" :data-current="index"
  16. @tap="dotEvent"></view>
  17. </block>
  18. </view>
  19. </view>
  20. <!-- <view class="notification_bar" wx:if="{{isNotice}}">
  21. <swiper class="swiper_container" vertical="true" autoplay="true" circular="false" duration="1000" interval="5000" easing-function="easeInOutCubic" class="bar_box dflex">
  22. <swiper-item class="bar_con dflex" wx:for="{{contentList}}" wx:key="item">
  23. <view class="bar dflex">
  24. <image class="bar_left" src="{{item.pic}}" />
  25. <text class="bar_text">最新订单来自</text>
  26. <text class="bar_text">{{item.name}},</text>
  27. <text class="bar_text">{{item.time}}</text>
  28. </view>
  29. </swiper-item>
  30. </swiper>
  31. </view> -->
  32. <view class="group">
  33. <image src="/activity/static/activity/images/ptbg.png" class="ptbg" v-if="act.start"></image>
  34. <image src="/activity/static/activity/images/msyybg.png" class="ptbg" v-else></image>
  35. <view class="groups dflex">
  36. <view class="left">
  37. <view class="price">拼团价¥<text>{{act.money}}</text></view>
  38. <view class="pin"><text class="origin" v-if="act.marketPrice<act.money&&act.marketPrice!=0">原价
  39. {{act.marketPrice}}</text>
  40. <block v-if="act.marketPrice<act.money&&act.marketPrice!=0"> | </block>{{count? count:0}}人已拼
  41. {{act.activityMainEntity.numberPeople}}人团
  42. </view>
  43. </view>
  44. <view class="right">
  45. <image src="/static/pages/images/tuan.png" class="tuan"></image>
  46. <view class="endtime dflex">
  47. <view>{{isStates==0?'距开始':isStates==1?'距结束':'已结束'}}</view>
  48. <block v-if="timer.length==4">
  49. <block v-if="timer[0] !=0"><text>{{timer[0]}}</text>天</block>
  50. <text>{{timer[1]}}</text>:
  51. <text>{{timer[2]}}</text>:
  52. <text>{{timer[3]}}</text>
  53. </block>
  54. <block v-else>
  55. <text>{{timer[0]}}</text>:
  56. <text>{{timer[1]}}</text>:
  57. <text>{{timer[2]}}</text>
  58. </block>
  59. <!-- <block wx:if="{{timer&&timer.length>0}}">
  60. <text>{{timer[0]}}</text>天</block>
  61. <text>{{timer[1]}}</text>:
  62. <text>{{timer[2]}}</text>:
  63. <text>{{timer[3]}}</text> -->
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="text">
  69. {{product.brandName ? product.brandName : ''}} {{product.brief ? product.brief : ''}}
  70. </view>
  71. <view class="info bgfff">
  72. <view class="infos dflex">
  73. <view class="title flex">{{pro.title?pro.title:'0'}}</view>
  74. <view class="share" @tap="showShare">
  75. <image src="/static/pages/images/fxico.png"></image>分享
  76. </view>
  77. </view>
  78. <view class="guarantee dflex" v-if="guarantee.length>0">
  79. <view class="cont dflex">
  80. <view v-for="(item, index) in guarantee" :key="index" class="dflex li">
  81. <image src="/activity/static/activity/images/guarantee.png"></image>{{item}}
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="detinfo mt20 bgfff">
  87. <!-- isOtc 0 默认 1 处方药 2 非处方药 3 医疗器械 4 食品类 5 海外购 -->
  88. <block v-if="act.isOtc!=5">
  89. <block v-if="is_open_shop == 1 && ascription">
  90. <view class="xiaodian dflex malr20" v-if="((act.isMeCommission != 1 || act.isMeCommission != '1') && act.oneCommission>0) || ((act.isMeCommission == 1 || act.isMeCommission == '1') && act.twoCommission>0) || act.serviceShopRate">
  91. <image src="/static/pages/images/xdbg1.png" class="xdbg"></image>
  92. <view class="shouyi flex" v-if="((act.isMeCommission != 1 || act.isMeCommission != '1') && act.oneCommission>0) || ((act.isMeCommission == 1 || act.isMeCommission == '1') && act.twoCommission>0)">
  93. <text>分销收益</text>
  94. <view v-if="act.isMeCommission == 0"><text>¥</text>{{act.oneCommission}}</view>
  95. <view v-else><text>¥</text>{{act.twoCommission}}</view>
  96. </view>
  97. <view class="shouyi flex" v-if="act.serviceShopRate">
  98. <text>小店服务费</text>
  99. <view><text>¥</text>{{act.serviceShopRate}}</view>
  100. </view>
  101. <view class="dflex" v-if="act.isJoinShop">
  102. <view class="fenxiang" @tap="showShare">分享推广</view>
  103. <navigator :url="url" hover-class="none" class="goShop">去小店</navigator>
  104. </view>
  105. <view class="addshop" @tap="addShop" v-else>添加到小店</view>
  106. </view>
  107. </block>
  108. <block v-else>
  109. <view class="xiaodian dflex malr20" v-if="((act.isMeCommission != 1 || act.isMeCommission != '1') && act.oneCommission>0) || ((act.isMeCommission == 1 || act.isMeCommission == '1') && act.twoCommission>0)">
  110. <image src="/static/pages/images/xdbg1.png" class="xdbg"></image>
  111. <view class="shouyi flex">
  112. <text>分销收益</text>
  113. <view v-if="act.isMeCommission == 0"><text>¥</text>{{act.oneCommission}}</view>
  114. <view v-else><text>¥</text>{{act.twoCommission}}</view>
  115. </view>
  116. <navigator url="/promote/apply/apply" hover-class="none" class="fenxiang" v-if="isDistriUser != 2">我要推广</navigator>
  117. <view class="fenxiang" @tap="showShare" v-else>分享推广</view>
  118. </view>
  119. </block>
  120. </block>
  121. <!-- <view class="item dflex">
  122. <label>优惠券</label>
  123. <view class="quan flex dflex">
  124. <view class="flex dflex">
  125. <text>满500减50</text>
  126. <text>满200减10</text>
  127. </view>
  128. <view class="ling dflex">领券<image src="/pages/images/more3.png"></image>
  129. </view>
  130. </view>
  131. </view> -->
  132. <view class="item pro-sel dflex" v-if="pro.propertiesList && pro.propertiesList.length > 0"
  133. @click="pro.stock > 0 ? addShopCart() : ''">
  134. <label>已选</label>
  135. <view class="flex">{{pro.properties}}</view>
  136. <image src="/static/pages/images/more.png" class="mrico"></image>
  137. </view>
  138. <view class="item dflex">
  139. <label>配送至</label>
  140. <view class="flex" @tap="toAddress">
  141. <view class="address">{{address.address?address.address:''}}{{address.house?address.house:''}}
  142. </view>
  143. <view class="huo" v-if="pro.isTimely == 1"><text>现货</text>,现在下单,预计2小时后送达</view>
  144. </view>
  145. <image src="/static/pages/images/more2.png" class="more" @tap="toAddress"></image>
  146. </view>
  147. <view class="item dflex">
  148. <label>门店</label>
  149. <view class="flex" @tap="toMerchant">
  150. <view class="address">{{merchant.title}}</view>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 参团情况 -->
  155. <!-- <view class="cantuan bgfff mt20">
  156. <view class="can-info">{{act.activityMainEntity.numberPeople}}人团,还差<text>{{act.activityMainEntity.numberPeople-(act.activityPurchaseRecordEntitys?act.activityPurchaseRecordEntitys.length:0)}}人</text></view>
  157. <view class="can-infos dflex" wx:for="{{act.activityPurchaseRecordEntitys}}">
  158. <view class="li">
  159. <image src="/pages/images/bar.png" mode="aspectFit"></image>
  160. <text>团长</text>
  161. </view>
  162. <view class="li">
  163. <image src="/pages/images/bar.png" mode="aspectFit"></image>
  164. </view>
  165. <view class="li">
  166. <image src="/pages/images/cha.png"></image>
  167. </view>
  168. <view class="li">
  169. <image src="/pages/images/cha.png"></image>
  170. </view>
  171. </view>
  172. <view class="can-btn mbglinear">我要参团</view>
  173. </view> -->
  174. <!-- 组团情况 -->
  175. <view class="zutuan bgfff mt20">
  176. <view
  177. v-if="(activityPurchaseRecordListDTO&&activityPurchaseRecordListDTO.length>0)||(act.activityPurchaseRecordListDTO.length>0&&act.activityPurchaseRecordListDTO)"
  178. class="zu-tit dflex">
  179. {{act.activityPurchaseRecordListDTO.length}}人正在组团,可直接参与<icon class="icon iconfont icon-bottom"
  180. @tap="activityPurchaseRecordListDTO.length>1&&activityDot.length>0?clickmore():''">
  181. </icon>
  182. </view>
  183. <view class="zu-list">
  184. <view v-for="(item, index) in activityPurchaseRecordListDTO" :key="index" class="li dflex">
  185. <image :src="item.groupMainP.uavatar" mode="aspectFit"></image>
  186. <view class="zu-name flex">{{item.groupMainP.unickName}}</view>
  187. <view class="zu-ren">
  188. <view class="cha"
  189. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  190. {{act.activityMainEntity.numberPeople}}人成团,还差<text>{{(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0?(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0)):0}}人</text>
  191. </view>
  192. <view class="zu-time"
  193. v-if="item.isGroup&&(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  194. 剩余<text>{{item.times}}</text></view>
  195. <block v-else>
  196. <view
  197. v-if="!item.isGroup&&(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  198. 拼团失败</view>
  199. <view
  200. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))<=0">
  201. <text>{{item.groupMainP.state==1?'拼团完成':'拼团待支付'}}</text>
  202. </view>
  203. </block>
  204. </view>
  205. <view class="zu-btn mbglinear" :data-index="index" @tap="toGoGroup"
  206. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">去参团
  207. </view>
  208. <view class="zu-btn mbglinear" :data-index="index" @tap="toGoGroup" v-else>查看详情</view>
  209. </view>
  210. </view>
  211. </view>
  212. <!-- 拼团玩法 -->
  213. <view class="wanfa bgfff mt20">
  214. <view class="wan-tit">拼团玩法</view>
  215. <view class="wan-info dflex">
  216. <view class="li dflex">
  217. <icon class="icon iconfont icon-zhifu"></icon>
  218. <view class="flex">支付开团<text>或参团</text></view>
  219. </view>
  220. <icon class="icon iconfont icon-right"></icon>
  221. <view class="li dflex">
  222. <icon class="icon iconfont icon-haoyou"></icon>
  223. <view class="flex">邀请好友<text>拼团</text></view>
  224. </view>
  225. <icon class="icon iconfont icon-right"></icon>
  226. <view class="li dflex">
  227. <icon class="icon iconfont icon-dingdan"></icon>
  228. <view class="flex">达到人数拼团成功<text>人数不足拼团失败</text></view>
  229. </view>
  230. </view>
  231. </view>
  232. <!-- 商品详情等页面 -->
  233. <product-footer ref="list" id="list" :detail="nodes" :imgs="imgs" :proId="pro.id" v-if="pro.id" :form="form"
  234. @showTab="showTab" @scoreTab="scoreTab" @freshen="freshenFun"></product-footer>
  235. <v-share :hide-toast="hideShare" :product="pro" :code-url="codeUrl" :a-type="'3'" @onFather="click"></v-share>
  236. <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 140) + 'rpx'"></view>
  237. <view class="bot fixed bgfff dflex" :style="'padding-bottom: ' + (bottomBlankHeight + 20) + 'rpx'">
  238. <contact-button img-url="/static/pages/images/kfico.png" class-name="botbtn" button-text="在线客服"></contact-button>
  239. <!-- <navigator class="botbtn" open-type="switchTab" url="/pages/cart/cart" hover-class="none">
  240. <image src="/pages/images/gwc.png"></image>购物车<text class="message" wx:if="{{pro.count > 0}}">{{pro.count}}</text>
  241. </navigator> -->
  242. <!-- <view class="botbtn" bindtap="clickCollect">
  243. <image src="/pages/images/shoucang_h.png" wx:if="{{pro.isCollect}}"></image>
  244. <image src="/pages/images/shoucang.png" wx:else></image>收藏
  245. </view> -->
  246. <!-- <view class="addcart">加入购物车</view> -->
  247. <block v-if="isStates!=0">
  248. <view class="gmbtn" @tap="atOnceBuy">¥{{salePrice}} 单独购买</view>
  249. <!-- <view class="ctbtn mbglinear">我要参团</view>官方组团按钮 -->
  250. <!-- 自由组团按钮 -->
  251. <view class="ctbtn mbglinear" @tap="createGroup" v-if="isStates==1&&myActData.state!=1&&!activityEnd">
  252. ¥{{ act.money}}发起拼团</view>
  253. <view class="ctbtn mbglinear" @tap="createGroup" v-if="myActData.state==1">查看拼团</view>
  254. <view class="ctbtn end" v-if="(isStates==2&&myActData.state!=1)||activityEnd">活动已结束</view>
  255. </block>
  256. <block v-if="isStates==0">
  257. <view class="cancel-yy dflex" @tap="cancelActivityRemind" v-if="isRemind">
  258. <icon class="icon iconfont icon-yugao"></icon>取消提醒
  259. </view>
  260. <view class="yybtn mbggreen dflex" @tap="addActivityRemind" v-else>
  261. <icon class="icon iconfont icon-yugao"></icon>预约提醒
  262. </view>
  263. </block>
  264. </view>
  265. <!-- 商品规格 -->
  266. <block v-if="isShow">
  267. <product-popup :product="popup" :activityId="act.id" :is-cart="isCart" order-type="4" @hidePopup="hidePopup"
  268. @addCartSuccess="addCartSuccess" :order-type="orderType" :merchant="merchant"
  269. :merchant-id="query.merchantId" :shop-id="query.shopId"></product-popup>
  270. </block>
  271. <view class="contact_index" @tap="goTop">
  272. <image src="/static/pages/images/backtop.png"></image>顶部
  273. </view>
  274. <!-- 查看更多 -->
  275. <view class="mask" @tap="eliminate" v-if="show" catchtouchmove="true"></view>
  276. <view class="page" :style="'margin:-' + (windowHeight/2) + 'px 0 0 -' + (windowWidth/2) + 'px'">
  277. <view class="ptuanmode" catchtouchmove="true" v-if="show">
  278. <view class="zu-list">
  279. <view class="pttop">正在拼团</view>
  280. <scroll-view scroll-y="true" style="max-height: 550rpx;">
  281. <view v-for="(item, index) in activityDot" :key="index" class="li dflex">
  282. <image :src="item.groupMainP.uavatar" mode="aspectFit"></image>
  283. <view class="zu-name flex">{{item.groupMainP.unickName}}</view>
  284. <view class="zu-ren">
  285. <view class="cha"
  286. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  287. {{act.activityMainEntity.numberPeople}}人成团,还差<text>{{(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0?(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0)):0}}人</text>
  288. </view>
  289. <view class="zu-time"
  290. v-if="item.isGroup&&(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  291. 剩余<text>{{item.times}}</text></view>
  292. <block v-else>
  293. <view
  294. v-if="!item.isGroup&&(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  295. 拼团失败</view>
  296. <view
  297. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))<=0">
  298. <text>{{item.groupMainP.state==1?'拼团完成':'拼团待支付'}}</text>
  299. </view>
  300. </block>
  301. </view>
  302. <view class="zu-btn mbglinear" :data-index="index" data-type="1" @tap="toGoGroup"
  303. v-if="(act.activityMainEntity.numberPeople-(item.groupList?item.groupList.length:0))>0">
  304. 去参团</view>
  305. <view class="zu-btn mbglinear" :data-index="index" @tap="toGoGroup" :data-type="1" v-else>
  306. 查看详情</view>
  307. </view>
  308. </scroll-view>
  309. <view class="tole" v-if="activityDot.length==21">--仅显示20个正在拼团的人--</view>
  310. </view>
  311. </view>
  312. </view>
  313. <!-- 添加到小店成功 -->
  314. <view class="mask" :hidden="isHide" @tap="hidePop"></view>
  315. <view class="suc" :hidden="isHide">
  316. <image :src="picUrlss+'tjcg1.png'" class="tjcg1"></image>
  317. <image src="/static/pages/images/tjcg.png" class="tjcg"></image>
  318. <text>快去我的小店看看吧</text>
  319. <view class="shopcc dflex">
  320. <view class="shop" @tap="showShare">分享推广</view>
  321. <navigator :url="url" hover-class="none" class="shop" >我的小店</navigator>
  322. </view>
  323. <!-- <view class="share-btn dflex">
  324. <button class="wxfriend dflex" open-type="share">
  325. <image src="/static/pages/images/wechat.png"></image>
  326. 微信好友
  327. </button>
  328. <view class="wxposter dflex" @tap="generatePoster">
  329. <image src="/static/pages/images/poster.png"></image>
  330. 生成海报
  331. </view>
  332. </view> -->
  333. <image src="/static/pages/images/close2.png" class="suc-close" @tap="hidePop"></image>
  334. </view>
  335. <block v-if="isPopupLogin">
  336. <product-login :about="about" @hidePopupLogin="hidePopupLogin"></product-login>
  337. </block>
  338. </view>
  339. </template>
  340. <script>
  341. const app = getApp();
  342. const req = require("../../../utils/request.js");
  343. const utils = require("../../../utils/util.js");
  344. var QQMapWX = require("../../../utils/qqmap.js");
  345. const requsetmessage = require("../../../utils/requestmessage.js");
  346. const route = require("../../../utils/route");
  347. const api = require("../../../utils/api.js");
  348. import productFooter from "../../../components/product_footer/index";
  349. import productPopup from "../../../components/product-popup/index";
  350. import vShare from "../../../components/share/share";
  351. import productLogin from "../../../components/product-login/index";
  352. export default {
  353. data() {
  354. return {
  355. picUrlss: req.public.picUrls,
  356. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  357. swiperCurrent: 0,
  358. bannerUrls: [],
  359. isShow: false,
  360. pro: {},
  361. timer: [],
  362. isRemind: false,
  363. hideShare: true,
  364. codeUrl: '',
  365. start: false,
  366. activityPurchaseRecordListDTO: [],
  367. activityDot: [],
  368. act: {},
  369. isGroup: true,
  370. hideShop: true,
  371. //隐藏添加到小店
  372. isHide: true,
  373. //添加小店成功弹窗
  374. contentList: [{
  375. pic: "/static/pages/images/bar.png",
  376. name: '好风依旧',
  377. time: '4秒前'
  378. }, {
  379. pic: "/static/pages/images/bar.png",
  380. name: '杨鑫',
  381. time: '20秒前'
  382. }, {
  383. pic: "/static/pages/images/bar.png",
  384. name: '杨鑫',
  385. time: '5秒前'
  386. }],
  387. isNotice: false,
  388. form: {
  389. page: 1,
  390. limit: 10
  391. },
  392. freshen: true //是否更新页面
  393. ,
  394. current: "",
  395. query: "",
  396. merchant: "",
  397. merchantId: "",
  398. shopId: "",
  399. imgs: "",
  400. nodes: "",
  401. salePrice: "",
  402. activityEnd: false,
  403. isStates: 0,
  404. address: {},
  405. popup: "",
  406. myActData: "",
  407. count: "",
  408. show: false,
  409. tabIndex: "",
  410. guarantee: "",
  411. is_open_comments: "",
  412. switch: true,
  413. about: {},
  414. allShow: false,
  415. url:'',
  416. is_open_shop: '',//商户是否开启分销
  417. ascription: false,//是否开启小店
  418. isDistriUser: 0, // 判断用户是否是分销员 2为分销员
  419. isPopupLogin: false
  420. };
  421. },
  422. components: {
  423. productFooter,
  424. productPopup,
  425. vShare,
  426. productLogin
  427. },
  428. props: {},
  429. onLoad: function(options) {
  430. // console.log(options);
  431. this.query = options;
  432. this.setData({
  433. query: options
  434. });
  435. if (options.scene) {
  436. this.scene = options.scene;
  437. }
  438. if (options.isShare) {
  439. this.query.id = options.id;
  440. this.query.acid = options.acid;
  441. req.setStorage('pidCode', options.userId);
  442. req.setStorage('pidCode', options.userId);
  443. let params = {
  444. userId: options.userId,
  445. merchantId: options.merchantId ? options.merchantId : '',
  446. }
  447. this.bindUser(params);
  448. }
  449. if (options.hideShop) {
  450. this.setData({
  451. hideShop: this.query.hideShop
  452. });
  453. } else {
  454. this.setData({
  455. hideShop: 'true'
  456. });
  457. } // this.isShop()
  458. setInterval(() => {
  459. this.setData({
  460. isNotice: true
  461. });
  462. }, 10000);
  463. // this.getuserInfo()
  464. },
  465. onShow: async function() {
  466. let that = this
  467. if (this.freshen) {
  468. await this.loadCodeParams();
  469. if(that.scene){
  470. await that.bindUser(that.query);
  471. }
  472. // this.loadDefaultAddress();
  473. this.groupCount();
  474. this.getGuarantee().then(data => {
  475. if (this.switch) {
  476. api.getMerchant(this.query, req, data => {
  477. that.loadDefaultAddress();
  478. if (data == 1) {
  479. api.locationShow()
  480. } else {
  481. that.getuserInfos(data);
  482. if (data.type == 5) {
  483. that.query.merchantId = data.merchantDTO.id
  484. that.query.shopId = data.id
  485. } else {
  486. that.query.merchantId = data.id
  487. }
  488. if (req.getStorage('userInfo') && that.merchant.id != data.id) {
  489. this.loadProudct();
  490. let pages = getCurrentPages();
  491. var prevPage = pages[pages.length - 2];
  492. if (prevPage) {
  493. prevPage.$vm.setData({
  494. freshen: true
  495. });
  496. }
  497. } else {
  498. this.loadProudct();
  499. }
  500. that.merchant = data
  501. }
  502. })
  503. }
  504. })
  505. await this.browsRecound(this.query.id); // let merchant = req.getStorage('defaultMerchant');
  506. // this.setData({ merchant: merchant });
  507. // this.getMerchant();
  508. }
  509. },
  510. onUnload() {
  511. if (this.timer) clearInterval(this.timer);
  512. this.clearAllTimer();
  513. },
  514. onShareAppMessage: function() {
  515. let merchantId = '';
  516. let path = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid + '&isShare=' +
  517. true;
  518. // console.log(!req.getStorage('userInfo').id);
  519. if (!req.getStorage('userInfo').id) {} else {
  520. path += '&userId=' + req.getStorage('userInfo').id;
  521. }
  522. // console.log(this.query.merchantId);
  523. let shopId = '';
  524. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  525. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  526. merchantId = req.getStorage('MERCHANT').id;
  527. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  528. path += '&shopId=' + req.getStorage('smallShop').id;
  529. shopId = req.getStorage('smallShop').id;
  530. merchantId = req.getStorage('smallShop').merchantDTO.id;
  531. }
  532. }
  533. // console.log(path)
  534. route.share(1, req.getStorage('userInfo').id, path, merchantId, shopId, 7, this.query.acid + '_' + this
  535. .query.id);
  536. return {
  537. title: this.pro.title,
  538. imageUrl: this.pro.pic,
  539. path: path
  540. }; // return {
  541. // title: this.data.pro.title,
  542. // imageUrl: this.data.pro.pic,
  543. // path: 'activity/group/detail/detail?acid=' + this.query.acid + "&id=" + this.query.id + '&isShare=' + true + '&userId=' + req.getStorage('userInfo').id + '&merchantId=' + this.data.query.merchantId
  544. // // path: '/product/groupDetail/groupDetail?id=' + this.query.id + '&acid=' + this.query.acid + '&isShare=' + true + '&userId=' + req.getStorage('userInfo').id
  545. // }
  546. },
  547. onReachBottom() {
  548. if (this.is_open_comments == 1 && this.tabIndex == 2) {
  549. this.form.page++;
  550. this.setData({
  551. ['form.page']: this.form.page
  552. });
  553. // this.selectComponent("#list").loadScore(this.current);
  554. this.$refs.list.loadScore(this.current);
  555. }
  556. },
  557. onHide() {
  558. this.clearAllTimer();
  559. },
  560. methods: {
  561. bindUser(par){
  562. let userInfo = req.getStorage('userInfo');
  563. if(!userInfo){
  564. // uni.login({
  565. // success(res) {
  566. // let params = {
  567. // code: res.code,
  568. // parentId: par.userId,
  569. // merchantId: par.merchantId ? par.merchantId : par.shopId ? par.shopId : ''
  570. // }
  571. // return new Promise((resolve,reject)=>{
  572. // req.postRequest('/api/v2/login', params, data => {
  573. // resolve();
  574. // });
  575. // })
  576. // }
  577. // });
  578. // this.isPopupLogin = true;
  579. req.silenceLogin(par.userId, par.merchantId ? par.merchantId : par.shopId ? par.shopId : '');
  580. }
  581. },
  582. // 获取用户信息
  583. getuserInfo() {
  584. let userInfo = req.getStorage('userInfo');
  585. if (userInfo && userInfo.listShopBase && userInfo.listShopBase != null && userInfo.listShopBase.length >
  586. 0) {
  587. if (userInfo.listShopBase[0].merchant_id) {
  588. let url = '/mine/shop/shop?merchantId=' + userInfo.listShopBase[0].merchant_id + '&shopId=' +
  589. userInfo.listShopBase[
  590. 0].id;
  591. this.setData({
  592. url: url
  593. });
  594. }
  595. console.log(this.url)
  596. }
  597. },
  598. click(e) {
  599. // console.log(e)
  600. this.hideShare = e
  601. },
  602. showShare() {
  603. // #ifndef H5
  604. req.isLogin().then(success => {
  605. if (success) {
  606. this.setData({
  607. hideShare: false
  608. });
  609. this.getCodeUrl()
  610. }
  611. });
  612. // #endif
  613. },
  614. /**
  615. * 轮播切换
  616. */
  617. swiperChange({
  618. detail
  619. }) {
  620. if (this.current == 0 && this.swiperCurrent > 1) {
  621. //卡死时,重置current为正确索引
  622. this.setData({
  623. current: this.swiperCurrent
  624. });
  625. } else {
  626. //正常轮转时,记录正确页码索引
  627. this.setData({
  628. swiperCurrent: detail.current
  629. });
  630. }
  631. },
  632. dotEvent(e) {
  633. this.setData({
  634. current: e.currentTarget.dataset.current
  635. });
  636. },
  637. browsRecound(id) {
  638. let from = {
  639. bindId: id,
  640. type: 7,
  641. page: '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid
  642. };
  643. if (this.query.isShare) {
  644. from.shareType = 1;
  645. from.page = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid +
  646. '&isShare=' + true;
  647. if (!this.query.userId) {} else {
  648. from.page += '&userId=' + this.query.userId;
  649. }
  650. if (!this.query.merchantId) {} else {
  651. from.merchantId = this.query.merchantId;
  652. }
  653. if (!this.query.shopId) {} else {
  654. from.shopId = this.query.shopId;
  655. }
  656. if (!this.query.userId) {} else {
  657. from.uid = this.query.userId;
  658. }
  659. }
  660. if (this.query.isShareTimeline) {
  661. from.shareType = 2;
  662. from.page = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid +
  663. '&isShareTimeline=' +
  664. true;
  665. if (!this.query.userId) {} else {
  666. from.page += '&userId=' + this.query.userId;
  667. }
  668. if (!this.query.merchantId) {} else {
  669. from.merchantId = this.query.merchantId;
  670. }
  671. if (!this.query.shopId) {} else {
  672. from.shopId = this.query.shopId;
  673. }
  674. if (!this.query.userId) {} else {
  675. from.uid = this.query.userId;
  676. }
  677. }
  678. return new Promise((resolve,reject)=>{
  679. req.postRequest('/api/browse', from, data => {resolve()});
  680. })
  681. },
  682. loadCodeParams() {
  683. let _ts = this;
  684. return new Promise((resolve, reject) => {
  685. if (!_ts.scene) {
  686. resolve();
  687. return false;
  688. }
  689. req.getRequest('/api/code/params', {
  690. scene: _ts.scene
  691. }, data => {
  692. this.query.id = data.scene.split('_')[0];
  693. this.query.acid = data.scene.split('_')[1];
  694. this.query.merchantId = data.scene.split('_')[2];
  695. this.query.shopId = data.scene.split('_')[3];
  696. this.query.userId = data.userId;
  697. req.setStorage('pidCode', data.userId);
  698. resolve();
  699. });
  700. });
  701. },
  702. getCodeUrl() {
  703. let that = this; //获取小程序码
  704. const query = this.query;
  705. let scene = that.pro.id + '_' + query.acid;
  706. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  707. scene += '_' + req.getStorage('MERCHANT').id;
  708. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  709. scene += '_' + req.getStorage('smallShop').id;
  710. }
  711. }
  712. // console.log(scene); //获取小程序码
  713. const params = {
  714. page: 'activity/group/detail/detail',
  715. scene: scene
  716. };
  717. req.getRequest('/api/program/codev', params, url => {
  718. that.setData({
  719. codeUrl: url
  720. });
  721. });
  722. },
  723. async loadProudct() {
  724. let that = this;
  725. await that.loadActivity();
  726. const query = that.query;
  727. let isShowLoading = false;
  728. if (!isShowLoading) {
  729. req.loadIng('加载中');
  730. isShowLoading = true;
  731. }
  732. req.getRequest('/api/product/detail', {
  733. id: query.id
  734. }, data => {
  735. //富文本图片放大
  736. var nodes = data.detail;
  737. // if (nodes) {
  738. // if (nodes.indexOf("src") >= 0) {
  739. // //正则匹配所有图片路径
  740. // var imgs = [];
  741. // nodes = nodes.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
  742. // imgs.push(capture);
  743. // that.setData({
  744. // imgs: imgs
  745. // });
  746. // return '';
  747. // });
  748. // }
  749. // }
  750. let propertiesList = []
  751. if (data.propertiesList && data.propertiesList.length > 0) {
  752. data.propertiesList.map(it => {
  753. propertiesList.push(it.value);
  754. })
  755. }
  756. data.properties = propertiesList.join(' / ')
  757. that.setData({
  758. bannerUrls: data.images,
  759. pro: data,
  760. nodes: nodes,
  761. // 'pro.stock': this.act.quantity,
  762. 'pro.stock': this.act.quantity - this.act.payQuantity,
  763. salePrice: data.salePrice,
  764. 'pro.payQuantity': this.act.payQuantity,
  765. 'pro.maxBuy': this.act.maxBuy,
  766. 'pro.salePrice': this.act.money,
  767. allShow: true
  768. });
  769. if (isShowLoading) {
  770. uni.hideLoading();
  771. isShowLoading = false;
  772. }
  773. // console.log(this.pro);
  774. // that.getCodeUrl();
  775. });
  776. },
  777. loadActivity() {
  778. const query = this.query;
  779. return new Promise((resolve, reject) => {
  780. let from = {
  781. id: query.acid,
  782. type: 3
  783. }
  784. if (!this.query.merchantId) {} else {
  785. from.merchantId = this.query.merchantId
  786. }
  787. let userInfo = req.getStorage('userInfo');
  788. if(userInfo.listShopBase && userInfo.listShopBase.length >0 ){
  789. from.shopId = userInfo.listShopBase[0].id;
  790. }
  791. req.getRequest('/api/activity/detailNew', from, data => {
  792. /**
  793. * 判断活动是否结束,结束,2秒后为用户跳转至该商品的详情页面
  794. */
  795. // if (data.end) {
  796. // this.setData({ start: data.end })
  797. // console.log(this.data.start)
  798. // wx.showToast({
  799. // title: '活动已结束,两秒后将为您跳转至该商品页面',
  800. // icon: 'none',
  801. // success: function () {
  802. // setTimeout(function () {
  803. // wx.redirectTo({ url: '/product/detail/detail?id=' + data.productId })
  804. // }, 2000);
  805. // }
  806. // })
  807. // }
  808. // data.activityPurchaseRecordListDTO.content(data.activityPurchaseRecordListDTO)
  809. // let arr=data.activityPurchaseRecordListDTO.filter(ele=>console.log(ele))
  810. this.getMy();
  811. if (!data || data == 2001) {
  812. this.setData({
  813. activityEnd: true
  814. });
  815. return false;
  816. } else {
  817. let activityPurchaseRecordListDTO;
  818. let arr;
  819. if (data.activityPurchaseRecordListDTO) {
  820. activityPurchaseRecordListDTO = data.activityPurchaseRecordListDTO.slice(0,
  821. 2);
  822. arr = data.activityPurchaseRecordListDTO.slice(0, 21);
  823. // console.log(arr,"789");
  824. }
  825. // console.log(data.activityPurchaseRecordListDTO);
  826. this.setData({
  827. act: data,
  828. isRemind: data.remindId
  829. });
  830. this.setData({
  831. activityPurchaseRecordListDTO: activityPurchaseRecordListDTO,
  832. activityDot: arr
  833. });
  834. // console.log(this.activityPurchaseRecordListDTO, this
  835. // .activityPurchaseRecordListDTO);
  836. this.checkMyIsGroup();
  837. this.initTimer(data);
  838. this.groupItemTimer(1);
  839. this.groupItemTimer();
  840. }
  841. resolve();
  842. });
  843. });
  844. },
  845. // 获取用户信息
  846. getuserInfos(data) {
  847. let userInfo = req.getStorage('userInfo');
  848. if (userInfo && userInfo.listShopBase && userInfo.listShopBase != null && userInfo.listShopBase.length >
  849. 0) {
  850. if (userInfo.listShopBase[0].merchant_id == data.id && data.type != 5) {
  851. let url = '/mine/shop/shop?merchantId=' + userInfo.listShopBase[0].merchant_id + '&shopId=' + userInfo.listShopBase[0].id;
  852. this.url = url;
  853. this.ascription = true;
  854. }
  855. }
  856. },
  857. getMy() {
  858. let that = this;
  859. let userInfo = req.getStorage('userInfo');
  860. if(!userInfo || userInfo == null) return false;
  861. req.getRequest('/api/user/my', {}, data => {
  862. that.isDistriUser = data.isDistriUser;
  863. });
  864. },
  865. //组团倒计时
  866. groupItemTimer(type) {
  867. // this.clearAllTimer();
  868. //社区拼图定时器
  869. let _ts = this;
  870. let group;
  871. if (type == 1) {
  872. group = this.activityPurchaseRecordListDTO;
  873. } else {
  874. group = this.activityDot;
  875. }
  876. if (group && group.length > 0) {
  877. let pageList = group;
  878. for (let i = 0, len = pageList.length; i < len; i++) {
  879. let group = pageList[i]; // let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
  880. let nowTime = new Date(this.act.nowTime.replace(/-/g, '/')).getTime();
  881. let endTime = new Date(group.endDate.replace(/-/g, '/'))
  882. .getTime(); // let actend=new Date(this.data.act.endTime.replace(/-/g, '/')).getTime();
  883. // if (!group.start) endTime = startTime;
  884. // let times
  885. // if(actend-endTime>0){
  886. // times = parseInt((endTime - nowTime) / 1000);
  887. // }else{
  888. // times = parseInt((actend - nowTime) / 1000);
  889. // }
  890. let times = parseInt((endTime - nowTime) / 1000);
  891. let timer = setInterval(() => {
  892. times--;
  893. let data = {};
  894. if (times < 0) {
  895. if (type == 1) {
  896. data['activityPurchaseRecordListDTO[' + i + '].isGroup'] = false;
  897. } else {
  898. data['activityDot[' + i + '].isGroup'] = false;
  899. } // this.setData({isGroup:false})
  900. } else if (times === 0) {
  901. //重新加载列表
  902. clearInterval(timer);
  903. } else {
  904. let n = utils.formatDayTimes(times);
  905. if (type == 1) {
  906. data['activityPurchaseRecordListDTO[' + i + '].times'] = n;
  907. data['activityPurchaseRecordListDTO[' + i + '].isGroup'] = true;
  908. } else {
  909. data['activityDot[' + i + '].times'] = n;
  910. data['activityDot[' + i + '].isGroup'] = true;
  911. }
  912. }
  913. _ts.setData(data);
  914. }, 1000);
  915. let fs = [];
  916. if (type == 1) {
  917. fs['activityPurchaseRecordListDTO[' + i + '].timer'] = timer;
  918. } else {
  919. fs['activityDot[' + i + '].timer'] = timer;
  920. }
  921. _ts.setData(fs);
  922. }
  923. }
  924. },
  925. clearAllTimer() {
  926. if (this.activityPurchaseRecordListDTO) {
  927. this.activityPurchaseRecordListDTO.forEach(it => {
  928. // console.log(it);
  929. clearInterval(it.timer);
  930. clearInterval(it.times);
  931. });
  932. }
  933. if (this.activityDot) {
  934. this.activityDot.forEach(it => {
  935. // console.log(it);
  936. clearInterval(it.timer);
  937. clearInterval(it.times);
  938. });
  939. }
  940. },
  941. initTimer(group) {
  942. //计时器
  943. let _ts = this;
  944. let nowTime = new Date(group.nowTime.replace(/-/g, '/')).getTime();
  945. let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
  946. let endTime = new Date(group.endTime.replace(/-/g, '/')).getTime();
  947. if (!group.start) endTime = startTime;
  948. let times = parseInt((endTime - nowTime) / 1000);
  949. let data = {}; //判断是否已开始
  950. if (nowTime - startTime > 0) {
  951. //开始了
  952. _ts.setData({
  953. isStates: 1
  954. });
  955. } else {
  956. //未开始
  957. _ts.setData({
  958. isStates: 0
  959. });
  960. }
  961. _ts.setData(data);
  962. if (times > 0) {
  963. this.timer = setInterval(() => {
  964. times--;
  965. if (times === 0) {
  966. //重新加载列表
  967. _ts.setData({
  968. 'act.end': true
  969. });
  970. return false;
  971. }
  972. let n = utils.formatDayTimes(times);
  973. _ts.setData({
  974. timer: n.split(/:|天/g)
  975. });
  976. }, 1000);
  977. } else {
  978. _ts.setData({
  979. isStates: 2
  980. });
  981. }
  982. },
  983. loadDefaultAddress() {
  984. if (req.isAuth()) {
  985. req.g('/api/address/default', data => {
  986. if (data) this.setData({
  987. address: data
  988. });
  989. else this.pointLocation();
  990. }, true);
  991. } else {
  992. this.pointLocation();
  993. }
  994. },
  995. toAddress() {
  996. app.globalData.openPage('mine/address/address');
  997. },
  998. toMerchant() {
  999. if (this.about.User_Limit_Store == 1) {
  1000. } else {
  1001. app.globalData.openPage('pages/nearby/nearby?isChoose=true');
  1002. }
  1003. },
  1004. pointLocation() {
  1005. //定位当前位置
  1006. let _ts = this;
  1007. QQMapWX.initMap();
  1008. req.getLocation(res => {
  1009. QQMapWX.reverseGeocoder(res, data => {
  1010. _ts.setData({
  1011. ['address.address']: data.address
  1012. });
  1013. });
  1014. });
  1015. },
  1016. atOnceBuy() {
  1017. //立即购买
  1018. // console.log("立即购买"); // if (this.data.isStates == 0) return req.msg('活动还未开始');
  1019. // if (this.data.isStates == 2) return req.msg('活动已结束');
  1020. // if (this.data.start) return req.msg('活动已结束');
  1021. let popup = this.pro;
  1022. popup.salePrice = this.salePrice;
  1023. popup.stock = this.pro.stock;
  1024. this.setData({
  1025. isShow: true,
  1026. popup: popup
  1027. });
  1028. },
  1029. //创建拼团
  1030. createGroup() {
  1031. req.isLogin().then(success => {});
  1032. if (!req.getStorage('userInfo')) return false;
  1033. // console.log(this.start);
  1034. if (this.start) return req.msg(
  1035. '活动已结束'); //state 1存在记录,2不存在,id创建团时存在则为已创建过团记录id,未创建则为-1 参与团id返回为传入的superiorId
  1036. if (this.myActData.state == 1) {
  1037. //存在拼团记录
  1038. this.jumpGoGroup(this.myActData.id);
  1039. } else {
  1040. //不存在,去创建
  1041. req.postRequest('/api/activity/carterActivityPurchaseRecords', {
  1042. acpId: this.act.id,
  1043. type: 3
  1044. }, res => {
  1045. // this.jumpGoGroup(res);
  1046. // this.atOnceBuy(res)
  1047. this.createGroupOrder(res);
  1048. });
  1049. }
  1050. },
  1051. createGroupOrder(aprId) {
  1052. const params = {
  1053. skuId: this.act.skuId,
  1054. quantity: 1,
  1055. productId: this.act.productId,
  1056. aprId: aprId
  1057. };
  1058. if (this.merchant && this.merchant.type != 5) {
  1059. params.merchantId = this.merchant.id;
  1060. }
  1061. if (this.merchant && this.merchant.type == 5) {
  1062. params.merchantId = this.merchant.merchantDTO.id
  1063. params.shopId = this.merchant.id;
  1064. }
  1065. if (this.act.id) params.activityId = this.act.id;
  1066. req.postRequest('/api/purchase/direct/buy', params, res => {
  1067. let redirect = '/product/subOrder/subOrder?ids=' + res;
  1068. redirect += '&orderType=' + 4;
  1069. redirect += '&aprId=' + aprId;
  1070. redirect += '&activityId=' + this.act.id;
  1071. if (params.merchantId) {
  1072. redirect += '&merchantId=' + params.merchantId;
  1073. }
  1074. if (params.shopId) {
  1075. redirect += '&shopId=' + params.shopId;
  1076. }
  1077. uni.navigateTo({
  1078. url: redirect
  1079. });
  1080. });
  1081. },
  1082. //校验是否开团
  1083. checkMyIsGroup() {
  1084. req.getRequest('/api/activity/participationActivity', {
  1085. acpId: this.act.id,
  1086. actId: this.act.actId,
  1087. productId: this.act.productId,
  1088. type: 3,
  1089. initOrPart: 1
  1090. }, res => {
  1091. this.setData({
  1092. myActData: res
  1093. });
  1094. });
  1095. },
  1096. toGoGroup(event) {
  1097. // req.isLogin().then(success => {
  1098. // })
  1099. const index = event.currentTarget.dataset.index;
  1100. const type = event.currentTarget.dataset.type;
  1101. let activityPurchaseRecord;
  1102. if (type == 1) {
  1103. activityPurchaseRecord = this.activityDot[index];
  1104. } else {
  1105. activityPurchaseRecord = this.activityPurchaseRecordListDTO[index];
  1106. }
  1107. // console.log(index, activityPurchaseRecord, type);
  1108. this.jumpGoGroup(activityPurchaseRecord.id);
  1109. },
  1110. //跳入到平团详情
  1111. jumpGoGroup(groupId) {
  1112. app.globalData.openPage('activity/group/ptDetail/ptDetail?acid=' + this.act.id + "&id=" + groupId +
  1113. "&merchantId=" +
  1114. this.query.merchantId);
  1115. },
  1116. addActivityRemind() {
  1117. req.postRequest('/api/activity/remind', {
  1118. activityId: this.act.id
  1119. }, res => {
  1120. requsetmessage.remind();
  1121. req.msg('订阅提醒成功');
  1122. this.setData({
  1123. isRemind: true
  1124. });
  1125. });
  1126. },
  1127. cancelActivityRemind(event) {
  1128. if (req.header.appId == 'ZQ1VK5oc17I387E') {
  1129. } else {
  1130. req.postRequest('/api/activity/cancel/remind', {
  1131. id: this.act.id
  1132. }, res => {
  1133. req.msg('取消提醒成功');
  1134. this.setData({
  1135. isRemind: false
  1136. });
  1137. });
  1138. }
  1139. },
  1140. hidePopup() {
  1141. this.setData({
  1142. isShow: false
  1143. });
  1144. },
  1145. hidePopupLogin(data) {
  1146. this.isPopupLogin = false;
  1147. },
  1148. clickCollect() {
  1149. let _ts = this;
  1150. req.postRequest('/api/collect', {
  1151. bindId: this.pro.id,
  1152. type: 1
  1153. }, data => {
  1154. _ts.setData({
  1155. 'pro.isCollect': !_ts.pro.isCollect
  1156. });
  1157. });
  1158. },
  1159. goTop: function(e) {
  1160. // 一键回到顶部
  1161. if (uni.pageScrollTo) {
  1162. uni.pageScrollTo({
  1163. scrollTop: 0
  1164. });
  1165. } else {
  1166. uni.showModal({
  1167. title: '提示',
  1168. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  1169. });
  1170. }
  1171. },
  1172. onShareTimeline() {
  1173. let merchantId = '';
  1174. let path = 'id=' + this.query.id + '&acid=' + this.query.acid + '&isShareTimeline=' + true;
  1175. if (!req.getStorage('userInfo').id) {} else {
  1176. path += '&userId=' + req.getStorage('userInfo').id;
  1177. }
  1178. let shopId = '';
  1179. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  1180. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  1181. merchantId = req.getStorage('MERCHANT').id;
  1182. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  1183. path += '&shopId=' + req.getStorage('smallShop').id;
  1184. shopId = req.getStorage('smallShop').id;
  1185. merchantId = req.getStorage('smallShop').merchantDTO.id;
  1186. }
  1187. }
  1188. let url = '/activity/group/detail/detail?' + path;
  1189. route.share(2, req.getStorage('userInfo').id, url, merchantId, shopId, 7, this.query.acid + '_' + this
  1190. .query.id);
  1191. return {
  1192. title: (req.getStorage("userInfo").nickName ? req.getStorage("userInfo").nickName : '') + '邀请您参加拼团:' +
  1193. this.pro.title,
  1194. query: path,
  1195. imageUrl: this.pro.pic
  1196. }; // return {
  1197. // title: this.data.pro.title,
  1198. // imageUrl: this.data.pro.pic
  1199. // }
  1200. },
  1201. // 获取参团活动总人数
  1202. groupCount() {
  1203. let param = {
  1204. aprId: this.query.acid
  1205. };
  1206. req.getRequest('/api/activity/groupCount', param, data => {
  1207. this.setData({
  1208. count: data
  1209. });
  1210. });
  1211. },
  1212. // 是否开启小店
  1213. isShop() {
  1214. if (req.getStorage('distribution')) {
  1215. dist = req.getStorage('distribution')
  1216. this.setData({
  1217. distr: dist
  1218. })
  1219. console.log(dist)
  1220. if (dist.distributionSmallShopOpen == 1) {
  1221. req.postRequest('/api/shopBase/isOpenShop', {}, data => {
  1222. this.setData({
  1223. isshop: data
  1224. })
  1225. console.log(data)
  1226. })
  1227. }
  1228. }
  1229. },
  1230. addShop() { //添加到小店
  1231. req.postRequest('/api/shopProduct/save', {
  1232. productId: this.act.id,
  1233. type: 4
  1234. }, data => {
  1235. this.act.isJoinShop = true;
  1236. this.isHide = false;
  1237. })
  1238. },
  1239. hidePop() { //添加到小店
  1240. this.setData({
  1241. isHide: true
  1242. })
  1243. },
  1244. clickmore() {
  1245. // let arrayShow = [];
  1246. // let index = 0;
  1247. // for (let i = index; i < index + 5; i++) {
  1248. // if (this.data.activityPurchaseRecordListDTO[i]) {
  1249. // arrayShow.push(this.data.activityPurchaseRecordListDTO[i]);
  1250. // index = i;
  1251. // }
  1252. // }
  1253. // index = index + 1;
  1254. // if(arrayShow.length>=20){
  1255. // return req.msg("仅显示20个正在拼团的人")
  1256. // }
  1257. // this.setData({arrayShow:arrayShow})
  1258. // this.groupItemTimer()
  1259. // console.log("123",this.activityDot)
  1260. this.getPage();
  1261. this.setData({
  1262. show: true
  1263. });
  1264. },
  1265. eliminate() {
  1266. this.setData({
  1267. show: false
  1268. });
  1269. },
  1270. getPage() {
  1271. //获取系统信息:获取当前屏幕可见区域的宽和高
  1272. let that = this;
  1273. uni.getSystemInfo({
  1274. success: function(res) {
  1275. that.setData({
  1276. "windowWidth": res.windowWidth,
  1277. //可使用窗口宽度,单位px
  1278. "windowHeight": res.windowHeight //可使用窗口高度,单位px
  1279. });
  1280. // console.log(res.windowWidth, that.windowWidth);
  1281. // console.log(res.windowHeight, that.windowHeight);
  1282. }
  1283. });
  1284. },
  1285. showTab: function(e) {
  1286. this.setData({
  1287. tabIndex: e.detail
  1288. });
  1289. },
  1290. scoreTab: function(e) {
  1291. this.form.page = 0;
  1292. this.setData({
  1293. current: e.detail,
  1294. ['form.page']: 1
  1295. });
  1296. },
  1297. freshenFun: function(e) {
  1298. this.setData({
  1299. freshen: e.detail
  1300. });
  1301. },
  1302. // 获取品种保证
  1303. getGuarantee() {
  1304. return new Promise((data, rej) => {
  1305. req.getRequest('/api/config', {}, res => {
  1306. req.setStorage("configRes", JSON.stringify(res))
  1307. this.about = res
  1308. data(res)
  1309. if (this.merchant && this.merchant.isDefault == 1 || this.query.acid) {
  1310. // 切割;拿到数组,然后在过滤掉空值
  1311. if (res.b2c_service_guarantee && res.b2c_service_guarantee != null) {
  1312. this.setData({
  1313. guarantee: res.b2c_service_guarantee.split(";").filter(it => {
  1314. return it = it && it.trim();
  1315. })
  1316. });
  1317. }
  1318. } else {
  1319. if (res.o2o_service_guarantee && res.b2c_service_guarantee != null) {
  1320. this.setData({
  1321. guarantee: res.o2o_service_guarantee.split(";").filter(it => {
  1322. return it = it && it.trim();
  1323. })
  1324. });
  1325. }
  1326. } // if(res.Is_Store_Price_Stock){
  1327. // this.setData({Is_Store_Price_Stock:res.Is_Store_Price_Stock})
  1328. // }
  1329. if (res.is_open_shop) {
  1330. this.is_open_shop = res.is_open_shop;
  1331. }
  1332. if (res.is_open_comments) {
  1333. this.setData({
  1334. is_open_comments: res.is_open_comments
  1335. });
  1336. } // this.setData({ show_membership_price: res.show_membership_price, Is_Store_Price_Stock: res.Is_Store_Price_Stock, is_open_shop: res.is_open_shop })
  1337. });
  1338. })
  1339. }
  1340. }
  1341. };
  1342. </script>
  1343. <style>
  1344. @import "./detail.css";
  1345. </style>