CarTouristGuideGrounContent.vue 25 KB

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