wangfukang 20 hours ago
parent
commit
f88438066b
  1. 16
      package1/address/addressList.vue
  2. 89
      package1/buyFood/buyFood.vue
  3. 71
      package1/index/deliveryPersonList.vue
  4. 25
      package1/order/orderDetail.vue
  5. 2
      package1/planet/pkHall.vue
  6. 36
      package1/runErrand/runErrand.vue

16
package1/address/addressList.vue

@ -109,6 +109,8 @@
addressList: [],
areaList: [],
areaTitleList: [],
areaListLoaded: false,
areaListLoading: false,
areaTitleInput: '',
areaSearchInput: '',
addressForm: {
@ -125,7 +127,6 @@
},
created() {
this.getAddressList();
this.getAreaList();
},
computed: {
filteredAreaTitleList() {
@ -166,14 +167,20 @@
}
},
getAreaList() {
if (this.areaListLoaded || this.areaListLoading) return Promise.resolve(this.areaList);
this.areaListLoading = true;
let that = this;
that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(uni.getStorageSync('area')).id, "GET", {}, false, true).then((res) => {
return that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(uni.getStorageSync('area')).id, "GET", {}, false, true).then((res) => {
if (res.code == 200 && res.result) {
that.$emit('shopAreaList',res.result)
that.areaList = res.result;
that.areaTitleList = res.result.map(item => item.title);
that.areaListLoaded = true;
}
}).catch(() => {});
return that.areaList;
}).catch(() => {}).finally(() => {
that.areaListLoading = false;
});
},
selectAddress(item) {
this.$emit('selectAddress', item);
@ -191,6 +198,7 @@
};
this.areaTitleInput = '';
this.areaSearchInput = '';
this.getAreaList();
this.$refs.addBookPopup.open('bottom');
},
openEdit(item) {
@ -204,6 +212,7 @@
receiverPhone: item.receiverPhone,
isDefault: item.isDefault || 0
};
this.getAreaList();
let match = this.areaList.find(a => a.id === item.areaId);
this.areaTitleInput = match ? match.title : (item.areaName || '');
this.areaSearchInput = '';
@ -211,6 +220,7 @@
},
openAreaPopup() {
this.areaSearchInput = this.areaTitleInput;
this.getAreaList();
this.$refs.areaPopup.open();
},
closeAreaPopup() {

89
package1/buyFood/buyFood.vue

@ -111,6 +111,18 @@
</view>
</view>
<view class="delivery-options">
<view class="delivery-option" v-if="supportShopDelivery">
<view class="delivery-choice">
<view class="radio-check" v-if="selected === 'shopDelivery'">
<uni-icons type="checkmarkempty" size="12"></uni-icons>
</view>
<view class="radio-no-check" @tap="checkVoucher('shopDelivery')" v-else></view>
商家自配送
</view>
<view class="worker-entry" @tap.stop>
{{shopDeliveryText}}
</view>
</view>
<view class="delivery-option">
<view class="delivery-choice">
<view class="radio-check" v-if="selected === 'buzhiding'">
@ -321,9 +333,9 @@
</view>
</view>
<!-- 地址簿弹出层 -->
<uni-popup ref="bookPopup" background-color="#fff">
<uni-popup ref="bookPopup" background-color="#fff" @change="onAddressPopupChange">
<view class="book-popup-content">
<address-list @selectAddress="handleSelectAddress" @syncAddress="handleSyncAddress"
<address-list v-if="addressBookVisible" @selectAddress="handleSelectAddress" @syncAddress="handleSyncAddress"
@close="closeAddressBook"></address-list>
</view>
</uni-popup>
@ -560,6 +572,7 @@
isPaymentSuccessGroupInitiate: false,
availableCoupons: [],
selectedCoupon: null,
addressBookVisible: false,
freeOrderEffectVisible: false,
freeOrderAmount: '0.00'
}
@ -605,6 +618,10 @@
this.isPack = 0;
this.totalPackageFee = 0;
}
if (this.supportShopDelivery) {
this.selected = 'shopDelivery';
}
this.fetchCoupons();
},
computed: {
goodsAmountCalc() {
@ -626,6 +643,7 @@
return this.orderScene === 'storeGroup' || (this.groupItem && this.groupItem.orderScene === 'storeGroup') || this.shopItem.merchantType == 2;
},
highFloorFeeCalc() {
if (this.selected === 'shopDelivery') return 0;
if (this.selected === 'zhiding' && this.assignedWorker) {
let hFee = parseFloat(this.assignedWorker.highFloorFee || 0);
if (hFee > 0 && this.formData.address && parseInt(this.formData.address.floor) > 3) {
@ -655,7 +673,9 @@
if (isJoiningFaceToFace)
return 0; // Front-end doesn't know exact fee, relies on backend after order creation
let commission = 0;
if (this.selected === 'zhiding') {
if (this.selected === 'shopDelivery') {
commission = parseFloat(this.shopItem.orderBkge || 0);
} else if (this.selected === 'zhiding') {
if (!this.assignedWorker) return 0;
commission = parseFloat(this.assignedWorker.orderBkge || 3);
} else {
@ -690,20 +710,36 @@
}
},
deliveryDurationMinutes() {
if (this.selected === 'shopDelivery') {
const selfDeliveryDuration = Number(this.shopItem.shopDeliveryDuration);
const cookingTime = Number(this.shopItem.shopTakeaway && this.shopItem.shopTakeaway.cookingTime ? this.shopItem.shopTakeaway.cookingTime : 0);
const validCookingTime = isNaN(cookingTime) || cookingTime < 0 ? 0 : cookingTime;
return isNaN(selfDeliveryDuration) || selfDeliveryDuration <= 0 ? validCookingTime + 30 : validCookingTime + selfDeliveryDuration;
}
const value = Number(this.shopItem.groupDeliveryTime);
return isNaN(value) || value < 25 ? 30 : value;
},
supportShopDelivery() {
return this.shopItem && this.shopItem.supportShopDelivery == 1 && this.shopItem.workerId;
},
shopDeliveryText() {
const fee = parseFloat(this.shopItem.orderBkge || 0);
const feeText = fee > 0 ? `¥${fee.toFixed(1)}` : '免配送费';
const locationText = this.shopItem.shopDeliveryLocation == 1 ? '送到宿舍' : '送到楼下';
const workerText = this.shopItem.workerName ? ` ${this.shopItem.workerName}` : '';
return `${feeText} ${locationText}${workerText}`;
}
},
watch: {},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.initAddress()
//this.fetchCoupons();
this.updateImmediateTimeStr();
uni.$on('updateDeliveryWorker', (worker) => {
this.assignedWorker = worker;
this.selected = 'zhiding';
this.refreshDeliveryTimeByModeChange();
});
},
onShareAppMessage(res) {
@ -800,6 +836,13 @@
endTime.setMinutes(endTime.getMinutes() + this.deliveryDurationMinutes);
this.immediateTimeStr = `${this.formatClockTime(startTime)}-${this.formatClockTime(endTime)}`;
},
refreshDeliveryTimeByModeChange() {
this.updateImmediateTimeStr();
if (this.formData.isImmediately === false) {
this.formData.deliveryTime = '';
this.generateDeliveryTimes();
}
},
formatClockTime(date) {
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
},
@ -834,12 +877,19 @@
this.formData.address = address;
uni.setStorageSync('selectedAddress', address);
this.$refs.bookPopup.close();
this.addressBookVisible = false;
},
handleSyncAddress(address) {
this.formData.address = address;
},
closeAddressBook() {
this.$refs.bookPopup.close();
this.addressBookVisible = false;
},
onAddressPopupChange(e) {
if (!e.show) {
this.addressBookVisible = false;
}
},
getSpecDisplayString(specs) {
if (!specs) return '';
@ -878,6 +928,13 @@
this.$refs.warnPopup.open();
return;
}
if (this.isPaotui && this.selected === 'shopDelivery' && !this.supportShopDelivery && !isJoiningFaceToFace) {
uni.showToast({
title: '商家自配送配置不完整',
icon: 'none'
})
return;
}
this.submitOrderToBackend();
},
goDetail() {
@ -923,7 +980,10 @@
this.$refs.couponPopup.close();
},
openAddressBook() {
this.$refs.bookPopup.open('bottom')
this.addressBookVisible = true;
this.$nextTick(() => {
this.$refs.bookPopup.open('bottom')
});
},
checkTime(type) {
if (type === this.formData.isImmediately) {
@ -945,7 +1005,11 @@
if (this.selected == 'buzhiding') {
this.formData.peisongyuan = "";
this.assignedWorker = null;
} else if (this.selected == 'shopDelivery') {
this.formData.peisongyuan = "";
this.assignedWorker = null;
}
this.refreshDeliveryTimeByModeChange();
},
wxPayment() {
let that = this;
@ -1154,14 +1218,24 @@
payload.groupParam = {
targetMembers: parseInt(this.groupItem.groupRule.groupCount),
isFaceToFace: this.groupItem.isFaceToFace ? 1 : 0,
selfCommission: this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) :
selfCommission: this.selected === 'shopDelivery' ? parseFloat(this.shopItem.orderBkge || 0) : (this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) :
null
)
};
}
}
if (this.isPaotui && !isJoiningFaceToFace) {
if (this.selected === 'zhiding' && this.assignedWorker) {
if (this.selected === 'shopDelivery') {
payload.shopDelivery = 1;
payload.workerParam = {
workerId: this.shopItem.workerId,
workerPhone: this.shopItem.workerPhone,
workerName: this.shopItem.workerName,
orderBkge: parseFloat(this.shopItem.orderBkge || 0)
};
} else if (this.selected === 'zhiding' && this.assignedWorker) {
payload.shopDelivery = 0;
payload.workerParam = {
workerId: this.assignedWorker.workerId,
workerPhone: this.assignedWorker.mobile,
@ -1169,6 +1243,7 @@
orderBkge: parseFloat(this.assignedWorker.orderBkge || 0) + this.highFloorFeeCalc
};
} else if (this.selected === 'buzhiding') {
payload.shopDelivery = 0;
payload.workerParam = {
orderBkge: parseFloat(this.customCommission || 0)
};

71
package1/index/deliveryPersonList.vue

@ -51,7 +51,7 @@
alt="" style="width: 140rpx;height: 32rpx;margin-top: 18rpx;"
v-if="worker.rebateAmount > 0" />
</view>
<view class="shop-menu-purchase man-name">
<view class="worker-price">
¥{{worker.orderBkge}}
</view>
</view>
@ -83,10 +83,13 @@
</view>
</view>
<view class="man-mank">
<view style="flex: 1;">
<view class="worker-remark">
备注:<text style="color: #000;">{{worker.remark || '无'}}</text>
</view>
<view class="" @tap.stop="getLoca(worker)">
<view class="delivery-location">
{{formatDeliveryLocation(worker.deliveryLocation)}}
</view>
<view class="location-btn" @tap.stop="getLoca(worker)">
查看位置
</view>
</view>
@ -187,6 +190,9 @@
this.latitude = this.markers[0].latitude
this.longitude = this.markers[0].longitude
},
formatDeliveryLocation(value) {
return value == 1 ? '送到宿舍门口' : '送上楼'
},
getShopList() {
this.loadStatus = 'loading';
// Fake request to our new endpoint
@ -398,6 +404,7 @@
height: 70rpx;
line-height: 70rpx;
padding-right: 20rpx;
align-items: center;
}
.man-name {
@ -450,21 +457,61 @@
}
.man-mank {
line-height: 40rpx;
line-height: 44rpx;
color: #777;
font-weight: 700;
display: flex;
align-items: center;
}
.shop-menu-purchase {
display: flex;
background: rgba(255, 57, 57, 0.1);
height: 36rpx;
line-height: 36rpx;
padding: 0 0 0 4rpx;
border-radius: 8rpx;
.worker-remark {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.delivery-location {
height: 44rpx;
line-height: 44rpx;
padding: 0 18rpx;
margin-right: 20rpx;
border-radius: 10rpx;
background: rgba(166, 255, 234, 0.22);
border: 1rpx solid rgba(166, 255, 234, 1);
color: #00231C;
font-size: 22rpx;
font-weight: 700;
margin-top: 10rpx;
white-space: nowrap;
}
.location-btn {
height: 44rpx;
line-height: 44rpx;
padding: 0 18rpx;
border-radius: 10rpx;
background: rgba(247, 248, 248, 0.9);
border: 1rpx solid #E7E7E7;
color: #777;
font-size: 22rpx;
white-space: nowrap;
}
.worker-price {
display: flex;
align-items: center;
justify-content: center;
min-width: 118rpx;
height: 58rpx;
line-height: 58rpx;
padding: 0 18rpx;
border-radius: 12rpx;
background: linear-gradient(90deg, rgba(227, 255, 150, 0.55), rgba(166, 255, 234, 0.55));
border: 2rpx solid rgba(166, 255, 234, 1);
font-weight: 700;
font-size: 32rpx;
color: #00231C;
box-shadow: 0 4rpx 12rpx rgba(0, 35, 28, 0.08);
}
</style>

25
package1/order/orderDetail.vue

@ -132,8 +132,8 @@
<view class="status-text">
<view class="status-zhu">
<text v-if="orderDetail.status == 0">待支付</text>
<text v-if="orderDetail.status == 2">等待配送员接单</text>
<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 1">配送员已接单</text>
<text v-if="orderDetail.status == 2">{{orderDetail.shopDelivery == 1 ? '等待商家配送接单' : '等待配送员接单'}}</text>
<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 1">{{orderDetail.shopDelivery == 1 ? '商家配送已接单' : '配送员已接单'}}</text>
<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 2">待消费</text>
<text v-if="orderDetail.status == 4 && orderDetail.deliveryType == 1">配送员已取货</text>
<text v-if="orderDetail.status == 5">订单已完成</text>
@ -207,10 +207,10 @@
@tap="makeMeal" style="background: rgba(0, 35, 28, 1);color:rgba(166, 255, 234, 1);">
立即备餐
</view>
<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2" @tap="openAddFeePopup">
<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2 && orderDetail.shopDelivery != 1" @tap="openAddFeePopup">
增加配送佣金
</view>
<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2" @tap="goAssignWorker">
<view class="btn" style="width: 40%;" v-if="orderDetail.status == 2 && orderDetail.shopDelivery != 1" @tap="goAssignWorker">
改派配送员
</view>
<!-- <view class="btn">
@ -446,7 +446,7 @@
<view style="height: 80rpx;line-height: 80rpx;display: flex;"
v-if="orderDetail.deliveryType == 1">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员
{{orderDetail.shopDelivery == 1 ? '商家配送员' : '配送员'}}
</view>
<view style="color: #000;font-weight: 700;display: flex;"
v-if="orderDetail.deliveryInfo && orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
@ -459,10 +459,19 @@
未指定等待接单中
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;"
v-if="orderDetail.deliveryType == 1 && orderDetail.shopDelivery == 1">
<view style="flex: 1;color: #777;font-weight: 700;">
配送方式
</view>
<view style="color: #ff6f2c;font-weight: 700;">
商家自配送
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;"
v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员接单时间
{{orderDetail.shopDelivery == 1 ? '商家配送接单时间' : '配送员接单时间'}}
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.deliveryInfo.acceptTime | formatTime}}
@ -481,7 +490,7 @@
<view style="height: 80rpx;line-height: 80rpx;display: flex;"
v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != '' && orderDetail.otherOrder == null">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员到店时间
{{orderDetail.shopDelivery == 1 ? '商家到店时间' : '配送员到店时间'}}
</view>
<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo">
{{orderDetail.deliveryInfo.arriveTime ? orderDetail.deliveryInfo.arriveTime : '' | formatTime}}
@ -490,7 +499,7 @@
<view style="height: 80rpx;line-height: 80rpx;display: flex;"
v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员取货时间
{{orderDetail.shopDelivery == 1 ? '商家取货时间' : '配送员取货时间'}}
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.deliveryInfo.getTime ? orderDetail.deliveryInfo.getTime : '' | formatTime}}

2
package1/planet/pkHall.vue

@ -80,7 +80,7 @@
<view class="modal-card">
<view class="modal-title">创建星球擂台</view>
<input class="field" v-model="form.roomName" maxlength="20" placeholder="房间名称" />
<input class="field" v-model.number="form.maxPlayers" type="number" placeholder="人数 2-5" />
<input class="field" v-model.number="form.maxPlayers" type="number" min="2" max="8" placeholder="人数 2-8" />
<input class="field" v-model.number="form.tickets" type="number" min="1" placeholder="入场券数量" @blur="normalizeTickets" />
<input class="field" v-model="form.password" placeholder="私密房密码,不填则公开" />
<view class="modal-actions">

36
package1/runErrand/runErrand.vue

@ -252,7 +252,8 @@
<!-- 收货/取货地址簿弹出层 -->
<uni-popup ref="bookPopup" background-color="#fff" @change="onBookPopupChange">
<view class="book-popup-content">
<address-list @selectAddress="handleSelectAddress" @syncAddress="handleSyncAddress" @shopAreaList="updateArea" @close="$refs.bookPopup.close()"></address-list>
<address-list v-if="addressBookVisible" @selectAddress="handleSelectAddress"
@syncAddress="handleSyncAddress" @shopAreaList="updateArea" @close="closeAddressBook"></address-list>
</view>
</uni-popup>
@ -387,9 +388,12 @@
commissionInputValue: '',
shopArea: [],
kuaidiAreaList: [],
shopAreaLoaded: false,
shopAreaLoading: false,
selectedPickupArea: null,
addressSelectMode: 'put', // 'put' | 'get'
isBookPopupOpen: false,
addressBookVisible: false,
formData: {
address: null, // putArea
pickupAddress: null, // getArea ()
@ -539,20 +543,29 @@
this.$refs.couponPopup.close();
},
getShopArea(){
if (this.shopAreaLoaded || this.shopAreaLoading) return Promise.resolve(this.shopArea);
this.shopAreaLoading = true;
let that = this
let areaStorage = uni.getStorageSync('area');
if(!areaStorage) return;
that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(areaStorage).id, "GET", {}, false, true).then((res) => {
if(!areaStorage) {
this.shopAreaLoading = false;
return Promise.resolve([]);
}
return that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(areaStorage).id, "GET", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
that.shopArea = res.result;
that.kuaidiAreaList = that.shopArea.filter(item => item.isCanteen === 2);
that.shopAreaLoaded = true;
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
return that.shopArea;
}).catch((res) => {}).finally(() => {
that.shopAreaLoading = false;
})
},
initAddress() {
let cachedAddress = uni.getStorageSync('selectedAddress');
@ -576,10 +589,21 @@
openAddressBook(mode) {
this.addressSelectMode = mode;
this.isBookPopupOpen = true;
this.$refs.bookPopup.open('bottom');
this.addressBookVisible = true;
this.$nextTick(() => {
this.$refs.bookPopup.open('bottom');
});
},
onBookPopupChange(e) {
this.isBookPopupOpen = !!e.show;
if (!e.show) {
this.addressBookVisible = false;
}
},
closeAddressBook() {
this.isBookPopupOpen = false;
this.addressBookVisible = false;
this.$refs.bookPopup.close();
},
handleSelectAddress(address) {
if (this.addressSelectMode === 'put') {
@ -589,6 +613,7 @@
this.formData.pickupAddress = address;
}
this.isBookPopupOpen = false;
this.addressBookVisible = false;
this.$refs.bookPopup.close();
},
updateArea(v){
@ -601,6 +626,7 @@
}
},
openKuaidiPicker() {
this.getShopArea();
this.$refs.kuaidiPickerPopup.open();
},
selectKuaidiArea(item) {

Loading…
Cancel
Save