product.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="container">
  3. <u-swiper :list="product.images" @change="e => currentNum = e.current" :autoplay="false" height="750rpx" radius="0" indicatorStyle="right: 20px">
  4. <view slot="indicator" class="indicator-num">
  5. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ product.images.length }}</text>
  6. </view>
  7. </u-swiper>
  8. <view class="product-box">
  9. <view class="prod-info">
  10. <view class="info-text">
  11. <u--text :lines="2" size="14px" color="#333333" :text="product.title"></u--text>
  12. <u-gap height="5px"></u-gap>
  13. <u--text :lines="3" size="12px" color="#939393" :text="product.desc"></u--text>
  14. </view>
  15. <view class="price-and-cart">
  16. <u--text-price color="red" size="16" intSize="26" :text="product.price"></u--text-price>
  17. </view>
  18. </view>
  19. <view class="prod-favor">
  20. <u-icon name="star" color="#2979ff" size="28"></u-icon>
  21. </view>
  22. </view>
  23. <u-gap height="8" bgColor="#f3f3f3"></u-gap>
  24. <view class="info-box">
  25. <text class="info-title">配送</text>
  26. <!-- <text>快递配送</text>
  27. <text>到店自提</text>-->
  28. </view>
  29. <u-gap height="8" bgColor="#f3f3f3"></u-gap>
  30. <view class="info-box" @click="showPromPopup">
  31. <text class="info-title">促销</text>
  32. </view>
  33. <view>
  34. <u-popup :show="promotionPopup" :round="10" :closeable="true" :closeOnClickOverlay="false" @close="closePromPopup">
  35. <view class="prom-popup-slot">
  36. <view class="prom-title">促销信息</view>
  37. <view class="prom-list">
  38. <view class="prom-item">全场满500减100</view>
  39. <view class="prom-item">全场满300减50</view>
  40. <view class="prom-item">全场满200减20</view>
  41. <view class="prom-item">全场满100减5</view>
  42. </view>
  43. </view>
  44. </u-popup>
  45. </view>
  46. <u-gap height="8" bgColor="#f3f3f3"></u-gap>
  47. <view class="info-box">
  48. <text class="info-title">领券</text>
  49. </view>
  50. <u-gap height="8" bgColor="#f3f3f3"></u-gap>
  51. <view class="info-box">
  52. <text class="info-title">已选</text>
  53. </view>
  54. <u-gap height="8" bgColor="#f3f3f3"></u-gap>
  55. <view class="evaluation-box-wrap">
  56. <view class="evaluation-box">
  57. <view class="evaluation-title">评价</view>
  58. <view class="evaluation-info">
  59. <view class="evan-type-list">
  60. <view class="evan-type-item" v-for="(item, index) in evanTypeList" :key="index" @click="handleEvanTypeClick(index)">
  61. {{item.name}}({{item.count}})
  62. </view>
  63. </view>
  64. <view class="comment-empty" v-if="true">
  65. <u-empty mode="comment" icon="/static/images/empty/comment.png"></u-empty>
  66. </view>
  67. <view v-else class="comment-list" style="min-height: 50px">
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="fixed-btn-box">
  73. <view class="btn-group">
  74. <view class="btn-item">
  75. <u-icon name="home" :size="24"></u-icon>
  76. <view class="btn-text">首页</view>
  77. </view>
  78. <view class="btn-item">
  79. <u-icon name="server-man" :size="24"></u-icon>
  80. <view class="btn-text">客服</view>
  81. </view>
  82. <view class="btn-item">
  83. <u-icon name="bag" :size="24"></u-icon>
  84. <view class="btn-text">购物车</view>
  85. </view>
  86. <view style="width: 200rpx">
  87. <u-button type="warning" shape="circle" size="small" text="加入购物车"></u-button>
  88. </view>
  89. <view style="width: 200rpx">
  90. <u-button type="error" shape="circle" size="small" text="立即购买"></u-button>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. current: 0,
  101. currentNum: 0,
  102. product: {
  103. id: '',
  104. images: ['https://cdn.uviewui.com/uview/album/1.jpg', 'https://cdn.uviewui.com/uview/album/2.jpg', 'https://cdn.uviewui.com/uview/album/3.jpg'],
  105. title: '山不在高,有仙则名。水不在深,有龙则灵。斯是陋室,惟吾德馨。',
  106. desc: '山不在于高,有了神仙就会有名气。水不在于深,有了龙就会有灵气。这是简陋的房子,只是我品德好就感觉不到简陋了。',
  107. price: '13.00'
  108. },
  109. promotionPopup: false,
  110. currentEvanType: 0,
  111. evanTypeList: [
  112. {
  113. id: '0',
  114. name: '全部',
  115. count: 0
  116. },
  117. {
  118. id: '1',
  119. name: '好评',
  120. count: 0
  121. },
  122. {
  123. id: '2',
  124. name: '中评',
  125. count: 0
  126. },
  127. {
  128. id: '3',
  129. name: '差评',
  130. count: 0
  131. },
  132. {
  133. id: '4',
  134. name: '有图',
  135. count: 0
  136. },
  137. ]
  138. }
  139. },
  140. onLoad(e) {
  141. if (!e.productId) {
  142. uni.$u.toast('请求参数错误');
  143. } else {
  144. this.product.id = e.productId;
  145. this.loadProductData();
  146. // TODO 请求接口获取商品详情数据
  147. }
  148. console.log(e);
  149. },
  150. methods: {
  151. loadProductData(){
  152. },
  153. showPromPopup() {
  154. this.promotionPopup = true
  155. },
  156. closePromPopup(){
  157. this.promotionPopup = false
  158. },
  159. handleEvanTypeClick(e) {
  160. this.currentEvanType = e.index;
  161. },
  162. },
  163. computed: {
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .indicator-num {
  169. padding: 2px 0;
  170. background-color: rgba(0, 0, 0, 0.35);
  171. border-radius: 100px;
  172. width: 35px;
  173. @include flex;
  174. justify-content: center;
  175. &__text {
  176. color: #FFFFFF;
  177. font-size: 12px;
  178. }
  179. }
  180. .product-box {
  181. padding: 40rpx 40rpx 10rpx 40rpx;
  182. display: flex;
  183. border-bottom: $custom-border-style;
  184. .prod-info {
  185. padding-right: 30rpx;
  186. .info-text {
  187. padding-bottom: 10rpx;
  188. }
  189. .price-and-cart {
  190. display: flex;
  191. justify-content: space-between;
  192. }
  193. }
  194. .prod-favor {
  195. margin-top: 15rpx;
  196. }
  197. }
  198. .info-box {
  199. padding: 15rpx 30rpx;
  200. .info-title {
  201. font-size: 30rpx;
  202. }
  203. }
  204. .prom-popup-slot {
  205. width: 750rpx;
  206. min-height: 500rpx;
  207. .prom-title {
  208. background: #f3f3f3;
  209. line-height: 100rpx;
  210. padding-left: 30rpx;
  211. font-size: 36rpx;
  212. border-radius: 10px 10px 0 0;
  213. }
  214. .prom-list{
  215. padding: 30rpx;
  216. .prom-item{
  217. line-height: 40rpx;
  218. font-size: 24rpx;
  219. }
  220. }
  221. }
  222. .evaluation-box-wrap {
  223. background: #f3f3f3;
  224. .evaluation-box {
  225. border-radius: 20rpx 20rpx 0 0;
  226. background: $custom-bg-color;
  227. padding-bottom: 120rpx;
  228. .evaluation-title{
  229. border-radius: 20rpx 20rpx 0 0;
  230. padding: 20rpx 30rpx;
  231. border-bottom: $custom-border-style;
  232. font-size: 30rpx;
  233. }
  234. .evaluation-info{
  235. }
  236. .evan-type-list{
  237. padding: 20rpx;
  238. display: flex;
  239. align-items: center;
  240. justify-content: space-around;
  241. .evan-type-item {
  242. border-radius: 8rpx;
  243. padding: 8rpx 12rpx;
  244. background: #f3f3f3;
  245. font-size: 12rpx;
  246. text-align: center;
  247. }
  248. }
  249. .comment-empty {
  250. }
  251. }
  252. }
  253. .fixed-btn-box {
  254. position: fixed;
  255. bottom: 0;
  256. left: 0;
  257. .btn-group {
  258. background: $custom-bg-color;
  259. border-top: $custom-border-style;
  260. width: 750rpx;
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-around;
  264. height: 100rpx;
  265. .btn-item {
  266. width: 80rpx;
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. .btn-text {
  271. font-size: 12rpx;
  272. color: #666666;
  273. }
  274. }
  275. }
  276. }
  277. </style>