SpecificationsContent.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div class='box weui-animate-fade-in' v-if="visible" @click="close()">
  3. <div class="content weui-animate-slide-up" @click.stop=''>
  4. <img class="image" v-if="productInfo.image" :src="productInfo.image+'?x-oss-process=image/resize,m_fill,h_120,w_120'" background-size="cover" alt="">
  5. <img class="image" v-else src="/static/images/icon_sirendingzhi.png" background-size="cover" alt="">
  6. <div class="price">
  7. {{totalMoney}}
  8. </div>
  9. <div class="chosse">
  10. <div class="title">选择支付方式</div>
  11. <div class="lableList">
  12. <div class="lable" :class="{select:chooseType=='all'}" @click="changeType('all')">支付全价</div>
  13. <div class="lable" v-if="productInfo.downPayment" :class="{select:chooseType=='down'}" @click="changeType('down')">支付定金</div>
  14. </div>
  15. </div>
  16. <div class="num">
  17. <div class="title">
  18. 购买数量
  19. </div>
  20. <div class="numVal">
  21. <img v-if="num>1" @click="subNum" src="/static/images/icon_jianqu.png" alt="">
  22. <img v-else src="/static/images/icon_jianqu_dis.png" alt="">
  23. <input type="number" v-model="num" confirm-type='done' @input="checkNum" />
  24. <img v-if="num<100" @click="addNum" src="/static/images/icon_zengjia.png" alt="">
  25. <img v-else src="/static/images/icon_zengjia_dis.png" alt="">
  26. </div>
  27. </div>
  28. <button class="sureBtn" @click="close('sure')">
  29. 确定
  30. </button>
  31. <img src="/static/images/icon_tanchuangclose_02.png" @click="close" alt="" class="close">
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'SpecificationsContent',
  38. props: {
  39. visible: {
  40. type: Boolean,
  41. default: false,
  42. },
  43. productInfo: {
  44. type: Object,
  45. default: () => {
  46. return {};
  47. },
  48. },
  49. totalMoney: {
  50. type: Number,
  51. default: 0,
  52. },
  53. chooseType: {
  54. type: String,
  55. default: 'all',
  56. },
  57. chooseNum: {
  58. type: Number,
  59. default: 1,
  60. },
  61. },
  62. data() {
  63. return {
  64. num: 1,
  65. preInfo: {
  66. chooseNum: 1,
  67. chooseType: 'all',
  68. },
  69. };
  70. },
  71. watch: {
  72. num() {
  73. this.$emit('changeNum', this.num);
  74. },
  75. visible() {
  76. this.num = this.chooseNum;
  77. this.preInfo.chooseNum = this.chooseNum;
  78. this.preInfo.chooseType = this.chooseType;
  79. },
  80. },
  81. mounted() {},
  82. methods: {
  83. addNum() {
  84. this.num = Number(this.num) + 1;
  85. },
  86. subNum() {
  87. this.num = Number(this.num) - 1;
  88. },
  89. checkNum() {
  90. this.num = Number(this.num);
  91. },
  92. close(type) {
  93. if (!type) {
  94. this.$emit('changeNum', this.preInfo.chooseNum);
  95. this.$emit('changeType', this.preInfo.chooseType);
  96. }
  97. else{
  98. this.$emit('changeChoose')
  99. }
  100. this.$emit('close');
  101. },
  102. changeType(type) {
  103. this.$emit('changeType', type);
  104. },
  105. },
  106. computed: {},
  107. };
  108. </script>
  109. <style lang='less' scoped>
  110. .box {
  111. background-color: rgba(0, 0, 0, 0.5);
  112. position: fixed;
  113. left: 0;
  114. right: 0;
  115. top: 0;
  116. bottom: 0;
  117. z-index: 200;
  118. }
  119. .content {
  120. bottom: 0;
  121. left: 0;
  122. z-index: 201;
  123. position: fixed;
  124. width: 100%;
  125. height: 320px;
  126. background: rgba(255, 255, 255, 1);
  127. border-radius: 8px 8px 0px 0px;
  128. box-sizing: border-box;
  129. padding: 40px 20px 8px;
  130. .image {
  131. width: 120px;
  132. height: 120px;
  133. border-radius: 6px;
  134. position: absolute;
  135. left: 20px;
  136. top: -40px;
  137. }
  138. .price {
  139. padding-left: 136px;
  140. font-size: 22px;
  141. font-weight: bold;
  142. color: rgba(255, 59, 48, 1);
  143. line-height: 30px;
  144. &::before {
  145. content: '¥';
  146. font-size: 16px;
  147. }
  148. }
  149. .close {
  150. position: absolute;
  151. right: 10px;
  152. top: 10px;
  153. width: 26px;
  154. height: 26px;
  155. }
  156. .chosse {
  157. margin-top: 30px;
  158. .title {
  159. font-size: 14px;
  160. font-weight: bold;
  161. color: rgba(0, 0, 0, 1);
  162. line-height: 20px;
  163. }
  164. .lableList {
  165. display: flex;
  166. align-items: center;
  167. margin-top: 15px;
  168. .lable {
  169. font-size: 14px;
  170. color: rgba(51, 51, 51, 1);
  171. line-height: 32px;
  172. text-align: center;
  173. background: rgba(242, 244, 245, 1);
  174. width: 96px;
  175. height: 32px;
  176. border-radius: 16px;
  177. margin-right: 20px;
  178. &.select {
  179. background: rgba(0, 197, 242, 1);
  180. color: #ffffff;
  181. }
  182. }
  183. }
  184. }
  185. .num {
  186. display: flex;
  187. justify-content: space-between;
  188. align-self: stretch;
  189. align-items: center;
  190. margin-top: 34px;
  191. .title {
  192. font-size: 14px;
  193. font-weight: bold;
  194. color: rgba(0, 0, 0, 1);
  195. line-height: 20px;
  196. }
  197. .numVal {
  198. display: flex;
  199. align-items: center;
  200. input {
  201. width: 60px;
  202. height: 28px;
  203. background: rgba(242, 244, 245, 1);
  204. border-radius: 4px;
  205. font-size: 28rpx;
  206. font-weight: bold;
  207. color: rgba(0, 0, 0, 1);
  208. text-align: center;
  209. margin: 0 8rpx;
  210. }
  211. img {
  212. min-width: 28px;
  213. width: 28px;
  214. height: 28px;
  215. }
  216. }
  217. }
  218. .sureBtn {
  219. width: 100%;
  220. height: 40px;
  221. background: rgba(0, 197, 242, 1);
  222. border-radius: 22px;
  223. font-size: 15px;
  224. font-weight: bold;
  225. color: rgba(255, 255, 255, 1);
  226. line-height: 40px;
  227. margin-top: 40px;
  228. }
  229. }
  230. </style>