detail.vue 10 KB

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