productdetails.vue 34 KB

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