detail.vue 44 KB

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