| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885 |
- <template>
- <view class="container">
- <u-sticky bgColor="#fff">
- <!-- <view class="search-box">
- <u-input placeholder="搜索我的订单" v-model="serviceName"
- :customStyle="{backgroundColor: '#eee',borderRadius: '50rpx',padding:'12rpx 30rpx'}" :border="false"
- @confirm="getOrderList('reload')">
- <template slot="suffix">
- <image src="/static/search-02.png" mode="aspectFill" style="width: 40rpx;height: 36rpx;"
- @click="getOrderList('reload')">
- </image>
- </template>
- </u-input>
- </view> -->
- <u-tabs :lineWidth="50" :activeStyle="{ color: '#4B91D1' }" :list="typeList" keyName="value"
- :current="current" @change="changeTab"></u-tabs>
- </u-sticky>
- <!-- 正常状态 -->
- <view class="order-list" v-if="orderStatus != 7">
- <view class="order-item" v-for="item,index in orderList" :key="index" @click="toDetails(item)">
- <view class="order-t-box">
- <view class="order-t-box-l">
- <view class="order-name">
- {{item.serviceName || '-'}}(数量:{{item.orderNum || '-'}})
- </view>
- <view class="order-no">
- <span>订单编号:{{item.orderNo || '-'}}</span>
- <image class="icon" :src="copyImg" mode="aspectFill"
- @click.stop="$utils.copyTxt(item.orderNo)"></image>
- </view>
- </view>
- <view class="order-t-box-r">
- <span class="title">订单金额</span>
- <span class="price">¥{{item.totalPrice || '-'}}</span>
- </view>
- </view>
- <u-line color="#f0f0f0"></u-line>
- <view class="order-b-box">
- <view class="order-b-box-l">
- <view class="order-b-item">
- <span class="title">医院:</span>
- <span class="txt">{{item.hospitalVo.name || '-'}}</span>
- </view>
- <view class="order-b-item">
- <span class="title">科室:</span>
- <span class="txt">{{item.hospitalDepartmentName || '-'}}</span>
- </view>
- <view class="order-b-item">
- <span class="title">就诊人:</span>
- <span class="txt">{{item.patientVo.name || '-'}}({{item.patientVo.mobile || '-'}})</span>
- </view>
- </view>
- <view class="order-b-box-r">
- <span class="status"
- :class="item.status == 6 ? 'cancle' : ''">{{getStatusTxt(item.status)}}</span>
- </view>
- </view>
- <u-line color="#f0f0f0"></u-line>
- <view class="btn-box">
- <span class="time">{{$utils.mFormatDate(item.expectedTime, 'yyyy-MM-dd HH:mm') || '-'}}</span>
- <view class="btn-box-r">
- <span class="btn btn1" v-if="item.status == 1" @click.stop="cancleOrder(item.id)">取消订单</span>
- <!-- -->
- <span class="btn btn2" v-if="item.status == 2 || item.status == 3"
- @click.stop="contactPerson(item.id)">联系护工</span>
- <span class="btn btn2" v-if="item.status == 4" @click.stop="goEvaluation(item.id)">去评价</span>
- </view>
- </view>
- </view>
- </view>
- <!-- 退款 -->
- <view class="order-list" v-else>
- <view class="order-item" v-for="item,index in orderList" :key="index" @click="toDetails(item,'refund')">
- <view class="order-t-box">
- <view class="order-t-box-l">
- <view class="order-name">
- {{item.serviceName || '-'}}(数量:{{item.orderNum || '-'}})
- </view>
- <view class="order-no">
- <span>退款订单号:{{item.orderRefundNo || '-'}}</span>
- <image class="icon" :src="copyImg" mode="aspectFill"
- @click.stop="$utils.copyTxt(item.orderRefundNo)"></image>
- </view>
- </view>
- <view class="order-t-box-r">
- <span class="title">退款金额</span>
- <span class="price">¥{{item.refundAmount || '-'}}</span>
- </view>
- </view>
- <u-line color="#f0f0f0"></u-line>
- <view class="order-b-box">
- <view class="order-b-box-l">
- <view class="order-b-item">
- <span class="title">医院:</span>
- <span class="txt">{{item.orderVo.hospitalName || '-'}}</span>
- </view>
- <view class="order-b-item">
- <span class="title">科室:</span>
- <span class="txt">{{item.orderVo.hospitalDepartmentName || '-'}}</span>
- </view>
- <view class="order-b-item">
- <span class="title">就诊人:</span>
- <span
- class="txt">{{item.orderVo.patientName || '-'}}({{item.orderVo.patientMobile || '-'}})</span>
- </view>
- </view>
- <view class="order-b-box-r">
- <span class="status">{{getRefundTxt(item.refundStatus)}}</span>
- </view>
- </view>
- <u-line color="#f0f0f0"></u-line>
- <view class="btn-box">
- <span class="time">{{$utils.mFormatDate(item.createTime, 'yyyy-MM-dd HH:mm') || '-'}}</span>
- <view class="btn-box-r">
- <span class="btn btn1" v-if="item.refundStatus == 1"
- @click.stop="cancleOrder(item.id)">取消退款</span>
- <span class="txt" v-if="item.refundStatus == 2">实退金额:{{item.actualRefundAmount || 0}}</span>
- </view>
- </view>
- </view>
- </view>
- <view class="empty-box" v-if="!orderList.length">
- <u-image src="/static/none.png" mode="aspectFill" width="582rpx" height="582rpx"></u-image>
- <span class="empty-txt">暂无数据!</span>
- <!-- <u-empty marginTop="100" style="width: 100%;"></u-empty> -->
- </view>
- <view style="width: 100%;padding-bottom: 40rpx;" v-else>
- <u-loadmore :status="status" :loading-text="loadingText" :loadmore-text="loadmoreText"
- :nomore-text="nomoreText" @loadmore="loadmore" dashed line marginTop="20" />
- </view>
- <!-- 联系护工 -->
- <u-popup :overlayStyle="{'touch-action':'none'}" closeable mode="bottom" :show="popShow" @close="popClose"
- @open="open" :round="20">
- <view class="pop-box">
- <view class="pop-title">联系护工</view>
- <view class="pop-content">
- <view class="pop-item" v-for="item,index in workerList" :key="index"
- @click="confirmAndCall(item.phoneNumber)">
- <u-icon name="phone" color="#fff"></u-icon>
- <span class="txt">{{item.phoneNumber || '-'}}</span>
- </view>
- </view>
- <view class="pop-footer-btn">
- <span class="btn" @click="popClose()">取消</span>
- </view>
- </view>
- </u-popup>
- <!-- 评价 -->
- <u-popup :overlayStyle="{'touch-action':'none'}" closeable mode="bottom" :show="evaluateShow"
- @close="evaluateClose" @open="evaluateOpen" :round="20">
- <view class="pop-box">
- <view class="pop-title">订单评价</view>
- <view class="pop-content">
- <view class="info-item">
- <span class="title">服务态度</span>
- <u-rate :count="count" size="20" v-model="evaluateInfo.serviceAttitude"></u-rate>
- </view>
- <u-line></u-line>
- <view class="info-item">
- <span class="title">着装仪态</span>
- <u-rate :count="count" size="20" v-model="evaluateInfo.dressAppearance"></u-rate>
- </view>
- <u-line></u-line>
- <view class="info-item">
- <span class="title">沟通能力</span>
- <u-rate :count="count" size="20" v-model="evaluateInfo.communicationAbility"></u-rate>
- </view>
- <u-line></u-line>
- <view class="tip-txt">
- <span class="name">文字评价</span>
- <u--textarea v-model="evaluateInfo.content" placeholder="请输入内容"></u--textarea>
- </view>
- </view>
- <view class="footer-btn">
- <span class="btn" @click="confirmEvaluate">确认提交</span>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- getOrderList,
- getOrderStatus,
- cancelOrder,
- getAfterSaleOrderList,
- getRefundStatus,
- getServicePhoneList,
- evaluateOrder
- } from "@/api/order.js"
- export default {
- data() {
- return {
- copyImg: require('@/static/copy.png'),
- serviceName: undefined,
- orderStatus: undefined,
- orderList: [],
- typeList: [],
- loading: false,
- pageSize: 10,
- pageNum: 1,
- botLoadingShow: 0, //0不显示 1显示 3.显示没有更多了
- loadingShow: false,
- status: 'loadmore',
- loadingText: '努力加载中',
- loadmoreText: '上拉或点击加载更多',
- nomoreText: '实在没有了',
- total: 0,
- customBar: 0, //状态栏高度 + 导航栏高度
- status: {
- 10: ''
- },
- current: 0,
- isFirst: true,
- workerList: [],
- popShow: false,
- refundStatusList: [],
- evaluateInfo: {
- content: '',
- serviceAttitude: 0,
- dressAppearance: 0,
- communicationAbility: 0,
- },
- evaluateShow: false,
- count: 5,
- orderId: '',
- }
- },
- onLoad(option) {
- if (option.type) {
- this.orderStatus = option.type;
- switch (option.type) {
- case "10":
- this.current = 1;
- break;
- case "20":
- this.current = 2;
- break
- case "40":
- this.current = 4;
- break
- case "60":
- this.current = 6;
- break
- default:
- this.current = 0;
- break
- }
- }
- console.log('onLoad');
- },
- onShow() {
- if (this.isFirst) {
- this.isFirst = false;
- this.init();
- } else {
- // 获取全局参数
- const app = getApp();
- if (app.globalData.switchTabParams) {
- const params = app.globalData.switchTabParams;
- console.log('接收到的参数:', params);
- if (params.reload) {
- console.log('onShow');
- this.init()
- // 使用完后可以清除
- app.globalData.switchTabParams = null;
- return
- } else {
- }
- }
- }
- },
- methods: {
- init() {
- console.log("初始化");
- this.getOrderList("reload")
- this.getOrderStatus();
- },
- evaluateOpen() {
- this.evaluateShow = true;
- },
- evaluateClose() {
- this.evaluateShow = false;
- },
- // 评价订单
- confirmEvaluate() {
- if (!this.evaluateInfo.content) {
- uni.showToast({
- title: '请填写内容',
- icon: 'none'
- });
- return
- }
- let that = this;
- uni.showLoading({
- title: '评价中',
- mask: true,
- });
- that.evaluateInfo.orderId = that.orderId
- evaluateOrder(that.evaluateInfo).then(res => {
- if (res.code == 200) {
- let data = res.data;
- that.evaluateInfo = {
- content: '',
- serviceAttitude: 0,
- dressAppearance: 0,
- communicationAbility: 0,
- }
- that.evaluateClose()
- that.getOrderList('reload')
- }
- })
- .catch((err) => {
- console.log(err);
- })
- .finally(() => {
- uni.hideLoading();
- });
- },
- open() {
- let that = this;
- getServicePhoneList().then(res => {
- if (res.code == 200) {
- let data = res.data;
- this.workerList = data;
- this.popShow = true;
- }
- })
- .catch((err) => {
- console.log(err);
- })
- },
- popClose() {
- this.popShow = false;
- },
- //拨打电话
- confirmAndCall(phoneNumber) {
- // 先验证电话号码
- if (!this.isValidPhoneNumber(phoneNumber)) {
- uni.showToast({
- title: '电话号码格式不正确',
- icon: 'none'
- });
- return;
- }
- // 显示确认对话框
- uni.showModal({
- title: '确认拨打电话',
- content: `确定要拨打 ${phoneNumber} 吗?`,
- success: (res) => {
- if (res.confirm) {
- // 用户点击确定,执行拨打电话
- this.makePhoneCall(phoneNumber);
- }
- }
- });
- },
- isValidPhoneNumber(phoneNumber) {
- // 简单的电话号码验证
- return /^1[3-9]\d{9}$/.test(phoneNumber);
- },
- makePhoneCall(phoneNumber) {
- uni.makePhoneCall({
- phoneNumber: phoneNumber,
- success: () => {
- console.log('拨打电话成功');
- },
- fail: (err) => {
- console.error('拨打电话失败', err);
- uni.showToast({
- title: '拨打电话失败',
- icon: 'none'
- });
- }
- });
- },
- changeTab(item) {
- console.log("item", item);
- this.pageNum = 1;
- this.orderStatus = item.code;
- if (item.code != 7) {
- this.orderList = [];
- this.getOrderList("reload");
- } else {
- this.getRefundStatus();
- this.getAfterSaleOrderList("reload");
- }
- },
- getStatusTxt(value) {
- let obj = this.typeList.find(item => item.code == value);;
- return obj ? obj.value : '-'
- },
- getRefundTxt(value) {
- let obj = this.refundStatusList.find(item => item.code == value);;
- return obj ? obj.value : '-'
- },
- //取消订单
- cancleOrder(id) {
- //确认是否删除
- uni.showModal({
- title: '提示',
- content: '确定取消订单吗?',
- success: (res) => {
- if (res.confirm) {
- console.log('用户点击确定');
- cancelOrder(id).then(res => {
- if (res.code == 200) {
- uni.showToast({
- title: '取消成功',
- icon: 'success'
- })
- this.init()
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- },
- })
- },
- //联系护工
- contactPerson(item) {
- this.open()
- },
- //去评价
- goEvaluation(id) {
- this.orderId = id
- this.evaluateOpen()
- },
- //获取订单列表
- getOrderList(reload) {
- // 验证登录
- // let token = uni.getStorageSync('apiToken');
- // if (!token) return
- let that = this;
- if (reload) {
- that.pageNum = 1;
- that.orderList = [];
- }
- uni.showLoading({
- title: '加载中',
- mask: true,
- });
- let param = {
- status: that.orderStatus,
- serviceName: that.serviceName,
- pageNum: that.pageNum,
- pageSize: that.pageSize,
- };
- getOrderList(param).then(res => {
- let data = res.rows;
- if (data) {
- that.orderList.push(...data); //在列表后面新增新获取的数据
- that.total = res.total; //获取数据总页数
- if (that.orderList.length >= that.total) {
- that.status = 'nomore';
- return;
- }
- } else {
- that.status = 'nomore';
- }
- })
- .catch((err) => {
- console.log(err);
- })
- .finally(() => {
- uni.hideLoading();
- });
- },
- //查询售后订单列表
- getAfterSaleOrderList(reload) {
- let that = this;
- if (reload) {
- that.pageNum = 1;
- that.orderList = [];
- }
- uni.showLoading({
- title: '加载中',
- mask: true,
- });
- let param = {
- pageNum: that.pageNum,
- pageSize: that.pageSize,
- }
- getAfterSaleOrderList(param).then(res => {
- let data = res.rows;
- if (data) {
- that.orderList.push(...data); //在列表后面新增新获取的数据
- that.total = res.total; //获取数据总页数
- if (that.orderList.length >= that.total) {
- that.status = 'nomore';
- return;
- }
- } else {
- that.status = 'nomore';
- }
- })
- .catch((err) => {
- console.log(err);
- })
- .finally(() => {
- uni.hideLoading();
- });
- },
- //查询订单状态
- getOrderStatus() {
- let that = this;
- getOrderStatus().then(res => {
- if (res.code == 200) {
- let data = res.data.orderStatus;
- data.unshift({
- value: '全部',
- code: undefined,
- })
- data.push({
- value: '退款',
- code: 7,
- })
- this.typeList = data;
- }
- })
- .catch((err) => {
- console.log(err);
- })
- },
- //查询退款状态
- getRefundStatus() {
- let that = this;
- getRefundStatus().then(res => {
- if (res.code == 200) {
- let data = res.data.refundStatus;
- this.refundStatusList = data;
- }
- })
- .catch((err) => {
- console.log(err);
- })
- },
- //去详情
- toDetails(item, type) {
- if (type) {
- uni.navigateTo({
- url: '/pages/order/refundDetails?id=' + item.id
- })
- } else {
- uni.navigateTo({
- url: '/pages/order/orderDetails?id=' + item.id
- })
- }
- },
- //去验收
- toAcceptance(item) {
- uni.navigateTo({
- url: '/pages/mineOrders/acceptance?id=' + item.id
- })
- },
- //加载更多
- loadmore() {
- // 如果当前页数大于等于总页数,状态修改为没有更多了,不再继续往下执行代码
- if (this.orderList.length >= this.total) {
- this.status = 'nomore';
- return;
- }
- this.status = 'loading'; //状态改为加载中
- this.pageNum++;
- if (this.orderStatus != 7) {
- this.getOrderList();
- } else {
- this.getAfterSaleOrderList();
- }
- },
- onReachBottom() {
- this.loadmore();
- },
- //下拉刷新回调函数
- onPullDownRefresh() {
- // wx.setStorageSync('isChangeBanner', true);
- this.init();
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- background-color: #f6f6f6;
- }
- .search-box {
- display: flex;
- align-items: center;
- padding: 20rpx;
- }
- .order-list {
- margin: 20rpx;
- .order-item {
- margin-bottom: 20rpx;
- background-color: #fff;
- border-radius: 20rpx;
- padding: 10rpx 24rpx 30rpx;
- .order-t-box {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- padding: 20rpx 0;
- .order-t-box-l {
- .order-name {
- font-size: 32rpx;
- font-weight: bold;
- }
- .order-no {
- display: flex;
- align-items: center;
- margin-top: 15rpx;
- font-size: 24rpx;
- color: #6F6F6F;
- .icon {
- width: 40rpx;
- height: 40rpx;
- margin-left: 10rpx;
- }
- }
- }
- .order-t-box-r {
- display: flex;
- align-items: center;
- flex-direction: column;
- .title {
- font-size: 24rpx;
- color: #6F6F6F;
- }
- .price {
- margin-top: 15rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #FF0000;
- }
- }
- }
- .order-b-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 0;
- .order-b-box-l {
- flex: 1;
- .order-b-item {
- margin-bottom: 15rpx;
- &:last-child {
- margin-bottom: 0;
- }
- .title {
- font-size: 26rpx;
- color: #1A1A1A;
- }
- .txt {
- font-size: 26rpx;
- color: #808080;
- }
- }
- }
- .order-b-box-r {
- width: 110rpx;
- text-align: right;
- font-size: 24rpx;
- color: #0085FF;
- .cancle {
- color: #FF0000;
- }
- }
- }
- .btn-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 15rpx;
- .time {
- font-size: 24rpx;
- color: #6F6F6F;
- }
- .btn-box-r {
- display: flex;
- align-items: center;
- .btn {
- width: 160rpx;
- height: 60rpx;
- margin-left: 20rpx;
- line-height: 60rpx;
- text-align: center;
- background-color: #4B91D1;
- color: #fff;
- border-radius: 30rpx;
- font-size: 24rpx;
- }
- .btn1 {
- background-color: #fff;
- border: 1rpx solid #4B91D1;
- color: #4B91D1;
- }
- }
- }
- }
- }
- .pop-box {
- .pop-title {
- font-size: 32rpx;
- font-weight: bold;
- text-align: center;
- padding: 20rpx 0;
- }
- .pop-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 30rpx;
- font-size: 28rpx;
- color: #6F6F6F;
- padding: 0 20rpx;
- &>view {
- margin-bottom: 20rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .pop-item {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 500rpx;
- padding: 20rpx 0;
- background-color: #4B91D1;
- border-radius: 40rpx;
- color: #fff;
- .txt {
- font-size: 28rpx;
- }
- }
- .info-item {
- display: flex;
- justify-content: space-between;
- padding: 20rpx 0;
- width: 100%;
- }
- .tip-txt {
- display: flex;
- flex-direction: column;
- padding: 20rpx 0;
- width: 100%;
- .name {
- margin-bottom: 20rpx;
- }
- }
- }
- .footer-btn {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 30rpx;
- padding: 20rpx;
- .btn {
- width: 100%;
- padding: 20rpx 0;
- border: 1rpx solid #4B91D1;
- background-color: #4B91D1;
- border-radius: 40rpx;
- color: #fff;
- text-align: center;
- }
- }
- .pop-footer-btn {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 60rpx;
- .btn {
- width: 500rpx;
- padding: 20rpx 0;
- border: 1rpx solid #4B91D1;
- border-radius: 40rpx;
- color: #333;
- text-align: center;
- }
- }
- }
- </style>
|