酒店预订平台
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.
 
 
 
 
 
 

642 lines
29 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. disabledDate(time) {
  322. return time.getTime() > Date.now();
  323. },
  324. shortcuts: [{
  325. text: '今天',
  326. onClick(picker) {
  327. picker.$emit('pick', new Date());
  328. }
  329. }, {
  330. text: '昨天',
  331. onClick(picker) {
  332. const date = new Date();
  333. date.setTime(date.getTime() - 3600 * 1000 * 24);
  334. picker.$emit('pick', date);
  335. }
  336. }, {
  337. text: '一周前',
  338. onClick(picker) {
  339. const date = new Date();
  340. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  341. picker.$emit('pick', date);
  342. }
  343. }]
  344. },
  345. }
  346. },
  347. created() {
  348. this.getAdminUser();
  349. this.getChannelList();
  350. this.getData(1)
  351. },
  352. methods: {
  353. checkSelect(row,index){
  354. if (this.editOrder.status != 0) {
  355. return false;
  356. }
  357. if (row.receipt_order_id ==0) {
  358. return true;
  359. }
  360. return false;
  361. },
  362. handleSelectionChange(val) {
  363. this.multipleSelection = val;
  364. },
  365. getChannelList(){
  366. axios.post("/hotel.php/cf_channel_info/getList", this.search).then((response) => {
  367. console.log(response)
  368. let data = response.data;
  369. this.channelList = data.list;
  370. }).catch(function (error) {
  371. console.log(error);
  372. });
  373. },
  374. getStatusName(info) {
  375. for (let i = 0; i < this.status.length; i++) {
  376. if (this.status[i].id == info.status) {
  377. return this.status[i].value
  378. }
  379. }
  380. return "-"
  381. },
  382. getUserName(info) {
  383. for (let i = 0; i < this.userList.length; i++) {
  384. if (this.userList[i].id == info.create_id) {
  385. return this.userList[i].name
  386. }
  387. }
  388. return "-"
  389. },
  390. getOrderMainStatus(info){
  391. for (let i = 0; i < this.orderMainStatus.length; i++) {
  392. if (this.orderMainStatus[i].id == info.order_status) {
  393. return this.orderMainStatus[i].name
  394. }
  395. }
  396. return "-"
  397. },
  398. sizeChange(pageSize) {
  399. this.search.pageSize = pageSize;
  400. this.getData(this.search.pageNum)
  401. },
  402. sizeOrderMainChange(pageSize) {
  403. this.orderMainListSearch.pageSize = pageSize;
  404. this.getOrderMainData(this.orderMainListSearch.pageNum)
  405. },
  406. //獲取列表
  407. getData(page) {
  408. this.search.pageNum = page;
  409. axios.post("/hotel.php/receipt_order/getList", this.search).then((response) => {
  410. let data = response.data;
  411. console.log(this.tableData);
  412. if (data.flag) {
  413. this.tableData = data.data.list;
  414. this.total = data.data.total;
  415. console.log(this.tableData);
  416. } else {
  417. this.$message.error(response.msg);
  418. }
  419. }).catch(function (error) {
  420. console.log(error);
  421. });
  422. },
  423. getAdminUser() {
  424. axios.post("/hotel.php/auth/admin/getList", this.search).then((response) => {
  425. this.userList = response.data.list;
  426. }).catch(function (error) {
  427. console.log(error);
  428. });
  429. },
  430. edit(info) {
  431. if (info == null) {
  432. this.editType = false;
  433. this.editData = {
  434. name: ""
  435. }
  436. } else {
  437. this.editType = true;
  438. this.editData = {
  439. id:info.id,
  440. name: info.name,
  441. status:info.status
  442. }
  443. }
  444. this.editShow = true;
  445. },
  446. editDoing(){
  447. axios.post("/hotel.php/receipt_order/save", this.editData).then( (response)=> {
  448. let data = response.data;
  449. console.log(this.tableData);
  450. if (data.flag) {
  451. this.$message({
  452. message: '保存成功!',
  453. type: 'success'
  454. });
  455. this.editShow = false;
  456. this.getData(1);
  457. } else {
  458. this.$message.error(data.msg);
  459. }
  460. }).catch(function (error) {
  461. this.$message.error("保存失败");
  462. console.log(error);
  463. });
  464. },
  465. setStatus(info){
  466. this.$confirm('确定修改状态?', '提示', {
  467. confirmButtonText: '确定',
  468. cancelButtonText: '取消',
  469. type: 'warning'
  470. }).then(() => {
  471. axios.post("/hotel.php/receipt_order/setStatus", info).then( (response)=> {
  472. let data = response.data;
  473. if (data.flag) {
  474. this.$message({
  475. message: '设置成功!',
  476. type: 'success'
  477. });
  478. } else {
  479. this.$message.error(data.msg);
  480. this.getData(this.search.pageNum)
  481. }
  482. }).catch(function (error) {
  483. this.$message.error("保存失败");
  484. console.log(error);
  485. this.getData(this.search.pageNum)
  486. });
  487. }).catch(() => {
  488. this.$message({
  489. type: 'info',
  490. message: '已取消'
  491. });
  492. this.getData(this.search.pageNum)
  493. })
  494. },
  495. editOrderDivShow(info){
  496. console.log(info);
  497. this.editOrder = info;
  498. this.orderMainListSearch.receipt_order_id = info.id;
  499. this.orderMainList=[];
  500. this.getOrderMainData(1);
  501. this.editOrderShow = true;
  502. },
  503. getOrderMainData(page){
  504. this.orderMainListSearch.pageNum = page;
  505. axios.post("/hotel.php/receipt_order/getOrderMainList", this.orderMainListSearch).then((response) => {
  506. let data = response.data;
  507. console.log(this.tableData);
  508. if (data.flag) {
  509. this.orderMainList = data.data.list;
  510. this.orderMainTotal = data.data.total;
  511. console.log(this.orderMainList);
  512. } else {
  513. this.$message.error(data.msg);
  514. }
  515. }).catch(function (error) {
  516. console.log(error);
  517. });
  518. },
  519. addOrderMain(order_id){
  520. let param = {
  521. order_id:order_id,
  522. id:this.editOrder.id
  523. }
  524. axios.post("/hotel.php/receipt_order/addOrderMain", param).then((response) => {
  525. let data = response.data;
  526. if (data.flag) {
  527. this.$message({
  528. message: '添加成功!',
  529. type: 'success'
  530. });
  531. this.getOrderMainData(this.orderMainListSearch.pageNum)
  532. this.getData(this.search.pageNum)
  533. } else {
  534. this.$message.error(data.msg);
  535. }
  536. }).catch(function (error) {
  537. console.log(error);
  538. });
  539. },
  540. addOrderAll(){
  541. let orderId = "";
  542. let length = this.multipleSelection.length;
  543. for (var k = 0; k < length; k++) {
  544. if (orderId == "") {
  545. orderId = this.multipleSelection[k].id;
  546. continue;
  547. }
  548. orderId =orderId+","+this.multipleSelection[k].id;
  549. }
  550. this.addOrderMain(orderId);
  551. },
  552. removeOrderMain(order_id){
  553. let param = {
  554. order_id:order_id,
  555. id:this.editOrder.id
  556. }
  557. axios.post("/hotel.php/receipt_order/removeOrderMain", param).then((response) => {
  558. let data = response.data;
  559. if (data.flag) {
  560. this.$message({
  561. message: '移除成功!',
  562. type: 'success'
  563. });
  564. this.getOrderMainData(this.orderMainListSearch.pageNum)
  565. this.getData(this.search.pageNum)
  566. } else {
  567. this.$message.error(data.msg);
  568. }
  569. }).catch(function (error) {
  570. console.log(error);
  571. });
  572. },
  573. delAll(id){
  574. let param = {
  575. id:id
  576. }
  577. this.$confirm('确定删除采购单?', '提示', {
  578. confirmButtonText: '确定',
  579. cancelButtonText: '取消',
  580. type: 'warning'
  581. }).then(() => {
  582. axios.post("/hotel.php/receipt_order/delAll", param).then((response) => {
  583. let data = response.data;
  584. if (data.flag) {
  585. this.$message({
  586. message: '移除成功!',
  587. type: 'success'
  588. });
  589. this.getData(this.search.pageNum)
  590. } else {
  591. this.$message.error(data.msg);
  592. }
  593. }).catch(function (error) {
  594. console.log(error);
  595. });
  596. }).catch(() => {
  597. this.$message({
  598. type: 'info',
  599. message: '已取消'
  600. });
  601. });
  602. }
  603. }
  604. })
  605. </script>
  606. <style lang="scss" scoped>
  607. .el-table thead {
  608. background-color: #5a5e66 !important;
  609. }
  610. .header-search {
  611. font-size: 14px;
  612. font-weight: 900;
  613. }
  614. body {
  615. background-color: white;
  616. }
  617. .table {
  618. width: 100%;
  619. font-size: 12px;
  620. margin-top: 12px;
  621. background-color: white;
  622. }
  623. .el-form-item{
  624. margin-bottom: 5px !important;
  625. }
  626. </style>
  627. </html>