productdetails.vue 34 KB

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