酒店预订平台
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

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