|
|
|
@ -386,7 +386,12 @@ |
|
|
|
<view class="goods-content-bottom"> |
|
|
|
<view class="popup-origin-price" |
|
|
|
style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;"> |
|
|
|
<text v-if="isPintuan"> |
|
|
|
¥{{selectedGroupRule.groupPrice}} |
|
|
|
</text> |
|
|
|
<text v-if="!isPintuan"> |
|
|
|
¥{{currentItem.attributeListPrice | sliceMsg}} |
|
|
|
</text> |
|
|
|
<text class="package-fee-pill popup-package-fee" v-if="currentPackageFeeNumber > 0"> |
|
|
|
餐盒费¥{{currentPackageFee}} |
|
|
|
</text> |
|
|
|
@ -745,6 +750,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -887,23 +893,15 @@ |
|
|
|
onLoad(option) { |
|
|
|
this.type = option.type; |
|
|
|
this.orderScene = option.orderScene || ''; |
|
|
|
this.rememberShareTarget(option || {}); |
|
|
|
if (option.groupId) { |
|
|
|
this.groupId = option.groupId; |
|
|
|
} |
|
|
|
if (option.isFaceToFace) { |
|
|
|
this.isFaceToFaceGroup = option.isFaceToFace === '1' || option.isFaceToFace === 'true'; |
|
|
|
if (this.isFaceToFaceGroup) { |
|
|
|
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then(( |
|
|
|
res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.tuanzhangOrder = res.result; |
|
|
|
} else { |
|
|
|
that.tui.toast(res.message) |
|
|
|
return |
|
|
|
} |
|
|
|
uni.hideLoading() |
|
|
|
}).catch((res) => {}) |
|
|
|
} |
|
|
|
if (this.isFaceToFaceGroup && this.groupId) { |
|
|
|
this.loadGroupOrder(); |
|
|
|
} |
|
|
|
if (option.targetMembers) { |
|
|
|
this.targetMembers = parseInt(option.targetMembers); |
|
|
|
@ -930,6 +928,10 @@ |
|
|
|
if (this.shopItem && this.shopItem.id) { |
|
|
|
this.getCategory(this.shopItem.id); |
|
|
|
this.getProduct(''); |
|
|
|
} else if (option.shopId) { |
|
|
|
this.loadShopById(option.shopId); |
|
|
|
} else if (this.groupId) { |
|
|
|
this.loadShopByGroupId(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
@ -966,6 +968,30 @@ |
|
|
|
this.detectCurrentCategory(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
rememberShareTarget(option) { |
|
|
|
if (uni.getStorageSync('id')) return; |
|
|
|
if (!option || !option.shopId || !option.groupId) return; |
|
|
|
let targetPath = '/package2/group/groupBuySingle?type=shop' + |
|
|
|
'&shopId=' + encodeURIComponent(option.shopId) + |
|
|
|
'&groupId=' + encodeURIComponent(option.groupId) + |
|
|
|
'&targetMembers=' + encodeURIComponent(option.targetMembers || 2) + |
|
|
|
'&isFaceToFace=' + encodeURIComponent(option.isFaceToFace || 0); |
|
|
|
if (option.orderScene) { |
|
|
|
targetPath += '&orderScene=' + encodeURIComponent(option.orderScene); |
|
|
|
} |
|
|
|
uni.setStorageSync('authPendingTargetPath', targetPath); |
|
|
|
uni.setStorageSync('pendingShareTargetPath', targetPath); |
|
|
|
}, |
|
|
|
getCurrentRegionId() { |
|
|
|
let area = uni.getStorageSync('area'); |
|
|
|
if (!area) return ''; |
|
|
|
try { |
|
|
|
let areaInfo = typeof area === 'string' ? JSON.parse(area) : area; |
|
|
|
return areaInfo && areaInfo.id ? areaInfo.id : ''; |
|
|
|
} catch (e) { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
}, |
|
|
|
parseRouteItem(item) { |
|
|
|
if (item == null || item === '') return null; |
|
|
|
try { |
|
|
|
@ -978,6 +1004,61 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
loadShopByGroupId() { |
|
|
|
if (!this.groupId) return; |
|
|
|
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then((res) => { |
|
|
|
if (res.code != 200 || !res.result) { |
|
|
|
this.tui.toast(res.message || '拼团信息不存在'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.tuanzhangOrder = res.result; |
|
|
|
let shopId = res.result.shopId; |
|
|
|
if (!shopId) { |
|
|
|
this.tui.toast('商家信息缺失,暂时无法参团'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.loadShopById(shopId); |
|
|
|
}).catch(() => {}); |
|
|
|
}, |
|
|
|
loadGroupOrder() { |
|
|
|
if (!this.groupId) return; |
|
|
|
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then((res) => { |
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
this.tuanzhangOrder = res.result; |
|
|
|
} |
|
|
|
}).catch(() => {}); |
|
|
|
}, |
|
|
|
loadShopById(shopId) { |
|
|
|
if (!shopId) return; |
|
|
|
let area = uni.getStorageSync('area'); |
|
|
|
let regionId = ''; |
|
|
|
try { |
|
|
|
regionId = area ? JSON.parse(area).id : ''; |
|
|
|
} catch (e) {} |
|
|
|
if (!regionId) { |
|
|
|
this.tui.toast('请先选择校区'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.tui.request("/app/shop/getShopInfoById", "POST", { |
|
|
|
id: shopId, |
|
|
|
regionId: regionId |
|
|
|
}, false, true).then((shopRes) => { |
|
|
|
if (shopRes.code != 200 || !shopRes.result || !shopRes.result.shop) { |
|
|
|
this.tui.toast(shopRes.message || '商家信息获取失败'); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.shopItem = shopRes.result.shop; |
|
|
|
if (this.shopItem.products) { |
|
|
|
this.shopRecommend = this.shopItem.products; |
|
|
|
for (let i = 0; i < this.shopRecommend.length; i++) { |
|
|
|
this.shopRecommend[i].categoryId = '1'; |
|
|
|
this.shopRecommend[i].isChecked = false; |
|
|
|
} |
|
|
|
} |
|
|
|
this.getCategory(this.shopItem.id); |
|
|
|
this.getProduct(''); |
|
|
|
}); |
|
|
|
}, |
|
|
|
onBottomPopupChange(e) { |
|
|
|
if (e.show) { |
|
|
|
this.bottomPopupOpenCount += 1; |
|
|
|
@ -1550,6 +1631,7 @@ |
|
|
|
this.$refs.pintuanPopup.close(); |
|
|
|
}, |
|
|
|
submitPintuan(isFaceToFace) { |
|
|
|
if (!requireLoginToCurrentPage()) return; |
|
|
|
if (this.currentOrderId && this.backendTotalAmount) { |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
@ -1592,6 +1674,7 @@ |
|
|
|
this.$refs.pintuanPopup.close(); |
|
|
|
}, |
|
|
|
submitFTFJoinPay(specChoices) { |
|
|
|
if (!requireLoginToCurrentPage()) return; |
|
|
|
if (this.currentOrderId && this.backendTotalAmount) { |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
@ -1627,9 +1710,14 @@ |
|
|
|
} |
|
|
|
|
|
|
|
let packageFee = parseFloat(this.currentItem.lunchBox || 0); |
|
|
|
let regionId = this.getCurrentRegionId(); |
|
|
|
if (!regionId) { |
|
|
|
this.tui.toast('请先选择校区'); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
userId: uni.getStorageSync('id') || 'test-user123', |
|
|
|
userId: uni.getStorageSync('id'), |
|
|
|
shopId: this.shopItem.id, |
|
|
|
deliveryType: this.tuanzhangOrder.deliveryType, |
|
|
|
packageFee: this.tuanzhangOrder.deliveryType == 1 ? packageFee : 0, |
|
|
|
@ -1643,7 +1731,7 @@ |
|
|
|
shopAddress: this.shopItem.shopAddress || '', |
|
|
|
groupId: this.groupId, |
|
|
|
userCouponId: this.selectedCoupon ? this.selectedCoupon.id : null, |
|
|
|
regionId: JSON.parse(uni.getStorageSync('area')).id |
|
|
|
regionId: regionId |
|
|
|
}; |
|
|
|
}, |
|
|
|
createFTFJoinOrder(specChoices, autoPay) { |
|
|
|
@ -1783,6 +1871,7 @@ |
|
|
|
return arr.join(','); |
|
|
|
}, |
|
|
|
submitCartCheckout() { |
|
|
|
if (!requireLoginToCurrentPage()) return; |
|
|
|
if (this.cartItems.length === 0) { |
|
|
|
this.$refs.selectGoodsPopup.open() |
|
|
|
return; |
|
|
|
@ -1975,6 +2064,7 @@ |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
wxPayment() { |
|
|
|
if (!requireLoginToCurrentPage()) return; |
|
|
|
let that = this; |
|
|
|
if (!this.currentOrderId || !this.backendTotalAmount) { |
|
|
|
if (this.pendingPaySpecChoices) { |
|
|
|
@ -2057,11 +2147,13 @@ |
|
|
|
fetchCoupons() { |
|
|
|
let userId = uni.getStorageSync('id'); |
|
|
|
if (!userId) return Promise.resolve([]); |
|
|
|
let regionId = this.getCurrentRegionId(); |
|
|
|
if (!regionId) return Promise.resolve([]); |
|
|
|
let amount = this.getFaceToFaceGoodsAmount(); |
|
|
|
return this.tui.request('/mall/coupon/available', 'GET', { |
|
|
|
userId: userId, |
|
|
|
applyScene: 1, |
|
|
|
regionId: JSON.parse(uni.getStorageSync('area')).id, |
|
|
|
regionId: regionId, |
|
|
|
amount: amount, |
|
|
|
merchantId: this.shopItem.id || '0' |
|
|
|
}, false, true).then((res) => { |
|
|
|
|