productdetails.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340
  1. <template>
  2. <view>
  3. <scroll-view ref="scrollView" scroll-y="true" scroll-with-animation="true" style="min-height: 100vh;"
  4. :scroll-into-view="toView">
  5. <!-- 页面内容 -->
  6. <!-- 自定义导航栏 -->
  7. <u-navbar :safeAreaInsetTop="true" :placeholder="true">
  8. <view class="u-nav-slot u-flex" slot="left" style="display: flex">
  9. <view class="u-flex">
  10. <u-icon name="arrow-left" size="19" @click="returnindex"></u-icon>
  11. <u-tabs :duration="duration" @click="scrollToPosition" :list="list1" lineColor="#fff"
  12. :activeStyle="{ color: '#FF1515' }" :inactiveStyle="{
  13. color: ' #666666',
  14. }"></u-tabs>
  15. </view>
  16. <!-- <view class="" style="margin-left: 184rpx;" @click="share = true">
  17. <image src="static/images/share.png" style="width: 38rpx;height: 38rpx;" mode=""></image>
  18. </view> -->
  19. </view>
  20. <view class="u-nav-slot u-flex" slot="right" style="display: flex">
  21. <view class="" style="margin-left: 184rpx" @click="sharea">
  22. <image src="static/images/share.png" style="width: 38rpx; height: 38rpx" mode=""></image>
  23. </view>
  24. <view class="" style="width: 180rpx"></view>
  25. </view>
  26. </u-navbar>
  27. <!-- 商品图片 -->
  28. <view class="uni-margin-wrap" id="scroll0">
  29. <swiper class="swiper" circular :indicator-dots="false" :autoplay="true">
  30. <swiper-item v-if="goodinfo.video">
  31. <video style="width: 750rpx; height: 750rpx" :src="goodinfo.video"></video>
  32. </swiper-item>
  33. <template v-if="goodinfo.images">
  34. <swiper-item v-for="(item, idx) in goodinfo.images.split(',')" :key="idx">
  35. <image :src="goodinfo.image" style="width: 750rpx; height: 750rpx" mode=""></image>
  36. </swiper-item>
  37. </template>
  38. </swiper>
  39. </view>
  40. <view class="back">
  41. <!-- 折扣 -->
  42. <view class="discount">
  43. <view class="top">
  44. <text class="count" v-if="goodinfo.is_discount == 0">{{
  45. i18n.Discounted
  46. }}</text>
  47. <text class="money">¥</text>
  48. <text class="money" style="font-size: 48rpx">{{
  49. goodinfo.is_discount == 0
  50. ? goodinfo.discount_price.slice(0, -3)
  51. : goodinfo.price.slice(0, -3)
  52. }}</text>
  53. <text class="money">{{
  54. goodinfo.is_discount == 0
  55. ? goodinfo.discount_price.slice(-3)
  56. : goodinfo.price.slice(-3)
  57. }}</text>
  58. <text class="right" v-if="goodinfo.is_discount == 0">¥{{ goodinfo.price }}</text>
  59. </view>
  60. <view class="bottom">
  61. <view class="u-flex" style="column-gap:16rpx">
  62. <div v-for="(tab,idx) in goodinfo.label_arr" :key="idx">
  63. <text v-if="language == 'zh-CN'" class="tabs">{{ tab.name_cn }}</text>
  64. <text v-if="language == 'en-US'" class="tabs">{{ tab.name_en }}</text>
  65. <text v-if="language == 'es-ES'" class="tabs">{{ tab.name_es }}</text>
  66. <text v-if="language == 'it-IT'" class="tabs">{{ tab.name_ita }}</text>
  67. </div>
  68. </view>
  69. <view class="">
  70. <text class="title" v-if="language == 'zh-CN'">
  71. {{ goodinfo.name_cn }}
  72. </text>
  73. <text class="title" selectable @longpress="onLongPress" v-if="language == 'en-US'">
  74. {{ goodinfo.name_en }}
  75. </text>
  76. <text class="title" selectable @longpress="onLongPress" v-if="language == 'es-ES'">
  77. {{ goodinfo.name_es }}
  78. </text>
  79. <text class="title" selectable @longpress="onLongPress" v-if="language == 'it-IT'">
  80. {{ goodinfo.name_ita }}
  81. </text>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 服务 -->
  86. <view class="serve" style="margin-top: 20rpx">
  87. <view class="top u-flex u-row-between" @click="sele">
  88. <view class="u-flex">
  89. <view class="change">{{ i18n.Sele }}</view>
  90. <view class="" style="margin-left: 20rpx">
  91. {{ selectArr.length > 0 ? selectArr.join(",") : i18n.Sele }}
  92. </view>
  93. </view>
  94. <view class="">
  95. <u-icon name="arrow-right" size="16"></u-icon>
  96. </view>
  97. </view>
  98. <view class="top u-flex u-row-between" style="margin-top: 36rpx" @click="openfu">
  99. <view class="u-flex">
  100. <view class="change">{{ i18n.service }}</view>
  101. <view v-if="language == 'zh-CN'" class="" style="margin-left: 20rpx">{{content.name_cn}}
  102. </view>
  103. <view v-if="language == 'en-US'" class="" style="margin-left: 20rpx">{{content.name_en}}
  104. </view>
  105. <view v-if="language == 'es-ES'" class="" style="margin-left: 20rpx">{{content.name_es}}
  106. </view>
  107. <view v-if="language == 'it-IT'" class="" style="margin-left: 20rpx">{{content.name_ita}}
  108. </view>
  109. </view>
  110. <view class="">
  111. <u-icon name="arrow-right" size="16"></u-icon>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 评论 -->
  116. <view class="comment" ref="targetPosition" id="scroll1">
  117. <view class="u-flex u-row-between">
  118. <text class="ping">{{ i18n.review }}</text>
  119. <view class="u-flex" @click="tocomment">
  120. <text class="strip">{{ total }}{{ i18n.article + i18n.review }}</text>
  121. <u-icon name="arrow-right" size="16"></u-icon>
  122. </view>
  123. </view>
  124. <view class="" v-for="(item, idx) in commentlist" :key="idx">
  125. <view class="uesr u-flex u-row-between" style="margin-top: 36rpx">
  126. <view class="u-flex">
  127. <image src="../static/images/logo.png" style="width: 52rpx; height: 52rpx" mode="">
  128. </image>
  129. <text class="name">{{ item.member.nickname }}</text>
  130. </view>
  131. <text class="strip">{{ item.created_at }}</text>
  132. </view>
  133. <view class="content">
  134. {{ item.content }}
  135. </view>
  136. <view class="sku" style="margin-top: 16rpx">{{
  137. item.sku_item.item
  138. }}</view>
  139. </view>
  140. </view>
  141. <!-- 店铺 -->
  142. <view class="store u-flex u-row-between">
  143. <view class="u-flex">
  144. <image :src="goodinfo.merchant.image" style="width: 112rpx; height: 112rpx" mode=""></image>
  145. <view class="" style="margin-left: 20rpx">
  146. <view class="title" style="width: 600;">{{ goodinfo.merchant.merchant_name }}</view>
  147. <view class="redback u-flex">
  148. <uni-rate network allow-half :readonly="true" active-color="red"
  149. color="rgba(255, 27, 0, 0.5)" :size="8" :value="5" v-model="rate" />
  150. <text style="margin-left: 8rpx">{{ rate }}</text>
  151. </view>
  152. <view class="" style="margin-top: 20rpx"></view>
  153. <view class="u-flex" style="margin-top: 20rpx">
  154. <text class="num">{{ i18n.Salesvolume }} {{goodinfo.merchant.sale_num}}</text>
  155. <view class="line"></view>
  156. <!-- 评价总数 -->
  157. <text class="num">{{ i18n.review }} {{goodinfo.merchant.comment_num}}</text>
  158. </view>
  159. </view>
  160. </view>
  161. <view class="goshop" @click="goshop">{{ i18n.stroll }}</view>
  162. </view>
  163. <!-- 推荐 -->
  164. <view class="recommend">
  165. <view class="title">
  166. {{ i18n.Recommended }}
  167. </view>
  168. <view class="" style="margin-top: 10rpx;">
  169. <swiper style="height: 400rpx" class="swiper" circular :indicator-dots="true" :autoplay="true">
  170. <swiper-item v-for="(parent, index) in swiptlist" :key="index">
  171. <view class="u-flex swiper-item u-row-between">
  172. <view class="" v-for="(child, idx) in parent" @click="detail(child.id)" :key="idx">
  173. <image :src="child.image" style="width: 214rpx; height: 214rpx;border-radius: 10rpx;" mode="">
  174. </image>
  175. <view class="over" style="
  176. width: 214rpx;
  177. margin-top: 14rpx;
  178. font-style: normal;
  179. font-size: 26rpx;
  180. " v-if="language == 'zh-CN'">
  181. {{ child.name_cn }}
  182. </view>
  183. <view class="over" style="
  184. width: 214rpx;
  185. margin-top: 14rpx;
  186. font-style: normal;
  187. font-size: 26rpx;
  188. " v-if="language == 'en-US'">
  189. {{ child.name_en }}
  190. </view>
  191. <view class="over" style="
  192. width: 214rpx;
  193. margin-top: 14rpx;
  194. font-style: normal;
  195. font-size: 26rpx;
  196. " v-if="language == 'es-ES'">
  197. {{ child.name_es }}
  198. </view>
  199. <view class="over" style="
  200. width: 214rpx;
  201. margin-top: 14rpx;
  202. font-style: normal;
  203. font-size: 26rpx;
  204. " v-if="language == 'it-IT'">
  205. {{ child.name_ita }}
  206. </view>
  207. <view class="" style="margin-top: 12rpx">
  208. <span
  209. style="color: rgba(204, 51, 0, 1); font-size: 26rpx">¥{{ child.price }}</span>
  210. </view>
  211. </view>
  212. </view>
  213. </swiper-item>
  214. </swiper>
  215. </view>
  216. </view>
  217. <view class="recommend" id="scroll2">
  218. <view class="title">{{ i18n.Productdetails }}</view>
  219. <view class="" style="margin-top: 32rpx; margin-bottom: 28rpx;font-size: 26rpx;">{{
  220. i18n.Specification
  221. }}</view>
  222. <view class="specification">
  223. <view class="item u-flex" style="margin-bottom: 28rpx" v-for="(item, idx) in goodinfo.parameter"
  224. :key="idx">
  225. <view style="width: 150rpx">{{ item.name }}</view>
  226. <text style="margin-left: 58rpx">{{ item.value }}</text>
  227. </view>
  228. </view>
  229. <view class="" style="margin-top: 28rpx;">
  230. <u-parse :content="goodinfo.detail_cn"></u-parse>
  231. <!-- <image :src="goodinfo.image" style="width: 100%; height: 580rpx" mode=""></image> -->
  232. </view>
  233. </view>
  234. <view class="" style="height: 158rpx"></view>
  235. <view class="fix u-flex u-row-between">
  236. <view class="u-flex" style="column-gap: 35rpx">
  237. <view class="u-flex" style="justify-content: center; flex-direction: column" @click="chat">
  238. <image src="../static/images/index/service.png" style="width: 40rpx; height: 40rpx" mode="">
  239. </image>
  240. <view class="ke">{{ i18n.Customer }}</view>
  241. </view>
  242. <view class="u-flex" style="justify-content: center; flex-direction: column" @click="shopping">
  243. <image src="../static/cart1.png" style="width: 40rpx; height: 40rpx" mode="">
  244. </image>
  245. <view class="ke">{{ i18n.Shopping }}</view>
  246. </view>
  247. <view class="u-flex" style="
  248. justify-content: center;
  249. flex-direction: column;
  250. width: 70rpx;
  251. " @click="fllow">
  252. <image v-if="goodinfo.is_interest == 1" src="../static/images/index/attention.png"
  253. style="width: 40rpx; height: 40rpx" mode=""></image>
  254. <image v-if="goodinfo.is_interest == 0" src="../static/images/index/bottom1.png"
  255. style="width: 40rpx; height: 40rpx" mode="">
  256. </image>
  257. <view v-if="goodinfo.is_interest == 1" class="ke">{{
  258. i18n.follow
  259. }}</view>
  260. <view v-if="goodinfo.is_interest == 0" class="ke" style="color: rgba(248, 50, 36, 1)">已关注
  261. </view>
  262. </view>
  263. </view>
  264. <view v-if="sku_info.stock_total == 0" class="tongzhi" @click="inform">
  265. {{ i18n.notification }}
  266. </view>
  267. <view v-if="sku_info.stock_total != 0" class="join" @click="join(0)">加入购物车</view>
  268. <view v-if="sku_info.stock_total != 0" class="pin" @click="join(1)">立即拼团</view>
  269. </view>
  270. </view>
  271. </scroll-view>
  272. <!-- 加入购物车 -->
  273. <u-popup :round="10" :show="show">
  274. <view style="padding: 48rpx 28rpx; box-sizing: border-box; position: relative">
  275. <view class="u-flex">
  276. <image :src="JSON.stringify(sku_info)=='{}'?goodinfo.image:sku_info.image"
  277. style="width: 192rpx; height: 192rpx" mode="">
  278. </image>
  279. <view class="" style="margin-left: 20rpx">
  280. <view class="">
  281. <text class="read">¥</text>
  282. <text class="read" style="font-size: 40rpx;font-weight: 600;" v-if="goodinfo.is_discount == 0">{{
  283. (Number(sku_info.discount_price * 100) *
  284. Number(value * 100)) /
  285. 10000 ||
  286. (Number(goodinfo.discount_price * 100) *
  287. Number(value * 100)) /
  288. 10000
  289. }}</text>
  290. <!-- <text class="read" v-if="goodinfo.is_discount==0">{{(goodinfo.discount_price * value).slice(-3)}}</text> -->
  291. <text class="read" style="font-size: 40rpx;font-weight: 600;" v-if="goodinfo.is_discount == 1">{{
  292. (Number(sku_info.price * 100) * Number(value * 100)) /
  293. 10000 ||
  294. (Number(goodinfo.price * 100) * Number(value * 100)) / 10000
  295. }}</text>
  296. <!-- <text class="read" v-if="goodinfo.is_discount==1">{{(goodinfo.price * value).slice(-3)}}</text> -->
  297. <!-- <text class="read" style="font-size: 40rpx;" >{{(Number(goodinfo.price) * Number(value)).toString()}}</text> -->
  298. </view>
  299. <text class="guige">已选:{{ selectArr.join(",") || i18n.selection }}</text>
  300. </view>
  301. </view>
  302. <view class="" style="position: absolute; top: 48rpx; right: 28rpx" @click="close">
  303. <u-icon name="close" color="#000" size="28"></u-icon>
  304. </view>
  305. <view class="" v-for="(item, index) in goodinfo.sku">
  306. <view class="title1" style="margin-top: 40rpx; margin-bottom: 32rpx">
  307. {{ item.name }}
  308. </view>
  309. <view class="u-flex" style="column-gap: 18rpx; flex-wrap: wrap">
  310. <view class="" :class="selectArr[index] == child ? 'acttab' : 'tabs'"
  311. v-for="(child, idx) in item.values" :key="idx" @click="actabs(index, child, item)">
  312. {{ child }}
  313. </view>
  314. </view>
  315. </view>
  316. <view class="u-flex u-row-between" style="margin-top: 30rpx">
  317. <text class="title1">数量</text>
  318. <u-number-box v-model="value" @change="valChange"></u-number-box>
  319. </view>
  320. <view class="" style="height: 200rpx"></view>
  321. <view class="bottoma">
  322. <view v-if="shopcar == 0" class="btn" @click="joincart">
  323. 加入购物车
  324. </view>
  325. <view v-if="shopcar == 1" class="btn" @click="order"> 立即购买 </view>
  326. <view v-if="shopcar == 2" class="btn" @click="close">
  327. 确定
  328. </view>
  329. </view>
  330. </view>
  331. </u-popup>
  332. <u-popup :show="serve" :round="20">
  333. <view style="
  334. padding: 48rpx 24rpx;
  335. box-sizing: border-box;
  336. background-color: #fff3e7;
  337. position: relative;
  338. border-radius: 20rpx 20rpx 0 0;
  339. ">
  340. <view class="u-flex" style="flex-direction: column; justify-content: center">
  341. <image src="../static/images/index/serve.png" style="width: 138rpx; height: 34rpx" mode=""></image>
  342. <text class="info"> 售前售后 安心无忧购物 </text>
  343. </view>
  344. <view class="" style="position: absolute; top: 48rpx; right: 24rpx" @click="close()">
  345. <u-icon name="close" style="width: 22rpx; height: 22rpx"></u-icon>
  346. </view>
  347. <view class="contenta">
  348. <view class="" v-if="language=='zh-CN'">
  349. <u-parse :content="content.content_cn"></u-parse>
  350. </view>
  351. <view class="" v-if="language=='en-US'">
  352. <u-parse :content="content.content_en"></u-parse>
  353. </view>
  354. <view class="" v-if="language=='es-ES'">
  355. <u-parse :content="content.content_es"></u-parse>
  356. </view>
  357. <view class="" v-if="language=='it-IT'">
  358. <u-parse :content="content.content_ita"></u-parse>
  359. </view>
  360. </view>
  361. <view class="button" @click="close()">
  362. {{ i18n.know }}
  363. </view>
  364. </view>
  365. </u-popup>
  366. <u-popup :round="10" :show="share" bgColor=" rgba(244, 244, 244, 1);">
  367. <view style="
  368. padding: 48rpx 24rpx;
  369. box-sizing: border-box;
  370. background-color: rgba(244, 244, 244, 1);
  371. border-radius: 10px 10px 0 0;
  372. ">
  373. <view class="u-flex u-row-between" style="">
  374. <view class="" style="width: 28px; height: 28px"></view>
  375. <text class="info" style="font-size: 32rpx">
  376. {{ i18n.shar }}
  377. </text>
  378. <image src="../static/images/index/bottom2.png" style="width: 40rpx; height: 40rpx">
  379. </image>
  380. </view>
  381. <!-- <view class="" style="position: absolute;top: 48rpx;right:24rpx;">
  382. </view> -->
  383. <view class="u-flex u-row-between" style="margin-top: 82rpx; padding: 0 140rpx">
  384. <view class="">
  385. <image src="../static/images/index/link.png" style="width: 108rpx; height: 108rpx" mode="">
  386. </image>
  387. <view class="link">{{ i18n.Copylink }}</view>
  388. </view>
  389. <view class="" @click="builder">
  390. <image src="../static/images/index/image.png" style="width: 108rpx; height: 108rpx" mode="">
  391. </image>
  392. <view class="link">{{ i18n.Generatepicture }}</view>
  393. </view>
  394. </view>
  395. <view class="button" @click="close" style="background: #fff; color: #555555; margin-top: 58rpx">
  396. {{ i18n.Cancel }}
  397. </view>
  398. </view>
  399. </u-popup>
  400. <u-popup :show="imagea" bgColor=" rgba(244, 244, 244, 0);" mode="center"
  401. :customStyle="{ alignItems: 'center' }">
  402. <view class="u-fle" style="display: flex; justify-content: flex-end; width: 100%">
  403. <u-icon name="close" @click="imagea == false" color="#fff" size="28"></u-icon>
  404. </view>
  405. <view style="
  406. padding: 48rpx 24rpx;
  407. box-sizing: border-box;
  408. background-color: rgba(255, 255, 255, 1);
  409. border-radius: 16rpx;
  410. width: 538rpx;
  411. ">
  412. <view class="" style="">
  413. <image src="../static/images/index/bottom2.png" style="width: 490rpx; height: 490rpx"></image>
  414. </view>
  415. <view class="money">
  416. <span>¥</span>
  417. <span style="font-size: 36rpx">258</span>
  418. <span>00</span>
  419. </view>
  420. <view class="title">布兰德低温烘焙猫粮全价通用高端鲜肉成猫幼</view>
  421. <view class="" style="
  422. display: flex;
  423. flex-direction: column;
  424. align-items: center;
  425. justify-content: center;
  426. margin-top: 44rpx;
  427. ">
  428. <image src="../static/images/logo.png" style="width: 132rpx; height: 132rpx" mode=""></image>
  429. <view class="view">长按识别查看</view>
  430. </view>
  431. </view>
  432. <view class="button" style="width: 658rpx">保存到相册</view>
  433. </u-popup>
  434. </view>
  435. </template>
  436. <script>
  437. export default {
  438. data() {
  439. return {
  440. toView: "",
  441. imagea: false,
  442. list1: [{
  443. name: "商品",
  444. },
  445. {
  446. name: "评价",
  447. },
  448. {
  449. name: "详情",
  450. },
  451. ],
  452. current: 0,
  453. // 购物车
  454. show: false,
  455. //服务
  456. serve: false,
  457. //分享
  458. share: false,
  459. value: 1, //步进器的值
  460. swiptlist: [], //推荐列表
  461. actab: 0,
  462. id: "", //商品id
  463. language: "zh-CN",
  464. goodinfo: {}, //商品详情
  465. duration: 0, //tabs选项
  466. actidx: 0,
  467. subIndex: [],
  468. selectArr: [],
  469. shopcar: "",
  470. sku_info: {},
  471. commentlist: [],
  472. total: "",
  473. rate: 5,
  474. content: {},
  475. bao: ''
  476. };
  477. },
  478. computed: {
  479. i18n() {
  480. return this.$t("index");
  481. },
  482. },
  483. onLoad(options) {
  484. this.id = options.id;
  485. this.comment();
  486. },
  487. onShow() {
  488. if (uni.getStorageSync("language") != "") {
  489. this.language = uni.getStorageSync("language");
  490. }
  491. this.detail(this.id);
  492. this.recommend();
  493. this.guarantee()
  494. },
  495. methods: {
  496. openfu(){
  497. this.serve = true
  498. },
  499. returnindex() {
  500. uni.switchTab({
  501. url:'/pages/index/index'
  502. })
  503. },
  504. chat() {
  505. uni.navigateTo({
  506. url: '/pageA/chat/chat?user_other=' + encodeURIComponent(JSON.stringify(this.goodinfo
  507. .merchant)) + '&user_other_no=' + this.goodinfo.merchant.member.easemob_username
  508. })
  509. },
  510. sharea() {
  511. this.share = true
  512. },
  513. close() {
  514. this.show = false
  515. this.share = false
  516. this.serve = false
  517. },
  518. //评论页面
  519. tocomment() {
  520. uni.navigateTo({
  521. url: "/pageA/comment?id=" + this.goodinfo.merchant_goods_id,
  522. });
  523. },
  524. //关注
  525. fllow() {
  526. uni.$u.http
  527. .post("/api/interest/follow", {
  528. interest_type: 0,
  529. interest_id: this.goodinfo.merchant_goods_id,
  530. })
  531. .then((res) => {
  532. if (res == "ok1") {
  533. this.$u.toast("取关成功");
  534. this.detail(this.id);
  535. } else {
  536. this.$u.toast("关注成功");
  537. this.detail(this.id);
  538. }
  539. })
  540. .catch(() => {});
  541. },
  542. sele() {
  543. this.shopcar = 2;
  544. this.show = true;
  545. },
  546. //跳转到购物车
  547. shopping() {
  548. uni.switchTab({
  549. url: "/pages/cart/cart",
  550. });
  551. },
  552. //评论接口
  553. comment() {
  554. uni.$u.http
  555. .post("/api/goods/goods_comment", {
  556. merchant_goods_id: this.goodinfo.merchant_goods_id,
  557. page: 1,
  558. limit: 2,
  559. })
  560. .then((res) => {
  561. this.commentlist = res.data;
  562. this.total = res.total;
  563. })
  564. .catch(() => {});
  565. },
  566. //商品推荐
  567. recommend() {
  568. uni.$u.http
  569. .post("/api/goods/recommend", {
  570. keyword: "",
  571. })
  572. .then((res) => {
  573. this.swiptlist = res.reduce(
  574. (a, b) => {
  575. let lastIndex = a.length - 1;
  576. if (a[lastIndex].length < 3) {
  577. a[lastIndex].push(b);
  578. } else {
  579. a.push([b]);
  580. }
  581. return a;
  582. },
  583. [
  584. []
  585. ]
  586. );
  587. })
  588. .catch(() => {});
  589. },
  590. scrollToPosition(e) {
  591. var that = this
  592. this.current = e.index;
  593. console.log(this.current);
  594. this.$nextTick(() => {
  595. that.toView = "scroll" + e.index;
  596. console.log('view', that.toView);
  597. })
  598. },
  599. //逛逛
  600. goshop() {
  601. uni.navigateTo({
  602. url: "/pageD/homepage/homepage",
  603. });
  604. },
  605. detail(id) {
  606. uni.$u.http
  607. .get("/api/goods/detail/" + id)
  608. .then((res) => {
  609. console.log(res);
  610. this.goodinfo = res;
  611. console.log('goodinfo.discount_price', this.goodinfo.discount_price);
  612. this.comment();
  613. this.rate = res.merchant.score;
  614. })
  615. .catch(() => {});
  616. },
  617. //保障服务
  618. guarantee() {
  619. uni.$u.http
  620. .get("/api/agreement?code=guarantee_service")
  621. .then((res) => {
  622. console.log(res);
  623. this.content = res
  624. })
  625. .catch(() => {});
  626. },
  627. // scrollToPosition() {
  628. // console.log(111);
  629. // // 使用$refs获取目标位置的DOM元素
  630. // const targetElement = this.$refs.targetPosition;
  631. // // 调用scrollToView方法滚动到目标位置
  632. // this.$refs.scrollView.scrollToView('targetPosition');
  633. // },
  634. actabs(index, child, idx) {
  635. // this.actidx = index
  636. // this.actab = child
  637. console.log(this.selectArr);
  638. if (this.selectArr[index] != child) {
  639. this.$set(this.selectArr, index, child);
  640. this.$set(this.subIndex, index, idx);
  641. } else {
  642. this.$set(this.selectArr, index, "");
  643. this.$set(this.subIndex, index, -1); //去掉选中颜色
  644. }
  645. this.goodinfo.sku_item.forEach((ite) => {
  646. console.log(ite.item);
  647. console.log(this.selectArr.join(","));
  648. if (ite.item == this.selectArr.join(",")) {
  649. this.sku_info = ite;
  650. }
  651. });
  652. console.log(this.sku_info);
  653. },
  654. order() {
  655. if (this.sku_info.stock_total != 0) {
  656. uni.navigateTo({
  657. url: "/pageA/order?sku=" +
  658. encodeURIComponent(JSON.stringify(this.sku_info)) +
  659. "&value=" +
  660. this.value +
  661. "&goodinfo=" +
  662. encodeURIComponent(JSON.stringify(this.goodinfo)),
  663. });
  664. } else {
  665. this.$u.toast("库存为0");
  666. this.show = false;
  667. }
  668. // console.log(JSON.stringify(this.sku_info));
  669. },
  670. //生成图片弹窗
  671. builder() {
  672. this.imagea = true;
  673. this.share = false;
  674. },
  675. //加入购物车
  676. joincart() {
  677. this.show = false;
  678. if (this.sku_info.stock_total == 0) {
  679. this.$u.toast("添加失败,库存为0");
  680. } else {
  681. uni.$u.http
  682. .post("/api/cart/save", {
  683. goods_id: this.id, //63 是 String 商品id
  684. goods_num: this.value, //1 是 String 商品数量
  685. sku_item_id: this.sku_info.id, //38 是 String 规格详情id
  686. merchant_goods_id: this.goodinfo.merchant_goods_id, //38 是 String 团长商品id
  687. belong: this.goodinfo.source, //是 String 商品归属 0 团长 1 平台自营 2 团长发布或者分享的平台自营商品、 供应链商品
  688. share_merchant_id: "", //是 String 分享团长id
  689. })
  690. .then((res) => {
  691. this.$u.toast("添加成功");
  692. })
  693. .catch(() => {});
  694. }
  695. },
  696. valChange(e) {
  697. return e.value;
  698. },
  699. navigateBack() {
  700. uni.navigateBack();
  701. },
  702. join(index) {
  703. this.show = true;
  704. this.shopcar = index;
  705. },
  706. //通知
  707. inform() {
  708. uni.showToast({
  709. title: this.i18n.shelves,
  710. icon: "none",
  711. duration: 2000,
  712. });
  713. },
  714. //复制
  715. onLongPress(e) {
  716. // 获取长按的文本内容
  717. let text = e.target.innerText;
  718. console.log(e);
  719. // 执行复制操作
  720. uni.setClipboardData({
  721. data: text,
  722. success: () => {
  723. uni.showToast({
  724. title: this.i18n.Copiedpaste,
  725. duration: 2000,
  726. });
  727. },
  728. fail: () => {
  729. uni.showToast({
  730. title: this.i18n.Replicationfailure,
  731. icon: "none",
  732. duration: 2000,
  733. });
  734. },
  735. });
  736. },
  737. },
  738. };
  739. </script>
  740. <style lang="scss" scoped>
  741. .over {
  742. font-family: PingFangSC, PingFang SC;
  743. font-weight: 400;
  744. font-size: 26rpx;
  745. color: #222222;
  746. line-height: 36rpx;
  747. text-align: left;
  748. font-style: normal;
  749. text-overflow: ellipsis;
  750. overflow: hidden;
  751. -webkit-line-clamp: 2;
  752. height: 70rpx;
  753. display: -webkit-box;
  754. -webkit-box-orient: vertical;
  755. word-break: break-all;
  756. }
  757. .redback {
  758. background: rgba(255, 27, 0, 0.07);
  759. border-radius: 12rpx;
  760. padding: 6rpx 12rpx;
  761. box-sizing: border-box;
  762. font-family: HarmonyOS_Sans_Medium;
  763. font-size: 16rpx;
  764. color: #ff1515;
  765. line-height: 22rpx;
  766. text-align: left;
  767. font-style: normal;
  768. width: 150rpx;
  769. }
  770. .sku {
  771. font-family: PingFangSC, PingFang SC;
  772. font-weight: 400;
  773. font-size: 20rpx;
  774. color: #888888;
  775. line-height: 28rpx;
  776. text-align: left;
  777. font-style: normal;
  778. }
  779. .acttab {
  780. height: 68rpx;
  781. padding: 14rpx 30rpx;
  782. text-align: center;
  783. box-sizing: border-box;
  784. display: inline;
  785. background: rgba(248, 50, 36, 0.06);
  786. border-radius: 6rpx;
  787. border: 2rpx solid #f83224;
  788. font-family: PingFangSC, PingFang SC;
  789. font-weight: 400;
  790. font-size: 28rpx;
  791. color: #f83224;
  792. line-height: 40rpx;
  793. }
  794. .read {
  795. font-family: HarmonyOS_Sans_Medium;
  796. font-size: 26rpx;
  797. color: #f83224;
  798. line-height: 36rpx;
  799. text-align: left;
  800. font-style: normal;
  801. }
  802. // ::v-deep .u-popup__content{
  803. // background-color: rgba(0,0,0,0) !important;
  804. // }
  805. .money {
  806. font-family: HarmonyOS_Sans_Medium;
  807. font-size: 20rpx;
  808. color: #f83224;
  809. line-height: 26rpx;
  810. text-align: left;
  811. font-style: normal;
  812. }
  813. .title {
  814. font-family: PingFangSC, PingFang SC;
  815. font-weight: 400;
  816. font-size: 28rpx;
  817. color: #222222;
  818. line-height: 40rpx;
  819. text-align: left;
  820. font-style: normal;
  821. margin-top: 16rpx;
  822. width: 100%;
  823. overflow: hidden;
  824. text-overflow: ellipsis;
  825. word-break: break-all;
  826. -webkit-line-clamp: 2;
  827. display: -webkit-box;
  828. -webkit-box-orient: vertical;
  829. }
  830. .view {
  831. font-family: PingFangSC, PingFang SC;
  832. font-weight: 400;
  833. font-size: 20rpx;
  834. color: #777777;
  835. line-height: 28rpx;
  836. text-align: left;
  837. font-style: normal;
  838. margin-top: 12rpx;
  839. }
  840. .actabs {
  841. width: 116rpx;
  842. height: 68rpx;
  843. background: rgba(248, 50, 36, 0.06);
  844. border-radius: 6rpx;
  845. border: 2rpx solid #f83224;
  846. }
  847. .bottoma {
  848. width: 750rpx;
  849. height: 166rpx;
  850. background: #ffffff;
  851. padding: 16rpx 44rpx 0;
  852. position: fixed;
  853. bottom: 0;
  854. left: 0;
  855. .btn {
  856. width: 662rpx;
  857. height: 84rpx;
  858. background: #f83224;
  859. border-radius: 44rpx;
  860. font-family: PingFangSC, PingFang SC;
  861. font-weight: 500;
  862. font-size: 32rpx;
  863. color: #ffffff;
  864. line-height: 84rpx;
  865. text-align: center;
  866. font-style: normal;
  867. }
  868. }
  869. .title1 {
  870. font-family: PingFangSC, PingFang SC;
  871. font-weight: 550;
  872. font-size: 32rpx;
  873. color: #222222;
  874. line-height: 44rpx;
  875. text-align: left;
  876. font-style: normal;
  877. }
  878. .tabs {
  879. // width: 276rpx;
  880. height: 68rpx;
  881. padding: 14rpx 30rpx;
  882. text-align: center;
  883. background: #f4f4f4;
  884. border-radius: 6rpx;
  885. box-sizing: border-box;
  886. display: inline;
  887. font-size: 28rpx;
  888. border: 2rpx solid rgba(151, 151, 151, 0);
  889. line-height: 40rpx;
  890. // line-height: 68rpx;
  891. }
  892. .link {
  893. font-family: PingFangSC, PingFang SC;
  894. font-weight: 400;
  895. font-size: 28rpx;
  896. color: #555555;
  897. line-height: 40rpx;
  898. text-align: left;
  899. font-style: normal;
  900. margin-top: 16rpx;
  901. }
  902. .tongzhi {
  903. width: 422rpx;
  904. height: 76rpx;
  905. background: #ffb515;
  906. border-radius: 40rpx;
  907. font-family: PingFangSC, PingFang SC;
  908. font-weight: 500;
  909. font-size: 28rpx;
  910. color: #ffffff;
  911. line-height: 76rpx;
  912. text-align: center;
  913. font-style: normal;
  914. }
  915. .info {
  916. font-family: PingFangSC, PingFang SC;
  917. font-weight: 400;
  918. font-size: 20rpx;
  919. color: #222222;
  920. line-height: 28rpx;
  921. text-align: left;
  922. font-style: normal;
  923. margin-top: 18rpx;
  924. }
  925. .button {
  926. // width: 662rpx;
  927. height: 88rpx;
  928. background: #f83224;
  929. border-radius: 44rpx;
  930. margin-top: 24rpx;
  931. font-family: PingFangSC, PingFang SC;
  932. font-weight: 500;
  933. font-size: 32rpx;
  934. color: #ffffff;
  935. line-height: 88rpx;
  936. text-align: center;
  937. font-style: normal;
  938. }
  939. .contenta {
  940. width: 702rpx;
  941. // height: 590rpx;
  942. background: #ffffff;
  943. border-radius: 20rpx;
  944. margin-top: 26rpx;
  945. padding: 28rpx 24rpx;
  946. box-sizing: border-box;
  947. .title {
  948. font-family: PingFangSC, PingFang SC;
  949. font-weight: 500;
  950. font-size: 30rpx;
  951. color: #222222;
  952. line-height: 42rpx;
  953. text-align: left;
  954. font-style: normal;
  955. }
  956. .content {
  957. font-family: PingFangSC, PingFang SC;
  958. font-weight: 400;
  959. font-size: 26rpx;
  960. color: rgba(34, 34, 34, 0.5);
  961. line-height: 36rpx;
  962. text-align: left;
  963. font-style: normal;
  964. margin-top: 20rpx;
  965. }
  966. }
  967. .back {
  968. background-color: #f4f4f4;
  969. padding: 20rpx;
  970. box-sizing: border-box;
  971. .guige {}
  972. .fix {
  973. width: 750rpx;
  974. height: 158rpx;
  975. background: #ffffff;
  976. padding: 14rpx 28rpx;
  977. box-sizing: border-box;
  978. position: fixed;
  979. bottom: 0;
  980. left: 0;
  981. .ke {
  982. font-family: PingFangSC, PingFang SC;
  983. font-weight: 400;
  984. font-size: 20rpx;
  985. color: #333333;
  986. line-height: 28rpx;
  987. text-align: left;
  988. font-style: normal;
  989. }
  990. .join {
  991. width: 208rpx;
  992. height: 76rpx;
  993. border-radius: 40rpx;
  994. border: 1rpx solid #ff1515;
  995. font-family: PingFangSC, PingFang SC;
  996. font-weight: 500;
  997. font-size: 28rpx;
  998. color: #f83224;
  999. line-height: 76rpx;
  1000. text-align: left;
  1001. font-style: normal;
  1002. text-align: center;
  1003. }
  1004. .pin {
  1005. width: 208rpx;
  1006. height: 76rpx;
  1007. background: #f83224;
  1008. border-radius: 40rpx;
  1009. font-family: PingFangSC, PingFang SC;
  1010. font-weight: 500;
  1011. font-size: 28rpx;
  1012. color: #ffffff;
  1013. line-height: 76rpx;
  1014. text-align: center;
  1015. font-style: normal;
  1016. }
  1017. }
  1018. // 规格
  1019. .specification {
  1020. width: 670rpx;
  1021. // height: 280rpx;
  1022. background: #f4f4f4;
  1023. padding: 24rpx 22rpx;
  1024. box-sizing: border-box;
  1025. view:last-of-type {
  1026. margin-bottom: 0rpx !important;
  1027. }
  1028. .item {
  1029. font-family: PingFangSC, PingFang SC;
  1030. font-weight: 400;
  1031. font-size: 26rpx;
  1032. color: #333333;
  1033. line-height: 36rpx;
  1034. text-align: left;
  1035. font-style: normal;
  1036. }
  1037. }
  1038. // 推荐
  1039. .recommend {
  1040. width: 710rpx;
  1041. // height: 476rpx;
  1042. background: #ffffff;
  1043. border-radius: 16rpx;
  1044. padding: 24rpx 20rpx;
  1045. margin-top: 20rpx;
  1046. box-sizing: border-box;
  1047. .title {
  1048. font-family: PingFangSC, PingFang SC;
  1049. font-weight: 550;
  1050. font-size: 28rpx;
  1051. color: #222222;
  1052. line-height: 40rpx;
  1053. text-align: left;
  1054. font-style: normal;
  1055. }
  1056. }
  1057. //店铺
  1058. .store {
  1059. width: 710rpx;
  1060. height: 160rpx;
  1061. background: #ffffff;
  1062. border-radius: 16rpx;
  1063. padding: 24rpx 20rpx;
  1064. box-sizing: border-box;
  1065. margin-top: 20rpx;
  1066. .line {
  1067. background: rgba(151, 151, 151, 1);
  1068. width: 4rpx;
  1069. height: 20rpx;
  1070. margin: 0 18rpx;
  1071. }
  1072. .num {
  1073. font-family: SFPro, SFPro;
  1074. font-weight: 400;
  1075. font-size: 20rpx;
  1076. color: #777777;
  1077. line-height: 24rpx;
  1078. text-align: left;
  1079. font-style: normal;
  1080. }
  1081. .goshop {
  1082. // width: 108rpx;
  1083. height: 52rpx;
  1084. border-radius: 26rpx;
  1085. border: 1rpx solid #ff1515;
  1086. font-family: PingFangSC, PingFang SC;
  1087. font-weight: 400;
  1088. font-size: 24rpx;
  1089. color: #f83224;
  1090. line-height: 52rpx;
  1091. text-align: center;
  1092. font-style: normal;
  1093. padding: 0 20rpx;
  1094. box-sizing: border-box;
  1095. }
  1096. }
  1097. // 评论
  1098. .comment {
  1099. width: 710rpx;
  1100. // height: 356rpx;
  1101. background: #ffffff;
  1102. border-radius: 16rpx;
  1103. margin-top: 20rpx;
  1104. padding: 24rpx 20rpx;
  1105. box-sizing: border-box;
  1106. .content {
  1107. margin-top: 20rpx;
  1108. font-family: PingFangSC, PingFang SC;
  1109. font-weight: 400;
  1110. font-size: 26rpx;
  1111. color: #444444;
  1112. line-height: 36rpx;
  1113. text-align: left;
  1114. font-style: normal;
  1115. max-height: 112rpx;
  1116. overflow: hidden;
  1117. text-overflow: ellipsis;
  1118. white-space: wrap;
  1119. -webkit-line-clamp: 3;
  1120. word-break: break-all;
  1121. }
  1122. .name {
  1123. font-family: PingFangSC, PingFang SC;
  1124. font-weight: 400;
  1125. font-size: 24rpx;
  1126. color: #222222;
  1127. line-height: 34rpx;
  1128. text-align: left;
  1129. font-style: normal;
  1130. margin-left: 16rpx;
  1131. }
  1132. .ping {
  1133. font-family: PingFangSC, PingFang SC;
  1134. font-weight: 500;
  1135. font-size: 28rpx;
  1136. color: #222222;
  1137. line-height: 40rpx;
  1138. text-align: left;
  1139. font-style: normal;
  1140. }
  1141. .strip {
  1142. font-family: PingFangSC, PingFang SC;
  1143. font-weight: 400;
  1144. font-size: 24rpx;
  1145. color: #444444;
  1146. line-height: 34rpx;
  1147. text-align: left;
  1148. font-style: normal;
  1149. }
  1150. }
  1151. //服务
  1152. .serve {
  1153. width: 710rpx;
  1154. height: 180rpx;
  1155. background: #ffffff;
  1156. border-radius: 16rpx;
  1157. padding: 32rpx 20rpx;
  1158. box-sizing: border-box;
  1159. .top {
  1160. .change {
  1161. font-family: PingFangSC, PingFang SC;
  1162. font-weight: 400;
  1163. font-size: 28rpx;
  1164. color: #666666;
  1165. line-height: 40rpx;
  1166. text-align: left;
  1167. font-style: normal;
  1168. }
  1169. }
  1170. }
  1171. //折扣
  1172. .discount {
  1173. position: relative;
  1174. height: 312rpx;
  1175. .top {
  1176. width: 710rpx;
  1177. height: 124rpx;
  1178. background: linear-gradient(295deg, #fb6662 0%, #fd403b 100%);
  1179. border-radius: 16rpx 16rpx 0 0;
  1180. padding: 20rpx;
  1181. box-sizing: border-box;
  1182. line-height: 98rpx;
  1183. .count {
  1184. font-family: PingFangSC, PingFang SC;
  1185. font-weight: 400;
  1186. font-size: 20rpx;
  1187. color: #ffffff;
  1188. text-align: left;
  1189. font-style: normal;
  1190. }
  1191. .money {
  1192. font-size: 20rpx;
  1193. font-family: HarmonyOS_Sans_Medium;
  1194. font-size: 20rpx;
  1195. color: #ffffff;
  1196. text-align: left;
  1197. font-style: normal;
  1198. margin-left: 8rpx;
  1199. }
  1200. .right {
  1201. font-family: HarmonyOS_Sans;
  1202. font-size: 24rpx;
  1203. color: #ffffff;
  1204. text-align: left;
  1205. font-style: normal;
  1206. text-decoration-line: line-through;
  1207. margin-left: 16rpx;
  1208. }
  1209. }
  1210. .bottom {
  1211. width: 710rpx;
  1212. height: 208rpx;
  1213. background: #ffffff;
  1214. border-radius: 16rpx;
  1215. position: absolute;
  1216. top: 104rpx;
  1217. z-index: 2;
  1218. padding: 28rpx 20rpx;
  1219. box-sizing: border-box;
  1220. .title {
  1221. margin-top: 24rpx;
  1222. font-family: PingFangSC, PingFang SC;
  1223. font-weight: 550;
  1224. font-size: 32rpx;
  1225. color: #222222;
  1226. line-height: 44rpx;
  1227. text-align: left;
  1228. font-style: normal;
  1229. }
  1230. }
  1231. .tabs {
  1232. // width: 104rpx;
  1233. height: 40rpx;
  1234. background: rgba(255, 21, 21, 0.1);
  1235. border-radius: 4rpx;
  1236. padding: 4rpx 8rpx;
  1237. font-family: PingFangSC, PingFang SC;
  1238. font-weight: 400;
  1239. font-size: 22rpx;
  1240. color: #ff1515;
  1241. line-height: 40rpx;
  1242. text-align: center;
  1243. font-style: normal;
  1244. }
  1245. }
  1246. }
  1247. // 轮播图
  1248. .uni-margin-wrap {
  1249. width: 750rpx;
  1250. width: 100%;
  1251. .swiper {
  1252. height: 750rpx;
  1253. }
  1254. .swiper-item {
  1255. display: block;
  1256. height: 300rpx;
  1257. line-height: 300rpx;
  1258. text-align: center;
  1259. }
  1260. .swiper-list {
  1261. margin-top: 40rpx;
  1262. margin-bottom: 0;
  1263. }
  1264. .uni-common-mt {
  1265. margin-top: 60rpx;
  1266. position: relative;
  1267. }
  1268. .info {
  1269. position: absolute;
  1270. right: 20rpx;
  1271. }
  1272. .uni-padding-wrap {
  1273. width: 550rpx;
  1274. padding: 0 100rpx;
  1275. }
  1276. }
  1277. ::v-deep .u-popup__content data-v-17becaea {
  1278. align-items: center !important;
  1279. }
  1280. </style>