2022-05-06 23:47:18 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
2022-06-13 16:13:10 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<view class="solid-bottom padding-bottom-sm">
|
|
|
|
|
|
<view v-if="columnTitleArr.length" class="flex justify-between margin-tb-sm">
|
|
|
|
|
|
<view class="basis-df">{{columnTitleArr[0]}}</view>
|
|
|
|
|
|
<view class="flex justify-end text-center basis-df">
|
|
|
|
|
|
<view v-for="(title, index) in columnTitleArr" v-if="index >= 1" class="basis-df">{{title}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="flex justify-between margin-tb-xs align-center" v-for="(item,index) in pickedList" :key="index">
|
|
|
|
|
|
<view class='cu-tag padding basis-lg'>{{item.goodsName}}</view>
|
|
|
|
|
|
<view class="flex justify-end basis-df text-center align-center">
|
|
|
|
|
|
<view class="basis-df">{{item.goodsNum}}</view>
|
|
|
|
|
|
<view class="basis-df">
|
|
|
|
|
|
<uni-number-box :min="0" :max="item.goodsNum" v-model="item.toAssignNum" @change="changePiecesNum($event, item)">
|
|
|
|
|
|
</uni-number-box>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-09-12 00:21:19 +08:00
|
|
|
|
<view class="padding-top-sm padding-bottom-xs flex justify-between align-center">
|
2022-11-09 01:07:15 +08:00
|
|
|
|
<text class="margin-right-sm">本单可派任务金额:<text class="text-red text-lg">{{curOrder.serverMoney}}</text></text>
|
2022-09-12 00:21:19 +08:00
|
|
|
|
</view>
|
2023-03-05 18:25:19 +08:00
|
|
|
|
<view class="padding-bottom-sm flex justify-between align-center">
|
2022-05-06 23:47:18 +08:00
|
|
|
|
<text class="margin-right-sm" style="width: 150rpx;">派单价格</text>
|
2022-06-13 16:13:10 +08:00
|
|
|
|
<input type="digit" class="line-input radius-input" v-model="dispatchTotalPrice" placeholder="请输入派出总额"></input>
|
2022-05-06 23:47:18 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2023-03-05 18:25:19 +08:00
|
|
|
|
<view class="solid-top padding-top-sm flex justify-between align-center">
|
|
|
|
|
|
<input type="text" class="line-input radius-input margin-right-xs" v-model="workerName" placeholder="请输入师傅名称"></input>
|
|
|
|
|
|
<view class="text-xl text-bold">
|
|
|
|
|
|
<text class="cuIcon-search margin-right-sm" @click="searchWorkers"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-05-06 23:47:18 +08:00
|
|
|
|
<!-- 可指派成员 -->
|
2022-07-19 11:34:36 +08:00
|
|
|
|
<scroll-view class="certern-height-with-scroll" :scroll-y="true" :scroll-with-animation="true">
|
2023-03-05 18:25:19 +08:00
|
|
|
|
<view v-if="searchedMembers && searchedMembers.length > 0">
|
|
|
|
|
|
<view class="bg-white padding" v-for="(member, index) in searchedMembers">
|
|
|
|
|
|
<view class="flex justify-between align-center">
|
|
|
|
|
|
<view class="flex justify-start align-center">
|
|
|
|
|
|
<view class="cu-avatar round"
|
|
|
|
|
|
:style="'background-image:url(' + member.workerLogoUrl + ');min-width: 80rpx;min-height: 80rpx'"></view>
|
|
|
|
|
|
<view class="text-lg margin-left-sm">{{member.workerName ? member.workerName : member.name}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<button class="cu-btn bg-main-color shadow-blur" @click="assignWork(member)">指派</button>
|
|
|
|
|
|
<text v-if="singleServ" class="padding-left text-lg text-gray text-bold" data-modal="showDispatchPriceModal" @click="showModal"><text class="cuIcon-right"></text></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="bg-white padding" v-for="(member, index) in members" v-else>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
<view class="flex justify-between align-center">
|
|
|
|
|
|
<view class="flex justify-start align-center">
|
|
|
|
|
|
<view class="cu-avatar round"
|
|
|
|
|
|
:style="'background-image:url(' + member.workerLogoUrl + ');min-width: 80rpx;min-height: 80rpx'"></view>
|
2022-07-29 23:05:47 +08:00
|
|
|
|
<view class="text-lg margin-left-sm">{{member.workerName ? member.workerName : member.name}}</view>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<button class="cu-btn bg-main-color shadow-blur" @click="assignWork(member)">指派</button>
|
|
|
|
|
|
<text v-if="singleServ" class="padding-left text-lg text-gray text-bold" data-modal="showDispatchPriceModal" @click="showModal"><text class="cuIcon-right"></text></text>
|
|
|
|
|
|
</view>
|
2022-05-06 23:47:18 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
</scroll-view>
|
2022-05-06 23:47:18 +08:00
|
|
|
|
<!-- 派单金额模态框 -->
|
|
|
|
|
|
<view class="cu-modal" :class="showDispatchPriceModal?'show':''">
|
|
|
|
|
|
<view class="cu-dialog">
|
|
|
|
|
|
<view class="cu-bar bg-white justify-end solid-bottom">
|
|
|
|
|
|
<view class="content">按金额派出</view>
|
|
|
|
|
|
<view class="action" data-modal="showDispatchPriceModal" @tap="hideModal">
|
|
|
|
|
|
<text class="cuIcon-close text-red"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="padding-xl bg-white">
|
|
|
|
|
|
<view>请输入派单金额:</view>
|
|
|
|
|
|
<view class="flex justify-center align-center margin-top-sm">
|
|
|
|
|
|
<input class="radius-input" type="digit"></input>
|
|
|
|
|
|
<text>元</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="cu-bar bg-white solid-top">
|
|
|
|
|
|
<view class="action margin-0 flex-sub text-black" data-modal="showDispatchPriceModal" @tap="hideModal">取消</view>
|
|
|
|
|
|
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="showDispatchPriceModal" @tap="hideModal"
|
|
|
|
|
|
@click="">确认派单</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-06-16 23:14:43 +08:00
|
|
|
|
// import productPicked from '@/components/goods-card/product-picked.vue';
|
2022-05-06 23:47:18 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'dispatch-order',
|
2022-06-16 23:14:43 +08:00
|
|
|
|
// components: {
|
|
|
|
|
|
// productPicked
|
|
|
|
|
|
// },
|
2022-05-06 23:47:18 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
singleServ: {
|
|
|
|
|
|
type: Boolean,
|
2022-06-13 16:13:10 +08:00
|
|
|
|
default: false
|
2022-05-06 23:47:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
product: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: {}
|
|
|
|
|
|
},
|
|
|
|
|
|
members: {
|
|
|
|
|
|
type: Array,
|
2023-03-05 18:25:19 +08:00
|
|
|
|
default: []
|
2022-05-06 23:47:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
orderNow: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
dispatchTotalPrice: null,
|
2022-06-13 16:13:10 +08:00
|
|
|
|
showDispatchPriceModal: false,
|
|
|
|
|
|
columnTitleArr: ['购买机型', '待派单', '派单量'],
|
|
|
|
|
|
curOrder: {},
|
2023-03-05 18:25:19 +08:00
|
|
|
|
pickedList: [],
|
|
|
|
|
|
workerName: null,
|
|
|
|
|
|
curUserInfo: null,
|
|
|
|
|
|
searchedMembers: null
|
2022-05-06 23:47:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
showModal(e) {
|
|
|
|
|
|
this[e.currentTarget.dataset.modal] = true;
|
|
|
|
|
|
},
|
|
|
|
|
|
hideModal(e) {
|
|
|
|
|
|
this[e.currentTarget.dataset.modal] = false;
|
2022-06-13 16:13:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
changePiecesNum(curNum, curItem) {
|
|
|
|
|
|
curItem.toAssignNum = curNum;
|
|
|
|
|
|
},
|
|
|
|
|
|
resetData() {
|
|
|
|
|
|
this.dispatchTotalPrice = null;
|
2022-11-04 00:29:56 +08:00
|
|
|
|
this.pickedList = [];
|
|
|
|
|
|
this.curOrder = {};
|
2023-03-05 18:25:19 +08:00
|
|
|
|
this.curUserInfo = null;
|
2022-06-13 16:13:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
loadData(order) {
|
|
|
|
|
|
this.resetData();
|
2023-03-05 18:25:19 +08:00
|
|
|
|
this.curUserInfo = this.$request.getCurUserInfo();
|
2022-06-13 16:13:10 +08:00
|
|
|
|
this.getCanAssignList(order);
|
|
|
|
|
|
},
|
|
|
|
|
|
async getCanAssignList(order) {
|
2022-11-09 01:07:15 +08:00
|
|
|
|
// 获取最新的订单信息
|
|
|
|
|
|
let getOrderRes = await this.$request.getOrderMasterDetail({
|
|
|
|
|
|
id: order.orderMasterId
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2022-06-13 16:13:10 +08:00
|
|
|
|
let res = await this.$request.getCanAssignList({
|
|
|
|
|
|
orderMasterId: order.orderMasterId
|
|
|
|
|
|
});
|
|
|
|
|
|
let pickedList = res.data;
|
2022-11-09 01:07:15 +08:00
|
|
|
|
this.curOrder = getOrderRes.data;
|
2022-06-13 16:13:10 +08:00
|
|
|
|
this.pickedList = pickedList;
|
|
|
|
|
|
},
|
2023-03-05 18:25:19 +08:00
|
|
|
|
async searchWorkers() {
|
|
|
|
|
|
let res = await this.$request.getTeamPage({
|
|
|
|
|
|
leaderId: this.curUserInfo.workerId,
|
|
|
|
|
|
workerId: null,
|
|
|
|
|
|
workerName: this.workerName
|
|
|
|
|
|
});
|
|
|
|
|
|
this.searchedMembers = res.rows;
|
|
|
|
|
|
},
|
2022-06-13 16:13:10 +08:00
|
|
|
|
assignWork(member) {
|
|
|
|
|
|
let goodsToAssign = [];
|
2022-06-22 22:38:07 +08:00
|
|
|
|
// 标识是否派完所有goods,1为派完,0为未派完
|
|
|
|
|
|
let isAll = 1;
|
2022-06-13 16:13:10 +08:00
|
|
|
|
this.pickedList.forEach((item) => {
|
2022-06-22 22:38:07 +08:00
|
|
|
|
if (item.goodsNum !== item.toAssignNum) {
|
|
|
|
|
|
isAll = 0;
|
|
|
|
|
|
}
|
2022-06-13 16:13:10 +08:00
|
|
|
|
if (item.toAssignNum) {
|
|
|
|
|
|
goodsToAssign.push({
|
|
|
|
|
|
goodsStandardId: item.goodsStandardId,
|
|
|
|
|
|
num: item.toAssignNum
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
if (goodsToAssign.length > 0) {
|
2022-07-19 15:11:32 +08:00
|
|
|
|
if (this.dispatchTotalPrice) {
|
|
|
|
|
|
let params = {
|
|
|
|
|
|
goodsList: goodsToAssign,
|
|
|
|
|
|
workerId: member.workerId,
|
|
|
|
|
|
totalPay: this.dispatchTotalPrice,
|
|
|
|
|
|
orderMasterId: this.curOrder.orderMasterId,
|
|
|
|
|
|
isAll: isAll
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$emit('assignWork', params);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '请填写派单价格',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
2022-06-13 16:13:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '请至少选择一种规格',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-05-06 23:47:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
.certern-height-with-scroll {
|
2023-03-05 18:25:19 +08:00
|
|
|
|
height: 480rpx;
|
|
|
|
|
|
/* margin-bottom: calc(100rpx + constant(safe-area-inset-bottom) / 2); */
|
|
|
|
|
|
/* margin-bottom: calc(100rpx + env(safe-area-inset-bottom) / 2); */
|
2022-07-19 11:34:36 +08:00
|
|
|
|
}
|
2022-05-06 23:47:18 +08:00
|
|
|
|
</style>
|