tianyi 1 month ago
parent
commit
a49f1e87cc
  1. 14
      pages/shop/goodsList.vue
  2. 171
      pages/shop/wallet.vue
  3. 198
      pages/worker/partTimeJobRegister.vue
  4. 142
      pages/worker/wallet.vue

14
pages/shop/goodsList.vue

@ -23,7 +23,7 @@
<scroll-view scroll-y class="content-right" lower-threshold="80" @scrolltolower="loadMore">
<view class="right-box" v-for="(item,index) in shopList" :key="index">
<view style="position: relative;display: flex;">
<view class="box-left" @tap="largeImg(item)">
<view class="box-left" @tap="largeImg(item.productPicture)">
<view v-if="(item.buyCountNew!= null && item.buyCountNew!= undefined)" style="position: absolute;left: 110rpx;color: #fff;background: red;width: 45rpx;height: 40rpx;font-size: 28rpx;text-align: center;line-height: 40rpx;border-radius: 10rpx;">
{{item.buyCountNew}}
</view>
@ -85,7 +85,7 @@
<view class="right-box" v-for="(item,index) in shopList1" :key="index">
<view style="position: relative;display: flex;">
<view class="box-left" @tap="largeImg(item)">
<view class="box-left" @tap="largeImg(item.productPicture)">
<view v-if="(item.buyCountNew!= null && item.buyCountNew!= undefined)" style="position: absolute;left: 110rpx;color: #fff;background: red;width: 45rpx;height: 40rpx;font-size: 28rpx;text-align: center;line-height: 40rpx;border-radius: 10rpx;">
{{item.buyCountNew}}
</view>
@ -410,6 +410,16 @@
}
})
},
//
largeImg(img) {
if (!img) return;
let shopImages = []
shopImages.push(img)
uni.previewImage({
current: shopImages[0],
urls: shopImages
})
},
//
clickLeftBtn(index) {
for (var i = 0; i < this.indexList.length; i++) {

171
pages/shop/wallet.vue

@ -25,7 +25,7 @@
</view>
<!-- 用户余额主卡 -->
<view class="hero-card enter-card">
<view class="hero-card enter-card" :class="{active: activeWalletType === 'shop'}" @tap="switchWallet('shop')">
<view class="hero-watermark">WALLET</view>
<view class="hero-copy">
<view class="hero-label" @tap.stop="toggleBalance">
@ -39,8 +39,7 @@
{{ showBalance ? formatMoney(currentShopBalance) : '••••' }}
</view>
<view class="hero-safe">
<text class="safe-shield">🛡</text>
<text>当前第 {{activeShopIndex + 1}} / {{shopWallets.length}} 个店铺</text>
<view class="card-today" v-if="shopWallets.length > 1">当前第 {{activeShopIndex + 1}} / {{shopWallets.length}} 个店铺</view>
</view>
</view>
<view class="withdraw-btn" @tap.stop="userCommion('shop', currentShopBalance, currentShop)">
@ -64,6 +63,7 @@
<view class="flow-tabs">
<view class="flow-tab active">余额明细</view>
</view>
<view class="flow-filter">点击不同身份查看余额明细</view>
</view>
<view class="timeline-list">
@ -93,6 +93,7 @@
<view class="bottom-space"></view>
</view>
</scroll-view>
<!-- 出层 -->
<uni-popup ref="payPopup" background-color="transparent">
<view class="withdraw-popup">
@ -102,14 +103,14 @@
<input type="text" v-model="aliName" placeholder="请输入姓名" />
</view>
<view class="popup-field">
<text>支付宝认证手机</text>
<input type="digit" v-model="aliAccount" placeholder="请输入手机号" />
<text>支付宝</text>
<input type="text" v-model.trim="aliAccount" maxlength="64" placeholder="请输入手机号或邮箱" />
</view>
<view class="popup-field">
<text>提现金额</text>
<input type="digit" v-model="commionAmount" placeholder="请输入金额" />
</view>
<view class="popup-btn" :style="{opacity: submittingWithdraw ? 0.6 : 1}" @tap="wxPayment">
<view class="popup-btn" :class="{disabled: submittingWithdraw}" :style="{opacity: submittingWithdraw ? 0.6 : 1}" @tap="wxPayment">
{{submittingWithdraw ? '提现中...' : '确认提现'}}
</view>
</view>
@ -151,6 +152,8 @@
balanceShop:[],
submittingWithdraw: false,
withdrawRequestId: '',
withdrawClickLocked: false,
withdrawClickTimer: null,
showBalance: true,
resolvingSettlementOrderId: false,
skipWalletRefreshOnShow: false,
@ -217,6 +220,7 @@
}
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
if (this.skipWalletRefreshOnShow) {
this.skipWalletRefreshOnShow = false
return
@ -231,11 +235,14 @@
this.searchForm.pageNum+=1;
this.rewardList();
},
beforeDestroy() {
if (this.withdrawClickTimer) {
clearTimeout(this.withdrawClickTimer)
}
},
methods: {
beginData(){
this.NB.sendRequest("/worker/getAllDepo/", {
userId:uni.getStorageSync('id')
}, false, 'get', 'application/json').then((res) => {
this.NB.sendRequest("/worker/getAllDepo/", {userId:uni.getStorageSync('id')}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
if(res.result.user){
this.balanceUser = res.result.user
@ -249,14 +256,10 @@
this.syncActiveWallet()
this.$forceUpdate();
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
return
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {});
})
},
//
withDraw(){
@ -265,6 +268,7 @@
})
},
userCommion(type,commion,item){
if (!this.lockWithdrawClick()) return
const withdrawAmount = Number(commion) || 0
if(type=='user'){
this.commionUrl = '/app/returnCommission/handleReturnUser'
@ -284,6 +288,25 @@
createWithdrawRequestId(){
return `${Date.now()}${Math.floor(Math.random() * 1000000)}`
},
lockWithdrawClick(){
if (this.withdrawClickLocked) return false
this.withdrawClickLocked = true
if (this.withdrawClickTimer) {
clearTimeout(this.withdrawClickTimer)
}
this.withdrawClickTimer = setTimeout(() => {
this.withdrawClickLocked = false
this.withdrawClickTimer = null
}, 800)
return true
},
closeWithdrawPopup(){
if (this.$refs.payPopup) {
this.$refs.payPopup.close()
}
this.submittingWithdraw = false
this.withdrawRequestId = ''
},
syncActiveWallet(){
if (this.targetWalletType) {
const targetIndex = this.walletTabs.findIndex(tab => tab.key === this.targetWalletType)
@ -345,56 +368,45 @@
},
wxPayment(){
let that = this
if (!this.lockWithdrawClick()) return
if (this.submittingWithdraw) {
uni.showToast({
title: '提现处理中,请勿重复提交',
icon: 'none'
});
that.tui.toast('提现处理中,请勿重复提交')
return
}
const amount = Number(this.commionAmount)
const maxAmount = Number(this.withdrawMaxAmount) || 0
if(!amount || amount < 1){
uni.showToast({
title: '提现金额不能小于1元',
icon: 'none'
});
that.tui.toast('提现金额不能小于1元')
return
}
if(amount > 5000){
uni.showToast({
title: '单笔提现金额不能超过5000元',
icon: 'none'
});
that.tui.toast('单笔提现金额不能超过5000元')
return
}
if(amount > maxAmount){
uni.showToast({
title: '提现金额不能超过可提现金额',
icon: 'none'
});
that.tui.toast('提现金额不能超过可提现金额')
return
}
const aliName = (this.aliName || '').trim()
const aliAccount = (this.aliAccount || '').trim()
if(!aliName){
that.tui.toast('支付宝实名名称不能为空')
return
}
if(!this.aliName){
uni.showToast({
title: '支付宝实名名称不能为空',
icon: 'none'
});
if(!aliAccount){
that.tui.toast('支付宝账号不能为空')
return
}
if(!this.aliAccount){
uni.showToast({
title: '支付宝手机号不能为空',
icon: 'none'
});
if(!this.isValidAliAccount(aliAccount)){
that.tui.toast('支付宝账号需为手机号或邮箱')
return
}
this.submittingWithdraw = true
let data = {
id:this.withdrawRequestId || this.createWithdrawRequestId(),
commission:amount,
aliName:this.aliName,
aliAccount:this.aliAccount
aliName:aliName,
aliAccount:aliAccount
}
if(this.commionType == 'user'){
data.userId = this.balanceUser.id
@ -403,28 +415,36 @@
}else{
data.shopId = this.shopId
}
this.NB.sendRequest(this.commionUrl, data, false, 'POST', 'application/json').then((res) => {
if (res.code == 200) {
this.$refs.payPopup.close();
this.withdrawRequestId = ''
this.beginData();
this.NB.sendRequest(this.commionUrl, data, false, 'post', 'application/json').then((res) => {
that.loadStatus = 'nomore';
const failMessage = that.getWithdrawErrorMessage(res)
if (res.code == 200 && !failMessage) {
that.closeWithdrawPopup()
that.beginData();
} else {
uni.showToast({
title: res.message,
icon: 'none'
});
that.submittingWithdraw = false
that.closeWithdrawPopup()
that.tui.toast(failMessage || '提现失败,请稍后再试', 2500)
return
}
that.submittingWithdraw = false
uni.hideLoading()
}).catch((res) => {
that.submittingWithdraw = false
uni.showToast({
title: res.message,
icon: 'none'
});
});
that.closeWithdrawPopup()
that.tui.toast(that.getWithdrawErrorMessage(res) || '提现失败,请稍后再试', 2500)
})
},
isValidAliAccount(account){
const value = (account || '').trim()
const phoneReg = /^1[3-9]\d{9}$/
const emailReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
return phoneReg.test(value) || emailReg.test(value)
},
getWithdrawErrorMessage(res){
if (!res) return ''
const message = res.message || res.msg || ''
const result = res.result || {}
const reason = result.failMessage || result.remark || message
if (res.code != 200 || res.success === false) return reason
return /失败|异常/.test(message) ? reason : ''
},
chooseLinkId(type,item){
if(type == 'user'){
@ -505,29 +525,23 @@
if (!this.canOpenShopOrder(item)) return
if (this.resolvingSettlementOrderId) return
this.resolvingSettlementOrderId = true
this.NB.sendRequest("/mall/order/orderIdBySettlementRecord/" + item.linkId, {}, false, 'GET', 'application/json').then((res) => {
if (res.code == 200) {
this.NB.sendRequest("/mall/order/orderIdBySettlementRecord/" + item.linkId, {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200 && res.result) {
this.skipWalletRefreshOnShow = true
uni.navigateTo({
url: '/pages/shop/orderDetail?id=' + res.result,
url: '/package3/shop/orderDetail?id=' + res.result,
fail: () => {
this.skipWalletRefreshOnShow = false
}
})
} else {
uni.showToast({
title: res.message || '未找到关联订单',
icon: 'none'
});
this.tui.toast(res.message || '未找到关联订单')
}
this.resolvingSettlementOrderId = false
}).catch((res) => {
uni.showToast({
title: res && res.message ? res.message : '未找到关联订单',
icon: 'none'
});
this.tui.toast(res && res.message ? res.message : '未找到关联订单')
this.resolvingSettlementOrderId = false
});
})
},
rewardList(){
this.loadStatus = 'loading'
@ -538,7 +552,7 @@
if (this.activeWalletType === 'user') {
params.excludeDealingsWay = '免单奖励'
}
this.NB.sendRequest("/mall/coupon/selectRewardByRegionId", params, false, 'POST', 'application/json').then((res) => {
this.NB.sendRequest("/mall/coupon/selectRewardByRegionId", params, false, 'post', 'application/json').then((res) => {
that.loadStatus = 'nomore';
if (res.code == 200) {
that.totalPages = res.result.pages
@ -549,14 +563,11 @@
}
that.$forceUpdate()
} else {
uni.showToast({
title: res.message,
icon: 'none'
});
that.tui.toast(res.message)
return
}
uni.hideLoading()
}).catch((res) => {});
})
},
back() {
uni.navigateBack()
@ -1377,6 +1388,10 @@
transition: transform 0.16s ease;
}
.popup-btn.disabled {
pointer-events: none;
}
/* ---------- 动画 ---------- */
.enter-card {
animation: cardIn 0.46s ease both;

198
pages/worker/partTimeJobRegister.vue

@ -24,15 +24,18 @@
<view class="box1">
<view class="reg-name">
<text style="color:red;">*</text> 学生证上传 <text
学生证上传 <text
style="font-weight: 400;color: #777;font-size: 11px;">身份信息仅用于认证身份平台会严格保密</text>
</view>
<view class="reg-value">
<image @tap="pictureAdd('mentou')"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/89d37db7e34c490da24c5dd62183bf2d.png" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;margin-right: 20rpx;" />
<image @tap="largeImg" :src="formData.studentCard" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;" />
<view class="student-card-preview" v-if="formData.studentCard">
<image @tap="largeImg" :src="formData.studentCard" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;" />
<view class="student-card-delete" @tap.stop="clearStudentCard">×</view>
</view>
</view>
</view>
<view class="box1">
@ -87,9 +90,9 @@
</view>
<view class="box1" v-if="formData.waima != false || formData.paotui != false">
<view class="reg-name rule-section-title">
<text style="color:red;">*</text> 我的赚钱地盘
<text v-if="formData.waima" style="color:red;">*</text> 我的赚钱地盘
</view>
<view class="rule-section-desc">选择愿意配送的取货点和楼栋再设置最低配送费系统只会按这些范围给你派单</view>
<view class="rule-section-desc">外卖需选择愿意配送的取货点和楼栋快递接单范围可稍后再设置</view>
<view class="reg-value">
<view class="value1" v-if="formData.waima">
<view class="value-title">
@ -150,7 +153,7 @@
<view class="rule-empty-card" v-if="paotuiRuleList.length == 0" @tap="checkAddress('paotui')">
<view class="rule-empty-icon">地盘</view>
<view class="rule-empty-title">你还没有划定快递赚钱地盘</view>
<view class="rule-empty-desc">选择快递站和宿舍楼系统才会把符合范围的快递单派给你</view>
<view class="rule-empty-desc">可先提交注册之后再选择快递站和宿舍楼来开启对应范围派单</view>
</view>
<view class="guize-list">
<view class="guize1 route-card" v-for="(item, index) in paotuiRuleList" :key="index">
@ -259,9 +262,16 @@
<view class="area-popup-title">{{currentConfigType == 'waima' ? '生成外卖接单路线' : '生成快递接单路线'}}</view>
<view class="area-popup-scroll">
<view class="area-popup-desc">选中的取货点和送达区域会两两组合生成路线新路线默认使用本弹窗填写的最低配送费和备注</view>
<view class="full-area-btn" v-if="currentConfigType == 'waima'" @tap="toggleWaimaFullAreaOrder"
:class="{'full-area-btn--active': waimaFullAreaOrder}">
{{waimaFullAreaOrder ? '已开启全域接单' : '全域接单'}}
</view>
<view class="full-area-tip" v-if="currentConfigType == 'waima' && waimaFullAreaOrder">
因校内区域较多请手动选择接送单区域
</view>
<view class="route-default-card">
<view class="route-default-row">
<view class="route-default-label">本次最低配送费</view>
<view class="route-default-label">统一设置配送费</view>
<view class="route-default-input">
<text></text>
<input type="digit" v-model="defaultRoutePrice" placeholder="如 1"
@ -422,7 +432,8 @@
dispatchSaving: false,
zhipaiCheck: false,
pendingNewDispatchRuleKeys: [],
workerNameAuditTip: ''
workerNameAuditTip: '',
waimaFullAreaOrder: false
}
},
components: {
@ -461,6 +472,15 @@
},
methods: {
getCurrentRegionId() {
try {
const area = uni.getStorageSync('area')
if (!area) return ''
return (typeof area == 'string' ? JSON.parse(area) : area).regionId || ''
} catch (e) {
return ''
}
},
formatMoneyInput(value) {
value = String(value || '');
value = value.replace(/[^\d.]/g, '');
@ -594,8 +614,9 @@
getWorkerMessage(openDispatchAfterLoad, enablePushOrderAfterLoad) {
const worker = uni.getStorageSync('worker')
if (!worker || !worker.workerId) return
const regionId = this.getCurrentRegionId()
let that = this
this.NB.sendRequest("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId, {}, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
this.NB.sendRequest("/app/workerRelaPrice/getByWorkerId?workerId=" + worker.workerId + "&regionId=" + regionId, {}, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
if (res.result != null) {
let data = res.result;
@ -642,14 +663,14 @@
uni.showToast({
title: res.message,
icon: 'none'
});
})
return
}
})
},
getShopArea() {
let that = this
this.NB.sendRequest("/app/shopArea/getByParentId/" + JSON.parse(uni.getStorageSync('area')).regionId, {}, false, 'get', 'application/x-www-form-urlencoded').then((res) => {
this.NB.sendRequest("/app/shopArea/getByParentId/" + JSON.parse(uni.getStorageSync('area')).regionId, {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
if (res.result != null) {
for (let m = 0; m < res.result.length; m++) {
@ -660,10 +681,9 @@
uni.showToast({
title: res.message,
icon: 'none'
});
})
return
}
})
},
back() {
@ -674,6 +694,10 @@
this.bigImg = this.formData.studentCard;
this.$refs.imgPopup.open()
},
clearStudentCard() {
this.formData.studentCard = ''
this.bigImg = ''
},
waimaOrpaotui(type) {
if (type == 'waima') {
this.formData.waima = !this.formData.waima
@ -701,6 +725,45 @@
})
this.$forceUpdate()
},
toggleWaimaFullAreaOrder() {
this.waimaFullAreaOrder = !this.waimaFullAreaOrder
this.buildRouteAreaOptions('waima')
},
buildRouteAreaOptions(type) {
let that = this
this.qucan = [];
this.songcan = [];
let currentRuleList = type == 'waima' ? this.waimaRuleList : this.paotuiRuleList;
let isCanteenVal = type == 'waima' ? 1 : 2;
let isFullAreaOrder = type == 'waima' && this.waimaFullAreaOrder;
this.shopArea.forEach(item => {
let isGetChecked = currentRuleList.some(r => r.getAreaId == item.id);
let isPutChecked = currentRuleList.some(r => r.putAreaId == item.id);
if (isFullAreaOrder) {
that.qucan.push({
...item,
checked: isGetChecked
});
that.songcan.push({
...item,
checked: isPutChecked
});
} else if (item.isCanteen == isCanteenVal) {
that.qucan.push({
...item,
checked: isGetChecked
});
} else {
that.songcan.push({
...item,
checked: isPutChecked
});
}
});
this.$forceUpdate()
},
closeGuize() {
let selectedQucan = this.qucan.filter(item => item.checked);
let selectedSongcan = this.songcan.filter(item => item.checked);
@ -725,6 +788,7 @@
let currentRuleList = this.currentConfigType == 'waima' ? this.waimaRuleList : this.paotuiRuleList;
let newRules = [];
let userId = uni.getStorageSync('id') || '';
let regionId = this.getCurrentRegionId();
selectedQucan.forEach(q => {
selectedSongcan.forEach(s => {
let existing = currentRuleList.find(r => r.getAreaId == q.id && r.putAreaId == s
@ -734,6 +798,7 @@
} else {
newRules.push({
workerId: "W" + userId,
regionId: regionId,
getAreaId: q.id,
getAreaName: q.title,
putAreaId: s.id,
@ -832,11 +897,12 @@
})
}
this.dispatchSaving = true
this.NB.sendRequest("/app/workerRelaPrice/batchUpdate", {
this.NB.sendRequest('/app/workerRelaPrice/batchUpdate', {
userId: uni.getStorageSync('id'),
regionId: this.getCurrentRegionId(),
workerRelaPriceList: selectRuleList,
getPushOrder: this.zhipaiCheck ? 1 : 0
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
}, false, 'post', 'application/json').then((res) => {
this.dispatchSaving = false
if (res.code == 200) {
let worker = uni.getStorageSync('worker') || {}
@ -858,35 +924,13 @@
icon: 'none'
})
}
}).catch(() => {
this.dispatchSaving = false
})
},
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.buildRouteAreaOptions(type)
this.$refs.guizePopup.open()
},
removeRule(type, index) {
@ -903,10 +947,6 @@
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'
@ -918,13 +958,6 @@
icon: 'none'
});
}
if (this.formData.paotui && this.paotuiRuleList.length == 0) {
return uni.showToast({
title: '请先划定快递赚钱地盘',
icon: 'none'
});
}
let workerRelaPriceList = [];
if (this.formData.waima) {
this.waimaRuleList.forEach(item => this.normalizeOrderBkge(item));
@ -947,8 +980,11 @@
workerRelaPriceList = workerRelaPriceList.concat(this.paotuiRuleList);
}
const regionId = this.getCurrentRegionId();
workerRelaPriceList.forEach(item => item.regionId = regionId);
let submitData = {
userId: uni.getStorageSync('id'),
regionId: regionId,
workerName: this.formData.name,
cardPicture: this.formData.studentCard,
highFloorFee: this.formatOneDecimalInput(this.formData.highFloorFee),
@ -965,7 +1001,7 @@
title: '提交中...',
mask: true
});
this.NB.sendRequest("/app/workerRelaPrice/batchAdd", submitData, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
this.NB.sendRequest("/app/workerRelaPrice/batchAdd", submitData, false, 'post', 'application/json').then((res) => {
uni.hideLoading();
if (res.code == 200) {
let user = res.result;
@ -978,7 +1014,7 @@
worker1.workerName = this.formData.name
if (hasNewRule) worker1.getPushOrder = 1
uni.setStorageSync('worker', worker1)
this.getWorkerMessage(true, hasNewRule)
this.getWorkerMessage(workerRelaPriceList.length > 0, hasNewRule)
} else {
const message = this.getResponseMessage(res, '提交失败')
if (this.isWorkerNameAuditMessage(message)) {
@ -990,7 +1026,6 @@
});
}
}
}).catch(err => {
uni.hideLoading();
const message = this.getResponseMessage(err, '提交失败,请稍后再试')
@ -1003,6 +1038,7 @@
});
}
});
},
pictureAdd() {
let that = this
@ -1088,7 +1124,7 @@
}
.back-btn {
padding-top:80rpx;
padding-top:110rpx;
}
.content {
@ -1128,6 +1164,33 @@
height: 500rpx;
}
.student-card-preview {
display: inline-block;
position: relative;
width: 160rpx;
height: 160rpx;
vertical-align: top;
}
.student-card-preview image {
display: block;
}
.student-card-delete {
position: absolute;
top: -14rpx;
right: -14rpx;
width: 36rpx;
height: 36rpx;
line-height: 34rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.65);
color: #fff;
font-size: 30rpx;
text-align: center;
z-index: 2;
}
.liangge-popup-content {
background: #fff;
border-radius: 10px;
@ -1606,6 +1669,35 @@
line-height: 36rpx;
}
.full-area-btn {
margin-top: 16rpx;
height: 70rpx;
line-height: 70rpx;
border-radius: 70rpx;
background: rgba(247, 248, 248, 0.9);
border: 1px solid rgba(0, 35, 28, 0.12);
color: #00624f;
font-size: 26rpx;
font-weight: 900;
text-align: center;
}
.full-area-btn--active {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
border-color: rgba(166, 255, 234, 1);
color: #00231C;
}
.full-area-tip {
margin-top: 12rpx;
padding: 16rpx 18rpx;
border-radius: 18rpx;
background: rgba(255, 244, 214, 0.8);
color: #9A5A00;
font-size: 24rpx;
line-height: 34rpx;
}
.area-popup-scroll {
flex: 1;
min-height: 0;

142
pages/worker/wallet.vue

@ -25,7 +25,7 @@
</view>
<!-- 用户余额主卡 -->
<view class="hero-card enter-card">
<view class="hero-card enter-card" :class="{active: activeWalletType === 'worker'}" @tap="switchWallet('worker')">
<view class="hero-watermark">WALLET</view>
<view class="hero-copy">
<view class="hero-label" @tap.stop="toggleBalance">
@ -39,8 +39,7 @@
{{ showBalance ? formatMoney(balanceWorker.depoBalRel) : '••••' }}
</view>
<view class="hero-safe">
<text class="safe-shield">🛡</text>
<text>今日佣金{{ showBalance ? formatMoney(balanceWorker.depoBal) : '••••' }}<text>次日可提现</text> </text>
今日佣金{{ showBalance ? formatMoney(balanceWorker.depoBal) : '••••' }}<text>次日可提现</text>
</view>
</view>
<view class="withdraw-btn" @tap.stop="userCommion('worker', balanceWorker.depoBalRel, balanceWorker)">
@ -104,14 +103,14 @@
<input type="text" v-model="aliName" placeholder="请输入姓名" />
</view>
<view class="popup-field">
<text>支付宝认证手机</text>
<input type="digit" v-model="aliAccount" placeholder="请输入手机号" />
<text>支付宝</text>
<input type="text" v-model.trim="aliAccount" maxlength="64" placeholder="请输入手机号或邮箱" />
</view>
<view class="popup-field">
<text>提现金额</text>
<input type="digit" v-model="commionAmount" placeholder="请输入金额" />
</view>
<view class="popup-btn" :style="{opacity: submittingWithdraw ? 0.6 : 1}" @tap="wxPayment">
<view class="popup-btn" :class="{disabled: submittingWithdraw}" :style="{opacity: submittingWithdraw ? 0.6 : 1}" @tap="wxPayment">
{{submittingWithdraw ? '提现中...' : '确认提现'}}
</view>
</view>
@ -153,6 +152,8 @@
balanceShop:[],
submittingWithdraw: false,
withdrawRequestId: '',
withdrawClickLocked: false,
withdrawClickTimer: null,
showBalance: true,
resolvingSettlementOrderId: false,
skipWalletRefreshOnShow: false,
@ -219,7 +220,7 @@
}
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
if (this.skipWalletRefreshOnShow) {
this.skipWalletRefreshOnShow = false
return
@ -234,11 +235,14 @@
this.searchForm.pageNum+=1;
this.rewardList();
},
beforeDestroy() {
if (this.withdrawClickTimer) {
clearTimeout(this.withdrawClickTimer)
}
},
methods: {
beginData(){
this.NB.sendRequest("/worker/getAllDepo/", {
userId:uni.getStorageSync('id')
}, false, 'get', 'application/json').then((res) => {
this.NB.sendRequest("/worker/getAllDepo/", {userId:uni.getStorageSync('id')}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
if(res.result.user){
this.balanceUser = res.result.user
@ -256,10 +260,9 @@
title: res.message,
icon: 'none'
})
return
}
uni.hideLoading()
}).catch((res) => {});
})
},
//
withDraw(){
@ -268,6 +271,7 @@
})
},
userCommion(type,commion,item){
if (!this.lockWithdrawClick()) return
const withdrawAmount = Number(commion) || 0
if(type=='user'){
this.commionUrl = '/app/returnCommission/handleReturnUser'
@ -287,6 +291,25 @@
createWithdrawRequestId(){
return `${Date.now()}${Math.floor(Math.random() * 1000000)}`
},
lockWithdrawClick(){
if (this.withdrawClickLocked) return false
this.withdrawClickLocked = true
if (this.withdrawClickTimer) {
clearTimeout(this.withdrawClickTimer)
}
this.withdrawClickTimer = setTimeout(() => {
this.withdrawClickLocked = false
this.withdrawClickTimer = null
}, 800)
return true
},
closeWithdrawPopup(){
if (this.$refs.payPopup) {
this.$refs.payPopup.close()
}
this.submittingWithdraw = false
this.withdrawRequestId = ''
},
syncActiveWallet(){
if (this.targetWalletType) {
const targetIndex = this.walletTabs.findIndex(tab => tab.key === this.targetWalletType)
@ -348,11 +371,12 @@
},
wxPayment(){
let that = this
if (!this.lockWithdrawClick()) return
if (this.submittingWithdraw) {
uni.showToast({
title: '提现处理中,请勿重复提交',
icon: 'none'
});
})
return
}
const amount = Number(this.commionAmount)
@ -361,43 +385,52 @@
uni.showToast({
title: '提现金额不能小于1元',
icon: 'none'
});
})
return
}
if(amount > 5000){
uni.showToast({
title: '单笔提现金额不能超过5000元',
icon: 'none'
});
})
return
}
if(amount > maxAmount){
uni.showToast({
title: '提现金额不能超过可提现金额',
icon: 'none'
});
})
return
}
if(!this.aliName){
const aliName = (this.aliName || '').trim()
const aliAccount = (this.aliAccount || '').trim()
if(!aliName){
uni.showToast({
title: '支付宝实名名称不能为空',
icon: 'none'
});
})
return
}
if(!this.aliAccount){
if(!aliAccount){
uni.showToast({
title: '支付宝手机号不能为空',
title: '支付宝号不能为空',
icon: 'none'
});
})
return
}
if(!this.isValidAliAccount(aliAccount)){
uni.showToast({
title: '支付宝账号需为手机号或邮箱',
icon: 'none'
})
return
}
this.submittingWithdraw = true
let data = {
id:this.withdrawRequestId || this.createWithdrawRequestId(),
commission:amount,
aliName:this.aliName,
aliAccount:this.aliAccount
aliName:aliName,
aliAccount:aliAccount
}
if(this.commionType == 'user'){
data.userId = this.balanceUser.id
@ -406,28 +439,43 @@
}else{
data.shopId = this.shopId
}
this.NB.sendRequest(this.commionUrl, data, false, 'POST', 'application/json').then((res) => {
if (res.code == 200) {
this.$refs.payPopup.close();
this.withdrawRequestId = ''
this.beginData();
this.NB.sendRequest(this.commionUrl, data, false, 'post', 'application/json').then((res) => {
that.loadStatus = 'nomore';
const failMessage = that.getWithdrawErrorMessage(res)
if (res.code == 200 && !failMessage) {
that.closeWithdrawPopup()
that.beginData();
} else {
that.closeWithdrawPopup()
uni.showToast({
title: res.message,
title: failMessage || '提现失败,请稍后再试',
icon: 'none'
});
that.submittingWithdraw = false
})
return
}
that.submittingWithdraw = false
uni.hideLoading()
}).catch((res) => {
that.submittingWithdraw = false
that.closeWithdrawPopup()
uni.showToast({
title: res.message,
title: that.getWithdrawErrorMessage(res) || '提现失败,请稍后再试',
icon: 'none'
});
});
})
})
},
isValidAliAccount(account){
const value = (account || '').trim()
const phoneReg = /^1[3-9]\d{9}$/
const emailReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
return phoneReg.test(value) || emailReg.test(value)
},
getWithdrawErrorMessage(res){
if (!res) return ''
const message = res.message || res.msg || ''
const result = res.result || {}
const reason = result.failMessage || result.remark || message
if (res.code != 200 || res.success === false) return reason
return /失败|异常/.test(message) ? reason : ''
},
chooseLinkId(type,item){
if(type == 'user'){
@ -508,11 +556,11 @@
if (!this.canOpenShopOrder(item)) return
if (this.resolvingSettlementOrderId) return
this.resolvingSettlementOrderId = true
this.NB.sendRequest("/mall/order/orderIdBySettlementRecord/" + item.linkId, {}, false, 'GET', 'application/json').then((res) => {
if (res.code == 200) {
this.NB.sendRequest("/mall/order/orderIdBySettlementRecord/" + item.linkId, {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200 && res.result) {
this.skipWalletRefreshOnShow = true
uni.navigateTo({
url: '/pages/shop/orderDetail?id=' + res.result,
url: '/package3/shop/orderDetail?id=' + res.result,
fail: () => {
this.skipWalletRefreshOnShow = false
}
@ -521,16 +569,16 @@
uni.showToast({
title: res.message || '未找到关联订单',
icon: 'none'
});
})
}
this.resolvingSettlementOrderId = false
}).catch((res) => {
uni.showToast({
title: res && res.message ? res.message : '未找到关联订单',
icon: 'none'
});
})
this.resolvingSettlementOrderId = false
});
})
},
rewardList(){
this.loadStatus = 'loading'
@ -541,7 +589,7 @@
if (this.activeWalletType === 'user') {
params.excludeDealingsWay = '免单奖励'
}
this.NB.sendRequest("/mall/coupon/selectRewardByRegionId", params, false, 'POST', 'application/json').then((res) => {
this.NB.sendRequest("/mall/coupon/selectRewardByRegionId", params, false, 'post', 'application/json').then((res) => {
that.loadStatus = 'nomore';
if (res.code == 200) {
that.totalPages = res.result.pages
@ -555,11 +603,11 @@
uni.showToast({
title: res.message,
icon: 'none'
});
})
return
}
uni.hideLoading()
}).catch((res) => {});
})
},
back() {
uni.navigateBack()
@ -1380,6 +1428,10 @@
transition: transform 0.16s ease;
}
.popup-btn.disabled {
pointer-events: none;
}
/* ---------- 动画 ---------- */
.enter-card {
animation: cardIn 0.46s ease both;

Loading…
Cancel
Save