| | |
| | | <up-empty text='暂无' icon="/static/order.png"> |
| | | </up-empty> |
| | | </view> |
| | | <up-modal title="送货安排" :show="show7" showCancelButton @confirm="confirmSave" @cancel='cancelModal' |
| | | ref='modalArrange' :asyncClose="true"> |
| | | <up-form labelPosition="left" :model="arrangeInfo" ref="formRef" labelWidth='140rpx'> |
| | | <up-form-item label="送货日期" prop="deliverTime" required :borderBottom='false' ref="item1" |
| | | @click="clickShouTime"> |
| | | <!-- <up-input v-model="arrangeInfo.deliverTime" readonly border="none" |
| | | placeholder="点击选择工作日期"></up-input> --> |
| | | <up-datetime-picker hasInput @confirm='confirmDate' :show="shougHuoshow" v-model="deliverTime" |
| | | mode="date" placeholder="点击选择工作日期" :minDate='Number(new Date(minDate))' |
| | | @cancel='() => shougHuoshow = false'></up-datetime-picker> |
| | | </up-form-item> |
| | | <up-form-item label="排序" prop="sort" required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.sort" placeholder="请输入排序" border="none" type="number"> |
| | | </up-input> |
| | | </up-form-item> |
| | | <up-form-item label="司机" prop="driverName" required :borderBottom='false' @click="clickAction('driver')" |
| | | ref="item1"> |
| | | <up-input v-model="arrangeInfo.driverName" disabled border="none" disabledColor="#ffffff" |
| | | placeholder="请选择司机"></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="收货单位" prop="companyName" required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.companyName" placeholder="请选择收货单位" border="none"> |
| | | <template #suffix> |
| | | <up-button @tap="clickAction" text="点击选择" type="primary" size="mini"></up-button> |
| | | </template> |
| | | </up-input> |
| | | </up-form-item> |
| | | <up-form-item label="联系人" prop="lianxiren" :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.lianxiren" border="none" placeholder="请输入联系人"></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="联系电话" prop="dianhua" required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.dianhua" border="none" placeholder="请输入联系电话"></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="送货地址" prop="dizhi" labelPosition='top' required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.dizhi" border="none" placeholder="请输入送货地址"></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="送货事由" prop="remark" labelPosition='top' required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="arrangeInfo.remark" border="none" placeholder="请输入送货事由"></up-input> |
| | | </up-form-item> |
| | | </up-form> |
| | | </up-modal> |
| | | <up-action-sheet :show="showActions" :actions="actions" title="请选择" @close="showActions = false" |
| | | wrapMaxHeight='500px' @select="selectItem"> |
| | | </up-action-sheet> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | rules: { |
| | | 'deliverTime': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请选择日期', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'driverName': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请选择司机', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'companyName': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请填写公司', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'dianhua': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入联系电话', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'dizhi': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入送货地址', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'remark': { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入送货事由', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | 'sort': { |
| | | required: true, |
| | | message: '请输入排序', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | }, |
| | | orderList: [], |
| | | loadStatus: 'loadmore', |
| | | pageIndex: 1, |
| | | pageSize: 20, |
| | | pageSize: 30, |
| | | contentVal: '', |
| | | options2: [{ |
| | | text: '编辑', |
| | |
| | | backgroundColor: '#f56c6c' |
| | | } |
| | | }], |
| | | show7: false, |
| | | arrangeInfo: { |
| | | deliverTime: this.$util.formatDate(new Date(), null, 1), |
| | | driverId: '', |
| | | buyerId: null, |
| | | dianhua: '', |
| | | remark: '', |
| | | lianxiren: '', |
| | | dizhi: '', |
| | | companyName: '', |
| | | driverName: '', |
| | | deliverTixingId: '', |
| | | sort: '1' |
| | | }, |
| | | shougHuoshow: false, |
| | | minDate: this.$util.formatDate(new Date(), null, -7), |
| | | maxDate: this.$util.formatDate(new Date(), null, 7), |
| | | deliverTime: Number(new Date(this.$util.formatDate(new Date(), null, 1))), |
| | | driverList: [], |
| | | customerList:[], |
| | | showActions: false, |
| | | driverName: '', |
| | | actions: [] |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.init() |
| | | }, |
| | | onLoad() { |
| | | this.Getdrivers() |
| | | this.getCustomer() |
| | | }, |
| | | onReady() { |
| | | this.$refs.formRef.setRules(this.rules); |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.init() |
| | | uni.stopPullDownRefresh(); |
| | | }, |
| | | onReachBottom() { |
| | | if (this.loadStatus != 'nomore') { |
| | | this.getList() |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'identity']), |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | Getdrivers() { |
| | | this.$api.Getdrivers().then(res => { |
| | | if (res.code == 1) { |
| | | this.driverList = res.data |
| | | } |
| | | }) |
| | | }, |
| | | clickShouTime() { |
| | | this.shougHuoshow = !this.shougHuoshow |
| | | }, |
| | | confirmDate(val) { |
| | | console.log(val); |
| | | this.arrangeInfo.deliverTime = val |
| | | this.shougHuoshow = false |
| | | }, |
| | | cancelModal() { |
| | | this.arrangeInfo = { |
| | | deliverTime: this.$util.formatDate(new Date(), null, 1), |
| | | driverId: '', |
| | | buyerId: null, |
| | | dianhua: '', |
| | | remark: '', |
| | | lianxiren: '', |
| | | dizhi: '', |
| | | driverName: '', |
| | | deliverTixingId: '', |
| | | sort:'1' |
| | | } |
| | | this.show7 = false |
| | | this.driverName = '' |
| | | this.buyerName = '' |
| | | }, |
| | | clickAction(val) { |
| | | switch (val) { |
| | | case 'driver': |
| | | this.actions = this.driverList |
| | | break |
| | | case 'driver7': |
| | | this.actions = this.sevenDaysDriver |
| | | break |
| | | default: |
| | | this.actions = this.customerList |
| | | break |
| | | } |
| | | this.selectAc = val |
| | | this.showActions = true |
| | | uni.hideKeyboard() |
| | | }, |
| | | getCustomer() { |
| | | this.$api.GeCorporateClients().then(res => { |
| | | if (res.code == 1) { |
| | | this.customerList = res.data |
| | | this.customerList.forEach(item => { |
| | | item.name = item.companyName |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | selectItem(item) { |
| | | if (this.selectAc == 'driver') { |
| | | this.arrangeInfo.driverName = item.name |
| | | this.arrangeInfo.driverId = item.keyid |
| | | } else if (this.selectAc == 'driver7') { |
| | | this.deliverKeyID = item.keyid |
| | | this.deliverKeyName = item.name |
| | | this.init() |
| | | } else { |
| | | this.buyerName = item.name |
| | | this.arrangeInfo.buyerId = item.keyid |
| | | this.arrangeInfo.dizhi = item.adder |
| | | this.arrangeInfo.dianhua = item.companyPhone |
| | | this.arrangeInfo.lianxiren = item.businessManagers |
| | | this.arrangeInfo.companyName = item.companyName |
| | | } |
| | | this.selectAc = '' |
| | | }, |
| | | init() { |
| | | this.pageIndex = 1 |
| | | this.pageSize = 20 |
| | | this.pageSize = 30 |
| | | this.loadStatus = 'loadmore' |
| | | this.orderList = [] |
| | | this.contentVal = '' |
| | | this.getList() |
| | | }, |
| | | reservation() { |
| | | this.$api.CreatAppointmentDeliver({ |
| | | remark: this.contentVal |
| | | }).then(res => { |
| | | if (res.code == 1) { |
| | | this.contentVal = '' |
| | | this.init() |
| | | confirmSave() { |
| | | // if (!this.arrangeInfo.driverId) { |
| | | // this.$refs.modalArrange.loading = false |
| | | // return this.$util.showToast({ |
| | | // title: '请选择司机!' |
| | | // }) |
| | | // } |
| | | console.log(); |
| | | this.$refs.formRef.validate().then(res => { |
| | | if (this.isEdit) { |
| | | this.$api.UpDataDeliverPlans(this.arrangeInfo).then(res => { |
| | | if (res.code == 1) { |
| | | this.isEdit = false |
| | | this.arrangeInfo = { |
| | | deliverTime: this.$util.formatDate(new Date(), null, 1), |
| | | driverId: '', |
| | | buyerId: null, |
| | | dianhua: '', |
| | | remark: '', |
| | | lianxiren: '', |
| | | dizhi: '', |
| | | deliverTixingId: '', |
| | | sort:'1' |
| | | } |
| | | this.show7 = false |
| | | this.driverName = '' |
| | | this.buyerName = '' |
| | | this.init() |
| | | } else { |
| | | this.$util.showToast({ |
| | | title: res.error |
| | | }) |
| | | } |
| | | this.isLoading = false |
| | | }) |
| | | return |
| | | } |
| | | this.$api.CreatDeliverPlan(this.arrangeInfo).then(res => { |
| | | if (res.code == 1) { |
| | | this.arrangeInfo = { |
| | | deliverTime: this.$util.formatDate(new Date(), null, 1), |
| | | driverId: '', |
| | | buyerId: null, |
| | | dianhua: '', |
| | | remark: '', |
| | | lianxiren: '', |
| | | dizhi: '', |
| | | } |
| | | this.show7 = false |
| | | this.driverName = '' |
| | | this.buyerName = '' |
| | | this.init() |
| | | } else { |
| | | this.$util.showToast({ |
| | | title: res.error |
| | | }) |
| | | } |
| | | this.isLoading = false |
| | | }) |
| | | }).catch(errors => { |
| | | this.$refs.modalArrange.loading = false |
| | | }) |
| | | |
| | | }, |
| | | reservation() { |
| | | this.show7 = true |
| | | // this.$api.CreatAppointmentDeliver({ |
| | | // remark: this.contentVal |
| | | // }).then(res => { |
| | | // if (res.code == 1) { |
| | | // this.contentVal = '' |
| | | // this.init() |
| | | // } |
| | | // }) |
| | | }, |
| | | getList() { |
| | | let data = { |
| | |
| | | }) |
| | | }, |
| | | accept(item) { |
| | | let that = this |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '确认受理该送货吗?', |
| | | success: function(res) { |
| | | if (res.confirm) { |
| | | // 执行确认后的操作 |
| | | that.$api.AcceptAppointmentDeliver(item.keyid).then(req => { |
| | | if (req.code == 1) { |
| | | that.$util.showToast({ |
| | | title: '受理成功!' |
| | | }) |
| | | that.init() |
| | | } else { |
| | | that.$util.showToast({ |
| | | title: req.error |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | // 执行取消后的操作 |
| | | } |
| | | } |
| | | }) |
| | | this.show7 = true |
| | | this.arrangeInfo.remark = item.remark |
| | | this.arrangeInfo.deliverTixingId = item.keyid |
| | | // let that = this |
| | | // uni.showModal({ |
| | | // title: '提示', |
| | | // content: '确认受理该送货吗?', |
| | | // success: function(res) { |
| | | // if (res.confirm) { |
| | | // // 执行确认后的操作 |
| | | // that.$api.AcceptAppointmentDeliver(item.keyid).then(req => { |
| | | // if (req.code == 1) { |
| | | // that.$util.showToast({ |
| | | // title: '受理成功!' |
| | | // }) |
| | | // that.init() |
| | | // } else { |
| | | // that.$util.showToast({ |
| | | // title: req.error |
| | | // }) |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // // 执行取消后的操作 |
| | | // } |
| | | // } |
| | | // }) |
| | | } |
| | | } |
| | | } |