市北人才赋能平台 --小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

168 lines
3.4 KiB

// pages/service/settle/settle.js
import { ServiceModel } from '../../../models/service.js'
let serviceModel = new ServiceModel()
Page({
/**
* 页面的初始数据
*/
data: {
info:'',
text:true,
imgUrl:[],
img:[],
message:0,
save:true,
code:1,
tp:'',
array: ['融创', '时代国际'],
index:'',
departIndex:'',
department:[],
departArray:[],
demand:'', // 服务需求
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options.code)
console.log(options.tp)
this.setData({
code:options.code,
tp:options.tp
})
serviceModel.getUserInfo(res=>{
this.setData({
info:res.result
})
})
if(this.data.code == 'zwfw'){
serviceModel.getDepartList(this.data.code,res=>{
var departArray = []
for(let i = 0;i < res.result.length; i++){
departArray.push(res.result[i]['depart_name'])
}
this.setData({
department:res.result,
departArray:departArray
})
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
photo:function(){
var th = this;
var img = th.data.img;
var count = img.length;
var num = 9 - count;
if(num <= 0){
wx.showToast({
title: '最多能选9张图片',
icon: 'none',
duration: 2000
})
return;
}
wx.chooseImage({
count: num,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths
console.log(tempFilePaths);
img = img.concat(tempFilePaths);
th.setData({
text:false,
img: img
})
}
})
},
del:function(e){
// console.log(e);
var id = e.currentTarget.dataset.id;
var th = this;
var img = th.data.img;
img.splice(id,1);
th.setData({
img:img
})
},
inputDemand:function(e){
console.log(e)
this.setData({
demand:e.detail.value
})
},
bindDepartChange:function(e){ // 办理部门
console.log(e)
this.setData({
departIndex:e.detail.value
})
}
})