detail.vue 13 KB

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