var app = getApp() Page({ data: { carList: [ //详情列表 { id: 1, img_url: "http://resource.bike.hanyiyun.com/bike_yunwei/position.png", text: "车辆位置" }, { id: 2, img_url: "http://resource.bike.hanyiyun.com/bike_yunwei/scan.png", text: "扫码位置" }, { id: 3, img_url: "http://resource.bike.hanyiyun.com/bike_yunwei/order.png", text: "最近订单" }, { id: 4, img_url: "http://resource.bike.hanyiyun.com/bike_yunwei/lock.png", text: "开关锁记录" }, { id: 4, img_url: "http://resource.bike.hanyiyun.com/bike_yunwei/line.png", text: "上下线记录" } ], id: '', bike_no: '', detail: [], isDisabled: false, //备注是否修改 textVal: '', //输入框内容 }, //点击跳转 skip(e) { let that = this; let idx = parseInt(e.currentTarget.dataset.idx); let url = '' switch (idx) { case 0: url = '/pages/carPosition/carPosition'; break; case 1: url = '/pages/scanRecord/scanRecord'; break; case 2: url = '/pages/recentOrder/recentOrder'; break; case 3: url = '/pages/lockRecord/lockRecord'; break; case 4: url = '/pages/lineRecord/lineRecord'; break; default: ; } console.log(that.data.bike_no) console.log(that.data.id) wx.navigateTo({ url: url + '?bike_no=' + that.data.bike_no + '&&id=' + that.data.id, }) }, onLoad: function (options) { wx.showLoading({ title: '加载中...', }) let that = this; that.setData({ bike_no: options.bike_no, id: options.id }) app.request('bike/getBikeInfo?bike_no=' + options.bike_no, '', 'GET').then(res => { wx.hideLoading(); that.setData({ detail: res.data.bike_info }) if (res.data.bike_info.remark) { that.setData({ isDisabled: true }) } }) }, getText(e) { this.setData({ textVal: e.detail.value }) }, operate() { wx.showLoading({ title: '加载中...', }) let that = this; let dis = that.data.isDisabled; if (dis) { that.setData({ isDisabled: false }) } else { let data = { remark: this.data.textVal } app.request('bike/updateRemark/' + this.data.id, data, 'PUT').then(res => { wx.hideLoading(); console.log(res); wx.showToast({ title: '提交成功~', icon: 'none' }) that.setData({ isDisabled: true }) }) } }, })