123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <!-- 订单详情 -->
- <template>
- <view class="order-detail">
- <view class="user-info order-card">
- <view class="font-title">基本信息</view>
- <view class="user-box">
- <view class="info-list">
- <view>被服务人员:{{ detaile.name }}</view>
- <view style="display: flex;">服务类别: <dict-tag :options="lrr_service_category"
- :value="detaile.serviceCategory" /></view>
- <view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
- <view>地址:{{ detaile.address }}</view>
- </view>
- </view>
- </view>
- <view class="service-info order-card">
- <view class="font-title ">备注信息</view>
- <view class="info-list">
- {{ detaile.remark }}
- </view>
- </view>
- <view class="service-info order-card" v-if="detaile.orderStatus === 1">
- <view class="font-title ">反馈信息</view>
- <view class="info-list">
- <up-textarea v-model="detaile.volunteerReview" placeholder="请输入内容" ></up-textarea>
- </view>
- </view>
- <view v-if="detaile.orderStatus !== 1">
- <view class="user-info order-card">
- <view class="font-title">志愿者反馈信息</view>
- <view class="user-box">
- <view class="info-list">
- <view class="info-item">{{ detaile.volunteerReview }}</view>
- </view>
- </view>
- <view class="upload-box">
- <view class="upload-img-item" v-for="(item) in volunteerPicture" :key="item.url">
- <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
- </view>
- </view>
- </view>
- <view class="user-info order-card">
- <view class="font-title">用户评价信息</view>
- <view class="user-box">
- <view class="info-list">
- <view class="info-item">{{ detaile.userReview || '用户未完成评价'}}</view>
- </view>
- </view>
- <view class="upload-box">
- <view class="upload-img-item" v-for="(item) in userPicture" :key="item.url">
- <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
- </view>
- </view>
- </view>
- </view>
- <view class="service-info order-card" v-if="detaile.orderStatus === 1">
- <view class="font-title">图片上传</view>
- <view class="upload-box">
- <view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
- <view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
- color="#f64a1f" size="18" v-if="detaile.orderStatus === 1"></up-icon></view>
- <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
- </view>
- <img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
- v-if="fileList.length < 10 && detaile.orderStatus === 1">
- </view>
- </view>
- <view class=" footer-g" v-if="detaile.orderStatus === 1">
- <up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, toRaw, computed } from 'vue';
- import { onLoad } from '@dcloudio/uni-app';
- import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
- import { getAddress } from '@/api/address.js'
- import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
- import { useDict } from '@/utils/dict.js';
- import DictTag from '@/components/DictTag/index.vue'
- const fileList = ref([]);
- const orderId = ref('');
- const detaile = ref({
- volunteerReview:''
- });
- const {
- lrr_service_category
- } = useDict('lrr_service_category');
- // 删除图片
- const deletePic = (index) => {
- fileList.value.splice(index, 1);
- };
- const uploadClick = async (type) => {
- const res = await wxUploadFile(type);
- fileList.value = [...fileList.value, ...res];
- console.log('xxxxres', res, fileList.value);
- }
- const onPhone = (phone) => {
- wxMakePhoneCall(phone)
- }
- //志愿者图片反馈
- const volunteerPicture = computed(() => {
- if (detaile.value.volunteerPicture) {
- return detaile.value.volunteerPicture.split(',').map(item => {
- return { url: item }
- });
- }
- return [];
- })
- //用户图片评价
- const userPicture = computed(() => {
- if (detaile.value.userPicture) {
- return detaile.value.userPicture.split(',').map(item => {
- return { url: item }
- });
- }
- return [];
- })
- const getOrderDetail = async () => {
- try {
- uni.showLoading({
- title: '数据加载中...'
- });
- const res = await getVolunteerOrderInfo({ orderId: orderId.value });
- const ad_res = await getAddress(res.data.addressId);
- let data = res.data;
- if (ad_res.data) {
- data = {
- ...data,
- address: ad_res.data.address,
- name: ad_res.data.name,
- telephone: ad_res.data.telephone
- }
- }
- // if (data.volunteerPicture) {
- // fileList.value = data.volunteerPicture.split(',').map(item => {
- // return { url: item }
- // });
- // }
- detaile.value = data;
- console.log('detaile.value', detaile.value);
- } catch (error) {
- console.log('error', error);
- uni.showToast({
- title: error.msg,
- icon: 'error',
- })
- } finally {
- uni.hideLoading();
- }
- }
- const onSubmit = () => {
- const img_urls = fileList.value.map(item => item.url).join(',');
- console.log('submit', fileList.value, img_urls);
- getVolunteerFinishSecondOrder({
- secondOrderId: orderId.value,
- volunteerPicture: img_urls,
- volunteerId: detaile.value.volunteerId,
- volunteerReview: detaile.value.volunteerReview
- }).then(res => {
- if (res.code === 200) {
- uni.showToast({
- title: '服务结束',
- icon: 'success',
- success: () => {
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/classify'
- });
- }, 800)
- }
- })
- } else {
- uni.showToast({
- title: res.data,
- icon: 'error',
- })
- }
- })
- }
- onLoad((options) => {
- console.log('options', options);
- orderId.value = options.orderId;
- // orderId.value = '1911685346559660034';
- getOrderDetail();
- })
- </script>
- <style lang="scss" scoped>
- .order-detail {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 12px 12px 24px;
- background: rgba(245, 245, 245, 1);
- overflow-y: auto;
- .order-card {
- border-radius: 8px;
- background: rgba(255, 255, 255, 1);
- padding: 12px;
- margin-bottom: 12px;
- }
- .font-title {
- margin-bottom: 12px;
- }
- .user-box {
- display: flex;
- .user-img {
- width: 65.8px;
- height: 65.8px;
- margin-right: 12px;
- }
- }
- .register-box {
- display: flex;
- margin-bottom: 12px;
- .register-img {
- width: 90px;
- height: 90px;
- margin-right: 12px;
- }
- }
- .info-list {
- flex: 1;
- font-size: 14px;
- font-weight: 500;
- letter-spacing: 0px;
- line-height: 23.27px;
- color: rgba(51, 51, 51, 1);
- }
- .price {
- font-size: 18px;
- font-weight: 500;
- color: rgba(246, 74, 31, 1);
- .price-yuan {
- font-size: 13px;
- font-weight: 700;
- color: rgba(246, 74, 31, 1);
- }
- }
- .footer-g {
- padding: 12px;
- position: absolute;
- bottom: 18px;
- left: 0px;
- right: 0px;
- }
- .upload-img {
- height: 68px;
- width: 68px;
- margin-right: 12px;
- margin-bottom: 12px;
- }
- .upload-box {
- display: flex;
- flex-wrap: wrap;
- .upload-img-item {
- position: relative;
- .delete-icon {
- position: absolute;
- top: -7px;
- right: 7px;
- z-index: 1;
- }
- }
- }
- .phone {
- color: #3c9cff;
- }
- .info-item {
- margin-bottom: 12px;
- }
- }
- </style>
|