123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <view>
- <view class="orderWrapper">
- <!-- 头部区域:订单号、头像 -->
- <view class="orderHead">
- <view class="orderHeadTitle">
- <view>
- <text>订单号</text>
- <text class="orderDetail">{{info.orderId}}</text>
- </view>
- <view>
- <text>对方</text>
- <text class="orderDetail">{{info.teacherName}}教员</text>
- </view>
- </view>
- </view>
- <!-- 中部区域:订单详情 -->
- <view class="orderMid">
- <view>
- <text>对方ID</text>
- <text class="orderDetail">{{info.teacherId}}</text>
- </view>
- <view>
- <text>需求号</text>
- <text class="courseNum" @click="toNeedDetail">{{info.requireId}}</text>
- </view>
- <view>
- <text>课程号</text>
- <text class="courseNum" @click="toCourseDetail">{{info.courseId}}</text>
- </view>
- <view>
- <text>需求金额</text>
- <text class="orderDetail">{{info.requireSalary/100}}</text>
- </view>
- </view>
- <view class="orderBottom">
- <view>
- <text>订单内容</text>
- <text class="orderDetail">{{info.requireDetail}}</text>
- </view>
- <view>
- <text>支付日期</text>
- <text class="orderDetail">{{info.datetime}}</text>
- </view>
- <view>
- <text>订单状态</text>
- <text class="orderPayStatus">{{info.status}}</text>
- </view>
- </view>
-
- <view class="payWrapper">
- <view class="pay" v-if="!payment">
- <view class="paidSucceed">
- <button class="payYesButton" @click="getPhone" type="primary">查看手机号</button>
- <button class="payNoButton" :disabled="buttonDisabled" @click="applyForRefund" type="warn">{{refundButton}}</button>
- </view>
- </view>
- </view>
- <view v-if="showPhone">
- <text>{{phone}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- buttonDisabled: true,
- timer: '',
- refundButton: '同意退款',
- phone: '',
- showPhone: false,
- disabled: false,
- minute: 0,
- second: 0,
- info: {},
- payment: false, //是否退款
- };
- },
- onLoad(option) {
- if (option.orderId !== undefined) {
- this.getOne(decodeURIComponent(option.orderId))
- }
- },
- methods: {
- toNeedDetail() {
- uni.navigateTo({
- url: '/subpkg/student/require/student_require_all_detail?requireId=' + encodeURIComponent(this.info.requireId)
- })
- },
- toCourseDetail() {
- uni.navigateTo({
- url: '/subpkg/teacher/course/teacher_course_all_detail?courseId=' + encodeURIComponent(this.info.courseId)
- })
- },
- // 申请退款
- async applyForRefund() {
- const queryObj = {
- orderNo: this.info.orderId,
- reason: '五天内试课不成功'
- }
- const {data: result} = await uni.$http.get('/payment/wx-pay/refunds', queryObj)
- if (result.message === '成功') {
- this.refundButton = '退款处理中'
- this.timer = setInterval(() => {
- this.queryIsRefundOrder()
- }, 1000)
- }
-
- },
- // 获取手机号
- async getPhone() {
- const {data: result} = await uni.$http.get('/ucenter/mini-program-openid-uid/getPhoneByUid', {uid: this.info.teacherId})
- this.phone = result.data.phone
- this.showPhone = true
- },
- // 获取订单信息
- async getOne(id) {
- const queryObj = {
- orderId: id
- }
- const {data: result} = await uni.$http.get('/payment/order-info/getOrderInfoByOrderId', queryObj)
- this.info = result.data.one
- if (this.info.isRefund === 1) this.buttonDisabled = false
- if (this.info.status === '已退款') this.payment = true
- },
- async queryIsRefundOrder() {
- const {data: result} = await uni.$http.get('/payment/order-info/queryIsRefundOrder', {orderId: this.info.orderId})
- if('已退款' === result.message) {
- this.showPhone = false
- clearInterval(this.timer)
- this.payment = true
- this.info.status = '已退款'
- uni.$showMsg('退款成功')
- }
- }
-
- }
- }
- </script>
- <!-- 设置页面背景 -->
- <style lang="scss">
- page{
- height: 100%;
- // background-color: #FFF;
- }
- </style>
- <style lang="scss" scoped>
- /* 设置全局边距 */
- .orderWrapper{
- padding-left: 20rpx;
- /* background-color: yellowgreen; */
- }
- /* 头部区域 */
- .orderHead{
- display: flex;
- position: relative;
- height: 200rpx;
- padding-top: 20rpx;
- }
- /* 头像 */
- .headImg{
- width: 160rpx;
- height: 160rpx;
- border-radius: 30rpx;
- position: absolute;
- right: 30rpx;
- }
- .orderHeadTitle{
- display: flex;
- flex-direction: column;
- height: 80px;
- justify-content: space-around;
- }
- /* 设置内容样式 */
- .orderDetail,
- .courseNum,
- .orderPayStatus{
- margin-left: 20rpx;
- font-weight: bold;
- }
- .courseNum{
- color: #00B0F0;
- text-decoration: underline;
- }
- /* 支付状态字体样式 */
- .orderPayStatus{
- color: red;
- }
- /* 中部区域 */
- .orderMid{
- height: 220rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- }
- /* 底部区域 */
- .orderBottom{
- margin-top: 40rpx;
- height: 260rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- }
- /* 支付倒计时 */
- .orderPay{
- margin-top: 40rpx;
- display: flex;
- align-items: baseline;
- }
- /* 倒计时时间格式 */
- .orderPayTime{
- padding-left: 20rpx;
- font-weight: bold;
- font-size: 40rpx;
- color: red;
- }
- /* 提醒信息 */
- .warning{
- display: flex;
- justify-content: center;
- margin-top: 60rpx;
- }
- /* 提醒信息详情 */
- .warningDetail{
- width: 80%;
- display: flex;
- flex-direction: column;
- font-size: 44rpx;
- font-weight: bold;
- color: red;
- }
- /* 支付及查看信息按钮居中排列 */
- .payWrapper{
- display: flex;
- justify-content: center;
- }
- .payYesButton,
- .payNoButton{
- border-radius: 50rpx;
- color: white;
- }
- .payYesButton{
- background-color: #35b882;
- }
- .payNoButton{
- background-color: #3ed598;
- }
- .paidSucceed{
- display: flex;
- width: 100%;
- justify-content: space-around;
- }
- .pay{
- /* display: flex; */
- width: 100%;
- }
- </style>
|