detail.vue 41 KB

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