jiazhipeng 4 months ago
parent
commit
c0c0a56d2d
  1. 7
      pages.json
  2. 26
      pages/cart/cart.vue
  3. 2
      pages/index/index.vue
  4. 13
      pages/login/login.vue
  5. 2
      pages/user/user.vue
  6. 4
      static/js/CommonFunction.js
  7. 9
      subPackages/homestay/order.vue
  8. 4
      subPackages/line/order.vue
  9. 8
      subPackages/line/orders.vue
  10. 671
      subPackages/order/orderDetail.vue
  11. 560
      subPackages/order/trades.vue
  12. 11
      subPackages/techan/order.vue
  13. 15
      subPackages/ticket/order.vue

7
pages.json

@ -223,6 +223,13 @@
"navigationBarTitleText": "全部订单"
}
},
{
"path": "order/orderDetail",
"style": {
"navigationBarTitleText": "订单详情",
"navigationStyle": "custom"
}
},
{
"path": "homestay/index",
"style": {

26
pages/cart/cart.vue

@ -16,13 +16,12 @@
<view style="font-size: 27rpx;color: #7C7C7C;" @click.stop="delCartByShop(item,index)">删除</view>
</view>
<uni-swipe-action-item v-for="(goods,goodsIndex) in item.goods" :key="goodsIndex" >
<view class="cart-item" :style="{'padding-bottom':goods.product.type=='hotel'?'60rpx':'20rpx'}"
@click.stop="gotoDetailByType(goods.product)">
<view class="cart-item" :style="{'padding-bottom':goods.product.type=='hotel'?'60rpx':'20rpx'}">
<view class="flex-between">
<view class="no-select" v-show="!goods.is_seld" @click.stop="changeGoodsSelect(goods,true)"></view>
<image class="select-img" v-show="goods.is_seld" @click.stop="changeGoodsSelect(goods,false)" src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png"></image>
<view class="cart-img" style="position: relative;">
<image class="cart-img" :src="goods.sku.headimg" mode="aspectFill"></image>
<image class="cart-img" :src="goods.sku.headimg" mode="aspectFill" @click.stop="gotoDetailByType(goods.product)"></image>
<view class="use-type">
{{goods.sku.use_type==1?"自提":goods.sku.use_type==2?"核销":
goods.sku.use_type==3?"邮寄或自提":"邮寄"}}
@ -218,7 +217,7 @@
if (v.sku.flag== "off") {
v.is_seld = false
} else {
if (v.product.type == 'hotel'&&(!v.strat_time||!v.end_time)) {
if (v.product.type == 'hotel'&&(!v.startDay||!v.endDay)) {
v.is_seld = false
} else {
v.is_seld = true
@ -241,7 +240,7 @@
if (v.sku.flag== "off") {
v.is_seld = false
} else {
if (v.product.type == 'hotel'&&(!v.strat_time||!v.end_time)) {
if (v.product.type == 'hotel'&&(!v.startDay||!v.endDay)) {
v.is_seld = false
} else {
v.is_seld = true
@ -263,7 +262,7 @@
if (item.sku.flag== "off") {
item.is_seld = false
} else {
if (item.product.type == 'hotel'&&(!item.strat_time||!item.end_time)) {
if (item.product.type == 'hotel'&&(!item.startDay||!item.endDay)) {
item.is_seld = false
uni.showToast({
title:'酒店产品需要选择时间',
@ -322,6 +321,7 @@
judgeHotelTime (data) {
this.$set(this.selectHotel, "startDay", data.startDay)
this.$set(this.selectHotel, "endDay", data.endDay)
this.$set(this.selectHotel, "differDays", data.differDays)
this.$refs.calendarPopup.close();
return
this.Post({
@ -332,6 +332,7 @@
if (res && res.code && res.data) {
this.$set(this.selectHotel, "startDay", data.startDay)
this.$set(this.selectHotel, "endDay", data.endDay)
this.$set(this.selectHotel, "differDays", data.differDays)
this.$refs.calendarPopup.close();
} else {
uni.showToast({
@ -382,7 +383,17 @@
sInfo: {...v.sku, buyNum: v.num}
})
} else if (v.product.type == "hotel") {
hotelOrderList.push(v)
console.log(v)
v.sku.selectDate = {
startDay: v.startDay,
endDay: v.endDay,
differDays: v.differDays
}
v.sku.buyNum = v.num
v.allSeldDate = []
hotelOrderList.push({
skuInfo: v.sku
})
}
})
@ -391,6 +402,7 @@
this.$store.commit("changeTicketOrderList", ticketOrderList);
this.$store.commit("changeFoodOrderList", foodOrderList);
this.$store.commit("changeHotelOrderList", hotelOrderList);
uni.setStorageSync('hotelOrderInfo', JSON.stringify(hotelOrderList))
// > > >
this.goCartNextPage(0)

2
pages/index/index.vue

@ -124,7 +124,7 @@
this.gotoDetailByType(item.product_model)
break;
case 2:
this.gotoPath(item.tdata.url)
this.gotoPath(item.front_model.inside)
break;
case 3:
this.gotoWebUrl(item.tdata.url)

13
pages/login/login.vue

@ -27,6 +27,7 @@ export default {
data() {
return {
isAgreed: false,
openid: ''
};
},
onLoad(options) {
@ -46,10 +47,10 @@ export default {
code: e.detail.code,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
token: uni.getStorageSync('token1')
}, '/api/mini_program/bindPhoneNumber')
openid: this.openid
}, '/api/uservice/user/bindPhoneNumber')
.then(res => {
this.$store.commit('changeUserInfo', res.data.userinfo);
this.$store.commit('changeUserInfo', res.data);
this.navigateBasedOnPath();
})
.catch(error => {
@ -107,11 +108,11 @@ export default {
loginType: 3
}, '/api/uservice/user/wxLogin')
.then(resTwo => {
this.$store.commit('changeUserInfo', resTwo.data.userinfo);
if (resTwo.data.userinfo.mobile) {
this.$store.commit('changeUserInfo', resTwo.data);
if (resTwo.data.isBindMobile) {
this.navigateBasedOnPath();
} else {
uni.setStorageSync('token1', resTwo.data.userinfo.token);
this.openid = resTwo.data.openid
this.$refs.popup.open('bottom');
}
})

2
pages/user/user.vue

@ -10,7 +10,7 @@
class="headImg" v-else></image>
</view>
<view class="username" v-if="userInfo.nickname">{{userInfo.nickname}}</view>
<view class="username" >请登录/注册 ></view>
<view class="username" v-else>请登录/注册 ></view>
</view>
<view class="top-right" v-if="userInfo.nickname">
个人信息 <image src="https://static.ticket.sz-trip.com/tongli/images/user/rightIcon1.png" mode=""></image>

4
static/js/CommonFunction.js

@ -251,7 +251,7 @@ Vue.prototype.gotoWebUrl = url => {
Vue.prototype.gotoDetailByType = item => {
let url = ''
if(item.is_package) {
url = '/subPackages/food/detail?id=' + item.id
url = '/subPackages/food/detail?id=' + item.product_id
Vue.prototype.gotoPath(url)
return;
@ -267,7 +267,7 @@ Vue.prototype.gotoDetailByType = item => {
url = '/subPackages/ticket/detail?id=' + (item.scene_id || item.id)
break;
case 'post':
url = '/subPackages/techan/detail?id=' + item.id
url = '/subPackages/techan/detail?id=' + (item.product_id || item.id)
break;
default:
break;

9
subPackages/homestay/order.vue

@ -310,19 +310,20 @@
]
}
console.log('data',data)
this.Post({
method: 'POST',
data: JSON.stringify(data)
}, '/api/order/create').then(res => {
console.log('成功');
if (res.code == 1) {
return;
uni.removeStorageSync('hotelOrderInfo')
this.Post({
order_id: res.data.order_id,
type: "miniprogram",
platform: 'miniprogram'
}, '/api/pay/unify').then(res => {
pay_platform: "miniprogram",
pay_method: 'abc'
}, '/api/order/pay').then(res => {
if (res.data) {
uni.requestPayment({
nonceStr: res.data.nonceStr,

4
subPackages/line/order.vue

@ -218,11 +218,13 @@
return;
}
const info = this.getPriceInfo(selectMonth, day);
if (info && info.product_price && info.product_price !== null && info.stock !== 0) {
console.log(info)
if (info && info.stock !== 0) {
info.selectMonth = selectMonth;
info.selectDate = day;
this.selectDate = info;
}
this.$forceUpdate()
},
//
minus(index) {

8
subPackages/line/orders.vue

@ -254,8 +254,6 @@
data: JSON.stringify(data),
method: 'POST',
},'/api/order/create').then(res => {
console.log(res)
return;
if(res.code == 1) {
let order_id = res.data.order_id
this.$store.commit("changeLineInfo", null);
@ -263,9 +261,9 @@
this.Post({
order_id: order_id,
type: "miniprogram",
platform: 'miniprogram'
}, '/api/pay/unify').then(res => {
pay_platform: "miniprogram",
pay_method: 'abc'
}, '/api/order/pay').then(res => {
if (res.data) {
uni.requestPayment({
nonceStr: res.data.nonceStr,

671
subPackages/order/orderDetail.vue

@ -0,0 +1,671 @@
<template>
<view class="bg">
<view class="title-box">
<uni-icons type="left" size="30" @click="goBack"></uni-icons>
<view>订单状态</view>
</view>
<view class="state-box">
<view>{{info.state_text}}</view>
<!-- 待支付时会显示自动取消时间 -->
<view v-if="info.state=='WAIT_PAYMENT'" class="close-time">
订单将在<span>{{info.close_time.slice(-8)}}</span>自动取消</view>
<!-- 待退款 -->
<view v-if="info.state=='REFUNDING'" class="close-time">系统将在1-7个工作日内原路退回您的原支付账户</view>
<!-- 退款完成 -->
<view v-if="info.state=='REFUND'" class="close-time">您的退款金额已退还到您的原支付账户</view>
</view>
<view class="box">
<!-- 循环子订单 -->
<view v-for="(item,index) in orderChildList" :key="index">
<!-- 核销码 景点线路自提 -->
<view class="" v-if="item.isQrcode && item.qrcode.length > 0">
<view class="qrcode-remain">
还剩<span>{{item.remainNum}}</span>张未核销
</view>
<swiper class="qrcode-box" :circular="false" previous-margin="100rpx" next-margin="100rpx"
:duration="800" :current="item.current" @change="swiperChange($event,item)">
<swiper-item v-for="(qrItem, qrIndex) in item.qrcode" :key="qrIndex" class="flex-center">
<view class="qrcode-item flex-column">
<view class="qrcode-title">{{item.sku_name}}</view>
<image :src="qrItem.qrcodeimg" style="width: 300rpx;height: 300rpx;"
mode="aspectFill"></image>
<canvas :id="'qrcodeT'+qrItem.use_code+qrIndex" :canvas-id="'qrcodeT'+qrItem.use_code+qrIndex"
style="width:150px;height:150px;z-index: -20;bottom: -500px;position: absolute;"></canvas>
<view class="qrcode-subtitle">
核销码:{{qrItem.use_code}}</view>
<view class="complete-text flex-center"
v-if="qrItem.state > 0">
<view class="flex-center" v-if="qrItem.state == 1">
已核销
</view>
<view class="flex-center" v-else>
已失效
</view>
</view>
</view>
</swiper-item>
</swiper>
<!-- 指示点 -->
<view class="swiper-point flex-center">
<view v-for="(qrItem,qrIndex) in item.qrcode" :key="qrIndex"
:class="[{'swiper-points': qrIndex == item.current}]"></view>
</view>
<!-- 提示语 -->
<view class="swiper-prompt">左右滑动核销其他二维码</view>
</view>
<!-- 收货地址 -->
<view class="product-box" v-if="item.product_model == 'post' && !Array.isArray(item.consignee_info)">
<view class="title">收货信息</view>
<view class="subtitle" style="font-weight: bold;font-size: 31rpx;">{{item.consignee_info.name}} {{item.consignee_info.tel}}</view>
<view class="subtitle"><span>{{item.consignee_info.address}}</span></view>
</view>
<!-- 景点商品详情 -->
<view class="product-box" v-if="item.product_model == 'ticket'">
<view class="title" @click="item.type=item.product_model;gotoDetailByType(item)">
{{item.product_title}}
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/rightIcon.png"
class="rightIcon"></image>
</view>
<view class="subtitle" v-if="item.use_date"><span>出行时间</span>{{item.use_date}}</view>
<view class="subtitle" v-if="item.scene_detail.open_time"><span>开放时间</span>{{item.scene_detail.open_time}}</view>
<view class="line"></view>
<view class="skutitle flex-between">
<view>{{item.sku_name}}</view>
<view>
<span>{{item.product_price / 100}}</span>
x{{item.product_num}}
</view>
</view>
</view>
<!-- 自提信息 -->
<view class="product-box" v-if="item.product_model == 'post' && item.pickup_shop_id > 0">
<view class="title">自提信息</view>
<view class="pick-box flex-between">
<view class="pick-title">
<view style="display: flex;align-items: center;">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/location.png" mode=""></image>
{{item.pickup_shop_info.title}}
</view>
<view class="pick-subtitle" style="padding: 20rpx 0 0 50rpx;">
{{item.pickup_shop_info.address}}
</view>
</view>
<view class="pick-subtitle flex-center">
<view v-if="item.pickup_shop_info.tel" @click="clickPhone(item.pickup_shop_info.tel)">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/phone.png" mode=""></image>
电话
</view>
<view style="margin-left: 35rpx;" v-if="item.pickup_shop_info.lon && item.pickup_shop_info.lat"
@click="openLocation(item.pickup_shop_info.lat,item.pickup_shop_info.lon)">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/navigation.png" mode=""></image>
导航
</view>
</view>
</view>
</view>
<!-- 邮寄自提商品详情 -->
<view class="product-box" v-if="item.product_model == 'post'">
<view class="good-box">
<image :src="item.product_img" mode="aspectFill" @click="item.type=item.product_model;gotoDetailByType(item)"></image>
<view class="flex-column">
<span class="good-title text-overflowRows">{{item.product_title}}</span>
<span class="good-subtitle">{{item.sku_name}}</span>
</view>
<view class="flex-column">
<span class="good-title">{{item.product_price / 100}}</span>
<span class="good-subtitle">x{{item.product_num}}</span>
</view>
</view>
</view>
<!-- 酒店信息 -->
<view class="product-box" v-if="item.product_model == 'hotel'">
<view class="title">入住信息</view>
<view class="hotel-title">
{{item.product_title}}
</view>
</view>
<!-- <view class="product-box" v-if="item.product_model == 'hotel'">
<view class="title">{{入住信息}}</view>
<view class="good-title">
{{item.product_title}}
</view>
<view class="order-time flex-between" style="justify-content: space-around;">
<view class="time">
<view style="font-size: 35rpx;font-weight: bold;">{{new Date(selectDate.startDay).Format('MM-dd')}}</view>
<view style="padding:0 14rpx">{{ ShowDateDay(new Date(selectDate.startDay).getDay()) }}</view>
<view style="color: #999999;">入住</view>
</view>
<view class="cal-day">
{{selectDate.differDays}}
</view>
<view class="time">
<view style="font-size: 35rpx;font-weight: bold;">{{new Date(selectDate.endDay).Format('MM-dd')}}</view>
<view style="padding:0 14rpx">{{ShowDateDay(new Date(selectDate.endDay).getDay()) }}</view>
<view style="color: #999999;">离店</view>
</view>
</view>
</view> -->
<!-- 景点出行人 -->
<view class="product-box" v-if="item.product_model == 'ticket' && item.phone">
<view class="title">出行人</view>
<view class="subtitle">
<span>手机号</span>{{item.phone}}
</view>
</view>
</view>
<view class="product-box">
<view class="subtitle flex-between">
<span>商品总额</span>{{info.total_money / 100}}
</view>
<view class="subtitle flex-between">
<span>优惠券</span>-{{info.preference_money / 100}}
</view>
<view class="subtitle flex-between">
<span>实付金额</span>
<view class="price">{{info.paid_money / 100}}</view>
</view>
</view>
<view class="product-box">
<view class="title">订单信息</view>
<view class="subtitle" style="display: flex;">
<span>订单账号</span>{{info.order_id}}
<view class="copy flex-around" @click="clickCopy">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/copy.png"></image>
复制
</view>
</view>
<view class="subtitle">
<span>下单时间</span>{{info.close_time}}
</view>
</view>
<button id="contact" open-type="contact" bindcontact="handleContact" session-from="sessionFrom">
<view class="kefu-box">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/kefu.png"></image>
联系客服
</view>
</button>
</view>
</view>
</template>
<script>
import QRCode from '@/static/js/weapp-qrcode.js'
export default {
data() {
return {
orderId: '',
info: {},
orderChildList: [],
}
},
onLoad(option) {
this.orderId = option.id
this.getDetail()
},
methods: {
getDetail() {
this.Post({
order_id: this.orderId
}, '/api/order/query').then(res => {
console.log(res.data)
this.info = res.data
this.orderChildList = res.data.order_product_list
// ticket线line
this.info.order_product_list.forEach(item => {
//
if(item.product_model == 'post' && item.consignee_info) item.consignee_info = JSON.parse(item.consignee_info)
console.log(item.consignee_info)
//
if(item.product_model == 'post' && item.pickup_shop_id > 0) item.pickup_shop_info = JSON.parse(item.pickup_shop_info)
//
if (['ticket', 'line', 'post'].includes(item.product_model)) {
item.isQrcode = true
if (item.product_model == 'post' && !item.pickup_shop_id) {
item.isQrcode = false
}
//
item.remainNum = 0
// index
item.current = 0
//
item.qrcode.forEach((qrItem, qrIndex) => {
if (qrItem.state == 0) {
item.remainNum += 1
}
this.getCodeImg(qrItem, qrIndex)
})
}
})
})
},
//
getCodeImg(item, index) {
new QRCode('qrcodeT' + item.use_code + index, {
text: item.use_code,
width: 150,
height: 150,
padding: 2,
colorDark: 'rgb(0,0,0)',
colorLight: 'rgb(255,255,255)',
correctLevel: QRCode.CorrectLevel.M, //
callback: res => {
this.$set(item, 'qrcodeimg', res.path);
this.$forceUpdate();
}
});
},
//
swiperChange(e,item) {
let {
current,
source
} = e.detail;
//current
if (source === 'autoplay' || source === 'touch') {
item.current = current;
}
this.$forceUpdate()
},
//
clickCopy() {
uni.setClipboardData({
data: this.info.order_id, //
success: () => {
//
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss" scoped>
.bg {
width: 750rpx;
overflow-x: hidden;
min-height: 100vh;
background-color: #F7F7F7;
padding-bottom: 200rpx;
}
.title-box {
font-size: 40rpx;
padding: 0 26.67rpx;
z-index: 2;
display: flex;
align-items: center;
width: 100%;
background: #D3E8A7;
height: 176rpx;
padding: 90rpx 26rpx 0;
view {
font-weight: 400;
font-size: 36rpx;
color: #000000;
margin-left: 230rpx;
}
}
.state-box {
width: 750rpx;
height: 240rpx;
background: linear-gradient(180deg, #D3E8A7, #D3E8A7, #D3E8A7, #F7F7F7);
padding: 42rpx 0 0 53rpx;
font-weight: bold;
font-size: 43rpx;
color: #000000;
.close-time {
font-weight: 500;
font-size: 27rpx;
color: #000000;
span {
color: #C3282E;
}
}
}
.box {
position: relative;
padding: 0 26rpx;
margin-top: -66rpx;
.product-box {
padding: 28rpx 28rpx 46rpx;
margin-bottom: 22rpx;
background: #FFFFFF;
border-radius: 20rpx;
.title {
font-weight: bold;
font-size: 36rpx;
color: #000000;
display: flex;
align-items: center;
.rightIcon {
width: 17.33rpx;
height: 29.33rpx;
margin-left: 25rpx;
}
}
.subtitle {
font-weight: 500;
font-size: 27rpx;
color: #000000;
margin-top: 18rpx;
span {
color: #666666;
min-width: 125rpx;
}
}
.line {
width: 643rpx;
height: 1rpx;
background: #d8d8d83b;
margin: 33rpx 0;
}
.skutitle {
font-weight: 500;
font-size: 27rpx;
color: #000000;
span {
margin-right: 60rpx;
}
}
.price {
font-weight: bold;
font-size: 34rpx;
color: #C3282E;
}
.price::before {
font-size: 24rpx;
content: '¥';
}
.copy {
width: 93rpx;
height: 37rpx;
border-radius: 11rpx;
border: 1rpx solid #515150;
font-weight: 500;
font-size: 22rpx;
color: #515150;
margin-left: 30rpx;
image {
width: 22rpx;
height: 23.33rpx;
}
}
.pick-box {
margin-top: 50rpx;
.pick-title {
font-weight: bold;
font-size: 31rpx;
color: #222222;
width: 500rpx;
image {
width: 33.33rpx;
height: 33.33rpx;
margin-right: 18rpx;
}
}
.pick-subtitle {
font-weight: 500;
font-size: 24rpx;
color: #666666;
image {
width: 56rpx;
height: 56rpx;
margin-bottom: 10rpx;
display: block;
}
&>view {
display: flex;
flex-direction: column;
align-items: center;
}
}
}
.hotel-title {
font-weight: bold;
font-size: 31rpx;
color: #222222;
margin-top: 30rpx;
}
}
.kefu-box {
height: 96rpx;
background: #FFFFFF;
border-radius: 20rpx;
padding-left: 27rpx;
display: flex;
align-items: center;
font-weight: 500;
font-size: 31rpx;
color: #000000;
image {
width: 44rpx;
height: 44rpx;
margin-right: 14rpx;
}
}
.good-box {
display: flex;
image {
width: 140rpx;
height: 140rpx;
border-radius: 13rpx;
}
&>view {
height: 140rpx;
justify-content: space-between;
padding-bottom: 14rpx;
margin-left: 18rpx;
width: 371rpx;
}
&>view:last-child {
margin-left: auto;
width: fit-content;
text-align: right;
}
.good-title {
font-weight: bold;
font-size: 27rpx;
color: #000000;
}
.good-subtitle {
font-weight: 500;
font-size: 24rpx;
color: #666666;
}
.order-time{
height: 107rpx;
background: linear-gradient(180deg, #FFFFFF, #F7F7F7);
.time{
display: flex;
font-family: PingFang SC;
font-size: 24rpx;
color: #000000;
align-items: center;
}
}
.cal-day{
background: #F2F2F2;
border-radius: 17rpx;
padding: 5rpx 16rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #000000;
}
}
}
button {
padding: 0;
}
button::after {
border: none;
background-color: rgba(0, 0, 0, 0);
}
//
.qrcode-remain {
font-weight: bold;
font-size: 29rpx;
color: #000000;
text-align: center;
span {
width: 60rpx;
text-align: center;
color: #C3282E;
display: inline-block;
}
}
.qrcode-box {
height: 456rpx;
display: flex;
align-items: center;
margin-top: 32rpx;
.qrcode-item {
width: 467rpx !important;
height: 456rpx !important;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 33rpx 0rpx rgba(102, 102, 102, 0.2);
border-radius: 20rpx;
padding: 25rpx 0;
justify-content: space-between;
align-items: center;
position: relative;
image {
width: 300rpx;
height: 300rpx;
}
.qrcode-title {
font-weight: bold;
font-size: 32rpx;
color: #000000;
}
.qrcode-subtitle {
font-weight: 500;
font-size: 27rpx;
color: #888888;
}
.complete-text {
position: absolute;
width: 300rpx;
height: 300rpx;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
background: rgba(0, 0, 0, .5);
view {
width: 200rpx;
height: 200rpx;
background: #FFFFFF;
border-radius: 100rpx;
font-weight: bold;
font-size: 36rpx;
color: #000000;
}
}
}
}
.swiper-point {
height: 63rpx;
view {
width: 11rpx;
height: 11rpx;
background: #D3E8A7;
border-radius: 50%;
}
view:not(:first-child) {
margin-left: 13rpx;
}
.swiper-points {
background: #6A8A2D;
}
}
.swiper-prompt {
font-weight: 500;
font-size: 29rpx;
color: #C3282E;
text-align: center;
margin-bottom: 45rpx;
}
</style>

560
subPackages/order/trades.vue

@ -1,28 +1,34 @@
<template>
<view class="bg">
<!-- 顶部搜索和筛选区域 -->
<view class="top-bg">
<view class="flex-around" style="margin-bottom: 20rpx;">
<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()" />
<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>
<view class="select-btn" @click="range = []; dateIndex = null; $refs.popup.open()">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/order/select.png" mode="aspectFill"></image>
筛选
</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' : '']">
:class="['common-type', typeIndex === index ? 'active' : '']">
{{ item.name }}
</view>
</view>
</view>
</view>
<view class="list-common-empty" v-if="list.length == 0">
<!-- 无订单提示 -->
<view class="list-common-empty" v-if="list.length === 0">
<img src="https://static.ticket.sz-trip.com/shiweisuzhou/images/user/noTrades.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)">
@ -50,112 +56,141 @@
<text>{{ item.total_money / 100 }}</text>
</view>
<view class="trade-item-btns">
<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 @click.stop="() => refund(item.order_id, key)" v-if="['WAIT_POST','WAIT_USE','PAID'].includes(item.state)">
取消订单
</view>
<view @click.stop="() => closeOrder(item.order_id, item)" v-if="item.state === 'UNPAID'">
关闭订单
</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.state === 'UNPAID'">
立即支付
</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> -->
<!-- 筛选弹框 -->
<uni-popup ref="popup" type="bottom" :safe-area="false">
<view class="popup-box">
<view class="popup-top flex-between">
<view @click="$refs.popup.close()">取消</view>
<view>订单筛选</view>
<view @click="changeDate">确定</view>
</view>
<view class="popup-content">
<view class="content-top">下单时间</view>
<view class="content-bottom">
<view class="flex-between">
<view :class="['content-item', {'content-active': dateIndex === 0 && range.length === 0}]"
@click="range = []; dateIndex = 0">近七天</view>
<view :class="['content-item', {'content-active': dateIndex === 1 && range.length === 0}]"
@click="range = []; dateIndex = 1">近三十天</view>
</view>
<uni-datetime-picker v-model="range" type="daterange" :end="new Date().Format('Y-MM-dd')" />
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
export default {
name: 'Trades',
data() {
return {
finished: false,
list: [],
typeList: [{
name: '全部',
id: 'ALL'
},
{
name: '待付款',
id: 'WAIT_PAYMENT'
},
{
name: '待发货',
id: 'WAIT_POST'
},
{
name: '待使用/出行',
id: 'WAIT_USE'
},
{
name: '待收货',
id: 'WAIT_DELIVERY'
},
{
name: '退款/售后',
id: 'NEED_REFUND'
}
typeList: [
{ name: '全部', id: 'ALL' },
{ name: '待付款', id: 'WAIT_PAYMENT' },
{ name: '待发货', id: 'WAIT_POST' },
{ name: '待使用/出行', id: 'WAIT_USE' },
{ name: '待收货', id: 'WAIT_DELIVERY' },
{ name: '退款/售后', id: 'NEED_REFUND' }
],
typeIndex: 0,
ajaxFlag: true,
keywords: '',
orderId: null,
dateRange: [],
type: ''
type: '',
range: [],
dateIndex: null,
};
},
onLoad(options) {
console.log(options);
if (options.type) this.typeIndex = this.typeList.findIndex(vm => vm.name === options.type);
uni.$on("updateDataByConnect", this.getDataByConnect)
if (options.type) {
this.typeIndex = this.typeList.findIndex(vm => vm.name === options.type);
}
uni.$on("updateDataByConnect", this.getDataByConnect);
},
onShow() {
this.getList();
},
onUnload() {
uni.$off("updateDataByConnect", this.getDataByConnect)
uni.$off("updateDataByConnect", this.getDataByConnect);
},
onReachBottom() {
if (this.finished) return false;
this.getList();
},
watch: {
range(newval) {
console.log('范围选:', this.range);
},
},
methods: {
// n
getLastNDays(n) {
const endDate = new Date();
const startDate = new Date();
startDate.setDate(endDate.getDate() - n + 1); //
// YYYY-MM-DD
const formatDate = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
return [formatDate(startDate), formatDate(endDate)];
},
//
getDataByConnect(data) {
if (data.msgType == "updateOrderTrades") {
this.list = [];
this.finished = false;
this.getList()
if (data.msgType === "updateOrderTrades") {
this.resetList();
this.getList();
}
},
emptyFunc() {
},
//
showItem(item) {
let flag = true;
// if (this.typeIndex == 2 && item.order_child[0] && !item.order_child[0].consignee) flag = false
// if (this.typeIndex === 2 && item.order_child[0] && !item.order_child[0].consignee) flag = false;
return flag;
},
//
onReload() {
this.list = [];
this.finished = false;
this.resetList();
this.getList();
},
//
setType(index) {
this.typeIndex = index;
this.onReload();
},
// ID
setOrderId(id) {
let that = this;
that.orderId = id;
that.Post({
this.orderId = id;
this.Post({
order_id: id,
type: "miniprogram",
platform: 'miniprogram'
},
'/api/pay/unify'
).then(res => {
}, '/api/pay/unify')
.then(res => {
if (res.data) {
uni.requestPayment({
nonceStr: res.data.nonceStr,
@ -169,15 +204,14 @@
'hRZoiEES2BWtKb6Xgsnn8khLQH9un5j_11qu0bwlhfE',
//
'YyTCUIYBnrj9CyKks8cOjNX_Rk8a4yVdswMP-zXVbhc'
]
];
uni.requestSubscribeMessage({
tmplIds: templateIds,
complete (res) {
that.list = [];
that.finished = false;
that.getList()
complete: () => {
this.resetList();
this.getList();
}
})
});
}
});
}
@ -185,28 +219,22 @@
},
//
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 == 1) {
list[index].order_child.map(item => {
this.Post({ order_id: id }, '/api/order/confirmPost')
.then(res => {
if (res.code === 1) {
this.list[index].order_child.forEach(item => {
item.status = 'WAIT_COMMENT';
});
list[index].status = 'WAIT_COMMENT';
list[index].postFlag = false;
that.list = list;
uni.showToast({
title: '操作成功'
});
that.$forceUpdate();
this.list[index].status = 'WAIT_COMMENT';
this.list[index].postFlag = false;
this.list = [...this.list];
uni.showToast({ title: '操作成功' });
this.$forceUpdate();
}
});
}
@ -215,54 +243,36 @@
},
//
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 == 1) {
uni.showToast({
title: '关闭成功',
icon: 'success'
});
that.list = [];
that.finished = false;
that.getList();
this.Post({ order_id: id }, '/api/order/close')
.then(res => {
if (res.code === 1) {
uni.showToast({ title: '关闭成功', icon: 'success' });
this.resetList();
this.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 == 1) {
uni.showToast({
title: '删除成功',
icon: 'success'
});
that.list = [];
that.finished = false;
that.getList();
this.Post({ order_id: id }, '/api/order/delOrder')
.then(res => {
if (res.code === 1) {
uni.showToast({ title: '删除成功', icon: 'success' });
this.resetList();
this.getList();
}
});
}
@ -271,91 +281,95 @@
},
// 退
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 == 1) {
uni.showToast({
title: '申请成功',
icon: 'success'
});
that.onReload();
this.Post({ order_id: id }, '/api/order/refund')
.then(res => {
if (res.code === 1) {
uni.showToast({ title: '申请成功', icon: 'success' });
this.onReload();
}
});
}
}
});
},
search(e) {
this.list = [];
//
search() {
this.resetList();
this.getList();
},
//
changeDate() {
if (this.dateIndex === 0) {
this.range = this.getLastNDays(7);
} else if (this.dateIndex === 1) {
this.range = this.getLastNDays(30);
}
this.$refs.popup.close();
this.resetList();
this.getList();
// if (e.keyCode == 13) {
// //
// this.keywords = e.target.value;
// }
},
//
getList() {
let data = {
state: this.typeList[this.typeIndex].id == 'ALL' ? '' : this.typeList[this.typeIndex].true_id ||
this.typeList[this.typeIndex].id,
const data = {
state: this.typeList[this.typeIndex].id === 'ALL' ? '' : this.typeList[this.typeIndex].id,
offset: this.list.length,
limit: 5,
keywords: this.keywords,
type: this.typeList[this.typeIndex].name == '待使用' ? 1 : (this.typeList[this.typeIndex].name ==
'待发货' ? 2 : '')
start_date: this.range[0] || '',
end_date: this.range[1] || ''
};
this.Post(data, '/api/order/list').then(res => {
this.list = [...this.list, ...res.data.list]
this.Post(data, '/api/order/list')
.then(res => {
this.list = [...this.list, ...res.data.list];
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.Post({ order_id: id }, '/api/order/orderDetail')
.then(res => {
this.ajaxFlag = true;
list.map(item => {
if (item.order_id == id) {
item = res.data;
const newList = this.list.map(item => {
if (item.order_id === id) {
return res.data;
}
return item;
});
this.list = list;
this.list = newList;
});
},
//
choseType(item) {
uni.navigateTo({
url: '/subPackages/order/detail?id=' + item.order_id
});
uni.navigateTo({ url: `/subPackages/order/orderDetail?id=${item.order_id}` });
},
//
resetList() {
this.list = [];
this.finished = false;
}
};
}
};
</script>
<style scoped lang="scss">
view {
//
view {
box-sizing: border-box;
}
}
.common-box {
.common-box {
height: 90rpx;
}
}
.common-types {
.common-types {
background: white;
height: 90rpx;
font-size: 31rpx;
@ -365,29 +379,29 @@
overflow-x: scroll;
overflow-y: hidden;
padding: 0 27rpx;
}
}
.common-types::-webkit-scrollbar {
.common-types::-webkit-scrollbar {
width: 0rpx;
height: 0;
display: none;
}
}
.common-type {
.common-type {
flex-shrink: 0;
margin: 0 26rpx;
line-height: 90rpx;
height: 90rpx;
position: relative;
}
}
.common-type.active {
.common-type.active {
font-size: 31rpx;
font-weight: bold;
color: #000;
}
}
.common-type.active:after {
.common-type.active:after {
display: block;
width: 60%;
font-size: 0;
@ -400,63 +414,63 @@
height: 4rpx;
background: #6A8A27;
border-radius: 2rpx;
}
}
.bg {
.bg {
min-height: 100vh;
background-color: #f7f7f7;
}
}
.noDate {
.noDate {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 200rpx;
}
}
.noDate img {
.noDate img {
width: 514rpx;
height: auto;
}
}
.noDate view {
.noDate view {
font-size: 24rpx;
color: #777777;
}
}
.trade-list {
.trade-list {
padding: 28rpx 26rpx;
}
}
.trade-items {
.trade-items {
background-color: white;
margin-bottom: 28rpx;
border-radius: 20rpx;
}
}
.trade-item-head {
.trade-item-head {
display: flex;
justify-content: space-between;
padding: 28rpx 20rpx;
border-bottom: 1rpx solid #d8d8d8;
}
}
.trade-item-head-tid {
.trade-item-head-tid {
font-size: 24rpx;
display: flex;
align-items: center;
color: #666666;
}
}
.trade-item-head-state {
.trade-item-head-state {
font-size: 27rpx;
font-family: PingFang SC;
font-weight: bold;
color: #6A8A27;
}
}
.trade-item-head-name {
.trade-item-head-name {
display: flex;
align-items: center;
@ -473,45 +487,45 @@
view {
margin-left: 13rpx;
}
}
}
.trade-item-pros {
.trade-item-pros {
display: flex;
/* background-color: #F2F2F2; */
flex-direction: column;
}
}
.trade-item-pro {
.trade-item-pro {
display: flex;
padding: 20rpx;
justify-content: space-between;
}
}
.trade-item-pro-img {
.trade-item-pro-img {
display: flex;
justify-content: center;
align-items: center;
}
}
.trade-item-pro-img image {
.trade-item-pro-img image {
width: 180rpx;
height: 180rpx;
border-radius: 10rpx;
}
}
.trade-item-pro-price {
.trade-item-pro-price {
display: flex;
flex-direction: column;
}
}
.trade-item-pro-title {
.trade-item-pro-title {
text-align: left;
flex: 1;
padding: 0 20rpx;
font-size: 28rpx;
}
}
.trade-item-pro-subtitle {
.trade-item-pro-subtitle {
text-align: left;
flex: 1;
padding: 0 20rpx;
@ -519,30 +533,30 @@
font-size: 24rpx;
color: #6A8A27;
margin-top: 20rpx;
}
}
.trade-item-pro-price view {
.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 {
.trade-item-pro-price-pri {
font-size: 27rpx;
color: #6A8A27;
font-weight: 500;
color: #333333;
}
}
.trade-item-pro-num {
.trade-item-pro-num {
font-size: 24rpx;
color: #666666;
margin-top: 24rpx;
}
}
.trade-item-info {
.trade-item-info {
font-size: 28rpx;
display: flex;
justify-content: flex-end;
@ -551,27 +565,28 @@
padding: 0rpx 20rpx;
margin-top: -6rpx;
/* border-bottom: 1px solid #B6B6B6; */
}
}
.trade-item-info text {
.trade-item-info text {
font-size: 36rpx;
font-weight: bold;
color: rgba(195, 40, 46, 1);
}
.trade-item-info text::before {
}
.trade-item-info text::before {
font-size: 26rpx;
content: '¥';
}
}
.trade-item-btns {
.trade-item-btns {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
padding: 20rpx;
}
}
.trade-item-btns view {
.trade-item-btns view {
margin-left: 20rpx;
background: rgba(237, 237, 237, 0);
border: 1rpx solid #999999;
@ -581,16 +596,16 @@
font-family: PingFang SC;
font-weight: 500;
color: #333333;
}
}
.trade-item-btns .pay-btn {
.trade-item-btns .pay-btn {
color: #FFFFFF;
background: #6A8A27;
border: none;
padding: 10rpx 16rpx;
}
}
.comment-btn {
.comment-btn {
width: 100rpx;
text-align: center;
line-height: 40rpx;
@ -600,36 +615,36 @@
justify-content: center !important;
font-size: 24rpx;
margin-top: 16rpx;
}
}
.list-common-empty {
.list-common-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 50vh;
}
}
.list-common-empty img {
.list-common-empty img {
width: 317.33rpx;
height: 282rpx;
}
}
.list-common-empty-tip {
.list-common-empty-tip {
margin-top: 36rpx;
font-weight: 500;
font-size: 32rpx;
color: #000000;
}
}
.com-flex-tao {
.com-flex-tao {
display: flex;
justify-content: space-between;
align-items: center;
}
}
.search-box {
width: 697rpx;
.search-box {
width: 600rpx;
height: 67rpx;
background: #f2f2f2;
border-radius: 33rpx;
@ -637,8 +652,6 @@
align-items: center;
justify-content: space-between;
padding: 0 8rpx 0 28rpx;
margin: 0 auto;
margin-bottom: 20rpx;
.left {
display: flex;
@ -669,10 +682,87 @@
line-height: 53rpx;
text-align: center;
}
}
}
.top-bg {
.top-bg {
background: #fff;
padding-top: 20rpx;
}
.select-btn {
font-weight: bold;
font-size: 20rpx;
color: #6A8A27;
image {
width: 33.33rpx;
height: 33.33rpx;
display: block;
}
}
.popup-box {
height: 70vh;
border-radius: 10rpx 10rpx 0 0;
background: #F7F7F7;
padding: 0 25rpx;
.popup-top {
height: 110rpx;
font-weight: 400;
font-size: 31rpx;
color: #000000;
&>view:nth-child(2) {
font-weight: bold;
font-size: 35rpx;
}
&>view:last-child {
color: #6A8A2D;
}
}
.popup-content {
height: calc(70vh - 110rpx);
padding: 0 28rpx;
background-color: #fff;
.content-top {
height: 94rpx;
border-bottom: 1px solid #CCCCCC;
font-weight: bold;
font-size: 32rpx;
color: #000000;
display: flex;
align-items: center;
}
.content-bottom {
padding-top: 40rpx;
.content-item {
margin-bottom: 27rpx;
width: 307rpx;
line-height: 67rpx;
text-align: center;
background: #FFFFFF;
border-radius: 7rpx;
border: 1px solid #CCCCCC;
font-weight: 500;
font-size: 31rpx;
color: #000000;
}
.content-active {
border: 1px solid #6A8A27;
color: #6A8A27;
}
::v-deep .uni-date {
border: 1px solid #CCCCCC;
}
}
}
}
</style>

11
subPackages/techan/order.vue

@ -508,10 +508,10 @@ export default {
this.Post(
{
order_id: res.data.order_id,
type: 'miniprogram',
platform: 'miniprogram'
pay_platform: "miniprogram",
pay_method: 'abc'
},
'/api/pay/unify'
'/api/order/pay'
).then(res => {
if (res.data) {
uni.requestPayment({
@ -520,10 +520,7 @@ export default {
paySign: res.data.paySign,
signType: res.data.signType,
timeStamp: res.data.timeStamp,
success: () => {
this.getSubscribeMessage()
},
fail() {
complete: () => {
uni.navigateTo({
url: '/subPackages/order/trades'
})

15
subPackages/ticket/order.vue

@ -470,9 +470,9 @@
this.$store.commit("choseCoupon", "");
this.Post({
order_id: order_id,
type: "miniprogram",
platform: 'miniprogram'
}, '/api/pay/unify').then(res => {
pay_platform: "miniprogram",
pay_method: 'abc'
}, '/api/order/pay').then(res => {
if (res.data) {
uni.requestPayment({
nonceStr: res.data.nonceStr,
@ -480,13 +480,8 @@
paySign: res.data.paySign,
signType: res.data.signType,
timeStamp: res.data.timeStamp,
success: () => {
this.getSubscribeMessage()
},
fail() {
uni.navigateTo({
url: '/subPackages/order/trades'
})
complete: () => {
this.gotoPath('/subPackages/order/trades')
}
})
}

Loading…
Cancel
Save