detail.vue 13 KB

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