templateB.vue 9.9 KB

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