wangfukang 1 month ago
parent
commit
90c1b2d62b
  1. 114
      pages/index/index.vue

114
pages/index/index.vue

@ -370,7 +370,7 @@
<view class="empty-delivery-title">暂时没有可抢订单</view>
<view class="empty-delivery-desc">可以切换分类或调整筛选条件新的校园订单会在这里出现</view>
</view>
<view class="list-1" v-for="(item,index) in deliveryItem" :key="index"
<view class="list-1" v-for="(item,index) in deliveryItem" :key="item.deliveryKey"
@tap="productDetail(item)">
<view class="daoda-time-row">
<view class="appointment-delivery-tag" v-if="item.appointmentDelivery == 1">
@ -382,16 +382,16 @@
</view>
<view class="order-page">
<view class="maotou" v-if="item.deliveryType == 1 && !item.workerId">
外卖
{{(item.deliveryFee + item.deliveryFeeMarketplace).toFixed(2)}}
</view>
<view class="maotou1" v-if="item.deliveryType == 2">
代取快递
{{(item.deliveryFee + item.deliveryFeeMarketplace).toFixed(2)}}
</view>
<view class="maotou2" v-if="item.deliveryType == 3">
代跑腿
{{(item.deliveryFee + item.deliveryFeeMarketplace).toFixed(2)}}
</view>
<view class="maotou3" v-if="item.workerId">
指派单
{{(item.deliveryFee + item.deliveryFeeMarketplace).toFixed(2)}}
</view>
<view class="shangjia">
<text
@ -400,8 +400,8 @@
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
</view>
<view v-else style="font-weight: 700;">
{{item.allCount ? item.allCount : 0}}
<view v-else style="font-weight: 700;padding-left: 30rpx;">
{{item.allCount ? item.allCount : 0}}
</view>
</view>
<view class="shangpin">
@ -441,17 +441,15 @@
</view>
</view>
</view>
<view class="yongjin">
<view class="yongjin" v-if="(item.isBig !=null && item.isBig == 1) || item.deliveryFeeMarketplace > 0">
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda" v-if="item.isBig !=null && item.isBig == 1">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
{{(item.deliveryFee + item.deliveryFeeMarketplace).toFixed(2)}}
<text style="color: #777;font-size: 22rpx;"
v-if="item.deliveryFeeMarketplace > 0">包含{{item.deliveryFeeMarketplace}}平台佣金</text>
v-if="item.deliveryFeeMarketplace > 0">包含{{item.deliveryFeeMarketplace}}平台奖励佣金</text>
</view>
</view>
<view class="beizhu" v-if="item.remark != null && item.remark != ''">
@ -535,8 +533,8 @@
<view class="product-popup-title">商品详情</view>
<view class="product-popup-subtitle">请核对商品规格和数量</view>
</view>
<view class="product-popup-list" v-if="productData.goodsList != null && productData.goodsList.length > 0">
<view class="product-popup-card" v-for="(item1,index1) in productData.goodsList" :key="index1">
<view class="product-popup-list" v-if="productGoodsList.length > 0">
<view class="product-popup-card" v-for="(item1,index1) in productGoodsList" :key="index1">
<view class="product-popup-img">
<img :src="item1.productPicture" alt="">
</view>
@ -744,7 +742,8 @@
kuaidiCount: 0,
paotuiCount: 0,
homeReminders: {},
productData: [],
productData: {},
productGoodsList: [],
zhipaiCount: 0,
searchForm: {
hallOnly: true,
@ -783,6 +782,7 @@
getshopArea: [],
putshopArea: [],
totalPages: 1,
deliveryQueryVersion: 0,
swipeOrderLowPerf: false,
swipeOrderDefaultStyle: {
progress: 'transform: translate3d(0, 0, 0) scaleX(0); transition: transform 0.14s ease-out;',
@ -927,12 +927,22 @@
})
}
},
onHide() {
this.closeProductPopup()
},
onReady() {
//
setTimeout(() => {
this.refreshDaimaiStickyPosition()
}, 500);
},
onUnload() {
this.closeProductPopup()
if (this.deliveryTimer) {
clearInterval(this.deliveryTimer);
this.deliveryTimer = null;
}
},
methods: {
setTabBarVisible(visible) {
this.isTabBarVisible = visible
@ -1107,6 +1117,7 @@
this.searchForm.getAreaId = ""
this.searchForm.putAreaId = ""
this.searchForm.order = ""
this.resetDeliveryQuery()
this.getDelivery()
this.$forceUpdate()
},
@ -1121,23 +1132,56 @@
}, 400);
},
productDetail(item) {
if (this._isSwipingOrderTap) {
this._isSwipingOrderTap = false
return
}
if (!item || item.deliveryType != 1) return
this.productData = item;
this.productGoodsList = Array.isArray(item.goodsList) ? item.goodsList : []
this.$refs.productPopup.open()
},
closeProductPopup() {
if (this.$refs.productPopup && this.$refs.productPopup.close) {
this.$refs.productPopup.close()
}
this.productData = {}
this.productGoodsList = []
},
getSwipeProgress(item, index) {
if (!item) return 0
if (this.swipeOrder.id === item.id && this.swipeOrder.index === index) {
return this.swipeOrder.progress
}
return 0
},
resetDeliveryQuery() {
this.deliveryQueryVersion++
this.searchForm.pageNum = 1
this.totalPages = 1
this.deliveryItem = []
this.resetSwipeOrder()
},
normalizeDeliveryRecords(records, pageNum) {
if (!Array.isArray(records)) return []
return records.filter(item => item && typeof item === 'object').map((item, index) => {
return {
...item,
deliveryKey: item.id !== undefined && item.id !== null ? String(item.id) : (pageNum + '-' + index)
}
})
},
isSwipeOrderActive(item, index) {
if (!item) return false
return this.swipeOrder.id === item.id && this.swipeOrder.index === index && this.swipeOrder.progress > 0
},
//
startSwipeOrder(event, item, index) {
if (!item || item.id === undefined || item.id === null) return
if (!this.requireLogin(0)) return
const touch = event.touches && event.touches[0]
if (!touch) return
this._isSwipingOrderTap = false
this._swipeOrderProgress = 0
this._swipeOrderLastRenderTime = 0
this.swipeOrder = {
@ -1165,6 +1209,9 @@
const trackWidth = this.swipeOrder.trackWidth || this.swipeOrderBaseWidth || 1
const deltaX = Math.max(0, touch.clientX - this.swipeOrder.startX)
const progress = Math.min(100, Math.round(deltaX / (trackWidth * 0.72) * 100))
if (progress > 3) {
this._isSwipingOrderTap = true
}
this._swipeOrderProgress = progress
const now = Date.now()
const frameGap = this.swipeOrderFrameGap || 16
@ -1196,6 +1243,10 @@
resetSwipeOrder() {
this._swipeOrderProgress = 0
this._swipeOrderLastRenderTime = 0
clearTimeout(this._swipeOrderTapTimer)
this._swipeOrderTapTimer = setTimeout(() => {
this._isSwipingOrderTap = false
}, 300)
this.swipeOrder = {
id: '',
index: -1,
@ -1496,13 +1547,22 @@
},
getDelivery() {
let that = this
const requestVersion = that.deliveryQueryVersion
const requestPageNum = that.searchForm.pageNum
const requestForm = {
...that.searchForm,
waimaiData: [...(that.searchForm.waimaiData || [])],
kuaidiData: [...(that.searchForm.kuaidiData || [])]
}
that.waimaiCount = 0
that.kuaidiCount = 0
that.paotuiCount = 0
that.zhipaiCount = 0
that.adList = []
that.searchForm.userId = uni.getStorageSync('id') || that.searchForm.userId || ''
this.tui.request("/mall/delivery/page", "POST", this.searchForm, false, false).then((res) => {
requestForm.userId = that.searchForm.userId
this.tui.request("/mall/delivery/page", "POST", requestForm, false, false).then((res) => {
if (requestVersion !== that.deliveryQueryVersion) return
that.loadStatus = 'nomore';
if (res.code == 200) {
that.homeReminders = res.result.homeReminders || {}
@ -1513,10 +1573,11 @@
that.adList.push(that.mallAds[i])
}
}
if (that.searchForm.pageNum == 1) {
that.deliveryItem = res.result.records;
const records = that.normalizeDeliveryRecords(res.result.records, requestPageNum)
if (requestPageNum == 1) {
that.deliveryItem = records;
} else {
that.deliveryItem = [...that.deliveryItem, ...res.result.records]
that.deliveryItem = [...that.deliveryItem, ...records]
}
if (res.result.orderCount != null && res.result.orderCount.length > 0) {
for (let i = 0; i < res.result.orderCount.length; i++) {
@ -1612,6 +1673,7 @@
this.areaName = item.title
this.areaKeyword = ''
this.searchForm.regionId = item.id
this.resetDeliveryQuery()
this.getDelivery();
this.getShopArea();
let that = this
@ -1731,7 +1793,7 @@
this.checkYongjin = false
this.searchForm.order = ''
}
this.searchForm.pageNum = 1
this.resetDeliveryQuery()
this.getDelivery();
},
//
@ -1753,6 +1815,7 @@
//
checkTab1(type) {
this.checked = type
this.resetDeliveryQuery()
if (type == 'waimai') {
this.searchForm.deliveryType = 1
this.searchForm.waimaiData = this.waimailistData;
@ -1794,12 +1857,6 @@
phoneNumber: phone
});
},
//
onUnload() {
if (this.deliveryTimer) {
clearInterval(this.deliveryTimer);
}
},
//
checkAdd() {
this.isgetArea = !this.isgetArea
@ -1813,6 +1870,9 @@
let that = this;
this.isTabBarVisible = true
this.lastIndex = this.currentIndex
if (index != 0) {
this.closeProductPopup()
}
if(index != 2){
this.currentIndex = index
}
@ -3434,7 +3494,7 @@
font-size: 24rpx;
}
.maotou1 {
width: 130rpx;
width: 90rpx;
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/6f9117df70b048e2b35badb5d3338706.png') no-repeat;
height: 74rpx;
background-size: 100%;
@ -3964,7 +4024,7 @@
.beizhu {
width: 95%;
margin: 0 auto;
margin: 20rpx auto;
background: rgba(255, 117, 88, 0.08);
border: 1px solid rgba(255, 117, 88, 0.12);
border-radius: 20rpx;

Loading…
Cancel
Save