银花优选微信小程序修改后的最新版本代码
This commit is contained in:
727
pages/mydata/index.js
Normal file
727
pages/mydata/index.js
Normal file
@@ -0,0 +1,727 @@
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
var areas = null;
|
||||
var CompanyCert=null;
|
||||
var CompanyPic=null;
|
||||
var UserPic=null;
|
||||
var BMap = null;
|
||||
var bmap=null;
|
||||
Page( {
|
||||
data: {
|
||||
loadingHidden:false,
|
||||
utype:0,
|
||||
contact:"",
|
||||
sfz:"",
|
||||
ncname:"",
|
||||
CompanyName:"",
|
||||
addpic0:"",
|
||||
addpic:"",
|
||||
addpic1:"",
|
||||
CompanyNumber:"",
|
||||
address:"",
|
||||
selectHidden:true,
|
||||
sectionHidden:true,
|
||||
IFDefault:1,
|
||||
Provinces:[],
|
||||
Citys:[],
|
||||
Countys:[],
|
||||
hx_index:-1,
|
||||
hx_index0:-1,
|
||||
hx_index1:-1,
|
||||
mapmsg:"",
|
||||
area:"",
|
||||
usernameHidden:true,
|
||||
sectionHidden0:true,
|
||||
savebutton:"保存",
|
||||
username:"",
|
||||
longitude: null,//经度
|
||||
latitude: null,//纬度
|
||||
clongitude: null,//经度
|
||||
clatitude: null,//纬度
|
||||
markers: [{ //标记点用于在地图上显示标记的位置
|
||||
id: 1,
|
||||
latitude: null,
|
||||
longitude: null,
|
||||
iconPath: '../../images/position-picker2.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
umoney:0.00,
|
||||
umoney0:0.00,
|
||||
}],
|
||||
},
|
||||
|
||||
onLoad: function() {
|
||||
that = this
|
||||
areas = require('../../area.js');
|
||||
that.setData({
|
||||
Provinces:areas.areaslist
|
||||
})
|
||||
that.rdata()
|
||||
},rdata: function() {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var userInfodata = wx.getStorageSync("userInfo")
|
||||
var userInfo = JSON.parse(userInfodata)
|
||||
that.setData({
|
||||
umoney:userInfo.xjjye,
|
||||
umoney0:userInfo.jdye
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getuserinfo",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
var utype=res.data.user.utype
|
||||
|
||||
var username=res.data.user.username
|
||||
var contact=res.data.user.realname
|
||||
var ncname=res.data.user.ncname
|
||||
var sfz=res.data.user.sfz
|
||||
var addpic1=res.data.user.avatar
|
||||
UserPic=res.data.user.yavatar
|
||||
var CompanyName=res.data.user.CompanyName
|
||||
var CompanyNumber=res.data.user.CompanyNumber
|
||||
CompanyCert=res.data.user.yCompanyCert
|
||||
CompanyPic=res.data.user.yCompanyPic
|
||||
var addpic=res.data.user.CompanyCert
|
||||
var addpic0=res.data.user.CompanyPic
|
||||
var Province=res.data.user.Province
|
||||
var City=res.data.user.City
|
||||
var County=res.data.user.County
|
||||
var address=res.data.user.address
|
||||
var latitude=res.data.user.latitude
|
||||
var longitude=res.data.user.longitude
|
||||
var index=-1
|
||||
var index0=-1
|
||||
var index1=-1
|
||||
|
||||
var provinces=that.data.Provinces
|
||||
|
||||
for(var i=0;i<provinces.length;i++){
|
||||
if(provinces[i].ProvinceID==Province){
|
||||
index=i;
|
||||
var citys=provinces[i].City;
|
||||
for(var j=0;j<citys.length;j++){
|
||||
if(citys[j].CityID==City){
|
||||
index0=j;
|
||||
var countys=citys[j].County;
|
||||
for(var k=0;k<countys.length;k++){
|
||||
if(countys[k].CountyID==County){
|
||||
index1=k;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
that.setData({
|
||||
hx_index: index
|
||||
})
|
||||
var citys=(index==-1?[]:that.data.Provinces[index].City)
|
||||
that.setData({
|
||||
Citys:citys,
|
||||
hx_index0: index0
|
||||
})
|
||||
var countys=(index0==-1?[]:that.data.Citys[index0].County)
|
||||
that.setData({
|
||||
Countys:countys,
|
||||
hx_index1: index1
|
||||
})
|
||||
var ProvinceName=(!that.data.Provinces[that.data.hx_index]?"":that.data.Provinces[that.data.hx_index].ProvinceName);
|
||||
var CityName=(!that.data.Citys[that.data.hx_index0]?"":that.data.Citys[that.data.hx_index0].CityName)
|
||||
var CountyName=(!that.data.Countys[that.data.hx_index1]?"":that.data.Countys[that.data.hx_index1].CountyName)
|
||||
|
||||
var area=ProvinceName+CityName+CountyName
|
||||
|
||||
that.setData({
|
||||
utype:utype,
|
||||
contact:contact,
|
||||
ncname:ncname,
|
||||
sfz:sfz,
|
||||
CompanyName:CompanyName,
|
||||
CompanyNumber:CompanyNumber,
|
||||
addpic:addpic,
|
||||
addpic0:addpic0,
|
||||
addpic1:addpic1,
|
||||
area:area,
|
||||
address:address,
|
||||
latitude:latitude,
|
||||
longitude:longitude,
|
||||
mapmsg:"您已标注",
|
||||
username:username,
|
||||
loadingHidden:true
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},onarea:function(e) {
|
||||
that.setData({
|
||||
sectionHidden:false
|
||||
})
|
||||
},ProvinceChange:function(e) {
|
||||
var index=e.detail.value;
|
||||
var citys=that.data.Provinces[index].City
|
||||
that.setData({
|
||||
hx_index: index,
|
||||
hx_index0: -1,
|
||||
hx_index1: -1,
|
||||
Citys:citys
|
||||
})
|
||||
if(citys.length==0){
|
||||
that.setData({
|
||||
sectionHidden:true,
|
||||
area:that.data.Provinces[that.data.hx_index].ProvinceName
|
||||
})
|
||||
}
|
||||
},CityChange:function(e) {
|
||||
var index=e.detail.value
|
||||
var countys=that.data.Citys[index].County
|
||||
that.setData({
|
||||
hx_index0: index,
|
||||
hx_index1: -1,
|
||||
Countys:countys
|
||||
})
|
||||
if(countys.length==0){
|
||||
that.setData({
|
||||
sectionHidden:true,
|
||||
area:that.data.Provinces[that.data.hx_index].ProvinceName+that.data.Citys[that.data.hx_index0].CityName
|
||||
})
|
||||
}
|
||||
},CountyChange:function(e) {
|
||||
that.setData({
|
||||
hx_index1: e.detail.value
|
||||
})
|
||||
that.setData({
|
||||
sectionHidden:true,
|
||||
area:that.data.Provinces[that.data.hx_index].ProvinceName+that.data.Citys[that.data.hx_index0].CityName+that.data.Countys[that.data.hx_index1].CountyName
|
||||
})
|
||||
},closesection:function(e) {
|
||||
that.setData({
|
||||
sectionHidden:true
|
||||
})
|
||||
},closesection0:function(e) {
|
||||
that.setData({
|
||||
sectionHidden0:true
|
||||
})
|
||||
},insection:function(e) {
|
||||
|
||||
},saveaddress:function(e) {
|
||||
var username = ""
|
||||
var contact = e.detail.value.contact.replace(/\s+/g, "");
|
||||
var ncname="";
|
||||
var Province=(that.data.hx_index==-1?"":that.data.Provinces[that.data.hx_index].ProvinceID)
|
||||
var City=(that.data.hx_index0==-1?"":that.data.Citys[that.data.hx_index0].CityID)
|
||||
var County=(that.data.hx_index1==-1?"":that.data.Countys[that.data.hx_index1].CountyID)
|
||||
var sfz="";
|
||||
var address="";
|
||||
var CompanyName="";
|
||||
var CompanyNumber="";
|
||||
var Companylatitude="";
|
||||
var Companylongitude="";
|
||||
if(that.data.utype>0){
|
||||
CompanyName = e.detail.value.CompanyName.replace(/\s+/g, "");
|
||||
CompanyNumber =e.detail.value.CompanyNumber.replace(/\s+/g, "");
|
||||
|
||||
Companylatitude=that.data.latitude;
|
||||
Companylongitude=that.data.longitude;
|
||||
address=e.detail.value.address.replace(/\s+/g, "");
|
||||
}else{
|
||||
ncname=e.detail.value.ncname.replace(/\s+/g, "");
|
||||
sfz=e.detail.value.sfz.replace(/\s+/g, "");
|
||||
address=e.detail.value.address.replace(/\s+/g, "");
|
||||
}
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var b=true
|
||||
if(b){
|
||||
if(contact==null || contact==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "姓名不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if(that.data.utype>0){
|
||||
if(b){
|
||||
if(CompanyName==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: (that.data.index==1?"商家":"企业") + "名称不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(CompanyPic==null){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "预览图片未上传!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(CompanyNumber==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: (that.data.index==1?"证件号码":"信用代码(营业执照号") + "不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(CompanyCert==null){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: (that.data.index==1?"证件":"营业执照") + "未上传!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(b){
|
||||
if(that.data.hx_index==-1){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "省份必须选择!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(that.data.hx_index0==-1){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "城市必须选择!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if(that.data.utype>0){
|
||||
if(b){
|
||||
if(address==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "详细地址不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(Companylatitude==""||Companylongitude==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "未标注地图!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
that.setData({
|
||||
savebutton:"请稍候..."
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"updateUserInfo2",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
contact:contact,
|
||||
ncname:ncname,
|
||||
UserPic:UserPic,
|
||||
sfz:sfz,
|
||||
CompanyName:CompanyName,
|
||||
CompanyNumber:CompanyNumber,
|
||||
CompanyCert:CompanyCert,
|
||||
CompanyPic:CompanyPic,
|
||||
Province:Province,
|
||||
City:City,
|
||||
County:County,
|
||||
address:address,
|
||||
Companylatitude:Companylatitude,
|
||||
Companylongitude:Companylongitude
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
wx.showModal({
|
||||
title: "操作提示",
|
||||
content: res.data.msg,
|
||||
showCancel:false,
|
||||
success (res0) {
|
||||
if (res0.confirm) {
|
||||
wx.setStorageSync('userInfo', JSON.stringify(res.data.userInfo))
|
||||
app.globalData.IFRefreshmy=1
|
||||
wx.navigateBack({})
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
that.setData({
|
||||
savebutton:"保存"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},onaddpic:function(e) {
|
||||
if(that.data.addpic=="../../images/ajaxLoader.gif"){
|
||||
wx.showToast({
|
||||
title: "正在上传中...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
|
||||
that.setData({
|
||||
addpic:"../../images/ajaxLoader.gif"
|
||||
})
|
||||
wx.uploadFile({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx", //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'image',
|
||||
formData: {
|
||||
action:"uploadtempImage"
|
||||
},
|
||||
fail: function(err) {
|
||||
wx.showToast({
|
||||
title: "上传出错了",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
addpic:"../../images/add.png"
|
||||
})
|
||||
},
|
||||
success (res0){
|
||||
var data=JSON.parse(res0.data);
|
||||
|
||||
|
||||
if(data.status==1){
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "success",
|
||||
duration: 1000
|
||||
})
|
||||
CompanyCert=data.pic;
|
||||
that.setData({
|
||||
addpic:data.url
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
addpic:"../../images/add.png"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},onaddpic0:function(e) {
|
||||
if(that.data.addpic0=="../../images/ajaxLoader.gif"){
|
||||
wx.showToast({
|
||||
title: "正在上传中...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
|
||||
that.setData({
|
||||
addpic0:"../../images/ajaxLoader.gif"
|
||||
})
|
||||
wx.uploadFile({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx", //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'image',
|
||||
formData: {
|
||||
action:"uploadtempImage"
|
||||
},
|
||||
success (res0){
|
||||
var data=JSON.parse(res0.data);
|
||||
|
||||
|
||||
if(data.status==1){
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "success",
|
||||
duration: 1000
|
||||
})
|
||||
CompanyPic=data.pic;
|
||||
that.setData({
|
||||
addpic0:data.url
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
addpic0:"../../images/add.png"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},onaddpic1:function(e) {
|
||||
if(that.data.addpic1=="../../images/ajaxLoader.gif"){
|
||||
wx.showToast({
|
||||
title: "正在上传中...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
that.setData({
|
||||
addpic1:"../../images/ajaxLoader.gif"
|
||||
})
|
||||
wx.uploadFile({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx", //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'image',
|
||||
formData: {
|
||||
action:"uploadtempImage",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
success (res0){
|
||||
var data=JSON.parse(res0.data);
|
||||
|
||||
|
||||
if(data.status==1){
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "success",
|
||||
duration: 1000
|
||||
})
|
||||
UserPic=data.pic;
|
||||
that.setData({
|
||||
addpic1:data.url
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
addpic1:"../../images/add.png"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},getaddressValue:function(e) {
|
||||
that.setData({
|
||||
Companyaddress:e.detail.value
|
||||
})
|
||||
},maptap(e){
|
||||
if(e.detail){
|
||||
var str = 'markers[0].longitude', str2 = 'markers[0].latitude';
|
||||
that.setData({
|
||||
latitude: e.detail.latitude,
|
||||
longitude: e.detail.longitude,
|
||||
[str]: e.detail.longitude,
|
||||
[str2]: e.detail.latitude,
|
||||
});
|
||||
}
|
||||
},my_location(e) {
|
||||
//微信API定位,获取当前位置经纬度
|
||||
|
||||
},markertap(e) {
|
||||
},regionchange(e){
|
||||
if (e.type == 'end' && (e.causedBy == 'scale' || e.causedBy == 'drag')) {
|
||||
that.bmap.getCenterLocation({
|
||||
success: function (res) {
|
||||
latitude = res.latitude;
|
||||
longitude = res.longitude;
|
||||
var str = 'markers[0].longitude', str2 = 'markers[0].latitude';
|
||||
that.setData({
|
||||
longitude: res.longitude,
|
||||
latitude: res.latitude,
|
||||
clongitude: res.longitude,
|
||||
clatitude: res.latitude,
|
||||
[str]: res.longitude,
|
||||
[str2]: res.latitude,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
,onmap:function() {
|
||||
|
||||
|
||||
|
||||
if(that.data.latitude&&that.data.longitude){
|
||||
that.setData({
|
||||
sectionHidden0:false
|
||||
})
|
||||
that.mapCtx = wx.createMapContext('myMap')
|
||||
// 实例化百度地图API核心类
|
||||
bmap = new BMap.BMapWX({
|
||||
ak: 'HiMGaFNdmB2VSvWSkPogESxBDaLQkOuq'
|
||||
})
|
||||
var str = 'markers[0].longitude', str2 = 'markers[0].latitude';
|
||||
that.setData({
|
||||
clatitude: that.data.latitude,
|
||||
clongitude: that.data.longitude,
|
||||
[str]: that.data.longitude,
|
||||
[str2]: that.data.latitude,
|
||||
});
|
||||
|
||||
}else{
|
||||
if (that.data.hx_index!=-1 && that.data.hx_index0!=-1 && that.data.hx_index1!=-1 && that.data.Companyaddress!="") {
|
||||
that.setData({
|
||||
sectionHidden0:false
|
||||
})
|
||||
that.mapCtx = wx.createMapContext('myMap')
|
||||
// 实例化百度地图API核心类
|
||||
bmap = new BMap.BMapWX({
|
||||
ak: 'HiMGaFNdmB2VSvWSkPogESxBDaLQkOuq'
|
||||
})
|
||||
var fail = function(data) {
|
||||
console.log(data)
|
||||
};
|
||||
var success = function(data) {
|
||||
var wxMarkerData = data.wxMarkerData;
|
||||
var str = 'markers[0].longitude', str2 = 'markers[0].latitude';
|
||||
that.setData({
|
||||
latitude: wxMarkerData[0].latitude,
|
||||
longitude: wxMarkerData[0].longitude,
|
||||
clatitude: wxMarkerData[0].latitude,
|
||||
clongitude: wxMarkerData[0].longitude,
|
||||
[str]: wxMarkerData[0].longitude,
|
||||
[str2]: wxMarkerData[0].latitude,
|
||||
});
|
||||
}
|
||||
// 发起geocoding检索请求
|
||||
var area = "";
|
||||
if(that.data.Provinces[that.data.hx_index]){
|
||||
area = that.data.Provinces[that.data.hx_index].ProvinceName;
|
||||
}
|
||||
if(that.data.Citys[that.data.hx_index0]){
|
||||
area += that.data.Citys[that.data.hx_index0].CityName;
|
||||
}
|
||||
if(that.data.Countys[that.data.hx_index1]){
|
||||
area += that.data.Countys[that.data.hx_index1].CountyName;
|
||||
}
|
||||
bmap.geocoding({
|
||||
address: area+that.data.Companyaddress,
|
||||
fail: fail,
|
||||
success: success
|
||||
});
|
||||
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: "请先选择区域和填写地址!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
},onupdated: function(e) {
|
||||
that.setData({
|
||||
loadingHidden:true
|
||||
})
|
||||
},qcbz:function(e) {
|
||||
var str = 'markers[0].longitude', str2 = 'markers[0].latitude';
|
||||
that.setData({
|
||||
latitude:null,
|
||||
latitude:null,
|
||||
clatitude:null,
|
||||
clatitude:null,
|
||||
[str]: null,
|
||||
[str2]: null,
|
||||
sectionHidden0:true,
|
||||
mapmsg:""
|
||||
})
|
||||
},qybz:function(e) {
|
||||
if(that.data.latitude&&that.data.longitude){
|
||||
that.setData({
|
||||
sectionHidden0:true,
|
||||
mapmsg:"已标注"
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: "请点击地图标注!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
3
pages/mydata/index.json
Normal file
3
pages/mydata/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "会员资料"
|
||||
}
|
||||
136
pages/mydata/index.wxml
Normal file
136
pages/mydata/index.wxml
Normal file
@@ -0,0 +1,136 @@
|
||||
<view class="container">
|
||||
|
||||
<view class="mydata-box">
|
||||
|
||||
<view class="frombody">
|
||||
<form bindsubmit='saveaddress'>
|
||||
<view>
|
||||
<text>您的账号:</text><input name="username" type="text" placeholder="请填写您的用户名" value="{{username}}" disabled="disabled" style="width:8em;" /><text style="float:right; color:#ff0000;">不可更改</text>
|
||||
</view>
|
||||
<view wx:if="{{umoney>0||umoney0>0}}">
|
||||
<text>您的姓名:</text><input name="contact" type="text" placeholder="请填写您的姓名" value="{{contact}} "disabled="disabled" style="width:8em;" /><text style="float:right; color:#ff0000;">不可更改</text>
|
||||
</view>
|
||||
<view wx:if="{{utype==0}}">
|
||||
<text style="width:8em;">头像图片:</text>
|
||||
<view class="pic_box">
|
||||
<image src="{{addpic1}}" bindtap="onaddpic1"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{utype==0}}">
|
||||
<text>您的昵称:</text><input name="ncname" type="text" placeholder="请填写昵称" value="{{ncname}}" />
|
||||
</view>
|
||||
<view wx:if="{{utype==0}}" wx:if="{{umoney>0||umoney0>0}}">
|
||||
<text>身份证号码:</text><input name="sfz" type="text" placeholder="请填写您的身份证号码" value="{{sfz}}" />
|
||||
</view>
|
||||
<view wx:if="{{utype>0}}">
|
||||
<text>{{utype==1?"商家":"企业"}}名称:</text><input name="CompanyName" type="text" placeholder='请填写{{utype==1?"商家":"企业"}}名称' value="{{CompanyName}}" />
|
||||
</view>
|
||||
<view wx:if="{{utype>0}}">
|
||||
<text style="width:8em;">上传预览图片:</text>
|
||||
<view class="pic_box">
|
||||
<image src="{{addpic0}}" bindtap="onaddpic0"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{utype>0}}">
|
||||
<text>{{utype==1?"证件号码":"营业执照"}}:</text><input name="CompanyNumber" type="text"
|
||||
placeholder='请填写{{utype==1?"证件号码":"信用代码(营业执照号)"}}' value="{{CompanyNumber}}" />
|
||||
</view>
|
||||
<view wx:if="{{utype>0}}">
|
||||
<text style="width:8em;">上传{{utype==1?"证件图片":"营业执照"}}:</text>
|
||||
<view class="pic_box">
|
||||
<image src="{{addpic}}" bindtap="onaddpic"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="area" wx:if="{{umoney>0||umoney0>0}}">
|
||||
<text>所在地区:</text>
|
||||
<view class="area_box" bindtap="onarea">
|
||||
<input name="area" type="text" disabled="disabled" placeholder="请选择地区" value="{{area}}"/><image src="../../images/icon-arrowdown.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{umoney>0||umoney0>0}}">
|
||||
<text>详细地址:</text><input name="address" type="text" placeholder="请填写您的详细地址" value="{{address}}" />
|
||||
</view>
|
||||
<view class="area" wx:if="{{utype>0}}">
|
||||
<text>标注地图:</text>
|
||||
<view class="area_box" bindtap="onmap">
|
||||
<input name="map" type="text" disabled="disabled" placeholder="请标注地图" value="{{mapmsg}}"/><image src="../../images/icon-arrowdown.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="button" wx:if="{{umoney>0||umoney0>0}}">
|
||||
<button form-type="submit">{{savebutton}}</button>
|
||||
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="Hidden_box" hidden="{{sectionHidden}}" bindtap="closesection">
|
||||
<view class="section" catchtap="insection">
|
||||
<view class="section-title">省市区选择器</view>
|
||||
<view class="close" bindtap="closesection"><image src="../../images/close.png" /></view>
|
||||
<view class="section-body">
|
||||
<view>
|
||||
<text>省份:</text>
|
||||
<picker class="picker_hx" name="picker_hx" value="{{Provinces[hx_index].ProvinceID}}" data-selecthx="{{Provinces[hx_index].ProvinceName}}" range="{{Provinces}}" range-key="{{'ProvinceName'}}" bindchange="ProvinceChange">
|
||||
<view class="picker">
|
||||
<text hidden='{{Provinces[hx_index].ProvinceName==null}}'>{{Provinces[hx_index].ProvinceName}}</text>
|
||||
<text hidden='{{Provinces[hx_index].ProvinceName!=null}}'>==请选择==</text>
|
||||
<image src="../../images/icon-arrowdown1.png"></image>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<text>城市:</text>
|
||||
<picker class="picker_hx" name="picker_hx" value="{{Citys[hx_index0].CityID}}" data-selecthx="{{Citys[hx_index0].CityName}}" range="{{Citys}}" range-key="{{'CityName'}}" bindchange="CityChange">
|
||||
<view class="picker">
|
||||
<text hidden='{{Citys[hx_index0].CityName==null}}'>{{Citys[hx_index0].CityName}}</text>
|
||||
<text hidden='{{Citys[hx_index0].CityName!=null}}'>==请选择==</text>
|
||||
<image src="../../images/icon-arrowdown1.png"></image>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
</view>
|
||||
<view>
|
||||
<text>县区:</text>
|
||||
<picker class="picker_hx" name="picker_hx" value="{{Countys[hx_index1].CountyID}}" data-selecthx="{{Countys[hx_index1].CountyName}}" range="{{Countys}}" range-key="{{'CountyName'}}" bindchange="CountyChange">
|
||||
<view class="picker">
|
||||
<text hidden='{{Countys[hx_index1].CountyName==null}}'>{{Countys[hx_index1].CountyName}}</text>
|
||||
<text hidden='{{Countys[hx_index1].CountyName!=null}}'>==请选择==</text>
|
||||
<image src="../../images/icon-arrowdown1.png"></image>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="Hidden_box" hidden="{{sectionHidden0}}" bindtap="closesection0">
|
||||
<view class="section" catchtap="insection" style="width:100%">
|
||||
<view class="section-title">点击地图标注位置</view>
|
||||
<view class="close" bindtap="closesection0"><image src="../../images/close.png" /></view>
|
||||
<view class="section-body">
|
||||
<view class="map_container">
|
||||
<map class="map" id="myMap" longitude="{{clongitude}}" latitude="{{clatitude}}" scale="16" show-location="true" markers="{{markers}}" bindtap="maptap" bindupdated="onupdated">
|
||||
<cover-image class="cover-image" bindtap="my_location" src="../../images/my_location.png" />
|
||||
<!--<cover-view class='mapPic'>
|
||||
<cover-image src='/images/position-picker2.png'></cover-image>
|
||||
</cover-view>
|
||||
<cover-view class="map-prompt">您可拖动地图, 标记准确位置</cover-view>
|
||||
-->
|
||||
</map>
|
||||
</view>
|
||||
<view class="button">
|
||||
<button bindtap="qcbz">清除标注</button><button bindtap="qybz">标注好了</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<loading hidden="{{loadingHidden}}">
|
||||
加载中...
|
||||
</loading>
|
||||
57
pages/mydata/index.wxss
Normal file
57
pages/mydata/index.wxss
Normal file
@@ -0,0 +1,57 @@
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
}
|
||||
.mydata-box{display: flex;flex-direction: column;align-items: center;justify-content: center;width:100%; padding: 0 0.8em; box-sizing: border-box;}
|
||||
|
||||
.mydata-box .frombody{margin-top: 1em; padding:0.8em;width:100%; display: flex;border-radius:0.5em; flex-direction: column; align-items: center; background-color:#fff;box-sizing: border-box;}
|
||||
.mydata-box .frombody view{position: relative;float:left; width:100%;display: flex;flex-direction:row;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box;}
|
||||
.mydata-box .frombody view text{padding:0;height:2.5em; line-height: 2.5em;}
|
||||
.mydata-box .frombody view input{width:14em;height:2.5em; line-height: 2.5em;}
|
||||
.mydata-box .frombody view.area input{width:12.8em;}
|
||||
.mydata-box .frombody view.area image{position: absolute; top:1.1em; right:0; width:1.2em;height:1.2em;}
|
||||
.mydata-box .frombody view.area text{width:8em;}
|
||||
.mydata-box .frombody view.area view.area_box{ display: flex;padding:0;border:0;flex-grow: 1;}
|
||||
.mydata-box .frombody view.area view.area_box input{width:100%;}
|
||||
.mydata-box .frombody view.area view.area_box image{position: absolute; top:0.7em; right:0; width:1.2em;height:1.2em;}
|
||||
.mydata-box .frombody view view.pic_box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:3em;
|
||||
height:3em;
|
||||
border:1px solid #f1f1f1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mydata-box .frombody view view.pic_box image{
|
||||
border:0; width:100%;height:100%;
|
||||
}
|
||||
|
||||
.mydata-box .frombody view.button{border: 0;}
|
||||
.mydata-box .frombody view.button button{width:100%;height:2.5em; line-height: 2.5em; background:linear-gradient(to right,#00B050,#00B050); color:#fff; border-radius:0.5em;}
|
||||
.Hidden_box{ position: fixed;display: flex;align-items: center; justify-content: center; top:0; left:0; width:100%;height:100vh; background:rgba(0, 0, 0, 0.5);z-index: 2;}
|
||||
.section{position: relative; bottom:0; width:96%; padding: 0 0.5em; background-color: #fff; box-sizing: border-box; border-radius:0.5em;}
|
||||
.section .close{position: absolute; right:0.5em; top:0.5em; width:1.5em; height:1.5em; padding:0.15em; background-color:#fff;border:1px solid #f1f1f1;border-radius:50%;box-sizing:border-box;}
|
||||
.section .close image{width:100%;height:100%;}
|
||||
.section-title{width:100%;height:2.5em; line-height: 2.5em; text-align: center; font-weight: 600;border-bottom:1px solid #f1f1f1;}
|
||||
.section-body{width:100%;}
|
||||
.section-body view{width:100%;display: flex;flex-direction: row; align-items: center;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box; line-height:1.5em;}
|
||||
.section-body view text{color:#000;}
|
||||
.section-body view .picker_hx{color:#939393;line-height:2.5em;}
|
||||
.section-body view .picker_hx view{ float:left; position: relative; display: block; border:0;min-width:10em; padding-left:1em; box-sizing: border-box;border:1px solid #dfdfdf;border-radius:0.3em;line-height:2em;}
|
||||
.section-body view .picker_hx image{position: absolute; top:1em;right:0.6em; width:1.2em;height:1.2em;}
|
||||
|
||||
|
||||
.map_container{width:100%;}
|
||||
.map_container .map{width:100%; height:70vh;}
|
||||
.map_container .map .mapPic{width:3em; height:3em;}
|
||||
.map_container .map .mapPic cover-image{width:3em; height:3em;}
|
||||
.map_container .map .map-prompt{width:100%; height:2.5em;}
|
||||
.map_container .map .cover-image{position: absolute; bottom:0.5em; right:0.5em; width:3em; height:3em; background-color: #fff;border-radius:50%;}
|
||||
Reference in New Issue
Block a user