wangfukang 2 weeks ago
parent
commit
c39b32c833
  1. 458
      package2/myCenter/partTimeJobRegister.vue

458
package2/myCenter/partTimeJobRegister.vue

@ -1,6 +1,6 @@
<template> <template>
<!-- 兼职注册 --> <!-- 兼职注册 -->
<page-meta :page-style="routePopupVisible ? 'overflow: hidden;' : 'overflow: visible;'"></page-meta> <page-meta :page-style="routePopupVisible || dispatchPopupVisible ? 'overflow: hidden;' : 'overflow: visible;'"></page-meta>
<view class="page1"> <view class="page1">
<view class="title"> <view class="title">
<view class="title-sreach"> <view class="title-sreach">
@ -215,7 +215,7 @@
温馨提示 温馨提示
</view> </view>
<view class="liangge-text"> <view class="liangge-text">
1.送单规则需要在<text style="color:red">配送</text>页面开启才能生效 1.接单规则提交后可直接在当前页面设置指派单
</view> </view>
<view class="liangge-text"> <view class="liangge-text">
2.您还没有关注公众号关注公众号后可提现佣金 2.您还没有关注公众号关注公众号后可提现佣金
@ -312,6 +312,81 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 指派单规则弹出层 -->
<uni-popup ref="dispatchPopup" type="bottom" background-color="transparent" :mask-click="false" @change="onDispatchPopupChange">
<view class="dispatch-popup-content">
<view class="dispatch-popup-title">设置指派单规则</view>
<view class="dispatch-popup-desc">
开启后系统只会把符合你设置区域和最低佣金的订单派给你新添加的路线已默认参与指派可在这里调整
</view>
<view class="zhipai-box">
开启接受指派单
<view class="zhipai">
<switch :checked="zhipaiCheck" @change="zhipaiChange"
style="transform: scale(0.7);text-align: right;" />
</view>
</view>
<view class="dispatch-empty" v-if="totalRuleCount == 0">
<view class="dispatch-empty-title">你还没有接单范围</view>
<view class="dispatch-empty-desc">先选择想送的楼栋和最低配送费设置后才能开启自动派单</view>
</view>
<scroll-view scroll-y="true" class="dispatch-rule-scroll">
<view class="dispatch-section-title">
外卖接单范围
<view @tap="allCheck('waima')" v-if="zhipaiCheck">全选</view>
</view>
<view class="dispatch-rule-card" v-for="(item, index) in waimaRuleList" :key="index">
<view v-if="!zhipaiCheck" class="dispatch-rule-disabled"></view>
<view class="dispatch-rule-main" @tap="checkDispatchRule(index,'waima')">
<view class="dispatch-route-point">
<view class="dispatch-route-badge"></view>
<view class="dispatch-route-name">{{item.getAreaName}}</view>
</view>
<view class="dispatch-route-point">
<view class="dispatch-route-badge dispatch-route-badge--send"></view>
<view class="dispatch-route-name dispatch-route-name--send">{{item.putAreaName}}</view>
</view>
<view class="dispatch-rule-fee">最低{{item.orderBkge || 0}}</view>
<view class="radio-check" v-if="item.isChecked">
<uni-icons type="checkmarkempty" size="12"></uni-icons>
</view>
<view class="radio-no-check" v-else></view>
</view>
</view>
<view class="dispatch-section-title">
快递接单范围
<view @tap="allCheck('paotui')" v-if="zhipaiCheck">全选</view>
</view>
<view class="dispatch-rule-card" v-for="(item, index) in paotuiRuleList" :key="index">
<view v-if="!zhipaiCheck" class="dispatch-rule-disabled"></view>
<view class="dispatch-rule-main" @tap="checkDispatchRule(index,'paotui')">
<view class="dispatch-route-point">
<view class="dispatch-route-badge"></view>
<view class="dispatch-route-name">{{item.getAreaName}}</view>
</view>
<view class="dispatch-route-point">
<view class="dispatch-route-badge dispatch-route-badge--send"></view>
<view class="dispatch-route-name dispatch-route-name--send">{{item.putAreaName}}</view>
</view>
<view class="dispatch-rule-fee">最低{{item.orderBkge || 0}}</view>
<view class="radio-check" v-if="item.isChecked">
<uni-icons type="checkmarkempty" size="12"></uni-icons>
</view>
<view class="radio-no-check" v-else></view>
</view>
</view>
<view class="dispatch-scroll-bottom">没有更多了</view>
</scroll-view>
<view class="dispatch-actions">
<view class="dispatch-action-btn dispatch-action-btn--secondary" @tap="closeDispatchPopup">
稍后设置
</view>
<view class="dispatch-action-btn dispatch-action-btn--primary" @tap="saveDispatchRule">
{{dispatchSaving ? '保存中...' : '确认并保存'}}
</view>
</view>
</view>
</uni-popup>
<common-loading /> <common-loading />
</view> </view>
</template> </template>
@ -340,7 +415,11 @@
currentConfigType: '', currentConfigType: '',
defaultRoutePrice: '1', defaultRoutePrice: '1',
defaultRouteRemark: '', defaultRouteRemark: '',
routePopupVisible: false routePopupVisible: false,
dispatchPopupVisible: false,
dispatchSaving: false,
zhipaiCheck: false,
pendingNewDispatchRuleKeys: []
} }
}, },
components: { components: {
@ -364,6 +443,9 @@
orderRange: lowOrders + '-' + highOrders, orderRange: lowOrders + '-' + highOrders,
incomeRange: '¥' + this.formatDisplayMoney(lowIncome) + '-' + this.formatDisplayMoney(highIncome) incomeRange: '¥' + this.formatDisplayMoney(lowIncome) + '-' + this.formatDisplayMoney(highIncome)
} }
},
totalRuleCount() {
return (this.waimaRuleList ? this.waimaRuleList.length : 0) + (this.paotuiRuleList ? this.paotuiRuleList.length : 0)
} }
}, },
onLoad() { onLoad() {
@ -424,6 +506,9 @@
const minFee = this.getMinFee(list) const minFee = this.getMinFee(list)
return '已覆盖 ' + list.length + ' 条路线' + (minFee > 0 ? ',最低¥' + this.formatDisplayMoney(minFee) + '起' : '') return '已覆盖 ' + list.length + ' 条路线' + (minFee > 0 ? ',最低¥' + this.formatDisplayMoney(minFee) + '起' : '')
}, },
getRuleKey(item) {
return [item.orderType, item.getAreaId, item.putAreaId].join('_')
},
showOnboardingOnce() { showOnboardingOnce() {
this.$nextTick(() => { this.$nextTick(() => {
if (uni.getStorageSync('part_time_rule_onboarding_seen')) return if (uni.getStorageSync('part_time_rule_onboarding_seen')) return
@ -482,9 +567,11 @@
item.orderBkge = value; item.orderBkge = value;
return value; return value;
}, },
getWorkerMessage() { getWorkerMessage(openDispatchAfterLoad, enablePushOrderAfterLoad) {
const worker = uni.getStorageSync('worker')
if (!worker || !worker.workerId) return
let that = this let that = this
that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + uni.getStorageSync('worker').workerId, that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId,
"GET", {}, false, true).then((res) => { "GET", {}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (res.result != null) { if (res.result != null) {
@ -498,8 +585,10 @@
.deliveryLocation = data.deliveryLocation; .deliveryLocation = data.deliveryLocation;
let list = (data.workerRelaPriceList || []).map(item => { let list = (data.workerRelaPriceList || []).map(item => {
const isNewRule = enablePushOrderAfterLoad && that.pendingNewDispatchRuleKeys.indexOf(that.getRuleKey(item)) !== -1
return Object.assign({}, item, { return Object.assign({}, item, {
remark: that.limitText(item.remark, 20) remark: that.limitText(item.remark, 20),
isChecked: item.getPushOrder == 1 || isNewRule
}); });
}); });
let waimaList = list.filter(item => item.orderType == 0); let waimaList = list.filter(item => item.orderType == 0);
@ -507,13 +596,24 @@
if (waimaList.length > 0) { if (waimaList.length > 0) {
that.formData.waima = true; that.formData.waima = true;
that.waimaRuleList = waimaList;
} }
if (paotuiList.length > 0) { if (paotuiList.length > 0) {
that.formData.paotui = true; that.formData.paotui = true;
that.paotuiRuleList = paotuiList;
} }
that.waimaRuleList = waimaList;
that.paotuiRuleList = paotuiList;
const workerInfo = uni.getStorageSync('worker') || {};
const pushOrder = data.getPushOrder !== undefined && data.getPushOrder !== null
? data.getPushOrder
: workerInfo.getPushOrder;
that.zhipaiCheck = enablePushOrderAfterLoad ? true : pushOrder == 1;
that.$forceUpdate(); that.$forceUpdate();
if (openDispatchAfterLoad) {
that.$nextTick(() => {
that.openDispatchPopup()
})
}
that.pendingNewDispatchRuleKeys = []
} }
} else { } else {
that.tui.toast(res.message) that.tui.toast(res.message)
@ -611,7 +711,9 @@
putAreaName: s.title, putAreaName: s.title,
orderBkge: this.formatMoneyInput(this.defaultRoutePrice), orderBkge: this.formatMoneyInput(this.defaultRoutePrice),
orderType: this.currentConfigType == 'waima' ? 0 : 1, orderType: this.currentConfigType == 'waima' ? 0 : 1,
remark: this.limitText(this.defaultRouteRemark, 20) remark: this.limitText(this.defaultRouteRemark, 20),
getPushOrder: 1,
isChecked: true
}); });
} }
}); });
@ -631,12 +733,106 @@
}, },
changePopup(e){ changePopup(e){
if(e.show == false){ if(e.show == false){
uni.navigateBack() this.openDispatchPopup()
} }
}, },
onRoutePopupChange(e) { onRoutePopupChange(e) {
this.routePopupVisible = !!e.show this.routePopupVisible = !!e.show
}, },
onDispatchPopupChange(e) {
this.dispatchPopupVisible = !!e.show
},
openDispatchPopup() {
if (this.$refs.dispatchPopup) {
this.$refs.dispatchPopup.open()
}
},
closeDispatchPopup() {
if (this.$refs.dispatchPopup) {
this.$refs.dispatchPopup.close()
}
},
zhipaiChange(e) {
this.zhipaiCheck = e.detail.value
},
checkDispatchRule(index, type) {
if (!this.zhipaiCheck) return
if (type == 'waima') {
this.waimaRuleList[index].isChecked = !this.waimaRuleList[index].isChecked
} else {
this.paotuiRuleList[index].isChecked = !this.paotuiRuleList[index].isChecked
}
this.$forceUpdate()
},
allCheck(type) {
const list = type == 'waima' ? this.waimaRuleList : this.paotuiRuleList
list.forEach(item => {
item.isChecked = true
})
this.$forceUpdate()
},
saveDispatchRule() {
if (this.dispatchSaving) return
let selectRuleList = []
let waimaiData = []
let kuaidiData = []
this.waimaRuleList.forEach(item => {
if (!item.id) return
const isChecked = this.zhipaiCheck && item.isChecked
item.getPushOrder = isChecked ? 1 : 0
selectRuleList.push({
id: item.id,
getPushOrder: isChecked ? 1 : 0
})
if (isChecked) waimaiData.push(item)
})
this.paotuiRuleList.forEach(item => {
if (!item.id) return
const isChecked = this.zhipaiCheck && item.isChecked
item.getPushOrder = isChecked ? 1 : 0
selectRuleList.push({
id: item.id,
getPushOrder: isChecked ? 1 : 0
})
if (isChecked) kuaidiData.push(item)
})
if (selectRuleList.length == 0) {
return uni.showToast({
title: '暂无可保存的接单范围',
icon: 'none'
})
}
this.dispatchSaving = true
this.tui.request('/app/workerRelaPrice/batchUpdate', 'post', {
userId: uni.getStorageSync('id'),
workerRelaPriceList: selectRuleList,
getPushOrder: this.zhipaiCheck ? 1 : 0
}).then(res => {
this.dispatchSaving = false
if (res.code == 200) {
let worker = uni.getStorageSync('worker') || {}
worker.getPushOrder = this.zhipaiCheck ? 1 : 0
uni.setStorageSync('worker', worker)
uni.setStorageSync('waimaiData', waimaiData)
uni.setStorageSync('kuaidiData', kuaidiData)
if (!this.zhipaiCheck) {
uni.removeStorageSync('waimaiData')
uni.removeStorageSync('kuaidiData')
}
uni.showToast({
title: '设置成功'
})
this.closeDispatchPopup()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch(() => {
this.dispatchSaving = false
})
},
checkAddress(type) { checkAddress(type) {
let that = this let that = this
this.currentConfigType = type; this.currentConfigType = type;
@ -729,6 +925,10 @@
mobile: this.formData.mobile, mobile: this.formData.mobile,
workerRelaPriceList: workerRelaPriceList workerRelaPriceList: workerRelaPriceList
}; };
const hasNewRule = workerRelaPriceList.some(item => !item.id)
this.pendingNewDispatchRuleKeys = workerRelaPriceList
.filter(item => !item.id)
.map(item => this.getRuleKey(item))
uni.showLoading({ uni.showLoading({
title: '提交中...', title: '提交中...',
@ -739,20 +939,15 @@
if (res.code == 200) { if (res.code == 200) {
let user = res.result; let user = res.result;
uni.setStorageSync('officialAccountOpenid', user.officialAccountOpenid) uni.setStorageSync('officialAccountOpenid', user.officialAccountOpenid)
if (user.officialAccountOpenid == null || user.officialAccountOpenid == '' || user
.officialAccountOpenid == undefined) {
this.$refs.lianggePopup.open()
} else {
uni.showToast({ uni.showToast({
title: '提交成功' title: '提交成功'
}); });
}
let worker1 = uni.getStorageSync('worker') let worker1 = uni.getStorageSync('worker')
worker1 = worker1 || {}
worker1.workerName = this.formData.name worker1.workerName = this.formData.name
if (hasNewRule) worker1.getPushOrder = 1
uni.setStorageSync('worker', worker1) uni.setStorageSync('worker', worker1)
uni.reLaunch({ this.getWorkerMessage(true, hasNewRule)
url: '/pages/index/index?tabIndex=1&deliveryRuleEdited=1'
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
@ -1468,4 +1663,231 @@
background: rgba(247, 248, 248, 0.9); background: rgba(247, 248, 248, 0.9);
text-align: center; text-align: center;
} }
.dispatch-popup-content {
width: 100%;
height: 76vh;
padding: 30rpx 28rpx 0;
border-radius: 36rpx 36rpx 0 0;
background: #fff;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.dispatch-popup-title {
line-height: 48rpx;
font-size: 34rpx;
font-weight: 900;
text-align: center;
color: #00231C;
}
.dispatch-popup-desc {
margin: 12rpx 0 8rpx;
padding: 18rpx 20rpx;
border-radius: 18rpx;
background: rgba(166, 255, 234, 0.22);
color: #526964;
font-size: 24rpx;
line-height: 36rpx;
}
.zhipai-box {
display: flex;
height: 100rpx;
line-height: 100rpx;
font-size: 32rpx;
font-weight: 700;
border-bottom: 1px solid #eee;
}
.zhipai {
flex: 1;
text-align: right;
}
.dispatch-empty {
margin: 20rpx 0;
padding: 34rpx 20rpx;
border-radius: 22rpx;
background: rgba(247, 248, 248, 0.9);
text-align: center;
}
.dispatch-empty-title {
font-size: 30rpx;
font-weight: 900;
color: #00231C;
}
.dispatch-empty-desc {
margin-top: 10rpx;
color: #7b8a85;
font-size: 24rpx;
line-height: 36rpx;
}
.dispatch-rule-scroll {
flex: 1;
min-height: 0;
height: auto;
overflow-y: scroll;
}
.dispatch-section-title {
height: 58rpx;
line-height: 58rpx;
display: flex;
font-weight: 900;
color: #00231C;
}
.dispatch-section-title view {
flex: 1;
padding-right: 20rpx;
color: #1E90FF;
text-align: right;
font-weight: 800;
}
.dispatch-rule-card {
position: relative;
padding-bottom: 20rpx;
border-bottom: 1px solid #ddd;
}
.dispatch-rule-main {
display: flex;
width: 100%;
}
.dispatch-rule-disabled {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.5);
z-index: 2;
}
.dispatch-route-point {
display: flex;
flex: 1;
padding-top: 20rpx;
min-width: 0;
}
.dispatch-route-badge {
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 40rpx;
background: rgba(0, 35, 28, 1);
color: #fff;
font-size: 20rpx;
text-align: center;
z-index: 1;
flex-shrink: 0;
}
.dispatch-route-badge--send {
background: #005849;
}
.dispatch-route-name {
height: 40rpx;
line-height: 38rpx;
margin-left: -10rpx;
padding: 0 20rpx;
border-top-right-radius: 40rpx;
border-bottom-right-radius: 40rpx;
background: rgba(166, 255, 234, 0.5);
font-size: 24rpx;
font-weight: 700;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dispatch-route-name--send {
background: rgba(209, 206, 255, 1);
}
.dispatch-rule-fee {
height: 40rpx;
line-height: 40rpx;
margin: 20rpx 16rpx 0 0;
padding: 0 12rpx;
border-radius: 40rpx;
background: rgba(255, 233, 89, 0.32);
color: #8a5a00;
font-size: 20rpx;
font-weight: 800;
flex-shrink: 0;
}
.radio-check {
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
margin: 16rpx 20rpx 0 0;
border-radius: 48rpx;
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
text-align: center;
flex-shrink: 0;
}
.radio-no-check {
width: 48rpx;
height: 48rpx;
margin: 16rpx 20rpx 0 0;
border-radius: 48rpx;
border: 1px solid #eee;
box-sizing: border-box;
flex-shrink: 0;
}
.dispatch-scroll-bottom {
width: 100%;
height: 60rpx;
line-height: 60rpx;
color: #9ca6a2;
text-align: center;
}
.dispatch-actions {
display: flex;
gap: 18rpx;
padding: 18rpx 0 24rpx;
padding: 18rpx 0 calc(24rpx + constant(safe-area-inset-bottom));
padding: 18rpx 0 calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
flex-shrink: 0;
z-index: 3;
}
.dispatch-action-btn {
flex: 1;
height: 78rpx;
line-height: 78rpx;
border-radius: 78rpx;
text-align: center;
font-size: 28rpx;
font-weight: 900;
box-sizing: border-box;
}
.dispatch-action-btn--secondary {
background: rgba(166, 255, 234, 0.28);
color: #00624f;
border: 2rpx solid rgba(166, 255, 234, 0.88);
}
.dispatch-action-btn--primary {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
color: #00231C;
box-shadow: 0 10rpx 22rpx rgba(0, 112, 91, 0.14);
}
</style> </style>
Loading…
Cancel
Save