detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <template>
  2. <mobile-frame>
  3. <scroll-view class="scrollView" scroll-with-animation :scroll-into-view="topItem" scroll-y="true"
  4. @scroll="handleScroll">
  5. <view class="main" id="top">
  6. <view class="onemain">
  7. <scroll-view scroll-y="true" class="scroll-view">
  8. <view class="list-scroll-view">
  9. <view class="one">
  10. <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
  11. indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
  12. <swiper-item class="list" v-for="(item,index) in bannerList" :key="index">
  13. <image class="image" :src="item.url" mode=""></image>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. <view class="two">
  18. <view class="two_1">
  19. <view class="money_1">
  20. <text>¥</text>
  21. <text>{{info.sell_money}}</text>
  22. </view>
  23. <view class="money_2">
  24. <text>¥</text>
  25. <text>{{info.flow_money}}</text>
  26. </view>
  27. </view>
  28. <view class="two_2">{{info.name}}</view>
  29. <view class="two_3">{{info.shot_brief}}</view>
  30. <view class="two_4">
  31. <text>运费{{info.freight}}元</text>
  32. <text>{{info.send_time}}内发货</text>
  33. </view>
  34. </view>
  35. <view class="thr">
  36. <view class="thr_1" @click="toChoose">
  37. <view class="title">选择规格</view>
  38. <text class="iconfont icon-dayufuhao"></text>
  39. </view>
  40. <view class="thr_1">
  41. <view class="title">商品评价({{info.comment||0}})</view>
  42. <text class="iconfont icon-dayufuhao"></text>
  43. </view>
  44. </view>
  45. <view class="four">
  46. <view class="four_1">
  47. <image class="image" :src="shop.file"></image>
  48. <view class="other">
  49. <view class="name">{{shop.name}}</view>
  50. <view class="other_1"><text>宝贝数</text>{{shop.num}}</view>
  51. </view>
  52. </view>
  53. <view class="four_2">
  54. <view class="grade">商品:<text>{{shop.grade||'5.00'}}</text></view>|
  55. <view class="grade">发货:<text>{{shop.grade||'5.00'}}</text></view>|
  56. <view class="grade">服务:<text>{{shop.grade||'5.00'}}</text></view>
  57. </view>
  58. <view class="four_2">
  59. <view class="btn">进入店铺</view>
  60. <view class="btn">关注</view>
  61. </view>
  62. </view>
  63. <view class="five">
  64. <view class="five_1">{{info.brief}}</view>
  65. <view class="five_2" v-for="(item,index) in bannerList" :key="index">
  66. <image class="image" :src="item.url"></image>
  67. </view>
  68. </view>
  69. </view>
  70. </scroll-view>
  71. </view>
  72. <view class="foot">
  73. <uni-goods-nav :options="options" :button-group="buttonGroup" @click="onClick"
  74. @buttonClick="buttonClick" />
  75. </view>
  76. </view>
  77. </scroll-view>
  78. <view class="collect">
  79. <text v-if="collection==false" @click="toCollect('true')" class="iconfont icon-kongxin"></text>
  80. <text v-if="collection==true" @click="toCollect('false')" class="iconfont icon-shixin"></text>
  81. </view>
  82. <view class="menu">
  83. <text @click="menu" class="iconfont icon-gengduo"></text>
  84. </view>
  85. <view class="backTop" v-if="isShow==true">
  86. <text @click="backTop" class="iconfont icon-fanhuidingbu"></text>
  87. </view>
  88. <uni-popup ref="popup" background-color="#fff" type="bottom">
  89. <view class="content">
  90. <view class="one">
  91. <image class="image" :src="info.file"></image>
  92. <view class="other">
  93. <view class="money">
  94. <text>¥</text>
  95. <text>{{info.sell_money}}</text>
  96. </view>
  97. <view class="other_1">
  98. 已选: <text>{{Selected}}</text>
  99. </view>
  100. </view>
  101. <view class="btn">
  102. <text @click="toClose" class="iconfont icon-shanchu"></text>
  103. </view>
  104. </view>
  105. <view class="two">
  106. <view class="two_1">口味</view>
  107. <view class="two_2"><text>{{info.specs.flavor}}</text></view>
  108. </view>
  109. <view class="thr">
  110. <text>数量:</text>
  111. <view class="count">
  112. <lxc-count @handleCount="toCount" :value="info.specs.num" :delayed="100">
  113. </lxc-count>
  114. </view>
  115. </view>
  116. <view @click="toBuy" class="button">立即购买</view>
  117. </view>
  118. </uni-popup>
  119. </mobile-frame>
  120. </template>
  121. <script>
  122. import lxcCount from '@/components/lxc-count/lxc-count.vue'
  123. export default {
  124. components: {
  125. lxcCount
  126. },
  127. data() {
  128. return {
  129. options: [{
  130. icon: 'shop',
  131. text: '店铺',
  132. },
  133. {
  134. icon: 'cart',
  135. text: '购物车',
  136. }, {
  137. icon: 'chat',
  138. text: '客服',
  139. }
  140. ],
  141. buttonGroup: [{
  142. text: '加入购物车',
  143. backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
  144. color: '#fff'
  145. },
  146. {
  147. text: '立即购买',
  148. backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
  149. color: '#fff'
  150. }
  151. ],
  152. bannerList: [ // 轮播图
  153. {
  154. url: require('@/static/test.png')
  155. },
  156. {
  157. url: require('@/static/test.png')
  158. },
  159. {
  160. url: require('@/static/test.png')
  161. },
  162. {
  163. url: require('@/static/test.png')
  164. },
  165. ],
  166. // 详情
  167. info: {
  168. file: require('@/static/test.png'),
  169. name: '大红门无淀粉果木熏火腿360g',
  170. sell_money: 28.8,
  171. flow_money: 35,
  172. shot_brief: '果木熏制 传统技法',
  173. freight: 8.00,
  174. send_time: '24h',
  175. specs: {
  176. flavor: '果木熏火腿',
  177. num: 0
  178. },
  179. brief: '简介',
  180. },
  181. shop: {
  182. file: require('@/static/test.png'),
  183. name: '官方自营店',
  184. num: 2,
  185. time: '2022-09-27'
  186. },
  187. // 已选
  188. Selected: '',
  189. // 是否显示返回顶部
  190. isShow: false,
  191. topItem: '',
  192. // 收藏
  193. collection: false
  194. };
  195. },
  196. onShow: function() {},
  197. methods: {
  198. onClick(e) {
  199. uni.showToast({
  200. title: `点击${e.content.text}`,
  201. icon: 'none'
  202. })
  203. },
  204. buttonClick(e) {
  205. console.log(e)
  206. },
  207. // 选择规格
  208. toChoose() {
  209. this.$refs.popup.open();
  210. },
  211. // 关闭弹框
  212. toClose() {
  213. this.$refs.popup.close()
  214. },
  215. // 计数器
  216. toCount(e) {
  217. console.log(e);
  218. },
  219. // 立即购买
  220. toBuy() {},
  221. // 计算高度
  222. handleScroll(e) {
  223. const that = this;
  224. let scrollTop = e.detail.scrollTop;
  225. that.isShow = scrollTop > 500;
  226. that.topItem = '';
  227. },
  228. // 返回顶部
  229. backTop() {
  230. const that = this;
  231. that.topItem = 'top'
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="scss">
  237. .scrollView {
  238. height: 100vh;
  239. }
  240. .main {
  241. display: flex;
  242. flex-direction: column;
  243. width: 100vw;
  244. height: 100vh;
  245. .onemain {
  246. position: relative;
  247. flex-grow: 1;
  248. background-color: var(--f9Color);
  249. .one {
  250. swiper {
  251. height: 80vw;
  252. }
  253. .list {
  254. border-radius: 5px;
  255. .image {
  256. width: 100%;
  257. height: 100%;
  258. border-radius: 5px;
  259. }
  260. }
  261. }
  262. .two {
  263. padding: 0 0 2vw 0;
  264. background-color: var(--mainColor);
  265. .two_1 {
  266. display: flex;
  267. align-items: center;
  268. border-bottom: 0.5vw solid var(--f9Color);
  269. padding: 2vw;
  270. .money_1 {
  271. color: var(--ff0Color);
  272. text {
  273. margin: 0 1vw 0 0;
  274. }
  275. text:last-child {
  276. font-size: var(--font20Szie);
  277. font-weight: bold;
  278. }
  279. }
  280. .money_2 {
  281. text-decoration: line-through;
  282. color: var(--f99Color);
  283. text {
  284. margin: 0 1vw 0 0;
  285. }
  286. text:last-child {
  287. font-size: var(--font16Size);
  288. }
  289. }
  290. }
  291. .two_2 {
  292. font-size: var(--font18Szie);
  293. font-weight: bold;
  294. padding: 1vw 2vw;
  295. }
  296. .two_3 {
  297. font-size: var(--font16Szie);
  298. color: var(--f85Color);
  299. padding: 1vw 2vw;
  300. }
  301. .two_4 {
  302. font-size: var(--font12Size);
  303. color: var(--fcColor);
  304. padding: 1vw 2vw;
  305. text {
  306. margin: 0 2vw 0 0;
  307. }
  308. }
  309. }
  310. .thr {
  311. .thr_1 {
  312. display: flex;
  313. flex-direction: row;
  314. justify-content: space-between;
  315. margin: 2vw 0 2vw 0;
  316. padding: 2vw;
  317. background-color: var(--mainColor);
  318. }
  319. }
  320. .four {
  321. padding: 2vw;
  322. background-color: var(--mainColor);
  323. .four_1 {
  324. display: flex;
  325. justify-content: space-between;
  326. .image {
  327. width: 15vw;
  328. height: 15vw;
  329. }
  330. .other {
  331. flex-grow: 1;
  332. margin: 0 0 0 2vw;
  333. .name {
  334. font-size: var(--font16Szie);
  335. }
  336. .other_1 {
  337. font-size: var(--font12Size);
  338. text {
  339. color: var(--fcColor);
  340. margin: 0 2vw 0 0;
  341. }
  342. }
  343. }
  344. }
  345. .four_2 {
  346. display: flex;
  347. flex-direction: row;
  348. justify-content: space-evenly;
  349. padding: 2vw 0;
  350. color: var(--f99Color);
  351. .grade {
  352. font-size: var(--font14Size);
  353. color: var(--f85Color);
  354. text {
  355. color: var(--ff0Color);
  356. }
  357. }
  358. .btn {
  359. border: 0.1vw solid var(--fcColor);
  360. padding: 1vw 6vw;
  361. border-radius: 1vw;
  362. color: var(--f00Color);
  363. }
  364. .btn:last-child {
  365. padding: 1vw 10vw;
  366. }
  367. }
  368. }
  369. .five {
  370. margin: 2vw 0 0 0;
  371. .five_1 {
  372. padding: 2vw;
  373. background-color: var(--mainColor);
  374. font-size: var(--font18Szie);
  375. color: var(--f99Color);
  376. }
  377. .five_2 {
  378. padding: 0 2vw;
  379. background-color: var(--mainColor);
  380. text-align: center;
  381. }
  382. }
  383. }
  384. }
  385. .scroll-view {
  386. position: absolute;
  387. top: 0;
  388. left: 0;
  389. right: 0;
  390. bottom: 0;
  391. .list-scroll-view {
  392. display: flex;
  393. flex-direction: column;
  394. }
  395. }
  396. .scrollView {
  397. height: 100vh;
  398. }
  399. .collect {
  400. position: fixed;
  401. top: 20vw;
  402. right: 5vw;
  403. text {
  404. font-size: 30px;
  405. background-color: #0000005f;
  406. border-radius: 90px;
  407. }
  408. }
  409. .menu {
  410. position: fixed;
  411. bottom: 20vw;
  412. right: 5vw;
  413. text {
  414. font-size: 30px;
  415. background-color: #0000005f;
  416. border-radius: 90px;
  417. }
  418. }
  419. .backTop {
  420. position: fixed;
  421. bottom: 10vw;
  422. right: 5vw;
  423. text {
  424. font-size: 30px;
  425. background-color: #0000005f;
  426. border-radius: 90px;
  427. }
  428. }
  429. .content {
  430. height: 100vw;
  431. .one {
  432. display: flex;
  433. flex-direction: row;
  434. justify-content: space-between;
  435. margin: 2vw;
  436. padding: 2vw 0;
  437. border-bottom: 1px solid var(--f9Color);
  438. .image {
  439. width: 25vw;
  440. height: 25vw;
  441. margin: 0 2vw 0 0;
  442. }
  443. .other {
  444. display: flex;
  445. flex-direction: column;
  446. flex-grow: 1;
  447. margin: 0 0 0 2vw;
  448. .money {
  449. color: var(--fFB1Color);
  450. font-size: var(--font20Szie);
  451. padding: 2vw 0;
  452. }
  453. .other_1 {
  454. font-size: var(--font14Size);
  455. text {
  456. font-weight: bold;
  457. padding: 0 2vw;
  458. color: var(--ff0Color);
  459. }
  460. }
  461. }
  462. }
  463. .two {
  464. margin: 0 2vw;
  465. padding: 2vw 0;
  466. font-size: var(--font12Size);
  467. border-bottom: 1px solid var(--f9Color);
  468. .two_2 {
  469. padding: 1vw;
  470. text {
  471. padding: 1vw;
  472. border-radius: 1vw;
  473. background-color: var(--f9Color);
  474. }
  475. }
  476. }
  477. .thr {
  478. display: flex;
  479. justify-content: space-between;
  480. margin: 0 2vw;
  481. padding: 2vw 0;
  482. text {
  483. margin: 1vw 0 0 0;
  484. }
  485. .count {
  486. margin: 0 2vw;
  487. flex-grow: 1;
  488. }
  489. }
  490. .button {
  491. position: fixed;
  492. width: 100vw;
  493. padding: 4vw 0;
  494. background-color: var(--fFB1Color);
  495. bottom: 0;
  496. text-align: center;
  497. font-size: var(--font18Szie);
  498. color: var(--mainColor);
  499. }
  500. }
  501. </style>