productDetail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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='40' 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. <icon type="clear" size="24"></icon>
  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">
  87. <text>数量</text>
  88. <u-number-box :min="1" :max="99"></u-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. }
  241. }
  242. }
  243. }
  244. .product-info-guige{
  245. display: flex;
  246. flex-wrap: wrap;
  247. justify-content: space-between;
  248. background:#fff;
  249. margin: 10px 0;
  250. padding: 10px;
  251. line-height: 28px;
  252. .row{
  253. width: 100%;
  254. }
  255. .row-ban{
  256. width: 50%;
  257. }
  258. >view{
  259. color: #999;
  260. text{
  261. color: #333333;
  262. }
  263. }
  264. }
  265. .product-info-content{
  266. background:#fff;
  267. margin-bottom: 10px;
  268. padding: 10px;
  269. line-height: 28px;
  270. }
  271. }
  272. .scrollPage-footer{
  273. background-color: #FFFFFF;
  274. width: 100%;
  275. position: fixed;
  276. left: 0;
  277. bottom: 0;
  278. .scrollPage-footer-box{
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. height: 50px;
  283. }
  284. .footer-left{
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. width: 35%;
  289. .footer-left-item{
  290. display: flex;
  291. flex-direction: column;
  292. align-items: center;
  293. justify-content: center;
  294. padding: 0 15px;
  295. position: relative;
  296. .footer-left-item-text{
  297. font-size: 12px;
  298. color: #666666;
  299. margin-top: 3px;
  300. }
  301. .badge{
  302. background: #f44336;
  303. color: #fff;
  304. position: absolute;
  305. right: 0;
  306. top: -8px;
  307. font-size: 12px;
  308. display: flex;
  309. align-items: center;
  310. justify-content: center;
  311. border-radius: 50rpx;
  312. padding: 0 10rpx;
  313. }
  314. }
  315. }
  316. .footer-right{
  317. width: 60%;
  318. height: 100%;
  319. display: flex;
  320. align-items: center;
  321. .footer-right-item{
  322. height: 100%;
  323. display: flex;
  324. flex-direction: column;
  325. align-items: center;
  326. justify-content: center;
  327. width: 50%;
  328. font-size: 14px;
  329. color: #FFFFFF;
  330. }
  331. .footer-right-item:first-child{
  332. background-color: #FF9900;
  333. }
  334. .footer-right-item:last-child{
  335. background-color: #FF0000;
  336. }
  337. }
  338. }
  339. .popu-content{
  340. display: flex;
  341. flex-direction: column;
  342. align-items: center;
  343. padding: 10px;
  344. .popu-close{
  345. padding: 10px;
  346. position: absolute;
  347. right: 0;
  348. top: 0;
  349. }
  350. .pupu-box{
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. margin-top: 25px;
  355. }
  356. .popu-content-img{
  357. border-radius: 10px;
  358. border: 1px solid #eee;
  359. }
  360. .popu-content-info{
  361. padding: 0 0 0 10px;
  362. .popu-content-info-title{
  363. font-size: 14px;
  364. font-weight: bold;
  365. }
  366. }
  367. .popu-content-box{
  368. display: flex;
  369. align-items: center;
  370. justify-content: space-between;
  371. margin-top: 10px;
  372. .popu-content-price{
  373. font-size: 14px;
  374. color: #FF0000;
  375. .price-red{
  376. font-size: 24px;
  377. }
  378. }
  379. .popu-content-num{
  380. font-size: 12px;
  381. color: #999999;
  382. margin-top: 5px;
  383. }
  384. }
  385. .popu-content-btn{
  386. width: 100%;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. margin-top: 10px;
  391. .popu-content-btn-item{
  392. width: 100%;
  393. height: 40px;
  394. background-color: #FF0000;
  395. color: #FFFFFF;
  396. font-size: 14px;
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. border-radius: 10px;
  401. }
  402. }
  403. }
  404. }
  405. </style>