[本时生活小程序-线上备份]
This commit is contained in:
134
pages/orderData/orderData.js
Normal file
134
pages/orderData/orderData.js
Normal file
@@ -0,0 +1,134 @@
|
||||
|
||||
/*
|
||||
* 本时生活
|
||||
*/
|
||||
|
||||
const app = getApp()
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
statusHeight : app.globalData.statusBarHeight,
|
||||
order : '' //订单详情
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 获取商品活动订单详情
|
||||
this.orderInfo(options.id);
|
||||
},
|
||||
|
||||
/**
|
||||
* 商品活动订单详情
|
||||
*/
|
||||
orderInfo(id) {
|
||||
wx.$api.exchange.show(id).then(res=>{
|
||||
this.setData({
|
||||
order : res.data
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
orderDelete(e) {
|
||||
let orderId = e.currentTarget.dataset.id
|
||||
wx.showModal({
|
||||
title : '订单取消',
|
||||
content : '确认取消吗?',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.$api.exchange.cancel(orderId).then(res=>{
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order'
|
||||
})
|
||||
|
||||
wx.showToast({
|
||||
title: res.data,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
wx.showToast({
|
||||
title : '取消',
|
||||
icon : 'loading',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 支付提交
|
||||
*/
|
||||
orderPay(e) {
|
||||
let orderid = e.currentTarget.dataset.id
|
||||
wx.$api.exchange.payments(orderid).then(res=>{
|
||||
wx.$api.index.wechat(res.data.trade_no).then(res=>{
|
||||
let payInfo = JSON.parse(res.data)
|
||||
wx.requestPayment({
|
||||
timeStamp: payInfo.timeStamp,
|
||||
nonceStr : payInfo.nonceStr,
|
||||
package : payInfo.package,
|
||||
paySign : payInfo.paySign,
|
||||
signType : payInfo.signType,
|
||||
success : res=>{
|
||||
if(res.errMsg == "requestPayment:ok"){
|
||||
wx.showToast({
|
||||
title: '支付成功',
|
||||
icon : 'success'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
wx.reLaunch({
|
||||
url: '/pages/coupon/coupon?type=couponPublic'
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
},
|
||||
fail : res=>{
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?stateType=unpay'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回上一页
|
||||
*/
|
||||
orderRun() {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 复制快递单号
|
||||
*/
|
||||
copyText (e) {
|
||||
let text = e.currentTarget.dataset.text
|
||||
wx.setClipboardData({
|
||||
data : text,
|
||||
success : res=> {
|
||||
wx.getClipboardData({
|
||||
success: res => {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
3
pages/orderData/orderData.json
Normal file
3
pages/orderData/orderData.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
63
pages/orderData/orderData.wxml
Normal file
63
pages/orderData/orderData.wxml
Normal file
@@ -0,0 +1,63 @@
|
||||
<!-- 订单状态 -->
|
||||
<view class="order-statl">
|
||||
{{order.state_text}}
|
||||
<block wx:if="{{order.state == 'UNPAY'}}">
|
||||
<image src="/static/icon/order_icon_00.png" class="order-statl-icon"></image>
|
||||
</block>
|
||||
<block wx:elif="{{order.state == 'PAID'}}">
|
||||
<image src="/static/icon/order_icon_01.png" class="order-statl-icon"></image>
|
||||
</block>
|
||||
<block wx:elif="{{order.state == 'COMPLETED'}}">
|
||||
<image src="/static/icon/order_icon_02.png" class="order-statl-icon"></image>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 收货人 -->
|
||||
<view class="order-address" wx:if="{{order.express != '' && order.express != null}}">
|
||||
<image class="address-icon" src="https://storage.funnyzhibo.com/images/2020/05/06/address_icon.png" mode="widthFix"></image>
|
||||
<view class="order-address-name nowrap">
|
||||
收货人:{{order.express.name}}
|
||||
<text>{{order.express.mobile}}</text>
|
||||
</view>
|
||||
<view class="order-address-text">{{order.express.address}}</view>
|
||||
<image class="order-address-back" src="/static/img/address_back.png" mode="widthFix"></image>
|
||||
</view>
|
||||
|
||||
<view class="order-goods">
|
||||
<view class="goods-goods-li">
|
||||
<image class="goods-img" src="{{order.items.cover}}" mode="aspectFill"></image>
|
||||
<view class="goods-body">
|
||||
<view class="goods-name nowrap">{{order.items.title}}</view>
|
||||
<view class="goods-price nowrap">¥{{order.items.price}}
|
||||
<text class="goods-qty">×{{order.items.qty}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="order-total">
|
||||
<view class="order-total-li order-type">
|
||||
权益类型
|
||||
<text>{{order.type_text}}</text>
|
||||
</view>
|
||||
<view class="order-total-li">
|
||||
订单号
|
||||
<text bindtap="copyText" data-text="{{order.orderid}}">{{order.orderid}}</text>
|
||||
</view>
|
||||
<view class="order-total-li">
|
||||
下单时间
|
||||
<text>{{order.created_at}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-total">
|
||||
<view class="order-total-li">
|
||||
实际支付
|
||||
<text class="redCor">¥{{order.amount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="order-data-footer {{statusHeight > 30 ? 'iphoneX':''}}">
|
||||
<view class="order-btn" bindtap="orderRun">返回订单</view>
|
||||
<view class="order-btn" bindtap="orderDelete" data-id="{{order.orderid}}" wx:if="{{order.canCancel}}">取消订单</view>
|
||||
<view class="order-btn order-btn-back" bindtap="orderPay" wx:if="{{order.canPay}}" data-id="{{order.orderid}}">立即支付</view>
|
||||
</view>
|
||||
241
pages/orderData/orderData.wxss
Normal file
241
pages/orderData/orderData.wxss
Normal file
@@ -0,0 +1,241 @@
|
||||
|
||||
/*
|
||||
* 亿时代
|
||||
*/
|
||||
.order-statl{
|
||||
background-color: #f57e32;
|
||||
padding: 0 30rpx 10rpx;
|
||||
color: white;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.order-statl-icon{
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
vertical-align: middle;
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 5rpx;
|
||||
}
|
||||
|
||||
/* 收货人信息 */
|
||||
.order-address{
|
||||
padding: 30rpx 30rpx 40rpx 100rpx;
|
||||
position: relative;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.order-address-back{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
vertical-align:bottom;
|
||||
}
|
||||
|
||||
.order-address-name{
|
||||
padding-right: 300rpx;
|
||||
position: relative;
|
||||
font-size: 33rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.order-address-name text{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 280rpx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.order-address-text{
|
||||
color: #464854;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.address-icon,
|
||||
.arrows-right{
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.address-icon{
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
left: 30rpx;
|
||||
top: calc(50% - 26rpx);
|
||||
top: -webkit-calc(50% - 26rpx);
|
||||
}
|
||||
|
||||
.arrows-right{
|
||||
height: 28rpx;
|
||||
width: 28rpx;
|
||||
right: 30rpx;
|
||||
top: calc(50% - 19rpx);
|
||||
top: -webkit-calc(50% - 19rpx);
|
||||
}
|
||||
|
||||
.order-add-address{
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.order-add-address navigator{
|
||||
display: inline-block;
|
||||
background: #e92344;
|
||||
color: white;
|
||||
line-height: 60rpx;
|
||||
padding: 0 30rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
/* 订单商品 */
|
||||
|
||||
.order-content{
|
||||
border-bottom: solid 100rpx transparent;
|
||||
}
|
||||
|
||||
.order-goods{
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.goods-goods-mall{
|
||||
padding: 20rpx 30rpx 0 30rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.goods-goods-mall image{
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 15rpx;
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
|
||||
.goods-goods-li{
|
||||
padding: 20rpx 30rpx;
|
||||
position: relative;
|
||||
border-bottom: solid 1rpx #f2f2f2;
|
||||
min-height: 130rpx;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.goods-goods-li:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.goods-img{
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
left: 30rpx;
|
||||
height: 130rpx;
|
||||
width: 130rpx;
|
||||
background: #f5f6fa;
|
||||
}
|
||||
|
||||
.goods-body{
|
||||
padding-left: 150rpx;
|
||||
}
|
||||
|
||||
.goods-name{
|
||||
font-weight: bold;
|
||||
padding: 10rpx 0 20rpx;
|
||||
}
|
||||
|
||||
.goods-price{
|
||||
color: #e92344;
|
||||
}
|
||||
|
||||
.goods-qty{
|
||||
color: gray;
|
||||
font-weight: normal;
|
||||
padding-left: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.goods-params{
|
||||
color: gray;
|
||||
padding-bottom: 20rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 统计信息 */
|
||||
|
||||
.order-total{
|
||||
background: white;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.order-total-li{
|
||||
padding: 0 30rpx;
|
||||
line-height: 90rpx;
|
||||
position: relative;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.order-total-li::before{
|
||||
position: absolute;
|
||||
content: " ";
|
||||
left: 30rpx;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
height: 1rpx;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.order-total-li:last-child::before{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.order-total-li text{
|
||||
float: right;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-total-li .redCor {
|
||||
color: #e92344;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.order-type text {
|
||||
color: #e92344;
|
||||
}
|
||||
|
||||
/* 底部工具栏 */
|
||||
.order-data-footer{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-top: solid 1rpx #f2f2f2;
|
||||
padding-top: 17rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-left: 30rpx;
|
||||
height: 83rpx;
|
||||
background: white;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction:row-reverse;
|
||||
}
|
||||
|
||||
.order-data-footer.iphoneX {
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.order-btn{
|
||||
margin-left: 20rpx;
|
||||
height: 54rpx;
|
||||
line-height: 50rpx;
|
||||
box-sizing: border-box;
|
||||
border:solid 1rpx #747788;
|
||||
padding: 0 20rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.order-btn-back {
|
||||
border-color: #f57e32;
|
||||
color: #f57e32;
|
||||
}
|
||||
Reference in New Issue
Block a user