You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

671 lines
20 KiB

<template>
<!-- 兼职注册 -->
<view class="page1">
<view class="title">
<view class="title-sreach">
<view class="back-btn" @tap="back" :style="{'top': menuButtonInfo.top +'px'}">
<uni-icons type="left" size="28"></uni-icons>
</view>
</view>
</view>
<view class="content">
<view class="box1">
<view class="reg-name">
* 姓名
</view>
<view class="reg-value">
<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>
</view>
<view class="reg-value">
<img @tap="pictureAdd('mentou')"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/89d37db7e34c490da24c5dd62183bf2d.png" alt=""
style="width: 80px;height: 80px;background-size: 100%;margin-right: 10px;" />
<img @tap="largeImg" :src="formData.studentCard" alt=""
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="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="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.waima != false || formData.paotui != false">
<view class="reg-name">
* 规则配置
</view>
<view class="reg-value">
<view class="value1" v-if="formData.waima">
<view class="value-title">
<view class="title-1">
外卖规则
</view>
<view class="title-2" @tap="checkAddress('waima')">
配置规则
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="guize-list">
<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">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
{{item.putAreaName}}
</view>
</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>
<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>
</view>
<view class="value1" v-if="formData.paotui">
<view class="value-title">
<view class="title-1">
快递规则
</view>
<view class="title-2" @tap="checkAddress('paotui')">
配置规则
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="guize-list">
<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">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
{{item.putAreaName}}
</view>
</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('paotui', index)" color="#ff0000" style="margin-left:5px;"></uni-icons>
</view>
</view>
<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>
</view>
</view>
</view>
<view
style="width: 120px;height: 140px;background: rgba(166, 255, 234, 1);margin: 10px auto;border-radius: 20px;text-align: center;">
<img show-menu-by-longpress src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d23a9043a8c24731831ec4db909fe3b4.jpg" alt=""
style="width: 90px;height: 90px;margin-top: 10px;" />
<view style="height: 25px;line-height: 25px;font-weight: 700;">关注公众号</view>
</view>
<view class="btn" @click="submit">
提交注册
</view>
</view>
<!-- 查看大图弹出层 -->
<uni-popup ref="imgPopup" background-color="#fff">
<view class="img-popup-content">
<img :src="bigImg" alt="" style="width: 100%;height: 100%;">
</view>
</uni-popup>
<!-- 规则选择弹出层 -->
<uni-popup ref="guizePopup" background-color="#fff">
<view class="guize-popup-content">
<view style="margin-top: 10px;">
<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: 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.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: 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.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: 50%;transform:translateX(-50%);" @tap.stop="$refs.guizePopup.close()">
<uni-icons type="close" size="40" color="#fff"></uni-icons>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
menuButtonInfo: {},
formData: {
name: '',
highFloorFee: 0,
paotui: false,
waima: false,
studentCard: '',
},
bigImg: '',
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=" + uni.getStorageSync('worker').workerId, "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()
},
//查看大图
largeImg(img) {
this.bigImg = this.formData.studentCard;
this.$refs.imgPopup.open()
},
waimaOrpaotui(type) {
if (type == 'waima') {
this.formData.waima = !this.formData.waima
} else {
this.formData.paotui = !this.formData.paotui
}
this.$forceUpdate()
},
qucanOrsongcan(type,index){
if (type == 'qucan') {
this.qucan[index].checked = !this.qucan[index].checked
} else {
this.songcan[index].checked = !this.songcan[index].checked
}
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) {
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) {
let user = res.result;
uni.setStorageSync('officialAccountOpenid',user.officialAccountOpenid)
if(user.officialAccountOpenid == null || user.officialAccountOpenid == '' || user.officialAccountOpenid == undefined){
uni.showModal({
title: '提示',
content: '您还没有关注公众号,关注公众号后可提现佣金',
cancelText:'去关注',
confirmText:'暂时不用',
success: function (res) {
if (res.confirm) {
uni.showToast({title: '提交成功'});
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
}
});
}else{
uni.showToast({title: '提交成功'});
}
} else {
uni.showToast({title: res.message, icon: 'none'});
}
}).catch(err => {
uni.hideLoading();
});
},
pictureAdd() {
let that = this
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album'],
success(res) {
uni.showLoading({
title: '加载中...',
mask: true
})
for (let i = 0; i < res.tempFiles.length; i++) {
that.upLoadFile(res.tempFiles[i].tempFilePath)
}
}
})
},
async upLoadFile(path) {
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({
url: that.tui.interfaceUrl() + '/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let pathData = JSON.parse(uploadFileRes.data)
that.formData.studentCard = pathData.result
that.$forceUpdate()
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
await setTimeout(res => {
uni.hideLoading();
}, 1000)
},
}
}
</script>
<style lang="scss">
page {
width: 100%;
height: 100%;
font-size: 24rpx;
background: #F5F8F5;
color: #00231C;
}
.page1 {
width: 100%;
height: 100%;
font-size: 24rpx;
position: relative;
}
.title {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/461dd2d5ba1f462ca05da7e2379d1d90.png') no-repeat;
width: 100%;
height: 320px;
background-size: 100%;
}
.title-sreach {
width: 100%;
display: flex;
height: 200rpx;
position: relative;
}
.back-btn {
position: absolute;
bottom: 0;
left: 0;
}
.content {
position: absolute;
top: 225px;
width: 100%;
border-radius: 20px;
background: #fff;
padding: 8px 10px;
}
.reg-name {
font-size: 16px;
font-weight: 700;
height: 35px;
line-height: 35px;
margin-top: 10px;
}
.reg-value {
margin-top: 5px;
}
.img-popup-content {
width: 500rpx;
height: 500rpx;
}
.box-check-btn {
width: 80px;
height: 35px;
background: rgba(180, 255, 238, 0.27);
text-align: center;
line-height: 35px;
border-radius: 35px;
font-weight: 700;
border: 1px solid rgba(180, 255, 238, 1);
margin-right: 10px;
}
.value1 {
background: #eee;
border-radius: 10px;
padding: 10px;
margin-bottom: 10px;
}
.value-title {
display: flex;
height: 35px;
line-height: 35px;
font-size: 15px;
font-weight: 400;
}
.title-1 {
font-weight: 700;
}
.title-2 {
flex: 1;
color: #777;
text-align: right;
}
.guize1-qusong {
display: flex;
flex: 1;
padding-top: 10px;
}
.guize1 {
display: flex;
margin-top: 10px;
}
.qusong1 {
width: 20px;
height: 20px;
background: rgba(0, 35, 28, 1);
color: #fff;
border-radius: 20px;
text-align: center;
line-height: 20px;
font-size: 10px;
z-index: 80;
}
.qusong2 {
height: 20px;
font-size: 12px;
line-height: 19px;
text-align: center;
background: rgba(166, 255, 234, 0.5);
padding: 0 10px;
margin-left: -5px;
font-weight: 700;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
.qusong3 {
width: 95px;
height: 35px;
background: #fff;
border-radius: 5px;
padding: 5px 10px;
flex: 1;
}
.btn {
width: 95%;
height: 50px;
font-size: 16px;
font-weight: 700;
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
border-radius: 50px;
line-height: 50px;
text-align: center;
margin: 20px auto;
}
.guize-popup-content {
height: auto;
background: #fff;
padding: 20px;
border-radius: 20px;
width: 90%;
margin: 0 auto;
max-height: 430px;
overflow: scroll;
position: relative;
}
.guize-btn{
background: #00231c;
border-radius: 50px;
height: 50px;
width: 100%;
margin: 60px auto 0;
color: #b4ffee;
clear: both;
text-align: center;
line-height: 50px;
font-size:15px;
font-weight: 700
}
</style>