productdetails.vue 34 KB

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