details.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283
  1. <template>
  2. <view class="container">
  3. <view id="page-top">
  4. <view class="product">
  5. <view class="u-bg-fff pb40">
  6. <view class="pic">
  7. <swiper
  8. class="swiper"
  9. indicator-dots="true"
  10. autoplay="true"
  11. interval="2000"
  12. duration="1500"
  13. circular="true"
  14. >
  15. <swiper-item v-if="dataForm.videoUrl">
  16. <j-video
  17. class="jvideo"
  18. :url="dataForm.videoUrl"
  19. width="750rpx"
  20. height="620rpx"
  21. ></j-video>
  22. </swiper-item>
  23. <swiper-item v-for="(item, index) in imglist" :key="index">
  24. <image :src="item" mode="aspectFill"></image>
  25. </swiper-item>
  26. </swiper>
  27. <view class="p-price">
  28. <view class="pd24 u-flex-center" style="align-items: baseline">
  29. <view class="u-FFF u-font36"
  30. ><rich-text
  31. :nodes="$mUtil.priceBigSmallTwo(dataForm.minPrice)"
  32. ></rich-text
  33. ></view>
  34. <text class="discount u-font24 u-ml20 u-del"
  35. >¥{{ dataForm.maxSalePrice }}</text
  36. >
  37. <!-- <text class="discount u-font24 u-ml15">{{ dataForm.discount }}折</text> -->
  38. <!-- #DCCDA4 -->
  39. <view v-if="dataForm.groupPeopleNum > 0">
  40. <text
  41. style="
  42. font-size: 22rpx;
  43. font-weight: 500;
  44. color: #fa6138;
  45. padding: 3rpx 14rpx;
  46. margin-left: 18rpx;
  47. background-color: #dccda4;
  48. border-radius: 20rpx;
  49. "
  50. >
  51. {{ dataForm.groupPeopleNum }}人拼
  52. </text>
  53. </view>
  54. </view>
  55. <view class="p-ab u-flex-center">
  56. <view class="triangle-bottomright"></view>
  57. <view class="seckill u-text-center u-font28">
  58. <!-- activeState 0:未开始 * 1:进行中 * 2:已结束 -->
  59. <view
  60. class="u-bold"
  61. style="padding: 20rpx"
  62. v-if="dataForm.activeState == 2"
  63. >已结束</view
  64. >
  65. <view class="u-bold" v-if="dataForm.activeState == 1"
  66. >距结束</view
  67. >
  68. <view class="u-bold" v-if="dataForm.activeState == 0"
  69. >离开抢</view
  70. >
  71. <view v-show="dataForm.activeState != 2 && !selectGroup">
  72. <uni-countdown
  73. :backgroundColor="'none'"
  74. @timeup="overDown2"
  75. :color="'#3775F6'"
  76. :splitorColor="'#3775F6'"
  77. :show-day="time1[0] > 0"
  78. :day="time1[0]"
  79. :hour="time1[1]"
  80. :minute="time1[2]"
  81. :second="time1[3]"
  82. ></uni-countdown>
  83. </view>
  84. <view v-show="dataForm.activeState != 2 && selectGroup">
  85. <uni-countdown
  86. :backgroundColor="'none'"
  87. :color="'#3775F6'"
  88. :splitorColor="'#3775F6'"
  89. :show-day="time2[0] > 0"
  90. :day="time2[0]"
  91. :hour="time2[1]"
  92. :minute="time2[2]"
  93. :second="time2[3]"
  94. ></uni-countdown>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="mt10 u-plr30">
  100. <view>
  101. <view class="tipsStatus" v-if="shop.platformShop">自营</view>
  102. <text class="u-font34 u-bold u-1A1A1A">{{
  103. dataForm.title
  104. }}</text>
  105. </view>
  106. <view class="u-font24 u-mt15 u-999">
  107. <text>
  108. 已售
  109. <text class="u-FF0000">{{ dataForm.resultSaleNum }}</text>
  110. 件,仅剩
  111. <text class="u-FF0000">{{ dataForm.residueStockTotal }}</text>
  112. </text>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <!--拼团-->
  118. <view
  119. class="u-bg-fff u-mt10"
  120. v-if="teamlist && teamlist.length > 0 && !selectGroup"
  121. >
  122. <view class="u-border-one">
  123. <view class="u-plr30 pt-pb30 border u-flex-center-sb">
  124. <view class="u-font28 u-1A1A1A"
  125. >{{ teamlist.length }}人的拼单,可直接参与</view
  126. >
  127. <view class="u-999 u-font24" @click="goGb">
  128. 更多拼团
  129. <text class="iconfont u-ml15">&#xe6c7;</text>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="stb-list">
  134. <view
  135. class="stb-item u-plr30"
  136. style="display: flex; justify-content: space-between"
  137. v-for="(item, index) in teamlist"
  138. :key="item.id"
  139. >
  140. <view class="pt20-pb14" style="width: 100%" v-if="index < 4">
  141. <view class="u-flex-center">
  142. <image
  143. v-if="item.leaderUserInfo.headPhoto"
  144. class="u-avatar65"
  145. :src="item.leaderUserInfo.headPhoto"
  146. ></image>
  147. <image
  148. v-else
  149. class="u-avatar65"
  150. src="/static/default-avatar.png"
  151. mode=""
  152. ></image>
  153. <view
  154. class="u-flex u-ml25"
  155. style="
  156. display: flex;
  157. justify-content: space-around;
  158. width: 100%;
  159. "
  160. >
  161. <view
  162. style="display: flex; flex-direction: column; flex: 1"
  163. >
  164. <view class="u-font24 u-1A1A1A u-text-width">{{
  165. item.leaderUserInfo.nickname
  166. }}</view>
  167. <view
  168. class="u-font24 u-flex-start"
  169. style="display: flex; align-items: center"
  170. >
  171. <text class="u-707070">剩余</text>
  172. <view class="u-FF0000">
  173. <uni-countdown
  174. :backgroundColor="'none'"
  175. :color="'#FF0000'"
  176. :splitorColor="'#FF0000'"
  177. :show-day="item.time[0] > 0"
  178. :day="item.time[0]"
  179. :hour="item.time[1]"
  180. :minute="item.time[2]"
  181. :second="item.time[3]"
  182. @timeup="overDown2"
  183. ></uni-countdown>
  184. </view>
  185. </view>
  186. </view>
  187. <view style="display: flex; align-items: flex-start">
  188. <view
  189. class="u-font24 u-1A1A1A"
  190. style="margin-right: 30rpx"
  191. >
  192. 还差
  193. <text class="u-FF0000">{{
  194. item.groupPeopleNum - item.memberUserInfos.length
  195. }}</text>
  196. 人拼成
  197. </view>
  198. <view
  199. class="u-FFF stb-btn u-font24"
  200. style="flex: 1; margin-top: 12rpx"
  201. @click="gogroup(item)"
  202. >
  203. 去拼单</view
  204. >
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. </view>
  210. </view>
  211. </view>
  212. <view class="u-bg-fff u-mt10">
  213. <view class="u-plr30 u-flex-center-sb pt-pb35">
  214. <view class="u-flex-center" @click="goShop">
  215. <view>
  216. <image class="u-avatar104" :src="shop.image"></image>
  217. </view>
  218. <view class="u-ml25">
  219. <view class="u-font28 u-1A1A1A u-bold">{{
  220. shop.businessName
  221. }}</view>
  222. <view class="u-999 u-font24 u-mt5 u-text2">
  223. <text
  224. class="iconfont"
  225. style="color: #fa6138"
  226. @click.stop="goLocal"
  227. >&#xe990;</text
  228. >
  229. {{ shop.provinceName }}{{ shop.cityName }}{{ shop.areaName
  230. }}{{ shop.address }}
  231. </view>
  232. </view>
  233. </view>
  234. <view class="iconfont" @click="goShop">&#xe6c7;</view>
  235. </view>
  236. </view>
  237. </view>
  238. <view class="u-bg-fff u-mt10">
  239. <view
  240. class="tab u-flex-center-sa u-font30 u-1A1A1A u-border-one-one"
  241. :style="[{ top: `calc(${statusBarHeight}px + 44px)` }]"
  242. >
  243. <view
  244. @tap="change(0)"
  245. class="pb30"
  246. :class="{ active: isChecked == 0 }"
  247. >商品详情</view
  248. >
  249. <view
  250. @tap="change(1)"
  251. class="pb30"
  252. :class="{ active: isChecked == 1 }"
  253. >用户评论({{ commentListLength }})</view
  254. >
  255. </view>
  256. <view class="u-mt10">
  257. <!--商品详情-->
  258. <view v-if="isChecked == 0">
  259. <view class="richText ql-editor-box">
  260. <uv-parse
  261. class="custom-parse"
  262. :content="goodsInfo.content"
  263. ></uv-parse>
  264. </view>
  265. </view>
  266. <!--评论-->
  267. <view class="u-plr30" v-else>
  268. <comment :value="commentList"></comment>
  269. </view>
  270. </view>
  271. </view>
  272. </view>
  273. <view style="height: 170rpx; background-color: white"></view>
  274. <view class="bottom-btn u-bg-fff">
  275. <view class="pt-pb30 u-plr30 u-flex-center-sb">
  276. <button
  277. open-type="share"
  278. class="u-text-center"
  279. style="line-height: normal"
  280. >
  281. <view class="iconfont2 u-font44 u-999">&#xe684;</view>
  282. <view class="u-font28 u-1A1A1A">分享</view>
  283. </button>
  284. <!-- 两个按钮 -->
  285. <view class="u-flex-center" v-if="!selectGroup">
  286. <button
  287. class="gb-btn btn-bg-dccda4 u-00321E btn-bg-dccda4-48"
  288. @click="goProduct(dataForm.productId)"
  289. >
  290. <view>
  291. <view class="u-font36 u-bold"
  292. ><rich-text
  293. :nodes="$mUtil.priceBigSmall(dataForm.minSalePrice)"
  294. ></rich-text
  295. ></view>
  296. </view>
  297. <view class="u-font22">单独购买</view>
  298. </button>
  299. <button
  300. v-if="dataForm.activeState == 1"
  301. class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
  302. @click="buy(1, dataForm.id)"
  303. >
  304. <view>
  305. <view class="u-font36 u-bold"
  306. ><rich-text
  307. :nodes="$mUtil.priceBigSmall(dataForm.minPrice)"
  308. ></rich-text>
  309. </view>
  310. </view>
  311. <view class="u-font22">发起拼团</view>
  312. </button>
  313. <button
  314. v-if="dataForm.activeState == 0"
  315. class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
  316. @click="notStarted()"
  317. >
  318. <view>
  319. <view class="u-font36 u-bold"
  320. ><rich-text
  321. :nodes="$mUtil.priceBigSmall(dataForm.minPrice)"
  322. ></rich-text>
  323. </view>
  324. </view>
  325. <view class="u-font22">发起拼团</view>
  326. </button>
  327. <button
  328. v-if="dataForm.activeState == 2"
  329. class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
  330. @click="itSover()"
  331. >
  332. <view>
  333. <view class="u-font36 u-bold"
  334. ><rich-text
  335. :nodes="$mUtil.priceBigSmall(dataForm.minPrice)"
  336. ></rich-text>
  337. </view>
  338. </view>
  339. <view class="u-font22">发起拼团</view>
  340. </button>
  341. </view>
  342. <!-- 三个按钮 -->
  343. <view class="u-flex-center" v-if="selectGroup">
  344. <button
  345. class="gb-btn btn-bg-dccda4 u-00321E"
  346. @click="goProduct(dataForm.productId)"
  347. >
  348. <view>
  349. <view class="u-font36 u-bold"
  350. ><rich-text
  351. :nodes="$mUtil.priceBigSmall(dataForm.minSalePrice)"
  352. ></rich-text
  353. ></view>
  354. </view>
  355. <view class="u-font22 font11">单独购买</view>
  356. </button>
  357. <button class="gb-btn btn-bg-00320E u-DCCDA4" @click="groupGoBuy">
  358. <view>
  359. <view class="u-font36 u-bold"
  360. ><rich-text
  361. :nodes="$mUtil.priceBigSmall(dataForm.minPrice)"
  362. ></rich-text>
  363. </view>
  364. </view>
  365. <view class="u-font22">发起拼团</view>
  366. </button>
  367. <button
  368. class="gb-btn btn-bg-dccda4 u-00321E"
  369. @click="goGdProduct(dataForm.productId)"
  370. >
  371. <view>
  372. <view class="u-font36 u-bold"
  373. ><rich-text
  374. :nodes="$mUtil.priceBigSmall(dataForm.minPrice)"
  375. ></rich-text>
  376. </view>
  377. </view>
  378. <view class="u-font22">去拼团</view>
  379. </button>
  380. </view>
  381. </view>
  382. </view>
  383. <!--规格-->
  384. <uv-popup mode="bottom" ref="specOpenRef" :touchmove="true" round="30rpx">
  385. <view class="u-bg-fff spec">
  386. <view class="u-plr30 flex-sb u-border-one-one pb30">
  387. <view class="u-flex-center">
  388. <image class="u-goods200" :src="skuObj.cover"></image>
  389. <view class="u-ml20">
  390. <view class="u-999 u-font24 price-zhe">
  391. <view class="u-FF0000 u-font36"
  392. ><rich-text
  393. :nodes="$mUtil.priceBigSmall(skuObj.salePrice)"
  394. ></rich-text>
  395. </view>
  396. <text class="u-del u-ml15"
  397. >¥{{ skuObj.originalSalePrice }}</text
  398. >
  399. <!-- <text class="u-ml10">{{ dataForm.discount }}折</text> -->
  400. </view>
  401. <view class="u-font22 u-999 u-mt5">
  402. 活动库存 {{ skuObj.stock }} 件
  403. </view>
  404. <view class="u-font22 u-999 u-mt5"></view>
  405. <view class="u-1A1A1A u-mt25">{{
  406. skuObj.skuSetName ? skuObj.skuSetName : "请选择"
  407. }}</view>
  408. </view>
  409. </view>
  410. <!-- <view class="iconfont u-999 closeIcon" @click="specOpenClose"
  411. >&#xe612;</view
  412. > -->
  413. <view class="closeIcon" @click.stop="specOpenClose">
  414. <uv-icon name="close-circle" color="#999999" size="36rpx"></uv-icon>
  415. </view>
  416. </view>
  417. <view>
  418. <view class="content">
  419. <scroll-view scroll-y style="max-height: 30vh">
  420. <view class="">
  421. <view
  422. class="u-mt30 bottom-bor"
  423. v-for="(item, index) in skuTab"
  424. :key="item.head.id"
  425. >
  426. <view class="u-plr30">{{ item.head.name }}</view>
  427. <view class="u-mt20 u-border-one-one pb30">
  428. <view class="u-plr30 u-flex u-flex-warp">
  429. <view
  430. class="spec-item"
  431. :class="childrenItem.flag ? 'activeColor' : ''"
  432. @click="chonseSku(index, childrenItem.id)"
  433. v-for="childrenItem in item.values"
  434. :key="childrenItem.id"
  435. >
  436. {{ childrenItem.name }}
  437. </view>
  438. </view>
  439. </view>
  440. </view>
  441. </view>
  442. </scroll-view>
  443. </view>
  444. <view class="u-plr30 u-mt30">
  445. <view class="u-flex-center-sb">
  446. <view>购买数量</view>
  447. <view class="u-flex-center">
  448. <uv-number-box
  449. v-model="addNumber"
  450. disabledInput
  451. ></uv-number-box>
  452. </view>
  453. </view>
  454. <view class="specOpen-btn">
  455. <view
  456. ><button class="u-btn-two" @click="btnBuy(1)">
  457. 立即购买
  458. </button></view
  459. >
  460. </view>
  461. </view>
  462. </view>
  463. </view>
  464. </uv-popup>
  465. <!--更多拼团-->
  466. <uv-popup
  467. mode="center"
  468. backgroundColor="transparent"
  469. ref="gbOpenRef"
  470. round="30rpx"
  471. >
  472. <view class="iconfont u-text-right u-font40 u-FFF" @click="gbClose"
  473. >&#xe603;</view
  474. >
  475. <view class="u-bg-D5C49B u-mt30 br-rd20">
  476. <view class="br-284534">
  477. <view class="u-text-center gb-te">正在拼团</view>
  478. </view>
  479. <view class="gb-list pb50">
  480. <view class="gb-item u-plr30" v-for="item in teamlist" :key="item.id">
  481. <view class="u-flex-center-sb br-284534 pt28-pb18">
  482. <view class="u-flex-center u-00321E">
  483. <image
  484. class="u-avatar65"
  485. v-if="item.leaderUserInfo.headPhoto"
  486. :src="item.leaderUserInfo.headPhoto"
  487. ></image>
  488. <!-- <image class="u-avatar65" v-else :src="imgUrl + '/head-on.png'" mode=""></image> -->
  489. <image
  490. class="u-avatar65"
  491. v-else
  492. src="/static/default-avatar.png"
  493. mode=""
  494. ></image>
  495. <view class="u-ml25">
  496. <view class="u-font28 u-text-width">{{
  497. item.leaderUserInfo.nickname
  498. }}</view>
  499. <view class="u-font20 per-num">
  500. <div class="u-font24 u-flex-center">
  501. <text>还差</text>
  502. <text class="u-FF0000">{{
  503. item.groupPeopleNumber - item.memberUserInfos.length
  504. }}</text>
  505. <text>人拼成</text>
  506. </div>
  507. <view
  508. class="u-flex-start u-font24 u-flex-center"
  509. style="display: flex"
  510. >
  511. <view class="u-00321E u-ml20 u-font24">剩余</view>
  512. <view class="u-FF0000">
  513. <uni-countdown
  514. :backgroundColor="'none'"
  515. :color="'#FF0000'"
  516. :splitorColor="'#FF0000'"
  517. :show-day="item.time[0] > 0"
  518. :day="item.time[0]"
  519. :hour="item.time[1]"
  520. :minute="item.time[2]"
  521. :second="item.time[3]"
  522. @timeup="overDown2"
  523. ></uni-countdown>
  524. </view>
  525. </view>
  526. </view>
  527. </view>
  528. </view>
  529. <view class="u-FFF stb-btn u-font24 ml54" @click="gogroup(item)"
  530. >我要参团</view
  531. >
  532. </view>
  533. </view>
  534. </view>
  535. </view>
  536. </uv-popup>
  537. </view>
  538. </template>
  539. <script setup>
  540. import { ref, reactive, onMounted } from "vue";
  541. import { onLoad, onShow, onShareAppMessage } from "@dcloudio/uni-app";
  542. import {
  543. activitygoodsGoodsInfo_Api,
  544. groupbuyingList_Api,
  545. groupbuyTeamInfo_Api,
  546. activitygoodsGroupbuying_Api,
  547. } from "@/api/groupbuy";
  548. import {
  549. getBusinessInfoId_Api,
  550. productInfo,
  551. shopOrderCommentPage,
  552. } from "@/api/shop.js";
  553. import comment from "@/components/ld-comment/ld-comment.vue";
  554. import jVideo from "@/components/j-video/j-video.vue";
  555. import utils from "@/util/index.js";
  556. const gbOpenRef = ref();
  557. const specOpenRef = ref();
  558. // 响应式数据
  559. const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
  560. const imglist = ref([]);
  561. const isChecked = ref(0);
  562. const btnName = ref("");
  563. const dataForm = ref({});
  564. const shop = ref({});
  565. const loading = ref(true);
  566. const skuTab = ref([]);
  567. const hasId = ref("");
  568. const addNumber = ref(1);
  569. const commentList = ref([]);
  570. const commentListLength = ref(0);
  571. const goodsInfo = ref({});
  572. const time1 = ref([0, 0, 0, 0]);
  573. const time2 = ref([0, 0, 0, 0]);
  574. const teamlist = ref([]);
  575. const selectGroup = ref(null);
  576. const teamId = ref(null);
  577. const skuObj = ref({});
  578. // 页面生命周期
  579. onLoad((options) => {
  580. if (options.id) {
  581. getDetailInfo(options.id);
  582. }
  583. if (options.teamId) {
  584. teamId.value = options.teamId;
  585. }
  586. if (options.shareId) {
  587. recordSave(options.shareId, options.id);
  588. }
  589. });
  590. onShow(() => {});
  591. onShareAppMessage((res) => {
  592. let user = uni.getStorageSync("personal");
  593. if (res.from === "button") {
  594. console.log(res.target);
  595. }
  596. return {
  597. title: dataForm.value.shareTitle,
  598. imageUrl: dataForm.value.shareImg,
  599. path: `/pages/product/goods/puzzleGoods?id=${
  600. dataForm.value.id
  601. }&SbusinessId=${dataForm.value.businessId}&teamId=${
  602. teamId.value || ""
  603. }&share=1&shareId=${user.id || ""}`,
  604. };
  605. });
  606. const notStarted = () => {
  607. uni.$uv.toast("活动尚未开始");
  608. };
  609. const itSover = () => {
  610. uni.$uv.toast("活动已结束");
  611. };
  612. const goLocal = () => {
  613. uni.openLocation({
  614. latitude: Number(shop.value.txLatitude),
  615. longitude: Number(shop.value.txLongitude),
  616. name: shop.value.name,
  617. address: shop.value.address,
  618. success: function () {
  619. console.log("success");
  620. },
  621. });
  622. };
  623. const goShop = () => {
  624. uni.navigateTo({
  625. url: "/pages/shop/index?businessId=" + dataForm.value.businessId,
  626. });
  627. };
  628. const recordSave = (shareUserId, goodsId) => {
  629. return;
  630. globalThis.$http
  631. .post("/share/record/save", {
  632. shareUserId: shareUserId,
  633. goodsId: goodsId,
  634. })
  635. .then((res) => {});
  636. };
  637. const groupGoBuy = () => {
  638. selectGroup.value = null;
  639. getTeam();
  640. };
  641. const gogroup = (item) => {
  642. gbOpenRef.value.close();
  643. groupbuyTeamInfo_Api(item.id).then((res) => {
  644. if (res && res.code == 200) {
  645. time2.value = utils
  646. .countDown(Math.floor(res.data.countDownEndTime))
  647. .split(":")
  648. .map((val) => Number(val));
  649. console.log(time2.value, 123);
  650. }
  651. });
  652. selectGroup.value = item;
  653. };
  654. const goGdProduct = () => {
  655. // checkSku(selectGroup.value.groupBuyGoodsId);
  656. specOpenRef.value.open();
  657. };
  658. const overDown2 = () => {
  659. getTeam();
  660. };
  661. // 获取店铺信息
  662. const getIndexList = (businessId) => {
  663. getBusinessInfoId_Api(businessId).then((ret) => {
  664. if (ret.data && ret.code == 200) {
  665. shop.value = ret.data;
  666. }
  667. });
  668. };
  669. const getTeam = () => {
  670. // console.log(dataForm.value.businessId, dataForm.value.id);
  671. if (!dataForm.value.businessId || !dataForm.value.id) return;
  672. groupbuyingList_Api(dataForm.value.businessId, dataForm.value.id).then(
  673. (res) => {
  674. if (res && res.code == 200) {
  675. res.data = res.data.map((val) => {
  676. val.time = utils
  677. .countDown(val.endTime)
  678. .split(":")
  679. .map((val) => Number(val));
  680. return val;
  681. });
  682. teamlist.value = res.data;
  683. if (teamId.value) {
  684. selectGroup.value = res.data.find((val) => val.id == teamId.value);
  685. console.log("团队信息2" + JSON.stringify(selectGroup.value));
  686. time2.value = utils
  687. .countDown(selectGroup.value.endTime)
  688. .split(":")
  689. .map((val) => Number(val));
  690. }
  691. }
  692. }
  693. );
  694. };
  695. const getDetailInfo = (id) => {
  696. activitygoodsGoodsInfo_Api(id).then((res) => {
  697. loading.value = false;
  698. if (res && res.code == 200) {
  699. dataForm.value = res.data;
  700. dataForm.value.businessId = res.data.businessId;
  701. getIndexList(dataForm.value.businessId);
  702. if (res.data.activeState == 0) {
  703. time1.value = utils
  704. .countDown(res.data.startTime)
  705. .split(":")
  706. .map((val) => Number(val));
  707. } else {
  708. time1.value = utils
  709. .countDown(res.data.finishTime)
  710. .split(":")
  711. .map((val) => Number(val));
  712. }
  713. productInfo(dataForm.value.productId).then((ret) => {
  714. if (ret && ret.code == 200) {
  715. goodsInfo.value = ret.data;
  716. imglist.value = ret.data.images;
  717. skuTab.value = ret.data.skuTable.map((item) => {
  718. if (item.values) {
  719. item.values[0].flag = true;
  720. }
  721. return item;
  722. });
  723. }
  724. });
  725. shopOrderCommentPage({
  726. productId: dataForm.value.productId,
  727. pageNum: 1,
  728. pageSize: 10,
  729. }).then((ret) => {
  730. if (ret && ret.code == 200) {
  731. commentList.value = ret.rows;
  732. commentListLength.value = ret.total;
  733. // console.log(commentListLength.value);
  734. }
  735. });
  736. getTeam();
  737. }
  738. });
  739. };
  740. const goProduct = (id) => {
  741. uni.navigateTo({
  742. url: "/pages/shop/goodsDetails?id=" + id,
  743. });
  744. };
  745. const goGb = () => {
  746. gbOpenRef.value.open();
  747. };
  748. const gbClose = () => {
  749. gbOpenRef.value.close();
  750. };
  751. const change = (i) => {
  752. isChecked.value = i;
  753. };
  754. const buy = (i, id) => {
  755. selectGroup.value = null;
  756. chonseSku();
  757. btnName.value = "立即购买";
  758. specOpenRef.value.open();
  759. };
  760. const chonseSku = (index, id) => {
  761. if (index != null) {
  762. skuTab.value[index].values.forEach((res) => {
  763. res.flag = false;
  764. if (res.id == id) {
  765. res.flag = true;
  766. }
  767. });
  768. }
  769. let choseId = [];
  770. skuTab.value.forEach((res) => {
  771. res.values.forEach((Key) => {
  772. if (Key.flag) {
  773. choseId.push(Key.id);
  774. }
  775. });
  776. });
  777. let totalId = choseId.sort((a, b) => a - b).join("_");
  778. totalId = "_" + totalId + "_";
  779. hasId.value = totalId;
  780. if (goodsInfo.value.singleSku) {
  781. if(dataForm.value.productSkuSetList.length>0) skuObj.value = dataForm.value.productSkuSetList[0];
  782. } else {
  783. dataForm.value.productSkuSetList.forEach((res) => {
  784. if (res.skuHashCode == totalId) {
  785. skuObj.value = res;
  786. }
  787. });
  788. }
  789. };
  790. const specOpenClose = () => {
  791. specOpenRef.value.close();
  792. };
  793. const btnBuys = () => {
  794. if (!skuObj.value.id && hasId.value == "") {
  795. uni.$uv.toast("请选中 sku");
  796. return false;
  797. }
  798. if (
  799. Number(addNumber.value) > dataForm.value.limitBuyNum &&
  800. dataForm.value.limitBuyNum != 0
  801. ) {
  802. uni.$uv.toast("商品限购" + dataForm.value.limitBuyNum + "件");
  803. return false;
  804. }
  805. //判断库存
  806. if (
  807. dataForm.value.productSkuSetList.length > 0 &&
  808. Number(skuObj.value.stock) < Number(addNumber.value)
  809. ) {
  810. uni.$uv.toast("商品库存只有" + skuObj.value.stock + "件");
  811. return false;
  812. }
  813. // psotJson();
  814. };
  815. const psotJson = () => {
  816. let dataJson = {};
  817. let childArr = [];
  818. let parendArr = [];
  819. childArr.push({
  820. userCartId: 0,
  821. activityGoodsId: skuObj.value.activityGoodsId,
  822. productId: dataForm.value.productId,
  823. num: addNumber.value,
  824. skuHashCode: skuObj.value.skuHashCode,
  825. });
  826. parendArr.push({
  827. businessId: dataForm.value.businessId,
  828. sourceShopId: shop.value.id,
  829. activityId: dataForm.value.groupBuyId,
  830. sponsorActivityId: selectGroup.value ? selectGroup.value.id : 0,
  831. userRemark: "",
  832. items: childArr,
  833. });
  834. dataJson = {
  835. isCart: false,
  836. receiptId: null,
  837. shipmentMode: 0,
  838. shopOrders: parendArr,
  839. marketingType: 2,
  840. };
  841. uni.setStorageSync("dataJson", dataJson);
  842. uni.navigateTo({
  843. url: "/pages/product/surePay/surePaySechill?type=group",
  844. });
  845. };
  846. const btnBuy = (i) => {
  847. if (!utils.isLoginTo(true)) {
  848. btnBuys();
  849. }
  850. };
  851. </script>
  852. <style lang="scss">
  853. page {
  854. background-color: #f5f5f5;
  855. }
  856. </style>
  857. <style lang="scss" scoped>
  858. .price-zhe {
  859. display: flex;
  860. align-items: baseline;
  861. }
  862. .per-num {
  863. display: flex;
  864. }
  865. .bottom-bor {
  866. border-bottom: 3rpx solid #e7e7e7;
  867. }
  868. .slotBox {
  869. .back {
  870. padding: 0 13rpx;
  871. }
  872. }
  873. .pd24 {
  874. padding: 24rpx;
  875. }
  876. .pd20 {
  877. padding: 20rpx;
  878. }
  879. .pt20-pb14 {
  880. padding-top: 20rpx;
  881. padding-bottom: 14rpx;
  882. }
  883. .pt28-pb18 {
  884. padding-top: 28rpx;
  885. padding-bottom: 18rpx;
  886. }
  887. .pb30 {
  888. padding-bottom: 30rpx;
  889. }
  890. .pb40 {
  891. padding-bottom: 40rpx;
  892. }
  893. .pb50 {
  894. padding-bottom: 50rpx;
  895. }
  896. .pt-pb30 {
  897. padding-top: 30rpx;
  898. padding-bottom: 30rpx;
  899. }
  900. .pt-pb35 {
  901. padding-top: 35rpx;
  902. padding-bottom: 35rpx;
  903. }
  904. .ml54 {
  905. margin-left: 54rpx;
  906. }
  907. .ml138 {
  908. margin-left: 138rpx;
  909. }
  910. .br-rd10 {
  911. border-radius: 10rpx;
  912. }
  913. .br-rd20 {
  914. border-radius: 20rpx;
  915. }
  916. .stb-btn {
  917. padding: 8rpx 18rpx;
  918. border-radius: 10rpx;
  919. background: #ff0000;
  920. }
  921. .br-FF0000 {
  922. border: 1rpx solid #ff0000;
  923. border-radius: 24rpx;
  924. padding: 6rpx 12rpx;
  925. }
  926. .bg-FFF6EE {
  927. background-color: #fff6ee;
  928. }
  929. .mt80 {
  930. margin-top: 80rpx;
  931. }
  932. .mt10 {
  933. margin-top: 10rpx;
  934. }
  935. .product {
  936. // padding-bottom: 150rpx;
  937. }
  938. .pic {
  939. width: 100%;
  940. position: relative;
  941. .swiper {
  942. // height: 620rpx;
  943. height: 100vw;
  944. video {
  945. width: 100%;
  946. // height: 620rpx;
  947. height: 100vw;
  948. }
  949. image {
  950. width: 100%;
  951. // height: 620rpx;
  952. height: 100vw;
  953. }
  954. }
  955. .p-price {
  956. width: 100%;
  957. // position: absolute;
  958. top: 460rpx;
  959. // background: linear-gradient(90deg,#20a733, #0a824b);
  960. background: #fa6138;
  961. border-radius: 20rpx 20rpx 0px 0px;
  962. position: relative;
  963. top: -18rpx;
  964. .discount {
  965. color: #ffffff;
  966. }
  967. }
  968. }
  969. .richText {
  970. padding: 30rpx;
  971. ::v-deep img {
  972. margin-top: 0 !important;
  973. }
  974. }
  975. //秒杀,拼团样式
  976. .p-ab {
  977. position: absolute;
  978. z-index: 2;
  979. top: -8rpx;
  980. right: 0;
  981. }
  982. .stb-list {
  983. padding-bottom: 10rpx;
  984. }
  985. .triangle-bottomright {
  986. width: 0;
  987. height: 0;
  988. border-bottom: 105rpx solid #dccda4;
  989. border-left: 60rpx solid transparent;
  990. }
  991. .seckill {
  992. background-color: #dccda4;
  993. color: #fa6138;
  994. padding: 12rpx 15rpx;
  995. padding-right: 28rpx;
  996. border-radius: 5rpx 20rpx 0px 0px;
  997. box-sizing: border-box;
  998. }
  999. .seckill-btn {
  1000. width: 86%;
  1001. }
  1002. .br-284534 {
  1003. border-bottom: 1rpx solid rgba($color: #284534, $alpha: 0.3);
  1004. }
  1005. .gb-te {
  1006. padding-top: 20rpx;
  1007. padding-bottom: 15rpx;
  1008. }
  1009. .gb-btn {
  1010. padding: 20rpx 40rpx;
  1011. line-height: 30rpx;
  1012. }
  1013. .btn-bg-dccda4 {
  1014. background: #dccda4;
  1015. border-radius: 48px;
  1016. }
  1017. .btn-bg-00321E {
  1018. background: #fa6138;
  1019. border-radius: 48px;
  1020. }
  1021. .btn-bg-00320E {
  1022. background: #fa6138;
  1023. border-radius: 48px;
  1024. }
  1025. .btn-bg-dccda4-48 {
  1026. padding: 20rpx 85rpx;
  1027. border-radius: 48px;
  1028. background: #f8a764;
  1029. color: white;
  1030. margin-right: 10rpx;
  1031. }
  1032. .btn-bg-dccda4-482 {
  1033. padding: 20rpx 85rpx;
  1034. border-radius: 48px;
  1035. background: #fa6138;
  1036. color: white;
  1037. margin-left: 10rpx;
  1038. }
  1039. .tab {
  1040. position: sticky;
  1041. top: 0;
  1042. background-color: #fff;
  1043. padding-top: 38rpx;
  1044. z-index: 9;
  1045. .pb30 {
  1046. position: relative;
  1047. &::before {
  1048. content: "";
  1049. position: absolute;
  1050. left: 50%;
  1051. bottom: 0;
  1052. transform: translateX(-50%);
  1053. width: 0;
  1054. height: 2px;
  1055. background: #fa6138;
  1056. transition: all 0.3s;
  1057. }
  1058. &.active {
  1059. font-size: 30rpx;
  1060. color: #fa6138;
  1061. font-weight: 700;
  1062. &::before {
  1063. width: 100%;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. .bottom-btn {
  1069. width: 100%;
  1070. position: fixed;
  1071. bottom: 0;
  1072. border-top: 1rpx solid #e6e6e6;
  1073. z-index: 9;
  1074. .cart {
  1075. position: relative;
  1076. .number {
  1077. position: absolute;
  1078. top: -10rpx;
  1079. left: 45rpx;
  1080. padding: 4rpx 8rpx;
  1081. background-color: #ff0000;
  1082. border: 4rpx solid #ffffff;
  1083. border-radius: 40rpx;
  1084. }
  1085. }
  1086. .cart-btn {
  1087. width: 230rpx;
  1088. height: 85rpx;
  1089. background: #dccda4;
  1090. border-radius: 43rpx 0rpx 0rpx 43rpx;
  1091. }
  1092. .buy-btn {
  1093. width: 230rpx;
  1094. height: 85rpx;
  1095. line-height: 85rpx;
  1096. background: #fa6138;
  1097. border-radius: 0rpx 43rpx 43rpx 0rpx;
  1098. }
  1099. }
  1100. .flex-sb {
  1101. display: flex;
  1102. justify-content: space-between;
  1103. border-bottom: 3rpx solid #e7e7e7;
  1104. }
  1105. //弹窗
  1106. .spec {
  1107. border-radius: 18rpx 18rpx 0rpx 0rpx;
  1108. padding-top: 30rpx;
  1109. // max-height: 900rpx;
  1110. overflow-y: auto;
  1111. // position: fixed;
  1112. // bottom: 0;
  1113. // z-index: 999;
  1114. // width: 100%;
  1115. .spec-item {
  1116. background-color: #f6f6f6;
  1117. border: 1px solid #f6f6f6;
  1118. padding: 12rpx 30rpx;
  1119. font-size: 24rpx;
  1120. color: #1a1a1a;
  1121. border-radius: 4px;
  1122. }
  1123. .activeColor {
  1124. background-color: #e1e6e3;
  1125. border: 1px solid #3775f6;
  1126. color: #fa6138;
  1127. border-radius: 4px;
  1128. }
  1129. .spec-item:not(:last-child) {
  1130. margin-right: 24rpx;
  1131. }
  1132. //减号
  1133. .minus {
  1134. width: 50rpx;
  1135. height: 50rpx;
  1136. line-height: 50rpx;
  1137. text-align: center;
  1138. background: #dedede;
  1139. border-radius: 8rpx 0rpx 0rpx 8rpx;
  1140. }
  1141. .num {
  1142. width: 74rpx;
  1143. height: 46rpx;
  1144. line-height: 46rpx;
  1145. text-align: center;
  1146. border: 1px solid #dedede;
  1147. }
  1148. //加号
  1149. .plus-sign {
  1150. width: 50rpx;
  1151. height: 50rpx;
  1152. line-height: 50rpx;
  1153. text-align: center;
  1154. background: #dedede;
  1155. border-radius: 0rpx 8rpx 8rpx 0rpx;
  1156. }
  1157. .specOpen-btn {
  1158. margin-top: 68rpx;
  1159. padding-bottom: 34rpx;
  1160. button {
  1161. background-color: #fa6138;
  1162. color: #ffffff;
  1163. }
  1164. }
  1165. }
  1166. </style>