Browse Source

修改兼职注册

master
wangfukang 4 weeks ago
parent
commit
203036955c
  1. 314
      package1/myCenter/partTimeJobRegister.vue

314
package1/myCenter/partTimeJobRegister.vue

@ -14,10 +14,11 @@
* 姓名
</view>
<view class="reg-value">
<input type="text" placeholder="请填写姓名"
<input type="text" v-model="formData.name" placeholder="请填写姓名"
style="background: #eee;height: 40px;line-height: 40px;padding: 9px 10px;border-radius: 10px;">
</view>
</view>
<view class="box1">
<view class="reg-name">
* 学生证上传 <text style="font-size: 12px;font-weight: 400;color: #777;">身份信息仅用于认证身份平台会严格保密</text>
@ -30,44 +31,54 @@
style="width: 80px;height: 80px;background-size: 100%;" />
</view>
</view>
<view class="box1">
<view class="reg-name">
* 超出3楼以上额外收费
</view>
<view class="reg-value">
<input type="number" v-model="formData.highFloorFee" placeholder="可设置金额"
style="background: #eee;height: 40px;line-height: 40px;padding: 9px 10px;border-radius: 10px;">
</view>
</view>
<view class="box1">
<view class="reg-name">
* 兼职类型
</view>
<view class="reg-value" style="display: flex;">
<view class="box-check-btn" @tap="daimaiOrpaotui('daimai')"
:style="{background:formData.daimai?'rgba(180, 255, 238, 0.27)':'#eee',border:formData.daimai?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
代买饭
<view class="box-check-btn" @tap="waimaOrpaotui('waima')"
:style="{background:formData.waima?'rgba(180, 255, 238, 0.27)':'#eee',border:formData.waima?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
外卖
</view>
<view class="box-check-btn" @tap="daimaiOrpaotui('paotui')"
<view class="box-check-btn" @tap="waimaOrpaotui('paotui')"
:style="{background:formData.paotui?'rgba(180, 255, 238, 0.27)':'#eee',border:formData.paotui?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
快递
</view>
</view>
</view>
<view class="box1" v-if="formData.daimai != false || formData.paotui != false">
<view class="box1" v-if="formData.waima != false || formData.paotui != false">
<view class="reg-name">
* 规则配置
</view>
<view class="reg-value">
<view class="value1" v-if="formData.daimai">
<view class="value1" v-if="formData.waima">
<view class="value-title">
<view class="title-1">
代买饭规则
外卖规则
</view>
<view class="title-2" @tap="checkAddress">
选择地址
<view class="title-2" @tap="checkAddress('waima')">
配置规则
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="guize-list">
<view class="guize1">
<view class="guize1" v-for="(item, index) in waimaRuleList" :key="index" style="flex-direction: column; padding-bottom: 10px; border-bottom: 1px solid #ddd;">
<view style="display: flex; width: 100%;">
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2">
第三食堂
{{item.getAreaName}}
</view>
</view>
<view class="guize1-qusong">
@ -75,32 +86,17 @@
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
1号宿舍楼
</view>
{{item.putAreaName}}
</view>
<view class="qusong3">
<input type="number" placeholder="填写配送费">
</view>
<view class="qusong3" style="display:flex; align-items:center;">
<input type="digit" v-model="item.orderBkge" placeholder="填写配送费" style="flex:1;">
<uni-icons type="closeempty" size="20" @click="removeRule('waima', index)" color="#ff0000" style="margin-left:5px;"></uni-icons>
</view>
<view class="guize1">
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2">
第三食堂
</view>
</view>
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
1号宿舍楼
</view>
</view>
<view class="qusong3">
<input type="number" placeholder="填写配送费">
<view style="display: flex; width: 100%; margin-top: 10px; align-items: center;">
<text style="margin: 0 10px 0 5px; color: #777; font-size: 13px; font-weight: bold;">备注</text>
<input type="text" v-model="item.remark" placeholder="填写备注,如:限时/大件加钱" style="flex:1; background: #fff; border-radius: 5px; padding: 0 10px; height: 30px; line-height: 30px;">
</view>
</view>
</view>
@ -110,19 +106,20 @@
<view class="title-1">
快递规则
</view>
<view class="title-2" @tap="checkAddress">
选择地址
<view class="title-2" @tap="checkAddress('paotui')">
配置规则
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="guize-list">
<view class="guize1">
<view class="guize1" v-for="(item, index) in paotuiRuleList" :key="index" style="flex-direction: column; padding-bottom: 10px; border-bottom: 1px solid #ddd;">
<view style="display: flex; width: 100%;">
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2">
第三食堂
{{item.getAreaName}}
</view>
</view>
<view class="guize1-qusong">
@ -130,32 +127,17 @@
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
1号宿舍楼
</view>
</view>
<view class="qusong3">
<input type="number" placeholder="填写配送费">
</view>
</view>
<view class="guize1">
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2">
第三食堂
{{item.putAreaName}}
</view>
</view>
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
1号宿舍楼
<view class="qusong3" style="display:flex; align-items:center;">
<input type="digit" v-model="item.orderBkge" placeholder="填写配送费" style="flex:1;">
<uni-icons type="closeempty" size="20" @click="removeRule('paotui', index)" color="#ff0000" style="margin-left:5px;"></uni-icons>
</view>
</view>
<view class="qusong3">
<input type="number" placeholder="填写配送费">
<view style="display: flex; width: 100%; margin-top: 10px; align-items: center;">
<text style="margin: 0 10px 0 5px; color: #777; font-size: 13px; font-weight: bold;">备注</text>
<input type="text" v-model="item.remark" placeholder="填写备注,如:限时/大件加钱" style="flex:1; background: #fff; border-radius: 5px; padding: 0 10px; height: 30px; line-height: 30px;">
</view>
</view>
</view>
@ -169,7 +151,7 @@
style="width: 90px;height: 90px;margin-top: 10px;" />
<view style="height: 25px;line-height: 25px;font-weight: 700;">关注公众号</view>
</view>
<view class="btn">
<view class="btn" @click="submit">
提交注册
</view>
</view>
@ -186,29 +168,30 @@
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/f06433fa1bd34b31948eaefe5338c357.png"
alt="" style="width: 102px;height: 25px;" />
</view>
<view style="margin-top: 10px;height: 45px;">
<view style="margin-top: 10px;height: auto;overflow:hidden;min-height: 45px;">
<view class="box-check-btn" @tap="qucanOrsongcan('qucan',index)" v-for="(item,index) in qucan" :key="index"
style="float: left;padding: 0 10px;width: auto;margin-bottom:10px;"
:style="{background:item.checked?'rgba(180, 255, 238, 0.27)':'#eee',border:item.checked?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
{{item.name}}
{{item.title}}
</view>
<view v-if="qucan.length==0" style="color:#999;font-size:12px;margin:10px 0;">暂无可选取货区域</view>
</view>
<view style="margin-top: 65px;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/32fd9d723fbf4d778f2631277d316940.png"
alt="" style="width: 102px;height: 25px;" />
</view>
<view style="margin-top: 10px;height: 45px;">
<view style="margin-top: 10px;height: auto;overflow:hidden;min-height: 45px;">
<view class="box-check-btn" @tap="qucanOrsongcan('songcan',index)" v-for="(item,index) in songcan" :key="index"
style="float: left;padding: 0 10px;width: auto;margin-bottom:10px;"
:style="{background:item.checked?'rgba(180, 255, 238, 0.27)':'#eee',border:item.checked?'1px solid rgba(180, 255, 238, 1)':'1px solid #777'}">
{{item.name}}
{{item.title}}
</view>
<view v-if="songcan.length==0" style="color:#999;font-size:12px;margin:10px 0;">暂无可送货区域</view>
</view>
<view class="guize-btn" @tap="closeGuize">
确定
</view>
<view style="position: absolute;bottom: -50px;left: 150px;" @tap.stop="$refs.guizePopup.close()">
<view style="position: absolute;bottom: -50px;left: 50%;transform:translateX(-50%);" @tap.stop="$refs.guizePopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons>
</view>
</view>
@ -222,49 +205,78 @@
return {
menuButtonInfo: {},
formData: {
name: '',
highFloorFee: 0,
paotui: false,
daimai: false,
waima: false,
studentCard: '',
},
bigImg: '',
qucan:[{
name:'第一食堂',
checked:false,
},{
name:'第二食堂',
checked:false,
},{
name:'第三食堂',
checked:false,
},{
name:'第四食堂',
checked:false,
}],
songcan:[{
name:'男生宿舍1号楼',
checked:false,
},{
name:'男生宿舍2号楼',
checked:false,
},{
name:'男生宿舍3号楼',
checked:false,
},{
name:'男生宿舍4号楼',
checked:false,
}]
qucan:[],
songcan:[],
shopArea: [],
waimaRuleList: [],
paotuiRuleList: [],
currentConfigType: ''
}
},
components: {
},
onLoad() {
this.getShopArea()
this.getWorkerMessage()
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
methods: {
getWorkerMessage(){
let that = this
that.tui.request("/app/workerRelaPrice/getByWorkerId?workerId=W" + uni.getStorageSync('id'), "GET", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
let data = res.result;
if (data.workerName) that.formData.name = data.workerName;
if (data.cardPicture) that.formData.studentCard = data.cardPicture;
if (data.highFloorFee !== undefined && data.highFloorFee !== null) that.formData.highFloorFee = data.highFloorFee;
let list = data.workerRelaPriceList || [];
let waimaList = list.filter(item => item.orderType == 0);
let paotuiList = list.filter(item => item.orderType == 1);
if(waimaList.length > 0) {
that.formData.waima = true;
that.waimaRuleList = waimaList;
}
if(paotuiList.length > 0) {
that.formData.paotui = true;
that.paotuiRuleList = paotuiList;
}
that.$forceUpdate();
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
},
getShopArea(){
let that = this
that.tui.request("/app/shopArea/getByParentId/"+JSON.parse(uni.getStorageSync('area')).id, "GET", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
for(let m = 0;m<res.result.length;m++){
that.shopArea.push(res.result[m])
}
console.log(that.shopArea)
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
},
back() {
uni.navigateBack()
},
@ -273,9 +285,9 @@
this.bigImg = this.formData.studentCard;
this.$refs.imgPopup.open()
},
daimaiOrpaotui(type) {
if (type == 'daimai') {
this.formData.daimai = !this.formData.daimai
waimaOrpaotui(type) {
if (type == 'waima') {
this.formData.waima = !this.formData.waima
} else {
this.formData.paotui = !this.formData.paotui
}
@ -290,16 +302,118 @@
this.$forceUpdate()
},
closeGuize(){
let selectedQucan = this.qucan.filter(item => item.checked);
let selectedSongcan = this.songcan.filter(item => item.checked);
if(selectedQucan.length == 0 || selectedSongcan.length == 0) {
uni.showToast({title: '请至少选择一个取货地址和一个送货地址', icon: 'none'});
return;
}
let currentRuleList = this.currentConfigType == 'waima' ? this.waimaRuleList : this.paotuiRuleList;
let newRules = [];
let userId = uni.getStorageSync('id') || '';
selectedQucan.forEach(q => {
selectedSongcan.forEach(s => {
let existing = currentRuleList.find(r => r.getAreaId == q.id && r.putAreaId == s.id);
if (existing) {
newRules.push(existing);
} else {
newRules.push({
workerId: "W"+userId,
getAreaId: q.id,
getAreaName: q.title,
putAreaId: s.id,
putAreaName: s.title,
orderBkge: '',
orderType: this.currentConfigType == 'waima' ? 0 : 1,
remark: ''
});
}
});
});
if (this.currentConfigType == 'waima') {
this.waimaRuleList = newRules;
} else {
this.paotuiRuleList = newRules;
}
this.$refs.guizePopup.close()
},
checkAddress(type) {
if (type == 'daimai') {
this.$refs.guizePopup.open()
let that = this
this.currentConfigType = type;
this.qucan = [];
this.songcan = [];
let currentRuleList = type == 'waima' ? this.waimaRuleList : this.paotuiRuleList;
let isCanteenVal = type == 'waima' ? 1 : 2;
this.shopArea.forEach(item => {
let isGetChecked = currentRuleList.some(r => r.getAreaId == item.id);
let isPutChecked = currentRuleList.some(r => r.putAreaId == item.id);
if (item.isCanteen == isCanteenVal) {
that.qucan.push({...item, checked: isGetChecked});
} else {
that.songcan.push({...item, checked: isPutChecked});
}
});
this.$refs.guizePopup.open()
},
removeRule(type, index) {
if(type == 'waima') {
this.waimaRuleList.splice(index, 1);
} else {
this.paotuiRuleList.splice(index, 1);
}
},
submit() {
if (!this.formData.name) return uni.showToast({title: '请填写姓名', icon: 'none'});
if (!this.formData.studentCard) return uni.showToast({title: '请上传学生证', icon: 'none'});
if (!this.formData.waima && !this.formData.paotui) return uni.showToast({title: '请至少选择一种兼职类型', icon: 'none'});
if (this.formData.waima && this.waimaRuleList.length == 0) {
return uni.showToast({title: '请配置外卖规则', icon: 'none'});
}
if (this.formData.paotui && this.paotuiRuleList.length == 0) {
return uni.showToast({title: '请配置快递规则', icon: 'none'});
}
let workerRelaPriceList = [];
if (this.formData.waima) {
let invalid = this.waimaRuleList.find(item => !item.orderBkge);
if (invalid) return uni.showToast({title: '请填写外卖配送费', icon: 'none'});
workerRelaPriceList = workerRelaPriceList.concat(this.waimaRuleList);
}
if (this.formData.paotui) {
let invalid = this.paotuiRuleList.find(item => !item.orderBkge);
if (invalid) return uni.showToast({title: '请填写快递配送费', icon: 'none'});
workerRelaPriceList = workerRelaPriceList.concat(this.paotuiRuleList);
}
let submitData = {
userId: uni.getStorageSync('id'),
workerName: this.formData.name,
cardPicture: this.formData.studentCard,
highFloorFee: this.formData.highFloorFee,
workerRelaPriceList: workerRelaPriceList
};
uni.showLoading({title: '提交中...', mask: true});
this.tui.request('/app/workerRelaPrice/batchAdd', 'post', submitData).then(res => {
uni.hideLoading();
if (res.code == 200) {
uni.showToast({title: '提交成功'});
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
uni.showToast({title: res.message, icon: 'none'});
}
}).catch(err => {
uni.hideLoading();
});
},
pictureAdd() {
let that = this

Loading…
Cancel
Save