12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- var app = getApp()
- Page({
- data: {
- bikeNo: '', //车牌号
- boxNo: '', //车牌号
- bikeID: '', //车牌号
- value: ''
- },
- onLoad: function (options) {
- this.setData({
- bikeNo: options.bike_no,
- bikeID: options.id,
- boxNo: options.box_no
- })
- },
- // 扫车牌号
- scan1() {
- var that = this;
- wx.scanCode({
- onlyFromCamera: true,
- success(res) {
- let index = res.result.lastIndexOf("\=");
- var code = res.result.substring(index + 1, res.result.length);
- that.setData({
- bikeNo: code
- })
- app.request('bike/getBikeInfo?bike_no=' + code, '', 'GET').then(res => {
- that.setData({
- bikeID: res.data.bike_info.id
- })
- })
- }
- })
- },
- //扫描中控设备号
- scan2() {
- wx.scanCode({
- onlyFromCamera: true,
- success(res) {
- let index = res.result.lastIndexOf("\=");
- var code = res.result.substring(index + 1, res.result.length);
- that.setData({
- boxNo: code
- })
- }
- })
- },
- input: function (e) {
- this.setData({
- value: e.detail.value
- })
- },
- btn: function () {
- wx.showLoading({
- title: '修改中...',
- })
- var data = {
- bike_id: this.data.bikeID,
- bike_remarks: this.data.value,
- bike_no: this.data.bikeNo,
- box_no: this.data.boxNo,
- }
- app.request('bike/updateBikeInfo', data, 'POST').then(res => {
- wx.hideLoading()
- if (res.statusCode == 200) {
- wx.showToast({
- title: '修改成功',
- icon: 'none',
- success: function () {
- wx.navigateBack()
- }
- })
- }
- })
- },
- })
|