|
|
|
@ -56,36 +56,37 @@ |
|
|
|
公告:{{shopItem.remark}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="pintuan" style="padding: 0;margin-top:20rpx;display: flex;" v-if="orderListWait.length > 1" @tap="openOrderWait()"> |
|
|
|
<view class="pintuan" style="padding: 0;margin-top:20rpx;display: flex;" v-if="orderListWait.length > 1" @tap="openOrderWait('')"> |
|
|
|
|
|
|
|
<swiper class="zaixian-swiper" vertical circular :autoplay="orderListWait.length > 1" |
|
|
|
:interval="onlineWorkerInterval" :duration="onlineWorkerDuration"> |
|
|
|
<swiper-item v-for="(item,index) in orderListWait" :key="index"> |
|
|
|
<view class="pintuan-left"> |
|
|
|
<view class="pintuan-left-img"> |
|
|
|
<img :src="item.productPicture" alt=""> |
|
|
|
<view> |
|
|
|
<view class="pintuan-left"> |
|
|
|
<view class="pintuan-left-img"> |
|
|
|
<img :src="item.productPicture" alt=""> |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-box"> |
|
|
|
<view class="pintuan-left-name"> |
|
|
|
{{item.productName}} |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-price"> |
|
|
|
拼团<text style="color: red;">¥{{item.groupPrice}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-box"> |
|
|
|
<view class="pintuan-left-name"> |
|
|
|
{{item.productName}} |
|
|
|
<view class="pintuan-right"> |
|
|
|
<view class="pintuan-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-price"> |
|
|
|
拼团<text style="color: red;">¥{{item.groupPrice}}</text> |
|
|
|
<view class="pintuan-right-cha"> |
|
|
|
差<text style="color: red;">{{item.targetMembers - item.currentMembers}}人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</swiper-item> |
|
|
|
|
|
|
|
<view class="pintuan-right"> |
|
|
|
<view class="pintuan-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="pintuan-right-cha"> |
|
|
|
差<text style="color: red;">{{item.targetMembers - item.currentMembers}}人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</swiper> |
|
|
|
</view> |
|
|
|
<!-- 分类栏:移到goods-list外层,position:sticky才能生效 --> |
|
|
|
@ -117,14 +118,14 @@ |
|
|
|
<view class="goods-deal1"> |
|
|
|
月售 <text> 100+</text> |
|
|
|
</view> |
|
|
|
<view class="goods-tag" @tap="openOrderWait()"> |
|
|
|
<view class="goods-tag" @tap.stop="openOrderWait(item)" v-if="item.orderListWait != undefined && item.orderListWait.length > 0"> |
|
|
|
<view class="pintuan-right-img"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/94f91382e76c4f289d53fbf858e8732b.png" |
|
|
|
alt="" /> |
|
|
|
<view class="weipincheng">+</view> |
|
|
|
</view> |
|
|
|
<view class="pintuan-right-cha"> |
|
|
|
差<text style="color: red;">12人</text>拼成 |
|
|
|
差<text style="color: red;">{{item.minGroupCount}}人</text>拼成 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -268,10 +269,6 @@ |
|
|
|
<view style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;"> |
|
|
|
¥{{currentItem.attributeListPrice | sliceMsg}} |
|
|
|
</view> |
|
|
|
<view class="pintuan-left-price" |
|
|
|
v-if="currentItem.productGroupBuyPrices && currentItem.productGroupBuyPrices.length > 0"> |
|
|
|
拼团<text style="color: red;">¥{{currentItem.productGroupBuyPrices | slicePrice}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -337,20 +334,20 @@ |
|
|
|
<view v-if="isPintuan" class="pintuan1"> |
|
|
|
<template v-if="!groupId"> |
|
|
|
<view class="pintuan2" style="border-bottom-left-radius: 50px;border-top-left-radius: 50px;" |
|
|
|
@tap="submitPintuan(true)"> |
|
|
|
@tap.stop="submitPintuan(true)"> |
|
|
|
面对面团 |
|
|
|
</view> |
|
|
|
<view class="pintuan2" |
|
|
|
style="background: rgba(0, 35, 28, 1);border-bottom-right-radius: 50px;border-top-right-radius: 50px;color: rgba(166, 255, 234, 1);" |
|
|
|
@tap="submitPintuan(false)"> |
|
|
|
发起拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}} |
|
|
|
@tap.stop="submitPintuan(false)"> |
|
|
|
发起拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPriceAndMore).toFixed(2) : '0.00'}} |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<template v-else> |
|
|
|
<view class="pintuan2" |
|
|
|
style="width: 100%; border-radius: 50px; " |
|
|
|
@tap="submitPintuan(false)"> |
|
|
|
参与拼团¥{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPrice).toFixed(2) : '0.00'}} |
|
|
|
@tap.stop="submitPintuan(false)"> |
|
|
|
参与拼团¥{{selectedGroupRule && selectedGroupRule.groupPriceAndMore ? parseFloat(selectedGroupRule.groupPriceAndMore).toFixed(2) : '0.00'}} |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</view> |
|
|
|
@ -369,6 +366,9 @@ |
|
|
|
<view class="goods-top"> |
|
|
|
快来加入一起成团吧! |
|
|
|
</view> |
|
|
|
<view class="goods-top"> |
|
|
|
可以选取任意拼团商品下单! |
|
|
|
</view> |
|
|
|
<scroll-view scroll-y style="max-height: 50vh;"> |
|
|
|
<template> |
|
|
|
<!-- 占位假数据展示 --> |
|
|
|
@ -389,7 +389,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list-btn" @tap="submitPintuan"> |
|
|
|
<view class="list-btn" @tap.stop="chooseOrderWait(item)"> |
|
|
|
去拼单 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -417,7 +417,10 @@ |
|
|
|
若拼团失败,将会为您自动退款 |
|
|
|
</view> |
|
|
|
<view v-if="groupId != '' && isFaceToFaceGroup" style="height: 40rpx;text-align: center;color: red;"> |
|
|
|
包含打包费 {{currentItem.lunchBox}} 元 配送费(均摊) {{tuanzhangOrder.deliveryFee}} 元 |
|
|
|
配送费(均摊) {{tuanzhangOrder.deliveryFee}} 元 |
|
|
|
</view> |
|
|
|
<view v-if="groupdeliveryType == 1" style="height: 40rpx;text-align: center;color: red;"> |
|
|
|
包含打包费 {{currentItem.lunchBox}} 元 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="box1" style="display: flex;padding: 40rpx;"> |
|
|
|
@ -491,6 +494,7 @@ |
|
|
|
selectedGroupRule: {}, |
|
|
|
pageNum: 1, |
|
|
|
total: 1, |
|
|
|
chooseWaitType:false, |
|
|
|
// 导航栏高度(用于sticky top偏移) |
|
|
|
navBarHeight: 0, |
|
|
|
orderListWait:[], |
|
|
|
@ -507,6 +511,7 @@ |
|
|
|
categoryId: '' |
|
|
|
}, |
|
|
|
menuButtonInfo: {}, |
|
|
|
groupdeliveryType:'', |
|
|
|
isPintuan: true, |
|
|
|
groupId: '', |
|
|
|
isFaceToFaceGroup: false, |
|
|
|
@ -628,7 +633,6 @@ |
|
|
|
} |
|
|
|
this.getCategory(this.shopItem.id); |
|
|
|
this.getProduct(''); |
|
|
|
this.getOrderWait(); |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect(); |
|
|
|
@ -663,6 +667,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取当前店铺待成团列表 |
|
|
|
that.getOrderWait(); |
|
|
|
|
|
|
|
that.total = res.result.pages; // pages = 总页数 |
|
|
|
that.pageNum = that.searchForm.pageNum; |
|
|
|
@ -733,7 +739,65 @@ |
|
|
|
duration: 200 |
|
|
|
}); |
|
|
|
}, |
|
|
|
openOrderWait(){ |
|
|
|
openOrderWait(item){ |
|
|
|
this.chooseWaitType = false |
|
|
|
if(item != ''){ |
|
|
|
this.chooseWaitType = true |
|
|
|
this.orderListWait = item.orderListWait |
|
|
|
|
|
|
|
this.currentItem = item; |
|
|
|
// Parse specifications |
|
|
|
this.parsedSpecs = []; |
|
|
|
if (item.attributeList && item.attributeList !== '{}') { |
|
|
|
try { |
|
|
|
let attrs = typeof item.attributeList === 'string' ? JSON.parse(item.attributeList) : item |
|
|
|
.attributeList; |
|
|
|
for (let key in attrs) { |
|
|
|
if (attrs[key] && attrs[key].title && attrs[key].title.length > 0) { |
|
|
|
this.parsedSpecs.push({ |
|
|
|
name: key, |
|
|
|
options: attrs[key].title, |
|
|
|
selected: attrs[key].title[0] // Default select first |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error("Failed to parse specifications", e); |
|
|
|
} |
|
|
|
} |
|
|
|
this.isPintuan = true; |
|
|
|
|
|
|
|
if (this.groupId) { |
|
|
|
// Determine best price match given targetMembers |
|
|
|
let prices = item.productGroupBuyPrices || []; |
|
|
|
let validPrices = prices.filter(p => p.groupCount <= this.targetMembers); |
|
|
|
if (validPrices.length > 0) { |
|
|
|
this.selectedGroupRule = validPrices.reduce((max, obj) => (obj.groupCount > max.groupCount ? obj : max)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else if (prices.length > 0) { |
|
|
|
this.selectedGroupRule = prices.reduce((prev, curr) => (prev.groupCount < curr.groupCount ? prev : curr)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else { |
|
|
|
this.selectedGroupRule = {}; |
|
|
|
} |
|
|
|
} else { |
|
|
|
// Normal init |
|
|
|
if (item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) { |
|
|
|
this.selectedGroupRule = item.productGroupBuyPrices[0]; |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else { |
|
|
|
this.selectedGroupRule = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let moreBuyPrice = 0 |
|
|
|
for(let i = 0;i<this.moreBuyList.length;i++){ |
|
|
|
if(this.moreBuyList[i].quantity > 0){ |
|
|
|
moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2)) |
|
|
|
} |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
} |
|
|
|
this.$refs.pintuanGroupPopup.open('bottom') |
|
|
|
}, |
|
|
|
getOrderWait(){ |
|
|
|
@ -747,6 +811,21 @@ |
|
|
|
that.loadStatus = 'nomore'; |
|
|
|
if (res.code == 200) { |
|
|
|
that.orderListWait = res.result; |
|
|
|
for(let i = 0;i<that.productItem.length;i++){ |
|
|
|
that.productItem[i].orderListWait = [] |
|
|
|
if(that.orderListWait !=null){ |
|
|
|
that.productItem[i].minGroupCount = that.orderListWait[0].targetMembers - that.orderListWait[0].currentMembers |
|
|
|
for(let y = 0;y<that.orderListWait.length;y++){ |
|
|
|
if(that.productItem[i].id == that.orderListWait[y].productId){ |
|
|
|
if(that.productItem[i].minGroupCount > (that.orderListWait[y].targetMembers - that.orderListWait[y].currentMembers)){ |
|
|
|
that.productItem[i].minGroupCount = that.orderListWait[y].targetMembers - that.orderListWait[y].currentMembers |
|
|
|
} |
|
|
|
that.productItem[i].orderListWait.push(that.orderListWait[y]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
that.$forceUpdate(); |
|
|
|
} else { |
|
|
|
that.tui.toast(res.message); |
|
|
|
@ -755,6 +834,14 @@ |
|
|
|
uni.hideLoading(); |
|
|
|
}).catch((res) => {}); |
|
|
|
}, |
|
|
|
chooseOrderWait(item){ |
|
|
|
this.$refs.pintuanGroupPopup.close(); |
|
|
|
this.groupId = item.id; |
|
|
|
this.targetMembers = parseInt(item.targetMembers); |
|
|
|
if(this.chooseWaitType){ |
|
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
|
} |
|
|
|
}, |
|
|
|
openPopup(type, index, item) { |
|
|
|
if (type == 'car') { |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
@ -789,8 +876,10 @@ |
|
|
|
let validPrices = prices.filter(p => p.groupCount <= this.targetMembers); |
|
|
|
if (validPrices.length > 0) { |
|
|
|
this.selectedGroupRule = validPrices.reduce((max, obj) => (obj.groupCount > max.groupCount ? obj : max)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else if (prices.length > 0) { |
|
|
|
this.selectedGroupRule = prices.reduce((prev, curr) => (prev.groupCount < curr.groupCount ? prev : curr)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else { |
|
|
|
this.selectedGroupRule = {}; |
|
|
|
} |
|
|
|
@ -806,11 +895,20 @@ |
|
|
|
// Normal init |
|
|
|
if (item.productGroupBuyPrices && item.productGroupBuyPrices.length > 0) { |
|
|
|
this.selectedGroupRule = item.productGroupBuyPrices[0]; |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
} else { |
|
|
|
this.selectedGroupRule = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let moreBuyPrice = 0 |
|
|
|
for(let i = 0;i<this.moreBuyList.length;i++){ |
|
|
|
if(this.moreBuyList[i].quantity > 0){ |
|
|
|
moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2)) |
|
|
|
} |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
|
|
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
|
} else { |
|
|
|
this.isPintuan = false; |
|
|
|
@ -834,6 +932,7 @@ |
|
|
|
}, |
|
|
|
selectGroupRule(rule) { |
|
|
|
this.selectedGroupRule = rule; |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
}, |
|
|
|
submitAddToCart() { |
|
|
|
let specChoices = {}; |
|
|
|
@ -892,6 +991,16 @@ |
|
|
|
price: parseFloat(this.selectedGroupRule && this.selectedGroupRule.groupPrice ? this.selectedGroupRule.groupPrice : 0), |
|
|
|
quantity: 1 |
|
|
|
}]; |
|
|
|
if(this.currentItem.moreBuyData){ |
|
|
|
for(let a = 0;a<this.currentItem.moreBuyData.length;a++){ |
|
|
|
items.push({ |
|
|
|
productId: this.currentItem.moreBuyData[a].id, |
|
|
|
specs: '', |
|
|
|
price: parseFloat(this.sliceMsg2(this.currentItem.moreBuyData[a].attributeListPrice)).toFixed(2), |
|
|
|
quantity: this.currentItem.moreBuyData[a].quantity |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let packageFee = parseFloat(this.currentItem.lunchBox || 0); |
|
|
|
|
|
|
|
@ -899,7 +1008,7 @@ |
|
|
|
userId: uni.getStorageSync('id') || 'test-user123', |
|
|
|
shopId: this.shopItem.id, |
|
|
|
deliveryType: this.tuanzhangOrder.deliveryType, |
|
|
|
packageFee: this.tuanzhangOrder.deliveryType == 1 ? this.packageFee : 0, |
|
|
|
packageFee: this.tuanzhangOrder.deliveryType == 1 ? packageFee : 0, |
|
|
|
remark: '', |
|
|
|
items: items, |
|
|
|
receiverName: '', |
|
|
|
@ -916,6 +1025,7 @@ |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.success && res.result) { |
|
|
|
this.currentOrderId = res.result.id; |
|
|
|
this.groupdeliveryType = res.result.deliveryType; |
|
|
|
this.backendTotalAmount = res.result.totalAmount; |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
@ -1054,17 +1164,33 @@ |
|
|
|
this.moreBuyData.splice(index1,1) |
|
|
|
} |
|
|
|
}, |
|
|
|
sliceMsg2(val) { |
|
|
|
var name = '' |
|
|
|
if (typeof(val) == 'string') { |
|
|
|
let newObj = JSON.parse(val) |
|
|
|
for (let as in newObj) { |
|
|
|
name = newObj[as].specPrice |
|
|
|
} |
|
|
|
} |
|
|
|
return name; |
|
|
|
}, |
|
|
|
changeValue(value) { |
|
|
|
let moreBuyPrice = 0 |
|
|
|
for(let i = 0;i<this.moreBuyList.length;i++){ |
|
|
|
if(this.moreBuyList[i].id == this.checkMoreBuyIndex){ |
|
|
|
this.moreBuyList[i].quantity = value |
|
|
|
} |
|
|
|
if(this.moreBuyList[i].quantity > 0){ |
|
|
|
moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2)) |
|
|
|
} |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
for(let i = 0;i<this.moreBuyData.length;i++){ |
|
|
|
if(this.moreBuyData[i].id == this.checkMoreBuyIndex){ |
|
|
|
this.moreBuyData[i].quantity = value |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
wxPayment() { |
|
|
|
let that = this; |
|
|
|
@ -1087,9 +1213,19 @@ |
|
|
|
signType: res.signType, |
|
|
|
paySign: res.paySign, |
|
|
|
success: function(res2) { |
|
|
|
that.$refs.payPopup.close(); |
|
|
|
uni.showToast({ title: '支付成功', icon: 'success' }); |
|
|
|
setTimeout(() => { that.$refs.joinSuccessPopup.open('bottom'); }, 1500); |
|
|
|
uni.showToast({ title: '支付成功', icon: 'success' }); |
|
|
|
that.tui.request("/api/wechat/pay/paySuccess", "POST", { |
|
|
|
outTradeNo: that.currentOrderId |
|
|
|
}, false, false).then((res3) => { |
|
|
|
if(res3.code == 200){ |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/package1/order/orderDetail?id=' + that.currentOrderId + '&groupId=' + that.groupId |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
that.tui.toast("订单创建失败,请联系客服处理"); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
that.tui.toast("支付失败或取消"); |
|
|
|
@ -1648,11 +1784,11 @@ |
|
|
|
} |
|
|
|
.zaixian-swiper{ |
|
|
|
flex: 1; |
|
|
|
height: 76rpx; |
|
|
|
height: 126rpx; |
|
|
|
} |
|
|
|
.zaixian-item{ |
|
|
|
height: 76rpx; |
|
|
|
line-height: 76rpx; |
|
|
|
height: 126rpx; |
|
|
|
line-height: 126rpx; |
|
|
|
font-size: 24rpx; |
|
|
|
overflow: hidden; |
|
|
|
text-overflow: ellipsis; |
|
|
|
|