addSanfangHetong.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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"
  37. v-if="data.type == 'addHetong'">创建合同</button>
  38. <button type="default" class="phone-green-btn" @click="handleUpdate"
  39. v-if="data.type == 'editorHetong'">更新合同</button>
  40. </view>
  41. </view>
  42. </template>
  43. <script setup>
  44. import {
  45. ref,
  46. reactive,
  47. nextTick
  48. } from "vue";
  49. import {
  50. onLoad
  51. } from "@dcloudio/uni-app";
  52. import * as httpApi from "@/api/sanfang.js"
  53. import hetongCardVue from "./components/hetongCard.vue";
  54. import jiazhengCardVue from "./components/jiazhengCard.vue";
  55. import kehuCardVue from "./components/kehuCard.vue";
  56. import qianMingVue from "./components/qianMing.vue";
  57. import qiTaYueDingVue from "./components/qiTaYueDing.vue";
  58. import commonDialog from '@/components/dialog/commonDialog.vue';
  59. import {
  60. useHetong
  61. } from "./useHetong.js"
  62. import {
  63. getSanfangInfo
  64. } from "../../../api/sanfang";
  65. const {
  66. provideHetong
  67. } = useHetong()
  68. const emits = defineEmits('select-kehu')
  69. const data = reactive({
  70. mobanList: [],
  71. mobanIndex: null,
  72. hetong: {
  73. htId: null, // 合同模板id
  74. baochou: '', // 基本月报酬
  75. qita: '', // 其他服务
  76. bingren: '', // 病人病情
  77. dizhi: '', // 服务地址
  78. fafangri: '', // 工资发放日
  79. fangshi: 1, // 服务方式,1住家型,2非住家型
  80. fsShijian: '', // 非住家型服务时间
  81. fuwufei: '', // 服务费
  82. fuwufeiRate: '', // 服务费百分比
  83. fzHaizi: '', // 辅助照顾孩子人数
  84. fzHzNianling: '', // 辅助照顾孩子年龄
  85. huli: '', // 产妇护理
  86. jiabingEndDate: '', // 甲丙服务结束时间
  87. jiabingStartDate: '', // 甲丙服务开始时间
  88. jiandurexian: '', // 服务监督热线
  89. jiayiEndDate: '', // 甲乙服务结束时间
  90. jiayiStartDate: '', // 甲乙服务开始时间
  91. khId: '', // 客户ID
  92. khName: '', // 客户姓名
  93. khIdcard: '', // 客户身份证号
  94. laoren: '', // 照顾老人人数
  95. leixing: 1, // 服务类型,1普通家务保姆,2钟点工保姆,3育儿嫂,4其他
  96. lrnianling: '', // 照顾老人年龄: 60,70,80
  97. lxName: '', // 其他服务类型名称
  98. mianji: '', // 住房面积
  99. qzHaizi: '', // 全职照顾孩子人数
  100. qzHzNianliang: '', // 全职照顾孩子年龄
  101. realName: '', // 家政姓名
  102. renkou: '', // 常驻人口数
  103. tianshu: '', // 基本月报酬天数
  104. userId: '', // 家政员ID
  105. xinyongdaima: '', // 统一社会信用代码
  106. xiuxi: '', // 休息天数
  107. khUserName: '', // 客户电话
  108. shentiqingkuang: 0, // 身体状态,1 能自理 ,2半自理, 3不能自理
  109. beizhu: '', // 备注
  110. qianmingBase64: '',
  111. id: null,
  112. jutidizhi: '',
  113. },
  114. type: null,
  115. timer: null
  116. })
  117. const commonDialogRef = ref(null)
  118. // 穿透式传参
  119. provideHetong(data)
  120. const jzRef = ref(null)
  121. function handleSelct(code) {
  122. if (code == 'kh') {
  123. khRef.value.handleShow();
  124. } else {
  125. jzRef.value.handleShow();
  126. }
  127. }
  128. function goUpPage() {
  129. uni.navigateBack()
  130. }
  131. function getMoban() {
  132. return httpApi.getMobanList().then(res => {
  133. data.mobanList = res.data;
  134. // 初始化默认选中
  135. data.mobanIndex = 0;
  136. })
  137. }
  138. function onMobanSelect(da) {
  139. data.mobanIndex = da.detail.value
  140. }
  141. function handleQianming(da) {
  142. data.qianming = da;
  143. }
  144. function handleAdd() {
  145. uni.showLoading({
  146. title: '创建中...',
  147. mask: true
  148. });
  149. const opt = Object.assign({}, {
  150. ...data.hetong,
  151. htId: data.mobanList[data.mobanIndex].id
  152. })
  153. httpApi.getSanfangAdd(opt).then(res => {
  154. if (res.data) {
  155. uni.hideLoading()
  156. uni.showToast({
  157. title: "创建成功",
  158. duration:2000,
  159. success() {
  160. setTimeout(() => {
  161. uni.navigateBack()
  162. },2000)
  163. }
  164. })
  165. }
  166. }).catch(() => {
  167. uni.hideLoading()
  168. }).
  169. finally(() => {
  170. clearTimeout(data.timer);
  171. data.timer = null;
  172. })
  173. }
  174. function handleUpdate() {
  175. uni.showLoading({
  176. title: '更新中...',
  177. mask: true
  178. });
  179. const opt = Object.assign({}, {
  180. ...data.hetong,
  181. htId: data.mobanList[data.mobanIndex].id
  182. })
  183. httpApi.getSanfangUpdate(opt).then(res => {
  184. if (res.data) {
  185. uni.hideLoading()
  186. uni.showToast({
  187. title: "更新成功",
  188. duration:2000,
  189. mask: true,
  190. success() {
  191. setTimeout(() => {
  192. uni.navigateBack()
  193. },2000)
  194. }
  195. })
  196. }
  197. }).catch(() => {
  198. uni.hideLoading()
  199. })
  200. }
  201. function handleConfirm() {
  202. uni.redirectTo({
  203. url: '/pages/admin/my/jzInfo' // 跳转完善
  204. })
  205. }
  206. onLoad((option) => {
  207. const {
  208. flag,
  209. id
  210. } = option;
  211. if (flag) {
  212. data.type = 'editorHetong'
  213. getMoban().then(() => {
  214. httpApi.getSanfangInfo({
  215. id
  216. }).then(res => {
  217. Object.assign(data.hetong, res.data)
  218. console.log('ccccc', res.data)
  219. })
  220. })
  221. } else {
  222. data.type = 'addHetong'
  223. httpApi.getSanfangCheck().then(res => {
  224. if (res.data) {
  225. getMoban();
  226. } else {
  227. commonDialogRef.value.handleShow()
  228. }
  229. })
  230. }
  231. })
  232. </script>
  233. <style>
  234. </style>