form.vue 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122
  1. <template>
  2. <!-- 添加或修改项目信息对话框 -->
  3. <div class="el-drawer__wrapper">
  4. <el-drawer :title="title" v-model="visible" direction="rtl" size="100%">
  5. <div class="page-container form-container">
  6. <div class="form-btns-container">
  7. <span class="title-label"
  8. ><el-icon>
  9. <Document />
  10. </el-icon>
  11. 合同信息</span
  12. >
  13. <el-button
  14. v-if="form.verifyStatus == 0 && !editStatus"
  15. type="warning"
  16. size="small"
  17. icon="Edit"
  18. @click="editStatus = true"
  19. >修改</el-button
  20. >
  21. <el-button
  22. v-if="form.id && editStatus"
  23. type="info"
  24. size="small"
  25. icon="Close"
  26. @click="
  27. () => {
  28. editStatus = false;
  29. getForm();
  30. }
  31. "
  32. >取消修改</el-button
  33. >
  34. <el-button
  35. v-if="form.id"
  36. type="success"
  37. size="small"
  38. icon="refresh"
  39. @click="getForm"
  40. >
  41. 刷新
  42. </el-button>
  43. <el-button
  44. v-show="form.id && !editStatus && form.verifyStatus == 0"
  45. v-hasPermi="['business:archive:order:verify']"
  46. type="primary"
  47. size="small"
  48. icon="check"
  49. @click="verifyHandler"
  50. >审核通过</el-button
  51. >
  52. <el-button
  53. v-show="form.id && !editStatus && form.verifyStatus == 0"
  54. v-hasPermi="['business:archive:order:verify']"
  55. type="danger"
  56. size="small"
  57. icon="back"
  58. @click="rejectHandler"
  59. >驳回</el-button
  60. >
  61. <el-button
  62. v-show="form.alterNumber > 0 && !editStatus"
  63. v-hasPermi="['business:archive:order:history']"
  64. type="info"
  65. size="small"
  66. icon="Notebook"
  67. @click="showHistoryList"
  68. >历史记录</el-button
  69. >
  70. <div class="screen-btn" @click="handleScreen">
  71. <template v-if="!isFullscreen">
  72. <i class="fa fa-window-maximize" aria-hidden="true" />
  73. <!-- <span>全屏</span> -->
  74. </template>
  75. <template v-else>
  76. <i class="fa fa-window-restore" aria-hidden="true" />
  77. <!-- <span>还原</span> -->
  78. </template>
  79. </div>
  80. <div class="close-btn" @click="cancel">
  81. <i class="fa fa-times" aria-hidden="true" />
  82. <!-- <span>关闭</span> -->
  83. </div>
  84. </div>
  85. <div
  86. class="Y-scrollbar"
  87. style="
  88. position: absolute;
  89. top: 32px;
  90. bottom: 0;
  91. width: 100%;
  92. overflow: auto;
  93. "
  94. ></div>
  95. <el-form
  96. ref="orderRef"
  97. class="master-container"
  98. size="small"
  99. :model="form"
  100. :rules="rules"
  101. label-width="100px"
  102. >
  103. <el-row :gutter="30">
  104. <el-col :span="6">
  105. <el-form-item label="合同编号" prop="contractNo">
  106. <el-input
  107. v-if="editStatus && type !== 'alterOrder'"
  108. v-model="form.contractNo"
  109. placeholder="请输入合同编号"
  110. width="100px"
  111. />
  112. <span v-else>{{ form.contractNo }}</span>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="6">
  116. <el-form-item label="合同类型" prop="contractType">
  117. <el-radio-group
  118. v-if="editStatus || type == 'alterOrder'"
  119. v-model="form.contractType"
  120. @change="contractTypeChangeHandler"
  121. >
  122. <el-radio :label="0">新签</el-radio>
  123. <el-radio :label="1">续签</el-radio>
  124. </el-radio-group>
  125. <span v-else>{{
  126. form.contractType === 0 ? "新签" : "续签"
  127. }}</span>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="6">
  131. <el-form-item label="客户名称" prop="companyId">
  132. <template v-if="editStatus && type !== 'alterOrder'">
  133. <el-autocomplete
  134. :fetch-suggestions="querySearchCompanyAsync"
  135. :trigger-on-focus="true"
  136. v-model="form.companyName"
  137. placeholder="请输入客户名称"
  138. popper-class="my-autocomplete"
  139. clearable
  140. @clear="handleClearCompany"
  141. @select="handleSelectCompany"
  142. style="width: 100%"
  143. >
  144. <template #append>
  145. <el-button icon="Plus" @click="showAddCompanyDialog">
  146. </el-button>
  147. </template>
  148. <template #default="{ item }">
  149. <div
  150. style="
  151. display: flex;
  152. flex-direction: row;
  153. justify-content: space-between;
  154. "
  155. >
  156. <div class="name" style="font-size: 12px">
  157. {{ item.name }}
  158. </div>
  159. </div>
  160. </template>
  161. </el-autocomplete>
  162. <!-- <el-button @click="showAddCompanyDialog">
  163. <el-icon class="el-input__icon">
  164. <plus />
  165. </el-icon>
  166. </el-button> -->
  167. </template>
  168. <span v-else>{{ form.companyName }}</span>
  169. </el-form-item>
  170. </el-col>
  171. <el-col :span="6">
  172. <el-form-item label="签约日期" prop="formDate">
  173. <el-date-picker
  174. v-if="editStatus && type !== 'alterOrder'"
  175. clearable
  176. v-model="form.formDate"
  177. type="date"
  178. value-format="YYYY-MM-DD"
  179. placeholder="请选择签约日期"
  180. >
  181. </el-date-picker>
  182. <span v-else>{{ form.formDate }}</span>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="6">
  186. <el-form-item label="签单人" prop="signerName">
  187. <el-autocomplete
  188. v-if="editStatus && type !== 'alterOrder'"
  189. :fetch-suggestions="querySearchAsync"
  190. :trigger-on-focus="true"
  191. style="width: 100%"
  192. v-model="form.signerName"
  193. placeholder="请输入签单人"
  194. popper-class="my-autocomplete"
  195. @select="handleSelectEmployee"
  196. >
  197. <template #default="{ item }">
  198. <div
  199. style="
  200. display: flex;
  201. flex-direction: row;
  202. justify-content: space-between;
  203. "
  204. >
  205. <div class="name" style="font-size: 12px">
  206. {{ item.nickName }}
  207. </div>
  208. <span
  209. class="code"
  210. style="font-size: 10px; color: darkgrey"
  211. >{{ item.userName }}</span
  212. >
  213. </div>
  214. </template>
  215. </el-autocomplete>
  216. <span v-else>{{ form.signerName }}</span>
  217. </el-form-item>
  218. </el-col>
  219. <el-col v-if="form.verifyStatus === 4" :span="6">
  220. <el-form-item label="驳回原因" prop="verifyRemark">
  221. <span>{{ form.verifyRemark }}</span>
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="8" style="width: 100%">
  225. <el-form-item
  226. label="来源"
  227. prop="sourceCategoryName"
  228. style="width: 100%"
  229. >
  230. <CustomerFormCom
  231. ref="CustomerFormComRef"
  232. :edit-status="editStatus && type !== 'alterOrder'"
  233. :form-data="form"
  234. :source-categories="sourceCategories"
  235. />
  236. </el-form-item>
  237. </el-col>
  238. <el-col :span="4">
  239. <el-form-item label="客户标签" prop="customerLabelId">
  240. <span >{{ selectedOptionLabel }}</span>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="6">
  244. <el-form-item label="甲方" prop="boss">
  245. <el-input
  246. v-if="editStatus"
  247. v-model="form.boss"
  248. style="width: 100%; margin: 0; padding: 0"
  249. placeholder="请输入甲方"
  250. />
  251. <span v-else>{{ form.boss }}</span>
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="14">
  255. <el-form-item label="备注" prop="remark">
  256. <el-input
  257. v-if="editStatus"
  258. v-model="form.remark"
  259. show-word-limit
  260. maxlength="200"
  261. style="width: 100%; margin: 0; padding: 0"
  262. placeholder="请输入备注"
  263. type="textarea"
  264. :rows="2"
  265. />
  266. <span v-else>{{ form.remark }}</span>
  267. </el-form-item>
  268. </el-col>
  269. <br />
  270. <el-col :span="24">
  271. <el-tabs
  272. v-model="form.serviceType"
  273. size="small"
  274. class="demo-tabs"
  275. @tab-change="handleServiceTypeClick"
  276. >
  277. <el-tab-pane :disabled="!editStatus" label="循环服务" :name="1">
  278. <el-row>
  279. <el-col :span="24">
  280. <el-checkbox-group
  281. :disabled="!editStatus"
  282. v-model="loops"
  283. @change="(arg) => changeDetails('loop', arg)"
  284. >
  285. <el-checkbox
  286. v-for="(item, index) in loopTasks"
  287. :key="index"
  288. :label="item.id"
  289. >{{ item.name }}</el-checkbox
  290. >
  291. </el-checkbox-group>
  292. </el-col>
  293. <el-col :span="24">
  294. <el-row
  295. v-for="(item, index) in loopDetails"
  296. :key="index"
  297. style="
  298. border-radius: 5px;
  299. border-color: rgba(0, 0, 0, 20%);
  300. border-style: solid;
  301. border-width: 1px;
  302. margin-bottom: 10px;
  303. "
  304. >
  305. <el-col :span="4" style="padding-top: 18px">
  306. <el-form-item label="服务项目">
  307. {{ item.taskTypeName }}
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="4" style="padding-top: 18px">
  311. <el-form-item label="月单价">
  312. <el-input-number
  313. v-if="editStatus"
  314. v-model="item.price"
  315. :precision="2"
  316. :step="0.1"
  317. :min="0"
  318. :controls="false"
  319. @change="
  320. (arg) =>
  321. inputChangeHandler('loop', 'price', item, arg)
  322. "
  323. />
  324. <div v-else>{{ rowNum(item.price) }}</div>
  325. </el-form-item>
  326. </el-col>
  327. <el-col :span="4" style="padding-top: 18px">
  328. <el-form-item label="服务月数">
  329. <el-input-number
  330. v-if="editStatus"
  331. v-model="item.serviceNum"
  332. :step="1"
  333. step-strictly
  334. :min="0"
  335. :controls="false"
  336. @change="
  337. (arg) =>
  338. inputChangeHandler(
  339. 'loop',
  340. 'serviceNum',
  341. item,
  342. arg
  343. )
  344. "
  345. />
  346. <div v-else>{{ item.serviceNum }}</div>
  347. </el-form-item>
  348. </el-col>
  349. <el-col :span="4" style="padding-top: 18px">
  350. <el-form-item label="赠送月数">
  351. <el-input-number
  352. v-if="editStatus"
  353. v-model="item.freeNum"
  354. :step="1"
  355. step-strictly
  356. :min="0"
  357. :controls="false"
  358. @change="
  359. (arg) =>
  360. inputChangeHandler(
  361. 'loop',
  362. 'freeNum',
  363. item,
  364. arg
  365. )
  366. "
  367. />
  368. <div v-else>{{ item.freeNum }}</div>
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="4" style="padding-top: 18px">
  372. <el-form-item label="优惠金额">
  373. <el-input-number
  374. v-if="editStatus"
  375. v-model="item.discountAmount"
  376. :precision="2"
  377. :step="0.1"
  378. :min="0"
  379. :controls="false"
  380. @change="
  381. (arg) =>
  382. inputChangeHandler('loop', 'discountAmount', item, arg)
  383. "
  384. />
  385. <div v-else>{{ rowNum(item.discountAmount) }}</div>
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="4" style="padding-top: 18px">
  389. <el-form-item label="合计金额">
  390. <div>{{ rowNum(item.amount) }}</div>
  391. </el-form-item>
  392. </el-col>
  393. <el-col :span="4" style="padding-top: 18px" v-if="item.taskTypeId ==4">
  394. </el-col>
  395. <el-col :span="4" style="padding-top: 18px" v-if="item.taskTypeId ==4">
  396. <el-form-item label="所属区">
  397. <el-select
  398. v-if="editStatus"
  399. v-model="item.belongRegion"
  400. style="margin-right: 5px"
  401. >
  402. <el-option
  403. v-for="item in belong_region"
  404. :key="item.value"
  405. :label="item.label"
  406. :value="item.id"
  407. ></el-option>
  408. </el-select>
  409. <span v-else>{{item.regionName}}</span>
  410. </el-form-item>
  411. </el-col>
  412. </el-row>
  413. </el-col>
  414. <el-divider />
  415. </el-row>
  416. </el-tab-pane>
  417. <el-tab-pane
  418. :disabled="!editStatus "
  419. label="代办服务"
  420. :name="2"
  421. >
  422. <el-checkbox-group
  423. :disabled="!editStatus"
  424. v-model="onces"
  425. @change="(arg) => changeDetails('once', arg)"
  426. >
  427. <el-checkbox
  428. v-for="(item, index) in onceTasks"
  429. :key="index"
  430. :label="item.id"
  431. >{{ item.name }}</el-checkbox
  432. >
  433. </el-checkbox-group>
  434. <el-col :span="24">
  435. <el-row
  436. v-for="(item, index) in onceDetails"
  437. :key="index"
  438. style="
  439. border-radius: 5px;
  440. border-color: rgba(0, 0, 0, 20%);
  441. border-style: solid;
  442. border-width: 1px;
  443. margin-bottom: 10px;
  444. "
  445. >
  446. <el-col :span="4" style="padding-top: 18px">
  447. <el-form-item label="服务项目">
  448. {{ item.taskTypeName }}
  449. </el-form-item>
  450. </el-col>
  451. <el-col
  452. v-if="item.payAddress === 1"
  453. :span="9"
  454. style="
  455. padding-top: 18px;
  456. padding-left: 35px;
  457. display: flex;
  458. flex-direction: column;
  459. margin-bottom: 18px;
  460. "
  461. >
  462. <el-radio-group
  463. v-if="editStatus"
  464. v-model="item.addressStyle"
  465. @change="changeProcesses(item)"
  466. >
  467. <el-radio :label="1" style="margin-bottom: 5px">
  468. <template #default>
  469. <div
  470. style="
  471. display: flex;
  472. flex-direction: row;
  473. width: 300px;
  474. justify-content: space-between;
  475. "
  476. >
  477. <div
  478. style="
  479. display: inline-block;
  480. height: 24px;
  481. line-height: 24px;
  482. margin-right: 10px;
  483. "
  484. >
  485. 自有地址
  486. </div>
  487. <div>
  488. <el-select
  489. :disabled="item.addressStyle === 2"
  490. v-model="item.provinceCode"
  491. placeholder="省份"
  492. style="width: 36%"
  493. @change="handleSelectProvince(item, index)"
  494. >
  495. <el-option
  496. v-for="item in provincesArr[index]"
  497. :key="item.code"
  498. :label="item.name"
  499. :value="item.code"
  500. />
  501. </el-select>
  502. <el-select
  503. :disabled="item.addressStyle === 2"
  504. v-model="item.cityCode"
  505. placeholder="城市"
  506. style="width: 37%"
  507. @change="handleSelectCity(item, index)"
  508. >
  509. <el-option
  510. v-for="item in citiesArr[index]"
  511. :key="item.code"
  512. :label="item.name"
  513. :value="item.code"
  514. />
  515. </el-select>
  516. <el-select
  517. :disabled="item.addressStyle === 2"
  518. v-model="item.districtCode"
  519. placeholder="行政区"
  520. style="width: 37%"
  521. @change="handleSelectDistrict(item, index)"
  522. >
  523. <el-option
  524. v-for="item in districtsArr[index]"
  525. :key="item.code"
  526. :label="item.name"
  527. :value="item.code"
  528. />
  529. </el-select>
  530. </div>
  531. </div>
  532. </template>
  533. </el-radio>
  534. <el-radio :label="2" style="margin-bottom: 5px">
  535. <template #default>
  536. <div
  537. style="
  538. display: flex;
  539. flex-direction: row;
  540. width: 325px;
  541. justify-content: space-between;
  542. "
  543. >
  544. <div
  545. style="
  546. display: inline-block;
  547. height: 24px;
  548. line-height: 24px;
  549. margin-right: 10px;
  550. "
  551. >
  552. 虚拟地址
  553. </div>
  554. <el-select
  555. :disabled="item.addressStyle !== 2"
  556. v-model="item.fictionAddressId"
  557. style="margin-right: 5px"
  558. >
  559. <el-option
  560. v-for="item in virtual_address"
  561. :key="item.value"
  562. :label="item.label"
  563. :value="item.id"
  564. ></el-option>
  565. </el-select>
  566. <div
  567. style="
  568. display: inline-block;
  569. height: 24px;
  570. line-height: 24px;
  571. "
  572. >
  573. 金额:
  574. </div>
  575. <el-input-number
  576. :disabled="item.addressStyle !== 2"
  577. v-if="editStatus"
  578. v-model="item.addressAmount"
  579. :precision="2"
  580. :step="0.01"
  581. step-strictly
  582. :controls="false"
  583. @change="
  584. (arg) =>
  585. inputChangeHandler(
  586. 'once',
  587. 'addressAmount',
  588. item,
  589. arg
  590. )
  591. "
  592. />
  593. </div>
  594. </template>
  595. </el-radio>
  596. </el-radio-group>
  597. <div
  598. v-else
  599. style="
  600. display: flex;
  601. flex-direction: row;
  602. width: 300px;
  603. justify-content: space-between;
  604. font-size: 12px;
  605. "
  606. >
  607. <div>
  608. {{
  609. item.addressStyle === 1
  610. ? "自有地址"
  611. : item.addressStyle === 2
  612. ? "虚拟地址"
  613. : ""
  614. }}
  615. </div>
  616. <div v-if="item.addressStyle === 1">
  617. 注册地区:{{ item.province }} - {{ item.city }} -
  618. {{ item.district }}
  619. </div>
  620. <div v-if="item.addressStyle === 2">
  621. {{ (item.fictionAddress) }}
  622. </div>
  623. <div v-if="item.addressStyle === 2">
  624. 金额:{{ rowNum(item.addressAmount) }}
  625. </div>
  626. </div>
  627. </el-col>
  628. <el-col
  629. v-if="item.payAddress === 0"
  630. :span="9"
  631. style="
  632. padding-top: 18px;
  633. display: flex;
  634. flex-direction: column;
  635. margin-bottom: 18px;
  636. "
  637. >
  638. <el-form-item
  639. v-if="item.taskTypeId === '6'"
  640. label="变更类型"
  641. >
  642. <el-select
  643. v-if="editStatus"
  644. v-model="item.alterType"
  645. style="width: 280px"
  646. >
  647. <el-option
  648. v-for="alter in alterTypes"
  649. :label="alter.label"
  650. :key="alter.value"
  651. :value="alter.value"
  652. >
  653. </el-option>
  654. </el-select>
  655. <div v-else>{{ item.alterType }}</div>
  656. </el-form-item>
  657. <div
  658. v-if="item.alterType === '跨区变更'"
  659. style="margin-left: 60px"
  660. >
  661. <el-radio-group
  662. v-if="editStatus"
  663. v-model="item.addressStyle"
  664. @change="changeProcesses(item)"
  665. >
  666. <el-radio :label="1" style="margin-bottom: 5px">
  667. <template #default>
  668. <div
  669. style="
  670. display: flex;
  671. flex-direction: row;
  672. width: 300px;
  673. justify-content: space-between;
  674. "
  675. >
  676. <div
  677. style="
  678. display: inline-block;
  679. height: 24px;
  680. line-height: 24px;
  681. margin-right: 10px;
  682. "
  683. >
  684. 自有地址
  685. </div>
  686. <div>
  687. <el-select
  688. :disabled="item.addressStyle === 2"
  689. v-model="item.provinceCode"
  690. placeholder="省份"
  691. style="width: 33.33%"
  692. @change="
  693. handleSelectProvince(item, index)
  694. "
  695. >
  696. <el-option
  697. v-for="item in provincesArr[index]"
  698. :key="item.code"
  699. :label="item.name"
  700. :value="item.code"
  701. />
  702. </el-select>
  703. <el-select
  704. :disabled="item.addressStyle === 2"
  705. v-model="item.cityCode"
  706. placeholder="城市"
  707. style="width: 33.33%"
  708. @change="handleSelectCity(item, index)"
  709. >
  710. <el-option
  711. v-for="item in citiesArr[index]"
  712. :key="item.code"
  713. :label="item.name"
  714. :value="item.code"
  715. />
  716. </el-select>
  717. <el-select
  718. :disabled="item.addressStyle === 2"
  719. v-model="item.districtCode"
  720. placeholder="行政区"
  721. style="width: 33.33%"
  722. @change="
  723. handleSelectDistrict(item, index)
  724. "
  725. >
  726. <el-option
  727. v-for="item in districtsArr[index]"
  728. :key="item.code"
  729. :label="item.name"
  730. :value="item.code"
  731. />
  732. </el-select>
  733. </div>
  734. </div>
  735. </template>
  736. </el-radio>
  737. <el-radio :label="2" style="margin-bottom: 5px">
  738. <template #default>
  739. <div
  740. style="
  741. display: flex;
  742. flex-direction: row;
  743. width: 300px;
  744. justify-content: space-between;
  745. "
  746. >
  747. <div
  748. style="
  749. display: inline-block;
  750. height: 24px;
  751. line-height: 24px;
  752. margin-right: 10px;
  753. "
  754. >
  755. 虚拟地址
  756. </div>
  757. <el-select
  758. :disabled="item.addressStyle !== 2"
  759. v-model="item.fictionAddressId"
  760. style="margin-right: 5px"
  761. >
  762. <el-option
  763. v-for="item in virtual_address"
  764. :key="item.value"
  765. :label="item.label"
  766. :value="item.id"
  767. ></el-option>
  768. </el-select>
  769. <div
  770. style="
  771. display: inline-block;
  772. height: 24px;
  773. line-height: 24px;
  774. "
  775. >
  776. 金额:
  777. </div>
  778. <el-input-number
  779. :disabled="item.addressStyle !== 2"
  780. v-if="editStatus"
  781. v-model="item.addressAmount"
  782. :precision="2"
  783. :step="0.01"
  784. step-strictly
  785. :controls="false"
  786. @change="
  787. (arg) =>
  788. inputChangeHandler(
  789. 'once',
  790. 'addressAmount',
  791. item,
  792. arg
  793. )
  794. "
  795. />
  796. </div>
  797. </template>
  798. </el-radio>
  799. </el-radio-group>
  800. <div
  801. v-else
  802. style="
  803. display: flex;
  804. flex-direction: row;
  805. width: 300px;
  806. justify-content: space-between;
  807. font-size: 12px;
  808. "
  809. >
  810. <div>
  811. {{
  812. item.addressStyle === 1
  813. ? "自有地址"
  814. : item.addressStyle === 2
  815. ? "虚拟地址"
  816. : ""
  817. }}
  818. </div>
  819. <div v-if="item.addressStyle === 1">
  820. 注册地区:{{ item.province }} - {{ item.city }} -
  821. {{ item.district }}
  822. </div>
  823. <div v-if="item.addressStyle === 2">
  824. {{ item.fictionAddress }}
  825. </div>
  826. <div v-if="item.addressStyle === 2">
  827. 金额:{{ rowNum(item.addressAmount) }}
  828. </div>
  829. </div>
  830. </div>
  831. <el-form-item v-else label="办理地区">
  832. <div
  833. v-if="editStatus"
  834. style="
  835. display: flex;
  836. flex-direction: row;
  837. width: 280px;
  838. justify-content: space-between;
  839. "
  840. >
  841. <el-select
  842. v-model="item.provinceCode"
  843. placeholder="省份"
  844. style="width: 33.33%"
  845. @click.stop="null"
  846. @change="handleSelectProvince(item, index)"
  847. >
  848. <el-option
  849. v-for="item in provincesArr[index]"
  850. :key="item.code"
  851. :label="item.name"
  852. :value="item.code"
  853. />
  854. </el-select>
  855. <el-select
  856. v-model="item.cityCode"
  857. placeholder="城市"
  858. style="width: 33.33%"
  859. @change="handleSelectCity(item, index)"
  860. @click.stop="null"
  861. >
  862. <el-option
  863. v-for="item in citiesArr[index]"
  864. :key="item.code"
  865. :label="item.name"
  866. :value="item.code"
  867. />
  868. </el-select>
  869. <el-select
  870. v-model="item.districtCode"
  871. placeholder="行政区"
  872. style="width: 33.33%"
  873. @change="handleSelectDistrict(item, index)"
  874. @click.stop="null"
  875. >
  876. <el-option
  877. v-for="item in districtsArr[index]"
  878. :key="item.code"
  879. :label="item.name"
  880. :value="item.code"
  881. />
  882. </el-select>
  883. </div>
  884. <div
  885. v-else
  886. style="
  887. display: flex;
  888. flex-direction: row;
  889. width: 300px;
  890. justify-content: space-between;
  891. "
  892. >
  893. {{ item.province }} - {{ item.city }} -
  894. {{ item.district }}
  895. </div>
  896. </el-form-item>
  897. </el-col>
  898. <el-col
  899. :span="7"
  900. style="padding-top: 18px; margin-bottom: 18px"
  901. >
  902. <el-checkbox-group
  903. :disabled="!editStatus"
  904. v-model="item.processes"
  905. @change="(arg) => changeProcesses(item, arg)"
  906. style="display: flex; flex-direction: column"
  907. >
  908. <el-checkbox
  909. v-for="(process, index) in item.defaultProcesses"
  910. :key="index"
  911. :label="process"
  912. >
  913. <template #default>
  914. <div
  915. style="
  916. display: flex;
  917. flex-direction: row;
  918. width: 300px;
  919. justify-content: space-between;
  920. "
  921. >
  922. <div
  923. style="
  924. display: inline-block;
  925. height: 24px;
  926. line-height: 24px;
  927. margin-right: 10px;
  928. width: 80px;
  929. "
  930. >
  931. {{ process.taskTypeDetailName }}
  932. </div>
  933. <div
  934. style="
  935. display: inline-block;
  936. height: 24px;
  937. line-height: 24px;
  938. "
  939. >
  940. 金额:
  941. </div>
  942. <el-input-number
  943. :disabled="
  944. checkedProcess(
  945. process.taskTypeDetailId,
  946. item
  947. )
  948. "
  949. size="small"
  950. v-if="editStatus"
  951. v-model="process.amount"
  952. :precision="2"
  953. :step="0.01"
  954. step-strictly
  955. :controls="false"
  956. style="width: 100px"
  957. @click.stop="null"
  958. @change="
  959. (arg) =>
  960. inputChangeHandler(
  961. 'process',
  962. 'amount',
  963. process,
  964. arg,
  965. item
  966. )
  967. "
  968. />
  969. <div
  970. v-else
  971. style="
  972. display: inline-block;
  973. height: 24px;
  974. line-height: 24px;
  975. width: 40px;
  976. text-align: right;
  977. "
  978. >
  979. {{ rowNum(process.amount) }}
  980. </div>
  981. </div>
  982. </template>
  983. <!-- {{ process.name }} -->
  984. </el-checkbox>
  985. </el-checkbox-group>
  986. </el-col>
  987. <el-col
  988. :span="3"
  989. style="
  990. padding-top: 18px;
  991. display: flex;
  992. flex-direction: column;
  993. margin-bottom: 18px;
  994. "
  995. >
  996. <div
  997. style="
  998. display: flex;
  999. flex-direction: row;
  1000. font-size: 12px;
  1001. "
  1002. >
  1003. <div
  1004. style="
  1005. display: inline-block;
  1006. height: 24px;
  1007. line-height: 24px;
  1008. margin-left: 10px;
  1009. "
  1010. >
  1011. 总金额:
  1012. </div>
  1013. <div
  1014. style="
  1015. display: inline-block;
  1016. height: 24px;
  1017. line-height: 24px;
  1018. "
  1019. >
  1020. {{ rowNum(item.amount) }}
  1021. </div>
  1022. </div>
  1023. </el-col>
  1024. <el-col :span="4" style="padding-top: 18px">
  1025. </el-col>
  1026. <el-col
  1027. v-if="item.taskTypeId == 9 || item.taskTypeId == 8"
  1028. :span="9"
  1029. style="
  1030. padding-top: 18px;
  1031. display: flex;
  1032. flex-direction: column;
  1033. margin-bottom: 18px;
  1034. "
  1035. >
  1036. <el-form-item label="备注" prop="remark">
  1037. <el-input v-model = "item.remark" v-if="editStatus"/>
  1038. <div v-else>{{ item.remark }}</div>
  1039. </el-form-item>
  1040. </el-col>
  1041. </el-row>
  1042. </el-col>
  1043. <el-divider />
  1044. </el-tab-pane>
  1045. </el-tabs>
  1046. </el-col>
  1047. <el-col :span="6">
  1048. <el-form-item label="合计:" prop="remark">
  1049. <span>{{ rowNum(form.amount) }}</span>
  1050. </el-form-item>
  1051. </el-col>
  1052. <el-col :span="6">
  1053. <el-form-item label="优惠金额:">
  1054. <span>{{ rowNum(form.discountAmount) }}</span>
  1055. </el-form-item>
  1056. </el-col>
  1057. <el-col :span="6">
  1058. <el-form-item label="实收:">
  1059. <div>{{ rowNum(form.trueAmount) }}</div>
  1060. </el-form-item>
  1061. </el-col>
  1062. <br />
  1063. <el-col :span="24">
  1064. <div class="details-head" style="font-size: 12px">
  1065. <div class="title">
  1066. <i class="fa fa-th-list" aria-hidden="true" /> 合同附件
  1067. </div>
  1068. <div class="details-btns-container" style="display: flex">
  1069. <el-upload
  1070. v-if="editStatus && type != 'alterOrder'"
  1071. action="#"
  1072. :http-request="upload"
  1073. :with-credentials="true"
  1074. :show-file-list="false"
  1075. multiple
  1076. >
  1077. <el-button style="margin-top: 10px; margin-bottom:10px;" size="small" type="primary" icon="Upload"
  1078. >点击上传</el-button>
  1079. </el-upload>
  1080. </div>
  1081. </div>
  1082. <div class="details-body" style="height: 200px">
  1083. <el-table
  1084. ref="filesTable"
  1085. :data="form.files"
  1086. size="small"
  1087. height="100%"
  1088. border
  1089. header-row-class-name="list-header-row"
  1090. >
  1091. <el-table-column
  1092. type="index"
  1093. label="序号"
  1094. width="47"
  1095. align="center"
  1096. />
  1097. <el-table-column
  1098. label="文件名"
  1099. prop="originalFileName"
  1100. align="center"
  1101. >
  1102. <template #default="scope">
  1103. <el-link
  1104. :href="`${baseUrl}${scope.row.fileUrl}`"
  1105. :underline="false"
  1106. target="_blank"
  1107. type="primary"
  1108. >
  1109. {{ scope.row.originalFileName }}
  1110. </el-link>
  1111. </template>
  1112. </el-table-column>
  1113. <el-table-column
  1114. v-if="editStatus && type !== 'alterOrder'"
  1115. label="操作"
  1116. width="70"
  1117. align="center"
  1118. >
  1119. <template #default="scope">
  1120. <el-button
  1121. link
  1122. size="small"
  1123. type="danger"
  1124. @click="handleDelFile(scope.$index)"
  1125. >删除</el-button
  1126. >
  1127. </template>
  1128. </el-table-column>
  1129. </el-table>
  1130. </div>
  1131. <br />
  1132. </el-col>
  1133. <el-col
  1134. v-if="editStatus"
  1135. :span="24"
  1136. style="
  1137. text-align: center;
  1138. display: flex;
  1139. flex-direction: row;
  1140. justify-content: center;
  1141. "
  1142. >
  1143. <el-button
  1144. size="small"
  1145. type="primary"
  1146. icon="Finished"
  1147. style="width: 160px"
  1148. @click="submitForm"
  1149. >保存</el-button
  1150. >
  1151. </el-col>
  1152. </el-row>
  1153. <br />
  1154. </el-form>
  1155. </div>
  1156. </el-drawer>
  1157. <el-dialog
  1158. title="驳回详情"
  1159. v-model="rejectOpen"
  1160. width="500px"
  1161. append-to-body
  1162. draggable
  1163. :close-on-click-modal = "false"
  1164. >
  1165. <el-form ref="dictRef" :model="form" label-width="100">
  1166. <el-form-item label="驳回原因" :prop="verifyRemark">
  1167. <el-input
  1168. v-model.trim="form.verifyRemark"
  1169. type="textarea"
  1170. :rows="3"
  1171. placeholder="请输入驳回原因"
  1172. maxlength="200"
  1173. show-word-limit
  1174. />
  1175. </el-form-item>
  1176. </el-form>
  1177. <template #footer>
  1178. <div class="dialog-footer">
  1179. <el-button
  1180. type="primary"
  1181. icon="Finished"
  1182. size="small"
  1183. @click="verifyUpload(4)"
  1184. >确 定</el-button
  1185. >
  1186. <el-button icon="close" size="small" @click="rejectCancel"
  1187. >取 消</el-button
  1188. >
  1189. </div>
  1190. </template>
  1191. </el-dialog>
  1192. <el-dialog
  1193. title="是否续签"
  1194. v-model="verifyOpen"
  1195. width="600px"
  1196. append-to-body
  1197. draggable
  1198. >
  1199. <el-form ref="dictRef" :model="verifyForm" label-width="380" size="small">
  1200. <el-form-item
  1201. v-for="item in redirectDetails"
  1202. :key="item.id"
  1203. :label="`${item.taskTypeName}上个任务结束月:${item.endMonth}是否重新开始`"
  1204. >
  1205. <el-checkbox v-model="item.redirect" />
  1206. </el-form-item>
  1207. </el-form>
  1208. <template #footer>
  1209. <div class="dialog-footer">
  1210. <el-button
  1211. type="primary"
  1212. icon="Finished"
  1213. size="small"
  1214. @click="redirectVerify()"
  1215. >确 定</el-button
  1216. >
  1217. <el-button icon="close" size="small" @click="verifyFormClose"
  1218. >取 消</el-button
  1219. >
  1220. </div>
  1221. </template>
  1222. </el-dialog>
  1223. <AddCompanyDialog ref="addCompanyDialogRef" />
  1224. <dialog-history-choice
  1225. ref="historyChoiceRef"
  1226. @choice="historyChoiceHandle"
  1227. />
  1228. </div>
  1229. </template>
  1230. <script setup>
  1231. import { uploadFile } from "@/api/tool/file";
  1232. import { listLableNoPage } from "@/api/business/lable";
  1233. import AddCompanyDialog from "../AddCompanyDialog";
  1234. import match from "@/utils/match";
  1235. import {
  1236. getOrder,
  1237. initTaskTypes,
  1238. addOrder,
  1239. updateOrder,
  1240. verifyOrder,
  1241. alterOrder,
  1242. dissolutionOrder,
  1243. verifyCheckOrder,
  1244. } from "@/api/business/crm/contract";
  1245. import { listSource } from "@/api/settings/source";
  1246. import { listCompany } from "@/api/business/crm/company";
  1247. import { listUser } from "@/api/system/user";
  1248. import CustomerFormCom from "@/components/CustomerFormCom";
  1249. import DialogHistoryChoice from "@/views/dialog/DialogHistoryChoice.vue";
  1250. import { formatDate, rowNum } from "@/utils/index";
  1251. import { ref } from "vue";
  1252. import useUserStore from "@/store/modules/user";
  1253. // import { it } from "element-plus/es/locale";
  1254. const { proxy } = getCurrentInstance();
  1255. const verifyOpen = ref(false);
  1256. const verifyForm = ref({});
  1257. const redirectDetails = ref([]);
  1258. const baseUrl = import.meta.env.VITE_APP_BASE_API;
  1259. const historyChoiceRef = ref(null);
  1260. const alterTypes = ref([
  1261. {
  1262. value: "普通变更",
  1263. label: "普通变更",
  1264. },
  1265. {
  1266. value: "股权变更",
  1267. label: "股权变更",
  1268. },
  1269. {
  1270. value: "减资",
  1271. label: "减资",
  1272. },
  1273. {
  1274. value: "跨区变更",
  1275. label: "跨区变更",
  1276. },
  1277. ]);
  1278. /** 父组件传参 */
  1279. const props = defineProps({
  1280. getList: {
  1281. type: Function,
  1282. default: () => {},
  1283. },
  1284. });
  1285. const { getList } = toRefs(props);
  1286. /** 字典数组区 */
  1287. const { virtual_address } = proxy.useDict("virtual_address");
  1288. const { belong_region } = proxy.useDict("belong_region");
  1289. /** 表单抽屉 页变量 */
  1290. const title = ref("");
  1291. const loading = ref(false);
  1292. const multiple = ref(true);
  1293. const visible = ref(false);
  1294. const editStatus = ref(false);
  1295. const loopTasks = ref([]);
  1296. const onceTasks = ref([]);
  1297. const sourceCategories = ref([]);
  1298. const loops = ref([]);
  1299. const onces = ref([]);
  1300. const type = ref("");
  1301. const addCompanyDialogRef = ref(null);
  1302. const rejectOpen = ref(false);
  1303. // 循环任务明细
  1304. const loopDetails = ref([]);
  1305. // 单次任务明细
  1306. const onceDetails = ref([]);
  1307. const detailEmpty = {
  1308. id: null,
  1309. taskTypeName: "",
  1310. taskTypeId: null,
  1311. serviceNum: undefined,
  1312. freeNum: undefined,
  1313. price: undefined,
  1314. amount: undefined,
  1315. addressStyle: undefined,
  1316. address: undefined,
  1317. fictionAddressId: undefined,
  1318. tenantId: undefined,
  1319. province: "",
  1320. city: "",
  1321. district: "",
  1322. addressStyle: 1,
  1323. provinceId: undefined,
  1324. processes: [],
  1325. defaultProcesses: [],
  1326. };
  1327. //地址数组
  1328. const provincesArr = ref([]);
  1329. const citiesArr = ref([]);
  1330. const districtsArr = ref([]);
  1331. const provinces = ref(proxy.region.getProvinces());
  1332. provinces.value.unshift({ code: "", name: "全部" });
  1333. const cities = ref([]);
  1334. const districts = ref([]);
  1335. const options = ref([]);
  1336. const contractEmpty = {
  1337. serviceType: 1,
  1338. contractType: 0,
  1339. formDate: formatDate(new Date(), "yyyy-MM-dd"),
  1340. signerId: useUserStore().user.userId,
  1341. signerName: useUserStore().user.nickName,
  1342. files: [],
  1343. };
  1344. const isFullscreen = ref(false);
  1345. const webHost = import.meta.env.VITE_APP_BASE_API;
  1346. const data = reactive({
  1347. form: {},
  1348. rules: {
  1349. contractNo: [
  1350. { required: true, message: "合同编号不能为空", trigger: "blur" },
  1351. ],
  1352. companyId: [{ required: true, message: "请选择有效客户", trigger: "blur" }],
  1353. formDate: [
  1354. { required: true, message: "签约日期不能为空", trigger: "blur" },
  1355. ],
  1356. amount: [{ required: true, message: "签约金额不能为空", trigger: "blur" }],
  1357. // signerName: [
  1358. // { required: true, message: "签单人不能为空", trigger: "change" },
  1359. // ],
  1360. contractType: [
  1361. { required: true, message: "合同类型不能为空", trigger: "change" },
  1362. ],
  1363. serviceType: [
  1364. { required: true, message: "任务类型不能为空", trigger: "change" },
  1365. ],
  1366. // sourceCategoryName: [
  1367. // { validator: sourceValidator, trigger: "change" },
  1368. // { required: true, message: "客户来源不能为空", trigger: "change" },
  1369. // ],
  1370. },
  1371. });
  1372. const { form, rules } = toRefs(data);
  1373. /*********************** 方法区 ****************************/
  1374. /** 打开抽屉 */
  1375. function open(id) {
  1376. reset();
  1377. visible.value = true;
  1378. if (id) {
  1379. Promise.all([initTaskTypes(), listSource(), getOrder(id)]).then((res) => {
  1380. loopTasks.value = res[0].data.loopTasks;
  1381. onceTasks.value = res[0].data.onceTasks;
  1382. sourceCategories.value = res[1].rows;
  1383. form.value = res[2].data;
  1384. type.value =
  1385. type.value == "" && form.value.status === 8 ? "alterOrder" : type.value;
  1386. parseDetail(form.value.details, form.value);
  1387. // console.log(onceDetails.value)
  1388. editStatus.value = false;
  1389. title.value = "修改订单信息";
  1390. initRegion();
  1391. });
  1392. // getOrder(id).then(response => {
  1393. // })
  1394. } else {
  1395. Promise.all([initTaskTypes(), listSource()]).then((res) => {
  1396. loopTasks.value = res[0].data.loopTasks;
  1397. onceTasks.value = res[0].data.onceTasks;
  1398. sourceCategories.value = res[1].rows;
  1399. });
  1400. editStatus.value = true;
  1401. title.value = "添加订单信息";
  1402. }
  1403. getOption()
  1404. }
  1405. function getOption(){
  1406. listLableNoPage().then(res =>{
  1407. options.value = res.data
  1408. })
  1409. }
  1410. const selectedOptionLabel = computed(() => {
  1411. const selectedOption = options.value.find(option => option.id === form.value.customerLabelId);
  1412. return selectedOption ? selectedOption.lable : '';
  1413. });
  1414. function openSimple(id, optionType) {
  1415. reset();
  1416. visible.value = true;
  1417. type.value = optionType || "";
  1418. if (id) {
  1419. Promise.all([initTaskTypes(), listSource(), getOrder(id)]).then((res) => {
  1420. loopTasks.value = res[0].data.loopTasks;
  1421. onceTasks.value = res[0].data.onceTasks;
  1422. sourceCategories.value = res[1].rows;
  1423. form.value = res[2].data;
  1424. parseDetail(form.value.details, form.value);
  1425. title.value = "合同变更信息";
  1426. if (type.value != "") {
  1427. editStatus.value = true;
  1428. } else {
  1429. editStatus.value = false;
  1430. }
  1431. });
  1432. } else {
  1433. Promise.all([initTaskTypes(), listSource()]).then((res) => {
  1434. loopTasks.value = res[0].data.loopTasks;
  1435. onceTasks.value = res[0].data.onceTasks;
  1436. sourceCategories.value = res[1].rows;
  1437. });
  1438. editStatus.value = true;
  1439. title.value = "添加订单信息";
  1440. }
  1441. }
  1442. /** 取消按钮 */
  1443. function cancel() {
  1444. visible.value = false;
  1445. reset();
  1446. }
  1447. /** 表单重置 */
  1448. function reset() {
  1449. form.value = JSON.parse(JSON.stringify(contractEmpty));
  1450. loops.value = [];
  1451. onces.value = [];
  1452. loopDetails.value = [];
  1453. onceDetails.value = [];
  1454. type.value = "";
  1455. // console.log(form)
  1456. proxy.resetForm("orderRef");
  1457. }
  1458. /** 全屏缩放 */
  1459. function handleScreen() {
  1460. const dom = document.querySelector(
  1461. ".list-container > .el-drawer__wrapper > .el-overlay"
  1462. );
  1463. isFullscreen.value = !isFullscreen.value;
  1464. dom.style.position = isFullscreen.value ? "fixed" : "absolute";
  1465. }
  1466. function sourceValidator(rule, value, callback) {
  1467. if (form.value.sourceCategoryName === "") {
  1468. callback(new Error("来源类型不能为空"));
  1469. return;
  1470. }
  1471. if (
  1472. form.value.referrerDataSource !== "" &&
  1473. form.value.referrerDataSource != null &&
  1474. form.value.sourceName === ""
  1475. ) {
  1476. callback(new Error("来源不能为空"));
  1477. return;
  1478. }
  1479. return callback();
  1480. }
  1481. /** 提交按钮 */
  1482. function submitForm() {
  1483. const query = { userId: form.value.signerId };
  1484. const users = [];
  1485. listUser(query).then((res) => {
  1486. users.value = res.rows;
  1487. console.log(form.value.signerId);
  1488. // if (users.value.length == 1) {
  1489. // if (
  1490. // form.value.signerId == users.value[0].userId &&
  1491. // form.value.signerName == users.value[0].nickName
  1492. // ) {
  1493. // } else {
  1494. // proxy.$modal.msgError("请选择有效签单人");
  1495. // return;
  1496. // }
  1497. // } else {
  1498. // proxy.$modal.msgError("请选择有效签单人");
  1499. // return;
  1500. // }
  1501. const companyQuery = { id: form.value.companyId };
  1502. const companys = [];
  1503. listCompany(companyQuery).then((res) => {
  1504. companys.value = res.rows;
  1505. if (companys.value.length == 1) {
  1506. if (
  1507. form.value.companyId == companys.value[0].id &&
  1508. form.value.companyName == companys.value[0].name
  1509. ) {
  1510. } else {
  1511. proxy.$modal.msgError("请选择有效客户");
  1512. return;
  1513. }
  1514. } else {
  1515. proxy.$modal.msgError("请选择有效客户");
  1516. return;
  1517. }
  1518. proxy.$refs["orderRef"].validate((valid) => {
  1519. if (valid && detailValid() && amountValid()) {
  1520. const formValue = form.value;
  1521. formValue.details =
  1522. form.value.serviceType === 1
  1523. ? loopDetails.value
  1524. : onceDetails.value;
  1525. if (formValue.id != null) {
  1526. if (formValue.companyId !== null) {
  1527. if (type.value == "") {
  1528. updateOrder(formValue).then((response) => {
  1529. proxy.$modal.msgSuccess("修改成功");
  1530. visible.value = false;
  1531. getList.value();
  1532. });
  1533. } else if (type.value == "alterOrder") {
  1534. alterOrder(formValue).then((response) => {
  1535. proxy.$modal.msgSuccess("修改成功");
  1536. visible.value = false;
  1537. getList.value();
  1538. });
  1539. } else if (type.value == "dissolutionOrder") {
  1540. dissolutionOrder(formValue).then((response) => {
  1541. proxy.$modal.msgSuccess("修改成功");
  1542. visible.value = false;
  1543. getList.value();
  1544. });
  1545. } else {
  1546. proxy.$modal.msgError("请选择有效客户");
  1547. }
  1548. }
  1549. } else {
  1550. addOrder(formValue).then((response) => {
  1551. proxy.$modal.msgSuccess("新增成功");
  1552. visible.value = false;
  1553. getList.value();
  1554. });
  1555. }
  1556. }
  1557. });
  1558. });
  1559. });
  1560. }
  1561. function detailValid() {
  1562. if (form.value.serviceType === 1) {
  1563. // 循环服务
  1564. if (loopDetails.value.length === 0) {
  1565. proxy.$modal.msgError("请选择至少一条任务");
  1566. return false;
  1567. }
  1568. // loopDetails.forEach((item, index) => {
  1569. for (let i = 0; i < loopDetails.value.length; i++) {
  1570. let item = loopDetails.value[i];
  1571. if (
  1572. (item.freeNum ? Number(item.freeNum) : 0) +
  1573. (item.serviceNum ? Number(item.serviceNum) : 0) <=
  1574. 0
  1575. ) {
  1576. proxy.$modal.msgError(`${item.taskTypeName}服务月数不能为0`);
  1577. return false;
  1578. }
  1579. if (item.price == null || item.price === "") {
  1580. proxy.$modal.msgError(`${item.taskTypeName}请填写服务单价`);
  1581. return false;
  1582. }
  1583. }
  1584. } else if (form.value.serviceType === 2) {
  1585. // 代账服务
  1586. if (onceDetails.value.length === 0) {
  1587. proxy.$modal.msgError("请选择至少一条任务");
  1588. return false;
  1589. }
  1590. for (let i = 0; i < onceDetails.value.length; i++) {
  1591. let item = onceDetails.value[i];
  1592. if (item.payAddress === 1) {
  1593. if (item.addressStyle == null) {
  1594. proxy.$modal.msgError("请选择注册地址类型");
  1595. return false;
  1596. }
  1597. if (
  1598. item.addressStyle === 1 &&
  1599. (item.province == null || item.city == null || item.district == null)
  1600. ) {
  1601. proxy.$modal.msgError("请选择注册区域");
  1602. return false;
  1603. }
  1604. console.log(item);
  1605. if (item.addressStyle === 2 && item.fictionAddressId == null) {
  1606. proxy.$modal.msgError("请选择虚拟地址");
  1607. return false;
  1608. }
  1609. if (item.addressStyle === 2 && item.addressAmount == undefined) {
  1610. proxy.$modal.msgError("请填写虚拟地址金额");
  1611. return false;
  1612. }
  1613. }
  1614. if (
  1615. item.payAddress === 0 &&
  1616. (item.province == null || item.city == null || item.district == null)
  1617. ) {
  1618. proxy.$modal.msgError("请选择办理地区");
  1619. return false;
  1620. }
  1621. for (let j = 0; j < item.processes.length; j++) {
  1622. let process = item.processes[j];
  1623. if (process.amount == undefined) {
  1624. proxy.$modal.msgError(`${process.taskTypeDetailName}请填写金额`);
  1625. return false;
  1626. }
  1627. }
  1628. }
  1629. }
  1630. return true;
  1631. }
  1632. function amountValid() {
  1633. if (form.value.trueAmount < 0) {
  1634. proxy.$modal.msgError("实收金额不可小于0");
  1635. return false;
  1636. }
  1637. return true;
  1638. }
  1639. /** 查询表单信息 */
  1640. function getForm() {
  1641. proxy.$refs.orderRef.resetFields();
  1642. loading.value = true;
  1643. getOrder(form.value.id).then((response) => {
  1644. loading.value = false;
  1645. form.value = response.data;
  1646. type.value =
  1647. type.value == "" && form.value.status === 8 ? "alterOrder" : type.value;
  1648. });
  1649. }
  1650. function handleServiceTypeClick(tab) {
  1651. computedService();
  1652. }
  1653. function changeDetails(type, arg) {
  1654. switch (type) {
  1655. case "loop":
  1656. arg.forEach((e) => {
  1657. const taskType = loopTasks.value.find((v) => v.id == e);
  1658. if (loopDetails.value.findIndex((v) => v.taskTypeId == e) < 0) {
  1659. const newDetail = JSON.parse(JSON.stringify(detailEmpty));
  1660. newDetail.taskTypeId = e;
  1661. newDetail.taskTypeName = taskType.name;
  1662. loopDetails.value.push(newDetail);
  1663. }
  1664. });
  1665. loopDetails.value = loopDetails.value.filter(
  1666. (v) => arg.findIndex((e) => e == v.taskTypeId) > -1
  1667. );
  1668. break;
  1669. case "once":
  1670. arg.forEach((e) => {
  1671. const taskType = onceTasks.value.find((v) => v.id == e);
  1672. if (onceDetails.value.findIndex((v) => v.taskTypeId == e) < 0) {
  1673. const newDetail = JSON.parse(JSON.stringify(detailEmpty));
  1674. newDetail.taskTypeId = e;
  1675. newDetail.taskTypeName = taskType.name;
  1676. newDetail.payAddress = taskType.payAddress;
  1677. (newDetail.alterType = e === "6" ? "普通变更" : ""),
  1678. (newDetail.defaultProcesses = taskType.processes.map((v) => ({
  1679. taskTypeId: e,
  1680. taskTypeDetailId: v.id,
  1681. taskTypeDetailName: v.name,
  1682. fictionAddressId: null,
  1683. fictionAddress: "",
  1684. addressStyle: 0,
  1685. checked: false,
  1686. amount: undefined,
  1687. })));
  1688. newDetail.processes = [];
  1689. onceDetails.value.push(newDetail);
  1690. }
  1691. });
  1692. onceDetails.value = onceDetails.value.filter(
  1693. (v) => arg.findIndex((e) => e == v.taskTypeId) > -1
  1694. );
  1695. let provincesLength = provincesArr.value.length;
  1696. if (onceDetails.value.length > provincesLength) {
  1697. for (let i = 0; i < onceDetails.value.length - provincesLength; i++) {
  1698. provincesArr.value.push(provinces.value);
  1699. citiesArr.value.push(cities.value);
  1700. districtsArr.value.push(districts.value);
  1701. }
  1702. } else if (onceDetails.value.length < provincesLength) {
  1703. for (let i = 0; i < provincesLength - onceDetails.value.length; i++) {
  1704. provincesArr.value.length--;
  1705. citiesArr.value.length--;
  1706. districtsArr.value.length--;
  1707. }
  1708. }
  1709. break;
  1710. default:
  1711. break;
  1712. }
  1713. }
  1714. function inputChangeHandler(type, field, item, value, parent) {
  1715. console.log(111,type, field, item, value, parent);
  1716. let amount = 0;
  1717. switch (type) {
  1718. case "loop":
  1719. switch (field) {
  1720. case "price":
  1721. amount =
  1722. (item.serviceNum ? Number(item.serviceNum) : 0) *
  1723. (value ? Number(value) : 0) -(item.discountAmount?Number(item.discountAmount):0);
  1724. item.amount = amount;
  1725. break;
  1726. case "serviceNum":
  1727. amount =
  1728. (item.price ? Number(item.price) : 0) * (value ? Number(value) : 0) -(item.discountAmount?Number(item.discountAmount):0);
  1729. item.amount = amount;
  1730. break;
  1731. case "freeNum":
  1732. amount =
  1733. (item.price ? Number(item.price) : 0) *
  1734. (item.serviceNum ? Number(item.serviceNum) : 0) -(item.discountAmount?Number(item.discountAmount):0);
  1735. item.amount = amount;
  1736. break;
  1737. case "discountAmount":
  1738. amount =
  1739. (item.price ? Number(item.price) : 0) *
  1740. (item.serviceNum ? Number(item.serviceNum) : 0) -(value ? Number(value) : 0);
  1741. item.amount = amount;
  1742. }
  1743. break;
  1744. case "once":
  1745. computedItem(item);
  1746. break;
  1747. case "process":
  1748. computedItem(parent);
  1749. break;
  1750. default:
  1751. break;
  1752. }
  1753. computedService();
  1754. }
  1755. function computedItem(parent) {
  1756. let amount = 0;
  1757. amount +=
  1758. parent.payAddress === 1 && parent.addressStyle === 2 && parent.addressAmount
  1759. ? Number(parent.addressAmount)
  1760. : 0;
  1761. amount +=
  1762. parent.taskTypeId === "6" &&
  1763. parent.alterType === "跨区变更" &&
  1764. parent.addressStyle === 2 &&
  1765. parent.addressAmount
  1766. ? Number(parent.addressAmount)
  1767. : 0;
  1768. parent.processes.forEach((l) => {
  1769. amount += l.amount ? Number(l.amount) : 0;
  1770. });
  1771. parent.amount = amount;
  1772. }
  1773. function computedService() {
  1774. //子表中的实际金额
  1775. let amount = 0;
  1776. let discountAmount = 0;
  1777. let trueAmount = 0;
  1778. switch (form.value.serviceType) {
  1779. case 1:
  1780. loopDetails.value.forEach((l) => {
  1781. amount += l.amount;
  1782. discountAmount += l.discountAmount;
  1783. trueAmount += l.trueAmount;
  1784. });
  1785. amount = amount >= 0 ? amount : 0;
  1786. discountAmount = discountAmount >= 0 ? discountAmount : 0;
  1787. break;
  1788. case 2:
  1789. onceDetails.value.forEach((l) => {
  1790. amount +=
  1791. l.payAddress === 1 && l.addressStyle === 2 && l.addressAmount
  1792. ? Number(l.addressAmount)
  1793. : 0;
  1794. l.processes.forEach((v) => {
  1795. amount += v.amount ? Number(v.amount) : 0;
  1796. });
  1797. });
  1798. break;
  1799. }
  1800. form.value.discountAmount = discountAmount;
  1801. form.value.trueAmount =amount
  1802. form.value.amount = match.add(amount,discountAmount);
  1803. }
  1804. /** 输入框输出建议 */
  1805. function querySearchAsync(queryString, cb) {
  1806. const query = { keyword: queryString };
  1807. listUser(query).then((res) => {
  1808. cb(res.rows);
  1809. });
  1810. }
  1811. function querySearchCompanyAsync(queryString, cb) {
  1812. const query =
  1813. queryString.length > 0
  1814. ? {
  1815. keyword: queryString,
  1816. pageSize: 50,
  1817. pageNum: 1,
  1818. orderByColumn: "create_time",
  1819. }
  1820. : { pageSize: 50, pageNum: 1, orderByColumn: "create_time" };
  1821. listCompany(query).then((res) => {
  1822. cb(res.rows);
  1823. });
  1824. }
  1825. function handleSelectEmployee(item) {
  1826. form.value.signerName = item.nickName;
  1827. form.value.signerId = item.userId;
  1828. }
  1829. function handleSelectCompany(item) {
  1830. form.value.companyName = item.name;
  1831. form.value.companyId = item.id;
  1832. form.value.customerLabelId = item.customerLabelId
  1833. }
  1834. function handleClearCompany(){
  1835. form.value.customerLabelId = "";
  1836. }
  1837. function handleSelectProvince(item, index) {
  1838. const _provinceCode = item.provinceCode;
  1839. const _province = provincesArr.value[index].find((i) => {
  1840. return i.code === _provinceCode;
  1841. });
  1842. item.province = _province.name;
  1843. citiesArr.value[index] = proxy.region.getCities(_provinceCode);
  1844. if (citiesArr.value[index].length === 0) {
  1845. // 清空城市数据
  1846. item.cityCode = "";
  1847. item.city = "";
  1848. cities.value = [{ code: "", name: "全部" }];
  1849. // 清空行政区数据
  1850. item.districtCode = "";
  1851. item.district = "";
  1852. districts.value = [{ code: "", name: "全部" }];
  1853. } else {
  1854. citiesArr.value[index].unshift({ code: "", name: "全部" });
  1855. item.cityCode = citiesArr.value[index][0].code;
  1856. item.city = citiesArr.value[index][0].name;
  1857. handleSelectCity(item, index);
  1858. }
  1859. }
  1860. function handleSelectCity(item, index) {
  1861. const _cityCode = item.cityCode;
  1862. const _city = citiesArr.value[index].find((i) => {
  1863. return i.code === _cityCode;
  1864. });
  1865. item.city = _city.name;
  1866. districtsArr.value[index] = proxy.region.getDistricts(_cityCode);
  1867. if (districtsArr.value[index].length === 0) {
  1868. // 清空行政区数据
  1869. item.districtCode = "";
  1870. item.district = "";
  1871. districtsArr.value[index] = [{ code: "", name: "全部" }];
  1872. } else {
  1873. districtsArr.value[index].unshift({ code: "", name: "全部" });
  1874. item.districtCode = districtsArr.value[index][0].code;
  1875. item.district = districtsArr.value[index][0].name;
  1876. }
  1877. }
  1878. function handleSelectDistrict(item, index) {
  1879. const _districtCode = item.districtCode;
  1880. const _district = districtsArr.value[index].find((i) => {
  1881. return i.code === _districtCode;
  1882. });
  1883. item.district = _district.name;
  1884. }
  1885. function getProcess(item) {
  1886. const typeItem = onceTasks.value.find((i) => i.id === item.taskTypeId);
  1887. return typeItem.processes;
  1888. }
  1889. function checkedProcess(processId, item) {
  1890. const processes = item.processes;
  1891. return processes.findIndex((v) => v.taskTypeDetailId == processId) < 0;
  1892. }
  1893. function changeProcesses(item) {
  1894. computedItem(item);
  1895. computedService();
  1896. }
  1897. function parseDetail(details, form) {
  1898. loops.value = [];
  1899. onces.value = [];
  1900. loopDetails.value = [];
  1901. onceDetails.value = [];
  1902. switch (form.serviceType) {
  1903. case 1:
  1904. // 循环任务
  1905. details.forEach((i) => {
  1906. loops.value.push(i.taskTypeId);
  1907. loopDetails.value.push(i);
  1908. });
  1909. break;
  1910. case 2:
  1911. // 代办任务
  1912. details.forEach((i) => {
  1913. onces.value.push(i.taskTypeId);
  1914. const taskType = onceTasks.value.find((j) => j.id === i.taskTypeId);
  1915. onceDetails.value.push({
  1916. ...i,
  1917. defaultProcesses: parseProcess(i, taskType.processes),
  1918. });
  1919. onceDetails.value.forEach((j) => {
  1920. j.processes = j.defaultProcesses.filter((v) => v.checked);
  1921. });
  1922. });
  1923. break;
  1924. default:
  1925. break;
  1926. }
  1927. }
  1928. function parseProcess(item, processes) {
  1929. return processes.map((l) => {
  1930. // console.log(item.processes.find((i) => i.taskTypeDetailId === l.id));
  1931. if (item.processes.findIndex((i) => i.taskTypeDetailId === l.id) < 0) {
  1932. return {
  1933. taskTypeId: item.taskTypeId,
  1934. taskTypeDetailId: l.id,
  1935. taskTypeDetailName: l.name,
  1936. checked: false,
  1937. amount: undefined,
  1938. };
  1939. } else {
  1940. return {
  1941. ...item.processes.find((i) => i.taskTypeDetailId === l.id),
  1942. checked: true,
  1943. };
  1944. }
  1945. });
  1946. }
  1947. function verifyHandler() {
  1948. proxy.$modal
  1949. .confirm("是否确认审核?")
  1950. .then((_) => {
  1951. verifyCheckOrder(form.value).then((res) => {
  1952. if (res.data == null) {
  1953. verifyUpload(1);
  1954. } else {
  1955. verifyOpen.value = true;
  1956. redirectDetails.value = res.data;
  1957. }
  1958. });
  1959. })
  1960. .catch((_) => {
  1961. proxy.$modal.msg("取消审核");
  1962. });
  1963. }
  1964. function verifyFormClose() {
  1965. redirectDetails.value = [];
  1966. verifyForm.value = {};
  1967. verifyOpen.value = false;
  1968. }
  1969. function redirectVerify() {
  1970. redirectDetails.value.forEach((l) => {
  1971. const index = form.value.details.findIndex((v) => v.id === l.id);
  1972. form.value.details[index].redirect = l.redirect;
  1973. });
  1974. verifyUpload(1);
  1975. verifyFormClose();
  1976. }
  1977. function rejectHandler() {
  1978. rejectOpen.value = true;
  1979. }
  1980. function rejectCancel() {
  1981. rejectOpen.value = false;
  1982. }
  1983. function rejectSubmitHandler() {
  1984. if (form.value.verifyRemark === "" || form.value.verifyRemark == null) {
  1985. proxy.$modal.msgError("请填写驳回原因");
  1986. return;
  1987. }
  1988. }
  1989. function verifyUpload(status) {
  1990. const formValue = proxy.deepClone(form.value);
  1991. formValue.verifyStatus = status;
  1992. formValue.status = status;
  1993. verifyOrder(formValue).then((res) => {
  1994. getForm();
  1995. getList.value();
  1996. rejectCancel();
  1997. proxy.$modal.msgSuccess("保存成功");
  1998. });
  1999. }
  2000. /** 文件上传 */
  2001. function upload(param) {
  2002. const formData = new FormData();
  2003. formData.append("file", param.file);
  2004. uploadFile(formData).then((res) => {
  2005. if (res.code === 200) {
  2006. const file = {};
  2007. file.fileName = res.newFileName;
  2008. file.url = res.url;
  2009. file.originalFileName = res.originalFilename;
  2010. file.fileUrl = res.fileName;
  2011. form.value.files.push(file);
  2012. }
  2013. });
  2014. }
  2015. function handleDelFile(index) {
  2016. form.value.files.splice(index, 1);
  2017. }
  2018. function initRegion() {
  2019. console.log("initRegion开始", form.value);
  2020. for (let i = 0; i < form.value.details.length; i++) {
  2021. cities.value = proxy.region.getCities(form.value.details[i].provinceCode);
  2022. cities.value.unshift({ code: "", name: "全部" });
  2023. districts.value = proxy.region.getDistricts(form.value.details[i].cityCode);
  2024. districts.value.unshift({ code: "", name: "全部" });
  2025. console.log("市", cities.value);
  2026. provincesArr.value.push(provinces.value);
  2027. citiesArr.value.push(cities.value);
  2028. districtsArr.value.push(districts.value);
  2029. }
  2030. }
  2031. function showAddCompanyDialog() {
  2032. addCompanyDialogRef.value.open();
  2033. }
  2034. function contractTypeChangeHandler() {
  2035. if (form.value.contractType === 1) {
  2036. form.value.serviceType = 1;
  2037. }
  2038. }
  2039. function showHistoryList() {
  2040. historyChoiceRef.value.open(
  2041. form.value.fromId === "0" ? form.value.id : form.value.fromId
  2042. );
  2043. }
  2044. function historyChoiceHandle(row) {
  2045. open(row.id);
  2046. }
  2047. /** 暴露给父组件的方法 */
  2048. defineExpose({
  2049. open,
  2050. openSimple,
  2051. });
  2052. </script>
  2053. <style scoped>
  2054. .my-autocomplete .el-input-group__append {
  2055. padding: 0 10px !important;
  2056. }
  2057. </style>