index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <!-- 分类三商品列表 -->
  3. <view class="goodsList">
  4. <view class="item acea-row" v-for="(item,index) in tempArr" :key="item.id" @click="goDetail(item)">
  5. <view class="pictrue">
  6. <image :src="item.image" mode="aspectFit"></image>
  7. </view>
  8. <view class="pictxt acea-row row-column">
  9. <view class="text line1">{{item.store_name}}</view>
  10. <view class="acea-row label-wrap">
  11. <BaseTag v-for="label in item.store_label" :key="label.id" :text="label.label_name" :color="label.color" :borderColor="label.border_color" :background="label.bg_color"
  12. :circle="!!label.border_color" :imgSrc="label.icon"></BaseTag>
  13. </view>
  14. <view class="bottom acea-row row-between-wrapper">
  15. <BaseMoney :money="item.price" symbolSize="28" integerSize="44" decimalSize="28"></BaseMoney>
  16. <template v-if="item.stock>0">
  17. <view class="btn-box"
  18. v-if="(item.activity && (item.activity.type === '1' || item.activity.type === '2' || item.activity.type === '3')) || item.product_type!=0 || item.custom_form.length || item.is_presale_product">
  19. <text class="iconfont icon-ic_ShoppingCart1"></text>
  20. </view>
  21. <template v-else>
  22. <!-- 多规格 -->
  23. <uni-badge v-if="item.spec_type" class="uni-badge-left-margin" :text="item.cart_num" absolute="rightTop">
  24. <view class="btn-box" @click.stop="goCartDuo(item)">
  25. <text class="iconfont icon-ic_ShoppingCart1"></text>
  26. </view>
  27. </uni-badge>
  28. <!-- 单规格 -->
  29. <template v-else>
  30. <view v-if="item.cart_num" class="cart acea-row">
  31. <view class="btn acea-row row-center-wrapper" @click.stop="CartNumDes(index,item)">
  32. <text class="iconfont icon-ic_Reduce"></text>
  33. </view>
  34. <view class="num">{{item.cart_num}}</view>
  35. <view class="btn acea-row row-center-wrapper" @click.stop="CartNumAdd(index,item)">
  36. <text class="iconfont icon-ic_increase"></text>
  37. </view>
  38. </view>
  39. <view v-else>
  40. <view v-if="item.cart_button">
  41. <view class="bnt acea-row row-center-wrapper end" v-if="item.is_presale_product && (item.presale_pay_status == 1 || item.presale_pay_status == 3)">
  42. {{item.presale_pay_status === 1?'未开始':'已结束'}}
  43. </view>
  44. <view class="btn-box acea-row row-center-wrapper" v-else @click.stop="goCartDan(item,index)">
  45. <text class="iconfont icon-ic_ShoppingCart1"></text>
  46. </view>
  47. </view>
  48. <view v-else class="bnt acea-row row-center-wrapper">立即购买</view>
  49. </view>
  50. </template>
  51. </template>
  52. </template>
  53. <view class="bnt acea-row row-center-wrapper end" v-else>已售罄</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. name: 'd_goodList',
  62. props: {
  63. dataConfig: {
  64. type: Object,
  65. default: () => {}
  66. },
  67. tempArr: {
  68. type: Array,
  69. default: () => []
  70. },
  71. isLogin: {
  72. type: Boolean,
  73. default: false
  74. }
  75. },
  76. data() {
  77. return {};
  78. },
  79. methods: {
  80. goDetail(item) {
  81. this.$emit('detail', item);
  82. },
  83. goCartDuo(item) {
  84. this.$emit('gocartduo', item);
  85. },
  86. goCartDan(item, index) {
  87. this.$emit('gocartdan', item, index);
  88. },
  89. CartNumDes(index, item) {
  90. this.$emit('ChangeCartNumDan', false, index, item);
  91. },
  92. CartNumAdd(index, item) {
  93. if (item.is_limit && item.cart_num >= item.limit_num) {
  94. this.$util.Tips({
  95. title: "购买最多不能超过" + item.limit_num
  96. });
  97. } else {
  98. this.$emit('ChangeCartNumDan', true, index, item);
  99. }
  100. }
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. .goodsList {
  106. padding: 0 30rpx;
  107. .item {
  108. flex-wrap: nowrap;
  109. margin-bottom: 24rpx;
  110. .pictrue {
  111. width: 176rpx;
  112. height: 176rpx;
  113. position: relative;
  114. image {
  115. width: 100%;
  116. height: 100%;
  117. border-radius: 16rpx;
  118. }
  119. }
  120. .pictxt {
  121. flex: 1;
  122. flex-wrap: nowrap;
  123. min-width: 0;
  124. padding-left: 20rpx;
  125. .text {
  126. font-size: 28rpx;
  127. line-height: 40rpx;
  128. color: #333333;
  129. }
  130. .label-wrap {
  131. flex: 1;
  132. min-height: 0;
  133. padding-top: 12rpx;
  134. }
  135. .bottom {
  136. .cart {
  137. .btn {
  138. width: 48rpx;
  139. height: 48rpx;
  140. border-radius: 50%;
  141. background: var(--view-theme);
  142. text-align: center;
  143. line-height: 48rpx;
  144. .iconfont {
  145. font-size: 28rpx;
  146. color: #FFFFFF;
  147. }
  148. }
  149. .num {
  150. width: 60rpx;
  151. height: 48rpx;
  152. text-align: center;
  153. font-weight: 500;
  154. font-size: 30rpx;
  155. line-height: 48rpx;
  156. color: #333333;
  157. }
  158. }
  159. .btn-box {
  160. width: 48rpx;
  161. height: 48rpx;
  162. border-radius: 50%;
  163. background-color: var(--view-theme);
  164. text-align: center;
  165. line-height: 48rpx;
  166. }
  167. .icon-ic_ShoppingCart1 {
  168. color: #fff;
  169. font-size: 30rpx;
  170. }
  171. .bnt {
  172. padding: 0 20rpx;
  173. height: 45rpx;
  174. background: var(--view-theme);
  175. border-radius: 23rpx;
  176. font-size: 22rpx;
  177. color: #fff;
  178. position: relative;
  179. &.end {
  180. background: #cccccc;
  181. }
  182. .num {
  183. min-width: 14rpx;
  184. height: 24rpx;
  185. text-align: center;
  186. line-height: 24rpx;
  187. background-color: #fff;
  188. color: var(--view-theme);
  189. border-radius: 15px;
  190. position: absolute;
  191. right: -13rpx;
  192. top: -11rpx;
  193. font-size: 16rpx;
  194. padding: 0 5rpx;
  195. border: 1px solid var(--view-theme);
  196. }
  197. }
  198. }
  199. }
  200. }
  201. }
  202. </style>