wangfukang 2 weeks ago
parent
commit
df0569c391
  1. 143
      package1/order/orderList.vue

143
package1/order/orderList.vue

@ -166,19 +166,19 @@
</view> </view>
</view> </view>
<view style="height: 100rpx;border-bottom: 1px solid #F5F5F5;display: flex;line-height: 100rpx;"> <view style="height: 100rpx;border-bottom: 1px solid #F5F5F5;display: flex;line-height: 100rpx;">
<view style="flex: 1;color: #777;" v-if="item.status == 0">
待支付 <text style="font-size: 32rpx;color: red;font-weight: 700;">{{ formatTime(item.timeLeft) }}</text>
</view>
<view style="font-size: 24rpx;font-weight: 700;"> <view style="font-size: 24rpx;font-weight: 700;">
实付<text v-if="tab1Checked == 'fantuan'" style="font-size: 20rpx;color: #777;">含包装/配送费</text> <text 实付<text v-if="tab1Checked == 'fantuan'" style="font-size: 20rpx;color: #777;">含包装/配送费</text> <text
style="color: red;">24</text> style="color: red;">{{item.totalAmount}}</text>
</view> </view>
</view> </view>
<view class="bottom-btn"> <view class="bottom-btn">
<view class="btn1"> <view class="btn1" v-if="orderStatus(item)" @tap="returnOrder(item)">
取消订单 取消订单
</view> </view>
<view class="btn1" v- <view class="btn1" v-if="item.status == 5">
申请售后
</view>
<view class="btn1" v-if="item.status == 0" @tap="payAgain(item)"
style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));color: #000;"> style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));color: #000;">
去支付 去支付
</view> </view>
@ -193,6 +193,49 @@
</view> --> </view> -->
</view> </view>
</view> </view>
<!-- 支付弹出层 -->
<uni-popup ref="payPopup" background-color="#fff">
<view class="pay-popup" style="height: 290px;background: #fff;border-radius: 40rpx 40rpx 0 0;padding-top: 40rpx;">
<view class="content" style="height: 100%;margin-top:0">
<view class="box1">
<view
style="height: 90rpx;line-height: 90rpx;text-align: center;font-weight: 700;font-size: 30rpx;">
<text
style="font-size: 60rpx;">{{payData.totalAmount ? payData.totalAmount.toFixed(2) : '0.00'}}</text>
</view>
<view style="height: 40rpx;text-align: center;color: #777;">
<text v-if="payData.groupInfo && payData.orderType == 3 && payData.deliveryType == 1">配送费(均摊) {{payData.deliveryFee}} </text>
<text v-if="payData.groupInfo && payData.orderType == 2 && payData.deliveryType == 1">配送费 {{payData.deliveryFee}} </text>
<text v-if="payData.packageFee > 0"> 打包费 {{payData.packageFee}} </text>
</view>
<view style="height: 40rpx;text-align: center;color: red;" v-if="payData.groupInfo">
若拼团失败将会为您自动退款
</view>
</view>
<view class="box1" style="display: flex;padding: 40rpx;">
<view style="flex: 1;">
<view style="height: 42rpx;line-height: 42rpx;display: flex;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4c8e0cc311db4d38ab43e019673c4b8c.png"
alt="" style="width: 42rpx;height: 42rpx;margin-right: 20rpx;" />
<text style="font-size: 30rpx;font-weight: 700;">微信支付</text>
</view>
<view style="text-align: right;margin-left: 60rpx;color: #777;width: 146rpx;">
使用微信支付
</view>
</view>
<view style="width: 36rpx;padding-top: 20rpx;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/02bff7edc4e04caaa1868955ff684f1f.png"
alt="" style="width: 36rpx;height: 36rpx;" />
</view>
</view>
<view class="btn" style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));width: 90%;height: 100rpx;border-radius: 100rpx;text-align: center;font-size: 28rpx;font-weight: 700;line-height: 100rpx;margin: 40rpx auto;" @tap="wxPayment">
确认付款
</view>
</view>
</view>
</uni-popup>
<uni-load-more :status="loadStatus" @change="onChange" /> <uni-load-more :status="loadStatus" @change="onChange" />
</view> </view>
</view> </view>
@ -207,7 +250,7 @@
tab2Checked: 'quanbu', tab2Checked: 'quanbu',
totalPages: 1, totalPages: 1,
pageNum:1, pageNum:1,
timer: null, payData:{},
orderList:[], orderList:[],
searchForm:{ searchForm:{
pageNum:1, pageNum:1,
@ -227,72 +270,11 @@
}, },
onLoad(option) { onLoad(option) {
this.getOrderList() this.getOrderList()
this.startGlobalTimer()
},
onUnload() {
//
if (this.timer) clearInterval(this.timer)
}, },
onShow() { onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
}, },
methods: { methods: {
// 1.
startGlobalTimer() {
// 1
this.updateCountdown()
this.timer = setInterval(() => {
this.updateCountdown()
}, 1000)
},
// 2.
updateCountdown() {
const now = new Date().getTime()
this.orderList.forEach(item => {
const reg = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/
const match = item.createTime.match(reg)
if (match) {
// 2. ( 1 JS 0-11)
// iOS
let targetTime = new Date(
parseInt(match[1]), //
parseInt(match[2]) - 1, // (1)
parseInt(match[3]), //
parseInt(match[4]), //
parseInt(match[5]), //
parseInt(match[6]) //
).getTime()
// 3. 1
targetTime = targetTime + (60 * 60 * 1000)
// 4.
const diff = targetTime - new Date().getTime()
// 0
item.timeLeft = diff > 0 ? diff : 0
}
})
},
// 3. ( -> )
formatTime(ms) {
const second = Math.floor(ms / 1000)
const day = Math.floor(second / 86400)
const hour = Math.floor((second % 86400) / 3600)
const minute = Math.floor((second % 3600) / 60)
const sec = second % 60
//
const pad = (n) => n < 10 ? '0' + n : n
// 1 02 05 10
return `${day > 0 ? day + '天' : ''}${pad(hour)}${pad(minute)}${pad(sec)}`
},
checkTab1(type) { checkTab1(type) {
this.tab1Checked = type this.tab1Checked = type
if(type == 'quanbu'){ if(type == 'quanbu'){
@ -307,9 +289,19 @@
this.searchForm.pageNum = 1 this.searchForm.pageNum = 1
this.getOrderList() this.getOrderList()
}, },
orderStatus(item){
if(item.status == 0 || item.status == 10 || item.status == 2 || (item.status == 3 && item.deliveryType == 1) || (item.status == 3 && item.deliveryType == 2) || item.status == 4){
return true;
}
return false;
},
checkTabs2(type) { checkTabs2(type) {
this.tab2Checked = type this.tab2Checked = type
}, },
payAgain(item){
this.payData = item;
this.$refs.payPopup.open('bottom');
},
getOrderList(){ getOrderList(){
this.loadStatus = 'loading' this.loadStatus = 'loading'
let that = this let that = this
@ -331,6 +323,21 @@
uni.hideLoading(); uni.hideLoading();
}).catch((res) => {}); }).catch((res) => {});
}, },
returnOrder(item){
let that = this
that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("取消订单成功");
that.searchForm.pageNum = 1
that.getOrderList()
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
}
uni.hideLoading();
}).catch((res) => {});
},
back() { back() {
uni.navigateBack() uni.navigateBack()
} }

Loading…
Cancel
Save