templateE.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_01">
  4. <image class="item-img-gg"
  5. :src="floorData.floorContent.appletsAdsImage1"
  6. @click="BannerNavigateTo(
  7. floorData.floorContent.linkType1,
  8. floorData.floorContent.linkParam1.id ? floorData.floorContent.linkParam1.id : '',
  9. floorData.floorContent.adsLink1,
  10. floorData.floorContent.linkParam1.keyword ? floorData.floorContent.linkParam1.keyword : ''
  11. )"
  12. mode="aspectFill">
  13. </image>
  14. </view>
  15. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in floorData.floorImageList" :key="idx" @click.stop="navToDetailPage(item)">
  16. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  17. <view class="floor-item_tag" v-if="item.listType == 2">
  18. <text>{{ item.label }}</text>
  19. </view>
  20. <view class="floor-item-content">
  21. <view class="title tui-skeleton-rect">
  22. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  23. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''">{{item.name}} </text>
  24. </view>
  25. <view class="floor-item-price" v-if="item.listType == 1">
  26. <view class="floor-item-act">
  27. <template v-if="userIdentity === 3">
  28. <template v-if="item.product.actStatus===1">
  29. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  30. {{item.product.promotions.name}}
  31. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  32. </view>
  33. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  34. </template>
  35. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  36. <view class="floor-tags">阶梯价格</view>
  37. </template>
  38. </template>
  39. <template v-else>
  40. <template v-if="item.product.actStatus===1">
  41. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  42. {{item.product.promotions.name}}
  43. <text v-if="hasLogin && item.product.price1TextFlag != 1">:¥{{item.product.retailPrice | NumFormat}}</text>
  44. </view>
  45. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  46. </template>
  47. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  48. <view class="floor-tags">阶梯价格</view>
  49. </template>
  50. </template>
  51. </view>
  52. <view v-if="hasLogin">
  53. <template v-if="item.product.productCategory == 1">
  54. <template v-if="userIdentity == 3">
  55. <template v-if="item.product.shopID == shopId">
  56. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  57. <text class="p big">¥未公开价格</text>
  58. </view>
  59. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  60. <text class="p sm">¥</text>
  61. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  62. </view>
  63. </template>
  64. <template v-else>
  65. <view class="no-price">
  66. <view class="p-stars">
  67. <text class="p-no">¥</text>
  68. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  69. </view>
  70. </view>
  71. </template>
  72. </template>
  73. <template v-else-if="userIdentity ===4">
  74. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  75. <text class="p big">¥未公开价格</text>
  76. </view>
  77. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  78. <text class="p big">¥价格仅会员可见</text>
  79. </view>
  80. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :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 v-else>
  86. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  87. <text class="p big">¥未公开价格</text>
  88. </view>
  89. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  90. <text class="p sm">¥</text>
  91. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  92. </view>
  93. </template>
  94. </template>
  95. <template v-else>
  96. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  97. <text class="p sm">¥</text>
  98. <text class="p big">价格详聊</text>
  99. </view>
  100. <view class="price tui-skeleton-rect" v-else>
  101. <text class="p sm">¥</text>
  102. <text class="p big">{{ item.product.retailPrice | NumFormat }}</text>
  103. </view>
  104. </template>
  105. </view>
  106. <view v-else class="no-price">
  107. <template v-if="item.product.productCategory == 1">
  108. <view class="p-stars">
  109. <text class="p-no">¥</text>
  110. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  111. </view>
  112. </template>
  113. <template v-else>
  114. <view class="p-stars">
  115. <text class="p-no">¥登录可见</text>
  116. </view>
  117. </template>
  118. </view>
  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:"templateE",
  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. }
  145. },
  146. filters: {
  147. NumFormat:function(text) {//处理金额
  148. return Number(text).toFixed(2);
  149. },
  150. },
  151. created(){
  152. this.initData(this.pageData)
  153. },
  154. computed: {
  155. ...mapState(['hasLogin','userInfo','isActivity'])
  156. },
  157. watch: {
  158. pageData: {
  159. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  160. this.pageData = el
  161. this.initData(this.pageData)
  162. },
  163. deep: true
  164. }
  165. },
  166. methods:{
  167. initData(data){
  168. this.floorData = data
  169. // console.log(this.floorData)
  170. this.$api.getStorage().then((resolve) =>{
  171. this.shopId = resolve.shopId ? resolve.shopId : 0
  172. }).catch(err => {
  173. console.log('err',err)
  174. })
  175. },
  176. PromotionsFormat(promo){//促销活动类型数据处理
  177. if(promo!=null){
  178. if(promo.type == 1 && promo.mode == 1){
  179. return true
  180. }else{
  181. return false
  182. }
  183. }
  184. return false
  185. },
  186. navToDetailPage(pros) {//跳转商品详情页
  187. this.$api.FlooryNavigateTo(pros)
  188. },
  189. BannerNavigateTo(linkType,linkId,linkHref,keyword) {//跳转商品详情页
  190. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. .section_page_main{
  197. width: 100%;
  198. height: auto;
  199. box-sizing: border-box;
  200. .floor-item{
  201. width: 339rpx;
  202. height: 516rpx;
  203. margin-right: 20rpx;
  204. font-size: $font-size-24;
  205. color: $text-color;
  206. background: #FFFFFF;
  207. line-height: 36rpx;
  208. border-radius: 16rpx;
  209. margin-bottom: 20rpx;
  210. float: left;
  211. box-sizing: border-box;
  212. position: relative;
  213. &.ad_01{
  214. width: 100%;
  215. height: 240rpx;
  216. .item-img-gg{
  217. width: 100%;
  218. height: 240rpx;
  219. display: block;
  220. border-radius: 16rpx;
  221. }
  222. }
  223. &.ad_02{
  224. margin-right: 20rpx;
  225. }
  226. &:nth-child(odd){
  227. margin-right: 0;
  228. }
  229. .item-img-gg{
  230. width: 339rpx;
  231. height: 516rpx;
  232. display: block;
  233. border-radius: 16rpx;
  234. }
  235. .item-img{
  236. width: 339rpx;
  237. height: 339rpx;
  238. border-radius: 16rpx 16rpx 0 0;
  239. display: block;
  240. margin-bottom: 8rpx;
  241. }
  242. .floor-item_tag{
  243. width: 100%;
  244. height: 32rpx;
  245. float: left;
  246. margin: 20rpx 0;
  247. padding: 0 20rpx;
  248. box-sizing: border-box;
  249. text{
  250. display: inline-block;
  251. padding: 0 8rpx;
  252. border: 1px solid #e3ebf7;
  253. border-radius: 8rpx ;
  254. color: #9aa5b5;
  255. font-size: $font-size-22;
  256. line-height: 32rpx;
  257. text-align: center;
  258. float: left;
  259. }
  260. }
  261. .floor-item-content{
  262. width: 100%;
  263. padding: 0 20rpx;
  264. box-sizing: border-box;
  265. }
  266. .floor-item-act{
  267. display: block;
  268. width: 100%;
  269. height: 32rpx;
  270. text-align: center;
  271. box-sizing: border-box;
  272. }
  273. .floor-tags{
  274. height: 28rpx;
  275. border-radius: 6rpx;
  276. background-color: #FFFFFF;
  277. line-height: 28rpx;
  278. color: $color-system;
  279. text-align: center;
  280. display: inline-block;
  281. padding:0 16rpx;
  282. font-size: $font-size-20;
  283. border: 1px solid #E15616;
  284. float: left;
  285. }
  286. .title-none{
  287. font-size: $font-size-26;
  288. color: #FF2A2A;
  289. line-height: 54rpx;
  290. }
  291. .title{
  292. width: 100%;
  293. height: 70rpx;
  294. display: flex;
  295. line-height: 35rpx;
  296. flex-direction: column;
  297. margin: 8rpx 0;
  298. padding: 0;
  299. position: relative;
  300. .mclap{
  301. width: 100%;
  302. line-height:35rpx;
  303. text-overflow:ellipsis;
  304. display: -webkit-box;
  305. word-break: break-all;
  306. -webkit-box-orient: vertical;
  307. -webkit-line-clamp: 2;
  308. overflow: hidden;
  309. font-size: 26rpx;
  310. &.indent{
  311. text-indent: 95rpx;
  312. }
  313. }
  314. .mclap-tag{
  315. display: block;
  316. width: 84rpx;
  317. height: 32rpx;
  318. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  319. border-radius: 4rpx 48rpx 4px 4px;
  320. line-height: 32rpx;
  321. font-size: $font-size-22;
  322. color: #FFFFFF;
  323. text-align: center;
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. }
  328. }
  329. .no-price{
  330. height: 54rpx;
  331. line-height: 54rpx;
  332. display: flex;
  333. box-sizing: border-box;
  334. .p-no{
  335. font-size: $font-size-28;
  336. color: $text-color;
  337. display: block;
  338. float: left;
  339. }
  340. .p-stars{
  341. float: left;
  342. }
  343. }
  344. .price{
  345. color: #FF2A2A;
  346. line-height:54rpx;
  347. &.none{
  348. text-decoration: line-through;
  349. color: #999999;
  350. }
  351. .sm{
  352. font-size: $font-size-24;
  353. }
  354. .big{
  355. font-size: $font-size-28;
  356. }
  357. }
  358. }
  359. }
  360. </style>