update
parent
9c12333c73
commit
8ffa88dac8
|
|
@ -72,6 +72,7 @@ export default defineUniPages({
|
|||
},
|
||||
{
|
||||
root: 'pages/form',
|
||||
name: 'form',
|
||||
pages: [
|
||||
{
|
||||
path: 'index',
|
||||
|
|
@ -91,6 +92,7 @@ export default defineUniPages({
|
|||
},
|
||||
{
|
||||
root: 'pages/other',
|
||||
name: 'other',
|
||||
pages: [
|
||||
{
|
||||
path: 'income-details',
|
||||
|
|
@ -167,6 +169,12 @@ export default defineUniPages({
|
|||
],
|
||||
},
|
||||
],
|
||||
preloadRule: {
|
||||
"pages/index/home/index": {
|
||||
network: "all",
|
||||
packages: ["pages/form", "pages/other"] // 在 pages/index 页面中预加载名为 pack1 分包内容
|
||||
}
|
||||
},
|
||||
tabBar: {
|
||||
// color: '#999999',
|
||||
// selectedColor: '#018d71',
|
||||
|
|
|
|||
|
|
@ -73,4 +73,15 @@ export const fetchPzServerList = params =>
|
|||
* @desc 医院列表
|
||||
*/
|
||||
export const fetchPzHospitalList = params =>
|
||||
request.get('/pzhospital/list', params)
|
||||
request.get('/pzhospital/listAll', params)
|
||||
|
||||
/**
|
||||
* @desc 上门服务列表
|
||||
*/
|
||||
export const fetchServerTypeList = params =>
|
||||
request.get('/visittype/listAll', params)
|
||||
/**
|
||||
* @desc 报告列表
|
||||
*/
|
||||
export const fetchReportTypelList = params =>
|
||||
request.get('/reporttype/listAll', params)
|
||||
|
|
@ -2,16 +2,18 @@ import * as base from './base/index.js'
|
|||
import * as user from './user/index.js'
|
||||
import * as home from './home/index.js'
|
||||
import * as realname from './realname/index.js'
|
||||
import * as order from './order/index.js'
|
||||
|
||||
const api = {
|
||||
...base,
|
||||
...user,
|
||||
...home,
|
||||
...realname,
|
||||
...order,
|
||||
}
|
||||
|
||||
export default {
|
||||
install(app) {
|
||||
install (app) {
|
||||
app.config.globalProperties.$api = api
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,10 +36,15 @@ export const doctorSave = data =>
|
|||
|
||||
/**
|
||||
* @description 获取陪诊师信息
|
||||
*/
|
||||
export const doctorInfo = data =>
|
||||
request.get('/doctor/infomation', data)
|
||||
*/
|
||||
export const doctorInfo = params =>
|
||||
request.get('/doctor/infomation', params)
|
||||
|
||||
/**
|
||||
* @description 切换身份信息
|
||||
*/
|
||||
export const checkRole = data =>
|
||||
request.post('/wxUser/checkRole', data)
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 377 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 61 KiB |
|
|
@ -8,7 +8,7 @@
|
|||
labelColor="#666"
|
||||
labelSize="24rpx"
|
||||
@change="handleChange"
|
||||
:disabled="disabled"
|
||||
:disabled="disabled"
|
||||
>
|
||||
<u-checkbox activeColor="#FF8CA6" name="1"></u-checkbox>
|
||||
<!-- label="我已阅读并同意" -->
|
||||
|
|
@ -45,7 +45,7 @@ const emit = defineEmits(['update:agreed'])
|
|||
const instance = getCurrentInstance()
|
||||
const { $Router } = instance.proxy
|
||||
watchEffect(() => {
|
||||
checked.value[0] = prop.agreed ? '1' : ''
|
||||
checked.value[0] = prop.agreed ? '1' : ''
|
||||
})
|
||||
|
||||
const handleAgree = () => {
|
||||
|
|
@ -53,6 +53,7 @@ const handleAgree = () => {
|
|||
}
|
||||
const handleAgreeCheck = () => {
|
||||
checked.value[0] = checked.value[0] === '1' ? '' : '1'
|
||||
emit('update:agreed', !!checked.value[0])
|
||||
}
|
||||
const handleChange = () => {
|
||||
emit('update:agreed', !!checked.value[0])
|
||||
|
|
|
|||
|
|
@ -27,7 +27,14 @@ const fileList = ref(props.modelValue)
|
|||
// 删除图片
|
||||
const deletePic = (event) => {
|
||||
fileList.value.splice(event.index, 1)
|
||||
emits('update:modelValue', fileList.value)
|
||||
emits(
|
||||
'update:modelValue',
|
||||
fileList.value.map((item) => ({
|
||||
size: item.size,
|
||||
type: item.type,
|
||||
url: item.url
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
// 新增图片
|
||||
|
|
@ -58,7 +65,14 @@ const afterRead = async (event) => {
|
|||
: fileList.value.splice(fileListLen, 1)
|
||||
fileListLen++
|
||||
}
|
||||
emits('update:modelValue', fileList.value)
|
||||
emits(
|
||||
'update:modelValue',
|
||||
fileList.value.map((item) => ({
|
||||
size: item.size,
|
||||
type: item.type,
|
||||
url: item.url
|
||||
}))
|
||||
)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ export const primaryColor = '#FF8CA6'
|
|||
// 项目基础路径
|
||||
export const appBasePath = isProduction ? './' : './'
|
||||
// 请求地址
|
||||
// export const requestURL = 'http://192.168.2.166:7788/hospital/app'
|
||||
export const requestURL = 'http://127.0.0.1:7788/hospital/app'
|
||||
// export const requestURL = 'http://192.168.2.155:7788/hospital/app'
|
||||
export const requestURL = 'https://peizhen.flameby.com/hospital/app'
|
||||
export const requestPath = ''
|
||||
export const requestFilePath = '/file'
|
||||
// 是否开启代理
|
||||
|
|
|
|||
|
|
@ -43,11 +43,13 @@
|
|||
"quickapp": {},
|
||||
"mp-weixin": {
|
||||
"appid": "wx55ff808ba0e28b1d",
|
||||
"libVersion": "3.1.5",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"ignoreUploadUnusedFiles": false,
|
||||
"ignoreDevUnusedFiles": false
|
||||
},
|
||||
"optimization": { "subPackages": true },
|
||||
"usingComponents": true,
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,15 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"preloadRule": {
|
||||
"pages/index/home/index": {
|
||||
"network": "all",
|
||||
"packages": [
|
||||
"pages/form",
|
||||
"pages/other"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tabBar": {
|
||||
"list": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,12 +11,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import wechatImage from '@/assets/image-wechat.png'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
wechatImage
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
:rules="rules"
|
||||
ref="formRef"
|
||||
borderBottom
|
||||
errorType="border-bottom"
|
||||
errorType="toast"
|
||||
labelWidth="auto"
|
||||
>
|
||||
<u-form-item
|
||||
|
|
@ -101,9 +101,9 @@
|
|||
>
|
||||
<upload-img
|
||||
v-model="fileList"
|
||||
disabled
|
||||
multiple
|
||||
:disabled="false"
|
||||
:maxCount="10"
|
||||
multiple
|
||||
></upload-img>
|
||||
</view>
|
||||
<view class="mt-22rpx mb-20rpx text-28rpx">备注</view>
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
3. 服务地点为必填项
|
||||
<br />
|
||||
</view>
|
||||
<agreed-comp v-model:agreed="agreed" />
|
||||
<agreed-comp v-model:agreed="agreed" :disabled="false" />
|
||||
</view>
|
||||
|
||||
<u-picker
|
||||
|
|
@ -134,19 +134,21 @@
|
|||
@confirm="onPickerConfirm"
|
||||
@cancel="show = false"
|
||||
@close="handleShowPicker"
|
||||
:defaultIndex="[curType - 1]"
|
||||
cancelText="取消"
|
||||
confirmColor="#FF8CA6"
|
||||
closeOnClickOverlay
|
||||
></u-picker>
|
||||
<block v-for="item in dateAndSelectFormList" :key="item.key">
|
||||
<!-- :minHour="item.type === 'time' ? new Date().getHours() : 0"
|
||||
:minMinute="item.type === 'time' ? new Date().getMinutes() : 0" -->
|
||||
<u-datetime-picker
|
||||
v-if="item.type === 'date' || item.type === 'time'"
|
||||
v-model="model[item.key]"
|
||||
:modelValue="model[item.key]"
|
||||
:show="item.show"
|
||||
:mode="item.type"
|
||||
:minDate="item.type === 'date' ? new Date().getTime() : 0"
|
||||
:minHour="item.type === 'time' ? new Date().getHours() : 0"
|
||||
:minMinute="item.type === 'time' ? new Date().getMinutes() : 0"
|
||||
:filter="item.type === 'time' ? filterFun : null"
|
||||
@confirm="onDatePickerConfirm($event, item)"
|
||||
@cancel="item.show = false"
|
||||
@close="item.show = false"
|
||||
|
|
@ -189,17 +191,20 @@
|
|||
</view>
|
||||
<button-contact />
|
||||
<view
|
||||
class="bg-#fff h-150rpx w-full sticky bottom-0 flex justify-between items-center pr-24rpx pl-40rpx pb-48rpx rounded-sm"
|
||||
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">
|
||||
<view>
|
||||
<text class="text-32rpx">¥</text>
|
||||
<text class="font-bold text-54rpx">{{
|
||||
typeSelItem.price || 198
|
||||
}}</text>
|
||||
<text class="font-bold text-54rpx">{{ selTypeItem.price || 0 }}</text>
|
||||
</view>
|
||||
<view
|
||||
@click="onSubmit"
|
||||
@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
|
||||
@click="$u.throttle(onSubmit, 1000)"
|
||||
class="text-white bg-#FF8CA6 rounded-24rpx w-240rpx h-80rpx text-center leading-80rpx hover:shadow-md"
|
||||
>立即下单</view
|
||||
>
|
||||
|
|
@ -218,7 +223,7 @@ import { useRoute } from '@/utils/uni-router'
|
|||
|
||||
const route = useRoute()
|
||||
const instance = getCurrentInstance()
|
||||
const { $u, $api, $Router, $Dialog } = instance.proxy
|
||||
const { $u, $api, $Router, $dialog, $toast, $store, $loading } = instance.proxy
|
||||
// 填写订单 在线支付 服务中 服务完成
|
||||
const list = ref([
|
||||
{ label: '填写订单', id: 1 },
|
||||
|
|
@ -228,16 +233,7 @@ const list = ref([
|
|||
])
|
||||
const current = ref(1)
|
||||
const show = ref(false)
|
||||
const fileList = ref([
|
||||
{
|
||||
message: '',
|
||||
size: 20042,
|
||||
// status: 'success',
|
||||
thumb: 'http://tmp/Y2K3DucvbS0Aa23b6ba2697baa86a0eb579485736a6a.jpeg',
|
||||
type: 'image',
|
||||
url: 'https://xjl559.oss-cn-shanghai.aliyuncs.com/2023/12/08/3d4a506c74a145ba_Y2K3DucvbS0Aa23b6ba2697baa86a0eb579485736a6a.jpeg'
|
||||
}
|
||||
])
|
||||
const fileList = ref([])
|
||||
// 半天陪诊 全天陪诊 代办约号 取送报告 代取送药 上门护理
|
||||
const columns = reactive([
|
||||
[
|
||||
|
|
@ -265,12 +261,12 @@ const formItems = [
|
|||
},
|
||||
{
|
||||
label: '就诊医院',
|
||||
placeholder: '请输入',
|
||||
placeholder: '请选择就诊医院',
|
||||
key: 'hospitalId',
|
||||
required: true,
|
||||
type: 'select',
|
||||
trigger: ['blur', 'change'],
|
||||
message: '请填写就诊医院',
|
||||
message: '请选择就诊医院',
|
||||
show: false,
|
||||
cur: [1, 2, 3, 4, 5],
|
||||
sort: 2
|
||||
|
|
@ -278,12 +274,13 @@ const formItems = [
|
|||
{
|
||||
label: '上门护理',
|
||||
placeholder: '请选择上门护理类型',
|
||||
key: 'hospitalId',
|
||||
key: 'typeId',
|
||||
required: true,
|
||||
type: 'checkbox',
|
||||
type: 'select',
|
||||
trigger: ['blur', 'change'],
|
||||
message: '请选择上门护理类型',
|
||||
show: false,
|
||||
options: [],
|
||||
cur: [6],
|
||||
sort: 1
|
||||
},
|
||||
|
|
@ -369,19 +366,7 @@ const formItems = [
|
|||
message: '请填写就诊人',
|
||||
show: true,
|
||||
sort: 5,
|
||||
cur: [1, 2]
|
||||
},
|
||||
{
|
||||
label: '就诊人',
|
||||
placeholder: '请填写就诊人',
|
||||
key: 'treatmenter',
|
||||
required: true,
|
||||
type: 'string',
|
||||
trigger: ['blur', 'change'],
|
||||
message: '请填写就诊人',
|
||||
show: true,
|
||||
sort: 5,
|
||||
cur: [5]
|
||||
cur: [1, 2, 5]
|
||||
},
|
||||
{
|
||||
label: '联系人',
|
||||
|
|
@ -428,15 +413,21 @@ const formItems = [
|
|||
// show: true
|
||||
// }
|
||||
]
|
||||
const formRef = ref(null)
|
||||
const dateAndSelectFormList = ref()
|
||||
const formList = ref()
|
||||
const model = ref({})
|
||||
const typeSelItem = ref({}) //选择的服务项目
|
||||
const curType = ref(route.query.cur ? +route.query.cur : columns[0][0].id)
|
||||
const typeVal = ref('')
|
||||
const selTypeItem = ref({})
|
||||
const rules = ref({})
|
||||
const agreed = ref(true)
|
||||
const agreed = ref(false)
|
||||
const hospitalList = ref([])
|
||||
const serverTypelList = ref([])
|
||||
const reportTypelList = ref([])
|
||||
const dateKeyObj = {}
|
||||
const orderId = ref(route.query.id ? +route.query.id : '')
|
||||
const orderInfo = ref({})
|
||||
|
||||
const getPzList = async () => {
|
||||
const res = await $api.fetchPzServerList()
|
||||
|
|
@ -445,37 +436,145 @@ const getPzList = async () => {
|
|||
|
||||
const getPzHospitalList = async () => {
|
||||
const res = await $api.fetchPzHospitalList()
|
||||
hospitalList.value = (res?.page?.list || []).map((item) => ({
|
||||
hospitalList.value = (res?.list || []).map((item) => ({
|
||||
label: item.name,
|
||||
id: item.id
|
||||
id: item.id + ''
|
||||
}))
|
||||
}
|
||||
const getServerTypeList = async () => {
|
||||
const res = await $api.fetchServerTypeList()
|
||||
serverTypelList.value = (res?.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
id: item.id + ''
|
||||
}))
|
||||
}
|
||||
const getReportTypelList = async () => {
|
||||
const res = await $api.fetchReportTypelList()
|
||||
reportTypelList.value = (res?.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
id: item.id + ''
|
||||
}))
|
||||
}
|
||||
const getOrderInfo = async () => {
|
||||
// if (!orderId.value) return
|
||||
$loading(true)
|
||||
const res = await $api.orderInfo({ id: orderId.value || 12 })
|
||||
if (res.success) {
|
||||
const { order = {} } = res
|
||||
orderInfo.value = order
|
||||
curType.value = order.serverId
|
||||
}
|
||||
$loading(false)
|
||||
}
|
||||
|
||||
getPzList()
|
||||
getPzHospitalList()
|
||||
getServerTypeList()
|
||||
getReportTypelList()
|
||||
getOrderInfo()
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('submit', fileList.value)
|
||||
const orderPay = async () => {
|
||||
const res = await $api.orderPay({
|
||||
orderId: orderId.value || model.value.contactPhone
|
||||
})
|
||||
if (res?.success) {
|
||||
const { timeStamp, nonce_str, prepay_id, signType = 'MD5', sign } = res
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay', // 支付宝支付:alipay,微信支付:wxpay
|
||||
timeStamp,
|
||||
nonceStr: nonce_str,
|
||||
package: prepay_id,
|
||||
signType,
|
||||
paySign: sign,
|
||||
success: function (res) {
|
||||
// 在这里处理支付成功的回调
|
||||
console.log(res)
|
||||
$toast('支付成功!')
|
||||
},
|
||||
fail: function (err) {
|
||||
// 处理支付失败的回调
|
||||
console.error(err.errMsg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
const onSubmit = () => {
|
||||
formRef.value.validate().then(async () => {
|
||||
if ([4, 5].includes(curType.value)) {
|
||||
if (fileList.value.length)
|
||||
model.value.pictureUrl = JSON.stringify(fileList.value)
|
||||
else {
|
||||
$toast(`请上传${curType.value === 5 ? '挂号' : '取报告'}凭证!`)
|
||||
return
|
||||
}
|
||||
}
|
||||
const { date, time } = dateKeyObj
|
||||
if (time && date) {
|
||||
const selDate = `${model.value[date]}T${model.value[time]}:00`
|
||||
if (new Date(selDate) < new Date()) {
|
||||
$toast('选择时间不能小于当前时间!', {
|
||||
type: 'error',
|
||||
duration: 2 * 1000
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (!agreed.value) {
|
||||
try {
|
||||
await $dialog('是否已阅读并同意《服务条款》?', {
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '同意',
|
||||
cancelButtonText: '取消',
|
||||
confirmColor: '#FF8CA6'
|
||||
})
|
||||
agreed.value = true
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// $loading(true)
|
||||
model.value.serverId = curType.value
|
||||
const { success, order } = await $api.orderCreate(model.value)
|
||||
if (success) {
|
||||
orderId.value = order.id
|
||||
orderInfo.value = order
|
||||
orderPay()
|
||||
$toast('提交订单成功!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
watch(curType, () => {
|
||||
const item = columns[0].find((item) => item.id === curType.value)
|
||||
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)) {
|
||||
if (item.key === 'hospitalId') item.options = [hospitalList.value]
|
||||
if (key === 'hospitalId') item.options = [hospitalList.value]
|
||||
if (key === 'typeId') item.options = [serverTypelList.value]
|
||||
if (key === 'reportType') item.options = [reportTypelList.value]
|
||||
formList.value.push(item)
|
||||
// if (['date', 'time', 'select'].includes(type)) {
|
||||
if (item.type !== 'string') {
|
||||
if (type !== 'string') {
|
||||
dateAndSelectFormList.value.push(item)
|
||||
}
|
||||
rules.value[item.key] = { required, message, trigger }
|
||||
if (orderInfo.value.srReport) {
|
||||
item.val = model.value[key] = orderInfo.value.srReport[key]
|
||||
} else {
|
||||
model.value[key] = ''
|
||||
if (type === 'time') model.value[key] = `${new Date().getHours()}:00`
|
||||
if (type === 'date' || type === 'time') dateKeyObj[type] = key
|
||||
}
|
||||
}
|
||||
rules.value[item.key] = { required, message, trigger }
|
||||
model.value[key] = ''
|
||||
})
|
||||
if (typeof orderInfo.value.srReport?.pictureUrl === 'string') {
|
||||
fileList.value = JSON.parse(orderInfo.value.srReport.pictureUrl)
|
||||
}
|
||||
console.log('🚀 ~ file: index.vue:572 ~ model.value:', model.value)
|
||||
})
|
||||
|
||||
const handleShowPicker = () => {
|
||||
|
|
@ -488,7 +587,6 @@ const onPickerConfirm = ({ value: [val] }) => {
|
|||
show.value = false
|
||||
typeVal.value = val.serveName
|
||||
curType.value = val.id
|
||||
typeSelItem.value = val
|
||||
}
|
||||
// 列表选择器
|
||||
const onSelectPickerConfirm = ({ value: [val] } = { value: [] }, item) => {
|
||||
|
|
@ -498,14 +596,19 @@ const onSelectPickerConfirm = ({ value: [val] } = { value: [] }, item) => {
|
|||
}
|
||||
const onDatePickerConfirm = ({ value }, item) => {
|
||||
item.show = false
|
||||
if (item.type === 'date') {
|
||||
if (item.type === 'date')
|
||||
item.val = model.value[item.key] = $u.timeFormat(value, 'yyyy-mm-dd')
|
||||
} else item.val = model.value[item.key] = value
|
||||
else item.val = model.value[item.key] = value
|
||||
}
|
||||
// 护理项目点击
|
||||
const onCheckboxChange = (val, item) => {
|
||||
model.value[item.key] = val
|
||||
item.val = val.join(',')
|
||||
item.val = val
|
||||
}
|
||||
|
||||
const filterFun = (type, value) => {
|
||||
if (type === 'minute') return value.filter((item) => item % 15 === 0)
|
||||
return value
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -43,17 +43,25 @@
|
|||
<button
|
||||
class="absolute right-30rpx bottom-40rpx bg-transparent border-transparent z-2 w-120rpx h-150rpx"
|
||||
open-type="contact"
|
||||
hoverClass="none"
|
||||
></button>
|
||||
</view>
|
||||
<view class="relative">
|
||||
<u--image
|
||||
width="702rpx"
|
||||
height="180rpx"
|
||||
mode="aspectFit"
|
||||
radius="16rpx"
|
||||
:src="$assets('/tongzhi.png')"
|
||||
:duration="300"
|
||||
lazy-load
|
||||
/>
|
||||
<button
|
||||
class="absolute left-0 top-0 w-full h-full bg-transparent border-transparent z-2"
|
||||
open-type="contact"
|
||||
hoverClass="none"
|
||||
></button>
|
||||
</view>
|
||||
<u--image
|
||||
width="702rpx"
|
||||
height="180rpx"
|
||||
mode="aspectFit"
|
||||
radius="16rpx"
|
||||
:src="$assets('/tongzhi.png')"
|
||||
:duration="300"
|
||||
lazy-load
|
||||
/>
|
||||
<view class="mt-30rpx flex items-center h-180rpx mb-20rpx">
|
||||
<u--image
|
||||
:src="$assets('/tongzhi.png')"
|
||||
|
|
@ -71,16 +79,16 @@
|
|||
<u-icon name="arrow-right" width="48rpx" height="48rpx" />
|
||||
</view>
|
||||
</view>
|
||||
<tabbar></tabbar>
|
||||
<tabbar></tabbar>
|
||||
</view>
|
||||
<Order v-else />
|
||||
<Order v-else />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue'
|
||||
import Order from '../order/index.vue'
|
||||
|
||||
const { $Router, $api,$store } = getCurrentInstance().proxy
|
||||
const { $Router, $api, $store } = getCurrentInstance().proxy
|
||||
const userRole = computed(() => $store.user.userInfo.roleName ?? 'simple')
|
||||
const searchVal = ref('')
|
||||
const swiperList = ref([
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
<template>
|
||||
<view class="min-h-600rpx">
|
||||
<u-sticky bgColor="#fff">
|
||||
<view v-if="true" class="px-24rpx pt-20rpx relative">
|
||||
<z-paging-swiper>
|
||||
<template #top>
|
||||
<view
|
||||
v-if="userInfo.roleName === 'common'"
|
||||
class="px-24rpx pt-20rpx relative"
|
||||
>
|
||||
<u--image
|
||||
width="100%"
|
||||
height="200rpx"
|
||||
|
|
@ -25,9 +28,10 @@
|
|||
@change="handleTabChange"
|
||||
class="w-full"
|
||||
:list="list"
|
||||
key="id"
|
||||
lineWidth="30"
|
||||
lineColor="#FF8CA6"
|
||||
:scrollable="false"
|
||||
:current="current"
|
||||
:activeStyle="{
|
||||
color: '#303133',
|
||||
fontWeight: 'bold',
|
||||
|
|
@ -39,62 +43,74 @@
|
|||
}"
|
||||
itemStyle="width: 20%; height: 100rpx;"
|
||||
></u-tabs>
|
||||
</u-sticky>
|
||||
|
||||
<view class="h-full">
|
||||
<template v-for="item in 10" :key="item">
|
||||
<view
|
||||
class="min-h-410rpx bg-white rounded-16rpx px-20rpx py-30rpx mb-20rpx shadow-current"
|
||||
</template>
|
||||
<swiper
|
||||
class="h-full"
|
||||
:current="current"
|
||||
@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 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[current]"
|
||||
: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
|
||||
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 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">服务项目</text></view>
|
||||
<view 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">
|
||||
<text>就诊人</text>
|
||||
<text class="text-#000 mt-8rpx">就诊人</text>
|
||||
</view>
|
||||
<view class="flex flex-col flex-1 pl-40rpx pr-20rpx text-#666">
|
||||
<text>医院</text>
|
||||
<text class="text-#000 mt-8rpx">医院医院医院医院医院</text>
|
||||
</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>
|
||||
</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>
|
||||
<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>
|
||||
</template>
|
||||
</view>
|
||||
</z-paging>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<u-popup
|
||||
class="overflow-hidden"
|
||||
:show="popupShow"
|
||||
|
|
@ -102,19 +118,19 @@
|
|||
@close="popupShow = false"
|
||||
closeable
|
||||
>
|
||||
<view class="min-h-800rpx pt-90rpx relative">
|
||||
<view class="pt-90rpx relative">
|
||||
<view class="text-#000 absolute left-50rpx top-30rpx"
|
||||
>请选择取消理由</view
|
||||
>
|
||||
<view
|
||||
class="h-full w-full overflow-y-auto py-4 px-40rpx rounded-16rpx overflow-hidden"
|
||||
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
|
||||
class="!mb-30rpx"
|
||||
labelSize="16"
|
||||
iconSize="20"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
activeColor="#FF8CA6"
|
||||
:label="'思悠悠,恨悠悠,恨到归时方始休' + index"
|
||||
:name="index"
|
||||
|
|
@ -136,11 +152,14 @@
|
|||
</view>
|
||||
</u-popup>
|
||||
<button-contact :class="`!bottom-16%`" />
|
||||
<tabbar :fixed="false" />
|
||||
</view>
|
||||
<template #bottom><tabbar :fixed="false" /></template>
|
||||
</z-paging-swiper>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const instance = getCurrentInstance()
|
||||
const { $api, $store, $Router, $loading } = instance.proxy
|
||||
const userInfo = computed(() => $store.user.userInfo)
|
||||
// 全部 待服务 进行中 已完成 已取消
|
||||
const list = ref([
|
||||
{ name: '全部', id: 0 },
|
||||
|
|
@ -149,10 +168,13 @@ const list = ref([
|
|||
{ name: '已完成', id: 3 },
|
||||
{ name: '已取消', id: 4 }
|
||||
])
|
||||
const paging = ref([])
|
||||
const dataList = ref([[], [], [], [], []])
|
||||
const popupShow = ref(false)
|
||||
const value = ref(0)
|
||||
const remark = ref('')
|
||||
const status = ref(Math.floor(Math.random() * 4))
|
||||
const current = ref(0)
|
||||
const stateColorList = [
|
||||
{
|
||||
text: '待服务',
|
||||
|
|
@ -178,7 +200,39 @@ const stateColorList = [
|
|||
|
||||
const handleTabChange = (item) => {
|
||||
status.value = item.id - 1 < 0 ? 0 : item.id - 1
|
||||
paging.value[current.value]?.reload()
|
||||
}
|
||||
//swiper滑动结束
|
||||
const swiperAnimationfinish = (e) => {
|
||||
current.value = e.detail.current
|
||||
}
|
||||
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
const params = {
|
||||
pageNo: pageNo,
|
||||
pageSize: pageSize,
|
||||
type: current.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)
|
||||
})
|
||||
.catch((res) => {
|
||||
paging.value.complete(false)
|
||||
$loading(false)
|
||||
})
|
||||
}
|
||||
|
||||
const handleClick = (item) => {
|
||||
console.log('🚀 ~ file: index.vue:133 ~ item:', item)
|
||||
popupShow.value = true
|
||||
|
|
@ -212,5 +266,12 @@ page {
|
|||
.u-popup__content {
|
||||
overflow: hidden;
|
||||
}
|
||||
.u-radio {
|
||||
padding-bottom: 20rpx !important;
|
||||
width: 100% !important;
|
||||
.u-radio__text {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ import defaultAvatar from '@/static/avatar.png'
|
|||
import { onShow } from '@dcloudio/uni-app'
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
const { $api, $store, $Router, $loading } = instance.proxy
|
||||
const { $api, $store, $Router, $loading, $dialog, $toast } = instance.proxy
|
||||
|
||||
const userStore = $store.user
|
||||
const isLogin = computed(() => !!$store.user.token)
|
||||
|
|
@ -178,11 +178,35 @@ const listConst = [
|
|||
]
|
||||
const menuList = ref([])
|
||||
watchEffect(() => {
|
||||
const { roleName = 'simple' } = userInfo.value
|
||||
const { roleName = 'simple', roleList = [] } = userInfo.value
|
||||
list.simple[1].text = roleList.includes('common') ? '切换身份' : '成为陪诊师'
|
||||
menuList.value = [...list[roleName], ...listConst]
|
||||
})
|
||||
|
||||
function handleInfo(item) {
|
||||
const handleInfo = async (item) => {
|
||||
const { roleName, roleList = [] } = userInfo.value
|
||||
if (
|
||||
!item.path ||
|
||||
(item.path === '/pages/other/switch' && roleList.includes('common'))
|
||||
) {
|
||||
try {
|
||||
await $dialog(
|
||||
`确认切换回${roleName === 'simple' ? '陪诊师' : '普通用户'}?`,
|
||||
{
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmColor: '#FF8CA6'
|
||||
}
|
||||
)
|
||||
const { success, wxUser = {} } = await $api.checkRole({ roleName })
|
||||
if (success) {
|
||||
userStore.setUserInfo(wxUser)
|
||||
$toast('身份切换成功!')
|
||||
}
|
||||
} catch (error) {}
|
||||
return
|
||||
}
|
||||
$Router.push({
|
||||
path: item.path,
|
||||
query: item.query || {}
|
||||
|
|
@ -191,7 +215,7 @@ function handleInfo(item) {
|
|||
// 提现
|
||||
const handleWithdraw = () => {}
|
||||
|
||||
async function handleLogin() {
|
||||
const handleLogin = async () => {
|
||||
if (!isLogin.value) {
|
||||
$loading(true)
|
||||
userStore.login().then((user) => {
|
||||
|
|
@ -201,25 +225,20 @@ async function handleLogin() {
|
|||
path: '/pages/other/edit-userinfo'
|
||||
})
|
||||
: userStore.setUserInfo(user)
|
||||
console.log('🚀 ~ file: index.vue:204 ~ user:', user)
|
||||
})
|
||||
} else
|
||||
$Router.push({
|
||||
path: '/pages/other/edit-userinfo'
|
||||
})
|
||||
}
|
||||
// await userStore.logout()
|
||||
// await $toast('退出登录成功', { type: 'success' })
|
||||
|
||||
const getUserInfo = async () => {
|
||||
if (isLogin.value) {
|
||||
// $loading(true)
|
||||
const res = await $api.getUser()
|
||||
if (res.success) {
|
||||
// $loading(false)
|
||||
userStore.setUserInfo(res.wxUser || {})
|
||||
} else userStore.logout()
|
||||
} else userStore.removeUserInfo()
|
||||
} else userStore.logout()
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
|
|
|
|||
|
|
@ -300,7 +300,6 @@ const handleSubmit = async () => {
|
|||
|
||||
agreed.value = true
|
||||
} catch (error) {
|
||||
console.log('error', error)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
|
|
@ -1,9 +1,9 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { getToken, removeToken, setToken, getUserInfo as getStorageUserInfo, setUserInfo, removeUserInfo } from '@/utils/token.js'
|
||||
import { getUserInfo, userLogin } from '@/api/user/index.js'
|
||||
import defaultAvatar from '@/static/avatar.png'
|
||||
import router from '@/router'
|
||||
import { useToast } from '@/utils/modals/index.js'
|
||||
// import defaultAvatar from '@/static/avatar.png'
|
||||
// import router from '@/router'
|
||||
|
||||
// import storage from '@/utils/storages'
|
||||
|
||||
|
|
@ -38,9 +38,17 @@ export const useUserStore = defineStore('app-user', {
|
|||
provider: 'weixin',
|
||||
success: ({ userInfo }) => {
|
||||
// 获取用户信息成功
|
||||
this.setUserInfo(userInfo)
|
||||
this.setToken(res.token)
|
||||
resolve(userInfo)
|
||||
if (res.token) {
|
||||
this.setUserInfo(userInfo)
|
||||
this.setToken(res.token)
|
||||
resolve(userInfo)
|
||||
} else {
|
||||
useToast('微信登录失败!', {
|
||||
type: 'error',
|
||||
duration: 2 * 1000,
|
||||
})
|
||||
reject('登录失败!')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
useToast('微信登录失败,请先同意授权!', {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export function setToken (data) {
|
|||
export const getToken = () => storage.get('token')
|
||||
|
||||
export function removeToken () {
|
||||
storage.remove('userInfo')
|
||||
storage.remove('token')
|
||||
}
|
||||
export function setUserInfo (data) {
|
||||
storage.set('userInfo', data)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ export default defineConfig({
|
|||
// },
|
||||
// },
|
||||
rollupOptions: {
|
||||
external: ['z-paging'],
|
||||
// external: ['/wxcomponents'],
|
||||
// output: {
|
||||
// manualChunks: undefined,
|
||||
|
|
|
|||
Loading…
Reference in New Issue