productDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <view class="pages">
  3. <!-- head -->
  4. <view class="scrollPage-header">
  5. <view :style="{height:statusBarHeight+'px'}"></view>
  6. <view class="header-title">
  7. <view class="header-left" @click="goBack">
  8. <image style="width: 16px; height: 16px;margin-right:3px;" mode="aspectFit" src="../static/arrow-left.png"></image>
  9. <text>返回</text>
  10. </view>
  11. <view class="header-right"></view>
  12. </view>
  13. </view>
  14. <!-- 内容 -->
  15. <view class="scrollPage-content">
  16. <view class="product-info">
  17. <view :style="{height:statusBarHeight+'px'}"></view>
  18. <u-swiper mode="number" :border-radius="0" bg-color="#000" img-mode="heightFix" :interval="3000" :height="450" :list="imgList"></u-swiper>
  19. <view class="product-info-text">
  20. <view class="product-info-text-title">【新品】Apple iPhone 13 Pro Max (A2644) 256GB 金色 支持移动联通电信5G 双卡双待手机</view>
  21. <view class="product-info-text-attr">
  22. <view class="product-info-price">
  23. ¥<text class="price-red">45.8</text>
  24. </view>
  25. <view class="product-info-nums">
  26. <view @click="share"><u-icon :size='24' name="zhuanfa"></u-icon> 分享</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <u-divider bg-color="">商品详情</u-divider>
  32. <view class="product-info-guige">
  33. <view class="row">品牌:<text>箭冠</text></view>
  34. <view class="row-ban">原厂编码:<text>128/79 R78 </text></view>
  35. <view class="row-ban">产品编码:<text>Y123</text></view>
  36. <view class="row-ban">单位:<text>箱</text></view>
  37. <view class="row-ban">包装数:<text>5/个</text></view>
  38. <view class="row-ban">尺寸:<text>16cm</text></view>
  39. <view class="row-ban">内盒尺寸:<text>15cm</text></view>
  40. <view class="row-ban">重量:<text>1.5KG</text></view>
  41. <view class="row-ban">颜色:<text>箭冠</text></view>
  42. </view>
  43. <view class="product-info-content"></view>
  44. </view>
  45. <!-- 底部栏 -->
  46. <view class="scrollPage-footer">
  47. <view class="scrollPage-footer-box">
  48. <view class="footer-left">
  49. <view class="footer-left-item" @click="toCart">
  50. <u-icon :size='50' name="shopping-cart"></u-icon>
  51. <text class="footer-left-item-text">购物车</text>
  52. <text class="badge" v-if="totalNum">{{totalNum>99?'99+':totalNum}}</text>
  53. </view>
  54. </view>
  55. <view class="footer-right">
  56. <view class="footer-right-item" @click="addCart">
  57. <text>加入购物车</text>
  58. </view>
  59. <view class="footer-right-item" @click="toBuy">
  60. <text>立即购买</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view :style="{height:safeAreaBottom+'px'}"></view>
  65. </view>
  66. <!-- 立即购买 -->
  67. <page-container
  68. :show="showPopu"
  69. :round="true"
  70. :z-index="100"
  71. position="bottom"
  72. custom-style="height:30%"
  73. @afterleave="closePopu">
  74. <view class="popu-content">
  75. <view class="popu-close" @click="showPopu=false">
  76. <uni-icons size="26" type="closeempty"></uni-icons>
  77. </view>
  78. <view class="pupu-box">
  79. <view class="popu-content-img">
  80. <image style="width: 100px; height: 100px;" mode="aspectFit" src="https://cdn.uviewui.com/uview/swiper/1.jpg"></image>
  81. </view>
  82. <view class="popu-content-info">
  83. <view class="popu-content-info-title">【新品】Apple iPhone 13 Pro Max (A2644) 256GB 金色 支持移动联通电信5G 双卡双待手机</view>
  84. <view class="popu-content-box">
  85. <view class="popu-content-price">¥<text class="price-red">45.8</text></view>
  86. <view class="popu-content-num flex align_center">
  87. <text style="margin-right: 5px;">数量</text>
  88. <uni-number-box :min="1" :max="99"></uni-number-box>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="popu-content-btn">
  94. <view class="popu-content-btn-item" @click="toBuy">确定采购</view>
  95. </view>
  96. <view :style="{height:safeAreaBottom+'px'}"></view>
  97. </view>
  98. </page-container>
  99. </view>
  100. </template>
  101. <script>
  102. export default {
  103. data() {
  104. return {
  105. showPopu: false, // 弹框
  106. statusBarHeight: 0, // 状态栏高度
  107. safeAreaBottom: 0, // 底部安全区域高度
  108. imgList: [
  109. 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  110. 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  111. 'https://cdn.uviewui.com/uview/swiper/3.jpg',
  112. 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  113. 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  114. ],
  115. totalNum: 0 // 购物车总数
  116. }
  117. },
  118. onLoad() {
  119. // 计算安全区域
  120. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
  121. this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
  122. },
  123. onShareAppMessage() {},
  124. methods: {
  125. // 返回
  126. goBack(){
  127. uni.navigateBack()
  128. },
  129. // 分享
  130. share(){
  131. uni.share({
  132. provider: "weixin",
  133. title:"产品标题",
  134. scene: "WXSceneSession",
  135. type: 0,
  136. imageUrl: "https://cdn.uviewui.com/uview/swiper/1.jpg",
  137. success: function (res) {
  138. console.log("success:" + JSON.stringify(res));
  139. },
  140. fail: function (err) {
  141. console.log("fail:" + JSON.stringify(err));
  142. }
  143. });
  144. },
  145. // 加入购物车
  146. addCart(){
  147. },
  148. // 打开购物车
  149. toCart(){
  150. uni.switchTab({
  151. url: '/pages/cart/index'
  152. })
  153. },
  154. // 立即购买
  155. toBuy(){
  156. // 打开数量选择弹框
  157. if(!this.showPopu){
  158. this.showPopu = true
  159. }else{
  160. // 提交
  161. this.submitOk = true
  162. }
  163. },
  164. // 关闭后
  165. closePopu(){
  166. this.showPopu = false
  167. uni.hideLoading()
  168. // 提交成功
  169. if(this.submitOk){
  170. uni.navigateTo({
  171. url: "/pagesB/procureOrder"
  172. })
  173. }
  174. },
  175. }
  176. }
  177. </script>
  178. <style lang="less">
  179. .pages {
  180. height: 100vh;
  181. display: flex;
  182. flex-direction: column;
  183. .scrollPage-header{
  184. z-index: 1;
  185. width: 100%;
  186. position:fixed;
  187. left: 0;
  188. top: 0;
  189. .header-title{
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. padding: 0 10px;
  194. height: 44px;
  195. .header-left{
  196. display: flex;
  197. align-items: center;
  198. text{
  199. font-size: 14px;
  200. color: #333333;
  201. }
  202. background-color: rgba(255,255,255,0.6);
  203. box-shadow: 0px 1px 0px 0px #E6E6E6;
  204. border-radius: 50px;
  205. padding: 3px 6px 3px;
  206. }
  207. .header-right{
  208. width: 50px;
  209. }
  210. }
  211. }
  212. .scrollPage-content{
  213. flex: 1;
  214. overflow-y: auto;
  215. .product-info{
  216. background:#fff;
  217. margin-bottom: 10px;
  218. .product-info-text{
  219. padding: 10px;
  220. .product-info-text-title{
  221. font-weight: bold;
  222. color: #333333;
  223. line-height: 22px;
  224. margin-bottom: 5px;
  225. }
  226. .product-info-text-attr{
  227. display: flex;
  228. align-items: center;
  229. justify-content: space-between;
  230. .product-info-price{
  231. font-size: 14px;
  232. color: #FF0000;
  233. .price-red{
  234. font-size: 24px;
  235. }
  236. }
  237. .product-info-nums{
  238. font-size: 12px;
  239. color: #999999;
  240. >view{
  241. display: flex;
  242. align-items: center;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. .product-info-guige{
  249. display: flex;
  250. flex-wrap: wrap;
  251. justify-content: space-between;
  252. background:#fff;
  253. margin: 10px 0;
  254. padding: 10px;
  255. line-height: 28px;
  256. .row{
  257. width: 100%;
  258. }
  259. .row-ban{
  260. width: 50%;
  261. }
  262. >view{
  263. color: #999;
  264. text{
  265. color: #333333;
  266. }
  267. }
  268. }
  269. .product-info-content{
  270. background:#fff;
  271. margin-bottom: 10px;
  272. padding: 10px;
  273. line-height: 28px;
  274. }
  275. }
  276. .scrollPage-footer{
  277. background-color: #FFFFFF;
  278. width: 100%;
  279. position: fixed;
  280. left: 0;
  281. bottom: 0;
  282. .scrollPage-footer-box{
  283. display: flex;
  284. align-items: center;
  285. justify-content: space-between;
  286. height: 50px;
  287. }
  288. .footer-left{
  289. display: flex;
  290. align-items: center;
  291. justify-content: space-between;
  292. width: 35%;
  293. .footer-left-item{
  294. display: flex;
  295. flex-direction: column;
  296. align-items: center;
  297. justify-content: center;
  298. padding: 0 15px;
  299. position: relative;
  300. .footer-left-item-text{
  301. font-size: 12px;
  302. color: #666666;
  303. }
  304. .badge{
  305. background: #f44336;
  306. color: #fff;
  307. position: absolute;
  308. right: 0;
  309. top: -8px;
  310. font-size: 12px;
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. border-radius: 50rpx;
  315. padding: 0 10rpx;
  316. }
  317. }
  318. }
  319. .footer-right{
  320. width: 60%;
  321. height: 100%;
  322. display: flex;
  323. align-items: center;
  324. .footer-right-item{
  325. height: 100%;
  326. display: flex;
  327. flex-direction: column;
  328. align-items: center;
  329. justify-content: center;
  330. width: 50%;
  331. font-size: 14px;
  332. color: #FFFFFF;
  333. }
  334. .footer-right-item:first-child{
  335. background-color: #FF9900;
  336. }
  337. .footer-right-item:last-child{
  338. background-color: #FF0000;
  339. }
  340. }
  341. }
  342. .popu-content{
  343. display: flex;
  344. flex-direction: column;
  345. align-items: center;
  346. padding: 10px;
  347. .popu-close{
  348. padding: 10px;
  349. position: absolute;
  350. right: 0;
  351. top: 0;
  352. }
  353. .pupu-box{
  354. display: flex;
  355. align-items: center;
  356. justify-content: space-between;
  357. margin-top: 25px;
  358. }
  359. .popu-content-img{
  360. border-radius: 10px;
  361. border: 1px solid #eee;
  362. }
  363. .popu-content-info{
  364. padding: 0 0 0 10px;
  365. .popu-content-info-title{
  366. font-size: 14px;
  367. font-weight: bold;
  368. }
  369. }
  370. .popu-content-box{
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. margin-top: 10px;
  375. .popu-content-price{
  376. font-size: 14px;
  377. color: #eb0000;
  378. .price-red{
  379. font-size: 24px;
  380. }
  381. }
  382. .popu-content-num{
  383. font-size: 12px;
  384. color: #999999;
  385. padding: 0 10px;
  386. }
  387. }
  388. .popu-content-btn{
  389. width: 100%;
  390. display: flex;
  391. align-items: center;
  392. justify-content: center;
  393. margin-top: 20px;
  394. .popu-content-btn-item{
  395. width: 100%;
  396. height: 40px;
  397. background-color: #eb0000;
  398. color: #FFFFFF;
  399. font-size: 14px;
  400. display: flex;
  401. align-items: center;
  402. justify-content: center;
  403. border-radius: 10px;
  404. }
  405. }
  406. }
  407. }
  408. </style>