wangfukang 3 weeks ago
parent
commit
16502c5046
  1. 152
      package1/buyFood/buyFood.vue
  2. 2
      package1/tabbar/fishRelease.vue

152
package1/buyFood/buyFood.vue

@ -36,7 +36,7 @@
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1cbed0734a154a70b75cb84a811bd0b7.png" alt="" />
<view class="tab-hit-area">
<view class="tab-hit-item"></view>
<view class="tab-hit-item" @tap="isPaotui=!isPaotui"></view>
<view class="tab-hit-item" @tap="selectOrderMode(false)"></view>
</view>
</view>
<view class="tab1" v-else>
@ -45,7 +45,7 @@
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/82627e6cedcf409a932d6afaafa19a4b.png" alt=""
class="tab-bg" />
<view class="tab-hit-area">
<view class="tab-hit-item" @tap="isPaotui=!isPaotui"></view>
<view class="tab-hit-item" @tap="selectOrderMode(true)"></view>
<view class="tab-hit-item"></view>
</view>
</view>
@ -388,6 +388,16 @@
</view>
</view>
</uni-popup>
<uni-popup ref="deliveryClosedPopup" type="center" background-color="transparent" @change="onDeliveryClosedPopupChange">
<view class="delivery-closed-popup" @tap.stop>
<view class="delivery-closed-icon">
<uni-icons type="info-filled" size="28" color="#0b9b73"></uni-icons>
</view>
<view class="delivery-closed-title">当前校区暂未开启配送</view>
<view class="delivery-closed-desc">本店目前只能选择到店消费关闭提示后会为你自动切换到到店标签</view>
<view class="delivery-closed-btn" @tap="closeDeliveryClosedPopup">知道了</view>
</view>
</uni-popup>
<!-- 警告弹出层 -->
<uni-popup ref="warnPopup" background-color="#fff">
<view class="warnImg">
@ -612,7 +622,11 @@
isSeckillOrder: false,
payPopupVisible: false,
commissionPopupVisible: false,
baseDeliveryFee: 0
baseDeliveryFee: 0,
deliveryEnabled: 1,
deliverySwitchChecked: false,
deliverySwitchLoading: false,
deliveryClosedPopupVisible: false
}
},
components: {
@ -803,6 +817,7 @@
}
this.updateImmediateTimeStr();
this.fetchBaseDeliveryFee();
this.fetchDeliverySwitch();
let pendingWorker = uni.getStorageSync('pendingAssignWorker');
if (pendingWorker) {
uni.removeStorageSync('pendingAssignWorker');
@ -941,6 +956,83 @@
}
}).catch(() => {});
},
shouldCheckDeliverySwitch() {
return !this.isStoreGroupOrder;
},
isDeliveryClosed() {
return this.shouldCheckDeliverySwitch() && Number(this.deliveryEnabled) === 0;
},
fetchDeliverySwitch() {
if (!this.shouldCheckDeliverySwitch()) return Promise.resolve(true);
const regionId = this.getCurrentRegionId();
if (!regionId) return Promise.resolve(true);
this.deliverySwitchLoading = true;
return this.tui.request('/app/shopArea/deliverySwitch/get', 'GET', {
regionId: regionId
}, false, true).then((res) => {
this.deliverySwitchLoading = false;
if (res.code == 200 || res.success) {
this.deliveryEnabled = res.result == null ? 1 : Number(res.result);
this.deliverySwitchChecked = true;
if (this.isDeliveryClosed() && this.isPaotui && !this.deliveryClosedPopupVisible) {
this.openDeliveryClosedPopup();
return false;
}
}
return !this.isDeliveryClosed();
}).catch(() => {
this.deliverySwitchLoading = false;
return true;
});
},
async ensureDeliveryAvailable() {
if (!this.shouldCheckDeliverySwitch() || !this.isPaotui) return true;
if (!this.deliverySwitchChecked) {
const available = await this.fetchDeliverySwitch();
if (!available) return false;
}
if (this.isDeliveryClosed()) {
this.openDeliveryClosedPopup();
return false;
}
return true;
},
selectOrderMode(isDelivery) {
if (!isDelivery) {
this.switchToStoreMode();
return;
}
if (this.isDeliveryClosed()) {
this.openDeliveryClosedPopup();
return;
}
this.isPaotui = true;
this.fetchCoupons();
},
switchToStoreMode() {
this.isPaotui = false;
this.fetchCoupons();
},
openDeliveryClosedPopup() {
this.deliveryClosedPopupVisible = true;
this.$nextTick(() => {
if (this.$refs.deliveryClosedPopup) {
this.$refs.deliveryClosedPopup.open('center');
}
});
},
closeDeliveryClosedPopup() {
this.switchToStoreMode();
if (this.$refs.deliveryClosedPopup) {
this.$refs.deliveryClosedPopup.close();
}
},
onDeliveryClosedPopupChange(e) {
this.deliveryClosedPopupVisible = e.show;
if (!e.show && this.isDeliveryClosed()) {
this.switchToStoreMode();
}
},
onPayPopupChange(e) {
this.payPopupVisible = e.show;
if (!e.show && this.currentOrderId && !this.navigatingFromPayPopup) {
@ -1089,7 +1181,7 @@
}
return arr.join(',');
},
submitPay() {
async submitPay() {
if (!requireLoginToCurrentPage()) return;
if (this.currentOrderId) {
uni.redirectTo({
@ -1100,6 +1192,9 @@
if (this.isCreatingOrder) return;
let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem
.isFaceToFace;
if (this.isPaotui && !(await this.ensureDeliveryAvailable())) {
return;
}
if (this.isPaotui && !this.formData.address && !isJoiningFaceToFace) {
this.warnPopup = 'shdz';
this.$refs.warnPopup.open();
@ -1463,7 +1558,7 @@
if(this.isSeckillOrder){
payload.seckillOrder = 1
}
payload.regionId = JSON.parse(uni.getStorageSync('area')).id
payload.regionId = this.getCurrentRegionId()
this.tui.request("/mall/order/create", "POST", payload, false, false).then(res => {
uni.hideLoading();
this.isCreatingOrder = false;
@ -2378,6 +2473,53 @@
box-shadow: 0 12rpx 26rpx rgba(11, 155, 115, 0.2);
}
.delivery-closed-popup {
width: 620rpx;
padding: 48rpx 38rpx 36rpx;
background: linear-gradient(180deg, #ffffff 0%, #f2fff9 100%);
border-radius: 34rpx;
box-sizing: border-box;
text-align: center;
box-shadow: 0 24rpx 70rpx rgba(0, 35, 28, 0.18);
}
.delivery-closed-icon {
width: 92rpx;
height: 92rpx;
margin: 0 auto 24rpx;
border-radius: 50%;
background: rgba(11, 155, 115, 0.12);
display: flex;
align-items: center;
justify-content: center;
}
.delivery-closed-title {
color: $primary;
font-size: 34rpx;
font-weight: 700;
line-height: 1.4;
}
.delivery-closed-desc {
margin-top: 18rpx;
color: $muted;
font-size: 26rpx;
line-height: 42rpx;
}
.delivery-closed-btn {
margin-top: 38rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 999rpx;
color: #fff;
font-size: 28rpx;
font-weight: 700;
background: linear-gradient(135deg, #0b9b73, #20d6a4);
box-shadow: 0 12rpx 26rpx rgba(11, 155, 115, 0.2);
}
.coupon-row {
border-top: 1rpx solid #f0f3f2;
font-size: 28rpx;

2
package1/tabbar/fishRelease.vue

@ -164,7 +164,7 @@
imageAuditMessage: '',
auditTitle: '提交中,等待审核',
officialAccountPopupVisible: false,
officialAccountQr: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d23a9043a8c24731831ec4db909fe3b4.jpg',
officialAccountQr: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/ca2d31caab16467eac20b1711fa00a78.jpg',
officialAccountResolve: null,
editorIns: null,
editorToolbarConfig: {

Loading…
Cancel
Save