From 188d4a764d8bcedf53ac67127b4b9e142f79b1eb Mon Sep 17 00:00:00 2001
From: linwenling <3256558519@qq.com>
Date: 星期日, 27 八月 2023 21:30:07 +0800
Subject: [PATCH] 旅游完善
---
ruoyi-ui/src/views/travel/Info.vue | 270 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 241 insertions(+), 29 deletions(-)
diff --git a/ruoyi-ui/src/views/travel/Info.vue b/ruoyi-ui/src/views/travel/Info.vue
index f3538b3..14ae47f 100644
--- a/ruoyi-ui/src/views/travel/Info.vue
+++ b/ruoyi-ui/src/views/travel/Info.vue
@@ -162,46 +162,45 @@
<!-- 娣诲姞鎴栦慨鏀硅祫浜т俊鎭厤缃璇濇 -->
- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+ <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px">
-
+ <h4 class="form-header">琛岀▼鍐呭 </h4>
+ <el-form-item label="鏍囬" prop="title">
+ <el-input v-model="formDat.title" placeholder="璇疯緭鍏ユ爣棰�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
<el-form-item label="鏃堕棿" prop="happenTime">
- <el-date-picker
+ <el-input
v-model='formDat.happenTime'
type='date'
placeholder='閫夋嫨鏃ユ湡'
- ></el-date-picker>
+ ></el-input>
</el-form-item>
<el-form-item label="鍦扮偣" prop="address">
<el-input v-model="formDat.address" placeholder="璇疯緭鍏ュ湴鐐�" clearable :style="{width: '100%'}" >
</el-input>
</el-form-item>
- <!-- <el-form-item label="鍦扮偣" prop="price">
- <el-select v-model="formDat.price" placeholder="璇烽�夋嫨鏀跺叆/鏀嚭" clearable :style="{width: '100%'}" >
- <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item> -->
<el-form-item label="浜虹墿" prop="people">
<el-input v-model="formDat.people" placeholder="璇疯緭鍏ヤ汉鐗�" clearable :style="{width: '100%'}" >
</el-input>
</el-form-item>
- <el-form-item label="鏍囬" prop="title">
- <el-input v-model="formDat.title" placeholder="璇疯緭鍏ユ爣棰�" clearable :style="{width: '100%'}" >
- </el-input>
- </el-form-item>
<el-form-item label="鏃呮湡" prop="travelPeriod">
- <el-input v-model="formDat.travelPeriod" placeholder="璇疯緭鍏ヤ娇鐢ㄤ汉" clearable :style="{width: '100%'}" >
+ <el-input v-model="formDat.travelPeriod" placeholder="璇疯緭鍏ユ梾鏈�" clearable :style="{width: '100%'}" >
</el-input>
</el-form-item>
<el-form-item label="鎸佽瘉鏃呮父" prop="certificate">
- <el-input v-model="formDat.certificate" placeholder="璇疯緭鍏ヨ瘉浠�" clearable :style="{width: '100%'}" >
- </el-input>
+ <el-select v-model="formDat.certificate" placeholder="璇烽�夋嫨璇佷欢" clearable :style="{width: '80%'}" >
+ <el-option label="灞呮皯韬唤璇�" value="灞呮皯韬唤璇�"></el-option>
+ <el-option label="涓存椂韬唤璇�" value="涓存椂韬唤璇�"></el-option>
+ <el-option label="鎴峰彛鏈�" value="鎴峰彛鏈�"></el-option>
+ <el-option label="鎶ょ収" value="鎶ょ収"></el-option>
+ <el-option label="瀛︾敓璇�" value="瀛︾敓璇�"></el-option>
+ </el-select>
</el-form-item>
- <el-form-item label="璐圭敤" prop="totalPrice">
+ <!-- <el-form-item label="璐圭敤" prop="totalPrice">
<el-input v-model="formDat.totalPrice" placeholder="璇疯緭鍏ユ�诲叡璐圭敤" clearable :style="{width: '100%'}" >
</el-input>
- </el-form-item>
+ </el-form-item> -->
<el-form-item label="鍏垂/鑷垂" prop="self">
<el-select v-model="formDat.self" placeholder="璇烽�夋嫨鑷垂/鍏垂" clearable :style="{width: '100%'}" >
<el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
@@ -211,6 +210,7 @@
<el-form-item label="澶囨敞" prop="remark">
<el-input v-model="formDat.remark" placeholder="璇疯緭鍏ュ娉�" clearable :style="{width: '100%'}" ></el-input>
</el-form-item>
+
<h4 class="form-header">鐩稿叧鍥剧墖 </h4>
<el-upload
@@ -269,6 +269,34 @@
</el-upload>
</el-form>
+ <el-form ref="elForm1" :model="formDat1" :rules="rules1" size="medium" label-width="100px">
+ <h4 class="form-header">璐圭敤鏄庣粏 </h4>
+ <el-form-item label="鍐呭" prop="content">
+ <el-input v-model="formDat1.content" placeholder="璇疯緭鍏ュ唴瀹�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+ <el-form-item label="浣忓璐圭敤" prop="stay">
+ <el-input v-model="formDat1.stay" placeholder="璇疯緭鍏ヤ綇瀹胯垂鐢�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+ <el-form-item label="浜ら�氳垂鐢�" prop="traffic">
+ <el-input v-model="formDat1.traffic" placeholder="璇疯緭鍏ヤ氦閫氳垂鐢�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+ <el-form-item label="椁愯垂" prop="eat">
+ <el-input v-model="formDat1.eat" placeholder="璇疯緭鍏ラ璐圭敤" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+ <el-form-item label="璐墿璐圭敤" prop="shopping">
+ <el-input v-model="formDat1.shopping" placeholder="璇疯緭鍏ヨ喘鐗╄垂鐢�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+ <el-form-item label="闂ㄧエ璐圭敤" prop="entrance">
+ <el-input v-model="formDat1.entrance" placeholder="璇疯緭鍏ラ棬绁ㄨ垂鐢�" clearable :style="{width: '100%'}" >
+ </el-input>
+ </el-form-item>
+
+ </el-form>
<h4 class="form-header"> </h4>
<div slot="footer" class="dialog-footer">
@@ -292,7 +320,7 @@
//鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁� --鎺ュソ浜�
-import {addTravelBase,listTravelBase,enload,delTravelBase, uploadPic} from "@/api/travel/index";
+import {addTravelBase,listTravelPrice,getTravelBaseInfo,listTravelBase,enload,delTravelBase, uploadPic,updateTravelPrice} from "@/api/travel/index";
export default {
name: "Role",
@@ -315,6 +343,7 @@
total: 0,
// 瀹跺ぇ浜嬭琛ㄦ牸鏁版嵁
travelBase: [],
+ detailList:[],
// 寮瑰嚭灞傛爣棰�
title: "",
// 鏄惁鏄剧ず寮瑰嚭灞�
@@ -347,6 +376,18 @@
self: undefined,
remark: undefined,
url: undefined,
+ },
+ formDat1: {
+ eat: undefined,
+ stay: undefined,
+ traffic: undefined,
+ entrance: undefined,
+ shopping:undefined,
+ content: undefined,
+ },
+ formDat2: {
+ id: undefined,
+ detailList: undefined,
},
// 鑿滃崟鍒楄〃
menuOptions: [],
@@ -413,6 +454,40 @@
}],
},
+ rules1: {
+ stay: [{
+ required: true,
+ message: '璇疯緭鍏ヤ汉鐗�',
+ trigger: 'blur'
+ }],
+
+ content: [{
+ required: true,
+ message: '璇疯緭鍏ュ湴鐐�',
+ trigger: 'blur'
+ }],
+ traffic: [{
+ required: true,
+ message: '璇疯緭鍏ユ爣棰�',
+ trigger: 'blur'
+ }],
+ entrance: [{
+ required: true,
+ message: '璇疯緭鍏ユ梾鏈�',
+ trigger: 'blur'
+ }],
+ eat: [{
+ required: true,
+ message: '璇疯緭鍏ヨ瘉浠�',
+ trigger: 'blur'
+ }],
+ shopping: [{
+ required: true,
+ message: '璇烽�夋嫨鏃ユ湡閫夋嫨',
+ trigger: 'change'
+ }],
+
+ },
typeOptions: [
{
value: '0',
@@ -436,8 +511,9 @@
},
created() {
- const id = this.$route.params && this.$route.params.id;
+ const id = this.$route.params && this.$route.params.id;
+ this.getList1();
this.getList(id);
},
@@ -491,11 +567,30 @@
// alert(123)
// console.log(response.data)
this.travelBase = response.data.data;
- console.log(this.travelBase)
+ // console.log(this.travelBase)
this.total = response.data.total;
this.loading = false;
}
);
+
+ },
+ getList1() {
+ this.loading = true;
+ const id = this.$route.params && this.$route.params.id;
+ return new Promise((resolve, reject) => {
+ listTravelPrice(this.queryParams).then(response => {
+ // console.log(response.data.data);
+ const filteredData = response.data.data.find(item => item.id === id);
+ this.total = response.data.total;
+ this.loading = false;
+ const detailList = filteredData.detailList;
+ // console.log(detailList);
+ resolve(detailList);
+ }).catch(error => {
+ console.error("璇锋眰閿欒:", error);
+ reject(error);
+ });
+ });
},
handleRemove(file) {
for(let i = 0; i < this.fileListOther.length; i++)
@@ -593,7 +688,14 @@
this.dialogVisible = true;
},
/** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */
- submitDataScope: function() {
+ submitDataScope: async function() {
+ this.formDat2.detailList = [];
+ console.log("璋冭瘯");
+ console.log(this.formDat2.detailList);
+ await this.getList1().then(detailList => {
+ this.formDat2.detailList = detailList;
+ console.log(this.formDat2.detailList);
+ });
let ul = this.fileList.map(function (elem){
return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
@@ -602,6 +704,24 @@
return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
}).join(",")
this.formDat.url = ul+","+uls
+ const fid = this.$route.params && this.$route.params.id;
+ this.formDat.feeId = this.$route.params && this.$route.params.id;
+ this.formDat1.happenTime = this.formDat.happenTime;
+ this.formDat2.detailList.push(this.formDat1);
+ this.formDat2.id = this.$route.params && this.$route.params.id;
+ const stay = parseFloat(this.formDat1.stay);
+ const traffic = parseFloat(this.formDat1.traffic);
+ const eat = parseFloat(this.formDat1.eat);
+ const shopping = parseFloat(this.formDat1.shopping);
+ const entrance = parseFloat(this.formDat1.entrance);
+
+ const totalPrice = stay + traffic + eat + shopping + entrance;
+ console.log("鎬昏垂鐢�");
+ console.log(totalPrice);
+ this.formDat.totalPrice=totalPrice;
+ console.log("111");
+ console.log(this.formDat2)
+
this.$refs["elForm"].validate(valid => {
if (valid) {
@@ -610,6 +730,18 @@
this.open = false;
this.getList(fid);
});
+
+ }
+ });
+ this.$refs["elForm1"].validate(valid => {
+ if (valid) {
+
+
+ updateTravelPrice(this.formDat2).then(response => {
+ this.$modal.msgSuccess("璐圭敤鏂板鎴愬姛");
+ this.open = false;
+ });
+
}
});
},
@@ -637,15 +769,95 @@
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
- handleDelete(row) {
+ async handleDelete(row) {
const Ids = row.id || this.ids;
- this.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() {
- return delTravelBase(Ids);
- }).then(() => {
- this.getList();
+ const id = row.id || this.ids;
+
+ try {
+ const response = await getTravelBaseInfo(id);
+ const baseDate = response.data.totalPrice;
+ console.log("112");
+ console.log(baseDate);
+
+ const detailList = await this.getList1();
+ this.detailList = detailList;
+ console.log(this.detailList);
+
+ const targetTotalCost = baseDate; // 鐩爣 totalCost 鍊�
+ let targetId = null; // 鐩爣鏁版嵁鐨� id
+
+ for (const detail of this.detailList) {
+ if (detail.totalCost === targetTotalCost) {
+ targetId = detail.id;
+ console.log(targetId);
+ break;
+ }
+ }
+
+ const detailList2 = this.detailList.filter((detail) => detail.id !== targetId);
+ console.log(detailList2);
+ const formDat3 = {}
+ formDat3.detailList = detailList2
+ const id2 = this.$route.params && this.$route.params.id;
+ console.log(id2);
+ formDat3.id = id2;
+ console.log(formDat3);
+ await updateTravelPrice(formDat3);
+ this.open = false;
+
+ await delTravelBase(Ids);
+ const fid = this.queryParams.fid
+ this.getList(fid);
this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- }).catch(() => {});
+ } catch (error) {
+ console.error(error);
+ }
},
+// async handleDelete(row) {
+// const Ids = row.id || this.ids;
+// const id = row.id ||this.ids
+// await getTravelBaseInfo(id).then(async (response) => {
+// const baseDate = response.data.totalPrice;
+// console.log("112");
+// console.log(baseDate);
+
+// // 鑾峰彇璇︾粏鍒楄〃
+// await this.getList1().then((detailList) => {
+// this.detailList = detailList;
+// console.log(this.detailList);
+
+// const targetTotalCost = baseDate; // 鐩爣 totalCost 鍊�
+// let targetId = null; // 鐩爣鏁版嵁鐨� id
+
+// for (const detail of this.detailList) {
+// if (detail.totalCost === targetTotalCost) {
+// targetId = detail.id;
+// console.log(targetId);
+// break;
+// }
+// }
+// const detailList2 = [...this.detailList].filter((detail) => {
+// return detail.id !== targetId;
+// });
+// console.log(detailList2);
+// const id2 = this.$route.params && this.$route.params.id;
+// console.log(id2);
+// detailList2.id = id2
+// console.log(typeof detailList2);
+// debugger
+// updateTravelPrice(detailList2).then(response => {
+// this.open = false;
+// });
+// });
+// });
+// this.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() {
+// return delTravelBase(Ids);
+
+// }).then(() => {
+// this.getList(fid);
+// this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+// }).catch(() => {});
+// },
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
const Ids = this.ids;
--
Gitblit v1.9.1