addSanfangHetong.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="sfht-info-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">新增三方合同</text>
  6. </view>
  7. <!-- form -->
  8. <view class="sfht-form-box">
  9. <!-- 合同模板 -->
  10. <view class="form-label-select form-radius-box">
  11. <view class="phone-form-label"><text class="form-label-require"></text>合同模板</view>
  12. <picker :range="data.mobanList" mode='selector' :value="data.mobanIndex" range-key="name"
  13. @change="onMobanSelect" class="select-picker-box">
  14. <view class="form-radio-select">
  15. <view v-if="data.mobanList[data.mobanIndex]">{{ data.mobanList[data.mobanIndex].name}}</view>
  16. <icon></icon>
  17. </view>
  18. </picker>
  19. </view>
  20. <!-- 客户信息 -->
  21. <kehuCardVue></kehuCardVue>
  22. <!-- 家政人员 -->
  23. <jiazhengCardVue></jiazhengCardVue>
  24. <template v-if="data.mobanIndex == 0">
  25. <!-- 合同信息 -->
  26. <hetongCardVue></hetongCardVue>
  27. <!-- 其他约定 -->
  28. <qiTaYueDingVue></qiTaYueDingVue>
  29. <!-- 家政签名 -->
  30. <qianMingVue></qianMingVue>
  31. </template>
  32. <common-dialog ref="commonDialogRef" title="提示" :showQuxiao="false" content="请完善社会信用代码与服务监督热线"
  33. @confirm-btn="handleConfirm"></common-dialog>
  34. </view>
  35. <view class="sfht-info-btn-box">
  36. <button type="default" class="phone-green-btn" @click="handleAdd" v-if="data.type == 'addHetong'">创建合同</button>
  37. <button type="default" class="phone-green-btn" @click="handleUpdate" v-if="data.type == 'editorHetong'">更新合同</button>
  38. </view>
  39. </view>
  40. </template>
  41. <script setup>
  42. import {
  43. ref,
  44. reactive,
  45. nextTick
  46. } from "vue";
  47. import {
  48. onLoad
  49. } from "@dcloudio/uni-app";
  50. import * as httpApi from "@/api/sanfang.js"
  51. import hetongCardVue from "./components/hetongCard.vue";
  52. import jiazhengCardVue from "./components/jiazhengCard.vue";
  53. import kehuCardVue from "./components/kehuCard.vue";
  54. import qianMingVue from "./components/qianMing.vue";
  55. import qiTaYueDingVue from "./components/qiTaYueDing.vue";
  56. import commonDialog from '@/components/dialog/commonDialog.vue';
  57. import {
  58. useHetong
  59. } from "./useHetong.js"
  60. import {getSanfangInfo} from "../../../api/sanfang";
  61. const {
  62. provideHetong
  63. } = useHetong()
  64. const emits = defineEmits('select-kehu')
  65. const data = reactive({
  66. mobanList: [],
  67. mobanIndex: null,
  68. hetong: {
  69. htId: null, // 合同模板id
  70. baochou: '', // 基本月报酬
  71. qita: '', // 其他服务
  72. bingren: '', // 病人病情
  73. dizhi: '', // 服务地址
  74. fafangri: '', // 工资发放日
  75. fangshi: 1, // 服务方式,1住家型,2非住家型
  76. fsShijian: '', // 非住家型服务时间
  77. fuwufei: '', // 服务费
  78. fuwufeiRate: '', // 服务费百分比
  79. fzHaizi: '', // 辅助照顾孩子人数
  80. fzHzNianling: '', // 辅助照顾孩子年龄
  81. huli: '', // 产妇护理
  82. jiabingEndDate: '', // 甲丙服务结束时间
  83. jiabingStartDate: '', // 甲丙服务开始时间
  84. jiandurexian: '', // 服务监督热线
  85. jiayiEndDate: '', // 甲乙服务结束时间
  86. jiayiStartDate: '', // 甲乙服务开始时间
  87. khId: '', // 客户ID
  88. khName: '', // 客户姓名
  89. khIdcard: '', // 客户身份证号
  90. laoren: '', // 照顾老人人数
  91. leixing: 1, // 服务类型,1普通家务保姆,2钟点工保姆,3育儿嫂,4其他
  92. lrnianling: '', // 照顾老人年龄: 60,70,80
  93. lxName: '', // 其他服务类型名称
  94. mianji: '', // 住房面积
  95. qzHaizi: '', // 全职照顾孩子人数
  96. qzHzNianliang: '', // 全职照顾孩子年龄
  97. realName: '', // 家政姓名
  98. renkou: '', // 常驻人口数
  99. tianshu: '', // 基本月报酬天数
  100. userId: '', // 家政员ID
  101. xinyongdaima: '', // 统一社会信用代码
  102. xiuxi: '', // 休息天数
  103. khUserName: '', // 客户电话
  104. shentizhuangkuang: 1, // 身体状态,1 能自理 ,2半自理, 3不能自理
  105. beizhu: '', // 备注
  106. qianming: '',
  107. id: null
  108. },
  109. type: null
  110. })
  111. const commonDialogRef = ref(null)
  112. // 穿透式传参
  113. provideHetong(data)
  114. const jzRef = ref(null)
  115. function handleSelct(code) {
  116. if (code == 'kh') {
  117. khRef.value.handleShow();
  118. } else {
  119. jzRef.value.handleShow();
  120. }
  121. }
  122. function goUpPage() {
  123. uni.navigateBack()
  124. }
  125. function getMoban() {
  126. return httpApi.getMobanList().then(res => {
  127. data.mobanList = res.data;
  128. // 初始化默认选中
  129. data.mobanIndex = 0;
  130. })
  131. }
  132. function onMobanSelect(da) {
  133. data.mobanIndex = da.detail.value
  134. }
  135. function handleQianming(da) {
  136. data.qianming = da;
  137. }
  138. function handleAdd() {
  139. const opt = Object.assign({}, {...data.hetong,htId:data.mobanList[data.mobanIndex].id })
  140. httpApi.getSanfangAdd(opt).then(res => {
  141. if (res.data) {
  142. uni.showToast({
  143. title: "创建成功",
  144. success() {
  145. uni.navigateBack()
  146. }
  147. })
  148. }
  149. })
  150. }
  151. function handleUpdate() {
  152. const opt = Object.assign({}, {...data.hetong,htId:data.mobanList[data.mobanIndex].id })
  153. httpApi.getSanfangUpdate(opt).then(res => {
  154. if (res.data) {
  155. uni.showToast({
  156. title: "创建成功",
  157. success() {
  158. uni.navigateBack()
  159. }
  160. })
  161. }
  162. })
  163. }
  164. function handleConfirm() {
  165. uni.redirectTo({
  166. url: '/pages/admin/my/jzInfo' // 跳转完善
  167. })
  168. }
  169. onLoad((option) => {
  170. const { flag, id } = option;
  171. if (flag) {
  172. data.type = 'editorHetong'
  173. getMoban().then(() => {
  174. httpApi.getSanfangInfo({id}).then(res => {
  175. Object.assign(data.hetong,res.data)
  176. })
  177. })
  178. } else {
  179. data.type = 'addHetong'
  180. httpApi.getSanfangCheck().then(res => {
  181. if (res.data) {
  182. getMoban();
  183. } else {
  184. commonDialogRef.value.handleShow()
  185. }
  186. })
  187. }
  188. })
  189. </script>
  190. <style>
  191. </style>