wangfukang 12 hours ago
parent
commit
9e4f2ada42
  1. 2
      App.vue
  2. 13
      components/print/index.js
  3. 35
      pages/index/index.vue
  4. 252
      pages/myCenter/businessInfo.vue
  5. 22
      pages/worker/workerOrderList.vue

2
App.vue

@ -150,7 +150,7 @@
this.onPlayAudio(10) this.onPlayAudio(10)
} else if (content.includes('您有一笔配送中订单用户申请退款')) { } else if (content.includes('您有一笔配送中订单用户申请退款')) {
this.onPlayAudio(11) this.onPlayAudio(11)
} else if (content.includes('抢单大厅来新单啦')) { } else if (content.includes('抢单大厅来新单啦') || content.includes('有新的中转配送单啦,请及时接单')) {
this.onPlayAudio(12) this.onPlayAudio(12)
} else if (content.includes('您有中转配送订单超时未送达中转点')) { } else if (content.includes('您有中转配送订单超时未送达中转点')) {
this.onPlayAudio(7) this.onPlayAudio(7)

13
components/print/index.js

@ -89,7 +89,7 @@ export default {
data1.deliveryType == 1 && data1.orderType == 3 ? data1.deliveryInfo.numberCode : data1.numberCode data1.deliveryType == 1 && data1.orderType == 3 ? data1.deliveryInfo.numberCode : data1.numberCode
); );
printerJobs.setAlign('ct').setSize(2, 2).setLineSpacing(60).print( printerJobs.setAlign('ct').setSize(2, 2).setLineSpacing(60).print(
(data1.deliveryInfo && data1.deliveryInfo.appointmentDelivery == 1 && data1.status != 7 && data1.status == 11) ? '预约单' : (data1.deliveryInfo && data1.deliveryInfo.appointmentDelivery == 1 && data1.status != 7 && data1.status != 11 && data1.status != 8 && data1.status != 12) ? '预约单' :
(data1.deliveryInfo && data1.deliveryInfo.transferDelivery == 1 && data1.status != 7 && data1.status != 11) ? '取餐码(' + data1.deliveryInfo.transferPickupCode +')' : (data1.deliveryInfo && data1.deliveryInfo.transferDelivery == 1 && data1.status != 7 && data1.status != 11) ? '取餐码(' + data1.deliveryInfo.transferPickupCode +')' :
(data1.status == 7 || data1.status == 11) ? '申请退款' : (data1.status == 7 || data1.status == 11) ? '申请退款' :
(data1.deliveryType == 1 && data1.orderType == 3) ? '面对面配送' : (data1.deliveryType == 1 && data1.orderType == 3) ? '面对面配送' :
@ -110,7 +110,11 @@ export default {
); );
} }
printerJobs.setSize(1, 1).setLineSpacing(40); printerJobs.setSize(1, 1).setLineSpacing(40);
printerJobs.setAlign('lt').print(data1.shopName + ((data1.deliveryType == 1 && data1.orderType == 3) ? '(' + if (this.isFaceToFaceDelivery(data1)) {
printerJobs.setAlign('lt').setSize(2, 2).setLineSpacing(60).print('本单编号:' + (data1.numberCode || ''));
printerJobs.setSize(1, 1).setLineSpacing(40);
}
printerJobs.setAlign('lt').print(data1.shopName + (this.isFaceToFaceDelivery(data1) ? '(' +
data1.numberCode + ')' : '')); data1.numberCode + ')' : ''));
printerJobs.setAlign('lt').print( printerJobs.setAlign('lt').print(
@ -190,7 +194,7 @@ export default {
printerJobs.print('锦鲤免单:-' + data1.freeAmount); printerJobs.print('锦鲤免单:-' + data1.freeAmount);
} }
printerJobs.print('合计金额:' + ((data1.goodsAmount + data1.deliveryFee + data1.packageFee).toFixed(2))); printerJobs.print('合计金额:' + ((data1.goodsAmount + data1.deliveryFee + data1.packageFee).toFixed(2)));
if (data1.mallRefundRecord != null) { if (data1.mallRefundRecord != null && data1.deliveryType != 2) {
printerJobs.print('应退金额:' + data1.totalAmount); printerJobs.print('应退金额:' + data1.totalAmount);
} else { } else {
printerJobs.print('实付金额:' + data1.totalAmount); printerJobs.print('实付金额:' + data1.totalAmount);
@ -247,6 +251,9 @@ export default {
} }
return '平台退款'; return '平台退款';
}, },
isFaceToFaceDelivery(order) {
return order && order.deliveryType == 1 && (order.orderType == 3 || (order.deliveryInfo && order.deliveryInfo.numberCode));
},
// 去除字符串中的 Emoji 表情 // 去除字符串中的 Emoji 表情
removeEmojis(str) { removeEmojis(str) {
if (!str) return ''; if (!str) return '';

35
pages/index/index.vue

@ -269,6 +269,7 @@
import tabBar from "@/components/tab-bar/tab-bar.vue"; import tabBar from "@/components/tab-bar/tab-bar.vue";
import deLivery from "@/components/tab-bar/delivery.vue"; import deLivery from "@/components/tab-bar/delivery.vue";
import myCenter from "@/components/tab-bar/myCenter.vue"; import myCenter from "@/components/tab-bar/myCenter.vue";
import printer from '@/components/print/index.js';
export default { export default {
data() { data() {
return { return {
@ -471,6 +472,7 @@
break; break;
default: default:
} }
if (!url) return;
uni.navigateTo({ uni.navigateTo({
url: url url: url
}) })
@ -546,6 +548,7 @@
title: '核销成功', title: '核销成功',
icon: 'none' icon: 'none'
}) })
that.printAfterComplete(productId)
} else { } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -576,6 +579,38 @@
} }
}) })
}, },
printAfterComplete(orderId) {
if (!orderId) return;
if (uni.getStorageSync('printingMethod') == 'cloud') {
this.NB.sendRequest("/mall/order/cloudPrint/" + orderId, {}, false, 'post',
'application/x-www-form-urlencoded').then((res) => {
if (res.code != 200) {
uni.showToast({
title: res.message || '云打印失败',
icon: 'none'
});
}
}).catch(() => {});
return;
}
getApp().globalData.printData.push({
order_id: orderId
});
if (!getApp().globalData.isPrinting) {
this.processPrintQueue();
}
},
processPrintQueue() {
if (getApp().globalData.printData.length === 0) {
getApp().globalData.isPrinting = false;
return;
}
getApp().globalData.isPrinting = true;
printer.getData(() => {
getApp().globalData.printData.shift();
this.processPrintQueue();
});
},
//tab //tab
changeIndex(index, type) { changeIndex(index, type) {
let that = this; let that = this;

252
pages/myCenter/businessInfo.vue

@ -8,29 +8,32 @@
<view class="form-wrap"> <view class="form-wrap">
<view class="content"> <view class="content">
<view class="section-title">营业设置</view> <view class="section-title">营业设置</view>
<view class="value"> <view class="business-hour-block">
<view class="name">营业开始时间</view> <view class="business-hour-title">营业时段</view>
<view class="text"> <view class="period-card" v-for="(item, index) in businessHourPeriods" :key="index">
<picker mode="time" :value="shop.businessHourBegin" start="00:00" end="23:59" <view class="period-header">
@change="bindTimeChange($event,'businessHourBegin')"> <text>时段{{index + 1}}</text>
<view class="picker-text" :class="{ placeholder: !shop.businessHourBegin }"> <view class="period-delete" v-if="businessHourPeriods.length > 1" @tap="removeBusinessHour(index)">删除</view>
{{shop.businessHourBegin || '请选择开始时间'}} </view>
<uni-icons type="bottom" size="14" color="#999"></uni-icons> <view class="period-times">
</view> <picker mode="time" :value="item.begin" start="00:00" end="23:59"
</picker> @change="bindBusinessTimeChange($event, index, 'begin')">
</view> <view class="time-picker" :class="{ placeholder: !item.begin }">
</view> {{item.begin || '开始时间'}}
<view class="value"> <uni-icons type="bottom" size="14" color="#999"></uni-icons>
<view class="name">营业结束时间</view> </view>
<view class="text"> </picker>
<picker mode="time" :value="shop.businessHourEnd" start="00:00" end="23:59" <view class="time-split"></view>
@change="bindTimeChange($event,'businessHourEnd')"> <picker mode="time" :value="item.end" start="00:00" end="23:59"
<view class="picker-text" :class="{ placeholder: !shop.businessHourEnd }"> @change="bindBusinessTimeChange($event, index, 'end')">
{{shop.businessHourEnd || '请选择结束时间'}} <view class="time-picker" :class="{ placeholder: !item.end }">
<uni-icons type="bottom" size="14" color="#999"></uni-icons> {{item.end || '结束时间'}}
</view> <uni-icons type="bottom" size="14" color="#999"></uni-icons>
</picker> </view>
</picker>
</view>
</view> </view>
<view class="add-period" @tap="addBusinessHour">+ 添加营业时段</view>
</view> </view>
<view class="value"> <view class="value">
<view class="name">营业状态</view> <view class="name">营业状态</view>
@ -89,8 +92,13 @@
virtualGroupCommissionRate: '', virtualGroupCommissionRate: '',
type: '', type: '',
isDelivery: 0, isDelivery: 0,
cookingTime: '' cookingTime: '',
businessHours: ''
}, },
businessHourPeriods: [{
begin: '',
end: ''
}],
submitLoading: false, submitLoading: false,
statusList: [{ statusList: [{
value: 0, value: 0,
@ -117,48 +125,120 @@
shopId: uni.getStorageSync('shopId') shopId: uni.getStorageSync('shopId')
}, false, 'get', 'application/x-www-form-urlencoded').then(res => { }, false, 'get', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) { if (res.code == 200) {
this.shop = res.result const result = Object.assign({}, res.result || {})
for (let key in this.shop) { for (let key in result) {
if (this.shop[key] === null) { if (result[key] === null) {
delete this.shop[key]; delete result[key]
} }
} }
this.shop = Object.assign({}, this.shop, result)
this.businessHourPeriods = this.parseBusinessHourPeriods(this.shop)
} else { } else {
uni.showToast(res.message) uni.showToast(res.message)
} }
}) })
}, },
bindTimeChange(e, key) { formatTimeValue(value) {
this.shop[key] = e.detail.value if (!value) return ''
if (typeof value === 'string') {
return value.length >= 5 ? value.substring(0, 5) : value
}
const date = value instanceof Date ? value : new Date(value)
if (isNaN(date.getTime())) return ''
const h = date.getHours()
const m = date.getMinutes()
return (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m)
},
parseBusinessHourPeriods(takeaway) {
if (!takeaway) {
return [{
begin: '',
end: ''
}]
}
let list = takeaway.businessHourList
if ((!list || !list.length) && takeaway.businessHours) {
try {
list = typeof takeaway.businessHours === 'string' ? JSON.parse(takeaway.businessHours) : takeaway.businessHours
} catch (e) {
list = []
}
}
if (list && list.length) {
return list.map(item => ({
begin: this.formatTimeValue(item.begin),
end: this.formatTimeValue(item.end)
}))
}
if (takeaway.businessHourBegin || takeaway.businessHourEnd) {
return [{
begin: this.formatTimeValue(takeaway.businessHourBegin),
end: this.formatTimeValue(takeaway.businessHourEnd)
}]
}
return [{
begin: '',
end: ''
}]
},
addBusinessHour() {
this.businessHourPeriods.push({
begin: '',
end: ''
})
},
removeBusinessHour(index) {
if (this.businessHourPeriods.length <= 1) return
this.businessHourPeriods.splice(index, 1)
},
bindBusinessTimeChange(e, index, key) {
this.$set(this.businessHourPeriods[index], key, e.detail.value)
}, },
statusChange(e) { statusChange(e) {
const item = this.statusList[e.detail.value] const item = this.statusList[e.detail.value]
if (item) this.shop.status = item.value if (item) this.shop.status = item.value
}, },
validateForm() { buildBusinessHoursPayload() {
if (!this.shop.businessHourBegin) return '请选择营业开始时间' const periods = []
if (!this.shop.businessHourEnd) return '请选择营业结束时间' for (let i = 0; i < this.businessHourPeriods.length; i++) {
return '' const begin = this.formatTimeValue(this.businessHourPeriods[i].begin)
}, const end = this.formatTimeValue(this.businessHourPeriods[i].end)
submit(){ if (!begin || !end) {
const error = this.validateForm() uni.showToast({
if (error) { title: '请完善第' + (i + 1) + '个营业时段',
icon: 'none'
})
return null
}
periods.push({
begin,
end
})
}
if (!periods.length) {
uni.showToast({ uni.showToast({
title: error, title: '请至少设置一个营业时段',
icon: 'none' icon: 'none'
}) })
return return null
} }
return periods
},
submit(){
const periods = this.buildBusinessHoursPayload()
if (!periods) return
const payload = { const payload = {
id: this.shop.id, id: this.shop.id,
shopId: this.shop.shopId || uni.getStorageSync('shopId'), shopId: this.shop.shopId || uni.getStorageSync('shopId'),
businessHourBegin: this.shop.businessHourBegin, businessHours: JSON.stringify(periods),
businessHourEnd: this.shop.businessHourEnd, businessHourBegin: periods[0].begin,
businessHourEnd: periods[0].end,
status: Number(this.shop.status) status: Number(this.shop.status)
} }
this.submitLoading = true this.submitLoading = true
this.NB.sendRequest('/app/shoptakeaway/update', payload, false, 'POST', 'application/x-www-form-urlencoded').then(res => { this.NB.sendRequest('/app/shoptakeaway/update', payload, false, 'POST', 'application/x-www-form-urlencoded').then(res => {
this.submitLoading = false
if (res.code == 200) { if (res.code == 200) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -171,6 +251,8 @@
} else { } else {
uni.showToast(res.message) uni.showToast(res.message)
} }
}).catch(() => {
this.submitLoading = false
}) })
} }
} }
@ -273,6 +355,92 @@
.section-title + .value { .section-title + .value {
border-top: none; border-top: none;
} }
.business-hour-block {
padding: 0 28rpx 28rpx;
border-top: 1rpx solid #edf3f0;
}
.section-title + .business-hour-block {
border-top: none;
}
.business-hour-title {
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
font-weight: 800;
color: #153c34;
}
.period-card {
margin-bottom: 20rpx;
padding: 22rpx;
border-radius: 22rpx;
background: #f7fbf9;
border: 1rpx solid #edf3f0;
}
.period-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 18rpx;
font-size: 26rpx;
font-weight: 800;
color: #153c34;
}
.period-delete {
color: #ff5a5f;
font-size: 24rpx;
font-weight: 700;
}
.period-times {
display: flex;
align-items: center;
}
.period-times picker {
flex: 1;
min-width: 0;
}
.time-picker {
height: 72rpx;
line-height: 72rpx;
text-align: center;
border-radius: 16rpx;
background: #fff;
border: 1rpx solid #e4ece8;
font-size: 26rpx;
color: #263f39;
}
.time-picker.placeholder {
color: #9aa7a3;
}
.time-split {
width: 66rpx;
text-align: center;
color: #7b8b86;
font-size: 24rpx;
font-weight: 700;
}
.add-period {
height: 76rpx;
line-height: 76rpx;
text-align: center;
border-radius: 18rpx;
border: 1rpx dashed #9adfcd;
color: #0d7f69;
font-size: 26rpx;
font-weight: 800;
background: rgba(166, 255, 234, 0.2);
}
.name { .name {
width: 210rpx; width: 210rpx;

22
pages/worker/workerOrderList.vue

@ -27,7 +27,7 @@
</view> </view>
<view class="worker-order-fixed-holder"></view> <view class="worker-order-fixed-holder"></view>
<view class="list-wrap"> <scroll-view class="list-wrap" scroll-y @scrolltolower="loadMore">
<view class="box1" @tap="goDetail(item)" v-for="(item,index) in orderList" :key="index"> <view class="box1" @tap="goDetail(item)" v-for="(item,index) in orderList" :key="index">
<view class="order-head"> <view class="order-head">
<view class="type-tag" :class="'type-' + item.deliveryType"> <view class="type-tag" :class="'type-' + item.deliveryType">
@ -110,7 +110,8 @@
<view class="empty-box" v-if="orderList.length == 0 && loadStatus == 'nomore'"> <view class="empty-box" v-if="orderList.length == 0 && loadStatus == 'nomore'">
暂无已完成订单 暂无已完成订单
</view> </view>
</view> <view class="bottom-space"></view>
</scroll-view>
<uni-popup ref="productPopup" background-color="transparent"> <uni-popup ref="productPopup" background-color="transparent">
<view class="product-popup-content"> <view class="product-popup-content">
@ -144,7 +145,6 @@
</view> </view>
</uni-popup> </uni-popup>
<view class="bottom-space"></view>
</view> </view>
</template> </template>
@ -174,9 +174,7 @@
} }
}, },
onReachBottom() { onReachBottom() {
if (this.searchForm.pageNum >= this.totalPages) return; this.loadMore();
this.searchForm.pageNum++;
this.getList();
}, },
filters: { filters: {
formatHourMinute(value) { formatHourMinute(value) {
@ -260,6 +258,12 @@
uni.hideLoading(); uni.hideLoading();
}) })
}, },
loadMore() {
if (this.loadStatus == 'loading') return;
if (this.searchForm.pageNum >= this.totalPages) return;
this.searchForm.pageNum++;
this.getList();
},
deliveryTypeText(type) { deliveryTypeText(type) {
if (type == 1) return '外卖'; if (type == 1) return '外卖';
if (type == 2) return '代取快递'; if (type == 2) return '代取快递';
@ -318,10 +322,10 @@
.page1 { .page1 {
width: 100%; width: 100%;
height: 100%; height: 100vh;
font-size: 24rpx; font-size: 24rpx;
position: relative; position: relative;
padding-bottom: 40rpx; overflow: hidden;
} }
.worker-order-fixed { .worker-order-fixed {
@ -402,9 +406,11 @@
.list-wrap { .list-wrap {
width: 92%; width: 92%;
height: calc(100vh - 462rpx);
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
z-index: 1; z-index: 1;
box-sizing: border-box;
} }
.search-card { .search-card {

Loading…
Cancel
Save