Merge branch 'master' of http://git.luyuan.tk/pplokijuhyg/deguodaigou into pplok
This commit is contained in:
commit
68a7aea72c
76
app.js
76
app.js
@ -1,39 +1,39 @@
|
||||
//app.js
|
||||
App({
|
||||
onLaunch: function () {
|
||||
// 展示本地存储能力
|
||||
var logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
}
|
||||
})
|
||||
// 获取用户信息
|
||||
wx.getSetting({
|
||||
success: res => {
|
||||
if (res.authSetting['scope.userInfo']) {
|
||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
||||
wx.getUserInfo({
|
||||
success: res => {
|
||||
// 可以将 res 发送给后台解码出 unionId
|
||||
this.globalData.userInfo = res.userInfo
|
||||
|
||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
||||
// 所以此处加入 callback 以防止这种情况
|
||||
if (this.userInfoReadyCallback) {
|
||||
this.userInfoReadyCallback(res)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null
|
||||
}
|
||||
//app.js
|
||||
App({
|
||||
onLaunch: function () {
|
||||
// 展示本地存储能力
|
||||
var logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
}
|
||||
})
|
||||
// 获取用户信息
|
||||
wx.getSetting({
|
||||
success: res => {
|
||||
if (res.authSetting['scope.userInfo']) {
|
||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
||||
wx.getUserInfo({
|
||||
success: res => {
|
||||
// 可以将 res 发送给后台解码出 unionId
|
||||
this.globalData.userInfo = res.userInfo
|
||||
|
||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
||||
// 所以此处加入 callback 以防止这种情况
|
||||
if (this.userInfoReadyCallback) {
|
||||
this.userInfoReadyCallback(res)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null
|
||||
}
|
||||
})
|
@ -21,6 +21,9 @@
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.shurupla1{
|
||||
color: #333333;
|
||||
}
|
||||
.arrow {
|
||||
width: 14rpx;
|
||||
height: 25rpx;
|
||||
|
@ -1,11 +1,11 @@
|
||||
<view class="shuru">
|
||||
<view class="left">{{left}}</view>
|
||||
<view class="right"wx:if="{{ifarrow}}" bindtap="choose">
|
||||
<text class="shurupla">{{right}}</text>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
<view class="right" wx:else>
|
||||
<input type="text" placeholder-class="shurupla" class="shuru1" placeholder="{{right}}" value="" bindinput="get" no="0" data-left="{{left}}"/>
|
||||
</view>
|
||||
|
||||
<view class="shuru">
|
||||
<view class="left">{{left}}</view>
|
||||
<view class="right"wx:if="{{ifarrow}}" bindtap="choose">
|
||||
<text class="shurupla1">{{right}}</text>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
<view class="right" wx:else>
|
||||
<input type="text" placeholder-class="shurupla" class="shuru1" placeholder="{{right}}" value="" bindinput="get" no="0" data-left="{{left}}"/>
|
||||
</view>
|
||||
|
||||
</view>
|
@ -1,37 +1 @@
|
||||
.shuru {
|
||||
width: 670rpx;
|
||||
height: 100rpx;
|
||||
border-bottom: 2rpx solid #E8E8E8;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
line-height: 100rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.shuru .left {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.shuru .right {
|
||||
margin: auto 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.shuru .right .shuru1 {
|
||||
width: 280rpx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.shuru .right .shurupla {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.shuru .right .arrow {
|
||||
width: 14rpx;
|
||||
height: 25rpx;
|
||||
background-color: #999999;
|
||||
margin: auto 0;
|
||||
margin-left: 27rpx;
|
||||
}
|
||||
.shuru{width:670rpx;height:100rpx;border-bottom:2rpx solid #E8E8E8;margin:0 auto;display:flex;justify-content:space-between;line-height:100rpx;font-size:28rpx}.shuru .left{color:#333333}.shuru .right{margin:auto 0;display:flex}.shuru .right .shuru1{width:280rpx;text-align:right}.shuru .right .shurupla{color:#999999;font-size:28rpx}.shuru .right .shurupla1{color:#333333}.shuru .right .arrow{width:14rpx;height:25rpx;background-color:#999999;margin:auto 0;margin-left:27rpx}
|
||||
|
@ -1 +1 @@
|
||||
.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce .towline{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}
|
||||
.list{padding-left:20rpx;width:572rpx;box-sizing:border-box;height:100vh}.list .commodity{width:552rpx;display:flex;align-items:center}.list .commodity .content{width:552rpx;height:100%;display:flex;align-items:center;border-bottom:2rpx solid #eaeaea;padding:30rpx 0}.list .commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.list .commodity .content .introduce{width:336rpx;margin-left:40rpx;display:flex;flex-direction:column}.list .commodity .content .introduce .towline{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.list .commodity .content .introduce>text{font-size:22rpx;color:#333;margin-bottom:22rpx}.list .commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.list .commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.list .commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}
|
||||
|
@ -1 +1 @@
|
||||
.navigation{width:188rpx;border-right:2rpx solid #eaeaea;max-height:100vh}.navigation view{height:97rpx;font-size:28rpx;color:#333;border-bottom:2rpx solid #eaeaea;line-height:97rpx;font-weight:bold;text-align:center;box-sizing:border-box}.navigation .on{border-left:5rpx solid #56CC84;color:#56CC84}
|
||||
.navigation{width:188rpx;border-right:2rpx solid #eaeaea;max-height:100vh}.navigation view{height:97rpx;font-size:28rpx;color:#333;border-bottom:2rpx solid #eaeaea;line-height:97rpx;font-weight:bold;text-align:center;box-sizing:border-box}.navigation .on{border-left:5rpx solid #56CC84;color:#56CC84}
|
||||
|
@ -1 +1 @@
|
||||
.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e}
|
||||
.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e}
|
||||
|
@ -1 +1 @@
|
||||
.list{width:623rpx;margin-top:36rpx}.list .title{font-size:30rpx;color:#333;font-weight:bold;margin-left:32rpx}
|
||||
.list{width:623rpx;margin-top:36rpx}.list .title{font-size:30rpx;color:#333;font-weight:bold;margin-left:32rpx}
|
||||
|
@ -1 +1 @@
|
||||
.search{width:613rpx;height:76rpx;margin-top:30rpx;box-sizing:border-box;border-radius:15rpx;display:flex;border:1rpx solid #c6c6c6}.search>image{width:42rpx;height:42rpx;background-color:#000;margin-left:40rpx;margin-top:17rpx}.search>input{height:30rpx;width:480rpx;margin-top:20rpx;margin-left:17rpx;font-size:30rpx}
|
||||
.search{width:613rpx;height:76rpx;margin-top:30rpx;box-sizing:border-box;border-radius:15rpx;display:flex;border:1rpx solid #c6c6c6}.search>image{width:42rpx;height:42rpx;background-color:#000;margin-left:40rpx;margin-top:17rpx}.search>input{height:30rpx;width:480rpx;margin-top:20rpx;margin-left:17rpx;font-size:30rpx}
|
||||
|
@ -13,4 +13,4 @@
|
||||
<!-- <view class="button" catch:tap="cancel">取消订单</view> -->
|
||||
<view class="button hlight" catch:tap="shouhuo">确认收货</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -1 +1 @@
|
||||
.commodity{margin-top:20rpx;background-color:#fff}.commodity .message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.commodity .message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.commodity .message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.commodity .message .introduce .title{font-size:28rpx;color:#333}.commodity .message .introduce .count{font-size:24rpx;color:#999;display:flex}.commodity .message .introduce .count>view{margin-right:27rpx}.commodity .message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.commodity .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #F2F2F2}.commodity .aggregate>text{color:#333;margin:0 5rpx}.commodity .operation{height:84rpx;display:flex;justify-content:flex-end;padding:0 30rpx;align-items:center}.commodity .operation .button{width:133rpx;height:51rpx;border:2rpx solid #999999;border-radius:26rpx;text-align:center;font-size:22rpx;color:#999999;line-height:51rpx;margin-right:8rpx}.commodity .operation .hlight{border:2rpx solid #47c877;color:#47C877}
|
||||
.commodity{margin-top:20rpx;background-color:#fff}.commodity .message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.commodity .message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.commodity .message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.commodity .message .introduce .title{font-size:28rpx;color:#333}.commodity .message .introduce .count{font-size:24rpx;color:#999;display:flex}.commodity .message .introduce .count>view{margin-right:27rpx}.commodity .message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.commodity .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #F2F2F2}.commodity .aggregate>text{color:#333;margin:0 5rpx}.commodity .operation{height:84rpx;display:flex;justify-content:flex-end;padding:0 30rpx;align-items:center}.commodity .operation .button{width:133rpx;height:51rpx;border:2rpx solid #999999;border-radius:26rpx;text-align:center;font-size:22rpx;color:#999999;line-height:51rpx;margin-right:8rpx}.commodity .operation .hlight{border:2rpx solid #47c877;color:#47C877}
|
||||
|
@ -14,4 +14,4 @@
|
||||
<van-tab title="售后">
|
||||
<commodity wx:for="{{AFTERSALE}}" wx:for-index="j" wx:key="{{j}}" data-id="{{item.order_id}}" num="{{item.goods_num}}" cprice="{{item.goods_price}}" freight="{{item.integral_money}}" goods="{{item.goods_list}}"></commodity>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</van-tabs>
|
||||
|
@ -1 +1 @@
|
||||
.content{background-color:#fff;width:750rpx;padding-bottom:33rpx}.content .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #f2f2f2}.content .aggregate>text{color:#333;margin:0 5rpx}.content .message{display:flex;padding:0 30rpx;justify-content:space-between;font-size:26rpx;color:#333;align-items:center;height:77rpx;border-bottom:1rpx solid #f2f2f2}.content .leave{display:flex;height:77rpx;padding:0 30rpx;align-items:center}
|
||||
.content{background-color:#fff;width:750rpx;padding-bottom:33rpx}.content .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #f2f2f2}.content .aggregate>text{color:#333;margin:0 5rpx}.content .message{display:flex;padding:0 30rpx;justify-content:space-between;font-size:26rpx;color:#333;align-items:center;height:77rpx;border-bottom:1rpx solid #f2f2f2}.content .leave{display:flex;height:77rpx;padding:0 30rpx;align-items:center}
|
||||
|
@ -1 +1 @@
|
||||
.logistics{margin-top:20rpx;background-color:#fff}.logistics .title{height:84rpx;font-size:28rpx;color:#333;line-height:84rpx;border-bottom:2rpx solid #e5e5e5;padding-left:29rpx;box-sizing:border-box}.logistics .schedule{width:650rpx;margin-left:50rpx}
|
||||
.logistics{margin-top:20rpx;background-color:#fff}.logistics .title{height:84rpx;font-size:28rpx;color:#333;line-height:84rpx;border-bottom:2rpx solid #e5e5e5;padding-left:29rpx;box-sizing:border-box}.logistics .schedule{width:650rpx;margin-left:50rpx}
|
||||
|
@ -1 +1 @@
|
||||
.orderchooseaddr{background-color:#fff;width:750rpx;height:148rpx;margin:0 auto;border-bottom:20rpx solid #fbfbfb;display:flex;justify-content:space-between}.orderchooseaddr .left{width:572rpx;height:80rpx}.orderchooseaddr .left .userinfo{color:#333333;font-size:26rpx;text-indent:30rpx;margin-top:41rpx;display:flex;justify-content:space-between}.orderchooseaddr .left .addr{color:#999999;font-size:24rpx;text-indent:30rpx;margin-top:32rpx}.orderchooseaddr .right{width:17rpx;height:30rpx;background-color:#d3d3d3;margin:auto 0;margin-right:19rpx}
|
||||
.orderchooseaddr{background-color:#fff;width:750rpx;height:148rpx;margin:0 auto;border-bottom:20rpx solid #fbfbfb;display:flex;justify-content:space-between}.orderchooseaddr .left{width:572rpx;height:80rpx}.orderchooseaddr .left .userinfo{color:#333333;font-size:26rpx;text-indent:30rpx;margin-top:41rpx;display:flex;justify-content:space-between}.orderchooseaddr .left .addr{color:#999999;font-size:24rpx;text-indent:30rpx;margin-top:32rpx}.orderchooseaddr .right{width:17rpx;height:30rpx;background-color:#d3d3d3;margin:auto 0;margin-right:19rpx}
|
||||
|
@ -1 +1 @@
|
||||
.payment{width:750rpx;height:98rpx;position:fixed;bottom:0;display:flex;justify-content:space-between;background-color:#fff;align-items:center}.payment .price{font-size:34rpx;margin-left:74rpx}.payment .price .title{color:#333}.payment .price .counts{color:#ff3838}.payment .submit{width:250rpx;height:98rpx;background-color:#47c877;font-size:30rpx;color:#fff;line-height:98rpx;text-align:center}
|
||||
.payment{width:750rpx;height:98rpx;position:fixed;bottom:0;display:flex;justify-content:space-between;background-color:#fff;align-items:center}.payment .price{font-size:34rpx;margin-left:74rpx}.payment .price .title{color:#333}.payment .price .counts{color:#ff3838}.payment .submit{width:250rpx;height:98rpx;background-color:#47c877;font-size:30rpx;color:#fff;line-height:98rpx;text-align:center}
|
||||
|
@ -1 +1 @@
|
||||
.merchandise{padding:46rpx 32rpx;display:flex;border-bottom:20rpx solid #fbfbfb}.merchandise .image{width:171rpx;height:168rpx;background-color:#000}.merchandise .message{margin-left:24rpx}.merchandise .message .title{font-size:26rpx;color:#333;width:491rpx;margin-bottom:9rpx}.merchandise .message .brief{font-size:22rpx;color:#999;margin-bottom:26rpx}.merchandise .message .price{font-size:28rpx;color:#ff4e6c}
|
||||
.merchandise{padding:46rpx 32rpx;display:flex;border-bottom:20rpx solid #fbfbfb}.merchandise .image{width:171rpx;height:168rpx;background-color:#000}.merchandise .message{margin-left:24rpx}.merchandise .message .title{font-size:26rpx;color:#333;width:491rpx;margin-bottom:9rpx}.merchandise .message .brief{font-size:22rpx;color:#999;margin-bottom:26rpx}.merchandise .message .price{font-size:28rpx;color:#ff4e6c}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/accomplish/accomplish.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/accomplish/accomplish.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index",
|
||||
"logistics": "../components/particulars/logistics/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index",
|
||||
"logistics": "../components/particulars/logistics/index"
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<view class="box">
|
||||
<orderchooseaddr></orderchooseaddr>
|
||||
<content></content>
|
||||
<logistics></logistics>
|
||||
<view class="box">
|
||||
<orderchooseaddr></orderchooseaddr>
|
||||
<content></content>
|
||||
<logistics></logistics>
|
||||
</view>
|
@ -1 +1 @@
|
||||
page{background-color:#fbfbfb}
|
||||
page{background-color:#fbfbfb}
|
||||
|
@ -1,170 +1,282 @@
|
||||
// pages/addaddress/addaddress.js
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
canshu: [],
|
||||
no: 0,
|
||||
userid:"",
|
||||
show: false,
|
||||
arealist:[],
|
||||
area:["请选择","请选择","请选择"]
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:0
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
arealist:res.data.result
|
||||
})
|
||||
console.log(this.data.arealist)
|
||||
})
|
||||
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
console.log(e)
|
||||
},
|
||||
showPopup() {
|
||||
this.setData({ show: true });
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.setData({ show: false });
|
||||
},
|
||||
onMyEvent(e) {
|
||||
console.log(e)
|
||||
for (let i = 0; i < 8; i++) {
|
||||
if (i == e.currentTarget.dataset.no) {
|
||||
this.data.canshu[i] = e.detail
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
console.log(this.data.canshu)
|
||||
},
|
||||
choose(e){
|
||||
console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset)
|
||||
let type=parseInt(e.currentTarget.dataset.type)
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
if(res.data.result.length){
|
||||
this.setData({
|
||||
arealist1:res.data.result
|
||||
})
|
||||
// this.data.area[type]=e.currentTarget.dataset.name
|
||||
|
||||
console.log(this.data.area,123)
|
||||
|
||||
}
|
||||
// for(let i in this.data.area){
|
||||
// if(i==type){
|
||||
// this.data.area[i]=e.currentTarget.dataset.name
|
||||
// }
|
||||
// }
|
||||
this.data.area[0]=e.currentTarget.dataset.name
|
||||
|
||||
console.log(this.data.area,this.data.arealist)
|
||||
})
|
||||
},
|
||||
save() {
|
||||
// wx.navigateTo({
|
||||
// url: "/pages/chooseaddr/chooseaddr"
|
||||
// })
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
console.log(res,1452)
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/addAddress",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
method:"POST",
|
||||
data: {
|
||||
address: "Wesrdtfyguhijkl",
|
||||
city: "339",
|
||||
consignee: "srdtfyguhijokl",
|
||||
country: 1,
|
||||
district: "361",
|
||||
is_default: 0,
|
||||
mobile: "19953879035",
|
||||
province: "338",
|
||||
twon: 0,
|
||||
user_id: "9",
|
||||
zipcode: "271103",
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/addaddress/addaddress.js
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
canshu: [],
|
||||
no: 0,
|
||||
userid:"",
|
||||
show: false,
|
||||
arealist1:[],
|
||||
arealist2:[],
|
||||
arealist3:[],
|
||||
area:["请选择","请选择","请选择"],
|
||||
tagDis:[false,true,true],
|
||||
active:0,
|
||||
addressCity:"请选择 请选择 请选择",
|
||||
countrys:[],
|
||||
countryid:44,
|
||||
nowcountry:"中国",
|
||||
areaid:[]
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:0
|
||||
},
|
||||
|
||||
}).then((res)=>{
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
arealist1:res.data.result
|
||||
})
|
||||
console.log(this.data.arealist)
|
||||
})
|
||||
|
||||
request({
|
||||
url: "User/getCountry",
|
||||
}).then((res)=>{
|
||||
let country=[]
|
||||
console.log(res,10000)
|
||||
for(let i=0;i<res.data.result.length;i++){
|
||||
country[i]=res.data.result[i].name
|
||||
}
|
||||
this.setData({
|
||||
countrys:country
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
console.log(e.detail.value)
|
||||
let nowcountry=this.data.countrys[e.detail.value]
|
||||
this.setData({
|
||||
countryid:e.detail.value+1,
|
||||
nowcountry:nowcountry
|
||||
})
|
||||
console.log(nowcountry,"zxc")
|
||||
},
|
||||
showPopup() {
|
||||
this.setData({ show: true });
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.setData({ show: false });
|
||||
},
|
||||
onMyEvent(e) {
|
||||
// console.log(e)
|
||||
for (let i = 0; i < 8; i++) {
|
||||
if (i == e.currentTarget.dataset.no) {
|
||||
this.data.canshu[i] = e.detail
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log(this.data.canshu)
|
||||
},
|
||||
choose1(e){
|
||||
// console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset)
|
||||
let type=parseInt(e.currentTarget.dataset.type)
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
arealist2:res.data.result,
|
||||
active:1
|
||||
})
|
||||
// this.data.area[type]=e.currentTarget.dataset.name
|
||||
this.setData({
|
||||
tagDis:[false,false,true]
|
||||
})
|
||||
// console.log(this.data.area,123)
|
||||
this.data.area[0]=e.currentTarget.dataset.name
|
||||
this.data.areaid[0]=e.currentTarget.dataset.id
|
||||
// for(let i in this.data.area){
|
||||
// if(i==type){
|
||||
// this.data.area[i]=e.currentTarget.dataset.name
|
||||
// }
|
||||
// }
|
||||
this.setData({
|
||||
area:this.data.area
|
||||
})
|
||||
|
||||
// console.log(this.data.area,this.data.arealist)
|
||||
})
|
||||
},
|
||||
choose2(e){
|
||||
// console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset)
|
||||
let type=parseInt(e.currentTarget.dataset.type)
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
|
||||
this.setData({
|
||||
arealist3:res.data.result,
|
||||
active:2,
|
||||
tagDis:[false,false,false]
|
||||
})
|
||||
|
||||
// this.data.area[type]=e.currentTarget.dataset.name
|
||||
|
||||
// console.log(this.data.area,123)
|
||||
|
||||
this.data.area[1]=e.currentTarget.dataset.name
|
||||
this.data.areaid[1]=e.currentTarget.dataset.id
|
||||
// for(let i in this.data.area){
|
||||
// if(i==type){
|
||||
// this.data.area[i]=e.currentTarget.dataset.name
|
||||
// }
|
||||
// }
|
||||
|
||||
this.setData({
|
||||
area:this.data.area
|
||||
})
|
||||
|
||||
// console.log(this.data.area,this.data.arealist)
|
||||
console.log(this.data.arealist3+"001",this.data.active+"002",this.data.tagDis+"003")
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
choose3(e){
|
||||
// console.log(e.currentTarget.dataset.id,e.currentTarget.dataset.name,e.currentTarget.dataset)
|
||||
let type=parseInt(e.currentTarget.dataset.type)
|
||||
request({
|
||||
url: "User/getArea",
|
||||
urldata:{
|
||||
parent_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
arealist1:res.data.result,
|
||||
tagDis:[false,false,false],
|
||||
active:1
|
||||
})
|
||||
// this.data.area[type]=e.currentTarget.dataset.name
|
||||
|
||||
// console.log(this.data.area,123)
|
||||
|
||||
this.data.area[2]=e.currentTarget.dataset.name
|
||||
this.data.areaid[2]=e.currentTarget.dataset.id
|
||||
// for(let i in this.data.area){
|
||||
// if(i==type){
|
||||
// this.data.area[i]=e.currentTarget.dataset.name
|
||||
// }
|
||||
// }}
|
||||
console.log(93)
|
||||
this.setData({
|
||||
area:this.data.area,
|
||||
show: false,
|
||||
addressCity:this.data.area[0]+this.data.area[1]+this.data.area[2]
|
||||
})
|
||||
console.log(this.data.active,94)
|
||||
// console.log(this.data.area,this.data.arealist)
|
||||
})
|
||||
},
|
||||
save() {
|
||||
// wx.navigateTo({
|
||||
// url: "/pages/chooseaddr/chooseaddr"
|
||||
// })
|
||||
console.log(this.data.canshu)
|
||||
console.log(this.data.countryid)
|
||||
console.log(this.data.area)
|
||||
console.log(this.data.areaid)
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
console.log(res,1452)
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/addAddress",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
method:"POST",
|
||||
data: {
|
||||
// address: this.data.canshu[4],
|
||||
city: this.data.areaid[1],
|
||||
consignee: this.data.canshu[0],
|
||||
country: this.data.countryid,
|
||||
address: this.data.canshu[4],
|
||||
is_default: 0,
|
||||
mobile: this.data.canshu[1],
|
||||
province: this.data.areaid[0],
|
||||
twon: this.data.areaid[2],
|
||||
user_id:this.data.userid,
|
||||
zipcode: this.data.canshu[5],
|
||||
idcard: this.data.canshu[6],
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,42 +1,42 @@
|
||||
<view class="addaddress">
|
||||
<shuru left="收件人" right="姓名需和身份证一致" bindmyevent="onMyEvent" data-no="0"></shuru>
|
||||
<shuru left="手机号" right="请填入常用的手机号码" bindmyevent="onMyEvent" data-no="1"></shuru>
|
||||
<picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
||||
<shuru left="国家" right="CN中国大陆" ifarrow="{{true}}" data-no="2"></shuru>
|
||||
</picker>
|
||||
<!-- <picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
||||
<shuru left="城市信息" right="北京市 北京市 东城区" ifarrow="{{true}}" data-no="3"></shuru>
|
||||
</picker> -->
|
||||
<view bindtap="showPopup">
|
||||
<shuru left="城市信息" right="北京市 北京市 东城区" ifarrow="{{true}}" data-no="3"></shuru>
|
||||
</view>
|
||||
<van-popup show="{{ show }}" position="bottom" bind:close="onClose">
|
||||
<van-tabs class="tab" swipe-threshold="5">
|
||||
<van-tab title="{{area[0]}}">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist}}" bindtap="choose" data-type="0" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
<van-tab title="{{area[1]}}">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist1}}" data-type="1" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
<van-tab title="{{area[2]}}">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist2}}" data-type="2" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</van-popup>
|
||||
<shuru left="街道地址" right="街道地址" bindmyevent="onMyEvent" data-no="4"></shuru>
|
||||
<shuru left="邮政编码" right="邮政编码" bindmyevent="onMyEvent" data-no="5"></shuru>
|
||||
<shuru left="身份证号" right="可为空,部分商品需要" bindmyevent="onMyEvent" data-no="6"></shuru>
|
||||
<addradd text="保存地址" class="btn1" bindtap="save"></addradd>
|
||||
<view class="addaddress">
|
||||
<shuru left="收件人" right="姓名需和身份证一致" bindmyevent="onMyEvent" data-no="0"></shuru>
|
||||
<shuru left="手机号" right="请填入常用的手机号码" bindmyevent="onMyEvent" data-no="1"></shuru>
|
||||
<picker bindchange="bindPickerChange" value="{{index}}" range="{{countrys}}">
|
||||
<shuru left="国家" right="{{nowcountry}}" ifarrow="{{true}}" data-no="2"></shuru>
|
||||
</picker>
|
||||
<!-- <picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
||||
<shuru left="城市信息" right="北京市 北京市 东城区" ifarrow="{{true}}" data-no="3"></shuru>
|
||||
</picker> -->
|
||||
<view bindtap="showPopup">
|
||||
<shuru left="城市信息" right="{{addressCity}}" ifarrow="{{true}}" data-no="3"></shuru>
|
||||
</view>
|
||||
<van-popup show="{{ show }}" position="bottom" bind:close="onClose" >
|
||||
<van-tabs class="tab" swipe-threshold="5" active="{{active}}">
|
||||
<van-tab title="{{area[0]}}" disabled="{{tagDis[0]}}">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist1}}" bindtap="choose1" data-type="0" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
<van-tab title="{{area[1]}}" disabled="{{tagDis[1]}}" bingtap="choose2">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist2}}" bindtap="choose2" data-type="1" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
<van-tab title="{{area[2]}}" disabled="{{tagDis[2]}}">
|
||||
<view class="choose">
|
||||
<view class="item" wx:for="{{arealist3}}" bindtap="choose3" data-type="2" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</van-popup>
|
||||
<shuru left="街道地址" right="街道地址" bindmyevent="onMyEvent" data-no="4"></shuru>
|
||||
<shuru left="邮政编码" right="邮政编码" bindmyevent="onMyEvent" data-no="5"></shuru>
|
||||
<shuru left="身份证号" right="可为空,部分商品需要" bindmyevent="onMyEvent" data-no="6"></shuru>
|
||||
<addradd text="保存地址" class="btn1" bindtap="save"></addradd>
|
||||
</view>
|
@ -1,159 +1,164 @@
|
||||
// pages/chooseaddr/chooseaddr.js
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
addresslist:[],
|
||||
userid:""
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
add() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/addaddress/addaddress"
|
||||
})
|
||||
},
|
||||
// user_id/8/id/215
|
||||
delete(e){
|
||||
let t=this
|
||||
wx.showModal({
|
||||
title: '确认',
|
||||
content: '要删除这个地址吗?',
|
||||
success(){
|
||||
|
||||
|
||||
console.log(e.currentTarget.dataset.id)
|
||||
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
t.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/del_address",
|
||||
urldata:{
|
||||
user_id:res.data.data.user_id,
|
||||
id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:t.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
t.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
setdefault(e){
|
||||
console.log(e.currentTarget.dataset.id)
|
||||
request({
|
||||
url: "User/setDefaultAddress",
|
||||
urldata:{
|
||||
user_id:this.data.userid,
|
||||
address_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
|
||||
}
|
||||
// pages/chooseaddr/chooseaddr.js
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
addresslist:[],
|
||||
userid:""
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
add() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/addaddress/addaddress"
|
||||
})
|
||||
},
|
||||
// user_id/8/id/215
|
||||
delete(e){
|
||||
let t=this
|
||||
wx.showModal({
|
||||
title: '确认',
|
||||
content: '要删除这个地址吗?',
|
||||
success(res){
|
||||
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
request({
|
||||
url: "User/validateOpenid",
|
||||
}).then((res)=>{
|
||||
t.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
request({
|
||||
url: "User/del_address",
|
||||
urldata:{
|
||||
user_id:res.data.data.user_id,
|
||||
id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:t.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
t.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
console.log("不能动啊")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
setdefault(e){
|
||||
console.log(e.currentTarget.dataset.id)
|
||||
request({
|
||||
url: "User/setDefaultAddress",
|
||||
urldata:{
|
||||
user_id:this.data.userid,
|
||||
address_id:e.currentTarget.dataset.id
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
request({
|
||||
url: "User/getAddressList",
|
||||
urldata:{
|
||||
user_id:this.data.userid
|
||||
},
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
addresslist:res.data.result
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
|
||||
}
|
||||
})
|
@ -1,4 +1,7 @@
|
||||
.chooseaddress {
|
||||
.box{
|
||||
height: 910rpx
|
||||
}
|
||||
.addr {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
<view class="chooseaddress">
|
||||
<view class="addr" wx:for="{{addresslist}}">
|
||||
<address binddelete="delete" binddefault="setdefault"data-id="{{item.address_id}}" username="{{item.consignee}}" address="{{item.address}}" tel="{{item.mobile}}" youzheng="{{item.zipcode}}" isdefault="{{item.is_default}}"></address>
|
||||
</view>
|
||||
<!-- <view class="addr">
|
||||
<address></address>
|
||||
</view>
|
||||
<view class="addr">
|
||||
<address></address>
|
||||
</view> -->
|
||||
<view class="btn1" bindtap="add">
|
||||
<addradd text="添加地址"></addradd>
|
||||
</view>
|
||||
<view class="chooseaddress">
|
||||
<scroll-view class="box" scroll-y="{{true}}">
|
||||
<view class="addr" wx:for="{{addresslist}}">
|
||||
<address binddelete="delete" binddefault="setdefault"data-id="{{item.address_id}}" username="{{item.consignee}}" address="{{item.address}}" tel="{{item.mobile}}" youzheng="{{item.zipcode}}" isdefault="{{item.is_default}}"></address>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- <view class="addr">
|
||||
<address></address>
|
||||
</view>
|
||||
<view class="addr">
|
||||
<address></address>
|
||||
</view> -->
|
||||
<view class="btn1" bindtap="add">
|
||||
<addradd text="添加地址"></addradd>
|
||||
</view>
|
||||
</view>
|
@ -1,9 +1 @@
|
||||
.chooseaddress .addr {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.chooseaddress .btn1 {
|
||||
position: fixed;
|
||||
bottom: 149rpx;
|
||||
left: 50rpx;
|
||||
}
|
||||
.chooseaddress .box{height:910rpx}.chooseaddress .addr{margin-left:30rpx}.chooseaddress .btn1{position:fixed;bottom:149rpx;left:50rpx}
|
||||
|
@ -1 +1 @@
|
||||
.box{width:750rpx;display:flex;border-top:1rpx solid #eaeaea}
|
||||
.box{width:750rpx;display:flex;border-top:1rpx solid #eaeaea}
|
||||
|
@ -1,22 +1,22 @@
|
||||
import {request} from "../../utils/bin"
|
||||
Page({
|
||||
data:{
|
||||
list:[]
|
||||
},
|
||||
onLoad(){
|
||||
request({
|
||||
url:"Goods/hotGoodsList",
|
||||
data:{
|
||||
page:0
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res.data.result)
|
||||
this.setData({
|
||||
list:res.data.result
|
||||
})
|
||||
})
|
||||
},
|
||||
searchs(){
|
||||
console.log(10)
|
||||
}
|
||||
})
|
||||
import {request} from "../../utils/bin"
|
||||
Page({
|
||||
data:{
|
||||
list:[]
|
||||
},
|
||||
onLoad(){
|
||||
request({
|
||||
url:"Goods/hotGoodsList",
|
||||
data:{
|
||||
page:0
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res.data.result)
|
||||
this.setData({
|
||||
list:res.data.result
|
||||
})
|
||||
})
|
||||
},
|
||||
searchs(){
|
||||
console.log(10)
|
||||
}
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
<view class="box">
|
||||
<search bind:tap="searchs"></search>
|
||||
<list list="{{list}}"></list>
|
||||
<view class="box">
|
||||
<search bind:tap="searchs"></search>
|
||||
<list list="{{list}}"></list>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column}
|
||||
.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column}
|
||||
|
@ -1,123 +1,123 @@
|
||||
// pages/login/login.js
|
||||
import {request} from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
getinfo(a){
|
||||
request({
|
||||
url:"User/validateOpenid"
|
||||
}).then((res)=>{
|
||||
if(res.data.code == 400){
|
||||
request({
|
||||
url:"User/register",
|
||||
data:{
|
||||
country:"",
|
||||
gender:0,
|
||||
nick_name:a.detail.userInfo.nickName,
|
||||
province:"",
|
||||
city:"",
|
||||
head_pic:a.detail.userInfo.avatarUrl,
|
||||
open_id: wx.getStorageSync("openid"),
|
||||
|
||||
}
|
||||
}).then((res)=>{
|
||||
if(res.data.code == 200){
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
login(a){
|
||||
console.log(a)
|
||||
let i = this
|
||||
wx.login({
|
||||
success (res) {
|
||||
if (res.code) {
|
||||
//发起网络请求
|
||||
request({
|
||||
url:"User/getopenId",
|
||||
data:{
|
||||
js_code:res.code
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
wx.setStorageSync("openid",res.data.openid)
|
||||
i.getinfo(a)
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/login/login.js
|
||||
import {request} from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
getinfo(a){
|
||||
request({
|
||||
url:"User/validateOpenid"
|
||||
}).then((res)=>{
|
||||
if(res.data.code == 400){
|
||||
request({
|
||||
url:"User/register",
|
||||
data:{
|
||||
country:"",
|
||||
gender:0,
|
||||
nick_name:a.detail.userInfo.nickName,
|
||||
province:"",
|
||||
city:"",
|
||||
head_pic:a.detail.userInfo.avatarUrl,
|
||||
open_id: wx.getStorageSync("openid"),
|
||||
|
||||
}
|
||||
}).then((res)=>{
|
||||
if(res.data.code == 200){
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
login(a){
|
||||
console.log(a)
|
||||
let i = this
|
||||
wx.login({
|
||||
success (res) {
|
||||
if (res.code) {
|
||||
//发起网络请求
|
||||
request({
|
||||
url:"User/getopenId",
|
||||
data:{
|
||||
js_code:res.code
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
wx.setStorageSync("openid",res.data.openid)
|
||||
i.getinfo(a)
|
||||
wx.switchTab({
|
||||
url:"/pages/index/index"
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
<view>
|
||||
<button open-type="getUserInfo" bindgetuserinfo="login">登录</button>
|
||||
<view>
|
||||
<button open-type="getUserInfo" bindgetuserinfo="login">登录</button>
|
||||
</view>
|
@ -1,66 +1,66 @@
|
||||
// pages/message/message.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/message/message.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,29 +1,29 @@
|
||||
<view class="box">
|
||||
<view class="list">
|
||||
<view class="information">
|
||||
<text>姓名</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>联系电话</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>邮箱</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>护照奥马</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="upload">
|
||||
<text class="title">护照正反面照片</text>
|
||||
<view class="files">
|
||||
<image></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit">
|
||||
保存
|
||||
</view>
|
||||
<view class="box">
|
||||
<view class="list">
|
||||
<view class="information">
|
||||
<text>姓名</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>联系电话</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>邮箱</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="information">
|
||||
<text>护照奥马</text>
|
||||
<input type="text" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="upload">
|
||||
<text class="title">护照正反面照片</text>
|
||||
<view class="files">
|
||||
<image></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit">
|
||||
保存
|
||||
</view>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{display:flex;flex-direction:column;align-items:center}.box .list{width:650rpx}.box .list .information{margin-top:43rpx;display:flex;flex-direction:column;font-size:28rpx;color:#333;border-bottom:1rpx solid #eaeaea;justify-content:space-between}.box .list .information>input{height:28rpx;font-size:28rpx;color:#333}.box .upload{width:650rpx;margin-top:42rpx}.box .upload .title{font-size:26rpx;color:#999}.box .upload .files{margin-top:42rpx;width:195rpx;height:195rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1)}.box .upload .files>image{width:50rpx;height:41rpx;background-color:#000;margin:77rpx 73rpx}.box .submit{margin-top:295rpx;width:650rpx;height:98rpx;background-color:#47C877;border-radius:49rpx;font-size:36rpx;line-height:98rpx;text-align:center;color:#fff}
|
||||
.box{display:flex;flex-direction:column;align-items:center}.box .list{width:650rpx}.box .list .information{margin-top:43rpx;display:flex;flex-direction:column;font-size:28rpx;color:#333;border-bottom:1rpx solid #eaeaea;justify-content:space-between}.box .list .information>input{height:28rpx;font-size:28rpx;color:#333}.box .upload{width:650rpx;margin-top:42rpx}.box .upload .title{font-size:26rpx;color:#999}.box .upload .files{margin-top:42rpx;width:195rpx;height:195rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1)}.box .upload .files>image{width:50rpx;height:41rpx;background-color:#000;margin:77rpx 73rpx}.box .submit{margin-top:295rpx;width:650rpx;height:98rpx;background-color:#47C877;border-radius:49rpx;font-size:36rpx;line-height:98rpx;text-align:center;color:#fff}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/order/order.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/order/order.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +1,3 @@
|
||||
<view class="box">
|
||||
<tab style="width:100%"></tab>
|
||||
<view class="box">
|
||||
<tab style="width:100%"></tab>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{display:flex;flex-direction:column;align-items:center;width:100%}page{background-color:#efefef}
|
||||
.box{display:flex;flex-direction:column;align-items:center;width:100%}page{background-color:#efefef}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index",
|
||||
"submit":"../components/particulars/submit/index"
|
||||
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index",
|
||||
"submit":"../components/particulars/submit/index"
|
||||
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
page{background-color:#fbfbfb}
|
||||
page{background-color:#fbfbfb}
|
||||
|
@ -1 +1 @@
|
||||
.box{display:flex;flex-direction:column;align-items:center}.box .card{width:690rpx;height:313rpx;background-color:#47C877;display:flex;box-sizing:border-box;padding:50rpx;font-size:30rpx;flex-direction:column;color:#fff;margin-top:20rpx}.box .card .user{display:flex;align-items:center}.box .card .user .head{width:80rpx;height:80rpx;margin-right:32rpx;border-radius:50%;background-color:#fff}.box .card .balance{display:flex;flex-direction:column;margin-top:52rpx}.box .list{display:flex;width:690rpx;margin-top:33rpx;flex-direction:column}.box .list .option{width:100%;height:80rpx;margin-bottom:15rpx;box-sizing:border-box;padding:0 30rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1);display:flex;align-items:center;justify-content:space-between}
|
||||
.box{display:flex;flex-direction:column;align-items:center}.box .card{width:690rpx;height:313rpx;background-color:#47C877;display:flex;box-sizing:border-box;padding:50rpx;font-size:30rpx;flex-direction:column;color:#fff;margin-top:20rpx}.box .card .user{display:flex;align-items:center}.box .card .user .head{width:80rpx;height:80rpx;margin-right:32rpx;border-radius:50%;background-color:#fff}.box .card .balance{display:flex;flex-direction:column;margin-top:52rpx}.box .list{display:flex;width:690rpx;margin-top:33rpx;flex-direction:column}.box .list .option{width:100%;height:80rpx;margin-bottom:15rpx;box-sizing:border-box;padding:0 30rpx;box-shadow:2rpx 3rpx 16rpx 1rpx rgba(51,51,51,0.1);display:flex;align-items:center;justify-content:space-between}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index"
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
page{background-color:#fbfbfb}
|
||||
page{background-color:#fbfbfb}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/sales1/sales1.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/sales1/sales1.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"merchandise":"../components/seles/merchandises/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"merchandise":"../components/seles/merchandises/index"
|
||||
}
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
<view class="box">
|
||||
<merchandise></merchandise>
|
||||
<view class="fill">
|
||||
<view class="cause">
|
||||
<view class="title">退货原因</view>
|
||||
<view class="select">请选择 ></view>
|
||||
</view>
|
||||
<view class="upload">
|
||||
<view class="title">添加照片(选填)</view>
|
||||
<view class="img">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit">提交</view>
|
||||
<view class="box">
|
||||
<merchandise></merchandise>
|
||||
<view class="fill">
|
||||
<view class="cause">
|
||||
<view class="title">退货原因</view>
|
||||
<view class="select">请选择 ></view>
|
||||
</view>
|
||||
<view class="upload">
|
||||
<view class="title">添加照片(选填)</view>
|
||||
<view class="img">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit">提交</view>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{border-top:1rpx solid #eee}.box .fill{padding:42rpx 30rpx;box-sizing:border-box}.box .fill .cause{display:flex;justify-content:space-between;align-items:center;margin-bottom:45rpx}.box .fill .cause .title{font-size:26rpx;color:#333}.box .fill .cause .select{font-size:26rpx;color:#999}.box .fill .upload .title{font-size:26rpx;color:#333;margin-bottom:45rpx}.box .fill .upload .img{width:187rpx;height:187rpx;border:1rpx solid #e5e5e5;border-radius:6rpx}.box .submit{width:650rpx;height:98rpx;border-radius:49rpx;background-color:#47C877;line-height:98rpx;text-align:center;color:#fff;font-size:36rpx;margin-top:67rpx;margin-left:50rpx}
|
||||
.box{border-top:1rpx solid #eee}.box .fill{padding:42rpx 30rpx;box-sizing:border-box}.box .fill .cause{display:flex;justify-content:space-between;align-items:center;margin-bottom:45rpx}.box .fill .cause .title{font-size:26rpx;color:#333}.box .fill .cause .select{font-size:26rpx;color:#999}.box .fill .upload .title{font-size:26rpx;color:#333;margin-bottom:45rpx}.box .fill .upload .img{width:187rpx;height:187rpx;border:1rpx solid #e5e5e5;border-radius:6rpx}.box .submit{width:650rpx;height:98rpx;border-radius:49rpx;background-color:#47C877;line-height:98rpx;text-align:center;color:#fff;font-size:36rpx;margin-top:67rpx;margin-left:50rpx}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/sales2/sales2.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/sales2/sales2.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"usingComponents": { "merchandise":"../components/seles/merchandises/index"}
|
||||
{
|
||||
"usingComponents": { "merchandise":"../components/seles/merchandises/index"}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
<view class="box">
|
||||
<view class="info">
|
||||
<view class="title">等待商家处理</view>
|
||||
<view class="msg">请耐心等待</view>
|
||||
</view>
|
||||
<merchandise></merchandise>
|
||||
<view class="info">
|
||||
<view class="title">退货原因: 拍多/多拍/不想要</view>
|
||||
<view class="title">申请时间:2019-07-21 11:23:21</view>
|
||||
</view>
|
||||
<view class="submit">
|
||||
<view class="button">修改申请</view>
|
||||
<view class="button">取消申请</view>
|
||||
</view>
|
||||
<view class="box">
|
||||
<view class="info">
|
||||
<view class="title">等待商家处理</view>
|
||||
<view class="msg">请耐心等待</view>
|
||||
</view>
|
||||
<merchandise></merchandise>
|
||||
<view class="info">
|
||||
<view class="title">退货原因: 拍多/多拍/不想要</view>
|
||||
<view class="title">申请时间:2019-07-21 11:23:21</view>
|
||||
</view>
|
||||
<view class="submit">
|
||||
<view class="button">修改申请</view>
|
||||
<view class="button">取消申请</view>
|
||||
</view>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{border-top:1rpx solid #efefef}.box .info{border-bottom:1rpx solid #efefef;padding:29rpx;box-sizing:border-box}.box .info .title{font-size:26rpx;color:#333;margin-bottom:22rpx}.box .info .msg{font-size:24rpx;color:#999}.box .submit{display:flex;margin-top:36rpx;padding:0 30rpx;justify-content:flex-end}.box .submit .button{width:133rpx;height:51rpx;border:1rpx solid #47C877;border-radius:25rpx;color:#47C877;font-size:22rpx;line-height:51rpx;text-align:center;margin-left:8rpx}
|
||||
.box{border-top:1rpx solid #efefef}.box .info{border-bottom:1rpx solid #efefef;padding:29rpx;box-sizing:border-box}.box .info .title{font-size:26rpx;color:#333;margin-bottom:22rpx}.box .info .msg{font-size:24rpx;color:#999}.box .submit{display:flex;margin-top:36rpx;padding:0 30rpx;justify-content:flex-end}.box .submit .button{width:133rpx;height:51rpx;border:1rpx solid #47C877;border-radius:25rpx;color:#47C877;font-size:22rpx;line-height:51rpx;text-align:center;margin-left:8rpx}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/search/search.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/search/search.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"search":"../components/index/search/index",
|
||||
"hot":"../components/search/hot/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"search":"../components/index/search/index",
|
||||
"hot":"../components/search/hot/index"
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<view class="box">
|
||||
<search></search>
|
||||
<hot></hot>
|
||||
<view class="box">
|
||||
<search></search>
|
||||
<hot></hot>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column}
|
||||
.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column}
|
||||
|
@ -1,66 +1,66 @@
|
||||
// pages/status/status.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
// pages/status/status.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"logistics": "../components/particulars/logistics/index",
|
||||
"message":"../components/order/message/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"logistics": "../components/particulars/logistics/index",
|
||||
"message":"../components/order/message/index"
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<view class="box">
|
||||
<view class="reference">
|
||||
订单编号:1234567812345789
|
||||
<message></message>
|
||||
</view>
|
||||
<logistics></logistics>
|
||||
<view class="box">
|
||||
<view class="reference">
|
||||
订单编号:1234567812345789
|
||||
<message></message>
|
||||
</view>
|
||||
<logistics></logistics>
|
||||
</view>
|
@ -1 +1 @@
|
||||
.box .reference{font-size:24rpx;color:#999;padding:32rpx 20rpx;background-color:#fff}page{background-color:#fbfbfb}
|
||||
.box .reference{font-size:24rpx;color:#999;padding:32rpx 20rpx;background-color:#fff}page{background-color:#fbfbfb}
|
||||
|
@ -1,5 +1,8 @@
|
||||
// pages/undetermined/undetermined.js
|
||||
<<<<<<< HEAD
|
||||
import bin from "../../utils/bin"
|
||||
=======
|
||||
>>>>>>> 260785c6fe0a4997462040f4f8890f1da9a0deb6
|
||||
Page({
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index"
|
||||
}
|
||||
{
|
||||
"usingComponents": {
|
||||
"content":"../components/particulars/content/index",
|
||||
"orderchooseaddr":"../components/particulars/orderchooseaddr/index"
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
page{background-color:#FBFBFB}
|
||||
page{background-color:#FBFBFB}
|
||||
|
12
sitemap.json
12
sitemap.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
2
utils/dist/action-sheet/index.d.ts
vendored
2
utils/dist/action-sheet/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
118
utils/dist/action-sheet/index.js
vendored
118
utils/dist/action-sheet/index.js
vendored
@ -1,59 +1,59 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
show: Boolean,
|
||||
title: String,
|
||||
cancelText: String,
|
||||
description: String,
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 100
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
value: []
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickAction: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
const item = this.data.actions[index];
|
||||
if (item && !item.disabled && !item.loading) {
|
||||
this.$emit('select', item);
|
||||
if (this.data.closeOnClickAction) {
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close');
|
||||
},
|
||||
onClickOverlay() {
|
||||
this.$emit('click-overlay');
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
show: Boolean,
|
||||
title: String,
|
||||
cancelText: String,
|
||||
description: String,
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 100
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
value: []
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickAction: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
const item = this.data.actions[index];
|
||||
if (item && !item.disabled && !item.loading) {
|
||||
this.$emit('select', item);
|
||||
if (this.data.closeOnClickAction) {
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close');
|
||||
},
|
||||
onClickOverlay() {
|
||||
this.$emit('click-overlay');
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
16
utils/dist/action-sheet/index.json
vendored
16
utils/dist/action-sheet/index.json
vendored
@ -1,8 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-popup": "../popup/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-popup": "../popup/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
|
108
utils/dist/action-sheet/index.wxml
vendored
108
utils/dist/action-sheet/index.wxml
vendored
@ -1,54 +1,54 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
position="bottom"
|
||||
round="{{ round }}"
|
||||
z-index="{{ zIndex }}"
|
||||
overlay="{{ overlay }}"
|
||||
custom-class="van-action-sheet"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
bind:close="onClickOverlay"
|
||||
>
|
||||
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
|
||||
{{ title }}
|
||||
<van-icon
|
||||
name="close"
|
||||
custom-class="van-action-sheet__close"
|
||||
bind:click="onClose"
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{ description }}" class="van-action-sheet__description">
|
||||
{{ description }}
|
||||
</view>
|
||||
<view wx:if="{{ actions && actions.length }}">
|
||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.openType }}"
|
||||
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
|
||||
hover-class="van-action-sheet__item--hover"
|
||||
data-index="{{ index }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<block wx:if="{{ !item.loading }}">
|
||||
{{ item.name }}
|
||||
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
|
||||
</button>
|
||||
</view>
|
||||
<slot />
|
||||
<view
|
||||
wx:if="{{ cancelText }}"
|
||||
class="van-action-sheet__cancel"
|
||||
hover-class="van-action-sheet__cancel--hover"
|
||||
hover-stay-time="70"
|
||||
bind:tap="onCancel"
|
||||
>
|
||||
{{ cancelText }}
|
||||
</view>
|
||||
</van-popup>
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
position="bottom"
|
||||
round="{{ round }}"
|
||||
z-index="{{ zIndex }}"
|
||||
overlay="{{ overlay }}"
|
||||
custom-class="van-action-sheet"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
bind:close="onClickOverlay"
|
||||
>
|
||||
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
|
||||
{{ title }}
|
||||
<van-icon
|
||||
name="close"
|
||||
custom-class="van-action-sheet__close"
|
||||
bind:click="onClose"
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{ description }}" class="van-action-sheet__description">
|
||||
{{ description }}
|
||||
</view>
|
||||
<view wx:if="{{ actions && actions.length }}">
|
||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.openType }}"
|
||||
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
|
||||
hover-class="van-action-sheet__item--hover"
|
||||
data-index="{{ index }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<block wx:if="{{ !item.loading }}">
|
||||
{{ item.name }}
|
||||
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
|
||||
</button>
|
||||
</view>
|
||||
<slot />
|
||||
<view
|
||||
wx:if="{{ cancelText }}"
|
||||
class="van-action-sheet__cancel"
|
||||
hover-class="van-action-sheet__cancel--hover"
|
||||
hover-stay-time="70"
|
||||
bind:tap="onCancel"
|
||||
>
|
||||
{{ cancelText }}
|
||||
</view>
|
||||
</van-popup>
|
||||
|
2
utils/dist/area/index.d.ts
vendored
2
utils/dist/area/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
420
utils/dist/area/index.js
vendored
420
utils/dist/area/index.js
vendored
@ -1,210 +1,210 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
const COLUMNSPLACEHOLDERCODE = '000000';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}, columnsNum: {
|
||||
type: null,
|
||||
value: 3
|
||||
}, columnsPlaceholder: {
|
||||
type: Array,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
typeToColumnsPlaceholder: {
|
||||
province: val[0] || '',
|
||||
city: val[1] || '',
|
||||
county: val[2] || '',
|
||||
}
|
||||
});
|
||||
}
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
typeToColumnsPlaceholder: {}
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.code = value;
|
||||
this.setValues();
|
||||
},
|
||||
areaList: 'setValues',
|
||||
columnsNum(value) {
|
||||
this.setData({
|
||||
displayColumns: this.data.columns.slice(0, +value)
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.setValues();
|
||||
}, 0);
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
this.picker = this.selectComponent('.van-area__picker');
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
onCancel(event) {
|
||||
this.emit('cancel', event.detail);
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
let { value } = event.detail;
|
||||
value = this.parseOutputValues(value);
|
||||
this.emit('confirm', { value, index });
|
||||
},
|
||||
emit(type, detail) {
|
||||
detail.values = detail.value;
|
||||
delete detail.value;
|
||||
this.$emit(type, detail);
|
||||
},
|
||||
// parse output columns data
|
||||
parseOutputValues(values) {
|
||||
const { columnsPlaceholder } = this.data;
|
||||
return values.map((value, index) => {
|
||||
// save undefined value
|
||||
if (!value)
|
||||
return value;
|
||||
value = JSON.parse(JSON.stringify(value));
|
||||
if (!value.code || value.name === columnsPlaceholder[index]) {
|
||||
value.code = '';
|
||||
value.name = '';
|
||||
}
|
||||
return value;
|
||||
});
|
||||
},
|
||||
onChange(event) {
|
||||
const { index, picker, value } = event.detail;
|
||||
this.code = value[index].code;
|
||||
this.setValues().then(() => {
|
||||
this.$emit('change', {
|
||||
picker,
|
||||
values: this.parseOutputValues(picker.getValues()),
|
||||
index
|
||||
});
|
||||
});
|
||||
},
|
||||
getConfig(type) {
|
||||
const { areaList } = this.data;
|
||||
return (areaList && areaList[`${type}_list`]) || {};
|
||||
},
|
||||
getList(type, code) {
|
||||
const { typeToColumnsPlaceholder } = this.data;
|
||||
let result = [];
|
||||
if (type !== 'province' && !code) {
|
||||
return result;
|
||||
}
|
||||
const list = this.getConfig(type);
|
||||
result = Object.keys(list).map(code => ({
|
||||
code,
|
||||
name: list[code]
|
||||
}));
|
||||
if (code) {
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'city') {
|
||||
code = '9';
|
||||
}
|
||||
result = result.filter(item => item.code.indexOf(code) === 0);
|
||||
}
|
||||
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||
// set columns placeholder
|
||||
const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
|
||||
result.unshift({
|
||||
code: `${code}${codeFill}`,
|
||||
name: typeToColumnsPlaceholder[type]
|
||||
});
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getIndex(type, code) {
|
||||
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
|
||||
const list = this.getList(type, code.slice(0, compareNum - 2));
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'province') {
|
||||
compareNum = 1;
|
||||
}
|
||||
code = code.slice(0, compareNum);
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code.slice(0, compareNum) === code) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
setValues() {
|
||||
const county = this.getConfig('county');
|
||||
let { code } = this;
|
||||
if (!code) {
|
||||
if (this.data.columnsPlaceholder.length) {
|
||||
code = COLUMNSPLACEHOLDERCODE;
|
||||
}
|
||||
else if (Object.keys(county)[0]) {
|
||||
code = Object.keys(county)[0];
|
||||
}
|
||||
else {
|
||||
code = '';
|
||||
}
|
||||
}
|
||||
const province = this.getList('province');
|
||||
const city = this.getList('city', code.slice(0, 2));
|
||||
const picker = this.getPicker();
|
||||
if (!picker) {
|
||||
return;
|
||||
}
|
||||
const stack = [];
|
||||
stack.push(picker.setColumnValues(0, province, false));
|
||||
stack.push(picker.setColumnValues(1, city, false));
|
||||
if (city.length && code.slice(2, 4) === '00') {
|
||||
[{ code }] = city;
|
||||
}
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
return Promise.all(stack)
|
||||
.catch(() => { })
|
||||
.then(() => picker.setIndexes([
|
||||
this.getIndex('province', code),
|
||||
this.getIndex('city', code),
|
||||
this.getIndex('county', code)
|
||||
]))
|
||||
.catch(() => { });
|
||||
},
|
||||
getValues() {
|
||||
const picker = this.getPicker();
|
||||
return picker ? picker.getValues().filter(value => !!value) : [];
|
||||
},
|
||||
getDetail() {
|
||||
const values = this.getValues();
|
||||
const area = {
|
||||
code: '',
|
||||
country: '',
|
||||
province: '',
|
||||
city: '',
|
||||
county: ''
|
||||
};
|
||||
if (!values.length) {
|
||||
return area;
|
||||
}
|
||||
const names = values.map((item) => item.name);
|
||||
area.code = values[values.length - 1].code;
|
||||
if (area.code[0] === '9') {
|
||||
area.country = names[1] || '';
|
||||
area.province = names[2] || '';
|
||||
}
|
||||
else {
|
||||
area.province = names[0] || '';
|
||||
area.city = names[1] || '';
|
||||
area.county = names[2] || '';
|
||||
}
|
||||
return area;
|
||||
},
|
||||
reset(code) {
|
||||
this.code = code || '';
|
||||
return this.setValues();
|
||||
}
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
const COLUMNSPLACEHOLDERCODE = '000000';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}, columnsNum: {
|
||||
type: null,
|
||||
value: 3
|
||||
}, columnsPlaceholder: {
|
||||
type: Array,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
typeToColumnsPlaceholder: {
|
||||
province: val[0] || '',
|
||||
city: val[1] || '',
|
||||
county: val[2] || '',
|
||||
}
|
||||
});
|
||||
}
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
typeToColumnsPlaceholder: {}
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.code = value;
|
||||
this.setValues();
|
||||
},
|
||||
areaList: 'setValues',
|
||||
columnsNum(value) {
|
||||
this.setData({
|
||||
displayColumns: this.data.columns.slice(0, +value)
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.setValues();
|
||||
}, 0);
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
this.picker = this.selectComponent('.van-area__picker');
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
onCancel(event) {
|
||||
this.emit('cancel', event.detail);
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
let { value } = event.detail;
|
||||
value = this.parseOutputValues(value);
|
||||
this.emit('confirm', { value, index });
|
||||
},
|
||||
emit(type, detail) {
|
||||
detail.values = detail.value;
|
||||
delete detail.value;
|
||||
this.$emit(type, detail);
|
||||
},
|
||||
// parse output columns data
|
||||
parseOutputValues(values) {
|
||||
const { columnsPlaceholder } = this.data;
|
||||
return values.map((value, index) => {
|
||||
// save undefined value
|
||||
if (!value)
|
||||
return value;
|
||||
value = JSON.parse(JSON.stringify(value));
|
||||
if (!value.code || value.name === columnsPlaceholder[index]) {
|
||||
value.code = '';
|
||||
value.name = '';
|
||||
}
|
||||
return value;
|
||||
});
|
||||
},
|
||||
onChange(event) {
|
||||
const { index, picker, value } = event.detail;
|
||||
this.code = value[index].code;
|
||||
this.setValues().then(() => {
|
||||
this.$emit('change', {
|
||||
picker,
|
||||
values: this.parseOutputValues(picker.getValues()),
|
||||
index
|
||||
});
|
||||
});
|
||||
},
|
||||
getConfig(type) {
|
||||
const { areaList } = this.data;
|
||||
return (areaList && areaList[`${type}_list`]) || {};
|
||||
},
|
||||
getList(type, code) {
|
||||
const { typeToColumnsPlaceholder } = this.data;
|
||||
let result = [];
|
||||
if (type !== 'province' && !code) {
|
||||
return result;
|
||||
}
|
||||
const list = this.getConfig(type);
|
||||
result = Object.keys(list).map(code => ({
|
||||
code,
|
||||
name: list[code]
|
||||
}));
|
||||
if (code) {
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'city') {
|
||||
code = '9';
|
||||
}
|
||||
result = result.filter(item => item.code.indexOf(code) === 0);
|
||||
}
|
||||
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||
// set columns placeholder
|
||||
const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
|
||||
result.unshift({
|
||||
code: `${code}${codeFill}`,
|
||||
name: typeToColumnsPlaceholder[type]
|
||||
});
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getIndex(type, code) {
|
||||
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
|
||||
const list = this.getList(type, code.slice(0, compareNum - 2));
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'province') {
|
||||
compareNum = 1;
|
||||
}
|
||||
code = code.slice(0, compareNum);
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code.slice(0, compareNum) === code) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
setValues() {
|
||||
const county = this.getConfig('county');
|
||||
let { code } = this;
|
||||
if (!code) {
|
||||
if (this.data.columnsPlaceholder.length) {
|
||||
code = COLUMNSPLACEHOLDERCODE;
|
||||
}
|
||||
else if (Object.keys(county)[0]) {
|
||||
code = Object.keys(county)[0];
|
||||
}
|
||||
else {
|
||||
code = '';
|
||||
}
|
||||
}
|
||||
const province = this.getList('province');
|
||||
const city = this.getList('city', code.slice(0, 2));
|
||||
const picker = this.getPicker();
|
||||
if (!picker) {
|
||||
return;
|
||||
}
|
||||
const stack = [];
|
||||
stack.push(picker.setColumnValues(0, province, false));
|
||||
stack.push(picker.setColumnValues(1, city, false));
|
||||
if (city.length && code.slice(2, 4) === '00') {
|
||||
[{ code }] = city;
|
||||
}
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
return Promise.all(stack)
|
||||
.catch(() => { })
|
||||
.then(() => picker.setIndexes([
|
||||
this.getIndex('province', code),
|
||||
this.getIndex('city', code),
|
||||
this.getIndex('county', code)
|
||||
]))
|
||||
.catch(() => { });
|
||||
},
|
||||
getValues() {
|
||||
const picker = this.getPicker();
|
||||
return picker ? picker.getValues().filter(value => !!value) : [];
|
||||
},
|
||||
getDetail() {
|
||||
const values = this.getValues();
|
||||
const area = {
|
||||
code: '',
|
||||
country: '',
|
||||
province: '',
|
||||
city: '',
|
||||
county: ''
|
||||
};
|
||||
if (!values.length) {
|
||||
return area;
|
||||
}
|
||||
const names = values.map((item) => item.name);
|
||||
area.code = values[values.length - 1].code;
|
||||
if (area.code[0] === '9') {
|
||||
area.country = names[1] || '';
|
||||
area.province = names[2] || '';
|
||||
}
|
||||
else {
|
||||
area.province = names[0] || '';
|
||||
area.city = names[1] || '';
|
||||
area.county = names[2] || '';
|
||||
}
|
||||
return area;
|
||||
},
|
||||
reset(code) {
|
||||
this.code = code || '';
|
||||
return this.setValues();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
12
utils/dist/area/index.json
vendored
12
utils/dist/area/index.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-picker": "../picker/index"
|
||||
}
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-picker": "../picker/index"
|
||||
}
|
||||
}
|
||||
|
36
utils/dist/area/index.wxml
vendored
36
utils/dist/area/index.wxml
vendored
@ -1,18 +1,18 @@
|
||||
<van-picker
|
||||
class="van-area__picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
show-toolbar
|
||||
value-key="name"
|
||||
title="{{ title }}"
|
||||
loading="{{ loading }}"
|
||||
columns="{{ displayColumns }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
cancel-button-text="{{ cancelButtonText }}"
|
||||
confirm-button-text="{{ confirmButtonText }}"
|
||||
bind:change="onChange"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="onCancel"
|
||||
/>
|
||||
<van-picker
|
||||
class="van-area__picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
show-toolbar
|
||||
value-key="name"
|
||||
title="{{ title }}"
|
||||
loading="{{ loading }}"
|
||||
columns="{{ displayColumns }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
cancel-button-text="{{ cancelButtonText }}"
|
||||
confirm-button-text="{{ confirmButtonText }}"
|
||||
bind:change="onChange"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="onCancel"
|
||||
/>
|
||||
|
2
utils/dist/button/index.d.ts
vendored
2
utils/dist/button/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
136
utils/dist/button/index.js
vendored
136
utils/dist/button/index.js
vendored
@ -1,68 +1,68 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { openType } from '../mixins/open-type';
|
||||
VantComponent({
|
||||
mixins: [button, openType],
|
||||
classes: ['hover-class', 'loading-class'],
|
||||
data: {
|
||||
style: ''
|
||||
},
|
||||
props: {
|
||||
icon: String,
|
||||
plain: Boolean,
|
||||
block: Boolean,
|
||||
round: Boolean,
|
||||
square: Boolean,
|
||||
loading: Boolean,
|
||||
hairline: Boolean,
|
||||
disabled: Boolean,
|
||||
loadingText: String,
|
||||
customStyle: String,
|
||||
loadingType: {
|
||||
type: String,
|
||||
value: 'circular'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal'
|
||||
},
|
||||
loadingSize: {
|
||||
type: String,
|
||||
value: '20px'
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
observer(color) {
|
||||
let style = '';
|
||||
if (color) {
|
||||
style += `color: ${this.data.plain ? color : 'white'};`;
|
||||
if (!this.data.plain) {
|
||||
// Use background instead of backgroundColor to make linear-gradient work
|
||||
style += `background: ${color};`;
|
||||
}
|
||||
// hide border when color is linear-gradient
|
||||
if (color.indexOf('gradient') !== -1) {
|
||||
style += 'border: 0;';
|
||||
}
|
||||
else {
|
||||
style += `border-color: ${color};`;
|
||||
}
|
||||
}
|
||||
if (style !== this.data.style) {
|
||||
this.setData({ style });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
if (!this.data.disabled && !this.data.loading) {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { openType } from '../mixins/open-type';
|
||||
VantComponent({
|
||||
mixins: [button, openType],
|
||||
classes: ['hover-class', 'loading-class'],
|
||||
data: {
|
||||
style: ''
|
||||
},
|
||||
props: {
|
||||
icon: String,
|
||||
plain: Boolean,
|
||||
block: Boolean,
|
||||
round: Boolean,
|
||||
square: Boolean,
|
||||
loading: Boolean,
|
||||
hairline: Boolean,
|
||||
disabled: Boolean,
|
||||
loadingText: String,
|
||||
customStyle: String,
|
||||
loadingType: {
|
||||
type: String,
|
||||
value: 'circular'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal'
|
||||
},
|
||||
loadingSize: {
|
||||
type: String,
|
||||
value: '20px'
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
observer(color) {
|
||||
let style = '';
|
||||
if (color) {
|
||||
style += `color: ${this.data.plain ? color : 'white'};`;
|
||||
if (!this.data.plain) {
|
||||
// Use background instead of backgroundColor to make linear-gradient work
|
||||
style += `background: ${color};`;
|
||||
}
|
||||
// hide border when color is linear-gradient
|
||||
if (color.indexOf('gradient') !== -1) {
|
||||
style += 'border: 0;';
|
||||
}
|
||||
else {
|
||||
style += `border-color: ${color};`;
|
||||
}
|
||||
}
|
||||
if (style !== this.data.style) {
|
||||
this.setData({ style });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
if (!this.data.disabled && !this.data.loading) {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
14
utils/dist/button/index.json
vendored
14
utils/dist/button/index.json
vendored
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
||||
|
104
utils/dist/button/index.wxml
vendored
104
utils/dist/button/index.wxml
vendored
@ -1,52 +1,52 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<button
|
||||
id="{{ id }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="van-button--active hover-class"
|
||||
lang="{{ lang }}"
|
||||
style="{{ style }} {{ customStyle }}"
|
||||
open-type="{{ openType }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
aria-label="{{ ariaLabel }}"
|
||||
bindtap="onClick"
|
||||
bindgetuserinfo="bindGetUserInfo"
|
||||
bindcontact="bindContact"
|
||||
bindgetphonenumber="bindGetPhoneNumber"
|
||||
binderror="bindError"
|
||||
bindlaunchapp="bindLaunchApp"
|
||||
bindopensetting="bindOpenSetting"
|
||||
>
|
||||
<block wx:if="{{ loading }}">
|
||||
<van-loading
|
||||
custom-class="loading-class"
|
||||
size="{{ loadingSize }}"
|
||||
type="{{ loadingType }}"
|
||||
color="{{ type === 'default' ? '#c9c9c9' : 'white' }}"
|
||||
/>
|
||||
<view
|
||||
wx:if="{{ loadingText }}"
|
||||
class="van-button__loading-text"
|
||||
>
|
||||
{{ loadingText }}
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
size="1.2em"
|
||||
name="{{ icon }}"
|
||||
class="van-button__icon"
|
||||
custom-style="line-height: inherit;"
|
||||
/>
|
||||
<view class="van-button__text">
|
||||
<slot />
|
||||
</view>
|
||||
</block>
|
||||
</button>
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<button
|
||||
id="{{ id }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="van-button--active hover-class"
|
||||
lang="{{ lang }}"
|
||||
style="{{ style }} {{ customStyle }}"
|
||||
open-type="{{ openType }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
aria-label="{{ ariaLabel }}"
|
||||
bindtap="onClick"
|
||||
bindgetuserinfo="bindGetUserInfo"
|
||||
bindcontact="bindContact"
|
||||
bindgetphonenumber="bindGetPhoneNumber"
|
||||
binderror="bindError"
|
||||
bindlaunchapp="bindLaunchApp"
|
||||
bindopensetting="bindOpenSetting"
|
||||
>
|
||||
<block wx:if="{{ loading }}">
|
||||
<van-loading
|
||||
custom-class="loading-class"
|
||||
size="{{ loadingSize }}"
|
||||
type="{{ loadingType }}"
|
||||
color="{{ type === 'default' ? '#c9c9c9' : 'white' }}"
|
||||
/>
|
||||
<view
|
||||
wx:if="{{ loadingText }}"
|
||||
class="van-button__loading-text"
|
||||
>
|
||||
{{ loadingText }}
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
size="1.2em"
|
||||
name="{{ icon }}"
|
||||
class="van-button__icon"
|
||||
custom-style="line-height: inherit;"
|
||||
/>
|
||||
<view class="van-button__text">
|
||||
<slot />
|
||||
</view>
|
||||
</block>
|
||||
</button>
|
||||
|
2
utils/dist/card/index.d.ts
vendored
2
utils/dist/card/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
76
utils/dist/card/index.js
vendored
76
utils/dist/card/index.js
vendored
@ -1,38 +1,38 @@
|
||||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'num-class',
|
||||
'desc-class',
|
||||
'thumb-class',
|
||||
'title-class',
|
||||
'price-class',
|
||||
'origin-price-class',
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
tag: String,
|
||||
num: String,
|
||||
desc: String,
|
||||
thumb: String,
|
||||
title: String,
|
||||
price: String,
|
||||
centered: Boolean,
|
||||
lazyLoad: Boolean,
|
||||
thumbLink: String,
|
||||
originPrice: String,
|
||||
thumbMode: {
|
||||
type: String,
|
||||
value: 'aspectFit'
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
value: '¥'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickThumb() {
|
||||
this.jumpLink('thumbLink');
|
||||
}
|
||||
}
|
||||
});
|
||||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'num-class',
|
||||
'desc-class',
|
||||
'thumb-class',
|
||||
'title-class',
|
||||
'price-class',
|
||||
'origin-price-class',
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
tag: String,
|
||||
num: String,
|
||||
desc: String,
|
||||
thumb: String,
|
||||
title: String,
|
||||
price: String,
|
||||
centered: Boolean,
|
||||
lazyLoad: Boolean,
|
||||
thumbLink: String,
|
||||
originPrice: String,
|
||||
thumbMode: {
|
||||
type: String,
|
||||
value: 'aspectFit'
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
value: '¥'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickThumb() {
|
||||
this.jumpLink('thumbLink');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
12
utils/dist/card/index.json
vendored
12
utils/dist/card/index.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-tag": "../tag/index"
|
||||
}
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-tag": "../tag/index"
|
||||
}
|
||||
}
|
||||
|
90
utils/dist/card/index.wxml
vendored
90
utils/dist/card/index.wxml
vendored
@ -1,45 +1,45 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="custom-class van-card">
|
||||
<view class="{{ utils.bem('card__header', { center: centered }) }}">
|
||||
<view class="van-card__thumb" bind:tap="onClickThumb">
|
||||
<image
|
||||
wx:if="{{ thumb }}"
|
||||
src="{{ thumb }}"
|
||||
mode="{{ thumbMode }}"
|
||||
lazy-load="{{ lazyLoad }}"
|
||||
class="van-card__img thumb-class"
|
||||
/>
|
||||
<slot name="thumb" />
|
||||
<van-tag
|
||||
wx:if="{{ tag }}"
|
||||
mark
|
||||
type="danger"
|
||||
custom-class="van-card__tag"
|
||||
>
|
||||
{{ tag }}
|
||||
</van-tag>
|
||||
</view>
|
||||
|
||||
<view class="van-card__content">
|
||||
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
|
||||
<slot wx:else name="desc" />
|
||||
|
||||
<slot name="tags" />
|
||||
|
||||
<view class="van-card__bottom">
|
||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||
<slot name="bottom" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-card__footer">
|
||||
<slot name="footer" />
|
||||
</view>
|
||||
</view>
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="custom-class van-card">
|
||||
<view class="{{ utils.bem('card__header', { center: centered }) }}">
|
||||
<view class="van-card__thumb" bind:tap="onClickThumb">
|
||||
<image
|
||||
wx:if="{{ thumb }}"
|
||||
src="{{ thumb }}"
|
||||
mode="{{ thumbMode }}"
|
||||
lazy-load="{{ lazyLoad }}"
|
||||
class="van-card__img thumb-class"
|
||||
/>
|
||||
<slot name="thumb" />
|
||||
<van-tag
|
||||
wx:if="{{ tag }}"
|
||||
mark
|
||||
type="danger"
|
||||
custom-class="van-card__tag"
|
||||
>
|
||||
{{ tag }}
|
||||
</van-tag>
|
||||
</view>
|
||||
|
||||
<view class="van-card__content">
|
||||
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
|
||||
<slot wx:else name="desc" />
|
||||
|
||||
<slot name="tags" />
|
||||
|
||||
<view class="van-card__bottom">
|
||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||
<slot name="bottom" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-card__footer">
|
||||
<slot name="footer" />
|
||||
</view>
|
||||
</view>
|
||||
|
2
utils/dist/cell-group/index.d.ts
vendored
2
utils/dist/cell-group/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
20
utils/dist/cell-group/index.js
vendored
20
utils/dist/cell-group/index.js
vendored
@ -1,10 +1,10 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
title: String,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
title: String,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
4
utils/dist/cell-group/index.json
vendored
4
utils/dist/cell-group/index.json
vendored
@ -1,3 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
{
|
||||
"component": true
|
||||
}
|
18
utils/dist/cell-group/index.wxml
vendored
18
utils/dist/cell-group/index.wxml
vendored
@ -1,9 +1,9 @@
|
||||
<view
|
||||
wx:if="{{ title }}"
|
||||
class="van-cell-group__title"
|
||||
>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
||||
<view
|
||||
wx:if="{{ title }}"
|
||||
class="van-cell-group__title"
|
||||
>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
||||
|
2
utils/dist/cell/index.d.ts
vendored
2
utils/dist/cell/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
74
utils/dist/cell/index.js
vendored
74
utils/dist/cell/index.js
vendored
@ -1,37 +1,37 @@
|
||||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'title-class',
|
||||
'label-class',
|
||||
'value-class',
|
||||
'right-icon-class',
|
||||
'hover-class'
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
title: null,
|
||||
value: null,
|
||||
icon: String,
|
||||
size: String,
|
||||
label: String,
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
required: Boolean,
|
||||
clickable: Boolean,
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event.detail);
|
||||
this.jumpLink();
|
||||
}
|
||||
}
|
||||
});
|
||||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'title-class',
|
||||
'label-class',
|
||||
'value-class',
|
||||
'right-icon-class',
|
||||
'hover-class'
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
title: null,
|
||||
value: null,
|
||||
icon: String,
|
||||
size: String,
|
||||
label: String,
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
required: Boolean,
|
||||
clickable: Boolean,
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event.detail);
|
||||
this.jumpLink();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
10
utils/dist/cell/index.json
vendored
10
utils/dist/cell/index.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
90
utils/dist/cell/index.wxml
vendored
90
utils/dist/cell/index.wxml
vendored
@ -1,45 +1,45 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
|
||||
hover-class="van-cell--hover hover-class"
|
||||
hover-stay-time="70"
|
||||
style="{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
name="{{ icon }}"
|
||||
class="van-cell__left-icon-wrap"
|
||||
custom-class="van-cell__left-icon"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
|
||||
<view
|
||||
style="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
class="van-cell__title title-class"
|
||||
>
|
||||
<block wx:if="{{ title }}">{{ title }}</block>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
|
||||
<slot wx:if="{{ useLabelSlot }}" name="label" />
|
||||
<block wx:elif="{{ label }}">{{ label }}</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-cell__value value-class">
|
||||
<block wx:if="{{ value || value === 0 }}">{{ value }}</block>
|
||||
<slot wx:else />
|
||||
</view>
|
||||
|
||||
<van-icon
|
||||
wx:if="{{ isLink }}"
|
||||
name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}"
|
||||
class="van-cell__right-icon-wrap right-icon-class"
|
||||
custom-class="van-cell__right-icon"
|
||||
/>
|
||||
<slot wx:else name="right-icon" />
|
||||
|
||||
<slot name="extra" />
|
||||
</view>
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
|
||||
hover-class="van-cell--hover hover-class"
|
||||
hover-stay-time="70"
|
||||
style="{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
name="{{ icon }}"
|
||||
class="van-cell__left-icon-wrap"
|
||||
custom-class="van-cell__left-icon"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
|
||||
<view
|
||||
style="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
class="van-cell__title title-class"
|
||||
>
|
||||
<block wx:if="{{ title }}">{{ title }}</block>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
|
||||
<slot wx:if="{{ useLabelSlot }}" name="label" />
|
||||
<block wx:elif="{{ label }}">{{ label }}</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-cell__value value-class">
|
||||
<block wx:if="{{ value || value === 0 }}">{{ value }}</block>
|
||||
<slot wx:else />
|
||||
</view>
|
||||
|
||||
<van-icon
|
||||
wx:if="{{ isLink }}"
|
||||
name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}"
|
||||
class="van-cell__right-icon-wrap right-icon-class"
|
||||
custom-class="van-cell__right-icon"
|
||||
/>
|
||||
<slot wx:else name="right-icon" />
|
||||
|
||||
<slot name="extra" />
|
||||
</view>
|
||||
|
2
utils/dist/checkbox-group/index.d.ts
vendored
2
utils/dist/checkbox-group/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
78
utils/dist/checkbox-group/index.js
vendored
78
utils/dist/checkbox-group/index.js
vendored
@ -1,39 +1,39 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox',
|
||||
type: 'descendant',
|
||||
linked(target) {
|
||||
this.children = this.children || [];
|
||||
this.children.push(target);
|
||||
this.updateChild(target);
|
||||
},
|
||||
unlinked(target) {
|
||||
this.children = this.children.filter((child) => child !== target);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
max: Number,
|
||||
value: {
|
||||
type: Array,
|
||||
observer: 'updateChildren'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer: 'updateChildren'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateChildren() {
|
||||
(this.children || []).forEach((child) => this.updateChild(child));
|
||||
},
|
||||
updateChild(child) {
|
||||
const { value, disabled } = this.data;
|
||||
child.setData({
|
||||
value: value.indexOf(child.data.name) !== -1,
|
||||
disabled: disabled || child.data.disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox',
|
||||
type: 'descendant',
|
||||
linked(target) {
|
||||
this.children = this.children || [];
|
||||
this.children.push(target);
|
||||
this.updateChild(target);
|
||||
},
|
||||
unlinked(target) {
|
||||
this.children = this.children.filter((child) => child !== target);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
max: Number,
|
||||
value: {
|
||||
type: Array,
|
||||
observer: 'updateChildren'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer: 'updateChildren'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateChildren() {
|
||||
(this.children || []).forEach((child) => this.updateChild(child));
|
||||
},
|
||||
updateChild(child) {
|
||||
const { value, disabled } = this.data;
|
||||
child.setData({
|
||||
value: value.indexOf(child.data.name) !== -1,
|
||||
disabled: disabled || child.data.disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
6
utils/dist/checkbox-group/index.json
vendored
6
utils/dist/checkbox-group/index.json
vendored
@ -1,3 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
|
2
utils/dist/checkbox-group/index.wxml
vendored
2
utils/dist/checkbox-group/index.wxml
vendored
@ -1 +1 @@
|
||||
<slot />
|
||||
<slot />
|
||||
|
2
utils/dist/checkbox/index.d.ts
vendored
2
utils/dist/checkbox/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
174
utils/dist/checkbox/index.js
vendored
174
utils/dist/checkbox/index.js
vendored
@ -1,87 +1,87 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { addUnit } from '../common/utils';
|
||||
function emit(target, value) {
|
||||
target.$emit('input', value);
|
||||
target.$emit('change', value);
|
||||
}
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox-group',
|
||||
type: 'ancestor',
|
||||
linked(target) {
|
||||
this.parent = target;
|
||||
},
|
||||
unlinked() {
|
||||
this.parent = null;
|
||||
}
|
||||
},
|
||||
classes: ['icon-class', 'label-class'],
|
||||
props: {
|
||||
value: Boolean,
|
||||
disabled: Boolean,
|
||||
useIconSlot: Boolean,
|
||||
checkedColor: String,
|
||||
labelPosition: String,
|
||||
labelDisabled: Boolean,
|
||||
shape: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
iconSize: {
|
||||
type: null,
|
||||
observer: 'setSizeWithUnit'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
sizeWithUnit: '20px'
|
||||
},
|
||||
methods: {
|
||||
emitChange(value) {
|
||||
if (this.parent) {
|
||||
this.setParentValue(this.parent, value);
|
||||
}
|
||||
else {
|
||||
emit(this, value);
|
||||
}
|
||||
},
|
||||
toggle() {
|
||||
const { disabled, value } = this.data;
|
||||
if (!disabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
onClickLabel() {
|
||||
const { labelDisabled, disabled, value } = this.data;
|
||||
if (!disabled && !labelDisabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
setParentValue(parent, value) {
|
||||
const parentValue = parent.data.value.slice();
|
||||
const { name } = this.data;
|
||||
const { max } = parent.data;
|
||||
if (value) {
|
||||
if (max && parentValue.length >= max) {
|
||||
return;
|
||||
}
|
||||
if (parentValue.indexOf(name) === -1) {
|
||||
parentValue.push(name);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const index = parentValue.indexOf(name);
|
||||
if (index !== -1) {
|
||||
parentValue.splice(index, 1);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
setSizeWithUnit(size) {
|
||||
this.set({
|
||||
sizeWithUnit: addUnit(size)
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
import { addUnit } from '../common/utils';
|
||||
function emit(target, value) {
|
||||
target.$emit('input', value);
|
||||
target.$emit('change', value);
|
||||
}
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox-group',
|
||||
type: 'ancestor',
|
||||
linked(target) {
|
||||
this.parent = target;
|
||||
},
|
||||
unlinked() {
|
||||
this.parent = null;
|
||||
}
|
||||
},
|
||||
classes: ['icon-class', 'label-class'],
|
||||
props: {
|
||||
value: Boolean,
|
||||
disabled: Boolean,
|
||||
useIconSlot: Boolean,
|
||||
checkedColor: String,
|
||||
labelPosition: String,
|
||||
labelDisabled: Boolean,
|
||||
shape: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
iconSize: {
|
||||
type: null,
|
||||
observer: 'setSizeWithUnit'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
sizeWithUnit: '20px'
|
||||
},
|
||||
methods: {
|
||||
emitChange(value) {
|
||||
if (this.parent) {
|
||||
this.setParentValue(this.parent, value);
|
||||
}
|
||||
else {
|
||||
emit(this, value);
|
||||
}
|
||||
},
|
||||
toggle() {
|
||||
const { disabled, value } = this.data;
|
||||
if (!disabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
onClickLabel() {
|
||||
const { labelDisabled, disabled, value } = this.data;
|
||||
if (!disabled && !labelDisabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
setParentValue(parent, value) {
|
||||
const parentValue = parent.data.value.slice();
|
||||
const { name } = this.data;
|
||||
const { max } = parent.data;
|
||||
if (value) {
|
||||
if (max && parentValue.length >= max) {
|
||||
return;
|
||||
}
|
||||
if (parentValue.indexOf(name) === -1) {
|
||||
parentValue.push(name);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const index = parentValue.indexOf(name);
|
||||
if (index !== -1) {
|
||||
parentValue.splice(index, 1);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
setSizeWithUnit(size) {
|
||||
this.set({
|
||||
sizeWithUnit: addUnit(size)
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
|
12
utils/dist/checkbox/index.json
vendored
12
utils/dist/checkbox/index.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
||||
|
38
utils/dist/checkbox/index.wxml
vendored
38
utils/dist/checkbox/index.wxml
vendored
@ -1,19 +1,19 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="van-checkbox custom-class">
|
||||
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||
<van-icon
|
||||
wx:else
|
||||
name="success"
|
||||
size="0.8em"
|
||||
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
|
||||
style="font-size: {{ sizeWithUnit }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
|
||||
custom-class="icon-class"
|
||||
custom-style="line-height: 1.25em;"
|
||||
/>
|
||||
</view>
|
||||
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="van-checkbox custom-class">
|
||||
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||
<van-icon
|
||||
wx:else
|
||||
name="success"
|
||||
size="0.8em"
|
||||
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
|
||||
style="font-size: {{ sizeWithUnit }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
|
||||
custom-class="icon-class"
|
||||
custom-style="line-height: 1.25em;"
|
||||
/>
|
||||
</view>
|
||||
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
|
2
utils/dist/circle/index.d.ts
vendored
2
utils/dist/circle/index.d.ts
vendored
@ -1 +1 @@
|
||||
export {};
|
||||
export {};
|
||||
|
316
utils/dist/circle/index.js
vendored
316
utils/dist/circle/index.js
vendored
@ -1,158 +1,158 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isObj } from '../common/utils';
|
||||
import { BLUE, WHITE } from '../common/color';
|
||||
function format(rate) {
|
||||
return Math.min(Math.max(rate, 0), 100);
|
||||
}
|
||||
const PERIMETER = 2 * Math.PI;
|
||||
const BEGIN_ANGLE = -Math.PI / 2;
|
||||
const STEP = 1;
|
||||
VantComponent({
|
||||
props: {
|
||||
text: String,
|
||||
lineCap: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: 'reRender'
|
||||
},
|
||||
speed: {
|
||||
type: Number,
|
||||
value: 50
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
value: 100,
|
||||
observer: 'setStyle'
|
||||
},
|
||||
fill: String,
|
||||
layerColor: {
|
||||
type: String,
|
||||
value: WHITE
|
||||
},
|
||||
color: {
|
||||
type: [String, Object],
|
||||
value: BLUE,
|
||||
observer: 'setHoverColor'
|
||||
},
|
||||
strokeWidth: {
|
||||
type: Number,
|
||||
value: 4
|
||||
},
|
||||
clockwise: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
style: 'width: 100px; height: 100px;',
|
||||
hoverColor: BLUE
|
||||
},
|
||||
methods: {
|
||||
getContext() {
|
||||
if (!this.ctx) {
|
||||
this.ctx = wx.createCanvasContext('van-circle', this);
|
||||
}
|
||||
return this.ctx;
|
||||
},
|
||||
setHoverColor() {
|
||||
const context = this.getContext();
|
||||
const { color, size } = this.data;
|
||||
let hoverColor = color;
|
||||
if (isObj(color)) {
|
||||
const LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort((a, b) => parseFloat(a) - parseFloat(b))
|
||||
.map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key]));
|
||||
hoverColor = LinearColor;
|
||||
}
|
||||
this.setData({ hoverColor });
|
||||
},
|
||||
setStyle() {
|
||||
const { size } = this.data;
|
||||
const style = `width: ${size}px; height: ${size}px;`;
|
||||
this.setData({ style });
|
||||
},
|
||||
presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
|
||||
const { strokeWidth, lineCap, clockwise, size } = this.data;
|
||||
const position = size / 2;
|
||||
const radius = position - strokeWidth / 2;
|
||||
context.setStrokeStyle(strokeStyle);
|
||||
context.setLineWidth(strokeWidth);
|
||||
context.setLineCap(lineCap);
|
||||
context.beginPath();
|
||||
context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
|
||||
context.stroke();
|
||||
if (fill) {
|
||||
context.setFillStyle(fill);
|
||||
context.fill();
|
||||
}
|
||||
},
|
||||
renderLayerCircle(context) {
|
||||
const { layerColor, fill } = this.data;
|
||||
this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
|
||||
},
|
||||
renderHoverCircle(context, formatValue) {
|
||||
const { clockwise, hoverColor } = this.data;
|
||||
// 结束角度
|
||||
const progress = PERIMETER * (formatValue / 100);
|
||||
const endAngle = clockwise
|
||||
? BEGIN_ANGLE + progress
|
||||
: 3 * Math.PI - (BEGIN_ANGLE + progress);
|
||||
this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle);
|
||||
},
|
||||
drawCircle(currentValue) {
|
||||
const context = this.getContext();
|
||||
const { size } = this.data;
|
||||
context.clearRect(0, 0, size, size);
|
||||
this.renderLayerCircle(context);
|
||||
const formatValue = format(currentValue);
|
||||
if (formatValue !== 0) {
|
||||
this.renderHoverCircle(context, formatValue);
|
||||
}
|
||||
context.draw();
|
||||
},
|
||||
reRender() {
|
||||
// tofector 动画暂时没有想到好的解决方案
|
||||
const { value, speed } = this.data;
|
||||
if (speed <= 0 || speed > 1000) {
|
||||
this.drawCircle(value);
|
||||
return;
|
||||
}
|
||||
this.clearInterval();
|
||||
this.currentValue = this.currentValue || 0;
|
||||
this.interval = setInterval(() => {
|
||||
if (this.currentValue !== value) {
|
||||
if (this.currentValue < value) {
|
||||
this.currentValue += STEP;
|
||||
}
|
||||
else {
|
||||
this.currentValue -= STEP;
|
||||
}
|
||||
this.drawCircle(this.currentValue);
|
||||
}
|
||||
else {
|
||||
this.clearInterval();
|
||||
}
|
||||
}, 1000 / speed);
|
||||
},
|
||||
clearInterval() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { value } = this.data;
|
||||
this.currentValue = value;
|
||||
this.drawCircle(value);
|
||||
},
|
||||
destroyed() {
|
||||
this.ctx = null;
|
||||
this.clearInterval();
|
||||
}
|
||||
});
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isObj } from '../common/utils';
|
||||
import { BLUE, WHITE } from '../common/color';
|
||||
function format(rate) {
|
||||
return Math.min(Math.max(rate, 0), 100);
|
||||
}
|
||||
const PERIMETER = 2 * Math.PI;
|
||||
const BEGIN_ANGLE = -Math.PI / 2;
|
||||
const STEP = 1;
|
||||
VantComponent({
|
||||
props: {
|
||||
text: String,
|
||||
lineCap: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: 'reRender'
|
||||
},
|
||||
speed: {
|
||||
type: Number,
|
||||
value: 50
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
value: 100,
|
||||
observer: 'setStyle'
|
||||
},
|
||||
fill: String,
|
||||
layerColor: {
|
||||
type: String,
|
||||
value: WHITE
|
||||
},
|
||||
color: {
|
||||
type: [String, Object],
|
||||
value: BLUE,
|
||||
observer: 'setHoverColor'
|
||||
},
|
||||
strokeWidth: {
|
||||
type: Number,
|
||||
value: 4
|
||||
},
|
||||
clockwise: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
style: 'width: 100px; height: 100px;',
|
||||
hoverColor: BLUE
|
||||
},
|
||||
methods: {
|
||||
getContext() {
|
||||
if (!this.ctx) {
|
||||
this.ctx = wx.createCanvasContext('van-circle', this);
|
||||
}
|
||||
return this.ctx;
|
||||
},
|
||||
setHoverColor() {
|
||||
const context = this.getContext();
|
||||
const { color, size } = this.data;
|
||||
let hoverColor = color;
|
||||
if (isObj(color)) {
|
||||
const LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort((a, b) => parseFloat(a) - parseFloat(b))
|
||||
.map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key]));
|
||||
hoverColor = LinearColor;
|
||||
}
|
||||
this.setData({ hoverColor });
|
||||
},
|
||||
setStyle() {
|
||||
const { size } = this.data;
|
||||
const style = `width: ${size}px; height: ${size}px;`;
|
||||
this.setData({ style });
|
||||
},
|
||||
presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
|
||||
const { strokeWidth, lineCap, clockwise, size } = this.data;
|
||||
const position = size / 2;
|
||||
const radius = position - strokeWidth / 2;
|
||||
context.setStrokeStyle(strokeStyle);
|
||||
context.setLineWidth(strokeWidth);
|
||||
context.setLineCap(lineCap);
|
||||
context.beginPath();
|
||||
context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
|
||||
context.stroke();
|
||||
if (fill) {
|
||||
context.setFillStyle(fill);
|
||||
context.fill();
|
||||
}
|
||||
},
|
||||
renderLayerCircle(context) {
|
||||
const { layerColor, fill } = this.data;
|
||||
this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
|
||||
},
|
||||
renderHoverCircle(context, formatValue) {
|
||||
const { clockwise, hoverColor } = this.data;
|
||||
// 结束角度
|
||||
const progress = PERIMETER * (formatValue / 100);
|
||||
const endAngle = clockwise
|
||||
? BEGIN_ANGLE + progress
|
||||
: 3 * Math.PI - (BEGIN_ANGLE + progress);
|
||||
this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle);
|
||||
},
|
||||
drawCircle(currentValue) {
|
||||
const context = this.getContext();
|
||||
const { size } = this.data;
|
||||
context.clearRect(0, 0, size, size);
|
||||
this.renderLayerCircle(context);
|
||||
const formatValue = format(currentValue);
|
||||
if (formatValue !== 0) {
|
||||
this.renderHoverCircle(context, formatValue);
|
||||
}
|
||||
context.draw();
|
||||
},
|
||||
reRender() {
|
||||
// tofector 动画暂时没有想到好的解决方案
|
||||
const { value, speed } = this.data;
|
||||
if (speed <= 0 || speed > 1000) {
|
||||
this.drawCircle(value);
|
||||
return;
|
||||
}
|
||||
this.clearInterval();
|
||||
this.currentValue = this.currentValue || 0;
|
||||
this.interval = setInterval(() => {
|
||||
if (this.currentValue !== value) {
|
||||
if (this.currentValue < value) {
|
||||
this.currentValue += STEP;
|
||||
}
|
||||
else {
|
||||
this.currentValue -= STEP;
|
||||
}
|
||||
this.drawCircle(this.currentValue);
|
||||
}
|
||||
else {
|
||||
this.clearInterval();
|
||||
}
|
||||
}, 1000 / speed);
|
||||
},
|
||||
clearInterval() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { value } = this.data;
|
||||
this.currentValue = value;
|
||||
this.drawCircle(value);
|
||||
},
|
||||
destroyed() {
|
||||
this.ctx = null;
|
||||
this.clearInterval();
|
||||
}
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user