|
@@ -4,117 +4,101 @@
|
|
|
<view class="user-info order-card">
|
|
|
<view class="font-title">基本信息</view>
|
|
|
<view class="user-box">
|
|
|
- <img src="/static/img/dd.png" alt="" class="user-img" />
|
|
|
<view class="info-list">
|
|
|
- <view>姓名:</view>
|
|
|
- <view>被服务对象:</view>
|
|
|
- <view>电话号码:</view>
|
|
|
+ <view>被服务人员:{{ detaile.name }}</view>
|
|
|
+ <view @click="onPhone" class="phone">电话号码:{{ detaile.telephone }}</view>
|
|
|
+ <view>地址:{{ detaile.address }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="service-info order-card">
|
|
|
- <view class="font-title ">服务信息</view>
|
|
|
+ <view class="font-title ">备注信息</view>
|
|
|
<view class="info-list">
|
|
|
- <view>服务地址:</view>
|
|
|
- <view>服务类别:</view>
|
|
|
- <view>服务科目:</view>
|
|
|
- <view>备注:</view>
|
|
|
+ {{ detaile.remark }}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="register-info order-card">
|
|
|
- <view class="font-title ">志愿者信息</view>
|
|
|
- <view class="register-box">
|
|
|
- <img src="/static/img/dd.png" alt="" class="register-img" />
|
|
|
- <view class="info-list">
|
|
|
- <view>时间:2025.4.1 15:00-18:0</view>
|
|
|
- <view>姓名:</view>
|
|
|
- <view>服务地址:</view>
|
|
|
- <view>金额:<span class="price"><span class="price-yuan">¥</span> 200</span>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- </view>
|
|
|
|
|
|
<view class="service-info order-card">
|
|
|
<view class="font-title">图片上传</view>
|
|
|
- <up-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" multiple
|
|
|
- :maxCount="10"></up-upload>
|
|
|
+ <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"></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">
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<view class=" footer-g">
|
|
|
- <up-button type="primary" text="前往沟通"></up-button>
|
|
|
+ <up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref } from 'vue';
|
|
|
-import { getToken } from '@/utils/auth'
|
|
|
-import config from '@/config'
|
|
|
-const baseUrl = config.baseUrl
|
|
|
+import { onLoad } from '@dcloudio/uni-app';
|
|
|
+import { getVolunteerOrderInfo } from '@/api/volunteer.js'
|
|
|
+import { getAddress } from '@/api/address.js'
|
|
|
+
|
|
|
+import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
|
|
|
|
|
|
const fileList = ref([]);
|
|
|
+const orderId =ref('');
|
|
|
+const detaile = ref({});
|
|
|
|
|
|
// 删除图片
|
|
|
-const deletePic = (event) => {
|
|
|
- fileList.value.splice(event.index, 1);
|
|
|
+const deletePic = (index) => {
|
|
|
+ fileList.value.splice(index, 1);
|
|
|
};
|
|
|
|
|
|
-// 新增图片
|
|
|
-const afterRead = async (event) => {
|
|
|
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
- let lists = [].concat(event.file);
|
|
|
- let fileListLen = fileList.value.length;
|
|
|
- lists.map((item) => {
|
|
|
- fileList.value.push({
|
|
|
- ...item,
|
|
|
- status: 'uploading',
|
|
|
- message: '上传中',
|
|
|
- });
|
|
|
- });
|
|
|
- for (let i = 0; i < lists.length; i++) {
|
|
|
- const result = await uploadFilePromise(lists[i]);
|
|
|
- let item = fileList.value[fileListLen];
|
|
|
- fileList.value.splice(fileListLen, 1, {
|
|
|
- ...item,
|
|
|
- status: 'success',
|
|
|
- message: '',
|
|
|
- url: result.url,
|
|
|
+
|
|
|
+const uploadClick = async (type) => {
|
|
|
+ const res = await wxUploadFile(type);
|
|
|
+ fileList.value = [...fileList.value, res];
|
|
|
+ console.log('文件上传', res);
|
|
|
+}
|
|
|
+const onPhone=(phone)=>{
|
|
|
+ wxMakePhoneCall(phone)
|
|
|
+}
|
|
|
+
|
|
|
+const getOrderDetail = async() => {
|
|
|
+ try {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '数据加载中...'
|
|
|
});
|
|
|
- fileListLen++;
|
|
|
+ const res = await getVolunteerOrderInfo({orderId: orderId.value});
|
|
|
+ const ad_res = await getAddress(res.data.addressId);
|
|
|
+ detaile.value = {
|
|
|
+ ...res.data,
|
|
|
+ address:ad_res.data.address,
|
|
|
+ name:ad_res.data.name,
|
|
|
+ telephone:ad_res.data.telephone
|
|
|
+ };
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error', error);
|
|
|
+ uni.showToast({
|
|
|
+ title: error.msg,
|
|
|
+ icon: 'error',
|
|
|
+ })
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
-const uploadFilePromise = (data) => {
|
|
|
- console.log('data',data);
|
|
|
+const onSubmit = () => {
|
|
|
+ console.log('submit',fileList.value);
|
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- wx.uploadFile({
|
|
|
- url: baseUrl + '/common/upload', // 仅为示例,非真实的接口地址
|
|
|
- filePath: data.url,
|
|
|
- name: 'file',
|
|
|
- formData: {
|
|
|
- file: data,
|
|
|
- },
|
|
|
- header: {
|
|
|
- 'Authorization': 'Bearer ' + getToken(), // 自定义请求头
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- const data = JSON.parse(res.data);
|
|
|
- resolve(data);
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- uni.showToast({
|
|
|
- title: '上传失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- console.error(' 转换失败:', err);
|
|
|
- reject();
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-};
|
|
|
+}
|
|
|
+
|
|
|
+onLoad((options) => {
|
|
|
+ console.log('options',options);
|
|
|
+ orderId.value = options.orderId;
|
|
|
+ getOrderDetail();
|
|
|
+
|
|
|
+})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.order-detail {
|
|
@@ -189,5 +173,31 @@ const uploadFilePromise = (data) => {
|
|
|
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;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|