OpCustomers.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. <template>
  2. <div class="car_add">
  3. <div class="communal-title">
  4. <div>{{ title }}</div>
  5. <!-- 客户名单 -->
  6. <el-popover placement="bottom" width="662" trigger="hover">
  7. <el-table max-height="600" border :data="rollcallarr">
  8. <el-table-column width="100" property="date" label="姓名">
  9. <template slot-scope="scope">
  10. {{ scope.row.lastName }}{{ scope.row.firstName }}
  11. </template>
  12. </el-table-column>
  13. <el-table-column width="200" property="lastName" label="拼音">
  14. <template slot-scope="scope">
  15. {{ pinyingxing(scope.row.lastName) }}/{{ pinyingxing(scope.row.firstName) }}
  16. </template>
  17. </el-table-column>
  18. <el-table-column width="50" property="sex" label="性别">
  19. <template slot-scope="scope">
  20. {{ scope.row.sex == 0 ? '男' : '女' }}
  21. </template>
  22. </el-table-column>
  23. <el-table-column width="110" property="birthDay" label="生日">
  24. <template slot-scope="scope">
  25. {{ fgarr(scope.row.birthDay) }}
  26. </template>
  27. </el-table-column>
  28. <el-table-column width="200" property="idCardNo" label="身份证号码">
  29. <template slot-scope="scope">
  30. {{ scope.row.idCardNo }}
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. <el-button style="margin-left: 10px;" type="primary" slot="reference">移上查看客户名单</el-button>
  35. <!-- <span slot="reference" style="cursor: pointer;margin-left: 20px;">"移上查看客户名单"</span> -->
  36. </el-popover>
  37. </div>
  38. <hr style='background-color:#5555; height:1px; border:none;margin: 10px 0;' />
  39. <div class="opcustomers-box">
  40. <el-form :model="delegationInfo" label-width="100px" class="demo-ruleForm">
  41. <div style="display: flex;flex-wrap: wrap;">
  42. <div style="width: 390px;">
  43. <el-form-item label="团组名称:" label-width="160px">
  44. <el-select v-model="OpCustomersData.diId" clearable filterable placeholder="团组选择"
  45. :disabled="isShow" @change="DiIdSelectChange">
  46. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  47. :value="item.id">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. </div>
  52. <div style="width: 390px;">
  53. <el-form-item label="团 号:" prop="tourCode" label-width="160px">
  54. <el-input placeholder="团号" v-model="delegationInfo.tourCode" :disabled="true">
  55. </el-input>
  56. </el-form-item>
  57. </div>
  58. <div style="width: 390px;">
  59. <el-form-item label="客户:" prop="clientName" label-width="160px">
  60. <el-input placeholder="客户" v-model="delegationInfo.clientName" :disabled="true">
  61. </el-input>
  62. </el-form-item>
  63. </div>
  64. <div style="width: 390px;">
  65. <el-form-item label="出访国家:" prop="visitCountry" label-width="160px">
  66. <el-input placeholder="出访国家" v-model="delegationInfo.visitCountry" :disabled="true">
  67. </el-input>
  68. </el-form-item>
  69. </div>
  70. </div>
  71. <div style="display: flex;flex-wrap: wrap;">
  72. <div style="width: 390px;">
  73. <el-form-item label="出访时间:" label-width="160px">
  74. <el-input placeholder="出访时间" v-model="VisitDate" :disabled="true">
  75. </el-input>
  76. </el-form-item>
  77. </div>
  78. <div style="width: 390px;">
  79. <el-form-item label="出访人数:" label-width="160px">
  80. <el-input placeholder="出访人数" v-model="delegationInfo.visitPNumber" :disabled="true">
  81. </el-input>
  82. </el-form-item>
  83. </div>
  84. <div style="width: 390px;">
  85. <el-form-item label="出访天数:" label-width="160px">
  86. <el-input placeholder="出访天数" v-model="delegationInfo.visitDays" :disabled="true">
  87. </el-input>
  88. </el-form-item>
  89. </div>
  90. </div>
  91. </el-form>
  92. <el-form :model="OpCustomersData" ref="OpCustomersData" :rules="OpCustomersDataRules" label-width="100px"
  93. class="demo-ruleForm">
  94. <div style="display: flex;flex-wrap: wrap;">
  95. <div style="width: 390px;">
  96. <el-form-item label="保险种类:" prop="iid" label-width="160px">
  97. <el-select v-model="OpCustomersData.iid" filterable placeholder="保险种类" @change="iidChane">
  98. <el-option v-for="item in insuranceCostList" :key="item.id" :label="item.gName"
  99. :value="item.id">
  100. </el-option>
  101. </el-select>
  102. </el-form-item>
  103. </div>
  104. <!-- <div style="width: 25%;">
  105. <el-form-item label="保险余额:" label-width="160px">
  106. <el-input placeholder="保险余额" v-model="Balance" :disabled="true">
  107. </el-input>
  108. </el-form-item>
  109. </div> -->
  110. <div style="width: 390px;">
  111. <el-form-item label="保险费用:" prop="insuranceCosts" label-width="160px">
  112. <el-input placeholder="保险费用" v-model="OpCustomersData.insuranceCosts" style="width: 48%;">
  113. </el-input>
  114. <el-select v-model="OpCustomersData.currency" filterable placeholder="币种"
  115. style="width: 48%;">
  116. <el-option v-for="item in currencyList" :key="item.currencyId"
  117. :label="item.currencyCode" :value="item.currencyId">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. </div>
  122. </div>
  123. <div style="width: 100%;">
  124. <el-form-item label="客户名称:" prop="clientName" label-width="160px">
  125. <el-select v-model="OpCustomersData.clientName" placeholder="客户名称" multiple clearable
  126. filterable>
  127. <el-option v-for="item in fliterClient" :key="item.id" :label="item.name" :value="item.id">
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. </div>
  132. <!-- <div style="display: flex;">
  133. <div style="width: 25%;">
  134. <el-form-item label="附件" prop="attachment" label-width="160px">
  135. <el-upload :file-list="uploadFiles" ref="upload" :on-success="upLoadSuccess"
  136. style="width: 200px;" :before-remove="beforeRemove" :limit="1" :on-exceed="exceed"
  137. :action="uploadURL" :headers="headers" :auto-upload="false" :on-change="onChange">
  138. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  139. </el-upload>
  140. </el-form-item>
  141. </div>
  142. </div> -->
  143. <div style="display: flex;">
  144. <div style="width: 100%;">
  145. <el-form-item label="备 注:" prop="Remark" label-width="160px">
  146. <el-input type="textarea" :rows="5" placeholder="备注"
  147. v-model="OpCustomersData.remark"></el-input>
  148. </el-form-item>
  149. </div>
  150. </div>
  151. <hr style='background-color:#5555; height:1px; border:none;margin: 10px 0;' />
  152. <div style="display: flex;flex-wrap: wrap;">
  153. <div style="width: 390px;">
  154. <el-form-item label="支付方式:" prop="payDId" label-width="160px">
  155. <el-select v-model="OpCustomersData.payDId" placeholder="支付方式" style="width: 100%;"
  156. @change="payChange">
  157. <el-option v-for="item in payment" :key="item.id" :label="item.name" :value="item.id">
  158. </el-option>
  159. </el-select>
  160. </el-form-item>
  161. </div>
  162. <div style="width: 390px;">
  163. <el-form-item label="消费方式:" prop="consumptionPatterns" label-width="160px">
  164. <el-input placeholder="消费方式" v-model="OpCustomersData.consumptionPatterns">
  165. </el-input>
  166. </el-form-item>
  167. </div>
  168. <div style="width: 390px;">
  169. <el-form-item label="消费日期:" prop="consumptionDate" label-width="160px">
  170. <el-date-picker value-format="yyyy-MM-dd" v-model="OpCustomersData.consumptionDate"
  171. placeholder="消费日期" type="date">
  172. </el-date-picker>
  173. </el-form-item>
  174. </div>
  175. <div style="width: 390px;">
  176. <el-form-item label="付款金额:" prop="payMoney" label-width="160px">
  177. <el-input placeholder="付款金额" v-model="OpCustomersData.insuranceCosts" style="width: 52%;"
  178. :disabled="true">
  179. </el-input>
  180. <el-select v-model="OpCustomersData.currency" style="width: 45%;" :disabled="true">
  181. <el-option v-for="item in currencyList" :key="item.currencyId"
  182. :label="item.currencyCode" :value="item.currencyId">
  183. </el-option>
  184. </el-select>
  185. </el-form-item>
  186. </div>
  187. </div>
  188. <div v-if="OpCustomersData.payDId == 72">
  189. <div style="display: flex;flex-wrap: wrap;">
  190. <div style="width: 390px;">
  191. <el-form-item label="卡类型:" prop="ctdId" label-width="160px">
  192. <el-select v-model="OpCustomersData.ctdId" placeholder="卡类型" style="width: 100%;"
  193. @change="ctdChange">
  194. <el-option v-for="item in bankCard" :key="item.id" :label="item.name"
  195. :value="item.id">
  196. </el-option>
  197. </el-select>
  198. </el-form-item>
  199. </div>
  200. <div style="width: 390px;">
  201. <el-form-item label="银行卡号:" prop="bankNo" label-width="160px">
  202. <el-input placeholder="银行卡号" v-model="OpCustomersData.bankNo" :disabled="true">
  203. </el-input>
  204. </el-form-item>
  205. </div>
  206. <div style="width: 390px;">
  207. <el-form-item label="持卡人姓名:" prop="cardholderName" label-width="160px">
  208. <el-input placeholder="持卡人姓名" v-model="OpCustomersData.cardholderName" :disabled="true">
  209. </el-input>
  210. </el-form-item>
  211. </div>
  212. </div>
  213. </div>
  214. <div v-else-if="OpCustomersData.payDId == 73">
  215. <div style="display: flex;flex-wrap: wrap;">
  216. <div style="width: 390px;">
  217. <el-form-item label="公司银行账号:" label-width="160px" prop="companyBankNo">
  218. <el-input placeholder="公司银行账号" v-model="OpCustomersData.companyBankNo">
  219. </el-input>
  220. </el-form-item>
  221. </div>
  222. <div style="width: 390px;">
  223. <el-form-item label="对方开户行:" prop="otherBankName" label-width="160px">
  224. <el-input placeholder="对方开户行:" v-model="OpCustomersData.otherBankName">
  225. </el-input>
  226. </el-form-item>
  227. </div>
  228. <div style="width: 390px;">
  229. <el-form-item label="对方银行卡号:" prop="otherSideNo" label-width="160px">
  230. <el-input placeholder="对方银行卡号" v-model="OpCustomersData.otherSideNo">
  231. </el-input>
  232. </el-form-item>
  233. </div>
  234. <div style="width: 390px;">
  235. <el-form-item label="对方姓名:" prop="otherSideName" label-width="160px">
  236. <el-input placeholder="对方姓名" v-model="OpCustomersData.otherSideName">
  237. </el-input>
  238. </el-form-item>
  239. </div>
  240. </div>
  241. </div>
  242. <div v-else-if="OpCustomersData.payDId == 83">
  243. <div style="display: flex;flex-wrap: wrap;">
  244. <div style="width: 390px;">
  245. <el-form-item label="对方开户行:" prop="otherBankName" label-width="160px">
  246. <el-input placeholder="对方开户行" v-model="OpCustomersData.otherBankName">
  247. </el-input>
  248. </el-form-item>
  249. </div>
  250. <div style="width: 390px;">
  251. <el-form-item label="对方银行卡号:" prop="otherSideNo" label-width="160px">
  252. <el-input placeholder="对方银行卡号" v-model="OpCustomersData.otherSideNo">
  253. </el-input>
  254. </el-form-item>
  255. </div>
  256. <div style="width: 390px;">
  257. <el-form-item label="对方姓名:" prop="otherSideName" label-width="160px">
  258. <el-input placeholder="对方姓名" v-model="OpCustomersData.otherSideName">
  259. </el-input>
  260. </el-form-item>
  261. </div>
  262. </div>
  263. </div>
  264. <div v-else></div>
  265. <div style="display:flex;flex-wrap: wrap;">
  266. <div style="width: 390px;">
  267. <el-form-item label="收款方:" label-width="160px">
  268. <el-input placeholder="对方姓名:" v-model="OpCustomersData.payee">
  269. </el-input>
  270. </el-form-item>
  271. </div>
  272. <div style="width: 390px;">
  273. <el-form-item label="费用标识:" prop="orbitalPrivateTransfer" label-width="160px">
  274. <el-select v-model="OpCustomersData.orbitalPrivateTransfer" placeholder="费用标识"
  275. style="width: 100%;">
  276. <el-option key="0" label="公转" :value=0>
  277. </el-option>
  278. <el-option key="1" label="私转" :value=1>
  279. </el-option>
  280. </el-select>
  281. </el-form-item>
  282. </div>
  283. </div>
  284. <div style="display: flex;">
  285. <div style="width: 100%;">
  286. <el-form-item label="备 注:" prop="Remark" label-width="160px">
  287. <el-input type="textarea" :rows="5" placeholder="备注"
  288. v-model="OpCustomersData.cRemark"></el-input>
  289. </el-form-item>
  290. </div>
  291. </div>
  292. <el-form-item>
  293. <div style="text-align: right;">
  294. <el-button type="primary" @click="addBtn">保存</el-button>
  295. <el-button @click="EscAdd">取消</el-button>
  296. </div>
  297. </el-form-item>
  298. </el-form>
  299. </div>
  300. </div>
  301. </template>
  302. <script>
  303. import { pinyin } from 'pinyin-pro';
  304. export default {
  305. data() {
  306. return {
  307. title: "新增保险费用",
  308. token: '',
  309. userId: 0,
  310. id: '',
  311. isShow: false,
  312. uploadURL: "http://132.232.92.186:8888/api/Groups/UploadCus",
  313. headers: {
  314. Authorization: JSON.parse(localStorage.getItem('userinif')).token,
  315. },
  316. projectName: "",
  317. uploadFiles: [],//上传的文件列表
  318. DelfileName: "",
  319. delegationInfo: {},
  320. delegationInfoList: [],//团组下拉框
  321. insuranceCostList: [],//保险类型下拉框
  322. Balance: 0,//保险余额
  323. currencyList: [],//币种下拉框
  324. bankCard: [],//卡类型下拉框
  325. payment: [],//支付方式下拉框
  326. OpCustomersData: {
  327. status: 0,
  328. id: 0,
  329. diId: 0,
  330. iid: 2,
  331. clientName: [],
  332. insuranceCosts: 0,
  333. currency: 836,
  334. attachment: '',
  335. createUserId: 0,
  336. remark: '',
  337. payDId: 1057,
  338. consumptionPatterns: '',
  339. consumptionDate: '',
  340. ctdId: '',
  341. companyBankNo: '',
  342. otherBankName: '',
  343. otherSideNo: '',
  344. otherSideName: '',
  345. bankNo: '',
  346. cardholderName: '',
  347. payee: '',
  348. orbitalPrivateTransfer: 0,
  349. cRemark: '',
  350. },
  351. IsAuditGM: 0,
  352. isPay: 0,
  353. VisitDate: '',
  354. passengerTypeSelect: [],
  355. transformDateFormat: function (value) {
  356. // 将value转换为Date对象
  357. var date = new Date(value);
  358. // 获取年、月、日
  359. var year = date.getFullYear();
  360. var month = date.getMonth() + 1;
  361. var day = date.getDate();
  362. // 将月份和日期转换为两位数的格式
  363. if (month < 10) {
  364. month = '0' + month;
  365. }
  366. if (day < 10) {
  367. day = '0' + day;
  368. }
  369. // 返回格式化后的日期字符串
  370. return year + '-' + month + '-' + day;
  371. },
  372. OpCustomersDataRules: {
  373. iid: [
  374. { required: true, message: '请选择保险名称', trigger: ['blur', 'change'] },
  375. ],
  376. clientName: [
  377. { type: "array", required: true, message: '请选择客户名称', trigger: ['blur', 'change'] },
  378. ],
  379. insuranceCosts: [
  380. { required: true, message: '请输入费用金额', trigger: ['blur', 'change'] },
  381. { pattern: /^(([1-9]?\d{0,8}(\.\d{1,2})?)|999999999|999999999\.(0){1,2})$/, message: '请输入正确的金额(最多2位小数)' }
  382. ],
  383. currency: [
  384. { required: true, message: '请选择支付币种', trigger: ['blur', 'change'] },
  385. ],
  386. payDId: [
  387. { required: true, message: '请选择支付方式', trigger: ['blur', 'change'] },
  388. ],
  389. consumptionPatterns: [
  390. { required: true, message: '请输入消费方式', trigger: ['blur', 'change'] },
  391. ],
  392. consumptionDate: [
  393. { required: true, message: '请选择消费日期', trigger: ['blur', 'change'] },
  394. ],
  395. payee: [
  396. { required: true, message: '请输入收款方', trigger: ['blur', 'change'] },
  397. ],
  398. ctdId: [
  399. { required: true, message: '请选择卡类型', trigger: ['blur', 'change'] },
  400. ],
  401. companyBankNo: [{ required: true, message: '公司银行账号', trigger: ['blur', 'change'] },],
  402. otherBankName: [{ required: true, message: '对方开户行', trigger: ['blur', 'change'] },],
  403. otherSideNo: [{ required: true, message: '对方银行卡号', trigger: ['blur', 'change'] },],
  404. totherSideName: [{ required: true, message: '对方姓名', trigger: ['blur', 'change'] },],
  405. },
  406. clientNameId: [],
  407. rollcallarr: [],
  408. }
  409. },
  410. methods: {
  411. //拼音
  412. pinyingxing(val) {
  413. return pinyin(val, { toneType: 'none' }).toUpperCase();
  414. },
  415. //fenge
  416. fgarr(val) {
  417. val = val + ""
  418. return val.split(' ')[0]
  419. },
  420. //初始化下拉框
  421. initializeSelect() {
  422. //团组下拉框绑定
  423. var url = "/api/Groups/DecreasePaymentsSelect"
  424. var that = this
  425. this.$axios({
  426. method: 'post',
  427. url: url,
  428. headers: {
  429. Authorization: 'Bearer ' + this.token
  430. },
  431. data: {
  432. userId: that.userId,
  433. ctId: 82
  434. }
  435. }).then(function (res) {
  436. console.log('DecreasePaymentsSelect', res.data.data);
  437. if (res.data.code == 200) {
  438. that.delegationInfoList = res.data.data.groupName; //团组列表
  439. that.PostTourClientListByDiId();
  440. that.payment = res.data.data.payment; //支付方式
  441. for (let index = 0; index < that.delegationInfoList.length; index++) {
  442. if (that.delegationInfoList[index].id == that.OpCustomersData.diId) {
  443. that.delegationInfo = that.delegationInfoList[index];
  444. //that.OpCustomersData.diId = that.delegationInfo.id
  445. that.VisitDate = that.transformDateFormat(that.delegationInfo.visitStartDate) + '至' + that.transformDateFormat(that.delegationInfo.visitEndDate); //时间
  446. var url = "/api/Groups/CustomersInitialize"
  447. that.$axios({
  448. method: 'post',
  449. url: url,
  450. headers: {
  451. Authorization: 'Bearer ' + that.token
  452. },
  453. data: {
  454. portType: 1,
  455. diId: that.OpCustomersData.diId
  456. }
  457. }).then(function (res) {
  458. if (res.data.code == 200) {
  459. that.insuranceCostList = res.data.data.insuranceCost;//保险类型下拉框
  460. that.OpCustomersData.iid = that.insuranceCostList[0].id;
  461. that.Balance = that.insuranceCostList[0].balance;
  462. that.currencyList = res.data.data.currencyList;//币种下拉框
  463. // if (that.currencyList.length != 0) {
  464. // that.OpCustomersData.currency = that.currencyList[0].currencyId
  465. // }
  466. that.bankCard = res.data.data.bankCard;//卡类型下拉框
  467. that.payment = res.data.data.payment;//支付方式下拉框
  468. if (that.OpCustomersData.id != null && that.OpCustomersData.id != undefined && that.OpCustomersData.id != 0) {
  469. that.QueryCustomersById();
  470. that.title = "修改保险费用";
  471. that.OpCustomersData.status = 2
  472. that.isShow = true
  473. } else {
  474. that.OpCustomersData.status = 1
  475. that.title = "新增保险费用"
  476. that.isShow = false
  477. }
  478. }
  479. })
  480. break;
  481. }
  482. }
  483. }
  484. })
  485. },
  486. DiIdSelectChange(val) {
  487. var that = this;
  488. setTimeout(function () {
  489. that.PostTourClientListByDiId(val);
  490. }, 500)
  491. for (let index = 0; index < that.delegationInfoList.length; index++) {
  492. if (that.delegationInfoList[index].id == that.OpCustomersData.diId) {
  493. that.delegationInfo = that.delegationInfoList[index];
  494. that.VisitDate = that.transformDateFormat(that.delegationInfo.visitStartDate) + '至' + that.transformDateFormat(that.delegationInfo.visitEndDate);
  495. var url = "/api/Groups/CustomersInitialize"
  496. that.$axios({
  497. method: 'post',
  498. url: url,
  499. headers: {
  500. Authorization: 'Bearer ' + that.token
  501. },
  502. data: {
  503. portType: 1,
  504. diId: that.OpCustomersData.diId
  505. }
  506. }).then(function (res) {
  507. if (res.data.code == 200) {
  508. that.insuranceCostList = res.data.data.insuranceCost;//保险类型下拉框
  509. that.OpCustomersData.iid = that.insuranceCostList[0].id;
  510. that.Balance = that.insuranceCostList[0].balance;
  511. that.currencyList = res.data.data.currencyList;//币种下拉框
  512. // if (that.currencyList.length != 0) {
  513. // that.OpCustomersData.currency = that.currencyList[0].currencyId
  514. // }
  515. that.bankCard = res.data.data.bankCard;//卡类型下拉框
  516. that.payment = res.data.data.payment;//支付方式下拉框
  517. }
  518. that.QueryClient();
  519. that.OpCustomersData.clientName = [];
  520. })
  521. break;
  522. }
  523. }
  524. that.$nextTick(() => {
  525. that.$refs.OpCustomersData.clearValidate();
  526. })
  527. },
  528. iidChane(row) {
  529. for (let index = 0; index < this.insuranceCostList.length; index++) {
  530. if (this.insuranceCostList[index].id == row) {
  531. this.Balance = this.insuranceCostList[index].balance;
  532. break;
  533. }
  534. }
  535. },
  536. payChange() {
  537. this.OpCustomersData.ctdId = '';
  538. this.OpCustomersData.bankNo = '';
  539. this.OpCustomersData.cardholderName = '';
  540. this.OpCustomersData.companyBankNo = '';
  541. this.OpCustomersData.otherBankName = '';
  542. this.OpCustomersData.otherSideNo = '';
  543. this.OpCustomersData.otherSideName = '';
  544. this.OpCustomersData.cRemark = '';
  545. if (this.OpCustomersData.payDId == 73) {
  546. this.OpCustomersDataRules.companyBankNo = [{ required: true, message: '公司银行账号', trigger: ['blur', 'change'] },]
  547. this.OpCustomersDataRules.otherBankName = [{ required: true, message: '对方开户行', trigger: ['blur', 'change'] },]
  548. this.OpCustomersDataRules.otherSideNo = [{ required: true, message: '对方银行卡号', trigger: ['blur', 'change'] },]
  549. this.OpCustomersDataRules.otherSideName = [{ required: true, message: '对方姓名', trigger: ['blur', 'change'] },]
  550. this.OpCustomersDataRules.ctdId = []
  551. } else if (this.OpCustomersData.payDId == 72) {
  552. this.OpCustomersDataRules.ctdId = [{ required: true, message: '请选择卡类型', trigger: ['blur', 'change'] },]
  553. this.OpCustomersDataRules.companyBankNo = []
  554. this.OpCustomersDataRules.otherBankName = []
  555. this.OpCustomersDataRules.otherSideNo = []
  556. this.OpCustomersDataRules.otherSideName = []
  557. } else if (this.OpCustomersData.payDId == 83) {
  558. this.OpCustomersDataRules.companyBankNo = []
  559. this.OpCustomersDataRules.otherBankName = [{ required: true, message: '对方开户行', trigger: ['blur', 'change'] },]
  560. this.OpCustomersDataRules.otherSideNo = [{ required: true, message: '对方银行卡号', trigger: ['blur', 'change'] },]
  561. this.OpCustomersDataRules.otherSideName = [{ required: true, message: '对方姓名', trigger: ['blur', 'change'] },]
  562. this.OpCustomersDataRules.ctdId = []
  563. } else {
  564. this.OpCustomersDataRules.companyBankNo = []
  565. this.OpCustomersDataRules.otherBankName = []
  566. this.OpCustomersDataRules.otherSideNo = []
  567. this.OpCustomersDataRules.otherSideName = []
  568. this.OpCustomersDataRules.ctdId = []
  569. }
  570. this.$nextTick(() => {
  571. this.$refs.OpCustomersData.clearValidate();
  572. })
  573. },
  574. ctdChange(id) {
  575. this.OpCustomersData.cardholderName = 'Zhang Hailin';
  576. for (var i = 0; i < this.bankCard.length; i++) {
  577. if (this.bankCard[i].id == parseInt(id)) {
  578. this.OpCustomersData.bankNo = this.bankCard[i].remark
  579. }
  580. }
  581. },
  582. //根据Id获取单挑数据及C表数据
  583. QueryCustomersById() {
  584. var url = "/api/Groups/CustomersById"
  585. var that = this
  586. this.$axios({
  587. method: 'post',
  588. url: url,
  589. headers: {
  590. Authorization: 'Bearer ' + this.token
  591. },
  592. data: {
  593. id: that.OpCustomersData.id
  594. }
  595. }).then(function (res) {
  596. if (res.data.code == 200) {
  597. var CreditCardPayment = res.data.data.creditCard;
  598. var Customers = res.data.data.customers;
  599. that.IsAuditGM = CreditCardPayment.isAuditGM;
  600. that.isPay = CreditCardPayment.isPay;
  601. that.OpCustomersData.iid = Customers.iid
  602. for (let index = 0; index < that.insuranceCostList.length; index++) {
  603. if (that.insuranceCostList[index].id == that.OpCustomersData.iid) {
  604. that.Balance = that.insuranceCostList[index].balance;
  605. break;
  606. }
  607. }
  608. var respClientName = Customers.clientName
  609. that.OpCustomersData.clientName = that.ClientFormat(respClientName);
  610. that.OpCustomersData.insuranceCosts = Customers.insuranceCosts
  611. that.OpCustomersData.currency = Customers.currency
  612. that.OpCustomersData.attachment = Customers.attachment
  613. that.uploadFiles = []
  614. if (that.OpCustomersData.attachment != null && that.OpCustomersData.attachment != undefined && that.OpCustomersData.attachment != "") {
  615. that.uploadFiles.push({
  616. name: that.OpCustomersData.attachment,
  617. url: 'http://132.232.92.186:24/Office/GrpFile/保险费用文件上传/',
  618. })
  619. }
  620. that.OpCustomersData.remark = Customers.remark
  621. that.OpCustomersData.payDId = CreditCardPayment.payDId;
  622. that.OpCustomersData.consumptionPatterns = CreditCardPayment.consumptionPatterns;
  623. that.OpCustomersData.consumptionDate = CreditCardPayment.consumptionDate;
  624. that.OpCustomersData.ctdId = CreditCardPayment.ctdId;
  625. that.OpCustomersData.bankNo = CreditCardPayment.bankNo;
  626. that.OpCustomersData.cardholderName = CreditCardPayment.cardholderName;
  627. that.OpCustomersData.companyBankNo = CreditCardPayment.companyBankNo
  628. that.OpCustomersData.otherBankName = CreditCardPayment.otherBankName
  629. that.OpCustomersData.otherSideNo = CreditCardPayment.otherSideNo
  630. that.OpCustomersData.otherSideName = CreditCardPayment.otherSideName
  631. that.OpCustomersData.payee = CreditCardPayment.payee;
  632. that.OpCustomersData.orbitalPrivateTransfer = CreditCardPayment.orbitalPrivateTransfer;
  633. that.OpCustomersData.cRemark = CreditCardPayment.remark;
  634. }
  635. })
  636. },
  637. //处理时间
  638. getdate(val) {
  639. var date = new Date(val);
  640. var y = date.getFullYear();
  641. var m = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  642. var d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  643. return y + '-' + m + '-' + d
  644. },
  645. addBtn() {
  646. if (this.OpCustomersData.payDId != 72) {
  647. this.OpCustomersData.ctdId = 0;
  648. this.OpCustomersData.bankNo = "";
  649. this.OpCustomersData.cardholderName = "";
  650. }
  651. if (this.isPay == 1) {
  652. this.$message.error('已付款,不可修改!');
  653. } else {
  654. if (this.OpCustomersData.diId == null || this.OpCustomersData.diId == undefined || this.OpCustomersData.diId == "") {
  655. this.$message.error("请选择团组名称");
  656. return;
  657. } else {
  658. const that = this;
  659. that.$refs.OpCustomersData.validate((valid) => {
  660. if (valid) {
  661. {
  662. that.OpCustomersData.createUserId = that.userId;
  663. if (that.OpCustomersData.ctdId == '') {
  664. that.OpCustomersData.ctdId = 0
  665. }
  666. var url = "/api/Groups/OpCustomers"
  667. that.OpCustomersData.clientName = that.ClientFormat(that.OpCustomersData.clientName);//处理数组
  668. that.OpCustomersData.consumptionDate = that.getdate(that.OpCustomersData.consumptionDate);//处理时间
  669. that.$axios({
  670. method: 'post',
  671. url: url,
  672. headers: {
  673. Authorization: 'Bearer ' + that.token
  674. },
  675. data: that.OpCustomersData
  676. }).then(function (res) {
  677. if (res.data.code == 200) {
  678. that.$message({
  679. message: res.data.msg,
  680. type: 'success'
  681. });
  682. that.loading = true;
  683. setTimeout(() => {
  684. that.$router.push({
  685. path: "/home/Customers",
  686. query: {
  687. diId: that.OpCustomersData.diId
  688. }
  689. })
  690. }, 500);
  691. } else {
  692. that.$message.error(res.data.msg);
  693. }
  694. }).finally(() => {
  695. that.OpCustomersData.clientName = that.ClientFormat(that.OpCustomersData.clientName);
  696. console.log('run finally code');
  697. });
  698. }
  699. } else {
  700. this.$message.error('请完善信息在保存!');
  701. return false;
  702. }
  703. })
  704. }
  705. }
  706. },
  707. /* 文件上传相关
  708. //上传
  709. // 文件超出限制
  710. exceed(files, fileList) {
  711. this.$message.warning(
  712. `当前限制选择 1个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length
  713. } 个文件,请取消要替换的文件`
  714. );
  715. },
  716. //文件上传成功时的钩子
  717. upLoadSuccess(response, file, fileList) {
  718. var that = this;
  719. if (response.code == 200) {
  720. if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
  721. that.$axios({
  722. method: 'post',
  723. url: "/api/Groups/DelFileCus",
  724. headers: {
  725. Authorization: 'Bearer ' + that.token
  726. },
  727. data: {
  728. fileName: that.DelfileName,
  729. id: that.id
  730. }
  731. }).then(function (res) {
  732. if (res.data.code == 200) {
  733. }
  734. })
  735. }
  736. //that.ctdId = that.ctdIdPay;
  737. that.OpCustomersData.createUserId = that.userId;
  738. that.OpCustomersData.attachment = that.projectName;
  739. if (that.OpCustomersData.ctdId == '') {
  740. that.OpCustomersData.ctdId = 0
  741. }
  742. var url = "/api/Groups/OpCustomers"
  743. that.$axios({
  744. method: 'post',
  745. url: url,
  746. headers: {
  747. Authorization: 'Bearer ' + that.token
  748. },
  749. data: that.OpCustomersData
  750. }).then(function (res) {
  751. if (res.data.code == 200) {
  752. that.$message({
  753. message: res.data.msg,
  754. type: 'success'
  755. });
  756. that.loading = true;
  757. setTimeout(() => {
  758. that.$router.push({
  759. path: "/home/Customers",
  760. query: {
  761. diId: that.OpCustomersData.diId
  762. }
  763. })
  764. }, 3000);
  765. } else {
  766. that.$message.error(res.data.msg);
  767. }
  768. })
  769. } else {
  770. if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
  771. that.$axios({
  772. method: 'post',
  773. url: "/api/Groups/DelFile",
  774. headers: {
  775. Authorization: 'Bearer ' + that.token
  776. },
  777. data: {
  778. fileName: that.DelfileName,
  779. id: that.OpCustomersData.id
  780. }
  781. }).then(function (res) {
  782. if (res.data.code == 200) {
  783. }
  784. })
  785. }
  786. that.OpCustomersData.createUserId = that.userId;
  787. if (that.OpCustomersData.ctdId == '') {
  788. that.OpCustomersData.ctdId = 0
  789. }
  790. var url = "/api/Groups/OpCustomers"
  791. that.$axios({
  792. method: 'post',
  793. url: url,
  794. headers: {
  795. Authorization: 'Bearer ' + that.token
  796. },
  797. data: that.OpCustomersData
  798. }).then(function (res) {
  799. if (res.data.code == 200) {
  800. that.$message({
  801. message: res.data.msg,
  802. type: 'success'
  803. });
  804. that.loading = true;
  805. setTimeout(() => {
  806. that.$router.push({
  807. path: "/home/Customers",
  808. query: {
  809. diId: that.OpCustomersData.diId
  810. }
  811. })
  812. }, 3000);
  813. } else {
  814. that.$message.error(res.data.msg);
  815. }
  816. })
  817. }
  818. },
  819. beforeRemove(file, fileList) {
  820. console.log(file.name)
  821. let id1 = this.uploadFiles.findIndex(item => {
  822. if (item.name == file.name) {
  823. return true
  824. }
  825. })
  826. this.uploadFiles.splice(id1, 1)
  827. this.projectName = ""
  828. this.DelfileName = file.name
  829. },
  830. onChange(file, fileList) {
  831. this.projectName = file.name
  832. },
  833. */
  834. //获取客户名单info
  835. PostTourClientListByDiId(val) {
  836. this.rollcallarr = [];
  837. var that = this
  838. var url = "/api/Groups/PostTourClientListByDiId"
  839. this.$axios({
  840. method: 'post',
  841. url: url,
  842. headers: {
  843. Authorization: 'Bearer ' + that.token
  844. },
  845. data: {
  846. portType: 1,
  847. diid: val ? val : that.OpCustomersData.diId,
  848. pageId: 104,
  849. userId: 233
  850. }
  851. }).then(function (res) {
  852. if (res.data.code == 200) {
  853. that.rollcallarr = res.data.data;
  854. } else {
  855. that.$message.error(res.data.msg);
  856. }
  857. })
  858. },
  859. EscAdd() {
  860. this.$router.push({
  861. path: "/home/Customers",
  862. query: {
  863. diId: this.OpCustomersData.diId
  864. }
  865. })
  866. },
  867. //加载团组客户名单
  868. QueryClient() {
  869. var url = "/api/Groups/QueryClientInfoByDIID"
  870. var that = this
  871. this.$axios({
  872. method: 'post',
  873. url: url,
  874. headers: {
  875. Authorization: 'Bearer ' + that.token
  876. },
  877. data: {
  878. diid: this.OpCustomersData.diId
  879. }
  880. }).then(function (res) {
  881. if (res.data.code == 200) {
  882. //客户名单
  883. console.log(res.data.data);
  884. that.clientNameId = res.data.data;
  885. }
  886. })
  887. },
  888. ClientFormat(val) {
  889. var result = [];
  890. if (typeof val == "string") {
  891. if (val.indexOf(',') != -1) {
  892. result = val.split(',').map(x => { return Number(x) }).filter(f => f > 0)
  893. } else {
  894. var clientId = Number(val);
  895. if (clientId > 0) {
  896. result = [clientId]
  897. }
  898. }
  899. } else if (Array.isArray(val)) {
  900. if (val.length > 0) {
  901. result = val.join();
  902. }
  903. } else {
  904. result = val;
  905. }
  906. return result;
  907. }
  908. },
  909. mounted() {
  910. this.token = JSON.parse(localStorage.getItem('userinif')).token
  911. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  912. this.OpCustomersData.diId = parseInt(this.$route.query.DiId)
  913. this.QueryClient();
  914. this.initializeSelect();
  915. this.OpCustomersData.id = this.$route.query.id
  916. },
  917. computed: {
  918. //客户名单属性
  919. fliterClient() {
  920. var arr = [];
  921. if (this.clientNameId.length < 1) {
  922. return [];
  923. }
  924. this.clientNameId.forEach(element => {
  925. var item = "";
  926. if (element.pinyin) {
  927. item += element.pinyin;
  928. }
  929. if (element.firstName && element.lastName) {
  930. item += "(" + element.lastName + element.firstName + ")";
  931. }
  932. if (item) {
  933. arr.push({ id: element.id, name: item });
  934. }
  935. });
  936. return arr;
  937. }
  938. }
  939. }
  940. </script>
  941. <style>
  942. .communal-list {
  943. background-color: #fff;
  944. padding: 10px;
  945. box-shadow: 0 0 5px #0005;
  946. border-radius: 10px;
  947. }
  948. .car_add .communal-title {
  949. display: flex;
  950. font-size: 17px;
  951. font-weight: 600;
  952. color: #555;
  953. margin-bottom: 20px;
  954. justify-content: space-between;
  955. align-items: center;
  956. }
  957. .appraise-box {
  958. display: flex;
  959. flex-wrap: wrap;
  960. justify-content: space-between;
  961. margin: 50px 0;
  962. }
  963. .appraise-box>div {
  964. width: 30%;
  965. }
  966. .communal-box {
  967. display: flex;
  968. }
  969. .communal-box>button {
  970. margin-left: 10px;
  971. padding: 8px 20px;
  972. }
  973. .car_add {
  974. background-color: #fff;
  975. padding: 20px;
  976. box-shadow: 0 0 5px #0005;
  977. border-radius: 10px;
  978. }
  979. .opcustomers-box .el-select {
  980. width: 100%;
  981. }
  982. .opcustomers-box .el-date-editor .el-input {
  983. width: 100%;
  984. }
  985. @media screen and (max-width: 1700px) {
  986. .appraise-box>div {
  987. width: 48%;
  988. }
  989. .appraise-box>div el-form-item__content {
  990. width: 260px !important;
  991. }
  992. }
  993. </style>