templateF.vue 8.4 KB

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