templateD.vue 8.9 KB

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