templateH.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="recommend-list">
  4. <swiper class="tui-banner-swiper" :autoplay="false" :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 floorData.floorImageList" v-if="idx < 4" :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">{{item.name}}</text>
  14. </view>
  15. <view class="floor-item-price" v-if="item.listType == 1">
  16. <view class="floor-item-act">
  17. <template v-if="userIdentity === 3">
  18. <template v-if="item.product.actStatus===1">
  19. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  20. {{item.product.promotions.name}}
  21. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  22. </view>
  23. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  24. </template>
  25. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  26. <view class="floor-tags">阶梯价格</view>
  27. </template>
  28. </template>
  29. <template v-else>
  30. <template v-if="item.product.actStatus===1">
  31. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  32. {{item.product.promotions.name}}
  33. <text v-if="hasLogin && item.product.price1TextFlag != 1">:¥{{item.product.retailPrice | NumFormat}}</text>
  34. </view>
  35. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  36. </template>
  37. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  38. <view class="floor-tags">阶梯价格</view>
  39. </template>
  40. </template>
  41. </view>
  42. <view v-if="hasLogin">
  43. <template v-if="item.product.productCategory == 1">
  44. <template v-if="userIdentity == 3">
  45. <template v-if="item.product.shopID == shopId">
  46. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  47. <text class="p big">¥未公开价格</text>
  48. </view>
  49. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  50. <text class="p sm">¥</text>
  51. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  52. </view>
  53. </template>
  54. <template v-else>
  55. <view class="no-price">
  56. <view class="p-stars">
  57. <text class="p-no">¥</text>
  58. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  59. </view>
  60. </view>
  61. </template>
  62. </template>
  63. <template v-else-if="userIdentity ===4">
  64. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  65. <text class="p big">¥未公开价格</text>
  66. </view>
  67. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  68. <text class="p big">¥价格仅会员可见</text>
  69. </view>
  70. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  71. <text class="p sm">¥</text>
  72. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  73. </view>
  74. </template>
  75. <template v-else>
  76. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  77. <text class="p big">¥未公开价格</text>
  78. </view>
  79. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  80. <text class="p sm">¥</text>
  81. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  82. </view>
  83. </template>
  84. </template>
  85. <template v-else>
  86. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  87. <text class="p sm">¥</text>
  88. <text class="p big">价格详聊</text>
  89. </view>
  90. <view class="price tui-skeleton-rect" v-else>
  91. <text class="p sm">¥</text>
  92. <text class="p big">{{ item.product.retailPrice | NumFormat }}</text>
  93. </view>
  94. </template>
  95. </view>
  96. <view v-else class="no-price">
  97. <template v-if="item.product.productCategory == 1">
  98. <view class="p-stars">
  99. <text class="p-no">¥</text>
  100. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  101. </view>
  102. </template>
  103. <template v-else>
  104. <view class="p-stars">
  105. <text class="p-no">¥登录可见</text>
  106. </view>
  107. </template>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </swiper-item>
  113. </swiper>
  114. <view class="swiper__recommenddots-box" v-if="productList.length > 1">
  115. <view v-for="(item,idx) in productList"
  116. :key="idx"
  117. :class="[idx===swiperCurrent?'swiper__dots-long':'none']"
  118. :data-index="swiperCurrent" class="swiper__dots-item">
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </template>
  124. <script>
  125. import { mapState,mapMutations} from 'vuex';
  126. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  127. export default{
  128. name:"templateH",
  129. components:{
  130. uniGrader
  131. },
  132. props:{
  133. pageData:{
  134. type:Object
  135. },
  136. userIdentity:{
  137. type:Number
  138. }
  139. },
  140. data() {
  141. return{
  142. shopId:0,
  143. floorData:{},
  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
  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. this.floorData = data
  182. // console.log(this.floorData)
  183. },
  184. PromotionsFormat(promo){//促销活动类型数据处理
  185. if(promo!=null){
  186. if(promo.type == 1 && promo.mode == 1){
  187. return true
  188. }else{
  189. return false
  190. }
  191. }
  192. return false
  193. },
  194. tabClick(index) {//轮播图切换
  195. this.current = index;
  196. },
  197. swiperChange(e) {//轮播切换
  198. const index = e.detail.current;
  199. this.swiperCurrent = index;
  200. },
  201. navToDetailPage(pros) {//跳转商品详情页
  202. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss">
  208. .section_page_main{
  209. width: 100%;
  210. height: auto;
  211. box-sizing: border-box;
  212. .recommend-list{
  213. width: 100%;
  214. height: 1100rpx;
  215. position: relative;
  216. padding-bottom: 20rpx;
  217. .tui-banner-swiper {
  218. width: 100%;
  219. margin: 0 auto;
  220. background: #F7F7F7;
  221. height: 1100rpx;
  222. overflow: hidden;
  223. transform: translateY(0);
  224. .floor-item{
  225. width: 339rpx;
  226. height: 516rpx;
  227. margin-right: 20rpx;
  228. font-size: $font-size-24;
  229. color: $text-color;
  230. background: #FFFFFF;
  231. line-height: 36rpx;
  232. border-radius: 16rpx;
  233. margin-bottom: 20rpx;
  234. float: left;
  235. box-sizing: border-box;
  236. position: relative;
  237. &:nth-child(2n){
  238. margin-right: 0;
  239. }
  240. .item-img{
  241. width: 339rpx;
  242. height: 339rpx;
  243. border-radius: 16rpx 16rpx 0 0;
  244. display: block;
  245. margin-bottom: 8rpx;
  246. }
  247. .floor-item_tag{
  248. width: 100%;
  249. height: 32rpx;
  250. float: left;
  251. margin: 20rpx 0;
  252. padding: 0 20rpx;
  253. box-sizing: border-box;
  254. text{
  255. display: inline-block;
  256. padding: 0 8rpx;
  257. border: 1px solid #e3ebf7;
  258. border-radius: 8rpx ;
  259. color: #9aa5b5;
  260. font-size: $font-size-22;
  261. line-height: 32rpx;
  262. text-align: center;
  263. float: left;
  264. }
  265. }
  266. .floor-item-content{
  267. width: 100%;
  268. padding: 0 20rpx;
  269. box-sizing: border-box;
  270. }
  271. .floor-item-act{
  272. display: block;
  273. width: 100%;
  274. height: 32rpx;
  275. text-align: center;
  276. box-sizing: border-box;
  277. }
  278. .floor-tags{
  279. height: 28rpx;
  280. border-radius: 6rpx;
  281. background-color: #FFFFFF;
  282. line-height: 28rpx;
  283. color: $color-system;
  284. text-align: center;
  285. display: inline-block;
  286. padding:0 16rpx;
  287. font-size: $font-size-20;
  288. border: 1px solid #E15616;
  289. float: left;
  290. }
  291. .title-none{
  292. font-size: $font-size-26;
  293. color: #FF2A2A;
  294. line-height: 54rpx;
  295. }
  296. .title{
  297. width: 100%;
  298. height: 70rpx;
  299. display: flex;
  300. line-height: 35rpx;
  301. flex-direction: column;
  302. margin: 8rpx 0;
  303. padding: 0;
  304. .mclap{
  305. width: 100%;
  306. line-height:35rpx;
  307. text-overflow:ellipsis;
  308. display: -webkit-box;
  309. word-break: break-all;
  310. -webkit-box-orient: vertical;
  311. -webkit-line-clamp: 2;
  312. overflow: hidden;
  313. font-size: 26rpx;
  314. }
  315. }
  316. .no-price{
  317. height: 54rpx;
  318. line-height: 54rpx;
  319. display: flex;
  320. box-sizing: border-box;
  321. .p-no{
  322. font-size: $font-size-28;
  323. color: $text-color;
  324. display: block;
  325. float: left;
  326. }
  327. .p-stars{
  328. float: left;
  329. }
  330. }
  331. .price{
  332. color: #FF2A2A;
  333. line-height:54rpx;
  334. &.none{
  335. text-decoration: line-through;
  336. color: #999999;
  337. }
  338. .sm{
  339. font-size: $font-size-24;
  340. }
  341. .big{
  342. font-size: $font-size-28;
  343. }
  344. }
  345. }
  346. }
  347. }
  348. .swiper__recommenddots-box{
  349. position: absolute;
  350. bottom: 0;
  351. left: 0;
  352. right: 0;
  353. /* #ifndef APP-NVUE */
  354. display: flex;
  355. /* #endif */
  356. flex: 1;
  357. flex-direction: row;
  358. justify-content: center;
  359. align-items: center;
  360. height: 60rpx;
  361. .swiper__dots-item{
  362. width: 8rpx;
  363. height: 8rpx;
  364. border-radius: 100%;
  365. margin-left: 6px;
  366. background-color:rgba(225,86,22,.3);
  367. }
  368. .swiper__dots-long{
  369. width: 32rpx;
  370. height: 8rpx;
  371. border-radius: 4rpx;
  372. background-color: #e15616;
  373. transition: all 0.4s;
  374. }
  375. }
  376. }
  377. </style>