bd-hc.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="bd-hc" v-if="(integral && integral.title) || (balance && balance.title) || (card && card.list.length > 0) || (coupon && coupon.list.length > 0)">
  3. <view class="bd-block dir-left-nowrap cross-center" v-if="integral && integral.title">
  4. <view class="box-grow-0">活动</view>
  5. <view class="bd-give box-grow-0 main-center cross-center" :class="theme.color">
  6. 送积分
  7. </view>
  8. <view class="content u-line-1 box-grow-1">{{integral.title}}</view>
  9. </view>
  10. <view class="bd-block dir-left-nowrap cross-center" v-if="balance && balance.title">
  11. <view class="box-grow-0">促销</view>
  12. <view class="bd-give box-grow-0 main-center cross-center" :class="theme.color">
  13. 赠余额
  14. </view>
  15. <view class="content u-line-1 box-grow-1">{{balance.title}}</view>
  16. </view>
  17. <view class="bd-block dir-left-nowrap cross-center" v-if="card && card.list.length > 0" @click="change('card', '卡券')">
  18. <view class="box-grow-0">{{!(balance && balance.title) ? '促销' : ''}}</view>
  19. <view class="bd-give box-grow-0 main-center cross-center" :class="theme.color">
  20. 赠卡券
  21. </view>
  22. <view class="content u-line-1 box-grow-1">{{card.title}}</view>
  23. <image class="box-grow-0 bd-icon" src="../../../static/image/icon/arrow-right.png"></image>
  24. </view>
  25. <view class="bd-block dir-left-nowrap cross-center" v-if="coupon && coupon.list.length > 0" @click="change('coupon', '优惠券')">
  26. <view class="box-grow-0">{{!(balance && balance.title && card && card.list.length > 0) ? '促销' : ''}}</view>
  27. <view class="bd-give box-grow-0 main-center cross-center" :class="theme.color">
  28. 赠优惠券
  29. </view>
  30. <view class="content u-line-1 box-grow-1">{{coupon.title}}</view>
  31. <image class="box-grow-0 bd-icon" src="../../../static/image/icon/arrow-right.png"></image>
  32. </view>
  33. <u-popup v-model="show" mode="bottom" border-radius="14" @close="show = false">
  34. <view class="model" @touchmove.stop.prevent>
  35. <view class="f-top dir-left-nowrap main-between cross-center">
  36. <view class="f-title dir-left-nowrap cross-center u-line-1">
  37. <view class="p-title">{{title}}</view>
  38. </view>
  39. <view class="f-image" @click="show = false">
  40. <image class="f-img" src="/static/image/icon/icon-close.png"></image>
  41. </view>
  42. </view>
  43. <scroll-view scroll-y class="f-scroll">
  44. <view class="f-scroll-content">
  45. <view class="coupon-content" v-if="showModal === 'coupon'">
  46. <view class="coupon dir-left-nowrap cross-center" v-for="(item, index) in coupon.list" :key="index">
  47. <view class="dis" v-if="item.type === 1">
  48. <text>{{item.discount}}</text>
  49. <text>折</text>
  50. </view>
  51. <view class="price" v-else-if="item.type === 2">
  52. <text>¥</text>
  53. <text>{{item.sub_price}}</text>
  54. </view>
  55. <view class="box-grow-1 dir-top-nowrap">
  56. <text class="name">{{item.name}}</text>
  57. <text class="limit">满{{item.min_price}}可用</text>
  58. <text class="number">赠送{{item.number}}张</text>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="card-content" v-if="showModal === 'card'">
  63. <view class="card dir-left-nowrap cross-center" v-for="(item, index) in card.list" :key="index">
  64. <image :src="item.pic_url"></image>
  65. <view class="box-grow-1 dir-top-nowrap">
  66. <text class="name">{{item.name}}</text>
  67. <text class="number">赠送{{item.number}}张</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </scroll-view>
  73. </view>
  74. </u-popup>
  75. </view>
  76. </template>
  77. <script>
  78. import uPopup from '../../basic-component/u-popup/u-popup.vue';
  79. export default {
  80. name: "bd-hc",
  81. components: {
  82. uPopup
  83. },
  84. props: {
  85. card: {
  86. type: Object,
  87. default() {
  88. return {};
  89. }
  90. },
  91. integral: {
  92. type: Object,
  93. default() {
  94. return {};
  95. }
  96. },
  97. balance: {
  98. type: Object,
  99. default() {
  100. return {};
  101. }
  102. },
  103. coupon: {
  104. type: Object,
  105. default() {
  106. return {};
  107. }
  108. },
  109. theme: {
  110. type: Object,
  111. default() {
  112. return {};
  113. }
  114. },
  115. },
  116. data() {
  117. return {
  118. show: false,
  119. showModal: '',
  120. title: ''
  121. };
  122. },
  123. methods: {
  124. change(key, title) {
  125. this.showModal = key;
  126. this.title = title;
  127. this.show = true;
  128. }
  129. }
  130. }
  131. </script>
  132. <style scoped lang="scss">
  133. .bd-hc {
  134. width: 702upx;
  135. border-radius: 15upx;
  136. padding: 20upx 20upx 0 20upx;
  137. background-color: #ffffff;
  138. overflow: hidden;
  139. margin: 24upx 24upx 24upx 24upx;
  140. }
  141. .bd-block {
  142. font-size: 26upx;
  143. color: #999999;
  144. margin-bottom: 20upx;
  145. .content {
  146. color: #353535;
  147. }
  148. }
  149. .bd-give {
  150. padding: 2upx 4upx;
  151. border: 1upx solid;
  152. border-radius: 4upx;
  153. font-size: 22upx;
  154. margin-right: 12upx;
  155. }
  156. .bd-block view:first-child {
  157. margin-right: 26upx;
  158. width: 60upx;
  159. }
  160. .bd-icon {
  161. width: 12upx;
  162. height: 22upx;
  163. }
  164. .card-content {
  165. width: 100%;
  166. .card {
  167. width: 100%;
  168. height: #{160rpx};
  169. background-image: url('../../../static/image/icon/goods-card.png');
  170. background-position: center;
  171. background-repeat: no-repeat;
  172. background-size: contain;
  173. padding: 0 #{32rpx} 0 #{36rpx};
  174. margin-bottom: #{20rpx};
  175. image {
  176. width: #{88rpx};
  177. height: #{88rpx};
  178. display: block;
  179. margin-right: #{68rpx};
  180. border-radius: #{88rpx};
  181. }
  182. .name {
  183. width: 478#{rpx};
  184. text-overflow: ellipsis;
  185. white-space: nowrap;
  186. overflow: hidden;
  187. font-size: 28#{rpx};
  188. color: #353535;
  189. }
  190. .number {
  191. font-size:24#{rpx};
  192. color: #999999;
  193. margin-top:10#{rpx};
  194. }
  195. }
  196. }
  197. .coupon-content {
  198. width: 100%;
  199. .coupon {
  200. width: 100%;
  201. height: #{160rpx};
  202. background-image: url('../../../static/image/icon/goods-card.png');
  203. background-position: center;
  204. background-repeat: no-repeat;
  205. background-size: contain;
  206. margin-bottom: #{20rpx};
  207. .dis {
  208. >text:first-child {
  209. font-weight: bold;
  210. font-size: 36upx;
  211. }
  212. >text:last-child {
  213. font-size: 22upx;
  214. font-weight: bold;
  215. }
  216. }
  217. .price {
  218. >text:first-child {
  219. font-size: 18upx;
  220. font-weight: bold;
  221. }
  222. >text:last-child {
  223. font-size: 36upx;
  224. font-weight: bold;
  225. }
  226. }
  227. view:first-child {
  228. width: 160upx;
  229. text-align: center;
  230. }
  231. view:last-child {
  232. padding-left: 32upx;
  233. }
  234. image {
  235. width: #{88rpx};
  236. height: #{88rpx};
  237. display: block;
  238. margin-right: #{68rpx};
  239. border-radius: #{88rpx};
  240. }
  241. .name {
  242. width: 478#{rpx};
  243. text-overflow: ellipsis;
  244. white-space: nowrap;
  245. overflow: hidden;
  246. font-size: 28#{rpx};
  247. color: #353535;
  248. }
  249. .limit {
  250. font-size: 19upx;
  251. color: #353535;
  252. }
  253. .number {
  254. font-size:24#{rpx};
  255. color: #999999;
  256. margin-top:10#{rpx};
  257. }
  258. }
  259. }
  260. .model {
  261. height: 80vh;
  262. width: 750upx;
  263. }
  264. .f-top {
  265. height: 105upx;
  266. background-color: #ffffff;
  267. position: relative;
  268. border-radius: 15rpx;
  269. }
  270. .f-image {
  271. width: 78upx;
  272. height: 78upx;
  273. padding: 24upx;
  274. position: absolute;
  275. right: 0;
  276. }
  277. .f-img {
  278. width: 30upx;
  279. height: 30upx;
  280. }
  281. .f-title {
  282. position: absolute;
  283. left: 50%;
  284. transform: translateX(-50%);
  285. max-width: 594upx;
  286. }
  287. .f-scroll {
  288. height: calc(80vh - 105upx);
  289. width: 100%;
  290. }
  291. .f-scroll-content {
  292. padding: 0 24upx;
  293. }
  294. </style>