【代码优化】拼团:其它用户,打开团长的界面的相关操作实现
							parent
							
								
									fc396021c6
								
							
						
					
					
						commit
						154a706af4
					
				|  | @ -181,11 +181,11 @@ | ||||||
|         </view> |         </view> | ||||||
|       </view> |       </view> | ||||||
| 
 | 
 | ||||||
|       <!-- TODO 芋艿:这里暂时没接入 --> |       <view v-if="!isEmpty(state.goodsInfo)"> | ||||||
|       <view v-if="state.data.goods"> |         <!-- 规格与数量弹框 --> | ||||||
|         <s-select-groupon-sku |         <s-select-groupon-sku | ||||||
|           :show="state.showSelectSku" |           :show="state.showSelectSku" | ||||||
|           :goodsInfo="state.data.goods" |           :goodsInfo="state.goodsInfo" | ||||||
|           :grouponAction="state.grouponAction" |           :grouponAction="state.grouponAction" | ||||||
|           :grouponNum="state.grouponNum" |           :grouponNum="state.grouponNum" | ||||||
|           @buy="onBuy" |           @buy="onBuy" | ||||||
|  | @ -193,6 +193,7 @@ | ||||||
|           @close="state.showSelectSku = false" |           @close="state.showSelectSku = false" | ||||||
|         /> |         /> | ||||||
|       </view> |       </view> | ||||||
|  | 
 | ||||||
|     </view> |     </view> | ||||||
| 
 | 
 | ||||||
|     <s-empty v-if="!state.data && !state.loading" icon="/static/goods-empty.png" /> |     <s-empty v-if="!state.data && !state.loading" icon="/static/goods-empty.png" /> | ||||||
|  | @ -207,21 +208,24 @@ | ||||||
|   import { showShareModal } from '@/sheep/hooks/useModal'; |   import { showShareModal } from '@/sheep/hooks/useModal'; | ||||||
|   import { isEmpty } from 'lodash-es'; |   import { isEmpty } from 'lodash-es'; | ||||||
|   import CombinationApi from '@/sheep/api/promotion/combination'; |   import CombinationApi from '@/sheep/api/promotion/combination'; | ||||||
|  |   import SpuApi from '@/sheep/api/product/spu'; | ||||||
| 
 | 
 | ||||||
|   const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); |   const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); | ||||||
|   const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; |   const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; | ||||||
|   const state = reactive({ |   const state = reactive({ | ||||||
|     data: {}, // 拼团详情 |     data: {}, // 拼团详情 | ||||||
|     loading: true, |     goodsId: 0, // 商品ID | ||||||
|     grouponAction: 'create', |     goodsInfo: {}, // 商品信息 | ||||||
|     showSelectSku: false, |     showSelectSku: false, // 显示规格弹框 | ||||||
|     grouponNum: 0, |     selectedSkuPrice: {}, // 选中的规格价格 | ||||||
|     number: 0, |     activity: {}, // 团购活动 | ||||||
|     activity: {}, |     grouponId: 0, // 团购ID | ||||||
|  |     grouponNum: 0, // 团购人数 | ||||||
|  |     grouponAction: 'create', // 团购操作 | ||||||
|     combinationHeadId: null, // 拼团团长编号 |     combinationHeadId: null, // 拼团团长编号 | ||||||
|  |     loading: true, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   // todo 芋艿:分享要再接下 |  | ||||||
|   const shareInfo = computed(() => { |   const shareInfo = computed(() => { | ||||||
|     if (isEmpty(state.data)) return {}; |     if (isEmpty(state.data)) return {}; | ||||||
|     return sheep.$platform.share.getShareInfo( |     return sheep.$platform.share.getShareInfo( | ||||||
|  | @ -250,33 +254,33 @@ | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 去开团 TODO 芋艿:这里没接入 |   // 去开团 | ||||||
|   function onCreateGroupon() { |   function onCreateGroupon() { | ||||||
|     state.grouponAction = 'create'; |     state.grouponAction = 'create'; | ||||||
|     state.grouponId = 0; |     state.grouponId = 0; | ||||||
|     state.showSelectSku = true; |     state.showSelectSku = true; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 规格变更 TODO 芋艿:这里没接入 |   // 规格变更 | ||||||
|   function onSkuChange(e) { |   function onSkuChange(e) { | ||||||
|     state.selectedSkuPrice = e; |     state.selectedSkuPrice = e; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 立即参团 TODO 芋艿:这里没接入 |   // 立即参团 | ||||||
|   function onJoinGroupon() { |   function onJoinGroupon() { | ||||||
|     state.grouponAction = 'join'; |     state.grouponAction = 'join'; | ||||||
|     state.grouponId = state.data.activityId; |     state.grouponId = state.data.headRecord.activityId; | ||||||
|     state.combinationHeadId = state.data.id; |     state.combinationHeadId = state.data.headRecord.id; | ||||||
|     state.grouponNum = state.data.num; |     state.grouponNum = state.data.headRecord.userSize; | ||||||
|     state.showSelectSku = true; |     state.showSelectSku = true; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 立即购买 TODO 芋艿:这里没接入 |   // 立即购买 | ||||||
|   function onBuy(sku) { |   function onBuy(sku) { | ||||||
|     sheep.$router.go('/pages/order/confirm', { |     sheep.$router.go('/pages/order/confirm', { | ||||||
|       data: JSON.stringify({ |       data: JSON.stringify({ | ||||||
|         order_type: 'goods', |         order_type: 'goods', | ||||||
|         combinationActivityId: state.data.activity.id, |         combinationActivityId: state.activity.id, | ||||||
|         combinationHeadId: state.combinationHeadId, |         combinationHeadId: state.combinationHeadId, | ||||||
|         items: [ |         items: [ | ||||||
|           { |           { | ||||||
|  | @ -305,6 +309,14 @@ | ||||||
|         data.headRecord.activityId, |         data.headRecord.activityId, | ||||||
|       ); |       ); | ||||||
|       state.activity = activity; |       state.activity = activity; | ||||||
|  |       state.grouponNum = activity.userSize; | ||||||
|  |       // 加载商品信息 | ||||||
|  |       const { data: spu } = await SpuApi.getSpuDetail(activity.spuId); | ||||||
|  |       state.goodsId = spu.id; | ||||||
|  |       activity.products.forEach((product) => { | ||||||
|  |         spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格 | ||||||
|  |       }); | ||||||
|  |       state.goodsInfo = spu; | ||||||
|     } else { |     } else { | ||||||
|       state.data = null; |       state.data = null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 puhui999
						puhui999