templateH.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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">{{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. productList:[],
  144. current:100,
  145. swiperCurrent:0,
  146. pageSize:4,
  147. }
  148. },
  149. filters: {
  150. NumFormat:function(text) {//处理金额
  151. return Number(text).toFixed(2);
  152. },
  153. },
  154. created(){
  155. this.initData(this.pageData)
  156. },
  157. computed: {
  158. ...mapState(['hasLogin','userInfo','isActivity'])
  159. },
  160. watch: {
  161. pageData: {
  162. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  163. this.pageData = el
  164. this.initData(this.pageData)
  165. },
  166. deep: true
  167. }
  168. },
  169. methods:{
  170. initData(data){
  171. this.$api.getStorage().then((resolve) =>{
  172. this.shopId = resolve.shopID ? resolve.shopID : 0
  173. })
  174. if(data.floorImageList.length>0){
  175. this.productList.splice(0,this.productList.length);
  176. for (var i = 0, j = data.floorImageList.length; i < j; i += this.pageSize) {
  177. this.productList.push(data.floorImageList.slice(i, i + this.pageSize));
  178. }
  179. }
  180. },
  181. PromotionsFormat(promo){//促销活动类型数据处理
  182. if(promo!=null){
  183. if(promo.type == 1 && promo.mode == 1){
  184. return true
  185. }else{
  186. return false
  187. }
  188. }
  189. return false
  190. },
  191. tabClick(index) {//轮播图切换
  192. this.current = index;
  193. },
  194. swiperChange(e) {//轮播切换
  195. const index = e.detail.current;
  196. this.swiperCurrent = index;
  197. },
  198. navToDetailPage(pros) {//跳转商品详情页
  199. this.$api.FlooryNavigateTo(pros)
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. .section_page_main{
  206. width: 100%;
  207. height: auto;
  208. box-sizing: border-box;
  209. .recommend-list{
  210. width: 100%;
  211. height: 1100rpx;
  212. position: relative;
  213. padding-bottom: 20rpx;
  214. .tui-banner-swiper {
  215. width: 100%;
  216. margin: 0 auto;
  217. background: #F7F7F7;
  218. height: 1100rpx;
  219. overflow: hidden;
  220. transform: translateY(0);
  221. .floor-item{
  222. width: 339rpx;
  223. height: 516rpx;
  224. margin-right: 20rpx;
  225. font-size: $font-size-24;
  226. color: $text-color;
  227. background: #FFFFFF;
  228. line-height: 36rpx;
  229. border-radius: 16rpx;
  230. margin-bottom: 20rpx;
  231. float: left;
  232. box-sizing: border-box;
  233. position: relative;
  234. &:nth-child(2n){
  235. margin-right: 0;
  236. }
  237. .item-img{
  238. width: 339rpx;
  239. height: 339rpx;
  240. border-radius: 16rpx 16rpx 0 0;
  241. display: block;
  242. margin-bottom: 8rpx;
  243. }
  244. .floor-item_tag{
  245. width: 100%;
  246. height: 32rpx;
  247. float: left;
  248. margin: 20rpx 0;
  249. padding: 0 20rpx;
  250. box-sizing: border-box;
  251. text{
  252. display: inline-block;
  253. padding: 0 8rpx;
  254. border: 1px solid #e3ebf7;
  255. border-radius: 8rpx ;
  256. color: #9aa5b5;
  257. font-size: $font-size-22;
  258. line-height: 32rpx;
  259. text-align: center;
  260. float: left;
  261. }
  262. }
  263. .floor-item-content{
  264. width: 100%;
  265. padding: 0 20rpx;
  266. box-sizing: border-box;
  267. }
  268. .floor-item-act{
  269. display: block;
  270. width: 100%;
  271. height: 32rpx;
  272. text-align: center;
  273. box-sizing: border-box;
  274. }
  275. .floor-tags{
  276. height: 28rpx;
  277. border-radius: 6rpx;
  278. background-color: #FFFFFF;
  279. line-height: 28rpx;
  280. color: $color-system;
  281. text-align: center;
  282. display: inline-block;
  283. padding:0 16rpx;
  284. font-size: $font-size-20;
  285. border: 1px solid #E15616;
  286. float: left;
  287. }
  288. .title-none{
  289. font-size: $font-size-26;
  290. color: #FF2A2A;
  291. line-height: 54rpx;
  292. }
  293. .title{
  294. width: 100%;
  295. height: 70rpx;
  296. display: flex;
  297. line-height: 35rpx;
  298. flex-direction: column;
  299. margin: 8rpx 0;
  300. padding: 0;
  301. .mclap{
  302. width: 100%;
  303. line-height:35rpx;
  304. text-overflow:ellipsis;
  305. display: -webkit-box;
  306. word-break: break-all;
  307. -webkit-box-orient: vertical;
  308. -webkit-line-clamp: 2;
  309. overflow: hidden;
  310. font-size: 26rpx;
  311. }
  312. }
  313. .no-price{
  314. height: 54rpx;
  315. line-height: 54rpx;
  316. display: flex;
  317. box-sizing: border-box;
  318. .p-no{
  319. font-size: $font-size-28;
  320. color: $text-color;
  321. display: block;
  322. float: left;
  323. }
  324. .p-stars{
  325. float: left;
  326. }
  327. }
  328. .price{
  329. color: #FF2A2A;
  330. line-height:54rpx;
  331. &.none{
  332. text-decoration: line-through;
  333. color: #999999;
  334. }
  335. .sm{
  336. font-size: $font-size-24;
  337. }
  338. .big{
  339. font-size: $font-size-28;
  340. }
  341. }
  342. }
  343. }
  344. }
  345. .swiper__recommenddots-box{
  346. position: absolute;
  347. bottom: 0;
  348. left: 0;
  349. right: 0;
  350. /* #ifndef APP-NVUE */
  351. display: flex;
  352. /* #endif */
  353. flex: 1;
  354. flex-direction: row;
  355. justify-content: center;
  356. align-items: center;
  357. height: 60rpx;
  358. .swiper__dots-item{
  359. width: 8rpx;
  360. height: 8rpx;
  361. border-radius: 100%;
  362. margin-left: 6px;
  363. background-color:rgba(225,86,22,.3);
  364. }
  365. .swiper__dots-long{
  366. width: 32rpx;
  367. height: 8rpx;
  368. border-radius: 4rpx;
  369. background-color: #e15616;
  370. transition: all 0.4s;
  371. }
  372. }
  373. }
  374. </style>