goods.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="tui-product-box">
  3. <view class="tui-block__box" :style="diyitem.base.bgstyle">
  4. <view v-if="diyitem.title.title.show" class="group-name-box">
  5. <view class="tui-group-name">
  6. <view>
  7. <text>{{ diyitem.title.title.txt }}</text>
  8. </view>
  9. <view v-if="diyitem.title.more.show" class="tui-more__box" @tap="navigateTo"
  10. :data-url="diyitem.title.link">
  11. <text>{{ diyitem.title.more.txt }}</text>
  12. <tui-icon name="arrowright" :size="36" unit="rpx" color="#999"></tui-icon>
  13. </view>
  14. </view>
  15. </view>
  16. <view v-if="diyitem.list.length > 0" class="tui-product-list">
  17. <view v-if="diyitem.base.display === 'li'">
  18. <view class="tui-goodli-box">
  19. <block v-for="(dataItem, index) in diyitem.list" :key="index">
  20. <view v-if="dataItem.goods_id > 0" class="tui-goodli-item">
  21. <view class="goodliimgtitle" @tap="goodsDetail" :data-id="dataItem.goods_id">
  22. <image :src="dataItem.image" class="tui-goodli-img" mode="widthFix">
  23. </image>
  24. <view class="tui-goodli-title-box">
  25. <view class="tui-goodli-title">{{ dataItem.goods_name }}
  26. </view>
  27. <view v-if="dataItem.keyword" class="goodli-keyword">
  28. {{ dataItem.keyword }}
  29. </view>
  30. <view class="tui-goodli-price">
  31. <text class="tui-goodli-present">
  32. <text class="f-24">¥</text>{{ dataItem.price}}
  33. <block v-if="dataItem.ptype==2 && dataItem.quantity_unit">
  34. <text v-if="dataItem.time_amount > 0"
  35. class="f-24">/{{dataItem.time_amount}}{{dataItem.quantity_unit}}</text>
  36. <text v-else class="f-24"><text
  37. v-if="dataItem.is_times && dataItem.timesmum">/{{dataItem.timesmum}}</text>{{dataItem.quantity_unit}}</text>
  38. </block>
  39. </text>
  40. <text v-if="dataItem.original_price > 0" class="tui-factory-price">¥{{ dataItem.original_price
  41. }}</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view v-if="diyitem.base.is_binding == true" class="goodli-butt-box">
  46. <button :data-id="dataItem.goods_id" @click="choosetechnical"
  47. :style="'background:'+ pagestyleconfig.appstylecolor"
  48. class="goodli-button">选择{{lang.technical}}</button>
  49. </view>
  50. <view v-else class="goodli-butt-box">
  51. <button :data-id="dataItem.goods_id" @click="goodsDetail"
  52. :style="'background:'+ pagestyleconfig.appstylecolor"
  53. class="goodli-button">详情</button>
  54. </view>
  55. </view>
  56. </block>
  57. </view>
  58. </view>
  59. <view v-else class="diy-goods">
  60. <view :class="'goods-list display__' + diyitem.base.display + ' column__' + diyitem.base.column">
  61. <scroll-view :scroll-x="diyitem.base.display === 'slide' ? true : false">
  62. <block v-for="(dataItem, index) in diyitem.list" :key="index">
  63. <view v-if="dataItem.goods_id" class="goods-item">
  64. <navigator hover-class="none"
  65. :url="dataItem.goods_id > 0 ? '/pages/goodsDetail/goodsDetail?id=' + dataItem.goods_id : ''">
  66. <view class="goods-image">
  67. <image :style="diyitem.base.widthheight ? diyitem.base.widthheight : ''"
  68. :src="dataItem.image"></image>
  69. </view>
  70. <view class="detail">
  71. <view v-if="diyitem.base.text.show > 0"
  72. class="goods-name twolist-hidden f-28">
  73. {{ dataItem.goods_name }}
  74. </view>
  75. <view v-if="diyitem.base.sjg" class="goods-price col-m">
  76. <text v-if="dataItem.is_points_goods == 1">{{lang.points}}:{{
  77. dataItem.pay_points }}</text>
  78. <text v-if="dataItem.is_points_goods != 1"><text class="f-24">¥</text>{{
  79. dataItem.price }}
  80. <block v-if="dataItem.ptype==2 && dataItem.quantity_unit">
  81. <text v-if="dataItem.time_amount > 0"
  82. class="f-24">/{{dataItem.time_amount}}{{dataItem.quantity_unit}}</text>
  83. <text v-else class="f-24"><text
  84. v-if="dataItem.is_times && dataItem.timesmum">/{{dataItem.timesmum}}</text>{{dataItem.quantity_unit}}</text>
  85. </block>
  86. </text><text v-if="dataItem.original_price > 0"
  87. class="tui-factory-price">¥{{
  88. dataItem.original_price }}</text>
  89. <text v-if="dataItem.minimum > 1"
  90. style="color:#999;font-size:24rpx;">起售量
  91. {{ dataItem.minimum }}</text>
  92. </view>
  93. </view>
  94. </navigator>
  95. </view>
  96. </block>
  97. </scroll-view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. export default {
  106. name: 'goods',
  107. props: {
  108. diyitem: {
  109. type: Object,
  110. default () {
  111. return {};
  112. }
  113. },
  114. pagestyleconfig: {
  115. type: Object,
  116. default () {
  117. return {};
  118. }
  119. }
  120. },
  121. computed: {
  122. },
  123. data() {
  124. return {
  125. lang: {}
  126. };
  127. },
  128. mounted() {
  129. let _this = this
  130. _this.$request.get('Lang.getlang').then(res => {
  131. if (res.errno == 0) {
  132. _this.lang = res.data;
  133. }
  134. });
  135. },
  136. methods: {
  137. navigateTo: function(e) {
  138. this.sam.diynavigateTo(e)
  139. },
  140. goodsDetail: function(e) {
  141. this.sam.navigateTo('/pages/goodsDetail/goodsDetail?id=' + e.currentTarget.dataset.id);
  142. },
  143. choosetechnical: function(e) {
  144. this.sam.navigateTo('/pages/technical/list?goodsid=' + e.currentTarget.dataset.id);
  145. },
  146. }
  147. };
  148. </script>
  149. <style>
  150. @import './diyapge.css';
  151. </style>