templateC.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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_04 clearfix" v-for="(item, idx) in floorData.floorImageList" v-if="idx < 3" :key="idx" @click.stop="navToDetailPage(item.product.productId)">
  10. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  11. <view class="floor-item_tag" v-if="item.listType == 2">
  12. <text>{{ item.label }}</text>
  13. </view>
  14. <view class="floor-item-content">
  15. <view class="title tui-skeleton-rect">
  16. <text class="mclap">{{item.name}}</text>
  17. </view>
  18. <view class="floor-item-price" v-if="item.listType == 1">
  19. <view class="floor-item-act">
  20. <template v-if="userIdentity === 3">
  21. <template v-if="item.product.actStatus===1">
  22. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  23. {{item.product.promotions.name}}
  24. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  25. </view>
  26. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  27. </template>
  28. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  29. <view class="floor-tags">阶梯价格</view>
  30. </template>
  31. </template>
  32. <template v-else>
  33. <template v-if="item.product.actStatus===1">
  34. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  35. {{item.product.promotions.name}}
  36. <text v-if="hasLogin && item.product.price1TextFlag != 1">:¥{{item.product.retailPrice | NumFormat}}</text>
  37. </view>
  38. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  39. </template>
  40. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  41. <view class="floor-tags">阶梯价格</view>
  42. </template>
  43. </template>
  44. </view>
  45. <view v-if="hasLogin">
  46. <template v-if="userIdentity == 3">
  47. <template v-if="item.product.shopID == shopId">
  48. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  49. <text class="p big">¥未公开价格</text>
  50. </view>
  51. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  52. <text class="p sm">¥</text>
  53. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  54. </view>
  55. </template>
  56. <template v-else>
  57. <view class="no-price">
  58. <view class="p-stars">
  59. <text class="p-no">¥</text>
  60. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  61. </view>
  62. </view>
  63. </template>
  64. </template>
  65. <template v-else-if="userIdentity ===4">
  66. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  67. <text class="p big">¥未公开价格</text>
  68. </view>
  69. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  70. <text class="p big">¥价格仅会员可见</text>
  71. </view>
  72. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  73. <text class="p sm">¥</text>
  74. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  75. </view>
  76. </template>
  77. <template v-else>
  78. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  79. <text class="p big">¥未公开价格</text>
  80. </view>
  81. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  82. <text class="p sm">¥</text>
  83. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  84. </view>
  85. </template>
  86. </view>
  87. <view v-else class="no-price">
  88. <template v-if="item.product.productCategory == 1">
  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. </template>
  94. <template v-else>
  95. <view class="p-stars">
  96. <text class="p-no">¥登录可见</text>
  97. </view>
  98. </template>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import { mapState,mapMutations} from 'vuex';
  107. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  108. export default{
  109. name:"templateC",
  110. components:{
  111. uniGrader
  112. },
  113. props:{
  114. pageData:{
  115. type:Object
  116. },
  117. userIdentity:{
  118. type:Number
  119. }
  120. },
  121. data() {
  122. return{
  123. shopId:0,
  124. floorData:{}
  125. }
  126. },
  127. filters: {
  128. NumFormat:function(text) {//处理金额
  129. return Number(text).toFixed(2);
  130. },
  131. },
  132. created(){
  133. this.initData(this.pageData)
  134. },
  135. computed: {
  136. ...mapState(['hasLogin','userInfo','isActivity'])
  137. },
  138. watch: {
  139. pageData: {
  140. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  141. this.pageData = el
  142. this.initData(this.pageData)
  143. },
  144. deep: true
  145. }
  146. },
  147. methods:{
  148. initData(data){
  149. this.$api.getStorage().then((resolve) =>{
  150. this.shopId = resolve.shopID
  151. })
  152. this.floorData = data
  153. // console.log(this.floorData)
  154. },
  155. PromotionsFormat(promo){//促销活动类型数据处理
  156. if(promo!=null){
  157. if(promo.type == 1 && promo.mode == 1){
  158. return true
  159. }else{
  160. return false
  161. }
  162. }
  163. return false
  164. },
  165. navToDetailPage(id) {//跳转商品详情页
  166. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. .section_page_main{
  173. width: 100%;
  174. height: auto;
  175. box-sizing: border-box;
  176. .floor-item{
  177. width: 339rpx;
  178. height: 516rpx;
  179. margin-right: 20rpx;
  180. font-size: $font-size-24;
  181. color: $text-color;
  182. background: #FFFFFF;
  183. line-height: 36rpx;
  184. border-radius: 16rpx;
  185. margin-bottom: 20rpx;
  186. float: left;
  187. box-sizing: border-box;
  188. position: relative;
  189. &.ad_01{
  190. width: 100%;
  191. height: 240rpx;
  192. .item-img-gg{
  193. width: 100%;
  194. height: 240rpx;
  195. display: block;
  196. border-radius: 16rpx;
  197. }
  198. }
  199. &.ad_02{
  200. margin-right: 20rpx;
  201. }
  202. &:nth-child(odd){
  203. margin-right: 0;
  204. }
  205. .item-img-gg{
  206. width: 339rpx;
  207. height: 516rpx;
  208. display: block;
  209. border-radius: 16rpx;
  210. }
  211. .item-img{
  212. width: 339rpx;
  213. height: 339rpx;
  214. border-radius: 16rpx 16rpx 0 0;
  215. display: block;
  216. margin-bottom: 8rpx;
  217. }
  218. .floor-item_tag{
  219. width: 100%;
  220. height: 32rpx;
  221. float: left;
  222. margin: 20rpx 0;
  223. padding: 0 20rpx;
  224. box-sizing: border-box;
  225. text{
  226. display: inline-block;
  227. padding: 0 8rpx;
  228. border: 1px solid #e3ebf7;
  229. border-radius: 8rpx ;
  230. color: #9aa5b5;
  231. font-size: $font-size-22;
  232. line-height: 32rpx;
  233. text-align: center;
  234. float: left;
  235. }
  236. }
  237. .floor-item_tag{
  238. width: 100%;
  239. height: 32rpx;
  240. float: left;
  241. margin: 8rpx 0;
  242. padding: 0 20rpx;
  243. box-sizing: border-box;
  244. margin-bottom: 20rpx;
  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>