arrivals.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view>
  3. <!--components/selected/selected.wxml-->
  4. <template name="arrivals">
  5. <view :class="arrivalsTemplate.theme==2?'pdlr30':''"
  6. v-if="arrivalsTemplate&&arrivalsTemplate.state==0&&arrivalsList.products.length > 0">
  7. <view class="mt20 bgfff r10">
  8. <navigator class="head" hover-class="none"
  9. :url="'/product/list/list?categoryId=1&title=新品上架&attr=news' + web">
  10. <view :class="'titleNav dflex' + (arrivalsTemplate.theme==2?'':' pdlr30')" v-if="arrivalsTemplate.titleType==1">
  11. {{arrivalsTemplate.titleCon}}
  12. <image src="/static/pages/images/more.png" class="more"></image>
  13. </view>
  14. <image lazy-load="true" v-if="arrivalsTemplate.titleType==2"
  15. :src="arrivalsTemplate.titleCon + '?x-oss-process=style/w750-auto'" mode="widthFix"
  16. class="imgtit"></image>
  17. </navigator>
  18. <!-- <navigator url="/product/list/list?categoryId=1&title={{chosenTemplate.titleCon}}" hover-class="none" class="title dflex">{{chosenTemplate.titleCon ? chosenTemplate.titleCon : '精选'}}
  19. <image src="/pages/images/more.png" class="more"></image>
  20. </navigator> -->
  21. <!-- <view class="jingxuan dflex pdlr20">
  22. <block v-for="(item, index) in boutiqueList" :key="index">
  23. <navigator :url="'/product/detail/detail?id=' + item.id + '' + (merchant.type==5?web:url)" hover-class="none" class="li">
  24. <image lazy-load="true" :src="item.pic + '?x-oss-process=style/w210'" mode="aspectFit"></image>
  25. <view class="name">{{item.title}}</view>
  26. <view class="price">
  27. ¥<text>{{about.show_membership_price==1&&item.actualPrice<item.salePrice?item.actualPrice:item.salePrice}}<>
  28. </text>undefined</tag>
  29. </text>undefined</tag>
  30. </text></text></view>
  31. </navigator>
  32. </block>
  33. </view> -->
  34. <view :class="arrivalsTemplate.theme==2?'':'pdlr20'">
  35. <goodsList :pageList="arrivalsList" :about="about" :merchant="web"></goodsList>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. </view>
  41. </template>
  42. <script>
  43. const route = require("../../utils/route"); // components/selected/selected.js
  44. import goodsList from "../../components/goodsList/goodsList";
  45. export default {
  46. data() {
  47. return {
  48. // boutiqueList: {},
  49. // chosenTemplate: {}
  50. };
  51. },
  52. components: {
  53. goodsList
  54. },
  55. props: {
  56. arrivalsList:Object, //{backgroundColor:背景颜色,displayStyle: 样式模板,lineNumber:每行几个,products:产品列表}
  57. about: Object, //参数配置, 是否显示会员价
  58. web: String, //路由跳转
  59. url: String, //路由跳转字符串
  60. arrivalsTemplate:Object, //精选后台配置
  61. // homeTemplate: Array,
  62. // templateType: Object,
  63. // merchant:Object
  64. },
  65. watch: {
  66. },
  67. mounted() { // this.init()
  68. // console.log(this.boutiqueLis,this.chosenTemplate,this.merchant)
  69. // this.getRqeDatas()
  70. },
  71. methods: {
  72. getRqeDatas() {
  73. let that = this; //精选
  74. let arrivals = that.homeTemplate.filter(it => it.module == that.templateType.module_new_arrivals);
  75. if (arrivals && arrivals.length > 0 && arrivals[0].state == 0) {
  76. that.setData({
  77. arrivalsTemplate: arrivals[0]
  78. });
  79. this.getArrivalsList(arrivals[0]);
  80. }
  81. },
  82. getArrivalsList(arrivalsTemplate) {
  83. if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) {
  84. let from = {
  85. page: this.page,
  86. limit: arrivalsTemplate.number,
  87. type: 1,
  88. merchantId: this.merchant.merchantDTO.id,
  89. sid: this.merchant.id,
  90. attr: 'news'
  91. };
  92. if (this.shopId && this.merchantId) from.merchantId = this.merchantId, from.sid = this.shopId;
  93. route.getShopeList(from, res => {
  94. res = {
  95. displayStyle: arrivalsTemplate.theme,
  96. lineNumber: arrivalsTemplate.lineNumber,
  97. products: res
  98. };
  99. this.setData({
  100. arrivalsList: res
  101. });
  102. });
  103. }
  104. if (this.merchant && this.merchant.type != 5) {
  105. let from = {
  106. page: 1,
  107. limit: arrivalsTemplate.number,
  108. merchantId: this.merchant.id
  109. };
  110. if (arrivalsTemplate.content != "") {
  111. from.contentId = arrivalsTemplate.contentId;
  112. } else {
  113. from.attr = 'news';
  114. }
  115. route.getProductList(from, res => {
  116. res = {
  117. displayStyle: arrivalsTemplate.theme,
  118. lineNumber: arrivalsTemplate.lineNumber,
  119. products: res
  120. };
  121. this.setData({
  122. arrivalsList: res
  123. });
  124. });
  125. }
  126. }
  127. }
  128. };
  129. </script>
  130. <style>
  131. @import "./arrivals.css";
  132. </style>