templateF.vue 9.1 KB

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