酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

617 lines
28 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <!-- import CSS -->
  6. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  7. </head>
  8. <body>
  9. <div id="app" class="table">
  10. <div>
  11. <div class="header-search">
  12. <span>名称:</span>
  13. <el-input v-model="search.name" style="width: 150px;" placeholder="请输入内容"></el-input>
  14. <span>状态</span>
  15. <el-select v-model="search.status" placeholder="请选择" clearable>
  16. <el-option
  17. v-for="item in status"
  18. :key="item.id"
  19. :label="item.value"
  20. :value="item.id">
  21. </el-option>
  22. </el-select>
  23. <span>金额</span>
  24. <el-input-number v-model="search.startMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
  25. ~
  26. <el-input-number v-model="search.endMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
  27. <el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
  28. <el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增收款单</el-button>
  29. </div>
  30. <el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark"
  31. style="font-size:12px;width: 100%;margin-top: 12px">
  32. <el-table-column prop="create_id" label="创建人" min-width="70" :formatter="getUserName"></el-table-column>
  33. <el-table-column prop="id" label="收款单号" min-width="50"></el-table-column>
  34. <el-table-column prop="name" label="收款单名称" min-width="120"></el-table-column>
  35. <el-table-column prop="status" label="收款单状态" :formatter="getStatusName" min-width="140">
  36. <template slot-scope="scope">
  37. <el-radio-group v-model="scope.row.status" size="mini" @change="setStatus(scope.row)">
  38. <el-radio-button label="0">未收款</el-radio-button>
  39. <el-radio-button label="1">收款中</el-radio-button>
  40. <el-radio-button label="2">已收款</el-radio-button>
  41. </el-radio-group>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="order_ids" label="关联订单" min-width="150"></el-table-column>
  45. <el-table-column prop="total_amount" label="金额" min-width="60"></el-table-column>
  46. <el-table-column prop="create_time" label="创建时间" min-width="80"></el-table-column>
  47. <el-table-column prop="update_time" label="更新时间" min-width="80"></el-table-column>
  48. <el-table-column label="操作" min-width="180">
  49. <template slot-scope="scope">
  50. <el-button-group>
  51. <el-button type="primary" size="mini" @click="edit(scope.row)" icon="el-icon-edit">编辑</el-button>
  52. <el-button type="success" size="mini" @click="editOrderDivShow(scope.row)" icon="el-icon-share">订单</el-button>
  53. <el-button type="danger" size="mini" icon="el-icon-delete" @click="delAll(scope.row.id)">删除</el-button>
  54. </el-button-group>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <el-pagination
  59. :page-size="search.pageSize"
  60. :pager-count="11"
  61. layout="total, sizes, prev, pager, next, jumper"
  62. :total="total"
  63. :current-page="search.pageNum"
  64. :page-sizes="[10, 20, 30, 40, 50]"
  65. @size-change="sizeChange"
  66. @current-change="getData"
  67. @prev-click="getData"
  68. @next-click="getData"
  69. ></el-pagination>
  70. </div>
  71. <transition name="bounce" v-if="editShow">
  72. <el-dialog title="收款单详情" :visible.sync="editShow" width="90%" top="15px">
  73. <el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 20px">
  74. <div style="display: flex;width: 100%">
  75. <el-form-item v-if="editType" label="收款单ID:" style="width: 80%">
  76. <div v-html="editData.id"></div>
  77. </el-form-item>
  78. </div>
  79. <div>
  80. <el-form-item label="收款单名称:" style="width: 80%">
  81. <el-input v-model="editData.name" style="width: 150px;" placeholder="请输入内容"></el-input>
  82. </el-form-item>
  83. </div>
  84. <div>
  85. <el-form-item v-if="editType" label="收款单状态:" style="width: 80%">
  86. <el-radio-group v-model="editData.status" size="mini" disabled>
  87. <el-radio-button label="0">未收款</el-radio-button>
  88. <el-radio-button label="1">收款中</el-radio-button>
  89. <el-radio-button label="2">已收款</el-radio-button>
  90. </el-radio-group>
  91. </el-form-item>
  92. </div>
  93. <div>
  94. <el-button type="primary" @click="editDoing()" >保存</el-button>
  95. </div>
  96. </el-form>
  97. </el-dialog>
  98. </transition>
  99. <transition name="bounce" v-if="editOrderShow">
  100. <el-dialog title="详情" :visible.sync="editOrderShow" width="90%" top="15px">
  101. <el-form ref="form" label-width="100px" style="width: 100%;padding-bottom: 10px">
  102. <div style="display: flex;width: 100%">
  103. <el-form-item label="收款单ID:" style="width: 80%">
  104. <div v-html="editOrder.id"></div>
  105. </el-form-item>
  106. <el-form-item label="收款单名称:" style="width: 80%">
  107. <div v-html="editOrder.name"></div>
  108. </el-form-item>
  109. <el-form-item label="收款单状态:" style="width: 80%">
  110. <el-radio-group v-model="editOrder.status" size="mini" disabled>
  111. <el-radio-button label="0">未收款</el-radio-button>
  112. <el-radio-button label="1">收款中</el-radio-button>
  113. <el-radio-button label="2">已收款</el-radio-button>
  114. </el-radio-group>
  115. </el-form-item>
  116. </div>
  117. </el-form>
  118. <div>
  119. <div class="header-search" style="width: 100%;margin-bottom: 10px">
  120. <span>订单ID:</span>
  121. <el-input v-model="orderMainListSearch.order_id" style="width: 150px;" placeholder="请输入内容"></el-input>
  122. <span>订单状态:</span>
  123. <el-select v-model="orderMainListSearch.order_status" style="width: 150px;" placeholder="请选择" clearable>
  124. <el-option
  125. v-for="item in orderMainStatus"
  126. :key="item.id"
  127. :label="item.name"
  128. :value="item.id">
  129. </el-option>
  130. </el-select>
  131. <span>收款单状态</span>
  132. <el-select v-model="orderMainListSearch.inReceipt" style="width: 150px;" placeholder="请选择" clearable>
  133. <el-option
  134. v-for="item in inReceipt"
  135. :key="item.id"
  136. :label="item.name"
  137. :value="item.id">
  138. </el-option>
  139. </el-select>
  140. </div>
  141. <div class="header-search" style="width: 100%;margin-bottom: 10px">
  142. <span>用户名</span>
  143. <el-input v-model="orderMainListSearch.user_name" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
  144. <span>渠道:</span>
  145. <el-select v-model="orderMainListSearch.channel_id" style="width: 150px;" placeholder="请选择" clearable>
  146. <el-option
  147. v-for="item in channelList"
  148. :key="item.id"
  149. :label="item.name"
  150. :value="item.id">
  151. </el-option>
  152. </el-select>
  153. <span>渠道订单号:</span>
  154. <el-input v-model="orderMainListSearch.channel_order_no" style="width: 150px;" placeholder="请输入内容"></el-input>
  155. <span>专员</span>
  156. <el-select v-model="orderMainListSearch.commissioner_id" style="width: 150px;" placeholder="请选择" clearable>
  157. <el-option
  158. v-for="item in userList"
  159. :key="item.id"
  160. :label="item.name"
  161. :value="item.id">
  162. </el-option>
  163. </el-select>
  164. <span>下单人</span>
  165. <el-select v-model="orderMainListSearch.create_id" style="width: 150px;" placeholder="请选择" clearable>
  166. <el-option
  167. v-for="item in userList"
  168. :key="item.id"
  169. :label="item.name"
  170. :value="item.id">
  171. </el-option>
  172. </el-select>
  173. </div>
  174. <div class="header-search" style="width: 100%;margin-bottom: 10px">
  175. <span>手机号</span>
  176. <el-input v-model="orderMainListSearch.user_phone" style="width: 150px;" placeholder="请输入内容" clearable></el-input>
  177. <span>金额</span>
  178. <el-input-number v-model="orderMainListSearch.startMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
  179. ~
  180. <el-input-number v-model="orderMainListSearch.endMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
  181. <span>时间</span>
  182. <el-date-picker
  183. style="width: 150px;"
  184. v-model="orderMainListSearch.startTime"
  185. type="date"
  186. value-format="yyyy-MM-dd"
  187. :picker-options="pickerOptions"
  188. placeholder="选择日期">
  189. </el-date-picker>
  190. ~
  191. <el-date-picker
  192. style="width: 150px;"
  193. v-model="orderMainListSearch.endTime"
  194. value-format="yyyy-MM-dd"
  195. type="date"
  196. :picker-options="pickerOptions"
  197. placeholder="选择日期">
  198. </el-date-picker>
  199. <el-button type="primary" icon="el-icon-search" @click="getOrderMainData(1)">搜索</el-button>
  200. </div>
  201. <div>
  202. <el-table ref="multipleTable" :data="orderMainList" border tooltip-effect="dark" style="font-size:12px;width: 100%;margin-top: 12px" @selection-change="handleSelectionChange">
  203. <el-table-column type="selection" width="30" :selectable="checkSelect"></el-table-column>
  204. <el-table-column prop="id" label="订单ID" min-width="40" ></el-table-column>
  205. <el-table-column prop="commissioner" label="专员" min-width="40" ></el-table-column>
  206. <el-table-column prop="channel_name" label="渠道" min-width="80" ></el-table-column>
  207. <el-table-column prop="channel_order_no" label="渠道订单号" min-width="90" ></el-table-column>
  208. <el-table-column prop="create_id" label="下单人" min-width="50" :formatter="getUserName"></el-table-column>
  209. <el-table-column prop="user_name" label="用户名称" min-width="50" ></el-table-column>
  210. <el-table-column prop="user_phone" label="手机号" min-width="60" ></el-table-column>
  211. <el-table-column prop="total_amount" label="总金额" min-width="40" ></el-table-column>
  212. <el-table-column prop="order_status" label="状态" min-width="40" :formatter="getOrderMainStatus"></el-table-column>
  213. <el-table-column prop="create_time" label="下单时间" min-width="80" ></el-table-column>
  214. <el-table-column prop="receipt_order_id" label="收款单ID" min-width="40" ></el-table-column>
  215. <el-table-column prop="receipt_order_name" label="收款单名称" min-width="80" ></el-table-column>
  216. <el-table-column label="操作" >
  217. <template slot-scope="scope">
  218. <el-button-group>
  219. <el-button type="primary" size="mini" v-if="scope.row.receipt_order_id==0 && editOrder.status==0" @click="addOrderMain(scope.row.id)" icon="el-icon-edit">添加</el-button>
  220. <el-button type="danger" size="mini" v-if="scope.row.receipt_order_id==editOrder.id && editOrder.status==0" @click="removeOrderMain(scope.row.id)" icon="el-icon-delete">移除</el-button>
  221. </el-button-group>
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. <div style="margin-top: 5px">
  226. <el-button type="primary" icon="el-icon-circle-plus" @click="addOrderAll()" :disabled="multipleSelection.length==0">添加到采购单</el-button>
  227. </div>
  228. <el-pagination
  229. :page-size="orderMainListSearch.pageSize"
  230. :pager-count="11"
  231. layout="total, sizes, prev, pager, next, jumper"
  232. :total="orderMainTotal"
  233. :current-page="orderMainListSearch.pageNum"
  234. :page-sizes="[10, 20, 30, 40, 50]"
  235. @size-change="sizeOrderMainChange"
  236. @current-change="getOrderMainData"
  237. @prev-click="getOrderMainData"
  238. @next-click="getOrderMainData"
  239. ></el-pagination>
  240. </div>
  241. </div>
  242. </el-dialog>
  243. </transition>
  244. </div>
  245. </body>
  246. <!-- import Vue before Element -->
  247. <script src="/assets/js/vue/vue.js"></script>
  248. <!-- import JavaScript -->
  249. <script src="/assets/js/vue/index.js"></script>
  250. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  251. <script>
  252. new Vue({
  253. el: '#app',
  254. data: function () {
  255. return {
  256. search: {
  257. name: "",
  258. status: "all",
  259. startMoney:0,
  260. endMoney:0,
  261. pageSize: 10,
  262. pageNum: 1
  263. },
  264. status: [
  265. {"id": "all", "value": "请选择"},
  266. {"id": 0, 'value': "未收款"},
  267. {"id": 1, 'value': "收款中"},
  268. {"id": 2, 'value': "已收款"}
  269. ],
  270. total: 0,
  271. tableData: [],
  272. userList: [],
  273. info: {
  274. id: null,
  275. name: "",
  276. status: 0,
  277. list: []
  278. },
  279. editShow: false,
  280. editType: false,
  281. editData: {},
  282. editOrderShow:false,
  283. editOrder:{},
  284. orderMainListSearch:{
  285. "receipt_order_id":"",
  286. "inReceipt":"",
  287. "order_id":"",
  288. "channel_order_no":"",
  289. "channel_id":"",
  290. "order_status":"",
  291. "commissioner_id":"",
  292. "user_name":"",
  293. "user_phone":"",
  294. "create_id":"",
  295. "startMoney":"",
  296. "endMoney":"",
  297. "startTime":"",
  298. "endTime":"",
  299. "pageNum":1,
  300. "pageSize":10
  301. },
  302. orderMainTotal:0,
  303. orderMainList:[],
  304. inReceipt:[
  305. {id:1,name:"在此收款单中"},
  306. {id:2,name:"不在此收款单中"},
  307. {id:3,name:"不在任何收款单中"}
  308. ],
  309. //0待处理 1已确认 2部分取消 10已完成 11已取消
  310. orderMainStatus:[
  311. {id:0,name:"待处理"},
  312. {id:1,name:"已确认"},
  313. {id:2,name:"部分取消"},
  314. {id:3,name:"处理中"},
  315. {id:10,name:"已完成"},
  316. {id:11,name:"已取消"}
  317. ],
  318. channelList:[],
  319. multipleSelection: [],
  320. pickerOptions: {
  321. shortcuts: [{
  322. text: '今天',
  323. onClick(picker) {
  324. picker.$emit('pick', new Date());
  325. }
  326. }, {
  327. text: '昨天',
  328. onClick(picker) {
  329. const date = new Date();
  330. date.setTime(date.getTime() - 3600 * 1000 * 24);
  331. picker.$emit('pick', date);
  332. }
  333. }, {
  334. text: '一周前',
  335. onClick(picker) {
  336. const date = new Date();
  337. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  338. picker.$emit('pick', date);
  339. }
  340. }]
  341. },
  342. }
  343. },
  344. created() {
  345. this.getAdminUser();
  346. this.getChannelList();
  347. this.getData(1)
  348. },
  349. methods: {
  350. checkSelect(row,index){
  351. if (this.editOrder.status != 0) {
  352. return false;
  353. }
  354. if (row.receipt_order_id ==0) {
  355. return true;
  356. }
  357. return false;
  358. },
  359. handleSelectionChange(val) {
  360. this.multipleSelection = val;
  361. },
  362. getChannelList(){
  363. axios.post("/hotel.php/cf_channel_info/getList", this.search).then((response) => {
  364. console.log(response)
  365. let data = response.data;
  366. this.channelList = data.list;
  367. }).catch(function (error) {
  368. console.log(error);
  369. });
  370. },
  371. getStatusName(info) {
  372. for (let i = 0; i < this.status.length; i++) {
  373. if (this.status[i].id == info.status) {
  374. return this.status[i].value
  375. }
  376. }
  377. return "-"
  378. },
  379. getUserName(info) {
  380. for (let i = 0; i < this.userList.length; i++) {
  381. if (this.userList[i].id == info.create_id) {
  382. return this.userList[i].name
  383. }
  384. }
  385. return "-"
  386. },
  387. getOrderMainStatus(info){
  388. for (let i = 0; i < this.orderMainStatus.length; i++) {
  389. if (this.orderMainStatus[i].id == info.order_status) {
  390. return this.orderMainStatus[i].name
  391. }
  392. }
  393. return "-"
  394. },
  395. sizeChange(pageSize) {
  396. this.search.pageSize = pageSize;
  397. this.getData(this.search.pageNum)
  398. },
  399. sizeOrderMainChange(pageSize) {
  400. this.orderMainListSearch.pageSize = pageSize;
  401. this.getOrderMainData(this.orderMainListSearch.pageNum)
  402. },
  403. //獲取列表
  404. getData(page) {
  405. this.search.pageNum = page;
  406. axios.post("/hotel.php/receipt_order/getList", this.search).then((response) => {
  407. let data = response.data;
  408. console.log(this.tableData);
  409. if (data.flag) {
  410. this.tableData = data.data.list;
  411. this.total = data.data.total;
  412. console.log(this.tableData);
  413. } else {
  414. this.$message.error(response.msg);
  415. }
  416. }).catch(function (error) {
  417. console.log(error);
  418. });
  419. },
  420. getAdminUser() {
  421. axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => {
  422. this.userList = response.data.list;
  423. }).catch(function (error) {
  424. console.log(error);
  425. });
  426. },
  427. edit(info) {
  428. if (info == null) {
  429. this.editType = false;
  430. this.editData = {
  431. name: ""
  432. }
  433. } else {
  434. this.editType = true;
  435. this.editData = {
  436. id:info.id,
  437. name: info.name,
  438. status:info.status
  439. }
  440. }
  441. this.editShow = true;
  442. },
  443. editDoing(){
  444. axios.post("/hotel.php/receipt_order/save", this.editData).then( (response)=> {
  445. let data = response.data;
  446. console.log(this.tableData);
  447. if (data.flag) {
  448. this.$message.success("保存成功");
  449. this.editShow = false;
  450. this.getData(1);
  451. } else {
  452. this.$message.error(data.msg);
  453. }
  454. }).catch(function (error) {
  455. this.$message.error("保存失败");
  456. console.log(error);
  457. });
  458. },
  459. setStatus(info){
  460. this.$confirm('确定修改状态?', '提示', {
  461. confirmButtonText: '确定',
  462. cancelButtonText: '取消',
  463. type: 'warning'
  464. }).then(() => {
  465. axios.post("/hotel.php/receipt_order/setStatus", info).then( (response)=> {
  466. let data = response.data;
  467. if (data.flag) {
  468. this.$message.success("保存成功");
  469. } else {
  470. this.$message.error(data.msg);
  471. this.getData(this.search.pageNum)
  472. }
  473. }).catch(function (error) {
  474. this.$message.error("保存失败");
  475. console.log(error);
  476. this.getData(this.search.pageNum)
  477. });
  478. }).catch(() => {
  479. this.$message.success("已取消");
  480. this.getData(this.search.pageNum)
  481. })
  482. },
  483. editOrderDivShow(info){
  484. console.log(info);
  485. this.editOrder = info;
  486. this.orderMainListSearch.receipt_order_id = info.id;
  487. this.orderMainList=[];
  488. this.getOrderMainData(1);
  489. this.editOrderShow = true;
  490. },
  491. getOrderMainData(page){
  492. this.orderMainListSearch.pageNum = page;
  493. axios.post("/hotel.php/receipt_order/getOrderMainList", this.orderMainListSearch).then((response) => {
  494. let data = response.data;
  495. console.log(this.tableData);
  496. if (data.flag) {
  497. this.orderMainList = data.data.list;
  498. this.orderMainTotal = data.data.total;
  499. console.log(this.orderMainList);
  500. } else {
  501. this.$message.error(data.msg);
  502. }
  503. }).catch(function (error) {
  504. console.log(error);
  505. });
  506. },
  507. addOrderMain(order_id){
  508. let param = {
  509. order_id:order_id,
  510. id:this.editOrder.id
  511. }
  512. axios.post("/hotel.php/receipt_order/addOrderMain", param).then((response) => {
  513. let data = response.data;
  514. if (data.flag) {
  515. this.$message.success("保存成功");
  516. this.getOrderMainData(this.orderMainListSearch.pageNum)
  517. this.getData(this.search.pageNum)
  518. } else {
  519. this.$message.error(data.msg);
  520. }
  521. }).catch(function (error) {
  522. console.log(error);
  523. });
  524. },
  525. addOrderAll(){
  526. let orderId = "";
  527. let length = this.multipleSelection.length;
  528. for (var k = 0; k < length; k++) {
  529. if (orderId == "") {
  530. orderId = this.multipleSelection[k].id;
  531. continue;
  532. }
  533. orderId =orderId+","+this.multipleSelection[k].id;
  534. }
  535. this.addOrderMain(orderId);
  536. },
  537. removeOrderMain(order_id){
  538. let param = {
  539. order_id:order_id,
  540. id:this.editOrder.id
  541. }
  542. axios.post("/hotel.php/receipt_order/removeOrderMain", param).then((response) => {
  543. let data = response.data;
  544. if (data.flag) {
  545. this.$message.success("移除成功");
  546. this.getOrderMainData(this.orderMainListSearch.pageNum)
  547. this.getData(this.search.pageNum)
  548. } else {
  549. this.$message.error(data.msg);
  550. }
  551. }).catch(function (error) {
  552. console.log(error);
  553. });
  554. },
  555. delAll(id){
  556. let param = {
  557. id:id
  558. }
  559. this.$confirm('确定删除采购单?', '提示', {
  560. confirmButtonText: '确定',
  561. cancelButtonText: '取消',
  562. type: 'warning'
  563. }).then(() => {
  564. axios.post("/hotel.php/receipt_order/delAll", param).then((response) => {
  565. let data = response.data;
  566. if (data.flag) {
  567. this.$message.success("移除成功");
  568. this.getData(this.search.pageNum)
  569. } else {
  570. this.$message.error(data.msg);
  571. }
  572. }).catch(function (error) {
  573. console.log(error);
  574. });
  575. }).catch(() => {
  576. this.$message.info("保存成功");
  577. });
  578. }
  579. }
  580. })
  581. </script>
  582. <style lang="scss" scoped>
  583. .el-table thead {
  584. background-color: #5a5e66 !important;
  585. }
  586. .header-search {
  587. font-size: 14px;
  588. font-weight: 900;
  589. }
  590. body {
  591. background-color: white;
  592. }
  593. .table {
  594. width: 100%;
  595. font-size: 12px;
  596. margin-top: 12px;
  597. background-color: white;
  598. }
  599. .el-form-item{
  600. margin-bottom: 5px !important;
  601. }
  602. </style>
  603. </html>