dingdong-master/pages/order-manage/order-manage.vue

765 lines
31 KiB
Vue
Raw Normal View History

2022-05-06 23:47:18 +08:00
<template>
<page-meta :page-style="'overflow:'+(ifShowPageMeta?'hidden':'visible')"></page-meta>
<view>
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">接收的任务</block>
</cu-custom>
<view class="sticky-bar" :style="[{top: stickyTop + 'px'}]">
<!-- 条件筛选栏 -->
<view class="padding bg-white solid-bottom">
<view class="flex justify-start align-center">
<text class="margin-right-xs inline-lable">全部</text>
<!-- <my-uni-combox class="inline-combox margin-right-xs" :candidates="stateList" placeholder="请选择"
v-model="formData.state"></my-uni-combox>
<my-uni-combox class="inline-combox" :candidates="subStateList" placeholder="请选择"
v-model="formData.subState"></my-uni-combox> -->
<!-- 区域筛选picker -->
2022-06-13 16:13:10 +08:00
<picker class="inline-combox margin-right-xs" :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange" :value="areaMultiIndex" :range-key="'areaName'" :range="areaList">
<input class="radius-input" disabled :value="formData.area ? formData.area[0].areaName + '-' + formData.area[1].areaName + '-' + formData.area[2].areaName : ''"
2022-05-06 23:47:18 +08:00
placeholder="请选择区域"></input>
</picker>
<!-- 品类筛选picker -->
2022-06-13 16:13:10 +08:00
<picker class="inline-combox" :mode="'multiSelector'" @change="categoryChange" @columnchange="categoryColChange" :value="categoryMultiIndex" :range-key="'goodsCategoryName'" :range="categoryList">
<input class="line-input radius-input" disabled :value="formData.category ? formData.category[0].goodsCategoryName + '-' + formData.category[1].goodsCategoryName + '-' + formData.category[2].goodsCategoryName : ''"
2022-05-06 23:47:18 +08:00
placeholder="请选择品类"></input>
</picker>
</view>
<view class="flex justify-between align-center margin-top-xs">
<input class="line-input radius-input margin-right-sm" v-model="formData.orderKeywords"
placeholder="请输入订单关键字"></input>
<view class="text-xl text-bold">
2022-06-13 16:13:10 +08:00
<text class="cuIcon-search margin-right-sm" @click="searchOrder"></text>
<text class="cuIcon-refresh" @click="resetConditions"></text>
2022-05-06 23:47:18 +08:00
</view>
</view>
</view>
<!-- 状态分类tab -->
<view class="cu-list grid no-border col-5 padding-top-sm bg-white">
<view class="cu-item" :class="stateCur === 0 ? 'bg-main-color light' : ''" :data-id="0" @tap="statusSelect">
<view class="margin-bottom-xs">超时单</view>
<view>({{myOrders.summary.overtimeOrderNum}})</view>
</view>
<view class="cu-item" :class="stateCur === 1 ? 'bg-main-color light' : ''" :data-id="1" @tap="statusSelect">
<view class="margin-bottom-xs">今日单</view>
<view>({{myOrders.summary.todayOrderNum}})</view>
</view>
<view class="cu-item" :class="stateCur === 2 ? 'bg-main-color light' : ''" :data-id="2" @tap="statusSelect">
<view class="margin-bottom-xs">明日单</view>
<view>({{myOrders.summary.tomorrowOrderNum}})</view>
</view>
<view class="cu-item" :class="stateCur === 3 ? 'bg-main-color light' : ''" :data-id="3" @tap="statusSelect">
<view class="margin-bottom-xs">急报单</view>
<view>({{myOrders.summary.urgentMsgOrderNum}})</view>
</view>
<view class="cu-item" :class="stateCur === 4 ? 'bg-main-color light' : ''" :data-id="4" @tap="statusSelect">
<view class="margin-bottom-xs">新订单</view>
<view>({{myOrders.summary.newOrderNum}})</view>
</view>
</view>
<!-- 子状态分类tab -->
<scroll-view scroll-x class="bg-white nav text-center" :scroll-with-animation="true" :scroll-left="scrollLeft">
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''" v-for="(item,index) in subStateList"
:key="index" @tap="tabSelect" :data-id="index">
{{item.name}}
</view>
</scroll-view>
</view>
<!-- tab content -->
<view class="padding bg-white margin-top-sm margin-lr-sm" v-for="(order, index) in orderList">
<view class="flex justify-between">
2022-06-13 16:13:10 +08:00
<view class="text-lg text-bold text-cut">{{order.goodsName}}</view>
2022-05-06 23:47:18 +08:00
<!-- 不同状态订单使用不同角标 -->
2022-06-02 17:39:45 +08:00
<view v-if="order.orderStatus === 0" class="right-tag padding-lr-sm padding-tb-xs bg-cyan"></view>
<view v-else-if="order.orderStatus === 1" class="right-tag padding-lr-sm padding-tb-xs bg-main-color"></view>
<view v-else-if="order.orderStatus === 2" class="right-tag padding-lr-sm padding-tb-xs bg-yellow"></view>
2022-06-18 02:03:07 +08:00
<view v-else-if="order.orderStatus === 3" class="right-tag padding-lr-sm padding-tb-xs bg-purple"></view>
<view v-else-if="order.orderStatus === 6" class="right-tag padding-lr-sm padding-tb-xs bg-orange"></view>
<view v-else-if="order.orderStatus === 4" class="right-tag padding-lr-sm padding-tb-xs bg-green"></view>
2022-05-06 23:47:18 +08:00
</view>
<view>
<view v-for="(tag, index1) in order.tags" v-if="tag.level === 'error'" class='cu-tag margin-right-xs radius line-red margin-top-xs'>{{tag.content}}</view>
<view v-else-if="tag.level === 'info'" class='cu-tag margin-right-xs radius line-main-color margin-top-xs'>{{tag.content}}</view>
</view>
<view class="margin-top-sm">
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-people"></text></text>
2022-06-13 16:13:10 +08:00
<text>姓名{{order.customerName}}</text>
2022-05-06 23:47:18 +08:00
</view>
<view class="margin-top-sm">
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-location"></text></text>
<text class="margin-right-xs">{{order.address}}</text>
<text class="text-lg" @tap="copyData(order.address)"><text class="cuIcon-copy"></text></text>
</view>
2022-06-13 16:13:10 +08:00
<view class="margin-top-sm">
2022-05-06 23:47:18 +08:00
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-time"></text></text>
2022-06-20 18:08:22 +08:00
<text>服务时间{{order.expectTimeStart + '~' + order.expectTimeEnd}}</text>
2022-05-06 23:47:18 +08:00
</view>
2022-06-17 18:34:14 +08:00
<view class="margin-top-sm" v-if="tabCur !== 0 && tabCur !== 1">
2022-05-06 23:47:18 +08:00
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-time"></text></text>
2022-06-17 18:34:14 +08:00
<text>上门时间{{order.workBeginTime}}</text>
2022-05-06 23:47:18 +08:00
</view>
2022-06-02 17:39:45 +08:00
<view class="margin-top-sm flex justify-start align-center" v-if="order.orderStatus === 2">
2022-05-06 23:47:18 +08:00
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-repair"></text></text>
<text>距上门</text>
<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
2022-06-20 18:08:22 +08:00
:day="$dateUtil.countDownDiff(order.expectTimeEnd).day"
:hour="$dateUtil.countDownDiff(order.expectTimeEnd).hour"
:minute="$dateUtil.countDownDiff(order.expectTimeEnd).min"
:second="$dateUtil.countDownDiff(order.expectTimeEnd).seconds">
2022-05-06 23:47:18 +08:00
</uni-countdown>
</view>
2022-06-02 17:39:45 +08:00
<view class="margin-top-sm flex justify-start align-center" v-if="order.subState === 4 && order.chargeReachDate">
2022-05-22 21:52:14 +08:00
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-time"></text></text>
<text>距到帐</text>
<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
:day="$dateUtil.countDownDiff(order.chargeReachDate).day"
:hour="$dateUtil.countDownDiff(order.chargeReachDate).hour"
:minute="$dateUtil.countDownDiff(order.chargeReachDate).min"
:second="$dateUtil.countDownDiff(order.chargeReachDate).seconds">
</uni-countdown>
</view>
2022-05-06 23:47:18 +08:00
<!-- 不同状态订单支持不同操作按钮 -->
2022-06-02 17:39:45 +08:00
<view v-if="order.orderStatus === 0">
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-popup="dispatchOrder" @click="getCanAssignList(order)" @tap="togglePopup($event, order)">派单</button>
2022-05-06 23:47:18 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm">改价</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm">转发</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm">确认接单</button>
</view>
2022-06-02 17:39:45 +08:00
<view v-if="order.orderStatus === 1">
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-popup="dispatchOrder" @click="getCanAssignList(order)" @tap="togglePopup($event, order)">派单</button>
2022-06-16 23:14:43 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click="assignWork2MySelf(order)">自己承接</button>
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showTimeArrangeModal" @tap="showModal($event, order)">预约时间</button>
2022-05-06 23:47:18 +08:00
</view>
2022-06-02 17:39:45 +08:00
<view v-if="order.orderStatus === 2">
2022-06-16 23:14:43 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click="showServOrderDetail(order)">查看</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @tap="makePhoneCall(order.customerPhone)">联系客户</button>
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showEditTimeArrangeModal" @tap="showModal($event, order)">修改时间</button>
2022-06-18 02:03:07 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click="workBegin(order)">立即上门</button>
2022-05-06 23:47:18 +08:00
</view>
2022-06-02 17:39:45 +08:00
<view v-if="order.orderStatus === 3">
2022-06-16 23:14:43 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @click="showServOrderDetail(order)">查看</button>
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showNewServPriceModal" @tap="showModal($event, order)">改价</button>
2022-06-16 23:14:43 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @tap="makePhoneCall(order.customerPhone)">联系客户</button>
2022-06-18 02:03:07 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showEditTimeArrangeModal" @tap="showModal($event, order)">重新排期</button>
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @tap="finishOrder(order)">发起完单</button>
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showPayQrcodeModal" @tap="makePayQrcode($event, order)">生成付款码</button>
2022-05-06 23:47:18 +08:00
</view>
2022-06-18 02:03:07 +08:00
<!-- <view v-if="order.orderStatus === 4">
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="sendUrgentMsgModal" @tap="showModal($event, order)">师傅急报</button>
2022-06-18 02:03:07 +08:00
</view> -->
<!-- <view v-if="order.orderStatus === 'afterSaleService'">
2022-06-16 23:14:43 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" @tap="makePhoneCall(order.customerPhone)">联系客户</button>
2022-06-13 16:13:10 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm" data-modal="showEditTimeArrangeModal" @tap="showModal($event, order)">修改时间</button>
2022-05-22 21:52:14 +08:00
<button class="cu-btn bg-main-color margin-right-xs shadow-blur margin-top-sm">立即上门</button>
2022-06-18 02:03:07 +08:00
</view> -->
2022-05-22 21:52:14 +08:00
<view class="margin-top-sm solid-top padding-top-sm" v-if="order.afterSaleType === 'finished'">
<view class="flex justify-start align-end">
<text>退单申请</text>
<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
:day="$dateUtil.countDownDiff(order.applyRefundLastTime).day"
:hour="$dateUtil.countDownDiff(order.applyRefundLastTime).hour"
:minute="$dateUtil.countDownDiff(order.applyRefundLastTime).min"
:second="$dateUtil.countDownDiff(order.applyRefundLastTime).seconds">
</uni-countdown>
</view>
<view class="margin-top-xs">
<text>退款金额</text><text class="text-price">{{order.refundAmount}}</text>
<text class="margin-left-sm">到帐金额</text><text class="text-price">{{order.refundReachAmount}}</text>
</view>
<view class="margin-top-xs">
<text>退款原因</text><text>{{order.refundReason}}</text>
</view>
<view class="flex justify-end margin-top-xs">
<button class="cu-btn sm bg-yellow margin-right-sm" @click="showAfterSalePic(index)" @tap="showModalByRef('showPicModal')">查看</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-if="order.refundStatus !== 'rejected'" @click="updateRefundStatus('rejected', index)">拒绝处理</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-else disabled type="">已拒绝</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-if="order.refundStatus !== 'recevied'" @click="updateRefundStatus('recevied', index)">同意退单</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-else disabled type="">已同意</button>
</view>
</view>
<view class="margin-top-sm solid-top padding-top-sm" v-else-if="order.afterSaleType === 'unfinished'">
<view class="flex justify-start align-end">
<text>待处理售后</text>
<uni-countdown :show-colon="false" :backgroundColor="'#eee'"
:day="$dateUtil.countDownDiff(order.waitAfterSaleLastTime).day"
:hour="$dateUtil.countDownDiff(order.waitAfterSaleLastTime).hour"
:minute="$dateUtil.countDownDiff(order.waitAfterSaleLastTime).min"
:second="$dateUtil.countDownDiff(order.waitAfterSaleLastTime).seconds">
</uni-countdown>
</view>
<view class="margin-top-xs">
<text>售后原因</text><text>{{order.afterSaleReason}}</text>
</view>
<view class="margin-top-xs">完成操作点击处理完成提交由客服回访</view>
<view class="flex justify-end align-end margin-top-xs">
<button class="cu-btn sm bg-yellow margin-right-sm" @click="showAfterSalePic(index)" @tap="showModalByRef('showPicModal')">查看</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-if="order.afterSaleDealStatus !== 'rejected'" @click="updateAfterSaleDealStatus('rejected', index)">拒绝处理</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-else disabled type="">已拒绝</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-if="order.afterSaleDealStatus !== 'recevied'" @click="updateAfterSaleDealStatus('recevied', index)">处理完成</button>
<button class="cu-btn sm bg-yellow margin-right-sm" v-else disabled type="">已同意</button>
</view>
</view>
2022-06-02 17:39:45 +08:00
<view class="margin-top-sm solid-top padding-top-sm" v-if="Boolean(order.remark)">
2022-05-06 23:47:18 +08:00
<text class="text-main-color text-lg margin-right-xs"><text class="cuIcon-comment"></text></text>
2022-06-02 17:39:45 +08:00
<text>备注{{order.remark}}</text>
2022-05-06 23:47:18 +08:00
</view>
</view>
<load-status-bar ref="loadStatusBar" @loadMore="loadMasterOrderPage"></load-status-bar>
2022-05-06 23:47:18 +08:00
<!-- 模态框 -->
2022-06-13 16:13:10 +08:00
<time-arrange :show="showTimeArrangeModal" :data="curOrder" :curDate="curDate" @showArrangeFailTime="showArrangeFailTime" @editServTime="editServTime"></time-arrange>
2022-05-06 23:47:18 +08:00
<time-arrange-fail :show="showArrangeFailTimeModal" :data="curOrder"></time-arrange-fail>
2022-05-09 10:00:16 +08:00
<new-serv-price :show="showNewServPriceModal" :data="curOrder"></new-serv-price>
2022-06-18 02:03:07 +08:00
<pay-qrcode ref="payQrcode" :show="showPayQrcodeModal" :data="curOrder" @finishQrPay="finishQrPay"></pay-qrcode>
<edit-time-arrange :show="showEditTimeArrangeModal" :data="curOrder" :curDate="curDate" @showArrangeFailTime="showArrangeFailTime" @editServTime="editServTime" :ifRollback2WS="true"></edit-time-arrange>
2022-05-22 21:52:14 +08:00
<urgent-msg :show="sendUrgentMsgModal" @hideModal="hideModal"></urgent-msg>
<pic-modal ref="showPicModal" :imgList="picModalImgList"></pic-modal>
2022-05-06 23:47:18 +08:00
<!-- popup -->
<uni-popup ref="dispatchOrder" type="bottom" @change="changePopupState">
<view class="text-bold text-gray text-lg text-center left-top-sm-bar" data-popup="dispatchOrder" @click="togglePopup"><text
class="cuIcon-close"></text></view>
2022-06-13 16:13:10 +08:00
<view ref="dispatchOrderContent" class="bg-white padding" style="padding-top: 74rpx; min-height: 600rpx;">
<dispatch-order v-if="myTeamMembers && myTeamMembers.length > 0" @assignWork="assignWork" :members="myTeamMembers"></dispatch-order>
<view v-else class="align-center-view text-xl">无可指派的师傅</view>
2022-05-06 23:47:18 +08:00
</view>
<!-- 底部占位 -->
<view class="cu-bar bg-white fixed-bottom-bar"></view>
</uni-popup>
</view>
</template>
<script>
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
import timeArrange from '@/pages/order-manage/modal/time-arrange.vue';
import timeArrangeFail from '@/pages/order-manage/modal/time-arrange-fail.vue';
2022-05-09 10:00:16 +08:00
import editTimeArrange from '@/pages/order-manage/modal/edit-time-arrange.vue';
2022-05-06 23:47:18 +08:00
import dispatchOrder from '@/pages/order-manage/dispatch-order.vue';
2022-05-09 10:00:16 +08:00
import newServPrice from '@/pages/order-manage/modal/new-serv-price.vue';
import payQrcode from '@/pages/order-manage/modal/pay-qrcode.vue';
2022-05-22 21:52:14 +08:00
import urgentMsg from '@/pages/order-manage/modal/urgent-msg.vue';
import picModal from '@/components/modal/pic-modal.vue';
2022-06-02 17:39:45 +08:00
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
2022-05-06 23:47:18 +08:00
export default {
components: {
myUniCombox,
timeArrange,
timeArrangeFail,
2022-05-09 10:00:16 +08:00
editTimeArrange,
dispatchOrder,
newServPrice,
2022-05-22 21:52:14 +08:00
payQrcode,
urgentMsg,
2022-06-02 17:39:45 +08:00
picModal,
loadStatusBar
2022-05-06 23:47:18 +08:00
},
data() {
return {
formData: {
category: null,
area: null,
orderKeywords: ''
},
areaList: [],
areaMultiIndex: [0, 0, 0],
categoryList: [],
categoryMultiIndex: [0, 0, 0],
// stateList: [{
// code: 1,
// name: '超时单'
// }, {
// code: 2,
// name: '今日单'
// }, {
// code: 3,
// name: '明日单'
// }, {
// code: 4,
// name: '急报单'
// }, {
// code: 5,
// name: '新订单'
// }],
subStateList: [{
code: 1,
name: '未约/未排'
}, {
code: 2,
name: '待上门'
}, {
code: 3,
name: '服务中'
}, {
2022-06-02 17:39:45 +08:00
code: 6,
2022-05-06 23:47:18 +08:00
name: '确认中'
2022-06-13 16:13:10 +08:00
},
// {
// code: '-',
// name: '售后中'
// },
{
2022-06-02 17:39:45 +08:00
code: 4,
2022-05-06 23:47:18 +08:00
name: '已完成'
}],
myOrders: {},
orderList: [],
2022-06-02 17:39:45 +08:00
pageParams: [],
2022-05-06 23:47:18 +08:00
curOrder: {},
myTeamMembers: [],
scrollLeft: 0,
stickyTop: this.CustomBar,
tabCur: 0,
stateCur: 0,
showTimeArrangeModal: false,
showArrangeFailTimeModal: false,
2022-05-09 10:00:16 +08:00
showNewServPriceModal: false,
showPayQrcodeModal: false,
showEditTimeArrangeModal: false,
2022-05-22 21:52:14 +08:00
sendUrgentMsgModal: false,
ifShowPageMeta: false,
2022-06-13 16:13:10 +08:00
picModalImgList: [],
2022-06-16 23:14:43 +08:00
curDate: '',
curUserInfo: {}
2022-05-06 23:47:18 +08:00
}
},
onLoad() {
this.loadData();
this.bindEvent();
},
onUnload() {
this.offBindEvent();
},
methods: {
async loadData() {
2022-06-13 16:13:10 +08:00
// let myTeamInfo = await this.$api.data('myTeamInfo');
// this.myTeamMembers = myTeamInfo.members;
2022-05-06 23:47:18 +08:00
this.myOrders = await this.$api.data('myOrders');
2022-06-02 17:39:45 +08:00
// this.orderList = this.myOrders.orderList;
2022-06-13 16:13:10 +08:00
// this.areaList = await this.$api.data('areaList');
// this.categoryList = await this.$api.data('categoryList');
2022-06-02 17:39:45 +08:00
2022-06-13 16:13:10 +08:00
// 初始化分页参数
2022-06-02 17:39:45 +08:00
for(let i = 0; i < this.subStateList.length; i++) {
this.pageParams.push({
pageNum: 0
});
}
// 初始化订单列表
this.loadMasterOrderPage({
orderStatus: this.subStateList[0].code
2022-06-13 16:13:10 +08:00
});
// 初始化品类及区域列表
this.loadCategoryList();
this.loadRegionList();
// 初始化指派成员
2022-06-16 23:14:43 +08:00
this.loadTeamMembers();
// 获取当前登录用户信息
this.curUserInfo = this.getCurUserInfo();
2022-06-02 17:39:45 +08:00
},
reloadMasterOrderPage(params = {}) {
this.pageParams = [];
for(let i = 0; i < this.subStateList.length; i++) {
this.pageParams.push({
pageNum: 0
});
}
this.orderList = [];
this.$refs.loadStatusBar.showLoadMore();
2022-06-13 16:13:10 +08:00
this.loadMasterOrderPage();
2022-06-02 17:39:45 +08:00
},
async loadMasterOrderPage(params = {}) {
params.pageNum = this.pageParams[this.tabCur].pageNum;
params.pageSize = this.$globalData.initPageSize;
2022-06-13 16:13:10 +08:00
params.orderStatus = this.subStateList[this.tabCur].code;
2022-06-02 17:39:45 +08:00
this.$refs.loadStatusBar.showLoading();
try {
2022-06-13 16:13:10 +08:00
let res = null;
// 不同状态的单需要请求不同接口
if (this.tabCur === 0) {
res = await this.$request.qryMasterOrderPage(params);
} else {
res = await this.$request.qryDetailOrderPage(params);
2022-06-13 16:13:10 +08:00
}
if (res && res.rows) {
let rowsLength = res.rows.length;
if (rowsLength === 0) {
this.orderList = [];
} else if (rowsLength > 0) {
this.orderList = this.orderList.concat(res.rows);
this.pageParams[this.tabCur].pageNum++;
if (rowsLength === this.pageSize) {
this.$refs.loadStatusBar.showLoadMore();
return;
}
2022-06-02 17:39:45 +08:00
}
}
this.$refs.loadStatusBar.showLoadOver();
} catch (e) {
console.error(e)
this.$refs.loadStatusBar.showLoadErr();
}
2022-05-06 23:47:18 +08:00
},
2022-06-13 16:13:10 +08:00
async loadCategoryList(idArr) {
let typeList = await this.$request.listByStep();
typeList = typeList.data;
let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
let subTypeList = await this.$request.listByStep({
goodsCategoryId: col1Id
});
subTypeList = subTypeList.data;
let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId;
let subSubTypeList = await this.$request.listByStep({
goodsCategoryId: col2Id
});
subSubTypeList = subSubTypeList.data;
this.categoryList.push(typeList);
this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList);
},
async loadRegionList() {
let regionList = await this.$request.areaListByStep();
regionList = regionList.data;
let subRegionList = [];
let subSubRegionList = [];
if (regionList && regionList.length > 0) {
subRegionList = await this.$request.areaListByStep({
parentCode: regionList[0].areaCode
});
subRegionList = subRegionList.data;
}
if (subRegionList && subRegionList.length > 0) {
subSubRegionList = await this.$request.areaListByStep({
parentCode: subRegionList[0].areaCode
});
subSubRegionList = subSubRegionList.data;
}
this.areaList.push(regionList);
this.areaList.push(subRegionList);
this.areaList.push(subSubRegionList);
},
async loadTeamMembers() {
let res = await this.$request.getTeamPage();
this.myTeamMembers = res.rows;
},
2022-05-06 23:47:18 +08:00
bindEvent() {
uni.$on(this.$globalFun.HIDE_MODAL, this.hideModal);
},
offBindEvent() {
uni.$off(this.$globalFun.HIDE_MODAL);
},
2022-06-13 16:13:10 +08:00
async regionColChange(e) {
let colObj = e.detail;
if (colObj.column == 0) {
// 通过一级查二级
let subAreaList = await this.$request.areaListByStep({parentCode: this.areaList[0][colObj.value].areaCode});
subAreaList = subAreaList.data;
let subSubAreaList = [];
if (subAreaList.length) {
subSubAreaList = await this.$request.areaListByStep({parentCode: subAreaList[0].areaCode});
subSubAreaList = subSubAreaList.data;
}
this.areaList.pop();
this.areaList.pop();
this.areaList.push(subAreaList);
this.areaList.push(subSubAreaList);
this.areaMultiIndex = [colObj.value, 0, 0];
} else if (colObj.column == 1) {
// 通过二级查三级
let subAreaList = await this.$request.areaListByStep({parentCode: this.regionList[0][colObj.value].areaCode});
subAreaList = subAreaList.data;
this.areaList.pop();
this.areaList.push(subAreaList);
this.areaMultiIndex = [this.areaMultiIndex[0], colObj.value, 0];
}
},
2022-05-06 23:47:18 +08:00
regionChange(e) {
this.areaMultiIndex = e.detail.value;
let chosenArea = [];
for(let i = 0; i < this.areaList.length; i++) {
chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]);
}
this.formData.area = chosenArea;
},
2022-06-13 16:13:10 +08:00
async categoryColChange(e) {
let colObj = e.detail;
if (colObj.column == 0) {
// 通过一级查询二级
let subTypeList = await this.$request.listByStep({
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
});
subTypeList = subTypeList.data;
let subSubTypeList = await this.$request.listByStep({
goodsCategoryId: subTypeList[0].goodsCategoryId
});
subSubTypeList = subSubTypeList.data;
this.categoryList.pop();
this.categoryList.pop();
this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList);
this.categoryMultiIndex = [colObj.value, 0, 0];
} else if (colObj.column == 1) {
// 通过二级查三级
let subSubTypeList = await this.$request.listByStep({
goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId
});
subSubTypeList = subSubTypeList.data;
this.categoryList.pop();
this.categoryList.push(subSubTypeList);
this.categoryMultiIndex = [this.categoryMultiIndex[0], colObj.value, 0];
}
},
2022-05-06 23:47:18 +08:00
categoryChange(e) {
this.categoryMultiIndex = e.detail.value;
let chosenCategory = [];
for(let i = 0; i < this.categoryList.length; i++) {
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
}
this.formData.category = chosenCategory;
},
2022-06-13 16:13:10 +08:00
searchOrder(e) {
2022-05-06 23:47:18 +08:00
console.log(e)
console.log(this.formData)
2022-06-13 16:13:10 +08:00
},
resetConditions() {
this.formData = {
category: null,
area: null,
orderKeywords: ''
}
2022-05-06 23:47:18 +08:00
},
tabSelect(e) {
this.tabCur = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
2022-06-02 17:39:45 +08:00
// this.reloadMasterOrderPage(this.stateCur, this.subStateList[this.tabCur].code);
2022-06-13 16:13:10 +08:00
this.reloadMasterOrderPage();
2022-05-06 23:47:18 +08:00
},
statusSelect(e) {
this.stateCur = e.currentTarget.dataset.id;
this.loadData(this.stateCur, this.subStateList[this.tabCur].code);
},
2022-06-13 16:13:10 +08:00
getCurDateAndTime() {
let date = new Date();
this.curDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + " 00:00:00";
2022-05-06 23:47:18 +08:00
},
2022-06-13 16:13:10 +08:00
showModal(e, orderInfo) {
this.getCurDateAndTime();
if (orderInfo) {
this.curOrder = orderInfo;
2022-05-06 23:47:18 +08:00
}
this[e.currentTarget.dataset.modal] = true;
},
2022-05-22 21:52:14 +08:00
showModalByRef(refName) {
this.$refs[refName].showModal();
},
2022-05-06 23:47:18 +08:00
hideModal(e) {
this.curOrder = null;
this[e.currentTarget.dataset.modal] = false;
},
copyData(data) {
uni.setClipboardData({
data: data
});
},
2022-06-20 18:08:22 +08:00
async editServTime(id, datetimeArr, ifRollback2WS) {
// 确定方法名
2022-06-16 23:14:43 +08:00
let reqFunName = "updateDetailOrder";
if (this.tabCur === 0) {
reqFunName = "updateOrder"
}
2022-06-20 18:08:22 +08:00
// 确定参数
let params = datetimeArr && datetimeArr.length > 1 ? {
id: id,
expectTimeStart: datetimeArr[0],
expectTimeEnd: datetimeArr[1]
} : {
2022-06-13 16:13:10 +08:00
id: id,
revTime: datetime
2022-06-20 18:08:22 +08:00
}
let res = await this.$request[reqFunName](params);
2022-06-13 16:13:10 +08:00
if (res.code === 0) {
2022-06-18 02:03:07 +08:00
let finishFlag = false;
if (ifRollback2WS) {
let statusUpdateRes = await this.updateOrderDetailStatus(id, 2);
if (statusUpdateRes && statusUpdateRes.code === 0) {
finishFlag = true;
}
2022-06-20 18:08:22 +08:00
} else {
finishFlag = true;
2022-06-18 02:03:07 +08:00
}
if (finishFlag) {
this.reloadMasterOrderPage();
uni.showToast({
title: '修改成功',
icon: 'success'
})
}
2022-06-13 16:13:10 +08:00
}
},
2022-06-18 02:03:07 +08:00
async updateOrderDetailStatus(orderDetailId, status) {
let res = await this.$request.updateDetailOrder({
id: orderDetailId,
orderStatus: status,
workBeginTime: ''
});
return res;
},
2022-05-06 23:47:18 +08:00
showArrangeFailTime(e) {
this.showTimeArrangeModal = false;
2022-06-16 23:14:43 +08:00
this.showEditTimeArrangeModal = false;
2022-05-06 23:47:18 +08:00
this.showArrangeFailTimeModal = true;
},
2022-06-18 02:03:07 +08:00
finishQrPay(e) {
this.hideModal(e);
this.reloadMasterOrderPage();
},
2022-06-13 16:13:10 +08:00
togglePopup(e, orderInfo) {
2022-05-06 23:47:18 +08:00
if (this.ifShowPageMeta) {
this.$refs[e.currentTarget.dataset.popup].close();
let timeout = setTimeout(() => {
this.curOrder = null;
}, 100);
} else {
2022-06-13 16:13:10 +08:00
if (orderInfo) {
this.curOrder = orderInfo;
2022-05-06 23:47:18 +08:00
}
this.$refs[e.currentTarget.dataset.popup].open();
}
},
changePopupState(e) {
this.ifShowPageMeta = e.show;
},
makePhoneCall(phoneNum) {
uni.makePhoneCall({
phoneNumber: phoneNum
})
2022-05-09 10:00:16 +08:00
},
2022-06-18 02:03:07 +08:00
async makePayQrcode(e, orderInfo) {
if (orderInfo.payStatus === 1) {
uni.showToast({
title: '订单已支付,不要重复付款!',
icon: 'none'
})
return;
}
let res = await this.$request.qrPay(orderInfo);
if (res && res.code === 0) {
this.$refs.payQrcode.showQrcode(res.data.expend.qrcode_url);
this.showModal(e, orderInfo);
}
2022-05-09 10:00:16 +08:00
},
2022-06-16 23:14:43 +08:00
showServOrderDetail(order) {
2022-05-09 10:00:16 +08:00
uni.navigateTo({
2022-06-16 23:14:43 +08:00
url: '/pages/order-manage/serv-detail?order=' + encodeURIComponent(JSON.stringify(order))
2022-05-09 10:00:16 +08:00
})
2022-05-09 14:28:35 +08:00
},
2022-06-18 02:03:07 +08:00
// finishOrder(order) {
// uni.navigateTo({
// url: '/pages/order-manage/finish-order?order=' + encodeURIComponent(JSON.stringify(order))
// })
// },
async finishOrder(order) {
let res = await this.updateOrderDetailStatus(order.orderDetailId, 6);
if (res && res.code === 0) {
this.reloadMasterOrderPage();
uni.showToast({
icon: 'success'
})
}
2022-05-22 21:52:14 +08:00
},
updateRefundStatus(status, index) {
2022-06-02 17:39:45 +08:00
this.orderList[index].refundStatus = status;
2022-05-22 21:52:14 +08:00
},
updateAfterSaleDealStatus(status, index) {
2022-06-02 17:39:45 +08:00
this.orderList[index].afterSaleDealStatus = status;
2022-05-22 21:52:14 +08:00
},
2022-06-13 16:13:10 +08:00
getCanAssignList(order) {
this.$refs.dispatchOrder.$children[0].loadData(order);
},
2022-06-18 02:03:07 +08:00
async workBegin(order) {
let curDate = new Date();
let formatCurDate = curDate.getFullYear() + '-' + (curDate.getMonth() + 1) + '-' + curDate.getDate()
+ ' ' + curDate.getHours() + ':' + curDate.getMinutes() + ':' + curDate.getSeconds();
let params = {
id: order.orderDetailId,
orderStatus: 3,
workBeginTime: formatCurDate
}
let res = await this.$request.updateDetailOrder(params);
if (res && res.code === 0) {
this.reloadMasterOrderPage();
}
},
2022-06-13 16:13:10 +08:00
/* modalpopup确认或关闭后的回调 */
2022-05-22 21:52:14 +08:00
async showAfterSalePic() {
// TODO:查询该售后单中的拒绝原因中上传的截图
this.picModalImgList = await this.$api.data('picImgList');
console.log(this.picModalImgList)
2022-06-13 16:13:10 +08:00
},
async assignWork(params) {
let res = await this.$request.assign(params);
if (res.code === 0) {
this.getCanAssignList(this.curOrder);
uni.showToast({
title: '派单成功',
icon: 'success'
})
}
2022-06-16 23:14:43 +08:00
},
async assignWork2MySelf(orderInfo) {
let res = await this.$request.getCanAssignList({
orderMasterId: orderInfo.orderMasterId
});
let pickedList = res.data;
let goodsToAssign = [];
pickedList.forEach((goods) => {
goodsToAssign.push({
goodsStandardId: goods.goodsStandardId,
num: goods.goodsNum
})
});
let params = {
goodsList: goodsToAssign,
workerId: this.curUserInfo.workerId,
totalPay: orderInfo.totalMoney,
orderMasterId: orderInfo.orderMasterId
}
this.assignWork(params);
2022-05-09 10:00:16 +08:00
}
2022-05-06 23:47:18 +08:00
}
}
</script>
<style scoped>
.inline-combox {
display: inline-block;
width: calc((90vw - 80rpx)/2);
}
.cu-list.grid.no-border {
padding: unset;
}
.cu-list.grid.no-border>.cu-item {
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.right-tag {
position: relative;
right: -30rpx;
border-radius: 40rpx 0 0 40rpx;
}
.cu-tag+.cu-tag {
margin-left: unset;
}
.left-top-sm-bar {
position: absolute;
right: 25rpx;
top: 25rpx;
z-index: 99;
}
</style>