templateA.vue 12 KB

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