40 changed files with 1650 additions and 49 deletions
@ -0,0 +1,66 @@ |
|||
// pages/old/index.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<!--pages/old/index.wxml--> |
|||
<view style="height:175rpx"></view> |
|||
<view class="bottom com-flex"> |
|||
<view class="bottom-item active"> |
|||
<image src="/images/homeSel.png" mode="widthFix"></image> |
|||
<view>首页</view> |
|||
</view> |
|||
<navigator url="user/index" class="bottom-item"> |
|||
<image src="/images/user.png" mode="widthFix"></image> |
|||
<view>我的</view> |
|||
</navigator> |
|||
</view> |
|||
@ -0,0 +1,24 @@ |
|||
/* pages/old/index.wxss */ |
|||
.bottom { |
|||
position: fixed; |
|||
left: 0; |
|||
right: 0; |
|||
height: 175rpx; |
|||
background: #FFFFFF; |
|||
box-shadow: -1px 1px 16rpx 0px rgba(6, 0, 1, 0.1); |
|||
color: #999; |
|||
bottom: 0; |
|||
} |
|||
.bottom-item { |
|||
width: 50%; |
|||
text-align: center; |
|||
} |
|||
.bottom image { |
|||
width: 80rpx; |
|||
display: block; |
|||
margin: 0 auto; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.bottom-item.active { |
|||
color: #0B898E; |
|||
} |
|||
@ -0,0 +1,217 @@ |
|||
// pages/user/address/add/index.js
|
|||
import util from "../../../../utils/util.js" |
|||
import user from "../../../../utils/https/user.js" |
|||
let app = getApp() |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
isDefault:true, |
|||
region: [], |
|||
customItem: '', |
|||
typeItem:null, |
|||
formData:{ |
|||
}, |
|||
id:null, // 为null的时候是新增,否则是编辑
|
|||
types:[], |
|||
safeBottom:app.globalData.safeBottom, |
|||
selectIndex:0 |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.setData({ |
|||
id: options.id || null |
|||
}) |
|||
// 获取证件列表
|
|||
user.user_post("user/getCardTypeList", {}).then(r => { |
|||
console.log(r) |
|||
let data = []; |
|||
r.data.map(item=>{ |
|||
data.push(item.title) |
|||
}) |
|||
this.setData({ |
|||
types: r.data, |
|||
typeList:data |
|||
}) |
|||
if (this.data.id) { |
|||
user.user_post("user/getContactInfoById", { id: this.data.id }).then(res => { |
|||
res.data.isDefault = res.data.is_default == '1' ? true : false; |
|||
res.data.username = res.data.name; |
|||
res.data.mobile = res.data.tel; |
|||
res.data.idNumber = res.data.id_number; |
|||
this.setData({ |
|||
formData: res.data, |
|||
idTypeId: res.data.idcard_type, |
|||
selectIndex:r.data.findIndex(item=>item.type == res.data.idcard_type && item.code == res.data.document_type) |
|||
}) |
|||
}) |
|||
} |
|||
}) |
|||
|
|||
|
|||
// 如果id存在那么需要获取地址详情
|
|||
}, |
|||
// 设为默认
|
|||
setDefault:function(e){ |
|||
var formData = this.data.formData; |
|||
formData.isDefault = e.detail.value; |
|||
this.setData({ |
|||
formData: formData |
|||
}) |
|||
}, |
|||
// 输入监听 不是双向绑定啊 绝望
|
|||
nameInput:function(e){ |
|||
var formData = this.data.formData; |
|||
formData.username = e.detail.value; |
|||
this.setData({ |
|||
formData: formData |
|||
}) |
|||
}, |
|||
telInput:function(e){ |
|||
var formData = this.data.formData; |
|||
formData.mobile = e.detail.value; |
|||
this.setData({ |
|||
formData: formData |
|||
}) |
|||
}, |
|||
idNumberInput:function(e){ |
|||
var formData = this.data.formData; |
|||
formData.idNumber = e.detail.value; |
|||
this.setData({ |
|||
formData: formData |
|||
}) |
|||
}, |
|||
// 选择证件类型
|
|||
selectType:function(e){ |
|||
this.setData({ |
|||
selectIndex:e.detail.value |
|||
}) |
|||
// let data = [];
|
|||
// for(let i=0;i<this.data.types.length;i++){
|
|||
// data.push(this.data.types[i].title)
|
|||
// }
|
|||
// wx.showActionSheet({
|
|||
// itemList: data,
|
|||
// success(res) {
|
|||
// that.setData({
|
|||
// typeItem:that.data.types[res.tapIndex],
|
|||
// idTypeId: that.data.types[res.tapIndex].id,
|
|||
// })
|
|||
// console.log(res);
|
|||
// },
|
|||
// fail(res) {
|
|||
// // Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
|
|||
// console.log(res.errMsg)
|
|||
// }
|
|||
// })
|
|||
}, |
|||
// 保存
|
|||
submit:function(){ |
|||
if (!this.data.formData.username){ |
|||
wx.showToast({ |
|||
title: '请输入姓名!', |
|||
icon:"none" |
|||
}) |
|||
return false; |
|||
} |
|||
if (!this.data.formData.mobile) { |
|||
wx.showToast({ |
|||
title: '请输入手机号码!', |
|||
icon: "none" |
|||
}) |
|||
return false; |
|||
} |
|||
if (!util.isTel(this.data.formData.mobile)) { |
|||
wx.showToast({ |
|||
title: '请输入正确的手机号码!', |
|||
icon: "none" |
|||
}) |
|||
return false; |
|||
} |
|||
// if (!this.data.idTypeId) {
|
|||
// wx.showToast({
|
|||
// title: '请选择证件类型!',
|
|||
// icon: "none"
|
|||
// })
|
|||
// return false;
|
|||
// }
|
|||
// if (!this.data.formData.idNumber) {
|
|||
// wx.showToast({
|
|||
// title: '请输入证件号!',
|
|||
// icon: "none"
|
|||
// })
|
|||
// return false;
|
|||
// }
|
|||
let data = this.data.formData; |
|||
data.idcard_type = this.data.types[this.data.selectIndex].type; |
|||
data.is_default = data.isDefault?'1':'0'; |
|||
data.document_type = this.data.types[this.data.selectIndex].code; |
|||
data.id_number = this.data.formData.idNumber; |
|||
let service ="addNewContact"; |
|||
if(this.data.id){ |
|||
data.contactId = this.data.id; |
|||
service = "editContactById"; |
|||
} |
|||
user.user_post("user/"+service,data).then(res=>{ |
|||
if(res.code==1){ |
|||
wx.showToast({ |
|||
title: '保存成功!', |
|||
icon:"success", |
|||
success:function(){ |
|||
util.back(); |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
cancel:function(){ |
|||
util.back() |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title-header": "/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<!--pages/user/address/add/index.wxml--> |
|||
<view> |
|||
<title-header title="{{id?'编辑':'添加'}}出行人"></title-header> |
|||
<view class="input-item"> |
|||
<text class="input-label">姓名:</text> |
|||
<input bindinput="nameInput" value="{{formData.username}}" class="weui-input" auto-focus placeholder="请输入姓名" /> |
|||
</view> |
|||
<view class="input-item"> |
|||
<text class="input-label">手机号:</text> |
|||
<input bindinput="telInput" type="number" value="{{formData.mobile}}" class="weui-input" placeholder="请输入手机号" /> |
|||
</view> |
|||
<view class="input-item" style="height:240rpx"> |
|||
<picker bindchange="selectType" value="{{selectIndex}}" range="{{typeList}}"> |
|||
<view class="picker com-flex"> |
|||
<text>{{typeList[selectIndex]}}</text> |
|||
<view class="iconfont icon-xia"></view> |
|||
</view> |
|||
</picker> |
|||
<textarea bindinput="idNumberInput" type="number" value="{{formData.idNumber}}" class="weui-input" placeholder="请选择证件并输入证件号"></textarea> |
|||
</view> |
|||
<view class="com-flex btns"> |
|||
<view bindtap="cancel">取消</view> |
|||
<view class="active" bindtap="submit">确定</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,64 @@ |
|||
/* pages/user/address/add/index.wxss */ |
|||
page { |
|||
background: #fff; |
|||
} |
|||
.input-item { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 185rpx; |
|||
font-size: 49rpx; |
|||
font-weight: 500; |
|||
margin: 0 30rpx; |
|||
justify-content: space-between; |
|||
padding: 0 20rpx; |
|||
border-bottom: 1rpx solid #D8D8D8; |
|||
} |
|||
.input-item .weui-input { |
|||
flex: 1; |
|||
} |
|||
.input-item textarea.weui-input { |
|||
height: 120rpx; |
|||
} |
|||
.picker { |
|||
height: 80rpx; |
|||
background: #FFFFFF; |
|||
border: 1px solid #999999; |
|||
border-radius: 20rpx; |
|||
box-sizing: border-box; |
|||
text-align: center; |
|||
margin-right: 20rpx; |
|||
} |
|||
.picker text { |
|||
flex: 1; |
|||
text-align: center; |
|||
padding: 0 15rpx; |
|||
} |
|||
.picker .iconfont { |
|||
color: #0B898E; |
|||
width: 80rpx; |
|||
line-height: 80rpx; |
|||
border-left: 1px solid #999999; |
|||
} |
|||
.btns { |
|||
position: fixed; |
|||
left: 27rpx; |
|||
right: 27rpx; |
|||
bottom: 27rpx; |
|||
justify-content: space-between; |
|||
font-size: 49rpx; |
|||
font-weight: bold; |
|||
} |
|||
.btns view { |
|||
color: #0B898E; |
|||
border: 2rpx solid #0B898E; |
|||
background: white; |
|||
width: 333rpx; |
|||
box-sizing: border-box; |
|||
text-align: center; |
|||
border-radius: 20rpx; |
|||
line-height: 103rpx; |
|||
} |
|||
.btns view.active { |
|||
color: #fff; |
|||
background: #0B898E; |
|||
} |
|||
@ -0,0 +1,185 @@ |
|||
// pages/user/address/index.js
|
|||
import user from "../../../utils/https/user.js" |
|||
import util from "../../../utils/util.js" |
|||
let app = getApp() |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
pageNo:1, |
|||
list:[], |
|||
isMore:true, |
|||
fromOrder:null, |
|||
safeBottom:app.globalData.safeBottom |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.setData({ |
|||
fromOrder:options.from || null, |
|||
pid:options.pid || null, |
|||
sid:options.sid || null |
|||
}) |
|||
}, |
|||
// 如果是来自订单的点击选中联系人
|
|||
setOrderLinkman:function(e){ |
|||
console.log(this.data.fromOrder) |
|||
if(this.data.fromOrder=='order'){ |
|||
let pid = this.data.pid,sid = this.data.sid; |
|||
app.globalData.shoppingCart.map((item,index,arr)=>{ |
|||
if(item.baseInfo.id==pid && item.skuInfo.id==sid){ |
|||
// 只有当产品id和规格id一致的时候才把联系人赋值进去
|
|||
// 并且只有当这个联系人没有在选中的联系人中才需要赋值
|
|||
let index = item.linkman.findIndex((l)=>l.id==e.currentTarget.dataset.item.id); |
|||
if(item.productNum<=item.linkman.length && index==-1){ |
|||
item.linkman[item.linkman.length-1] = e.currentTarget.dataset.item |
|||
} |
|||
else if(index==-1){ |
|||
item.linkman.push(e.currentTarget.dataset.item) |
|||
} |
|||
} |
|||
}) |
|||
util.back() |
|||
} |
|||
else if(this.data.fromOrder=='CtripOrder'){ |
|||
// 携程下单来的
|
|||
app.globalData.product.linkman = e.currentTarget.dataset.item; |
|||
util.back(); |
|||
} |
|||
}, |
|||
getList: function () { |
|||
user.user_post("user/getContactOrConsignee", { |
|||
contactType:"CONTACT", |
|||
offset: this.data.list.length, |
|||
limit: 10 |
|||
}).then(res => { |
|||
let list = this.data.list.concat(res.data),isMore = true; |
|||
if(res.data.length<10){ |
|||
isMore = false; |
|||
} |
|||
this.setData({ |
|||
list: list, |
|||
isMore: isMore |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
// 设为默认
|
|||
setDefault:function(e){ |
|||
let item = e.currentTarget.dataset.item; |
|||
if(item.is_default==1) return; |
|||
user.user_post("user/setDefaultContact",{contactId:item.id}).then(res=>{ |
|||
// 设置默认成功
|
|||
let list = this.data.list; |
|||
if(res.data){ |
|||
wx.showToast({ |
|||
title: '操作成功!', |
|||
icon:"success" |
|||
}); |
|||
list.map((i,index,arr)=>{ |
|||
if(i.id==item.id){ |
|||
i.is_default = 1; |
|||
} |
|||
else { |
|||
i.is_default = '0'; |
|||
} |
|||
}) |
|||
this.setData({ |
|||
list:list |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 删除单个地址
|
|||
del: function (e) { |
|||
let that = this, id = e.currentTarget.dataset.id, index = e.currentTarget.dataset.index; |
|||
wx.showModal({ |
|||
title: '提示', |
|||
content: '确定删除吗?', |
|||
success: function (res) { |
|||
if (res.confirm) { |
|||
// 确定删除
|
|||
user.user_post("user/delContact", { contactId: id }).then(res => { |
|||
if (res.code==1) { |
|||
wx.showToast({ |
|||
title: '删除成功', |
|||
icon: 'success' |
|||
}) |
|||
let data = that.data.list; |
|||
data.splice(index, 1) |
|||
that.setData({ |
|||
list: data |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
add: function (e) { |
|||
console.log(e) |
|||
if (e.target.dataset.id) { |
|||
wx.navigateTo({ |
|||
url: './add/index?id=' + e.target.dataset.id |
|||
}) |
|||
} |
|||
else { |
|||
wx.navigateTo({ |
|||
url: './add/index?id=' |
|||
}) |
|||
} |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
this.setData({ |
|||
list:[], |
|||
pageNo:1, |
|||
isMore:true |
|||
}) |
|||
this.getList(); |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
if(this.data.isMore){ |
|||
this.getList(); |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<!--pages/old/linkman/index.wxml--> |
|||
<title title="出行人信息"></title> |
|||
<view class="item" wx:for="{{list}}"> |
|||
<view>姓名:{{item.name}}</view> |
|||
<view>手机号:{{item.tel}}</view> |
|||
<view>{{item.title}}:{{item.id_number}}</view> |
|||
<view class="item-bottom com-flex"> |
|||
<view class="iconfont {{item.is_default==1?'icon-gou':'icon-quan'}}" bindtap="setDefault" data-item="{{item}}"></view> |
|||
<view style="flex:1">默认出行人</view> |
|||
<navigator url="add/index?id={{item.id}}" class="edit-btn">编辑</navigator> |
|||
<view class="edit-btn" bindtap="del" data-id="{{item.id}}" data-index="{{index}}">删除</view> |
|||
</view> |
|||
</view> |
|||
<view style="height:140rpx"></view> |
|||
<navigator url="add/index" class="btn">添加出行人</navigator> |
|||
@ -0,0 +1,56 @@ |
|||
/* pages/old/linkman/index.wxss */ |
|||
.btn { |
|||
position: fixed; |
|||
left: 27rpx; |
|||
right: 27rpx; |
|||
width: 697rpx; |
|||
line-height: 107rpx; |
|||
background: #0B898E; |
|||
border-radius: 20rpx; |
|||
bottom: 27rpx; |
|||
text-align: center; |
|||
color: #fff; |
|||
font-size: 49rpx; |
|||
font-weight: 500; |
|||
} |
|||
.item { |
|||
color: #333333; |
|||
margin-bottom: 40rpx; |
|||
font-size: 49rpx; |
|||
font-weight: 500; |
|||
background: white; |
|||
padding: 0 27rpx; |
|||
line-height: 80rpx; |
|||
padding-top: 20rpx; |
|||
} |
|||
page { |
|||
background: #EDEDED; |
|||
} |
|||
.item .com-flex { |
|||
padding-left: 24rpx; |
|||
padding-right: 13rpx; |
|||
font-size: 44rpx; |
|||
border-top: 1px solid #D8D8D8; |
|||
height: 147rpx; |
|||
margin-top: 20rpx; |
|||
} |
|||
.item .com-flex .iconfont { |
|||
width: 53rpx; |
|||
line-height: 53rpx; |
|||
border-radius: 50%; |
|||
text-align: center; |
|||
margin-right: 20rpx; |
|||
overflow: hidden; |
|||
} |
|||
.item .com-flex .icon-quan { |
|||
color: #ccc; |
|||
background: #ccc; |
|||
} |
|||
.item .com-flex .icon-gou { |
|||
color: #0B898E; |
|||
font-size: 53rpx; |
|||
} |
|||
.item .com-flex .edit-btn { |
|||
color: #0B898E; |
|||
margin-left: 40rpx; |
|||
} |
|||
@ -0,0 +1,103 @@ |
|||
// pages/old/nickname/index.js
|
|||
import util from "../../../utils/util" |
|||
import userApi from "../../../utils/https/user" |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
info:null |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
userApi.user_post("user/getMyInfo",{}).then(res=>{ |
|||
this.setData({ |
|||
info:res.data |
|||
}) |
|||
}) |
|||
}, |
|||
changeName:function(e){ |
|||
let info = this.data.info |
|||
info.nickname = e.detail.value |
|||
this.setData({ |
|||
info:info |
|||
}) |
|||
}, |
|||
submit:function(e){ |
|||
if(!this.data.info.nickname){ |
|||
wx.showToast({ |
|||
title: '请输入昵称', |
|||
icon: 'none' |
|||
}) |
|||
return; |
|||
} |
|||
userApi.user_post("user/changeNickname",{ |
|||
nickname: this.data.info.nickname |
|||
}).then(res=>{ |
|||
if(res.code==1){ |
|||
wx.showToast({ |
|||
title: '修改成功!', |
|||
icon:"success" |
|||
}) |
|||
setTimeout(()=>{ |
|||
wx.navigateBack({ |
|||
complete: (res) => {}, |
|||
}) |
|||
},1000) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
<!--pages/old/nickname/index.wxml--> |
|||
<title title="修改昵称"></title> |
|||
<view class="input-box com-flex" wx:if="{{info}}"> |
|||
<input type="text" value="{{info.nickname}}" bindinput="changeName" placeholder="请输入昵称" /> |
|||
</view> |
|||
<view class="btn" bindtap="submit">保存</view> |
|||
@ -0,0 +1,25 @@ |
|||
/* pages/old/nickname/index.wxss */ |
|||
.input-box { |
|||
height: 187rpx; |
|||
margin: 0 30rpx; |
|||
border-bottom: 1px solid #D8D8D8; |
|||
} |
|||
.input-box input { |
|||
display: block; |
|||
width: 100%; |
|||
font-size: 49rpx; |
|||
color: #333333; |
|||
font-weight: bold; |
|||
flex: 1; |
|||
} |
|||
.btn { |
|||
width: 697rpx; |
|||
line-height: 107rpx; |
|||
background: #0B898E; |
|||
border-radius: 20rpx; |
|||
text-align: center; |
|||
color: #fff; |
|||
font-size: 49rpx; |
|||
font-weight: bold; |
|||
margin: 40rpx auto; |
|||
} |
|||
@ -0,0 +1,214 @@ |
|||
// pages/user/profile/index.js
|
|||
let app = getApp(); |
|||
import util from "../../../utils/util" |
|||
import WeCropper from '../../../we-cropper/we-cropper.min.js'; |
|||
import userApi from "../../../utils/https/user" |
|||
let device = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect(); // 获取设备信息
|
|||
const width = device.windowWidth // 示例为一个与屏幕等宽的正方形裁剪框
|
|||
let menuHeight = (rect.top - device.statusBarHeight) * 2 + rect.height + device.statusBarHeight; |
|||
let height = device.windowHeight - menuHeight; |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
menuWidth:width - rect.right + rect.width + 6, |
|||
info:null, |
|||
today:"2020-10-11", |
|||
sexes:['男','女'], |
|||
birthday:"", |
|||
sexIndex:0, |
|||
cropperOpt: { |
|||
id: 'cropper', // 用于手势操作的canvas组件标识符
|
|||
targetId: 'targetCropper', // 用于用于生成截图的canvas组件标识符
|
|||
pixelRatio: device.pixelRatio, // 传入设备像素比
|
|||
width, // 画布宽度
|
|||
height:height, // 画布高度
|
|||
src: '', |
|||
scale: 2.5, // 最大缩放倍数
|
|||
zoom: 8, // 缩放系数
|
|||
cut: { |
|||
x: (width - 320) / 2, // 裁剪框x轴起点
|
|||
y: (height - 320) / 2, // 裁剪框y轴起点
|
|||
width: 320, // 裁剪框宽度
|
|||
height: 320 // 裁剪框高度
|
|||
} |
|||
}, |
|||
showCropper:false, |
|||
avatar:"" |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
let { |
|||
cropperOpt |
|||
} = this.data,that = this; |
|||
cropperOpt.height = device.screenHeight - menuHeight; |
|||
cropperOpt.cut.y = (height - 320) / 2; |
|||
console.log(cropperOpt,menuHeight,device) |
|||
let today = new Date(); |
|||
this.setData({ |
|||
today:util.formatDate(today), |
|||
cropperOpt:cropperOpt |
|||
}) |
|||
this.cropper = new WeCropper(cropperOpt); |
|||
}, |
|||
// 插件通过touchStart、touchMove、touchEnd方法来接收事件对象。
|
|||
touchStart(e) { |
|||
console.log(e) |
|||
this.cropper.touchStart(e) |
|||
}, |
|||
touchMove(e) { |
|||
this.cropper.touchMove(e) |
|||
}, |
|||
touchEnd(e) { |
|||
this.cropper.touchEnd(e) |
|||
}, |
|||
changeSex:function(e){ |
|||
|
|||
userApi.user_post("user/changeSex",{ |
|||
sex:Number(e.detail.value)+1 |
|||
}).then(res=>{ |
|||
if(res.code==1){ |
|||
this.setData({ |
|||
sexIndex:e.detail.value |
|||
}) |
|||
wx.showToast({ |
|||
title: '修改成功', |
|||
icon: 'success' |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
bindDateChange:function(e){ |
|||
let birthday = e.detail.value; |
|||
userApi.user_post("user/changeBirthday",{ |
|||
birthday:birthday |
|||
}).then(res=>{ |
|||
if(res.code==1){ |
|||
this.setData({ |
|||
birthday:birthday |
|||
}) |
|||
wx.showToast({ |
|||
title: '修改成功', |
|||
icon: 'success' |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 自定义裁剪页面的布局中,可以重新选择图片
|
|||
uploadTap() { |
|||
const self = this |
|||
wx.chooseImage({ |
|||
count: 1, // 默认9
|
|||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|||
success(res) { |
|||
const src = res.tempFilePaths[0] |
|||
self.cropper.pushOrign(src) |
|||
self.setData({ |
|||
showCropper: true |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 生成图片
|
|||
getCropperImage() { |
|||
var that = this; |
|||
wx.showLoading({ title: '加载中', mask: true }); |
|||
this.cropper.getCropperImage(tempFilePath => { |
|||
// tempFilePath 为裁剪后的图片临时路径
|
|||
console.log(tempFilePath) |
|||
if (tempFilePath) { |
|||
wx.uploadFile({ |
|||
url: 'https://api.cloud.sz-trip.com/api/pbservice.other/upload', //这里是上传的服务器地址
|
|||
filePath: tempFilePath, |
|||
header:{ |
|||
token: wx.getStorageSync('jstrip_token'), |
|||
}, |
|||
name: "file", |
|||
success: function (res) { |
|||
console.log(res) |
|||
var res = JSON.parse(res.data); |
|||
let avatar = res.data.url; |
|||
userApi.user_post("user/changeAvatar",{ |
|||
avatarUrl:avatar |
|||
}).then(res=>{ |
|||
if(res.code==1){ |
|||
wx.hideLoading(); |
|||
that.setData({ |
|||
showCropper: false, |
|||
avatar: avatar |
|||
}) |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
fail:function(res){ |
|||
wx.hideLoading(); |
|||
console.log('err',res) |
|||
} |
|||
}) |
|||
// 拿到裁剪后的图片路径的操作
|
|||
} else { |
|||
console.log('获取图片地址失败,请稍后重试') |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
userApi.user_post("user/getMyInfo",{}).then(res=>{ |
|||
this.setData({ |
|||
info:res.data, |
|||
avatar:res.data.avatar, |
|||
birthday:res.data.birthday |
|||
}) |
|||
if(res.data.gender==2){ |
|||
this.setData({ |
|||
sexIndex:1 |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<import src='/we-cropper/we-cropper.wxml' /> |
|||
<title title="我的资料"> |
|||
<view wx:if="{{showCropper}}" bindtap="getCropperImage" class="submit-upload" style="right:{{menuWidth}}px">完成</view> |
|||
</title> |
|||
<view class="profile-item"> |
|||
<text>头像</text> |
|||
<view class="info" bindtap="uploadTap" style="text-align:right;"> |
|||
<image src="{{avatar}}" mode="aspectFill"></image> |
|||
</view> |
|||
<view class="iconfont icon-you"></view> |
|||
</view> |
|||
<navigator url="../nickname/index" class="profile-item" wx:if="{{info}}"> |
|||
<text>昵称</text> |
|||
<view class="info">{{info.nickname}}</view> |
|||
<view class="iconfont icon-you"></view> |
|||
</navigator> |
|||
<view class="cropper-wrapper" wx:if="{{showCropper}}"> |
|||
<template is="we-cropper" data="{{...cropperOpt}}"/> |
|||
</view> |
|||
<!-- <view class="logoff" bindtap="logoff">注销</view> --> |
|||
@ -0,0 +1,51 @@ |
|||
/* pages/user/profile/index.wxss */ |
|||
.profile-item { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
font-size: 49rpx; |
|||
color: #333; |
|||
height: 187rpx; |
|||
margin: 0 30rpx; |
|||
font-weight: 500; |
|||
border-bottom: 1rpx solid #D8D8D8; |
|||
} |
|||
.profile-item text { |
|||
flex-shrink: 0; |
|||
} |
|||
.profile-item .info { |
|||
flex: 1; |
|||
text-align: right; |
|||
} |
|||
.profile-item .iconfont { |
|||
flex-shrink: 0; |
|||
} |
|||
.profile-item .info image { |
|||
display: inline-block; |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
border-radius: 50%; |
|||
} |
|||
.cropper{ |
|||
position: absolute; |
|||
bottom: 0; |
|||
left: 0; |
|||
} |
|||
.cropper-buttons{ |
|||
position: absolute; |
|||
bottom: 0; |
|||
height: 80rpx; |
|||
z-index: 111; |
|||
display: flex; |
|||
width: 100%; |
|||
left: 0; |
|||
align-items: center; |
|||
justify-content: center; |
|||
background: rgba(0, 0, 0, 0.86) |
|||
} |
|||
.submit-upload { |
|||
position: absolute; |
|||
right: 0; |
|||
font-size: 36rpx; |
|||
color: #0B898E; |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
// pages/old/user/index.js
|
|||
import userApi from "../../../utils/https/user" |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
info:{} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
userApi.user_post("user/getMyInfo").then(res => { |
|||
this.setData({ |
|||
info: res.data |
|||
}) |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
<!--pages/old/index.wxml--> |
|||
<title title="君到苏州(文化旅游总入口)"></title> |
|||
<view class="topbg com-flex"> |
|||
<image src="{{info.avatar}}" mode="aspectFill" class="avatar"></image> |
|||
<navigator url="../profile/index" class="userinfo"> |
|||
<view class="com-flex"> |
|||
<view>{{info.nickname}}</view> |
|||
<image wx:if="{{info.gender==1 || info.gender==2}}" mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/user/sex{{info.gender}}.png"></image> |
|||
<view style="flex:1"></view> |
|||
<view class="com-flex changebox"> |
|||
<image src="https://static.ticket.sz-trip.com/xcxImages/old/change.png" mode="widthFix"></image> |
|||
<view>切换常规模式</view> |
|||
</view> |
|||
</view> |
|||
<view>id:{{info.id}}</view> |
|||
</navigator> |
|||
</view> |
|||
<view class="list"> |
|||
<view class="item com-flex"> |
|||
<view>我的订单</view> |
|||
<image class="bgimg" src="https://static.ticket.sz-trip.com/xcxImages/old/orderbg.png" mode="widthFix"></image> |
|||
<image class="circle" src="https://static.ticket.sz-trip.com/xcxImages/old/circle.png" mode="widthFix"></image> |
|||
</view> |
|||
<navigator url="../linkman/index" class="item com-flex"> |
|||
<view>出行人信息</view> |
|||
<image class="bgimg" src="https://static.ticket.sz-trip.com/xcxImages/old/linkmanbg.png" mode="widthFix"></image> |
|||
<image class="circle" src="https://static.ticket.sz-trip.com/xcxImages/old/circle.png" mode="widthFix"></image> |
|||
</navigator> |
|||
<view class="item com-flex"> |
|||
<view>联系客服</view> |
|||
<image class="bgimg" src="https://static.ticket.sz-trip.com/xcxImages/old/servicebg.png" mode="widthFix"></image> |
|||
<image class="circle" src="https://static.ticket.sz-trip.com/xcxImages/old/circle.png" mode="widthFix"></image> |
|||
</view> |
|||
</view> |
|||
<view style="height:175rpx"></view> |
|||
<view class="bottom com-flex"> |
|||
<navigator url="../index" class="bottom-item"> |
|||
<image src="/images/home.png" mode="widthFix"></image> |
|||
<view>首页</view> |
|||
</navigator> |
|||
<view class="bottom-item active"> |
|||
<image src="/images/userSel.png" mode="widthFix"></image> |
|||
<view>我的</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,105 @@ |
|||
/* pages/old/index.wxss */ |
|||
.bottom { |
|||
position: fixed; |
|||
left: 0; |
|||
right: 0; |
|||
height: 175rpx; |
|||
background: #FFFFFF; |
|||
box-shadow: -1px 1px 16rpx 0px rgba(6, 0, 1, 0.1); |
|||
color: #999; |
|||
bottom: 0; |
|||
} |
|||
.bottom-item { |
|||
width: 50%; |
|||
text-align: center; |
|||
} |
|||
.bottom image { |
|||
width: 80rpx; |
|||
display: block; |
|||
margin: 0 auto; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.bottom-item.active { |
|||
color: #0B898E; |
|||
} |
|||
.title-header .icon-fanhui1 { |
|||
display: none; |
|||
} |
|||
.topbg { |
|||
height: 340rpx; |
|||
background: url(https://static.ticket.sz-trip.com/xcxImages/user/topbg.png); |
|||
background-size: 100% 100%; |
|||
color: #FFFFFF; |
|||
font-size: 40rpx; |
|||
align-items: flex-start; |
|||
padding-top: 50rpx; |
|||
box-sizing: border-box; |
|||
} |
|||
.topbg .avatar { |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
border-radius: 50%; |
|||
margin: 0 30rpx; |
|||
flex-shrink: 0; |
|||
} |
|||
.userinfo image { |
|||
width: 53rpx; |
|||
margin-left: 40rpx; |
|||
} |
|||
.topbg .userinfo { |
|||
flex: 1; |
|||
} |
|||
.topbg .userinfo .com-flex { |
|||
font-size: 56rpx; |
|||
line-height: 100rpx; |
|||
font-weight: 500; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.topbg .userinfo .changebox.com-flex { |
|||
line-height: 53rpx; |
|||
background: #C9E5E6; |
|||
border-radius: 27rpx 0 0 27rpx; |
|||
justify-content: center; |
|||
font-size: 27rpx; |
|||
color: #0B898E; |
|||
font-weight: 500; |
|||
width: 232rpx; |
|||
margin-bottom: 0; |
|||
} |
|||
.topbg .userinfo .changebox.com-flex image { |
|||
width: 33rpx; |
|||
margin-left: 0; |
|||
margin-right: 11rpx; |
|||
} |
|||
.list { |
|||
margin: 0 30rpx; |
|||
margin-top: -70rpx; |
|||
color: #333333; |
|||
font-size: 49rpx; |
|||
font-weight: bold; |
|||
position: relative; |
|||
} |
|||
.item { |
|||
padding-left: 100rpx; |
|||
position: relative; |
|||
padding-right: 30rpx; |
|||
border-radius: 20rpx; |
|||
background: white; |
|||
margin-bottom: 30rpx; |
|||
line-height: 240rpx; |
|||
align-items: flex-end; |
|||
justify-content: space-between; |
|||
} |
|||
.item .circle { |
|||
position: absolute; |
|||
left: 83rpx; |
|||
bottom: 70rpx; |
|||
width: 43rpx; |
|||
display: block; |
|||
} |
|||
.item .bgimg { |
|||
width: 231rpx; |
|||
} |
|||
page { |
|||
background: #EDEDED; |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
// pages/user/order/expressInfo/index.js
|
|||
import commonApi from "../../../../utils/https/common" |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
expressList:[] |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
commonApi.user_post("order/query",{ |
|||
order_id:options.id |
|||
}).then(res=>{ |
|||
let ajax = [],expressList = [],proNames = [] |
|||
res.data.post_detail_list.map(item=>{ |
|||
let product = res.data.order_product_list.find(pro=>pro.child_order_id==item.child_order_id) |
|||
ajax.push(commonApi.user_post("order/getExpress",{ |
|||
logisticCode:item.courier_number, |
|||
shipperCode:item.express_code, |
|||
child_order_id:item.child_order_id |
|||
})) |
|||
}) |
|||
Promise.all(ajax).then(res=>{ |
|||
console.log(res) |
|||
res.map(item=>{ |
|||
expressList.push(item.data.reverse()) |
|||
}) |
|||
this.setData({ |
|||
expressList:expressList |
|||
}) |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
<!--pages/user/order/expressInfo/index.wxml--> |
|||
<title title="物流信息"></title> |
|||
<view class="box" wx:for="{{expressList}}"> |
|||
<view wx:for="{{item}}" class="item"> |
|||
<view class="line"></view> |
|||
<view class="circle"></view> |
|||
<view class="title">{{item.AcceptStation}}</view> |
|||
<view>{{item.AcceptTime}}</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,50 @@ |
|||
/* pages/user/order/expressInfo/index.wxss */ |
|||
.box { |
|||
padding: 0 30rpx; |
|||
font-size: 24rpx; |
|||
color: #666666; |
|||
padding-top: 40rpx; |
|||
} |
|||
.item { |
|||
padding-left: 40rpx; |
|||
padding-bottom: 30rpx; |
|||
position: relative; |
|||
} |
|||
.circle { |
|||
position: absolute; |
|||
left: 0; |
|||
width: 20rpx; |
|||
height: 20rpx; |
|||
border-radius: 50%; |
|||
left: 0rpx; |
|||
background: #ccc; |
|||
top: 10rpx; |
|||
} |
|||
.title { |
|||
font-size: 28rpx; |
|||
line-height: 40rpx; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.line { |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
bottom: 0; |
|||
width: 2rpx; |
|||
left: 9rpx; |
|||
background: #ccc; |
|||
} |
|||
.item:nth-child(1) .line { |
|||
top: 20rpx; |
|||
} |
|||
.item:last-child .line { |
|||
bottom: auto; |
|||
height: 20rpx; |
|||
} |
|||
.item:nth-child(1) .circle { |
|||
background: #0B898E; |
|||
} |
|||
.item:nth-child(1) .title { |
|||
color: #000000; |
|||
font-weight: 500; |
|||
} |
|||
Loading…
Reference in new issue