popupGoods.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template name="popup">
  2. <!-- 规格-模态层弹窗 -->
  3. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
  4. <!-- 遮罩层 -->
  5. <view class="mask"></view>
  6. <view class="layer" @tap.stop="discard">
  7. <view class="content">
  8. <view class="layer-smimg">
  9. <image src="https://img.caimei365.com/group1/M00/02/6D/Cmis21xFeHGAIyUTAAPeRga1_H464.JPEG" mode=""></image>
  10. </view>
  11. <view class="layer-nunbox">
  12. <view class="layer-nunbox-t">
  13. <view class="text">
  14. 数量:
  15. <uni-number-box
  16. class="product-step"
  17. :min="minBuyNumber"
  18. :max="stock"
  19. :value="minBuyNumber>stock?stock:minBuyNumber"
  20. :isMax="minBuyNumber>=stock?true:false"
  21. :isMin="minBuyNumber===minBuyNumber"
  22. @eventChange="numberChang"
  23. >
  24. </uni-number-box>
  25. </view>
  26. </view>
  27. <view class="layer-nunbox-b">
  28. <view class="text">单价:
  29. <text class="p sm">¥</text>
  30. <text class="p bg">{{goodsData.retailPrice}}</text>
  31. <text class="p sm">{{goodsData.smallMoney== '0'?'.00':goodsData.smallMoney}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="btn"><view class="button" @tap="btnConfirm">确定</view></view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. var self;
  42. import uniNumberBox from '@/components/uni-number-box.vue'
  43. export default{
  44. name:'popup',
  45. components:{
  46. uniNumberBox
  47. },
  48. props:['goodsData','minBuyNumber','stock'],
  49. data() {
  50. return{
  51. specClass: '',//规格弹窗css类,控制开关动画
  52. isType:'',
  53. }
  54. },
  55. created() {
  56. },
  57. methods:{
  58. //数量
  59. numberChange(data){
  60. },
  61. //规格弹窗
  62. showSpec(type) {
  63. this.isType = type
  64. this.specClass = 'show';
  65. },
  66. //关闭规格弹窗
  67. hideSpec() {
  68. this.specClass = 'hide';
  69. setTimeout(() => {
  70. this.specClass = 'none';
  71. }, 200);
  72. },
  73. //加入购物车关闭规格弹窗
  74. btnConfirm() {
  75. this.specClass = 'hide';
  76. setTimeout(() => {
  77. this.specClass = 'none';
  78. }, 200);
  79. if(this.isType == 'add'){
  80. uni.showToast({
  81. title: "已加入购物车",
  82. duration:2000,
  83. icon:'success',
  84. mask:false
  85. });
  86. }else{
  87. this.toConfirmation()
  88. }
  89. },
  90. //跳转确认订单页面
  91. toConfirmation(){
  92. uni.navigateTo({
  93. url:'/pages/user/order/confirmation'
  94. })
  95. },
  96. discard() {
  97. //丢弃
  98. }
  99. },
  100. }
  101. </script>
  102. <style lang="scss">
  103. /* 加入购物模态层*/
  104. @keyframes showPopup {
  105. 0% {
  106. opacity: 0;
  107. }
  108. 100% {
  109. opacity: 1;
  110. }
  111. }
  112. @keyframes hidePopup {
  113. 0% {
  114. opacity: 1;
  115. }
  116. 100% {
  117. opacity: 0;
  118. }
  119. }
  120. @keyframes showLayer {
  121. 0% {
  122. transform: translateY(0);
  123. }
  124. 100% {
  125. transform: translateY(-100%);
  126. }
  127. }
  128. @keyframes hideLayer {
  129. 0% {
  130. transform: translateY(-100%);
  131. }
  132. 100% {
  133. transform: translateY(0);
  134. }
  135. }
  136. .popup {
  137. position: fixed;
  138. top: 0;
  139. width: 100%;
  140. height: 100%;
  141. z-index: 999;
  142. display: none;
  143. .mask{
  144. position: fixed;
  145. top: 0;
  146. width: 100%;
  147. height: 100%;
  148. z-index: 21;
  149. background-color: rgba(0, 0, 0, 0.6);
  150. }
  151. .layer {
  152. position: fixed;
  153. z-index: 22;
  154. bottom: -270rpx;
  155. width: 702rpx;
  156. padding: 24rpx 24rpx 10rpx 24rpx;
  157. height: 236rpx;
  158. border-radius: 20rpx 20rpx 0 0;
  159. background-color: #fff;
  160. display: flex;
  161. flex-wrap: wrap;
  162. align-content: space-between;
  163. .content {
  164. width: 100%;
  165. }
  166. .btn {
  167. width: 100%;
  168. height: 88rpx;
  169. .button {
  170. width: 100%;
  171. height: 88rpx;
  172. color: #fff;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. background-color: #000000;
  177. font-size: $font-size-28;
  178. }
  179. }
  180. }
  181. &.show {
  182. display: block;
  183. .mask{
  184. animation: showPopup 0.2s linear both;
  185. }
  186. .layer {
  187. animation: showLayer 0.2s linear both;
  188. }
  189. }
  190. &.hide {
  191. display: block;
  192. .mask{
  193. animation: hidePopup 0.2s linear both;
  194. }
  195. .layer {
  196. animation: hideLayer 0.2s linear both;
  197. }
  198. }
  199. &.none {
  200. display: none;
  201. }
  202. &.service {
  203. .row {
  204. margin: 30upx 0;
  205. .title {
  206. font-size: 30upx;
  207. margin: 10upx 0;
  208. }
  209. .description {
  210. font-size: 28upx;
  211. color: #999;
  212. }
  213. }
  214. }
  215. .layer-smimg{
  216. width: 114rpx;
  217. height: 114rpx;
  218. float: left;
  219. border-radius: 10rpx;
  220. margin-right: 24rpx;
  221. image{
  222. width: 114rpx;
  223. height: 114rpx;
  224. border-radius: 10rpx;
  225. }
  226. }
  227. .layer-nunbox{
  228. justify-content: space-between;
  229. align-items: center;
  230. width: 536rpx;
  231. height: 88rpx;
  232. padding: 13rpx 0 0 0;
  233. float: left;
  234. .layer-nunbox-t{
  235. width: 100%;
  236. height:44rpx;
  237. position:relative;
  238. .product-step{
  239. position: absolute;
  240. left: 45rpx;
  241. bottom: 0;
  242. height: 44rpx;
  243. background: #FFFFFF;
  244. }
  245. }
  246. .layer-nunbox-b{
  247. width: 100%;
  248. height:44rpx;
  249. margin-top: 13rpx;
  250. }
  251. .text{
  252. line-height: 44rpx;
  253. font-size: $font-size-28;
  254. .p{
  255. color: #FF2A2A;
  256. }
  257. .p:first-child{
  258. margin-left: 30rpx;
  259. }
  260. .p.sm{
  261. font-size: $font-size-24;
  262. }
  263. }
  264. }
  265. }
  266. </style>