detail.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470
  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="/static/pages/images/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. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  356. swiperCurrent: 0,
  357. bannerUrls: [],
  358. isShow: false,
  359. pro: {},
  360. timer: [],
  361. isRemind: false,
  362. hideShare: true,
  363. codeUrl: '',
  364. start: false,
  365. activityPurchaseRecordListDTO: [],
  366. activityDot: [],
  367. act: {},
  368. isGroup: true,
  369. hideShop: true,
  370. //隐藏添加到小店
  371. isHide: true,
  372. //添加小店成功弹窗
  373. contentList: [{
  374. pic: "/static/pages/images/bar.png",
  375. name: '好风依旧',
  376. time: '4秒前'
  377. }, {
  378. pic: "/static/pages/images/bar.png",
  379. name: '杨鑫',
  380. time: '20秒前'
  381. }, {
  382. pic: "/static/pages/images/bar.png",
  383. name: '杨鑫',
  384. time: '5秒前'
  385. }],
  386. isNotice: false,
  387. form: {
  388. page: 1,
  389. limit: 10
  390. },
  391. freshen: true //是否更新页面
  392. ,
  393. current: "",
  394. query: "",
  395. merchant: "",
  396. merchantId: "",
  397. shopId: "",
  398. imgs: "",
  399. nodes: "",
  400. salePrice: "",
  401. activityEnd: false,
  402. isStates: 0,
  403. address: {},
  404. popup: "",
  405. myActData: "",
  406. count: "",
  407. show: false,
  408. tabIndex: "",
  409. guarantee: "",
  410. is_open_comments: "",
  411. switch: true,
  412. about: {},
  413. allShow: false,
  414. url:'',
  415. is_open_shop: '',//商户是否开启分销
  416. ascription: false,//是否开启小店
  417. isDistriUser: 0, // 判断用户是否是分销员 2为分销员
  418. isPopupLogin: false
  419. };
  420. },
  421. components: {
  422. productFooter,
  423. productPopup,
  424. vShare,
  425. productLogin
  426. },
  427. props: {},
  428. onLoad: function(options) {
  429. // console.log(options);
  430. this.query = options;
  431. this.setData({
  432. query: options
  433. });
  434. if (options.scene) {
  435. this.scene = options.scene;
  436. }
  437. if (options.isShare) {
  438. this.query.id = options.id;
  439. this.query.acid = options.acid;
  440. req.setStorage('pidCode', options.userId);
  441. req.setStorage('pidCode', options.userId);
  442. let params = {
  443. userId: options.userId,
  444. merchantId: options.merchantId ? options.merchantId : '',
  445. }
  446. this.bindUser(params);
  447. }
  448. if (options.hideShop) {
  449. this.setData({
  450. hideShop: this.query.hideShop
  451. });
  452. } else {
  453. this.setData({
  454. hideShop: 'true'
  455. });
  456. } // this.isShop()
  457. setInterval(() => {
  458. this.setData({
  459. isNotice: true
  460. });
  461. }, 10000);
  462. // this.getuserInfo()
  463. },
  464. onShow: async function() {
  465. let that = this
  466. if (this.freshen) {
  467. await this.loadCodeParams();
  468. if(that.scene){
  469. await that.bindUser(that.query);
  470. }
  471. // this.loadDefaultAddress();
  472. this.groupCount();
  473. this.getGuarantee().then(data => {
  474. if (this.switch) {
  475. api.getMerchant(this.query, req, data => {
  476. that.loadDefaultAddress();
  477. if (data == 1) {
  478. api.locationShow()
  479. } else {
  480. that.getuserInfos(data);
  481. if (data.type == 5) {
  482. that.query.merchantId = data.merchantDTO.id
  483. that.query.shopId = data.id
  484. } else {
  485. that.query.merchantId = data.id
  486. }
  487. if (req.getStorage('userInfo') && that.merchant.id != data.id) {
  488. this.loadProudct();
  489. let pages = getCurrentPages();
  490. var prevPage = pages[pages.length - 2];
  491. if (prevPage) {
  492. prevPage.$vm.setData({
  493. freshen: true
  494. });
  495. }
  496. } else {
  497. this.loadProudct();
  498. }
  499. that.merchant = data
  500. }
  501. })
  502. }
  503. })
  504. await this.browsRecound(this.query.id); // let merchant = req.getStorage('defaultMerchant');
  505. // this.setData({ merchant: merchant });
  506. // this.getMerchant();
  507. }
  508. },
  509. onUnload() {
  510. if (this.timer) clearInterval(this.timer);
  511. this.clearAllTimer();
  512. },
  513. onShareAppMessage: function() {
  514. let merchantId = '';
  515. let path = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid + '&isShare=' +
  516. true;
  517. // console.log(!req.getStorage('userInfo').id);
  518. if (!req.getStorage('userInfo').id) {} else {
  519. path += '&userId=' + req.getStorage('userInfo').id;
  520. }
  521. // console.log(this.query.merchantId);
  522. let shopId = '';
  523. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  524. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  525. merchantId = req.getStorage('MERCHANT').id;
  526. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  527. path += '&shopId=' + req.getStorage('smallShop').id;
  528. shopId = req.getStorage('smallShop').id;
  529. merchantId = req.getStorage('smallShop').merchantDTO.id;
  530. }
  531. }
  532. // console.log(path)
  533. route.share(1, req.getStorage('userInfo').id, path, merchantId, shopId, 7, this.query.acid + '_' + this
  534. .query.id);
  535. return {
  536. title: this.pro.title,
  537. imageUrl: this.pro.pic,
  538. path: path
  539. }; // return {
  540. // title: this.data.pro.title,
  541. // imageUrl: this.data.pro.pic,
  542. // 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
  543. // // path: '/product/groupDetail/groupDetail?id=' + this.query.id + '&acid=' + this.query.acid + '&isShare=' + true + '&userId=' + req.getStorage('userInfo').id
  544. // }
  545. },
  546. onReachBottom() {
  547. if (this.is_open_comments == 1 && this.tabIndex == 2) {
  548. this.form.page++;
  549. this.setData({
  550. ['form.page']: this.form.page
  551. });
  552. // this.selectComponent("#list").loadScore(this.current);
  553. this.$refs.list.loadScore(this.current);
  554. }
  555. },
  556. onHide() {
  557. this.clearAllTimer();
  558. },
  559. methods: {
  560. bindUser(par){
  561. let userInfo = req.getStorage('userInfo');
  562. if(!userInfo){
  563. // uni.login({
  564. // success(res) {
  565. // let params = {
  566. // code: res.code,
  567. // parentId: par.userId,
  568. // merchantId: par.merchantId ? par.merchantId : par.shopId ? par.shopId : ''
  569. // }
  570. // return new Promise((resolve,reject)=>{
  571. // req.postRequest('/api/v2/login', params, data => {
  572. // resolve();
  573. // });
  574. // })
  575. // }
  576. // });
  577. // this.isPopupLogin = true;
  578. req.silenceLogin(par.userId, par.merchantId ? par.merchantId : par.shopId ? par.shopId : '');
  579. }
  580. },
  581. // 获取用户信息
  582. getuserInfo() {
  583. let userInfo = req.getStorage('userInfo');
  584. if (userInfo && userInfo.listShopBase && userInfo.listShopBase != null && userInfo.listShopBase.length >
  585. 0) {
  586. if (userInfo.listShopBase[0].merchant_id) {
  587. let url = '/mine/shop/shop?merchantId=' + userInfo.listShopBase[0].merchant_id + '&shopId=' +
  588. userInfo.listShopBase[
  589. 0].id;
  590. this.setData({
  591. url: url
  592. });
  593. }
  594. console.log(this.url)
  595. }
  596. },
  597. click(e) {
  598. // console.log(e)
  599. this.hideShare = e
  600. },
  601. showShare() {
  602. // #ifndef H5
  603. req.isLogin().then(success => {
  604. if (success) {
  605. this.setData({
  606. hideShare: false
  607. });
  608. this.getCodeUrl()
  609. }
  610. });
  611. // #endif
  612. },
  613. /**
  614. * 轮播切换
  615. */
  616. swiperChange({
  617. detail
  618. }) {
  619. if (this.current == 0 && this.swiperCurrent > 1) {
  620. //卡死时,重置current为正确索引
  621. this.setData({
  622. current: this.swiperCurrent
  623. });
  624. } else {
  625. //正常轮转时,记录正确页码索引
  626. this.setData({
  627. swiperCurrent: detail.current
  628. });
  629. }
  630. },
  631. dotEvent(e) {
  632. this.setData({
  633. current: e.currentTarget.dataset.current
  634. });
  635. },
  636. browsRecound(id) {
  637. let from = {
  638. bindId: id,
  639. type: 7,
  640. page: '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid
  641. };
  642. if (this.query.isShare) {
  643. from.shareType = 1;
  644. from.page = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid +
  645. '&isShare=' + true;
  646. if (!this.query.userId) {} else {
  647. from.page += '&userId=' + this.query.userId;
  648. }
  649. if (!this.query.merchantId) {} else {
  650. from.merchantId = this.query.merchantId;
  651. }
  652. if (!this.query.shopId) {} else {
  653. from.shopId = this.query.shopId;
  654. }
  655. if (!this.query.userId) {} else {
  656. from.uid = this.query.userId;
  657. }
  658. }
  659. if (this.query.isShareTimeline) {
  660. from.shareType = 2;
  661. from.page = '/activity/group/detail/detail?id=' + this.query.id + '&acid=' + this.query.acid +
  662. '&isShareTimeline=' +
  663. true;
  664. if (!this.query.userId) {} else {
  665. from.page += '&userId=' + this.query.userId;
  666. }
  667. if (!this.query.merchantId) {} else {
  668. from.merchantId = this.query.merchantId;
  669. }
  670. if (!this.query.shopId) {} else {
  671. from.shopId = this.query.shopId;
  672. }
  673. if (!this.query.userId) {} else {
  674. from.uid = this.query.userId;
  675. }
  676. }
  677. return new Promise((resolve,reject)=>{
  678. req.postRequest('/api/browse', from, data => {resolve()});
  679. })
  680. },
  681. loadCodeParams() {
  682. let _ts = this;
  683. return new Promise((resolve, reject) => {
  684. if (!_ts.scene) {
  685. resolve();
  686. return false;
  687. }
  688. req.getRequest('/api/code/params', {
  689. scene: _ts.scene
  690. }, data => {
  691. this.query.id = data.scene.split('_')[0];
  692. this.query.acid = data.scene.split('_')[1];
  693. this.query.merchantId = data.scene.split('_')[2];
  694. this.query.shopId = data.scene.split('_')[3];
  695. this.query.userId = data.userId;
  696. req.setStorage('pidCode', data.userId);
  697. resolve();
  698. });
  699. });
  700. },
  701. getCodeUrl() {
  702. let that = this; //获取小程序码
  703. const query = this.query;
  704. let scene = that.pro.id + '_' + query.acid;
  705. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  706. scene += '_' + req.getStorage('MERCHANT').id;
  707. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  708. scene += '_' + req.getStorage('smallShop').id;
  709. }
  710. }
  711. // console.log(scene); //获取小程序码
  712. const params = {
  713. page: 'activity/group/detail/detail',
  714. scene: scene
  715. };
  716. req.getRequest('/api/program/codev', params, url => {
  717. that.setData({
  718. codeUrl: url
  719. });
  720. });
  721. },
  722. async loadProudct() {
  723. let that = this;
  724. await that.loadActivity();
  725. const query = that.query;
  726. let isShowLoading = false;
  727. if (!isShowLoading) {
  728. req.loadIng('加载中');
  729. isShowLoading = true;
  730. }
  731. req.getRequest('/api/product/detail', {
  732. id: query.id
  733. }, data => {
  734. //富文本图片放大
  735. var nodes = data.detail;
  736. // if (nodes) {
  737. // if (nodes.indexOf("src") >= 0) {
  738. // //正则匹配所有图片路径
  739. // var imgs = [];
  740. // nodes = nodes.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
  741. // imgs.push(capture);
  742. // that.setData({
  743. // imgs: imgs
  744. // });
  745. // return '';
  746. // });
  747. // }
  748. // }
  749. let propertiesList = []
  750. if (data.propertiesList && data.propertiesList.length > 0) {
  751. data.propertiesList.map(it => {
  752. propertiesList.push(it.value);
  753. })
  754. }
  755. data.properties = propertiesList.join(' / ')
  756. that.setData({
  757. bannerUrls: data.images,
  758. pro: data,
  759. nodes: nodes,
  760. // 'pro.stock': this.act.quantity,
  761. 'pro.stock': this.act.quantity - this.act.payQuantity,
  762. salePrice: data.salePrice,
  763. 'pro.payQuantity': this.act.payQuantity,
  764. 'pro.maxBuy': this.act.maxBuy,
  765. 'pro.salePrice': this.act.money,
  766. allShow: true
  767. });
  768. if (isShowLoading) {
  769. uni.hideLoading();
  770. isShowLoading = false;
  771. }
  772. // console.log(this.pro);
  773. // that.getCodeUrl();
  774. });
  775. },
  776. loadActivity() {
  777. const query = this.query;
  778. return new Promise((resolve, reject) => {
  779. let from = {
  780. id: query.acid,
  781. type: 3
  782. }
  783. if (!this.query.merchantId) {} else {
  784. from.merchantId = this.query.merchantId
  785. }
  786. let userInfo = req.getStorage('userInfo');
  787. if(userInfo.listShopBase && userInfo.listShopBase.length >0 ){
  788. from.shopId = userInfo.listShopBase[0].id;
  789. }
  790. req.getRequest('/api/activity/detailNew', from, data => {
  791. /**
  792. * 判断活动是否结束,结束,2秒后为用户跳转至该商品的详情页面
  793. */
  794. // if (data.end) {
  795. // this.setData({ start: data.end })
  796. // console.log(this.data.start)
  797. // wx.showToast({
  798. // title: '活动已结束,两秒后将为您跳转至该商品页面',
  799. // icon: 'none',
  800. // success: function () {
  801. // setTimeout(function () {
  802. // wx.redirectTo({ url: '/product/detail/detail?id=' + data.productId })
  803. // }, 2000);
  804. // }
  805. // })
  806. // }
  807. // data.activityPurchaseRecordListDTO.content(data.activityPurchaseRecordListDTO)
  808. // let arr=data.activityPurchaseRecordListDTO.filter(ele=>console.log(ele))
  809. this.getMy();
  810. if (!data || data == 2001) {
  811. this.setData({
  812. activityEnd: true
  813. });
  814. return false;
  815. } else {
  816. let activityPurchaseRecordListDTO;
  817. let arr;
  818. if (data.activityPurchaseRecordListDTO) {
  819. activityPurchaseRecordListDTO = data.activityPurchaseRecordListDTO.slice(0,
  820. 2);
  821. arr = data.activityPurchaseRecordListDTO.slice(0, 21);
  822. // console.log(arr,"789");
  823. }
  824. // console.log(data.activityPurchaseRecordListDTO);
  825. this.setData({
  826. act: data,
  827. isRemind: data.remindId
  828. });
  829. this.setData({
  830. activityPurchaseRecordListDTO: activityPurchaseRecordListDTO,
  831. activityDot: arr
  832. });
  833. // console.log(this.activityPurchaseRecordListDTO, this
  834. // .activityPurchaseRecordListDTO);
  835. this.checkMyIsGroup();
  836. this.initTimer(data);
  837. this.groupItemTimer(1);
  838. this.groupItemTimer();
  839. }
  840. resolve();
  841. });
  842. });
  843. },
  844. // 获取用户信息
  845. getuserInfos(data) {
  846. let userInfo = req.getStorage('userInfo');
  847. if (userInfo && userInfo.listShopBase && userInfo.listShopBase != null && userInfo.listShopBase.length >
  848. 0) {
  849. if (userInfo.listShopBase[0].merchant_id == data.id && data.type != 5) {
  850. let url = '/mine/shop/shop?merchantId=' + userInfo.listShopBase[0].merchant_id + '&shopId=' + userInfo.listShopBase[0].id;
  851. this.url = url;
  852. this.ascription = true;
  853. }
  854. }
  855. },
  856. getMy() {
  857. let that = this;
  858. let userInfo = req.getStorage('userInfo');
  859. if(!userInfo || userInfo == null) return false;
  860. req.getRequest('/api/user/my', {}, data => {
  861. that.isDistriUser = data.isDistriUser;
  862. });
  863. },
  864. //组团倒计时
  865. groupItemTimer(type) {
  866. // this.clearAllTimer();
  867. //社区拼图定时器
  868. let _ts = this;
  869. let group;
  870. if (type == 1) {
  871. group = this.activityPurchaseRecordListDTO;
  872. } else {
  873. group = this.activityDot;
  874. }
  875. if (group && group.length > 0) {
  876. let pageList = group;
  877. for (let i = 0, len = pageList.length; i < len; i++) {
  878. let group = pageList[i]; // let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
  879. let nowTime = new Date(this.act.nowTime.replace(/-/g, '/')).getTime();
  880. let endTime = new Date(group.endDate.replace(/-/g, '/'))
  881. .getTime(); // let actend=new Date(this.data.act.endTime.replace(/-/g, '/')).getTime();
  882. // if (!group.start) endTime = startTime;
  883. // let times
  884. // if(actend-endTime>0){
  885. // times = parseInt((endTime - nowTime) / 1000);
  886. // }else{
  887. // times = parseInt((actend - nowTime) / 1000);
  888. // }
  889. let times = parseInt((endTime - nowTime) / 1000);
  890. let timer = setInterval(() => {
  891. times--;
  892. let data = {};
  893. if (times < 0) {
  894. if (type == 1) {
  895. data['activityPurchaseRecordListDTO[' + i + '].isGroup'] = false;
  896. } else {
  897. data['activityDot[' + i + '].isGroup'] = false;
  898. } // this.setData({isGroup:false})
  899. } else if (times === 0) {
  900. //重新加载列表
  901. clearInterval(timer);
  902. } else {
  903. let n = utils.formatDayTimes(times);
  904. if (type == 1) {
  905. data['activityPurchaseRecordListDTO[' + i + '].times'] = n;
  906. data['activityPurchaseRecordListDTO[' + i + '].isGroup'] = true;
  907. } else {
  908. data['activityDot[' + i + '].times'] = n;
  909. data['activityDot[' + i + '].isGroup'] = true;
  910. }
  911. }
  912. _ts.setData(data);
  913. }, 1000);
  914. let fs = [];
  915. if (type == 1) {
  916. fs['activityPurchaseRecordListDTO[' + i + '].timer'] = timer;
  917. } else {
  918. fs['activityDot[' + i + '].timer'] = timer;
  919. }
  920. _ts.setData(fs);
  921. }
  922. }
  923. },
  924. clearAllTimer() {
  925. if (this.activityPurchaseRecordListDTO) {
  926. this.activityPurchaseRecordListDTO.forEach(it => {
  927. // console.log(it);
  928. clearInterval(it.timer);
  929. clearInterval(it.times);
  930. });
  931. }
  932. if (this.activityDot) {
  933. this.activityDot.forEach(it => {
  934. // console.log(it);
  935. clearInterval(it.timer);
  936. clearInterval(it.times);
  937. });
  938. }
  939. },
  940. initTimer(group) {
  941. //计时器
  942. let _ts = this;
  943. let nowTime = new Date(group.nowTime.replace(/-/g, '/')).getTime();
  944. let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
  945. let endTime = new Date(group.endTime.replace(/-/g, '/')).getTime();
  946. if (!group.start) endTime = startTime;
  947. let times = parseInt((endTime - nowTime) / 1000);
  948. let data = {}; //判断是否已开始
  949. if (nowTime - startTime > 0) {
  950. //开始了
  951. _ts.setData({
  952. isStates: 1
  953. });
  954. } else {
  955. //未开始
  956. _ts.setData({
  957. isStates: 0
  958. });
  959. }
  960. _ts.setData(data);
  961. if (times > 0) {
  962. this.timer = setInterval(() => {
  963. times--;
  964. if (times === 0) {
  965. //重新加载列表
  966. _ts.setData({
  967. 'act.end': true
  968. });
  969. return false;
  970. }
  971. let n = utils.formatDayTimes(times);
  972. _ts.setData({
  973. timer: n.split(/:|天/g)
  974. });
  975. }, 1000);
  976. } else {
  977. _ts.setData({
  978. isStates: 2
  979. });
  980. }
  981. },
  982. loadDefaultAddress() {
  983. if (req.isAuth()) {
  984. req.g('/api/address/default', data => {
  985. if (data) this.setData({
  986. address: data
  987. });
  988. else this.pointLocation();
  989. }, true);
  990. } else {
  991. this.pointLocation();
  992. }
  993. },
  994. toAddress() {
  995. app.globalData.openPage('mine/address/address');
  996. },
  997. toMerchant() {
  998. if (this.about.User_Limit_Store == 1) {
  999. } else {
  1000. app.globalData.openPage('pages/nearby/nearby?isChoose=true');
  1001. }
  1002. },
  1003. pointLocation() {
  1004. //定位当前位置
  1005. let _ts = this;
  1006. QQMapWX.initMap();
  1007. req.getLocation(res => {
  1008. QQMapWX.reverseGeocoder(res, data => {
  1009. _ts.setData({
  1010. ['address.address']: data.address
  1011. });
  1012. });
  1013. });
  1014. },
  1015. atOnceBuy() {
  1016. //立即购买
  1017. // console.log("立即购买"); // if (this.data.isStates == 0) return req.msg('活动还未开始');
  1018. // if (this.data.isStates == 2) return req.msg('活动已结束');
  1019. // if (this.data.start) return req.msg('活动已结束');
  1020. let popup = this.pro;
  1021. popup.salePrice = this.salePrice;
  1022. popup.stock = this.pro.stock;
  1023. this.setData({
  1024. isShow: true,
  1025. popup: popup
  1026. });
  1027. },
  1028. //创建拼团
  1029. createGroup() {
  1030. req.isLogin().then(success => {});
  1031. if (!req.getStorage('userInfo')) return false;
  1032. // console.log(this.start);
  1033. if (this.start) return req.msg(
  1034. '活动已结束'); //state 1存在记录,2不存在,id创建团时存在则为已创建过团记录id,未创建则为-1 参与团id返回为传入的superiorId
  1035. if (this.myActData.state == 1) {
  1036. //存在拼团记录
  1037. this.jumpGoGroup(this.myActData.id);
  1038. } else {
  1039. //不存在,去创建
  1040. req.postRequest('/api/activity/carterActivityPurchaseRecords', {
  1041. acpId: this.act.id,
  1042. type: 3
  1043. }, res => {
  1044. // this.jumpGoGroup(res);
  1045. // this.atOnceBuy(res)
  1046. this.createGroupOrder(res);
  1047. });
  1048. }
  1049. },
  1050. createGroupOrder(aprId) {
  1051. const params = {
  1052. skuId: this.act.skuId,
  1053. quantity: 1,
  1054. productId: this.act.productId,
  1055. aprId: aprId
  1056. };
  1057. if (this.merchant && this.merchant.type != 5) {
  1058. params.merchantId = this.merchant.id;
  1059. }
  1060. if (this.merchant && this.merchant.type == 5) {
  1061. params.merchantId = this.merchant.merchantDTO.id
  1062. params.shopId = this.merchant.id;
  1063. }
  1064. if (this.act.id) params.activityId = this.act.id;
  1065. req.postRequest('/api/purchase/direct/buy', params, res => {
  1066. let redirect = '/product/subOrder/subOrder?ids=' + res;
  1067. redirect += '&orderType=' + 4;
  1068. redirect += '&aprId=' + aprId;
  1069. redirect += '&activityId=' + this.act.id;
  1070. if (params.merchantId) {
  1071. redirect += '&merchantId=' + params.merchantId;
  1072. }
  1073. if (params.shopId) {
  1074. redirect += '&shopId=' + params.shopId;
  1075. }
  1076. uni.navigateTo({
  1077. url: redirect
  1078. });
  1079. });
  1080. },
  1081. //校验是否开团
  1082. checkMyIsGroup() {
  1083. req.getRequest('/api/activity/participationActivity', {
  1084. acpId: this.act.id,
  1085. actId: this.act.actId,
  1086. productId: this.act.productId,
  1087. type: 3,
  1088. initOrPart: 1
  1089. }, res => {
  1090. this.setData({
  1091. myActData: res
  1092. });
  1093. });
  1094. },
  1095. toGoGroup(event) {
  1096. // req.isLogin().then(success => {
  1097. // })
  1098. const index = event.currentTarget.dataset.index;
  1099. const type = event.currentTarget.dataset.type;
  1100. let activityPurchaseRecord;
  1101. if (type == 1) {
  1102. activityPurchaseRecord = this.activityDot[index];
  1103. } else {
  1104. activityPurchaseRecord = this.activityPurchaseRecordListDTO[index];
  1105. }
  1106. // console.log(index, activityPurchaseRecord, type);
  1107. this.jumpGoGroup(activityPurchaseRecord.id);
  1108. },
  1109. //跳入到平团详情
  1110. jumpGoGroup(groupId) {
  1111. app.globalData.openPage('activity/group/ptDetail/ptDetail?acid=' + this.act.id + "&id=" + groupId +
  1112. "&merchantId=" +
  1113. this.query.merchantId);
  1114. },
  1115. addActivityRemind() {
  1116. req.postRequest('/api/activity/remind', {
  1117. activityId: this.act.id
  1118. }, res => {
  1119. requsetmessage.remind();
  1120. req.msg('订阅提醒成功');
  1121. this.setData({
  1122. isRemind: true
  1123. });
  1124. });
  1125. },
  1126. cancelActivityRemind(event) {
  1127. if (req.header.appId == 'ZQ1VK5oc17I387E') {
  1128. } else {
  1129. req.postRequest('/api/activity/cancel/remind', {
  1130. id: this.act.id
  1131. }, res => {
  1132. req.msg('取消提醒成功');
  1133. this.setData({
  1134. isRemind: false
  1135. });
  1136. });
  1137. }
  1138. },
  1139. hidePopup() {
  1140. this.setData({
  1141. isShow: false
  1142. });
  1143. },
  1144. hidePopupLogin(data) {
  1145. this.isPopupLogin = false;
  1146. },
  1147. clickCollect() {
  1148. let _ts = this;
  1149. req.postRequest('/api/collect', {
  1150. bindId: this.pro.id,
  1151. type: 1
  1152. }, data => {
  1153. _ts.setData({
  1154. 'pro.isCollect': !_ts.pro.isCollect
  1155. });
  1156. });
  1157. },
  1158. goTop: function(e) {
  1159. // 一键回到顶部
  1160. if (uni.pageScrollTo) {
  1161. uni.pageScrollTo({
  1162. scrollTop: 0
  1163. });
  1164. } else {
  1165. uni.showModal({
  1166. title: '提示',
  1167. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  1168. });
  1169. }
  1170. },
  1171. onShareTimeline() {
  1172. let merchantId = '';
  1173. let path = 'id=' + this.query.id + '&acid=' + this.query.acid + '&isShareTimeline=' + true;
  1174. if (!req.getStorage('userInfo').id) {} else {
  1175. path += '&userId=' + req.getStorage('userInfo').id;
  1176. }
  1177. let shopId = '';
  1178. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  1179. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  1180. merchantId = req.getStorage('MERCHANT').id;
  1181. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  1182. path += '&shopId=' + req.getStorage('smallShop').id;
  1183. shopId = req.getStorage('smallShop').id;
  1184. merchantId = req.getStorage('smallShop').merchantDTO.id;
  1185. }
  1186. }
  1187. let url = '/activity/group/detail/detail?' + path;
  1188. route.share(2, req.getStorage('userInfo').id, url, merchantId, shopId, 7, this.query.acid + '_' + this
  1189. .query.id);
  1190. return {
  1191. title: (req.getStorage("userInfo").nickName ? req.getStorage("userInfo").nickName : '') + '邀请您参加拼团:' +
  1192. this.pro.title,
  1193. query: path,
  1194. imageUrl: this.pro.pic
  1195. }; // return {
  1196. // title: this.data.pro.title,
  1197. // imageUrl: this.data.pro.pic
  1198. // }
  1199. },
  1200. // 获取参团活动总人数
  1201. groupCount() {
  1202. let param = {
  1203. aprId: this.query.acid
  1204. };
  1205. req.getRequest('/api/activity/groupCount', param, data => {
  1206. this.setData({
  1207. count: data
  1208. });
  1209. });
  1210. },
  1211. // 是否开启小店
  1212. isShop() {
  1213. if (req.getStorage('distribution')) {
  1214. dist = req.getStorage('distribution')
  1215. this.setData({
  1216. distr: dist
  1217. })
  1218. console.log(dist)
  1219. if (dist.distributionSmallShopOpen == 1) {
  1220. req.postRequest('/api/shopBase/isOpenShop', {}, data => {
  1221. this.setData({
  1222. isshop: data
  1223. })
  1224. console.log(data)
  1225. })
  1226. }
  1227. }
  1228. },
  1229. addShop() { //添加到小店
  1230. req.postRequest('/api/shopProduct/save', {
  1231. productId: this.act.id,
  1232. type: 4
  1233. }, data => {
  1234. this.act.isJoinShop = true;
  1235. this.isHide = false;
  1236. })
  1237. },
  1238. hidePop() { //添加到小店
  1239. this.setData({
  1240. isHide: true
  1241. })
  1242. },
  1243. clickmore() {
  1244. // let arrayShow = [];
  1245. // let index = 0;
  1246. // for (let i = index; i < index + 5; i++) {
  1247. // if (this.data.activityPurchaseRecordListDTO[i]) {
  1248. // arrayShow.push(this.data.activityPurchaseRecordListDTO[i]);
  1249. // index = i;
  1250. // }
  1251. // }
  1252. // index = index + 1;
  1253. // if(arrayShow.length>=20){
  1254. // return req.msg("仅显示20个正在拼团的人")
  1255. // }
  1256. // this.setData({arrayShow:arrayShow})
  1257. // this.groupItemTimer()
  1258. // console.log("123",this.activityDot)
  1259. this.getPage();
  1260. this.setData({
  1261. show: true
  1262. });
  1263. },
  1264. eliminate() {
  1265. this.setData({
  1266. show: false
  1267. });
  1268. },
  1269. getPage() {
  1270. //获取系统信息:获取当前屏幕可见区域的宽和高
  1271. let that = this;
  1272. uni.getSystemInfo({
  1273. success: function(res) {
  1274. that.setData({
  1275. "windowWidth": res.windowWidth,
  1276. //可使用窗口宽度,单位px
  1277. "windowHeight": res.windowHeight //可使用窗口高度,单位px
  1278. });
  1279. // console.log(res.windowWidth, that.windowWidth);
  1280. // console.log(res.windowHeight, that.windowHeight);
  1281. }
  1282. });
  1283. },
  1284. showTab: function(e) {
  1285. this.setData({
  1286. tabIndex: e.detail
  1287. });
  1288. },
  1289. scoreTab: function(e) {
  1290. this.form.page = 0;
  1291. this.setData({
  1292. current: e.detail,
  1293. ['form.page']: 1
  1294. });
  1295. },
  1296. freshenFun: function(e) {
  1297. this.setData({
  1298. freshen: e.detail
  1299. });
  1300. },
  1301. // 获取品种保证
  1302. getGuarantee() {
  1303. return new Promise((data, rej) => {
  1304. req.getRequest('/api/config', {}, res => {
  1305. req.setStorage("configRes", JSON.stringify(res))
  1306. this.about = res
  1307. data(res)
  1308. if (this.merchant && this.merchant.isDefault == 1 || this.query.acid) {
  1309. // 切割;拿到数组,然后在过滤掉空值
  1310. if (res.b2c_service_guarantee && res.b2c_service_guarantee != null) {
  1311. this.setData({
  1312. guarantee: res.b2c_service_guarantee.split(";").filter(it => {
  1313. return it = it && it.trim();
  1314. })
  1315. });
  1316. }
  1317. } else {
  1318. if (res.o2o_service_guarantee && res.b2c_service_guarantee != null) {
  1319. this.setData({
  1320. guarantee: res.o2o_service_guarantee.split(";").filter(it => {
  1321. return it = it && it.trim();
  1322. })
  1323. });
  1324. }
  1325. } // if(res.Is_Store_Price_Stock){
  1326. // this.setData({Is_Store_Price_Stock:res.Is_Store_Price_Stock})
  1327. // }
  1328. if (res.is_open_shop) {
  1329. this.is_open_shop = res.is_open_shop;
  1330. }
  1331. if (res.is_open_comments) {
  1332. this.setData({
  1333. is_open_comments: res.is_open_comments
  1334. });
  1335. } // 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 })
  1336. });
  1337. })
  1338. }
  1339. }
  1340. };
  1341. </script>
  1342. <style>
  1343. @import "./detail.css";
  1344. </style>