regularPurchase.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view class="container all-type-list-wrapper">
  3. <!-- 商品列表 -->
  4. <product-list ref="productList" @operationConfim="hanldOperationConfim"></product-list>
  5. <!-- 选择规格弹窗 -->
  6. <cm-unit-popup v-if="popupShow1" :popupShow="popupShow1" :product="handleData"></cm-unit-popup>
  7. </view>
  8. </template>
  9. <script>
  10. import productList from './components/productList'
  11. import cmUnitPopup from '@/components/cm-module/productDetails/cm-unit-popup.vue'
  12. export default {
  13. components: {
  14. productList,
  15. cmUnitPopup
  16. },
  17. data() {
  18. return {
  19. userId: 0,
  20. isIphoneX: this.$store.state.isIphoneX,
  21. popupShow1:false,
  22. handleData: {},
  23. }
  24. },
  25. onLoad() {
  26. this.initGetStotage()
  27. },
  28. methods: {
  29. async initGetStotage() {
  30. const userInfo = await this.$api.getStorage()
  31. this.userId = userInfo.userId ? userInfo.userId : 0
  32. this.GetProductListInfo()
  33. this.ProductCartNumber()
  34. },
  35. hanldOperationConfim(data) {
  36. //显示选择数量确认弹窗
  37. this.popupShow1 = true
  38. this.handleData = data
  39. },
  40. GetUserCartNumber() {
  41. this.OrderService.ShoppingCartCount({ userId: this.userId })
  42. .then(response => {
  43. this.$refs.productList.cartQuantity = response.data
  44. })
  45. .catch(error => {
  46. console.log('查询用户购物车数量失败')
  47. })
  48. }
  49. },
  50. onShow() {
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. page {
  56. background: $sub-bg-color;
  57. .all-type-list-wrapper {
  58. display: flex;
  59. flex-direction: column;
  60. }
  61. }
  62. /* 加入购物模态层*/
  63. @keyframes showPopup {
  64. 0% {
  65. opacity: 0;
  66. }
  67. 100% {
  68. opacity: 1;
  69. }
  70. }
  71. @keyframes hidePopup {
  72. 0% {
  73. opacity: 1;
  74. }
  75. 100% {
  76. opacity: 0;
  77. }
  78. }
  79. @keyframes showLayer {
  80. 0% {
  81. transform: translateY(0);
  82. }
  83. 100% {
  84. transform: translateY(-100%);
  85. }
  86. }
  87. @keyframes hideLayer {
  88. 0% {
  89. transform: translateY(-100%);
  90. }
  91. 100% {
  92. transform: translateY(0);
  93. }
  94. }
  95. @keyframes showAmnation {
  96. 0% {
  97. top: -12rpx;
  98. opacity: 0;
  99. }
  100. 50% {
  101. top: -60rpx;
  102. opacity: 1;
  103. }
  104. 100% {
  105. top: -100rpx;
  106. opacity: 0;
  107. }
  108. }
  109. @keyframes hideAmnation {
  110. 0% {
  111. top: -100rpx;
  112. opacity: 0;
  113. }
  114. 100% {
  115. top: -12rpx;
  116. opacity: 0;
  117. }
  118. }
  119. .popup {
  120. position: fixed;
  121. top: 0;
  122. width: 100%;
  123. height: 100%;
  124. z-index: 999;
  125. display: none;
  126. .mask {
  127. position: fixed;
  128. top: 0;
  129. width: 100%;
  130. height: 100%;
  131. z-index: 21;
  132. background-color: rgba(0, 0, 0, 0.6);
  133. }
  134. .layer {
  135. position: fixed;
  136. z-index: 22;
  137. bottom: -294rpx;
  138. width: 702rpx;
  139. padding: 24rpx 24rpx 36rpx 24rpx;
  140. height: 236rpx;
  141. border-radius: 20rpx 20rpx 0 0;
  142. background-color: #fff;
  143. display: flex;
  144. flex-wrap: wrap;
  145. align-content: space-between;
  146. .content {
  147. width: 100%;
  148. }
  149. .btn {
  150. width: 100%;
  151. height: 88rpx;
  152. display: flex;
  153. .button {
  154. width: 340rpx;
  155. height: 88rpx;
  156. color: #fff;
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. font-size: $font-size-28;
  161. border-radius: 44rpx;
  162. &.buy {
  163. background: $btn-confirm;
  164. }
  165. &.add {
  166. background: rgba(239, 175, 0, 1);
  167. margin-left: 20rpx;
  168. }
  169. }
  170. }
  171. }
  172. &.show {
  173. display: block;
  174. .mask {
  175. animation: showPopup 0.2s linear both;
  176. }
  177. .layer {
  178. animation: showLayer 0.2s linear both;
  179. }
  180. }
  181. &.hide {
  182. display: block;
  183. .mask {
  184. animation: hidePopup 0.2s linear both;
  185. }
  186. .layer {
  187. animation: hideLayer 0.2s linear both;
  188. }
  189. }
  190. &.none {
  191. display: none;
  192. }
  193. &.service {
  194. .row {
  195. margin: 30upx 0;
  196. .title {
  197. font-size: 30upx;
  198. margin: 10upx 0;
  199. }
  200. .description {
  201. font-size: 28upx;
  202. color: #999;
  203. }
  204. }
  205. }
  206. .layer-smimg {
  207. width: 114rpx;
  208. height: 114rpx;
  209. float: left;
  210. border-radius: 10rpx;
  211. margin-right: 24rpx;
  212. image {
  213. width: 114rpx;
  214. height: 114rpx;
  215. border-radius: 10rpx;
  216. }
  217. }
  218. .layer-nunbox {
  219. justify-content: space-between;
  220. align-items: center;
  221. width: 536rpx;
  222. height: 88rpx;
  223. padding: 13rpx 0 0 0;
  224. float: left;
  225. .layer-nunbox-t {
  226. width: 100%;
  227. height: 44rpx;
  228. position: relative;
  229. display: flex;
  230. .layer-nunbox-text {
  231. line-height: 44rpx;
  232. font-size: $font-size-28;
  233. }
  234. .number-box {
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. border: 2rpx solid #ffe6dc;
  239. border-radius: 30rpx;
  240. height: 48rpx;
  241. margin-left: 20rpx;
  242. .iconfont {
  243. font-size: $font-size-24;
  244. padding: 0 18rpx;
  245. color: #999999;
  246. text-align: center;
  247. line-height: 48rpx;
  248. font-weight: bold;
  249. background: #fef6f3;
  250. &.icon-jianhao {
  251. border-radius: 30rpx 0 0 30rpx;
  252. }
  253. &.icon-jiahao {
  254. border-radius: 0 30rpx 30rpx 0;
  255. }
  256. }
  257. .btn-input {
  258. width: 62rpx;
  259. height: 48rpx;
  260. line-height: 48rpx;
  261. background: #ffffff;
  262. border-radius: 4rpx;
  263. text-align: center;
  264. font-size: $font-size-28;
  265. }
  266. }
  267. .product-step {
  268. position: absolute;
  269. left: 45rpx;
  270. bottom: 0;
  271. height: 44rpx;
  272. background: #ffffff;
  273. }
  274. }
  275. .layer-nunbox-b {
  276. width: 100%;
  277. height: 44rpx;
  278. margin-top: 13rpx;
  279. }
  280. .text {
  281. line-height: 44rpx;
  282. font-size: $font-size-28;
  283. .p {
  284. color: #ff2a2a;
  285. }
  286. .p:first-child {
  287. margin-left: 30rpx;
  288. }
  289. .p.sm {
  290. font-size: $font-size-24;
  291. }
  292. }
  293. }
  294. }
  295. </style>