templateG.vue 9.8 KB

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