goodListMall.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <view class="index-product-wrapper" :class="iSshowH ? 'on' : ''" :style="'margin-top:'+mbConfig*2+'rpx;'"
  3. v-show="!isSortType">
  4. <view v-if="iSshowH">
  5. <u-tabs :list="navigationList2" @click="clickNav" lineColor="#EB4C63" :inactiveStyle="{ color: '#333' }"
  6. :activeStyle="{ color: '#EB4C63', fontWeight: 'bold' }" keyName="title"></u-tabs>
  7. </view>
  8. <!-- 商品列表 -->
  9. <view class="list-box animated" :class='tempArr.length > 0 ? "fadeIn on" : ""'>
  10. <view class="item" v-for="(item, index) in tempArr" :key="index" @click="goDetail(item)">
  11. <view class="pictrue">
  12. <span class="pictrue_log pictrue_log_class" :style="'background-color:' + labelColor"
  13. v-if="item.activity && item.activity.type === '1'">{{ $t(`秒杀`) }}</span>
  14. <span class="pictrue_log pictrue_log_class" :style="'background-color:' + labelColor"
  15. v-if="item.activity && item.activity.type === '2'">{{ $t(`砍价`) }}</span>
  16. <span class="pictrue_log pictrue_log_class" :style="'background-color:' + labelColor"
  17. v-if="item.activity && item.activity.type === '3'">{{ $t(`拼团`) }}</span>
  18. <image :src="item.goodsCover" mode="aspectFit"></image>
  19. <!-- <image src="../../../../static/goods@2x.png" mode="aspectFit"></image> -->
  20. </view>
  21. <view class="text-info">
  22. <view class="title" v-if="titleShow">
  23. <u-text :prefixIcon="item.isHot == 1?'bookmark':''" iconStyle="font-size: 16px; color:red;min-height: 30px;" :lines="2" bold block
  24. size="12" :text="item.goodsName"></u-text>
  25. </view>
  26. <view class="tags" v-if="opriceShow">赠送{{ item.obtainIntegral }}红积分</view>
  27. <view class="price" :style="{ color: fontColor }">
  28. <view v-if="priceShow">
  29. <text>{{ $t(`¥`) }}</text>{{ item.salePrice - 0 }}
  30. </view>
  31. <view class="txt" :style="'border:1px solid ' + labelColor + ';color:' + labelColor"
  32. :class="priceShow ? '' : 'on'" v-if="item.isNew">{{ $t(`新`) }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { getGoodsInfo, getCategoryTwo } from '@/api/home.js'
  41. export default {
  42. name: 'promotionList',
  43. props: {
  44. dataConfig: {
  45. type: Object,
  46. default: () => { }
  47. },
  48. tempArr: {
  49. type: Array,
  50. default: []
  51. },
  52. iSshowH: {
  53. type: Boolean,
  54. default: false
  55. },
  56. isSortType: {
  57. type: String | Number,
  58. default: 0
  59. },
  60. currentId: {
  61. type: String | Number,
  62. default: 0
  63. }
  64. },
  65. watch: {
  66. currentId(Id) {
  67. console.log(Id);
  68. this.getCategoryTwo(Id)
  69. }
  70. },
  71. data() {
  72. return {
  73. navigationList2: [],
  74. ProductNavindex: 0,
  75. explosiveMoney: [
  76. {
  77. "chiild": [
  78. {
  79. "title": "标题",
  80. "val": "首发新品",
  81. "max": 4,
  82. "pla": "选填,不超过四个字"
  83. },
  84. {
  85. "title": "简介",
  86. "val": "最新出炉",
  87. "max": 4,
  88. "pla": "选填,不超过四个字"
  89. }
  90. ],
  91. "link": {
  92. "title": "链接",
  93. "activeVal": 3,
  94. "optiops": [
  95. {
  96. "type": 0,
  97. "value": 1,
  98. "label": "精品推荐"
  99. },
  100. {
  101. "type": 1,
  102. "value": 2,
  103. "label": "热门榜单"
  104. },
  105. {
  106. "type": 2,
  107. "value": 3,
  108. "label": "首发新品"
  109. },
  110. {
  111. "type": 3,
  112. "value": 4,
  113. "label": "促销单品"
  114. }
  115. ]
  116. }
  117. },
  118. {
  119. "chiild": [
  120. {
  121. "title": "标题",
  122. "val": "精品推荐",
  123. "max": 4,
  124. "pla": "选填,不超过四个字"
  125. },
  126. {
  127. "title": "简介",
  128. "val": "猜你喜欢",
  129. "max": 4,
  130. "pla": "选填,不超过四个字"
  131. }
  132. ],
  133. "link": {
  134. "title": "链接",
  135. "activeVal": 1,
  136. "optiops": [
  137. {
  138. "type": 0,
  139. "value": 1,
  140. "label": "精品推荐"
  141. },
  142. {
  143. "type": 1,
  144. "value": 2,
  145. "label": "热门榜单"
  146. },
  147. {
  148. "type": 2,
  149. "value": 3,
  150. "label": "首发新品"
  151. },
  152. {
  153. "type": 3,
  154. "value": 4,
  155. "label": "促销单品"
  156. }
  157. ]
  158. }
  159. },
  160. {
  161. "chiild": [
  162. {
  163. "title": "标题",
  164. "val": "热门榜单",
  165. "max": 4,
  166. "pla": "选填,不超过四个字"
  167. },
  168. {
  169. "title": "简介",
  170. "val": "好评如云",
  171. "max": 4,
  172. "pla": "选填,不超过四个字"
  173. }
  174. ],
  175. "link": {
  176. "title": "链接",
  177. "activeVal": 2,
  178. "optiops": [
  179. {
  180. "type": 0,
  181. "value": 1,
  182. "label": "精品推荐"
  183. },
  184. {
  185. "type": 1,
  186. "value": 2,
  187. "label": "热门榜单"
  188. },
  189. {
  190. "type": 2,
  191. "value": 3,
  192. "label": "首发新品"
  193. },
  194. {
  195. "type": 3,
  196. "value": 4,
  197. "label": "促销单品"
  198. }
  199. ]
  200. }
  201. },
  202. {
  203. "chiild": [
  204. {
  205. "title": "标题",
  206. "val": "促销单品",
  207. "max": 4,
  208. "pla": "选填,不超过四个字"
  209. },
  210. {
  211. "title": "简介",
  212. "val": "多买多销",
  213. "max": 4,
  214. "pla": "选填,不超过四个字"
  215. }
  216. ],
  217. "link": {
  218. "title": "链接",
  219. "activeVal": 4,
  220. "optiops": [
  221. {
  222. "type": 0,
  223. "value": 1,
  224. "label": "精品推荐"
  225. },
  226. {
  227. "type": 1,
  228. "value": 2,
  229. "label": "热门榜单"
  230. },
  231. {
  232. "type": 2,
  233. "value": 3,
  234. "label": "首发新品"
  235. },
  236. {
  237. "type": 3,
  238. "value": 4,
  239. "label": "促销单品"
  240. }
  241. ]
  242. }
  243. }
  244. ],
  245. numConfig: 9,
  246. // imgStyle: this.dataConfig.imgStyle.type,
  247. mbConfig: 0,
  248. themeColor: "rgba(29,176,252,1)",
  249. titleShow: true, //标题是否显示
  250. opriceShow: true, //原价是否显示
  251. priceShow: true, //价格是否显示
  252. couponShow: true,//优惠券标签是否显示
  253. titleConfig: 2, //标题位置
  254. fontColor: "rgba(253,80,47,1)",
  255. labelColor: "rgba(29,176,252,1)",
  256. typeId: ''
  257. };
  258. },
  259. created() {
  260. // this.getCategoryTwo(this.currentId)
  261. },
  262. methods: {
  263. clickNav(e) {
  264. this.typeId = e.id
  265. this.getGoodsPage(e.id)
  266. },
  267. getCategoryTwo(Id) {
  268. getCategoryTwo({
  269. parentId: Id
  270. }).then(res => {
  271. this.navigationList2 = res.data
  272. if (res.data.length > 0) {
  273. this.getGoodsPage(res.data[0].id)
  274. }
  275. })
  276. },
  277. getGoodsPage(typeId) {
  278. uni.showLoading({ title: '商品加载中' });
  279. getGoodsInfo({
  280. zoneType: 3,
  281. goodsCategoryId: this.typeId,
  282. current: 1,
  283. size: 100
  284. }).then(res => {
  285. this.tempArr = []
  286. this.tempArr = res.data
  287. uni.hideLoading();
  288. uni.stopPullDownRefresh()
  289. })
  290. },
  291. // 首发新品切换
  292. ProductNavTab(type, index) {
  293. this.ProductNavindex = index;
  294. this.$emit('changeTab', type);
  295. },
  296. goDetail(item) {
  297. this.$emit('detail', item);
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss">
  303. .index-product-wrapper {
  304. margin: 30rpx 20rpx 0 20rpx;
  305. &.on {
  306. min-height: 1500rpx;
  307. }
  308. .nav-bd {
  309. display: flex;
  310. align-items: center;
  311. margin-top: 30rpx;
  312. .item {
  313. display: flex;
  314. flex-direction: column;
  315. align-items: center;
  316. justify-content: center;
  317. width: 25%;
  318. &.on {
  319. border-radius: 0;
  320. }
  321. .txt {
  322. font-size: 32rpx;
  323. color: #282828;
  324. }
  325. .label {
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. width: 124rpx;
  330. height: 32rpx;
  331. margin-top: 5rpx;
  332. font-size: 24rpx;
  333. color: #999;
  334. border-radius: 16rpx;
  335. }
  336. }
  337. }
  338. .list-box {
  339. display: flex;
  340. flex-wrap: wrap;
  341. justify-content: space-between;
  342. margin-top: 30rpx;
  343. .item {
  344. width: 345rpx;
  345. margin-bottom: 20rpx;
  346. background-color: #fff;
  347. border-radius: 20rpx;
  348. overflow: hidden;
  349. position: relative;
  350. .pictrue_log {
  351. width: 92rpx;
  352. height: 44rpx;
  353. font-size: 26rpx;
  354. line-height: 44rpx;
  355. }
  356. image {
  357. width: 100%;
  358. height: 346rpx;
  359. display: block;
  360. }
  361. .text-info {
  362. padding: 10rpx 20rpx 15rpx;
  363. .title {
  364. color: #222222;
  365. }
  366. .tags {
  367. display: inline-block;
  368. font-size: 20rpx;
  369. padding: 6rpx;
  370. background-color: #FCE9EC;
  371. color: #EB4C63;
  372. margin: 6rpx 0;
  373. }
  374. .old-price {
  375. margin-top: 4rpx;
  376. font-size: 26rpx;
  377. color: #f51414;
  378. // text-decoration: line-through;
  379. text {
  380. margin-right: 2px;
  381. font-size: 20rpx;
  382. }
  383. }
  384. .price {
  385. display: flex;
  386. align-items: flex-end;
  387. font-size: 36rpx;
  388. font-weight: 550;
  389. text {
  390. padding-bottom: 4rpx;
  391. font-size: 26rpx;
  392. font-weight: normal;
  393. }
  394. .txt {
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. width: 28rpx;
  399. height: 28rpx;
  400. margin-left: 15rpx;
  401. margin-bottom: 10rpx;
  402. border-radius: 4rpx;
  403. font-size: 20rpx;
  404. font-weight: normal;
  405. &.on {
  406. margin-left: 0;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. &.on {
  413. display: flex;
  414. }
  415. }
  416. }
  417. </style>