wangfukang 2 weeks ago
parent
commit
ec4b6e17fc
  1. 137
      package1/order/orderList.vue

137
package1/order/orderList.vue

@ -8,14 +8,14 @@
</view> </view>
<view class="title-search" :style="{'margin-top': menuButtonInfo.top +'px'}"> <view class="title-search" :style="{'margin-top': menuButtonInfo.top +'px'}">
<uni-icons type="search" size="18" style="margin: 9rpx;"></uni-icons> <uni-icons type="search" size="18" style="margin: 9rpx;"></uni-icons>
<input type="text" placeholder="搜索" v-model="searchForm.keyWord" @confirm="goSearch" <input type="text" placeholder="搜索" v-model="searchForm.shopName" @confirm="goSearch"
confirm-type="search" /> confirm-type="search" />
</view> </view>
</view> </view>
</view> </view>
<view class="nav-tab"> <view class="nav-tab">
<view class="tab1"> <view class="tab1">
<view class="tabs1" @tap="checkTab1('quanbu')" <view class="tabs1" @tap="checkTab1(10)"
:style="{'color':tab1Checked == 'quanbu'?'#000':'#777','font-size':tab1Checked== 'quanbu'?'36rpx':'30rpx'}"> :style="{'color':tab1Checked == 'quanbu'?'#000':'#777','font-size':tab1Checked== 'quanbu'?'36rpx':'30rpx'}">
全部订单 全部订单
<img v-if="tab1Checked == 'quanbu'" <img v-if="tab1Checked == 'quanbu'"
@ -45,38 +45,38 @@
</view> </view>
</view> </view>
<view class="tab2"> <view class="tab2">
<view class="tabs2" @tap="checkTabs2('quanbu')" <view class="tabs2" @tap="checkTabs2(10)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='quanbu'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='quanbu'?'#000':'#777'}"> :style="{'background':tab2Checked==10?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==10?'#000':'#777'}">
全部</view> 全部</view>
<view class="tabs2" @tap="checkTabs2('daifu')" <view class="tabs2" @tap="checkTabs2(0)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='daifu'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daifu'?'#000':'#777'}"> :style="{'background':tab2Checked==0?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==0?'#000':'#777'}">
待支付</view> 待支付</view>
<view class="tabs2" @tap="checkTabs2('daifu')" <view class="tabs2" @tap="checkTabs2(1)" v-if="tab1Checked !='quanbu' && tab1Checked == 'fantuan'"
:style="{'background':tab2Checked=='daifu'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daifu'?'#000':'#777'}"> :style="{'background':tab2Checked==1?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==1?'#000':'#777'}">
待成团</view> 待成团</view>
<view class="tabs2" @tap="checkTabs2('daishou')" <view class="tabs2" @tap="checkTabs2(2)" v-if="tab1Checked !='quanbu' && tab1Checked == 'fantuan'"
:style="{'background':tab2Checked=='daishou'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daishou'?'#000':'#777'}"> :style="{'background':tab2Checked==2?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==2?'#000':'#777'}">
待消费</view> 待消费</view>
<view class="tabs2" @tap="checkTabs2('daifu')" <view class="tabs2" @tap="checkTabs2(3)" v-if="tab1Checked !='quanbu' && tab1Checked != 'ershou'"
:style="{'background':tab2Checked=='daifu'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daifu'?'#000':'#777'}"> :style="{'background':tab2Checked==3?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==3?'#000':'#777'}">
待接单</view> 待接单</view>
<view class="tabs2" @tap="checkTabs2('daifa')" <view class="tabs2" @tap="checkTabs2(4)" v-if="tab1Checked !='quanbu' && tab1Checked != 'ershou'"
:style="{'background':tab2Checked=='daifa'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daifa'?'#000':'#777'}"> :style="{'background':tab2Checked==4?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==4?'#000':'#777'}">
待取货</view> 待取货</view>
<view class="tabs2" @tap="checkTabs2('daishou')" <view class="tabs2" @tap="checkTabs2(5)" v-if="tab1Checked !='quanbu' && tab1Checked != 'ershou'"
:style="{'background':tab2Checked=='daishou'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daishou'?'#000':'#777'}"> :style="{'background':tab2Checked==5?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==5?'#000':'#777'}">
待送达</view> 待送达</view>
<view class="tabs2" @tap="checkTabs2('daishou')" <view class="tabs2" @tap="checkTabs2(6)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='daishou'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daishou'?'#000':'#777'}"> :style="{'background':tab2Checked==6?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==6?'#000':'#777'}">
已完成</view> 已完成</view>
<view class="tabs2" @tap="checkTabs2('daishou')" <view class="tabs2" @tap="checkTabs2(7)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='daishou'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daishou'?'#000':'#777'}"> :style="{'background':tab2Checked==7?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==7?'#000':'#777'}">
商家同意退款</view> 待退款</view>
<view class="tabs2" @tap="checkTabs2('daishou')" <view class="tabs2" @tap="checkTabs2(8)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='daishou'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='daishou'?'#000':'#777'}"> :style="{'background':tab2Checked==8?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==8?'#000':'#777'}">
已退款</view> 已退款</view>
<view class="tabs2" @tap="checkTabs2('guanbi')" <view class="tabs2" @tap="checkTabs2(9)" v-if="tab1Checked !='quanbu'"
:style="{'background':tab2Checked=='guanbi'?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked=='guanbi'?'#000':'#777'}"> :style="{'background':tab2Checked==9?'rgba(166, 255, 234, 1)':'#F5F5F5','color':tab2Checked==9?'#000':'#777'}">
已取消</view> 已取消</view>
</view> </view>
</view> </view>
@ -172,7 +172,7 @@
</view> </view>
</view> </view>
<view class="bottom-btn"> <view class="bottom-btn">
<view class="btn1" v-if="orderStatus(item)" @tap="returnOrder(item)"> <view class="btn1" v-if="orderStatus(item)" @tap="returnPopupProp(item)">
取消订单 取消订单
</view> </view>
<view class="btn1" v-if="item.status == 5"> <view class="btn1" v-if="item.status == 5">
@ -206,7 +206,7 @@
<view style="height: 40rpx;text-align: center;color: #777;"> <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 == 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.deliveryFee != null && payData.deliveryFee > 0) && payData.orderType != 3 && payData.deliveryType == 1">配送费 {{payData.deliveryFee}} </text>
<text v-if="payData.packageFee > 0"> 打包费 {{payData.packageFee}} </text> <text v-if="payData.packageFee > 0"> 打包费 {{payData.packageFee}} </text>
</view> </view>
@ -236,6 +236,19 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="returnPopup" background-color="#fff" style="height: 1600rpx !important;">
<view class="guize-list">
<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
确定要取消订单吗
<text v-if="payData.status == 2 || payData.status == 3 || payData.status == 4 || payData.status == 4">取消订单需要商家同意</text>
</view>
<view class="btn" @tap="returnOrder()">
确认取消
</view>
</view>
</uni-popup>
<uni-load-more :status="loadStatus" @change="onChange" /> <uni-load-more :status="loadStatus" @change="onChange" />
</view> </view>
</view> </view>
@ -247,7 +260,7 @@
return { return {
loadStatus: 'more', loadStatus: 'more',
tab1Checked: 'quanbu', tab1Checked: 'quanbu',
tab2Checked: 'quanbu', tab2Checked: 10,
totalPages: 1, totalPages: 1,
pageNum:1, pageNum:1,
payData:{}, payData:{},
@ -255,6 +268,7 @@
searchForm:{ searchForm:{
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
shopName:'',
searchType:0, searchType:0,
userId:uni.getStorageSync('id'), userId:uni.getStorageSync('id'),
regionId:JSON.parse(uni.getStorageSync('area')).id regionId:JSON.parse(uni.getStorageSync('area')).id
@ -289,6 +303,52 @@
this.searchForm.pageNum = 1 this.searchForm.pageNum = 1
this.getOrderList() this.getOrderList()
}, },
goSearch(){
this.searchForm.pageNum = 1
this.getOrderList()
},
wxPayment() {
let that = this;
if (!this.payData.id || !this.payData.totalAmount) return;
let amountInCents = Math.round(Number(this.payData.totalAmount) * 100);
this.tui.request("/api/wechat/pay/unified-order", "POST", {
openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',
amount: amountInCents,
description: '拼团参与订单',
outTradeNo: this.payData.id
}, false, false).then((res) => {
if (res.code == 200) {
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.timeStamp,
nonceStr: res.nonceStr,
package: res.package,
signType: res.signType,
paySign: res.paySign,
success: function(res2) {
uni.showToast({ title: '支付成功', icon: 'success' });
that.tui.request("/api/wechat/pay/paySuccess", "POST", {
outTradeNo: that.payData.id
}, false, false).then((res3) => {
if(res3.code == 200){
uni.redirectTo({
url: '/package1/order/orderDetail?id=' + that.payData.id
});
}else{
that.tui.toast("订单创建失败,请联系客服处理");
}
})
},
fail: function(err) {
that.tui.toast("支付失败或取消");
}
});
}
})
},
orderStatus(item){ 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){ 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 true;
@ -296,7 +356,10 @@
return false; return false;
}, },
checkTabs2(type) { checkTabs2(type) {
this.tab2Checked = type this.tab2Checked = type;
this.searchForm.searchStatus = type;
this.searchForm.pageNum = 1
this.getOrderList();
}, },
payAgain(item){ payAgain(item){
this.payData = item; this.payData = item;
@ -323,7 +386,13 @@
uni.hideLoading(); uni.hideLoading();
}).catch((res) => {}); }).catch((res) => {});
}, },
returnOrder(item){ returnPopupProp(item){
this.payData = item;
this.$refs.returnPopup.open('bottom');
},
returnOrder(){
this.$refs.returnPopup.close();
let item = this.payData
let that = this let that = this
that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => { that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -556,4 +625,12 @@
.vue-ref{ .vue-ref{
border-radius: 10px !important; border-radius: 10px !important;
} }
.guize-list {
width: 600rpx;
padding: 20rpx;
overflow: scroll;
background: #fff;
border-radius: 20rpx;
max-height: 1000rpx;
}
</style> </style>
Loading…
Cancel
Save