You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
703 lines
14 KiB
703 lines
14 KiB
<template>
|
|
<view class="bg">
|
|
<view class="top-bg">
|
|
<view class="search-box">
|
|
<view class="left">
|
|
<image src="https://static.ticket.sz-trip.com/yandu/images/eventCalendar/search.png" mode="aspectFill"></image>
|
|
<input v-model="keywords" type="text" placeholder="请输入关键字" @confirm="search()" />
|
|
</view>
|
|
|
|
<!-- <view class="btn" @click="search()">搜索</view> -->
|
|
</view>
|
|
<view class="common-box">
|
|
<view class="common-types com-flex-tao">
|
|
<view @click="setType(index)" v-for="(item, index) in typeList" :key="item.id" :class="['common-type', typeIndex == index ? 'active' : '']">
|
|
{{ item.name }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="list-common-empty" v-if="list.length == 0">
|
|
<img :src="showImg('/uploads/20221201/8f97261b8eddffcc55342eca0ed0249c.png')" />
|
|
<p class="list-common-empty-tip">暂无订单~</p>
|
|
</view>
|
|
<view class="trade-list" v-if="list.length > 0">
|
|
<view v-for="(item, key) in list" :key="item.id" class="trade-items" v-if="showItem(item)" @click="() => choseType(item)">
|
|
<view class="trade-item-head">
|
|
<view class="trade-item-head-tid">订单号:{{ item.order_id }}</view>
|
|
<view class="trade-item-head-state">{{ item.status_text }}</view>
|
|
</view>
|
|
<view class="trade-item-pros">
|
|
<view
|
|
class="trade-item-pro"
|
|
v-for="(pro, proIndex) in item.order_child"
|
|
:key="pro.child_id"
|
|
>
|
|
<view class="trade-item-pro-img" v-if="pro.specifications_image"><image :src="showImg(pro.specifications_image)" mode="aspectFill"></image></view>
|
|
<view class="trade-item-pro-title">{{ pro.goods_title + pro.specifications_name }}</view>
|
|
<view class="trade-item-pro-price">
|
|
<view class="trade-item-pro-price-pri">¥{{ pro.pay_money / 100 }}</view>
|
|
<view class="trade-item-pro-num">x{{ pro.num }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="trade-item-info">
|
|
合计¥
|
|
<text>{{ item.pay_money / 100 }}</text>
|
|
</view>
|
|
<view class="trade-item-btns" v-if="item.client_id != 'jdsz'">
|
|
<view @click.stop="() => refund(item.order_id, key)" v-if="item.status == 'PAYMENT_SUCCESSFULLY'">申请退款</view>
|
|
<view @click.stop="() => closeOrder(item.order_id, item)" v-if="item.status == 'WAIT_PAYMENT'">关闭订单</view>
|
|
<view @click.stop="confirmpost(item.order_id, key)" v-if="item.postFlag">确认收货</view>
|
|
<view class="pay-btn" @click.stop="setOrderId(item.order_id)" v-if="item.status == 'WAIT_PAYMENT'">立即支付</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- <view v-if="list.length === 0 && finished" class="noDate">
|
|
<view>暂无订单</view>
|
|
</view> -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'Trades',
|
|
data() {
|
|
return {
|
|
finished: false,
|
|
list: [],
|
|
typeList: [
|
|
{
|
|
id: 'ALL',
|
|
name: '全部'
|
|
},
|
|
{
|
|
id: 'WAIT_PAYMENT',
|
|
name: '待付款'
|
|
},
|
|
{
|
|
id: 'PAYMENT_SUCCESSFULLY',
|
|
name: '待使用'
|
|
},
|
|
{
|
|
id: 'PAYMENT_SUCCESSFULLY',
|
|
name: '待发货'
|
|
},
|
|
{
|
|
id: 'POST',
|
|
name: '待收货'
|
|
},
|
|
// {
|
|
// id: 'WAIT_COMMENT',
|
|
// name: '待评价'
|
|
// },
|
|
{
|
|
id: 'WAIT_REFUND,REFUND_SUCCESS,REFUND_REFUSAL,REFUND_ERROR,REFUND_PART',
|
|
name: '退款/售后'
|
|
}
|
|
],
|
|
typeIndex: 0,
|
|
ajaxFlag: true,
|
|
keywords: '',
|
|
orderId: null,
|
|
dateRange: [],
|
|
type: '',
|
|
JDSZAPIURL: 'https://api.cloud.sz-trip.com',
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
console.log(options);
|
|
if (options.type) this.typeIndex = this.typeList.findIndex(vm => vm.name === options.type);
|
|
this.getList();
|
|
|
|
uni.$on("updateDataByConnect",this.getDataByConnect)
|
|
},
|
|
onUnload () {
|
|
uni.$off("updateDataByConnect",this.getDataByConnect)
|
|
},
|
|
onReachBottom() {
|
|
if (this.finished) return false;
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
getDataByConnect(data) {
|
|
if (data.msgType == "updateOrderTrades") {
|
|
this.list = [];
|
|
this.finished = false;
|
|
this.getList()
|
|
}
|
|
},
|
|
emptyFunc() {
|
|
|
|
},
|
|
showItem(item) {
|
|
let flag = true;
|
|
// if (this.typeIndex == 2 && item.order_child[0] && !item.order_child[0].consignee) flag = false
|
|
return flag;
|
|
},
|
|
onReload() {
|
|
this.list = [];
|
|
this.finished = false;
|
|
this.getList();
|
|
},
|
|
setType(index) {
|
|
this.typeIndex = index;
|
|
this.onReload();
|
|
},
|
|
setOrderId(id) {
|
|
let that = this;
|
|
that.orderId = id;
|
|
that.Post(
|
|
{
|
|
order_id: id,
|
|
type: "miniprogram",
|
|
platform: 'miniprogram'
|
|
},
|
|
'/api/pay/unify'
|
|
).then(res => {
|
|
if (res.data) {
|
|
uni.requestPayment({
|
|
nonceStr: res.data.nonceStr,
|
|
package: res.data.package,
|
|
paySign: res.data.paySign,
|
|
signType: res.data.signType,
|
|
timeStamp: res.data.timeStamp,
|
|
complete() {
|
|
that.list = [];
|
|
that.finished = false;
|
|
that.getList()
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
// 确认收货
|
|
confirmpost(id, index) {
|
|
let that = this;
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否确认收货?',
|
|
success: successRes => {
|
|
if (successRes.confirm) {
|
|
that.Post(
|
|
{
|
|
order_id: id
|
|
},
|
|
'/api/order/confirmPost'
|
|
).then(res => {
|
|
if (res.code == 200) {
|
|
list[index].order_child.map(item => {
|
|
item.status = 'WAIT_COMMENT';
|
|
});
|
|
list[index].status = 'WAIT_COMMENT';
|
|
list[index].postFlag = false;
|
|
that.list = list;
|
|
uni.showToast({
|
|
title: '操作成功'
|
|
});
|
|
that.$forceUpdate();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
// 关闭订单
|
|
closeOrder(id, index) {
|
|
console.log(id);
|
|
console.log(index);
|
|
let that = this;
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否关闭订单?',
|
|
success: successRes => {
|
|
if (successRes.confirm) {
|
|
that.Post(
|
|
{
|
|
order_id: id
|
|
},
|
|
'/api/order/closeOrder'
|
|
).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '关闭成功',
|
|
icon: 'success'
|
|
});
|
|
that.list = [];
|
|
that.finished = false;
|
|
that.getList();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//删除订单
|
|
deletOrder(id) {
|
|
let that = this;
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否删除订单?',
|
|
success: successRes => {
|
|
if (successRes.confirm) {
|
|
that.Post(
|
|
{
|
|
order_id: id
|
|
},
|
|
'/api/order/delOrder'
|
|
).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '删除成功',
|
|
icon: 'success'
|
|
});
|
|
that.list = [];
|
|
that.finished = false;
|
|
that.getList();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
// 申请退款
|
|
refund(id, index) {
|
|
console.log(id);
|
|
let that = this;
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '是否申请退款?',
|
|
success: successRes => {
|
|
if (successRes.confirm) {
|
|
that.Post(
|
|
{
|
|
order_id: id
|
|
},
|
|
'/api/order/applyRefund'
|
|
).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '申请成功',
|
|
icon: 'success'
|
|
});
|
|
that.onReload();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
search(e) {
|
|
this.list = [];
|
|
this.getList();
|
|
// if (e.keyCode == 13) {
|
|
// // 提交
|
|
// this.keywords = e.target.value;
|
|
// }
|
|
},
|
|
getList() {
|
|
let data = {
|
|
status: this.typeList[this.typeIndex].id == 'ALL' ? '' : this.typeList[this.typeIndex].true_id || this.typeList[this.typeIndex].id,
|
|
offset: this.list.length,
|
|
limit: 5,
|
|
name: this.keywords,
|
|
type: this.typeList[this.typeIndex].name == '待使用' ? 1 : (this.typeList[this.typeIndex].name == '待发货' ? 2 : '')
|
|
};
|
|
this.Post(data, '/api/order/orderList').then(res => {
|
|
this.list = [...this.list, ...res.data]
|
|
if (res.data.length < 5) {
|
|
this.finished = true;
|
|
}
|
|
});
|
|
},
|
|
UpdateOrder(id) {
|
|
this.ajaxFlag = false;
|
|
let list = this.list;
|
|
this.Post(
|
|
{
|
|
order_id: id
|
|
},
|
|
'/api/order/orderDetail'
|
|
).then(res => {
|
|
this.ajaxFlag = true;
|
|
list.map(item => {
|
|
if (item.order_id == id) {
|
|
item = res.data;
|
|
}
|
|
});
|
|
this.list = list;
|
|
});
|
|
},
|
|
choseType(item) {
|
|
// 判断是否是君到苏州来源,如果是君到苏州就跳到君到苏州订单详情,目前只支持景点、邮寄、演出和线路
|
|
if(item.client_id == 'jdsz') {
|
|
// 如果是君到苏州的需要先拿到君到苏州token,获取订单详情去判断产品类型
|
|
this.checkIsLoginJdsz().then(res => {
|
|
if(res) {
|
|
uni.request({
|
|
method: 'POST',
|
|
url: this.JDSZAPIURL + '/api/order/query',
|
|
header: {
|
|
'content-type': 'application/json',
|
|
'token': res
|
|
},
|
|
data: {
|
|
order_id: item.order_id
|
|
},
|
|
success: resTwo => {
|
|
let data = resTwo.data.data
|
|
let httpUrl = 'https://test.m.cloud.sz-trip.com/'
|
|
let url = ''
|
|
// 根据类型跳转到不同的订单详情页面
|
|
switch (data.order_product_list[0].product_model){
|
|
case 'ticket': // 景点
|
|
url = httpUrl + 'TicketOrderDetail?order_id=' + data.order_id + '&token=' + res
|
|
break;
|
|
case 'post': // 邮寄
|
|
url = httpUrl + 'CulturalCreationOrderDetail?order_id=' + data.order_id + '&token=' + res
|
|
break;
|
|
case 'show': // 演出
|
|
url = httpUrl + 'TicketOrderDetail?order_id=' + data.order_id + '&token=' + res
|
|
break;
|
|
case 'line': // 线路
|
|
url = httpUrl + 'LineOrderDetail?order_id=' + data.order_id + '&token=' + res
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
uni.navigateTo({
|
|
url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url)
|
|
});
|
|
}
|
|
})
|
|
}
|
|
})
|
|
return;
|
|
}
|
|
uni.navigateTo({
|
|
url:'/subPackages/order/detail?id='+item.order_id
|
|
});
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
view {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.common-box {
|
|
height: 90rpx;
|
|
}
|
|
|
|
.common-types {
|
|
background: white;
|
|
height: 90rpx;
|
|
font-size: 31rpx;
|
|
z-index: 10;
|
|
margin: auto;
|
|
color: #666;
|
|
overflow-x: scroll;
|
|
overflow-y: hidden;
|
|
padding: 0 27rpx;
|
|
}
|
|
|
|
.common-types::-webkit-scrollbar {
|
|
width: 0rpx;
|
|
height: 0;
|
|
display: none;
|
|
}
|
|
|
|
.common-type {
|
|
flex-shrink: 0;
|
|
margin: 0 26rpx;
|
|
line-height: 90rpx;
|
|
height: 90rpx;
|
|
position: relative;
|
|
}
|
|
|
|
.common-type.active {
|
|
font-size: 31rpx;
|
|
font-weight: bold;
|
|
color: #00AEA0;
|
|
}
|
|
|
|
.common-type.active:after {
|
|
display: block;
|
|
width: 60%;
|
|
background-color: rgba(0, 215, 237, 1);
|
|
font-size: 0;
|
|
content: '1';
|
|
margin: auto;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 1rpx;
|
|
height: 4rpx;
|
|
background: #71B580;
|
|
border-radius: 2rpx;
|
|
}
|
|
|
|
.bg {
|
|
min-height: 100vh;
|
|
background-color: #f7f7f7;
|
|
}
|
|
|
|
.noDate {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-top: 200rpx;
|
|
}
|
|
|
|
.noDate img {
|
|
width: 514rpx;
|
|
height: auto;
|
|
}
|
|
|
|
.noDate view {
|
|
font-size: 24rpx;
|
|
color: #777777;
|
|
}
|
|
|
|
.trade-list {
|
|
padding: 28rpx 26rpx;
|
|
}
|
|
|
|
.trade-items {
|
|
background-color: white;
|
|
margin-bottom: 28rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.trade-item-head {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 28rpx 20rpx;
|
|
border-bottom: 1rpx solid #d8d8d8;
|
|
}
|
|
|
|
.trade-item-head-tid {
|
|
font-size: 24rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
color: #666666;
|
|
}
|
|
|
|
.trade-item-head-state {
|
|
font-size: 27rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: bold;
|
|
color: #00AEA0;
|
|
}
|
|
|
|
.trade-item-head-name {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
font-size: 31rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: bold;
|
|
color: #333333;
|
|
|
|
image {
|
|
width: 33rpx;
|
|
height: 31rpx;
|
|
}
|
|
|
|
view {
|
|
margin-left: 13rpx;
|
|
}
|
|
}
|
|
|
|
.trade-item-pros {
|
|
display: flex;
|
|
/* background-color: #F2F2F2; */
|
|
flex-direction: column;
|
|
}
|
|
|
|
.trade-item-pro {
|
|
display: flex;
|
|
padding: 20rpx;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.trade-item-pro-img {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.trade-item-pro-img image {
|
|
width: 180rpx;
|
|
height: 180rpx;
|
|
border-radius: 10rpx;
|
|
}
|
|
|
|
.trade-item-pro-price {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.trade-item-pro-title {
|
|
text-align: left;
|
|
flex: 1;
|
|
padding: 0 20rpx;
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.trade-item-pro-price view {
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
text-wrap: none;
|
|
white-space: nowrap;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.trade-item-pro-price-pri {
|
|
font-size: 27rpx;
|
|
color: #fc514b;
|
|
font-weight: 500;
|
|
color: #333333;
|
|
}
|
|
|
|
.trade-item-pro-num {
|
|
font-size: 24rpx;
|
|
color: #666666;
|
|
margin-top: 24rpx;
|
|
}
|
|
|
|
.trade-item-info {
|
|
font-size: 28rpx;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
background-color: white;
|
|
padding: 0rpx 20rpx;
|
|
margin-top: -6rpx;
|
|
/* border-bottom: 1px solid #B6B6B6; */
|
|
}
|
|
|
|
.trade-item-info text {
|
|
font-size: 36rpx;
|
|
font-weight: bold;
|
|
color: #333333;
|
|
}
|
|
|
|
.trade-item-btns {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
padding: 20rpx;
|
|
}
|
|
|
|
.trade-item-btns view {
|
|
margin-left: 20rpx;
|
|
background: rgba(237, 237, 237, 0);
|
|
border: 1rpx solid #999999;
|
|
border-radius: 27rpx;
|
|
padding: 8rpx 16rpx;
|
|
font-size: 27rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 500;
|
|
color: #333333;
|
|
}
|
|
|
|
.trade-item-btns .pay-btn {
|
|
color: #FFFFFF;
|
|
background: linear-gradient(90deg, #FD6F34, #F4A61F);
|
|
border: none;
|
|
padding: 10rpx 16rpx;
|
|
}
|
|
|
|
.comment-btn {
|
|
width: 100rpx;
|
|
text-align: center;
|
|
line-height: 40rpx;
|
|
border-radius: 20rpx;
|
|
border: 1px solid #999999;
|
|
color: #333333;
|
|
justify-content: center !important;
|
|
font-size: 24rpx;
|
|
margin-top: 16rpx;
|
|
}
|
|
|
|
.list-common-empty {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 50vh;
|
|
}
|
|
|
|
.list-common-empty img {
|
|
width: 483rpx;
|
|
height: 254rpx;
|
|
}
|
|
|
|
.list-common-empty-tip {
|
|
margin-top: 61rpx;
|
|
|
|
font-size: 29rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 500;
|
|
color: #8599b5;
|
|
}
|
|
|
|
.com-flex-tao {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.search-box {
|
|
width: 697rpx;
|
|
height: 67rpx;
|
|
background: #f2f2f2;
|
|
border-radius: 33rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 8rpx 0 28rpx;
|
|
margin: 0 auto;
|
|
margin-bottom: 20rpx;
|
|
|
|
.left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
image {
|
|
width: 28rpx;
|
|
height: 30rpx;
|
|
}
|
|
|
|
input {
|
|
margin-left: 20rpx;
|
|
font-size: 31rpx;
|
|
font-weight: 400;
|
|
color: #333;
|
|
width: 450rpx;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
width: 107rpx;
|
|
height: 53rpx;
|
|
background: #71B580;
|
|
border-radius: 27rpx;
|
|
font-size: 28rpx;
|
|
font-weight: 400;
|
|
color: #ffffff;
|
|
line-height: 53rpx;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
.top-bg {
|
|
background: #fff;
|
|
padding-top: 20rpx;
|
|
}
|
|
</style>
|
|
|