Procházet zdrojové kódy

新增地址管理页面

guessPrice
sui před 5 roky
rodič
revize
ffb5237a7c
11 změnil soubory, kde provedl 421 přidání a 22 odebrání
  1. +2
    -1
      496_dongfengqichen/app.json
  2. +227
    -0
      496_dongfengqichen/pages/address/address.js
  3. +6
    -0
      496_dongfengqichen/pages/address/address.json
  4. +30
    -0
      496_dongfengqichen/pages/address/address.wxml
  5. +84
    -0
      496_dongfengqichen/pages/address/address.wxss
  6. +1
    -1
      496_dongfengqichen/pages/index/index.js
  7. +53
    -16
      496_dongfengqichen/pages/luckyStar/luckyStar.js
  8. +3
    -1
      496_dongfengqichen/pages/luckyStar/luckyStar.wxml
  9. +7
    -1
      496_dongfengqichen/pages/myCenter/myCenter.js
  10. +1
    -1
      496_dongfengqichen/pages/myCenter/myCenter.wxml
  11. +7
    -1
      496_dongfengqichen/project.config.json

+ 2
- 1
496_dongfengqichen/app.json Zobrazit soubor

@@ -11,7 +11,8 @@
"pages/prizes/prizes",
"pages/poster/poster",
"pages/coupon/coupon",
"pages/receiveRegister/receiveRegister"
"pages/receiveRegister/receiveRegister",
"pages/address/address"
],
"window": {
"backgroundTextStyle": "light",

+ 227
- 0
496_dongfengqichen/pages/address/address.js Zobrazit soubor

@@ -0,0 +1,227 @@
// pages/address/address.js
const app = getApp()
Page({

/**
* 页面的初始数据
*/
data: {
imgUrl: app.globalData.urlStatic,//图片路径
submitData:{
realName:"",
mobile: "",//电话
province: "",//省份
city: "",//城市
district: "",//地区
addressDetail:""//详细
},
isAddress: false,//是否有地址
phoneInputShow: false,//是否显示电话输入框
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
app.globalData.nowPage = 4;
if (app.globalData.openid) {
this.loadFun();
} else {
app.globalData.openidSuccessFuc = this.loadFun;
}
// if (app.globalData.userMobile) {
// this.data.submitData.mobile = app.globalData.userMobile;
// this.setData({
// phoneInputShow: true,
// submitData: this.data.submitData
// })
// }
},
loadFun: function () {
this.getAddress();
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

},
addressChange:function(e){//所在地区发生改变
this.data.submitData.province = e.detail.value[0];
this.data.submitData.city = e.detail.value[1];
this.data.submitData.district = e.detail.value[2];
this.setData({
submitData:this.data.submitData
})
},
getRealName: function (e) {//获取收货人
this.data.submitData.realName = e.detail.value;
this.setData({
submitData: this.data.submitData
})
},
getMobile: function (e) {//获取手机号码
this.data.submitData.mobile = e.detail.value;
this.setData({
submitData: this.data.submitData
})
},
getAddressDetail: function (e) {//获取详细地址
this.data.submitData.addressDetail = e.detail.value;
this.setData({
submitData: this.data.submitData
})
},
getAddress: function () {//获取地址
app.wxRequest(app.globalData.urlRoot +"address/getAddress",{},res=>{
if(res.code == 200){
if(res.data){
this.data.isAddress = true;
this.data.submitData.realName = res.data.realName;
this.data.submitData.mobile = res.data.mobile;
this.data.submitData.province = res.data.province;
this.data.submitData.city = res.data.city;
this.data.submitData.district = res.data.district;
this.data.submitData.addressDetail = res.data.addressDetail;
this.setData({
submitData: this.data.submitData
})
}
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
},this);
},
addAddress:function(){//添加地址
app.wxRequest(app.globalData.urlRoot + "address/addAddress", this.data.submitData,res => {
wx.showToast({
title: res.msg,
})
if (res.code == 200) {
wx.navigateBack({
delta: 1
})
}
},this,"POST")
},
updateAddress: function () {//更新地址
app.wxRequest(app.globalData.urlRoot + "address/updateAddress", this.data.submitData, res => {
wx.showToast({
title: res.msg,
})
if (res.code == 200) {
wx.navigateBack({
delta:1
})
}
}, this,"POST");
},
getUserPhone: function (e) {//获取用户手机号
this.setData({
phoneInputShow: true
})
if (e.detail.errMsg == 'getPhoneNumber:ok') {
app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
if (res.code == 200) {
this.data.submitData.mobile = res.data.decodeData.phoneNumber;
this.setData({
submitData: this.data.submitData
})
} else {
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this);
}
},
submitAddress:function(){//保存地址
if (!this.data.submitData.realName){
wx.showToast({
title: '请输入收货人',
icon:"none"
})
return;
}
if (!app.mobileVerify(this.data.submitData.mobile)) {
if (this.data.submitData.mobile) {
wx.showToast({
title: '请输入正确的电话',
icon: 'none'
})
} else {
wx.showToast({
title: '请输入电话',
icon: 'none'
})
}
return;
}
if (!this.data.submitData.province) {
wx.showToast({
title: '请选择所在地区',
icon: 'none'
})
return;
}
if (!this.data.submitData.addressDetail) {
wx.showToast({
title: '请输入详细地址',
icon: "none"
})
return;
}
if(this.data.isAddress){
this.updateAddress();
} else {
this.addAddress();
}
}
})

+ 6
- 0
496_dongfengqichen/pages/address/address.json Zobrazit soubor

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "地址管理",
"usingComponents": {
"tabBar": "../component/tabBar/index"
}
}

+ 30
- 0
496_dongfengqichen/pages/address/address.wxml Zobrazit soubor

@@ -0,0 +1,30 @@
<!--pages/address/address.wxml-->
<view>
<view class="main">
<view class="addressTitle">编辑收货信息</view>
<view class="addressMsg">
<view class="msgGroup">
<view class="msgTitle">收货人:</view>
<input class="msgInput" bindinput="getRealName" value="{{submitData.realName}}"></input>
</view>
<view class="msgGroup">
<view class="msgTitle">手机号码:</view>
<input class="msgInput" maxlength='11' type="number" bindinput="getMobile" value="{{submitData.mobile}}"></input>
<!-- <button wx:if="{{!phoneInputShow}}" class="msgInput buttonSty" style="width:530rpx;height: 62rpx;margin: 0;padding: 0;min-height: 0;opacity:0;" open-type="getPhoneNumber" bindgetphonenumber="getUserPhone"></button> -->
</view>
<view class="msgGroup">
<view class="msgTitle">所在地区:</view>
<picker class="pickerSty" mode="region" bindchange="addressChange" value="{{[submitData.province,submitData.city,submitData.district]}}">
<!-- <picker class="pickerSty" mode="region" bindchange="addressChange"> -->
<view class="msgInput">{{submitData.province+" "+submitData.city+" "+submitData.district}}</view>
</picker>
</view>
<view class="msgGroup addressDetail">
<view class="msgTitle">详细地址:</view>
<textarea class="msgInput addressTextarea" bindinput="getAddressDetail" value="{{submitData.addressDetail}}"></textarea>
</view>
</view>
<view class="saveAddress" bindtap="submitAddress">保存</view>
</view>
<tabBar></tabBar>
</view>

+ 84
- 0
496_dongfengqichen/pages/address/address.wxss Zobrazit soubor

@@ -0,0 +1,84 @@
/* pages/address/address.wxss */
image{
display: block;
}
view{
-webkit-overflow-scrolling: touch;
}
.main{
height: calc(100vh - 150rpx);
overflow: auto;
position: relative;
}
.addressTitle{
margin:72rpx 0;
font-size:35rpx;
line-height:35rpx;
font-family:PingFangSC;
font-weight:600;
color:rgba(0,0,0,1);
text-align: center;
}
.addressMsg{
display: flex;
align-items: center;
flex-direction: column;
}
.msgGroup{
position: relative;
width:697rpx;
min-height:62rpx;
border: 1rpx solid #B1B1B1;
border-radius: 15rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0 27rpx;
margin-bottom: 40rpx;
}
.msgTitle,.msgInput{
min-height: 23rpx;
line-height: 23rpx;
font-size:23rpx;
font-family:PingFangSC;
font-weight:600;
color:rgba(35,33,34,1);
}
.msgInput{
width: 530rpx;
}
.addressDetail{
padding: 21rpx 26rpx;
height:155rpx;
align-items: flex-start;
}
.addressTextarea{
height: 100%;
}
.saveAddress{
position: absolute;
left: 50%;
bottom: 45rpx;
text-align: center;
transform: translateX(-50%);
width:652rpx;
height:70rpx;
background-color: #01538E;
line-height: 70rpx;
font-size:30rpx;
font-family:PingFangSC;
font-weight:400;
color:rgba(255,255,255,1);
border-radius: 15rpx;
}
.pickerSty{
height: 62rpx;
display: flex;
align-items: center;
}
.buttonSty{
position: absolute;
left: 135rpx;
top: 0;
z-index: 2;
}

+ 1
- 1
496_dongfengqichen/pages/index/index.js Zobrazit soubor

@@ -135,7 +135,7 @@ Page({
},
getUserLocation:function(e){
wx.getLocation({
type: 'wgs84', //
type: 'gcj02', //
success:(res)=>{
// console.log(res);
this.getDistributorList(res.longitude, res.latitude);

+ 53
- 16
496_dongfengqichen/pages/luckyStar/luckyStar.js Zobrazit soubor

@@ -14,13 +14,16 @@ Page({
clawScale: 1,//爪子的scale值
downNum:30,//倒计时时间
setInt:null,//倒计时元素
pizeTip:0,//抓奖提示框
pizeTip:1,//抓奖提示框
setGroup:{
left:null,
right: null,
top: null,
bottom: null,
}
},
gameSign: null, //游戏结束时需要
startType:1,//开始类型:1通过游戏玩法里的开始按钮,2:通过抓取按钮
gameState:false,//游戏状态
},

/**
@@ -84,18 +87,48 @@ Page({
})
},
openGameRule: function () {//打开游戏玩法
this.setData({
ruleShow: true
})
if(!this.data.gameState){
this.setData({
ruleShow: true
})
}
},
gameStart: function () {//开始游戏
if (!this.data.ruleCloseShow) {
this.downTimeFun();
gameStart: function () {//开始游戏按钮
if(this.data.startType==1){
this.data.startType = 2;
this.setData({
ruleShow: false,
ruleCloseShow: true
})
this.beginGame();
}
this.setData({
ruleShow: false,
ruleCloseShow: true
})
},
beginGame: function () {//开始游戏
app.wxRequest(app.globalData.urlRoot + "dollGame/beginGame", {}, res => {
console.log(res);
if(res.code==200){
this.data.gameSign = res.data.sign;
this.endGame();
if (this.data.gameSign) {
this.downTimeFun();
}
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
},this)
},
endGame:function(){//结束游戏
app.wxRequest(app.globalData.urlRoot + "dollGame/endGame", { sign:this.data.gameSign}, res => {
console.log(res);
if(res.code=200){

}else{
console.log(res);
}
}, this,"POST")
},
startClaw:function(e){//开始控制爪子方向
let direction = e.currentTarget.dataset.direction;
@@ -168,6 +201,7 @@ Page({
this.closeSetInt();
},
downTimeFun:function(){//游戏倒计时
this.data.gameState = true;
this.data.setInt = setInterval(()=>{
this.data.downNum -= 1;
if (this.data.downNum<10){
@@ -181,7 +215,8 @@ Page({
}
},1000);
},
closeSetInt:function(){//关闭倒计时
closeSetInt: function () {//关闭倒计时
this.data.gameState = false;
clearInterval(this.data.setInt);
this.setData({
downNum: 30,
@@ -197,8 +232,10 @@ Page({
}, 1200);
},
prizeLook:function(){//活动奖品
wx.navigateTo({
url: '../prizes/prizes'
})
if(!this.data.gameState){
wx.navigateTo({
url: '../prizes/prizes'
})
}
}
})

+ 3
- 1
496_dongfengqichen/pages/luckyStar/luckyStar.wxml Zobrazit soubor

@@ -38,6 +38,8 @@
<view class="gameStrat" bindtap="gameStart">开始游戏</view>
</view>
</view>
<view class="gameRuleDesc" style="background-color:rgba(000,000,000,0)" wx:if="{{false}}">
</view>
<view class="successPop" wx:if="{{pizeTip}}">
<view class="successGroup" wx:if="{{pizeTip==1}}">
<image class="gameRuleClose" style="top:-31rpx;right:-29rpx;" src="{{imgUrl+'/images/gameRuleClose.png'}}"></image>
@@ -46,7 +48,7 @@
<view class="successTip">幸运满格,大奖到手</view>
<image class="prizePic" src="{{imgUrl+'/images/prizePic1.png'}}" mode="aspectFit"></image>
<view class="prizeName">头等舱机票一张</view>
<view class="startRegister">立即领</view>
<view class="startRegister">立即领</view>
</view>
<view class="successGroup" wx:if="{{pizeTip==2 || pizeTip==3}}">
<image class="gameRuleClose" style="top:-31rpx;right:-29rpx;" src="{{imgUrl+'/images/gameRuleClose.png'}}"></image>

+ 7
- 1
496_dongfengqichen/pages/myCenter/myCenter.js Zobrazit soubor

@@ -334,7 +334,8 @@ Page({
this.data.subscribeData.realname = "";
this.data.subscribeData.captcha = "";
this.setData({
subscribeData: this.data.subscribeData
subscribeData: this.data.subscribeData,
verificationCode: '获取验证码',
})
// this.setData({
// isRegister: true
@@ -499,5 +500,10 @@ Page({
}
}, this);
}
},
addressControl:function(){//跳转到地址管理
wx.navigateTo({
url: '../address/address'
})
}
})

+ 1
- 1
496_dongfengqichen/pages/myCenter/myCenter.wxml Zobrazit soubor

@@ -16,7 +16,7 @@
</view>
<view class="userNameGroup">
<view class="userName">{{userData.nickName}}</view>
<!-- <image class="userNameEdit" src="{{imgUrl+'/images/userNameEdit.png'}}"></image> -->
<image bindtap="addressControl" class="userNameEdit" src="{{imgUrl+'/images/userNameEdit.png'}}"></image>
</view>
<view class="userLevel" wx:if="{{userData.userLevel}}">
<image class="userLevelIcon" src="{{imgUrl+'/images/userLevelIcon'+userData.userLevel+'.png'}}"></image>

+ 7
- 1
496_dongfengqichen/project.config.json Zobrazit soubor

@@ -95,7 +95,13 @@
"name": "领红包注册",
"pathName": "pages/receiveRegister/receiveRegister",
"query": ""
}
},
{
"id": -1,
"name": "地址管理",
"pathName": "pages/address/address",
"query": ""
}
]
}
}

Načítá se…
Zrušit
Uložit