productdetails.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  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 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">{{ 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 }} 2384w+</text>
  155. <view class="line"></view>
  156. <!-- 评价总数 -->
  157. <text class="num">{{ i18n.Salesvolume }} 2384w+</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="">
  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" 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">{{
  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" 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" 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="serve = false">
  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="serve = false">
  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. chat() {
  497. uni.navigateTo({
  498. url: '/pageA/chat/chat?user_other=' + encodeURIComponent(JSON.stringify(this.goodinfo.merchant)) +'&user_other_no=' + this.goodinfo.merchant.member.easemob_username
  499. })
  500. },
  501. sharea() {
  502. this.share = true
  503. },
  504. close() {
  505. this.show = false
  506. this.share = false
  507. },
  508. //评论页面
  509. tocomment() {
  510. uni.navigateTo({
  511. url: "/pageA/comment?id=" + this.goodinfo.merchant_goods_id,
  512. });
  513. },
  514. //关注
  515. fllow() {
  516. uni.$u.http
  517. .post("/api/interest/follow", {
  518. interest_type: 0,
  519. interest_id: this.goodinfo.merchant_goods_id,
  520. })
  521. .then((res) => {
  522. if (res == "ok1") {
  523. this.$u.toast("取关成功");
  524. this.detail(this.id);
  525. } else {
  526. this.$u.toast("关注成功");
  527. this.detail(this.id);
  528. }
  529. })
  530. .catch(() => {});
  531. },
  532. sele() {
  533. this.shopcar = 2;
  534. this.show = true;
  535. },
  536. //跳转到购物车
  537. shopping() {
  538. uni.switchTab({
  539. url: "/pages/cart/cart",
  540. });
  541. },
  542. //评论接口
  543. comment() {
  544. uni.$u.http
  545. .post("/api/goods/goods_comment", {
  546. merchant_goods_id: this.goodinfo.merchant_goods_id,
  547. page: 1,
  548. limit: 2,
  549. })
  550. .then((res) => {
  551. this.commentlist = res.data;
  552. this.total = res.total;
  553. })
  554. .catch(() => {});
  555. },
  556. //商品推荐
  557. recommend() {
  558. uni.$u.http
  559. .post("/api/goods/recommend", {
  560. keyword: "",
  561. })
  562. .then((res) => {
  563. this.swiptlist = res.reduce(
  564. (a, b) => {
  565. let lastIndex = a.length - 1;
  566. if (a[lastIndex].length < 3) {
  567. a[lastIndex].push(b);
  568. } else {
  569. a.push([b]);
  570. }
  571. return a;
  572. },
  573. [
  574. []
  575. ]
  576. );
  577. })
  578. .catch(() => {});
  579. },
  580. scrollToPosition(e) {
  581. var that = this
  582. this.current = e.index;
  583. console.log(this.current);
  584. this.$nextTick(() => {
  585. that.toView = "scroll" + e.index;
  586. console.log('view', that.toView);
  587. })
  588. },
  589. //逛逛
  590. goshop() {
  591. uni.navigateTo({
  592. url: "/pageD/homepage/homepage",
  593. });
  594. },
  595. detail(id) {
  596. uni.$u.http
  597. .get("/api/goods/detail/" + id)
  598. .then((res) => {
  599. console.log(res);
  600. this.goodinfo = res;
  601. console.log('goodinfo.discount_price', this.goodinfo.discount_price);
  602. this.comment();
  603. this.rate = res.merchant.score;
  604. })
  605. .catch(() => {});
  606. },
  607. //保障服务
  608. guarantee() {
  609. uni.$u.http
  610. .get("/api/agreement?code=guarantee_service")
  611. .then((res) => {
  612. console.log(res);
  613. this.content = res
  614. })
  615. .catch(() => {});
  616. },
  617. // scrollToPosition() {
  618. // console.log(111);
  619. // // 使用$refs获取目标位置的DOM元素
  620. // const targetElement = this.$refs.targetPosition;
  621. // // 调用scrollToView方法滚动到目标位置
  622. // this.$refs.scrollView.scrollToView('targetPosition');
  623. // },
  624. actabs(index, child, idx) {
  625. // this.actidx = index
  626. // this.actab = child
  627. console.log(this.selectArr);
  628. if (this.selectArr[index] != child) {
  629. this.$set(this.selectArr, index, child);
  630. this.$set(this.subIndex, index, idx);
  631. } else {
  632. this.$set(this.selectArr, index, "");
  633. this.$set(this.subIndex, index, -1); //去掉选中颜色
  634. }
  635. this.goodinfo.sku_item.forEach((ite) => {
  636. console.log(ite.item);
  637. console.log(this.selectArr.join(","));
  638. if (ite.item == this.selectArr.join(",")) {
  639. this.sku_info = ite;
  640. }
  641. });
  642. console.log(this.sku_info);
  643. },
  644. order() {
  645. if (this.sku_info.stock_total != 0) {
  646. uni.navigateTo({
  647. url: "/pageA/order?sku=" +
  648. encodeURIComponent(JSON.stringify(this.sku_info)) +
  649. "&value=" +
  650. this.value +
  651. "&goodinfo=" +
  652. encodeURIComponent(JSON.stringify(this.goodinfo)),
  653. });
  654. } else {
  655. this.$u.toast("库存为0");
  656. this.show = false;
  657. }
  658. // console.log(JSON.stringify(this.sku_info));
  659. },
  660. //生成图片弹窗
  661. builder() {
  662. this.imagea = true;
  663. this.share = false;
  664. },
  665. //加入购物车
  666. joincart() {
  667. this.show = false;
  668. if (this.sku_info.stock_total == 0) {
  669. this.$u.toast("添加失败,库存为0");
  670. } else {
  671. uni.$u.http
  672. .post("/api/cart/save", {
  673. goods_id: this.id, //63 是 String 商品id
  674. goods_num: this.value, //1 是 String 商品数量
  675. sku_item_id: this.sku_info.id, //38 是 String 规格详情id
  676. merchant_goods_id: this.goodinfo.merchant_goods_id, //38 是 String 团长商品id
  677. belong: this.goodinfo.source, //是 String 商品归属 0 团长 1 平台自营 2 团长发布或者分享的平台自营商品、 供应链商品
  678. share_merchant_id: "", //是 String 分享团长id
  679. })
  680. .then((res) => {
  681. this.$u.toast("添加成功");
  682. })
  683. .catch(() => {});
  684. }
  685. },
  686. valChange(e) {
  687. return e.value;
  688. },
  689. navigateBack() {
  690. uni.navigateBack();
  691. },
  692. join(index) {
  693. this.show = true;
  694. this.shopcar = index;
  695. },
  696. //通知
  697. inform() {
  698. uni.showToast({
  699. title: this.i18n.shelves,
  700. icon: "none",
  701. duration: 2000,
  702. });
  703. },
  704. //复制
  705. onLongPress(e) {
  706. // 获取长按的文本内容
  707. let text = e.target.innerText;
  708. console.log(e);
  709. // 执行复制操作
  710. uni.setClipboardData({
  711. data: text,
  712. success: () => {
  713. uni.showToast({
  714. title: this.i18n.Copiedpaste,
  715. duration: 2000,
  716. });
  717. },
  718. fail: () => {
  719. uni.showToast({
  720. title: this.i18n.Replicationfailure,
  721. icon: "none",
  722. duration: 2000,
  723. });
  724. },
  725. });
  726. },
  727. },
  728. };
  729. </script>
  730. <style lang="scss" scoped>
  731. .over {
  732. font-family: PingFangSC, PingFang SC;
  733. font-weight: 400;
  734. font-size: 26rpx;
  735. color: #222222;
  736. line-height: 36rpx;
  737. text-align: left;
  738. font-style: normal;
  739. text-overflow: ellipsis;
  740. overflow: hidden;
  741. -webkit-line-clamp: 2;
  742. height: 70rpx;
  743. display: -webkit-box;
  744. -webkit-box-orient: vertical;
  745. }
  746. .redback {
  747. background: rgba(255, 27, 0, 0.07);
  748. border-radius: 12rpx;
  749. padding: 6rpx 12rpx;
  750. box-sizing: border-box;
  751. font-family: HarmonyOS_Sans_Medium;
  752. font-size: 16rpx;
  753. color: #ff1515;
  754. line-height: 22rpx;
  755. text-align: left;
  756. font-style: normal;
  757. width: 150rpx;
  758. }
  759. .sku {
  760. font-family: PingFangSC, PingFang SC;
  761. font-weight: 400;
  762. font-size: 20rpx;
  763. color: #888888;
  764. line-height: 28rpx;
  765. text-align: left;
  766. font-style: normal;
  767. }
  768. .acttab {
  769. height: 68rpx;
  770. padding: 14rpx 30rpx;
  771. text-align: center;
  772. box-sizing: border-box;
  773. display: inline;
  774. background: rgba(248, 50, 36, 0.06);
  775. border-radius: 6rpx;
  776. border: 2rpx solid #f83224;
  777. font-family: PingFangSC, PingFang SC;
  778. font-weight: 400;
  779. font-size: 28rpx;
  780. color: #f83224;
  781. line-height: 40rpx;
  782. }
  783. .read {
  784. font-family: HarmonyOS_Sans_Medium;
  785. font-size: 26rpx;
  786. color: #f83224;
  787. line-height: 36rpx;
  788. text-align: left;
  789. font-style: normal;
  790. }
  791. // ::v-deep .u-popup__content{
  792. // background-color: rgba(0,0,0,0) !important;
  793. // }
  794. .money {
  795. font-family: HarmonyOS_Sans_Medium;
  796. font-size: 20rpx;
  797. color: #f83224;
  798. line-height: 26rpx;
  799. text-align: left;
  800. font-style: normal;
  801. }
  802. .title {
  803. font-family: PingFangSC, PingFang SC;
  804. font-weight: 400;
  805. font-size: 28rpx;
  806. color: #222222;
  807. line-height: 40rpx;
  808. text-align: left;
  809. font-style: normal;
  810. margin-top: 16rpx;
  811. }
  812. .view {
  813. font-family: PingFangSC, PingFang SC;
  814. font-weight: 400;
  815. font-size: 20rpx;
  816. color: #777777;
  817. line-height: 28rpx;
  818. text-align: left;
  819. font-style: normal;
  820. margin-top: 12rpx;
  821. }
  822. .actabs {
  823. width: 116rpx;
  824. height: 68rpx;
  825. background: rgba(248, 50, 36, 0.06);
  826. border-radius: 6rpx;
  827. border: 2rpx solid #f83224;
  828. }
  829. .bottoma {
  830. width: 750rpx;
  831. height: 166rpx;
  832. background: #ffffff;
  833. padding: 16rpx 44rpx 0;
  834. position: fixed;
  835. bottom: 0;
  836. left: 0;
  837. .btn {
  838. width: 662rpx;
  839. height: 84rpx;
  840. background: #f83224;
  841. border-radius: 44rpx;
  842. font-family: PingFangSC, PingFang SC;
  843. font-weight: 500;
  844. font-size: 32rpx;
  845. color: #ffffff;
  846. line-height: 84rpx;
  847. text-align: center;
  848. font-style: normal;
  849. }
  850. }
  851. .title1 {
  852. font-family: PingFangSC, PingFang SC;
  853. font-weight: 550;
  854. font-size: 32rpx;
  855. color: #222222;
  856. line-height: 44rpx;
  857. text-align: left;
  858. font-style: normal;
  859. }
  860. .tabs {
  861. // width: 276rpx;
  862. height: 68rpx;
  863. padding: 14rpx 30rpx;
  864. text-align: center;
  865. background: #f4f4f4;
  866. border-radius: 6rpx;
  867. box-sizing: border-box;
  868. display: inline;
  869. font-size: 28rpx;
  870. border: 2rpx solid rgba(151, 151, 151, 0);
  871. line-height: 40rpx;
  872. // line-height: 68rpx;
  873. }
  874. .link {
  875. font-family: PingFangSC, PingFang SC;
  876. font-weight: 400;
  877. font-size: 28rpx;
  878. color: #555555;
  879. line-height: 40rpx;
  880. text-align: left;
  881. font-style: normal;
  882. margin-top: 16rpx;
  883. }
  884. .tongzhi {
  885. width: 422rpx;
  886. height: 76rpx;
  887. background: #ffb515;
  888. border-radius: 40rpx;
  889. font-family: PingFangSC, PingFang SC;
  890. font-weight: 500;
  891. font-size: 28rpx;
  892. color: #ffffff;
  893. line-height: 76rpx;
  894. text-align: center;
  895. font-style: normal;
  896. }
  897. .info {
  898. font-family: PingFangSC, PingFang SC;
  899. font-weight: 400;
  900. font-size: 20rpx;
  901. color: #222222;
  902. line-height: 28rpx;
  903. text-align: left;
  904. font-style: normal;
  905. margin-top: 18rpx;
  906. }
  907. .button {
  908. // width: 662rpx;
  909. height: 88rpx;
  910. background: #f83224;
  911. border-radius: 44rpx;
  912. margin-top: 24rpx;
  913. font-family: PingFangSC, PingFang SC;
  914. font-weight: 500;
  915. font-size: 32rpx;
  916. color: #ffffff;
  917. line-height: 88rpx;
  918. text-align: center;
  919. font-style: normal;
  920. }
  921. .contenta {
  922. width: 702rpx;
  923. // height: 590rpx;
  924. background: #ffffff;
  925. border-radius: 20rpx;
  926. margin-top: 26rpx;
  927. padding: 28rpx 24rpx;
  928. box-sizing: border-box;
  929. .title {
  930. font-family: PingFangSC, PingFang SC;
  931. font-weight: 500;
  932. font-size: 30rpx;
  933. color: #222222;
  934. line-height: 42rpx;
  935. text-align: left;
  936. font-style: normal;
  937. }
  938. .content {
  939. font-family: PingFangSC, PingFang SC;
  940. font-weight: 400;
  941. font-size: 26rpx;
  942. color: rgba(34, 34, 34, 0.5);
  943. line-height: 36rpx;
  944. text-align: left;
  945. font-style: normal;
  946. margin-top: 20rpx;
  947. }
  948. }
  949. .back {
  950. background-color: #f4f4f4;
  951. padding: 20rpx;
  952. box-sizing: border-box;
  953. .guige {}
  954. .fix {
  955. width: 750rpx;
  956. height: 158rpx;
  957. background: #ffffff;
  958. padding: 14rpx 28rpx;
  959. box-sizing: border-box;
  960. position: fixed;
  961. bottom: 0;
  962. left: 0;
  963. .ke {
  964. font-family: PingFangSC, PingFang SC;
  965. font-weight: 400;
  966. font-size: 20rpx;
  967. color: #333333;
  968. line-height: 28rpx;
  969. text-align: left;
  970. font-style: normal;
  971. }
  972. .join {
  973. width: 208rpx;
  974. height: 76rpx;
  975. border-radius: 40rpx;
  976. border: 1rpx solid #ff1515;
  977. font-family: PingFangSC, PingFang SC;
  978. font-weight: 500;
  979. font-size: 28rpx;
  980. color: #f83224;
  981. line-height: 76rpx;
  982. text-align: left;
  983. font-style: normal;
  984. text-align: center;
  985. }
  986. .pin {
  987. width: 208rpx;
  988. height: 76rpx;
  989. background: #f83224;
  990. border-radius: 40rpx;
  991. font-family: PingFangSC, PingFang SC;
  992. font-weight: 500;
  993. font-size: 28rpx;
  994. color: #ffffff;
  995. line-height: 76rpx;
  996. text-align: center;
  997. font-style: normal;
  998. }
  999. }
  1000. // 规格
  1001. .specification {
  1002. width: 670rpx;
  1003. // height: 280rpx;
  1004. background: #f4f4f4;
  1005. padding: 24rpx 22rpx;
  1006. box-sizing: border-box;
  1007. view:last-of-type {
  1008. margin-bottom: 0rpx !important;
  1009. }
  1010. .item {
  1011. font-family: PingFangSC, PingFang SC;
  1012. font-weight: 400;
  1013. font-size: 26rpx;
  1014. color: #333333;
  1015. line-height: 36rpx;
  1016. text-align: left;
  1017. font-style: normal;
  1018. }
  1019. }
  1020. // 推荐
  1021. .recommend {
  1022. width: 710rpx;
  1023. // height: 476rpx;
  1024. background: #ffffff;
  1025. border-radius: 16rpx;
  1026. padding: 24rpx 20rpx;
  1027. margin-top: 20rpx;
  1028. box-sizing: border-box;
  1029. .title {
  1030. font-family: PingFangSC, PingFang SC;
  1031. font-weight: 550;
  1032. font-size: 28rpx;
  1033. color: #222222;
  1034. line-height: 40rpx;
  1035. text-align: left;
  1036. font-style: normal;
  1037. }
  1038. }
  1039. //店铺
  1040. .store {
  1041. width: 710rpx;
  1042. height: 160rpx;
  1043. background: #ffffff;
  1044. border-radius: 16rpx;
  1045. padding: 24rpx 20rpx;
  1046. box-sizing: border-box;
  1047. margin-top: 20rpx;
  1048. .line {
  1049. background: rgba(151, 151, 151, 1);
  1050. width: 4rpx;
  1051. height: 20rpx;
  1052. margin: 0 18rpx;
  1053. }
  1054. .num {
  1055. font-family: SFPro, SFPro;
  1056. font-weight: 400;
  1057. font-size: 20rpx;
  1058. color: #777777;
  1059. line-height: 24rpx;
  1060. text-align: left;
  1061. font-style: normal;
  1062. }
  1063. .goshop {
  1064. // width: 108rpx;
  1065. height: 52rpx;
  1066. border-radius: 26rpx;
  1067. border: 1rpx solid #ff1515;
  1068. font-family: PingFangSC, PingFang SC;
  1069. font-weight: 400;
  1070. font-size: 24rpx;
  1071. color: #f83224;
  1072. line-height: 52rpx;
  1073. text-align: center;
  1074. font-style: normal;
  1075. padding: 0 20rpx;
  1076. box-sizing: border-box;
  1077. }
  1078. }
  1079. // 评论
  1080. .comment {
  1081. width: 710rpx;
  1082. // height: 356rpx;
  1083. background: #ffffff;
  1084. border-radius: 16rpx;
  1085. margin-top: 20rpx;
  1086. padding: 24rpx 20rpx;
  1087. box-sizing: border-box;
  1088. .content {
  1089. margin-top: 20rpx;
  1090. font-family: PingFangSC, PingFang SC;
  1091. font-weight: 400;
  1092. font-size: 26rpx;
  1093. color: #444444;
  1094. line-height: 36rpx;
  1095. text-align: left;
  1096. font-style: normal;
  1097. max-height: 112rpx;
  1098. overflow: hidden;
  1099. text-overflow: ellipsis;
  1100. white-space: wrap;
  1101. -webkit-line-clamp: 3;
  1102. }
  1103. .name {
  1104. font-family: PingFangSC, PingFang SC;
  1105. font-weight: 400;
  1106. font-size: 24rpx;
  1107. color: #222222;
  1108. line-height: 34rpx;
  1109. text-align: left;
  1110. font-style: normal;
  1111. margin-left: 16rpx;
  1112. }
  1113. .ping {
  1114. font-family: PingFangSC, PingFang SC;
  1115. font-weight: 500;
  1116. font-size: 28rpx;
  1117. color: #222222;
  1118. line-height: 40rpx;
  1119. text-align: left;
  1120. font-style: normal;
  1121. }
  1122. .strip {
  1123. font-family: PingFangSC, PingFang SC;
  1124. font-weight: 400;
  1125. font-size: 24rpx;
  1126. color: #444444;
  1127. line-height: 34rpx;
  1128. text-align: left;
  1129. font-style: normal;
  1130. }
  1131. }
  1132. //服务
  1133. .serve {
  1134. width: 710rpx;
  1135. height: 180rpx;
  1136. background: #ffffff;
  1137. border-radius: 16rpx;
  1138. padding: 32rpx 20rpx;
  1139. box-sizing: border-box;
  1140. .top {
  1141. .change {
  1142. font-family: PingFangSC, PingFang SC;
  1143. font-weight: 400;
  1144. font-size: 28rpx;
  1145. color: #666666;
  1146. line-height: 40rpx;
  1147. text-align: left;
  1148. font-style: normal;
  1149. }
  1150. }
  1151. }
  1152. //折扣
  1153. .discount {
  1154. position: relative;
  1155. height: 312rpx;
  1156. .top {
  1157. width: 710rpx;
  1158. height: 124rpx;
  1159. background: linear-gradient(295deg, #fb6662 0%, #fd403b 100%);
  1160. border-radius: 16rpx 16rpx 0 0;
  1161. padding: 20rpx;
  1162. box-sizing: border-box;
  1163. line-height: 98rpx;
  1164. .count {
  1165. font-family: PingFangSC, PingFang SC;
  1166. font-weight: 400;
  1167. font-size: 20rpx;
  1168. color: #ffffff;
  1169. text-align: left;
  1170. font-style: normal;
  1171. }
  1172. .money {
  1173. font-size: 20rpx;
  1174. font-family: HarmonyOS_Sans_Medium;
  1175. font-size: 20rpx;
  1176. color: #ffffff;
  1177. text-align: left;
  1178. font-style: normal;
  1179. margin-left: 8rpx;
  1180. }
  1181. .right {
  1182. font-family: HarmonyOS_Sans;
  1183. font-size: 24rpx;
  1184. color: #ffffff;
  1185. text-align: left;
  1186. font-style: normal;
  1187. text-decoration-line: line-through;
  1188. margin-left: 16rpx;
  1189. }
  1190. }
  1191. .bottom {
  1192. width: 710rpx;
  1193. height: 208rpx;
  1194. background: #ffffff;
  1195. border-radius: 16rpx;
  1196. position: absolute;
  1197. top: 104rpx;
  1198. z-index: 2;
  1199. padding: 28rpx 20rpx;
  1200. box-sizing: border-box;
  1201. .title {
  1202. margin-top: 24rpx;
  1203. font-family: PingFangSC, PingFang SC;
  1204. font-weight: 550;
  1205. font-size: 32rpx;
  1206. color: #222222;
  1207. line-height: 44rpx;
  1208. text-align: left;
  1209. font-style: normal;
  1210. }
  1211. }
  1212. .tabs {
  1213. // width: 104rpx;
  1214. height: 40rpx;
  1215. background: rgba(255, 21, 21, 0.1);
  1216. border-radius: 4rpx;
  1217. padding: 4rpx 8rpx;
  1218. font-family: PingFangSC, PingFang SC;
  1219. font-weight: 400;
  1220. font-size: 22rpx;
  1221. color: #ff1515;
  1222. line-height: 40rpx;
  1223. text-align: center;
  1224. font-style: normal;
  1225. }
  1226. }
  1227. }
  1228. // 轮播图
  1229. .uni-margin-wrap {
  1230. width: 750rpx;
  1231. width: 100%;
  1232. .swiper {
  1233. height: 750rpx;
  1234. }
  1235. .swiper-item {
  1236. display: block;
  1237. height: 300rpx;
  1238. line-height: 300rpx;
  1239. text-align: center;
  1240. }
  1241. .swiper-list {
  1242. margin-top: 40rpx;
  1243. margin-bottom: 0;
  1244. }
  1245. .uni-common-mt {
  1246. margin-top: 60rpx;
  1247. position: relative;
  1248. }
  1249. .info {
  1250. position: absolute;
  1251. right: 20rpx;
  1252. }
  1253. .uni-padding-wrap {
  1254. width: 550rpx;
  1255. padding: 0 100rpx;
  1256. }
  1257. }
  1258. ::v-deep .u-popup__content data-v-17becaea {
  1259. align-items: center !important;
  1260. }
  1261. </style>