123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- // miniprogram/scheme/scheme.js
- const app=getApp();
- const utils=require("../../utils/http");
- let time1=null;
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- priceflag:{
- type: Boolean,
- value:false
- },
- rType: {
- type: String,
- value: ''
- },
- curId: {
- type: String|Number,
- value: ''
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- imgUrl:app.globalData.imgUrl,
- homearr:[
- {id:1,name:'1室'},
- {id:2,name:'2室'},
- {id:3,name:'3室'},
- {id:4,name:'4室'},
- {id:5,name:'5室'},
- {id:6,name:'6室'},
- {id:7,name:'7室'},
- {id:8,name:'8室'},
- {id:9,name:'9室'},
- {id:10,name:'10室'}],
- hidx:2,
- liveroom:[
- {id:1,name:'1厅'},
- {id:2,name:'2厅'},
- {id:3,name:'3厅'},
- {id:4,name:'4厅'},
- {id:5,name:'5厅'}
- ],
- lidx:1,
- tolitarr:[
- {id:1,name:'1卫'},
- {id:2,name:'2卫'},
- {id:3,name:'3卫'},
- {id:4,name:'4卫'},
- {id:5,name:'5卫'}
- ],
- tidx:0,
- area:'',
- community:''
- },
- ready() {
- console.log(this.data.rType,this.data.curId,'<<<<')
- },
- methods:{
- dothis(){},
- setareatap(e){
- this.setData({
- area:e.detail.value
- })
- },
- bindPickerChange: function(e) {
- this.setData({
- hidx: e.detail.value
- })
- },
- bindliveChange: function(e) {
- this.setData({
- lidx: e.detail.value
- })
- },
- bindtolietChange: function(e) {
- this.setData({
- tidx: e.detail.value
- })
- },
- isPhoneNum: function (phone) {
- var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
- if (!myreg.test(phone)) {
- return false;
- }
- return true;
- },
- setcommunitytap(e){
- this.setData({
- community: e.detail.value
- })
- },
- closetap(){
- this.triggerEvent("run", {type: 'close'})
- },
- /**
- * 获取手机号
- */
- getPhoneNumberTap: function (res) {
- var that = this;
- if (res.detail.errMsg == 'getPhoneNumber:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserMobile',
- data: {
- encryptedData: res.detail.encryptedData,
- iv: res.detail.iv
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.subfun(r.data.mobile)
- } else {
- that.setData({
- errorText: r.data.msg,
- errorflag: true
- })
- }
- }
- })
- }
- },
- subfun(phone){
- const that=this;
- if(!that.data.area){
- wx.showToast({
- title: "房屋面积不能为空",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if(!that.data.community){
- wx.showToast({
- title: "小区名称不能为空",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.showLoading({
- title: '计算中...',
- })
- var bedRoom = `${that.data.homearr[that.data.hidx].name}${that.data.liveroom[that.data.lidx].name}${that.data.tolitarr[that.data.tidx].name}`;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/getDecorationDesign',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- type: that.data.rType,
- id: that.data.curId,
- community: that.data.community,
- area:that.data.area,
- bedroom: bedRoom,//*室*厅*卫
- mobile: phone,
- },
- success: function (res) {
- // wx.hideLoading();
- if(res.data.code=='0'){
- that.triggerEvent("run", {type: 'success'})
- wx.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 2000
- })
- }
- }
- })
- },
- }
- })
|