tianyi 5 days ago
parent
commit
6c8587c366
  1. 17
      pages/index/index.vue
  2. 48
      pages/login/login.vue
  3. 553
      pages/shop/shopReturnOrder.vue
  4. 4
      pages/shop/transferDeliveryOrderList.vue
  5. 785
      pages/worker/index.vue
  6. 15
      pages/worker/partTimeJobCenter.vue

17
pages/index/index.vue

@ -280,12 +280,17 @@
this.indexInit()
},
onLoad() {
if(uni.getStorageSync('peisongyuan')){
uni.reLaunch({
url: '../worker/index'
})
return
}
},
methods: {
indexInit() {
let that = this
this.shopConfig = JSON.parse(uni.getStorageSync('area')).shop || {}
this.shopConfig = JSON.parse(uni.getStorageSync('area')) || {}
uni.getSystemInfo({
success: function(info) {
@ -336,8 +341,8 @@
}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shop = res.result
this.shop.shopIcon = JSON.parse(uni.getStorageSync('area')).shop.shopIcon
this.shop.shopName = JSON.parse(uni.getStorageSync('area')).shop.shopName
this.shop.shopIcon = JSON.parse(uni.getStorageSync('area')).shopIcon
this.shop.shopName = JSON.parse(uni.getStorageSync('area')).shopName
this.businessStatus = res.result.status
} else {
uni.showToast({
@ -352,10 +357,8 @@
uni.setStorageSync('shopId', item.shop.id)
uni.setStorageSync('shopMerchantType', item.shop.merchantType)
uni.setStorageSync('area', JSON.stringify(item))
console.log('1111111111111111',uni.getStorageSync('shopMerchantType'))
this.getBusinessStatus()
this.getData()
this.$refs.areaPopup.close()
},
//
@ -417,7 +420,7 @@
url = '/pages/shop/transferDeliveryOrderList'
break;
case 'tui':
url = '/pages/shop/shopReturnOrder?type=shop'
url = '/pages/shop/afterService?type=shop'
break;
case 'zd':
url = '/pages/shop/shopBill'

48
pages/login/login.vue

@ -58,7 +58,7 @@
<view class="popup-area-title">
<text>选择登录店铺</text>
</view>
<view class="popup-area-container" v-for="item in shopList" :key="item" @tap="checkShop(item)">
<view class="popup-area-container" v-for="(item,index) in shopList" :key="index" @tap="checkShop(item)">
<text style="display: inline-block">{{item.shopName}}</text>
</view>
</view>
@ -329,25 +329,25 @@
uni.getSystemInfo({
success: function (res1) {
that.NB.sendRequest('/auth/chooseShop', {
shopId: item.shop.id,
shopId: item.id,
deviceId:res1.deviceId
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
uni.setStorageSync('type',item.type)
uni.setStorageSync('warehouseKeeperFlag',item.warehouseKeeperFlag)
uni.setStorageSync('shopId',item.shop.id)
uni.setStorageSync('shopId',item.id)
uni.setStorageSync('shopName',item.shopName)
uni.setStorageSync('storeFlag',item.storeFlag)
uni.setStorageSync('shopIcon',res.result.shopIcon)
uni.setStorageSync('shopAddress',res.result.shopAddress)
uni.setStorageSync('shopRemark',res.result.remark)
uni.setStorageSync('shopScore',item.shop.shopScore)
uni.setStorageSync('shopMerchantType', item.shop.merchantType)
uni.setStorageSync('shopScore',item.shopScore)
uni.setStorageSync('shopMerchantType', item.merchantType)
uni.setStorageSync("shopOwnerPhone", item.shopOwnerPhone)
uni.setStorageSync('schoolShop',res.result.shop)
uni.setStorageSync('schoolShop',res.result.shop)
uni.setStorageSync('shopTakeaway',item.shopTakeaway)
uni.setStorageSync('attrId',item.shop.attrId)
uni.setStorageSync('attrId',item.attrId)
uni.setStorageSync('area',JSON.stringify(item))
uni.setStorageSync("isShop",true)
setTimeout(() => {
@ -412,17 +412,43 @@
that.NB.sendRequest(url, data, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code !== 200) return
uni.setStorageSync("hiver_token", res.result.accessToken)
if (res.result.accessToken) uni.setStorageSync('hiver_token', res.result.accessToken)
if (res.result.worker !== undefined) uni.setStorageSync('worker', res.result.worker)
uni.setStorageSync("wayValue", this.wayValue)
uni.setStorageSync("nickname", res.result.user.nickname)
uni.setStorageSync('username',this.mobile)
if (res.result.shopList.length > 1) {
this.shopList = res.result.shopList;
if (res.result.shop !== undefined) uni.setStorageSync('schoolShop', res.result.shop)
if (res.result.waimaiData !== undefined) uni.setStorageSync('waimaiData', res.result.waimaiData)
if (res.result.kuaidiData !== undefined) uni.setStorageSync('kuaidiData', res.result.kuaidiData)
if (res.result.user) {
uni.setStorageSync('nickname', res.result.user.nickname)
uni.setStorageSync('id', res.result.user.id)
uni.setStorageSync('unionid', res.result.user.unionid)
uni.setStorageSync('miniProgramOpenid', res.result.user.miniProgramOpenid)
uni.setStorageSync('officialAccountOpenid', res.result.user.officialAccountOpenid)
if (res.result.user.mobile) {
uni.setStorageSync('mobile', res.result.user.mobile)
}
}
// uni.setStorageSync('area',JSON.stringify(item))
this.shopList = res.result.shop;
let data = {
id:res.result.worker.region
}
uni.setStorageSync('area',JSON.stringify(data))
uni.setStorageSync('peisongyuan',this.peisongyuan)
if(this.peisongyuan){
uni.reLaunch({
url: '../worker/index'
})
return
}
console.log('111111111111111111111',res)
if (this.shopList.length > 1) {
this.toggle("center");
}else{
this.checkShop(res.result.shopList[0])
this.checkShop(this.shopList[0])
}
})

553
pages/shop/shopReturnOrder.vue

@ -1,553 +0,0 @@
<template>
<view class="page1">
<view class="title">
<view class="title-sreach">
<view class="back-btn" @tap="back">
<uni-icons type="left" size="28"></uni-icons>
</view>
<view class="title-name">
待退款/售后{{returnCount}}
</view>
</view>
</view>
<view class="content">
<!-- <view class="box1" style="display: flex;">
<view class="">
待退款/售后{{returnCount}}
</view>
</view> -->
<view class="box1" v-for="(item,index) in returnData" :key="index">
<view style="display: flex;height: 50rpx;border-bottom: 1px solid #eee;">
<view style="display: flex;">
{{'#' + item.mallOrder.numberCode}}
</view>
<view style="flex: 1;display: flex;padding-left: 20rpx;">
{{item.createTime | formatISOTime}}
<!-- <text>已退款</text> -->
</view>
<view>
{{item.status == 0?'待退款':item.status == 3?'待售后':""}}
</view>
</view>
<view style="height: 180rpx;padding-top: 20rpx;color: #777;">
<view style="height: 50rpx;line-height: 50rpx;font-size: 28rpx;">
<view>退款原因: <text style="font-weight: 700;color:#00231C;">{{item.refundTypeStatus == 1?'商家原因':item.refundTypeStatus == 2?'配送原因':item.refundTypeStatus == 3?'商家/配送都有原因(需要退配送费)':item.refundTypeStatus == 4?'平台退款':""}}</text></view>
<view>退款类型: <text style="font-weight: 700;color:#00231C;">{{item.refundType == 1?'退商品':item.refundType == 2?'退配送费':item.refundType == 3?'全额退款':""}}</text></view>
<view style="text-align: right;">退款金额: <text style="color:red;font-size: 34rpx;font-weight: 700;">{{item.refundAmount}}</text></view>
</view>
</view>
<view style="height: 80rpx;border-top: 1px solid #eee;display: flex;">
<view style="flex: 1;">
<view class="btn" @tap="orderDetailOpen(item)" style="display: inline-block;">
查看订单
</view>
</view>
<view class="btn" @tap="returnAmountAllow(item,0)" style="background: rgba(0, 35, 28, 1);color: rgba(166, 255, 234, 1);">
不同意
</view>
<view class="btn" @tap="returnAmountAllow(item,1)" style="margin-left: 10px;">
同意
</view>
</view>
</view>
<uni-popup ref="orderPopup" background-color="#fff">
<view class="popup-area-content" style="height: 1200rpx;overflow: scroll;">
<view class="popup-area-title">
<text>订单详情</text>
</view>
<view class="box1">
<view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;">
{{orderDetail.shopName}}
<img @tap="makeCall(orderDetail.shopPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
alt="" style="width: 60rpx;height: 60rpx;" />
</view>
<view v-for="(item1,index1) in goodsList" :key="index1" v-if="goodsList != null && goodsList.length > 0" style="display: flex;padding: 20rpx;background: #eee;border-radius: 20rpx;">
<view class="goods-img">
<img :src="item1.productPicture" alt="">
</view>
<view class="goods-content">
<view class="goods-name">
{{item1.productName}}
</view>
<view class="goods-content-center">
<view class="goods-deal1">
{{item1.specs}}
</view>
</view>
<view class="goods-content-bottom">
<view style="width: 50%;">
X{{item1.quantity}}
</view>
<view class="pintuan-left-price">
{{item1.price}}
</view>
</view>
</view>
</view>
<view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.packageFee != null && orderDetail.packageFee > 0">
<view style="flex: 1;color: #777;font-weight: 700;">
打包费
</view>
<view style="color: #000;font-weight:700;">
{{orderDetail.packageFee}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1">
<view style="flex: 1;color: #777;font-weight: 700;">
配送费
</view>
<view style="color: #000;font-weight:700;">
{{orderDetail.deliveryFee}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;">
<view style="flex: 1;color: #777;font-weight: 700;">
优惠券
</view>
<view style="color: #000;font-weight:700;">
-1 <uni-icons type="right" size="12"></uni-icons>
</view>
</view>
</view>
<view style="display: flex;height: 80rpx;line-height: 100rpx;border-top: 1px solid #eee;font-size: 32rpx;font-weight: 700;">
<view style="flex: 1;">
实付
</view>
<view class="">
{{orderDetail.totalAmount}}
</view>
</view>
</view>
<view class="box1">
<view>
<!-- <view style="height: 80rpx;line-height: 80rpx;display: flex;">
<view style="flex: 1;color: #777;font-weight: 700;">
收件地址
</view>
<view style="color: #000;font-weight: 700;">
北校区1号宿舍楼5楼512(0702)
</view>
</view> -->
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.numberCode != null">
<view style="flex: 1;color: #777;font-weight: 700;">
订单号
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.numberCode}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;">
<view style="flex: 1;color: #777;font-weight: 700;">
下单时间
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.createTime | formatISOTime}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.shopMakeTime != null">
<view style="flex: 1;color: #777;font-weight: 700;">
商家出餐时间
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.shopMakeTime ? orderDetail.shopMakeTime : '' | formatISOTime}}
</view>
</view>
</view>
</view>
<view class="popup-area-container" v-for="(item,index) in productData" :key="index">
<text style="display: inline-block">{{item.productName}} {{item.specs}} * {{item.quantity}}</text>
</view>
</view>
</uni-popup>
<!-- 拼团详情弹窗 -->
<uni-popup ref="pintuanPopup" background-color="#fff">
<view class="guize-list">
<view v-for="(item,index) in tuanzhangOrder" :key="index">
<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;">
订单-{{item.numberCode}}
</view>
<view class="">
<view class="dingdan">
<view style="display:flex">
<view style="width:300rpx;">
订单状态
</view>
<view class="pituan-text">
{{item.status == 0?'待支付':item.status == 2?'待配送员接单':(item.status == 3 && item.deliveryType == 1 && item.shopMakeTime == null) || (item.status == 3 && item.deliveryType == 2 && item.userRequireMake == 1)?'待出餐':(item.status == 3 && item.deliveryType == 1 && item.shopMakeTime != null)?'待取货':(item.status == 3 && item.deliveryType == 2)?'待消费':item.status == 4?'待送达':item.status == 5?'已完成':item.status == 7?'待同意退款':item.status == 8?'已退款':item.status == 6?'已取消':item.status == 11?'售后中':item.status == 12?'已售后':""}}
</view>
</view>
<view style="display:flex">
<view style="width:300rpx;">
订单号
</view>
<view class="pituan-text">
{{item.id}}
</view>
</view>
<view style="display:flex">
<view style="width:300rpx;">
订单时间
</view>
<view class="pituan-text">
{{item.createTime | formatISOTime}}
</view>
</view>
</view>
<view class="dingdan" v-for="(item1,index1) in item.goodsList" :key="index1">
<view class="pt-title">
商品信息
</view>
<view style="display: flex;font-weight: 700;">
<view style="flex:1">
商品名{{item1.productName}}
</view>
<view style="width:100rpx;">
X{{item1.quantity}}
</view>
<view style="width:220rpx;text-align: right;padding-right:20rpx;">
{{item1.price}}
</view>
</view>
</view>
<view class="dingdan">
<view style="text-align: right;padding-right: 20rpx;color: #777;">
餐盒费{{item.packageFee}} 配送费{{item.deliveryFee}}
</view>
<view style="text-align: right;padding-right: 20rpx;font-size: 28rpx;font-weight: 700;color: red;">
总计{{item.totalAmount}}
</view>
</view>
</view>
</view>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
export default {
data() {
return {
searchCountForm:{
linkId:uni.getStorageSync('worker').workerId,
pageNum:1,
pageSize:100,
statusList:[0,3]
},
type:'worker',
returnFormData:{},
groupOrderIdList:[],
tuanzhangOrder:[],
goodsList:[],
orderDetail:{},
returnData:[],
returnCount:0
}
},
filters:{
formatISOTime(isoString) {
const date = new Date(isoString);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
},
onShow() {
this.searchCountForm.linkId = uni.getStorageSync('worker').workerId
},
onLoad(option) {
if(option.type){
this.type = option.type
}
this.getReturnCount()
},
methods: {
getGroupOrders(id){
this.NB.sendRequest("/mall/order/selectAllOrderByOrderId/"+id, {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.tuanzhangOrder = res.result;
this.$refs.pintuanPopup.open('bottom')
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
orderDetailOpen(item){
this.returnFormData.id = item.id;
this.returnFormData.linkId = item.linkId;
this.returnFormData.orderId = item.orderId;
this.returnFormData.deliveryType = item.mallOrder.deliveryType;
this.returnFormData.refundAmount = item.refundAmount;
this.returnFormData.refundType = item.refundType;
this.returnFormData.refundTypeStatus = item.refundTypeStatus;
this.orderDetail = item.mallOrder;
this.goodsList = item.items;
this.$refs.orderPopup.open();
},
makeCall(phone){
uni.makePhoneCall({
phoneNumber: phone
});
},
getReturnCount(){
let that = this
if(this.type == 'worker'){
this.searchCountForm.linkId = uni.getStorageSync('worker').workerId
}else{
this.searchCountForm.linkId = uni.getStorageSync('shopId')
}
this.NB.sendRequest("/mall/refund/page", this.searchCountForm, false, 'POST', 'application/json').then((res) => {
if (res.code == 200) {
that.returnCount = res.result.records.length;
that.returnData = res.result.records
that.$forceUpdate();
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
returnAmountAllow(item,status){
let titleText = status == 1 ? '确定同意该申请吗?' : '确定拒绝该申请吗?';
//退
if(item.groupOrderIds != null && item.groupOrderIds != ''){
titleText += '该订单为面对面配送单,所有参团订单将同步处理';
for(let i = 0; i < this.returnData.length;i++){
if(item.groupOrderIds.indexOf(this.returnData[i].mallOrder.id) != -1){
//
this.groupOrderIdList.push(this.returnData[i]);
}
}
}else{
this.groupOrderIdList = []
}
// 2.
uni.showModal({
title: '提示',
content: titleText,
success: (res) => {
if (res.confirm) {
if(this.groupOrderIdList != [] && this.groupOrderIdList.length > 0){
for(let i = 0; i < this.groupOrderIdList.length;i++){
this.processReturn(this.groupOrderIdList[i], status);
}
}else{
this.processReturn(item, status);
}
}
}
});
},
processReturn(item,status){
let url = ''
//退
if(item.status == 0){
//
if(status == 0){
this.returnFormData.status = 2
}else{
this.returnFormData.status = 1
}
}else if(item.status == 3){
//
if(status == 0){
this.returnFormData.status = 5
}else{
this.returnFormData.status = 4
}
}
this.returnFormData.id = item.id;
this.returnFormData.linkId = item.linkId;
this.returnFormData.orderId = item.orderId;
this.returnFormData.deliveryType = item.mallOrder.deliveryType;
this.returnFormData.orderType = item.mallOrder.orderType;
this.returnFormData.refundAmount = item.refundAmount;
this.returnFormData.refundType = item.refundType;
this.returnFormData.refundTypeStatus = item.refundTypeStatus;
let that = this
this.NB.sendRequest("/mall/refund/allowOrReject", this.returnFormData, false, 'POST', 'application/json').then((res) => {
if (res.code == 200) {
uni.showToast({
title: res.message,
icon: 'none'
})
this.getReturnCount()
that.$forceUpdate();
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
back() {
uni.navigateBack()
},
}
}
</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/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
width: 100%;
height: 20%;
}
.title-sreach {
width: 100%;
display: flex;
height: 200rpx;
position: relative;
}
.back-btn {
padding-top: 110rpx;
}
.title-name {
padding-top: 110rpx;
font-size: 36rpx;
font-weight: 700;
flex: 1;
text-align: center;
}
.content{
margin: -100rpx auto;
}
.box1 {
width: 95%;
margin: 20rpx auto;
background: #fff;
border-radius: 20rpx;
padding: 20rpx;
}
.btn{
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
padding:0 20rpx;
height: 50rpx;
border-radius: 14rpx;
line-height: 50rpx;
text-align: center;
font-weight: 700;
margin-top: 20rpx;
}
.popup-area-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-area-content {
align-items: center;
justify-content: center;
padding: 30rpx;
width: 500rpx;
height: auto;
background-color: #fff;
}
.goods-img {
width: 160rpx;
height: 160rpx;
position: relative;
img {
width: 100%;
background-size: 100%;
height: 100%;
border-radius: 20rpx;
}
}
.pinzi{
margin: 20rpx 0;
background: linear-gradient(90deg, #FF4500, #FFA07A);
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
border-radius: 10rpx;
color: #fff;
}
.goods-content {
flex: 1;
padding-left: 20rpx;
}
.goods-name {
font-size: 32rpx;
font-weight: 900;
}
.goods-content-center {
display: flex;
margin: 16rpx 0;
color: #777;
}
.guize-list {
width: 100%;
padding: 20rpx;
overflow: scroll;
background: #fff;
max-height: 1000rpx;
line-height: 25px;
}
.pt-title{
font-size: 28rpx;
font-weight: 700;
color: #777;
}
.dingdan{
border-top: 1px solid #eee;
}
.uni-popup__wrapper{
border-radius: 20rpx !important;
}
.pituan-text{
flex:1;
text-align:right;
padding-right:20rpx;
font-weight: 700;
}
</style>

4
pages/shop/transferDeliveryOrderList.vue

@ -69,9 +69,9 @@
this.totalPages = 1
this.list = []
this.loadStatus = 'more'
this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).shop.id
this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).id
const area = uni.getStorageSync('area')
this.searchForm.regionId = area ? JSON.parse(area).shop.regionId : ''
this.searchForm.regionId = area ? JSON.parse(area).regionId : ''
this.getList()
},
loadMore() {

785
pages/worker/index.vue

@ -204,7 +204,7 @@
<view class="delivery-list-wrap">
<view class="empty-delivery" v-if="deliveryItem">
<view class="empty-delivery" v-if="deliveryItem.length <= 0">
<view class="empty-delivery-icon">校园</view>
<view class="empty-delivery-title">暂时没有可抢订单</view>
<view class="empty-delivery-desc">可以切换分类或调整筛选条件新的校园订单会在这里出现</view>
@ -725,6 +725,7 @@
return {
isOnLine: 1,
bigImg: '',
adList:[],
zhipaiCheck: false,
tab1Checked: 'dating',
scrollTop: 0,
@ -732,17 +733,25 @@
isLoadingPage: false,
scrollViewHeight: 0,
isArea: false,
latitude: 39.909, //
longitude: 116.39742, //
latitude: 39.909,
longitude: 116.39742,
searchForm: {
status: 1,
hallOnly: true,
status: 0,
pageNum: 1,
pageSize: 10,
pageSize:10,
getAreaId: '',
putAreaId: '',
paths: ['home_top', 'home_center_left_top', 'home_center_left_bottom', 'home_center_right_top',
'home_center_right_bottom'
],
order: '',
returnOrderLast: 1,
regionId: '',
deliveryType: null,
workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
userId: uni.getStorageSync('id') || '',
deliveryType: 1,
waimaiData: [],
workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '',
kuaidiData: []
},
menuButtonInfo: {
top: 44
@ -825,7 +834,7 @@
}
},
onShow() {
this.runHomeInit()
this.indexInit()
if (this.pendingTabIndex !== null) {
const tabIndex = this.pendingTabIndex
const shouldShowDeliveryRuleConfirm = this.pendingDeliveryRuleConfirm && tabIndex == 1
@ -890,73 +899,32 @@
filters: {
formatHourMinute(value) {
if (!value) return '';
const date = new Date(value);
// (getDate)0
const day = String(date.getDate()).padStart(2, '0');
// (getHours)0
const hour = String(date.getHours()).padStart(2, '0');
// (getMinutes)0
const minute = String(date.getMinutes()).padStart(2, '0');
// --:
return `${hour}:${minute}`;
},
delNode(data) {
// 1.
let str;
if (typeof data === 'object' && data !== null) {
// JSON
str = JSON.stringify(data);
} else if (typeof data === 'string') {
str = data;
} else {
//
str = String(data);
}
// 2. { } "
const result = str.replace(/[{}"]/g, '');
return result;
},
delPlus(data){
if (data.endsWith("+")) {
data = data.slice(0, -1); //
data = data.slice(0, -1);
}
return data;
}
},
methods: {
init() {
if (!this.ensureLogin()) return
let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) {
uni.showToast({
title: '您还没有注册兼职',
icon: 'none'
});
return
}
this.isOnLine = uni.getStorageSync('worker').isOnLine
this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
if (uni.getStorageSync('area')) {
this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
}
if (uni.getStorageSync('worker')) {
this.searchForm.workerId = uni.getStorageSync('worker').workerId
}
this.$forceUpdate()
this.loadWorkerRules()
this.getDelivery()
this.$nextTick(() => {
this.measureScrollView()
})
},
getPickupPictures(item) {
const pictures = item && item.getPictures
if (!pictures) return []
@ -976,22 +944,6 @@
}
return []
},
runHomeInit() {
//
this.indexInit()
this.$nextTick(() => {
this.refreshDaimaiStickyPosition()
})
},
refreshDaimaiStickyPosition() {
const query = uni.createSelectorQuery().in(this);
query.select('#menuList').boundingClientRect(rect => {
if (rect) {
this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0);
this.stickyTrigger = Math.max(360, this.menuListOffsetTop - this.navBarHeight - 46);
}
}).exec();
},
goMyCenter(){
uni.navigateTo({
url: '/pages/worker/partTimeJobCenter'
@ -1071,27 +1023,16 @@
&& Date.now() - Number(cacheItem.savedAt || 0) < HOME_AD_IMAGE_CACHE_TTL
&& this.isSavedFileExists(cacheItem.path))
},
//
getUserOrders() {
let that = this
this.NB.sendRequest("/mall/order/getOrdersByUserId/" + uni.getStorageSync('id'), {}, true, 'GET', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
if (res.result != null) {
that.orderLists = res.result
that.$forceUpdate()
}
} else {
uni.showToast({
title: res.message,
icon: 'none'
});
return
}
uni.hideLoading()
})
},
indexInit() {
let that = this
if (!this.ensureLogin()) return
this.isOnLine = uni.getStorageSync('worker').isOnLine
this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
this.loadWorkerRules()
this.$nextTick(() => {
this.measureScrollView()
})
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
@ -1104,9 +1045,7 @@
that.searchForm.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
//
// this.getUserLocation();
if(uni.getStorageSync('hiver_token')){
this.getUserOrders();
}
if (!uni.getStorageSync('area')) {
this.checkArea()
} else {
@ -1143,10 +1082,9 @@
}
this.searchForm.waimaiData = this.waimailistData;
this.searchForm.kuaidiData = [];
this.getDelivery();
this.getDaTing();
this.getShopArea();
}
// sticky offsetstatusBarHeight + 40px
const info = uni.getSystemInfoSync();
this.navBarHeight = info.statusBarHeight;
this.swipeOrderBaseWidth = info.windowWidth * 0.86;
@ -1307,7 +1245,7 @@
this.searchForm.order = ''
}
this.resetDeliveryQuery()
this.getDelivery();
this.getDaTing();
},
clearCheck() {
this.checkYongjin = false
@ -1317,7 +1255,7 @@
this.searchForm.putAreaId = ""
this.searchForm.order = ""
this.resetDeliveryQuery()
this.getDelivery()
this.getDaTing()
this.$forceUpdate()
},
resetDeliveryQuery() {
@ -1350,14 +1288,12 @@
if (!uni.getStorageSync('worker') && res.result != null) {
this.$refs.tishiPopup.open()
uni.setStorageSync('worker', res.result)
that.$refs.tabBar.indexWorkerCount ++
}else{
if(res.message == '接单成功'){
uni.showToast({
title: res.message,
icon: 'none'
});
that.$refs.tabBar.indexWorkerCount ++
}else{
uni.showToast({
title: res.message,
@ -1624,23 +1560,73 @@
}
this.searchForm.pageNum = 1
this.scrollToTop()
this.getDelivery()
this.getDaTing()
this.$forceUpdate();
},
shouldNotify(mustFinishTimeStr) {
// ISO 8601
const targetTime = new Date(mustFinishTimeStr);
//
if (isNaN(targetTime.getTime())) {
throw new Error('Invalid date format: ' + mustFinishTimeStr);
}
const currentTime = new Date();
const diffMs = targetTime - currentTime; //
// diffMs <= 0 100 < diffMs < 600000
const diffMs = targetTime - currentTime;
return diffMs <= 0 || diffMs < 10 * 60 * 1000;
},
getDaTing() {
let that = this
const requestVersion = that.deliveryQueryVersion
const requestPageNum = that.searchForm.pageNum
const requestForm = {
...that.searchForm,
waimaiData: [...(that.searchForm.waimaiData || [])],
kuaidiData: [...(that.searchForm.kuaidiData || [])]
}
that.waimaiCount = 0
that.kuaidiCount = 0
that.paotuiCount = 0
that.zhipaiCount = 0
that.adList = []
that.searchForm.userId = uni.getStorageSync('id') || that.searchForm.userId || ''
requestForm.userId = that.searchForm.userId
this.NB.sendRequest("/mall/delivery/page", requestForm, true, 'POST', 'application/json').then(res => {
if (requestVersion !== that.deliveryQueryVersion) return
that.loadStatus = 'nomore';
if (res.code == 200) {
const records = that.normalizeDeliveryRecords(res.result.records, requestPageNum)
if (requestPageNum == 1) {
that.deliveryItem = records;
} else {
that.deliveryItem = [...that.deliveryItem, ...records]
}
if (res.result.orderCount != null && res.result.orderCount.length > 0) {
for (let i = 0; i < res.result.orderCount.length; i++) {
if (res.result.orderCount[i].deliveryType == 1) {
that.waimaiCount = res.result.orderCount[i].orderCount
} else if (res.result.orderCount[i].deliveryType == 2) {
that.kuaidiCount = res.result.orderCount[i].orderCount
} else if (res.result.orderCount[i].deliveryType == 3) {
that.paotuiCount = res.result.orderCount[i].orderCount
}
}
}else{
that.waimaiCount = 0
that.kuaidiCount = 0
that.paotuiCount = 0
}
if (res.result.zhipaiCount != undefined && res.result.zhipaiCount != null) {
that.zhipaiCount = res.result.zhipaiCount
}
that.totalPages = res.result.pages; // pages =
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
}
uni.hideLoading();
})
},
getDelivery() {
if (!this.ensureLogin()) return
let that = this
@ -1663,7 +1649,7 @@
that.pageData = that.deliveryItem
}
that.totalPages = res.result.pages; // pages =
that.totalPages = res.result.pages;
that.$forceUpdate();
} else {
uni.showToast({
@ -1708,7 +1694,7 @@
this.searchForm.waimaiData = [];
this.searchForm.kuaidiData = [];
}
this.getDelivery()
this.getDaTing()
this.$nextTick(() => {
this.scrollToDaimaiPanel()
})
@ -1784,7 +1770,7 @@
getPushOrder: this.zhipaiCheck ? 1 : 0
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
let worker = uni.getStorageSync('worker') || {}; //
let worker = uni.getStorageSync('worker') || {};
worker.getPushOrder = that.zhipaiCheck ? 1 : 0;
uni.setStorageSync('worker', worker);
uni.setStorageSync('waimaiData', that.waimaiData)
@ -1843,7 +1829,7 @@
})
},
checkArea() {
this.NB.sendRequest("/app/shopArea/getByParentId/0", {}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
this.NB.sendRequest("/app/shopArea/getByParentId/0", {}, true, 'get', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
this.areaList = res.result
this.areaKeyword = ''
@ -2085,7 +2071,12 @@
}
this.searchForm.pageNum = 1
this.scrollToTop()
this.getDelivery()
if(type == 'dating'){
this.getDaTing()
}else{
this.getDelivery()
}
},
refreshCurrentTab() {
@ -2175,7 +2166,7 @@
id: worker.workerId
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
let worker = uni.getStorageSync('worker') || {}; //
let worker = uni.getStorageSync('worker') || {};
worker.isOnLine = value;
this.isOnLine = value
uni.setStorageSync('worker', worker);
@ -2193,6 +2184,584 @@
})
this.isArea = !this.isArea
this.$forceUpdate()
},
setTabBarVisible(visible) {
this.isTabBarVisible = visible
},
showDeliveryRuleEditedConfirm() {
this.$nextTick(() => {
setTimeout(() => {
if (this.$refs.deLiveryPage && this.$refs.deLiveryPage.showRuleEditedConfirm) {
this.$refs.deLiveryPage.showRuleEditedConfirm()
}
}, 300)
})
},
normalizeShareTargetPath(value) {
return normalizeShareTargetPath(value)
},
resolveShareTargetPath(value) {
let targetPath = String(value || '')
if (targetPath.indexOf('/pages/index/index') === 0 || targetPath.indexOf('pages/index/index') === 0) {
const queryIndex = targetPath.indexOf('?')
if (queryIndex !== -1) {
const query = targetPath.slice(queryIndex + 1).split('&')
for (let i = 0; i < query.length; i++) {
const pair = query[i].split('=')
if (pair[0] === 'targetPath') {
targetPath = pair.slice(1).join('=')
break
}
}
}
}
return this.normalizeShareTargetPath(targetPath)
},
openShareTargetIfNeeded() {
if (!this.pendingShareTargetPath) {
this.pendingShareTargetPath = this.resolveShareTargetPath(uni.getStorageSync('pendingShareTargetPath') || '')
if (this.pendingShareTargetPath) {
uni.setStorageSync('pendingShareTargetPath', this.pendingShareTargetPath)
}
}
if (!this.pendingShareTargetPath) return false
if (!uni.getStorageSync('area')) return true
const targetPath = this.pendingShareTargetPath
this.pendingShareTargetPath = ''
uni.removeStorageSync('pendingShareTargetPath')
uni.removeStorageSync('authPendingTargetPath')
this.$nextTick(() => {
setTimeout(() => {
uni.navigateTo({
url: targetPath,
fail: () => {
this.pendingShareTargetPath = targetPath
uni.setStorageSync('pendingShareTargetPath', targetPath)
uni.redirectTo({
url: targetPath,
success: () => {
uni.removeStorageSync('pendingShareTargetPath')
},
fail: () => {
uni.showToast({
title: '进入分享页面失败,请重试',
icon: 'none'
})
}
})
}
})
}, 300)
})
return true
},
refreshDaimaiStickyPosition() {
const query = uni.createSelectorQuery().in(this);
query.select('#menuList').boundingClientRect(rect => {
if (rect) {
this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0);
this.stickyTrigger = Math.max(360, this.menuListOffsetTop - this.navBarHeight - 46);
}
}).exec();
},
hasLogin() {
const token = uni.getStorageSync('hiver_token')
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
},
requireLogin(tabIndex = this.currentIndex) {
if (this.hasLogin()) return true
const redirectKey = 'login_redirect_' + Date.now()
const index = Number(tabIndex)
const redirectUrl = '/pages/index/index' + (!isNaN(index) && index > 0 ? '?tabIndex=' + index : '')
uni.setStorageSync(redirectKey, redirectUrl)
uni.navigateTo({
url: '/package2/login/login?redirect=' + redirectKey
})
return false
},
// isSwitching
_switchCategory(index) {
if (this.isSwitching) return;
this.isSwitching = true;
this.checkTab(index);
// 400ms200ms200ms
setTimeout(() => {
this.isSwitching = false;
}, 400);
},
productDetail(item) {
if (this._isSwipingOrderTap) {
this._isSwipingOrderTap = false
return
}
if (!item || item.deliveryType != 1) return
this.productData = item;
this.productGoodsList = Array.isArray(item.goodsList) ? item.goodsList : []
this.$refs.productPopup.open()
},
closeProductPopup() {
if (this.$refs.productPopup && this.$refs.productPopup.close) {
this.$refs.productPopup.close()
}
this.productData = {}
this.productGoodsList = []
},
getSwipeProgress(item, index) {
if (!item) return 0
if (this.swipeOrder.id === item.id && this.swipeOrder.index === index) {
return this.swipeOrder.progress
}
return 0
},
resetDeliveryQuery() {
this.deliveryQueryVersion++
this.searchForm.pageNum = 1
this.totalPages = 1
this.deliveryItem = []
this.resetSwipeOrder()
},
normalizeDeliveryRecords(records, pageNum) {
if (!Array.isArray(records)) return []
return records.filter(item => item && typeof item === 'object').map((item, index) => {
return {
...item,
deliveryKey: item.id !== undefined && item.id !== null ? String(item.id) : (pageNum + '-' + index)
}
})
},
shouldShowReceiverPhoneIcon(item) {
return !!(item && item.workerId)
},
parseDeliveryTime(value) {
if (!value) return NaN
if (typeof value === 'number') {
return String(value).length === 10 ? value * 1000 : value
}
const timeText = String(value).trim()
if (!timeText) return NaN
const nativeParsedTime = new Date(timeText).getTime()
if (!isNaN(nativeParsedTime)) return nativeParsedTime
const timeOnlyMatch = timeText.match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/)
if (timeOnlyMatch) {
const currentDate = new Date(this.deliveryNowTime || Date.now())
currentDate.setHours(Number(timeOnlyMatch[1]), Number(timeOnlyMatch[2]), Number(timeOnlyMatch[3] || 0), 0)
return currentDate.getTime()
}
const parsedTime = new Date(timeText.replace(/-/g, '/')).getTime()
return parsedTime
},
isNearMustFinishTime(item) {
if (!item || !item.mustFinishTime) return false
const mustFinishTime = this.parseDeliveryTime(item.mustFinishTime)
if (isNaN(mustFinishTime)) return false
return mustFinishTime - this.deliveryNowTime <= 10 * 60 * 1000
},
getMustFinishWarningText(item) {
const mustFinishTime = this.parseDeliveryTime(item && item.mustFinishTime)
if (!isNaN(mustFinishTime) && this.deliveryNowTime > mustFinishTime) {
return '已超过用户要求送达时间,为避免纠纷,建议和用户沟通是否继续接单配送'
}
return '已经临近用户要求送达时间,为避免纠纷,建议和用户沟通是否继续接单配送。'
},
startDeliveryTimeTimer() {
this.deliveryNowTime = Date.now()
if (this.deliveryTimer) return
this.deliveryTimer = setInterval(() => {
this.deliveryNowTime = Date.now()
}, 60 * 1000)
},
isSwipeOrderActive(item, index) {
if (!item) return false
return this.swipeOrder.id === item.id && this.swipeOrder.index === index && this.swipeOrder.progress > 0
},
//
startSwipeOrder(event, item, index) {
if (!item || item.id === undefined || item.id === null) return
if (!this.requireLogin(0)) return
const touch = event.touches && event.touches[0]
if (!touch) return
this._isSwipingOrderTap = false
this._swipeOrderProgress = 0
this._swipeOrderLastRenderTime = 0
this.swipeOrder = {
id: item.id,
index,
startX: touch.clientX,
startProgress: 0,
progress: 0,
progressStyle: 'transform: translate3d(0, 0, 0) scaleX(0); transition: none;',
thumbStyle: 'transform: translate3d(0, 0, 0); transition: none;',
trackWidth: this.swipeOrderBaseWidth || 0,
confirmed: false
}
this.$nextTick(() => {
uni.createSelectorQuery().in(this).select('#swipe-order-' + item.id).boundingClientRect((rect) => {
if (rect && this.swipeOrder.id === item.id && this.swipeOrder.index === index) {
this.swipeOrder.trackWidth = rect.width
}
}).exec()
})
},
moveSwipeOrder(event) {
const touch = event.touches && event.touches[0]
if (!touch || this.swipeOrder.id === '') return
const trackWidth = this.swipeOrder.trackWidth || this.swipeOrderBaseWidth || 1
const deltaX = Math.max(0, touch.clientX - this.swipeOrder.startX)
const progress = Math.min(100, Math.round(deltaX / (trackWidth * 0.72) * 100))
if (progress > 3) {
this._isSwipingOrderTap = true
}
this._swipeOrderProgress = progress
const now = Date.now()
const frameGap = this.swipeOrderFrameGap || 16
const progressStep = this.swipeOrderProgressStep || 1
if (now - (this._swipeOrderLastRenderTime || 0) < frameGap &&
Math.abs(progress - this.swipeOrder.progress) < progressStep &&
progress < 92) {
return
}
this._swipeOrderLastRenderTime = now
this.setSwipeOrderProgress(progress)
},
//
endSwipeOrder(item, index) {
if (!this.requireLogin(0)) {
this.resetSwipeOrder()
return
}
if (this.swipeOrder.id !== item.id || this.swipeOrder.index !== index) return
const progress = this._swipeOrderProgress !== undefined ? this._swipeOrderProgress : this.swipeOrder.progress
if (progress >= 92 && !this.swipeOrder.confirmed) {
this.swipeOrder.confirmed = true
this.setSwipeOrderProgress(100)
this.getOrder(item, index)
return
}
this.resetSwipeOrder()
},
resetSwipeOrder() {
this._swipeOrderProgress = 0
this._swipeOrderLastRenderTime = 0
clearTimeout(this._swipeOrderTapTimer)
this._swipeOrderTapTimer = setTimeout(() => {
this._isSwipingOrderTap = false
}, 300)
this.swipeOrder = {
id: '',
index: -1,
startX: 0,
startProgress: 0,
progress: 0,
progressStyle: 'transform: translate3d(0, 0, 0) scaleX(0); transition: none;',
thumbStyle: 'transform: translate3d(0, 0, 0); transition: none;',
trackWidth: 0,
confirmed: false
}
},
setSwipeOrderProgress(progress) {
if (this.swipeOrder.progress === progress) return
const trackWidth = this.swipeOrder.trackWidth || this.swipeOrderBaseWidth || 0
const thumbWidth = this.swipeOrderThumbWidth || 0
const thumbOffset = Math.max(0, trackWidth - thumbWidth) * progress / 100
this.swipeOrder.progress = progress
this.swipeOrder.progressStyle = 'transform: translate3d(0, 0, 0) scaleX(' + (progress / 100) + '); transition: none;'
this.swipeOrder.thumbStyle = 'transform: translate3d(' + thumbOffset + 'px, 0, 0); transition: none;'
},
normalizeAdImageUrl(url) {
if (!url) return ''
let normalized = String(url).trim()
while (normalized.endsWith(',')) {
normalized = normalized.slice(0, -1)
}
return normalized
},
getHomeAdImageCache() {
const cache = uni.getStorageSync(HOME_AD_IMAGE_CACHE_KEY)
return cache && typeof cache === 'object' ? cache : {}
},
saveHomeAdImageCache(cache) {
uni.setStorageSync(HOME_AD_IMAGE_CACHE_KEY, cache)
},
isSavedFileExists(filePath) {
if (!filePath || filePath.indexOf('__tmp__') !== -1) return false
try {
const fs = (uni.getFileSystemManager && uni.getFileSystemManager())
|| (typeof wx !== 'undefined' && wx.getFileSystemManager ? wx.getFileSystemManager() : null)
if (fs && fs.accessSync) {
fs.accessSync(filePath)
return true
}
} catch (e) {
return false
}
return true
},
isHomeAdImageCacheValid(cacheItem) {
return !!(cacheItem
&& Date.now() - Number(cacheItem.savedAt || 0) < HOME_AD_IMAGE_CACHE_TTL
&& this.isSavedFileExists(cacheItem.path))
},
cacheHomeMenuIcon(key, imageUrl) {
if (homeAdImageDownloading[imageUrl]) return
homeAdImageDownloading[imageUrl] = true
uni.downloadFile({
url: imageUrl,
success: (downloadRes) => {
if (downloadRes.statusCode !== 200 || !downloadRes.tempFilePath) {
this.homeMenuIconImages[key] = imageUrl
delete homeAdImageDownloading[imageUrl]
return
}
uni.saveFile({
tempFilePath: downloadRes.tempFilePath,
success: (saveRes) => {
const cache = this.getHomeAdImageCache()
const oldCacheItem = cache[imageUrl]
if (oldCacheItem && oldCacheItem.path && oldCacheItem.path !== saveRes.savedFilePath) {
uni.removeSavedFile({
filePath: oldCacheItem.path,
fail: () => {}
})
}
cache[imageUrl] = {
path: saveRes.savedFilePath,
savedAt: Date.now()
}
this.saveHomeAdImageCache(cache)
this.homeMenuIconImages[key] = saveRes.savedFilePath
},
fail: () => {
this.homeMenuIconImages[key] = imageUrl
},
complete: () => {
delete homeAdImageDownloading[imageUrl]
}
})
},
fail: () => {
this.homeMenuIconImages[key] = imageUrl
delete homeAdImageDownloading[imageUrl]
},
complete: (downloadRes) => {
if (!downloadRes || downloadRes.statusCode !== 200) {
this.homeMenuIconImages[key] = imageUrl
delete homeAdImageDownloading[imageUrl]
}
}
})
},
cacheHomeAdImage(imageUrl) {
if (homeAdImageDownloading[imageUrl]) return
homeAdImageDownloading[imageUrl] = true
uni.downloadFile({
url: imageUrl,
success: (downloadRes) => {
if (downloadRes.statusCode !== 200 || !downloadRes.tempFilePath) {
this.replaceAdImageWithCache(imageUrl, imageUrl)
delete homeAdImageDownloading[imageUrl]
return
}
uni.saveFile({
tempFilePath: downloadRes.tempFilePath,
success: (saveRes) => {
const cache = this.getHomeAdImageCache()
const oldCacheItem = cache[imageUrl]
if (oldCacheItem && oldCacheItem.path && oldCacheItem.path !== saveRes.savedFilePath) {
uni.removeSavedFile({
filePath: oldCacheItem.path,
fail: () => {}
})
}
cache[imageUrl] = {
path: saveRes.savedFilePath,
savedAt: Date.now()
}
this.saveHomeAdImageCache(cache)
this.replaceAdImageWithCache(imageUrl, saveRes.savedFilePath)
},
fail: () => {
this.replaceAdImageWithCache(imageUrl, imageUrl)
},
complete: () => {
delete homeAdImageDownloading[imageUrl]
}
})
},
fail: () => {
delete homeAdImageDownloading[imageUrl]
},
complete: (downloadRes) => {
if (!downloadRes || downloadRes.statusCode !== 200) {
this.replaceAdImageWithCache(imageUrl, imageUrl)
delete homeAdImageDownloading[imageUrl]
}
}
})
},
replaceAdImageWithCache(imageUrl, filePath) {
const replace = (list) => {
(list || []).forEach((item) => {
if (item.adImage === imageUrl) {
item.adDisplayImage = filePath
}
})
}
replace(this.mallAds)
replace(this.adList)
this.$forceUpdate()
},
pruneHomeAdImageCache(cache, activeUrls) {
const activeUrlMap = activeUrls.reduce((result, url) => {
result[url] = true
return result
}, {})
const now = Date.now()
Object.keys(cache).forEach((url) => {
const item = cache[url]
const isExpired = !this.isHomeAdImageCacheValid(item)
if (isExpired && !activeUrlMap[url]) {
item && item.path && uni.removeSavedFile({
filePath: item.path,
fail: () => {}
})
delete cache[url]
}
})
const urls = Object.keys(cache).sort((a, b) => Number(cache[a].savedAt || now) - Number(cache[b].savedAt || now))
while (urls.length > HOME_AD_IMAGE_CACHE_LIMIT) {
const url = urls.shift()
if (activeUrlMap[url]) {
urls.push(url)
if (urls.every(itemUrl => activeUrlMap[itemUrl])) break
continue
}
const item = cache[url]
item && item.path && uni.removeSavedFile({
filePath: item.path,
fail: () => {}
})
delete cache[url]
}
this.saveHomeAdImageCache(cache)
},
//广
goAdPage(item) {
if (!this.requireLogin(0)) return
uni.navigateTo({
url: item.linkUrl + item.linkParams
})
},
checkTab(index) {
for (let i = 0; i < this.menuList.length; i++) {
this.menuList[i].checked = (i === index);
}
//
this.searchForm.pageNum = 1;
this.pageNum = 1;
this.total = 1;
this.productItem = [];
// this.getProduct(this.menuList[index].id);
// nav-bar
// menuListOffsetTop - navBarHeight 使sticky
const target = this.menuListOffsetTop - this.navBarHeight;
uni.pageScrollTo({
scrollTop: target > 0 ? target : 0,
duration: 200
});
},
goSeckillGroup() {
uni.navigateTo({
url: '/package2/seckill/seckillGroup'
})
},
//
goDetail(type) {
let url = ''
switch (type) {
case '1':
url = '/package1/runErrand/runErrand'
break;
case '2':
url = '/package2/group/groupBuyList'
break;
case '3':
url = '/package2/group/studentStoreList'
break;
case '4':
url = '/package1/planet/index'
break;
case '5':
url = '/package1/ieBrowser/index'
break;
}
uni.navigateTo({
url: url
})
},
//
goOrderDetail(item) {
uni.navigateTo({
url: '/package1/order/orderDetail?id=' + item.id
});
},
scrollToDaimaiPanel() {
const query = uni.createSelectorQuery().in(this);
query.select('#menuList').boundingClientRect(rect => {
if (!rect) return;
const stickyTop = this.navBarHeight + 46;
const target = rect.top + (this._scrollTopRaw || 0) - stickyTop;
uni.pageScrollTo({
scrollTop: target > 0 ? target : 0,
duration: 260
});
}).exec();
},
//
makeCall(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
//
checkAdd() {
this.isgetArea = !this.isgetArea
},
//
checkAdd1() {
this.isputArea = !this.isputArea
},
//tab
changeIndex(index) {
let that = this;
this.isTabBarVisible = true
this.lastIndex = this.currentIndex
if (index != 0) {
this.closeProductPopup()
}
if(index != 2){
this.currentIndex = index
}
switch (index) {
case 0:
this.runHomeInit()
break;
case 1:
that.$refs.deLiveryPage.init()
break;
case 2:
uni.navigateTo({
url: '/package1/tabbar/release'
})
break;
case 3:
that.$refs.postListPage.init()
break;
case 4:
that.$refs.myCenterPage.init()
break;
}
}
}
}

15
pages/worker/partTimeJobCenter.vue

@ -157,6 +157,14 @@
退款/售后记录
</view>
</view>
<view class="menu22" @tap="logOut">
<view class="menu33">
<image src="../../static/image/dingdan/dd0.png" alt="" />
</view>
<view class="menu44">
退出登录
</view>
</view>
</view>
</view>
</view>
@ -229,6 +237,13 @@
url: '/pages/worker/workerOrderList?today=1'
})
},
logOut() {
uni.clearStorage()
getApp().globalData.userinfo = ''
uni.reLaunch({
url: '../login/login'
})
},
goDetail(type, index) {
let url = ''
switch (type) {

Loading…
Cancel
Save