combination.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view>
  3. <view class="default" v-if="isIframe && !combinationList.length">
  4. <text>{{$t(`拼团模块,暂无数据`)}}</text>
  5. </view>
  6. <view class="combination index-wrapper" v-if="combinationList.length&&isShow&&!isIframe">
  7. <view class='title acea-row row-between-wrapper'>
  8. <view class='text'>
  9. <view class='name line1'>{{$t(`拼团活动`)}}</view>
  10. <view class='line1'>{{$t(`享超值开团价`)}}</view>
  11. </view>
  12. <navigator class='more' url="/pages/activity/goods_combination/index" hover-class="none">{{$t(`更多`)}}<text class='iconfont icon-jiantou'></text></navigator>
  13. </view>
  14. <view class="conter">
  15. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  16. <view class="itemCon" v-for="(item, index) in combinationList" :key="index" @click="goDetail(item)">
  17. <view class="item">
  18. <view class="pictrue">
  19. <image :src="item.image"></image>
  20. </view>
  21. <view class="name line1">{{item.title}}</view>
  22. <view class="money">
  23. <view class="price acea-row row-middle">
  24. <view class="label">{{$t(`拼团价`)}}</view>
  25. <view class="x_money">{{$t(`¥`)}}<text class="num">{{item.price}}</text></view>
  26. </view>
  27. <view class="bnt">{{$t(`参与拼团`)}}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. </view>
  34. <view class="combination index-wrapper" v-if="combinationList.length&&isIframe">
  35. <view class='title acea-row row-between-wrapper'>
  36. <view class='text'>
  37. <view class='name line1'>{{$t(`拼团活动`)}}</view>
  38. <view class='line1'>{{$t(`享超值开团价`)}}</view>
  39. </view>
  40. <navigator class='more'>{{$t(`更多`)}}<text class='iconfont icon-jiantou'></text></navigator>
  41. </view>
  42. <view class="conter">
  43. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  44. <view class="itemCon" v-for="(item, index) in combinationList" :key="index" @click="goDetail(item)">
  45. <view class="item">
  46. <view class="pictrue">
  47. <image :src="item.image"></image>
  48. </view>
  49. <view class="name line1">{{item.title}}</view>
  50. <view class="money">
  51. <view class="price acea-row row-middle">
  52. <view class="label">{{$t(`拼团价`)}}</view>
  53. <view class="x_money">{{$t(`¥`)}}<text class="num">{{item.price}}</text></view>
  54. </view>
  55. <view class="bnt">{{$t(`参与拼团`)}}</view>
  56. </view>
  57. </view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. let app = getApp();
  66. import {
  67. goPage
  68. } from '@/libs/order.js';
  69. import { getHomeProducts } from '@/api/store.js';
  70. export default {
  71. name: 'combination',
  72. props: {
  73. dataConfig: {
  74. type: Object,
  75. default: () => {}
  76. }
  77. },
  78. watch: {
  79. dataConfig: {
  80. immediate: true,
  81. handler(nVal, oVal) {
  82. if(nVal){
  83. this.isShow = nVal.isShow.val;
  84. this.selectType = nVal.tabConfig.tabVal;
  85. this.$set(this, 'selectId', nVal.selectConfig.activeValue || '');
  86. this.$set(this, 'type', nVal.titleInfo.type);
  87. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  88. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  89. this.ids = nVal.ids?nVal.ids.join(','):'';
  90. this.numConfig = nVal.numConfig.val;
  91. this.productslist();
  92. }
  93. }
  94. }
  95. },
  96. data() {
  97. return {
  98. combinationList: [],
  99. name:this.$options.name,//component组件固定写法获取当前name;
  100. isIframe:app.globalData.isIframe,//判断是前台还是后台;
  101. isShow:true,//判断此模块是否显示;
  102. selectType:0,
  103. selectId: '',
  104. salesOrder:'',
  105. newsOrder:'',
  106. ids:'',
  107. page: 1,
  108. limit: this.$config.LIMIT,
  109. type: '',
  110. numConfig:0
  111. };
  112. },
  113. created() {},
  114. mounted() {},
  115. methods: {
  116. // 产品列表
  117. productslist: function() {
  118. let that = this;
  119. let data = {};
  120. if (that.selectType) {
  121. data = {
  122. page: that.page,
  123. limit: that.limit,
  124. type: that.type,
  125. ids: that.ids,
  126. selectType: that.selectType
  127. }
  128. } else {
  129. data = {
  130. page: that.page,
  131. limit: that.numConfig<=that.limit?that.numConfig:that.limit,
  132. type: that.type,
  133. newsOrder: that.newsOrder,
  134. salesOrder: that.salesOrder,
  135. selectId: that.selectId,
  136. selectType: that.selectType
  137. }
  138. }
  139. getHomeProducts(data).then(res => {
  140. that.combinationList = res.data.list;
  141. }).catch(err => {
  142. that.$util.Tips({ title: err });
  143. });
  144. },
  145. goDetail(item){
  146. goPage(item).then(res=>{
  147. uni.navigateTo({
  148. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  149. })
  150. })
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. .default{
  157. width: 690rpx;
  158. height: 300rpx;
  159. border-radius: 14rpx;
  160. margin: 26rpx auto 0 auto;
  161. background-color: #ccc;
  162. text-align: center;
  163. line-height: 300rpx;
  164. .iconfont{
  165. font-size: 50rpx;
  166. }
  167. }
  168. .combination{
  169. width: 100%;
  170. background-color: $uni-bg-color;
  171. border-radius: 14rpx;
  172. .conter {
  173. width: 690rpx;
  174. height: 400rpx;
  175. background-color: #FFFFFF;
  176. border-radius: 12px;
  177. margin: 26rpx auto 0 auto;
  178. .itemCon {
  179. display: inline-block;
  180. width: 220rpx;
  181. margin-right: 24rpx;
  182. .item {
  183. width: 100%;
  184. .pictrue {
  185. width: 100%;
  186. height: 220rpx;
  187. border-radius: 6rpx;
  188. image {
  189. width: 100%;
  190. height: 100%;
  191. border-radius: 6rpx;
  192. }
  193. }
  194. .name {
  195. font-size: 24rpx;
  196. color: #333333;
  197. margin-top: 10rpx;
  198. }
  199. .money {
  200. .bnt{
  201. width: 220rpx;
  202. height: 48rpx;
  203. border-radius: 0 0 14rpx 14rpx;
  204. text-align: center;
  205. line-height: 48rpx;
  206. color: #fff;
  207. background: rgb(233, 51, 35);
  208. margin-top: 14rpx;
  209. font-size: 26rpx;
  210. }
  211. .price {
  212. margin-top: 10rpx;
  213. }
  214. .label{
  215. height: 40rpx;
  216. line-height: 40rpx;
  217. padding: 0 6rpx;
  218. margin-right: 6rpx;
  219. font-size: 18rpx;
  220. font-weight: 400;
  221. background: rgba(255, 68, 68, 0.1);
  222. color: rgb(233, 51, 35);
  223. margin-right: 10rpx;
  224. }
  225. .y_money {
  226. font-size: 20rpx;
  227. color: #999999;
  228. text-decoration: line-through;
  229. }
  230. .x_money {
  231. color: #FD502F;
  232. font-size: 24rpx;
  233. font-weight: bold;
  234. margin-top: 3rpx;
  235. .num {
  236. font-size: 28rpx;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>