Skip to content

Instantly share code, notes, and snippets.

@330132662
Created August 17, 2020 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 330132662/81ac0ca2cef21676845d9bce6372dc99 to your computer and use it in GitHub Desktop.
Save 330132662/81ac0ca2cef21676845d9bce6372dc99 to your computer and use it in GitHub Desktop.
1
<!-- 新版 -->
<view class="qdgl" wx:if="{{carType== 1}}">
<view class="lbxx">
<view class="nr">
<text>被施救车辆种类:{{dunwei}}类</text>
<view class="xx">
<text>城区</text>
<view>
<text>车辆</text>
<input type="number" placeholder="请输入车辆数" model:value="{{car_city_amount}}"></input>
</view>
</view>
<view class="xx">
<text>公路</text>
<view>
<text>车辆</text>
<input type="number" placeholder="请输入车辆数" model:value="{{craneCount}}"></input>
</view>
<view>
<text>空车行驶公里数</text>
<input type="number" placeholder="请输入车辆数" model:value="{{carEmptyKm}}"></input>
</view>
<view>
<text>重车行驶公里数</text>
<input type="number" placeholder="请输入车辆数" model:value="{{carFillKm}}"></input>
</view>
</view>
<view class="jg">
<text>小计:</text>
<text>¥{{amount}}</text>
<view bindtap="carCount">获取价格</view>
</view>
</view>
</view>
</view>
// pkg_b/components/diaoche.js 青岛地区 吊车组件
const app = getApp();
var util = require('../../utils/util.js');
Component({
/**
* 组件的属性列表
*/
properties: {
tabShow: {
type: Array, value: [],
observer: function (newVal, oldVal, changedPath) {
this.setData({ tabs: newVal })
}
},
tabsId: {
type: Array, value: [],
observer: function (newVal, oldVal, changedPath) {
this.setData({ tabsId: newVal });
// console.log("tabsId= ", newval);
}
},
carType: {
type: String, value: [],
observer: function (newVal, oldVal, changedPath) {
this.setData({ carType: newVal })
// console.log("车辆类型 ", newval);
}
},
dunwei: {
type: String, value: [],
observer: function (newVal, oldVal, changedPath) {
this.setData({ dunwei: newVal })
}
},
tonnageChoose: {
type: String, value: [],
observer: function (newVal, oldVal, changedPath) {
// console.log("被施救车辆类型 ", newval);
this.setData({ rescueeCarType: newVal })
}
},
},
/**
* 组件的初始数据
*/
data: {
carType: 1,
dunwei: 0,
rescueeCarType: 1,// 选择
car_city_amount: 0,
craneCount: 0,
rescueCarType: 0,
carEmptyKm: 0,
carFillKm: 0,
TabCur: 0,
tabs: [],
keyword: '',
tabsId: [],
scrollLeft: 0, status: 0,
},
/**
* 组件的方法列表
*/
methods: {
carCount() {
let car_city_amount = this.data.car_city_amount;
let car_road_amount = this.data.craneCount;
let rescueCarType = this.data.rescueCarType;
let rescueeCarType = this.data.rescueeCarType;
let carEmptyKm = this.data.carEmptyKm;
let carFillKm = this.data.carFillKm;
var jsonData = {
"region": 1,
"car_city_amount": car_city_amount,//
"car_road_amount": this.data.craneCount,
"rescueCarType": this.data.carType,
"rescueeCarType": this.data.rescueeCarType,// 被施救 车 类型
"carEmptyKm": this.data.carEmptyKm,
"carFillKm": this.data.carFillKm,
"craneCount": 0,//
"rescueCarHourRoad": 0,//
"tonnageChoose": 0,//
// 非吊车 参数参默认值 防止后端报错
};
var that = this;
const api = 'Rescue/calculate';
util.myReq(api, 2, 1, jsonData).then(function name(response) {
// console.log("", response);
that.setData({
amount: response.data,
})
that.triggerEvent('search', {
tonnageChoose: that.data.rescueeCarType,
amount: response.data
});
})
}
}
,
lifetimes: {
attached: function () {
// 在组件实例进入页面节点树时执行
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
// 以下是旧式的定义方式,可以保持对 <2.2.3 版本基础库的兼容
attached: function () {
// 在组件实例进入页面节点树时执行
console.log(this.data);
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
pageLifetimes: {
// 组件所在页面的生命周期函数
show: function () {
// console.log('yewu show');
// this.reqList();
},
attached: function () {
console.log(' attached');
// this.reqList();
},
hide: function () {
console.log(' hide');
},
resize: function () {
console.log(' resize');
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment