sel-popup.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="sel-popup">
  3. <bottom-popup class="popup-wrap" :show="show" @close="close">
  4. <app-close @close="close" />
  5. <div class="tui-popup-box">
  6. <div class="tui-product-box">
  7. <img :src="imgNormal" class="tui-popup-img" />
  8. <div class="tui-popup-price">
  9. <div class="goods-tit app-font-size-30">{{ $util.isEmpty(info.goodsStyleList) ? '' : info.goodsStyleList[selIndex].title }}</div>
  10. <div class="tui-amount tui-bold">¥{{ $util.isEmpty(info.goodsStyleList) ? '' : info.goodsStyleList[selIndex].price }}</div>
  11. </div>
  12. </div>
  13. <scroll-view scroll-y class="tui-popup-scroll">
  14. <div class="tui-scrolldiv-box">
  15. <div class="tui-bold tui-attr-title">颜色</div>
  16. <div class="tui-attr-box">
  17. <div class="tui-attr-item" :class="{'tui-attr-active': selIndex}" v-for="(item, index) in info.goodsStyleList" :key="index">{{ item.title }}</div>
  18. </div>
  19. <div class="tui-number-box tui-bold tui-attr-title">
  20. <div class="tui-attr-title">数量</div>
  21. <number-box :max="99" :min="1" :value="buyNum" @change="change"></number-box>
  22. </div>
  23. </div>
  24. </scroll-view>
  25. <div class="tui-popup-btn">
  26. <button class="button-com red" @click="nextFn">下一步</button>
  27. </div>
  28. </div>
  29. </bottom-popup>
  30. </div>
  31. </template>
  32. <script>
  33. import bottomPopup from '@/components/plugin/bottom-popup'
  34. import numberBox from '@/components/plugin/number-box'
  35. import appClose from '@/components/module/app-close'
  36. export default {
  37. name: 'sel-popup',
  38. components: {
  39. bottomPopup,
  40. numberBox,
  41. appClose
  42. },
  43. props: {
  44. // 信息
  45. info: {
  46. type: Object,
  47. default: () => {
  48. return {}
  49. }
  50. },
  51. selIndex: {
  52. type: Number,
  53. default: 0
  54. },
  55. buyNum: {
  56. type: Number,
  57. default: 1
  58. },
  59. show: {
  60. type: Boolean,
  61. default: true
  62. }
  63. },
  64. data() {
  65. return {}
  66. },
  67. computed: {
  68. imgNormal() {
  69. if (!this.$util.isEmpty(this.info)) {
  70. return this.info.imgList[0].normal
  71. } else {
  72. return ''
  73. }
  74. }
  75. },
  76. methods: {
  77. change(e) {
  78. this.$emit('change', e)
  79. },
  80. close() {
  81. this.$emit('close')
  82. },
  83. nextFn() {
  84. this.$util.pageTo({
  85. url: '/pages/order/buy',
  86. query: {
  87. goodsId: this.info.id,
  88. goodsStyleId: this.info.goodsStyleList[this.selIndex].id,
  89. goodsNum: this.buyNum
  90. }
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. /deep/.popup-wrap {
  98. .tui-popup-class {
  99. border-top-left-radius: 24rpx;
  100. border-top-right-radius: 24rpx;
  101. // 适配iphoneX
  102. padding-bottom: env(safe-area-inset-bottom);
  103. }
  104. .tui-popup-box {
  105. position: relative;
  106. padding: 30rpx 30px 100rpx;
  107. }
  108. .tui-popup-btn {
  109. width: 100%;
  110. position: absolute;
  111. left: 0;
  112. bottom: 0;
  113. padding: 14px 0;
  114. @include disFlex(center, center);
  115. border-top: 1px solid $borderColor;
  116. .button-com {
  117. width: 80%;
  118. font-size: 32px;
  119. // padding-top: 12px;
  120. // padding-bottom: 12px;
  121. }
  122. }
  123. .tui-product-box {
  124. display: flex;
  125. align-items: center;
  126. font-size: 24rpx;
  127. padding-bottom: 30rpx;
  128. }
  129. .tui-popup-img {
  130. height: 200rpx;
  131. width: 200rpx;
  132. border-radius: 24rpx;
  133. display: block;
  134. }
  135. .tui-popup-price {
  136. padding-left: 20rpx;
  137. padding-bottom: 8rpx;
  138. .goods-tit {
  139. margin-bottom: 75px;
  140. }
  141. }
  142. .tui-amount {
  143. color: #ff201f;
  144. font-size: 36rpx;
  145. }
  146. .tui-popup-scroll {
  147. height: 380rpx;
  148. font-size: 26rpx;
  149. }
  150. .tui-scrollview-box {
  151. padding: 0 30rpx 60rpx 30rpx;
  152. box-sizing: border-box;
  153. }
  154. .tui-attr-title {
  155. padding: 10rpx 0;
  156. color: #333;
  157. }
  158. .tui-attr-box {
  159. font-size: 0;
  160. padding: 20rpx 0;
  161. }
  162. .tui-attr-item {
  163. max-width: 100%;
  164. min-width: 200rpx;
  165. height: 64rpx;
  166. display: -webkit-inline-flex;
  167. display: inline-flex;
  168. align-items: center;
  169. justify-content: center;
  170. background: #f7f7f7;
  171. padding: 0 26rpx;
  172. box-sizing: border-box;
  173. border-radius: 32rpx;
  174. margin-right: 20rpx;
  175. margin-bottom: 20rpx;
  176. font-size: 26rpx;
  177. }
  178. .tui-attr-active {
  179. background: #fcedea !important;
  180. color: #e41f19;
  181. font-weight: bold;
  182. position: relative;
  183. }
  184. .tui-attr-active::after {
  185. content: "";
  186. position: absolute;
  187. border: 1rpx solid #e41f19;
  188. width: 100%;
  189. height: 100%;
  190. border-radius: 40rpx;
  191. left: 0;
  192. top: 0;
  193. }
  194. .tui-number-box {
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. padding: 20rpx 0 30rpx 0;
  199. box-sizing: border-box;
  200. }
  201. }
  202. </style>