diff --git a/components/textarea/index.wxml b/components/textarea/index.wxml index d5d37e2..13f3713 100644 --- a/components/textarea/index.wxml +++ b/components/textarea/index.wxml @@ -1,4 +1,4 @@ {{value || placeholder }} \ No newline at end of file diff --git a/pages/agent/appointment/index.js b/pages/agent/appointment/index.js index db5bef1..923f6b3 100644 --- a/pages/agent/appointment/index.js +++ b/pages/agent/appointment/index.js @@ -33,7 +33,11 @@ Scene({ visible: false, show: false, code: '', - marginTop: 0 + editing: false, + focusTop: '100%', // 输入框获取焦点时的top值 + platform: false, // 机型 + domHeight: 'auto', // dom元素高度 + focusTime: 0 // 获取焦点的时间 yiling 20200408 14:43:56 }, onLoad: function (options) { if(options.activityId){ @@ -45,12 +49,13 @@ Scene({ wx.showLoading({ title: '加载中', mask: true }) getVehicleList().then(result => { this.data.plateList = result.data.records + var height = app.globalData.fragmentHeight - app.globalData.safeBottom - 120 if(this.data.plateList.length <= 7){ - this.setData({ vateList: this.data.plateList, height: app.globalData.fragmentHeight - app.globalData.safeBottom - 120 }) + this.setData({ vateList: this.data.plateList, height, platform: app.globalData.isIos }) } else { this.data.vateList = this.data.plateList.slice(0, 7) this.data.vateList.push({plateNumber: '查看更多', fold: 1}) - this.setData({ vateList: this.data.vateList, height: app.globalData.fragmentHeight - app.globalData.safeBottom - 120}) + this.setData({ vateList: this.data.vateList, height, platform: app.globalData.isIos }) } }).catch(err => { }) @@ -121,8 +126,10 @@ Scene({ this.setData({ [form_data]: e.detail }) } }, - bindFocus: function(e){ - // this.setData({ marginTop: e.detail }) + onEdit: function(e){ + this.setData({ editing: true }) + }, + bindRemark: function (e) { }, bindInput: function (e) { if(!util.isEmpty(e.currentTarget.id)){ @@ -299,5 +306,96 @@ Scene({ this.dialog = this.dialog || this.selectComponent('#van-dialog') this.dialog.stopLoading() }) + }, + /************************************** TextArea ********************************************/ + handleEvaluationFocus(e) { + /* 获取焦点时记录时间 yiling 202000408 14:43:56 start */ + this.setData({ focusTime: Date.now() }) + /* 获取焦点时记录时间 yiling 202000408 14:43:56 end */ + const { height } = e.detail // 为键盘高度 + const windowHeight = wx.getSystemInfoSync().windowHeight // 可使用窗口高度,单位px + if (this.data.oldFocusTop) { + this.setData({ focusTop: this.data.oldFocusTop }) + } else { + const query = wx.createSelectorQuery().in(this) // 自定义组件内必须添加.in(this),否则获取不到dom数据! + query.select('.popup-evaluation-wrap').boundingClientRect() + query.exec(res => { + if (res[0]) { + const domHeight = res[0].height || 156 + this.setData({ + focusTop: (windowHeight - domHeight - height) + 'px', + oldFocusTop: (windowHeight - domHeight - height) + 'px', + domHeight: domHeight + 'px', // 固定高度,防止部分机型中多行文本时布局错乱 + }) + } + }) + } + }, + /** + * @author: yiling + * @description: 监听输入框输入内容,统计字数 + * @param {Object} event event + * @return {void} + * @Date: 2019-12-16 15:46:22 + */ + handleEvaluationInput({detail}) { + this.setData({ ['form.remark']: detail.value }) + }, + /** + * @author: yiling + * @description: 点击完成按钮时关闭弹窗 + * @return {void} + * @Date: 2019-12-16 15:46:22 + */ + handleEvaluationConfirm() { + this.handleClose() + }, + /** + * @author: yiling + * @description: 点击发表评论按钮 + * @return {void} + * @Date: 2019-12-16 15:46:22 + */ + handleEvaluationRelease() { + this.handleClose((object) => { + object.id = this.data.info.id // id + object.content = this.data.commentsText // 评论内容 + object.typeName = this.data.info.typeName // 类型:名片 / 资讯 / 商城 / ... + }) + }, + /** + * @author: yiling + * @description: 关闭输入框的弹窗 + * @param {Function} callback 回调 + * @return {void} + * @Date: 2019-12-16 15:46:22 + */ + handleClose(callback) { + this.setData({ focusTop: '100%', editing: false }) + }, + /** + * @author: yiling + * @description: 防页面穿透 + * @return {void} + * @Date: 2019-12-16 15:46:22 + */ + handleEvaluationtouchmove() { + this.handleClose() + return false + }, + /** + * @author: yiling + * @description: 失去焦点(安卓机软键盘右上角的小三角会触发) + * @return {void} + * @Date: 2019-12-19 + */ + handleEvaluationBlur() { + if (Date.now() > this.data.focusTime && this.data.focusTime !== 0) { + console.log('handleEvaluationBlur') + this.handleClose() + } + }, + noop: function(){ + } }) \ No newline at end of file diff --git a/pages/agent/appointment/index.wxml b/pages/agent/appointment/index.wxml index 1681f32..cc509a8 100644 --- a/pages/agent/appointment/index.wxml +++ b/pages/agent/appointment/index.wxml @@ -4,89 +4,88 @@ 代卖预约 - - - - 提交订单 - - 等待预约 - - 线下送货 - - 余额提现 - + + + 提交订单 + + 等待预约 + + 线下送货 + + 余额提现 + - - - 纸品信息 + + + 纸品信息 + + + + 纸厂名称 + {{factoryDetail.name}} - - - 纸厂名称 - {{factoryDetail.name}} - - - - - 纸品品类 - {{cateName || '请选择品类'}} - - - - - 预估单价(元/吨) - - {{formate.formatePrice(form.unitPrice)}} - (已含补贴{{formate.formatePrice(form.publicSubsidies)}}元/吨) - - - - - - 预估重量(吨) - - - - - 货到时间 - {{form.deliveryTime||'请选择货到时间'}} - - - - - - 车辆信息 + + + + 纸品品类 + {{cateName || '请选择品类'}} - - - {{item.plateNumber}} + + + + 预估单价(元/吨) + + {{formate.formatePrice(form.unitPrice)}} + (已含补贴{{formate.formatePrice(form.publicSubsidies)}}元/吨) - - - - {{index + 1}} - 货车车牌: - - {{item.plateNumber || '点击输入车牌号码'}} - - - - - - 添加车辆 + + + + 预估重量(吨) + + + + + 货到时间 + {{form.deliveryTime||'请选择货到时间'}} + - - - 其他信息 + + + 车辆信息 + + + + {{item.plateNumber}} - - + + + + + {{index + 1}} + 货车车牌: + + {{item.plateNumber || '点击输入车牌号码'}} + - - - + + + + 添加车辆 + + + + + 其他信息 + + + {{form.remark || '点击输入备注,最多100字' }} + + + + 提交订单 @@ -99,4 +98,17 @@ - \ No newline at end of file + + + + + + + 其他信息 + + + + + + + diff --git a/pages/agent/appointment/index.wxss b/pages/agent/appointment/index.wxss index 27a03c5..f9d373d 100644 --- a/pages/agent/appointment/index.wxss +++ b/pages/agent/appointment/index.wxss @@ -27,7 +27,7 @@ .textarea{ width:100%; height:80px; - padding:12rpx; + padding: 12rpx; font-size: 14px; border: 1rpx solid #f3f3f3; } @@ -48,3 +48,40 @@ width: 44rpx; height: 44rpx; } + + + + + +.popup-evaluation__bg { + background: rgba(0, 0, 0, 0.2); + position: fixed; + left: 0; + right: 0; + top: 100%; + z-index: 66; + opacity: 0; + min-height: 100vh; +} +.popup-evaluation-wrap { + box-sizing: border-box; + background: #fff; + position: absolute; + top: 100%; + /* transition: .15s; */ + width: 100%; + display: flex; + flex-direction: column; +} + +/* 修复ios的padding bug 注:苹果手机中textarea自带会带"填充"且是小值为12 start */ +.textatrea_ios_bug { + padding: 4rpx; +} + +/* 获取焦点时的样式 start */ +.is__show { + top:0; + opacity: 1; + /* transition: .35s; */ +}