templateH.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="recommend-list">
  4. <swiper class="tui-banner-swiper" :autoplay="true" :interval="5000" :duration="500" :circular="true" @change="swiperChange">
  5. <swiper-item v-for="(product,index) in productList" :key="index">
  6. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in product" :key="idx" @click.stop="navToDetailPage(item)">
  7. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  8. <view class="floor-item_tag" v-if="item.listType == 2">
  9. <text>{{ item.label }}</text>
  10. </view>
  11. <view class="floor-item-content">
  12. <view class="title tui-skeleton-rect">
  13. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  14. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''">{{item.name}} </text>
  15. </view>
  16. <view class="floor-item-price" v-if="item.listType == 1">
  17. <view class="floor-item-act">
  18. <template v-if="userIdentity === 3">
  19. <template v-if="item.product.actStatus===1">
  20. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  21. {{item.product.promotions.name}}
  22. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  23. </view>
  24. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  25. </template>
  26. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  27. <view class="floor-tags">阶梯价格</view>
  28. </template>
  29. </template>
  30. <template v-else>
  31. <template v-if="item.product.actStatus===1">
  32. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  33. {{item.product.promotions.name}}
  34. <text v-if="hasLogin && item.product.price1TextFlag != 1">:¥{{item.product.retailPrice | NumFormat}}</text>
  35. </view>
  36. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  37. </template>
  38. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  39. <view class="floor-tags">阶梯价格</view>
  40. </template>
  41. </template>
  42. </view>
  43. <view v-if="hasLogin">
  44. <template v-if="item.product.productCategory == 1">
  45. <template v-if="userIdentity == 3">
  46. <template v-if="item.product.shopID == shopId">
  47. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  48. <text class="p big">¥未公开价格</text>
  49. </view>
  50. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  51. <text class="p sm">¥</text>
  52. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  53. </view>
  54. </template>
  55. <template v-else>
  56. <view class="no-price">
  57. <view class="p-stars">
  58. <text class="p-no">¥</text>
  59. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  60. </view>
  61. </view>
  62. </template>
  63. </template>
  64. <template v-else-if="userIdentity ===4">
  65. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  66. <text class="p big">¥未公开价格</text>
  67. </view>
  68. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  69. <text class="p big">¥价格仅会员可见</text>
  70. </view>
  71. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  72. <text class="p sm">¥</text>
  73. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  74. </view>
  75. </template>
  76. <template v-else>
  77. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  78. <text class="p big">¥未公开价格</text>
  79. </view>
  80. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  81. <text class="p sm">¥</text>
  82. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  83. </view>
  84. </template>
  85. </template>
  86. <template v-else>
  87. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  88. <text class="p sm">¥</text>
  89. <text class="p big">价格详聊</text>
  90. </view>
  91. <view class="price tui-skeleton-rect" v-else>
  92. <text class="p sm">¥</text>
  93. <text class="p big">{{ item.product.retailPrice | NumFormat }}</text>
  94. </view>
  95. </template>
  96. </view>
  97. <view v-else class="no-price">
  98. <template v-if="item.product.productCategory == 1">
  99. <view class="p-stars">
  100. <text class="p-no">¥</text>
  101. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  102. </view>
  103. </template>
  104. <template v-else>
  105. <view class="p-stars">
  106. <text class="p-no">¥登录可见</text>
  107. </view>
  108. </template>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </swiper-item>
  114. </swiper>
  115. <view class="swiper__recommenddots-box" v-if="productList.length > 1">
  116. <view v-for="(item,idx) in productList"
  117. :key="idx"
  118. :class="[idx===swiperCurrent?'swiper__dots-long':'none']"
  119. :data-index="swiperCurrent" class="swiper__dots-item">
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </template>
  125. <script>
  126. import { mapState,mapMutations} from 'vuex';
  127. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  128. export default{
  129. name:"templateH",
  130. components:{
  131. uniGrader
  132. },
  133. props:{
  134. pageData:{
  135. type:Object
  136. },
  137. userIdentity:{
  138. type:Number
  139. }
  140. },
  141. data() {
  142. return{
  143. shopId:0,
  144. productList:[],
  145. current:100,
  146. swiperCurrent:0,
  147. pageSize:4,
  148. }
  149. },
  150. filters: {
  151. NumFormat:function(text) {//处理金额
  152. return Number(text).toFixed(2);
  153. },
  154. },
  155. created(){
  156. this.initData(this.pageData)
  157. },
  158. computed: {
  159. ...mapState(['hasLogin','userInfo','isActivity'])
  160. },
  161. watch: {
  162. pageData: {
  163. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  164. this.pageData = el
  165. this.initData(this.pageData)
  166. },
  167. deep: true
  168. }
  169. },
  170. methods:{
  171. initData(data){
  172. this.$api.getStorage().then((resolve) =>{
  173. this.shopId = resolve.shopID ? resolve.shopID : 0
  174. })
  175. if(data.floorImageList.length>0){
  176. this.productList.splice(0,this.productList.length);
  177. for (var i = 0, j = data.floorImageList.length; i < j; i += this.pageSize) {
  178. this.productList.push(data.floorImageList.slice(i, i + this.pageSize));
  179. }
  180. }
  181. },
  182. PromotionsFormat(promo){//促销活动类型数据处理
  183. if(promo!=null){
  184. if(promo.type == 1 && promo.mode == 1){
  185. return true
  186. }else{
  187. return false
  188. }
  189. }
  190. return false
  191. },
  192. tabClick(index) {//轮播图切换
  193. this.current = index;
  194. },
  195. swiperChange(e) {//轮播切换
  196. const index = e.detail.current;
  197. this.swiperCurrent = index;
  198. },
  199. navToDetailPage(pros) {//跳转商品详情页
  200. this.$api.FlooryNavigateTo(pros)
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss">
  206. .section_page_main{
  207. width: 100%;
  208. height: auto;
  209. box-sizing: border-box;
  210. .recommend-list{
  211. width: 100%;
  212. height: 1100rpx;
  213. position: relative;
  214. padding-bottom: 20rpx;
  215. .tui-banner-swiper {
  216. width: 100%;
  217. margin: 0 auto;
  218. background: #F7F7F7;
  219. height: 1100rpx;
  220. overflow: hidden;
  221. transform: translateY(0);
  222. .floor-item{
  223. width: 339rpx;
  224. height: 516rpx;
  225. margin-right: 20rpx;
  226. font-size: $font-size-24;
  227. color: $text-color;
  228. background: #FFFFFF;
  229. line-height: 36rpx;
  230. border-radius: 16rpx;
  231. margin-bottom: 20rpx;
  232. float: left;
  233. box-sizing: border-box;
  234. position: relative;
  235. &:nth-child(2n){
  236. margin-right: 0;
  237. }
  238. .item-img{
  239. width: 339rpx;
  240. height: 339rpx;
  241. border-radius: 16rpx 16rpx 0 0;
  242. display: block;
  243. margin-bottom: 8rpx;
  244. }
  245. .floor-item_tag{
  246. width: 100%;
  247. height: 32rpx;
  248. float: left;
  249. margin: 20rpx 0;
  250. padding: 0 20rpx;
  251. box-sizing: border-box;
  252. text{
  253. display: inline-block;
  254. padding: 0 8rpx;
  255. border: 1px solid #e3ebf7;
  256. border-radius: 8rpx ;
  257. color: #9aa5b5;
  258. font-size: $font-size-22;
  259. line-height: 32rpx;
  260. text-align: center;
  261. float: left;
  262. }
  263. }
  264. .floor-item-content{
  265. width: 100%;
  266. padding: 0 20rpx;
  267. box-sizing: border-box;
  268. }
  269. .floor-item-act{
  270. display: block;
  271. width: 100%;
  272. height: 32rpx;
  273. text-align: center;
  274. box-sizing: border-box;
  275. }
  276. .floor-tags{
  277. height: 28rpx;
  278. border-radius: 6rpx;
  279. background-color: #FFFFFF;
  280. line-height: 28rpx;
  281. color: $color-system;
  282. text-align: center;
  283. display: inline-block;
  284. padding:0 16rpx;
  285. font-size: $font-size-20;
  286. border: 1px solid #E15616;
  287. float: left;
  288. }
  289. .title-none{
  290. font-size: $font-size-26;
  291. color: #FF2A2A;
  292. line-height: 54rpx;
  293. }
  294. .title{
  295. width: 100%;
  296. height: 70rpx;
  297. display: flex;
  298. line-height: 35rpx;
  299. flex-direction: column;
  300. margin: 8rpx 0;
  301. padding: 0;
  302. position: relative;
  303. .mclap{
  304. width: 100%;
  305. line-height:35rpx;
  306. text-overflow:ellipsis;
  307. display: -webkit-box;
  308. word-break: break-all;
  309. -webkit-box-orient: vertical;
  310. -webkit-line-clamp: 2;
  311. overflow: hidden;
  312. font-size: 26rpx;
  313. &.indent{
  314. text-indent: 95rpx;
  315. }
  316. }
  317. .mclap-tag{
  318. display: block;
  319. width: 84rpx;
  320. height: 32rpx;
  321. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  322. border-radius: 4rpx 48rpx 4px 4px;
  323. line-height: 32rpx;
  324. font-size: $font-size-22;
  325. color: #FFFFFF;
  326. text-align: center;
  327. position: absolute;
  328. left: 0;
  329. top: 0;
  330. }
  331. }
  332. .no-price{
  333. height: 54rpx;
  334. line-height: 54rpx;
  335. display: flex;
  336. box-sizing: border-box;
  337. .p-no{
  338. font-size: $font-size-28;
  339. color: $text-color;
  340. display: block;
  341. float: left;
  342. }
  343. .p-stars{
  344. float: left;
  345. }
  346. }
  347. .price{
  348. color: #FF2A2A;
  349. line-height:54rpx;
  350. &.none{
  351. text-decoration: line-through;
  352. color: #999999;
  353. }
  354. .sm{
  355. font-size: $font-size-24;
  356. }
  357. .big{
  358. font-size: $font-size-28;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. .swiper__recommenddots-box{
  365. position: absolute;
  366. bottom: 0;
  367. left: 0;
  368. right: 0;
  369. /* #ifndef APP-NVUE */
  370. display: flex;
  371. /* #endif */
  372. flex: 1;
  373. flex-direction: row;
  374. justify-content: center;
  375. align-items: center;
  376. height: 60rpx;
  377. .swiper__dots-item{
  378. width: 8rpx;
  379. height: 8rpx;
  380. border-radius: 100%;
  381. margin-left: 6px;
  382. background-color:rgba(225,86,22,.3);
  383. }
  384. .swiper__dots-long{
  385. width: 32rpx;
  386. height: 8rpx;
  387. border-radius: 4rpx;
  388. background-color: #e15616;
  389. transition: all 0.4s;
  390. }
  391. }
  392. }
  393. </style>