templateD.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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.appletsAdsImage1" mode="aspectFill"></image>
  5. </view>
  6. <view class="floor-item ad_02">
  7. <image class="item-img-gg" :src="floorData.floorContent.appletsAdsImage2" mode="aspectFill"></image>
  8. </view>
  9. <view class="floor-item ad_03">
  10. <image class="item-img-gg" :src="floorData.floorContent.appletsAdsImage3" mode="aspectFill"></image>
  11. </view>
  12. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in floorData.floorImageList" :key="idx" @click.stop="navToDetailPage(item)">
  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(pros) {//跳转商品详情页
  169. if(pros.listType == 1){
  170. if(pros.product.productCategory == '1'){
  171. this.$api.navigateTo(`/pages/goods/product?id=${pros.product.productID}`)
  172. }else{
  173. this.$api.navigateTo(`/second/pages/product/product-details?id=${pros.product.productID}`)
  174. }
  175. }else{
  176. /**
  177. * 页面跳转类型
  178. * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
  179. * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
  180. * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
  181. **/
  182. if(pros.linkType){
  183. const typeMap = {
  184. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.name}`,
  185. 2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
  186. 4:`/h5/pages/activity/activity?id=${pros.linkParam.id}`,
  187. 5:`/pages/goods/product?id=${pros.linkParam.id}`,
  188. 7:`/supplier/pages/user/my-shop?shopId=${pros.linkParam.id}`,
  189. 8:`/h5/pages/activity/activity-list`,
  190. 9:`/second/pages/form/introduce`,
  191. 10:`/second/pages/product/product-list`,
  192. 11:`/second/pages/form/form`,
  193. 12:`/pages/search/search?keyWord=${pros.name}`,
  194. 13:`/h5/pages/article/page?link=${pros.link}`,
  195. 14:`/h5/pages/article/page?link=${pros.link}`,
  196. 15:`/h5/pages/article/page?link=${pros.link}`,
  197. 17:`/pages/login/register-select`,
  198. 18:`/h5/pages/article/page?link=${pros.link}`,
  199. 19:`/pages/search/search-supplier?keyWord=${pros.name}`
  200. }
  201. const url = typeMap[pros.linkType];
  202. this.$api.navigateTo(url)
  203. }
  204. }
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss">
  210. .section_page_main{
  211. width: 100%;
  212. height: auto;
  213. box-sizing: border-box;
  214. .floor-item{
  215. width: 339rpx;
  216. height: 516rpx;
  217. margin-right: 20rpx;
  218. font-size: $font-size-24;
  219. color: $text-color;
  220. background: #FFFFFF;
  221. line-height: 36rpx;
  222. border-radius: 16rpx;
  223. margin-bottom: 20rpx;
  224. float: left;
  225. box-sizing: border-box;
  226. position: relative;
  227. &.ad_01{
  228. width: 100%;
  229. height: 240rpx;
  230. margin-right: 0;
  231. .item-img-gg{
  232. width: 100%;
  233. height: 240rpx;
  234. display: block;
  235. border-radius: 16rpx;
  236. }
  237. }
  238. &:nth-child(odd){
  239. margin-right: 0;
  240. }
  241. .item-img-gg{
  242. width: 339rpx;
  243. height: 516rpx;
  244. display: block;
  245. border-radius: 16rpx;
  246. }
  247. .item-img{
  248. width: 339rpx;
  249. height: 339rpx;
  250. border-radius: 16rpx 16rpx 0 0;
  251. display: block;
  252. margin-bottom: 8rpx;
  253. }
  254. .floor-item_tag{
  255. width: 100%;
  256. height: 32rpx;
  257. float: left;
  258. margin: 20rpx 0;
  259. padding: 0 20rpx;
  260. box-sizing: border-box;
  261. text{
  262. display: inline-block;
  263. padding: 0 8rpx;
  264. border: 1px solid #e3ebf7;
  265. border-radius: 8rpx ;
  266. color: #9aa5b5;
  267. font-size: $font-size-22;
  268. line-height: 32rpx;
  269. text-align: center;
  270. float: left;
  271. }
  272. }
  273. .floor-item-content{
  274. width: 100%;
  275. padding: 0 20rpx;
  276. box-sizing: border-box;
  277. }
  278. .floor-item-act{
  279. display: block;
  280. width: 100%;
  281. height: 32rpx;
  282. text-align: center;
  283. box-sizing: border-box;
  284. }
  285. .floor-tags{
  286. height: 28rpx;
  287. border-radius: 6rpx;
  288. background-color: #FFFFFF;
  289. line-height: 28rpx;
  290. color: $color-system;
  291. text-align: center;
  292. display: inline-block;
  293. padding:0 16rpx;
  294. font-size: $font-size-20;
  295. border: 1px solid #E15616;
  296. float: left;
  297. }
  298. .title-none{
  299. font-size: $font-size-26;
  300. color: #FF2A2A;
  301. line-height: 54rpx;
  302. }
  303. .title{
  304. width: 100%;
  305. height: 70rpx;
  306. display: flex;
  307. line-height: 35rpx;
  308. flex-direction: column;
  309. margin: 8rpx 0;
  310. padding: 0;
  311. .mclap{
  312. width: 100%;
  313. line-height:35rpx;
  314. text-overflow:ellipsis;
  315. display: -webkit-box;
  316. word-break: break-all;
  317. -webkit-box-orient: vertical;
  318. -webkit-line-clamp: 2;
  319. overflow: hidden;
  320. font-size: 26rpx;
  321. }
  322. }
  323. .no-price{
  324. height: 54rpx;
  325. line-height: 54rpx;
  326. display: flex;
  327. box-sizing: border-box;
  328. .p-no{
  329. font-size: $font-size-28;
  330. color: $text-color;
  331. display: block;
  332. float: left;
  333. }
  334. .p-stars{
  335. float: left;
  336. }
  337. }
  338. .price{
  339. color: #FF2A2A;
  340. line-height:54rpx;
  341. &.none{
  342. text-decoration: line-through;
  343. color: #999999;
  344. }
  345. .sm{
  346. font-size: $font-size-24;
  347. }
  348. .big{
  349. font-size: $font-size-28;
  350. }
  351. }
  352. }
  353. }
  354. </style>