templateD.vue 10 KB

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