templateF.vue 10.0 KB

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