CarTouristGuideGrounContent.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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%">
  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 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. }
  228. },
  229. methods: {
  230. //初始化下拉框
  231. initializeSelect() {
  232. //团组下拉框绑定
  233. var url = "/api/Groups/CarTouristGuideGroundContentInitialize"
  234. var that = this
  235. this.$axios({
  236. method: 'post',
  237. url: url,
  238. headers: {
  239. Authorization: 'Bearer ' + this.token
  240. },
  241. data: {
  242. userId: that.userId,
  243. id: that.id,
  244. }
  245. }).then(function (res) {
  246. if (res.data.code == 200) {
  247. console.log(res)
  248. that.delegationInfoList = res.data.data.delegations;
  249. for (let index = 0; index < that.delegationInfoList.length; index++) {
  250. if (that.delegationInfoList[index].id == that.diId) {
  251. that.delegationInfo = that.delegationInfoList[index];
  252. break;
  253. }
  254. }
  255. //that.ContentList = res.data.data.carTouristGuides;
  256. that.sourceList = res.data.data.carTouristGuides;
  257. that.payment = res.data.data.payment;
  258. var CreditCardPayment = res.data.data.creditCardPayment;
  259. if (CreditCardPayment != null) {
  260. that.OPContenData.payDId = CreditCardPayment.payDId
  261. that.OPContenData.payee = CreditCardPayment.payee
  262. that.currency = CreditCardPayment.paymentCurrency
  263. that.OPContenData.payPercentage = CreditCardPayment.payPercentage
  264. that.countCost = CreditCardPayment.payMoney
  265. that.OPContenData.orbitalPrivateTransfer = CreditCardPayment.orbitalPrivateTransfer
  266. that.IsAuditGM = CreditCardPayment.isAuditGM;
  267. }
  268. that.unitsArr = res.data.data.ssdv;
  269. var start = new Date(res.data.data.start).getTime();
  270. var end = new Date(res.data.data.end).getTime();
  271. that.startPickerOptions.disabledDate = (time) => {
  272. return time.getTime() < start || time.getTime() > end;
  273. }
  274. that.checkList = res.data.data.checkedItem;
  275. that.checkBoxChange();
  276. that.loading = false;
  277. //that.OpCarTouristGuideGroundContenById()
  278. } else {
  279. this.$message.error('初始化失败' + res.data.msg);
  280. }
  281. })
  282. },
  283. //获取ctable
  284. PostPageLinkCTable() {
  285. var url = "/api/Business/PostPageLinkCTable"
  286. var that = this
  287. this.$axios({
  288. method: 'post',
  289. url: url,
  290. headers: {
  291. Authorization: 'Bearer ' + this.token
  292. },
  293. data: {
  294. pageId: that.pageId,
  295. }
  296. }).then(function (res) {
  297. if (res.data.code == 200) {
  298. that.cTable = res.data.data.cTable
  299. that.PostGroupTeamRateByDiIdAndCTableId();
  300. }
  301. })
  302. },
  303. //获取团组币种
  304. PostGroupTeamRateByDiIdAndCTableId() {
  305. var url = "/api/Business/PostGroupTeamRateByDiIdAndCTableId"
  306. var that = this
  307. this.$axios({
  308. method: 'post',
  309. url: url,
  310. headers: {
  311. Authorization: 'Bearer ' + this.token
  312. },
  313. data: {
  314. portType: 1,
  315. diId: that.diId,
  316. cTable: that.cTable,
  317. }
  318. }).then(function (res) {
  319. console.log(res)
  320. if (res.data.code == 200) {
  321. that.currencyList = res.data.data.teamRates;
  322. that.currency = that.currencyList[0].currencyId;
  323. }
  324. })
  325. },
  326. // OpCarTouristGuideGroundContenById() {
  327. // var url = "/api/Groups/OpCarTouristGuideGroundContentById"
  328. // var that = this
  329. // this.$axios({
  330. // method: 'post',
  331. // url: url,
  332. // headers: {
  333. // Authorization: 'Bearer ' + this.token
  334. // },
  335. // data: {
  336. // id: that.id
  337. // }
  338. // }).then(function (res) {
  339. // if (res.data.code == 200) {
  340. // var CarTouristsContent = res.data.data.carTouristsContent;
  341. // if (CarTouristsContent.length != 0) {
  342. // CarTouristsContent.forEach(function (item) {
  343. // that.ContentList.forEach(function (item1) {
  344. // if (item.sId == item1.sId) {
  345. // item1.id = item.id
  346. // item1.price = item.price
  347. // item1.priceContent = item.priceContent
  348. // //item1.remark = item.remark
  349. // }
  350. // })
  351. // })
  352. // }
  353. // that.loading = false
  354. // }
  355. // })
  356. // },
  357. addBtn() {
  358. if (this.IsAuditGM == 1) {
  359. this.$message.error('已通过审核,不可修改!');
  360. } else {
  361. if (this.diId == null && this.diId == undefined && this.diId == "") {
  362. this.$message.error("请选择团组名称");
  363. return;
  364. } else {
  365. var that = this
  366. that.$refs.OPContenData.validate((valid) => {
  367. if (valid) {
  368. that.OPContenData.diId = that.diId;
  369. that.OPContenData.cTGGRId = that.id;
  370. that.OPContenData.currency = that.currency;
  371. that.OPContenData.CreateUserId = that.userId;
  372. that.OPContenData.selectCheck = that.checkList;
  373. that.OPContenData.OPContentList = [];
  374. that.ContentList.forEach(function (item) {
  375. that.OPContenData.OPContentList.push({
  376. id: item.id,
  377. sId: item.sId,
  378. price: item.price,
  379. priceContent: item.priceContent,
  380. datePrice: item.datePrice,
  381. count: item.count,
  382. units: item.units,
  383. //remark: item.remark,
  384. })
  385. })
  386. var url = "/api/Groups/OpCarTouristGuideGroundContent"
  387. that.$axios({
  388. method: 'post',
  389. url: url,
  390. headers: {
  391. Authorization: 'Bearer ' + that.token
  392. },
  393. data: that.OPContenData
  394. }).then(function (res) {
  395. if (res.data.code == 200) {
  396. that.$message({
  397. message: res.data.msg,
  398. type: 'success'
  399. });
  400. that.EscAdd();
  401. } else {
  402. that.$message.error(res.data.msg);
  403. }
  404. })
  405. } else {
  406. this.$message.error('请完善信息在保存!');
  407. return false;
  408. }
  409. })
  410. }
  411. }
  412. },
  413. EscAdd() {
  414. this.$router.push({
  415. path: "/home/CarTouristGuideGroundId",
  416. query: {
  417. diId: this.diId
  418. }
  419. })
  420. },
  421. PriceChange() {
  422. var countCost = 0;
  423. this.ContentList.forEach(function (item) {
  424. if (item.price) {
  425. countCost += parseFloat(item.price)
  426. }
  427. })
  428. this.countCost = countCost
  429. },
  430. checkBoxChange() {
  431. this.ContentList = [];
  432. for (var soure = 0; soure < this.sourceList.length; soure++) {
  433. for (var item = 0; item < this.checkList.length; item++) {
  434. if (this.sourceList[soure].sidName == this.checkList[item]) {
  435. this.ContentList.push(this.sourceList[soure]);
  436. }
  437. }
  438. }
  439. this.PriceChange();
  440. }
  441. },
  442. mounted() {
  443. this.pageId = localStorage.getItem('indexs').split('-')[1];
  444. console.log(this.pageId)
  445. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  446. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  447. this.id = this.$route.query.id
  448. this.diId = parseInt(this.$route.query.diId)
  449. this.PostPageLinkCTable();
  450. this.initializeSelect();
  451. //this.OpCarTouristGuideGroundContenById();
  452. }
  453. }
  454. </script>
  455. <style>
  456. .communal-list {
  457. background-color: #fff;
  458. padding: 10px;
  459. box-shadow: 0 0 5px #0005;
  460. border-radius: 10px;
  461. }
  462. .car_add .communal-title {
  463. display: flex;
  464. font-size: 17px;
  465. font-weight: 600;
  466. color: #555;
  467. margin-bottom: 20px;
  468. justify-content: space-between;
  469. align-items: center;
  470. }
  471. .appraise-box {
  472. display: flex;
  473. flex-wrap: wrap;
  474. justify-content: space-between;
  475. margin: 50px 0;
  476. }
  477. .appraise-box>div {
  478. width: 30%;
  479. }
  480. .communal-box {
  481. display: flex;
  482. }
  483. .communal-box>button {
  484. margin-left: 10px;
  485. padding: 8px 20px;
  486. }
  487. .car_add {
  488. background-color: #fff;
  489. padding: 20px;
  490. box-shadow: 0 0 5px #0005;
  491. border-radius: 10px;
  492. }
  493. .el-input-number-style .el-input input {
  494. text-align: left;
  495. }
  496. .pice-ys .el-input-number {
  497. width: 250px;
  498. }
  499. @media screen and (max-width: 1700px) {
  500. .appraise-box>div {
  501. width: 48%;
  502. }
  503. .appraise-box>div el-form-item__content {
  504. width: 260px !important;
  505. }
  506. }
  507. .checkbox-style .el-checkbox {
  508. width: 120px;
  509. margin: 10px 10px;
  510. }
  511. </style>