templateC.vue 8.6 KB

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