72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
|
|
import { Apis } from '@/gen/Apis'
|
||
|
|
import { getApiLoading } from '@/common/libraries/apiLoading'
|
||
|
|
import userLoginStatus from '@/common/libraries/userUserLogin'
|
||
|
|
import { showToastBack, showToast } from '@/common/libraries/naviHelper'
|
||
|
|
import { useWeAppAuthStore, useWorkStore } from '@/common'
|
||
|
|
import useModel from './model'
|
||
|
|
const work = useWorkStore()
|
||
|
|
const auth = useWeAppAuthStore()
|
||
|
|
const getList = () => {
|
||
|
|
getApiLoading(Apis.Activity.ActivityEnrolls.List, useModel?.formData?.value).then(res => {
|
||
|
|
useModel.listData.value = [...useModel.listData.value, ...res.data]
|
||
|
|
useModel.metaData.value = res.meta
|
||
|
|
console.log(res)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export default {
|
||
|
|
getList,
|
||
|
|
init() {
|
||
|
|
if (work?.selectWorkHouse?.asset_house) {
|
||
|
|
useModel.formData.value = {
|
||
|
|
...useModel.formData.value,
|
||
|
|
asset_houses_id: work?.selectWorkHouse?.asset_house?.id,
|
||
|
|
full_name: work?.selectWorkHouse?.asset_house?.full_name
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
useModel.formData.value = {
|
||
|
|
...useModel.formData.value,
|
||
|
|
asset_houses_id: auth?.data?.selected_house?.id,
|
||
|
|
full_name: auth?.data?.selected_house?.full_name
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
loadMore(page: number) {
|
||
|
|
useModel.formData.value.page = page
|
||
|
|
this.getList()
|
||
|
|
},
|
||
|
|
handleTabsChange(idx: number, res: any) {
|
||
|
|
useModel.currentTabs.value = idx
|
||
|
|
useModel.formData.value = {
|
||
|
|
page: 1,
|
||
|
|
status: res?.value
|
||
|
|
}
|
||
|
|
useModel.listData.value = []
|
||
|
|
getList()
|
||
|
|
console.log(idx, 'e')
|
||
|
|
},
|
||
|
|
handleToSelectHouse() {
|
||
|
|
uni.navigateTo({
|
||
|
|
url: '/INDEX/asset_houses/index?type=work_add'
|
||
|
|
})
|
||
|
|
},
|
||
|
|
handleSubmit() {
|
||
|
|
let data = useModel?.formData?.value
|
||
|
|
if (!data?.asset_houses_id) {
|
||
|
|
return showToast('请选择房屋!')
|
||
|
|
}
|
||
|
|
if (!data?.type) {
|
||
|
|
return showToast('请选择装修类型!')
|
||
|
|
}
|
||
|
|
if (!data?.process_type) {
|
||
|
|
return showToast('请选择办理类型!')
|
||
|
|
}
|
||
|
|
getApiLoading(Apis.Renovation.RenovationApplies.Store, useModel?.formData?.value).then(res => {
|
||
|
|
uni.redirectTo({
|
||
|
|
url: `/ME/decoration/update/index?id=${res.data.id}`
|
||
|
|
})
|
||
|
|
console.log(res)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|