OpCustomers.vue 44 KB

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