报修改样式

This commit is contained in:
his-uncles-father 2020-01-16 00:16:43 +08:00
parent befc22a6f1
commit eb3e87323e
6 changed files with 392 additions and 0 deletions

View File

@ -30,6 +30,7 @@
"pages/payParkingFeeList/payParkingFeeList",
"pages/payParkingFee/payParkingFee",
"pages/my/myHouseDetail"
"pages/my/myHouseDetail",
],
"window": {
"navigationBarTextStyle": "white",

View File

@ -51,6 +51,10 @@ Page({
name: "报修",
src: "/images/5.png",
href: "/pages/repair/repair"
}, {
name: "报修新",
src: "/images/5.png",
href: "/pages/repair/repair2"
}, {
name: "房屋出租",
src: "/images/6.png"

328
pages/repair/repair2.js Normal file
View File

@ -0,0 +1,328 @@
// pages/enterCommunity/enterCommunity.js
const context = require('../../context/Java110Context.js')
const constant = context.constant;
const factory = context.factory;
Page({
/**
* 页面的初始数据
*/
data: {
minDate: new Date().getTime(),
bindDate: '',
bindTime: '',
roomCloums:[],
roomIdArr:[],
roomName:"",
roomId: '',
roomShow:false,
columns: ['卧室报修', '管道报修', '客厅报修'],
typeName: '',
typeId: '',
typeShow: false,
timeShow:false,
photoList: [],
bindTel: '',
context: '',
bindRepairName: '',
userId: '',
storeId: '',
photos: [],
communityId:"",
formatter(type, value) {
if (type === 'year') {
return `${value}`;
} else if (type === 'month') {
return `${value}`;
}else if (type === 'day') {
return `${value}`;
}
return value;
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let that = this;
context.getRooms().then(res=>{
let arr = res.data.rooms;
let roomCloums = [];
let roomIdArr = [];
arr.map(item => {
roomCloums.push(item.floorNum + "号楼" + item.unitNum + "单元" + item.roomNum + "室");
roomIdArr.push(item.roomId);
})
that.setData({
roomCloums: roomCloums,
roomIdArr: roomIdArr,
userId: res.data.owner.appUserId,
communityId: res.data.owner.communityId
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
bindInput: function(e) {
console.log('数据监听', e);
let _that = this;
let dataset = e.currentTarget.dataset;
let value = e.detail;
let name = dataset.name;
_that.data[name] = value;
// _that.setData({
// name: value
// });
console.log(this.data);
},
bindOwner: function(e) {
// context.getOwner(function(_ownerInfo) {
// console.log(_ownerInfo, 888888888);
// if (_ownerInfo) {
let obj = {
"typeId": this.data.typeId,
"bindRepairName": this.data.bindRepairName,
"bindTel": this.data.bindTel,
"roomId": this.data.roomId,
"photos": [],
"context": this.data.context,
"userId": this.data.userId,
"communityId": this.data.communityId
}
let _photos = this.data.photos;
_photos.forEach(function(_item) {
obj.photos.push({ "photo": _item });
});
console.log(obj,3333333333333);
let msg = "";
if (obj.roomId == "") {
msg = "请选择房屋";
} else if (obj.typeId == "") {
msg = "请选择报修类型";
} else if (obj.bindRepairName == "") {
msg = "请填写报修人";
} else if (obj.bindTel == "") {
msg = "请填写手机号";
} else if (obj.bindDate == "") {
msg = "请选择预约日期";
}else if (obj.bindTime == "") {
msg = "请选择预约时间";
}else if (obj.context == "") {
msg = "请填写投诉内容";
}
console.log(obj.roomId);
if (msg != "") {
wx.showToast({
title: msg,
icon: 'none',
duration: 2000
})
} else {
console.log("提交数据", obj);
context.request({
url: constant.url.saveOwnerRepair, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair
header: context.getHeaders(),
method: "POST",
data: {
"repairType": "10001",
"roomId": "752019100758260005",
"communityId": "7020181217000001",
"repairName": "吴学文",
"tel": "17797173942",
"context": "服务太差",
"appointmentTime": "2019-12-14 18:30:30",
"photos": ['base64....']
},
// data:obj, //动态数据
success: function(res) {
console.log(res, 99999);
}
});
}
},
onChange: function(e) {
console.log(e);
},
onTimeConfirm: function(e) {
console.log("onConfirm", e);
this.setData({
bindTime: e.detail,
timeShow: false
});
},
onTimeCancel: function(e) {
this.setData({
timeShow: false
});
},
chooseTime: function(e) {
this.setData({
timeShow: true
});
},
onDateConfirm: function(e) {
console.log("onConfirm", e);
var oDate = new Date(e.detail * 1),
oYear = oDate.getFullYear(),
oMonth = oDate.getMonth() + 1,
oDay = oDate.getDate();
console.log("oYear", oYear);
console.log("oMonth", oMonth);
console.log("oDay", oDay);
this.setData({
bindDate:oYear +"-" +oMonth+"-" +oDay,
dateShow: false
});
},
onDateCancel: function(e) {
this.setData({
dateShow: false
});
},
chooseDate: function(e) {
this.setData({
dateShow: true
});
},
onTypeConfirm: function(e) {
console.log("onConfirm", e);
this.setData({
typeName: e.detail.value,
typeId: e.detail.index ? '809001' : '809002',
typeShow: false
});
},
onTypeCancel: function(e) {
this.setData({
typeShow: false
});
},
chooseType: function(e) {
this.setData({
typeShow: true
});
},
onRoomConfirm: function (e) {
console.log("onConfirm", e);
this.setData({
roomName: e.detail.value,
roomId: this.data.roomIdArr[e.detail.index],
roomShow: false
});
},
onRoomCancel: function (e) {
this.setData({
roomShow: false
});
},
chooseRoom: function (e) {
this.setData({
roomShow: true
});
},
afterRead: function(event) {
const {
file
} = event.detail;
let _that = this;
const {
photoList = []
} = this.data;
photoList.push(file);
this.setData({
photoList
});
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
factory.base64.urlTobase64(file.path).then(function(_baseInfo) {
_that.data.photos.push(_baseInfo);
});
console.log("data信息", this.data);
},
removePhoto: function (e) {
console.log(e.detail.index);
let _photoList = [];
this.data.photoList.forEach(function (item, index) {
if (index != e.detail.index) {
_photoList.push(item);
}
});
let _photos = [];
this.data.photos.forEach(function (item, index) {
if (index != e.detail.index) {
_photos.push(item);
}
});
this.setData({
photos: _photos,
photoList: _photoList
});
},
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "报修"
}

54
pages/repair/repair2.wxml Normal file
View File

@ -0,0 +1,54 @@
<view>
<view class="block__title">房屋信息</view>
<van-cell-group>
<van-field value="{{ roomName }}" label="房屋" placeholder="请选择房屋" catchtap="chooseRoom" required readonly icon="arrow" />
</van-cell-group>
<view class="block__title">投诉信息</view>
<van-cell-group>
<van-field value="{{ typeName }}" label="报修类型" placeholder="请选择报修类型" catchtap="chooseType" required readonly icon="arrow" />
<van-field value="{{ bindRepairName }}" bindinput="bindInput" data-name="bindRepairName" label="报修人" placeholder="请输入报修人" required />
<van-field value="{{ bindTel }}" bindinput="bindInput" data-name="bindTel" type="number" label="手机号" placeholder="请输入手机号" required />
<van-field value="{{ bindDate }}" bindinput="bindInput" data-name="bindDate" catchtap="chooseDate" label="预约日期" placeholder="请选择日期" required/>
<van-field value="{{ bindTime }}" bindinput="bindInput" data-name="bindTime" catchtap="chooseTime" label="预约时间" placeholder="请选择时间" required />
<van-field value="{{ context }}" bindinput="bindInput" data-name="context" label="报修内容" type="textarea" placeholder="请输入报修内容" autosize border="{{ false }}" required />
</van-cell-group>
<view class="block__title">相关图片</view>
<view class="aku_photo_view">
<van-uploader file-list="{{ photoList }}" max-count="3" bind:after-read="afterRead" bind:delete="removePhoto" />
</view>
<view class="button_up_blank"></view>
<van-button type="primary" size="large" catchtap="bindOwner">提交</van-button>
<van-popup show="{{ roomShow }}" position="bottom" custom-style="height: 40%;">
<van-picker show-toolbar title="" columns="{{ roomCloums }}" bind:change="onChange" bind:cancel="onRoomCancel" bind:confirm="onRoomConfirm" />
</van-popup>
<van-popup show="{{ typeShow }}" position="bottom" custom-style="height: 40%;">
<van-picker show-toolbar title="" columns="{{ columns }}" bind:change="onChange" bind:cancel="onTypeCancel" bind:confirm="onTypeConfirm" />
</van-popup>
<van-popup show="{{ dateShow }}" position="bottom" custom-style="height: 40%;">
<van-datetime-picker show-toolbar bind:change="onChange" bind:cancel="onDateCancel" bind:confirm="onDateConfirm"
type="date"
value="{{ date }}"
min-date="{{ minDate }}"
formatter="{{ formatter }}"
/>
</van-popup>
<van-popup show="{{ timeShow }}" position="bottom" custom-style="height: 40%;">
<van-datetime-picker show-toolbar bind:change="onChange" bind:cancel="onTimeCancel" bind:confirm="onTimeConfirm"
type="time"
value="{{ time }}"
/>
</van-popup>
</view>

View File

@ -0,0 +1 @@
/* pages/repair/repair2.wxss */