CarTouristGuideGrounContent.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <template>
  2. <div class="car_add">
  3. <div>
  4. <div class="communal-title">
  5. <div>OP费用填写明细</div>
  6. </div>
  7. </div>
  8. <el-skeleton :rows="28" animated :loading="loading">
  9. <div style="display: flex;justify-content: space-between;">
  10. <div style="width: 80%;display: flex;">
  11. <div style="width: 25%;margin-right: 10px;">
  12. <el-select v-model="diId" placeholder="团组选择" clearable filterable style="width: 100%;"
  13. :disabled="true">
  14. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  15. :value="item.id">
  16. </el-option>
  17. </el-select>
  18. </div>
  19. <div style="width: 25%;">
  20. <el-select v-model="currency" placeholder="币种选择" clearable filterable style="width: 80%;">
  21. <el-option v-for="item in currencyList" :key="item.currencyId"
  22. :label="item.currencyName + '(' + item.currencyCode + ')'" :value="item.currencyId">
  23. </el-option>
  24. </el-select>
  25. </div>
  26. </div>
  27. </div>
  28. <div style="display: flex;justify-content: space-between;margin: 10px 0;" class="checkbox-style">
  29. <el-checkbox-group v-model="checkList" @change="checkBoxChange">
  30. <el-checkbox v-for="(item, index) in checkItems" :key="index" :label=item></el-checkbox>
  31. </el-checkbox-group>
  32. </div>
  33. <div style="margin:10px 0;color:#606266;font-size:16px;">
  34. <span style="font-weight: bold;">团队名称:</span>
  35. <span style="color:#606266;">{{ delegationInfo.teamName }}&nbsp;&nbsp;&nbsp;</span>
  36. <span style="font-weight: bold;">客户:</span>
  37. <span style="color:#606266;">{{ delegationInfo.clientName }}&nbsp;&nbsp;&nbsp; </span>
  38. <span style="font-weight: bold;">出访国家:</span>
  39. <span style="color:#606266;">{{ delegationInfo.visitCountry }}&nbsp;&nbsp;&nbsp;</span>
  40. <span style="font-weight: bold;">起止日期:</span>
  41. <span style="color:#606266;">{{ delegationInfo.visitDate }}&nbsp;&nbsp;&nbsp;</span>
  42. <span style="font-weight: bold;">天数/人数:</span>
  43. <span style="color:#606266;">{{ delegationInfo.visitDays }}天/{{
  44. delegationInfo.visitPNumber }}人</span>
  45. </div>
  46. <hr style='background-color:#5555; height:1px; border:none;' />
  47. <div>
  48. <template>
  49. <el-table :data="ContentList" :border=true style="width: 100%" :span-method="objectSpanMethod">
  50. <el-table-column prop="num" label="序 号" width="55">
  51. <template slot-scope="scope">
  52. {{ scope.$index + 1 }}
  53. </template>
  54. </el-table-column>
  55. <el-table-column :align="'center'" prop="SIdName" label="费用项目" width="120">
  56. <template slot-scope="scope">
  57. <span style="display: none;">{{ scope.row.sId }}</span>{{ scope.row.sidName }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="datePrice" label="日期" width="160">
  61. <template slot-scope="scope">
  62. <el-date-picker style="width: 100%;" v-model="scope.row.datePrice" type="date"
  63. :picker-options="startPickerOptions" value-format="yyyy-MM-dd HH:mm:ss"
  64. placeholder="选择日期">
  65. </el-date-picker>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="金额/币种" width="400">
  69. <template slot-scope="scope">
  70. <div class="el-input-number-style pice-ys">
  71. <el-input-number size="small" placeholder="请输入金额" v-model="scope.row.price"
  72. :controls="false" @change="PriceChange"></el-input-number>
  73. <!-- <el-input placeholder="请输入金额" v-model="scope.row.price" clearable style="width:180px;"
  74. @change="PriceChange" /> -->
  75. <el-select size="small" v-model="currency" placeholder="币种选择" clearable filterable
  76. style="width:120px" :disabled="true">
  77. <el-option v-for="item in currencyList" :key="item.currencyId"
  78. :label="item.currencyCode" :value="item.currencyId">
  79. </el-option>
  80. </el-select>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="数量" width="100">
  85. <template slot-scope="scope">
  86. <el-input size="small" style="width: 100%;" placeholder="选择单位" v-model="scope.row.count"
  87. @change="PriceChange">
  88. </el-input>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="单位" width="200">
  92. <template slot-scope="scope">
  93. <!-- <el-input size="small" style="width: 100%;" placeholder="选择单位" v-model="scope.row.units"
  94. @change="PriceChange"></el-input> -->
  95. <el-select v-model="scope.row.units" filterable placeholder="选择单位">
  96. <el-option v-for="item in unitsArr" :key="item.id" :label="item.name"
  97. :value="item.id">
  98. </el-option>
  99. </el-select>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="费用明细">
  103. <template slot-scope="scope">
  104. <el-input type="textarea" :rows="1" placeholder="费用明细"
  105. v-model="scope.row.priceContent"></el-input>
  106. </template>
  107. </el-table-column>
  108. <!-- <el-table-column label="备注">
  109. <template slot-scope="scope">
  110. <el-input type="textarea" :rows="1" placeholder="备注" v-model="scope.row.remark"></el-input>
  111. </template>
  112. </el-table-column> -->
  113. </el-table>
  114. <hr style='background-color:#5555; height:1px; border:none;' />
  115. <el-form :model="OPContenData" ref="OPContenData" :rules="OPContenDataRules" label-width="100px"
  116. class="demo-ruleForm">
  117. <div style="display: flex;">
  118. <div style="width: 25%;">
  119. <el-form-item label="此次付款百分比:" prop="payPercentage" label-width="160px">
  120. <el-input placeholder="此次付款百分比" v-model="OPContenData.payPercentage">
  121. <template slot="append">%</template>
  122. </el-input>
  123. </el-form-item>
  124. </div>
  125. <div style="width: 25%;">
  126. <el-form-item label="收款方:" prop="payee" label-width="160px">
  127. <el-input placeholder="收款方" v-model="OPContenData.payee">
  128. </el-input>
  129. </el-form-item>
  130. </div>
  131. <div style="width: 25%;">
  132. <el-form-item label="费用标识:" prop="orbitalPrivateTransfer" label-width="160px">
  133. <el-select v-model="OPContenData.orbitalPrivateTransfer" clearable filterable
  134. placeholder="费用标识" style="width: 100%;">
  135. <el-option :key=0 :value="0" label="公转"></el-option>
  136. <el-option :key=1 :value="1" label="私转"></el-option>
  137. </el-select>
  138. </el-form-item>
  139. </div>
  140. <div style="width: 25%;">
  141. <el-form-item label="支付方式:" prop="payDId" label-width="160px">
  142. <el-select v-model="OPContenData.payDId" placeholder="支付方式" clearable filterable
  143. style="width:100%">
  144. <el-option v-for="item in payment" :key="item.id" :label="item.name"
  145. :value="item.id">
  146. </el-option>
  147. </el-select>
  148. </el-form-item>
  149. </div>
  150. </div>
  151. <div style="display: flex;">
  152. <div style="width: 25%;">
  153. <el-form-item label="总金额:" label-width="160px">
  154. <el-input placeholder="金额" v-model="countCost" :disabled="true"
  155. style="width: 120px;"></el-input>
  156. <el-select v-model="currency" placeholder="币种选择" clearable filterable
  157. style="width:100px" :disabled="true">
  158. <el-option v-for="item in currencyList" :key="item.currencyId"
  159. :label="item.currencyCode" :value="item.currencyId">
  160. </el-option>
  161. </el-select>
  162. </el-form-item>
  163. </div>
  164. <div style="width: 75%;text-align: right;">
  165. <el-form-item>
  166. <el-button type="primary" @click="addBtn">保存</el-button>
  167. <el-button @click="EscAdd">取消</el-button>
  168. </el-form-item>
  169. </div>
  170. </div>
  171. </el-form>
  172. </template>
  173. </div>
  174. </el-skeleton>
  175. </div>
  176. </template>
  177. <script>
  178. export default {
  179. data() {
  180. return {
  181. startPickerOptions: {
  182. },
  183. pageId: '',
  184. token: '',
  185. cTable: '',
  186. userId: 0,
  187. id: '',
  188. diId: '',
  189. loading: true,
  190. currency: 836,
  191. countCost: 0,
  192. delegationInfo: {},
  193. delegationInfoList: [],//团组下拉框
  194. currencyList: [],
  195. payment: [],
  196. IsAuditGM: 0,
  197. ContentList: [],
  198. OPContenData: {
  199. diId: '',
  200. cTGGRId: '',
  201. orbitalPrivateTransfer: 0,
  202. payPercentage: '80',
  203. payee: '',
  204. payDId: '',
  205. currency: '',
  206. OPContentList: [],
  207. CreateUserId: 0
  208. },
  209. OPContenDataRules: {
  210. payPercentage: [
  211. { required: true, message: '请输入付款百分比', trigger: ['blur', 'change'] },
  212. ],
  213. orbitalPrivateTransfer: [
  214. { required: true, message: '请选择费用标识', trigger: ['blur', 'change'] },
  215. ],
  216. payee: [
  217. { required: true, message: '请输入收款方', trigger: ['blur', 'change'] },
  218. ],
  219. payDId: [
  220. { required: true, message: '请选择付款方式', trigger: ['blur', 'change'] },
  221. ]
  222. },
  223. unitsArr: [],
  224. checkItems: ["车费", "导游费", "客户午餐费用", "导游景点费", "导游小费", "接送机费", "其他费用", "司机工资", "司机小费", "司机餐补", "车超时费", "导游餐补", "导游房补", "导游交通", "客户早餐费用", "客户晚餐费用", "景点门票费", "饮料/零食/水果", "住补费用", "翻译费"],
  225. checkList: [],
  226. sourceList: [],
  227. ListCount: 1,
  228. }
  229. },
  230. methods: {
  231. //初始化下拉框
  232. initializeSelect() {
  233. //团组下拉框绑定
  234. var url = "/api/Groups/CarTouristGuideGroundContentInitialize"
  235. var that = this
  236. this.$axios({
  237. method: 'post',
  238. url: url,
  239. headers: {
  240. Authorization: 'Bearer ' + this.token
  241. },
  242. data: {
  243. userId: that.userId,
  244. id: that.id,
  245. }
  246. }).then(function (res) {
  247. if (res.data.code == 200) {
  248. console.log(res)
  249. that.delegationInfoList = res.data.data.delegations;
  250. for (let index = 0; index < that.delegationInfoList.length; index++) {
  251. if (that.delegationInfoList[index].id == that.diId) {
  252. that.delegationInfo = that.delegationInfoList[index];
  253. break;
  254. }
  255. }
  256. //that.ContentList = res.data.data.carTouristGuides;
  257. that.sourceList = res.data.data.carTouristGuides;
  258. that.payment = res.data.data.payment;
  259. var CreditCardPayment = res.data.data.creditCardPayment;
  260. if (CreditCardPayment != null) {
  261. that.OPContenData.payDId = CreditCardPayment.payDId
  262. that.OPContenData.payee = CreditCardPayment.payee
  263. that.currency = CreditCardPayment.paymentCurrency
  264. that.OPContenData.payPercentage = CreditCardPayment.payPercentage
  265. that.countCost = CreditCardPayment.payMoney
  266. that.OPContenData.orbitalPrivateTransfer = CreditCardPayment.orbitalPrivateTransfer
  267. that.IsAuditGM = CreditCardPayment.isAuditGM;
  268. }
  269. that.unitsArr = res.data.data.ssdv;
  270. var start = new Date(res.data.data.start).getTime();
  271. var end = new Date(res.data.data.end).getTime();
  272. that.startPickerOptions.disabledDate = (time) => {
  273. return time.getTime() < start || time.getTime() > end;
  274. }
  275. that.checkList = res.data.data.checkedItem;
  276. that.checkBoxChange();
  277. that.loading = false;
  278. //that.OpCarTouristGuideGroundContenById()
  279. } else {
  280. this.$message.error('初始化失败' + res.data.msg);
  281. }
  282. })
  283. },
  284. //获取ctable
  285. PostPageLinkCTable() {
  286. var url = "/api/Business/PostPageLinkCTable"
  287. var that = this
  288. this.$axios({
  289. method: 'post',
  290. url: url,
  291. headers: {
  292. Authorization: 'Bearer ' + this.token
  293. },
  294. data: {
  295. pageId: that.pageId,
  296. }
  297. }).then(function (res) {
  298. if (res.data.code == 200) {
  299. that.cTable = res.data.data.cTable
  300. that.PostGroupTeamRateByDiIdAndCTableId();
  301. }
  302. })
  303. },
  304. //获取团组币种
  305. PostGroupTeamRateByDiIdAndCTableId() {
  306. var url = "/api/Business/PostGroupTeamRateByDiIdAndCTableId"
  307. var that = this
  308. this.$axios({
  309. method: 'post',
  310. url: url,
  311. headers: {
  312. Authorization: 'Bearer ' + this.token
  313. },
  314. data: {
  315. portType: 1,
  316. diId: that.diId,
  317. cTable: that.cTable,
  318. }
  319. }).then(function (res) {
  320. console.log(res)
  321. if (res.data.code == 200) {
  322. that.currencyList = res.data.data.teamRates;
  323. that.currency = that.currencyList[0].currencyId;
  324. }
  325. })
  326. },
  327. // OpCarTouristGuideGroundContenById() {
  328. // var url = "/api/Groups/OpCarTouristGuideGroundContentById"
  329. // var that = this
  330. // this.$axios({
  331. // method: 'post',
  332. // url: url,
  333. // headers: {
  334. // Authorization: 'Bearer ' + this.token
  335. // },
  336. // data: {
  337. // id: that.id
  338. // }
  339. // }).then(function (res) {
  340. // if (res.data.code == 200) {
  341. // var CarTouristsContent = res.data.data.carTouristsContent;
  342. // if (CarTouristsContent.length != 0) {
  343. // CarTouristsContent.forEach(function (item) {
  344. // that.ContentList.forEach(function (item1) {
  345. // if (item.sId == item1.sId) {
  346. // item1.id = item.id
  347. // item1.price = item.price
  348. // item1.priceContent = item.priceContent
  349. // //item1.remark = item.remark
  350. // }
  351. // })
  352. // })
  353. // }
  354. // that.loading = false
  355. // }
  356. // })
  357. // },
  358. addBtn() {
  359. if (this.IsAuditGM == 1) {
  360. this.$message.error('已通过审核,不可修改!');
  361. } else {
  362. if (this.diId == null && this.diId == undefined && this.diId == "") {
  363. this.$message.error("请选择团组名称");
  364. return;
  365. } else {
  366. var that = this
  367. that.$refs.OPContenData.validate((valid) => {
  368. if (valid) {
  369. that.OPContenData.diId = that.diId;
  370. that.OPContenData.cTGGRId = that.id;
  371. that.OPContenData.currency = that.currency;
  372. that.OPContenData.CreateUserId = that.userId;
  373. that.OPContenData.selectCheck = that.checkList;
  374. that.OPContenData.OPContentList = [];
  375. that.ContentList.forEach(function (item) {
  376. that.OPContenData.OPContentList.push({
  377. id: item.id,
  378. sId: item.sId,
  379. price: item.price,
  380. priceContent: item.priceContent,
  381. datePrice: item.datePrice,
  382. count: item.count,
  383. units: item.units,
  384. //remark: item.remark,
  385. })
  386. })
  387. var url = "/api/Groups/OpCarTouristGuideGroundContent"
  388. that.$axios({
  389. method: 'post',
  390. url: url,
  391. headers: {
  392. Authorization: 'Bearer ' + that.token
  393. },
  394. data: that.OPContenData
  395. }).then(function (res) {
  396. if (res.data.code == 200) {
  397. that.$message({
  398. message: res.data.msg,
  399. type: 'success'
  400. });
  401. that.EscAdd();
  402. } else {
  403. that.$message.error(res.data.msg);
  404. }
  405. })
  406. } else {
  407. this.$message.error('请完善信息在保存!');
  408. return false;
  409. }
  410. })
  411. }
  412. }
  413. },
  414. EscAdd() {
  415. this.$router.push({
  416. path: "/home/CarTouristGuideGroundId",
  417. query: {
  418. diId: this.diId
  419. }
  420. })
  421. },
  422. PriceChange() {
  423. var countCost = 0;
  424. this.ContentList.forEach(function (item) {
  425. if (item.price) {
  426. countCost += parseFloat(item.price)
  427. }
  428. })
  429. this.countCost = countCost
  430. },
  431. checkBoxChange() {
  432. this.ContentList = [];
  433. for (var soure = 0; soure < this.sourceList.length; soure++) {
  434. for (var item = 0; item < this.checkList.length; item++) {
  435. if (this.sourceList[soure].sidName == this.checkList[item]) {
  436. this.ContentList.push(this.sourceList[soure]);
  437. }
  438. }
  439. }
  440. this.PriceChange();
  441. var count = 1;
  442. if (this.ContentList.length > 0) {
  443. var sid = this.ContentList[0].sId;
  444. count = this.ContentList.filter(x => x.sId == sid).length;
  445. }
  446. this.ListCount = count;
  447. },
  448. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  449. if (columnIndex === 1) {
  450. if (rowIndex % this.ListCount === 0) {
  451. return {
  452. rowspan: this.ListCount,
  453. colspan: 1
  454. };
  455. } else {
  456. return {
  457. rowspan: 0,
  458. colspan: 0
  459. };
  460. }
  461. // if (columnIndex === 1) {
  462. // if (rowIndex % 2 === 0) {
  463. // return {
  464. // rowspan: 2,
  465. // colspan: 1
  466. // };
  467. // } else {
  468. // return {
  469. // rowspan: 0,
  470. // colspan: 0
  471. // };
  472. // }
  473. // }
  474. }
  475. }
  476. },
  477. mounted() {
  478. this.pageId = localStorage.getItem('indexs').split('-')[1];
  479. console.log(this.pageId)
  480. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  481. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  482. this.id = this.$route.query.id
  483. this.diId = parseInt(this.$route.query.diId)
  484. this.PostPageLinkCTable();
  485. this.initializeSelect();
  486. //this.OpCarTouristGuideGroundContenById();
  487. }
  488. }
  489. </script>
  490. <style>
  491. .communal-list {
  492. background-color: #fff;
  493. padding: 10px;
  494. box-shadow: 0 0 5px #0005;
  495. border-radius: 10px;
  496. }
  497. .car_add .communal-title {
  498. display: flex;
  499. font-size: 17px;
  500. font-weight: 600;
  501. color: #555;
  502. margin-bottom: 20px;
  503. justify-content: space-between;
  504. align-items: center;
  505. }
  506. .appraise-box {
  507. display: flex;
  508. flex-wrap: wrap;
  509. justify-content: space-between;
  510. margin: 50px 0;
  511. }
  512. .appraise-box>div {
  513. width: 30%;
  514. }
  515. .communal-box {
  516. display: flex;
  517. }
  518. .communal-box>button {
  519. margin-left: 10px;
  520. padding: 8px 20px;
  521. }
  522. .car_add {
  523. background-color: #fff;
  524. padding: 20px;
  525. box-shadow: 0 0 5px #0005;
  526. border-radius: 10px;
  527. }
  528. .el-input-number-style .el-input input {
  529. text-align: left;
  530. }
  531. .pice-ys .el-input-number {
  532. width: 250px;
  533. }
  534. @media screen and (max-width: 1700px) {
  535. .appraise-box>div {
  536. width: 48%;
  537. }
  538. .appraise-box>div el-form-item__content {
  539. width: 260px !important;
  540. }
  541. }
  542. .checkbox-style .el-checkbox {
  543. width: 120px;
  544. margin: 10px 10px;
  545. }
  546. </style>