productdetails.vue 39 KB

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