templateD.vue 11 KB

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