diy-store-info.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template id="diy-store-info">
  2. <div>
  3. <div class="merchant-info-item" :class="borderBottom ? 'has-border' : 'no-border '" v-for="(item, index) in list" :key="index" :style="[componentStyle]">
  4. <div class="info-item-store" flex>
  5. <div class="item-logo" :style="{backgroundImage: 'url('+ item.logo +')', width: width + 'px', height: height + 'px'}" v-show="updataCheck('logo')">
  6. <div class="item-sales over1" v-show="updataCheck('sales') && saleType == 1">在售{{ item.sales_num }}件</div>
  7. </div>
  8. <div class="item-info" flex="dir:top main:justify">
  9. <div>
  10. <div class="info-name over1" v-show="updataCheck('name')" :style="{color: computedStyle.nameColor}">{{ item.merchant_name }}</div>
  11. <div class="info-desc over2" v-show="updataCheck('intro') && showDesc" :style="{color: computedStyle.introColor}">{{ item.merchant_desc }}</div>
  12. <div class="info-desc over2" v-show="updataCheck('sales') && saleType == 2">在售商品 {{ item.sales_num }} 件</div>
  13. </div>
  14. <div class="info-address over1" v-show="updataCheck('address') && showAddress" :style="{color: computedStyle.addrColor}">{{ item.address }}</div>
  15. </div>
  16. <div class="item-btn">
  17. <div class="item-btn-text" flex="cross:center main:center" :style="[btnStyle]">{{ merchData.input || '进入店铺' }}</div>
  18. </div>
  19. </div>
  20. <slot :goods-title-color="computedStyle.goodsTitleColor" :goods-price-color="computedStyle.goodsPriceColor"></slot>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. Vue.component('diy-store-info', {
  26. name: "diy-store-info",
  27. template: '#diy-store-info',
  28. props: {
  29. list: {
  30. type: [Array],
  31. default: () => []
  32. },
  33. computedStyle: {
  34. type: Object,
  35. default: () => {}
  36. },
  37. componentStyle: {
  38. type: Object,
  39. default: () => {}
  40. },
  41. merchData: {
  42. type: Object,
  43. default: () => {}
  44. },
  45. btnStyle: {
  46. type: Object,
  47. default: () => {}
  48. },
  49. width: {
  50. type: [String, Number],
  51. default: 80
  52. },
  53. height: {
  54. type: [String, Number],
  55. default: 80
  56. },
  57. borderBottom: {
  58. type: Boolean,
  59. default: false
  60. },
  61. showAddress: {
  62. type: Boolean,
  63. default: true
  64. },
  65. showDesc: {
  66. type: Boolean,
  67. default: true
  68. },
  69. saleType: {
  70. type: [Number, String],
  71. default: 1
  72. }
  73. },
  74. data() {
  75. return {
  76. storeList: []
  77. }
  78. },
  79. watch: {
  80. },
  81. methods: {
  82. updataCheck(name) {
  83. let content = this.merchData && this.merchData.content
  84. if (content && content.length >= 0) {
  85. return content.includes(name)
  86. } else {
  87. return true
  88. }
  89. },
  90. }
  91. });
  92. </script>
  93. <style>
  94. .merchant-info-item {
  95. overflow: hidden;
  96. box-sizing: border-box;
  97. }
  98. .merchant-info-item:last-child {
  99. margin-bottom: 0 !important;
  100. }
  101. .has-border {
  102. border-bottom: 1px solid #ededed;
  103. }
  104. .has-border:last-child,
  105. .no-border {
  106. border-bottom: none !important;
  107. }
  108. .info-item-store {
  109. position: relative;
  110. padding: 13px 12px;
  111. }
  112. .merchant-info-item .item-logo {
  113. position: relative;
  114. border-radius: 2px;
  115. overflow: hidden;
  116. background-repeat: no-repeat;
  117. background-position: 50%;
  118. background-size: cover;
  119. margin-right: 10px;
  120. }
  121. .merchant-info-item .item-logo .item-sales {
  122. position: absolute;
  123. bottom: 0;
  124. left: 0;
  125. width: 100%;
  126. height: 22px;
  127. line-height: 22px;
  128. background-color: rgba(0, 0, 0, .4);
  129. font-size: 12px;
  130. text-align: center;
  131. color: #fff;
  132. }
  133. .item-info {
  134. width: 185px;
  135. }
  136. .item-info .info-name {
  137. color: #3d404d;
  138. font-size: 15px;
  139. font-weight: 600;
  140. margin-bottom: 4px;
  141. }
  142. .item-info .info-desc {
  143. color: #999ca7;
  144. font-size: 13px;
  145. }
  146. .item-info .info-address {
  147. font-size: 13px;
  148. color: #5e6066;
  149. }
  150. .merchant-info-item .item-btn {
  151. position: absolute;
  152. right: 10px;
  153. top: 50%;
  154. transform: translateY(-50%);
  155. }
  156. .item-btn-text {
  157. width: 74px;
  158. height: 26px;
  159. border-radius: 26px;
  160. font-size: 12px;
  161. color: #fff;
  162. background-color: rgb(218, 54, 54);
  163. border: 1px solid rgb(218, 54, 54);
  164. }
  165. </style>