detail.vue 41 KB

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