From 81d091a7bde2524f8d637beb73952a5f763079ba Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期四, 16 十一月 2023 17:02:42 +0800 Subject: [PATCH] # --- pages/business/goBusiness/addgoBusiness.vue | 392 ++++++++++++++++++++++++++++++++++++++++++++----------- App.vue | 8 pages/business/goBusiness/goBusiness.vue | 15 ++ 3 files changed, 330 insertions(+), 85 deletions(-) diff --git a/App.vue b/App.vue index f619972..d7bded1 100644 --- a/App.vue +++ b/App.vue @@ -42,10 +42,10 @@ } .fxbtn { position: fixed; - bottom: 50px; - right: 10px; - width: 40px; - height: 40px; + bottom: 100rpx; + right: 40rpx; + width: 80rpx; + height: 80rpx; background-color: #46a7ff; color: #FFF; display: flex; diff --git a/pages/business/goBusiness/addgoBusiness.vue b/pages/business/goBusiness/addgoBusiness.vue index 7a45756..56ee301 100644 --- a/pages/business/goBusiness/addgoBusiness.vue +++ b/pages/business/goBusiness/addgoBusiness.vue @@ -1,36 +1,52 @@ <template> <view> - + <view class="card" v-for="item in form2"> <!-- head --> <view class="card-head flex"> <view class="card-head-title">{{item.title}}</view> </view> <!-- body --> - <view class="card-body flex-column" v-for="subItem in item.info"> - <view class="flex"><text class="card-required" v-show="subItem.required">*</text>{{subItem.subTitle}}</view> - <view class="flex"> - <view style="flex: 1;"> - <input type="text" :placeholder="subItem.placeholder" :placeholder-style="subItem.placeholderStyle" v-model="subItem.value" :disabled="subItem.disabled" v-show="subItem.inputType != 'data'"> - <uni-datetime-picker v-model="subItem.value" :border="false" :red-color="subItem.placeholderStyle" v-if="subItem.inputType == 'data'" /> - </view> - - <view class="flex" style="width: 50rpx;" v-show="subItem.inputType == 'select'" @click="showPicker(subItem.type)"><uni-icons type="right" color="#000" ></uni-icons></view> + <view class="card-body flex-column" v-for="subItem in item.info" v-show="!subItem.unshow"> + <view class="flex"><text class="card-required" v-show="subItem.required">*</text>{{subItem.subTitle}} </view> + <view class="flex"> + <uni-combox :candidates="orderIds" placeholder="璇烽�夋嫨椤圭洰" v-model="subItem.value" + @input="getOrderId(subItem.value)" v-show="subItem.inputType == 'chose'"> + </uni-combox> + + <view style="flex: 1;" v-show="subItem.inputType != 'chose'"> + + <input type="text" :placeholder="subItem.placeholder" + :placeholder-style="subItem.placeholderStyle" v-model="subItem.value" + :disabled="subItem.disabled" v-show="subItem.inputType != 'data'"> + <uni-datetime-picker v-model="subItem.value" :border="false" + :red-color="subItem.placeholderStyle" v-if="subItem.inputType == 'data'" /> + </view> + + <view class="flex" style="width: 50rpx;" v-show="subItem.inputType == 'select'" + @click="showPicker(subItem.type)"><uni-icons type="right" color="#000"></uni-icons></view> + </view> + </view> - + </view> - - - <u-picker :show="businessTransportationShow" :columns="businessTransportations" @confirm="businessTransportationConfirm"></u-picker> + + + <u-picker :show="businessTransportationShow" :columns="businessTransportations" + @confirm="businessTransportationConfirm"></u-picker> <u-picker :show="businessReturnShow" :columns="businessReturns" @confirm="businessReturnConfirm"></u-picker> - <u-picker :show="pcdShow" ref="uPicker" :columns="columns" @confirm="pcdStartConfirm" @change="changeHandler" :defaultIndex="defaultIndex"></u-picker> - <u-picker :show="pcdEndShow" ref="uPicker" :columns="columns" @confirm="pcdEndConfirm" @change="changeHandler" :defaultIndex="defaultIndex"></u-picker> - <u-picker :show="businessStartTimeDayShow" :columns="businessStartTimeDays" @confirm="businessStartTimeDayConfirm"></u-picker> - <u-picker :show="businessEndTimeDayShow" :columns="businessEndTimeDays" @confirm="businessEndTimeDayConfirm"></u-picker> - + <u-picker :show="pcdShow" ref="uPicker" :columns="columns" @confirm="pcdStartConfirm" @change="changeHandler" + :defaultIndex="defaultIndex"></u-picker> + <u-picker :show="pcdEndShow" ref="uPicker" :columns="columns" @confirm="pcdEndConfirm" @change="changeHandler" + :defaultIndex="defaultIndex"></u-picker> + <u-picker :show="businessStartTimeDayShow" :columns="businessStartTimeDays" + @confirm="businessStartTimeDayConfirm"></u-picker> + <u-picker :show="businessEndTimeDayShow" :columns="businessEndTimeDays" + @confirm="businessEndTimeDayConfirm"></u-picker> + <view style="height: 120rpx;"></view> - + <view class="floor"> <view class="default">閲嶇疆</view> <view class="primary" @click="submit()">鎻愪氦</view> @@ -44,6 +60,10 @@ export default { data() { return { + type: 'add', + orderIds: [], + orderId: '', + orderIdList: [], year: '2021-5-3', placeholderStyle: 'font-size:20rpx', form: { @@ -54,52 +74,239 @@ defaultIndex: [], citysData: data.citysData, businessTransportationShow: false, - businessTransportations: [['椋炴満','楂橀搧','鐏溅','姹借溅','鎽╂墭','鐢佃溅','鍏朵粬']], + businessTransportations: [ + ['椋炴満', '楂橀搧', '鐏溅', '姹借溅', '鎽╂墭', '鐢佃溅', '鍏朵粬'] + ], businessReturnShow: false, - businessReturns: [['鍗曠▼','寰�杩�']], + businessReturns: [ + ['鍗曠▼', '寰�杩�'] + ], pcdShow: false, pcdEndShow: false, pcds: data.citysData, businessStartTimeDayShow: false, - businessStartTimeDays: [['涓婂崍','涓嬪崍']], - businessEndTimeDayShow: false, - businessEndTimeDays: [['涓婂崍','涓嬪崍']], - form2: [ - {title: '鍩烘湰淇℃伅',info:[ - {subTitle: '鍑哄樊浜嬬敱',placeholder: '璇疯緭鍏ュ嚭宸簨鐢�',placeholderStyle: 'font-size:20rpx', value: '',submitVal: '鍑哄樊浜嬬敱',type: 'businessTripReasons',inputType: 'input',required: true} - ]}, - {title: '琛岀▼淇℃伅',info:[ - {subTitle: '浜ら�氬伐鍏�',placeholder: '璇烽�夋嫨浜ら�氬伐鍏�',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessTransportation',inputType: 'select',disabled:true,required: true}, - {subTitle: '鍗曠▼寰�杩�',placeholder: '璇烽�夋嫨鍗曠▼鍗曠▼',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessReturn',inputType: 'select',disabled:true,required: true}, - {subTitle: '杞︾墝鍙�',placeholder: '璇疯緭鍏ヨ溅鐗屽彿',placeholderStyle: 'font-size:20rpx',value: '',type: 'carNumber',inputType: 'input',required: true}, - {subTitle: '琛岀▼鏄庣粏鍙婂叕閲屾暟',placeholder: '璇疯緭鍏ヨ绋嬫槑缁嗗強鍏噷鏁�',placeholderStyle: 'font-size:20rpx',value: '',type: 'kilometers',inputType: 'input',required: true}, - {subTitle: '鍑哄彂鍦�',placeholder: '璇烽�夋嫨鍑哄彂鍦�',placeholderStyle: 'font-size:20rpx',value: '',type: 'pcdStart',inputType: 'select',disabled:true,required: true}, - {subTitle: '鍑哄彂鍦拌缁嗗湴鍧�',placeholder: '璇疯緭鍏ュ嚭鍙戝湴璇︾粏鍦板潃',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessStartAddr',inputType: 'input',required: true}, - {subTitle: '鐩殑鍦�',placeholder: '璇烽�夋嫨鐩殑鍦�',placeholderStyle: 'font-size:20rpx',value: '',type: 'pcdEnd',inputType: 'select',disabled:true,required: true}, - {subTitle: '鐩殑鍦拌缁嗗湴鍧�',placeholder: '璇疯緭鍏ョ洰鐨勫湴璇︾粏鍦板潃',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessEndAddr',inputType: 'input',required: true}, - ]}, - {title: '鏃ユ湡淇℃伅',info:[ - {subTitle: '鍑哄彂鏃ユ湡',placeholder: '璇烽�夋嫨鍑哄彂鏃ユ湡',placeholderStyle: 'font-size:20rpx',value: '2021-5-3',type: 'businessStartTime',inputType: 'data',required: true}, - {subTitle: '鍑哄彂鏃惰景',placeholder: '璇烽�夋嫨鍑哄彂鏃惰景',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessStartTimeDay',inputType: 'select',disabled:true,required: true}, - {subTitle: '缁撴潫鏃ユ湡',placeholder: '璇烽�夋嫨缁撴潫鏃ユ湡',placeholderStyle: 'font-size:20rpx',value: '2021-5-3',type: 'businessEndTime',inputType: 'data',required: true}, - {subTitle: '缁撴潫鏃惰景',placeholder: '璇烽�夋嫨缁撴潫鏃惰景',placeholderStyle: 'font-size:20rpx',value: '',type: 'businessEndTimeDay',inputType: 'select',disabled:true,required: true} - ]}, - {title: '鍩烘湰淇℃伅',info:[ - {subTitle: '鍚岃浜�',placeholder: '璇疯緭鍏ュ悓琛屼汉',placeholderStyle: 'font-size:20rpx',value: '鍚岃浜�',type: 'businessPeers',inputType: 'input',required: true}, - {subTitle: '澶囨敞',placeholder: '澶囨敞淇℃伅',placeholderStyle: 'font-size:20rpx',value: '澶囨敞',inputType: 'input',type: 'businessNotes'} - ]}, + businessStartTimeDays: [ + ['涓婂崍', '涓嬪崍'] ], - + businessEndTimeDayShow: false, + businessEndTimeDays: [ + ['涓婂崍', '涓嬪崍'] + ], + form2: [{ + title: '鍩烘湰淇℃伅', + info: [{ + subTitle: '椤圭洰鍚嶇О', + placeholder: '璇疯緭鍏ラ」鐩悕绉�', + placeholderStyle: 'font-size:20rpx', + value: '', + submitVal: '', + type: 'orderId', + inputType: 'chose', + required: true, + unshow: false + }, + { + subTitle: '鍑哄樊浜嬬敱', + placeholder: '璇疯緭鍏ュ嚭宸簨鐢�', + placeholderStyle: 'font-size:20rpx', + value: '', + submitVal: '鍑哄樊浜嬬敱', + type: 'businessTripReasons', + inputType: 'input', + required: true + }, + ] + }, + { + title: '琛岀▼淇℃伅', + info: [{ + subTitle: '浜ら�氬伐鍏�', + placeholder: '璇烽�夋嫨浜ら�氬伐鍏�', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessTransportation', + inputType: 'select', + disabled: true, + required: true + }, + { + subTitle: '鍗曠▼寰�杩�', + placeholder: '璇烽�夋嫨鍗曠▼鍗曠▼', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessReturn', + inputType: 'select', + disabled: true, + required: true + }, + { + subTitle: '杞︾墝鍙�', + placeholder: '璇疯緭鍏ヨ溅鐗屽彿', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'carNumber', + inputType: 'input', + required: true + }, + { + subTitle: '琛岀▼鏄庣粏鍙婂叕閲屾暟', + placeholder: '璇疯緭鍏ヨ绋嬫槑缁嗗強鍏噷鏁�', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'kilometers', + inputType: 'input', + required: true + }, + { + subTitle: '鍑哄彂鍦�', + placeholder: '璇烽�夋嫨鍑哄彂鍦�', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'pcdStart', + inputType: 'select', + disabled: true, + required: true + }, + { + subTitle: '鍑哄彂鍦拌缁嗗湴鍧�', + placeholder: '璇疯緭鍏ュ嚭鍙戝湴璇︾粏鍦板潃', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessStartAddr', + inputType: 'input', + required: true + }, + { + subTitle: '鐩殑鍦�', + placeholder: '璇烽�夋嫨鐩殑鍦�', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'pcdEnd', + inputType: 'select', + disabled: true, + required: true + }, + { + subTitle: '鐩殑鍦拌缁嗗湴鍧�', + placeholder: '璇疯緭鍏ョ洰鐨勫湴璇︾粏鍦板潃', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessEndAddr', + inputType: 'input', + required: true + }, + ] + }, + { + title: '鏃ユ湡淇℃伅', + info: [{ + subTitle: '鍑哄彂鏃ユ湡', + placeholder: '璇烽�夋嫨鍑哄彂鏃ユ湡', + placeholderStyle: 'font-size:20rpx', + value: '2021-5-3', + type: 'businessStartTime', + inputType: 'data', + required: true + }, + { + subTitle: '鍑哄彂鏃惰景', + placeholder: '璇烽�夋嫨鍑哄彂鏃惰景', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessStartTimeDay', + inputType: 'select', + disabled: true, + required: true + }, + { + subTitle: '缁撴潫鏃ユ湡', + placeholder: '璇烽�夋嫨缁撴潫鏃ユ湡', + placeholderStyle: 'font-size:20rpx', + value: '2021-5-3', + type: 'businessEndTime', + inputType: 'data', + required: true + }, + { + subTitle: '缁撴潫鏃惰景', + placeholder: '璇烽�夋嫨缁撴潫鏃惰景', + placeholderStyle: 'font-size:20rpx', + value: '', + type: 'businessEndTimeDay', + inputType: 'select', + disabled: true, + required: true + } + ] + }, + { + title: '鍩烘湰淇℃伅', + info: [{ + subTitle: '鍚岃浜�', + placeholder: '璇疯緭鍏ュ悓琛屼汉', + placeholderStyle: 'font-size:20rpx', + value: '鍚岃浜�', + type: 'businessPeers', + inputType: 'input', + required: true + }, + { + subTitle: '澶囨敞', + placeholder: '澶囨敞淇℃伅', + placeholderStyle: 'font-size:20rpx', + value: '澶囨敞', + inputType: 'input', + type: 'businessNotes' + } + ] + }, + ], + } + }, + onLoad(option) { + let _this = this + const eventChannel = this.getOpenerEventChannel(); + eventChannel.on('goBusinessDel', function(data) { + if (data.data == 'add') { + + _this.getOrderId('') + } + }) + }, mounted() { this.handlePcd(); }, methods: { + getOrderId(condition) { + // console.log(condition); + let _this = this + uni.request({ + url: `${_this.baseUrl}/orderQueryName/auth`, + header: { 'token': uni.getStorageSync('token') }, + method: 'POST', + data: {condition: condition}, + success(res) { + res = res.data + _this.orderIds = [] + _this.orderIdList = [] + if (res.code === 200 && res.data) { + _this.orderIds2 = res.data + for (let k of res.data) { + _this.orderIds.push(k.value) + _this.orderIdList.push(k) + } + + } + } + + }) + }, handlePcd() { - let sheng_s = '110000'; - let shi_s = '110100'; - let qu_s = '110101'; + let sheng_s = '110000'; + let shi_s = '110100'; + let qu_s = '110101'; let sheng = []; let shi = []; @@ -111,13 +318,13 @@ if (shi_item.value === shi_s) { this.defaultIndex[1] = shi_index shi_item.children.forEach((qu_item, qu_index) => { - if (qu_item.value === qu_s) { - this.defaultIndex[2] = qu_index - } - qu.push(qu_item.text); - }) + if (qu_item.value === qu_s) { + this.defaultIndex[2] = qu_index + } + qu.push(qu_item.text); + }) } - shi.push(shi_item.text); + shi.push(shi_item.text); }) } sheng.push(sheng_item.text); @@ -186,29 +393,41 @@ for (let sub of k.info) { if (sub.inputType == 'select') { this.form[sub.type] = sub.submitVal + } else if (sub.inputType == 'chose') { + if (!sub.unshow) { + for (let odd of this.orderIdList) { + if (sub.value == odd.value) { + this.form[sub.type] = odd.id + } + } + } } else { this.form[sub.type] = sub.value } + if (sub.required) { sub.placeholderStyle = 'font-size:20rpx;' if (sub.value == '' || (sub.submitVal == '' && sub.submitVal < 0)) { - console.log(sub); + // console.log(sub); sub.placeholderStyle = 'font-size:20rpx;color:red' subPass = false - } + } } - + } } - console.log(this.form); - console.log(subPass); - if(subPass) { - console.log(this.form); - } + // console.log(this.form.orderId); + // console.log(this.orderIds); + console.log(this.form); + // console.log(subPass); + if (subPass) { + // console.log(this.form); + } + }, showPicker(e) { - switch(e) { + switch (e) { case 'businessTransportation': this.businessTransportationShow = true break; @@ -216,16 +435,16 @@ this.businessReturnShow = true break case 'pcdStart': - this.pcdShow = true + this.pcdShow = true break case 'pcdEnd': - this.pcdEndShow = true + this.pcdEndShow = true break case 'businessStartTimeDay': - this.businessStartTimeDayShow = true + this.businessStartTimeDayShow = true break case 'businessEndTimeDay': - this.businessEndTimeDayShow = true + this.businessEndTimeDayShow = true break } }, @@ -274,7 +493,7 @@ pcd[e.indexs[0]] // console.log(pcd[e.indexs[0]]); this.pcdShow = false - + // console.log(e.indexs) let shen = data.citysData[e.indexs[0]] // console.log(shen.value, shen.text) @@ -284,8 +503,8 @@ // console.log(qu.value, qu.code) // console.log(shen.value , shi.value, qu.value); this.form2[1].info[4].value = e.value[0] + '/' + e.value[1] + '/' + e.value[2] - this.form2[1].info[4].submitVal = shen.value + ',' + shi.value + ',' + qu.value - console.log(this.form2[1].info[4].value,this.form2[1].info[4].submitVal); + this.form2[1].info[4].submitVal = shen.value + ',' + shi.value + ',' + qu.value + console.log(this.form2[1].info[4].value, this.form2[1].info[4].submitVal); }, pcdEndConfirm(e) { // console.log('confirm', e) @@ -293,7 +512,7 @@ pcd[e.indexs[0]] // console.log(pcd[e.indexs[0]]); this.pcdEndShow = false - + // console.log(e.indexs) let shen = data.citysData[e.indexs[0]] // console.log(shen.value, shen.text) @@ -303,8 +522,8 @@ // console.log(qu.value, qu.code) // console.log(shen.value , shi.value, qu.value); this.form2[1].info[6].value = e.value[0] + '/' + e.value[1] + '/' + e.value[2] - this.form2[1].info[6].submitVal = shen.value + ',' + shi.value + ',' + qu.value - console.log(this.form2[1].info[6].value,this.form2[1].info[6].submitVal); + this.form2[1].info[6].submitVal = shen.value + ',' + shi.value + ',' + qu.value + console.log(this.form2[1].info[6].value, this.form2[1].info[6].submitVal); } } } @@ -313,34 +532,41 @@ <style scoped> .card { min-height: 100rpx; - margin: 16rpx 0 0 0; + margin: 16rpx 20rpx 0 20rpx; background-color: #fff; } + .card-head { min-height: 60rpx; width: calc(100%-5px); margin-left: 4px; box-shadow: -4px 0 0px #2d8cf0; } + .card-head-title { /* background-color: #556655; */ padding-left: 6px; } + .card-body { - margin: 8rpx 8rpx 0 8rpx ; + margin: 8rpx 8rpx 0 8rpx; } + .card-required { color: red; padding-right: 4rpx; } + .flex { display: flex; align-items: center; } + .flex-column { display: flex; flex-direction: column; } + .floor { height: 100rpx; line-height: 100rpx; @@ -354,18 +580,22 @@ text-align: center; letter-spacing: 10rpx; } + .default { flex: 2; } + .default:active { background-color: #eff0f1; } + .primary { flex: 3; background-color: #2d8cf0; color: #fff; } + .primary:active { background-color: #007dea; } -</style> +</style> \ No newline at end of file diff --git a/pages/business/goBusiness/goBusiness.vue b/pages/business/goBusiness/goBusiness.vue index 7629127..1821d91 100644 --- a/pages/business/goBusiness/goBusiness.vue +++ b/pages/business/goBusiness/goBusiness.vue @@ -29,6 +29,10 @@ </view> </view> </view> + + <view class="fxbtn"> + <uni-icons type="plusempty" color="#fff" @click="add()" ></uni-icons> + </view> <!-- 鍨簳 --> <view style="height: 120rpx;"></view> @@ -104,6 +108,17 @@ } }) }, + // 鍑哄樊鐢宠 + add() { + uni.navigateTo({ + url: '/pages/business/goBusiness/addgoBusiness', + success: function(res) { + res.eventChannel.emit('goBusinessDel', { + data: 'add' + }) + } + }) + }, back() { uni.navigateBack({}) }, -- Gitblit v1.9.1