浏览代码

页面功能完善一部分

guessPrice
sui 5 年前
父节点
当前提交
ec8fe9f5cb
共有 7 个文件被更改,包括 427 次插入51 次删除
  1. +5
    -5
      496_dongfengqichen/app.js
  2. +140
    -13
      496_dongfengqichen/pages/index/index.js
  3. +15
    -12
      496_dongfengqichen/pages/index/index.wxml
  4. +18
    -0
      496_dongfengqichen/pages/index/index.wxss
  5. +124
    -3
      496_dongfengqichen/pages/myCenter/myCenter.js
  6. +39
    -15
      496_dongfengqichen/pages/myCenter/myCenter.wxml
  7. +86
    -3
      496_dongfengqichen/pages/myCenter/myCenter.wxss

+ 5
- 5
496_dongfengqichen/app.js 查看文件

@@ -91,11 +91,11 @@ App({
"OPENID": this.globalData.openid
},
success: function (re) {
if (re.data.code == -1002) {
wx.removeStorageSync('openid');
that.wxLogin();
// that.wxRequest(url, params, callback, thisArg, methods, openid);
}
// if (re.data.code == -1002) {
// wx.removeStorageSync('openid');
// that.wxLogin();
// // that.wxRequest(url, params, callback, thisArg, methods, openid);
// }
if (callback && thisArg) {
callback.call(thisArg, re.data);
}

+ 140
- 13
496_dongfengqichen/pages/index/index.js 查看文件

@@ -6,11 +6,21 @@ Page({
imgUrl: app.globalData.urlStatic,//图片路径
phoneInputShow:false,//是否显示电话输入框
siteSelect: false,//是否显示位置选择框
provinceArr:['广东','上海','河南','河北'],//省
provinceArr:[],//省
provinceValue: 0,//选中的省下标
storeArr:['百联超市','全家','喜士多'],//店铺
storeArr:[],//店铺
storeValue:0,//选中的店铺下标
swiperCurrent:1,//swiper选中的元素下标
verificationCode: '获取验证码',//验证码文案
sendCode: true,
subscribeData:{
realname:"",//姓名
mobile:"",//手机号
captcha:"",//验证码
province:"",//省份
agentDetail: "",//经销商详细信息
parentOpenid: "",//好友openid
}
},
onLoad: function () {
this.getUserLocation();//获取用户当前位置
@@ -18,32 +28,54 @@ Page({
provinceChane: function (e) {//选中省
this.setData({
provinceValue: e.detail.value,
storeArr: this.data.provinceArr[e.detail.value].children,
storeValue:0
})
this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
},
storeChane: function (e) {//选中店铺
this.setData({
storeValue: e.detail.value,
})
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
},
getUserPhone:function(e){//获取用户手机号
console.log(e);
this.setData({
phoneInputShow: true,
phoneInputShow: true
})
if (e.detail.errMsg=='getPhoneNumber:ok'){
console.log('获取到了手机号');
this.setData({
siteSelect: true,
})
app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
if (res.code == 200) {
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
this.setData({
subscribeData: this.data.subscribeData
})
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this,"POST");
}else{
this.setData({
siteSelect: true,
})
}
},
getUserLocation:function(e){
wx.getLocation({
type: 'gcj02', //wgs84
success(res) {
if (res) {
console.log(res);
// this.setData({
// siteSelect: true,
// })
}
success:(res)=>{
// console.log(res);
this.getDistributorList(res.longitude, res.latitude);
},
fail:(res)=>{
this.getDistributorList("", "");
}
})
},
@@ -67,5 +99,100 @@ Page({
swiperCurrent: e.detail.current,
})
}
}
},
getDistributorList: function (longitude, latitude){//获取经销商列表
app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude}, res => {
if (res.code == 200) {
this.setData({
provinceArr: res.data.list,
storeArr: res.data.list[res.data.nearData.provinceIndex].children,
provinceValue: res.data.nearData.provinceIndex,
storeValue: res.data.nearData.cityIndex
})
this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this);
},
getCode: function (e) {//获取验证码
if (!app.mobileVerify(this.data.subscribeData.mobile)) {
if (this.data.subscribeData.mobile){
wx.showToast({
title: '请输入正确的电话',
icon: 'none'
})
}else{
wx.showToast({
title: '请输入电话',
icon: 'none'
})
}
return;
}
if (!this.data.sendCode){
return;
}
app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", { mobile:'18831849567'},res=>{
console.log(res);
if (res.code == 200) {
this.countDown();
wx.showToast({
title: '验证码获取成功',
icon: "none"
})
this.setData({
verificationCode:60
})
this.data.sendCode = false;
}else{
wx.showToast({
title: res.msg,
icon: "none"
})
}
},this)
},
countDown: function () {//倒计时
setTimeout(() => {
this.setData({
verificationCode: this.data.verificationCode - 1
})
if (this.data.verificationCode > 0) {
this.countDown();
} else {
this.setData({
verificationCode: "获取验证码"
})
this.data.sendCode = true;
}
}, 1000);
},
getRealname: function (e) {//获取用户输入的姓名
this.data.subscribeData.realname = e.detail.value;
},
getMobile: function (e) {//获取用户输入的电话
this.data.subscribeData.mobile = e.detail.value;
},
getCaptcha: function (e) {//获取用户输入的验证码
this.data.subscribeData.captcha = e.detail.value;
},
subscribeFun: function (e) {//预约鉴赏
console.log(this.data.subscribeData);
app.wxRequest(app.globalData.urlRoot + "userInfo/submitOrderInfo", this.data.subscribeData, res => {
console.log(res);
if (res.code == 200) {
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this, "POST")
},
})

+ 15
- 12
496_dongfengqichen/pages/index/index.wxml 查看文件

@@ -2,8 +2,7 @@
<view class="all">
<view class="main container">
<view class="contentFrame">
<video class="videoSty" ad-unit-id="" poster-for-crawler="" src=""></video>
<!-- <video class="videoSty" ad-unit-id="" poster-for-crawler="" src="{{imgUrl+'/video1212.mp4'}}"></video> -->
<video class="videoSty" src="https://www.jiyou-tech.com/2020/496_qichen/static/video1212.mp4"></video>
<view class="swiperFrame">
<swiper class="swiperSty" current="{{swiperCurrent}}" bindchange="swiperChange">
<swiper-item><image src="{{imgUrl+'/images/indexBottom.png'}}" style="width:100%;" mode="aspectFill"></image></swiper-item>
@@ -19,27 +18,31 @@
<!-- <image src="{{imgUrl+'/images/indexBg.jpg'}}" class='imgBg'></image> -->
<view class="msgFrame">
<view class="inputGroup">
<input class="inputSty" placeholder="姓名"></input>
<input class="inputSty" type="number" maxlength='11' placeholder="电话"></input>
<view class="getPhoneFrame" wx:if="{{!phoneInputShow}}">
<button class="getPhoneBtn" open-type="getPhoneNumber" bindgetphonenumber="getUserPhone"></button>
</view>
<input class="inputSty" placeholder="姓名" bindinput="getRealname"></input>
<input class="inputSty" bindinput="getMobile" type="number" value="{{subscribeData.mobile}}" maxlength='11' placeholder="电话"></input>
<view class="getPhoneFrame" wx:if="{{!phoneInputShow}}">
<button class="getPhoneBtn" open-type="getPhoneNumber" bindgetphonenumber="getUserPhone"></button>
</view>
</view>
<view class="codeGroup">
<input class="inputCode" bindinput="getCaptcha" placeholder="验证码"></input>
<view class="codeTime" bindtap="getCode">{{verificationCode}}</view>
</view>
<view wx:if="{{siteSelect}}">
<picker mode='selector' range="{{provinceArr}}" value="{{provinceValue}}" bindchange="provinceChane">
<picker mode='selector' range="{{provinceArr}}" range-key="province" value="{{provinceValue}}" bindchange="provinceChane">
<view class="selectGroup">
<text class="selectName">{{provinceArr[provinceValue]}}</text>
<text class="selectName">{{provinceArr[provinceValue].province}}</text>
<image src="{{imgUrl+'/images/selectIcon.png'}}" class="selectIcon"></image>
</view>
</picker>
<picker mode='selector' range="{{storeArr}}" value="{{storeValue}}" bindchange="storeChane">
<picker mode='selector' range="{{storeArr}}" range-key="agent_detail" value="{{storeValue}}" bindchange="storeChane">
<view class="selectGroup">
<text class="selectName">{{storeArr[storeValue]}}</text>
<text class="selectName">{{storeArr[storeValue].agent_detail}}</text>
<image src="{{imgUrl+'/images/selectIcon.png'}}" class="selectIcon"></image>
</view>
</picker>
</view>
<view class="subscribeBtn">预约鉴赏</view>
<view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏</view>
</view>
<service></service>
</view>

+ 18
- 0
496_dongfengqichen/pages/index/index.wxss 查看文件

@@ -122,4 +122,22 @@ page{
top:50%;
right: 23rpx;
transform: translateY(-50%);
}
.codeGroup{
width:672rpx;
height:55rpx;
background-color: white;
border-radius: 10rpx;
box-sizing: border-box;
line-height: 55rpx;
padding: 0 25rpx;
font-size: 20rpx;
margin-top: 18rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.inputCode{
height: 100%;
width: 500rpx;
}

+ 124
- 3
496_dongfengqichen/pages/myCenter/myCenter.js 查看文件

@@ -7,7 +7,7 @@ Page({
*/
data: {
imgUrl: app.globalData.urlStatic,//图片路径
isLogin:true,//登录状态
isLogin:false,//登录状态
selectNow:0,//现在的选项
taskNow:1,//现在的任务类型
recordNow: 1,//现在的记录类型
@@ -19,7 +19,21 @@ Page({
{ name: "双子星LED大灯", bar: 4 },
{ name: "双子星LED大灯", bar: 4 },
{ name: "双子星LED大灯", bar: 4 },
]
],
provinceArr: [],//省
provinceValue: 0,//选中的省下标
storeArr: [],//店铺
storeValue: 0,//选中的店铺下标
verificationCode: '获取验证码',//验证码文案
sendCode: true,
subscribeData: {
realname: "",//姓名
mobile: "",//手机号
captcha: "",//验证码
province: "",//省份
agentDetail: "",//经销商详细信息
parentOpenid: "",//好友openid
}
},

/**
@@ -33,7 +47,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.getUserLocation();
},

/**
@@ -92,4 +106,111 @@ Page({
recordNow: e.currentTarget.dataset.type
})
},
getUserLocation: function (e) {
wx.getLocation({
type: 'gcj02', //wgs84
success: (res) => {
this.getDistributorList(res.longitude, res.latitude);
},
fail: (res) => {
this.getDistributorList("", "");
}
})
},
getDistributorList: function (longitude, latitude) {//获取经销商列表
app.wxRequest(app.globalData.urlRoot + "agent/getAgentList", { longitude: longitude, latitude: latitude }, res => {
if (res.code == 200) {
this.setData({
provinceArr: res.data.list,
storeArr: res.data.list[res.data.nearData.provinceIndex].children,
provinceValue: res.data.nearData.provinceIndex,
storeValue: res.data.nearData.cityIndex
})
this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this);
},
provinceChane: function (e) {//选中省
this.setData({
provinceValue: e.detail.value,
storeArr: this.data.provinceArr[e.detail.value].children,
storeValue: 0
})
this.data.subscribeData.province = this.data.provinceArr[this.data.provinceValue].province;
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
},
storeChane: function (e) {//选中店铺
this.setData({
storeValue: e.detail.value,
})
this.data.subscribeData.agentDetail = this.data.storeArr[this.data.storeValue].agent_detail;
},
getCode: function (e) {//获取验证码
app.wxRequest(app.globalData.urlRoot + "captcha/sendCaptcha", { mobile: '18831849567' }, res => {
console.log(res);
if (res.code == 200) {
this.countDown();
wx.showToast({
title: '验证码获取成功',
icon: "none"
})
this.setData({
verificationCode: 60
})
this.data.sendCode = false;
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this)
},
countDown: function () {//倒计时
setTimeout(() => {
this.setData({
verificationCode: this.data.verificationCode - 1
})
if (this.data.verificationCode > 0) {
this.countDown();
} else {
this.setData({
verificationCode: "获取验证码"
})
this.data.sendCode = true;
}
}, 1000);
},
getRealname: function (e) {//获取用户输入的姓名
this.data.subscribeData.realname = e.detail.value;
},
getMobile: function (e) {//获取用户输入的电话
this.data.subscribeData.mobile = e.detail.value;
},
getCaptcha: function (e) {//获取用户输入的验证码
this.data.subscribeData.captcha = e.detail.value;
},
subscribeFun: function (e) {//预约鉴赏
console.log(this.data.subscribeData);
app.wxRequest(app.globalData.urlRoot + "userInfo/submitOrderInfo", this.data.subscribeData, res => {
console.log(res);
if (res.code == 200) {

} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this, "POST")
},
getUserWxMsg:function(e){//获取用户信息
console.log(e);
}
})

+ 39
- 15
496_dongfengqichen/pages/myCenter/myCenter.wxml 查看文件

@@ -6,7 +6,7 @@
<view class="headGroup">
<image class="defaultHead" src="{{imgUrl+'/images/defaultHead.png'}}"></image>
</view>
<view class="loginBtn">微信一键登录</view>
<view class="loginBtn">微信一键登录<button bindgetuserinfo="getUserWxMsg" class="getUserMsgBtn" open-type="getUserInfo" lang="zh_CN"></button></view>
</view>
<view class="userMsg" wx:if="{{isLogin}}">
<image class="userMsgBg" src="{{imgUrl+'/images/userMsgBg.png'}}"></image>
@@ -92,23 +92,25 @@
<view bindtap="selectRecord" data-type='2' class="taskText recordText {{recordNow==2?'taskText2':''}}">每日任务奖品</view>
<view bindtap="selectRecord" data-type='3' class="taskText recordText {{recordNow==3?'taskText2':''}}">幸运星抓手奖品</view>
</view>
<view class="recordGroup">
<view class="recordGroupLeft">
<view class="recordHeadGroup">
<image class="recordUserImg" src="{{imgUrl+'/images/defaultHead.png'}}"></image>
<view class="recordFrame">
<view class="recordGroup" wx:for="{{5}}">
<view class="recordGroupLeft">
<view class="recordHeadGroup">
<image class="recordUserImg" src="{{imgUrl+'/images/defaultHead.png'}}"></image>
</view>
<view class="recordMainGroup">
<view class="rewardName">头等舱机票一张</view>
<view class="rewardTerm">2020.04.05</view>
</view>
</view>
<view class="recordMainGroup">
<view class="rewardName">头等舱机票一张</view>
<view class="rewardTerm">2020.04.05</view>
<view class="recordPic">
<image class="recordTip" src="{{imgUrl+'/images/recordTip.png'}}"></image>
<image class="rewardIcon" src="{{imgUrl+'/images/jiangpin.png'}}"></image>
</view>
</view>
<view class="recordPic">
<image class="recordTip" src="{{imgUrl+'/images/recordTip.png'}}"></image>
<image class="rewardIcon" src="{{imgUrl+'/images/jiangpin.png'}}"></image>
</view>
</view>
</view>
<view wx:if="{{selectNow==3}}">
<view class="ranksGroup" wx:if="{{selectNow==3}}">
<view class="detachmentGroup">
<view class="detachmentGroupLeft">
<view class="recordHeadGroup">
@@ -140,8 +142,30 @@
<view class="ranksState ranksType3">推荐已购车</view>
</view>
</view>
<view wx:if="{{selectNow==4}}">
<view class="subscribeGroup" wx:if="{{selectNow==4}}">
<view class="inputGroup">
<input class="inputCode" bindinput="getCaptcha" placeholder="请输入您的姓名"></input>
</view>
<view class="inputGroup">
<input class="inputCode" bindinput="getCaptcha" placeholder="请输入您的联系电话"></input>
</view>
<view class="inputGroup">
<input class="inputCode" style="width:500rpx;" bindinput="getCaptcha" placeholder="请输入验证码"></input>
<view class="codeTime" bindtap="getCode">{{verificationCode}}</view>
</view>
<picker mode='selector' range="{{provinceArr}}" range-key="province" value="{{provinceValue}}" bindchange="provinceChane">
<view class="selectSiteGroup">
<text class="selectName">{{provinceArr[provinceValue].province}}</text>
<image src="{{imgUrl+'/images/selectIcon.png'}}" class="selectIcon"></image>
</view>
</picker>
<picker mode='selector' range="{{storeArr}}" range-key="agent_detail" value="{{storeValue}}" bindchange="storeChane">
<view class="selectSiteGroup">
<text class="selectName">{{storeArr[storeValue].agent_detail}}</text>
<image src="{{imgUrl+'/images/selectIcon.png'}}" class="selectIcon"></image>
</view>
</picker>
<view class="subscribeBtn" bindtap="subscribeFun">预约鉴赏</view>
</view>
<service></service>
</view>

+ 86
- 3
496_dongfengqichen/pages/myCenter/myCenter.wxss 查看文件

@@ -28,6 +28,7 @@ image{
height: 100%;
}
.loginBtn{
position: relative;
margin: 0 auto;
width:307rpx;
height:49rpx;
@@ -37,6 +38,7 @@ image{
font-size: 25rpx;
color: white;
line-height: 49rpx;
overflow: hidden;
}
.funList{
position: relative;
@@ -106,7 +108,6 @@ image{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 23rpx;
}
.taskText{
width:256rpx;
@@ -183,9 +184,12 @@ image{
display: flex;
}
.taskDetailFrame{
margin-top: 40rpx;
position: absolute;
left: 0;
bottom: 0;
top: 104rpx;
width: 750rpx;
height: 200rpx;
height: 485rpx;
overflow-y: auto;
}
.recordText{
@@ -350,4 +354,83 @@ image{
width: 0;
position: absolute;
top: 143rpx;
}
.inputGroup{
width:652rpx;
height:65rpx;
margin: 0 auto;
background-color: white;
border-radius: 10rpx;
box-sizing: border-box;
line-height: 65rpx;
padding: 0 25rpx;
font-size: 20rpx;
margin-top: 18rpx;
display: flex;
align-items: center;
justify-content: space-between;
border: 1rpx solid #B4B4B4;
}
.inputCode{
height: 100%;
width: 100%;
}
.selectSiteGroup{
border: 1rpx solid #B4B4B4;
margin: 0 auto;
width:652rpx;
height:65rpx;
background-color: white;
border-radius: 10rpx;
box-sizing: border-box;
line-height: 65rpx;
padding: 0 25rpx;
font-size: 20rpx;
margin-top: 18rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.selectIcon{
width: 25rpx;
height: 15rpx;
}
.subscribeBtn{
margin: 0 auto;
width:652rpx;
height:65rpx;
line-height: 65rpx;
text-align: center;
background-color: #005EFF;
color: white;
font-size: 29rpx;
margin-top: 18rpx;
border-radius: 10rpx;
}
.subscribeGroup{
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.taskGroup,.ranksGroup,.subscribeGroup{
height: 589rpx;
}
.taskGroup{
position: relative;
padding-top:23rpx;
}
.recordFrame{
margin-top: 23rpx;
height: 543rpx;
}
.getUserMsgBtn{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
margin: 0;
padding:0;
}

正在加载...
取消
保存