123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view>
- <view class="amendCar">
- <view class="inp">
- <image src="http://resource.weilaibike.com/common/icon1.png"></image>
- <input type="number" placeholder="请输入车牌号" v-model="bikeNo"></input>
- <text class="flexC" @click="scan1">扫码</text>
- </view>
- <view class="inp">
- <image src="http://resource.weilaibike.com/common/icon2.png"></image>
- <input type="number" placeholder="请输入中控设备号" v-model="boxNo"></input>
- <text class="flexC" @click="scan2">扫码</text>
- </view>
- <view class="inp">
- <image src="http://resource.weilaibike.com/common/icon3.png"></image>
- <input placeholder="添加备注" @input="input"></input>
- </view>
- <view class="button flexC" @click="btn">
- <view>保存</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var app = getApp()
- export default {
- data() {
- return {
- bikeNo: '', //车牌号
- boxNo: '', //车牌号
- bikeID: '', //车牌号
- value: ''
- }
- },
- methods: {
- // 扫车牌号
- scan1() {
- var that = this;
- uni.scanCode({
- onlyFromCamera: true,
- success(res) {
- let index = res.result.lastIndexOf("\=");
- var code = res.result.substring(index + 1, res.result.length);
- this.bikeNo = code
- app.request('bike/getBikeInfo?bike_no=' + code, '', 'GET').then(res => {
- this.bikeID = res.data.bike_info.id
- })
- }
- })
- },
- //扫描中控设备号
- scan2() {
- uni.scanCode({
- onlyFromCamera: true,
- success(res) {
- let index = res.result.lastIndexOf("\=");
- var code = res.result.substring(index + 1, res.result.length);
- this.boxNo = code
- }
- })
- },
- input: function(e) {
- this.value = e.detail.value
- },
- btn: function() {
- uni.showLoading({
- title: '修改中...',
- })
- var data = {
- bike_id: this.bikeID,
- bike_remarks: this.value,
- bike_no: this.bikeNo,
- box_no: this.boxNo,
- }
- app.request('bike/updateBikeInfo', data, 'POST').then(res => {
- uni.hideLoading()
- if (res.statusCode == 200) {
- uni.showToast({
- title: '修改成功',
- icon: 'none',
- success: function() {
- uni.navigateBack()
- }
- })
- }
- })
- },
- },
- onLoad: function(options) {
- this.bikeNo = options.bike_no;
- this.bikeID = options.id;
- this.boxNo = options.box_no;
- },
- }
- </script>
- <style>
- uni-page{
- height: auto;
- }
- .amendCar {
- width: 90%;
- margin: 20upx auto 0;
- }
- .amendCar>view {
- display: flex;
- }
- .amendCar image {
- height: 48upx;
- width: 48upx;
- margin-right: 28upx;
- }
- .amendCar view.inp {
- margin-bottom: 20upx;
- box-shadow: 0 0 4upx 0 rgba(222, 222, 222, 1);
- padding: 20upx 20upx;
- border-radius: 10upx;
- }
- .amendCar input {
- font-size: 28upx;
- border-bottom: 1px solid #6b6b6b;
- padding-bottom: 10upx;
- width: 70%;
- }
- .amendCar .placeholder {
- font-size: 28upx;
- color: #b6b6b6;
- }
- .amendCar text {
- background: #c5c5c5;
- padding: 5upx 20upx;
- color: #fff;
- font-size: 24upx;
- margin-left: 10upx;
- border-radius: 10upx;
- padding-top: 10upx;
- }
- .button {
- margin: 0 auto;
- width: 420upx;
- height: 88upx;
- color: #fff;
- letter-spacing: 10upx;
- margin-top: 84upx;
- background: rgba(24, 213, 185, 1);
- box-shadow: 0 8upx 13upx 0 rgba(100, 239, 218, 1);
- border-radius: 44upx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|