From 2d43a1df3f5ba42710e6d21c27d1e13bdb8dfd56 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期一, 24 三月 2025 09:23:08 +0800 Subject: [PATCH] - --- src/pages/delivergoods/arrange.vue | 509 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 392 insertions(+), 117 deletions(-) diff --git a/src/pages/delivergoods/arrange.vue b/src/pages/delivergoods/arrange.vue index fb00cd3..017afe0 100644 --- a/src/pages/delivergoods/arrange.vue +++ b/src/pages/delivergoods/arrange.vue @@ -7,11 +7,11 @@ </view> <view class="coreshop-ff content c-p-10 chuany-flex chuany-justify-between"> <view class="chuany-width82"> - <up-search placeholder="璇风偣鍑婚�夋嫨鍙告満" @click='clickIcon' @clear='PostMyDakaListPage' disabled - action-text="鏌ヨ" v-model="wordDate" search-icon="calendar" @search='PostMyDakaListPage' - @custom='PostMyDakaListPage'></up-search> + <up-search placeholder="璇风偣鍑婚�夋嫨鍙告満" @click="clickAction('driver7')" @clear='init' disabled + @change='init' action-text="鏌ヨ" v-model="deliverKeyName" @search='init' + @custom='init'></up-search> </view> - <up-text align="right" text='閫佽揣瀹夋帓' size='14' @click="arrange('Yes')"></up-text> + <up-text align="right" text='閫佽揣瀹夋帓' size='14' @click="() => show7 = true"></up-text> </view> </view> </up-sticky> @@ -21,21 +21,28 @@ <view class="coreshop-ff chuany-bradius20"> <view class="chuany-font26"> <view class="chuany-flex chuany-justify-between"> - <text class="chuany-width5">{{index+1}}</text> + <text class="chuany-width6">{{index+1}}</text> <view class="chuany-width15"> - {{$util.formatDate(item.createTime,'riqi')}} + {{$util.formatDate(item.deliverTime,'riqi')}} </view> - <view class="chuany-width65"> - <u-text size='14' :text="item.remark" lines="1"> + <view :class="item.deliveredstatus !== 'Delivered'?'chuany-width67':'chuany-width79'" + @click='goDetail(item)'> + <u-text size='14' :text="item.companyName" lines="1"> + <!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> --> </u-text> </view> - <view class="chuany-width11 chuany-flex chuany-justify-between"> - <up-icon name="edit-pen" @click='editOrder(item)'></up-icon> - <up-icon name="trash" @click='delOrder(item)'></up-icon> - </view> - </view> - <view class="c-p-t-8"> - <u--text :lines="1" :text="item.planContent"></u--text> + <template v-if="item.deliveredstatus !== 'Delivered'"> + <view class="chuany-width6 chuany-paddingright-10" @tap.stop='editOrder(item)'> + <up-icon name="edit-pen" size='18'></up-icon> + </view> + <view class="chuany-width6" @tap.stop='UndoDeliverPlans(item)'> + <up-icon name="reload" size='19'></up-icon> + </view> + </template> + <!-- <view class="chuany-width6" v-else> + <u-text size='14' type="" text="" lines="1"> + </u-text> + </view> --> </view> </view> </view> @@ -46,35 +53,61 @@ <up-empty text='鏆傛棤' icon="/static/order.png"> </up-empty> </view> - <up-modal title="閫佽揣瀹夋帓" :show="show7" showCancelButton @confirm="() => show7 = false"> - <up-form labelPosition="left" :model="model1" :rules="rules" ref="form1"> - <up-form-item label="濮撳悕" prop="userInfo.name" borderBottom ref="item1"> - <up-input v-model="model1.userInfo.name" border="none"></up-input> + <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" + disabled disabledColor='#FFF' mode="date" placeholder="鐐瑰嚮閫夋嫨宸ヤ綔鏃ユ湡" + :minDate='Number(new Date(minDate))' @cancel='() => shougHuoshow = false'></up-datetime-picker> </up-form-item> - <up-form-item label="濮撳悕" prop="userInfo.name" borderBottom ref="item1"> - <up-input v-model="model1.userInfo.name" border="none"></up-input> + <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="userInfo.name" borderBottom ref="item1"> - <up-input v-model="model1.userInfo.name" border="none"></up-input> - </up-form-item> - <up-form-item label="濮撳悕" prop="userInfo.name" borderBottom ref="item1"> - <up-input v-model="model1.userInfo.name" border="none"></up-input> - </up-form-item> - <up-form-item label="濮撳悕" prop="userInfo.name" borderBottom ref="item1"> - <up-input v-model="model1.userInfo.name" border="none"></up-input> - </up-form-item> - <up-form-item label="鎬у埆" prop="userInfo.sex" borderBottom @click="showSex = true; hideKeyboard()" + <up-form-item label="鍙告満" prop="driverName" required :borderBottom='false' @click="clickAction('driver')" ref="item1"> - <up-input v-model="model1.userInfo.sex" disabled disabledColor="#ffffff" placeholder="璇烽�夋嫨鎬у埆" - border="none"></up-input> - <template #right> - <up-icon name="arrow-right"></up-icon> - </template> + <up-input v-model="arrangeInfo.driverName" disabled border="none" disabledColor="#ffffff" + placeholder="璇烽�夋嫨鍙告満"></up-input> + </up-form-item> + <up-form-item label="鏀惰揣鍗曚綅" prop="companyName" labelPosition='top' required :borderBottom='false' + ref="item1" v-if='show7'> + <!-- <tem-selects-fan placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :data="customerList" :clearable='true' + :value="arrangeInfo.companyName" :value-type="valueType" :filterable='true' :searchType='1' + @input='selectChange'></tem-selects-fan> --> + <!-- <form-select class="form_select" ref="formSelect1" :search="true" :icon="true" + :placeholder="optionPlaceholder" :selectedId="optionId" :localdata="optionModel" + @change="changeOption" @clear="clearOption"></form-select> --> + <tem-select ref="formSelect" placeholder="璇烽�夋嫨鏀惰揣鍗曚綅" :selectedId="arrangeInfo.buyerId" :value='arrangeInfo.companyName' :search='true' + :localdata="customerList" @change="selectChange"></tem-select> + <!-- <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> - <fui-date-picker range :show="datePickerShow" :value="getFirstDayOfMonth()" type="3" @change="changePicker" :minDate='minDate' :maxDate='maxDate' - @cancel="clickTime"></fui-date-picker> + <fui-date-picker :show="datePickerShow" :value="getFirstDayOfMonth()" type="3" zIndex="10000" + @change="changePicker" :minDate='minDate' :maxDate='maxDate' @cancel="clickTime"></fui-date-picker> + <up-action-sheet :show="showActions" :actions="actions" title="璇烽�夋嫨" @close="showActions = false" + wrapMaxHeight='500px' @select="selectItem"> + </up-action-sheet> </view> </template> @@ -87,84 +120,267 @@ export default { data() { return { - datePickerShow:false, - workTime:'', + valueType: { + label: 'companyName', + value: 'keyid' + }, + datePickerShow: false, + shougHuoshow: false, + workTime: this.$util.formatDate(new Date()), orderList: [], loadStatus: 'loadmore', pageIndex: 1, - pageSize: 20, - contentVal: '', - options2: [{ - text: '缂栬緫', - style: { - backgroundColor: '#3c9cff' - } - }, { - text: '鍒犻櫎', - style: { - backgroundColor: '#f56c6c' - } - }], + pageSize: 30, + customerList: [], isEdit: false, editItem: {}, isLoading: false, show7: false, - showSex: false, - model1: { - userInfo: { - name: 'uview-plus UI', - sex: '', - }, + showActions: false, + driverName: '', + actions: [], + selectAc: '', + 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))), + arrangeInfo: { + deliverTime: this.$util.formatDate(new Date(), null, 1), + driverId: '', + buyerId: null, + dianhua: '', + remark: '', + lianxiren: '', + dizhi: '', + companyName: '', + driverName: '', + sort: '1' }, - actions: [{ - name: '鐢�', - }, - { - name: '濂�', - }, - { - name: '淇濆瘑', - }, - ], rules: { - 'userInfo.name': { + 'deliverTime': { type: 'string', required: true, - message: '璇峰~鍐欏鍚�', + message: '璇烽�夋嫨鏃ユ湡', trigger: ['blur', 'change'] }, - 'userInfo.sex': { + 'driverName': { type: 'string', - max: 1, required: true, - message: '璇烽�夋嫨鐢锋垨濂�', + 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': { + type: 'number', + required: true, + message: '璇疯緭鍏ユ帓搴�', trigger: ['blur', 'change'] }, }, radio: '', - switchVal: false + switchVal: false, + driverList: [], + buyerName: '', + timeStart: new Date(), + timeEnd: new Date(), + sevenDaysDriver: [], + deliverKeyID: '', + deliverKeyName: '' } }, onShow() { this.init() }, + onReady() { + this.$refs.formRef.setRules(this.rules); + }, + onLoad() { + this.Getdrivers() + this.getCustomer() + this.GetDriversOfWithin7days() + }, + onMounted() { + this.$refs.formRef.setRules(this.rules); + }, + onReachBottom() { + if (this.loadStatus != 'nomore') { + this.getList() + } + }, onPullDownRefresh() { + this.timeStart = new Date() + this.timeEnd = new Date() + this.workTime = this.$util.formatDate(new Date()) + this.deliverKeyName = '' this.init() uni.stopPullDownRefresh(); }, methods: { - getFirstDayOfMonth () { + goDetail(item) { + uni.navigateTo({ + url: `/pages/delivergoods/arrangedetail?KeyId=${item.keyid}` + }); + }, + GetDriversOfWithin7days() { + this.$api.GetDriversOfWithin7days().then(res => { + if (res.code == 1) { + this.sevenDaysDriver = res.data + } + }) + }, + changePicker(val) { + console.log(val, '-=-=鈥�'); + this.workTime = val.result + this.timeStart = new Date(val.result) //宸ヤ綔寮�濮嬫椂闂� + this.timeEnd = new Date(val.result) + this.datePickerShow = !this.datePickerShow + this.init() + }, + confirmDate(val) { + console.log(val); + this.arrangeInfo.deliverTime = this.$util.formatDate(val.value) + this.shougHuoshow = false + }, + getCustomer() { + this.$api.GeCorporateClients().then(res => { + if (res.code == 1) { + this.customerList = res.data + this.customerList.forEach(item => { + item.name = item.companyName + item.title = item.companyName + item.id = item.keyid + }) + } + }) + }, + 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 = '' + }, + selectChange(item) { + console.log(item,'hhhhh'); + if (typeof item == 'object') { + 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 + } else { + this.arrangeInfo.companyName = item + } + }, + getFirstDayOfMonth() { var currentDate = new Date(); // currentDate.setDate(1); // 灏嗘棩鏈熻涓�1 return this.$util.formatDate(currentDate); }, - clickTime () { + clickTime() { this.datePickerShow = !this.datePickerShow + }, + clickShouTime() { + this.shougHuoshow = !this.shougHuoshow + }, + 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() }, editOrder(item) { this.isEdit = true - this.contentVal = item.remark - this.editItem = item + this.arrangeInfo = { + deliverTime: this.$util.formatDate(item.deliverTime), + driverId: item.driverId, + buyerId: item.buyerId, + dianhua: item.dianhua, + remark: item.remark, + lianxiren: item.lianxiren, + dizhi: item.dizhi, + keyid: item.keyid, + companyName: item.companyName, + sort: item.sort, + driverName: item.driver.name || '' + } + this.show7 = true + this.driverName = item.driver && item.driver.name + // let obj = this.customerList.find(ite => { + // return ite.keyid == item.buyerId + // }) + // this.buyerName = obj.companyName + }, + UndoDeliverPlans(item) { + let that = this + uni.showModal({ + title: '鎻愮ず', + content: '纭鎾ら攢璇ヨ鍗曞悧锛�', + success: function(res) { + if (res.confirm) { + // 鎵ц纭鍚庣殑鎿嶄綔 + that.$api.UndoDeliverPlans(item.keyid).then(res => { + if (res.code == 1) { + that.$util.showToast({ + title: '鎾ら攢鎴愬姛锛�' + }) + that.init() + } else { + that.$util.showToast({ + title: res.error + }) + } + }) + } else { + // 鎵ц鍙栨秷鍚庣殑鎿嶄綔 + } + } + }) + }, delOrder(item) { let that = this @@ -196,30 +412,67 @@ }, init() { this.pageIndex = 1 - this.pageSize = 20 + this.pageSize = 30 this.loadStatus = 'loadmore' this.orderList = [] - this.contentVal = '' + console.log(this.orderList); this.getList() }, - reservation() { - this.show7 = true - if (!this.contentVal) { - return this.$util.showToast({ - title: '璇峰厛杈撳叆鍐呭锛�' - }) - } - this.isLoading = true - if (this.isEdit) { - let obj = { - keyid: this.editItem.keyid, - remark: this.contentVal + 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: '', + companyName: '', + driverName: '', + sort: '1' + } + this.show7 = false + this.driverName = '' + this.buyerName = '' + this.init() + } else { + this.$util.showToast({ + title: res.error + }) + } + this.isLoading = false + }) + return } - this.$api.UpDataAppointmentDeliver(obj).then(res => { + this.$api.CreatDeliverPlan(this.arrangeInfo).then(res => { if (res.code == 1) { - this.isEdit = false - this.editItem = {} - this.contentVal = '' + this.arrangeInfo = { + deliverTime: this.$util.formatDate(new Date(), null, 1), + driverId: '', + buyerId: null, + dianhua: '', + remark: '', + lianxiren: '', + dizhi: '', + companyName: '', + driverName: '', + sort: '1' + } + this.show7 = false + this.driverName = '' + this.buyerName = '' this.init() } else { this.$util.showToast({ @@ -228,32 +481,53 @@ } this.isLoading = false }) - return + }).catch(errors => { + this.$refs.modalArrange.loading = false + }) + + }, + cancelModal() { + this.arrangeInfo = { + deliverTime: this.$util.formatDate(new Date(), null, 1), + driverId: '', + buyerId: null, + dianhua: '', + remark: '', + lianxiren: '', + dizhi: '', + companyName: '', + driverName: '', + sort: '1' } - this.$api.CreatAppointmentDeliver({ - remark: this.contentVal - }).then(res => { + this.show7 = false + this.driverName = '' + this.buyerName = '' + }, + Getdrivers() { + this.$api.Getdrivers().then(res => { if (res.code == 1) { - this.contentVal = '' - this.init() - } else { - this.$util.showToast({ - title: res.error - }) + this.driverList = res.data } - this.isLoading = false }) }, getList() { + this.deliverKeyName == '' ? this.deliverKeyID = '' : null let data = { - deliverState: 0, page: { pageIndex: this.pageIndex, pageSize: this.pageSize, } } - this.$api.GetListAppointmentDeliverList(data).then(res => { - console.log(res, res.code, '-----------123鈥�'); + if (this.timeStart) { + data.timeStart = this.timeStart + } + if (this.timeEnd) { + data.timeEnd = this.timeEnd + } + if (this.deliverKeyID) { + data.deliverKeyID = this.deliverKeyID + } + this.$api.GetDeliverPlans(data).then(res => { if (res.code == 1) { if (this.pageIndex == 1) { this.orderList = res.data.data @@ -300,16 +574,17 @@ } } }) - }, - actionClick(item, e) { - console.log(e); - if (e.index == 0) { - this.contentVal = item.remark - } } } } </script> <style> + .u-textarea { + padding: 0 !important; + } + + .u-form-item__body { + padding: 5px 0 !important; + } </style> \ No newline at end of file -- Gitblit v1.9.1