tianyi 3 months ago
parent
commit
fe16bcfe65
  1. 270
      pages/index/index.vue
  2. 289
      pages/myCenter/shopDetail.vue
  3. 471
      pages/shop/selfDeliveryOrderList.vue
  4. 183
      pages/shop/transferDeliveryOrderList.vue

270
pages/index/index.vue

@ -31,7 +31,7 @@
<view class="order2">
<view class="order22">
<view class="order33" @tap="changeIndex(1,13)">
<view class="order44">
<view class="order44" style="color: red;">
{{daichucan}}
</view>
<view class="order55">
@ -65,7 +65,7 @@
</view>
</view>
<view class="order33" @tap="goDetail('tui',11)">
<view class="order44">
<view class="order44" style="color: red;">
{{shopData.refundCount == undefined?0:shopData.refundCount}}
</view>
<view class="order55">
@ -80,7 +80,28 @@
待回复差评
</view>
</view>
<view class="order33" v-if="shopConfig.supportShopDelivery == 1"
@tap="goDetail('selfDelivery')">
<view class="order44" style="color: red;">
{{shopData.shopDeliveryPendingCount == undefined?0:shopData.shopDeliveryPendingCount}}
</view>
<view class="order55">
自配送订单
</view>
</view>
<view class="order33" v-if="shopConfig.supportTransferDelivery == 1"
@tap="goDetail('transferDelivery')">
<view class="order44" style="color: red;">
{{shopData.transferDeliveryPendingCount == undefined?0:shopData.transferDeliveryPendingCount}}
</view>
<view class="order55">
中转配送
</view>
</view>
</view>
<!-- <view class="order22">
</view> -->
</view>
</view>
<view class="shop-order">
@ -190,7 +211,8 @@
<view class="popup-area-title">
<text>请选择店铺</text>
</view>
<view class="popup-area-container" v-for="(item,index) in areaList" :key="index" @tap="onClickArea(item)">
<view class="popup-area-container" v-for="(item,index) in areaList" :key="index"
@tap="onClickArea(item)">
<text style="display: inline-block">{{item.shop.shopName}}</text>
</view>
</view>
@ -208,15 +230,16 @@
return {
width: 0,
currentIndex: 0,
businessStatus:1,
shop:{},
areaList:[],
businessStatus: 1,
shop: {},
shopConfig: {},
areaList: [],
shopList: [],
shopData:{},
daixiaofei:0,
daichucan:0,
daiquhuo:0,
daisongda:0
shopData: {},
daixiaofei: 0,
daichucan: 0,
daiquhuo: 0,
daisongda: 0
}
},
components: {
@ -228,11 +251,13 @@
this.indexInit()
},
onLoad() {
},
methods: {
indexInit(){
indexInit() {
let that = this
this.shopConfig = JSON.parse(uni.getStorageSync('area')).shop || {}
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
@ -240,12 +265,13 @@
});
this.getData()
this.getBusinessStatus()
if(!uni.getStorageSync('area')){
if (!uni.getStorageSync('area')) {
this.checkArea()
}
},
checkArea(){
this.NB.sendRequest("/auth/getShopByUser", {}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
checkArea() {
this.NB.sendRequest("/auth/getShopByUser", {}, false, 'post', 'application/x-www-form-urlencoded').then((
res) => {
if (res.code == 200) {
this.areaList = res.result
this.$refs.areaPopup.open()
@ -255,11 +281,11 @@
icon: 'none'
})
}
})
},
//
getBusinessStatus(){
getBusinessStatus() {
this.NB.sendRequest("/app/shoptakeaway/getByShopId", {
shopId: uni.getStorageSync('shopId')
}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
@ -277,36 +303,38 @@
uni.hideLoading()
}).catch((res) => {})
},
onClickArea(item){
uni.setStorageSync('area',JSON.stringify(item))
onClickArea(item) {
uni.setStorageSync('area', JSON.stringify(item))
this.getBusinessStatus()
this.getData()
this.$refs.areaPopup.close()
},
//
updateStatus(){
updateStatus() {
let that = this;
uni.showModal({
title: '提示',
content: '要更改营业状态吗?',
success: function (res1) {
success: function(res1) {
if (res1.confirm) {
that.NB.sendRequest("/app/shoptakeaway/update", {
shopId: uni.getStorageSync('shopId'),
status:that.businessStatus == "1"?'0':that.businessStatus == "0"?'1':'2'
status: that.businessStatus == "1" ? '0' : that.businessStatus == "0" ?
'1' : '2'
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
uni.showToast({
title: '更改成功',
icon:'none'
icon: 'none'
});
that.businessStatus = that.businessStatus == "1"?'0':that.businessStatus == "0"?'1':'2'
that.businessStatus = that.businessStatus == "1" ? '0' : that
.businessStatus == "0" ? '1' : '2'
} else {
uni.showToast({
title: res.message,
icon:'none'
icon: 'none'
});
}
uni.hideLoading()
@ -314,9 +342,9 @@
}
}
});
},
goDetail(type,index) {
goDetail(type, index) {
let url = ''
switch (type) {
case 'tj':
@ -328,53 +356,61 @@
case 'sp':
url = '/pages/shop/goodsList'
break;
case 'dp':
url = ''
case 'yy':
url = '/pages/myCenter/businessInfo'
break;
case 'sjxx':
url = '/pages/myCenter/shopDetail'
break;
case 'selfDelivery':
url = '/pages/shop/selfDeliveryOrderList'
break;
case 'transferDelivery':
url = '/pages/shop/transferDeliveryOrderList'
break;
case 'dd':
url = '/pages/shop/shopOrderList'
break;
case 'tui':
uni.navigateTo({
url: '/pages/shop/shopReturnOrder?type=shop'
})
break;
case 'zd':
url = '/pages/shop/shopBill'
break;
case 'pj':
let item = {
shopScore:uni.getStorageSync('shopScore'),
id:uni.getStorageSync('shopId')
shopScore: uni.getStorageSync('shopScore'),
id: uni.getStorageSync('shopId')
}
url = '/pages/shop/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=1&isCha=' + (index =='cha'?1:0)
break;
case 'tui':
uni.navigateTo({
url: '/pages/shop/shopReturnOrder?type=shop'
})
url = '/pages/shop/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=1&isCha=' + (index ==
'cha' ? 1 : 0)
break;
case 'hx':
this.scanCodeAdd()
break;
case 'dy':
url = '/pages/myCenter/setPrint'
break;
default:
}
uni.navigateTo({
url: url
})
},
getData(){
getData() {
let that = this;
that.NB.sendRequest("/mall/order/countByShop/"+uni.getStorageSync('shopId'), {}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
that.NB.sendRequest("/mall/order/countByShop/" + uni.getStorageSync('shopId'), {}, false, 'GET',
'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shopData = res.result
for(let i=0;i<this.shopData.orderStatusCount.length;i++){
if(this.shopData.orderStatusCount[i].counttype){
if(this.shopData.orderStatusCount[i].counttype == 'daisong'){
for (let i = 0; i < this.shopData.orderStatusCount.length; i++) {
if (this.shopData.orderStatusCount[i].counttype) {
if (this.shopData.orderStatusCount[i].counttype == 'daisong') {
this.daisongda = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daiqu'){
} else if (this.shopData.orderStatusCount[i].counttype == 'daiqu') {
this.daiquhuo = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daixiaofei'){
} else if (this.shopData.orderStatusCount[i].counttype == 'daixiaofei') {
this.daixiaofei = this.shopData.orderStatusCount[i].count
}else if(this.shopData.orderStatusCount[i].counttype == 'daichucan'){
} else if (this.shopData.orderStatusCount[i].counttype == 'daichucan') {
this.daichucan = this.shopData.orderStatusCount[i].count
}
}
@ -400,29 +436,31 @@
uni.showModal({
title: '提示',
content: '确定要核销该订单吗?',
success: function (res1) {
success: function(res1) {
if (res1.confirm) {
that.NB.sendRequest("/mall/order/complete", {
orderId: productId
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
uni.showToast({
title: '核销成功',
icon: 'none'
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
orderId: productId
}, false, 'post',
'application/x-www-form-urlencoded').then((
res) => {
if (res.code == 200) {
uni.showToast({
title: '核销成功',
icon: 'none'
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
}
}
});
} else {
uni.showToast({
title: '未查询到此订单信息,请核实!',
@ -440,7 +478,7 @@
})
},
//tab
changeIndex(index,type) {
changeIndex(index, type) {
let that = this;
this.lastIndex = this.currentIndex
this.currentIndex = index
@ -449,7 +487,7 @@
this.indexInit()
break;
case 1:
that.$refs.deLivery.init(type)
break;
case 2:
@ -464,19 +502,20 @@
<style lang="scss">
@import url("./index.css");
.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;
}
.title-name {
padding-top: 110rpx;
font-size: 36rpx;
@ -484,7 +523,7 @@
flex: 1;
text-align: center;
}
.shop-title {
width: 95%;
margin: 0 auto;
@ -495,88 +534,103 @@
font-size: 28rpx;
font-weight: 700;
}
.title1 {
width: 70rpx;
height: 70rpx;
img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
.title2{
flex: 1;
line-height: 70rpx;
display: flex;
.title2 {
flex: 1;
line-height: 70rpx;
display: flex;
}
.title22{
flex: 1;
padding-left: 20rpx;
.title22 {
flex: 1;
padding-left: 20rpx;
}
.shop-order{
.shop-order {
width: 95%;
margin: 20rpx auto 0;
background: #fff;
border-radius: 20rpx;
padding: 0 20rpx 0;
}
.order1{
.order1 {
height: 70rpx;
line-height: 70rpx;
font-size: 28rpx;
font-weight: 700;
border-bottom: 1px solid #eee;
}
.order22{
}
.order22 {
display: flex;
height: 100rpx;
padding-top: 20rpx;
}
.order33{
.order33 {
flex: 1;
text-align: center;
}
.order44{
.order44 {
font-size: 28rpx;
font-weight: 700;
}
.data2{
display: flex;
height: 140rpx;
text-align: center;
padding-top: 20rpx;
.data2 {
display: flex;
height: 140rpx;
text-align: center;
padding-top: 20rpx;
}
.data22{
.data22 {
flex: 1;
}
.data222{
font-size: 36rpx;
font-weight: 700;
padding-bottom: 20rpx;
.data222 {
font-size: 36rpx;
font-weight: 700;
padding-bottom: 20rpx;
}
.menu2{
.menu2 {
display: flex;
flex-wrap: wrap;
text-align: center;
padding-top: 20rpx;
}
.menu22{
.menu22 {
width: 25%;
height: 120rpx;
height: 120rpx;
}
.menu33{
image{
.menu33 {
image {
width: 50rpx;
height: 50rpx;
height: 50rpx;
background-size: 100%;
}
}
.menu44{
.menu44 {
height: 40rpx;
line-height: 40rpx;
}
.popup-area-content {
align-items: center;
justify-content: center;
@ -585,14 +639,14 @@
height: auto;
background-color: #fff;
}
.popup-area-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-area-container {
margin-top: 20rpx;
height: 100rpx;

289
pages/myCenter/shopDetail.vue

@ -89,6 +89,83 @@
</view>
</view>
</view>
<view class="list-box">
<view class="section-title">商家自配送</view>
<view class="list-1">
<view class="list-name">支持自配送</view>
<view class="list-right">
<label class="radio" style="padding-right: 20rpx;" @tap="setSelfDelivery(1)">
<radio :checked="shop.supportShopDelivery == 1" /><text></text>
</label>
<label class="radio" @tap="setSelfDelivery(0)">
<radio :checked="shop.supportShopDelivery == 0" /><text></text>
</label>
</view>
</view>
<block v-if="shop.supportShopDelivery == 1">
<view class="list-1">
<view class="list-name">配送费</view>
<view class="list-right">
<input type="digit" v-model="shop.orderBkge" placeholder="默认0,最多1位小数" @blur="formatOrderBkge" />
</view>
</view>
<view class="list-1">
<view class="list-name">送达位置</view>
<view class="list-right">
<picker :range="deliveryLocationList" range-key="text" @change="deliveryLocationChange">
<view>{{deliveryLocationText || '请选择'}}</view>
</picker>
</view>
</view>
<view class="list-1">
<view class="list-name">配送时长</view>
<view class="list-right">
<input type="number" v-model="shop.shopDeliveryDuration" placeholder="分钟" />
</view>
</view>
<view class="list-1">
<view class="list-name">配送员电话</view>
<view class="list-right worker-query">
<input type="number" v-model="workerMobile" placeholder="输入手机号" />
<view class="query-btn" @tap="findWorker">查询</view>
</view>
</view>
<view class="list-1" v-if="shop.workerId">
<view class="list-name">已绑定</view>
<view class="list-right">{{shop.workerName}} {{shop.workerPhone}}</view>
</view>
</block>
</view>
<view class="list-box">
<view class="section-title">中转配送</view>
<view class="list-1">
<view class="list-name">支持中转配送</view>
<view class="list-right">
<label class="radio" style="padding-right: 20rpx;" @tap="setTransferDelivery(1)">
<radio :checked="shop.supportTransferDelivery == 1" /><text></text>
</label>
<label class="radio" @tap="setTransferDelivery(0)">
<radio :checked="shop.supportTransferDelivery == 0" /><text></text>
</label>
</view>
</view>
<block v-if="shop.supportTransferDelivery == 1">
<view class="list-1">
<view class="list-name">中转时长</view>
<view class="list-right">
<input type="number" v-model="shop.transferDeliveryDuration" placeholder="分钟" />
</view>
</view>
<view class="list-1">
<view class="list-name">中转地点</view>
<view class="list-right">
<picker :range="addressList" range-key="text" @change="transferAddressChange">
<view>{{shop.transferAddressName || '请选择'}}</view>
</picker>
</view>
</view>
</block>
</view>
<view class="list-box">
<view class="list-2" @click="submit">
保存
@ -103,20 +180,40 @@
return {
shop: {},
shopImages: [],
huanjing: ''
huanjing: '',
workerMobile: '',
addressList: [],
deliveryLocationList: [{
value: 1,
text: '送到宿舍'
}, {
value: 2,
text: '送到楼下'
}]
}
},
computed: {
deliveryLocationText() {
let item = this.deliveryLocationList.find(item => item.value == this.shop.shopDeliveryLocation)
return item ? item.text : ''
}
},
onLoad() {
this.shop = JSON.parse(uni.getStorageSync('area')).shop;
this.shopImages = this.shop.shopImages.split('@@')
this.huanjing = JSON.parse(this.shopImages[3])[0]
for (let key in this.shop) {
if (this.shop[key] === null) {
delete this.shop[key];
}
}
if (this.shop.supportShopDelivery == null) this.shop.supportShopDelivery = 0
if (this.shop.orderBkge == null) this.shop.orderBkge = 0
if (this.shop.supportTransferDelivery == null) this.shop.supportTransferDelivery = 0
this.workerMobile = this.shop.workerPhone || ''
this.getRegionList()
},
methods: {
navigatorTo(e) {
@ -180,28 +277,194 @@
uni.hideLoading();
}, 1000)
},
submit() {
this.NB.sendRequest('/app/shop/edit', this.shop, false, 'PUT', 'application/x-www-form-urlencoded').then(
res => {
setSelfDelivery(type) {
this.shop.supportShopDelivery = type
if (type != 1) {
this.shop.orderBkge = 0
this.shop.shopDeliveryLocation = ''
this.shop.shopDeliveryDuration = ''
this.shop.workerId = ''
this.shop.workerName = ''
this.shop.workerPhone = ''
this.workerMobile = ''
}
},
setTransferDelivery(type) {
this.shop.supportTransferDelivery = type
if (type != 1) {
this.shop.transferDeliveryDuration = ''
this.shop.transferAddressId = ''
this.shop.transferAddressName = ''
}
},
getRegionList() {
this.NB.sendRequest('/app/shopArea/getByParentId/0', {}, false, 'get', 'application/x-www-form-urlencoded')
.then(res => {
if (res.code == 200) {
this.addressList = (Array.isArray(res.result) ? res.result : []).map(item => {
return {
value: item.id,
text: item.title || item.name || item.regionName || item.areaName ||
'未命名区域'
}
})
} else {
uni.showToast(res.message)
}
})
},
transferAddressChange(e) {
const item = this.addressList[e.detail.value]
if (item) {
this.shop.transferAddressId = item.value
this.shop.transferAddressName = item.text
}
},
formatOrderBkge() {
let value = parseFloat(this.shop.orderBkge || 0)
if (isNaN(value) || value < 0) value = 0
this.shop.orderBkge = Number(value.toFixed(1))
},
deliveryLocationChange(e) {
const item = this.deliveryLocationList[e.detail.value]
if (item) {
this.shop.shopDeliveryLocation = item.value
}
},
findWorker() {
if (!this.workerMobile) {
uni.showToast('请输入配送员手机号')
return
}
this.NB.sendRequest('/app/shop/findWorkerByMobile', {
mobile: this.workerMobile
}, false, 'get', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
this.shop.workerId = res.result.workerId
this.shop.workerName = res.result.workerName
this.shop.workerPhone = res.result.workerPhone || res.result.mobile
uni.showToast('绑定成功')
} else {
uni.showToast(res.message)
}
})
},
normalizeSelfDelivery() {
if (this.shop.supportShopDelivery != 1) {
this.setSelfDelivery(0)
return true
}
this.formatOrderBkge()
if (!this.shop.shopDeliveryLocation) {
this.tui.toast('请选择送达位置')
return false
}
if (!this.shop.shopDeliveryDuration) {
this.tui.toast('请输入配送时长')
return false
}
if (!this.shop.workerId) {
this.tui.toast('请绑定配送员')
return false
}
return true
},
normalizeTransferDelivery() {
if (this.shop.supportTransferDelivery != 1) {
this.setTransferDelivery(0)
return true
}
if (!this.shop.transferDeliveryDuration) {
this.tui.toast('请输入中转配送时长')
return false
}
if (!this.shop.transferAddressId) {
this.tui.toast('请选择中转地点')
return false
}
this.shop.transferDeliveryDuration = parseInt(this.shop.transferDeliveryDuration || 0)
return true
},
updateLocalShopCache() {
let shopList = uni.getStorageSync('schoolShop') || []
if (Array.isArray(shopList)) {
shopList = shopList.map(item => item.id == this.shop.id ? Object.assign({}, item, this.shop) : item)
uni.setStorageSync('schoolShop', shopList)
}
uni.setStorageSync('shop', this.shop)
},
submit() {
if (!this.normalizeSelfDelivery()) return
if (!this.normalizeTransferDelivery()) return
this.NB.sendRequest('/app/shop/updateSelfDelivery', {
id: this.shop.id,
supportShopDelivery: this.shop.supportShopDelivery,
orderBkge: this.shop.orderBkge,
shopDeliveryLocation: this.shop.shopDeliveryLocation,
shopDeliveryDuration: this.shop.shopDeliveryDuration,
workerId: this.shop.workerId,
workerName: this.shop.workerName,
workerPhone: this.shop.workerPhone
},
false, // loading
'post', //
'application/x-www-form-urlencoded' //
).then(deliveryRes => {
if (deliveryRes.code !== 200) {
this.tui.toast(deliveryRes.message);
return Promise.reject(deliveryRes);
}
//
return this.NB.sendRequest(
'/app/shop/updateTransferDelivery', {
id: this.shop.id,
supportTransferDelivery: this.shop.supportTransferDelivery,
transferDeliveryDuration: this.shop.transferDeliveryDuration,
transferAddressId: this.shop.transferAddressId,
transferAddressName: this.shop.transferAddressName
},
false,
'post',
'application/x-www-form-urlencoded'
);
}).then(transferRes => {
if (transferRes.code !== 200) {
this.tui.toast(transferRes.message);
return Promise.reject(transferRes);
}
// PUT
return this.NB.sendRequest(
'/app/shop/edit',
this.shop, //
false,
'put', //
'application/x-www-form-urlencoded'
);
}).then(res => {
if (res.code === 200) {
this.updateLocalShopCache();
uni.showModal({
title: '提示',
content: '更新信息成功',
showCancel: false,
success: function(res) {
uni.setStorageSync('shop', this.shop)
if (res.confirm) {
uni.navigateBack()
success: (modalRes) => {
if (modalRes.confirm) {
uni.navigateBack();
}
}
});
} else {
uni.showToast(res.message)
this.tui.toast(res.message);
}
uni.hideLoading();
})
.catch(err => {
// rejecttoast
uni.hideLoading(); //
//
});
}
}
}

471
pages/shop/selfDeliveryOrderList.vue

@ -0,0 +1,471 @@
<template>
<view class="page">
<view class="fixed-head">
<view class="nav" :style="{'height': navHeight + 'px'}">
<view class="back-btn" :style="{'top': backTop + 'px'}" @tap="back">
<uni-icons type="left" size="26"></uni-icons>
</view>
<view class="nav-title">自配送订单</view>
</view>
<view class="tabs">
<view class="tab" :class="{active: tab === 'pickup'}" @tap="switchTab('pickup')">待取货</view>
<view class="tab" :class="{active: tab === 'complete'}" @tap="switchTab('complete')">待送达</view>
</view>
</view>
<scroll-view class="list" :style="{'top': listTop + 'px'}" scroll-y @scrolltolower="loadMore">
<view class="card" v-for="(item,index) in list" :key="item.id">
<view class="card-head">
<view class="tag">商家自配送</view>
<view class="time">{{item.mustFinishTime | formatTime}}前送达</view>
</view>
<view class="order-code" v-if="item.numberCode">#{{item.numberCode}}</view>
<view class="address">
<view class="dot get"></view>
<view>
<view class="name">{{item.shopName}}</view>
<view class="desc">{{item.shopAddress}}</view>
<view class="phone-row" v-if="item.shopPhone" @tap.stop="makeCall(item.shopPhone)">
商家电话{{item.shopPhone}}
</view>
</view>
</view>
<view class="address">
<view class="dot send"></view>
<view>
<view class="name">{{item.receiverName}} {{item.receiverPhone}}</view>
<view class="desc">{{item.receiverAddress}}</view>
<view class="phone-row" v-if="item.receiverPhone" @tap.stop="makeCall(item.receiverPhone)">
用户电话{{item.receiverPhone}}
</view>
</view>
</view>
<view class="goods-row" v-if="item.goodsList && item.goodsList.length > 0" @tap="productDetail(item)">
<view class="goods-title">商品详情</view>
<view class="goods-desc">{{goodsCount(item)}}点击查看规格和数量</view>
<uni-icons type="right" size="14" color="#7a8582"></uni-icons>
</view>
<view class="remark" v-if="item.remark">备注{{item.remark}}</view>
<view class="fee">配送费 {{item.deliveryFee || 0}}</view>
<view class="btn" @tap="handleOrder(index,item)">
{{buttonText(item)}}
</view>
</view>
<view class="empty" v-if="list.length === 0 && loadStatus === 'nomore'">暂无订单</view>
</scroll-view>
<uni-popup ref="productPopup" background-color="transparent">
<view class="product-popup-content">
<view class="product-popup-header">
<view class="product-popup-title">商品详情</view>
<view class="product-popup-subtitle">请核对商品规格和数量</view>
</view>
<view class="product-popup-list" v-if="productData && productData.length > 0">
<view class="product-popup-card" v-for="(item1,index1) in productData" :key="index1">
<view class="product-popup-img">
<img :src="item1.productPicture" alt="">
</view>
<view class="product-popup-info">
<view class="product-popup-name">{{item1.productName}}</view>
<view class="product-popup-spec">
<text class="product-popup-label">规格</text>
<text class="product-popup-spec-text">{{formatSpecs(item1.specs)}}</text>
</view>
</view>
<view class="product-popup-quantity">
<view class="product-popup-quantity-num">x{{item1.quantity}}</view>
<view class="product-popup-quantity-label">数量</view>
</view>
</view>
</view>
<view class="product-popup-empty" v-else>暂无商品详情</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
tab: 'pickup',
list: [],
loadStatus: 'more',
totalPages: 1,
searchForm: {
pageNum: 1,
pageSize: 10,
status: 1,
deliveryType: 1,
shopDelivery: 1,
shopId: '',
workerId: '',
regionId: ''
},
menuButtonInfo: {},
navHeight: 120,
backTop: 88,
listTop: 210,
productData: []
}
},
filters: {
formatTime(value) {
if (!value) return '';
const date = new Date(value);
return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
}
},
onShow() {
this.initNavMetrics();
this.initWorkerFromShop();
this.resetList();
},
methods: {
initNavMetrics() {
const rect = uni.getMenuButtonBoundingClientRect();
this.menuButtonInfo = rect || {};
const top = rect && rect.top ? rect.top : 32;
const height = rect && rect.height ? rect.height : 32;
this.backTop = top + 6;
this.navHeight = top + height + 52;
this.listTop = this.navHeight + 76;
},
back() {
uni.navigateBack();
},
initWorkerFromShop() {
const shop = this.getCurrentShop();
this.searchForm.shopId = uni.getStorageSync('shopId');
this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
this.searchForm.workerId = shop.workerId || '';
this.worker = {
workerId: shop.workerId || '',
workerName: shop.workerName || '',
workerPhone: shop.workerPhone || ''
};
},
getCurrentShop() {
const shopList = uni.getStorageSync('schoolShop') || [];
const shopId = uni.getStorageSync('shopId');
if (Array.isArray(shopList)) {
return shopList.find(item => item.id == shopId) || {};
}
return {};
},
switchTab(tab) {
this.tab = tab;
this.resetList();
},
resetList() {
this.list = [];
this.searchForm.pageNum = 1;
this.totalPages = 1;
this.loadStatus = 'more';
this.searchForm.status = this.tab === 'pickup' ? 1 : 2;
this.getList();
},
loadMore() {
if (this.searchForm.pageNum >= this.totalPages) return;
this.searchForm.pageNum++;
this.getList();
},
getList() {
if (!this.searchForm.workerId) {
this.loadStatus = 'nomore';
this.tui.toast('店铺未绑定自配送配送员');
return;
}
this.tui.request('/mall/delivery/pageShopDelivery', 'POST', this.searchForm, false, false).then((res) => {
if (res.code == 200) {
const records = res.result.records || [];
this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records);
this.totalPages = res.result.pages || 1;
this.loadStatus = this.searchForm.pageNum >= this.totalPages ? 'nomore' : 'more';
} else {
this.tui.toast(res.message);
}
});
},
handleOrder(index, item) {
if (this.tab === 'pickup' && !item.arriveTime) {
this.changeStatus(index, item, 1);
return;
}
this.changeStatus(index, item, this.tab === 'pickup' ? 2 : 3);
},
buttonText(item) {
if (this.tab === 'pickup') {
return item.arriveTime ? '确认取货' : '已到店';
}
return '确认送达';
},
changeStatus(index, item, status) {
const url = status === 1 ? '/mall/delivery/arriveShop' : (status === 2 ? '/mall/delivery/pickup' : '/mall/delivery/complete');
this.tui.request(url, 'POST', {
regionId: this.searchForm.regionId,
deliveryId: item.id,
workerId: this.worker.workerId
}, false, true).then((res) => {
if (res.code == 200) {
if (status === 1) {
this.$set(this.list[index], 'arriveTime', new Date());
} else {
this.list.splice(index, 1);
}
this.tui.toast(res.message || '操作成功');
} else {
this.tui.toast(res.message);
}
});
},
productDetail(item) {
this.productData = item.goodsList || [];
this.$refs.productPopup.open();
},
goodsCount(item) {
return (item.goodsList || []).reduce((sum, goods) => sum + Number(goods.quantity || 0), 0);
},
formatSpecs(data) {
let str;
if (typeof data === 'object' && data !== null) {
str = JSON.stringify(data);
} else if (typeof data === 'string') {
str = data;
} else {
str = String(data || '');
}
return str.replace(/[{}"]/g, '');
},
makeCall(phone) {
if (!phone) return;
uni.makePhoneCall({
phoneNumber: phone
});
}
}
}
</script>
<style>
.page{
height: 100vh;
background: #F5F8F5;
padding: 0 24rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.fixed-head{
position: absolute;
top: -40rpx;
left: 24rpx;
right: 24rpx;
z-index: 10;
background: #F5F8F5;
}
.nav{
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.back-btn{
position: absolute;
left: 0;
width: 68rpx;
height: 68rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 8rpx 20rpx rgba(0, 35, 28, 0.08);
}
.nav-title{
position: absolute;
bottom: 18rpx;
font-size: 32rpx;
font-weight: 800;
}
.tabs{
display: flex;
background: #fff;
border-radius: 24rpx;
padding: 10rpx;
margin-bottom: 0;
}
.tab{
flex: 1;
text-align: center;
height: 70rpx;
line-height: 70rpx;
border-radius: 20rpx;
font-weight: 700;
}
.tab.active{
background: linear-gradient(90deg, #e3ff96, #a6ffea);
}
.list{
position: absolute;
left: 24rpx;
right: 24rpx;
bottom: 0;
box-sizing: border-box;
padding-top: 20rpx;
padding-bottom: 36rpx;
}
.card{
background: #fff;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 12rpx 30rpx rgba(0, 35, 28, 0.08);
}
.card-head{
display: flex;
align-items: center;
justify-content: space-between;
}
.tag{
background: rgba(255, 111, 44, 0.1);
color: #ff6f2c;
padding: 8rpx 16rpx;
border-radius: 18rpx;
font-weight: 700;
}
.time{
color: #666;
}
.order-code{
margin-top: 18rpx;
font-size: 32rpx;
font-weight: 800;
}
.address{
display: flex;
margin-top: 18rpx;
}
.dot{
width: 44rpx;
height: 44rpx;
line-height: 44rpx;
text-align: center;
border-radius: 50%;
color: #fff;
margin-right: 16rpx;
}
.get{
background: #0b9b73;
}
.send{
background: #ff6f2c;
}
.name{
font-weight: 700;
}
.desc,.remark,.fee{
margin-top: 8rpx;
color: #666;
line-height: 38rpx;
}
.phone-row{
display: inline-block;
margin-top: 8rpx;
color: #0b9b73;
font-weight: 700;
line-height: 34rpx;
}
.goods-row{
display: flex;
align-items: center;
margin-top: 20rpx;
padding: 18rpx 20rpx;
border-radius: 18rpx;
background: rgba(247, 248, 248, 0.8);
}
.goods-title{
font-weight: 800;
margin-right: 16rpx;
}
.goods-desc{
flex: 1;
color: #666;
font-size: 24rpx;
}
.btn{
margin-top: 24rpx;
height: 76rpx;
line-height: 76rpx;
text-align: center;
border-radius: 38rpx;
background: linear-gradient(90deg, #e3ff96, #a6ffea);
font-weight: 800;
}
.empty{
text-align: center;
color: #888;
padding: 80rpx 0;
}
.product-popup-content{
width: 650rpx;
max-height: 850rpx;
padding: 30rpx;
border-radius: 28rpx;
background: #fff;
box-sizing: border-box;
}
.product-popup-title{
font-size: 32rpx;
font-weight: 800;
}
.product-popup-subtitle{
margin-top: 8rpx;
color: #888;
font-size: 24rpx;
}
.product-popup-list{
margin-top: 24rpx;
max-height: 680rpx;
overflow-y: auto;
}
.product-popup-card{
display: flex;
align-items: center;
padding: 18rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.product-popup-img img{
width: 90rpx;
height: 90rpx;
border-radius: 16rpx;
margin-right: 18rpx;
}
.product-popup-info{
flex: 1;
min-width: 0;
}
.product-popup-name{
font-weight: 800;
line-height: 38rpx;
}
.product-popup-spec{
margin-top: 8rpx;
color: #777;
font-size: 24rpx;
}
.product-popup-label{
margin-right: 10rpx;
color: #999;
}
.product-popup-quantity{
width: 80rpx;
text-align: right;
}
.product-popup-quantity-num{
font-weight: 800;
}
.product-popup-quantity-label,
.product-popup-empty{
color: #888;
font-size: 22rpx;
}
</style>

183
pages/shop/transferDeliveryOrderList.vue

@ -0,0 +1,183 @@
<template>
<view class="page">
<scroll-view class="list" scroll-y @scrolltolower="loadMore">
<view class="card" v-for="(item,index) in list" :key="item.id">
<view class="card-head">
<view class="tag">中转配送</view>
<view class="code" v-if="item.numberCode">#{{item.numberCode}}</view>
</view>
<view class="row">
<view class="label">中转点</view>
<view class="value">{{item.transferAddressName || item.shopName}}</view>
</view>
<view class="row">
<view class="label">配送员</view>
<view class="value phone-value" @tap.stop="makeCall(item.workerPhone)">
<text>{{item.workerName || '未分配'}}</text>
<text v-if="item.workerPhone" class="phone">{{item.workerPhone}}</text>
</view>
</view>
<view class="row">
<view class="label">用户</view>
<view class="value phone-value" @tap.stop="makeCall(item.receiverPhone)">
<text>{{item.receiverName}}</text>
<text v-if="item.receiverPhone" class="phone">{{item.receiverPhone}}</text>
</view>
</view>
<view class="address">{{item.receiverAddress}}</view>
<view class="image-row" v-if="item.transferArriveImage">
<image :src="item.transferArriveImage" mode="aspectFill"></image>
</view>
<view class="actions">
<view class="photo-btn" @tap="chooseImage(index)">拍照</view>
<view class="main-btn" @tap="transferArrive(index,item)">送达中转点</view>
</view>
</view>
<view class="empty" v-if="list.length === 0 && loadStatus === 'nomore'">暂无中转配送单</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
loadStatus: 'more',
totalPages: 1,
searchForm: {
pageNum: 1,
pageSize: 10,
status: 1,
deliveryType: 1,
transferDelivery: 1,
transferArriveEmpty: true,
shopId: '',
regionId: ''
}
}
},
onShow() {
this.resetList()
},
methods: {
back() {
uni.navigateBack()
},
resetList() {
this.searchForm.pageNum = 1
this.totalPages = 1
this.list = []
this.loadStatus = 'more'
this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).shop.id
const area = uni.getStorageSync('area')
this.searchForm.regionId = area ? JSON.parse(area).shop.regionId : ''
this.getList()
},
loadMore() {
if (this.searchForm.pageNum >= this.totalPages) return
this.searchForm.pageNum++
this.getList()
},
getList() {
this.NB.sendRequest("/mall/delivery/pageTransferDelivery",this.searchForm, false, 'post', 'application/json').then((res) => {
if (res.code == 200) {
const records = res.result.records || []
this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records)
this.totalPages = res.result.pages || 1
this.loadStatus = this.searchForm.pageNum >= this.totalPages ? 'nomore' : 'more'
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
chooseImage(index) {
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['camera', 'album'],
success: (res) => {
const file = res.tempFiles && res.tempFiles[0] ? res.tempFiles[0].tempFilePath : ''
if (file) this.uploadImage(index, file)
}
})
},
uploadImage(index, filePath) {
uni.uploadFile({
url: this.tui.interfaceUrl() + '/upload/file',
filePath,
name: 'file',
header: {
'accessToken': uni.getStorageSync('hiver_token'),
'content-type': 'multipart/form-data'
},
success: (res) => {
const data = JSON.parse(res.data)
this.$set(this.list[index], 'transferArriveImage', data.result)
}
})
},
transferArrive(index, item) {
console.log('快看快看',item)
this.NB.sendRequest("/mall/delivery/transferArrive",{
deliveryId: item.id,
transferArriveImage: item.transferArriveImage || ''
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.list.splice(index, 1)
uni.showToast({
title: '操作成功',
icon: 'none'
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
},
makeCall(phone) {
if (!phone) {
uni.showToast({
title: '暂无手机号',
icon: 'none'
})
return
}
uni.makePhoneCall({
phoneNumber: phone
})
}
}
}
</script>
<style>
.page{min-height:100vh;background:#F5F8F5;padding:120rpx 24rpx 24rpx;box-sizing:border-box;}
.nav{position:fixed;top:0;left:0;right:0;height:110rpx;background:#F5F8F5;z-index:9;display:flex;align-items:flex-end;justify-content:center;padding-bottom:18rpx;}
.back{position:absolute;left:24rpx;bottom:12rpx;width:68rpx;height:68rpx;border-radius:50%;background:#fff;display:flex;align-items:center;justify-content:center;}
.title{font-size:32rpx;font-weight:800;}
.list{height:calc(100vh - 140rpx);}
.card{background:#fff;border-radius:24rpx;padding:24rpx;margin-bottom:20rpx;box-shadow:0 10rpx 26rpx rgba(0,35,28,.08);}
.card-head{display:flex;align-items:center;margin-bottom:20rpx;}
.tag{background:#fff2e9;color:#f36c21;border-radius:12rpx;padding:8rpx 14rpx;font-weight:700;}
.code{margin-left:auto;font-weight:800;font-size:32rpx;}
.row{display:flex;line-height:46rpx;}
.label{width:120rpx;color:#7a8582;}
.value{flex:1;font-weight:700;}
.phone-value{display:flex;align-items:center;gap:16rpx;color:#123d35;}
.phone{color:#0b9b73;text-decoration:underline;}
.address{margin-top:10rpx;color:#6c7773;line-height:40rpx;}
.image-row image{width:160rpx;height:160rpx;border-radius:16rpx;margin-top:16rpx;}
.actions{display:flex;margin-top:22rpx;gap:18rpx;}
.photo-btn,.main-btn{flex:1;height:76rpx;line-height:76rpx;text-align:center;border-radius:38rpx;font-weight:700;}
.photo-btn{background:#f2f6f4;color:#0b9b73;}
.main-btn{background:linear-gradient(90deg,#e3ff96,#a6ffea);color:#00231c;}
.empty{text-align:center;color:#8a9692;padding:80rpx 0;}
</style>
Loading…
Cancel
Save