update
|
|
@ -16,4 +16,27 @@ export const orderPay = data =>
|
|||
* @description 获取订单信息
|
||||
*/
|
||||
export const orderInfo = params =>
|
||||
request.get('/order/infomation', params)
|
||||
request.get('/order/infomation', params)
|
||||
|
||||
/**
|
||||
* @description 获取取消原因列表
|
||||
*/
|
||||
export const reasonList = params =>
|
||||
request.get('/reason/list', params)
|
||||
|
||||
/**
|
||||
* @description 获取订单列表
|
||||
*/
|
||||
export const orderList = data =>
|
||||
request.post('/order/orderList', data)
|
||||
|
||||
/**
|
||||
* @description 取消订单
|
||||
*/
|
||||
export const cancelOrder = data =>
|
||||
request.post('/order/cancelOrder', data)
|
||||
/**
|
||||
* @description 申请退款
|
||||
*/
|
||||
export const orderRefund = data =>
|
||||
request.post('/refound', data)
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
|
@ -52,6 +52,7 @@ const handleAgree = () => {
|
|||
$Router.push({ path: '/pages/statement/index' })
|
||||
}
|
||||
const handleAgreeCheck = () => {
|
||||
if (prop.disabled) return
|
||||
checked.value[0] = checked.value[0] === '1' ? '' : '1'
|
||||
emit('update:agreed', !!checked.value[0])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
:safeAreaInsetBottom="true"
|
||||
:fixed="true"
|
||||
:border="false"
|
||||
v-bind="$attrs"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<block v-for="item in tabbarList" :key="item.path">
|
||||
<u-tabbar-item
|
||||
|
|
@ -34,70 +34,68 @@
|
|||
<script setup>
|
||||
uni.hideTabBar()
|
||||
const instance = getCurrentInstance()
|
||||
const { $assets,$Router,$Route,$store } = instance.proxy
|
||||
const { $assets, $Router, $Route, $store } = instance.proxy
|
||||
const tabbarList = ref([])
|
||||
const List = {
|
||||
simple: [
|
||||
{
|
||||
text: '首页',
|
||||
icon: '/tabbar/home.png',
|
||||
activeIcon: '/tabbar/home-sel.png',
|
||||
path: '/pages/index/home/index',
|
||||
name: 'home',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '订单',
|
||||
icon: '/tabbar/order.png',
|
||||
activeIcon: '/tabbar/order-sel.png',
|
||||
path: '/pages/index/order/index',
|
||||
name: 'order',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '我的',
|
||||
icon: '/tabbar/my.png',
|
||||
activeIcon: '/tabbar/my-sel.png',
|
||||
path: '/pages/index/personal/index',
|
||||
name: 'personal',
|
||||
show: true
|
||||
}
|
||||
],
|
||||
common: [
|
||||
{
|
||||
text: '首页',
|
||||
icon: '/tabbar/order.png',
|
||||
activeIcon: '/tabbar/order-sel.png',
|
||||
path: '/pages/index/order/index',
|
||||
name: 'order',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '我的',
|
||||
icon: '/tabbar/my.png',
|
||||
activeIcon: '/tabbar/my-sel.png',
|
||||
path: '/pages/index/personal/index',
|
||||
name: 'personal',
|
||||
show: true
|
||||
}
|
||||
]
|
||||
simple: [
|
||||
{
|
||||
text: '首页',
|
||||
icon: '/tabbar/home.png',
|
||||
activeIcon: '/tabbar/home-sel.png',
|
||||
path: '/pages/index/home/index',
|
||||
name: 'home',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '订单',
|
||||
icon: '/tabbar/order.png',
|
||||
activeIcon: '/tabbar/order-sel.png',
|
||||
path: '/pages/index/order/index',
|
||||
name: 'order',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '我的',
|
||||
icon: '/tabbar/my.png',
|
||||
activeIcon: '/tabbar/my-sel.png',
|
||||
path: '/pages/index/personal/index',
|
||||
name: 'personal',
|
||||
show: true
|
||||
}
|
||||
],
|
||||
common: [
|
||||
{
|
||||
text: '首页',
|
||||
icon: '/tabbar/order.png',
|
||||
activeIcon: '/tabbar/order-sel.png',
|
||||
path: '/pages/index/order/index',
|
||||
name: 'order',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
text: '我的',
|
||||
icon: '/tabbar/my.png',
|
||||
activeIcon: '/tabbar/my-sel.png',
|
||||
path: '/pages/index/personal/index',
|
||||
name: 'personal',
|
||||
show: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const activeItem = ref()
|
||||
|
||||
const activeItem = ref($Route.meta.key || 'home')
|
||||
watchEffect(() => {
|
||||
activeItem.value = $Route.meta.key
|
||||
const roleName = $store.user.roleName
|
||||
if(activeItem.value === 'home' && roleName === 'common') {
|
||||
activeItem.value = 'order'
|
||||
}
|
||||
tabbarList.value = List[roleName]
|
||||
const roleName = $store.user.roleName
|
||||
if (activeItem.value === 'home' && roleName === 'common') {
|
||||
activeItem.value = 'order'
|
||||
}
|
||||
tabbarList.value = List[roleName]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-tabbar-item__icon {
|
||||
margin-top: 10rpx;
|
||||
margin-top: 10rpx;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
object-fit: contain;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@
|
|||
errorType="toast"
|
||||
labelWidth="auto"
|
||||
>
|
||||
<!-- :labelStyle="{
|
||||
padding: '12rpx 0'
|
||||
}" -->
|
||||
<u-form-item
|
||||
v-for="item in formList"
|
||||
:key="item.key"
|
||||
|
|
@ -79,7 +82,7 @@
|
|||
<!-- model[item.key] ? item.type === 'date' ? $u.timeFormat(model[item.key], 'yyyy-mm-dd') : model[item.key] : item.placeholder -->
|
||||
<view
|
||||
v-else
|
||||
@click="item.show = true"
|
||||
@click="item.show = current === 1 ? true : false"
|
||||
class="w-full text-right u-line-1 pl-2"
|
||||
:class="item.val ? '' : 'text-#C0C4CC'"
|
||||
>{{ item.val || item.placeholder }}
|
||||
|
|
@ -101,7 +104,7 @@
|
|||
>
|
||||
<upload-img
|
||||
v-model="fileList"
|
||||
:disabled="false"
|
||||
:disabled="current > 1"
|
||||
:maxCount="10"
|
||||
multiple
|
||||
></upload-img>
|
||||
|
|
@ -111,6 +114,7 @@
|
|||
v-model="model.remark"
|
||||
placeholder=""
|
||||
maxlength="300"
|
||||
:disabled="current > 1"
|
||||
count
|
||||
:autoHeight="false"
|
||||
/>
|
||||
|
|
@ -123,7 +127,7 @@
|
|||
3. 服务地点为必填项
|
||||
<br />
|
||||
</view>
|
||||
<agreed-comp v-model:agreed="agreed" :disabled="false" />
|
||||
<agreed-comp v-model:agreed="agreed" :disabled="current > 1" />
|
||||
</view>
|
||||
|
||||
<u-picker
|
||||
|
|
@ -191,39 +195,50 @@
|
|||
</view>
|
||||
<button-contact />
|
||||
<view
|
||||
v-if="!orderInfo.reasonId"
|
||||
class="bg-#fff h-150rpx w-full sticky bottom-0 z-2 flex justify-between items-center pr-24rpx pl-40rpx pb-48rpx rounded-sm"
|
||||
>
|
||||
<block v-if="true">
|
||||
<block v-if="orderInfo.status < 3 || !orderId">
|
||||
<view>
|
||||
<text class="text-32rpx">¥</text>
|
||||
<text class="font-bold text-54rpx">{{ selTypeItem.price || 0 }}</text>
|
||||
<text class="font-bold text-54rpx">{{
|
||||
orderInfo.orderPrice || selTypeItem.price || 0
|
||||
}}</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="orderInfo.status === 2"
|
||||
@click="$u.throttle(orderPay, 1000)"
|
||||
class="text-white mr-4 bg-#FF8CA6 rounded-24rpx w-240rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>支付</view
|
||||
>
|
||||
<view
|
||||
v-if="!orderId"
|
||||
@click="$u.throttle(onSubmit, 1000)"
|
||||
class="text-white bg-#FF8CA6 rounded-24rpx w-240rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>立即下单</view
|
||||
>
|
||||
</block>
|
||||
<view
|
||||
v-if="false"
|
||||
v-if="roleName === 'common'"
|
||||
class="text-white bg-#FF8CA6 rounded-24rpx w-full mx-30rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>{{ true ? '开始服务' : '订单已完成,提交工作记录' }}</view
|
||||
>
|
||||
<view
|
||||
v-if="roleName === 'simple' && orderInfo.status > 2"
|
||||
class="text-white bg-#FF8CA6 rounded-24rpx w-full mx-30rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>{{
|
||||
orderInfo.status === 3 ? '订单已提交,请耐心等待' : '服务完成,请评价'
|
||||
}}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRoute } from '@/utils/uni-router'
|
||||
|
||||
const route = useRoute()
|
||||
const instance = getCurrentInstance()
|
||||
const { $u, $api, $Router, $dialog, $toast, $store, $loading } = instance.proxy
|
||||
const { $u, $api, $Router, $Route, $dialog, $toast, $store, $loading } =
|
||||
instance.proxy
|
||||
const roleName = $store.user.userInfo.roleName
|
||||
// 填写订单 在线支付 服务中 服务完成
|
||||
const list = ref([
|
||||
{ label: '填写订单', id: 1 },
|
||||
|
|
@ -263,6 +278,7 @@ const formItems = [
|
|||
label: '就诊医院',
|
||||
placeholder: '请选择就诊医院',
|
||||
key: 'hospitalId',
|
||||
keyName: 'hospitalName',
|
||||
required: true,
|
||||
type: 'select',
|
||||
trigger: ['blur', 'change'],
|
||||
|
|
@ -275,6 +291,7 @@ const formItems = [
|
|||
label: '上门护理',
|
||||
placeholder: '请选择上门护理类型',
|
||||
key: 'typeId',
|
||||
keyName: 'typeName',
|
||||
required: true,
|
||||
type: 'select',
|
||||
trigger: ['blur', 'change'],
|
||||
|
|
@ -300,6 +317,7 @@ const formItems = [
|
|||
label: '报告类型',
|
||||
placeholder: '请选择报告类型',
|
||||
key: 'reportType',
|
||||
keyName: 'reportTypeName',
|
||||
required: true,
|
||||
type: 'select',
|
||||
trigger: ['blur', 'change'],
|
||||
|
|
@ -417,7 +435,7 @@ const formRef = ref(null)
|
|||
const dateAndSelectFormList = ref()
|
||||
const formList = ref()
|
||||
const model = ref({})
|
||||
const curType = ref(route.query.cur ? +route.query.cur : columns[0][0].id)
|
||||
const curType = ref($Route.query.cur ? +$Route.query.cur : columns[0][0].id)
|
||||
const typeVal = ref('')
|
||||
const selTypeItem = ref({})
|
||||
const rules = ref({})
|
||||
|
|
@ -426,7 +444,7 @@ const hospitalList = ref([])
|
|||
const serverTypelList = ref([])
|
||||
const reportTypelList = ref([])
|
||||
const dateKeyObj = {}
|
||||
const orderId = ref(route.query.id ? +route.query.id : '')
|
||||
const orderId = ref($Route.query.id ? +$Route.query.id : '')
|
||||
const orderInfo = ref({})
|
||||
|
||||
const getPzList = async () => {
|
||||
|
|
@ -456,13 +474,16 @@ const getReportTypelList = async () => {
|
|||
}))
|
||||
}
|
||||
const getOrderInfo = async () => {
|
||||
// if (!orderId.value) return
|
||||
if (!orderId.value) return
|
||||
$loading(true)
|
||||
const res = await $api.orderInfo({ id: orderId.value || 12 })
|
||||
const res = await $api.orderInfo({ id: orderId.value })
|
||||
if (res.success) {
|
||||
const { order = {} } = res
|
||||
console.log('🚀 ~ file: index.vue:465 ~ order:', order.result)
|
||||
orderInfo.value = order
|
||||
curType.value = order.serverId
|
||||
current.value = order.status || 1
|
||||
agreed.value = true
|
||||
}
|
||||
$loading(false)
|
||||
}
|
||||
|
|
@ -489,11 +510,22 @@ const orderPay = async () => {
|
|||
success: function (res) {
|
||||
// 在这里处理支付成功的回调
|
||||
console.log(res)
|
||||
$toast('支付成功!')
|
||||
$toast('支付成功!', {
|
||||
icon: 'success',
|
||||
duration: 2 * 1000
|
||||
})
|
||||
getOrderInfo()
|
||||
},
|
||||
fail: function (err) {
|
||||
// 处理支付失败的回调
|
||||
console.error(err.errMsg)
|
||||
getOrderInfo()
|
||||
if (err.errMsg === 'requestPayment:fail cancel') {
|
||||
$toast('支付取消!', {
|
||||
type: 'error',
|
||||
duration: 2 * 1000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -545,15 +577,16 @@ const onSubmit = () => {
|
|||
})
|
||||
}
|
||||
|
||||
watch(curType, () => {
|
||||
const item = columns[0].find((item) => item.id === curType.value)
|
||||
watchEffect(() => {
|
||||
const cur = curType.value
|
||||
const item = columns[0].find((item) => item.id === cur)
|
||||
typeVal.value = item?.serveName
|
||||
selTypeItem.value = item || {}
|
||||
dateAndSelectFormList.value = []
|
||||
formList.value = []
|
||||
formItems.forEach((item) => {
|
||||
const { required, key, message, trigger, type } = item
|
||||
if (item.cur.includes(curType.value)) {
|
||||
const { required, key, keyName, message, trigger, type } = item
|
||||
if (item.cur.includes(cur)) {
|
||||
if (key === 'hospitalId') item.options = [hospitalList.value]
|
||||
if (key === 'typeId') item.options = [serverTypelList.value]
|
||||
if (key === 'reportType') item.options = [reportTypelList.value]
|
||||
|
|
@ -562,8 +595,11 @@ watch(curType, () => {
|
|||
dateAndSelectFormList.value.push(item)
|
||||
}
|
||||
rules.value[item.key] = { required, message, trigger }
|
||||
if (orderInfo.value.srReport) {
|
||||
item.val = model.value[key] = orderInfo.value.srReport[key]
|
||||
if (orderInfo.value.result) {
|
||||
item.val = model.value[key] = orderInfo.value.result[key]
|
||||
if (keyName) {
|
||||
item.val = orderInfo.value.result[keyName] || ''
|
||||
}
|
||||
} else {
|
||||
model.value[key] = ''
|
||||
if (type === 'time') model.value[key] = `${new Date().getHours()}:00`
|
||||
|
|
@ -571,10 +607,10 @@ watch(curType, () => {
|
|||
}
|
||||
}
|
||||
})
|
||||
if (typeof orderInfo.value.srReport?.pictureUrl === 'string') {
|
||||
fileList.value = JSON.parse(orderInfo.value.srReport.pictureUrl)
|
||||
if (typeof orderInfo.value.result?.pictureUrl === 'string') {
|
||||
fileList.value = JSON.parse(orderInfo.value.result.pictureUrl)
|
||||
}
|
||||
console.log('🚀 ~ file: index.vue:572 ~ model.value:', model.value)
|
||||
model.value.remark = orderInfo.value?.result?.remark || ''
|
||||
})
|
||||
|
||||
const handleShowPicker = () => {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { onShow } from '@dcloudio/uni-app';
|
||||
<template>
|
||||
<z-paging-swiper>
|
||||
<template #top>
|
||||
<view
|
||||
v-if="userInfo.roleName === 'common'"
|
||||
class="px-24rpx pt-20rpx relative"
|
||||
>
|
||||
<view v-if="roleName === 'common'" class="px-24rpx pt-20rpx relative">
|
||||
<u--image
|
||||
width="100%"
|
||||
height="200rpx"
|
||||
|
|
@ -50,65 +48,105 @@
|
|||
@animationfinish="swiperAnimationfinish"
|
||||
>
|
||||
<swiper-item v-for="(_, index) in list" :key="index">
|
||||
<z-paging
|
||||
:ref="(el) => (paging[index] = el)"
|
||||
v-model="dataList[current]"
|
||||
@query="queryList"
|
||||
:min-delay="300"
|
||||
>
|
||||
<view
|
||||
v-for="(item, i) of dataList[current]"
|
||||
:key="i"
|
||||
class="min-h-410rpx bg-white rounded-16rpx mx-30rpx px-20rpx py-30rpx mb-20rpx shadow-current"
|
||||
<view class="h-full">
|
||||
<z-paging
|
||||
:ref="(el) => (paging[index] = el)"
|
||||
v-if="dataList[index].show"
|
||||
v-model="dataList[index].data"
|
||||
@query="queryList"
|
||||
:min-delay="300"
|
||||
>
|
||||
<view class="flex-row-between">
|
||||
<text class="text-#999 text-24rpx">订单号:22323232323</text>
|
||||
<view
|
||||
class="w-124rpx h-48rpx leading-48rpx text-center rounded-sm text-24rpx"
|
||||
:class="`${stateColorList[status].bg} ${stateColorList[status].color}`"
|
||||
>{{ stateColorList[status].text }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="flex-row-between text-28rpx text-#999 mt-20rpx">
|
||||
<view>服务项目:<text class="text-#000">服务项目</text></view>
|
||||
<view class="text-#FF3939 font-bold">预计收入:¥100</view>
|
||||
</view>
|
||||
<view
|
||||
class="mt-10rpx mb-24rpx flex text-24rpx bg-#f2f2f2 w-full min-h-140rpx rounded-sm px-34rpx pt-20rpx pb-10rpx"
|
||||
v-for="(item, i) of dataList[index].data"
|
||||
:key="i"
|
||||
class="min-h-410rpx bg-white rounded-16rpx mx-30rpx px-20rpx py-30rpx mb-20rpx shadow-current"
|
||||
>
|
||||
<view class="flex flex-col text-#666">
|
||||
<text>就诊人</text>
|
||||
<text class="text-#000 mt-8rpx">就诊人</text>
|
||||
<view class="flex-row-between">
|
||||
<text class="text-#999 text-24rpx">订单号:22323232323</text>
|
||||
<view
|
||||
v-if="item.orderStatus !== null"
|
||||
class="w-124rpx h-48rpx leading-48rpx text-center rounded-sm text-24rpx"
|
||||
:class="`${stateColorList[item.orderStatus].bg} ${
|
||||
stateColorList[item.orderStatus].color
|
||||
}`"
|
||||
>{{ stateColorList[item.orderStatus].text }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="flex flex-col flex-1 pl-40rpx pr-20rpx text-#666">
|
||||
<text>医院</text>
|
||||
<text class="text-#000 mt-8rpx">医院医院医院医院医院</text>
|
||||
<view class="flex-row-between text-28rpx text-#999 mt-20rpx">
|
||||
<view
|
||||
>服务项目:<text class="text-#000">{{
|
||||
item.projectName
|
||||
}}</text></view
|
||||
>
|
||||
<view
|
||||
v-if="roleName === 'common'"
|
||||
class="text-#FF3939 font-bold"
|
||||
>预计收入:¥{{ '100' }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="flex flex-col text-#666">
|
||||
<text>预约时间:</text>
|
||||
<text class="text-#000 mt-8rpx">2023/02/02</text>
|
||||
<text class="text-#000">10:00</text>
|
||||
<view
|
||||
class="mt-10rpx mb-24rpx flex text-24rpx bg-#f2f2f2 w-full min-h-140rpx rounded-sm px-34rpx pt-20rpx pb-10rpx"
|
||||
>
|
||||
<view class="flex flex-col text-#666">
|
||||
<block v-if="item.result?.clinicPerson">
|
||||
<text>就诊人</text>
|
||||
<text class="text-#000 mt-8rpx">{{
|
||||
item.result.clinicPerson
|
||||
}}</text>
|
||||
</block>
|
||||
<block v-else-if="item.result?.contact">
|
||||
<text>联系人</text>
|
||||
<text class="text-#000 mt-8rpx">{{
|
||||
item.result?.contact
|
||||
}}</text>
|
||||
</block>
|
||||
</view>
|
||||
<view class="flex flex-col flex-1 pl-40rpx pr-20rpx text-#666">
|
||||
<text>医院</text>
|
||||
<text class="text-#000 mt-8rpx">{{
|
||||
item.result?.hospitalName
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="flex flex-col text-#666">
|
||||
<text>预约时间:</text>
|
||||
<text class="text-#000 mt-8rpx">{{
|
||||
item.result?.clinicDate ||
|
||||
item.result?.visitDate ||
|
||||
item.result?.serviceTime
|
||||
}}</text>
|
||||
<text class="text-#000">{{
|
||||
item.result?.clinicTime || item.result?.visitTime
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-end items-center">
|
||||
<view
|
||||
v-if="item.orderStatus === 4"
|
||||
@click="handleClick(item, 'refund')"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#5F5F5F text-#5F5F5F"
|
||||
>申请退款</view
|
||||
>
|
||||
<view
|
||||
v-if="roleName === 'common' && item.orderStatus === 1"
|
||||
@click="$u.throttle(() => handleClick(item, 'start'), 800)"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#40A0E4 text-#40A0E4"
|
||||
>开始服务</view
|
||||
>
|
||||
<view
|
||||
@click="$u.throttle(() => handleClick(item, 'detail'), 800)"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#FF8CA6 text-#FF8CA6"
|
||||
>查看详情</view
|
||||
>
|
||||
<view
|
||||
v-if="!item.reasonId && item.orderStatus < 3"
|
||||
@click="handleClick(item, 'cancel')"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#5F5F5F text-#5F5F5F"
|
||||
>取消订单</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-end items-center">
|
||||
<view
|
||||
@click="handleClick(item)"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#40A0E4 text-#40A0E4"
|
||||
>开始服务</view
|
||||
>
|
||||
<view
|
||||
@click="handleClick(item)"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#FF8CA6 text-#FF8CA6"
|
||||
>查看详情</view
|
||||
>
|
||||
<view
|
||||
@click="handleClick(item)"
|
||||
class="btn text-30rpx px-30rpx py-14rpx ml-30rpx border-#5F5F5F text-#5F5F5F"
|
||||
>取消订单</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging>
|
||||
</z-paging>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<u-popup
|
||||
|
|
@ -125,15 +163,15 @@
|
|||
<view
|
||||
class="h-full w-full overflow-y-auto py-10rpx px-40rpx rounded-16rpx overflow-hidden"
|
||||
>
|
||||
<u-radio-group v-model="value" placement="row" @change="groupChange">
|
||||
<u-radio-group v-model="cancelVal" placement="row">
|
||||
<u-radio
|
||||
labelSize="16"
|
||||
iconSize="20"
|
||||
v-for="(item, index) in list"
|
||||
v-for="(item, index) in reasonList"
|
||||
:key="index"
|
||||
activeColor="#FF8CA6"
|
||||
:label="'思悠悠,恨悠悠,恨到归时方始休' + index"
|
||||
:name="index"
|
||||
:label="item.reason"
|
||||
:name="item.id"
|
||||
></u-radio>
|
||||
</u-radio-group>
|
||||
<view class="mt-20rpx mb-20rpx text-28rpx">其他理由,请填写</view>
|
||||
|
|
@ -145,6 +183,7 @@
|
|||
:autoHeight="false"
|
||||
/>
|
||||
<view
|
||||
@click="handleCancelSubmit"
|
||||
class="text-white bg-#FF8CA6 rounded-24rpx w-full mx-auto mt-30rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>提交</view
|
||||
>
|
||||
|
|
@ -157,9 +196,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
const { $api, $store, $Router, $loading } = instance.proxy
|
||||
const userInfo = computed(() => $store.user.userInfo)
|
||||
const { $api, $store, $Router, $toast, $dialog } = instance.proxy
|
||||
const roleName = computed(() => $store.user.userInfo.roleName)
|
||||
// 全部 待服务 进行中 已完成 已取消
|
||||
const list = ref([
|
||||
{ name: '全部', id: 0 },
|
||||
|
|
@ -169,13 +210,26 @@ const list = ref([
|
|||
{ name: '已取消', id: 4 }
|
||||
])
|
||||
const paging = ref([])
|
||||
const dataList = ref([[], [], [], [], []])
|
||||
const dataList = ref([
|
||||
{ data: [], show: true },
|
||||
{ data: [], show: false },
|
||||
{ data: [], show: false },
|
||||
{ data: [], show: false },
|
||||
{ data: [], show: false }
|
||||
])
|
||||
const popupShow = ref(false)
|
||||
const value = ref(0)
|
||||
const cancelVal = ref()
|
||||
const remark = ref('')
|
||||
const status = ref(Math.floor(Math.random() * 4))
|
||||
const status = ref(0)
|
||||
const current = ref(0)
|
||||
const outTradeNo = ref('')
|
||||
const reasonList = ref([])
|
||||
const stateColorList = [
|
||||
{
|
||||
text: '待支付',
|
||||
color: 'text-#fff',
|
||||
bg: 'bg-primary-500'
|
||||
},
|
||||
{
|
||||
text: '待服务',
|
||||
color: 'text-#01BB88',
|
||||
|
|
@ -198,47 +252,121 @@ const stateColorList = [
|
|||
}
|
||||
]
|
||||
|
||||
const getReasonList = () => {
|
||||
$api.reasonList().then(({ page = {} }) => {
|
||||
reasonList.value = page.list || []
|
||||
})
|
||||
}
|
||||
getReasonList()
|
||||
|
||||
onShow(() => {
|
||||
nextTick(() => {
|
||||
if (!roleName.value) {
|
||||
$dialog('请先登录', {
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '去登录',
|
||||
cancelButtonText: '取消',
|
||||
confirmColor: '#FF8CA6'
|
||||
})
|
||||
.then(() => {
|
||||
$Router.push('/personal')
|
||||
})
|
||||
.catch(() => '')
|
||||
return
|
||||
} else paging.value[current.value]?.reload()
|
||||
})
|
||||
})
|
||||
|
||||
const handleTabChange = (item) => {
|
||||
console.log('🚀 ~ file: index.vue:250 ~ item:', item)
|
||||
current.value = item.id
|
||||
status.value = item.id - 1 < 0 ? 0 : item.id - 1
|
||||
paging.value[current.value]?.reload()
|
||||
dataList.value[item.id].show = true
|
||||
}
|
||||
//swiper滑动结束
|
||||
const swiperAnimationfinish = (e) => {
|
||||
current.value = e.detail.current
|
||||
const cur = e.detail.current
|
||||
current.value = cur
|
||||
dataList.value[cur].show = true
|
||||
}
|
||||
|
||||
watch(current, (cur) => {
|
||||
dataList.value[cur].show && paging.value[cur]?.reload()
|
||||
})
|
||||
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
if (!roleName.value) return
|
||||
const params = {
|
||||
pageNo: pageNo,
|
||||
pageNum: pageNo,
|
||||
pageSize: pageSize,
|
||||
type: current.value
|
||||
status: current.value,
|
||||
roleName: roleName.value
|
||||
}
|
||||
setTimeout(() => {
|
||||
paging.value[current.value].complete(
|
||||
new Array(Math.floor(Math.random() * 20)).fill({})
|
||||
)
|
||||
}, 300)
|
||||
return
|
||||
$loading(true)
|
||||
$api
|
||||
.queryList(params)
|
||||
.then((res) => {
|
||||
paging.value[current.value].complete(res.data.list)
|
||||
dataList.value[current.value] = res.data.list
|
||||
$loading(false)
|
||||
.orderList(params)
|
||||
.then(({ data }) => {
|
||||
paging.value[current.value]?.complete(data?.records || [])
|
||||
dataList.value[current.value].data = data?.records || []
|
||||
dataList.value[current.value].show = true
|
||||
})
|
||||
.catch((res) => {
|
||||
paging.value.complete(false)
|
||||
$loading(false)
|
||||
paging.value[current.value]?.complete(false)
|
||||
})
|
||||
}
|
||||
|
||||
const handleClick = (item) => {
|
||||
console.log('🚀 ~ file: index.vue:133 ~ item:', item)
|
||||
popupShow.value = true
|
||||
const handleClick = async (item, type) => {
|
||||
console.log('🚀 ~ file: index.vue:284 ~ item:', item)
|
||||
if (type === 'start') {
|
||||
} else if (type === 'detail') {
|
||||
$Router.push({
|
||||
path: '/pages/form/index',
|
||||
query: {
|
||||
id: item.id
|
||||
}
|
||||
})
|
||||
} else if (type === 'cancel') {
|
||||
outTradeNo.value = item.outTradeNo
|
||||
popupShow.value = true
|
||||
} else if (type === 'refund') {
|
||||
$dialog('确定要申请退款吗?', {
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
confirmColor: '#FF8CA6'
|
||||
})
|
||||
.then(() => {
|
||||
$api
|
||||
.orderRefund({
|
||||
outTradeNo: item.outTradeNo
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.success)
|
||||
$toast('申请成功,请耐心等待到账!', {
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => '')
|
||||
}
|
||||
}
|
||||
const groupChange = (value) => {
|
||||
console.log('🚀 ~ file: index.vue:133 ~ value:', value)
|
||||
|
||||
const handleCancelSubmit = async () => {
|
||||
if (!cancelVal.value) return $toast('请选择取消理由')
|
||||
if (cancelVal.value === 5 && !remark.value?.trim()) {
|
||||
return $toast('请填写取消理由')
|
||||
}
|
||||
const res = await $api.cancelOrder({
|
||||
outTradeNo: outTradeNo.value,
|
||||
reasonId: cancelVal.value,
|
||||
remark: remark.value,
|
||||
roleName: roleName.value
|
||||
})
|
||||
if (res.success) {
|
||||
$toast('取消成功')
|
||||
popupShow.value = false
|
||||
paging.value[current.value]?.reload()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -178,9 +178,9 @@ const listConst = [
|
|||
]
|
||||
const menuList = ref([])
|
||||
watchEffect(() => {
|
||||
const { roleName = 'simple', roleList = [] } = userInfo.value
|
||||
const { roleName, roleList = [] } = userInfo.value
|
||||
list.simple[1].text = roleList.includes('common') ? '切换身份' : '成为陪诊师'
|
||||
menuList.value = [...list[roleName], ...listConst]
|
||||
menuList.value = [...list[roleName || 'simple'], ...listConst]
|
||||
})
|
||||
|
||||
const handleInfo = async (item) => {
|
||||
|
|
|
|||