detail.vue 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075
  1. <template>
  2. <view class="app-container">
  3. <view class="recommender-container" v-if="isGroupbuyGoods && !isHeadUser">
  4. <view class="content">
  5. <image :src="detail.groupPic"></image>
  6. <view class="name ellipsis">{{ detail.groupUserName }}</view>
  7. <view>向你推荐</view>
  8. </view>
  9. </view>
  10. <!-- <no-data v-if="!isLoaded" :showText="'加载中'"></no-data> -->
  11. <no-data v-if="isLoaded && noData" :showText="'该商品已失效'"></no-data>
  12. <block v-if="isLoaded && !noData">
  13. <view class="swiper-container">
  14. <swiper @change="changeBanner">
  15. <swiper-item v-if="detail.vedio">
  16. <video id="video1" :src="detail.vedio" @play="playVideo" @pause="pauseVideo" controls loop
  17. :enable-progress-gesture="false" :muted="isFixedVideo"></video>
  18. </swiper-item>
  19. <block v-for="(item, index) in bannerList" :key="index" v-if="bannerList.length > 0">
  20. <swiper-item>
  21. <!-- <image :src="item.url" mode="aspectFill" @tap="previewImage(item.url)" ></image> -->
  22. <view class="image" @tap="previewImage(item.url)">
  23. <image :src="item.url" mode="aspectFill" class="img"></image>
  24. <image :src="detail.logo" mode="aspectFill" class="water"
  25. v-if="isShowWater && index == 0"></image>
  26. </view>
  27. </swiper-item>
  28. </block>
  29. </swiper>
  30. <view class="nums" v-show="(detail.vedio && bannerCurrent != 0) || !detail.vedio">
  31. {{ bannerCurrent + 1 }}/{{
  32. bannerList.length + (detail.vedio ? 1 : 0)
  33. }}
  34. </view>
  35. </view>
  36. <view class="video-container" :class="isFixedVideo ? 'isFixed' : ''">
  37. <view class="content">
  38. <view class="close" @tap="closeFixedVideo">
  39. <image src="@/static/icon/close.png"></image>
  40. </view>
  41. <video id="video2" :src="detail.vedio" @error="videoErrorCallback" controls loop
  42. :enable-progress-gesture="false"></video>
  43. </view>
  44. </view>
  45. <view class="seckill-container" v-if="isSeckillGoods">
  46. <view class="price">
  47. <view class="price-1">¥{{ detail.goodsPrice | numToFixed }}</view>
  48. <view class="price-2">¥{{ detail.orgGoodsPrice | numToFixed }}</view>
  49. </view>
  50. <view class="right">
  51. <text>距结束还剩:</text>
  52. <view class="time">
  53. <text>{{ countdownTime[0] }}</text>时<text>{{ countdownTime[1] }}</text>分<text>{{ countdownTime[2] }}</text>秒
  54. </view>
  55. </view>
  56. <view class="clock">
  57. <image src="@/static/icon/clock.png"></image>
  58. </view>
  59. </view>
  60. <view class="main-container">
  61. <view class="title">{{ detail.goodsName }}</view>
  62. <view class="des">{{
  63. detail.describeText ? detail.describeText : ''
  64. }}</view>
  65. <view class="stock">
  66. <block v-if="!isSeckillGoods">
  67. <view class="left">
  68. <text>剩余{{ detail.stock }}件</text>
  69. </view>
  70. </block>
  71. <block v-if="isSeckillGoods">
  72. <view class="left">
  73. <text>剩余{{ detail.secStockNum }}件</text>
  74. <view class="progress-box">
  75. <progress :percent="(detail.secStockNum / detail.limitBuy) * 100" activeColor="#FF3F42"
  76. active stroke-width="6" />
  77. </view>
  78. </view>
  79. <view class="right" @tap="isOpen = !isOpen" v-if="
  80. (isServiceUser && !isGroupbuyGoods) ||
  81. (isHeadUser && isGroupbuyGoods)
  82. ">
  83. <text>{{ isOpen ? '收起' : '展开' }}</text>
  84. <image :src="
  85. isOpen
  86. ? '../../static/icon/arrow_2.png'
  87. : '../../static/icon/arrow_1.png'
  88. "></image>
  89. </view>
  90. </block>
  91. </view>
  92. <view class="price" v-if="!isSeckillGoods">
  93. <view class="left">
  94. <view class="price-1">¥{{ detail.goodsPrice | numToFixed }}</view>
  95. <view class="price-2">¥{{ detail.orgGoodsPrice | numToFixed }}</view>
  96. </view>
  97. <view class="right" @tap="isOpen = !isOpen" v-if="
  98. (isServiceUser && !isGroupbuyGoods) ||
  99. (isHeadUser && isGroupbuyGoods)
  100. ">
  101. <text>{{ isOpen ? '收起' : '展开' }}</text>
  102. <image :src="
  103. isOpen
  104. ? '../../static/icon/arrow_2.png'
  105. : '../../static/icon/arrow_1.png'
  106. "></image>
  107. </view>
  108. </view>
  109. <view class="bottom" v-if="isOpen">
  110. <view v-if="isHeadUser && isGroupbuyGoods">团长分佣金额</view>
  111. <view v-else>分享可获得收益</view>
  112. <view>¥{{ commission | numToFixed
  113. }}{{ detail.goodsSpecs.length > 1 ? '起' : '' }}</view>
  114. </view>
  115. </view>
  116. <view class="line-container">
  117. <view v-if="
  118. accountInfo.miniProgram &&
  119. accountInfo.miniProgram.appId !== 'wxf89d330c7b0e718d'
  120. ">运费:包邮</view>
  121. <view>销量:<text>{{ detail.soldNum }}</text></view>
  122. </view>
  123. <view class="evaluate-container" v-if="evaluateList.length">
  124. <view class="title">商品评价</view>
  125. <view class="list">
  126. <view class="item" :class="evaluateList.length === 1 ? 'onlyOne' : ''"
  127. v-for="(item, index) in evaluateList">
  128. <view class="top">
  129. <view class="user">
  130. <image :src="item.avatar" mode="aspectFill" v-if="item.avatar.indexOf('http') >= 0">
  131. </image>
  132. <image :src="imageUrl + item.avatar" mode="aspectFill" v-else></image>
  133. <view class="name ellipsis">{{ item.userName }}</view>
  134. </view>
  135. <view class="date">{{ item.createTime }}</view>
  136. </view>
  137. <view class="rate">
  138. <view class="it"><text>商品质量</text><uni-rate :size="14" :margin="4"
  139. :value="item.commentGoods" color="#fff" active-color="#FE781F" :readonly="true" />
  140. </view>
  141. <view class="it"><text>服务质量</text><uni-rate :size="14" :margin="4"
  142. :value="item.commentService" color="#fff" active-color="#FE781F" :readonly="true" />
  143. </view>
  144. <view class="it"><text>配送质量</text><uni-rate :size="14" :margin="4"
  145. :value="item.commentExpress" color="#fff" active-color="#FE781F" :readonly="true" />
  146. </view>
  147. </view>
  148. <view class="tags">
  149. <view class="it" v-for="(it, idx) in item.tags">{{ it }}</view>
  150. </view>
  151. <view class="content">{{ item.content }}</view>
  152. <view class="images" v-if="item.imgs && item.imgs.length > 0">
  153. <image v-for="(it, idx) in item.imgs" :src="it" @tap="previewEvaluateImage(it, item.imgs)">
  154. </image>
  155. </view>
  156. </view>
  157. </view>
  158. <view class="more">
  159. <view class="btn" @tap="toAllEvaluate">查看全部评价</view>
  160. </view>
  161. </view>
  162. <view class="detail-container">
  163. <view class="title">商品详情</view>
  164. <view class="content" v-if="detail.pubCommonTemplate">
  165. <u-parse :content="detail.pubCommonTemplate.content"></u-parse>
  166. </view>
  167. <view class="content" v-if="detail.commonTemplate">
  168. <u-parse :content="detail.commonTemplate.content"></u-parse>
  169. </view>
  170. <view class="content">
  171. <u-parse :content="detail.content"></u-parse>
  172. </view>
  173. </view>
  174. <view class="bottom-container">
  175. <view class="left">
  176. <view class="item" @tap="clickShare">
  177. <image src="@/static/icon/share.png"></image>
  178. <text>分享</text>
  179. </view>
  180. <view class="item" @tap="handleCollect" v-if="!isGroupbuyGoods && !isPackageGoods">
  181. <block v-if="detail.favorite">
  182. <image src="@/static/icon/collect2.png"></image>
  183. <text>已收藏</text>
  184. </block>
  185. <block v-else>
  186. <image src="@/static/icon/collect.png"></image>
  187. <text>收藏</text>
  188. </block>
  189. </view>
  190. <view class="item" @tap="toCart">
  191. <image src="@/static/icon/cart2.png"></image>
  192. <text>购物车</text>
  193. <view class="dot" v-if="cartCount > 0">{{
  194. cartCount <= 99 ? cartCount : '99+'
  195. }}</view>
  196. </view>
  197. </view>
  198. <view class="right" v-if="!isSeckillGoods && !isGroupbuyGoods && !isPackageGoods">
  199. <view class="button cart" @tap="clickCartOrBuy(1)">加入购物车</view>
  200. <view class="button buy" @tap="clickCartOrBuy(2)">立即购买</view>
  201. </view>
  202. <view class="right" v-if="!isSeckillGoods && isGroupbuyGoods">
  203. <view class="button cart" @tap="clickCartOrBuy(1)">加入购物车</view>
  204. <view class="button buy" @tap="clickCartOrBuy(4)">立即拼团</view>
  205. </view>
  206. <view class="right" v-if="isSeckillGoods">
  207. <view class="button cart" @tap="clickCartOrBuy(1)">加入购物车</view>
  208. <view class="button buy" @tap="clickCartOrBuy(3)">马上抢购</view>
  209. </view>
  210. <view class="right" v-if="isPackageGoods">
  211. <view class="button buy" @tap="clickPackageBuy()">立即购买</view>
  212. </view>
  213. </view>
  214. <u-popup :round="10" :closeable="true" :show="isBuyDialog" @close="isBuyDialog = false">
  215. <view class="cart-container">
  216. <view class="main">
  217. <image :src="specList[specCurrent].imgUrl"></image>
  218. <view class="right">
  219. <view class="title ellipsis-2">{{ detail.goodsName }}</view>
  220. <block v-if="isGroupbuyGoods">
  221. <view class="price">
  222. <view class="price-1">¥{{ specList[specCurrent].price }}</view>
  223. <view class="price-2">¥{{ specList[specCurrent].orgPrice }}</view>
  224. </view>
  225. <view class="stock">剩余{{ specList[specCurrent].stockNum }}件</view>
  226. </block>
  227. <block v-else-if="isSeckillGoods">
  228. <view class="price">
  229. <view class="price-1">¥{{ specList[specCurrent].secPrice }}</view>
  230. <view class="price-2">¥{{ specList[specCurrent].price }}</view>
  231. </view>
  232. <view class="stock">剩余{{ detail.secStockNum }}件</view>
  233. </block>
  234. <block v-else>
  235. <view class="price">
  236. <view class="price-1">¥{{ specList[specCurrent].price }}</view>
  237. <view class="price-2">¥{{ detail.orgGoodsPrice }}</view>
  238. </view>
  239. <view class="stock">剩余{{ specList[specCurrent].stockNum }}件</view>
  240. </block>
  241. </view>
  242. </view>
  243. <view class="attr">
  244. <view class="title">已选属性</view>
  245. <view class="list">
  246. <block v-for="(item, index) in specList" :key="index">
  247. <view class="item" @tap="changeSpec(index)"
  248. :class="specCurrent == index ? 'current' : ''">{{ item.name }}-{{ item.specValue }}
  249. </view>
  250. </block>
  251. </view>
  252. </view>
  253. <view class="num">
  254. <view class="title">购买数量</view>
  255. <u-number-box v-model="buyNum" :min="1" :buttonSize="26" iconStyle="font-size: 12px;">
  256. </u-number-box>
  257. </view>
  258. <view class="button" v-if="dialogType == 1" @tap="addToCart">加入购物车</view>
  259. <view class="button" v-if="dialogType == 2" @tap="nowBuy">立即购买</view>
  260. <view class="button" v-if="dialogType == 3" @tap="rushBuy">马上抢购</view>
  261. <view class="button" v-if="dialogType == 4" @tap="nowBuy">马上拼团</view>
  262. </view>
  263. </u-popup>
  264. <u-popup :round="10" :closeable="false" :show="isShareDialog" @close="isShareDialog = false">
  265. <view class="sharelist-container">
  266. <button class="item" open-type="share" @tap="isShareDialog = false">
  267. <image src="@/static/icon/wechat.png"></image>
  268. <text>分享给微信好友</text>
  269. </button>
  270. <view class="item" @tap="markImage">
  271. <image src="@/static/icon/image.png"></image>
  272. <text>生成图片分享</text>
  273. </view>
  274. </view>
  275. </u-popup>
  276. <view class="global-mask" v-show="isShowCanvas" @tap="closeCanvas"></view>
  277. <view class="canvas-container" v-show="isShowCanvas">
  278. <view class="content">
  279. <canvas style="width: 300px; height: 520px" canvas-id="myCanvas" id="myCanvas"></canvas>
  280. </view>
  281. <view class="button"><text @tap="saveImage">保存图片</text></view>
  282. </view>
  283. <u-popup :round="10" :closeable="true" :show="isPackageDialog" @close="isPackageDialog = false">
  284. <view class="package-container">
  285. <view class="main">
  286. <view class="group" v-for="(item, index) in packageList" :key="index">
  287. <view class="title">请选择商品{{ item.num }}件</view>
  288. <view class="goods-list">
  289. <view class="item" v-for="(it, idx) in item.goodsList" :key="idx">
  290. <image :src="it.imgUrl"></image>
  291. <view class="right">
  292. <view class="name ellipsis-2">{{ it.goodsName }}</view>
  293. <view class="des">{{ it.specValue }}</view>
  294. <view class="bottom">
  295. <view class="price">
  296. <view class="price-1">¥{{ it.price | numToFixed }}</view>
  297. <view class="price-2">¥{{ it.orgPrice | numToFixed }}</view>
  298. </view>
  299. <u-number-box v-model="it.num" :min="0" :max="it.limitNum" :buttonSize="26"
  300. iconStyle="font-size: 12px;">
  301. </u-number-box>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. </view>
  307. </view>
  308. <view class="button" @tap="packageBuy()">立即购买</view>
  309. </view>
  310. </u-popup>
  311. <u-popup :round="10" :show="isShowPhoneDialog">
  312. <view class="phone-dialog">
  313. <view class="content">
  314. <view>申请获取以下权限</view>
  315. <text>获得你的公开信息(手机号码)</text>
  316. </view>
  317. <view class="btn">
  318. <button @tap="isShowPhoneDialog = false">取消</button>
  319. <button type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  320. 确定授权
  321. </button>
  322. </view>
  323. </view>
  324. </u-popup>
  325. </block>
  326. <canvas style="
  327. width: 800px;
  328. height: 800px;
  329. z-index: -1;
  330. position: fixed;
  331. bottom: -1000px;
  332. right: -1000px;
  333. " canvas-id="myCanvas22" id="myCanvas22"></canvas>
  334. </view>
  335. </template>
  336. <script>
  337. import {
  338. mapState
  339. } from 'vuex';
  340. import {
  341. base64src
  342. } from '@/utils/base.js';
  343. import {
  344. appId
  345. } from '@/utils/config.js';
  346. import {
  347. uploadImg
  348. } from '@/api/axios.js';
  349. export default {
  350. data() {
  351. return {
  352. isShowPhoneDialog: false,
  353. imageUrl: this.$imageUrl,
  354. configInfo: uni.getStorageSync('configInfo'),
  355. isLoaded: false,
  356. noData: true,
  357. goodsId: null, // 商品id
  358. detail: {}, // 商品详情
  359. commission: 0, // 分佣金额
  360. bannerList: [], // 轮播图列表
  361. bannerCurrent: 0, // 轮播图当前值
  362. specList: [], // 规格列表
  363. specCurrent: 0, // 规格当前值
  364. isOpen: false, // 是否展开
  365. isBuyDialog: false, // 是否显示购买/加入购物车弹窗
  366. dialogType: 1, // 弹窗类型: 1加入购物车,2立即购买,3秒杀抢购
  367. isShareDialog: false, // 是否显示分享弹窗
  368. isShowCanvas: false, // 是否显示海报弹窗
  369. buyNum: 1, // 购买/加入购物车 数量
  370. isSeckillGoods: false, // 是否秒杀商品
  371. isGroupbuyGoods: false, // 是否团购商品
  372. isPackageGoods: false, // 是否套购商品
  373. isPackageDialog: false, // 是否显示套购购买弹窗
  374. packageList: [], // 套购选择列表
  375. cartCount: 0, // 购物车内商品数
  376. isFinishCanvas: false, // 是否已完成海报
  377. codeUrl: '', // 商品码
  378. videoContext1: '', // 视频对象
  379. videoContext2: '', // 视频对象
  380. isFixedVideo: false, // 是否显示视频弹窗
  381. isPlayVideo: false, // 视频是否播放中
  382. isCloseMyself: false, // 是否亲自关闭视频弹窗
  383. countdownTime: '', // 倒计时
  384. endHour: 0, // 倒计时结束时间
  385. evaluateList: [],
  386. isShowWater: false,
  387. accountInfo: {},
  388. };
  389. },
  390. computed: {
  391. ...mapState(['userInfo', 'isLogin', 'userId']),
  392. isHeadUser() {
  393. // 是否团长
  394. return this.userInfo.promotionGroupLeader;
  395. },
  396. isServiceUser() {
  397. // 是否业务员
  398. return this.userInfo.type === 'SERVICE';
  399. },
  400. },
  401. watch: {
  402. countdownTime() {
  403. if (
  404. this.countdownTime[0] == 0 &&
  405. this.countdownTime[1] == 0 &&
  406. this.countdownTime[2] == 0
  407. ) {
  408. this.getDetail();
  409. }
  410. },
  411. },
  412. onPageScroll(res) {
  413. if (
  414. res.scrollTop > 300 &&
  415. this.isPlayVideo &&
  416. !this.isCloseMyself &&
  417. this.detail.vedio
  418. ) {
  419. this.isFixedVideo = true;
  420. this.videoContext2.play();
  421. } else {
  422. this.isFixedVideo = false;
  423. this.videoContext2.pause();
  424. }
  425. if (res.scrollTop < 300) {
  426. this.isCloseMyself = false;
  427. }
  428. },
  429. onLoad({
  430. id
  431. }) {
  432. this.accountInfo = uni.getAccountInfoSync();
  433. this.goodsId = id;
  434. this.getDetail();
  435. this.getEvaluateList();
  436. this.getCartCount();
  437. uni.showLoading({
  438. title: '加载中',
  439. });
  440. },
  441. onShow() {
  442. this.isBuyDialog = false;
  443. },
  444. onReady() {
  445. this.videoContext1 = uni.createVideoContext('video1');
  446. this.videoContext2 = uni.createVideoContext('video2');
  447. },
  448. async onShareAppMessage(options) {
  449. if (options && options.from == 'button') {
  450. // 来自页面内的转发按钮
  451. } else {
  452. // 点击微信右上角的分享按钮
  453. }
  454. return {
  455. title: '分享商品「' + this.detail.goodsName + '」',
  456. imageUrl: await this.markImage222(),
  457. path: '/pages/index/index?goodsId=' +
  458. this.goodsId +
  459. '&serviceId=' +
  460. this.userId,
  461. query: {
  462. // id: this.goodsId,
  463. },
  464. success: function(res) {
  465. if (res.errMsg == 'shareAppMessage:ok') {
  466. this.$successToast('分享完成');
  467. }
  468. },
  469. };
  470. },
  471. methods: {
  472. // 获取手机号
  473. getPhoneNumber(e) {
  474. if (e?.detail?.iv && e?.detail?.encryptedData) {
  475. this.$axios({
  476. url: '/user/mobile/grant',
  477. params: {
  478. userId: this.userId,
  479. iv: e.detail.iv,
  480. encryptedData: e.detail.encryptedData,
  481. },
  482. }).then((res) => {
  483. uni.setStorageSync('token', res.data.token);
  484. uni.setStorageSync('isActiveLogout', false);
  485. this.isShowPhoneDialog = false;
  486. this.$getUserInfo();
  487. });
  488. }
  489. },
  490. // 获取详情
  491. getDetail() {
  492. this.$axios({
  493. url: '/goods/detail',
  494. method: 'get',
  495. params: {
  496. goodsId: this.goodsId,
  497. userId: this.userId,
  498. },
  499. })
  500. .then((res) => {
  501. this.detail = res.data;
  502. this.noData = false;
  503. this.isLoaded = true;
  504. // 团购
  505. this.isGroupbuyGoods = res.data.promotionGroup;
  506. // 秒杀
  507. this.isSeckillGoods = res.data.secType;
  508. this.endHour = res.data.endHour;
  509. this.countTime();
  510. // 套购
  511. this.isPackageGoods = res.data.goodsType === 'PACKAGE';
  512. this.bannerList = res.data.images;
  513. this.specList = res.data.goodsSpecs;
  514. this.specCurrent = 0;
  515. if (!this.isPackageGoods) {
  516. let commissionList = [];
  517. this.specList.forEach((item, index) => {
  518. item.price = item.price.toFixed(2);
  519. item.orgPrice = item.orgPrice.toFixed(2);
  520. commissionList.push(item.shareAmount);
  521. });
  522. this.commission = Math.min(...commissionList);
  523. } else {
  524. this.commission = res.data.shareAmount;
  525. }
  526. // 水印
  527. if (res.data.logo && res.data.logoStartTime) {
  528. this.isShowWater = this.$compareTime(
  529. res.data.logoStartTime,
  530. res.data.logoEndTime
  531. );
  532. } else {
  533. this.isShowWater = false;
  534. }
  535. this.markImage222(false);
  536. })
  537. .catch((res) => {
  538. this.noData = true;
  539. this.isLoaded = true;
  540. })
  541. .finally((res) => {
  542. uni.hideLoading();
  543. });
  544. },
  545. // 获取评价列表
  546. getEvaluateList() {
  547. this.$axios({
  548. url: '/order/comment/goods',
  549. method: 'get',
  550. params: {
  551. pageNo: 1,
  552. pageSize: 5,
  553. goodsId: this.goodsId,
  554. },
  555. }).then((res) => {
  556. this.evaluateList = res.data.records;
  557. });
  558. },
  559. // 查询结束时间
  560. checkEndTime(val) {
  561. let yy = new Date().getFullYear();
  562. let mm = new Date().getMonth() + 1;
  563. let dd = new Date().getDate();
  564. // dd = val == 10 ? dd + 1 : dd;
  565. // 每月有多少天
  566. let days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  567. if ((yy % 4 == 0 && yy % 100 != 0) || yy % 400 == 0) {
  568. days[1] = 29;
  569. }
  570. // 如果结束时间=10(表示第二天10点),dd需加一天
  571. if (val == 10) {
  572. if (dd >= days[mm - 1]) {
  573. mm = mm + 1;
  574. } else {
  575. dd = dd + 1;
  576. }
  577. }
  578. let date = yy + '/' + mm + '/' + dd;
  579. let dateTime = date + ' ' + val + ':00:00';
  580. return dateTime;
  581. },
  582. // 计算倒计时
  583. countTime() {
  584. let endDateTime = this.checkEndTime(this.endHour);
  585. var nowtime = new Date(), //获取当前时间
  586. endtime = new Date(endDateTime); //定义结束时间
  587. var lefttime = endtime.getTime() - nowtime.getTime(), //距离结束时间的毫秒数
  588. hh = Math.floor(lefttime / (1000 * 60 * 60)), //计算小时数
  589. mm = Math.floor((lefttime / (1000 * 60)) % 60), //计算分钟数
  590. ss = Math.floor((lefttime / 1000) % 60); //计算秒数
  591. function checkTime(i) {
  592. if (i < 10) {
  593. i = '0' + i;
  594. }
  595. return i;
  596. }
  597. setTimeout(() => {
  598. this.countTime();
  599. }, 1000);
  600. this.countdownTime = [checkTime(hh), checkTime(mm), checkTime(ss)];
  601. },
  602. // 获取商品二维码
  603. getGoodsCode(success) {
  604. const that = this;
  605. this.$axios({
  606. url: '/goods/qrcode',
  607. method: 'get',
  608. params: {
  609. goodsId: this.goodsId,
  610. userId: this.userId,
  611. },
  612. }).then((res) => {
  613. // this.codeUrl = 'data:image/jpeg;base64,' + res.data;
  614. that.codeUrl = res.data;
  615. console.log(this.codeUrl, typeof success);
  616. if (typeof success === 'function') {
  617. success();
  618. }
  619. });
  620. },
  621. // 视频播放
  622. playVideo(e) {
  623. this.isPlayVideo = true;
  624. },
  625. // 视频暂停
  626. pauseVideo(e) {
  627. this.isPlayVideo = false;
  628. },
  629. // 关闭视频弹窗
  630. closeFixedVideo() {
  631. this.isFixedVideo = false;
  632. this.isCloseMyself = true;
  633. this.videoContext2.pause();
  634. },
  635. // 从个人信息获取购物车商品数量
  636. getCartCount() {
  637. this.$axios({
  638. url: '/user/user/detail',
  639. method: 'get',
  640. params: {
  641. userId: this.userId,
  642. },
  643. }).then((res) => {
  644. this.cartCount = res.data.shoppingCartNums;
  645. if (!res.data.openId) {
  646. return uni.navigateTo({
  647. url: '/pages/login/index?isNotOpenid=' + true,
  648. });
  649. }
  650. });
  651. },
  652. // 查看所有评价
  653. toAllEvaluate() {
  654. uni.navigateTo({
  655. url: '/packageGoods/pages/evaluate?goodsId=' + this.goodsId,
  656. });
  657. },
  658. // 收藏/取消收藏
  659. handleCollect() {
  660. if (!this.isLogin) {
  661. return uni.navigateTo({
  662. url: '/pages/login/index',
  663. });
  664. }
  665. if (!this.detail.favorite) {
  666. this.$axios({
  667. url: '/goods/favorite/add',
  668. params: {
  669. goodsId: this.goodsId,
  670. userId: this.userId,
  671. },
  672. }).then((res) => {
  673. this.$successToast('收藏成功');
  674. this.getDetail();
  675. });
  676. } else {
  677. this.$axios({
  678. url: '/goods/favorite/detail/del',
  679. params: {
  680. goodsId: this.goodsId,
  681. userId: this.userId,
  682. },
  683. }).then((res) => {
  684. this.$successToast('取消收藏成功');
  685. this.getDetail();
  686. });
  687. }
  688. },
  689. // 切换图片
  690. changeBanner(e) {
  691. this.bannerCurrent = e.detail.current;
  692. if (this.bannerCurrent > 0 && this.detail.vedio) {
  693. this.videoContext1.pause();
  694. }
  695. },
  696. // 预览图片
  697. previewImage(url) {
  698. let imgs = [];
  699. this.bannerList.forEach((item, index) => {
  700. imgs.push(item.url);
  701. });
  702. uni.previewImage({
  703. urls: imgs,
  704. current: url,
  705. });
  706. },
  707. // 预览评价图片
  708. previewEvaluateImage(url, imgs) {
  709. uni.previewImage({
  710. urls: imgs,
  711. current: url,
  712. });
  713. },
  714. // 点击分享
  715. clickShare() {
  716. if (!this.isLogin) {
  717. return uni.navigateTo({
  718. url: '/pages/login/index',
  719. });
  720. }
  721. // this.getGoodsCode();
  722. this.isShareDialog = true;
  723. },
  724. // 点击加入购物车/立即购买
  725. clickCartOrBuy(type) {
  726. if (!this.isLogin) {
  727. return uni.navigateTo({
  728. url: '/pages/login/index',
  729. });
  730. }
  731. this.dialogType = type;
  732. this.isBuyDialog = true;
  733. },
  734. // 切换规格
  735. changeSpec(index) {
  736. this.specCurrent = index;
  737. },
  738. // 加入购物车
  739. addToCart() {
  740. if (this.specList[this.specCurrent].stockNum == 0) {
  741. return this.$toast('该规格库存不足');
  742. }
  743. this.$axios({
  744. url: '/shpping/cart/add/one',
  745. type: 'application/json',
  746. params: {
  747. userId: this.userId,
  748. buyGoods: [{
  749. goodsId: this.goodsId,
  750. goodsSpecId: this.specList[this.specCurrent].goodsSpecId,
  751. num: this.buyNum,
  752. secKillId: this.detail.secKillId || '',
  753. promotionGroupId: this.detail.promotionGroupId || '',
  754. }, ],
  755. },
  756. isLoading: 1,
  757. }).then((res) => {
  758. this.$successToast('添加成功');
  759. this.getCartCount();
  760. this.isBuyDialog = false;
  761. });
  762. },
  763. // 立即购买
  764. nowBuy() {
  765. if (this.specList[this.specCurrent].stockNum == 0) {
  766. return this.$toast('该规格库存不足');
  767. }
  768. if (!this.userInfo.mobile) {
  769. this.isShowPhoneDialog = true;
  770. return;
  771. }
  772. let buyList = [{
  773. goodsId: this.goodsId,
  774. goodsSpecId: this.specList[this.specCurrent].goodsSpecId,
  775. num: this.buyNum,
  776. secKillId: this.detail.secKillId || '',
  777. promotionGroupId: this.detail.promotionGroupId || '',
  778. }, ];
  779. let url = '/packageGoods/pages/order?buyList=' + JSON.stringify(buyList);
  780. if (this.detail.promotionGroupId) {
  781. url = url + '&groupbuyId=' + this.detail.promotionGroupId;
  782. }
  783. uni.navigateTo({
  784. url,
  785. });
  786. },
  787. // 马上抢购(秒杀)
  788. rushBuy() {
  789. if (this.detail.secStockNum == 0) {
  790. return this.$toast('该规格库存不足');
  791. }
  792. if (!this.userInfo.mobile) {
  793. this.isShowPhoneDialog = true;
  794. return;
  795. }
  796. this.$axios({
  797. url: '/goods/sec/kill/start',
  798. method: 'post',
  799. params: {
  800. secKillId: this.detail.secKillId,
  801. },
  802. }).then((res) => {
  803. if (res.data) {
  804. let buyList = [{
  805. goodsId: this.goodsId,
  806. goodsSpecId: this.specList[this.specCurrent].goodsSpecId,
  807. num: this.buyNum,
  808. secKillId: this.detail.secKillId || '',
  809. promotionGroupId: this.detail.promotionGroupId || '',
  810. }, ];
  811. uni.navigateTo({
  812. url: '/packageGoods/pages/order?buyList=' +
  813. JSON.stringify(buyList) +
  814. '&secKillId=' +
  815. this.detail.secKillId +
  816. '&secKillSpecId=' +
  817. this.detail.secKillSpecId +
  818. '&secToken=' +
  819. res.data,
  820. });
  821. } else {
  822. this.$toast('活动异常');
  823. }
  824. });
  825. },
  826. // 去购物车页面
  827. toCart() {
  828. uni.switchTab({
  829. url: '/pages/cart/index',
  830. });
  831. },
  832. // 打开套购购买弹窗
  833. clickPackageBuy() {
  834. this.packageList = [];
  835. this.$axios({
  836. url: '/goods/package/choice',
  837. method: 'get',
  838. params: {
  839. goodsId: this.goodsId,
  840. },
  841. }).then((res) => {
  842. let goodsList = res.data;
  843. for (let i = 0; i < goodsList.length; i++) {
  844. for (let j = 0; j < goodsList[i].length; j++) {
  845. goodsList[i][j].num = 0;
  846. }
  847. }
  848. let pops = this.detail.packagePop.split(':');
  849. pops.forEach((item, index) => {
  850. this.packageList.push({
  851. num: item,
  852. goodsList: goodsList[index],
  853. });
  854. });
  855. console.log(this.packageList);
  856. this.isPackageDialog = true;
  857. });
  858. },
  859. // 套购购买
  860. packageBuy() {
  861. if (!this.userInfo.mobile) {
  862. this.isShowPhoneDialog = true;
  863. return;
  864. }
  865. let buyList = [];
  866. for (let i = 0; i < this.packageList.length; i++) {
  867. for (let j = 0; j < this.packageList[i].goodsList.length; j++) {
  868. if (this.packageList[i].goodsList[j].num > 0) {
  869. buyList.push({
  870. goodsId: this.packageList[i].goodsList[j].goodsId,
  871. goodsSpecId: this.packageList[i].goodsList[j].goodsSpecId,
  872. popType: this.packageList[i].goodsList[j].type,
  873. num: this.packageList[i].goodsList[j].num,
  874. });
  875. }
  876. }
  877. }
  878. uni.navigateTo({
  879. url: '/packageGoods/pages/order?buyList=' +
  880. JSON.stringify(buyList) +
  881. '&packageId=' +
  882. this.detail.goodsId,
  883. });
  884. },
  885. // 分享
  886. share() {
  887. uni.share({
  888. provider: 'weixin',
  889. scene: 'WXSceneSession',
  890. type: 5,
  891. summary: '我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!',
  892. success: function(res) {
  893. console.log('success:' + JSON.stringify(res));
  894. },
  895. fail: function(err) {
  896. console.log('fail:' + JSON.stringify(err));
  897. },
  898. });
  899. },
  900. async markImage222(bool = true) {
  901. return new Promise((r) => {
  902. if (
  903. this.detail.logo &&
  904. this.detail.imgUrl &&
  905. this.$compareTime(this.detail.logoStartTime, this.detail.logoEndTime)
  906. ) {
  907. if (!!this.detail.mergeImage) {
  908. r(this.detail.mergeImage);
  909. } else {
  910. if (bool) {
  911. uni.showLoading({
  912. title: '图片生成中',
  913. });
  914. }
  915. this.getGoodsCode(() => {
  916. let img = this.detail.imgUrl;
  917. let logo = this.detail.logo;
  918. var ctx = uni.createCanvasContext('myCanvas22');
  919. ctx.rect(0, 0, 800, 800);
  920. ctx.setFillStyle('#FFFFFF');
  921. ctx.fill();
  922. ctx.stroke();
  923. uni.downloadFile({
  924. url: img,
  925. success: (res) => {
  926. ctx.drawImage(res.tempFilePath, 0, 0, 800, 800);
  927. uni.downloadFile({
  928. url: logo,
  929. success: (res2) => {
  930. ctx.drawImage(res2
  931. .tempFilePath, 0, 0,
  932. 800, 800);
  933. ctx.draw();
  934. uni.canvasToTempFilePath({
  935. x: 0,
  936. y: 0,
  937. width: 800,
  938. height: 800,
  939. canvasId: 'myCanvas22',
  940. success: (
  941. res33) => {
  942. uploadImg({
  943. path: res33
  944. .tempFilePath,
  945. })
  946. .then((
  947. data
  948. ) => {
  949. this.$axios({
  950. url: '/goods/update/mergeImage',
  951. method: 'post',
  952. params: {
  953. goodsId: this
  954. .goodsId,
  955. imgUrl: data
  956. .url,
  957. },
  958. })
  959. .then(
  960. (
  961. res
  962. ) => {
  963. if (
  964. bool
  965. ) {
  966. uni
  967. .hideLoading();
  968. this
  969. .getDetail();
  970. }
  971. r(res
  972. .data
  973. );
  974. }
  975. );
  976. });
  977. },
  978. });
  979. },
  980. });
  981. },
  982. });
  983. });
  984. }
  985. } else {
  986. r(this.detail.imgUrl);
  987. }
  988. });
  989. },
  990. // 生成图片
  991. markImage() {
  992. this.isShareDialog = false;
  993. this.isShowCanvas = true;
  994. if (this.isFinishCanvas) {
  995. return false;
  996. }
  997. uni.showLoading({
  998. title: '海报生成中',
  999. });
  1000. // 调用获取二维图接口后执行匿名函数
  1001. this.getGoodsCode(() => {
  1002. let img = this.detail.imgUrl;
  1003. let logo = this.detail.logo;
  1004. let title = this.detail.goodsName;
  1005. let des = this.detail.describeText;
  1006. let price1 = this.detail.goodsPrice;
  1007. let price2 = this.detail.orgGoodsPrice;
  1008. let sales = this.detail.soldNum;
  1009. // let code = this.codeUrl;
  1010. // base64src(this.codeUrl , resCurrent => {
  1011. // code = resCurrent;
  1012. // })
  1013. var ctx = uni.createCanvasContext('myCanvas');
  1014. /**
  1015. * @param {Object} str 要绘制的字符串
  1016. * @param {Number} initX 绘制字符串起始x坐标
  1017. * @param {Number} initY 绘制字符串起始y坐标
  1018. * @param {Number} lineHeight 字行高
  1019. */
  1020. function canvasTextAutoLine(str, initX, initY, lineHeight) {
  1021. var lineWidth = 0;
  1022. var canvasWidth = 260;
  1023. var lastSubStrIndex = 0;
  1024. var lineNum = 0;
  1025. var state = true;
  1026. for (let i = 0; i < str.length; i++) {
  1027. lineWidth += ctx.measureText(str[i]).width;
  1028. if (lineWidth > canvasWidth && lineNum < 1) {
  1029. ctx.fillText(str.substring(lastSubStrIndex, i), initX, initY);
  1030. initY += lineHeight;
  1031. lineWidth = 0;
  1032. lastSubStrIndex = i;
  1033. lineNum++;
  1034. } else if (lineWidth > canvasWidth && lineNum < 2) {
  1035. ctx.fillText(
  1036. str.substring(lastSubStrIndex + 2, i) + '...',
  1037. initX,
  1038. initY
  1039. );
  1040. lineNum++;
  1041. state = false;
  1042. }
  1043. if (i == str.length - 1 && state) {
  1044. ctx.fillText(str.substring(lastSubStrIndex, i + 1), initX, initY);
  1045. }
  1046. }
  1047. }
  1048. // 白色背景
  1049. ctx.rect(0, 0, 300, 520);
  1050. ctx.setFillStyle('#FFFFFF');
  1051. ctx.fill();
  1052. ctx.stroke();
  1053. // 商品名称
  1054. ctx.setFontSize(14);
  1055. ctx.setFillStyle('#333333');
  1056. canvasTextAutoLine(title, 20, 300, 18);
  1057. // 商品描述
  1058. if (des) {
  1059. ctx.setFontSize(12);
  1060. ctx.setFillStyle('#999999');
  1061. canvasTextAutoLine(des, 20, 336, 16);
  1062. }
  1063. // 现价
  1064. ctx.setFontSize(16);
  1065. ctx.setFillStyle('#FF3F42');
  1066. ctx.fillText('¥' + price1, 20, 380);
  1067. // 原价
  1068. ctx.setFontSize(13);
  1069. ctx.setFillStyle('#666666');
  1070. ctx.fillText('¥' + price2, 20, 396);
  1071. ctx.setStrokeStyle('#666666');
  1072. ctx.moveTo(20, 392);
  1073. ctx.lineTo(ctx.measureText('¥' + price2).width + 20, 392);
  1074. ctx.stroke();
  1075. // 销量
  1076. ctx.setFontSize(12);
  1077. ctx.setFillStyle('#666666');
  1078. ctx.fillText(
  1079. '销量:' + sales,
  1080. 260 - ctx.measureText('销量:' + sales).width + 20,
  1081. 380
  1082. );
  1083. // 二维码
  1084. // ctx.drawImage(code, 110, 404, 80, 80)
  1085. // 提示
  1086. ctx.setFontSize(12);
  1087. ctx.setFillStyle('#FE781F');
  1088. ctx.fillText('打开微信扫描识别查看商品', 78, 500);
  1089. // 图片
  1090. uni.downloadFile({
  1091. url: img,
  1092. success: (res) => {
  1093. ctx.drawImage(res.tempFilePath, 20, 20, 260, 260);
  1094. // 二维码
  1095. uni.downloadFile({
  1096. url: this.codeUrl,
  1097. success: (res) => {
  1098. ctx.drawImage(res.tempFilePath, 110, 404, 80, 80);
  1099. if (this.isShowWater) {
  1100. uni.downloadFile({
  1101. url: logo,
  1102. success: (res2) => {
  1103. ctx.drawImage(res2
  1104. .tempFilePath, 20, 20,
  1105. 260, 260);
  1106. ctx.draw();
  1107. uni.hideLoading();
  1108. this.isFinishCanvas = true;
  1109. },
  1110. });
  1111. } else {
  1112. console.log('生成画布成功');
  1113. ctx.draw();
  1114. uni.hideLoading();
  1115. this.isFinishCanvas = true;
  1116. }
  1117. },
  1118. });
  1119. },
  1120. });
  1121. });
  1122. },
  1123. // 保存图片
  1124. saveImage() {
  1125. let that = this;
  1126. uni.canvasToTempFilePath({
  1127. x: 0,
  1128. y: 0,
  1129. width: 300,
  1130. height: 520,
  1131. canvasId: 'myCanvas',
  1132. success: function(res) {
  1133. uni.saveImageToPhotosAlbum({
  1134. filePath: res.tempFilePath,
  1135. success: function() {
  1136. that.$successToast('保存成功');
  1137. },
  1138. });
  1139. },
  1140. });
  1141. },
  1142. // 关闭canvas
  1143. closeCanvas() {
  1144. this.isShowCanvas = false;
  1145. uni.hideLoading();
  1146. },
  1147. },
  1148. };
  1149. </script>
  1150. <style lang="scss">
  1151. .app-container {
  1152. background: #f4f2f2;
  1153. box-sizing: border-box;
  1154. padding-bottom: 100rpx;
  1155. }
  1156. .recommender-container {
  1157. position: fixed;
  1158. top: 20rpx;
  1159. left: 0;
  1160. z-index: 99;
  1161. display: flex;
  1162. justify-content: center;
  1163. width: 100%;
  1164. .content {
  1165. font-size: 28rpx;
  1166. color: #ffffff;
  1167. background: rgba($color: #000000, $alpha: 0.8);
  1168. display: flex;
  1169. padding: 0 15rpx;
  1170. height: 60rpx;
  1171. border-radius: 60rpx;
  1172. justify-content: center;
  1173. align-items: center;
  1174. image {
  1175. width: 40rpx;
  1176. height: 40rpx;
  1177. display: block;
  1178. border-radius: 50%;
  1179. margin-right: 10rpx;
  1180. }
  1181. .name {
  1182. max-width: 160rpx;
  1183. margin-right: 6rpx;
  1184. }
  1185. }
  1186. }
  1187. .swiper-container {
  1188. position: relative;
  1189. swiper {
  1190. height: 750rpx;
  1191. }
  1192. .image {
  1193. width: 750rpx;
  1194. height: 750rpx;
  1195. display: block;
  1196. margin: 0 auto;
  1197. overflow: hidden;
  1198. position: relative;
  1199. .img {
  1200. width: 750rpx;
  1201. height: 750rpx;
  1202. display: block;
  1203. }
  1204. .water {
  1205. width: 750rpx;
  1206. height: 750rpx;
  1207. display: block;
  1208. position: absolute;
  1209. left: 0;
  1210. top: 0;
  1211. z-index: 1;
  1212. }
  1213. }
  1214. // image {
  1215. // height: 750rpx;
  1216. // width: 750rpx;
  1217. // display: block;
  1218. // margin: 0 auto;
  1219. // overflow: hidden;
  1220. // }
  1221. video {
  1222. height: 750rpx;
  1223. width: 750rpx;
  1224. display: block;
  1225. margin: 0 auto;
  1226. overflow: hidden;
  1227. }
  1228. .nums {
  1229. position: absolute;
  1230. right: 20rpx;
  1231. bottom: 20rpx;
  1232. background: rgba($color: #000000, $alpha: 0.2);
  1233. border-radius: 8rpx;
  1234. line-height: 48rpx;
  1235. padding: 0 12rpx;
  1236. font-size: 28rpx;
  1237. color: #ffffff;
  1238. }
  1239. }
  1240. .video-container {
  1241. position: fixed;
  1242. right: 20rpx;
  1243. bottom: 300rpx;
  1244. z-index: -99;
  1245. &.isFixed {
  1246. z-index: 99;
  1247. }
  1248. .content {
  1249. position: relative;
  1250. }
  1251. video {
  1252. height: 200rpx;
  1253. width: 375rpx;
  1254. }
  1255. .close {
  1256. position: absolute;
  1257. right: 0;
  1258. top: 0;
  1259. z-index: 100;
  1260. background: rgba($color: #000000, $alpha: 0.4);
  1261. padding: 10rpx;
  1262. image {
  1263. width: 28rpx;
  1264. height: 28rpx;
  1265. display: block;
  1266. }
  1267. }
  1268. }
  1269. .seckill-container {
  1270. height: 120rpx;
  1271. background: linear-gradient(-90deg, rgba(255, 37, 118, 1) 0%, #ff5648 100%);
  1272. display: flex;
  1273. justify-content: space-between;
  1274. align-items: center;
  1275. padding: 0 20rpx;
  1276. position: relative;
  1277. .clock {
  1278. position: absolute;
  1279. right: 220rpx;
  1280. top: 20rpx;
  1281. image {
  1282. width: 74rpx;
  1283. height: 72rpx;
  1284. display: block;
  1285. }
  1286. }
  1287. .price-1 {
  1288. font-size: 40rpx;
  1289. color: #ffffff;
  1290. line-height: 44rpx;
  1291. }
  1292. .price-2 {
  1293. font-size: 28rpx;
  1294. line-height: 32rpx;
  1295. color: #dddddd;
  1296. text-decoration: line-through;
  1297. }
  1298. .right {
  1299. display: flex;
  1300. flex-direction: column;
  1301. align-items: center;
  1302. text {
  1303. font-size: 24rpx;
  1304. color: #ffffff;
  1305. }
  1306. .time {
  1307. font-size: 24rpx;
  1308. color: #ffffff;
  1309. display: flex;
  1310. align-items: center;
  1311. margin-top: 6rpx;
  1312. text {
  1313. width: 40rpx;
  1314. height: 40rpx;
  1315. background: #ffffff;
  1316. border-radius: 4rpx;
  1317. color: #ff2775;
  1318. font-size: 24rpx;
  1319. line-height: 40rpx;
  1320. text-align: center;
  1321. margin: 0 4rpx;
  1322. }
  1323. }
  1324. }
  1325. }
  1326. .main-container {
  1327. background: #ffffff;
  1328. padding: 20rpx 20rpx 0;
  1329. .title {
  1330. font-size: 32rpx;
  1331. color: #333333;
  1332. line-height: 40rpx;
  1333. font-weight: 600;
  1334. }
  1335. .des {
  1336. font-size: 24rpx;
  1337. color: #999999;
  1338. line-height: 28rpx;
  1339. margin-top: 8rpx;
  1340. }
  1341. .stock {
  1342. display: flex;
  1343. justify-content: space-between;
  1344. align-items: flex-end;
  1345. margin-top: 20rpx;
  1346. padding-bottom: 20rpx;
  1347. .left {
  1348. display: flex;
  1349. align-items: center;
  1350. text {
  1351. font-size: 24rpx;
  1352. color: #666666;
  1353. }
  1354. .progress-box {
  1355. width: 140rpx;
  1356. border-radius: 6px;
  1357. overflow: hidden;
  1358. margin-left: 10rpx;
  1359. }
  1360. }
  1361. .right {
  1362. font-size: 28rpx;
  1363. color: #999999;
  1364. display: flex;
  1365. align-items: center;
  1366. image {
  1367. width: 20rpx;
  1368. height: 20rpx;
  1369. display: block;
  1370. margin-left: 10rpx;
  1371. }
  1372. }
  1373. }
  1374. .price {
  1375. display: flex;
  1376. justify-content: space-between;
  1377. align-items: flex-end;
  1378. // margin-top: 10rpx;
  1379. padding-bottom: 20rpx;
  1380. .left {
  1381. display: flex;
  1382. flex-direction: column;
  1383. }
  1384. .price-1 {
  1385. font-size: 32rpx;
  1386. color: #ff3f42;
  1387. line-height: 36rpx;
  1388. }
  1389. .price-2 {
  1390. font-size: 26rpx;
  1391. color: #666666;
  1392. line-height: 30rpx;
  1393. text-decoration: line-through;
  1394. }
  1395. .right {
  1396. font-size: 28rpx;
  1397. color: #999999;
  1398. display: flex;
  1399. align-items: center;
  1400. image {
  1401. width: 20rpx;
  1402. height: 20rpx;
  1403. display: block;
  1404. margin-left: 10rpx;
  1405. }
  1406. }
  1407. }
  1408. .bottom {
  1409. display: flex;
  1410. align-items: center;
  1411. justify-content: space-between;
  1412. height: 76rpx;
  1413. border-top: 1px solid #eaeaea;
  1414. font-size: 28rpx;
  1415. color: #666666;
  1416. }
  1417. }
  1418. .line-container {
  1419. background: #ffffff;
  1420. margin-top: 20rpx;
  1421. display: flex;
  1422. justify-content: space-between;
  1423. align-items: center;
  1424. height: 88rpx;
  1425. font-size: 28rpx;
  1426. color: #333333;
  1427. padding: 0 20rpx;
  1428. text {
  1429. color: #fe781f;
  1430. }
  1431. }
  1432. .detail-container {
  1433. background: #ffffff;
  1434. margin-top: 20rpx;
  1435. .title {
  1436. font-size: 32rpx;
  1437. color: #333333;
  1438. line-height: 88rpx;
  1439. text-align: center;
  1440. font-weight: 600;
  1441. }
  1442. .content {
  1443. image {
  1444. width: 100%;
  1445. }
  1446. }
  1447. }
  1448. .evaluate-container {
  1449. background: #ffffff;
  1450. margin-top: 20rpx;
  1451. .title {
  1452. font-size: 32rpx;
  1453. color: #333333;
  1454. line-height: 88rpx;
  1455. text-align: center;
  1456. font-weight: 600;
  1457. }
  1458. .list {
  1459. display: flex;
  1460. overflow-x: scroll;
  1461. padding: 0 20rpx;
  1462. .item {
  1463. width: 650rpx;
  1464. padding-right: 30rpx;
  1465. flex-shrink: 0;
  1466. &:last-child {
  1467. padding-right: 20rpx;
  1468. }
  1469. &.onlyOne {
  1470. width: 710rpx;
  1471. }
  1472. .top {
  1473. display: flex;
  1474. justify-content: space-between;
  1475. align-items: center;
  1476. .user {
  1477. display: flex;
  1478. align-items: center;
  1479. image {
  1480. width: 80rpx;
  1481. height: 80rpx;
  1482. display: block;
  1483. border-radius: 50%;
  1484. margin-right: 20rpx;
  1485. }
  1486. .name {
  1487. font-size: 28rpx;
  1488. color: #333333;
  1489. width: 250rpx;
  1490. }
  1491. }
  1492. .date {
  1493. font-size: 28rpx;
  1494. color: #999999;
  1495. }
  1496. }
  1497. .rate {
  1498. margin-top: 14rpx;
  1499. .it {
  1500. display: flex;
  1501. align-items: center;
  1502. font-size: 24rpx;
  1503. color: #666666;
  1504. margin-top: 5rpx;
  1505. &>text {
  1506. margin-right: 10rpx;
  1507. }
  1508. }
  1509. }
  1510. .tags {
  1511. display: flex;
  1512. flex-wrap: wrap;
  1513. .it {
  1514. line-height: 44rpx;
  1515. padding: 0 15rpx;
  1516. border: 1px solid #eaeaea;
  1517. border-radius: 44rpx;
  1518. font-size: 24rpx;
  1519. margin-right: 14rpx;
  1520. margin-top: 14rpx;
  1521. color: #666666;
  1522. }
  1523. }
  1524. .content {
  1525. font-size: 28rpx;
  1526. color: #333333;
  1527. margin-top: 14rpx;
  1528. }
  1529. .images {
  1530. display: flex;
  1531. flex-wrap: wrap;
  1532. margin-top: 14rpx;
  1533. image {
  1534. width: 140rpx;
  1535. height: 140rpx;
  1536. margin-right: 20rpx;
  1537. margin-bottom: 20rpx;
  1538. }
  1539. }
  1540. }
  1541. }
  1542. .more {
  1543. display: flex;
  1544. justify-content: center;
  1545. padding: 10rpx 0 30rpx;
  1546. .btn {
  1547. width: 220rpx;
  1548. height: 68rpx;
  1549. line-height: 68rpx;
  1550. text-align: center;
  1551. border-radius: 68rpx;
  1552. border: 1px solid #eaeaea;
  1553. font-size: 28rpx;
  1554. color: #666666;
  1555. }
  1556. }
  1557. }
  1558. .bottom-container {
  1559. position: fixed;
  1560. bottom: 0;
  1561. left: 0;
  1562. width: 100%;
  1563. box-sizing: border-box;
  1564. padding: 0 20rpx;
  1565. background: #ffffff;
  1566. display: flex;
  1567. justify-content: space-between;
  1568. align-items: center;
  1569. height: 100rpx;
  1570. border-top: 1px solid #eaeaea;
  1571. .left {
  1572. display: flex;
  1573. width: 280rpx;
  1574. .item {
  1575. display: flex;
  1576. flex-direction: column;
  1577. align-items: center;
  1578. justify-content: center;
  1579. margin-right: 40rpx;
  1580. position: relative;
  1581. width: 66rpx;
  1582. &:last-child {
  1583. margin-right: 0;
  1584. }
  1585. image {
  1586. width: 40rpx;
  1587. height: 40rpx;
  1588. display: block;
  1589. }
  1590. text {
  1591. font-size: 22rpx;
  1592. color: #333333;
  1593. margin-top: 4rpx;
  1594. }
  1595. .dot {
  1596. position: absolute;
  1597. right: -4rpx;
  1598. top: -8rpx;
  1599. background: #ff3f42;
  1600. width: 32rpx;
  1601. height: 32rpx;
  1602. line-height: 32rpx;
  1603. text-align: center;
  1604. border-radius: 32rpx;
  1605. font-size: 20rpx;
  1606. color: #ffffff;
  1607. }
  1608. }
  1609. }
  1610. .right {
  1611. display: flex;
  1612. .button {
  1613. width: 190rpx;
  1614. height: 80rpx;
  1615. line-height: 80rpx;
  1616. text-align: center;
  1617. border-radius: 80rpx;
  1618. font-size: 28rpx;
  1619. color: #ffffff;
  1620. &.cart {
  1621. background: #fe781f;
  1622. }
  1623. &.buy {
  1624. background: #ff3f42;
  1625. margin-left: 10rpx;
  1626. }
  1627. &.sec {
  1628. background: linear-gradient(-90deg, #ff3f42 0%, #fe781f 100%);
  1629. }
  1630. }
  1631. }
  1632. }
  1633. .cart-container {
  1634. padding: 50rpx 20rpx 30rpx;
  1635. .main {
  1636. display: flex;
  1637. padding: 20rpx 0;
  1638. border-bottom: 1px solid #eaeaea;
  1639. image {
  1640. width: 200rpx;
  1641. height: 200rpx;
  1642. display: block;
  1643. flex-shrink: 0;
  1644. }
  1645. .right {
  1646. margin-left: 26rpx;
  1647. display: flex;
  1648. flex-direction: column;
  1649. justify-content: space-between;
  1650. .title {
  1651. font-size: 28rpx;
  1652. color: #333333;
  1653. line-height: 36rpx;
  1654. }
  1655. .price {
  1656. display: flex;
  1657. flex-direction: column;
  1658. }
  1659. .price-1 {
  1660. font-size: 32rpx;
  1661. color: #ff3f42;
  1662. line-height: 36rpx;
  1663. }
  1664. .price-2 {
  1665. font-size: 26rpx;
  1666. color: #666666;
  1667. line-height: 30rpx;
  1668. text-decoration: line-through;
  1669. }
  1670. .stock {
  1671. font-size: 24rpx;
  1672. color: #999999;
  1673. }
  1674. }
  1675. }
  1676. .attr {
  1677. padding: 20rpx 0;
  1678. border-bottom: 1px solid #eaeaea;
  1679. .title {
  1680. font-size: 28rpx;
  1681. color: #333333;
  1682. }
  1683. .list {
  1684. display: flex;
  1685. flex-wrap: wrap;
  1686. .item {
  1687. margin-top: 16rpx;
  1688. padding: 10rpx 16rpx;
  1689. font-size: 24rpx;
  1690. color: #666666;
  1691. background: #f5f5f5;
  1692. border-radius: 5rpx;
  1693. margin-right: 16rpx;
  1694. &.current {
  1695. color: #ff3f42;
  1696. background: rgba($color: #ff3f42, $alpha: 0.2);
  1697. }
  1698. }
  1699. }
  1700. }
  1701. .num {
  1702. padding: 20rpx 0;
  1703. display: flex;
  1704. justify-content: space-between;
  1705. align-items: center;
  1706. .title {
  1707. font-size: 28rpx;
  1708. color: #333333;
  1709. }
  1710. }
  1711. .button {
  1712. text-align: center;
  1713. line-height: 74rpx;
  1714. border-radius: 74rpx;
  1715. background: linear-gradient(-90deg, #ff3f42 0%, #fe781f 100%);
  1716. font-size: 28rpx;
  1717. color: #ffffff;
  1718. margin-top: 20rpx;
  1719. }
  1720. }
  1721. .package-container {
  1722. padding: 30rpx 20rpx;
  1723. .main {
  1724. max-height: 75vh;
  1725. overflow-y: scroll;
  1726. .group {
  1727. border-bottom: 1px solid #eaeaea;
  1728. &:last-child {
  1729. border: none;
  1730. }
  1731. .title {
  1732. font-size: 28rpx;
  1733. color: #ff3f42;
  1734. line-height: 28rpx;
  1735. margin: 20rpx 0;
  1736. }
  1737. .goods-list {
  1738. .item {
  1739. display: flex;
  1740. align-items: center;
  1741. background: #ffffff;
  1742. margin-bottom: 20rpx;
  1743. image {
  1744. width: 180rpx;
  1745. height: 180rpx;
  1746. display: block;
  1747. margin-right: 20rpx;
  1748. flex-shrink: 0;
  1749. }
  1750. .right {
  1751. flex: 1;
  1752. height: 190rpx;
  1753. display: flex;
  1754. justify-content: space-between;
  1755. flex-direction: column;
  1756. .name {
  1757. font-size: 28rpx;
  1758. color: #333333;
  1759. line-height: 36rpx;
  1760. height: 72rpx;
  1761. }
  1762. .des {
  1763. font-size: 24rpx;
  1764. color: #999999;
  1765. line-height: 36rpx;
  1766. }
  1767. .bottom {
  1768. display: flex;
  1769. justify-content: space-between;
  1770. align-items: center;
  1771. .price {
  1772. display: flex;
  1773. flex-direction: column;
  1774. }
  1775. .price-1 {
  1776. font-size: 32rpx;
  1777. color: #ff3f42;
  1778. line-height: 36rpx;
  1779. }
  1780. .price-2 {
  1781. font-size: 26rpx;
  1782. color: #666666;
  1783. line-height: 30rpx;
  1784. text-decoration: line-through;
  1785. }
  1786. }
  1787. }
  1788. }
  1789. }
  1790. }
  1791. }
  1792. .button {
  1793. text-align: center;
  1794. line-height: 74rpx;
  1795. border-radius: 74rpx;
  1796. background: linear-gradient(-90deg, #ff3f42 0%, #fe781f 100%);
  1797. font-size: 28rpx;
  1798. color: #ffffff;
  1799. margin-top: 20rpx;
  1800. }
  1801. }
  1802. .sharelist-container {
  1803. padding: 30rpx 0;
  1804. display: flex;
  1805. button {
  1806. background: none;
  1807. border-radius: 0;
  1808. &::after {
  1809. border: none;
  1810. }
  1811. }
  1812. .item {
  1813. display: flex;
  1814. width: 50%;
  1815. flex-direction: column;
  1816. align-items: center;
  1817. image {
  1818. width: 100rpx;
  1819. height: 100rpx;
  1820. display: block;
  1821. margin-bottom: 20rpx;
  1822. }
  1823. text {
  1824. font-size: 28rpx;
  1825. line-height: 32rpx;
  1826. color: #333333;
  1827. }
  1828. }
  1829. }
  1830. .canvas-container {
  1831. position: fixed;
  1832. left: 50%;
  1833. top: 50%;
  1834. z-index: 999;
  1835. margin-left: -150px;
  1836. margin-top: -280px;
  1837. .button {
  1838. display: flex;
  1839. justify-content: center;
  1840. text {
  1841. display: block;
  1842. width: 280rpx;
  1843. height: 70rpx;
  1844. border-radius: 70rpx;
  1845. background: linear-gradient(-90deg, #ff3f42 0%, #fe781f 100%);
  1846. font-size: 28rpx;
  1847. color: #ffffff;
  1848. text-align: center;
  1849. line-height: 70rpx;
  1850. margin-top: 20rpx;
  1851. }
  1852. }
  1853. }
  1854. .phone-dialog {
  1855. padding: 40rpx;
  1856. box-sizing: border-box;
  1857. .content {
  1858. margin-top: 30rpx;
  1859. margin-bottom: 30rpx;
  1860. line-height: 50rpx;
  1861. text {
  1862. color: #9d9d9d;
  1863. }
  1864. }
  1865. .btn {
  1866. display: flex;
  1867. justify-content: center;
  1868. margin-top: 60rpx;
  1869. button::after {
  1870. border: none;
  1871. }
  1872. button {
  1873. width: 180rpx;
  1874. height: 70rpx;
  1875. line-height: 70rpx;
  1876. margin: 0;
  1877. font-size: 28rpx;
  1878. margin: 0 30rpx;
  1879. &:first-child {
  1880. background: #f5f5f5;
  1881. color: #00ba5c;
  1882. }
  1883. }
  1884. }
  1885. }
  1886. </style>