detail.vue 13 KB

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