|  | @@ -0,0 +1,356 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <!-- 待配送订单 -->
 | 
	
		
			
				|  |  | +  <div>
 | 
	
		
			
				|  |  | +    <div ref="grabble">
 | 
	
		
			
				|  |  | +      <actionBar :operateList="operateList" :formList="formList" :ruleForm="searchRuleForm" @openModel="openModel"
 | 
	
		
			
				|  |  | +        @searchProtocol="searchProtocol"></actionBar>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <div class="card_content">
 | 
	
		
			
				|  |  | +      <!-- 表单 -->
 | 
	
		
			
				|  |  | +      <tables ref="refWaybill" controlswidth="340px" tableHeight="68vh" :suspension="true" :tableList="tableList"
 | 
	
		
			
				|  |  | +        :tableData="tableData" @buttonData="buttonData">
 | 
	
		
			
				|  |  | +      </tables>
 | 
	
		
			
				|  |  | +      <!-- 分页 -->
 | 
	
		
			
				|  |  | +      <div v-if="Total">
 | 
	
		
			
				|  |  | +        <pagination :total="Total" :currentPage="Pagination.PageIndex" @changeSize="changeSize"
 | 
	
		
			
				|  |  | +          @changeCurrent="changeCurrent">
 | 
	
		
			
				|  |  | +        </pagination>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <el-dialog title="派单" :visible.sync="sendDialogVisible" width="500px" :close-on-click-modal="false"
 | 
	
		
			
				|  |  | +      @close="closeDialog">
 | 
	
		
			
				|  |  | +      <forms ref="sendRules" :formNewList="sendRuleList" :ruleForm="sendRuleForm" :iceTracing="true" :iceBank="true"
 | 
	
		
			
				|  |  | +        labelWidth="80px" @handleScroll="handleScroll" @remoteMethod="remoteMethod" @changeOption="changeOption">
 | 
	
		
			
				|  |  | +      </forms>
 | 
	
		
			
				|  |  | +      <span slot="footer" class="dialog-footer">
 | 
	
		
			
				|  |  | +        <el-button plain @click="sendDialogVisible = false">取 消</el-button>
 | 
	
		
			
				|  |  | +        <el-button type="primary" :loading="sendConfirmLoading" @click.stop="sendHandleAdd">确 定</el-button>
 | 
	
		
			
				|  |  | +      </span>
 | 
	
		
			
				|  |  | +    </el-dialog>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +  import {
 | 
	
		
			
				|  |  | +    getCoolerBox,
 | 
	
		
			
				|  |  | +    getRaftCoolerBox
 | 
	
		
			
				|  |  | +  } from '@/api/incubator.js'
 | 
	
		
			
				|  |  | +  import actionBar from '@/components/actionBar'
 | 
	
		
			
				|  |  | +  import tables from '@/components/tables'
 | 
	
		
			
				|  |  | +  import pagination from '@/components/pagination'
 | 
	
		
			
				|  |  | +  import forms from '@/components/forms'
 | 
	
		
			
				|  |  | +  import {
 | 
	
		
			
				|  |  | +    employee,
 | 
	
		
			
				|  |  | +    sendList
 | 
	
		
			
				|  |  | +  } from "./uncertain.js";
 | 
	
		
			
				|  |  | +  import {
 | 
	
		
			
				|  |  | +    getUser
 | 
	
		
			
				|  |  | +  } from '@/api/user'
 | 
	
		
			
				|  |  | +  import {
 | 
	
		
			
				|  |  | +    WaybillStatus
 | 
	
		
			
				|  |  | +  } from '@/assets/js/blockSort'
 | 
	
		
			
				|  |  | +  export default {
 | 
	
		
			
				|  |  | +    name: 'OrderManagement',
 | 
	
		
			
				|  |  | +    components: {
 | 
	
		
			
				|  |  | +      actionBar,
 | 
	
		
			
				|  |  | +      tables,
 | 
	
		
			
				|  |  | +      pagination,
 | 
	
		
			
				|  |  | +      forms
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    data() {
 | 
	
		
			
				|  |  | +      return {
 | 
	
		
			
				|  |  | +        operateList: [{
 | 
	
		
			
				|  |  | +          type: 'sends',
 | 
	
		
			
				|  |  | +          title: '批量派单',
 | 
	
		
			
				|  |  | +          colour: 'success'
 | 
	
		
			
				|  |  | +        }],
 | 
	
		
			
				|  |  | +        formList: [{
 | 
	
		
			
				|  |  | +          type: 'input',
 | 
	
		
			
				|  |  | +          label: '订单编号',
 | 
	
		
			
				|  |  | +          field: 'orderNo',
 | 
	
		
			
				|  |  | +          placeholder: '请输入订单编号',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'input',
 | 
	
		
			
				|  |  | +          label: '门店名称',
 | 
	
		
			
				|  |  | +          field: 'orderNo',
 | 
	
		
			
				|  |  | +          placeholder: '请输入门店名称',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'input',
 | 
	
		
			
				|  |  | +          label: '配送员姓名',
 | 
	
		
			
				|  |  | +          field: 'orderNo',
 | 
	
		
			
				|  |  | +          placeholder: '请输入配送员姓名',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'input',
 | 
	
		
			
				|  |  | +          label: '患者名称',
 | 
	
		
			
				|  |  | +          field: 'orderNo',
 | 
	
		
			
				|  |  | +          placeholder: '请输入患者名称',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'input',
 | 
	
		
			
				|  |  | +          label: '患者手机号',
 | 
	
		
			
				|  |  | +          field: 'orderNo',
 | 
	
		
			
				|  |  | +          placeholder: '请输入患者手机号',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'select',
 | 
	
		
			
				|  |  | +          label: '分配状态',
 | 
	
		
			
				|  |  | +          field: 'status',
 | 
	
		
			
				|  |  | +          placeholder: '请选择分配状态',
 | 
	
		
			
				|  |  | +          options: WaybillStatus(),
 | 
	
		
			
				|  |  | +        }],
 | 
	
		
			
				|  |  | +        searchRuleForm: {
 | 
	
		
			
				|  |  | +          orderNo: '',
 | 
	
		
			
				|  |  | +          status: null,
 | 
	
		
			
				|  |  | +          time: [],
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        searchValue: {},
 | 
	
		
			
				|  |  | +        Pagination: {
 | 
	
		
			
				|  |  | +          PageIndex: 1,
 | 
	
		
			
				|  |  | +          PageSize: 10,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        Total: 0,
 | 
	
		
			
				|  |  | +        operationType: '',
 | 
	
		
			
				|  |  | +        tableData: [],
 | 
	
		
			
				|  |  | +        tableList: [],
 | 
	
		
			
				|  |  | +        btnData: [{
 | 
	
		
			
				|  |  | +          type: 'logs',
 | 
	
		
			
				|  |  | +          label: '详情',
 | 
	
		
			
				|  |  | +          icon: 'el-icon-tickets',
 | 
	
		
			
				|  |  | +          style: 'success',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'send',
 | 
	
		
			
				|  |  | +          label: '处方',
 | 
	
		
			
				|  |  | +          icon: 'el-icon-tickets',
 | 
	
		
			
				|  |  | +          style: 'primary',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'sign',
 | 
	
		
			
				|  |  | +          label: '分配',
 | 
	
		
			
				|  |  | +          icon: 'el-icon-folder-checked',
 | 
	
		
			
				|  |  | +          style: 'warning',
 | 
	
		
			
				|  |  | +        }, {
 | 
	
		
			
				|  |  | +          type: 'del',
 | 
	
		
			
				|  |  | +          label: '取消订单',
 | 
	
		
			
				|  |  | +          icon: 'el-icon-delete',
 | 
	
		
			
				|  |  | +          style: 'danger',
 | 
	
		
			
				|  |  | +        }],
 | 
	
		
			
				|  |  | +        sendDialogVisible: false,
 | 
	
		
			
				|  |  | +        sendRuleList: sendList(),
 | 
	
		
			
				|  |  | +        sendRuleForm: {
 | 
	
		
			
				|  |  | +          code: [],
 | 
	
		
			
				|  |  | +          coolerBoxId: null,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        sendConfirmLoading: false,
 | 
	
		
			
				|  |  | +        page: 1,
 | 
	
		
			
				|  |  | +        staffName: '',
 | 
	
		
			
				|  |  | +        limitNo: true,
 | 
	
		
			
				|  |  | +        sendOrdersId: 2,
 | 
	
		
			
				|  |  | +        waybillIdList: [],
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    mounted() {
 | 
	
		
			
				|  |  | +      let arr = employee()
 | 
	
		
			
				|  |  | +      arr.forEach(item => {
 | 
	
		
			
				|  |  | +        if (item.field == 'unpackBtn') {
 | 
	
		
			
				|  |  | +          item.labelButton = this.btnData
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +      this.tableList = arr
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    methods: {
 | 
	
		
			
				|  |  | +      // 搜索
 | 
	
		
			
				|  |  | +      searchProtocol(value) {
 | 
	
		
			
				|  |  | +        this.Pagination.PageIndex = 1
 | 
	
		
			
				|  |  | +        this.searchValue = value
 | 
	
		
			
				|  |  | +        if (value.time) {
 | 
	
		
			
				|  |  | +          this.searchValue.orderStartTime = value.time[0]
 | 
	
		
			
				|  |  | +          this.searchValue.orderEndTime = value.time[1]
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        this.getList()
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      async openModel(type) {
 | 
	
		
			
				|  |  | +        console.log(type, 87)
 | 
	
		
			
				|  |  | +        this.operationType = type
 | 
	
		
			
				|  |  | +        if (type == 'sends') {
 | 
	
		
			
				|  |  | +          this.sendDialogVisible = true
 | 
	
		
			
				|  |  | +          var arr = await this.getUserList()
 | 
	
		
			
				|  |  | +          this.sendRuleList.forEach(item => {
 | 
	
		
			
				|  |  | +            if (item.field == 'reCheckId') {
 | 
	
		
			
				|  |  | +              item.options = arr
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          this.getIncubator(2)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      buttonData(row, type) {
 | 
	
		
			
				|  |  | +        this.operationType = type
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 触底事件
 | 
	
		
			
				|  |  | +      handleScroll() {
 | 
	
		
			
				|  |  | +        if (this.limitNo) {
 | 
	
		
			
				|  |  | +          this.getIncubator()
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 搜索
 | 
	
		
			
				|  |  | +      remoteMethod(value, type) {
 | 
	
		
			
				|  |  | +        console.log(value, type,236)
 | 
	
		
			
				|  |  | +        this.resetSelect()
 | 
	
		
			
				|  |  | +        this.staffName = value
 | 
	
		
			
				|  |  | +        // this.getIncubator(this.sendOrdersId)
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 重置选择员工
 | 
	
		
			
				|  |  | +      resetSelect() {
 | 
	
		
			
				|  |  | +        this.sendRuleList.forEach(item => {
 | 
	
		
			
				|  |  | +          if (item.field == 'reCheckId') {
 | 
	
		
			
				|  |  | +            item.options = []
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        this.page = 1
 | 
	
		
			
				|  |  | +        this.limitNo = true
 | 
	
		
			
				|  |  | +        this.staffName = ''
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 运单派单
 | 
	
		
			
				|  |  | +      sendHandleAdd() {
 | 
	
		
			
				|  |  | +        let flag = this.$refs['sendRules'].validateForm();
 | 
	
		
			
				|  |  | +        if (flag) {
 | 
	
		
			
				|  |  | +          this.sendConfirmLoading = true
 | 
	
		
			
				|  |  | +          let arrID = []
 | 
	
		
			
				|  |  | +          if (this.operationType == 'send') {
 | 
	
		
			
				|  |  | +            arrID.push(this.orderId)
 | 
	
		
			
				|  |  | +          } else if (this.operationType == 'sends') {
 | 
	
		
			
				|  |  | +            arrID = this.waybillIdList
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          const param = {
 | 
	
		
			
				|  |  | +            waybillIds: arrID,
 | 
	
		
			
				|  |  | +            coolerBoxId: Number(this.sendRuleForm.coolerBoxId),
 | 
	
		
			
				|  |  | +            iceRaftCode: this.sendRuleForm.code,
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          waybillDelivery(param).then(res => {
 | 
	
		
			
				|  |  | +            if (res.code == 200) {
 | 
	
		
			
				|  |  | +              this.$message({
 | 
	
		
			
				|  |  | +                message: res.msg,
 | 
	
		
			
				|  |  | +                type: 'success'
 | 
	
		
			
				|  |  | +              });
 | 
	
		
			
				|  |  | +              this.getList()
 | 
	
		
			
				|  |  | +              this.sendDialogVisible = false
 | 
	
		
			
				|  |  | +            } else if (res.code == 2000) {
 | 
	
		
			
				|  |  | +              let arrTitle = res.data
 | 
	
		
			
				|  |  | +              let title = ' ,请将冰排' + arrTitle.toString() + '重新入库'
 | 
	
		
			
				|  |  | +              this.$message({
 | 
	
		
			
				|  |  | +                showClose: true,
 | 
	
		
			
				|  |  | +                message: res.msg + title,
 | 
	
		
			
				|  |  | +                duration: 0,
 | 
	
		
			
				|  |  | +                type: 'warning'
 | 
	
		
			
				|  |  | +              });
 | 
	
		
			
				|  |  | +              this.sendDialogVisible = false
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.sendConfirmLoading = false
 | 
	
		
			
				|  |  | +          }).catch(() => {
 | 
	
		
			
				|  |  | +            this.sendConfirmLoading = false
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          this.$message.error('表单信息不完整,请继续填写完整');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 获取保温箱列表
 | 
	
		
			
				|  |  | +      getIncubator(type) {
 | 
	
		
			
				|  |  | +        let arrList = []
 | 
	
		
			
				|  |  | +        let params = {
 | 
	
		
			
				|  |  | +          page: this.page,
 | 
	
		
			
				|  |  | +          pageSize: 10,
 | 
	
		
			
				|  |  | +          status: '2',
 | 
	
		
			
				|  |  | +          name: this.staffName,
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        getCoolerBox(params).then(res => {
 | 
	
		
			
				|  |  | +          if (res.code == 200) {
 | 
	
		
			
				|  |  | +            let arr = res.data.list
 | 
	
		
			
				|  |  | +            let arrList = []
 | 
	
		
			
				|  |  | +            arr.forEach(item1 => {
 | 
	
		
			
				|  |  | +              var arrData = {
 | 
	
		
			
				|  |  | +                label: null,
 | 
	
		
			
				|  |  | +                value: null,
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +              arrData.label = item1.name
 | 
	
		
			
				|  |  | +              arrData.value = item1.id
 | 
	
		
			
				|  |  | +              arrList.push(arrData)
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +            if (this.limitNo == true) {
 | 
	
		
			
				|  |  | +              this.sendRuleList.forEach(item => {
 | 
	
		
			
				|  |  | +                if (item.field == 'coolerBoxId') {
 | 
	
		
			
				|  |  | +                  item.options = item.options.concat(arrList);
 | 
	
		
			
				|  |  | +                  let some = [];
 | 
	
		
			
				|  |  | +                  item.options.forEach(el => {
 | 
	
		
			
				|  |  | +                    if (!some.some(e => e.value == el.value)) {
 | 
	
		
			
				|  |  | +                      some.push(el)
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                  })
 | 
	
		
			
				|  |  | +                  item.options = some
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (arrList.length >= 10) {
 | 
	
		
			
				|  |  | +              this.page = ++this.page;
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +              // 已经没数据了 不需要增加数据
 | 
	
		
			
				|  |  | +              this.limitNo = false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 获取不同用户列表
 | 
	
		
			
				|  |  | +      getUserList() {
 | 
	
		
			
				|  |  | +        return new Promise((resolve, reject) => {
 | 
	
		
			
				|  |  | +          var params = {
 | 
	
		
			
				|  |  | +            page: 1,
 | 
	
		
			
				|  |  | +            pageSize: 999,
 | 
	
		
			
				|  |  | +            // type: 3,
 | 
	
		
			
				|  |  | +            name: this.delivererName,
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          getUser(params).then(res => {
 | 
	
		
			
				|  |  | +            if (res.code == 200) {
 | 
	
		
			
				|  |  | +              let arr = res.data.list
 | 
	
		
			
				|  |  | +              let arrList = []
 | 
	
		
			
				|  |  | +              arr.forEach(item1 => {
 | 
	
		
			
				|  |  | +                var arrData = {
 | 
	
		
			
				|  |  | +                  label: null,
 | 
	
		
			
				|  |  | +                  value: null,
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                arrData.label = item1.nickName
 | 
	
		
			
				|  |  | +                arrData.value = item1.id
 | 
	
		
			
				|  |  | +                arrList.push(arrData)
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +              resolve(arrList)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }).catch((err) => {
 | 
	
		
			
				|  |  | +            reject(err)
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 获取保温箱搜索选择框数据
 | 
	
		
			
				|  |  | +      changeOption(id) {
 | 
	
		
			
				|  |  | +        getRaftCoolerBox({
 | 
	
		
			
				|  |  | +          coolerBoxId: id
 | 
	
		
			
				|  |  | +        }).then(res => {
 | 
	
		
			
				|  |  | +          if (res.code == 200) {
 | 
	
		
			
				|  |  | +            if (res.data) {
 | 
	
		
			
				|  |  | +              this.sendRuleForm.code = res.data
 | 
	
		
			
				|  |  | +              this.$refs.sendRules.inputsList = res.data
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      changeSize(val) {
 | 
	
		
			
				|  |  | +        this.Pagination.PageSize = val
 | 
	
		
			
				|  |  | +        this.getList()
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      changeCurrent(val) {
 | 
	
		
			
				|  |  | +        this.Pagination.PageIndex = val
 | 
	
		
			
				|  |  | +        this.getList()
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 清空表单
 | 
	
		
			
				|  |  | +      closeDialog() {
 | 
	
		
			
				|  |  | +        this.$refs.sendRules.resetCheck();
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style lang="scss">
 | 
	
		
			
				|  |  | +</style>
 |