regularPurchase.vue 5.1 KB

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